This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
embed.fnc: fix comment
[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. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated using [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_acosh=''
376 d_aintl=''
377 d_alarm=''
378 asctime_r_proto=''
379 d_asctime_r=''
380 d_attribute_deprecated=''
381 d_attribute_format=''
382 d_attribute_malloc=''
383 d_attribute_nonnull=''
384 d_attribute_noreturn=''
385 d_attribute_pure=''
386 d_attribute_unused=''
387 d_attribute_warn_unused_result=''
388 d_printf_format_null=''
389 d_backtrace=''
390 d_bcmp=''
391 d_bcopy=''
392 d_builtin_choose_expr=''
393 d_builtin_expect=''
394 d_bzero=''
395 d_c99_variadic_macros=''
396 d_casti32=''
397 castflags=''
398 d_castneg=''
399 d_chown=''
400 d_chroot=''
401 d_chsize=''
402 d_class=''
403 d_clearenv=''
404 d_closedir=''
405 d_void_closedir=''
406 d_cmsghdr_s=''
407 d_const=''
408 d_copysignl=''
409 d_cplusplus=''
410 cryptlib=''
411 d_crypt=''
412 crypt_r_proto=''
413 d_crypt_r=''
414 d_csh=''
415 full_csh=''
416 d_ctermid=''
417 ctermid_r_proto=''
418 d_ctermid_r=''
419 ctime_r_proto=''
420 d_ctime_r=''
421 d_cuserid=''
422 d_dbl_dig=''
423 d_dbminitproto=''
424 d_difftime=''
425 d_dir_dd_fd=''
426 d_dirfd=''
427 d_dladdr=''
428 d_dlerror=''
429 d_dlopen=''
430 d_dlsymun=''
431 d_dosuid=''
432 d_suidsafe=''
433 d_drand48_r=''
434 drand48_r_proto=''
435 d_drand48proto=''
436 d_dup2=''
437 d_eaccess=''
438 d_endgrent=''
439 d_endgrent_r=''
440 endgrent_r_proto=''
441 d_endhent=''
442 d_endhostent_r=''
443 endhostent_r_proto=''
444 d_endnent=''
445 d_endnetent_r=''
446 endnetent_r_proto=''
447 d_endpent=''
448 d_endprotoent_r=''
449 endprotoent_r_proto=''
450 d_endpwent=''
451 d_endpwent_r=''
452 endpwent_r_proto=''
453 d_endsent=''
454 d_endservent_r=''
455 endservent_r_proto=''
456 d_faststdio=''
457 d_fchdir=''
458 d_fchmod=''
459 d_fchown=''
460 d_fcntl=''
461 d_fcntl_can_lock=''
462 d_fd_macros=''
463 d_fd_set=''
464 d_fds_bits=''
465 d_fegetround=''
466 d_fgetpos=''
467 d_finite=''
468 d_finitel=''
469 d_flexfnam=''
470 d_flock=''
471 d_flockproto=''
472 d_fork=''
473 d_fp_class=''
474 d_fp_classify=''
475 d_fp_classl=''
476 d_fpclass=''
477 d_fpclassify=''
478 d_fpclassl=''
479 d_fpgetround=''
480 d_fpos64_t=''
481 d_frexpl=''
482 d_fs_data_s=''
483 d_fseeko=''
484 d_fsetpos=''
485 d_fstatfs=''
486 d_fsync=''
487 d_ftello=''
488 d_ftime=''
489 d_gettimeod=''
490 d_futimes=''
491 d_Gconvert=''
492 d_getaddrinfo=''
493 d_getcwd=''
494 d_getespwnam=''
495 d_getfsstat=''
496 d_getgrent=''
497 d_getgrent_r=''
498 getgrent_r_proto=''
499 d_getgrgid_r=''
500 getgrgid_r_proto=''
501 d_getgrnam_r=''
502 getgrnam_r_proto=''
503 d_getgrps=''
504 d_gethbyaddr=''
505 d_gethbyname=''
506 d_gethent=''
507 aphostname=''
508 d_gethname=''
509 d_phostname=''
510 d_uname=''
511 d_gethostbyaddr_r=''
512 gethostbyaddr_r_proto=''
513 d_gethostbyname_r=''
514 gethostbyname_r_proto=''
515 d_gethostent_r=''
516 gethostent_r_proto=''
517 d_gethostprotos=''
518 d_getitimer=''
519 d_getlogin=''
520 d_getlogin_r=''
521 getlogin_r_proto=''
522 d_getmnt=''
523 d_getmntent=''
524 d_getnameinfo=''
525 d_getnbyaddr=''
526 d_getnbyname=''
527 d_getnent=''
528 d_getnetbyaddr_r=''
529 getnetbyaddr_r_proto=''
530 d_getnetbyname_r=''
531 getnetbyname_r_proto=''
532 d_getnetent_r=''
533 getnetent_r_proto=''
534 d_getnetprotos=''
535 d_getpagsz=''
536 d_getpent=''
537 d_getpgid=''
538 d_getpgrp2=''
539 d_bsdgetpgrp=''
540 d_getpgrp=''
541 d_getppid=''
542 d_getprior=''
543 d_getpbyname=''
544 d_getpbynumber=''
545 d_getprotobyname_r=''
546 getprotobyname_r_proto=''
547 d_getprotobynumber_r=''
548 getprotobynumber_r_proto=''
549 d_getprotoent_r=''
550 getprotoent_r_proto=''
551 d_getprotoprotos=''
552 d_getprpwnam=''
553 d_getpwent=''
554 d_getpwent_r=''
555 getpwent_r_proto=''
556 d_getpwnam_r=''
557 getpwnam_r_proto=''
558 d_getpwuid_r=''
559 getpwuid_r_proto=''
560 d_getsent=''
561 d_getservbyname_r=''
562 getservbyname_r_proto=''
563 d_getservbyport_r=''
564 getservbyport_r_proto=''
565 d_getservent_r=''
566 getservent_r_proto=''
567 d_getservprotos=''
568 d_getspnam=''
569 d_getspnam_r=''
570 getspnam_r_proto=''
571 d_getsbyname=''
572 d_getsbyport=''
573 d_gmtime_r=''
574 gmtime_r_proto=''
575 d_gnulibc=''
576 gnulibc_version=''
577 d_hasmntopt=''
578 d_htonl=''
579 d_ilogbl=''
580 d_inetaton=''
581 d_inetntop=''
582 d_inetpton=''
583 d_int64_t=''
584 d_isascii=''
585 d_isblank=''
586 d_isfinite=''
587 d_isfinitel=''
588 d_isinf=''
589 d_isinfl=''
590 d_isnan=''
591 d_isnanl=''
592 d_j0=''
593 d_j0l=''
594 d_killpg=''
595 d_lchown=''
596 d_ldbl_dig=''
597 d_libm_lib_version=''
598 d_link=''
599 d_localtime_r=''
600 d_localtime_r_needs_tzset=''
601 localtime_r_proto=''
602 d_locconv=''
603 d_lockf=''
604 d_ldexpl=''
605 d_longdbl=''
606 longdblkind=''
607 longdblsize=''
608 d_longlong=''
609 longlongsize=''
610 d_lseekproto=''
611 d_lstat=''
612 d_madvise=''
613 d_malloc_good_size=''
614 d_malloc_size=''
615 d_mblen=''
616 d_mbstowcs=''
617 d_mbtowc=''
618 d_memchr=''
619 d_memcmp=''
620 d_memcpy=''
621 d_memmove=''
622 d_memset=''
623 d_mkdir=''
624 d_mkdtemp=''
625 d_mkfifo=''
626 d_mkstemp=''
627 d_mkstemps=''
628 d_mktime=''
629 d_mmap=''
630 mmaptype=''
631 d_modfl=''
632 d_modfl_pow32_bug=''
633 d_modflproto=''
634 d_mprotect=''
635 d_msg=''
636 d_msgctl=''
637 d_msgget=''
638 d_msghdr_s=''
639 d_msgrcv=''
640 d_msgsnd=''
641 d_msync=''
642 d_munmap=''
643 d_nice=''
644 d_nl_langinfo=''
645 d_off64_t=''
646 d_open3=''
647 d_fpathconf=''
648 d_pathconf=''
649 d_pause=''
650 d_pipe=''
651 d_poll=''
652 d_portable=''
653 d_prctl=''
654 d_prctl_set_name=''
655 d_procselfexe=''
656 procselfexe=''
657 d_old_pthread_create_joinable=''
658 old_pthread_create_joinable=''
659 d_pthread_atfork=''
660 d_pthread_attr_setscope=''
661 d_pthread_yield=''
662 d_sched_yield=''
663 sched_yield=''
664 d_ptrdiff_t=''
665 d_qgcvt=''
666 d_random_r=''
667 random_r_proto=''
668 d_readdir64_r=''
669 readdir64_r_proto=''
670 d_readdir=''
671 d_rewinddir=''
672 d_seekdir=''
673 d_telldir=''
674 d_readdir_r=''
675 readdir_r_proto=''
676 d_readlink=''
677 d_readv=''
678 d_recvmsg=''
679 d_rename=''
680 d_rmdir=''
681 d_safebcpy=''
682 d_safemcpy=''
683 d_sanemcmp=''
684 d_sbrkproto=''
685 d_scalbnl=''
686 d_select=''
687 d_sem=''
688 d_semctl=''
689 d_semget=''
690 d_semop=''
691 d_sendmsg=''
692 d_setegid=''
693 d_seteuid=''
694 d_setgrent=''
695 d_setgrent_r=''
696 setgrent_r_proto=''
697 d_setgrps=''
698 d_sethent=''
699 d_sethostent_r=''
700 sethostent_r_proto=''
701 d_setitimer=''
702 d_setlinebuf=''
703 d_setlocale=''
704 d_setlocale_r=''
705 setlocale_r_proto=''
706 d_setnent=''
707 d_setnetent_r=''
708 setnetent_r_proto=''
709 d_setpent=''
710 d_setpgid=''
711 d_setpgrp2=''
712 d_bsdsetpgrp=''
713 d_setpgrp=''
714 d_setprior=''
715 d_setproctitle=''
716 d_setprotoent_r=''
717 setprotoent_r_proto=''
718 d_setpwent=''
719 d_setpwent_r=''
720 setpwent_r_proto=''
721 d_setregid=''
722 d_setresgid=''
723 d_setresuid=''
724 d_setreuid=''
725 d_setrgid=''
726 d_setruid=''
727 d_setsent=''
728 d_setservent_r=''
729 setservent_r_proto=''
730 d_setsid=''
731 d_setvbuf=''
732 d_shm=''
733 d_shmat=''
734 d_shmatprototype=''
735 shmattype=''
736 d_shmctl=''
737 d_shmdt=''
738 d_shmget=''
739 d_sigaction=''
740 d_signbit=''
741 d_sigprocmask=''
742 d_sigsetjmp=''
743 usesitecustomize=''
744 d_snprintf=''
745 d_vsnprintf=''
746 d_sockatmark=''
747 d_sockatmarkproto=''
748 d_ip_mreq=''
749 d_ip_mreq_source=''
750 d_ipv6_mreq=''
751 d_ipv6_mreq_source=''
752 d_msg_ctrunc=''
753 d_msg_dontroute=''
754 d_msg_oob=''
755 d_msg_peek=''
756 d_msg_proxy=''
757 d_oldsock=''
758 d_scm_rights=''
759 d_sin6_scope_id=''
760 d_sockaddr_in6=''
761 d_sockaddr_sa_len=''
762 d_socket=''
763 d_sockpair=''
764 sockethdr=''
765 socketlib=''
766 d_socklen_t=''
767 d_socks5_init=''
768 d_sprintf_returns_strlen=''
769 d_sqrtl=''
770 d_srand48_r=''
771 srand48_r_proto=''
772 d_srandom_r=''
773 srandom_r_proto=''
774 d_sresgproto=''
775 d_sresuproto=''
776 d_statblks=''
777 d_statfs_f_flags=''
778 d_statfs_s=''
779 d_static_inline=''
780 perl_static_inline=''
781 d_fstatvfs=''
782 d_statvfs=''
783 d_stdio_cnt_lval=''
784 d_stdio_ptr_lval=''
785 d_stdio_ptr_lval_nochange_cnt=''
786 d_stdio_ptr_lval_sets_cnt=''
787 d_stdiobase=''
788 d_stdstdio=''
789 stdio_base=''
790 stdio_bufsiz=''
791 stdio_cnt=''
792 stdio_filbuf=''
793 stdio_ptr=''
794 d_index=''
795 d_strchr=''
796 d_strcoll=''
797 d_strctcpy=''
798 d_strerrm=''
799 d_strerror=''
800 d_sysernlst=''
801 d_syserrlst=''
802 d_strerror_r=''
803 strerror_r_proto=''
804 d_strftime=''
805 d_strlcat=''
806 d_strlcpy=''
807 d_strtod=''
808 d_strtol=''
809 d_strtold=''
810 d_strtoll=''
811 d_strtoq=''
812 d_strtoul=''
813 d_strtoull=''
814 d_strtouq=''
815 d_strxfrm=''
816 d_symlink=''
817 d_syscall=''
818 d_syscallproto=''
819 d_sysconf=''
820 d_system=''
821 d_tcgetpgrp=''
822 d_tcsetpgrp=''
823 d_telldirproto=''
824 d_time=''
825 timetype=''
826 d_asctime64=''
827 d_ctime64=''
828 d_difftime64=''
829 d_gmtime64=''
830 d_localtime64=''
831 d_mktime64=''
832 d_timegm=''
833 clocktype=''
834 d_times=''
835 d_tmpnam_r=''
836 tmpnam_r_proto=''
837 d_truncate=''
838 d_ttyname_r=''
839 ttyname_r_proto=''
840 d_tzname=''
841 d_u32align=''
842 d_ualarm=''
843 d_umask=''
844 d_semctl_semid_ds=''
845 d_semctl_semun=''
846 d_union_semun=''
847 d_unordered=''
848 d_unsetenv=''
849 d_usleep=''
850 d_usleepproto=''
851 d_ustat=''
852 d_pseudofork=''
853 d_vfork=''
854 usevfork=''
855 d_voidsig=''
856 signal_t=''
857 d_volatile=''
858 d_charvspr=''
859 d_vprintf=''
860 d_wait4=''
861 d_waitpid=''
862 d_wcscmp=''
863 d_wcstombs=''
864 d_wcsxfrm=''
865 d_wctomb=''
866 d_writev=''
867 dlext=''
868 bin_ELF=''
869 cccdlflags=''
870 ccdlflags=''
871 dlsrc=''
872 ld=''
873 ld_can_script=''
874 lddlflags=''
875 usedl=''
876 doublesize=''
877 ebcdic=''
878 fflushNULL=''
879 fflushall=''
880 fpossize=''
881 fpostype=''
882 gccansipedantic=''
883 gccosandvers=''
884 gccversion=''
885 gidformat=''
886 gidsign=''
887 gidsize=''
888 gidtype=''
889 groupstype=''
890 h_fcntl=''
891 h_sysfile=''
892 html1dir=''
893 html1direxp=''
894 installhtml1dir=''
895 html3dir=''
896 html3direxp=''
897 installhtml3dir=''
898 i_arpainet=''
899 i_assert=''
900 i_bfd=''
901 i_crypt=''
902 db_hashtype=''
903 db_prefixtype=''
904 db_version_major=''
905 db_version_minor=''
906 db_version_patch=''
907 i_db=''
908 i_dbm=''
909 i_rpcsvcdbm=''
910 d_dirnamlen=''
911 direntrytype=''
912 i_dirent=''
913 i_dlfcn=''
914 i_execinfo=''
915 i_fcntl=''
916 i_fenv=''
917 i_float=''
918 i_fp=''
919 i_fp_class=''
920 i_gdbm=''
921 d_grpasswd=''
922 i_grp=''
923 i_ieeefp=''
924 i_inttypes=''
925 i_langinfo=''
926 i_libutil=''
927 i_limits=''
928 i_locale=''
929 i_machcthr=''
930 i_malloc=''
931 i_mallocmalloc=''
932 i_math=''
933 i_memory=''
934 i_mntent=''
935 d_gdbm_ndbm_h_uses_prototypes=''
936 d_gdbmndbm_h_uses_prototypes=''
937 d_ndbm=''
938 d_ndbm_h_uses_prototypes=''
939 i_gdbm_ndbm=''
940 i_gdbmndbm=''
941 i_ndbm=''
942 i_netdb=''
943 i_neterrno=''
944 i_netinettcp=''
945 i_niin=''
946 i_sysin=''
947 i_poll=''
948 i_prot=''
949 i_pthread=''
950 d_pwage=''
951 d_pwchange=''
952 d_pwclass=''
953 d_pwcomment=''
954 d_pwexpire=''
955 d_pwgecos=''
956 d_pwpasswd=''
957 d_pwquota=''
958 i_pwd=''
959 i_shadow=''
960 i_socks=''
961 i_stdbool=''
962 i_stddef=''
963 i_stdint=''
964 i_stdlib=''
965 i_string=''
966 strings=''
967 i_sunmath=''
968 i_sysaccess=''
969 i_sysdir=''
970 i_sysfile=''
971 d_voidtty=''
972 i_bsdioctl=''
973 i_sysfilio=''
974 i_sysioctl=''
975 i_syssockio=''
976 i_syslog=''
977 i_sysmman=''
978 i_sysmode=''
979 i_sysmount=''
980 i_sysndir=''
981 i_sysparam=''
982 i_syspoll=''
983 i_sysresrc=''
984 i_syssecrt=''
985 i_sysselct=''
986 i_sysstat=''
987 i_sysstatfs=''
988 i_sysstatvfs=''
989 i_systimes=''
990 i_systypes=''
991 i_sysuio=''
992 i_sysun=''
993 i_sysutsname=''
994 i_sysvfs=''
995 i_syswait=''
996 i_sgtty=''
997 i_termio=''
998 i_termios=''
999 d_tm_tm_gmtoff=''
1000 d_tm_tm_zone=''
1001 i_systime=''
1002 i_systimek=''
1003 i_time=''
1004 timeincl=''
1005 i_unistd=''
1006 i_ustat=''
1007 i_utime=''
1008 i_values=''
1009 i_stdarg=''
1010 i_varargs=''
1011 i_varhdr=''
1012 i_vfork=''
1013 d_inc_version_list=''
1014 inc_version_list=''
1015 inc_version_list_init=''
1016 installprefix=''
1017 installprefixexp=''
1018 installstyle=''
1019 installusrbinperl=''
1020 intsize=''
1021 longsize=''
1022 shortsize=''
1023 issymlink=''
1024 libc=''
1025 ldlibpthname=''
1026 libperl=''
1027 shrpenv=''
1028 useshrplib=''
1029 glibpth=''
1030 incpth=''
1031 libpth=''
1032 loclibpth=''
1033 plibpth=''
1034 xlibpth=''
1035 ignore_versioned_solibs=''
1036 libs=''
1037 libsdirs=''
1038 libsfiles=''
1039 libsfound=''
1040 libspath=''
1041 lns=''
1042 d_PRIEUldbl=''
1043 d_PRIFUldbl=''
1044 d_PRIGUldbl=''
1045 d_PRIeldbl=''
1046 d_PRIfldbl=''
1047 d_PRIgldbl=''
1048 d_SCNfldbl=''
1049 sPRIEUldbl=''
1050 sPRIFUldbl=''
1051 sPRIGUldbl=''
1052 sPRIeldbl=''
1053 sPRIfldbl=''
1054 sPRIgldbl=''
1055 sSCNfldbl=''
1056 lseeksize=''
1057 lseektype=''
1058 make_set_make=''
1059 d_mymalloc=''
1060 freetype=''
1061 mallocobj=''
1062 mallocsrc=''
1063 malloctype=''
1064 usemallocwrap=''
1065 usemymalloc=''
1066 installman1dir=''
1067 man1dir=''
1068 man1direxp=''
1069 man1ext=''
1070 installman3dir=''
1071 man3dir=''
1072 man3direxp=''
1073 man3ext=''
1074 modetype=''
1075 multiarch=''
1076 mydomain=''
1077 myhostname=''
1078 phostname=''
1079 c=''
1080 n=''
1081 d_eofnblk=''
1082 eagain=''
1083 o_nonblock=''
1084 rd_nodata=''
1085 need_va_copy=''
1086 netdb_hlen_type=''
1087 netdb_host_type=''
1088 netdb_name_type=''
1089 netdb_net_type=''
1090 groupcat=''
1091 hostcat=''
1092 passcat=''
1093 orderlib=''
1094 ranlib=''
1095 d_perl_otherlibdirs=''
1096 otherlibdirs=''
1097 package=''
1098 spackage=''
1099 pager=''
1100 api_revision=''
1101 api_subversion=''
1102 api_version=''
1103 api_versionstring=''
1104 patchlevel=''
1105 perl_patchlevel=''
1106 revision=''
1107 subversion=''
1108 version=''
1109 version_patchlevel_string=''
1110 perl5=''
1111 perladmin=''
1112 perlpath=''
1113 d_nv_preserves_uv=''
1114 d_nv_zero_is_allbits_zero=''
1115 i16size=''
1116 i16type=''
1117 i32size=''
1118 i32type=''
1119 i64size=''
1120 i64type=''
1121 i8size=''
1122 i8type=''
1123 ivsize=''
1124 ivtype=''
1125 nv_overflows_integers_at=''
1126 nv_preserves_uv_bits=''
1127 nvsize=''
1128 nvtype=''
1129 u16size=''
1130 u16type=''
1131 u32size=''
1132 u32type=''
1133 u64size=''
1134 u64type=''
1135 u8size=''
1136 u8type=''
1137 uvsize=''
1138 uvtype=''
1139 ivdformat=''
1140 nvEUformat=''
1141 nvFUformat=''
1142 nvGUformat=''
1143 nveformat=''
1144 nvfformat=''
1145 nvgformat=''
1146 uvXUformat=''
1147 uvoformat=''
1148 uvuformat=''
1149 uvxformat=''
1150 pidtype=''
1151 prefix=''
1152 prefixexp=''
1153 installprivlib=''
1154 privlib=''
1155 privlibexp=''
1156 prototype=''
1157 ptrsize=''
1158 d_PRIXU64=''
1159 d_PRId64=''
1160 d_PRIi64=''
1161 d_PRIo64=''
1162 d_PRIu64=''
1163 d_PRIx64=''
1164 sPRIXU64=''
1165 sPRId64=''
1166 sPRIi64=''
1167 sPRIo64=''
1168 sPRIu64=''
1169 sPRIx64=''
1170 d_quad=''
1171 quadkind=''
1172 quadtype=''
1173 uquadtype=''
1174 drand01=''
1175 randbits=''
1176 randfunc=''
1177 randseedtype=''
1178 seedfunc=''
1179 installscript=''
1180 scriptdir=''
1181 scriptdirexp=''
1182 selectminbits=''
1183 selecttype=''
1184 sh=''
1185 targetsh=''
1186 sig_count=''
1187 sig_name=''
1188 sig_name_init=''
1189 sig_num=''
1190 sig_num_init=''
1191 sig_size=''
1192 d_sitearch=''
1193 installsitearch=''
1194 sitearch=''
1195 sitearchexp=''
1196 installsitebin=''
1197 sitebin=''
1198 sitebinexp=''
1199 installsitehtml1dir=''
1200 sitehtml1dir=''
1201 sitehtml1direxp=''
1202 installsitehtml3dir=''
1203 sitehtml3dir=''
1204 sitehtml3direxp=''
1205 installsitelib=''
1206 sitelib=''
1207 sitelib_stem=''
1208 sitelibexp=''
1209 installsiteman1dir=''
1210 siteman1dir=''
1211 siteman1direxp=''
1212 installsiteman3dir=''
1213 siteman3dir=''
1214 siteman3direxp=''
1215 siteprefix=''
1216 siteprefixexp=''
1217 installsitescript=''
1218 sitescript=''
1219 sitescriptexp=''
1220 sizesize=''
1221 sizetype=''
1222 d_libname_unique=''
1223 so=''
1224 socksizetype=''
1225 sharpbang=''
1226 shsharp=''
1227 spitshell=''
1228 src=''
1229 ssizetype=''
1230 st_ino_sign=''
1231 st_ino_size=''
1232 startperl=''
1233 startsh=''
1234 stdchar=''
1235 d_stdio_stream_array=''
1236 stdio_stream_array=''
1237 sysman=''
1238 sGMTIME_max=''
1239 sGMTIME_min=''
1240 sLOCALTIME_max=''
1241 sLOCALTIME_min=''
1242 trnl=''
1243 uidformat=''
1244 uidsign=''
1245 uidsize=''
1246 uidtype=''
1247 archname64=''
1248 use64bitall=''
1249 use64bitint=''
1250 usecbacktrace=''
1251 dtrace=''
1252 usedtrace=''
1253 usefaststdio=''
1254 usekernprocpathname=''
1255 ccflags_uselargefiles=''
1256 ldflags_uselargefiles=''
1257 libswanted_uselargefiles=''
1258 uselargefiles=''
1259 uselongdouble=''
1260 usemorebits=''
1261 usemultiplicity=''
1262 nm_opt=''
1263 nm_so_opt=''
1264 runnm=''
1265 usenm=''
1266 usensgetexecutablepath=''
1267 useperlio=''
1268 usesocks=''
1269 d_oldpthreads=''
1270 use5005threads=''
1271 useithreads=''
1272 usereentrant=''
1273 usethreads=''
1274 incpath=''
1275 mips_type=''
1276 usrinc=''
1277 vaproto=''
1278 d_vendorarch=''
1279 installvendorarch=''
1280 vendorarch=''
1281 vendorarchexp=''
1282 d_vendorbin=''
1283 installvendorbin=''
1284 vendorbin=''
1285 vendorbinexp=''
1286 installvendorhtml1dir=''
1287 vendorhtml1dir=''
1288 vendorhtml1direxp=''
1289 installvendorhtml3dir=''
1290 vendorhtml3dir=''
1291 vendorhtml3direxp=''
1292 d_vendorlib=''
1293 installvendorlib=''
1294 vendorlib=''
1295 vendorlib_stem=''
1296 vendorlibexp=''
1297 installvendorman1dir=''
1298 vendorman1dir=''
1299 vendorman1direxp=''
1300 installvendorman3dir=''
1301 vendorman3dir=''
1302 vendorman3direxp=''
1303 usevendorprefix=''
1304 vendorprefix=''
1305 vendorprefixexp=''
1306 d_vendorscript=''
1307 installvendorscript=''
1308 vendorscript=''
1309 vendorscriptexp=''
1310 versiononly=''
1311 yacc=''
1312 yaccflags=''
1313 CONFIG=''
1314
1315 : Detect odd OSs
1316 define='define'
1317 undef='undef'
1318 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1319 rmlist=''
1320
1321 : We must find out about Eunice early
1322 eunicefix=':'
1323 if test -f /etc/unixtovms; then
1324         eunicefix=/etc/unixtovms
1325 fi
1326 if test -f /etc/unixtovms.exe; then
1327         eunicefix=/etc/unixtovms.exe
1328 fi
1329
1330 : Set executable suffix now -- needed before hints available
1331 if test -f "/libs/version.library"; then
1332 : Amiga OS
1333     _exe=""
1334 elif test -f "/system/gnu_library/bin/ar.pm"; then
1335 : Stratus VOS
1336     _exe=".pm"
1337 elif test -n "$DJGPP"; then
1338 : DOS DJGPP
1339     _exe=".exe"
1340 elif test -f /kern/cookiejar; then
1341 : MiNT
1342     _exe=""
1343 elif test -d c:/. -o -n "$is_os2" ; then
1344 : OS/2 or cygwin
1345     _exe=".exe"
1346 fi
1347
1348 groupstype=''
1349 i_whoami=''
1350 : Trailing extension.  Override this in a hint file, if needed.
1351 : Extra object files, if any, needed on this platform.
1352 archobjs=''
1353 archname=''
1354 : Possible local include directories to search.
1355 : Set locincpth to "" in a hint file to defeat local include searches.
1356 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1357 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1358 :
1359 : no include file wanted by default
1360 inclwanted=''
1361
1362 : Enable -DEBUGGING and -DDEBUGGING from the command line
1363 EBUGGING=''
1364 DEBUGGING=''
1365
1366 libnames=''
1367 : change the next line if compiling for Xenix/286 on Xenix/386
1368 xlibpth='/usr/lib/386 /lib/386'
1369 : Possible local library directories to search.
1370 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1371 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1372
1373 : general looking path for locating libraries
1374 glibpth="/lib /usr/lib $xlibpth"
1375 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1376 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1377 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1378 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1379
1380 : Private path used by Configure to find libraries.  Its value
1381 : is prepended to libpth. This variable takes care of special
1382 : machines, like the mips.  Usually, it should be empty.
1383 plibpth=''
1384
1385 : default library list
1386 libswanted=''
1387 : some systems want to use only the non-versioned libso:s
1388 ignore_versioned_solibs=''
1389 : set usethreads on the Configure command line to enable threads.
1390 usereentrant='undef'
1391 ccname=''
1392 ccversion=''
1393 perllibs=''
1394 : set useposix=false in your hint file to disable the POSIX extension.
1395 useposix=true
1396 : set useopcode=false in your hint file to disable the Opcode extension.
1397 useopcode=true
1398 archname64=''
1399 ccflags_uselargefiles=''
1400 ldflags_uselargefiles=''
1401 libswanted_uselargefiles=''
1402 : set usemultiplicity on the Configure command line to enable multiplicity.
1403 : set usesocks on the Configure command line to enable socks.
1404 : List of libraries we want.
1405 : If anyone needs extra -lxxx, put those in a hint file.
1406 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1407 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1408 : We probably want to search /usr/shlib before most other libraries.
1409 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1410 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1411 glibpth="/usr/shlib $glibpth"
1412 : Do not use vfork unless overridden by a hint file.
1413 usevfork=false
1414
1415 : Find the basic shell for Bourne shell scripts
1416 case "$sh" in
1417 '')
1418         case "$SYSTYPE" in
1419         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1420         *) xxx='/bin/sh';;
1421         esac
1422         if test -f "$xxx"; then
1423                 sh="$xxx"
1424         else
1425                 : Build up a list and do a single loop so we can 'break' out.
1426                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1427                 for xxx in sh bash ksh pdksh ash; do
1428                         for p in $pth; do
1429                                 try="$try ${p}/${xxx}"
1430                         done
1431                 done
1432                 for xxx in $try; do
1433                         if test -f "$xxx"; then
1434                                 sh="$xxx";
1435                                 break
1436                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1437                                 sh="$xxx";
1438                                 break
1439                         elif test -f "$xxx.exe"; then
1440                                 sh="$xxx";
1441                                 break
1442                         fi
1443                 done
1444         fi
1445         ;;
1446 esac
1447
1448 case "$sh" in
1449 '')     cat >&2 <<EOM
1450 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1451
1452 Usually it's in /bin/sh.  How did you even get this far?
1453 Please contact me (Perl Maintainers) at perlbug@perl.org and
1454 we'll try to straighten this all out.
1455 EOM
1456         exit 1
1457         ;;
1458 esac
1459
1460 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1461 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1462 targetsh=$sh
1463
1464 : see if sh knows # comments
1465 if `$sh -c '#' >/dev/null 2>&1`; then
1466         shsharp=true
1467         spitshell=cat
1468         xcat=/bin/cat
1469         test -f $xcat$_exe || xcat=/usr/bin/cat
1470         if test ! -f $xcat$_exe; then
1471                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1472                         if test -f $p/cat$_exe; then
1473                                 xcat=$p/cat
1474                                 break
1475                         fi
1476                 done
1477                 if test ! -f $xcat$_exe; then
1478                         echo "Can't find cat anywhere!"
1479                         exit 1
1480                 fi
1481         fi
1482         echo "#!$xcat" >sharp
1483         $eunicefix sharp
1484         chmod +x sharp
1485         ./sharp > today 2>/dev/null
1486         if test -s today; then
1487                 sharpbang='#!'
1488         else
1489                 echo "#! $xcat" > sharp
1490                 $eunicefix sharp
1491                 chmod +x sharp
1492                 ./sharp > today 2>/dev/null
1493                 if test -s today; then
1494                         sharpbang='#! '
1495                 else
1496                         sharpbang=': use '
1497                 fi
1498         fi
1499 else
1500         echo " "
1501         echo "Your $sh doesn't grok # comments--I will strip them later on."
1502         shsharp=false
1503         cd ..
1504         echo "exec grep -v '^[  ]*#'" >spitshell
1505         chmod +x spitshell
1506         $eunicefix spitshell
1507         spitshell=`pwd`/spitshell
1508         cd UU
1509         echo "I presume that if # doesn't work, #! won't work either!"
1510         sharpbang=': use '
1511 fi
1512 rm -f sharp today
1513
1514 : figure out how to guarantee sh startup
1515 case "$startsh" in
1516 '') startsh=${sharpbang}${sh} ;;
1517 *)
1518 esac
1519 cat >sharp <<EOSS
1520 $startsh
1521 set abc
1522 test "$?abc" != 1
1523 EOSS
1524
1525 chmod +x sharp
1526 $eunicefix sharp
1527 if ./sharp; then
1528         : echo "Yup, it does."
1529 else
1530         echo "Hmm... '$startsh' does not guarantee sh startup..."
1531         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1532 fi
1533 rm -f sharp
1534
1535 : Save command line options in file UU/cmdline.opt for later use in
1536 : generating config.sh.
1537 cat > cmdline.opt <<EOSH
1538 : Configure command line arguments.
1539 config_arg0='$0'
1540 config_args='$*'
1541 config_argc=$#
1542 EOSH
1543 argn=1
1544 args_exp=''
1545 args_sep=''
1546 for arg in "$@"; do
1547         cat >>cmdline.opt <<EOSH
1548 config_arg$argn='$arg'
1549 EOSH
1550         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1551 $arg
1552 EOC
1553         arg_exp=`cat cmdl.opt`
1554         args_exp="$args_exp$args_sep'$arg_exp'"
1555         argn=`expr $argn + 1`
1556         args_sep=' '
1557 done
1558 rm -f cmdl.opt
1559
1560 : produce awk script to parse command line options
1561 cat >options.awk <<'EOF'
1562 BEGIN {
1563         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1564
1565         len = length(optstr);
1566         for (i = 1; i <= len; i++) {
1567                 c = substr(optstr, i, 1);
1568                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1569                 if (a == ":") {
1570                         arg[c] = 1;
1571                         i++;
1572                 }
1573                 opt[c] = 1;
1574         }
1575 }
1576 {
1577         expect = 0;
1578         str = $0;
1579         if (substr(str, 1, 1) != "-") {
1580                 printf("'%s'\n", str);
1581                 next;
1582         }
1583         len = length($0);
1584         for (i = 2; i <= len; i++) {
1585                 c = substr(str, i, 1);
1586                 if (!opt[c]) {
1587                         printf("-%s\n", substr(str, i));
1588                         next;
1589                 }
1590                 printf("-%s\n", c);
1591                 if (arg[c]) {
1592                         if (i < len)
1593                                 printf("'%s'\n", substr(str, i + 1));
1594                         else
1595                                 expect = 1;
1596                         next;
1597                 }
1598         }
1599 }
1600 END {
1601         if (expect)
1602                 print "?";
1603 }
1604 EOF
1605
1606 : process the command line options
1607 set X `for arg in "$@"; do echo "X$arg"; done |
1608         sed -e s/X// | awk -f options.awk`
1609 eval "set $*"
1610 shift
1611 rm -f options.awk
1612
1613 : set up default values
1614 fastread=''
1615 reuseval=false
1616 config_sh=''
1617 alldone=''
1618 error=''
1619 silent=''
1620 extractsh=''
1621 override=''
1622 knowitall=''
1623 rm -f optdef.sh posthint.sh
1624 cat >optdef.sh <<EOS
1625 $startsh
1626 EOS
1627
1628
1629 : option parsing
1630 while test $# -gt 0; do
1631         case "$1" in
1632         -d) shift; fastread=yes;;
1633         -e) shift; alldone=cont;;
1634         -f)
1635                 shift
1636                 cd ..
1637                 if test -r "$1"; then
1638                         config_sh="$1"
1639                 else
1640                         echo "$me: cannot read config file $1." >&2
1641                         error=true
1642                 fi
1643                 cd UU
1644                 shift;;
1645         --help|\
1646         -h) shift; error=true;;
1647         -r) shift; reuseval=true;;
1648         -s) shift; silent=true; realsilent=true;;
1649         -E) shift; alldone=exit;;
1650         -K) shift; knowitall=true;;
1651         -O) shift; override=true;;
1652         -S) shift; silent=true; extractsh=true;;
1653         -D)
1654                 shift
1655                 case "$1" in
1656                 *=)
1657                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1658                         echo "$me: ignoring -D $1" >&2
1659                         ;;
1660                 *=*) echo "$1" | \
1661                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1662                 *) echo "$1='define'" >> optdef.sh;;
1663                 esac
1664                 shift
1665                 ;;
1666         -U)
1667                 shift
1668                 case "$1" in
1669                 *=) echo "$1" >> optdef.sh;;
1670                 *=*)
1671                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1672                         echo "$me: ignoring -U $1" >&2
1673                         ;;
1674                 *) echo "$1='undef'" >> optdef.sh;;
1675                 esac
1676                 shift
1677                 ;;
1678         -A)
1679             shift
1680             xxx=''
1681             yyy="$1"
1682             zzz=''
1683             uuu=undef
1684             case "$yyy" in
1685             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1686                  case "$zzz" in
1687                  *:*) zzz='' ;;
1688                  *)   xxx=append
1689                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1690                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1691                  esac
1692                  ;;
1693             esac
1694             case "$xxx" in
1695             '')  case "$yyy" in
1696                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1697                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1698                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1699                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1700                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1701                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1702                  esac
1703                  ;;
1704             esac
1705             case "$xxx" in
1706             append)
1707                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1708             clear)
1709                 echo "$yyy=''"                  >> posthint.sh ;;
1710             define)
1711                 case "$zzz" in
1712                 '') zzz=define ;;
1713                 esac
1714                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1715             eval)
1716                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1717             prepend)
1718                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1719             undef)
1720                 case "$zzz" in
1721                 '') zzz="$uuu" ;;
1722                 esac
1723                 echo "$yyy=$zzz"                >> posthint.sh ;;
1724             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1725             esac
1726             shift
1727             ;;
1728         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1729             exit 0;;
1730         --) break;;
1731         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1732         *) break;;
1733         esac
1734 done
1735
1736 case "$error" in
1737 true)
1738         cat >&2 <<EOM
1739 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1740                  [-U symbol] [-U symbol=] [-A command:symbol...]
1741   -d : use defaults for all answers.
1742   -e : go on without questioning past the production of config.sh.
1743   -f : specify an alternate default configuration file.
1744   -h : print this help message and exit (with an error status).
1745   -r : reuse C symbols value if possible (skips costly nm extraction).
1746   -s : silent mode, only echoes questions and essential information.
1747   -D : define symbol to have some value:
1748          -D symbol         symbol gets the value 'define'
1749          -D symbol=value   symbol gets the value 'value'
1750        common used examples (see INSTALL for more info):
1751          -Duse64bitint            use 64bit integers
1752          -Duse64bitall            use 64bit integers and pointers
1753          -Dusethreads             use thread support
1754          -Dinc_version_list=none  do not include older perl trees in @INC
1755          -DEBUGGING=none          DEBUGGING options
1756          -Dcc=gcc                 choose your compiler
1757          -Dprefix=/opt/perl5      choose your destination
1758   -E : stop at the end of questions, after having produced config.sh.
1759   -K : do not use unless you know what you are doing.
1760   -O : let -D and -U override definitions from loaded configuration file.
1761   -S : perform variable substitutions on all .SH files (can mix with -f)
1762   -U : undefine symbol:
1763          -U symbol    symbol gets the value 'undef'
1764          -U symbol=   symbol gets completely empty
1765        e.g.:  -Uversiononly
1766   -A : manipulate symbol after the platform specific hints have been applied:
1767          -A append:symbol=value   append value to symbol
1768          -A symbol=value          like append:, but with a separating space
1769          -A define:symbol=value   define symbol to have value
1770          -A clear:symbol          define symbol to be ''
1771          -A define:symbol         define symbol to be 'define'
1772          -A eval:symbol=value     define symbol to be eval of value
1773          -A prepend:symbol=value  prepend value to symbol
1774          -A undef:symbol          define symbol to be 'undef'
1775          -A undef:symbol=         define symbol to be ''
1776        e.g.:  -A prepend:libswanted='cl pthread '
1777               -A ccflags=-DSOME_MACRO
1778   -V : print version number and exit (with a zero status).
1779 EOM
1780         exit 1
1781         ;;
1782 esac
1783
1784 : Sanity checks
1785 case "$fastread$alldone" in
1786 yescont|yesexit) ;;
1787 *)
1788         case "$extractsh" in
1789         true) ;;
1790         *)
1791                 if test ! -t 0; then
1792                         echo "Say 'sh Configure', not 'sh <Configure'"
1793                         exit 1
1794                 fi
1795                 ;;
1796         esac
1797         ;;
1798 esac
1799
1800 exec 4>&1
1801 case "$silent" in
1802 true) exec 1>/dev/null;;
1803 esac
1804
1805 : run the defines and the undefines, if any, but leave the file out there...
1806 touch optdef.sh
1807 . ./optdef.sh
1808 : create the posthint manipulation script and leave the file out there...
1809 touch posthint.sh
1810
1811 : set package name
1812 package='perl5'
1813 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1814 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1815 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1816 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1817 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1818 esac
1819
1820 : Some greps do not return status, grrr.
1821 echo "grimblepritz" >grimble
1822 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1823         contains=contains
1824 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1825         contains=grep
1826 else
1827         contains=contains
1828 fi
1829 rm -f grimble
1830 : the following should work in any shell
1831 case "$contains" in
1832 contains*)
1833         echo " "
1834         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1835         cat >contains <<'EOSS'
1836 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1837 EOSS
1838 chmod +x contains
1839 esac
1840
1841 : Find the path to the source tree
1842 case "$src" in
1843 '') case "$0" in
1844     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1845          case "$src" in
1846          /*)    ;;
1847          .)     ;;
1848          *)     src=`cd ../$src && pwd` ;;
1849          esac
1850          ;;
1851     *)   src='.';;
1852     esac;;
1853 esac
1854 case "$src" in
1855 '')     src=/
1856         rsrc=/
1857         ;;
1858 /*)     rsrc="$src";;
1859 *)      rsrc="../$src";;
1860 esac
1861 if test -f $rsrc/Configure && \
1862         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1863 then
1864    : found it, so we are ok.
1865 else
1866         rsrc=''
1867         for src in . .. ../.. ../../.. ../../../..; do
1868                 if test -f ../$src/Configure && \
1869                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1870                 then
1871                         rsrc=../$src
1872                         break
1873                 fi
1874         done
1875 fi
1876 case "$rsrc" in
1877 '')
1878         cat <<EOM >&4
1879
1880 Sorry, I can't seem to locate the source dir for $package.  Please start
1881 Configure with an explicit path -- i.e. /some/path/Configure.
1882
1883 EOM
1884         exit 1
1885         ;;
1886 ../.)   rsrc='..';;
1887 *)
1888         echo " "
1889         echo "Sources for $package found in \"$src\"." >&4
1890         ;;
1891 esac
1892
1893 : script used to extract .SH files with variable substitutions
1894 cat >extract <<'EOS'
1895 PERL_CONFIG_SH=true
1896 echo "Doing variable substitutions on .SH files..."
1897 if test -f MANIFEST; then
1898         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1899 else
1900         echo "(Looking for .SH files under the source directory.)"
1901         set x `(cd "$src"; find . -name "*.SH" -print)`
1902 fi
1903 shift
1904 case $# in
1905 0) set x `(cd "$src"; echo *.SH)`; shift;;
1906 esac
1907 if test ! -f "$src/$1"; then
1908         shift
1909 fi
1910 mkdir_p='
1911 name=$1;
1912 create="";
1913 while test $name; do
1914         if test ! -d "$name"; then
1915                 create="$name $create";
1916                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1917                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1918         else
1919                 name="";
1920         fi;
1921 done;
1922 for file in $create; do
1923         mkdir $file;
1924 done
1925 '
1926 for file in $*; do
1927         case "$src" in
1928         ".")
1929                 case "$file" in
1930                 */*)
1931                         dir=`expr X$file : 'X\(.*\)/'`
1932                         file=`expr X$file : 'X.*/\(.*\)'`
1933                         (cd "$dir" && . ./$file)
1934                         ;;
1935                 *)
1936                         . ./$file
1937                         ;;
1938                 esac
1939                 ;;
1940         *)
1941                 case "$file" in
1942                 */*)
1943                         dir=`expr X$file : 'X\(.*\)/'`
1944                         file=`expr X$file : 'X.*/\(.*\)'`
1945                         (set x $dir; shift; eval $mkdir_p)
1946                         sh <"$src/$dir/$file"
1947                         ;;
1948                 *)
1949                         sh <"$src/$file"
1950                         ;;
1951                 esac
1952                 ;;
1953         esac
1954 done
1955 if test -f "$src/config_h.SH"; then
1956         if test ! -f config.h; then
1957         : oops, they left it out of MANIFEST, probably, so do it anyway.
1958         . "$src/config_h.SH"
1959         fi
1960 fi
1961 EOS
1962
1963 : extract files and exit if asked to do so
1964 case "$extractsh" in
1965 true)
1966         case "$realsilent" in
1967         true) ;;
1968         *) exec 1>&4;;
1969         esac
1970         case "$config_sh" in
1971         '') config_sh='config.sh';;
1972         esac
1973         echo " "
1974         echo "Fetching answers from $config_sh..."
1975         cd ..
1976         . $config_sh
1977         test "$override" && . ./optdef.sh
1978         echo " "
1979         . UU/extract
1980         rm -rf UU
1981         echo "Extraction done."
1982         exit 0
1983         ;;
1984 esac
1985
1986 : Eunice requires " " instead of "", can you believe it
1987 echo " "
1988 : Here we go...
1989 echo "Beginning of configuration questions for $package."
1990
1991 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1992
1993 : first determine how to suppress newline on echo command
1994 echo " "
1995 echo "Checking echo to see how to suppress newlines..."
1996 (echo "hi there\c" ; echo " ") >.echotmp
1997 if $contains c .echotmp >/dev/null 2>&1 ; then
1998         echo "...using -n."
1999         n='-n'
2000         c=''
2001 else
2002         cat <<'EOM'
2003 ...using \c
2004 EOM
2005         n=''
2006         c='\c'
2007 fi
2008 echo $n "The star should be here-->$c"
2009 echo '*'
2010 rm -f .echotmp
2011
2012 : Now test for existence of everything in MANIFEST
2013 echo " "
2014 if test -f "$rsrc/MANIFEST"; then
2015         echo "First let's make sure your kit is complete.  Checking..." >&4
2016         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2017                 (split -l 50 2>/dev/null || split -50)
2018         rm -f missing
2019         tmppwd=`pwd`
2020         for filelist in x??; do
2021                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2022                         >/dev/null 2>>"$tmppwd/missing")
2023         done
2024         if test -s missing; then
2025                 cat missing >&4
2026                 cat >&4 <<'EOM'
2027
2028 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2029
2030 You have the option of continuing the configuration process, despite the
2031 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2032 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2033 and contact the author (perlbug@perl.org).
2034
2035 EOM
2036                 echo $n "Continue? [n] $c" >&4
2037                 read ans
2038                 case "$ans" in
2039                 y*)
2040                         echo "Continuing..." >&4
2041                         rm -f missing
2042                         ;;
2043                 *)
2044                         echo "ABORTING..." >&4
2045                         kill $$
2046                         ;;
2047                 esac
2048         else
2049                 echo "Looks good..."
2050         fi
2051 else
2052         echo "There is no MANIFEST file.  I hope your kit is complete !"
2053 fi
2054 rm -f missing x??
2055
2056 : Find the appropriate value for a newline for tr
2057 echo " "
2058 if test -n "$DJGPP"; then
2059        trnl='\012'
2060 fi
2061 if test X"$trnl" = X; then
2062         case "`echo foo|tr '\n' x 2>/dev/null`" in
2063         foox) trnl='\n' ;;
2064         esac
2065 fi
2066 if test X"$trnl" = X; then
2067         case "`echo foo|tr '\012' x 2>/dev/null`" in
2068         foox) trnl='\012' ;;
2069         esac
2070 fi
2071 if test X"$trnl" = X; then
2072        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2073        fooxy) trnl='\n\r' ;;
2074        esac
2075 fi
2076 if test X"$trnl" = X; then
2077         cat <<EOM >&2
2078
2079 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2080
2081 EOM
2082         exit 1
2083 fi
2084
2085 : compute the number of columns on the terminal for proper question formatting
2086 case "$COLUMNS" in
2087 '') COLUMNS='80';;
2088 esac
2089
2090 : set up the echo used in my read
2091 myecho="case \"\$xxxm\" in
2092 '') echo $n \"\$rp $c\" >&4;;
2093 *) case \"\$rp\" in
2094         '') echo $n \"[\$xxxm] $c\";;
2095         *)
2096                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2097                         echo \"\$rp\" >&4
2098                         echo $n \"[\$xxxm] $c\" >&4
2099                 else
2100                         echo $n \"\$rp [\$xxxm] $c\" >&4
2101                 fi
2102                 ;;
2103         esac;;
2104 esac"
2105
2106 : now set up to do reads with possible shell escape and default assignment
2107 cat <<EOSC >myread
2108 $startsh
2109 xxxm=\$dflt
2110 $myecho
2111 ans='!'
2112 case "\$fastread" in
2113 yes) case "\$dflt" in
2114         '') ;;
2115         *) ans='';
2116                 case "\$silent-\$rp" in
2117                 true-) ;;
2118                 *) echo " " >&4;;
2119                 esac;;
2120         esac;;
2121 *) case "\$silent" in
2122         true) case "\$rp" in
2123                 '') ans='';;
2124                 esac;;
2125         esac;;
2126 esac
2127 while expr "X\$ans" : "X!" >/dev/null; do
2128         read answ
2129         set x \$xxxm
2130         shift
2131         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2132         case  "\$answ" in
2133         "!")
2134                 sh 1>&4
2135                 echo " "
2136                 $myecho
2137                 ;;
2138         !*)
2139                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2140                 shift
2141                 sh 1>&4 -c "\$*"
2142                 echo " "
2143                 $myecho
2144                 ;;
2145         "\$ans")
2146                 case "\$ans" in
2147                 \\&*)
2148                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2149                         shift
2150                         case "\$1" in
2151                         -d)
2152                                 fastread=yes
2153                                 echo "(OK, I'll run with -d after this question.)" >&4
2154                                 ;;
2155                         -*)
2156                                 echo "*** Sorry, \$1 not supported yet." >&4
2157                                 ;;
2158                         esac
2159                         $myecho
2160                         ans=!
2161                         ;;
2162                 esac;;
2163         *)
2164                 case "\$aok" in
2165                 y)
2166                         echo "*** Substitution done -- please confirm."
2167                         xxxm="\$ans"
2168                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2169                         xxxm="\$ans"
2170                         ans=!
2171                         ;;
2172                 *)
2173                         echo "*** Error -- try again."
2174                         ans=!
2175                         ;;
2176                 esac
2177                 $myecho
2178                 ;;
2179         esac
2180         case "\$ans\$xxxm\$nostick" in
2181         '')
2182                 ans=!
2183                 $myecho
2184                 ;;
2185         esac
2186 done
2187 case "\$ans" in
2188 '') ans="\$xxxm";;
2189 esac
2190 EOSC
2191
2192 : create .config dir to save info across Configure sessions
2193 test -d ../.config || mkdir ../.config
2194 cat >../.config/README <<EOF
2195 This directory created by Configure to save information that should
2196 persist across sessions for $package.
2197
2198 You may safely delete it if you wish.
2199 EOF
2200
2201 : See if we are using a devel version and want that
2202 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2203 case "$usedevel" in
2204 $define|true|[yY]*)
2205     usedevel="$define" ;;
2206 *) case "$xversion" in
2207    *[13579])
2208         cat >&4 <<EOH
2209 *** WHOA THERE!!! ***
2210
2211     This is an UNSTABLE DEVELOPMENT release.
2212     The version of this $package distribution is $xversion, that is, odd,
2213     (as opposed to even) and that signifies a development release.
2214     If you want a maintenance release, you want an even-numbered version.
2215
2216     Do ***NOT*** install this into production use.
2217     Data corruption and crashes are possible.
2218
2219     It is most seriously suggested that you do not continue any further
2220     unless you want to help in developing and debugging Perl.
2221
2222     If you *still* want to build perl, you can answer 'y' now,
2223     or pass -Dusedevel to Configure.
2224
2225 EOH
2226         rp='Do you really want to continue?'
2227         dflt='n'
2228         . ./myread
2229         case "$ans" in
2230         [yY]) echo >&4 "Okay, continuing."
2231               usedevel="$define" ;;
2232         *) echo >&4 "Okay, bye."
2233            exit 1
2234            ;;
2235         esac
2236         ;;
2237     esac
2238     usedevel="$undef"
2239     ;;
2240 esac
2241 case "$usedevel" in
2242 $define|true|[yY]*)
2243         case "$versiononly" in
2244         '') versiononly="$define" ;;
2245         esac
2246         case "$installusrbinperl" in
2247         '') installusrbinperl="$undef" ;;
2248         esac
2249         ;;
2250 esac
2251
2252 : general instructions
2253 needman=true
2254 firsttime=true
2255 user=`(logname) 2>/dev/null`
2256 case "$user" in
2257 '') user=`whoami 2>&1`;;
2258 esac
2259 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2260         firsttime=false
2261         echo " "
2262         rp='Would you like to see the instructions?'
2263         dflt=n
2264         . ./myread
2265         case "$ans" in
2266         [yY]*) ;;
2267         *) needman=false;;
2268         esac
2269 fi
2270 if $needman; then
2271         cat <<EOH
2272
2273 This installation shell script will examine your system and ask you questions
2274 to determine how the perl5 package should be installed. If you get
2275 stuck on a question, you may use a ! shell escape to start a subshell or
2276 execute a command.  Many of the questions will have default answers in square
2277 brackets; typing carriage return will give you the default.
2278
2279 On some of the questions which ask for file or directory names you are allowed
2280 to use the ~name construct to specify the login directory belonging to "name",
2281 even if you don't have a shell which knows about that.  Questions where this is
2282 allowed will be marked "(~name ok)".
2283
2284 EOH
2285         rp=''
2286         dflt='Type carriage return to continue'
2287         . ./myread
2288         cat <<'EOH'
2289
2290 The prompter used in this script allows you to use shell variables and
2291 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2292 in the default answer, as if the default line was a set of arguments given to a
2293 script shell.  This means you may also use $* to repeat the whole default line,
2294 so you do not have to re-type everything to add something to the default.
2295
2296 Every time there is a substitution, you will have to confirm.  If there is an
2297 error (e.g. an unmatched backtick), the default answer will remain unchanged
2298 and you will be prompted again.
2299
2300 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2301 the questions and use the computed defaults (or the previous answers if there
2302 was already a config.sh file). Type 'Configure -h' for a list of options.
2303 You may also start interactively and then answer '& -d' at any prompt to turn
2304 on the non-interactive behaviour for the remainder of the execution.
2305
2306 EOH
2307         . ./myread
2308         cat <<EOH
2309
2310 Much effort has been expended to ensure that this shell script will run on any
2311 Unix system.  If despite that it blows up on yours, your best bet is to edit
2312 Configure and run it again.  If you can't run Configure for some reason,
2313 you'll have to generate a config.sh file by hand.  Whatever problems you
2314 have, let me (perlbug@perl.org) know how I blew it.
2315
2316 This installation script affects things in two ways:
2317
2318 1) it may do direct variable substitutions on some of the files included
2319    in this kit.
2320 2) it builds a config.h file for inclusion in C programs.  You may edit
2321    any of these files as the need arises after running this script.
2322
2323 If you make a mistake on a question, there is no easy way to back up to it
2324 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2325 files.  Configure will offer to let you do this before it runs the SH files.
2326
2327 EOH
2328         dflt='Type carriage return to continue'
2329         . ./myread
2330         case "$firsttime" in
2331         true) echo $user >>../.config/instruct;;
2332         esac
2333 fi
2334
2335 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2336 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2337 if test "X$sysroot" = X; then
2338     sysroot=""
2339 else
2340     case "$cc" in
2341         *gcc*|*g++*)
2342             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2343             # _sysroot is used in places where we need --sysroot=foo
2344             # but using the rest of the flags could cause issues.
2345             _sysroot="--sysroot=$sysroot";
2346             case "$ccflags" in
2347                 *sysroot*) ;;
2348                 'undef'|*)
2349                 ccflags="$ccflags $_sysroot"
2350             esac
2351             case "$ldflags" in
2352                 *sysroot*) ;;
2353                 'undef'|*)
2354                 ldflags="$ldflags $_sysroot"
2355             esac
2356             case "$cppflags" in
2357                 *sysroot*) ;;
2358                 'undef'|*)
2359                 cppflags="$cppflags $_sysroot"
2360             esac
2361             # lddlflags updated below in lddlflags section;
2362             # same with cccdlflags
2363             ;;
2364     esac
2365
2366     # Adjust some defaults to also use $sysroot
2367     for var in xlibpth loclibpth locincpth glibpth; do
2368         eval xxx=\$$var
2369         eval $var=''
2370         for path in $xxx; do
2371             eval $var=\"\$$var $sysroot$path\"
2372         done
2373     done
2374
2375 fi
2376
2377 : find out where common programs are
2378 echo " "
2379 echo "Locating common programs..." >&4
2380 cat <<EOSC >loc
2381 $startsh
2382 case \$# in
2383 0) exit 1;;
2384 esac
2385 thing=\$1
2386 shift
2387 dflt=\$1
2388 shift
2389 for dir in \$*; do
2390         case "\$thing" in
2391         .)
2392         if test -d \$dir/\$thing; then
2393                 echo \$dir
2394                 exit 0
2395         fi
2396         ;;
2397         *)
2398         for thisthing in \$dir/\$thing; do
2399                 : just loop through to pick last item
2400         done
2401         if test -f \$thisthing; then
2402                 echo \$thisthing
2403                 exit 0
2404         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2405                 echo \$thisthing
2406                 exit 0
2407         elif test -f \$dir/\$thing.exe; then
2408                 if test -n "$DJGPP"; then
2409                         echo \$dir/\$thing.exe
2410                 elif test "$eunicefix" != ":"; then
2411                         : on Eunice apparently
2412                         echo \$dir/\$thing
2413                 fi
2414                 exit 0
2415         fi
2416         ;;
2417         esac
2418 done
2419 echo \$dflt
2420 exit 1
2421 EOSC
2422 chmod +x loc
2423 $eunicefix loc
2424 loclist="
2425 awk
2426 cat
2427 chmod
2428 comm
2429 cp
2430 echo
2431 expr
2432 grep
2433 ls
2434 mkdir
2435 rm
2436 sed
2437 sort
2438 touch
2439 tr
2440 uniq
2441 "
2442 trylist="
2443 ar
2444 bison
2445 byacc
2446 cpp
2447 csh
2448 date
2449 egrep
2450 gmake
2451 gzip
2452 less
2453 ln
2454 make
2455 more
2456 nm
2457 nroff
2458 perl
2459 pg
2460 test
2461 uname
2462 zip
2463 "
2464 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2465 pth="$pth $sysroot/lib $sysroot/usr/lib"
2466 for file in $loclist; do
2467         eval xxx=\$$file
2468         case "$xxx" in
2469         /*|?:[\\/]*)
2470                 if test -f "$xxx"; then
2471                         : ok
2472                 else
2473                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2474                         xxx=`./loc $file $file $pth`
2475                 fi
2476                 ;;
2477         '') xxx=`./loc $file $file $pth`;;
2478         *) xxx=`./loc $xxx $xxx $pth`;;
2479         esac
2480         eval $file=$xxx$_exe
2481         eval _$file=$xxx
2482         case "$xxx" in
2483         /*)
2484                 echo $file is in $xxx.
2485                 ;;
2486         ?:[\\/]*)
2487                 echo $file is in $xxx.
2488                 ;;
2489         *)
2490                 echo "I don't know where '$file' is, and my life depends on it." >&4
2491                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2492                 exit 1
2493                 ;;
2494         esac
2495 done
2496 echo " "
2497 echo "Don't worry if any of the following aren't found..."
2498 say=offhand
2499 for file in $trylist; do
2500         eval xxx=\$$file
2501         case "$xxx" in
2502         /*|?:[\\/]*)
2503                 if test -f "$xxx"; then
2504                         : ok
2505                 else
2506                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2507                         xxx=`./loc $file $file $pth`
2508                 fi
2509                 ;;
2510         '') xxx=`./loc $file $file $pth`;;
2511         *) xxx=`./loc $xxx $xxx $pth`;;
2512         esac
2513         eval $file=$xxx$_exe
2514         eval _$file=$xxx
2515         case "$xxx" in
2516         /*)
2517                 echo $file is in $xxx.
2518                 ;;
2519         ?:[\\/]*)
2520                 echo $file is in $xxx.
2521                 ;;
2522         *)
2523                 echo "I don't see $file out there, $say."
2524                 say=either
2525                 ;;
2526         esac
2527 done
2528 case "$egrep" in
2529 egrep)
2530         echo "Substituting grep for egrep."
2531         egrep=$grep
2532         _egrep=$grep
2533         ;;
2534 esac
2535 case "$less" in
2536 '')     ;;
2537 *)      if $less -R </dev/null >/dev/null 2>&1; then
2538                echo "Substituting less -R for less."
2539                less="$less -R"
2540                _less=$less
2541         fi
2542         ;;
2543 esac
2544 case "$ln" in
2545 ln)
2546         echo "Substituting cp for ln."
2547         ln=$cp
2548         _ln=$cp
2549         ;;
2550 esac
2551 case "$make" in
2552 make)
2553         case "$gmake" in
2554         gmake)
2555         echo "I can't find make or gmake, and my life depends on it." >&4
2556         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2557         exit 1
2558         ;;
2559         esac
2560         ;;
2561 esac
2562 case "$gmake" in
2563 gmake)  ;;
2564 *)      # We can't have osname yet.
2565         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2566                 # Assume that gmake, if found, is definitely GNU make
2567                 # and prefer it over the system make.
2568                 echo "Substituting gmake for make."
2569                 make=$gmake
2570                 _make=$gmake
2571         fi
2572         ;;
2573 esac
2574 case "$test" in
2575 test)
2576         echo "Hopefully test is built into your sh."
2577         ;;
2578 *)
2579         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2580                 echo "Using the test built into your sh."
2581                 test=test
2582                 _test=test
2583         fi
2584         ;;
2585 esac
2586 case "$echo" in
2587 echo)
2588         echo "Hopefully echo is built into your sh."
2589         ;;
2590 '') ;;
2591 *)
2592         echo " "
2593 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2594         $echo $n "hi there$c" >foo1
2595         echo $n "hi there$c" >foo2
2596         if cmp foo1 foo2 >/dev/null 2>&1; then
2597                 echo "They are compatible.  In fact, they may be identical."
2598         else
2599                 case "$n" in
2600                 '-n') n='' c='\c';;
2601                 *) n='-n' c='';;
2602                 esac
2603                 cat <<FOO
2604 They are not compatible!  You are probably running ksh on a non-USG system.
2605 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2606 have echo built in and we may have to run some Bourne shell scripts.  That
2607 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2608
2609 FOO
2610                 $echo $n "The star should be here-->$c"
2611                 $echo "*"
2612         fi
2613         $rm -f foo1 foo2
2614         ;;
2615 esac
2616
2617 # This question was auctioned at YAPC::Europe-2007 in Vienna
2618 # I never promised you could answer it. I only auctioned the question.
2619 cat <<FOO
2620 The following message is sponsored by
2621
2622   Dresden.pm<--The stars should be here.
2623
2624 Dear Perl user, system administrator or package
2625 maintainer, the Perl community sends greetings to
2626 you. Do you (emblematical) greet back [Y/n]? n
2627
2628 FOO
2629
2630 : Check what type of C compiler we use
2631 cat <<EOS >trygcc
2632 $startsh
2633 EOS
2634 cat <<'EOSC' >>trygcc
2635 case "$cc" in
2636 '') ;;
2637 *)  $rm -f try try.*
2638     $cat >try.c <<EOM
2639 int main(int argc, char *argv[]) {
2640   return 0;
2641 }
2642 EOM
2643     if $cc -o try $ccflags $ldflags try.c; then
2644        :
2645     else
2646         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2647         despair=yes
2648         trygcc=yes
2649         case "$cc" in
2650         *gcc*) trygcc=no ;;
2651         esac
2652         # Skip this test because it gives a false match on output like:
2653         #    ./trygcc: line 23: cc: command not found
2654         # case "`$cc -v -c try.c 2>&1`" in
2655         # *gcc*) trygcc=no ;;
2656         # esac
2657         if $test X"$trygcc" = Xyes; then
2658             if gcc -o try -c try.c; then
2659                 echo " "
2660                 echo "You seem to have a working gcc, though." >&4
2661                 # Switching compilers may undo the work of hints files.
2662                 # The most common problem is -D_REENTRANT for threads.
2663                 # This heuristic catches that case, but gets false positives
2664                 # if -Dusethreads was not actually specified.  Better to
2665                 # bail out here with a useful message than fail 
2666                 # mysteriously later. Should we perhaps just try to
2667                 # re-invoke Configure -Dcc=gcc config_args ?
2668                 if $test -f usethreads.cbu; then
2669                         $cat >&4 <<EOM 
2670
2671 *** However, any setting of the C compiler flags (e.g. for thread support)
2672 *** will be lost.  It may be necessary for you to restart Configure and
2673 *** add -Dcc=gcc to your Configure command line.
2674
2675 EOM
2676                         rp="Would you like to go ahead and try gcc anyway?"
2677                         dflt=n
2678                 else
2679                         rp="Would you like to use it?"
2680                         dflt=y
2681                 fi
2682                 if $test -f myread; then
2683                     . ./myread
2684                 else
2685                     if $test -f UU/myread; then
2686                         . ./UU/myread
2687                     else
2688                         echo "Cannot find myread, sorry.  Aborting." >&2
2689                         exit 1
2690                     fi
2691                 fi  
2692                 case "$ans" in
2693                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2694                 esac
2695             fi
2696         fi
2697     fi
2698     $rm -f try try.*
2699     ;;
2700 esac
2701 EOSC
2702
2703 cat <<EOS >checkcc
2704 $startsh
2705 EOS
2706 cat <<'EOSC' >>checkcc
2707 case "$cc" in        
2708 '') ;;
2709 *)  $rm -f try try.*              
2710     $cat >try.c <<EOM
2711 int main(int argc, char *argv[]) {
2712   return 0;
2713 }
2714 EOM
2715     if $cc -o try $ccflags $ldflags try.c; then
2716        :
2717     else
2718         if $test X"$despair" = Xyes; then
2719            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2720         fi
2721         $cat >&4 <<EOM         
2722 You need to find a working C compiler.
2723 Either (purchase and) install the C compiler supplied by your OS vendor,
2724 or for a free C compiler try http://gcc.gnu.org/
2725 I cannot continue any further, aborting.
2726 EOM
2727         exit 1
2728     fi
2729     $rm -f try try.*
2730     ;;
2731 esac
2732 EOSC
2733
2734 : determine whether symbolic links are supported
2735 echo " "
2736 $touch blurfl
2737 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2738         echo "Symbolic links are supported." >&4
2739         lns="$ln -s"
2740 else
2741         echo "Symbolic links are NOT supported." >&4
2742         lns="$ln"
2743 fi
2744 $rm -f blurfl sym
2745
2746 : determine whether symbolic links are supported
2747 echo " "
2748 case "$lns" in
2749 *"ln"*" -s")
2750         echo "Checking how to test for symbolic links..." >&4
2751         $lns blurfl sym
2752         if $test "X$issymlink" = X; then
2753                 case "$newsh" in
2754                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2755                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2756                 esac
2757                 if test $? = 0; then
2758                         issymlink="test -h"
2759                 else
2760                         echo "Your builtin 'test -h' may be broken." >&4
2761                         case "$test" in
2762                         /*)     ;;
2763                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2764                                 for p in $pth
2765                                 do
2766                                         if test -f "$p/$test"; then
2767                                                 test="$p/$test"
2768                                                 break
2769                                         fi
2770                                 done
2771                                 ;;
2772                         esac
2773                         case "$test" in
2774                         /*)
2775                                 echo "Trying external '$test -h'." >&4
2776                                 issymlink="$test -h"
2777                                 if $test ! -h sym >/dev/null 2>&1; then
2778                                         echo "External '$test -h' is broken, too." >&4
2779                                         issymlink=''
2780                                 fi
2781                                 ;;
2782                         *)      issymlink='' ;;
2783                         esac
2784                 fi
2785         fi
2786         if $test "X$issymlink" = X; then
2787                 if $test -L sym 2>/dev/null; then
2788                         issymlink="$test -L"
2789                         echo "The builtin '$test -L' worked." >&4
2790                 fi
2791         fi
2792         if $test "X$issymlink" != X; then
2793                 echo "You can test for symbolic links with '$issymlink'." >&4
2794         else
2795                 echo "I do not know how you can test for symbolic links." >&4
2796         fi
2797         $rm -f blurfl sym
2798         ;;
2799 *)      echo "No symbolic links, so not testing for their testing..." >&4
2800         ;;
2801 esac
2802 echo " "
2803
2804 : Make symlinks util
2805 case "$mksymlinks" in
2806 $define|true|[yY]*)
2807         case "$src" in
2808         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2809                 exit 1
2810                 ;;
2811         *)      case "$lns:$issymlink" in
2812                 *"ln"*" -s:"*"test -"?)
2813                         echo "Creating the symbolic links..." >&4
2814                         echo "(First creating the subdirectories...)" >&4
2815                         cd ..
2816                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2817                                 read directory
2818                                 test -z "$directory" && break
2819                                 mkdir -p $directory
2820                         done
2821                         # Sanity check 1.
2822                         if test ! -d t/base; then
2823                                 echo "Failed to create the subdirectories.  Aborting." >&4
2824                                 exit 1
2825                         fi
2826                         echo "(Then creating the symlinks...)" >&4
2827                         awk '{print $1}' $src/MANIFEST | while true; do
2828                                 read filename
2829                                 test -z "$filename" && break
2830                                 if test -f $filename; then
2831                                         if $issymlink $filename; then
2832                                                 rm -f $filename
2833                                         fi
2834                                 fi
2835                                 if test -f $filename; then
2836                                         echo "$filename already exists, not symlinking."
2837                                 else
2838                                         ln -s $src/$filename $filename
2839                                 fi
2840                         done
2841                         # Sanity check 2.
2842                         if test ! -f t/base/lex.t; then
2843                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2844                                 exit 1
2845                         fi
2846                         cd UU
2847                         ;;
2848                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2849                         ;;
2850                 esac
2851                 ;;
2852         esac
2853         ;;
2854 esac
2855
2856 : Check for Cross-Compilation
2857 if $test "X$targethost" = "X"; then
2858     targethost=""
2859 fi
2860 if $test "X$targetenv" = "X"; then
2861     targetenv=""
2862 fi
2863 case "$usecrosscompile" in
2864 $define|true|[yY]*)
2865         $echo "Cross-compiling..."
2866         croak=''
2867         case "$cc" in
2868         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2869             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2870             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2871             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2872             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2873             # leave out ld, choosing it is more complex
2874             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2875             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2876             # We are in a weird spot. Just before us, some values
2877             # were 'saved', to be restored after the hints are
2878             # run.  This means that the changes we made to ar,
2879             # nm and ranlib will get reverted.
2880             # To avoid that, we hijack the saving mechanism and
2881             # have it save our new values.
2882             for file in ar nm ranlib; do
2883                 eval xxx=\$$file
2884                 eval $file=$xxx$_exe
2885                 eval _$file=$xxx
2886             done
2887         ;;
2888         esac
2889         case "$targetarch" in
2890         '') echo "Targetarch not defined." >&4; croak=y ;;
2891         *)  echo "Using targetarch $targetarch." >&4 ;;
2892         esac
2893         case "$targethost" in
2894         '') echo "Targethost not defined." >&4; croak=y ;;
2895         *)  echo "Using targethost $targethost." >&4
2896         esac
2897         locincpth=' '
2898         loclibpth=' '
2899         case "$croak" in
2900         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2901         esac
2902     : compile a host miniperl and generate_uudmap, unless we got passed them
2903     if $test "X$hostperl" = X; then
2904       echo "Building host miniperl and generate_uudmap binaries" >&4
2905       before_host=`pwd`
2906       cd ..
2907       cd $src
2908       src=`pwd`
2909       rm -rf $src/host
2910       mkdir $src/host
2911       cd $src/host
2912       $src/Configure -des -Dusedevel -Dmksymlinks
2913       $make miniperl
2914       case "$hostgenerate" in
2915       '') $make generate_uudmap
2916           hostgenerate=$src/host/generate_uudmap
2917           ;;
2918        "$undef") hostgenerate=''
2919           ;;
2920       esac
2921       hostperl=$src/host/miniperl
2922       cd $before_host
2923     fi
2924     hostosname=`$hostperl -le 'print $^O'`
2925     ;;
2926 *)
2927     usecrosscompile="$undef"
2928     ;;
2929 esac
2930
2931 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2932 case "$targethost" in
2933     '') echo "Checking for cross-compile" >&4
2934     case "$usecrosscompile$multiarch" in
2935        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2936          if [ -f Makefile ]; then
2937            echo " "
2938            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2939          else
2940            echo "Configure done."
2941          fi
2942        exit 0
2943        ;;
2944      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2945         run=''
2946         to=:
2947         from=:
2948         ;;
2949     esac
2950     ;;
2951     *) echo "Using targethost $targethost." >&4
2952         case "$src" in
2953         /*) run=$src/Cross/run
2954             targetmkdir=$src/Cross/mkdir
2955             to=$src/Cross/to
2956             from=$src/Cross/from
2957             ;;
2958         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2959             run=$pwd/Cross/run
2960             targetmkdir=$pwd/Cross/mkdir
2961             to=$pwd/Cross/to
2962             from=$pwd/Cross/from
2963             ;;
2964         esac
2965         case "$targetrun" in
2966         '') targetrun=ssh ;;
2967         esac
2968         case "$targetto" in
2969         '') targetto=scp ;;
2970         esac
2971         case "$targetfrom" in
2972         '') targetfrom=scp ;;
2973         esac
2974         run=$run-$targetrun
2975         to=$to-$targetto
2976         from=$from-$targetfrom
2977         case "$targetdir" in
2978         '')  targetdir=/tmp
2979              echo "Guessing targetdir $targetdir." >&4
2980              ;;
2981         esac
2982         case "$targetuser" in
2983         '')  targetuser=root
2984              echo "Guessing targetuser $targetuser." >&4
2985              ;;
2986         esac
2987         case "$targetport" in
2988         '')  targetport=22
2989              echo "Guessing targetport $targetport." >&4
2990              ;;
2991         esac
2992         case "$targetfrom" in
2993         scp)    q=-q ;;
2994         *)      q='' ;;
2995         esac
2996         case "$targetrun" in
2997         ssh|rsh)
2998             cat >$run <<EOF
2999 #!/bin/sh
3000 env=''
3001 case "\$1" in
3002 -cwd)
3003   shift
3004   cwd=\$1
3005   shift
3006   ;;
3007 esac
3008 case "\$1" in
3009 -env)
3010   shift
3011   env=\$1
3012   shift
3013   ;;
3014 esac
3015 case "\$cwd" in
3016 '') cwd=$targetdir ;;
3017 esac
3018 exe=\$1
3019 shift
3020 $to \$exe
3021 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3022 EOF
3023             ;;
3024         adb)
3025             $touch $run
3026             ;;
3027         *)  echo "Unknown targetrun '$targetrun'" >&4
3028             exit 1
3029             ;;
3030         esac
3031         case "$targetmkdir" in
3032         */Cross/mkdir)
3033             cat >$targetmkdir <<EOF
3034 #!/bin/sh
3035 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3036 EOF
3037             $chmod a+rx $targetmkdir
3038             ;;
3039         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3040             exit 1
3041             ;;
3042         esac
3043         case "$targetto" in
3044         scp|rcp)
3045             cat >$to <<EOF
3046 #!/bin/sh
3047 for f in \$@
3048 do
3049   case "\$f" in
3050   /*)
3051     $targetmkdir \`dirname \$f\`
3052     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3053     ;;
3054   *)
3055     $targetmkdir $targetdir/\`dirname \$f\`
3056     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3057     ;;
3058   esac
3059 done
3060 exit 0
3061 EOF
3062             ;;
3063         cp) cat >$to <<EOF
3064 #!/bin/sh
3065 for f in \$@
3066 do
3067   case "\$f" in
3068   /*)
3069     $mkdir -p $targetdir/\`dirname \$f\`
3070     $cp \$f $targetdir/\$f || exit 1
3071     ;;
3072   *)
3073     $targetmkdir $targetdir/\`dirname \$f\`
3074     $cp \$f $targetdir/\$f || exit 1
3075     ;;
3076   esac
3077 done
3078 exit 0
3079 EOF
3080             ;;
3081         *)  echo "Unknown targetto '$targetto'" >&4
3082             exit 1
3083             ;;
3084         esac
3085         case "$targetfrom" in
3086         scp|rcp)
3087           cat >$from <<EOF
3088 #!/bin/sh
3089 for f in \$@
3090 do
3091   $rm -f \$f
3092   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3093 done
3094 exit 0
3095 EOF
3096             ;;
3097         cp) cat >$from <<EOF
3098 #!/bin/sh
3099 for f in \$@
3100 do
3101   $rm -f \$f
3102   cp $targetdir/\$f . || exit 1
3103 done
3104 exit 0
3105 EOF
3106             ;;
3107         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3108             exit 1
3109             ;;
3110         esac
3111         if $test ! -f $run; then
3112             echo "Target 'run' script '$run' not found." >&4
3113         else
3114             $chmod a+rx $run
3115         fi
3116         if $test ! -f $to; then
3117             echo "Target 'to' script '$to' not found." >&4
3118         else
3119             $chmod a+rx $to
3120         fi
3121         if $test ! -f $from; then
3122             echo "Target 'from' script '$from' not found." >&4
3123         else
3124             $chmod a+rx $from
3125         fi
3126         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3127             exit 1
3128         fi
3129         cat >&4 <<EOF
3130 Using '$run' for remote execution,
3131 and '$from' and '$to'
3132 for remote file transfer.
3133 EOF
3134         ;;
3135 *)      run=''
3136         to=:
3137         from=:
3138         usecrosscompile="$undef"
3139         targetarch=''
3140         ;;
3141 esac
3142
3143 : see whether [:lower:] and [:upper:] are supported character classes
3144 echo " "
3145 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3146 ABYZ)
3147         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3148         up='[:upper:]'
3149         low='[:lower:]'
3150         ;;
3151 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3152         # (0xd9 and 0xe2), therefore that is a nice testing point.
3153         if test "X$up" = X -o "X$low" = X; then
3154             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3155             rs) up='[A-Z]'
3156                 low='[a-z]'
3157                 ;;
3158             esac
3159         fi
3160         if test "X$up" = X -o "X$low" = X; then
3161             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3162             rs) up='A-Z'
3163                 low='a-z'
3164                 ;;
3165             esac
3166         fi
3167         if test "X$up" = X -o "X$low" = X; then
3168             case "`echo RS | od -x 2>/dev/null`" in
3169             *D9E2*|*d9e2*)
3170                 echo "Hey, this might be EBCDIC." >&4
3171                 if test "X$up" = X -o "X$low" = X; then
3172                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3173                     rs) up='[A-IJ-RS-Z]'
3174                         low='[a-ij-rs-z]'
3175                         ;;
3176                     esac
3177                 fi
3178                 if test "X$up" = X -o "X$low" = X; then
3179                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3180                     rs) up='A-IJ-RS-Z'
3181                         low='a-ij-rs-z'
3182                         ;;
3183                     esac
3184                 fi
3185                 ;;
3186             esac
3187         fi
3188 esac
3189 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3190 rs)
3191     echo "Using $up and $low to convert case." >&4
3192     ;;
3193 *)
3194     echo "I don't know how to translate letters from upper to lower case." >&4
3195     echo "Your tr is not acting any way I know of." >&4
3196     exit 1
3197     ;;
3198 esac
3199 : set up the translation script tr, must be called with ./tr of course
3200 cat >tr <<EOSC
3201 $startsh
3202 case "\$1\$2" in
3203 '[A-Z][a-z]') exec $tr '$up' '$low';;
3204 '[a-z][A-Z]') exec $tr '$low' '$up';;
3205 esac
3206 exec $tr "\$@"
3207 EOSC
3208 chmod +x tr
3209 $eunicefix tr
3210
3211 : Try to determine whether config.sh was made on this system
3212 case "$config_sh" in
3213 '')
3214 myuname=`$uname -a 2>/dev/null`
3215 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3216 # Downcase everything to avoid ambiguity.
3217 # Remove slashes and single quotes so we can use parts of this in
3218 # directory and file names.
3219 # Remove newlines so myuname is sane to use elsewhere.
3220 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3221 # because the A-Z/a-z are not consecutive.
3222 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3223         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3224 newmyuname="$myuname"
3225 dflt=n
3226 case "$knowitall" in
3227 '')
3228         if test -f ../config.sh; then
3229                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3230                         eval "`grep myuname= ../config.sh`"
3231                 fi
3232                 if test "X$myuname" = "X$newmyuname"; then
3233                         dflt=y
3234                 fi
3235         fi
3236         ;;
3237 *) dflt=y;;
3238 esac
3239
3240 : Get old answers from old config file if Configure was run on the
3241 : same system, otherwise use the hints.
3242 hint=default
3243 cd ..
3244 if test -f config.sh; then
3245         echo " "
3246         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3247         . UU/myread
3248         case "$ans" in
3249         n*|N*) echo "OK, I'll ignore it."
3250                 mv config.sh config.sh.old
3251                 myuname="$newmyuname"
3252                 ;;
3253         *)  echo "Fetching default answers from your old config.sh file..." >&4
3254                 tmp_n="$n"
3255                 tmp_c="$c"
3256                 tmp_sh="$sh"
3257                 . ./config.sh
3258                 cp config.sh UU
3259                 n="$tmp_n"
3260                 c="$tmp_c"
3261                 : Older versions did not always set $sh.  Catch re-use of such
3262                 : an old config.sh.
3263                 case "$sh" in
3264                 '') sh="$tmp_sh" ;;
3265                 esac
3266                 hint=previous
3267                 ;;
3268         esac
3269 fi
3270 . ./UU/checkcc
3271 if test ! -f config.sh; then
3272         $cat <<EOM
3273
3274 First time through, eh?  I have some defaults handy for some systems
3275 that need some extra help getting the Configure answers right:
3276
3277 EOM
3278         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3279         dflt=''
3280         : Half the following guesses are probably wrong... If you have better
3281         : tests or hints, please send them to perlbug@perl.org
3282         : The metaconfig authors would also appreciate a copy...
3283         $test -f /irix && osname=irix
3284         $test -f /xenix && osname=sco_xenix
3285         $test -f /dynix && osname=dynix
3286         $test -f /dnix && osname=dnix
3287         $test -f /lynx.os && osname=lynxos
3288         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3289         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3290         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3291         $test -f /bin/mips && /bin/mips && osname=mips
3292         $test -d /usr/apollo/bin && osname=apollo
3293         $test -f /etc/saf/_sactab && osname=svr4
3294         $test -d /usr/include/minix && osname=minix
3295         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3296         if $test -d /MachTen -o -d /MachTen_Folder; then
3297                 osname=machten
3298                 if $test -x /sbin/version; then
3299                         osvers=`/sbin/version | $awk '{print $2}' |
3300                         $sed -e 's/[A-Za-z]$//'`
3301                 elif $test -x /usr/etc/version; then
3302                         osvers=`/usr/etc/version | $awk '{print $2}' |
3303                         $sed -e 's/[A-Za-z]$//'`
3304                 else
3305                         osvers="$2.$3"
3306                 fi
3307         fi
3308
3309         $test -f /sys/posix.dll &&
3310                 $test -f /usr/bin/what &&
3311                 set X `/usr/bin/what /sys/posix.dll` &&
3312                 $test "$3" = UWIN &&
3313                 osname=uwin &&
3314                 osvers="$5"
3315
3316         if $test -f $uname; then
3317                 set X $myuname
3318                 shift
3319
3320                 case "$5" in
3321                 fps*) osname=fps ;;
3322                 mips*)
3323                         case "$4" in
3324                         umips) osname=umips ;;
3325                         *) osname=mips ;;
3326                         esac;;
3327                 [23]100) osname=mips ;;
3328                 i386*)
3329                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3330                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3331                                 osname='sco'
3332                                 osvers=$tmp
3333                         elif $test -f /etc/kconfig; then
3334                                 osname=isc
3335                                 if test "$lns" = "$ln -s"; then
3336                                         osvers=4
3337                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3338                                         osvers=3
3339                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3340                                         osvers=2
3341                                 fi
3342                         fi
3343                         tmp=''
3344                         ;;
3345                 pc*)
3346                         if test -n "$DJGPP"; then
3347                                 osname=dos
3348                                 osvers=djgpp
3349                         fi
3350                         ;;
3351                 esac
3352
3353                 case "$1" in
3354                 aix) osname=aix
3355                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3356                         case "$tmp" in
3357                         # oslevel can fail with:
3358                         # oslevel: Unable to acquire lock.
3359                         *not\ found) osvers="$4"."$3" ;;
3360                         '<3240'|'<>3240') osvers=3.2.0 ;;
3361                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3362                         '=3250'|'>3250') osvers=3.2.5 ;;
3363                         *) osvers=$tmp;;
3364                         esac
3365                         ;;
3366                 bitrig) osname=bitrig
3367                         osvers="$3"
3368                         ;;
3369                 bsd386) osname=bsd386
3370                         osvers=`$uname -r`
3371                         ;;
3372                 cygwin*) osname=cygwin
3373                         osvers="$3"
3374                         ;;
3375                 *dc.osx) osname=dcosx
3376                         osvers="$3"
3377                         ;;
3378                 dnix) osname=dnix
3379                         osvers="$3"
3380                         ;;
3381                 domainos) osname=apollo
3382                         osvers="$3"
3383                         ;;
3384                 dgux)   osname=dgux
3385                         osvers="$3"
3386                         ;;
3387                 dragonfly) osname=dragonfly
3388                         osvers="$3"
3389                         ;;
3390                 dynixptx*) osname=dynixptx
3391                         osvers=`echo "$4"|sed 's/^v//'`
3392                         ;;
3393                 freebsd) osname=freebsd
3394                         osvers="$3" ;;
3395                 genix)  osname=genix ;;
3396                 gnu)    osname=gnu
3397                         osvers="$3" ;;
3398                 hp*)    osname=hpux
3399                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3400                         ;;
3401                 irix*)  osname=irix
3402                         case "$3" in
3403                         4*) osvers=4 ;;
3404                         5*) osvers=5 ;;
3405                         *)      osvers="$3" ;;
3406                         esac
3407                         ;;
3408                 linux)  osname=linux
3409                         case "$3" in
3410                         *)      osvers="$3" ;;
3411                         esac
3412                         $test -f /system/lib/libandroid.so && osname=linux-android
3413                         ;;
3414                 MiNT)   osname=mint
3415                         ;;
3416                 netbsd*) osname=netbsd
3417                         osvers="$3"
3418                         ;;
3419                 news-os) osvers="$3"
3420                         case "$3" in
3421                         4*) osname=newsos4 ;;
3422                         *) osname=newsos ;;
3423                         esac
3424                         ;;
3425                 nonstop-ux) osname=nonstopux ;;
3426                 openbsd) osname=openbsd
3427                         osvers="$3"
3428                         ;;
3429                 os2)    osname=os2
3430                         osvers="$4"
3431                         ;;
3432                 POSIX-BC | posix-bc ) osname=posix-bc
3433                         osvers="$3"
3434                         ;;
3435                 powerux | power_ux | powermax_os | powermaxos | \
3436                 powerunix | power_unix) osname=powerux
3437                         osvers="$3"
3438                         ;;
3439                 qnx) osname=qnx
3440                         osvers="$4"
3441                         ;;
3442                 solaris) osname=solaris
3443                         case "$3" in
3444                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3445                         *)      osvers="$3" ;;
3446                         esac
3447                         ;;
3448                 sunos) osname=sunos
3449                         case "$3" in
3450                         5*) osname=solaris
3451                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3452                         *)      osvers="$3" ;;
3453                         esac
3454                         ;;
3455                 titanos) osname=titanos
3456                         case "$3" in
3457                         1*) osvers=1 ;;
3458                         2*) osvers=2 ;;
3459                         3*) osvers=3 ;;
3460                         4*) osvers=4 ;;
3461                         *)      osvers="$3" ;;
3462                         esac
3463                         ;;
3464                 ultrix) osname=ultrix
3465                         osvers="$3"
3466                         ;;
3467                 osf1|mls+)      case "$5" in
3468                                 alpha)
3469                                         osname=dec_osf
3470                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3471                                         case "$osvers" in
3472                                         [1-9].[0-9]*) ;;
3473                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3474                                         esac
3475                                         ;;
3476                         hp*)    osname=hp_osf1  ;;
3477                         mips)   osname=mips_osf1 ;;
3478                         esac
3479                         ;;
3480                 # UnixWare 7.1.2 is known as Open UNIX 8
3481                 openunix|unixware) osname=svr5
3482                         osvers="$4"
3483                         ;;
3484                 uts)    osname=uts
3485                         osvers="$3"
3486                         ;;
3487                 vos) osvers="$3"
3488                         ;;
3489                 $2) case "$osname" in
3490                         *isc*) ;;
3491                         *freebsd*) ;;
3492                         svr*)
3493                                 : svr4.x or possibly later
3494                                 case "svr$3" in
3495                                 ${osname}*)
3496                                         osname=svr$3
3497                                         osvers=$4
3498                                         ;;
3499                                 esac
3500                                 case "$osname" in
3501                                 svr4.0)
3502                                         : Check for ESIX
3503                                         if test -f /stand/boot ; then
3504                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3505                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3506                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3507                                                         if test -n "$isesix"; then
3508                                                                 osname=esix4
3509                                                         fi
3510                                                 fi
3511                                         fi
3512                                         ;;
3513                                 esac
3514                                 ;;
3515                         *)      if test -f /etc/systemid; then
3516                                         osname=sco
3517                                         set `echo $3 | $sed 's/\./ /g'` $4
3518                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3519                                                 osvers=$1.$2.$3
3520                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3521                                                 osvers=$1.$2
3522                                         elif $test -f $src/hints/sco_$1.sh; then
3523                                                 osvers=$1
3524                                         fi
3525                                 else
3526                                         case "$osname" in
3527                                         '') : Still unknown.  Probably a generic Sys V.
3528                                                 osname="sysv"
3529                                                 osvers="$3"
3530                                                 ;;
3531                                         esac
3532                                 fi
3533                                 ;;
3534                         esac
3535                         ;;
3536                 *)      case "$osname" in
3537                         '') : Still unknown.  Probably a generic BSD.
3538                                 osname="$1"
3539                                 osvers="$3"
3540                                 ;;
3541                         esac
3542                         ;;
3543                 esac
3544         else
3545                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3546                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3547                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3548                                 osname=news_os
3549                         fi
3550                         $rm -f UU/kernel.what
3551                 elif test -d c:/. -o -n "$is_os2" ; then
3552                         set X $myuname
3553                         osname=os2
3554                         osvers="$5"
3555                 fi
3556         fi
3557
3558         case "$targetarch" in
3559         '') ;;
3560         *)  hostarch=$osname
3561             case "$targetarch" in
3562                 nto*|*-nto-*)
3563                     # Will load qnx.sh, which should change osname to nto
3564                     osname=qnx
3565                     osvers=''
3566                     ;;
3567                 *linux-android*)
3568                     # Catch arm-linux-androideabi, mipsel-linux-android,
3569                     # and i686-linux-android
3570                     osname=linux-android
3571                     osvers=''
3572                     ;;
3573                 *linux*)
3574                     # Something like arm-linux-gnueabihf is really just
3575                     # plain linux.
3576                     osname=linux
3577                     osvers=''
3578                     ;;
3579                 *solaris*|*sunos*)
3580                     osname=solaris
3581                     # XXX perhaps we should just assume
3582                     # osvers to be 2, or maybe take the value
3583                     # from targetarch. Using $run before the
3584                     # hints are run is somewhat icky.
3585                     set X `$run $uname -a 2>/dev/null`
3586                     shift
3587                     case "$3" in
3588                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3589                         *)  osvers="$3" ;;
3590                     esac
3591                     ;;
3592                 *)
3593                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3594                     osvers=''
3595                 ;;
3596             esac
3597             ;;
3598         esac
3599
3600         : Now look for a hint file osname_osvers, unless one has been
3601         : specified already.
3602         case "$hintfile" in
3603         ''|' ')
3604                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3605                 : Also try without trailing minor version numbers.
3606                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3607                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3608                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3609                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3610                 case "$file" in
3611                 '') dflt=none ;;
3612                 *)  case "$osvers" in
3613                         '') dflt=$file
3614                                 ;;
3615                         *)  if $test -f $src/hints/$file.sh ; then
3616                                         dflt=$file
3617                                 elif $test -f $src/hints/$xfile.sh ; then
3618                                         dflt=$xfile
3619                                 elif $test -f $src/hints/$xxfile.sh ; then
3620                                         dflt=$xxfile
3621                                 elif $test -f $src/hints/$xxxfile.sh ; then
3622                                         dflt=$xxxfile
3623                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3624                                         dflt=$xxxxfile
3625                                 elif $test -f "$src/hints/${osname}.sh" ; then
3626                                         dflt="${osname}"
3627                                 else
3628                                         dflt=none
3629                                 fi
3630                                 ;;
3631                         esac
3632                         ;;
3633                 esac
3634                 if $test -f Policy.sh ; then
3635                         case "$dflt" in
3636                         *Policy*) ;;
3637                         none) dflt="Policy" ;;
3638                         *) dflt="Policy $dflt" ;;
3639                         esac
3640                 fi
3641                 ;;
3642         *)
3643                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3644                 ;;
3645         esac
3646
3647         if $test -f Policy.sh ; then
3648                 $cat <<EOM
3649
3650 There's also a Policy hint file available, which should make the
3651 site-specific (policy) questions easier to answer.
3652 EOM
3653
3654         fi
3655
3656         $cat <<EOM
3657
3658 You may give one or more space-separated answers, or "none" if appropriate.
3659 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3660 previous run of Configure, you may specify it as well as or instead of
3661 OS-specific hints.  If hints are provided for your OS, you should use them:
3662 although Perl can probably be built without hints on many platforms, using
3663 hints often improve performance and may enable features that Configure can't
3664 set up on its own. If there are no hints that match your OS, specify "none";
3665 DO NOT give a wrong version or a wrong OS.
3666
3667 EOM
3668
3669         rp="Which of these apply, if any?"
3670         . UU/myread
3671         tans=$ans
3672         for file in $tans; do
3673                 if $test X$file = XPolicy -a -f Policy.sh; then
3674                         . Policy.sh
3675                         $cat Policy.sh >> UU/config.sh
3676                 elif $test -f $src/hints/$file.sh; then
3677                         . $src/hints/$file.sh
3678                         $cat $src/hints/$file.sh >> UU/config.sh
3679                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3680                         : nothing
3681                 else
3682                         : Give one chance to correct a possible typo.
3683                         echo "$file.sh does not exist"
3684                         dflt=$file
3685                         rp="hint to use instead?"
3686                         . UU/myread
3687                         for file in $ans; do
3688                                 if $test -f "$src/hints/$file.sh"; then
3689                                         . $src/hints/$file.sh
3690                                         $cat $src/hints/$file.sh >> UU/config.sh
3691                                 elif $test X$ans = X -o X$ans = Xnone ; then
3692                                         : nothing
3693                                 else
3694                                         echo "$file.sh does not exist -- ignored."
3695                                 fi
3696                         done
3697                 fi
3698         done
3699
3700         hint=recommended
3701         : Remember our hint file for later.
3702         if $test -f "$src/hints/$file.sh" ; then
3703                 hintfile="$file"
3704         else
3705                 hintfile=''
3706         fi
3707 fi
3708 cd UU
3709 ;;
3710 *)
3711         echo " "
3712         echo "Fetching default answers from $config_sh..." >&4
3713         tmp_n="$n"
3714         tmp_c="$c"
3715         cd ..
3716         cp $config_sh config.sh 2>/dev/null
3717         chmod +w config.sh
3718         . ./config.sh
3719         cd UU
3720         cp ../config.sh .
3721         n="$tmp_n"
3722         c="$tmp_c"
3723         hint=previous
3724         ;;
3725 esac
3726 test "$override" && . ./optdef.sh
3727
3728 : Restore computed paths
3729 for file in $loclist $trylist; do
3730         eval $file="\$_$file"
3731 done
3732
3733 cat << EOM
3734
3735 Configure uses the operating system name and version to set some defaults.
3736 The default value is probably right if the name rings a bell. Otherwise,
3737 since spelling matters for me, either accept the default or answer "none"
3738 to leave it blank.
3739
3740 EOM
3741 case "$osname" in
3742         ''|' ')
3743                 case "$hintfile" in
3744                 ''|' '|none) dflt=none ;;
3745                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3746                 esac
3747                 ;;
3748         *) dflt="$osname" ;;
3749 esac
3750 rp="Operating system name?"
3751 . ./myread
3752 case "$ans" in
3753 none)  osname='' ;;
3754 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3755 esac
3756 echo " "
3757 case "$osvers" in
3758         ''|' ')
3759                 case "$hintfile" in
3760                 ''|' '|none) dflt=none ;;
3761                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3762                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3763                         case "$dflt" in
3764                         ''|' ') dflt=none ;;
3765                         esac
3766                         ;;
3767                 esac
3768                 ;;
3769         *) dflt="$osvers" ;;
3770 esac
3771 rp="Operating system version?"
3772 . ./myread
3773 case "$ans" in
3774 none)  osvers='' ;;
3775 *) osvers="$ans" ;;
3776 esac
3777
3778
3779 . ./posthint.sh
3780
3781 : who configured the system
3782 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3783 case "$cf_by" in
3784 "")
3785         cf_by=`(logname) 2>/dev/null`
3786         case "$cf_by" in
3787         "")
3788                 cf_by=`(whoami) 2>/dev/null`
3789                 case "$cf_by" in
3790                 "") cf_by=unknown ;;
3791                 esac ;;
3792         esac ;;
3793 esac
3794
3795 : decide how portable to be.  Allow command line overrides.
3796 case "$d_portable" in
3797 "$undef") ;;
3798 *)      d_portable="$define" ;;
3799 esac
3800
3801 : set up shell script to do ~ expansion
3802 cat >filexp <<EOSS
3803 $startsh
3804 : expand filename
3805 case "\$1" in
3806  \~/*|\~)
3807         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3808         ;;
3809  \~*)
3810         if $test -f /bin/csh; then
3811                 /bin/csh -f -c "glob \$1"
3812                 failed=\$?
3813                 echo ""
3814                 exit \$failed
3815         else
3816                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3817                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3818                 if $test ! -d "\$dir"; then
3819                         me=\`basename \$0\`
3820                         echo "\$me: can't locate home directory for: \$name" >&2
3821                         exit 1
3822                 fi
3823                 case "\$1" in
3824                 */*)
3825                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3826                         ;;
3827                 *)
3828                         echo \$dir
3829                         ;;
3830                 esac
3831         fi
3832         ;;
3833 *)
3834         echo \$1
3835         ;;
3836 esac
3837 EOSS
3838 chmod +x filexp
3839 $eunicefix filexp
3840
3841 : now set up to get a file name
3842 cat <<EOS >getfile
3843 $startsh
3844 EOS
3845 cat <<'EOSC' >>getfile
3846 tilde=''
3847 fullpath=''
3848 already=''
3849 skip=''
3850 none_ok=''
3851 exp_file=''
3852 nopath_ok=''
3853 orig_rp="$rp"
3854 orig_dflt="$dflt"
3855 case "$gfpth" in
3856 '') gfpth='.' ;;
3857 esac
3858
3859 case "$fn" in
3860 *\(*)
3861         : getfile will accept an answer from the comma-separated list
3862         : enclosed in parentheses even if it does not meet other criteria.
3863         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3864         fn=`echo $fn | sed 's/(.*)//'`
3865         ;;
3866 esac
3867
3868 case "$fn" in
3869 *:*)
3870         loc_file=`expr $fn : '.*:\(.*\)'`
3871         fn=`expr $fn : '\(.*\):.*'`
3872         ;;
3873 esac
3874
3875 case "$fn" in
3876 *~*) tilde=true;;
3877 esac
3878 case "$fn" in
3879 */*) fullpath=true;;
3880 esac
3881 case "$fn" in
3882 *+*) skip=true;;
3883 esac
3884 case "$fn" in
3885 *n*) none_ok=true;;
3886 esac
3887 case "$fn" in
3888 *e*) exp_file=true;;
3889 esac
3890 case "$fn" in
3891 *p*) nopath_ok=true;;
3892 esac
3893
3894 case "$fn" in
3895 *f*) type='File';;
3896 *d*) type='Directory';;
3897 *l*) type='Locate';;
3898 esac
3899
3900 what="$type"
3901 case "$what" in
3902 Locate) what='File';;
3903 esac
3904
3905 case "$exp_file" in
3906 '')
3907         case "$d_portable" in
3908         "$define") ;;
3909         *) exp_file=true;;
3910         esac
3911         ;;
3912 esac
3913
3914 cd ..
3915 while test "$type"; do
3916         redo=''
3917         rp="$orig_rp"
3918         dflt="$orig_dflt"
3919         case "$tilde" in
3920         true) rp="$rp (~name ok)";;
3921         esac
3922         . UU/myread
3923         if test -f UU/getfile.ok && \
3924                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3925         then
3926                 value="$ans"
3927                 ansexp="$ans"
3928                 break
3929         fi
3930         case "$ans" in
3931         none)
3932                 value=''
3933                 ansexp=''
3934                 case "$none_ok" in
3935                 true) type='';;
3936                 esac
3937                 ;;
3938         *)
3939                 case "$tilde" in
3940                 '') value="$ans"
3941                         ansexp="$ans";;
3942                 *)
3943                         value=`UU/filexp $ans`
3944                         case $? in
3945                         0)
3946                                 if test "$ans" != "$value"; then
3947                                         echo "(That expands to $value on this system.)"
3948                                 fi
3949                                 ;;
3950                         *) value="$ans";;
3951                         esac
3952                         ansexp="$value"
3953                         case "$exp_file" in
3954                         '') value="$ans";;
3955                         esac
3956                         ;;
3957                 esac
3958                 case "$fullpath" in
3959                 true)
3960                         case "$ansexp" in
3961                         /*) value="$ansexp" ;;
3962                         [a-zA-Z]:/*) value="$ansexp" ;;
3963                         *)
3964                                 redo=true
3965                                 case "$already" in
3966                                 true)
3967                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3968                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3969                                         ;;
3970                                 *)
3971                                 echo "Please give a full path name, starting with slash." >&4
3972                                         case "$tilde" in
3973                                         true)
3974                                 echo "Note that using ~name is ok provided it expands well." >&4
3975                                                 already=true
3976                                                 ;;
3977                                         esac
3978                                 esac
3979                                 ;;
3980                         esac
3981                         ;;
3982                 esac
3983                 case "$redo" in
3984                 '')
3985                         case "$type" in
3986                         File)
3987                                 for fp in $gfpth; do
3988                                         if test "X$fp" = X.; then
3989                                             pf="$ansexp"
3990                                         else    
3991                                             pf="$fp/$ansexp"
3992                                         fi
3993                                         if test -f "$pf"; then
3994                                                 type=''
3995                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3996                                         then
3997                                                 echo "($value is not a plain file, but that's ok.)"
3998                                                 type=''
3999                                         fi
4000                                         if test X"$type" = X; then
4001                                             value="$pf"
4002                                             break
4003                                         fi
4004                                 done
4005                                 ;;
4006                         Directory)
4007                                 for fp in $gfpth; do
4008                                         if test "X$fp" = X.; then
4009                                             dir="$ans"
4010                                             direxp="$ansexp"
4011                                         else    
4012                                             dir="$fp/$ansexp"
4013                                             direxp="$fp/$ansexp"
4014                                         fi
4015                                         if test -d "$direxp"; then
4016                                                 type=''
4017                                                 value="$dir"
4018                                                 break
4019                                         fi
4020                                 done
4021                                 ;;
4022                         Locate)
4023                                 if test -d "$ansexp"; then
4024                                         echo "(Looking for $loc_file in directory $value.)"
4025                                         value="$value/$loc_file"
4026                                         ansexp="$ansexp/$loc_file"
4027                                 fi
4028                                 if test -f "$ansexp"; then
4029                                         type=''
4030                                 fi
4031                                 case "$nopath_ok" in
4032                                 true)   case "$value" in
4033                                         */*) ;;
4034                                         *)      echo "Assuming $value will be in people's path."
4035                                                 type=''
4036                                                 ;;
4037                                         esac
4038                                         ;;
4039                                 esac
4040                                 ;;
4041                         esac
4042
4043                         case "$skip" in
4044                         true) type='';
4045                         esac
4046
4047                         case "$type" in
4048                         '') ;;
4049                         *)
4050                                 if test "$fastread" = yes; then
4051                                         dflt=y
4052                                 else
4053                                         dflt=n
4054                                 fi
4055                                 rp="$what $value doesn't exist.  Use that name anyway?"
4056                                 . UU/myread
4057                                 dflt=''
4058                                 case "$ans" in
4059                                 y*) type='';;
4060                                 *) echo " ";;
4061                                 esac
4062                                 ;;
4063                         esac
4064                         ;;
4065                 esac
4066                 ;;
4067         esac
4068 done
4069 cd UU
4070 ans="$value"
4071 rp="$orig_rp"
4072 dflt="$orig_dflt"
4073 rm -f getfile.ok
4074 test "X$gfpthkeep" != Xy && gfpth=""
4075 EOSC
4076
4077 : determine root of directory hierarchy where package will be installed.
4078 case "$prefix" in
4079 '')
4080         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4081         ;;
4082 *?/)
4083         dflt=`echo "$prefix" | sed 's/.$//'`
4084         ;;
4085 *)
4086         dflt="$prefix"
4087         ;;
4088 esac
4089 $cat <<EOM
4090
4091 By default, $package will be installed in $dflt/bin, manual pages
4092 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4093 installation directories. Typically this is something like /usr/local.
4094 If you wish to have binaries under /usr/bin but other parts of the
4095 installation under /usr/local, that's ok: you will be prompted
4096 separately for each of the installation directories, the prefix being
4097 only used to set the defaults.
4098
4099 EOM
4100 fn=d~
4101 rp='Installation prefix to use?'
4102 . ./getfile
4103 oldprefix=''
4104 case "$prefix" in
4105 '') ;;
4106 *)
4107         case "$ans" in
4108         "$prefix") ;;
4109         *) oldprefix="$prefix";;
4110         esac
4111         ;;
4112 esac
4113 prefix="$ans"
4114 prefixexp="$ansexp"
4115
4116 : allow them to override the AFS root
4117 case "$afsroot" in
4118 '')     afsroot=/afs ;;
4119 *)      afsroot=$afsroot ;;
4120 esac
4121
4122 : is AFS running?
4123 echo " "
4124 case "$afs" in
4125 $define|true)   afs=true ;;
4126 $undef|false)   afs=false ;;
4127 *)      if $test -d $afsroot; then
4128                 afs=true
4129         else
4130                 afs=false
4131         fi
4132         ;;
4133 esac
4134 if $afs; then
4135         echo "AFS may be running... I'll be extra cautious then..." >&4
4136 else
4137         echo "AFS does not seem to be running..." >&4
4138 fi
4139
4140 : determine installation prefix for where package is to be installed.
4141 if $afs; then
4142 $cat <<EOM
4143
4144 Since you are running AFS, I need to distinguish the directory in which
4145 files will reside from the directory in which they are installed (and from
4146 which they are presumably copied to the former directory by occult means).
4147
4148 EOM
4149         case "$installprefix" in
4150         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4151         *) dflt="$installprefix";;
4152         esac
4153 else
4154 $cat <<EOM
4155
4156 In some special cases, particularly when building $package for distribution,
4157 it is convenient to distinguish the directory in which files should be
4158 installed from the directory ($prefix) in which they will
4159 eventually reside.  For most users, these two directories are the same.
4160
4161 EOM
4162         case "$installprefix" in
4163         '') dflt=$prefix ;;
4164         *) dflt=$installprefix;;
4165         esac
4166 fi
4167 fn=d~
4168 rp='What installation prefix should I use for installing files?'
4169 . ./getfile
4170 installprefix="$ans"
4171 installprefixexp="$ansexp"
4172
4173 : Perform the prefixexp/installprefixexp correction if necessary
4174 cat <<EOS >installprefix
4175 $startsh
4176 EOS
4177 cat <<'EOSC' >>installprefix
4178 : Change installation prefix, if necessary.
4179 if $test X"$prefix" != X"$installprefix"; then
4180     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4181 else
4182     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4183 fi
4184 EOSC
4185 chmod +x installprefix
4186 $eunicefix installprefix
4187
4188 : Set variables such as privlib and privlibexp from the output of ./getfile
4189 : performing the prefixexp/installprefixexp correction if necessary.
4190 cat <<EOS >setprefixvar
4191 $startsh
4192 EOS
4193 cat <<'EOSC' >>setprefixvar
4194 eval "${prefixvar}=\"\$ans\""
4195 eval "${prefixvar}exp=\"\$ansexp\""
4196 . ./installprefix
4197 EOSC
4198 chmod +x setprefixvar
4199 $eunicefix setprefixvar
4200
4201 : set up the script used to warn in case of inconsistency
4202 cat <<EOS >whoa
4203 $startsh
4204 EOS
4205 cat <<'EOSC' >>whoa
4206 dflt=y
4207 case "$hint" in
4208     recommended)
4209         case "$hintfile" in
4210         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4211                 ;;
4212         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4213                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4214                 ;;
4215         esac
4216         ;;
4217     *)  echo " "
4218         echo "*** WHOA THERE!!! ***" >&4
4219         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4220         ;;
4221 esac
4222 rp="    Keep the $hint value?"
4223 . ./myread
4224 case "$ans" in
4225 y) td=$was; tu=$was;;
4226 esac
4227 EOSC
4228
4229 : function used to set '$1' to '$val'
4230 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4231 case "$val$was" in
4232 $define$undef) . ./whoa; eval "$var=\$td";;
4233 $undef$define) . ./whoa; eval "$var=\$tu";;
4234 *) eval "$var=$val";;
4235 esac'
4236
4237 : get the patchlevel
4238 echo " "
4239 echo "Getting the current patchlevel..." >&4
4240 if $test -r $rsrc/patchlevel.h;then
4241         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4242         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4243         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4244         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4245         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4246         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4247         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4248 else
4249         revision=0
4250         patchlevel=0
4251         subversion=0
4252         api_revision=0
4253         api_version=0
4254         api_subversion=0
4255         perl_patchlevel=0
4256         $echo "(You do not have patchlevel.h.  Eek.)"
4257 fi
4258 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4259 version_patchlevel_string="version $patchlevel subversion $subversion"
4260 case "$perl_patchlevel" in
4261 0|'') ;;
4262 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4263     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4264     ;;
4265 esac
4266
4267 $echo "(You have $package $version_patchlevel_string.)"
4268
4269 case "$osname" in
4270 dos|vms)
4271         : XXX Should be a Configure test for double-dots in filenames.
4272         version=`echo $revision $patchlevel $subversion | \
4273                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4274         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4275                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4276         ;;
4277 *)
4278         version=`echo $revision $patchlevel $subversion | \
4279                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4280         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4281                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4282         ;;
4283 esac
4284 : Special case the 5.005_xx maintenance series, which used 5.005
4285 : without any subversion label as a subdirectory in $sitelib
4286 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4287         api_versionstring='5.005'
4288 fi
4289
4290 : Do we want threads support and if so, what type
4291 case "$usethreads" in
4292 $define|true|[yY]*)     dflt='y';;
4293 *)     # Catch case where user specified ithreads or 5005threads but
4294        # forgot -Dusethreads (A.D. 4/2002)
4295        case "$useithreads$use5005threads" in
4296        *$define*)       dflt='y';;
4297        *)               dflt='n';;
4298        esac
4299        ;;
4300 esac
4301 cat <<EOM
4302
4303 Perl can be built to offer a form of threading support on some systems
4304 To do so, Configure can be run with -Dusethreads.
4305
4306 Note that Perl built with threading support runs slightly slower
4307 and uses slightly more memory than plain Perl.
4308
4309 If this doesn't make any sense to you, just accept the default '$dflt'.
4310 EOM
4311 rp='Build a threading Perl?'
4312 . ./myread
4313 case "$ans" in
4314 y|Y)    val="$define" ;;
4315 *)      val="$undef" ;;
4316 esac
4317 set usethreads
4318 eval $setvar
4319
4320 if $test $patchlevel -lt 9; then
4321     case "$usethreads" in
4322     $define)
4323         : Default to ithreads unless overridden on command line or with
4324         : old config.sh
4325         dflt='y'
4326         case "$use5005threads" in
4327                 $define|true|[yY]*)
4328                         echo "5.005 threads are no longer supported"
4329                         exit 1
4330                 ;;
4331         esac
4332         case "$useithreads" in
4333                 $undef|false|[nN]*) dflt='n';;
4334         esac
4335         rp='Use the newer interpreter-based ithreads?'
4336         . ./myread
4337         case "$ans" in
4338         y|Y)    val="$define" ;;
4339         *)      val="$undef" ;;
4340         esac
4341         set useithreads
4342         eval $setvar
4343         : Now set use5005threads to the opposite value.
4344         case "$useithreads" in
4345         $define) val="$undef" ;;
4346         *) val="$define" ;;
4347         esac
4348         set use5005threads
4349         eval $setvar
4350         ;;
4351     *)
4352         useithreads="$undef"
4353         use5005threads="$undef"
4354         ;;
4355     esac
4356
4357     case "$useithreads$use5005threads" in
4358     "$define$define")
4359         $cat >&4 <<EOM
4360
4361 You cannot have both the ithreads and the 5.005 threads enabled
4362 at the same time.  Disabling the 5.005 threads since they are
4363 much less stable than the ithreads.
4364
4365 EOM
4366         use5005threads="$undef"
4367         ;;
4368     esac
4369
4370 else
4371 : perl-5.9.x and later
4372
4373     if test X"$usethreads" = "X$define"; then
4374         case "$use5005threads" in
4375             $define|true|[yY]*)
4376                 $cat >&4 <<EOM
4377
4378 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4379
4380 EOM
4381             ;;
4382         esac
4383     fi
4384
4385     use5005threads="$undef"
4386     useithreads="$usethreads"
4387 fi
4388
4389 case "$d_oldpthreads" in
4390 '')     : Configure tests would be welcome here.  For now, assume undef.
4391         val="$undef" ;;
4392 *)      val="$d_oldpthreads" ;;
4393 esac
4394 set d_oldpthreads
4395 eval $setvar
4396
4397
4398 : Look for a hint-file generated 'call-back-unit'.  If the
4399 : user has specified that a threading perl is to be built,
4400 : we may need to set or change some other defaults.
4401 if $test -f usethreads.cbu; then
4402     echo "Your platform has some specific hints regarding threaded builds, using them..."
4403     . ./usethreads.cbu
4404 else
4405     case "$usethreads" in
4406         "$define"|true|[yY]*)
4407                 $cat <<EOM
4408 (Your platform does not have any specific hints for threaded builds.
4409  Assuming POSIX threads, then.)
4410 EOM
4411         ;;
4412     esac
4413 fi
4414
4415 : Check if multiplicity is required
4416 cat <<EOM
4417
4418 Perl can be built so that multiple Perl interpreters can coexist
4419 within the same Perl executable.
4420 EOM
4421
4422 case "$useithreads" in
4423 $define)
4424         cat <<EOM
4425 This multiple interpreter support is required for interpreter-based threads.
4426 EOM
4427         val="$define"
4428         ;;
4429 *)      case "$usemultiplicity" in
4430         $define|true|[yY]*)     dflt='y';;
4431         *) dflt='n';;
4432         esac
4433         echo " "
4434         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4435         rp='Build Perl for multiplicity?'
4436         . ./myread
4437         case "$ans" in
4438         y|Y)    val="$define" ;;
4439         *)      val="$undef" ;;
4440         esac
4441         ;;
4442 esac
4443 set usemultiplicity
4444 eval $setvar
4445
4446 : Check if morebits is requested
4447 case "$usemorebits" in
4448 "$define"|true|[yY]*)
4449         use64bitint="$define"
4450         uselongdouble="$define"
4451         usemorebits="$define"
4452         ;;
4453 *)      usemorebits="$undef"
4454         ;;
4455 esac
4456
4457 : Determine the C compiler to be used
4458 echo " "
4459 case "$cc" in
4460 '') dflt=cc;;
4461 *) dflt="$cc";;
4462 esac
4463 rp="Use which C compiler?"
4464 . ./myread
4465 cc="$ans"
4466
4467 : See whether they have no cc but they do have gcc
4468 . ./trygcc
4469 if $test -f cc.cbu; then
4470     . ./cc.cbu
4471 fi
4472 . ./checkcc
4473
4474 : make some quick guesses about what we are up against
4475 echo " "
4476 $echo $n "Hmm...  $c"
4477 echo exit 1 >bsd
4478 echo exit 1 >usg
4479 echo exit 1 >v7
4480 echo exit 1 >osf1
4481 echo exit 1 >eunice
4482 echo exit 1 >xenix
4483 echo exit 1 >venix
4484 echo exit 1 >os2
4485 d_bsd="$undef"
4486 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4487 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4488 then
4489         echo "Looks kind of like an OSF/1 system, but we'll see..."
4490         echo exit 0 >osf1
4491 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4492         xxx=`./loc addbib blurfl $pth`
4493         if $test -f $xxx; then
4494         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4495                 echo exit 0 >bsd
4496                 echo exit 0 >usg
4497         else
4498                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4499                         echo "Looks kind of like an extended USG system, but we'll see..."
4500                 else
4501                         echo "Looks kind of like a USG system, but we'll see..."
4502                 fi
4503                 echo exit 0 >usg
4504         fi
4505 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4506         echo "Looks kind of like a BSD system, but we'll see..."
4507         d_bsd="$define"
4508         echo exit 0 >bsd
4509 else
4510         echo "Looks kind of like a Version 7 system, but we'll see..."
4511         echo exit 0 >v7
4512 fi
4513 case "$eunicefix" in
4514 *unixtovms*)
4515         $cat <<'EOI'
4516 There is, however, a strange, musty smell in the air that reminds me of
4517 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4518 EOI
4519         echo exit 0 >eunice
4520         d_eunice="$define"
4521 : it so happens the Eunice I know will not run shell scripts in Unix format
4522         ;;
4523 *)
4524         echo " "
4525         echo "Congratulations.  You aren't running Eunice."
4526         d_eunice="$undef"
4527         ;;
4528 esac
4529 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4530 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4531 : semicolon as a patch separator
4532 case "$p_" in
4533 :) ;;
4534 *)
4535         $cat <<'EOI'
4536 I have the feeling something is not exactly right, however...don't tell me...
4537 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4538 (Or you may be running DOS with DJGPP.)
4539 EOI
4540         echo exit 0 >os2
4541         ;;
4542 esac
4543 if test -f /xenix; then
4544         echo "Actually, this looks more like a XENIX system..."
4545         echo exit 0 >xenix
4546         d_xenix="$define"
4547 else
4548         echo " "
4549         echo "It's not Xenix..."
4550         d_xenix="$undef"
4551 fi
4552 chmod +x xenix
4553 $eunicefix xenix
4554 if test -f /venix; then
4555         echo "Actually, this looks more like a VENIX system..."
4556         echo exit 0 >venix
4557 else
4558         echo " "
4559         if ./xenix; then
4560                 : null
4561         else
4562                 echo "Nor is it Venix..."
4563         fi
4564 fi
4565 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4566 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4567 $rm -f foo
4568
4569 : Check if we are using GNU gcc and what its version is
4570 echo " "
4571 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4572 $cat >try.c <<EOM
4573 #include <stdio.h>
4574 int main() {
4575 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4576 #ifdef __VERSION__
4577         printf("%s\n", __VERSION__);
4578 #else
4579         printf("%s\n", "1");
4580 #endif
4581 #endif
4582         return(0);
4583 }
4584 EOM
4585 if $cc -o try $ccflags $ldflags try.c; then
4586         gccversion=`$run ./try`
4587         case "$gccversion" in
4588         '') echo "You are not using GNU cc." ;;
4589         *)  echo "You are using GNU cc $gccversion."
4590             ccname=gcc
4591             ;;
4592         esac
4593 else
4594         echo " "
4595         echo "*** WHOA THERE!!! ***" >&4
4596         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4597         case "$knowitall" in
4598         '')
4599         echo "    You'd better start hunting for one and let me know about it." >&4
4600                 exit 1
4601                 ;;
4602         esac
4603 fi
4604 $rm -f try try.*
4605 case "$gccversion" in
4606 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4607 esac
4608 case "$gccversion" in
4609 '') gccosandvers='' ;;
4610 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4611    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4612    gccshortvers=''
4613    case "$gccosandvers" in
4614    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4615    $osname$osvers) ;; # looking good
4616    $osname*) cat <<EOM >&4
4617
4618 *** WHOA THERE!!! ***
4619
4620     Your gcc has not been compiled for the exact release of
4621     your operating system ($gccosandvers versus $osname$osvers).
4622
4623     In general it is a good idea to keep gcc synchronized with
4624     the operating system because otherwise serious problems
4625     may ensue when trying to compile software, like Perl.
4626
4627     I'm trying to be optimistic here, though, and will continue.
4628     If later during the configuration and build icky compilation
4629     problems appear (headerfile conflicts being the most common
4630     manifestation), I suggest reinstalling the gcc to match
4631     your operating system release.
4632
4633 EOM
4634       ;;
4635    *) gccosandvers='' ;; # failed to parse, better be silent
4636    esac
4637    ;;
4638 esac
4639 case "$ccname" in
4640 '') ccname="$cc" ;;
4641 esac
4642
4643 # gcc 3.* complain about adding -Idirectories that they already know about,
4644 # so we will take those off from locincpth.
4645 case "$gccversion" in
4646 3*)
4647     echo "main(){}">try.c
4648     for incdir in $locincpth; do
4649        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4650              grep '^c[cp]p*[01]: warning: changing search order '`
4651        if test "X$warn" != X; then
4652            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4653        fi
4654     done
4655     $rm -f try try.*
4656 esac
4657
4658 # gcc 4.9 by default does some optimizations that break perl.
4659 # see ticket 121505.
4660 #
4661 # The -fwrapv disables those optimizations (and probably others,) so
4662 # for gcc 4.9 (and later, since the optimizations probably won't go
4663 # away), add -fwrapv unless the user requests -fno-wrapv, which
4664 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4665 # which turns the overflows -fwrapv ignores into runtime errors.
4666 case "$gccversion" in
4667 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4668     case "$ccflags" in
4669     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4670     *) ccflags="$ccflags -fwrapv" ;;
4671     esac
4672 esac
4673
4674 : What should the include directory be ?
4675 : Use sysroot if set, so findhdr looks in the right place.
4676 echo " "
4677 $echo $n "Hmm...  $c"
4678 dflt="$sysroot/usr/include"
4679 incpath=''
4680 mips_type=''
4681 if $test -f /bin/mips && /bin/mips; then
4682         echo "Looks like a MIPS system..."
4683         $cat >usr.c <<'EOCP'
4684 #ifdef SYSTYPE_BSD43
4685 /bsd43
4686 #endif
4687 EOCP
4688         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4689                 dflt='/bsd43/usr/include'
4690                 incpath='/bsd43'
4691                 mips_type='BSD 4.3'
4692         else
4693                 mips_type='System V'
4694         fi
4695         $rm -f usr.c usr.out
4696         echo "and you're compiling with the $mips_type compiler and libraries."
4697         xxx_prompt=y
4698         echo "exit 0" >mips
4699 else
4700         echo "Doesn't look like a MIPS system."
4701         xxx_prompt=n
4702         echo "exit 1" >mips
4703 fi
4704 chmod +x mips
4705 $eunicefix mips
4706 case "$usrinc" in
4707 '') ;;
4708 *) dflt="$usrinc";;
4709 esac
4710 case "$xxx_prompt" in
4711 y)      fn=d/
4712         echo " "
4713         rp='Where are the include files you want to use?'
4714         . ./getfile
4715         usrinc="$ans"
4716         ;;
4717 *)      usrinc="$dflt"
4718         ;;
4719 esac
4720
4721 : see how we invoke the C preprocessor
4722 echo " "
4723 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4724 cat <<'EOT' >testcpp.c
4725 #define ABC abc
4726 #define XYZ xyz
4727 ABC.XYZ
4728 EOT
4729 cd ..
4730 if test ! -f cppstdin; then
4731         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4732                 # AIX cc -E doesn't show the absolute headerfile
4733                 # locations but we'll cheat by using the -M flag.
4734                 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
4735         else
4736                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4737         fi
4738 else
4739         echo "Keeping your $hint cppstdin wrapper."
4740 fi
4741 chmod 755 cppstdin
4742 wrapper=`pwd`/cppstdin
4743 ok='false'
4744 cd UU
4745
4746 if $test "X$cppstdin" != "X" && \
4747         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4748         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4749 then
4750         echo "You used to use $cppstdin $cppminus so we'll use that again."
4751         case "$cpprun" in
4752         '') echo "But let's see if we can live without a wrapper..." ;;
4753         *)
4754                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4755                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4756                 then
4757                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4758                         ok='true'
4759                 else
4760                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4761                 fi
4762                 ;;
4763         esac
4764 else
4765         case "$cppstdin" in
4766         '') ;;
4767         *)
4768                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4769                 ;;
4770         esac
4771 fi
4772
4773 if $ok; then
4774         : nothing
4775 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4776         $cc -E <testcpp.c >testcpp.out 2>&1; \
4777         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4778         echo "Yup, it does."
4779         x_cpp="$cc $cppflags -E"
4780         x_minus='';
4781 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4782         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4783         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4784         echo "Yup, it does."
4785         x_cpp="$cc $cppflags -E"
4786         x_minus='-';
4787 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4788         $cc -P <testcpp.c >testcpp.out 2>&1; \
4789         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4790         echo "Yipee, that works!"
4791         x_cpp="$cc $cppflags -P"
4792         x_minus='';
4793 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4794         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4795         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4796         echo "At long last!"
4797         x_cpp="$cc $cppflags -P"
4798         x_minus='-';
4799 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4800         $cpp <testcpp.c >testcpp.out 2>&1; \
4801         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4802         echo "It works!"
4803         x_cpp="$cpp $cppflags"
4804         x_minus='';
4805 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4806         $cpp - <testcpp.c >testcpp.out 2>&1; \
4807         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4808         echo "Hooray, it works!  I was beginning to wonder."
4809         x_cpp="$cpp $cppflags"
4810         x_minus='-';
4811 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4812         $wrapper <testcpp.c >testcpp.out 2>&1; \
4813         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4814         x_cpp="$wrapper"
4815         x_minus=''
4816         echo "Eureka!"
4817 else
4818         dflt=''
4819         rp="No dice.  I can't find a C preprocessor.  Name one:"
4820         . ./myread
4821         x_cpp="$ans"
4822         x_minus=''
4823         $x_cpp <testcpp.c >testcpp.out 2>&1
4824         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4825                 echo "OK, that will do." >&4
4826         else
4827 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4828                 exit 1
4829         fi
4830 fi
4831
4832 case "$ok" in
4833 false)
4834         cppstdin="$x_cpp"
4835         cppminus="$x_minus"
4836         cpprun="$x_cpp"
4837         cpplast="$x_minus"
4838         set X $x_cpp
4839         shift
4840         case "$1" in
4841         "$cpp")
4842                 echo "Perhaps can we force $cc -E using a wrapper..."
4843                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4844                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4845                 then
4846                         echo "Yup, we can."
4847                         cppstdin="$wrapper"
4848                         cppminus='';
4849                 else
4850                         echo "Nope, we'll have to live without it..."
4851                 fi
4852                 ;;
4853         esac
4854         case "$cpprun" in
4855         "$wrapper")
4856                 cpprun=''
4857                 cpplast=''
4858                 ;;
4859         esac
4860         ;;
4861 esac
4862
4863 case "$cppstdin" in
4864 "$wrapper"|'cppstdin') ;;
4865 *) $rm -f $wrapper;;
4866 esac
4867 $rm -f testcpp.c testcpp.out
4868
4869 : Adjust cppfilter for path component separator
4870 case "$osname" in
4871 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4872 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4873 *)   cppfilter='' ;;
4874 esac
4875
4876 : Use gcc to determine libpth and incpth
4877 # If using gcc or clang, we can get better values for libpth, incpth
4878 # and usrinc directly from the compiler.
4879 # Note that ccname for clang is also gcc.
4880 case "$ccname" in
4881     gcc)
4882         $echo 'extern int foo;' > try.c
4883         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4884         shift
4885         if $test $# -gt 0; then
4886             incpth="$incpth $*"
4887             incpth="`$echo $incpth|$sed 's/^ //'`"
4888             for i in $*; do
4889                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4890                 if $test -d $j; then
4891                     libpth="$libpth $j"
4892                 fi
4893             done
4894             libpth="`$echo $libpth|$sed 's/^ //'`"
4895             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4896                 if $test -d $xxx; then
4897                     case " $libpth " in
4898                     *" $xxx "*) ;;
4899                     *) libpth="$libpth $xxx";;
4900                     esac
4901                 fi
4902             done
4903         fi
4904         $rm -f try.c
4905         case "$usrinc" in
4906         '') for i in $incpth; do
4907                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4908                     usrinc="$i"
4909                     break
4910                 fi
4911             done
4912             ;;
4913         esac
4914
4915         case "$usecrosscompile" in
4916         $define|true|[yY]*)
4917             case "$incpth" in
4918                 '') echo "Incpth not defined." >&4; croak=y ;;
4919                 *)  echo "Using incpth '$incpth'." >&4 ;;
4920             esac
4921             case "$libpth" in
4922                 '') echo "Libpth not defined." >&4; croak=y ;;
4923                 *)  echo "Using libpth '$libpth'." >&4 ;;
4924             esac
4925             case "$usrinc" in
4926                 '') echo "Usrinc not defined." >&4; croak=y ;;
4927                 *)  echo "Using usrinc $usrinc." >&4 ;;
4928             esac
4929             case "$croak" in
4930                 y)
4931                 if test "X$sysroot" = X; then
4932                     echo "Cannot continue, aborting." >&4; exit 1
4933                 else
4934                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4935                 fi
4936                 ;;
4937             esac
4938             ;;
4939         esac
4940     ;;
4941 esac
4942
4943 : Default value for incpth is just usrinc
4944 case "$incpth" in
4945 '') incpth="$usrinc";;
4946 esac
4947
4948 : Set private lib path
4949 case "$plibpth" in
4950 '') if ./mips; then
4951         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4952     fi;;
4953 esac
4954 case "$libpth" in
4955 ' ') dlist='';;
4956 '') dlist="$loclibpth $plibpth $glibpth";;
4957 *) dlist="$libpth";;
4958 esac
4959
4960 : Now check and see which directories actually exist, avoiding duplicates
4961 for xxx in $dlist
4962 do
4963     if $test -d $xxx; then
4964                 case " $libpth " in
4965                 *" $xxx "*) ;;
4966                 *) libpth="$libpth $xxx";;
4967                 esac
4968     fi
4969 done
4970 $cat <<'EOM'
4971
4972 Some systems have incompatible or broken versions of libraries.  Among
4973 the directories listed in the question below, please remove any you
4974 know not to be holding relevant libraries, and add any that are needed.
4975 Say "none" for none.
4976
4977 EOM
4978
4979 if test "X$sysroot" != X; then
4980     $cat <<EOM
4981 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4982
4983 EOM
4984 fi
4985
4986 case "$libpth" in
4987 '') dflt='none';;
4988 *)
4989         set X $libpth
4990         shift
4991         dflt=${1+"$@"}
4992         ;;
4993 esac
4994 rp="Directories to use for library searches?"
4995 . ./myread
4996 case "$ans" in
4997 none) libpth=' ';;
4998 *) libpth="$ans";;
4999 esac
5000
5001 : compute shared library extension
5002 case "$so" in
5003 '')
5004         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5005                 dflt='sl'
5006         else
5007                 dflt='so'
5008         fi
5009         ;;
5010 *) dflt="$so";;
5011 esac
5012 $cat <<EOM
5013
5014 On some systems, shared libraries may be available.  Answer 'none' if
5015 you want to suppress searching of shared libraries for the remainder
5016 of this configuration.
5017
5018 EOM
5019 rp='What is the file extension used for shared libraries?'
5020 . ./myread
5021 so="$ans"
5022
5023 : Does target system insist that shared library basenames are unique
5024 $cat << EOM
5025
5026 Some dynamic loaders assume that the *basename* of shared library filenames
5027 are globally unique.  We'll default this to undef as we assume your system
5028 is not this weird. Set to defined if you're on one of them.
5029
5030 EOM
5031
5032 dflt='n'
5033 rp='Make shared library basenames unique?'
5034 . ./myread
5035 case "$ans" in
5036 y|Y) val="$define" ;;
5037 *)   val="$undef"  ;;
5038 esac
5039 set d_libname_unique
5040 eval $setvar
5041
5042 : Define several unixisms.
5043 : Hints files or command line option can be used to override them.
5044 : The convoluted testing is in case hints files set either the old
5045 : or the new name.
5046 case "$_exe" in
5047 '')     case "$exe_ext" in
5048         '')     ;;
5049         *)      _exe="$exe_ext" ;;
5050         esac
5051         ;;
5052 esac
5053 case "$_a" in
5054 '')     case "$lib_ext" in
5055     '') _a='.a';;
5056         *)      _a="$lib_ext" ;;
5057         esac
5058         ;;
5059 esac
5060 case "$_o" in
5061 '') case "$obj_ext" in
5062         '')     _o='.o';;
5063         *)      _o="$obj_ext";;
5064         esac
5065         ;;
5066 esac
5067 case "$p_" in
5068 '') case "$path_sep" in
5069         '')     p_=':';;
5070         *)      p_="$path_sep";;
5071         esac
5072         ;;
5073 esac
5074 exe_ext=$_exe
5075 lib_ext=$_a
5076 obj_ext=$_o
5077 path_sep=$p_
5078
5079 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5080
5081 : Which makefile gets called first.  This is used by make depend.
5082 case "$firstmakefile" in
5083 '') firstmakefile='makefile';;
5084 esac
5085
5086 : Check is we will use socks
5087 case "$usesocks" in
5088 $define|true|[yY]*)     dflt='y';;
5089 *) dflt='n';;
5090 esac
5091 cat <<EOM
5092
5093 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5094 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5095 to use the PerlIO abstraction layer, this will be implicitly selected.
5096
5097 If this doesn't make any sense to you, just accept the default '$dflt'.
5098 EOM
5099 rp='Build Perl for SOCKS?'
5100 . ./myread
5101 case "$ans" in
5102 y|Y)    val="$define" ;;
5103 *)      val="$undef" ;;
5104 esac
5105 set usesocks
5106 eval $setvar
5107
5108 : Check for uselongdouble support
5109 case "$ccflags" in
5110 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5111 esac
5112
5113 case "$uselongdouble" in
5114 $define|true|[yY]*)     dflt='y';;
5115 *) dflt='n';;
5116 esac
5117 cat <<EOM
5118
5119 Perl can be built to take advantage of long doubles which
5120 (if available) may give more accuracy and range for floating point numbers.
5121
5122 If this doesn't make any sense to you, just accept the default '$dflt'.
5123 EOM
5124 rp='Try to use long doubles if available?'
5125 . ./myread
5126 case "$ans" in
5127 y|Y)    val="$define"   ;;
5128 *)      val="$undef"    ;;
5129 esac
5130 set uselongdouble
5131 eval $setvar
5132
5133 case "$uselongdouble" in
5134 true|[yY]*) uselongdouble="$define" ;;
5135 esac
5136
5137 : Look for a hint-file generated 'call-back-unit'.  If the
5138 : user has specified that long doubles should be used,
5139 : we may need to set or change some other defaults.
5140 if $test -f uselongdouble.cbu; then
5141     echo "Your platform has some specific hints regarding long doubles, using them..."
5142     . ./uselongdouble.cbu
5143 else
5144     case "$uselongdouble" in
5145         $define)
5146                 $cat <<EOM
5147 (Your platform does not have any specific hints for long doubles.)
5148 EOM
5149         ;;
5150     esac
5151 fi
5152
5153 : Looking for optional libraries
5154 echo " "
5155 echo "Checking for optional libraries..." >&4
5156 case "$libs" in
5157 ' '|'') dflt='';;
5158 *) dflt="$libs";;
5159 esac
5160 case "$libswanted" in
5161 '') libswanted='c_s';;
5162 esac
5163 case "$usesocks" in
5164 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5165 esac
5166 case "$usecbacktrace" in
5167 "$define") libswanted="$libswanted bfd" ;;
5168 esac
5169 libsfound=''
5170 libsfiles=''
5171 libsdirs=''
5172 libspath=''
5173 for thisdir in $libpth $xlibpth; do
5174   test -d $thisdir && libspath="$libspath $thisdir"
5175 done
5176 for thislib in $libswanted; do
5177         for thisdir in $libspath; do
5178             xxx=''
5179             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5180                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5181                 $test -f "$xxx" && eval $libscheck
5182                 $test -f "$xxx" && libstyle=shared
5183                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5184                 $test -f "$xxx" && eval $libscheck
5185                 $test -f "$xxx" && libstyle=shared
5186             fi
5187             if test ! -f "$xxx"; then
5188                 xxx=$thisdir/lib$thislib.$so
5189                 $test -f "$xxx" && eval $libscheck
5190                 $test -f "$xxx" && libstyle=shared
5191             fi
5192             if test ! -f "$xxx"; then
5193                 xxx=$thisdir/lib$thislib$_a
5194                 $test -f "$xxx" && eval $libscheck
5195                 $test -f "$xxx" && libstyle=static
5196             fi
5197             if test ! -f "$xxx"; then
5198                 xxx=$thisdir/$thislib$_a
5199                 $test -f "$xxx" && eval $libscheck
5200                 $test -f "$xxx" && libstyle=static
5201             fi
5202             if test ! -f "$xxx"; then
5203                 xxx=$thisdir/lib${thislib}_s$_a
5204                 $test -f "$xxx" && eval $libscheck
5205                 $test -f "$xxx" && libstyle=static
5206                 $test -f "$xxx" && thislib=${thislib}_s
5207             fi
5208             if test ! -f "$xxx"; then
5209                 xxx=$thisdir/Slib$thislib$_a
5210                 $test -f "$xxx" && eval $libscheck
5211                 $test -f "$xxx" && libstyle=static
5212             fi
5213             if $test -f "$xxx"; then
5214                 case "$libstyle" in
5215                 shared) echo "Found -l$thislib (shared)." ;;
5216                 static) echo "Found -l$thislib." ;;
5217                 *)      echo "Found -l$thislib ($libstyle)." ;;
5218                 esac
5219                 case " $dflt " in
5220                 *"-l$thislib "*);;
5221                 *) dflt="$dflt -l$thislib"
5222                    libsfound="$libsfound $xxx"
5223                    yyy=`basename $xxx`
5224                    libsfiles="$libsfiles $yyy"
5225                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5226                    case " $libsdirs " in
5227                    *" $yyy "*) ;;
5228                    *) libsdirs="$libsdirs $yyy" ;;
5229                    esac
5230                    ;;
5231                 esac
5232                 break
5233             fi
5234         done
5235         if $test ! -f "$xxx"; then
5236             echo "No -l$thislib."
5237         fi
5238 done
5239 set X $dflt
5240 shift
5241 dflt="$*"
5242 case "$libs" in
5243 '') dflt="$dflt";;
5244 *) dflt="$libs";;
5245 esac
5246 case "$dflt" in
5247 ' '|'') dflt='none';;
5248 esac
5249
5250 $cat <<EOM
5251
5252 In order to compile $package on your machine, a number of libraries
5253 are usually needed.  Include any other special libraries here as well.
5254 Say "none" for none.  The default list is almost always right.
5255 EOM
5256
5257 echo " "
5258 rp="What libraries to use?"
5259 . ./myread
5260 case "$ans" in
5261 none) libs=' ';;
5262 *) libs="$ans";;
5263 esac
5264
5265 : determine optimization, if desired, or use for debug flag also
5266 case "$optimize" in
5267 ' '|$undef) dflt='none';;
5268 '') dflt='-O';;
5269 *) dflt="$optimize";;
5270 esac
5271 $cat <<EOH
5272
5273 By default, $package compiles with the -O flag to use the optimizer.
5274 Alternately, you might want to use the symbolic debugger, which uses
5275 the -g flag (on traditional Unix systems).  Either flag can be
5276 specified here.  To use neither flag, specify the word "none".
5277
5278 EOH
5279 rp="What optimizer/debugger flag should be used?"
5280 . ./myread
5281 optimize="$ans"
5282 case "$optimize" in
5283 'none') optimize=" ";;
5284 esac
5285
5286 : Check what DEBUGGING is required from the command line
5287 : -DEBUGGING      or -DDEBUGGING or
5288 : -DEBUGGING=both                       = -g + -DDEBUGGING
5289 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5290 : -DEBUGGING=none or -UDEBUGGING        =
5291 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5292 case "$EBUGGING" in
5293 '')     ;;
5294 *)      DEBUGGING=$EBUGGING ;;
5295 esac
5296
5297 case "$DEBUGGING" in
5298 -g|both|$define)
5299     case "$optimize" in
5300         *-g*) ;;
5301         *)    optimize="$optimize -g" ;;
5302     esac ;;
5303 none|$undef)
5304     case "$optimize" in
5305         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5306                 shift
5307                 optimize="$*"
5308                 ;;
5309     esac ;;
5310 esac
5311
5312 dflt=''
5313 case "$DEBUGGING" in
5314 both|$define) dflt='-DDEBUGGING'
5315 esac
5316
5317 : argument order is deliberate, as the flag will start with - which set could
5318 : think is an option
5319 checkccflag='check=$1; flag=$2; callback=$3;
5320 echo " ";
5321 echo "Checking if your compiler accepts $flag" 2>&1;
5322 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5323 echo "int main(void) { return 0; }" > gcctest.c;
5324 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5325     echo "Yes, it does." 2>&1;
5326     if $test -s gcctest.out ; then
5327         echo "But your platform does not like it:";
5328         cat gcctest.out;
5329     else
5330         case "$ccflags" in
5331         *$check*)
5332             echo "Leaving current flags $ccflags alone." 2>&1
5333             ;;
5334         *) dflt="$dflt $flag";
5335             eval $callback
5336             ;;
5337         esac
5338     fi
5339 else
5340     echo "Nope, it does not, but that is ok." 2>&1;
5341 fi
5342 '
5343
5344 : We will not override a previous value, but we might want to
5345 : augment a hint file
5346 case "$hint" in
5347 default|recommended)
5348         case "$gccversion" in
5349         1*) dflt="$dflt -fpcc-struct-return" ;;
5350         esac
5351         case "$optimize:$DEBUGGING" in
5352         *-g*:old) dflt="$dflt -DDEBUGGING";;
5353         esac
5354         case "$gccversion" in
5355         2*) if $test -d /etc/conf/kconfig.d &&
5356                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5357                 then
5358                         # Interactive Systems (ISC) POSIX mode.
5359                         dflt="$dflt -posix"
5360                 fi
5361                 ;;
5362         esac
5363         case "$gccversion" in
5364         1*) ;;
5365         2.[0-8]*) ;;
5366         ?*)     set strict-aliasing -fno-strict-aliasing
5367                 eval $checkccflag
5368                 ;;
5369         esac
5370         # For gcc, adding -pipe speeds up compilations for some, but apparently
5371         # some assemblers can't read from stdin.  (It also slows down compilations
5372         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5373         case "$gccversion" in
5374         ?*)     set pipe -pipe
5375                 eval $checkccflag
5376                 ;;
5377         esac
5378
5379         # on x86_64 (at least) we require an extra library (libssp) in the
5380         # link command line. This library is not named, so I infer that it is
5381         # an implementation detail that may change. Hence the safest approach
5382         # is to add the flag to the flags passed to the compiler at link time,
5383         # as that way the compiler can do the right implementation dependant
5384         # thing. (NWC)
5385         case "$gccversion" in
5386         ?*)     set stack-protector -fstack-protector
5387                 eval $checkccflag
5388                 ;;
5389         esac
5390         ;;
5391 esac
5392
5393 case "$mips_type" in
5394 *BSD*|'') inclwanted="$locincpth $usrinc";;
5395 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5396 esac
5397 for thisincl in $inclwanted; do
5398         if $test -d $thisincl; then
5399                 if $test x$thisincl != x$usrinc; then
5400                         case "$dflt" in
5401                         *" -I$thisincl "*);;
5402                         *) dflt="$dflt -I$thisincl ";;
5403                         esac
5404                 fi
5405         fi
5406 done
5407
5408 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5409         xxx=true;
5410 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5411         xxx=true;
5412 else
5413         xxx=false;
5414 fi;
5415 if $xxx; then
5416         case "$dflt" in
5417         *$2*);;
5418         *) dflt="$dflt -D$2";;
5419         esac;
5420 fi'
5421
5422 set signal.h LANGUAGE_C; eval $inctest
5423
5424 case "$usesocks" in
5425 $define)
5426         ccflags="$ccflags -DSOCKS"
5427         ;;
5428 esac
5429
5430 case "$hint" in
5431 default|recommended) dflt="$ccflags $dflt" ;;
5432 *) dflt="$ccflags";;
5433 esac
5434
5435 case "$dflt" in
5436 ''|' ') dflt=none;;
5437 esac
5438
5439 $cat <<EOH
5440
5441 Your C compiler may want other flags.  For this question you should include
5442 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5443 but you should NOT include libraries or ld flags like -lwhatever.  If you
5444 want $package to honor its debug switch, you should include -DDEBUGGING here.
5445 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5446
5447 To use no flags, specify the word "none".
5448
5449 EOH
5450 set X $dflt
5451 shift
5452 dflt=${1+"$@"}
5453 rp="Any additional cc flags?"
5454 . ./myread
5455 case "$ans" in
5456 none) ccflags='';;
5457 *) ccflags="$ans";;
5458 esac
5459
5460 : the following weeds options from ccflags that are of no interest to cpp
5461 case "$cppflags" in
5462 '') cppflags="$ccflags" ;;
5463 *)  cppflags="$cppflags $ccflags" ;;
5464 esac
5465 case "$gccversion" in
5466 1*) cppflags="$cppflags -D__GNUC__"
5467 esac
5468 case "$mips_type" in
5469 '');;
5470 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5471 esac
5472 case "$cppflags" in
5473 '');;
5474 *)
5475         echo " "
5476         echo "Let me guess what the preprocessor flags are..." >&4
5477         set X $cppflags
5478         shift
5479         cppflags=''
5480         $cat >cpp.c <<'EOM'
5481 #define BLURFL foo
5482
5483 BLURFL xx LFRULB
5484 EOM
5485         previous=''
5486         for flag in $*
5487         do
5488                 case "$flag" in
5489                 -*) ftry="$flag";;
5490                 *) ftry="$previous $flag";;
5491                 esac
5492                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5493                         >cpp1.out 2>/dev/null && \
5494                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5495                         >cpp2.out 2>/dev/null && \
5496                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5497                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5498                 then
5499                         cppflags="$cppflags $ftry"
5500                         previous=''
5501                 else
5502                         previous="$flag"
5503                 fi
5504         done
5505         set X $cppflags
5506         shift
5507         cppflags=${1+"$@"}
5508         case "$cppflags" in
5509         *-*)  echo "They appear to be: $cppflags";;
5510         esac
5511         $rm -f cpp.c cpp?.out
5512         ;;
5513 esac
5514
5515 : flags used in final linking phase
5516 case "$ldflags" in
5517 '') if ./venix; then
5518                 dflt='-i -z'
5519         else
5520                 dflt=''
5521         fi
5522         case "$ccflags" in
5523         *-posix*) dflt="$dflt -posix" ;;
5524         esac
5525         ;;
5526 *) dflt="$ldflags";;
5527 esac
5528 # See note above about -fstack-protector
5529 case "$ccflags" in
5530 *-fstack-protector*)
5531         case "$dflt" in
5532         *-fstack-protector*) ;; # Don't add it again
5533         *) dflt="$dflt -fstack-protector" ;;
5534         esac
5535         ;;
5536 esac
5537
5538 : Try to guess additional flags to pick up local libraries.
5539 for thislibdir in $libpth; do
5540         case " $loclibpth " in
5541         *" $thislibdir "*)
5542                 case "$dflt " in
5543                 *"-L$thislibdir "*) ;;
5544                 *)  dflt="$dflt -L$thislibdir" ;;
5545                 esac
5546                 ;;
5547         esac
5548 done
5549
5550 case "$dflt" in
5551 '') dflt='none' ;;
5552 esac
5553
5554 $cat <<EOH
5555
5556 Your C linker may need flags.  For this question you should
5557 include -L/whatever and any other flags used by the C linker, but you
5558 should NOT include libraries like -lwhatever.
5559
5560 Make sure you include the appropriate -L/path flags if your C linker
5561 does not normally search all of the directories you specified above,
5562 namely
5563         $libpth
5564 To use no flags, specify the word "none".
5565
5566 EOH
5567
5568 rp="Any additional ld flags (NOT including libraries)?"
5569 . ./myread
5570 case "$ans" in
5571 none) ldflags='';;
5572 *) ldflags="$ans";;
5573 esac
5574 rmlist="$rmlist pdp11"
5575
5576 : coherency check
5577 echo " "
5578 echo "Checking your choice of C compiler and flags for coherency..." >&4
5579 $cat > try.c <<'EOF'
5580 #include <stdio.h>
5581 int main() { printf("Ok\n"); return(0); }
5582 EOF
5583 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5584 shift
5585 $cat >try.msg <<'EOM'
5586 I've tried to compile and run the following simple program:
5587
5588 EOM
5589 $cat try.c >> try.msg
5590
5591 $cat >> try.msg <<EOM
5592
5593 I used the command:
5594
5595         $*
5596         $run ./try
5597
5598 and I got the following output:
5599
5600 EOM
5601 dflt=y
5602 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5603         if $sh -c "$run ./try " >>try.msg 2>&1; then
5604                 xxx=`$run ./try`
5605                 case "$xxx" in
5606                 "Ok") dflt=n ;;
5607                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5608                 esac
5609         else
5610                 echo "The program compiled OK, but exited with status $?." >>try.msg
5611                 rp="You have a problem.  Shall I abort Configure"
5612                 dflt=y
5613         fi
5614 else
5615         echo "I can't compile the test program." >>try.msg
5616         rp="You have a BIG problem.  Shall I abort Configure"
5617         dflt=y
5618 fi
5619 case "$dflt" in
5620 y)
5621         $cat try.msg >&4
5622         case "$knowitall" in
5623         '')
5624                 echo "(The supplied flags or libraries might be incorrect.)"
5625                 ;;
5626         *) dflt=n;;
5627         esac
5628         echo " "
5629         . ./myread
5630         case "$ans" in
5631         n*|N*) ;;
5632         *)      echo "Ok.  Stopping Configure." >&4
5633                 exit 1
5634                 ;;
5635         esac
5636         ;;
5637 n) echo "OK, that should do.";;
5638 esac
5639 $rm_try gcctest gcctest.out
5640
5641 : define a shorthand compile call
5642 compile='
5643 mc_file=$1;
5644 shift;
5645 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5646 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5647 exit 1;
5648 fi;
5649 esac;
5650 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5651 : define a shorthand compile call for compilations that should be ok.
5652 compile_ok='
5653 mc_file=$1;
5654 shift;
5655 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5656
5657 : determine filename position in cpp output
5658 echo " "
5659 echo "Computing filename position in cpp output for #include directives..." >&4
5660 case "$osname" in
5661 vos) testaccess=-e ;;
5662 *)   testaccess=-r ;;
5663 esac
5664 echo '#include <stdio.h>' > foo.c
5665 $cat >fieldn <<EOF
5666 $startsh
5667 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5668 $grep '^[       ]*#.*stdio\.h' | \
5669 while read cline; do
5670         pos=1
5671         set \$cline
5672         while $test \$# -gt 0; do
5673                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5674                         echo "\$pos"
5675                         exit 0
5676                 fi
5677                 shift
5678                 pos=\`expr \$pos + 1\`
5679         done
5680 done
5681 EOF
5682 chmod +x fieldn
5683 fieldn=`./fieldn`
5684 $rm -f foo.c fieldn
5685 case $fieldn in
5686 '') pos='???';;
5687 1) pos=first;;
5688 2) pos=second;;
5689 3) pos=third;;
5690 *) pos="${fieldn}th";;
5691 esac
5692 echo "Your cpp writes the filename in the $pos field of the line."
5693
5694 : locate header file
5695 $cat >findhdr <<EOF
5696 $startsh
5697 wanted=\$1
5698 name=''
5699 for usrincdir in $incpth
5700 do
5701         if test -f \$usrincdir/\$wanted; then
5702                 echo "\$usrincdir/\$wanted"
5703                 exit 0
5704         fi
5705 done
5706 awkprg='{ print \$$fieldn }'
5707 echo "#include <\$wanted>" > foo\$\$.c
5708 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5709 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5710 while read cline; do
5711         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5712         case "\$name" in
5713         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5714         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5715         *) exit 2;;
5716         esac;
5717 done;
5718 #
5719 # status = 0: grep returned 0 lines, case statement not executed
5720 # status = 1: headerfile found
5721 # status = 2: while loop executed, no headerfile found
5722 #
5723 status=\$?
5724 $rm -f foo\$\$.c;
5725 if test \$status -eq 1; then
5726         exit 0;
5727 fi
5728 exit 1
5729 EOF
5730 chmod +x findhdr
5731
5732 : define an alternate in-header-list? function
5733 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5734 cont=true; xxf="echo \"<\$1> found.\" >&4";
5735 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5736 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5737 esac;
5738 case $# in 4) instead=instead;; *) instead="at last";; esac;
5739 while $test "$cont"; do
5740         xxx=`./findhdr $1`
5741         var=$2; eval "was=\$$2";
5742         if $test "$xxx" && $test -r "$xxx";
5743         then eval $xxf;
5744         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5745                 cont="";
5746         else eval $xxnf;
5747         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5748         set $yyy; shift; shift; yyy=$@;
5749         case $# in 0) cont="";;
5750         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5751                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5752         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5753                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5754         esac;
5755 done;
5756 while $test "$yyy";
5757 do set $yyy; var=$2; eval "was=\$$2";
5758         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5759         set $yyy; shift; shift; yyy=$@;
5760 done'
5761
5762 : see if stdint is available
5763 set stdint.h i_stdint
5764 eval $inhdr
5765
5766 : see if stdlib is available
5767 set stdlib.h i_stdlib
5768 eval $inhdr
5769
5770 : check for lengths of integral types
5771 echo " "
5772 case "$intsize" in
5773 '')
5774         echo "Checking to see how big your integers are..." >&4
5775         $cat >try.c <<EOCP
5776 #include <stdio.h>
5777 #$i_stdlib I_STDLIB
5778 #ifdef I_STDLIB
5779 #include <stdlib.h>
5780 #endif
5781 int main()
5782 {
5783         printf("intsize=%d;\n", (int)sizeof(int));
5784         printf("longsize=%d;\n", (int)sizeof(long));
5785         printf("shortsize=%d;\n", (int)sizeof(short));
5786         exit(0);
5787 }
5788 EOCP
5789         set try
5790         if eval $compile_ok && $run ./try > /dev/null; then
5791                 eval `$run ./try`
5792                 echo "Your integers are $intsize bytes long."
5793                 echo "Your long integers are $longsize bytes long."
5794                 echo "Your short integers are $shortsize bytes long."
5795         else
5796                 $cat >&4 <<EOM
5797 !
5798 Help! I can't compile and run the intsize test program: please enlighten me!
5799 (This is probably a misconfiguration in your system or libraries, and
5800 you really ought to fix it.  Still, I'll try anyway.)
5801 !
5802 EOM
5803                 dflt=4
5804                 rp="What is the size of an integer (in bytes)?"
5805                 . ./myread
5806                 intsize="$ans"
5807                 dflt=$intsize
5808                 rp="What is the size of a long integer (in bytes)?"
5809                 . ./myread
5810                 longsize="$ans"
5811                 dflt=2
5812                 rp="What is the size of a short integer (in bytes)?"
5813                 . ./myread
5814                 shortsize="$ans"
5815         fi
5816         ;;
5817 esac
5818 $rm_try
5819
5820 : check for long long
5821 echo " "
5822 echo "Checking to see if you have long long..." >&4
5823 echo 'int main() { long long x = 7; return 0; }' > try.c
5824 set try
5825 if eval $compile; then
5826         val="$define"
5827         echo "You have long long."
5828 else
5829         val="$undef"
5830         echo "You do not have long long."
5831 fi
5832 $rm_try
5833 set d_longlong
5834 eval $setvar
5835
5836 : check for length of long long
5837 case "${d_longlong}${longlongsize}" in
5838 $define)
5839         echo " "
5840         echo "Checking to see how big your long longs are..." >&4
5841         $cat >try.c <<'EOCP'
5842 #include <stdio.h>
5843 int main()
5844 {
5845     printf("%d\n", (int)sizeof(long long));
5846     return(0);
5847 }
5848 EOCP
5849         set try
5850         if eval $compile_ok; then
5851                 longlongsize=`$run ./try`
5852                 echo "Your long longs are $longlongsize bytes long."
5853         else
5854                 dflt='8'
5855                 echo " "
5856                 echo "(I can't seem to compile the test program.  Guessing...)"
5857                 rp="What is the size of a long long (in bytes)?"
5858                 . ./myread
5859                 longlongsize="$ans"
5860         fi
5861         if $test "X$longsize" = "X$longlongsize"; then
5862                 echo "(That isn't any different from an ordinary long.)"
5863         fi
5864         ;;
5865 esac
5866 $rm_try
5867
5868 : see if inttypes.h is available
5869 : we want a real compile instead of Inhdr because some systems
5870 : have an inttypes.h which includes non-existent headers
5871 echo " "
5872 $cat >try.c <<EOCP
5873 #include <inttypes.h>
5874 int main() {
5875         static int32_t foo32 = 0x12345678;
5876 }
5877 EOCP
5878 set try
5879 if eval $compile; then
5880         echo "<inttypes.h> found." >&4
5881         val="$define"
5882 else
5883         echo "<inttypes.h> NOT found." >&4
5884         val="$undef"
5885 fi
5886 $rm_try
5887 set i_inttypes
5888 eval $setvar
5889
5890 : check for int64_t
5891 echo " "
5892 echo "Checking to see if you have int64_t..." >&4
5893 $cat >try.c <<EOCP
5894 #include <sys/types.h>
5895 #$i_inttypes I_INTTYPES
5896 #ifdef I_INTTYPES
5897 #include <inttypes.h>
5898 #endif
5899 int main() { int64_t x = 7; }
5900 EOCP
5901 set try
5902 if eval $compile; then
5903         val="$define"
5904         echo "You have int64_t."
5905 else
5906         val="$undef"
5907         echo "You do not have int64_t."
5908 fi
5909 $rm_try
5910 set d_int64_t
5911 eval $setvar
5912
5913 : Check if 64bit ints have a quad type
5914 echo " "
5915 echo "Checking which 64-bit integer type we could use..." >&4
5916
5917 case "$intsize" in
5918 8) val=int
5919    set quadtype
5920    eval $setvar
5921    val='"unsigned int"'
5922    set uquadtype
5923    eval $setvar
5924    quadkind=1
5925    ;;
5926 *) case "$longsize" in
5927    8) val=long
5928       set quadtype
5929       eval $setvar
5930       val='"unsigned long"'
5931       set uquadtype
5932       eval $setvar
5933       quadkind=2
5934       ;;
5935    *) case "$d_longlong:$longlongsize" in
5936       define:8)
5937         val='"long long"'
5938         set quadtype
5939         eval $setvar
5940         val='"unsigned long long"'
5941         set uquadtype
5942         eval $setvar
5943         quadkind=3
5944         ;;
5945       *) case "$d_int64_t" in
5946          define)
5947            val=int64_t
5948            set quadtype
5949            eval $setvar
5950            val=uint64_t
5951            set uquadtype
5952            eval $setvar
5953            quadkind=4
5954            ;;
5955          esac
5956          ;;
5957       esac
5958       ;;
5959    esac
5960    ;;
5961 esac
5962
5963 case "$quadtype" in
5964 '')     echo "Alas, no 64-bit integer types in sight." >&4
5965         d_quad="$undef"
5966         ;;
5967 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5968         d_quad="$define"
5969         ;;
5970 esac
5971
5972 : Do we want 64bit support
5973 case "$uselonglong" in
5974 "$define"|true|[yY]*)
5975         cat <<EOM >&4
5976
5977 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5978 EOM
5979         use64bitint="$define"
5980         ;;
5981 esac
5982 case "$use64bits" in
5983 "$define"|true|[yY]*)
5984         cat <<EOM >&4
5985
5986 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5987 EOM
5988         use64bitint="$define"
5989         ;;
5990 esac
5991 case "$use64bitints" in
5992 "$define"|true|[yY]*)
5993         cat <<EOM >&4
5994
5995 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5996 EOM
5997         use64bitint="$define"
5998         ;;
5999 esac
6000 case "$use64bitsint" in
6001 "$define"|true|[yY]*)
6002         cat <<EOM >&4
6003
6004 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6005 EOM
6006         use64bitint="$define"
6007         ;;
6008 esac
6009 case "$uselonglongs" in
6010 "$define"|true|[yY]*)
6011         cat <<EOM >&4
6012
6013 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6014 EOM
6015         use64bitint="$define"
6016         ;;
6017 esac
6018 case "$use64bitsall" in
6019 "$define"|true|[yY]*)
6020         cat <<EOM >&4
6021
6022 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6023 EOM
6024         use64bitall="$define"
6025         ;;
6026 esac
6027
6028 case "$ccflags" in
6029 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6030 esac
6031 case "$use64bitall" in
6032 "$define"|true|[yY]*) use64bitint="$define" ;;
6033 esac
6034
6035 case "$longsize" in
6036 8) cat <<EOM
6037
6038 You have natively 64-bit long integers.
6039 EOM
6040    val="$define"
6041    ;;
6042 *) case "$use64bitint" in
6043    "$define"|true|[yY]*) dflt='y';;
6044    *) dflt='n';;
6045    esac
6046    case "$d_quad" in
6047    "$define") ;;
6048    *) dflt='n' ;;
6049    esac
6050    cat <<EOM
6051
6052 Perl can be built to take advantage of 64-bit integer types
6053 on some systems.  To do so, Configure can be run with -Duse64bitint.
6054 Choosing this option will most probably introduce binary incompatibilities.
6055
6056 If this doesn't make any sense to you, just accept the default '$dflt'.
6057 (The default has been chosen based on your configuration.)
6058 EOM
6059    rp='Try to use 64-bit integers, if available?'
6060    . ./myread
6061    case "$ans" in
6062    [yY]*) val="$define" ;;
6063    *)     val="$undef"  ;;
6064    esac
6065    ;;
6066 esac
6067 set use64bitint
6068 eval $setvar
6069
6070 case "$use64bitall" in
6071 "$define"|true|[yY]*) dflt='y' ;;
6072 *) case "$longsize" in
6073    8) dflt='y' ;;
6074    *) dflt='n' ;;
6075    esac
6076    ;;
6077 esac
6078 cat <<EOM
6079
6080 You may also choose to try maximal 64-bitness.  It means using as much
6081 64-bitness as possible on the platform.  This in turn means even more
6082 binary incompatibilities.  On the other hand, your platform may not
6083 have any more 64-bitness available than what you already have chosen.
6084
6085 If this doesn't make any sense to you, just accept the default '$dflt'.
6086 (The default has been chosen based on your configuration.)
6087 EOM
6088 rp='Try to use maximal 64-bit support, if available?'
6089 . ./myread
6090 case "$ans" in
6091 [yY]*) val="$define" ;;
6092 *)     val="$undef"  ;;
6093 esac
6094 set use64bitall
6095 eval $setvar
6096 case "$use64bitall" in
6097 "$define")
6098         case "$use64bitint" in
6099         "$undef")
6100                 cat <<EOM
6101
6102 Since you have chosen a maximally 64-bit build, I'm also turning on
6103 the use of 64-bit integers.
6104 EOM
6105                 use64bitint="$define" ;;
6106         esac
6107         ;;
6108 esac
6109
6110 : Look for a hint-file generated 'call-back-unit'.  If the
6111 : user has specified that a 64-bit perl is to be built,
6112 : we may need to set or change some other defaults.
6113 if $test -f use64bitint.cbu; then
6114         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6115         . ./use64bitint.cbu
6116 fi
6117 case "$use64bitint" in
6118 "$define"|true|[yY]*)
6119         : This test was common to all the OpenBSD forks, and seems harmless for
6120         : other platforms:
6121         echo " "
6122         echo "Checking if your C library has broken 64-bit functions..." >&4
6123         cat >try.c <<EOCP
6124 #include <stdio.h>
6125 typedef $uquadtype myULL;
6126 int main (void)
6127 {
6128     struct {
6129         double d;
6130         myULL  u;
6131     } *p, test[] = {
6132         {4294967303.15, 4294967303ULL},
6133         {4294967294.2,  4294967294ULL},
6134         {4294967295.7,  4294967295ULL},
6135         {0.0, 0ULL}
6136     };
6137     for (p = test; p->u; p++) {
6138         myULL x = (myULL)p->d;
6139         if (x != p->u) {
6140             printf("buggy\n");
6141             return 0;
6142         }
6143     }
6144     printf("ok\n");
6145     return 0;
6146 }
6147 EOCP
6148         set try
6149         if eval $compile_ok; then
6150             libcquad=`$run ./try`
6151             echo "Your C library's 64-bit functions are $libcquad."
6152         else
6153             echo "(I can't seem to compile the test program.)"
6154             echo "Assuming that your C library's 64-bit functions are ok."
6155             libcquad="ok"
6156         fi
6157         $rm_try
6158
6159         case "$libcquad" in
6160             buggy*)
6161                 cat >&4 <<EOM
6162
6163 *** You have a C library with broken 64-bit functions.
6164 *** 64-bit support does not work reliably in this configuration.
6165 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6166 *** Cannot continue, aborting.
6167
6168 EOM
6169                 exit 1
6170                 ;;
6171         esac
6172         case "$longsize" in
6173         4) case "$archname64" in
6174            '') archname64=64int ;;
6175            esac
6176            ;;
6177         esac
6178         ;;
6179 esac
6180
6181 : Look for a hint-file generated 'call-back-unit'.  If the
6182 : user has specified that a maximally 64-bit perl is to be built,
6183 : we may need to set or change some other defaults.
6184 if $test -f use64bitall.cbu; then
6185         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6186         . ./use64bitall.cbu
6187 fi
6188 case "$use64bitall" in
6189 "$define"|true|[yY]*)
6190         case "$longsize" in
6191         4) case "$archname64" in
6192            ''|64int) archname64=64all ;;
6193            esac
6194            ;;
6195         esac
6196         ;;
6197 esac
6198
6199 case "$d_quad:$use64bitint" in
6200 $undef:$define)
6201         cat >&4 <<EOF
6202
6203 *** You have chosen to use 64-bit integers,
6204 *** but none can be found.
6205 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6206 *** Cannot continue, aborting.
6207
6208 EOF
6209         exit 1
6210         ;;
6211 esac
6212
6213 : Check if we are using the GNU C library
6214 echo " "
6215 echo "Checking for GNU C Library..." >&4
6216 cat >try.c <<'EOCP'
6217 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6218    alone are insufficient to distinguish different versions, such as
6219    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6220    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6221 */
6222 #include <stdio.h>
6223 int main(void)
6224 {
6225 #ifdef __GLIBC__
6226 #   ifdef __GLIBC_MINOR__
6227 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6228 #           include <gnu/libc-version.h>
6229             printf("%s\n",  gnu_get_libc_version());
6230 #       else
6231             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6232 #       endif
6233 #   else
6234         printf("%d\n",  __GLIBC__);
6235 #   endif
6236     return 0;
6237 #else
6238     return 1;
6239 #endif
6240 }
6241 EOCP
6242 set try
6243 if eval $compile_ok && $run ./try > glibc.ver; then
6244         val="$define"
6245         gnulibc_version=`$cat glibc.ver`
6246         echo "You are using the GNU C Library version $gnulibc_version"
6247 else
6248         val="$undef"
6249         gnulibc_version=''
6250         echo "You are not using the GNU C Library"
6251 fi
6252 $rm_try glibc.ver
6253 set d_gnulibc
6254 eval $setvar
6255
6256 : see if nm is to be used to determine whether a symbol is defined or not
6257 case "$usenm" in
6258 '')
6259         dflt=''
6260         case "$d_gnulibc" in
6261         "$define")
6262                 echo " "
6263                 echo "nm probably won't work on the GNU C Library." >&4
6264                 dflt=n
6265                 ;;
6266         esac
6267         case "$dflt" in
6268         '')
6269                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6270                         echo " "
6271                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6272                         echo "'nm' won't be sufficient on this system." >&4
6273                         dflt=n
6274                 fi
6275                 ;;
6276         esac
6277         case "$dflt" in
6278         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6279                 if $test $dflt -gt 20; then
6280                         dflt=y
6281                 else
6282                         dflt=n
6283                 fi
6284                 ;;
6285         esac
6286         ;;
6287 *)
6288         case "$usenm" in
6289         true|$define) dflt=y;;
6290         *) dflt=n;;
6291         esac
6292         ;;
6293 esac
6294 $cat <<EOM
6295
6296 I can use $nm to extract the symbols from your C libraries. This
6297 is a time consuming task which may generate huge output on the disk (up
6298 to 3 megabytes) but that should make the symbols extraction faster. The
6299 alternative is to skip the 'nm' extraction part and to compile a small
6300 test program instead to determine whether each symbol is present. If
6301 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6302 this may be the best solution.
6303
6304 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6305
6306 EOM
6307 rp="Shall I use $nm to extract C symbols from the libraries?"
6308 . ./myread
6309 case "$ans" in
6310 [Nn]*) usenm=false;;
6311 *) usenm=true;;
6312 esac
6313
6314 runnm=$usenm
6315 case "$reuseval" in
6316 true) runnm=false;;
6317 esac
6318
6319 : nm options which may be necessary
6320 case "$nm_opt" in
6321 '') if $test -f /mach_boot; then
6322                 nm_opt=''       # Mach
6323         elif $test -d /usr/ccs/lib; then
6324                 nm_opt='-p'     # Solaris (and SunOS?)
6325         elif $test -f /dgux; then
6326                 nm_opt='-p'     # DG-UX
6327         elif $test -f /lib64/rld; then
6328                 nm_opt='-p'     # 64-bit Irix
6329         else
6330                 nm_opt=''
6331         fi;;
6332 esac
6333
6334 : nm options which may be necessary for shared libraries but illegal
6335 : for archive libraries.  Thank you, Linux.
6336 case "$nm_so_opt" in
6337 '')     case "$myuname" in
6338         *linux*|gnu*)
6339                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6340                         nm_so_opt='--dynamic'
6341                 fi
6342                 ;;
6343         esac
6344         ;;
6345 esac
6346
6347 : Figure out where the libc is located
6348 case "$runnm" in
6349 true)
6350 : get list of predefined functions in a handy place
6351 echo " "
6352 case "$libc" in
6353 '') libc=unknown
6354         case "$libs" in
6355         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6356         esac
6357         ;;
6358 esac
6359 case "$libs" in
6360 '') ;;
6361 *)  for thislib in $libs; do
6362         case "$thislib" in
6363         -lc|-lc_s)
6364                 : Handle C library specially below.
6365                 ;;
6366         -l*)
6367                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6368                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6369                         :
6370                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6371                         :
6372                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6373                         :
6374                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6375                         :
6376                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6377                         :
6378                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6379                         :
6380                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6381                         :
6382                 else
6383                         try=''
6384                 fi
6385                 libnames="$libnames $try"
6386                 ;;
6387         *) libnames="$libnames $thislib" ;;
6388         esac
6389         done
6390         ;;
6391 esac
6392 xxx=normal
6393 case "$libc" in
6394 unknown)
6395         set /lib/libc.$so
6396         for xxx in $libpth; do
6397                 $test -r $1 || set $xxx/libc.$so
6398                 : The messy sed command sorts on library version numbers.
6399                 $test -r $1 || \
6400                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6401                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6402                                 h
6403                                 s/[0-9][0-9]*/0000&/g
6404                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6405                                 G
6406                                 s/\n/ /' | \
6407                          $sort | $sed -e 's/^.* //'`
6408                 eval set \$$#
6409         done
6410         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6411         $test -r $1 || set $sysroot/lib/libsys_s$_a
6412         ;;
6413 *)
6414         set blurfl
6415         ;;
6416 esac
6417 if $test -r "$1"; then
6418         echo "Your (shared) C library seems to be in $1."
6419         libc="$1"
6420 elif $test -r /lib/libc && $test -r /lib/clib; then
6421         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6422         xxx=apollo
6423         libc='/lib/clib /lib/libc'
6424         if $test -r /lib/syslib; then
6425                 echo "(Your math library is in /lib/syslib.)"
6426                 libc="$libc /lib/syslib"
6427         fi
6428 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6429         echo "Your C library seems to be in $libc, as you said before."
6430 elif $test -r $incpath/usr/lib/libc$_a; then
6431         libc=$incpath/usr/lib/libc$_a;
6432         echo "Your C library seems to be in $libc.  That's fine."
6433 elif $test -r /lib/libc$_a; then
6434         libc=/lib/libc$_a;
6435         echo "Your C library seems to be in $libc.  You're normal."
6436 else
6437         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6438                 :
6439         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6440                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6441         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6442                 :
6443         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6444                 :
6445         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6446                 :
6447         else
6448                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6449         fi
6450         if $test -r "$tans"; then
6451                 echo "Your C library seems to be in $tans, of all places."
6452                 libc=$tans
6453         else
6454                 libc='blurfl'
6455         fi
6456 fi
6457 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6458         dflt="$libc"
6459         cat <<EOM
6460
6461 If the guess above is wrong (which it might be if you're using a strange
6462 compiler, or your machine supports multiple models), you can override it here.
6463
6464 EOM
6465 else
6466         dflt=''
6467         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6468         cat >&4 <<EOM
6469 I can't seem to find your C library.  I've looked in the following places:
6470
6471 EOM
6472         $sed 's/^/      /' libpath
6473         cat <<EOM
6474
6475 None of these seems to contain your C library. I need to get its name...
6476
6477 EOM
6478 fi
6479 fn=f
6480 rp='Where is your C library?'
6481 . ./getfile
6482 libc="$ans"
6483
6484 echo " "
6485 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6486 set X `cat libnames`
6487 shift
6488 xxx=files
6489 case $# in 1) xxx=file; esac
6490 echo "Extracting names from the following $xxx for later perusal:" >&4
6491 echo " "
6492 $sed 's/^/      /' libnames >&4
6493 echo " "
6494 $echo $n "This may take a while...$c" >&4
6495
6496 for file in $*; do
6497         case $file in
6498         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6499         *) $nm $nm_opt $file 2>/dev/null;;
6500         esac
6501 done >libc.tmp
6502
6503 $echo $n ".$c"
6504 $grep fprintf libc.tmp > libc.ptf
6505 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6506 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6507 xxx='[ADTSIWi]'
6508 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6509         eval $xscan;\
6510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6511                 eval $xrun
6512 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6513         eval $xscan;\
6514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6515                 eval $xrun
6516 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6517         eval $xscan;\
6518         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6519                 eval $xrun
6520 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6521         eval $xscan;\
6522         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6523                 eval $xrun
6524 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6525         eval $xscan;\
6526         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6527                 eval $xrun
6528 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6529         eval $xscan;\
6530         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6531                 eval $xrun
6532 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6533                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6534         eval $xscan;\
6535         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6536                 eval $xrun
6537 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6538         eval $xscan;\
6539         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6540                 eval $xrun
6541 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6542         eval $xscan;\
6543         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6544                 eval $xrun
6545 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6546         eval $xscan;\
6547         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6548                 eval $xrun
6549 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6550         eval $xscan;\
6551         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6552                 eval $xrun
6553 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6554         eval $xscan;\
6555         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6556                 eval $xrun
6557 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6558         eval $xscan;\
6559         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6560                 eval $xrun
6561 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6562         eval $xscan;\
6563         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6564                 eval $xrun
6565 else
6566         $nm -p $* 2>/dev/null >libc.tmp
6567         $grep fprintf libc.tmp > libc.ptf
6568         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6569                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6570         then
6571                 nm_opt='-p'
6572                 eval $xrun
6573         else
6574                 echo " "
6575                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6576                 com=''
6577                 if $ar t $libc > libc.tmp && \
6578                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6579                 then
6580                         for thisname in $libnames $libc; do
6581                                 $ar t $thisname >>libc.tmp
6582                         done
6583                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6584                         echo "Ok." >&4
6585                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6586                         for thisname in $libnames $libc; do
6587                                 $ar tv $thisname >>libc.tmp
6588                                 emximp -o tmp.imp $thisname \
6589                                     2>/dev/null && \
6590                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6591                                     < tmp.imp >>libc.tmp
6592                                 $rm -f tmp.imp
6593                         done
6594                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6595                         echo "Ok." >&4
6596                 else
6597                         echo "$ar didn't seem to work right." >&4
6598                         echo "Maybe this is a Cray...trying bld instead..." >&4
6599                         if  bld t $libc | \
6600                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6601                                 $test -s libc.list
6602                         then
6603                                 for thisname in $libnames; do
6604                                         bld t $libnames | \
6605                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6606                                         $ar t $thisname >>libc.tmp
6607                                 done
6608                                 echo "Ok." >&4
6609                         else
6610                                 echo "That didn't work either.  Giving up." >&4
6611                                 exit 1
6612                         fi
6613                 fi
6614         fi
6615 fi
6616 nm_extract="$com"
6617 case "$PASE" in
6618 define)
6619     echo " "
6620     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6621     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6622     ;;
6623 *)  if $test -f /lib/syscalls.exp; then
6624         echo " "
6625         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6626         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6627                 /lib/syscalls.exp >>libc.list
6628     fi
6629     ;;
6630 esac
6631 ;;
6632 esac
6633 $rm -f libnames libpath
6634
6635 : Check if we are using C++
6636 echo " "
6637 echo "Checking for C++..." >&4
6638 $cat >try.c <<'EOCP'
6639 #include <stdio.h>
6640 int main(void)
6641 {
6642 #ifdef __cplusplus
6643     return 0;
6644 #else
6645     return 1;
6646 #endif
6647 }
6648 EOCP
6649 set try
6650 if eval $compile_ok && $run ./try; then
6651         val="$define"
6652         echo "You are using a C++ compiler."
6653 else
6654         val="$undef"
6655         echo "You are not using a C++ compiler."
6656 fi
6657 $rm_try cplusplus$$
6658 set d_cplusplus
6659 eval $setvar
6660
6661 : is a C symbol defined?
6662 csym='tlook=$1;
6663 case "$3" in
6664 -v) tf=libc.tmp; tdc="";;
6665 -a) tf=libc.tmp; tdc="[]";;
6666 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6667 esac;
6668 case "$d_cplusplus" in
6669     $define)    extern_C="extern \"C\"" ;;
6670     *)          extern_C="extern"       ;;
6671 esac;
6672 tx=yes;
6673 case "$reuseval-$4" in
6674 true-) ;;
6675 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6676 esac;
6677 case "$tx" in
6678 yes)
6679         tval=false;
6680         if $test "$runnm" = true; then
6681                 if $contains $tlook $tf >/dev/null 2>&1; then
6682                         tval=true;
6683                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6684                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6685                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6686                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6687                         $rm_try;
6688                 fi;
6689         else
6690                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
6691                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6692                 $rm_try;
6693         fi;
6694         ;;
6695 *)
6696         case "$tval" in
6697         $define) tval=true;;
6698         *) tval=false;;
6699         esac;
6700         ;;
6701 esac;
6702 eval "$2=$tval"'
6703
6704 : define an is-in-libc? function
6705 inlibc='echo " "; td=$define; tu=$undef;
6706 sym=$1; var=$2; eval "was=\$$2";
6707 tx=yes;
6708 case "$reuseval$was" in
6709 true) ;;
6710 true*) tx=no;;
6711 esac;
6712 case "$tx" in
6713 yes)
6714         set $sym tres -f;
6715         eval $csym;
6716         case "$tres" in
6717         true)
6718                 echo "$sym() found." >&4;
6719                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6720         *)
6721                 echo "$sym() NOT found." >&4;
6722                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6723         esac;;
6724 *)
6725         case "$was" in
6726         $define) echo "$sym() found." >&4;;
6727         *) echo "$sym() NOT found." >&4;;
6728         esac;;
6729 esac'
6730
6731 : check for length of double
6732 echo " "
6733 case "$doublesize" in
6734 '')
6735         echo "Checking to see how big your double precision numbers are..." >&4
6736         $cat >try.c <<EOCP
6737 #include <stdio.h>
6738 #$i_stdlib I_STDLIB
6739 #ifdef I_STDLIB
6740 #include <stdlib.h>
6741 #endif
6742 int main()
6743 {
6744     printf("%d\n", (int)sizeof(double));
6745     exit(0);
6746 }
6747 EOCP
6748         set try
6749         if eval $compile_ok; then
6750                 doublesize=`$run ./try`
6751                 echo "Your double is $doublesize bytes long."
6752         else
6753                 dflt='8'
6754                 echo "(I can't seem to compile the test program.  Guessing...)"
6755                 rp="What is the size of a double precision number (in bytes)?"
6756                 . ./myread
6757                 doublesize="$ans"
6758         fi
6759         ;;
6760 esac
6761 $rm_try
6762
6763 : see if this is a fenv.h system
6764 set fenv.h i_fenv
6765 eval $inhdr
6766
6767 : see if this is a float.h system
6768 set float.h i_float
6769 eval $inhdr
6770
6771 : check for long doubles
6772 echo " "
6773 echo "Checking to see if you have long double..." >&4
6774 echo 'int main() { long double x = 7.0; }' > try.c
6775 set try
6776 if eval $compile; then
6777         val="$define"
6778         echo "You have long double."
6779 else
6780         val="$undef"
6781         echo "You do not have long double."
6782 fi
6783 $rm_try
6784 set d_longdbl
6785 eval $setvar
6786
6787 : see if ldexpl exists
6788 set ldexpl d_ldexpl
6789 eval $inlibc
6790
6791 : check for length of long double
6792 case "${d_longdbl}${longdblsize}" in
6793 $define)
6794         echo " "
6795         echo "Checking to see how big your long doubles are..." >&4
6796         $cat >try.c <<'EOCP'
6797 #include <stdio.h>
6798 int main()
6799 {
6800         printf("%d\n", sizeof(long double));
6801 }
6802 EOCP
6803         set try
6804         set try
6805         if eval $compile; then
6806                 longdblsize=`$run ./try`
6807                 echo "Your long doubles are $longdblsize bytes long."
6808         else
6809                 dflt='8'
6810                 echo " "
6811                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6812                 rp="What is the size of a long double (in bytes)?"
6813                 . ./myread
6814                 longdblsize="$ans"
6815         fi
6816         if $test "X$doublesize" = "X$longdblsize"; then
6817                 echo "That isn't any different from an ordinary double."
6818                 echo "I'll keep your setting anyway, but you may see some"
6819                 echo "harmless compilation warnings."
6820         fi
6821         ;;
6822 esac
6823 $rm_try
6824
6825 $echo "Checking the kind of long doubles you have..." >&4
6826 case "$d_longdbl" in
6827 define)
6828 $cat <<EOP >try.c
6829 #$i_float I_FLOAT
6830 #$i_stdlib I_STDLIB
6831 #define LONGDBLSIZE $longdblsize
6832 #ifdef I_FLOAT
6833 #include <float.h>
6834 #endif
6835 #ifdef I_STDLIB
6836 #include <stdlib.h>
6837 #endif
6838 #include <stdio.h>
6839 static const long double d = -0.1L;
6840 int main() {
6841   unsigned const char* b = (unsigned const char*)(&d);
6842 #if LDBL_MANT_DIG == 113 && LONGDBLSIZE == 16
6843   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6844     /* IEEE 754 128-bit little-endian */
6845     printf("1\n");
6846     exit(0);
6847   }
6848   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6849     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6850     printf("2\n");
6851     exit(0);
6852   }
6853 #endif
6854 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6855   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6856     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6857      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6858      * Also known as "extended precision". */
6859     printf("3\n");
6860     exit(0);
6861   }
6862   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6863     /* is there ever big-endian 80-bit, really? */
6864     printf("4\n");
6865     exit(0);
6866   }
6867 #endif
6868 #if LDBL_MANT_DIG == 106 && LONGDBLSIZE == 16
6869   /* software "double double", the 106 is 53+53 */
6870   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6871     /* double double 128-bit little-endian,
6872      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6873     printf("5\n");
6874     exit(0);
6875   }
6876   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6877     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6878      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6879     printf("6\n");
6880     exit(0);
6881   }
6882 #endif
6883   printf("-1\n"); /* unknown */
6884   exit(0);
6885 }
6886 EOP
6887 set try
6888 if eval $compile; then
6889     longdblkind=`$run ./try`
6890 else
6891     longdblkind=-1
6892 fi
6893 ;;
6894 *) longdblkind=0 ;;
6895 esac
6896 case "$longdblkind" in
6897 0) echo "Your long doubles are doubles." >&4 ;;
6898 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6899 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6900 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6901 *) echo "Cannot figure out your long double." >&4 ;;
6902 esac
6903 $rm_try
6904
6905
6906 : determine the architecture name
6907 echo " "
6908 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6909         tarch=`arch`"-$osname"
6910 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6911         if uname -m > tmparch 2>&1 ; then
6912                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6913                         -e 's/$/'"-$osname/" tmparch`
6914         else
6915                 tarch="$osname"
6916         fi
6917         $rm -f tmparch
6918 else
6919         tarch="$osname"
6920 fi
6921 case "$myarchname" in
6922 ''|"$tarch") ;;
6923 *)
6924         echo "(Your architecture name used to be $myarchname.)"
6925         archname=''
6926         ;;
6927 esac
6928 case "$targetarch" in
6929 '') ;;
6930 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6931 esac
6932 myarchname="$tarch"
6933 case "$archname" in
6934 '') dflt="$tarch";;
6935 *) dflt="$archname";;
6936 esac
6937 rp='What is your architecture name'
6938 . ./myread
6939 archname="$ans"
6940
6941 : optionally add API version to the architecture for versioned archlibs
6942 case "$useversionedarchname" in
6943 $define|true|[yY]*) dflt='y';;
6944 *)                  dflt='n';;
6945 esac
6946 rp='Add the Perl API version to your archname?'
6947 . ./myread
6948 case "$ans" in
6949 y|Y)    useversionedarchname="$define" ;;
6950 *)      useversionedarchname="$undef" ;;
6951 esac
6952 case "$useversionedarchname" in
6953 $define)
6954         case "$archname" in
6955         *-$api_versionstring)
6956                 echo "...and architecture name already has -$api_versionstring" >&4
6957                 ;;
6958         *)
6959                 archname="$archname-$api_versionstring"
6960                 echo "...setting architecture name to $archname." >&4
6961                 ;;
6962         esac
6963         ;;
6964 esac
6965
6966 case "$usethreads" in
6967 $define)
6968         echo "Threads selected." >&4
6969         case "$archname" in
6970         *-thread*) echo "...and architecture name already has -thread." >&4
6971                 ;;
6972         *)      archname="$archname-thread"
6973                 echo "...setting architecture name to $archname." >&4
6974                 ;;
6975         esac
6976         ;;
6977 esac
6978 case "$usemultiplicity" in
6979 $define)
6980         echo "Multiplicity selected." >&4
6981         case "$archname" in
6982         *-multi*) echo "...and architecture name already has -multi." >&4
6983                 ;;
6984         *)      archname="$archname-multi"
6985                 echo "...setting architecture name to $archname." >&4
6986                 ;;
6987         esac
6988         ;;
6989 esac
6990 case "$use64bitint$use64bitall" in
6991 *"$define"*)
6992         case "$archname64" in
6993         '')
6994                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6995                 ;;
6996         *)
6997                 case "$use64bitint" in
6998                 "$define") echo "64 bit integers selected." >&4 ;;
6999                 esac
7000                 case "$use64bitall" in
7001                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7002                 esac
7003                 case "$archname" in
7004                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7005                         ;;
7006                 *)      archname="$archname-$archname64"
7007                         echo "...setting architecture name to $archname." >&4
7008                         ;;
7009                 esac
7010                 ;;
7011         esac
7012 esac
7013 case "$uselongdouble" in
7014 $define)
7015         echo "Long doubles selected." >&4
7016         case "$longdblsize" in
7017         $doublesize)
7018                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7019                 ;;
7020         *)
7021                 case "$archname" in
7022                 *-ld*) echo "...and architecture name already has -ld." >&4
7023                         ;;
7024                 *)      archname="$archname-ld"
7025                         echo "...setting architecture name to $archname." >&4
7026                         ;;
7027                 esac
7028                 ;;
7029         esac
7030         ;;
7031 esac
7032 if $test -f archname.cbu; then
7033         echo "Your platform has some specific hints for architecture name, using them..."
7034         . ./archname.cbu
7035 fi
7036
7037 : set the prefixit variable, to compute a suitable default value
7038 prefixit='case "$3" in
7039 ""|none)
7040         case "$oldprefix" in
7041         "") eval "$1=\"\$$2\"";;
7042         *)
7043                 case "$3" in
7044                 "") eval "$1=";;
7045                 none)
7046                         eval "tp=\"\$$2\"";
7047                         case "$tp" in
7048                         ""|" ") eval "$1=\"\$$2\"";;
7049                         *) eval "$1=";;
7050                         esac;;
7051                 esac;;
7052         esac;;
7053 *)
7054         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7055         case "$tp" in
7056         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7057         /*-$oldprefix/*|\~*-$oldprefix/*)
7058                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7059         *) eval "$1=\"\$$2\"";;
7060         esac;;
7061 esac'
7062
7063 : determine installation style
7064 : For now, try to deduce it from prefix unless it is already set.
7065 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7066 case "$installstyle" in
7067 '')     case "$prefix" in
7068                 *perl*) dflt='lib';;
7069                 *) dflt='lib/perl5' ;;
7070         esac
7071         ;;
7072 *)      dflt="$installstyle" ;;
7073 esac
7074 : Probably not worth prompting for this since we prompt for all
7075 : the directories individually, and the prompt would be too long and
7076 : confusing anyway.
7077 installstyle=$dflt
7078
7079 : determine where public executables go
7080 echo " "
7081 set dflt bin bin
7082 eval $prefixit
7083 fn=d~
7084 rp='Pathname where the public executables will reside?'
7085 . ./getfile
7086 if $test "X$ansexp" != "X$binexp"; then
7087         installbin=''
7088 fi
7089 prefixvar=bin
7090 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7091 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7092 :     this via initialinstalllocation
7093 . ./setprefixvar
7094
7095 case "$userelocatableinc" in
7096 $define|true|[yY]*)     dflt='y' ;;
7097 *)                      dflt='n' ;;
7098 esac
7099 cat <<EOM
7100
7101 Would you like to build Perl so that the installation is relocatable, so that
7102 library paths in @INC are determined relative to the path of the perl binary?
7103 This is not advised for system Perl installs, or if you need to run setid
7104 scripts or scripts under taint mode.
7105
7106 If this doesn't make any sense to you, just accept the default '$dflt'.
7107 EOM
7108 rp='Use relocatable @INC?'
7109 . ./myread
7110 case "$ans" in
7111 y|Y)    val="$define" ;;
7112 *)      val="$undef"  ;;
7113 esac
7114 set userelocatableinc
7115 eval $setvar
7116
7117 initialinstalllocation="$binexp"
7118 : Default prefix is now "up one level from where the binaries are"
7119 case "$userelocatableinc" in
7120 $define|true|[yY]*)
7121     bin=".../"
7122     binexp=".../"
7123     prefix=".../.."
7124     prefixexp=".../.."
7125     installprefixexp=".../.."
7126     ;;
7127 esac
7128
7129 : determine where private library files go
7130 : Usual default is /usr/local/lib/perl5/$version.
7131 : Also allow things like /opt/perl/lib/$version, since
7132 : /opt/perl/lib/perl5... would be redundant.
7133 : The default "style" setting is made in installstyle.U
7134 case "$installstyle" in
7135 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7136 *)       set dflt privlib lib/$version ;;
7137 esac
7138 eval $prefixit
7139 $cat <<EOM
7140
7141 There are some auxiliary files for $package that need to be put into a
7142 private library directory that is accessible by everyone.
7143
7144 EOM
7145 fn=$binexp
7146 fn=d~+
7147 rp='Pathname where the private library files will reside?'
7148 . ./getfile
7149 prefixvar=privlib
7150 . ./setprefixvar
7151
7152 : set the prefixup variable, to restore leading tilda escape
7153 prefixup='case "$prefixexp" in
7154 "$prefix") ;;
7155 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7156 esac'
7157
7158 : determine where public architecture dependent libraries go
7159 set archlib archlib
7160 eval $prefixit
7161 : privlib default is /usr/local/lib/$package/$version
7162 : archlib default is /usr/local/lib/$package/$version/$archname
7163 : privlib may have an optional trailing /share.
7164 tdflt=`echo $privlib | $sed 's,/share$,,'`
7165 tdflt=$tdflt/$archname
7166 case "$archlib" in
7167 '')     dflt=$tdflt
7168         ;;
7169 *)      dflt="$archlib"
7170     ;;
7171 esac
7172 $cat <<EOM
7173
7174 $spackage contains architecture-dependent library files.  If you are
7175 sharing libraries in a heterogeneous environment, you might store
7176 these files in a separate location.  Otherwise, you can just include
7177 them with the rest of the public library files.
7178
7179 EOM
7180 fn=$binexp
7181 fn=d+~
7182 rp='Where do you want to put the public architecture-dependent libraries?'
7183 . ./getfile
7184 prefixvar=archlib
7185 . ./setprefixvar
7186 if $test X"$archlib" = X"$privlib"; then
7187         d_archlib="$undef"
7188 else
7189         d_archlib="$define"
7190 fi
7191
7192 : see if setuid scripts can be secure
7193 $cat <<EOM
7194
7195 Some kernels have a bug that prevents setuid #! scripts from being
7196 secure.  Some sites have disabled setuid #! scripts because of this.
7197
7198 First let's decide if your kernel supports secure setuid #! scripts.
7199 (If setuid #! scripts would be secure but have been disabled anyway,
7200 don't say that they are secure if asked.)
7201
7202 EOM
7203
7204 val="$undef"
7205 if $test -d /dev/fd; then
7206         echo "#!$ls" >reflect
7207         chmod +x,u+s reflect
7208         ./reflect >flect 2>&1
7209         if $contains "/dev/fd" flect >/dev/null; then
7210                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7211                 val="$define"
7212         else
7213                 $cat <<EOM
7214 If you are not sure if they are secure, I can check but I'll need a
7215 username and password different from the one you are using right now.
7216 If you don't have such a username or don't want me to test, simply
7217 enter 'none'.
7218
7219 EOM
7220                 rp='Other username to test security of setuid scripts with?'
7221                 dflt='none'
7222                 . ./myread
7223                 case "$ans" in
7224                 n|none)
7225                         case "$d_suidsafe" in
7226                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7227                                 dflt=n;;
7228                         "$undef")
7229                                 echo "Well, the $hint value is *not* secure." >&4
7230                                 dflt=n;;
7231                         *)      echo "Well, the $hint value *is* secure." >&4
7232                                 dflt=y;;
7233                         esac
7234                         ;;
7235                 *)
7236                         $rm -f reflect flect
7237                         echo "#!$ls" >reflect
7238                         chmod +x,u+s reflect
7239                         echo >flect
7240                         chmod a+w flect
7241                         echo '"su" will (probably) prompt you for '"$ans's password."
7242                         su $ans -c './reflect >flect'
7243                         if $contains "/dev/fd" flect >/dev/null; then
7244                                 echo "Okay, it looks like setuid scripts are secure." >&4
7245                                 dflt=y
7246                         else
7247                                 echo "I don't think setuid scripts are secure." >&4
7248                                 dflt=n
7249                         fi
7250                         ;;
7251                 esac
7252                 rp='Does your kernel have *secure* setuid scripts?'
7253                 . ./myread
7254                 case "$ans" in
7255                 [yY]*)  val="$define";;
7256                 *)      val="$undef";;
7257                 esac
7258         fi
7259 else
7260         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7261         echo "(That's for file descriptors, not floppy disks.)"
7262         val="$undef"
7263 fi
7264 set d_suidsafe
7265 eval $setvar
7266
7267 $rm -f reflect flect
7268
7269 : now see if they want to do setuid emulation
7270 if $test $patchlevel -lt 11; then
7271 echo " "
7272 val="$undef"
7273 case "$d_suidsafe" in
7274 "$define")
7275         val="$undef"
7276         echo "No need to emulate SUID scripts since they are secure here." >&4
7277         ;;
7278 *)
7279         $cat <<EOM
7280 Some systems have disabled setuid scripts, especially systems where
7281 setuid scripts cannot be secure.  On systems where setuid scripts have
7282 been disabled, the setuid/setgid bits on scripts are currently
7283 useless.  It is possible for $package to detect those bits and emulate
7284 setuid/setgid in a secure fashion.  This emulation will only work if
7285 setuid scripts have been disabled in your kernel.
7286
7287 EOM
7288         case "$d_dosuid" in
7289         "$define") dflt=y ;;
7290         *) dflt=n ;;
7291         esac
7292         rp="Do you want to do setuid/setgid emulation?"
7293         . ./myread
7294         case "$ans" in
7295         [yY]*)  val="$define";;
7296         *)      val="$undef";;
7297         esac
7298         ;;
7299 esac
7300 set d_dosuid
7301 eval $setvar
7302 else
7303     case "$d_dosuid" in
7304         "$define")
7305         cat >&4 <<EOH
7306
7307 SUID emulation has been removed for 5.12
7308 Please re-run Configure without -Dd_dosuid
7309
7310 EOH
7311         exit 1;
7312         ;;
7313     esac
7314     d_dosuid=undef
7315 fi
7316
7317 : Find perl5.005 or later.
7318 echo "Looking for a previously installed perl5.005 or later... "
7319 case "$perl5" in
7320 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7321                 : Check if this perl is recent and can load a simple module
7322                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7323                         perl5=$tdir/perl
7324                         break;
7325                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7326                         perl5=$tdir/perl5
7327                         break;
7328                 fi
7329         done
7330         ;;
7331 *)      perl5="$perl5"
7332         ;;
7333 esac
7334 case "$perl5" in
7335 '')     echo "None found.  That's ok.";;
7336 *)      echo "Using $perl5." ;;
7337 esac
7338
7339 : Set the siteprefix variables
7340 $cat <<EOM
7341
7342 After $package is installed, you may wish to install various
7343 add-on modules and utilities.  Typically, these add-ons will
7344 be installed under $prefix with the rest
7345 of this package.  However, you may wish to install such add-ons
7346 elsewhere under a different prefix.
7347
7348 If you do not wish to put everything under a single prefix, that's
7349 ok.  You will be prompted for the individual locations; this siteprefix
7350 is only used to suggest the defaults.
7351
7352 The default should be fine for most people.
7353
7354 EOM
7355 fn=d~+
7356 rp='Installation prefix to use for add-on modules and utilities?'
7357 : XXX Here might be another good place for an installstyle setting.
7358 case "$siteprefix" in
7359 '') dflt=$prefix ;;
7360 *)  dflt=$siteprefix ;;
7361 esac
7362 . ./getfile
7363 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7364 oldsiteprefix=''
7365 case "$siteprefix" in
7366 '') ;;
7367 *)      case "$ans" in
7368         "$prefix") ;;
7369         *) oldsiteprefix="$prefix";;
7370         esac
7371         ;;
7372 esac
7373 siteprefix="$ans"
7374 siteprefixexp="$ansexp"
7375
7376 : determine where site specific libraries go.
7377 : Usual default is /usr/local/lib/perl5/site_perl/$version
7378 : The default "style" setting is made in installstyle.U
7379 : XXX No longer works with Prefixit stuff.
7380 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7381 case "$sitelib" in
7382 '') case "$installstyle" in
7383         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7384         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7385         esac
7386         ;;
7387 *)      dflt="$sitelib"
7388         ;;
7389 esac
7390 $cat <<EOM
7391
7392 The installation process will create a directory for
7393 site-specific extensions and modules.  Most users find it convenient
7394 to place all site-specific files in this directory rather than in the
7395 main distribution directory.
7396
7397 EOM
7398 fn=d~+
7399 rp='Pathname for the site-specific library files?'
7400 . ./getfile
7401 prefixvar=sitelib
7402 . ./setprefixvar
7403 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7404
7405 : Determine list of previous versions to include in @INC
7406 $cat > getverlist <<EOPL
7407 #!$perl5 -w
7408 use File::Basename;
7409 \$api_versionstring = "$api_versionstring";
7410 \$version = "$version";
7411 \$stem = "$sitelib_stem";
7412 \$archname = "$archname";
7413 EOPL
7414         $cat >> getverlist <<'EOPL'
7415 # The list found is store twice for each entry: the original name, and
7416 # the binary broken down version as pack "sss", so sorting is easy and
7417 # unambiguous. This will work for all versions that have a maximum of
7418 # three digit groups, separate by '.'s or '_'s. Names are extended with
7419 # ".0.0" to ensure at least three elements for the pack.
7420 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7421
7422 # Can't have leading @ because metaconfig interprets it as a command!
7423 ;@inc_version_list=();
7424 # XXX Redo to do opendir/readdir?
7425 if (-d $stem) {
7426     chdir($stem);
7427     ;@candidates = map {
7428         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7429     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7430 }
7431 else {
7432     ;@candidates = ();
7433 }
7434
7435 ($pversion, $aversion, $vsn5005) = map {
7436     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7437 foreach $d (@candidates) {
7438     if ($d->[1] lt $pversion) {
7439         if ($d->[1] ge $aversion) {
7440             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7441         }
7442         elsif ($d->[1] ge $vsn5005) {
7443             unshift(@inc_version_list, grep { -d } $d->[0]);
7444         }
7445     }
7446     else {
7447         # Skip newer version.  I.e. don't look in
7448         # 5.7.0 if we're installing 5.6.1.
7449     }
7450 }
7451
7452 if (@inc_version_list) {
7453     print join(' ', @inc_version_list);
7454 }
7455 else {
7456     # Blank space to preserve value for next Configure run.
7457     print " ";
7458 }
7459 EOPL
7460 chmod +x getverlist
7461 case "$inc_version_list" in
7462 '')     if test -x "$perl5$exe_ext"; then
7463                 dflt=`$perl5 getverlist`
7464         else
7465                 dflt='none'
7466         fi
7467         ;;
7468 $undef) dflt='none' ;;
7469 *)  eval dflt=\"$inc_version_list\" ;;
7470 esac
7471 case "$dflt" in
7472 ''|' ') dflt=none ;;
7473 esac
7474 case "$dflt" in
7475 5.005) dflt=none ;;
7476 esac
7477 $cat <<EOM
7478
7479 In order to ease the process of upgrading, this version of perl
7480 can be configured to use modules built and installed with earlier
7481 versions of perl that were installed under $prefix.  Specify here
7482 the list of earlier versions that this version of perl should check.
7483 If Configure detected no earlier versions of perl installed under
7484 $prefix, then the list will be empty.  Answer 'none' to tell perl
7485 to not search earlier versions.
7486
7487 The default should almost always be sensible, so if you're not sure,
7488 just accept the default.
7489 EOM
7490
7491 rp='List of earlier versions to include in @INC?'
7492 . ./myread
7493 case "$ans" in
7494 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7495 *) inc_version_list="$ans" ;;
7496 esac
7497 case "$inc_version_list" in
7498 ''|' ')
7499         inc_version_list_init='0'
7500         d_inc_version_list="$undef"
7501         ;;
7502 *)      inc_version_list_init=`echo $inc_version_list |
7503                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7504         d_inc_version_list="$define"
7505         ;;
7506 esac
7507 $rm -f getverlist
7508
7509 : see if malloc/malloc.h has to be included
7510 set malloc/malloc.h i_mallocmalloc
7511 eval $inhdr
7512
7513 : see if this is a malloc.h system
7514 : we want a real compile instead of Inhdr because some systems have a
7515 : malloc.h that just gives a compile error saying to use stdlib.h instead
7516 echo " "
7517 $cat >try.c <<EOCP
7518 #include <stdlib.h>
7519 #include <malloc.h>
7520 #$i_mallocmalloc I_MALLOCMALLOC
7521 #ifdef I_MALLOCMALLOC
7522 # include <malloc/malloc.h>
7523 #endif
7524
7525 int main () { return 0; }
7526 EOCP
7527 set try
7528 if eval $compile; then
7529     echo "<malloc.h> found." >&4
7530     val="$define"
7531 else
7532     echo "<malloc.h> NOT found." >&4
7533     val="$undef"
7534 fi
7535 $rm_try
7536 set i_malloc
7537 eval $setvar
7538
7539 : check for length of pointer
7540 echo " "
7541 case "$ptrsize" in
7542 '')
7543         echo "Checking to see how big your pointers are..." >&4
7544         $cat >>try.c <<EOCP
7545 #include <stdio.h>
7546 #$i_stdlib I_STDLIB
7547 #ifdef I_STDLIB
7548 #include <stdlib.h>
7549 #endif
7550 int main()
7551 {
7552     printf("%d\n", (int)sizeof(void *));
7553     exit(0);
7554 }
7555 EOCP
7556         set try
7557         if eval $compile_ok; then
7558                 ptrsize=`$run ./try`
7559                 echo "Your pointers are $ptrsize bytes long."
7560         else
7561                 dflt='4'
7562                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7563                 rp="What is the size of a pointer (in bytes)?"
7564                 . ./myread
7565                 ptrsize="$ans"
7566         fi
7567         ;;
7568 esac
7569 $rm_try
7570 case "$use64bitall" in
7571 "$define"|true|[yY]*)
7572         case "$ptrsize" in
7573         4)      cat <<EOM >&4
7574
7575 *** You have chosen a maximally 64-bit build,
7576 *** but your pointers are only 4 bytes wide.
7577 *** Please rerun Configure without -Duse64bitall.
7578 EOM
7579                 case "$d_quad" in
7580                 define)
7581                         cat <<EOM >&4
7582 *** Since you have quads, you could possibly try with -Duse64bitint.
7583 EOM
7584                         ;;
7585                 esac
7586                 cat <<EOM >&4
7587 *** Cannot continue, aborting.
7588
7589 EOM
7590
7591                 exit 1
7592                 ;;
7593         esac
7594         ;;
7595 esac
7596
7597
7598 : determine whether to use malloc wrapping
7599 echo " "
7600 case "$usemallocwrap" in
7601 [yY]*|true|$define)     dflt='y' ;;
7602 [nN]*|false|$undef)     dflt='n' ;;
7603 *)      case "$usedevel" in
7604         [yY]*|true|$define)     dflt='y' ;;
7605         *) dflt='n' ;;
7606         esac
7607         ;;
7608 esac
7609 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7610 . ./myread
7611 usemallocwrap="$ans"
7612 case "$ans" in
7613 y*|true)
7614         usemallocwrap="$define" ;;
7615 *)
7616         usemallocwrap="$undef" ;;
7617 esac
7618
7619 : determine which malloc to compile in
7620 echo " "
7621 case "$usemymalloc" in
7622 [yY]*|true|$define)     dflt='y' ;;
7623 [nN]*|false|$undef)     dflt='n' ;;
7624 *)      case "$ptrsize" in
7625         4) dflt='y' ;;
7626         *) dflt='n' ;;
7627         esac
7628         if test "$useithreads" = "$define"; then dflt='n'; fi
7629         ;;
7630 esac
7631 rp="Do you wish to attempt to use the malloc that comes with $package?"
7632 . ./myread
7633 usemymalloc="$ans"
7634 case "$ans" in
7635 y*|true)
7636         usemymalloc='y'
7637         mallocsrc='malloc.c'
7638         mallocobj="malloc$_o"
7639         d_mymalloc="$define"
7640         case "$libs" in
7641         *-lmalloc*)
7642                 : Remove malloc from list of libraries to use
7643                 echo "Removing unneeded -lmalloc from library list" >&4
7644                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7645                 shift
7646                 libs="$*"
7647                 echo "libs = $libs" >&4
7648                 ;;
7649         esac
7650         ;;
7651 *)
7652         usemymalloc='n'
7653         mallocsrc=''
7654         mallocobj=''
7655         d_mymalloc="$undef"
7656         ;;
7657 esac
7658
7659 : compute the return types of malloc and free
7660 echo " "
7661 $cat >malloc.c <<END
7662 #$i_malloc I_MALLOC
7663 #$i_stdlib I_STDLIB
7664 #include <stdio.h>
7665 #include <sys/types.h>
7666 #ifdef I_MALLOC
7667 #include <malloc.h>
7668 #endif
7669 #ifdef I_STDLIB
7670 #include <stdlib.h>
7671 #endif
7672 #ifdef TRY_MALLOC
7673 void *malloc();
7674 #endif
7675 #ifdef TRY_FREE
7676 void free();
7677 #endif
7678 END
7679 case "$malloctype" in
7680 '')
7681         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7682                 malloctype='void *'
7683         else
7684                 malloctype='char *'
7685         fi
7686         ;;
7687 esac
7688 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7689
7690 case "$freetype" in
7691 '')
7692         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7693                 freetype='void'
7694         else
7695                 freetype='int'
7696         fi
7697         ;;
7698 esac
7699 echo "Your system uses $freetype free(), it would seem." >&4
7700 $rm -f malloc.[co]
7701 : determine where site specific architecture-dependent libraries go.
7702 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7703 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7704 : sitelib may have an optional trailing /share.
7705 case "$sitearch" in
7706 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7707         dflt="$dflt/$archname"
7708         ;;
7709 *)      dflt="$sitearch"
7710         ;;
7711 esac
7712 set sitearch sitearch none
7713 eval $prefixit
7714 $cat <<EOM
7715
7716 The installation process will also create a directory for
7717 architecture-dependent site-specific extensions and modules.
7718
7719 EOM
7720 fn=d~+
7721 rp='Pathname for the site-specific architecture-dependent library files?'
7722 . ./getfile
7723 prefixvar=sitearch
7724 . ./setprefixvar
7725 if $test X"$sitearch" = X"$sitelib"; then
7726         d_sitearch="$undef"
7727 else
7728         d_sitearch="$define"
7729 fi
7730
7731 : Set the vendorprefix variables
7732 $cat <<EOM
7733
7734 The installation process will also create a directory for
7735 vendor-supplied add-ons.  Vendors who supply perl with their system
7736 may find it convenient to place all vendor-supplied files in this
7737 directory rather than in the main distribution directory.  This will
7738 ease upgrades between binary-compatible maintenance versions of perl.
7739
7740 Of course you may also use these directories in whatever way you see
7741 fit.  For example, you might use them to access modules shared over a
7742 company-wide network.
7743
7744 The default answer should be fine for most people.
7745 This causes further questions about vendor add-ons to be skipped
7746 and no vendor-specific directories will be configured for perl.
7747
7748 EOM
7749 rp='Do you want to configure vendor-specific add-on directories?'
7750 case "$usevendorprefix" in
7751 define|true|[yY]*) dflt=y ;;
7752 *)      : User may have set vendorprefix directly on Configure command line.
7753         case "$vendorprefix" in
7754         ''|' ') dflt=n ;;
7755         *)      dflt=y ;;
7756         esac
7757         ;;
7758 esac
7759 . ./myread
7760 case "$ans" in
7761 [yY]*)  fn=d~+
7762         rp='Installation prefix to use for vendor-supplied add-ons?'
7763         case "$vendorprefix" in
7764         '') dflt="$prefix" ;;
7765         *)  dflt=$vendorprefix ;;
7766         esac
7767         . ./getfile
7768         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7769         oldvendorprefix=''
7770         case "$vendorprefix" in
7771         '') ;;
7772         *)      case "$ans" in
7773                 "$prefix") ;;
7774                 *) oldvendorprefix="$prefix";;
7775                 esac
7776                 ;;
7777         esac
7778         usevendorprefix="$define"
7779         vendorprefix="$ans"
7780         vendorprefixexp="$ansexp"
7781         ;;
7782 *)      usevendorprefix="$undef"
7783         vendorprefix=''
7784         vendorprefixexp=''
7785         ;;
7786 esac
7787
7788 : Set the vendorlib variables
7789 case "$vendorprefix" in
7790 '')     d_vendorlib="$undef"
7791         vendorlib=''
7792         vendorlibexp=''
7793         ;;
7794 *)      d_vendorlib="$define"
7795         : determine where vendor-supplied modules go.
7796         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7797         case "$vendorlib" in
7798         '')
7799                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7800                 case "$installstyle" in
7801                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7802                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7803                 esac
7804                 ;;
7805         *)      dflt="$vendorlib"
7806                 ;;
7807         esac
7808         fn=d~+
7809         rp='Pathname for the vendor-supplied library files?'
7810         . ./getfile
7811         vendorlib="$ans"
7812         vendorlibexp="$ansexp"
7813         ;;
7814 esac
7815 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7816 prefixvar=vendorlib
7817 . ./installprefix
7818
7819 : Set the vendorarch variables
7820 case "$vendorprefix" in
7821 '')     d_vendorarch="$undef"
7822         vendorarch=''
7823         vendorarchexp=''
7824         ;;
7825 *)      d_vendorarch="$define"
7826         : determine where vendor-supplied architecture-dependent libraries go.
7827         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7828         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7829         : vendorlib may have an optional trailing /share.
7830         case "$vendorarch" in
7831         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7832                 dflt="$dflt/$archname"
7833                 ;;
7834         *)      dflt="$vendorarch" ;;
7835         esac
7836         fn=d~+
7837         rp='Pathname for vendor-supplied architecture-dependent files?'
7838         . ./getfile
7839         vendorarch="$ans"
7840         vendorarchexp="$ansexp"
7841         ;;
7842 esac
7843 prefixvar=vendorarch
7844 . ./installprefix
7845 if $test X"$vendorarch" = X"$vendorlib"; then
7846         d_vendorarch="$undef"
7847 else
7848         d_vendorarch="$define"
7849 fi
7850
7851 : Final catch-all directories to search
7852 $cat <<EOM
7853
7854 Lastly, you can have perl look in other directories for extensions and
7855 modules in addition to those already specified.
7856 These directories will be searched after
7857         $sitearch
7858         $sitelib
7859 EOM
7860 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7861 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7862 echo ' '
7863 case "$otherlibdirs" in
7864 ''|' ') dflt='none' ;;
7865 *)      dflt="$otherlibdirs" ;;
7866 esac
7867 $cat <<EOM
7868 Enter a colon-separated set of extra paths to include in perl's @INC
7869 search path, or enter 'none' for no extra paths.
7870
7871 EOM
7872
7873 rp='Colon-separated list of additional directories for perl to search?'
7874 . ./myread
7875 case "$ans" in
7876 ' '|''|none)    otherlibdirs=' ' ;;
7877 *)      otherlibdirs="$ans" ;;
7878 esac
7879 case "$otherlibdirs" in
7880 ' ') val=$undef ;;
7881 *)      val=$define ;;
7882 esac
7883 set d_perl_otherlibdirs
7884 eval $setvar
7885
7886 : Cruising for prototypes
7887 echo " "
7888 echo "Checking out function prototypes..." >&4
7889 $cat >prototype.c <<EOCP
7890 #$i_stdlib I_STDLIB
7891 #ifdef I_STDLIB
7892 #include <stdlib.h>
7893 #endif
7894 int main(int argc, char *argv[]) {
7895         exit(0);}
7896 EOCP
7897 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7898         echo "Your C compiler appears to support function prototypes."
7899         val="$define"
7900 else
7901         echo "Your C compiler doesn't seem to understand function prototypes."
7902         val="$undef"
7903 fi
7904 set prototype
7905 eval $setvar
7906 $rm -f prototype*
7907
7908 : Check if ansi2knr is required
7909 case "$prototype" in
7910 "$define") ;;
7911 *)      ansi2knr='ansi2knr'
7912         echo " "
7913         cat <<EOM >&4
7914
7915 $me:  FATAL ERROR:
7916 This version of $package can only be compiled by a compiler that 
7917 understands function prototypes.  Unfortunately, your C compiler 
7918         $cc $ccflags
7919 doesn't seem to understand them.  Sorry about that.
7920
7921 If GNU cc is available for your system, perhaps you could try that instead.  
7922
7923 Eventually, we hope to support building Perl with pre-ANSI compilers.
7924 If you would like to help in that effort, please contact <perlbug@perl.org>.
7925
7926 Aborting Configure now.
7927 EOM
7928         exit 2
7929         ;;
7930 esac
7931
7932 : DTrace support
7933 dflt_dtrace='/usr/sbin/dtrace'
7934 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7935
7936 cat <<EOM
7937
7938 Perl can be built to support DTrace on platforms that support it.
7939 DTrace is a diagnosis and performance analysis tool from Sun.
7940
7941 If this doesn't make any sense to you, just accept the default '$dflt'.
7942 EOM
7943
7944 while $test 1 ; do
7945         case "$usedtrace" in
7946         $define|true|[yY]*)
7947                 dflt='y'
7948                 ;;
7949         ?*)
7950                 dflt='y'
7951                 dflt_dtrace=$usedtrace
7952                 ;;
7953         *)
7954                 dflt='n'
7955                 ;;
7956         esac
7957
7958         rp='Support DTrace if available?'
7959         . ./myread
7960         case "$ans" in
7961         y|Y)    val="$define" ;;
7962         *)      val="$undef" ;;
7963         esac
7964         set usedtrace
7965         eval $setvar
7966
7967         test "X$usedtrace" != "X$define" && break
7968
7969         echo " "
7970         rp='Where is the dtrace executable?'
7971         dflt=$dflt_dtrace
7972         . ./getfile
7973         val="$ans"
7974         set dtrace
7975         eval $setvar
7976
7977         if $test -f $dtrace
7978         then
7979                 if $dtrace -h -s ../perldtrace.d \
7980                         -o perldtrace.tmp >/dev/null 2>&1 \
7981                         && rm -f perldtrace.tmp
7982                 then
7983                         echo " "
7984                         echo "Good: your $dtrace knows about the -h flag."
7985                 else
7986                         cat >&2 <<EOM
7987
7988 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7989 ***
7990 *** Your installed dtrace doesn't support the -h switch to compile a D
7991 *** program into a C header. Can't continue.
7992
7993 EOM
7994                         exit 1
7995                 fi
7996                 break;
7997         fi
7998
7999         case "$fastread" in
8000         yes)
8001                 cat >&2 <<EOM
8002
8003 *** $me:  Fatal Error:  $dtrace not found.
8004 *** Can't continue.
8005
8006 EOM
8007                 exit 1
8008                 ;;
8009         *)
8010                 echo "*** $dtrace was not found."
8011                 echo " "
8012                 ;;
8013         esac
8014 done
8015
8016 : See if we want extra modules installed
8017 echo " "
8018 case "$extras" in
8019 '') dflt='n';;
8020 *) dflt='y';;
8021 esac
8022 cat <<EOM
8023 Perl can be built with extra modules or bundles of modules which
8024 will be fetched from the CPAN and installed alongside Perl.
8025
8026 Notice that you will need access to the CPAN; either via the Internet,
8027 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8028 be asked later to configure the CPAN.pm module which will in turn do
8029 the installation of the rest of the extra modules or bundles.)
8030
8031 Notice also that if the modules require any external software such as
8032 libraries and headers (the libz library and the zlib.h header for the
8033 Compress::Zlib module, for example) you MUST have any such software
8034 already installed, this configuration process will NOT install such
8035 things for you.
8036
8037 If this doesn't make any sense to you, just accept the default '$dflt'.
8038 EOM
8039 rp='Install any extra modules (y or n)?'
8040 . ./myread
8041 case "$ans" in
8042 y|Y)
8043         cat <<EOM
8044
8045 Please list any extra modules or bundles to be installed from CPAN,
8046 with spaces between the names.  The names can be in any format the
8047 'install' command of CPAN.pm will understand.  (Answer 'none',
8048 without the quotes, to install no extra modules or bundles.)
8049 EOM
8050         rp='Extras?'
8051         dflt="$extras"
8052         . ./myread
8053         extras="$ans"
8054 esac
8055 case "$extras" in
8056 ''|'none')
8057         val=''
8058         $rm -f ../extras.lst
8059         ;;
8060 *)      echo "(Saving the list of extras for later...)"
8061         echo "$extras" > ../extras.lst
8062         val="'$extras'"
8063         ;;
8064 esac
8065 set extras
8066 eval $setvar
8067 echo " "
8068
8069 : determine where html pages for programs go
8070 set html1dir html1dir none
8071 eval $prefixit
8072 $cat <<EOM
8073
8074 If you wish to install html files for programs in $spackage, indicate
8075 the appropriate directory here.  To skip installing html files,
8076 answer "none".
8077 EOM
8078 case "$html1dir" in
8079 ''|none|$undef|' ') dflt=none ;;
8080 *) dflt=$html1dir ;;
8081 esac
8082 fn=dn+~
8083 rp="Directory for the main $spackage html pages?"
8084 . ./getfile
8085 prefixvar=html1dir
8086 . ./setprefixvar
8087 : Use ' ' for none so value is preserved next time through Configure
8088 $test X"$html1dir" = "X" && html1dir=' '
8089
8090 : determine where html pages for libraries and modules go
8091 set html3dir html3dir none
8092 eval $prefixit
8093 $cat <<EOM
8094
8095 If you wish to install html files for modules associated with $spackage,
8096 indicate the appropriate directory here.  To skip installing html files,
8097 answer "none".
8098 EOM
8099 : There is no obvious default.  If they have specified html1dir, then
8100 : try to key off that, possibly changing .../html1 into .../html3.
8101 case "$html3dir" in
8102 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8103 *) dflt=$html3dir ;;
8104 esac
8105 fn=dn+~
8106 rp="Directory for the $spackage module html pages?"
8107 . ./getfile
8108 prefixvar=html3dir
8109 . ./setprefixvar
8110 : Use ' ' for none so value is preserved next time through Configure
8111 $test X"$html3dir" = "X" && html3dir=' '
8112
8113 : determine whether to install perl also as /usr/bin/perl
8114
8115 echo " "
8116 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8117         $cat <<EOM
8118 Many scripts expect perl to be installed as /usr/bin/perl.
8119
8120 If you want to, I can install the perl you are about to compile
8121 as /usr/bin/perl (in addition to $bin/perl).
8122 EOM
8123         if test -f /usr/bin/perl; then
8124             $cat <<EOM
8125
8126 However, please note that because you already have a /usr/bin/perl,
8127 overwriting that with a new Perl would very probably cause problems.
8128 Therefore I'm assuming you don't want to do that (unless you insist).
8129
8130 EOM
8131             case "$installusrbinperl" in
8132             "$define"|[yY]*)    dflt='y';;
8133             *)                  dflt='n';;
8134             esac
8135         else
8136             $cat <<EOM
8137
8138 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8139
8140 EOM
8141             case "$installusrbinperl" in
8142             "$undef"|[nN]*)     dflt='n';;
8143             *)                  dflt='y';;
8144             esac
8145         fi
8146         rp="Do you want to install perl as /usr/bin/perl?"
8147         . ./myread
8148         case "$ans" in
8149         [yY]*)  val="$define";;
8150         *)      val="$undef" ;;
8151         esac
8152 else
8153         val="$undef"
8154 fi
8155 set installusrbinperl
8156 eval $setvar
8157
8158 : see if dlopen exists
8159 xxx_runnm="$runnm"
8160 xxx_ccflags="$ccflags"
8161 runnm=false
8162 : with g++ one needs -shared to get is-in-libc to work for dlopen
8163 case "$gccversion" in
8164 '')     ;;
8165 *)      case "$d_cplusplus" in
8166         "$define") ccflags="$ccflags -shared" ;;
8167         esac
8168         ;;
8169 esac
8170 set dlopen d_dlopen
8171 eval $inlibc
8172 runnm="$xxx_runnm"
8173 ccflags="$xxx_ccflags"
8174
8175 : see if this is a unistd.h system
8176 set unistd.h i_unistd
8177 eval $inhdr
8178
8179 : determine which dynamic loading, if any, to compile in
8180 echo " "
8181 dldir="ext/DynaLoader"
8182 case "$usedl" in
8183     $define|y|true)
8184         dflt='y'
8185         usedl="$define"
8186         ;;
8187     $undef|n|false)
8188         dflt='n'
8189         usedl="$undef"
8190         ;;
8191     *)
8192         dflt='n'
8193         case "$d_dlopen" in
8194             $define) dflt='y' ;;
8195         esac
8196         : Does a dl_xxx.xs file exist for this operating system
8197         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8198         ;;
8199 esac
8200 rp="Do you wish to use dynamic loading?"
8201 . ./myread
8202 usedl="$ans"
8203 bin_ELF="$undef"
8204 case "$ans" in
8205     y*) usedl="$define"
8206         case "$dlsrc" in
8207             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8208                     dflt="$dldir/dl_${osname}.xs"
8209                 elif $test "$d_dlopen" = "$define" ; then
8210                     dflt="$dldir/dl_dlopen.xs"
8211                 else
8212                     dflt=''
8213                 fi
8214                 ;;
8215             *)  dflt="$dldir/$dlsrc"
8216                 ;;
8217         esac
8218         echo "The following dynamic loading files are available:"
8219         : Can not go over to $dldir because getfile has path hard-coded in.
8220         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8221         rp="Source file to use for dynamic loading"
8222         fn="fne"
8223         gfpth="$src"
8224         . ./getfile
8225         usedl="$define"
8226         : emulate basename
8227         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8228
8229         $cat << EOM
8230
8231 Some systems may require passing special flags to $cc -c to
8232 compile modules that will be used to create a shared library.
8233 To use no flags, say "none".
8234
8235 EOM
8236         case "$cccdlflags" in
8237             '') case "$gccversion" in
8238                 '') case "$osname" in
8239                         hpux)   dflt='+z' ;;
8240                         irix*)  dflt='-KPIC' ;;
8241                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8242                         sunos)  dflt='-pic' ;;
8243                         *)      dflt='none' ;;
8244                     esac
8245                     ;;
8246                 *)  case "$osname" in
8247                         darwin) dflt='none' ;;
8248                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8249                         *)      dflt='-fpic' ;;
8250                     esac ;;
8251                 esac ;;
8252             ' ') dflt='none' ;;
8253             *)   dflt="$cccdlflags" ;;
8254         esac
8255
8256         case "$dflt" in
8257             none) dflt='' ;;
8258         esac
8259
8260         # If -Dsysroot was specified, now's the time to add it
8261         # to cccdlflags
8262         if test "X$sysroot" != X; then
8263             case "$gccversion" in
8264                 '') ;;
8265                 *)  case "$dflt" in
8266                         *sysroot*) ;;
8267                         'undef'|*)
8268                             dflt="$dflt --sysroot=$sysroot" ;;
8269                     esac
8270                     ;;
8271             esac
8272         fi
8273
8274         case "$dflt" in
8275             '') dflt='none';;
8276         esac
8277
8278         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8279         . ./myread
8280         case "$ans" in
8281             none) cccdlflags=' ' ;;
8282             *)    cccdlflags="$ans" ;;
8283         esac
8284
8285         cat << EOM
8286
8287 Some systems use ld to create libraries that can be dynamically loaded,
8288 while other systems (such as those using ELF) use $cc.
8289
8290 EOM
8291
8292 : Determine if this is ELF
8293         $cat >try.c <<EOM
8294 /* Test for whether ELF binaries are produced */
8295 #include <fcntl.h>
8296 #$i_stdlib I_STDLIB
8297 #ifdef I_STDLIB
8298 #include <stdlib.h>
8299 #endif
8300 #$i_unistd I_UNISTD
8301 #ifdef I_UNISTD
8302 #include <unistd.h>
8303 #endif
8304 int main() {
8305     char b[4];
8306     int i = open("a.out",O_RDONLY);
8307     if(i == -1)
8308         exit(1); /* fail */
8309     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8310         exit(0); /* succeed (yes, it is ELF) */
8311     exit(1); /* fail */
8312 }
8313 EOM
8314         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8315             bin_ELF="$define"
8316         fi
8317         $rm_try
8318
8319         case "$ld" in
8320             '') if $test $bin_ELF = "$define"; then
8321                     cat <<EOM
8322 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8323 EOM
8324                     dflt="$cc"
8325                 else
8326                     echo "I'll use ld to build dynamic libraries."
8327                     dflt='ld'
8328                 fi
8329                 ;;
8330             *)  dflt="$ld"
8331                 ;;
8332         esac
8333
8334         rp="What command should be used to create dynamic libraries?"
8335         . ./myread
8336         ld="$ans"
8337
8338         cat << EOM
8339
8340 Some systems may require passing special flags to $ld to create a
8341 library that can be dynamically loaded.  If your ld flags include
8342 -L/other/path options to locate libraries outside your loader's normal
8343 search path, you may need to specify those -L options here as well.  To
8344 use no flags, say "none".
8345
8346 EOM
8347         case "$lddlflags" in
8348             '') case "$osname" in
8349                     haiku) dflt='-shared' ;;
8350                     hpux) dflt='-b';
8351                           case "$gccversion" in
8352                               '') dflt="$dflt +vnocompatwarnings" ;;
8353                           esac
8354                           ;;
8355                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8356                     solaris) # See [perl #66604].
8357                             # On Solaris 11, gcc -m64 on amd64
8358                             # appears not to understand -G.  gcc versions at
8359                             # least as old as 3.4.3 support -shared, so just
8360                             # use that with Solaris 11 and later, but keep
8361                             # the old behavior for older Solaris versions.
8362                             case "$gccversion" in
8363                                 '') dflt='-G' ;;
8364                                 *)  case "$osvers" in
8365                                         2.?|2.10) dflt='-G' ;;
8366                                         *) dflt='-shared' ;;
8367                                     esac
8368                                     ;;
8369                             esac
8370                             ;;
8371                     sunos) dflt='-assert nodefinitions' ;;
8372                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8373                     *)     dflt='none' ;;
8374                 esac
8375                 ;;
8376             *) dflt="$lddlflags" ;;
8377         esac
8378
8379         : Only do this for gcc, since, for example, qcc has no concept
8380         : of --sysroot.
8381         if $test "X$sysroot" != X; then
8382             case "$gccversion" in
8383                 '') ;;
8384                 *)  dflt="$dflt --sysroot $sysroot" ;;
8385             esac
8386         fi
8387
8388         : Try to guess additional flags to pick up local libraries.
8389         : Be careful not to append to a plain 'none'
8390         case "$dflt" in
8391             none) dflt='' ;;
8392         esac
8393         for thisflag in $ldflags; do
8394             case "$thisflag" in
8395                 -L*|-R*|-Wl,-R*)
8396                     case " $dflt " in
8397                         *" $thisflag "*) ;;
8398                         *) dflt="$dflt $thisflag" ;;
8399                     esac
8400                     ;;
8401             esac
8402         done
8403
8404         case "$dflt" in
8405             ''|' ') dflt='none' ;;
8406         esac
8407
8408         case "$ldflags" in
8409             *-fstack-protector*)
8410                 case "$dflt" in
8411                     *-fstack-protector*) ;; # Don't add it again
8412                     *) dflt="$dflt -fstack-protector" ;;
8413                 esac
8414                 ;;
8415         esac
8416
8417         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8418         . ./myread
8419         case "$ans" in
8420             none) lddlflags=' ' ;;
8421             *) lddlflags="$ans" ;;
8422         esac
8423
8424         cat <<EOM
8425
8426 Some systems may require passing special flags to $cc to indicate that
8427 the resulting executable will use dynamic linking.  To use no flags,
8428 say "none".
8429
8430 EOM
8431         case "$ccdlflags" in
8432             '') case "$osname" in
8433                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8434                     sunos)             dflt='none'   ;;
8435                     *)                 dflt='none'   ;;
8436                 esac ;;
8437             ' ') dflt='none' ;;
8438             *)   dflt="$ccdlflags" ;;
8439         esac
8440         rp="Any special flags to pass to $cc to use dynamic linking?"
8441         . ./myread
8442         case "$ans" in
8443             none) ccdlflags=' ' ;;
8444             *)    ccdlflags="$ans" ;;
8445         esac
8446         ;;
8447
8448     *)  usedl="$undef"
8449         ld='ld'
8450         dlsrc='dl_none.xs'
8451         lddlflags=''
8452         ccdlflags=''
8453         ;;
8454 esac
8455
8456 ld_can_script="$undef"
8457 case "$bin_ELF$usedl" in
8458     $define$define)
8459         # Abuse try.h and a.out names for neat cleanup
8460         $cat >try.c <<EOM
8461 void foo() {}
8462 void bar() {}
8463 EOM
8464         $cat >try.h <<EOM
8465 LIBTEST_42 {
8466  global:
8467   foo;
8468  local: *;
8469  };
8470 EOM
8471         if $cc $cccdlflags $ccdlflags $ccflags \
8472                $ldflags $lddlflags -o a.out try.c \
8473                -Wl,--version-script=try.h >/dev/null 2>&1 \
8474            &&  $test -s a.out ; then
8475             echo "ld supports scripting" >&4
8476             ld_can_script="$define"
8477         else
8478             echo "ld does not support scripting" >&4
8479         fi
8480         $rm_try
8481         ;;
8482 esac
8483
8484 : Do we want a shared libperl?
8485 also=''
8486 case "$usedl" in
8487 $undef)
8488         # No dynamic loading being used, so don't bother even to prompt.
8489         useshrplib='false'
8490         ;;
8491 *)      case "$useshrplib" in
8492         '')     case "$osname" in
8493                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8494                         dflt=y
8495                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8496                         ;;
8497                 *)      dflt=n
8498                         ;;
8499                 esac
8500                 ;;
8501         $define|true|[Yy]*)
8502                 dflt=y
8503                 ;;
8504         *)      dflt=n
8505                 ;;
8506         esac
8507         $cat << EOM
8508
8509 The perl executable is normally obtained by linking perlmain.c with
8510 libperl${_a}, any static extensions (usually just DynaLoader), and
8511 any other libraries needed on this system (such as -lm, etc.).  Since
8512 your system supports dynamic loading, it is probably possible to build
8513 a shared libperl.$so.  If you will have more than one executable linked
8514 to libperl.$so, this will significantly reduce the size of each
8515 executable, but it may have a noticeable effect on performance.  The
8516 default is probably sensible for your system.
8517 $also
8518
8519 EOM
8520         rp="Build a shared libperl.$so (y/n)"
8521         . ./myread
8522         case "$ans" in
8523         true|$define|[Yy]*)
8524                 useshrplib='true'  ;;
8525         *)      useshrplib='false' ;;
8526         esac
8527         ;;
8528 esac
8529
8530 case "$useshrplib" in
8531 true)
8532         case "$userelocatableinc" in
8533         true|define)
8534                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8535                 echo "See INSTALL for an explanation why that won't work." >&4
8536                 exit 4
8537                 ;;
8538         esac
8539         case "$libperl" in
8540         '')
8541                 # Figure out a good name for libperl.so.  Since it gets stored in
8542                 # a version-specific architecture-dependent library, the version
8543                 # number isn't really that important, except for making cc/ld happy.
8544                 #
8545                 # A name such as libperl.so.10.1
8546                 majmin="libperl.$so.$patchlevel.$subversion"
8547                 # A name such as libperl.so.100
8548                 majonly=`echo $patchlevel $subversion |
8549                         $awk '{printf "%d%02d", $1, $2}'`
8550                 majonly=libperl.$so.$majonly
8551                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8552                 # rely on figuring it out from the naming of libc.
8553                 case "${osname}${osvers}" in
8554                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8555                         dflt=libperl.$so
8556                         ;;
8557                 cygwin*) # ld links now against the dll directly
8558                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8559                         majonly=`echo $patchlevel $subversion |
8560                                 $awk '{printf "%03d%03d", $1, $2}'`
8561                         majonly=cygperl5.$majonly.$so
8562                         dflt=$majmin
8563                         ;;
8564                 *)      # Try to guess based on whether libc has major.minor.
8565                         case "$libc" in
8566                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8567                         *libc.$so.[0-9]*) dflt=$majonly ;;
8568                         *)      dflt=libperl.$so ;;
8569                         esac
8570                         ;;
8571                 esac
8572                 ;;
8573         *)      dflt=$libperl
8574                 ;;
8575         esac
8576         cat << EOM
8577
8578 I need to select a good name for the shared libperl.  If your system uses
8579 library names with major and minor numbers, then you might want something
8580 like $majmin.  Alternatively, if your system uses a single version
8581 number for shared libraries, then you might want to use $majonly.
8582 Or, your system might be quite happy with a simple libperl.$so.
8583
8584 Since the shared libperl will get installed into a version-specific
8585 architecture-dependent directory, the version number of the shared perl
8586 library probably isn't important, so the default should be o.k.
8587
8588 EOM
8589         rp='What name do you want to give to the shared libperl?'
8590         . ./myread
8591         libperl=$ans
8592         echo "Ok, I'll use $libperl"
8593         ;;
8594 *)
8595         libperl="libperl${_a}"
8596         ;;
8597 esac
8598
8599 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8600 case "$shrpdir" in
8601 '') ;;
8602 *)      $cat >&4 <<EOM
8603 WARNING:  Use of the shrpdir variable for the installation location of
8604 the shared $libperl is not supported.  It was never documented and
8605 will not work in this version.  Let me (perlbug@perl.org)
8606 know of any problems this may cause.
8607
8608 EOM
8609         case "$shrpdir" in
8610         "$archlibexp/CORE")
8611                 $cat >&4 <<EOM
8612 But your current setting of $shrpdir is
8613 the default anyway, so it's harmless.
8614 EOM
8615                 ;;
8616         *)
8617                 $cat >&4 <<EOM
8618 Further, your current attempted setting of $shrpdir
8619 conflicts with the value of $archlibexp/CORE
8620 that installperl will use.
8621 EOM
8622                 ;;
8623         esac
8624         ;;
8625 esac
8626
8627 # How will the perl executable find the installed shared $libperl?
8628 # Add $xxx to ccdlflags.
8629 # If we can't figure out a command-line option, use $shrpenv to
8630 # set env LD_RUN_PATH.  The main perl makefile uses this.
8631 shrpdir=$archlibexp/CORE
8632 xxx=''
8633 tmp_shrpenv=''
8634 if "$useshrplib"; then
8635     case "$osname" in
8636         aix)
8637                 # We'll set it in Makefile.SH...
8638                 ;;
8639         solaris)
8640                 xxx="-R $shrpdir"
8641                 ;;
8642         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8643                 xxx="-Wl,-R$shrpdir"
8644                 ;;
8645         bsdos|linux|irix*|dec_osf|gnu*)
8646                 xxx="-Wl,-rpath,$shrpdir"
8647                 ;;
8648         haiku)
8649                 # Haiku doesn't like the default, either.
8650                 ;;
8651         hpux*)
8652                 # hpux doesn't like the default, either.
8653                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8654                 ;;
8655         cygwin)
8656                 # cygwin needs only ldlibpth
8657                 ;;
8658         *)
8659                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8660                 ;;
8661         esac
8662         case "$xxx" in
8663         '') ;;
8664         *)
8665                 # Only add $xxx if it isn't already in ccdlflags.
8666                 case " $ccdlflags " in
8667                 *" $xxx "*)     ;;
8668                 *)      ccdlflags="$ccdlflags $xxx"
8669                         cat <<EOM >&4
8670
8671 Adding $xxx to the flags
8672 passed to $ld so that the perl executable will find the
8673 installed shared $libperl.
8674
8675 EOM
8676                         ;;
8677                 esac
8678                 ;;
8679         esac
8680 fi
8681 # Fix ccdlflags in AIX for building external extensions.
8682 # (For building Perl itself bare -bE:perl.exp is needed,
8683 #  Makefile.SH takes care of this.)
8684 case "$osname" in
8685 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8686 esac
8687 # Respect a hint or command-line value.
8688 case "$shrpenv" in
8689 '') shrpenv="$tmp_shrpenv" ;;
8690 esac
8691 case "$ldlibpthname" in
8692 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8693 none)   ldlibpthname='' ;;
8694 esac
8695
8696 : determine where manual pages are on this system
8697 echo " "
8698 case "$sysman" in
8699 '')
8700         syspath='/usr/share/man/man1 /usr/man/man1'
8701         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8702         syspath="$syspath /usr/man/u_man/man1"
8703         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8704         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8705         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8706         sysman=`./loc . /usr/man/man1 $syspath`
8707         ;;
8708 esac
8709 if $test -d "$sysman"; then
8710         echo "System manual is in $sysman." >&4
8711 else
8712         echo "Could not find manual pages in source form." >&4
8713 fi
8714
8715 : determine where manual pages go
8716 set man1dir man1dir none
8717 eval $prefixit
8718 $cat <<EOM
8719
8720 $spackage has manual pages available in source form.
8721 EOM
8722 case "$nroff" in
8723 nroff)
8724         echo "However, you don't have nroff, so they're probably useless to you."
8725         case "$man1dir" in
8726         '') man1dir="none";;
8727         esac;;
8728 esac
8729 echo "If you don't want the manual sources installed, answer 'none'."
8730 case "$man1dir" in
8731 ' ') dflt=none
8732         ;;
8733 '')
8734         lookpath="$prefixexp/share/man/man1"
8735         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8736         lookpath="$lookpath $prefixexp/man/p_man/man1"
8737         lookpath="$lookpath $prefixexp/man/u_man/man1"
8738         lookpath="$lookpath $prefixexp/man/man.1"
8739         case "$sysman" in
8740         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8741         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8742         esac
8743         set dflt
8744         eval $prefixup
8745         ;;
8746 *)  dflt="$man1dir"
8747         ;;
8748 esac
8749 echo " "
8750 fn=dn+~
8751 rp="Where do the main $spackage manual pages (source) go?"
8752 . ./getfile
8753 if $test "X$man1direxp" != "X$ansexp"; then
8754         installman1dir=''
8755 fi
8756 prefixvar=man1dir
8757 . ./setprefixvar
8758
8759 case "$man1dir" in
8760 '')     man1dir=' '
8761         installman1dir='';;
8762 esac
8763
8764 : What suffix to use on installed man pages
8765
8766 case "$man1dir" in
8767 ' ')
8768         man1ext='0'
8769         ;;
8770 *)
8771         rp="What suffix should be used for the main $spackage man pages?"
8772         case "$man1ext" in
8773         '')     case "$man1dir" in
8774                 *1)  dflt=1 ;;
8775                 *1p) dflt=1p ;;
8776                 *1pm) dflt=1pm ;;
8777                 *l) dflt=l;;
8778                 *n) dflt=n;;
8779                 *o) dflt=o;;
8780                 *p) dflt=p;;
8781                 *C) dflt=C;;
8782                 *L) dflt=L;;
8783                 *L1) dflt=L1;;
8784                 *) dflt=1;;
8785                 esac
8786                 ;;
8787         *)      dflt="$man1ext";;
8788         esac
8789         . ./myread
8790         man1ext="$ans"
8791         ;;
8792 esac
8793
8794 : see if we can have long filenames
8795 echo " "
8796 first=123456789abcdef
8797 $rm -f $first
8798 if (echo hi >$first) 2>/dev/null; then
8799         if $test -f 123456789abcde; then
8800                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8801                 val="$undef"
8802         else
8803                 echo 'You can have filenames longer than 14 characters.'>&4
8804                 val="$define"
8805         fi
8806 else
8807         $cat <<'EOM'
8808 You can't have filenames longer than 14 chars.
8809 You can't even think about them!
8810 EOM
8811         val="$undef"
8812 fi
8813 set d_flexfnam
8814 eval $setvar
8815 $rm -rf 123456789abcde*
8816
8817 : determine where library module manual pages go
8818 set man3dir man3dir none
8819 eval $prefixit
8820 $cat <<EOM
8821
8822 $spackage has manual pages for many of the library modules.
8823 EOM
8824
8825 case "$nroff" in
8826 nroff)
8827         $cat <<'EOM'
8828 However, you don't have nroff, so they're probably useless to you.
8829 EOM
8830         case "$man3dir" in
8831         '') man3dir="none";;
8832         esac;;
8833 esac
8834
8835 case "$d_flexfnam" in
8836 undef)
8837         $cat <<'EOM'
8838 However, your system can't handle the long file names like File::Basename.3.
8839 EOM
8840         case "$man3dir" in
8841         '') man3dir="none";;
8842         esac;;
8843 esac
8844
8845 echo "If you don't want the manual sources installed, answer 'none'."
8846 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8847 case "$man3dir" in
8848 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8849         if $test -d "$privlib/man/man3"; then
8850                 cat <<EOM >&4
8851
8852 WARNING:  Previous versions of perl installed man3 pages into
8853 $privlib/man/man3.  This version will suggest a
8854 new default of $dflt.
8855 EOM
8856                 tdflt=$dflt
8857                 dflt='n'
8858                 rp='Do you wish to preserve the old behavior?(y/n)'
8859                 . ./myread
8860                 case "$ans" in
8861                 y*) dflt="$privlib/man/man3" ;;
8862                 *)  dflt=$tdflt ;;
8863                 esac
8864     fi
8865         ;;
8866 *)      dflt="$man3dir" ;;
8867 esac
8868 case "$dflt" in
8869 ' ') dflt=none ;;
8870 esac
8871 echo " "
8872 fn=dn+~
8873 rp="Where do the $package library man pages (source) go?"
8874 . ./getfile
8875 prefixvar=man3dir
8876 . ./setprefixvar
8877
8878 case "$man3dir" in
8879 '')     man3dir=' '
8880         installman3dir='';;
8881 esac
8882
8883 : What suffix to use on installed man pages
8884 case "$man3dir" in
8885 ' ')
8886         man3ext='0'
8887         ;;
8888 *)
8889         rp="What suffix should be used for the $package library man pages?"
8890         case "$man3ext" in
8891         '')     case "$man3dir" in
8892                 *3)  dflt=3 ;;
8893                 *3p) dflt=3p ;;
8894                 *3pm) dflt=3pm ;;
8895                 *l) dflt=l;;
8896                 *n) dflt=n;;
8897                 *o) dflt=o;;
8898                 *p) dflt=p;;
8899                 *C) dflt=C;;
8900                 *L) dflt=L;;
8901                 *L3) dflt=L3;;
8902                 *) dflt=3;;
8903                 esac
8904                 ;;
8905         *)      dflt="$man3ext";;
8906         esac
8907         . ./myread
8908         man3ext="$ans"
8909         ;;
8910 esac
8911
8912 : see if we have to deal with yellow pages, now NIS.
8913 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8914         case "$hostcat" in
8915         nidump*) ;;
8916         *)
8917                 case "$hostcat" in
8918                 *ypcat*) dflt=y;;
8919                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8920                                 dflt=y
8921                         else
8922                                 dflt=n
8923                         fi;;
8924                 *) dflt=n;;
8925                 esac
8926                 echo " "
8927                 rp='Are you getting the hosts file via yellow pages?'
8928                 . ./myread
8929                 case "$ans" in
8930                 y*) hostcat='ypcat hosts';;
8931                 *) hostcat='cat /etc/hosts';;
8932                 esac
8933                 ;;
8934         esac
8935 fi
8936 case "$hostcat" in
8937 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8938 esac
8939 case "$groupcat" in
8940 '') test -f /etc/group && groupcat='cat /etc/group';;
8941 esac
8942 case "$passcat" in
8943 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8944 esac
8945
8946 : now get the host name
8947 echo " "
8948 echo "Figuring out host name..." >&4
8949 case "$myhostname" in
8950 '') cont=true
8951         echo 'Maybe "hostname" will work...'
8952         if tans=`sh -c hostname 2>&1` ; then
8953                 myhostname=$tans
8954                 phostname=hostname
8955                 cont=''
8956         fi
8957         ;;
8958 *) cont='';;
8959 esac
8960 if $test "$cont"; then
8961         if ./xenix; then
8962                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8963                 if tans=`cat /etc/systemid 2>&1` ; then
8964                         myhostname=$tans
8965                         phostname='cat /etc/systemid'
8966                         echo "Whadyaknow.  Xenix always was a bit strange..."
8967                         cont=''
8968                 fi
8969         elif $test -r /etc/systemid; then
8970                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8971         fi
8972 fi
8973 if $test "$cont"; then
8974         echo 'No, maybe "uuname -l" will work...'
8975         if tans=`sh -c 'uuname -l' 2>&1` ; then
8976                 myhostname=$tans
8977                 phostname='uuname -l'
8978         else
8979                 echo 'Strange.  Maybe "uname -n" will work...'
8980                 if tans=`sh -c 'uname -n' 2>&1` ; then
8981                         myhostname=$tans
8982                         phostname='uname -n'
8983                 else
8984                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8985                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8986                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8987                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8988                         else
8989                                 case "$myhostname" in
8990                                 '') echo "Does this machine have an identity crisis or something?"
8991                                         phostname='';;
8992                                 *)
8993                                         echo "Well, you said $myhostname before..."
8994                                         phostname='echo $myhostname';;
8995                                 esac
8996                         fi
8997                 fi
8998         fi
8999 fi
9000 case "$myhostname" in
9001 '') myhostname=noname ;;
9002 esac
9003 : you do not want to know about this
9004 set $myhostname
9005 myhostname=$1
9006
9007 : verify guess
9008 if $test "$myhostname" ; then
9009         dflt=y
9010         rp='Your host name appears to be "'$myhostname'".'" Right?"
9011         . ./myread
9012         case "$ans" in
9013         y*) ;;
9014         *) myhostname='';;
9015         esac
9016 fi
9017
9018 : bad guess or no guess
9019 while $test "X$myhostname" = X ; do
9020         dflt=''
9021         rp="Please type the (one word) name of your host:"
9022         . ./myread
9023         myhostname="$ans"
9024 done
9025
9026 : translate upper to lower if necessary
9027 case "$myhostname" in
9028 *[A-Z]*)
9029         echo "(Normalizing case in your host name)"
9030         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9031         ;;
9032 esac
9033
9034 case "$myhostname" in
9035 *.*)
9036         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9037         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9038         echo "(Trimming domain name from host name--host name is now $myhostname)"
9039         ;;
9040 *) case "$mydomain" in
9041         '')
9042                 {
9043                         test "X$hostcat" = "Xypcat hosts" &&
9044                         ypmatch "$myhostname" hosts 2>/dev/null |\
9045                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9046                         $test -s hosts
9047                 } || {
9048                         test "X$hostcat" != "X" &&
9049                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9050                                         /[       ]$myhostname[  . ]/p" > hosts
9051                 }
9052                 tmp_re="[       . ]"
9053                 if $test -f hosts; then
9054                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9055                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9056                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9057                                 hosts | $sort | $uniq | \
9058                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9059                         case `$echo X$dflt` in
9060                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9061                                 dflt=.
9062                                 ;;
9063                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9064                                 ;;
9065                         esac
9066                 else
9067                         echo "(I cannot locate a hosts database anywhere)"
9068                         dflt=.
9069                 fi
9070                 case "$dflt" in
9071                 .)
9072                         tans=`./loc resolv.conf X /etc /usr/etc`
9073                         if $test -f "$tans"; then
9074                                 echo "(Attempting domain name extraction from $tans)"
9075                                 dflt=.`$sed -n -e 's/   / /g' \
9076                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9077                                   -e 1q 2>/dev/null`
9078                                 case "$dflt" in
9079                                 .) dflt=.`$sed -n -e 's/        / /g' \
9080                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9081                                      -e 1q 2>/dev/null`
9082                                         ;;
9083                                 esac
9084                         fi
9085                         ;;
9086                 esac
9087                 case "$dflt" in
9088                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9089                         dflt=.`sh -c domainname 2>/dev/null`
9090                         case "$dflt" in
9091                         '') dflt='.';;
9092                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9093                         esac
9094                         ;;
9095                 esac
9096                 case "$dflt$osname" in
9097                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9098                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9099                         ;;
9100                 esac
9101                 case "$dflt" in
9102                 .) echo "(Lost all hope -- silly guess then)"
9103                         dflt='.nonet'
9104                         ;;
9105                 esac
9106                 $rm -f hosts
9107                 ;;
9108         *) dflt="$mydomain";;
9109         esac;;
9110 esac
9111 echo " "
9112 rp="What is your domain name?"
9113 . ./myread
9114 tans="$ans"
9115 case "$ans" in
9116 '') ;;
9117 .*) ;;
9118 *) tans=".$tans";;
9119 esac
9120 mydomain="$tans"
9121
9122 : translate upper to lower if necessary
9123 case "$mydomain" in
9124 *[A-Z]*)
9125         echo "(Normalizing case in your domain name)"
9126         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9127         ;;
9128 esac
9129
9130 : a little sanity check here
9131 case "$phostname" in
9132 '') ;;
9133 *)
9134         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9135         $myhostname$mydomain|$myhostname) ;;
9136         *)
9137                 case "$phostname" in
9138                 sed*)
9139                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9140                         ;;
9141                 *)
9142                         echo "(That doesn't agree with your $phostname command, by the way.)"
9143                         ;;
9144                 esac
9145         ;;
9146         esac
9147         ;;
9148 esac
9149
9150 : determine the e-mail address of the user who is running us
9151 $cat <<EOM
9152
9153 I need to get your e-mail address in Internet format if possible, i.e.
9154 something like user@host.domain. Please answer accurately since I have
9155 no easy means to double check it. The default value provided below
9156 is most probably close to reality but may not be valid from outside
9157 your organization...
9158
9159 EOM
9160 cont=x
9161 while test "$cont"; do
9162         case "$MAILDOMAIN" in
9163         '')
9164                 if $test -s /etc/mailname; then
9165                         maildomain=`$cat /etc/mailname`
9166                 else
9167                         maildomain="$myhostname$mydomain"
9168                 fi
9169                 ;;
9170         *)  maildomain="$MAILDOMAIN";;
9171         esac
9172         case "$cf_email" in
9173         '') dflt="$cf_by@$maildomain";;
9174         *)  dflt="$cf_email";;
9175         esac
9176         rp='What is your e-mail address?'
9177         . ./myread
9178         cf_email="$ans"
9179         case "$cf_email" in
9180         *@*.*) cont='' ;;
9181         *)
9182                 rp='Address does not look like an Internet one.  Use it anyway?'
9183                 case "$fastread" in
9184                 yes) dflt=y ;;
9185                 *) dflt=n ;;
9186                 esac
9187                 . ./myread
9188                 case "$ans" in
9189                 y*) cont='' ;;
9190                 *) echo " " ;;
9191                 esac
9192                 ;;
9193         esac
9194 done
9195
9196 : Ask e-mail of administrator
9197 $cat <<EOM
9198
9199 If you or somebody else will be maintaining perl at your site, please
9200 fill in the correct e-mail address here so that they may be contacted
9201 if necessary. Currently, the "perlbug" program included with perl
9202 will send mail to this address in addition to perlbug@perl.org. You may
9203 enter "none" for no administrator.
9204
9205 EOM
9206 case "$perladmin" in
9207 '') dflt="$cf_email";;
9208 *) dflt="$perladmin";;
9209 esac
9210 rp='Perl administrator e-mail address'
9211 . ./myread
9212 perladmin="$ans"
9213
9214 : determine whether to only install version-specific parts.
9215 echo " "
9216 $cat <<EOM
9217 Do you want to install only the version-specific parts of the perl
9218 distribution?  Usually you do *not* want to do this.
9219 EOM
9220 case "$versiononly" in
9221 "$define"|[Yy]*|true) dflt='y' ;;
9222 *) dflt='n';
9223 esac
9224 rp="Do you want to install only the version-specific parts of perl?"
9225 . ./myread
9226 case "$ans" in
9227 [yY]*)  val="$define";;
9228 *)      val="$undef" ;;
9229 esac
9230 set versiononly
9231 eval $setvar
9232
9233 case "$versiononly" in
9234 "$define") inc_version_list=''
9235            inc_version_list_init=0
9236            ;;
9237 esac
9238
9239 : figure out how to guarantee perl startup
9240 : XXX Note that this currently takes advantage of the bug that binexp ignores
9241 :     the Configure -Dinstallprefix setting, which in turn means that under
9242 :     relocatable @INC, initialinstalllocation is what binexp started as.
9243 case "$startperl" in
9244 '')
9245         case "$sharpbang" in
9246         *!)
9247                 $cat <<EOH
9248
9249 I can use the #! construct to start perl on your system. This will
9250 make startup of perl scripts faster, but may cause problems if you
9251 want to share those scripts and perl is not in a standard place
9252 ($initialinstalllocation/perl) on all your platforms. The alternative
9253 is to force a shell by starting the script with a single ':' character.
9254
9255 EOH
9256                 case "$versiononly" in
9257                 "$define")      dflt="$initialinstalllocation/perl$version";;
9258                 *)              dflt="$initialinstalllocation/perl";;
9259                 esac
9260                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9261                 . ./myread
9262                 case "$ans" in
9263                 none)   startperl=": # use perl";;
9264                 *)      startperl="#!$ans"
9265                         if $test 30 -lt `echo "$ans" | wc -c`; then
9266                                 $cat >&4 <<EOM
9267
9268 WARNING:  Some systems limit the #! command to 32 characters.
9269 If you experience difficulty running Perl scripts with #!, try
9270 installing Perl in a directory with a shorter pathname.
9271
9272 EOM
9273                         fi ;;
9274                 esac
9275                 ;;
9276         *) startperl=": # use perl"
9277                 ;;
9278         esac
9279         ;;
9280 esac
9281 echo "I'll use $startperl to start perl scripts."
9282
9283 : figure best path for perl in scripts
9284 case "$perlpath" in
9285 '')
9286         case "$versiononly" in
9287         "$define")      perlpath="$initialinstalllocation/perl$version";;
9288         *)              perlpath="$initialinstalllocation/perl";;
9289         esac
9290         case "$startperl" in
9291         *!*) ;;
9292         *)
9293                 $cat <<EOH
9294
9295 I will use the "eval 'exec'" idiom to start Perl on your system.
9296 I can use the full path of your Perl binary for this purpose, but
9297 doing so may cause problems if you want to share those scripts and
9298 Perl is not always in a standard place ($initialinstalllocation/perl).
9299
9300 EOH
9301                 dflt="$initialinstalllocation/perl"
9302                 rp="What path shall I use in \"eval 'exec'\"?"
9303                 . ./myread
9304                 perlpath="$ans"
9305                 ;;
9306         esac
9307         ;;
9308 esac
9309 case "$startperl" in
9310 *!*)    ;;
9311 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9312 esac
9313
9314 : determine where public executable scripts go
9315 set scriptdir scriptdir
9316 eval $prefixit
9317 case "$scriptdir" in
9318 '')
9319         dflt="$bin"
9320         : guess some guesses
9321         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9322         $test -d /usr/share/bin     && dflt=/usr/share/bin
9323         $test -d /usr/local/script  && dflt=/usr/local/script
9324         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9325         $test -d $prefixexp/script  && dflt=$prefixexp/script
9326         set dflt
9327         eval $prefixup
9328         ;;
9329 *)  dflt="$scriptdir"
9330         ;;
9331 esac
9332 $cat <<EOM
9333
9334 Some installations have a separate directory just for executable scripts so
9335 that they can mount it across multiple architectures but keep the scripts in
9336 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9337 Or you might just lump your scripts in with all your other executables.
9338
9339 EOM
9340 fn=d~
9341 rp='Where do you keep publicly executable scripts?'
9342 . ./getfile
9343 if $test "X$ansexp" != "X$scriptdirexp"; then
9344         installscript=''
9345 fi
9346 installscriptdir=''
9347 prefixvar=scriptdir
9348 . ./setprefixvar
9349 : A little fix up for an irregularly named variable.
9350 installscript="$installscriptdir"
9351
9352 : determine where add-on public executables go
9353 case "$sitebin" in
9354 '')     dflt=$siteprefix/bin ;;
9355 *)      dflt=$sitebin ;;
9356 esac
9357 fn=d~
9358 rp='Pathname where the add-on public executables should be installed?'
9359 . ./getfile
9360 prefixvar=sitebin
9361 . ./setprefixvar
9362
9363 : determine where add-on html pages go
9364 : There is no standard location, so try to copy the previously-selected
9365 : directory structure for the core html pages.
9366 case "$sitehtml1dir" in
9367 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9368 *)     dflt=$sitehtml1dir ;;
9369 esac
9370 case "$dflt" in
9371 ''|' ') dflt=none ;;
9372 esac
9373 fn=dn+~
9374 rp='Pathname where the site-specific html pages should be installed?'
9375 . ./getfile
9376 prefixvar=sitehtml1dir
9377 . ./setprefixvar
9378
9379 : determine where add-on library html pages go
9380 : There is no standard location, so try to copy the previously-selected
9381 : directory structure for the core html pages.
9382 case "$sitehtml3dir" in
9383 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9384 *)     dflt=$sitehtml3dir ;;
9385 esac
9386 case "$dflt" in
9387 ''|' ') dflt=none ;;
9388 esac
9389 fn=dn+~
9390 rp='Pathname where the site-specific library html pages should be installed?'
9391 . ./getfile
9392 prefixvar=sitehtml3dir
9393 . ./setprefixvar
9394
9395 : determine where add-on manual pages go
9396 case "$siteman1dir" in
9397 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9398 *)      dflt=$siteman1dir ;;
9399 esac
9400 case "$dflt" in
9401 ''|' ') dflt=none ;;
9402 esac
9403 fn=dn+~
9404 rp='Pathname where the site-specific manual pages should be installed?'
9405 . ./getfile
9406 prefixvar=siteman1dir
9407 . ./setprefixvar
9408
9409 : determine where add-on library man pages go
9410 case "$siteman3dir" in
9411 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9412 *)      dflt=$siteman3dir ;;
9413 esac
9414 case "$dflt" in
9415 ''|' ') dflt=none ;;
9416 esac
9417 fn=dn+~
9418 rp='Pathname where the site-specific library manual pages should be installed?'
9419 . ./getfile
9420 prefixvar=siteman3dir
9421 . ./setprefixvar
9422
9423 : determine where add-on public executable scripts go
9424 case "$sitescript" in
9425 '')     dflt=$siteprefix/script
9426         $test -d $dflt || dflt=$sitebin ;;
9427 *)  dflt="$sitescript" ;;
9428 esac
9429 fn=d~+
9430 rp='Pathname where add-on public executable scripts should be installed?'
9431 . ./getfile
9432 prefixvar=sitescript
9433 . ./setprefixvar
9434
9435 : see if backtrace exists
9436 set backtrace d_backtrace
9437 eval $inlibc
9438
9439 : add flags if using c backtrace
9440 case "$usecbacktrace" in
9441   "") usecbacktrace=$undef ;;
9442   [yY]*|true|$define)
9443     case "$d_backtrace" in
9444       [yY]*|true|$define)
9445         case " $ccflags " in
9446           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9447           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9448           esac
9449         ;;
9450       *)
9451         echo "This system does not support backtrace" >&4
9452         usecbacktrace=$undef
9453         ;;
9454       esac
9455     ;;
9456   esac
9457
9458 : Check if faststdio is requested and available
9459 case "$usefaststdio" in
9460 $define|true|[yY]*|'')
9461         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9462         case "$xversion" in
9463         [68])   dflt='y' ;;
9464         *)      dflt='n' ;;
9465         esac
9466         ;;
9467 *) dflt='n';;
9468 esac
9469 cat <<EOM
9470
9471 Perl can be built to use 'fast stdio', which means using the stdio
9472 library but also directly manipulating the stdio buffers to enable
9473 faster I/O.  Using stdio is better for backward compatibility (especially
9474 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9475 interface has been preferred instead of stdio.
9476
9477 If this doesn't make any sense to you, just accept the default '$dflt'.
9478 EOM
9479 rp='Use the "fast stdio" if available?'
9480 . ./myread
9481 case "$ans" in
9482 y|Y)    val="$define" ;;
9483 *)      val="$undef" ;;
9484 esac
9485 set usefaststdio
9486 eval $setvar
9487
9488
9489 : define an is-a-typedef? function
9490 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9491 case "$inclist" in
9492 "") inclist="sys/types.h";;
9493 esac;
9494 eval "varval=\$$var";
9495 case "$varval" in
9496 "")
9497         $rm -f temp.c;
9498         for inc in $inclist; do
9499                 echo "#include <$inc>" >>temp.c;
9500         done;
9501         echo "#ifdef $type" >> temp.c;
9502         echo "printf(\"We have $type\");" >> temp.c;
9503         echo "#endif" >> temp.c;
9504         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9505         if $contains $type temp.E >/dev/null 2>&1; then
9506                 eval "$var=\$type";
9507         else
9508                 eval "$var=\$def";
9509         fi;
9510         $rm -f temp.?;;
9511 *) eval "$var=\$varval";;
9512 esac'
9513
9514 : define an is-a-typedef? function that prompts if the type is not available.
9515 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9516 case "$inclist" in
9517 "") inclist="sys/types.h";;
9518 esac;
9519 eval "varval=\$$var";
9520 case "$varval" in
9521 "")
9522         $rm -f temp.c;
9523         for inc in $inclist; do
9524                 echo "#include <$inc>" >>temp.c;
9525         done;
9526         echo "#ifdef $type" >> temp.c;
9527         echo "printf(\"We have $type\");" >> temp.c;
9528         echo "#endif" >> temp.c;
9529         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9530         echo " " ;
9531         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9532         if $contains $type temp.E >/dev/null 2>&1; then
9533                 echo "$type found." >&4;
9534                 eval "$var=\$type";
9535         else
9536                 echo "$type NOT found." >&4;
9537                 dflt="$def";
9538                 . ./myread ;
9539                 eval "$var=\$ans";
9540         fi;
9541         $rm -f temp.?;;
9542 *) eval "$var=\$varval";;
9543 esac'
9544
9545 : see what type lseek is declared as in the kernel
9546 rp="What is the type used for lseek's offset on this system?"
9547 set off_t lseektype long stdio.h sys/types.h
9548 eval $typedef_ask
9549
9550 echo " "
9551 echo "Checking to see how big your file offsets are..." >&4
9552 $cat >try.c <<EOCP
9553 #include <sys/types.h>
9554 #include <stdio.h>
9555 int main()
9556 {
9557     printf("%d\n", (int)sizeof($lseektype));
9558     return(0);
9559 }
9560 EOCP
9561 set try
9562 if eval $compile_ok; then
9563         lseeksize=`$run ./try`
9564         echo "Your file offsets are $lseeksize bytes long."
9565 else
9566         dflt=$longsize
9567         echo " "
9568         echo "(I can't seem to compile the test program.  Guessing...)"
9569         rp="What is the size of your file offsets (in bytes)?"
9570         . ./myread
9571         lseeksize="$ans"
9572 fi
9573 $rm_try
9574
9575 : see what type file positions are declared as in the library
9576 rp="What is the type for file position used by fsetpos()?"
9577 set fpos_t fpostype long stdio.h sys/types.h
9578 eval $typedef_ask
9579
9580 : Check size for Fpos_t
9581 echo " "
9582 case "$fpostype" in
9583 *_t) zzz="$fpostype"    ;;
9584 *)   zzz="fpos_t"       ;;
9585 esac
9586 echo "Checking the size of $zzz..." >&4
9587 cat > try.c <<EOCP
9588 #include <sys/types.h>
9589 #include <stdio.h>
9590 #$i_stdlib I_STDLIB
9591 #ifdef I_STDLIB
9592 #include <stdlib.h>
9593 #endif
9594 int main() {
9595     printf("%d\n", (int)sizeof($fpostype));
9596     exit(0);
9597 }
9598 EOCP
9599 set try
9600 if eval $compile_ok; then
9601         yyy=`$run ./try`
9602         case "$yyy" in
9603         '')     fpossize=4
9604                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9605                 ;;
9606         *)      fpossize=$yyy
9607                 echo "Your $zzz is $fpossize bytes long."
9608                 ;;
9609         esac
9610 else
9611         dflt="$longsize"
9612         echo " " >&4
9613         echo "(I can't compile the test program.  Guessing...)" >&4
9614         rp="What is the size of your file positions (in bytes)?"
9615         . ./myread
9616         fpossize="$ans"
9617 fi
9618
9619 : Check for large file support
9620 # Backward compatibility (uselfs is deprecated).
9621 case "$uselfs" in
9622 "$define"|true|[yY]*)
9623         cat <<EOM >&4
9624
9625 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9626 EOM
9627         uselargefiles="$define"
9628         ;;
9629 esac
9630
9631 case "$lseeksize:$fpossize" in
9632 8:8) cat <<EOM
9633
9634 You can have files larger than 2 gigabytes.
9635 EOM
9636    val="$define" ;;
9637 *)    case "$uselargefiles" in
9638    "$undef"|false|[nN]*) dflt='n' ;;
9639    *)   dflt='y' ;;
9640    esac
9641    cat <<EOM
9642
9643 Perl can be built to understand large files (files larger than 2 gigabytes)
9644 on some systems.  To do so, Configure can be run with -Duselargefiles.
9645
9646 If this doesn't make any sense to you, just accept the default '$dflt'.
9647 EOM
9648    rp='Try to understand large files, if available?'
9649    . ./myread
9650    case "$ans" in
9651    y|Y)         val="$define" ;;
9652    *)           val="$undef"  ;;
9653    esac
9654    ;;
9655 esac
9656 set uselargefiles
9657 eval $setvar
9658 : Look for a hint-file generated 'call-back-unit'.  If the
9659 : user has specified that a large files perl is to be built,
9660 : we may need to set or change some other defaults.
9661 if $test -f uselargefiles.cbu; then
9662         echo "Your platform has some specific hints regarding large file builds, using them..."
9663         . ./uselargefiles.cbu
9664 fi
9665 case "$uselargefiles" in
9666 "$define")
9667         if $test -f uselargefiles.cbu; then
9668                 echo " "
9669                 echo "Rechecking to see how big your file offsets are..." >&4
9670                 $cat >try.c <<EOCP
9671 #include <sys/types.h>
9672 #include <stdio.h>
9673 int main()
9674 {
9675     printf("%d\n", (int)sizeof($lseektype));
9676     return(0);
9677 }
9678 EOCP
9679                 set try
9680                 if eval $compile_ok; then
9681                         lseeksize=`$run ./try`
9682                         $echo "Your file offsets are now $lseeksize bytes long."
9683                 else
9684                         dflt="$lseeksize"
9685                         echo " "
9686                         echo "(I can't seem to compile the test program.  Guessing...)"
9687                         rp="What is the size of your file offsets (in bytes)?"
9688                         . ./myread
9689                         lseeksize="$ans"
9690                 fi
9691                 case "$fpostype" in
9692                 *_t) zzz="$fpostype"    ;;
9693                 *)   zzz="fpos_t"       ;;
9694                 esac
9695                 $echo $n "Rechecking the size of $zzz...$c" >&4
9696                 $cat > try.c <<EOCP
9697 #include <sys/types.h>
9698 #include <stdio.h>
9699 #$i_stdlib I_STDLIB
9700 #ifdef I_STDLIB
9701 #include <stdlib.h>
9702 #endif
9703 int main() {
9704     printf("%d\n", (int)sizeof($fpostype));
9705     return(0);
9706 }
9707 EOCP
9708                 set try
9709                 if eval $compile_ok; then
9710                         yyy=`$run ./try`
9711                         dflt="$lseeksize"
9712                         case "$yyy" in
9713                         '')     echo " "
9714                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9715                                 ;;
9716                         *)      fpossize=$yyy
9717                                 echo " $fpossize bytes." >&4
9718                                 ;;
9719                         esac
9720                 else
9721                         dflt="$fpossize"
9722                         echo " "
9723                         echo "(I can't compile the test program.  Guessing...)" >&4
9724                         rp="What is the size of your file positions (in bytes)?"
9725                         . ./myread
9726                         fpossize="$ans"
9727                 fi
9728                 $rm_try
9729         fi
9730         ;;
9731 esac
9732
9733 : Check if we want perlio
9734 useperlio="$define"
9735
9736 : Set the vendorbin variables
9737 case "$vendorprefix" in
9738 '')     d_vendorbin="$undef"
9739         vendorbin=''
9740         vendorbinexp=''
9741         ;;
9742 *)      d_vendorbin="$define"
9743         : determine where vendor-supplied executables go.
9744         case "$vendorbin" in
9745         '') dflt=$vendorprefix/bin ;;
9746         *)      dflt="$vendorbin" ;;
9747         esac
9748         fn=d~+
9749         rp='Pathname for the vendor-supplied executables directory?'
9750         . ./getfile
9751         vendorbin="$ans"
9752         vendorbinexp="$ansexp"
9753         ;;
9754 esac
9755 prefixvar=vendorbin
9756 . ./installprefix
9757
9758 : Set the vendorhtml1dir variables
9759 case "$vendorprefix" in
9760 '')     vendorhtml1dir=''
9761         vendorhtml1direxp=''
9762         ;;
9763 *)      : determine where vendor-supplied html pages go.
9764         : There is no standard location, so try to copy the previously-selected
9765         : directory structure for the core html pages.
9766         : XXX Better default suggestions would be welcome.
9767         case "$vendorhtml1dir" in
9768         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9769         *)      dflt=$vendorhtml1dir ;;
9770         esac
9771         case "$dflt" in
9772         ''|' ') dflt=none ;;
9773         esac
9774         fn=dn+~
9775         rp='Pathname for the vendor-supplied html pages?'
9776         . ./getfile
9777         vendorhtml1dir="$ans"
9778         vendorhtml1direxp="$ansexp"
9779         ;;
9780 esac
9781 : Use ' ' for none so value is preserved next time through Configure
9782 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9783 prefixvar=vendorhtml1dir
9784 . ./installprefix
9785
9786 : Set the vendorhtml3dir variables
9787 case "$vendorprefix" in
9788 '')     vendorhtml3dir=''
9789         vendorhtml3direxp=''
9790         ;;
9791 *)      : determine where vendor-supplied module html pages go.
9792         : There is no standard location, so try to copy the previously-selected
9793         : directory structure for the core html pages.
9794         : XXX Better default suggestions would be welcome.
9795         case "$vendorhtml3dir" in
9796         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9797         *)      dflt=$vendorhtml3dir ;;
9798         esac
9799         case "$dflt" in
9800         ''|' ') dflt=none ;;
9801         esac
9802         fn=dn+~
9803         rp='Pathname for the vendor-supplied html pages?'
9804         . ./getfile
9805         vendorhtml3dir="$ans"
9806         vendorhtml3direxp="$ansexp"
9807         ;;
9808 esac
9809 : Use ' ' for none so value is preserved next time through Configure
9810 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9811 prefixvar=vendorhtml3dir
9812 . ./installprefix
9813
9814 : Set the vendorman1dir variables
9815 case "$vendorprefix" in
9816 '')     vendorman1dir=''
9817         vendorman1direxp=''
9818         ;;
9819 *)      : determine where vendor-supplied manual pages go.
9820         case "$vendorman1dir" in
9821         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9822         *)      dflt=$vendorman1dir ;;
9823         esac
9824         case "$dflt" in
9825         ''|' ') dflt=none ;;
9826         esac
9827         fn=nd~+
9828         rp='Pathname for the vendor-supplied manual section 1 pages?'
9829         . ./getfile
9830         vendorman1dir="$ans"
9831         vendorman1direxp="$ansexp"
9832         ;;
9833 esac
9834 : Use ' ' for none so value is preserved next time through Configure
9835 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9836 prefixvar=vendorman1dir
9837 . ./installprefix
9838
9839 : Set the vendorman3dir variables
9840 case "$vendorprefix" in
9841 '')     vendorman3dir=''
9842         vendorman3direxp=''
9843         ;;
9844 *)      : determine where vendor-supplied module manual pages go.
9845         case "$vendorman3dir" in
9846         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9847         *)      dflt=$vendorman3dir ;;
9848         esac
9849         case "$dflt" in
9850         ''|' ') dflt=none ;;
9851         esac
9852         fn=nd~+
9853         rp='Pathname for the vendor-supplied manual section 3 pages?'
9854         . ./getfile
9855         vendorman3dir="$ans"
9856         vendorman3direxp="$ansexp"
9857         ;;
9858 esac
9859 : Use ' ' for none so value is preserved next time through Configure
9860 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9861 prefixvar=vendorman3dir
9862 . ./installprefix
9863
9864 : Set the vendorscript variables
9865 case "$vendorprefix" in
9866 '')     d_vendorscript="$undef"
9867         vendorscript=''
9868         vendorscriptexp=''
9869         ;;
9870 *)      d_vendorscript="$define"
9871         : determine where vendor-supplied scripts go.
9872         case "$vendorscript" in
9873         '')     dflt=$vendorprefix/script
9874                 $test -d $dflt || dflt=$vendorbin ;;
9875         *)  dflt="$vendorscript" ;;
9876         esac
9877         $cat <<EOM
9878
9879 The installation process will create a directory for
9880 vendor-supplied scripts.
9881
9882 EOM
9883         fn=d~+
9884         rp='Pathname for the vendor-supplied scripts directory?'
9885         . ./getfile
9886         vendorscript="$ans"
9887         vendorscriptexp="$ansexp"
9888         ;;
9889 esac
9890 prefixvar=vendorscript
9891 . ./installprefix
9892
9893 : script used to emit important warnings
9894 cat >warn <<EOS
9895 $startsh
9896 if test \$# -gt 0; then
9897         echo "\$@" >msg
9898 else
9899         cat >msg
9900 fi
9901 echo "*** WARNING:" >&4
9902 sed -e 's/^/*** /' <msg >&4
9903 echo "*** " >&4
9904 cat msg >>config.msg
9905 echo " " >>config.msg
9906 rm -f msg
9907 EOS
9908 chmod +x warn
9909 $eunicefix warn
9910
9911 : see which of string.h or strings.h is needed
9912 echo " "
9913 strings=`./findhdr string.h`
9914 if $test "$strings" && $test -r "$strings"; then
9915         echo "Using <string.h> instead of <strings.h>." >&4
9916         val="$define"
9917 else
9918         val="$undef"
9919         strings=`./findhdr strings.h`
9920         if $test "$strings" && $test -r "$strings"; then
9921                 echo "Using <strings.h> instead of <string.h>." >&4
9922         else
9923                 ./warn "No string header found -- You'll surely have problems."
9924         fi
9925 fi
9926 set i_string
9927 eval $setvar
9928 case "$i_string" in
9929 "$undef") strings=`./findhdr strings.h`;;
9930 *)        strings=`./findhdr string.h`;;
9931 esac
9932
9933 : see if qgcvt exists
9934 set qgcvt d_qgcvt
9935 eval $inlibc
9936
9937 : Check print/scan long double stuff
9938 echo " "
9939
9940 if $test X"$d_longdbl" = X"$define"; then
9941
9942 echo "Checking how to print long doubles..." >&4
9943
9944 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9945         $cat >try.c <<'EOCP'
9946 #include <sys/types.h>
9947 #include <stdio.h>
9948 int main() {
9949   double d = 123.456;
9950   printf("%.3f\n", d);
9951 }
9952 EOCP
9953         set try
9954         if eval $compile; then
9955                 yyy=`$run ./try`
9956                 case "$yyy" in
9957                 123.456)
9958                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9959                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9960                         echo "We will use %f."
9961                         ;;
9962                 esac
9963         fi
9964 fi
9965
9966 if $test X"$sPRIfldbl" = X; then
9967         $cat >try.c <<'EOCP'
9968 #include <sys/types.h>
9969 #include <stdio.h>
9970 int main() {
9971   long double d = 123.456;
9972   printf("%.3Lf\n", d);
9973 }
9974 EOCP
9975         set try
9976         if eval $compile; then
9977                 yyy=`$run ./try`
9978                 case "$yyy" in
9979                 123.456)
9980                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9981                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9982                         echo "We will use %Lf."
9983                         ;;
9984                 esac
9985         fi
9986 fi
9987
9988 if $test X"$sPRIfldbl" = X; then
9989         $cat >try.c <<'EOCP'
9990 #include <sys/types.h>
9991 #include <stdio.h>
9992 int main() {
9993   long double d = 123.456;
9994   printf("%.3llf\n", d);
9995 }
9996 EOCP
9997         set try
9998         if eval $compile; then
9999                 yyy=`$run ./try`
10000                 case "$yyy" in
10001                 123.456)
10002                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10003                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10004                         echo "We will use %llf."
10005                         ;;
10006                 esac
10007         fi
10008 fi
10009
10010 if $test X"$sPRIfldbl" = X; then
10011         $cat >try.c <<'EOCP'
10012 #include <sys/types.h>
10013 #include <stdio.h>
10014 int main() {
10015   long double d = 123.456;
10016   printf("%.3lf\n", d);
10017 }
10018 EOCP
10019         set try
10020         if eval $compile; then
10021                 yyy=`$run ./try`
10022                 case "$yyy" in
10023                 123.456)
10024                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10025                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10026                         echo "We will use %lf."
10027                         ;;
10028                 esac
10029         fi
10030 fi
10031
10032 if $test X"$sPRIfldbl" = X; then
10033         echo "Cannot figure out how to print long doubles." >&4
10034 else
10035         sSCNfldbl=$sPRIfldbl    # expect consistency
10036 fi
10037
10038 $rm_try
10039
10040 fi # d_longdbl
10041
10042 case "$sPRIfldbl" in
10043 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10044         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10045         d_SCNfldbl="$undef";
10046         ;;
10047 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10048         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10049         d_SCNfldbl="$define";
10050         ;;
10051 esac
10052
10053 : Check how to convert floats to strings.
10054
10055 if test "X$d_Gconvert" = X; then
10056
10057 echo " "
10058 echo "Checking for an efficient way to convert floats to strings."
10059 echo " " > try.c
10060 case "$uselongdouble" in
10061 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10062 esac
10063 case "$d_longdbl" in
10064 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10065 esac
10066 case "$d_PRIgldbl" in
10067 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10068 esac
10069 $cat >>try.c <<EOP
10070 #ifdef TRY_gconvert
10071 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10072 char *myname = "gconvert";
10073 #endif
10074 #ifdef TRY_gcvt
10075 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10076 char *myname = "gcvt";
10077 #endif
10078 #ifdef TRY_qgcvt
10079 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10080 char *myname = "qgcvt";
10081 #define DOUBLETYPE long double
10082 #endif
10083 #ifdef TRY_sprintf
10084 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10085 #ifdef HAS_PRIgldbl
10086 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10087 #else
10088 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10089 #endif
10090 #else
10091 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10092 #endif
10093 char *myname = "sprintf";
10094 #endif
10095
10096 #ifndef DOUBLETYPE
10097 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10098 #define DOUBLETYPE long double
10099 #else
10100 #define DOUBLETYPE double
10101 #endif
10102 #endif
10103
10104 #include <stdio.h>
10105
10106 #$i_stdlib I_STDLIB
10107 #ifdef I_STDLIB
10108 #include <stdlib.h>
10109 #endif
10110 #$i_string I_STRING
10111 #ifdef I_STRING
10112 #  include <string.h>
10113 #else
10114 #  include <strings.h>
10115 #endif
10116
10117 int checkit(char *expect, char *got)
10118 {
10119     if (strcmp(expect, got)) {
10120                 printf("%s oddity:  Expected %s, got %s\n",
10121                         myname, expect, got);
10122                 exit(1);
10123         }
10124 }
10125
10126 int main()
10127 {
10128         char buf[64];
10129         buf[63] = '\0';
10130
10131         /* This must be 1st test on (which?) platform */
10132         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10133         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10134         checkit("0.1", buf);
10135
10136         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10137         checkit("0.01", buf);
10138
10139         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10140         checkit("0.001", buf);
10141
10142         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10143         checkit("0.0001", buf);
10144
10145         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10146         if (strlen(buf) > 5)
10147             checkit("9e-005", buf); /* for Microsoft ?? */
10148         else
10149             checkit("9e-05", buf);
10150
10151         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10152         checkit("1", buf);
10153
10154         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10155         checkit("1.1", buf);
10156
10157         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10158         checkit("1.01", buf);
10159
10160         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10161         checkit("1.001", buf);
10162
10163         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10164         checkit("1.0001", buf);
10165
10166         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10167         checkit("1.00001", buf);
10168
10169         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10170         checkit("1.000001", buf);
10171
10172         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10173         checkit("0", buf);
10174
10175         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10176         checkit("-1", buf);
10177
10178         /* Some Linux gcvt's give 1.e+5 here. */
10179         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10180         checkit("100000", buf);
10181
10182         /* Some Linux gcvt's give -1.e+5 here. */
10183         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10184         checkit("-100000", buf);
10185
10186         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10187         checkit("123.456", buf);
10188
10189         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10190         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10191         /* 34 should be enough to scare even long double
10192          * places into using the e notation. */
10193         if (strlen(buf) > 5)
10194             checkit("1e+034", buf); /* for Microsoft */
10195         else
10196             checkit("1e+34", buf);
10197
10198         /* For Perl, if you add additional tests here, also add them to
10199          * t/base/num.t for benefit of platforms not using Configure or
10200          * overriding d_Gconvert */
10201
10202         exit(0);
10203 }
10204 EOP
10205 : first add preferred functions to our list
10206 xxx_list=""
10207 for xxx_convert in $gconvert_preference; do
10208     case $xxx_convert in
10209     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10210     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10211     esac
10212 done
10213 : then add any others
10214 for xxx_convert in gconvert gcvt sprintf; do
10215     case "$xxx_list" in
10216     *$xxx_convert*) ;;
10217     *) xxx_list="$xxx_list $xxx_convert" ;;
10218     esac
10219 done
10220
10221 case "$d_longdbl$uselongdouble" in
10222 "$define$define")
10223     : again, add preferred functions to our list first
10224     xxx_ld_list=""
10225     for xxx_convert in $gconvert_ld_preference; do
10226         case $xxx_convert in
10227         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10228         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10229         esac
10230     done
10231     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10232     for xxx_convert in qgcvt sprintf $xxx_list; do
10233         case "$xxx_ld_list" in
10234         $xxx_convert*|*" $xxx_convert"*) ;;
10235         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10236         esac
10237     done
10238     : if sprintf cannot do long doubles, move it to the end
10239     if test "$d_PRIgldbl" != "$define"; then
10240         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10241     fi
10242     : if no qgcvt, remove it
10243     if test "$d_qgcvt" != "$define"; then
10244         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10245     fi
10246     : use the ld_list
10247     xxx_list="$xxx_ld_list"
10248     ;;
10249 esac
10250
10251 for xxx_convert in $xxx_list; do
10252         echo "Trying $xxx_convert..."
10253         $rm -f try try$_o core
10254         set try -DTRY_$xxx_convert
10255         if eval $compile; then
10256                 echo "$xxx_convert() found." >&4
10257                 if $run ./try; then
10258                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10259                         break;
10260                 else
10261                         echo "...But $xxx_convert didn't work as I expected."
10262                         xxx_convert=''
10263                 fi
10264         else
10265                 echo "$xxx_convert NOT found." >&4
10266         fi
10267 done
10268
10269 if test X$xxx_convert = X; then
10270     echo "*** WHOA THERE!!! ***" >&4
10271     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10272     xxx_convert=sprintf
10273 fi
10274
10275 case "$xxx_convert" in
10276 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10277 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10278 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10279 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10280    "$define$define$define")
10281       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10282    "$define$define$undef")
10283       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10284    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10285    esac
10286    ;;
10287 esac
10288
10289 fi
10290 $rm_try
10291
10292 : see if _fwalk exists
10293 set fwalk d__fwalk
10294 eval $inlibc
10295
10296 : Initialize h_fcntl
10297 h_fcntl=false
10298
10299 : Initialize h_sysfile
10300 h_sysfile=false
10301
10302 : access call always available on UNIX
10303 set access d_access
10304 eval $inlibc
10305
10306 : locate the flags for 'access()'
10307 case "$d_access" in
10308 "$define")
10309         echo " "
10310         $cat >access.c <<EOCP
10311 #include <sys/types.h>
10312 #ifdef I_FCNTL
10313 #include <fcntl.h>
10314 #endif
10315 #ifdef I_SYS_FILE
10316 #include <sys/file.h>
10317 #endif
10318 #ifdef I_UNISTD
10319 #include <unistd.h>
10320 #endif
10321 #$i_stdlib I_STDLIB
10322 #ifdef I_STDLIB
10323 #include <stdlib.h>
10324 #endif
10325 int main() {
10326         exit(R_OK);
10327 }
10328 EOCP
10329         : check sys/file.h first, no particular reason here
10330         if $test `./findhdr sys/file.h` && \
10331                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10332                 h_sysfile=true;
10333                 echo "<sys/file.h> defines the *_OK access constants." >&4
10334         elif $test `./findhdr fcntl.h` && \
10335                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10336                 h_fcntl=true;
10337                 echo "<fcntl.h> defines the *_OK access constants." >&4
10338         elif $test `./findhdr unistd.h` && \
10339                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10340                 echo "<unistd.h> defines the *_OK access constants." >&4
10341         else
10342                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10343         fi
10344         ;;
10345 esac
10346 $rm -f access*
10347
10348 : see if accessx exists
10349 set accessx d_accessx
10350 eval $inlibc
10351
10352 : see if acosh exists
10353 set acosh d_acosh
10354 eval $inlibc
10355
10356 : see if aintl exists
10357 set aintl d_aintl
10358 eval $inlibc
10359
10360 : see if alarm exists
10361 set alarm d_alarm
10362 eval $inlibc
10363
10364 : see if 64bit time functions exists
10365
10366 set ctime64 d_ctime64
10367 eval $inlibc
10368
10369 set localtime64 d_localtime64
10370 eval $inlibc
10371
10372 set gmtime64 d_gmtime64
10373 eval $inlibc
10374
10375 set mktime64 d_mktime64
10376 eval $inlibc
10377
10378 set difftime64 d_difftime64
10379 eval $inlibc
10380
10381 set asctime64 d_asctime64
10382 eval $inlibc
10383
10384 : see if POSIX threads are available
10385 set pthread.h i_pthread
10386 eval $inhdr
10387
10388 : define a function to check prototypes
10389 $cat > protochk <<EOSH
10390 $startsh
10391 cc="$cc"
10392 optimize="$optimize"
10393 ccflags="$ccflags"
10394 prototype="$prototype"
10395 define="$define"
10396 rm_try="$rm_try"
10397 usethreads=$usethreads
10398 i_pthread=$i_pthread
10399 pthread_h_first=$pthread_h_first
10400 EOSH
10401
10402 $cat >> protochk <<'EOSH'
10403
10404 $rm_try
10405 foo="$1"
10406 shift
10407 while test $# -ge 2; do
10408         case "$1" in
10409                 $define) echo "#include <$2>" >> try.c ;;
10410                 literal) echo "$2" >> try.c ;;
10411         esac
10412     # Extra magic for the benefit of systems that need pthread.h
10413     # to be included early to correctly detect threadsafe functions.
10414     # Such functions must guarantee themselves, though, that the usethreads
10415     # and i_pthread have been defined, before calling protochk.
10416     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10417         echo "#include <pthread.h>" >> try.c
10418         pthread_h_done=yes
10419     fi
10420     shift 2
10421 done
10422 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10423 cat >> try.c <<'EOCP'
10424 #ifdef CAN_PROTOTYPE
10425 #define _(args) args
10426 #else
10427 #define _(args) ()
10428 #endif
10429 EOCP
10430 echo "$foo" >> try.c
10431 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10432 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10433 status=$?
10434 $rm_try
10435 exit $status
10436 EOSH
10437 chmod +x protochk
10438 $eunicefix protochk
10439
10440 : Define hasproto macro for Configure internal use
10441 hasproto='varname=$1; func=$2; shift; shift;
10442 while $test $# -ge 2; do
10443         case "$1" in
10444         $define) echo "#include <$2>";;
10445         esac ;
10446     shift 2;
10447 done > try.c;
10448 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10449 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10450         echo "$func() prototype found.";
10451         val="$define";
10452 else
10453         echo "$func() prototype NOT found.";
10454         val="$undef";
10455 fi;
10456 set $varname;
10457 eval $setvar;
10458 $rm_try tryout.c'
10459
10460 : see if sys/types.h has to be included
10461 set sys/types.h i_systypes
10462 eval $inhdr
10463
10464 : see if sys/select.h has to be included
10465 set sys/select.h i_sysselct
10466 eval $inhdr
10467
10468 : Define hasfield macro for Configure internal use
10469 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10470 while $test $# -ge 2; do
10471         case "$1" in
10472         $define) echo "#include <$2>";;
10473         esac ;
10474     shift 2;
10475 done > try.c;
10476 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10477 set try;
10478 if eval $compile; then
10479         val="$define";
10480 else
10481         val="$undef";
10482 fi;
10483 set $varname;
10484 eval $setvar;
10485 $rm_try'
10486
10487 : see if we should include time.h, sys/time.h, or both
10488 echo " "
10489 if test "X$timeincl" = X; then
10490         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10491         $echo $n "I'm now running the test program...$c"
10492         $cat >try.c <<EOCP
10493 #include <sys/types.h>
10494 #ifdef I_TIME
10495 #include <time.h>
10496 #endif
10497 #ifdef I_SYSTIME
10498 #ifdef SYSTIMEKERNEL
10499 #define KERNEL
10500 #endif
10501 #include <sys/time.h>
10502 #endif
10503 #ifdef I_SYSSELECT
10504 #include <sys/select.h>
10505 #endif
10506 #$i_stdlib I_STDLIB
10507 #ifdef I_STDLIB
10508 #include <stdlib.h>
10509 #endif
10510 int main()
10511 {
10512         struct tm foo;
10513 #ifdef S_TIMEVAL
10514         struct timeval bar;
10515 #endif
10516 #ifdef S_TIMEZONE
10517         struct timezone tzp;
10518 #endif
10519         if (foo.tm_sec == foo.tm_sec)
10520                 exit(0);
10521 #ifdef S_TIMEVAL
10522         if (bar.tv_sec == bar.tv_sec)
10523                 exit(0);
10524 #endif
10525         exit(1);
10526 }
10527 EOCP
10528         flags=''
10529         for s_timezone in '-DS_TIMEZONE' ''; do
10530         sysselect=''
10531         for s_timeval in '-DS_TIMEVAL' ''; do
10532         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10533         for i_time in '' '-DI_TIME'; do
10534         for i_systime in '-DI_SYSTIME' ''; do
10535                 case "$flags" in
10536                 '') $echo $n ".$c"
10537                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10538                         if eval $compile; then
10539                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10540                                 shift
10541                                 flags="$*"
10542                                 echo " "
10543                                 $echo $n "Succeeded with $flags$c"
10544                         fi
10545                         ;;
10546                 esac
10547         done
10548         done
10549         done
10550         done
10551         done
10552         timeincl=''
10553         echo " "
10554         case "$flags" in
10555         *SYSTIMEKERNEL*) i_systimek="$define"
10556                 timeincl=`./findhdr sys/time.h`
10557                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10558         *) i_systimek="$undef";;
10559         esac
10560         case "$flags" in
10561         *I_TIME*) i_time="$define"
10562                 timeincl=`./findhdr time.h`" $timeincl"
10563                 echo "We'll include <time.h>." >&4;;
10564         *) i_time="$undef";;
10565         esac
10566         case "$flags" in
10567         *I_SYSTIME*) i_systime="$define"
10568                 timeincl=`./findhdr sys/time.h`" $timeincl"
10569                 echo "We'll include <sys/time.h>." >&4;;
10570         *) i_systime="$undef";;
10571         esac
10572         $rm_try
10573 fi
10574 : see if struct tm knows about tm_zone
10575 case "$i_systime$i_time" in
10576 *$define*)
10577         echo " "
10578         echo "Checking to see if your struct tm has tm_zone field..." >&4
10579         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10580         eval $hasfield
10581         ;;
10582 *)      val="$undef"
10583         set d_tm_tm_zone
10584         eval $setvar
10585         ;;
10586 esac
10587 case "$d_tm_tm_zone" in
10588 "$define")      echo "Yes, it does."   ;;
10589 *)              echo "No, it doesn't." ;;
10590 esac
10591 : see if struct tm knows about tm_gmtoff
10592 case "$i_systime$i_time" in
10593 *$define*)
10594         echo " "
10595         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10596         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10597         eval $hasfield
10598         ;;
10599 *)      val="$undef"
10600         set d_tm_tm_gmtoff
10601         eval $setvar
10602         ;;
10603 esac
10604 case "$d_tm_tm_gmtoff" in
10605 "$define")      echo "Yes, it does."   ;;
10606 *)              echo "No, it doesn't." ;;
10607 esac
10608
10609 : see if asctime_r exists
10610 set asctime_r d_asctime_r
10611 eval $inlibc
10612 case "$d_asctime_r" in
10613 "$define")
10614         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10615         case "$d_asctime_r_proto:$usethreads" in
10616         ":define")      d_asctime_r_proto=define
10617                 set d_asctime_r_proto asctime_r $hdrs
10618                 eval $hasproto ;;
10619         *)      ;;
10620         esac
10621         case "$d_asctime_r_proto" in
10622         define)
10623         case "$asctime_r_proto" in
10624         ''|0) try='char* asctime_r(const struct tm*, char*);'
10625         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10626         esac
10627         case "$asctime_r_proto" in
10628         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10629         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10630         esac
10631         case "$asctime_r_proto" in
10632         ''|0) try='int asctime_r(const struct tm*, char*);'
10633         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10634         esac
10635         case "$asctime_r_proto" in
10636         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10637         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10638         esac
10639         case "$asctime_r_proto" in
10640         ''|0)   d_asctime_r=undef
10641                 asctime_r_proto=0
10642                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10643         * )     case "$asctime_r_proto" in
10644                 REENTRANT_PROTO*) ;;
10645                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10646                 esac
10647                 echo "Prototype: $try" ;;
10648         esac
10649         ;;
10650         *)      case "$usethreads" in
10651                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10652                 esac
10653                 d_asctime_r=undef
10654                 asctime_r_proto=0
10655                 ;;
10656         esac
10657         ;;
10658 *)      asctime_r_proto=0
10659         ;;
10660 esac
10661
10662 : see if atolf exists
10663 set atolf d_atolf
10664 eval $inlibc
10665
10666 : see if atoll exists
10667 set atoll d_atoll
10668 eval $inlibc
10669
10670 : Look for GCC-style attribute format
10671 case "$d_attribute_format" in
10672 '')
10673 echo " "
10674 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10675 $cat >attrib.c <<'EOCP'
10676 #include <stdio.h>
10677 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10678 EOCP
10679 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10680         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10681                 echo "Your C compiler doesn't support __attribute__((format))."
10682                 val="$undef"
10683         else
10684                 echo "Your C compiler supports __attribute__((format))."
10685                 val="$define"
10686         fi
10687 else
10688         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10689         val="$undef"
10690 fi
10691 ;;
10692 *) val="$d_attribute_format" ;;
10693 esac
10694 set d_attribute_format
10695 eval $setvar
10696 $rm -f attrib*
10697
10698 : Look for GCC-style attribute format with null format allowed
10699 case "$d_printf_format_null" in
10700 '') case "$d_attribute_format" in
10701     $define)
10702         echo " "
10703         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10704 $cat >attrib.c <<EOCP
10705 #include <stdio.h>
10706 #$i_stdlib I_STDLIB
10707 #ifdef I_STDLIB
10708 #include <stdlib.h>
10709 #endif
10710 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10711 int null_printf (char* pat,...) { return (int)pat; }
10712 int main () { exit(null_printf(NULL)); }
10713 EOCP
10714         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10715             : run the executable in case it produces a run-time warning
10716             if $run ./attrib >>attrib.out 2>&1; then
10717                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10718                     echo "Your C compiler doesn't allow __printf__ format to be null."
10719                     val="$undef"
10720                 else
10721                     echo "Your C compiler allows __printf__ format to be null."
10722                     val="$define"
10723                 fi
10724             else
10725             echo "Your C compiler executable failed with __printf__ format null."
10726             val="$undef"
10727         fi
10728     else
10729         echo "Your C compiler fails with __printf__ format null."
10730         val="$undef"
10731     fi
10732     ;;
10733     *)  val="$undef" ;;
10734     esac
10735 ;;
10736 *)  val="$d_printf_format_null" ;;
10737 esac
10738 set d_printf_format_null
10739 eval $setvar
10740 $rm -f attrib*
10741
10742 : Look for GCC-style attribute malloc
10743 case "$d_attribute_malloc" in
10744 '')
10745 echo " "
10746 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10747 $cat >attrib.c <<'EOCP'
10748 #include <stdio.h>
10749 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10750 EOCP
10751 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10752         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10753                 echo "Your C compiler doesn't support __attribute__((malloc))."
10754                 val="$undef"
10755         else
10756                 echo "Your C compiler supports __attribute__((malloc))."
10757                 val="$define"
10758         fi
10759 else
10760         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10761         val="$undef"
10762 fi
10763 ;;
10764 *) val="$d_attribute_malloc" ;;
10765 esac
10766 set d_attribute_malloc
10767 eval $setvar
10768 $rm -f attrib*
10769
10770 : Look for GCC-style attribute nonnull
10771 case "$d_attribute_nonnull" in
10772 '')
10773 echo " "
10774 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10775 $cat >attrib.c <<'EOCP'
10776 #include <stdio.h>
10777 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10778 EOCP
10779 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10780         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10781                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10782                 val="$undef"
10783         else
10784                 echo "Your C compiler supports __attribute__((nonnull))."
10785                 val="$define"
10786         fi
10787 else
10788         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10789         val="$undef"
10790 fi
10791 ;;
10792 *) val="$d_attribute_nonnull" ;;
10793 esac
10794 set d_attribute_nonnull
10795 eval $setvar
10796 $rm -f attrib*
10797
10798 : Look for GCC-style attribute noreturn
10799 case "$d_attribute_noreturn" in
10800 '')
10801 echo " "
10802 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10803 $cat >attrib.c <<'EOCP'
10804 #include <stdio.h>
10805 void fall_over_dead( void ) __attribute__((noreturn));
10806 EOCP
10807 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10808         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10809                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10810                 val="$undef"
10811         else
10812                 echo "Your C compiler supports __attribute__((noreturn))."
10813                 val="$define"
10814         fi
10815 else
10816         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10817         val="$undef"
10818 fi
10819 ;;
10820 *) val="$d_attribute_noreturn" ;;
10821 esac
10822 set d_attribute_noreturn
10823 eval $setvar
10824 $rm -f attrib*
10825
10826 : Look for GCC-style attribute pure
10827 case "$d_attribute_pure" in
10828 '')
10829 echo " "
10830 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10831 $cat >attrib.c <<'EOCP'
10832 #include <stdio.h>
10833 int square( int n ) __attribute__((pure));
10834 EOCP
10835 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10836         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10837                 echo "Your C compiler doesn't support __attribute__((pure))."
10838                 val="$undef"
10839         else
10840                 echo "Your C compiler supports __attribute__((pure))."
10841                 val="$define"
10842         fi
10843 else
10844         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10845         val="$undef"
10846 fi
10847 ;;
10848 *) val="$d_attribute_pure" ;;
10849 esac
10850 set d_attribute_pure
10851 eval $setvar
10852 $rm -f attrib*
10853
10854 : Look for GCC-style attribute unused
10855 case "$d_attribute_unused" in
10856 '')
10857 echo " "
10858 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10859 $cat >attrib.c <<'EOCP'
10860 #include <stdio.h>
10861 int do_something( int dummy __attribute__((unused)), int n );
10862 EOCP
10863 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10864         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10865                 echo "Your C compiler doesn't support __attribute__((unused))."
10866                 val="$undef"
10867         else
10868                 echo "Your C compiler supports __attribute__((unused))."
10869                 val="$define"
10870         fi
10871 else
10872         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10873         val="$undef"
10874 fi
10875 ;;
10876 *) val="$d_attribute_unused" ;;
10877 esac
10878 set d_attribute_unused
10879 eval $setvar
10880 $rm -f attrib*
10881
10882 : Look for GCC-style attribute deprecated
10883 case "$d_attribute_deprecated" in
10884 '')
10885 echo " "
10886 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10887 $cat >attrib.c <<'EOCP'
10888 #include <stdio.h>
10889 int I_am_deprecated(void) __attribute__((deprecated));
10890 EOCP
10891 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10892         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10893                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10894                 val="$undef"
10895         else
10896                 echo "Your C compiler supports __attribute__((deprecated))."
10897                 val="$define"
10898         fi
10899 else
10900         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10901         val="$undef"
10902 fi
10903 ;;
10904 *) val="$d_attribute_deprecated" ;;
10905 esac
10906 set d_attribute_deprecated
10907 eval $setvar
10908 $rm -f attrib*
10909
10910 : Look for GCC-style attribute warn_unused_result
10911 case "$d_attribute_warn_unused_result" in
10912 '')
10913 echo " "
10914 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10915 $cat >attrib.c <<'EOCP'
10916 #include <stdio.h>
10917 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10918 EOCP
10919 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10920         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10921                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10922                 val="$undef"
10923         else
10924                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10925                 val="$define"
10926         fi
10927 else
10928         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10929         val="$undef"
10930 fi
10931 ;;
10932 *) val="$d_attribute_warn_unused_result" ;;
10933 esac
10934 set d_attribute_warn_unused_result
10935 eval $setvar
10936 $rm -f attrib*
10937
10938 : see if bcmp exists
10939 set bcmp d_bcmp
10940 eval $inlibc
10941
10942 : see if bcopy exists
10943 set bcopy d_bcopy
10944 eval $inlibc
10945
10946 : see if getpgrp exists
10947 set getpgrp d_getpgrp
10948 eval $inlibc
10949
10950 case "$d_getpgrp" in
10951 "$define")
10952         echo " "
10953         echo "Checking to see which flavor of getpgrp is in use..."
10954         $cat >try.c <<EOP
10955 #$i_unistd I_UNISTD
10956 #include <sys/types.h>
10957 #ifdef I_UNISTD
10958 #  include <unistd.h>
10959 #endif
10960 #$i_stdlib I_STDLIB
10961 #ifdef I_STDLIB
10962 #include <stdlib.h>
10963 #endif
10964 int main()
10965 {
10966         if (getuid() == 0) {
10967                 printf("(I see you are running Configure as super-user...)\n");
10968                 setuid(1);
10969         }
10970 #ifdef TRY_BSD_PGRP
10971         if (getpgrp(1) == 0)
10972                 exit(0);
10973 #else
10974         if (getpgrp() > 0)
10975                 exit(0);
10976 #endif
10977         exit(1);
10978 }
10979 EOP
10980         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10981                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10982                 val="$define"
10983         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10984                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10985                 val="$undef"
10986         else
10987                 echo "I can't seem to compile and run the test program."
10988                 if ./usg; then
10989                         xxx="a USG one, i.e. you use getpgrp()."
10990                 else
10991                         # SVR4 systems can appear rather BSD-ish.
10992                         case "$i_unistd" in
10993                         $undef)
10994                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10995                                 val="$define"
10996                                 ;;
10997                         $define)
10998                                 xxx="probably a USG one, i.e. you use getpgrp()."
10999                                 val="$undef"
11000                                 ;;
11001                         esac
11002                 fi
11003                 echo "Assuming your getpgrp is $xxx" >&4
11004         fi
11005         ;;
11006 *) val="$undef";;
11007 esac
11008 set d_bsdgetpgrp
11009 eval $setvar
11010 $rm_try
11011
11012 : see if setpgrp exists
11013 set setpgrp d_setpgrp
11014 eval $inlibc
11015
11016 case "$d_setpgrp" in
11017 "$define")
11018         echo " "
11019         echo "Checking to see which flavor of setpgrp is in use..."
11020         $cat >try.c <<EOP
11021 #$i_unistd I_UNISTD
11022 #include <sys/types.h>
11023 #ifdef I_UNISTD
11024 #  include <unistd.h>
11025 #endif
11026 #$i_stdlib I_STDLIB
11027 #ifdef I_STDLIB
11028 #include <stdlib.h>
11029 #endif
11030 int main()
11031 {
11032         if (getuid() == 0) {
11033                 printf("(I see you are running Configure as super-user...)\n");
11034                 setuid(1);
11035         }
11036 #ifdef TRY_BSD_PGRP
11037         if (-1 == setpgrp(1, 1))
11038                 exit(0);
11039 #else
11040         if (setpgrp() != -1)
11041                 exit(0);
11042 #endif
11043         exit(1);
11044 }
11045 EOP
11046         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11047                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11048                 val="$define"
11049         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11050                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11051                 val="$undef"
11052         else
11053                 echo "(I can't seem to compile and run the test program.)"
11054                 if ./usg; then
11055                         xxx="a USG one, i.e. you use setpgrp()."
11056                 else
11057                         # SVR4 systems can appear rather BSD-ish.
11058                         case "$i_unistd" in
11059                         $undef)
11060                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11061                                 val="$define"
11062                                 ;;
11063                         $define)
11064                                 xxx="probably a USG one, i.e. you use setpgrp()."
11065                                 val="$undef"
11066                                 ;;
11067                         esac
11068                 fi
11069                 echo "Assuming your setpgrp is $xxx" >&4
11070         fi
11071         ;;
11072 *) val="$undef";;
11073 esac
11074 set d_bsdsetpgrp
11075 eval $setvar
11076 $rm_try
11077
11078 : Look for GCC-style __builtin_choose_expr
11079 case "$d_builtin_choose_expr" in
11080 '')
11081     echo " "
11082     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11083     $cat >try.c <<'EOCP'
11084 #include <assert.h>
11085 #include <stdlib.h>
11086 #include <stdio.h>
11087
11088 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11089
11090 int main(void) {
11091     assert( SYRINX(1) == 2112 );
11092     assert( SYRINX(1) != 5150 );
11093     assert( SYRINX(0) == 5150 );
11094     assert( SYRINX(0) != 2112 );
11095     puts( "All good!" );
11096     exit(0);
11097 }
11098
11099 EOCP
11100     set try
11101     if eval $compile && $run ./try; then
11102         echo "Your C compiler supports __builtin_choose_expr."
11103         val="$define"
11104     else
11105         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11106         val="$undef"
11107     fi
11108 ;;
11109 *) val="$d_builtin_choose_expr" ;;
11110 esac
11111
11112 set d_builtin_choose_expr
11113 eval $setvar
11114 $rm_try
11115
11116 : Look for GCC-style __builtin_expect
11117 case "$d_builtin_expect" in
11118 '')
11119     echo " "
11120     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11121     $cat >try.c <<'EOCP'
11122 int main(void) {
11123     int n = 50;
11124     if ( __builtin_expect(n, 0) ) n = 1;
11125     /* Remember shell exit code truth is 0, C truth is non-zero */
11126     return !(n == 1);
11127 }
11128 EOCP
11129     set try
11130     if eval $compile && $run ./try; then
11131         echo "Your C compiler supports __builtin_expect."
11132         val="$define"
11133     else
11134         echo "Your C compiler doesn't seem to understand __builtin_expect."
11135         val="$undef"
11136     fi
11137     ;;
11138 *) val="$d_builtin_expect" ;;
11139 esac
11140
11141 set d_builtin_expect
11142 eval $setvar
11143 $rm_try
11144
11145 : see if bzero exists
11146 set bzero d_bzero
11147 eval $inlibc
11148
11149 : see if stdarg is available
11150 echo " "
11151 if $test `./findhdr stdarg.h`; then
11152         echo "<stdarg.h> found." >&4
11153         valstd="$define"
11154 else
11155         echo "<stdarg.h> NOT found." >&4
11156         valstd="$undef"
11157 fi
11158
11159 : see if varargs is available
11160 echo " "
11161 if $test `./findhdr varargs.h`; then
11162         echo "<varargs.h> found." >&4
11163 else
11164         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11165 fi
11166
11167 : set up the varargs testing programs
11168 $cat > varargs.c <<EOP
11169 #ifdef I_STDARG
11170 #include <stdarg.h>
11171 #endif
11172 #ifdef I_VARARGS
11173 #include <varargs.h>
11174 #endif
11175
11176 #ifdef I_STDARG
11177 int f(char *p, ...)
11178 #else
11179 int f(va_alist)
11180 va_dcl
11181 #endif
11182 {
11183         va_list ap;
11184 #ifndef I_STDARG
11185         char *p;
11186 #endif
11187 #ifdef I_STDARG
11188         va_start(ap,p);
11189 #else
11190         va_start(ap);
11191         p = va_arg(ap, char *);
11192 #endif
11193         va_end(ap);
11194         return 0;
11195 }
11196 EOP
11197 $cat > varargs <<EOP
11198 $startsh
11199 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11200         echo "true"
11201 else
11202         echo "false"
11203 fi
11204 $rm -f varargs$_o
11205 EOP
11206 chmod +x varargs
11207
11208 : now check which varargs header should be included
11209 echo " "
11210 i_varhdr=''
11211 val=''
11212 case "$valstd" in
11213 "$define")
11214         if `./varargs I_STDARG`; then
11215                 val='stdarg.h'
11216         elif `./varargs I_VARARGS`; then
11217                 val='varargs.h'
11218         fi
11219         ;;
11220 *)
11221         if `./varargs I_VARARGS`; then
11222                 val='varargs.h'
11223         fi
11224         ;;
11225 esac
11226 case "$val" in
11227 '')
11228         echo " "
11229         echo "*** WHOA THERE!!! ***" >&4
11230         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11231         case "$knowitall" in
11232         '')
11233         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11234                 exit 1
11235                 ;;
11236         esac
11237 echo "I could not find the definition for va_dcl... You have problems..." >&4
11238         val="$undef"; set i_stdarg; eval $setvar
11239         val="$undef"; set i_varargs; eval $setvar
11240         ;;
11241 *)
11242         set i_varhdr
11243         eval $setvar
11244         case "$i_varhdr" in
11245         stdarg.h)
11246                 val="$define"; set i_stdarg; eval $setvar
11247                 val="$undef"; set i_varargs; eval $setvar
11248                 ;;
11249         varargs.h)
11250                 val="$undef"; set i_stdarg; eval $setvar
11251                 val="$define"; set i_varargs; eval $setvar
11252                 ;;
11253         esac
11254         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11255 esac
11256 $rm -f varargs*
11257
11258 : see if the Compiler supports C99 variadic macros
11259 case "$i_stdarg$i_stdlib" in
11260     "$define$define")
11261     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11262     $cat >try.c <<EOCP
11263 #include <stdio.h>
11264 #include <stdarg.h>
11265
11266 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11267
11268 int main() {
11269   char buf[20];
11270   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11271   puts(buf);
11272   return 0;
11273 }
11274 EOCP
11275     set try
11276     if eval $compile && $run ./try 2>&1 >/dev/null; then
11277         case "`$run ./try`" in
11278             "123 456 789")
11279             echo "You have C99 variadic macros." >&4
11280             d_c99_variadic_macros="$define"
11281             ;;
11282             *)
11283             echo "You don't have functional C99 variadic macros." >&4
11284             d_c99_variadic_macros="$undef"
11285             ;;
11286         esac
11287     else
11288         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11289         d_c99_variadic_macros="$undef"
11290     fi
11291     $rm_try
11292     ;;
11293     *)
11294     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11295     d_c99_variadic_macros="$undef"
11296     ;;
11297 esac
11298
11299 : see if signal is declared as pointer to function returning int or void
11300 echo " "
11301 xxx=`./findhdr signal.h`
11302 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11303 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11304         echo "You have int (*signal())() instead of void." >&4
11305         val="$undef"
11306 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11307         echo "You have void (*signal())()." >&4
11308         val="$define"
11309 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11310         echo "You have int (*signal())() instead of void." >&4
11311         val="$undef"
11312 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11313         echo "You have void (*signal())()." >&4
11314         val="$define"
11315 else
11316         case "$d_voidsig" in
11317         '')
11318         echo "I can't determine whether signal handler returns void or int..." >&4
11319                 dflt=void
11320                 rp="What type does your signal handler return?"
11321                 . ./myread
11322                 case "$ans" in
11323                 v*) val="$define";;
11324                 *) val="$undef";;
11325                 esac;;
11326         "$define")
11327                 echo "As you already told me, signal handler returns void." >&4
11328                 val="$define"
11329                 ;;
11330         *)      echo "As you already told me, signal handler returns int." >&4
11331                 val="$undef"
11332                 ;;
11333         esac
11334 fi
11335 set d_voidsig
11336 eval $setvar
11337 case "$d_voidsig" in
11338 "$define") signal_t="void";;
11339 *) signal_t="int";;
11340 esac
11341 $rm -f $$.tmp
11342
11343 : check for ability to cast large floats to 32-bit ints.
11344 echo " "
11345 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11346 if $test "$intsize" -ge 4; then
11347         xxx=int
11348 else
11349         xxx=long
11350 fi
11351 $cat >try.c <<EOCP
11352 #include <stdio.h>
11353 #$i_stdlib I_STDLIB
11354 #ifdef I_STDLIB
11355 #include <stdlib.h>
11356 #endif
11357 #include <sys/types.h>
11358 #include <signal.h>
11359 $signal_t blech(int s) { exit(3); }
11360 int main()
11361 {
11362         $xxx i32;
11363         double f, g;
11364         int result = 0;
11365         char str[16];
11366         signal(SIGFPE, blech);
11367
11368         /* Don't let compiler optimize the test away.  Store the number
11369            in a writable string for gcc to pass to sscanf under HP-UX.
11370         */
11371         sprintf(str, "2147483647");
11372         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11373         g = 10 * f;
11374         i32  = ($xxx) g;
11375
11376         /* x86 processors will probably give 0x8000 0000, which is a
11377            sign change.  We don't want that.  We want to mimic SPARC
11378            behavior here, which is to preserve the sign and give
11379            back 0x7fff ffff.
11380         */
11381         if (i32 != ($xxx) f)
11382                 result |= 1;
11383         exit(result);
11384 }
11385 EOCP
11386 set try
11387 if eval $compile_ok; then
11388         $run ./try
11389         yyy=$?
11390 else
11391         echo "(I can't seem to compile the test program--assuming it can't)"
11392         yyy=1
11393 fi
11394 case "$yyy" in
11395 0)      val="$define"
11396         echo "Yup, it can."
11397         ;;
11398 *)      val="$undef"
11399         echo "Nope, it can't."
11400         ;;
11401 esac
11402 set d_casti32
11403 eval $setvar
11404 $rm_try
11405
11406 : check for ability to cast negative floats to unsigned
11407 echo " "
11408 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11409 $cat >try.c <<EOCP
11410 #include <stdio.h>
11411 #$i_stdlib I_STDLIB
11412 #ifdef I_STDLIB
11413 #include <stdlib.h>
11414 #endif
11415 #include <sys/types.h>
11416 #include <signal.h>
11417 $signal_t blech(int s) { exit(7); }
11418 $signal_t blech_in_list(int s) { exit(4); }
11419 unsigned long dummy_long(unsigned long p) { return p; }
11420 unsigned int dummy_int(unsigned int p) { return p; }
11421 unsigned short dummy_short(unsigned short p) { return p; }
11422 int main()
11423 {
11424         double f;
11425         unsigned long along;
11426         unsigned int aint;
11427         unsigned short ashort;
11428         int result = 0;
11429         char str[16];
11430
11431         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11432            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11433            optimized the whole file away
11434         */
11435         /* Store the number in a writable string for gcc to pass to
11436            sscanf under HP-UX.
11437         */
11438         sprintf(str, "-123");
11439         sscanf(str, "%lf", &f);  /* f = -123.; */
11440
11441         signal(SIGFPE, blech);
11442         along = (unsigned long)f;
11443         aint = (unsigned int)f;
11444         ashort = (unsigned short)f;
11445         if (along != (unsigned long)-123)
11446                 result |= 1;
11447         if (aint != (unsigned int)-123)
11448                 result |= 1;
11449         if (ashort != (unsigned short)-123)
11450                 result |= 1;
11451         sprintf(str, "1073741824.");
11452         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11453         f = f + f;
11454         along = 0;
11455         along = (unsigned long)f;
11456         if (along != 0x80000000)
11457                 result |= 2;
11458         f -= 1.;
11459         along = 0;
11460         along = (unsigned long)f;
11461         if (along != 0x7fffffff)
11462                 result |= 1;
11463         f += 2.;
11464         along = 0;
11465         along = (unsigned long)f;
11466         if (along != 0x80000001)
11467                 result |= 2;
11468         if (result)
11469                 exit(result);
11470         signal(SIGFPE, blech_in_list);
11471         sprintf(str, "123.");
11472         sscanf(str, "%lf", &f);  /* f = 123.; */
11473         along = dummy_long((unsigned long)f);
11474         aint = dummy_int((unsigned int)f);
11475         ashort = dummy_short((unsigned short)f);
11476         if (along != (unsigned long)123)
11477                 result |= 4;
11478         if (aint != (unsigned int)123)
11479                 result |= 4;
11480         if (ashort != (unsigned short)123)
11481                 result |= 4;
11482         exit(result);
11483
11484 }
11485 EOCP
11486 set try
11487 if eval $compile_ok; then
11488         $run ./try
11489         castflags=$?
11490 else
11491         echo "(I can't seem to compile the test program--assuming it can't)"
11492         castflags=7
11493 fi
11494 case "$castflags" in
11495 0)      val="$define"
11496         echo "Yup, it can."
11497         ;;
11498 *)      val="$undef"
11499         echo "Nope, it can't."
11500         ;;
11501 esac
11502 set d_castneg
11503 eval $setvar
11504 $rm_try
11505
11506 : see if vprintf exists
11507 echo " "
11508 if set vprintf val -f d_vprintf; eval $csym; $val; then
11509         echo 'vprintf() found.' >&4
11510         val="$define"
11511         $cat >try.c <<EOF
11512 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11513 #$i_varargs I_VARARGS
11514
11515 #$i_stdlib I_STDLIB
11516 #$i_unistd I_UNISTD
11517
11518 #ifdef I_STDARG
11519 #  include <stdarg.h>
11520 #else /* I_VARARGS */
11521 #  include <varargs.h>
11522 #endif
11523
11524 #ifdef I_UNISTD
11525 #  include <unistd.h>
11526 #endif
11527
11528 #ifdef I_STDLIB
11529 #  include <stdlib.h>
11530 #endif
11531
11532 #include <stdio.h> /* vsprintf prototype */
11533
11534 #ifdef I_STDARG
11535 void xxx(int n, ...)
11536 {
11537     va_list args;
11538     char buf[10];
11539     va_start(args, n);
11540     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11541 }
11542 int main() { xxx(1, "foo"); }
11543
11544 #else /* I_VARARGS */
11545
11546 xxx(va_alist)
11547 va_dcl
11548 {
11549     va_list args;
11550     char buf[10];
11551     va_start(args);
11552     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11553 }
11554 int main() { xxx("foo"); }
11555
11556 #endif
11557
11558 EOF
11559         set try
11560         if eval $compile_ok; then
11561                 if $run ./try; then
11562                         echo "Your vsprintf() returns (int)." >&4
11563                         val2="$undef"
11564                 else
11565                         echo "Your vsprintf() returns (char*)." >&4
11566                         val2="$define"
11567                 fi
11568         else
11569                 echo 'I am unable to compile the vsprintf() test program.' >&4
11570                 # We shouldn't get here.  If we do, assume the standard signature,
11571                 # not the old BSD one.
11572                 echo 'Guessing that vsprintf() returns (int).' >&4
11573                 val2="$undef"
11574         fi
11575 else
11576         echo 'vprintf() NOT found.' >&4
11577         val="$undef"
11578         val2="$undef"
11579 fi
11580 $rm_try
11581 set d_vprintf
11582 eval $setvar
11583 val=$val2
11584 set d_charvspr
11585 eval $setvar
11586
11587 : see if chown exists
11588 set chown d_chown
11589 eval $inlibc
11590
11591 : see if chroot exists
11592 set chroot d_chroot
11593 eval $inlibc
11594
11595 : see if chsize exists
11596 set chsize d_chsize
11597 eval $inlibc
11598
11599 : see if class exists
11600 set class d_class
11601 eval $inlibc
11602
11603 : see if clearenv exists
11604 set clearenv d_clearenv
11605 eval $inlibc
11606
11607 : Define hasstruct macro for Configure internal use
11608 hasstruct='varname=$1; struct=$2; shift; shift;
11609 while $test $# -ge 2; do
11610         case "$1" in
11611         $define) echo "#include <$2>";;
11612         esac ;
11613     shift 2;
11614 done > try.c;
11615 echo "int main () { struct $struct foo; }" >> try.c;
11616 set try;
11617 if eval $compile; then
11618         val="$define";
11619 else
11620         val="$undef";
11621 fi;
11622 set $varname;
11623 eval $setvar;
11624 $rm_try'
11625
11626 : see whether socket exists
11627 socketlib=''
11628 sockethdr=''
11629 echo " "
11630 $echo $n "Hmm... $c" >&4
11631 if set socket val -f d_socket; eval $csym; $val; then
11632     echo "Looks like you have Berkeley networking support." >&4
11633     d_socket="$define"
11634     if set setsockopt val -f; eval $csym; $val; then
11635         d_oldsock="$undef"
11636     else
11637         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11638         d_oldsock="$define"
11639     fi
11640 else
11641     if $contains socklib libc.list >/dev/null 2>&1; then
11642         echo "Looks like you have Berkeley networking support." >&4
11643         d_socket="$define"
11644         : we will have to assume that it supports the 4.2 BSD interface
11645         d_oldsock="$undef"
11646     else
11647         echo "You don't have Berkeley networking in libc$_a..." >&4
11648         if test "X$d_socket" = "X$define"; then
11649             echo "...but you seem to believe that you have sockets." >&4
11650         else
11651             for net in net socket
11652             do
11653                 if test -f $sysroot/usr/lib/lib$net$_a; then
11654                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11655                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11656                     if $contains socket libc.list >/dev/null 2>&1; then
11657                         d_socket="$define"
11658                         socketlib="-l$net"
11659                         case "$net" in
11660                         net)
11661                             echo "...but the Wollongong group seems to have hacked it in." >&4
11662                             sockethdr="-I$sysroot/usr/netinclude"
11663                             ;;
11664                         esac
11665                         echo "Found Berkeley sockets interface in lib$net." >&4
11666                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11667                             d_oldsock="$undef"
11668                         else
11669                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11670                             d_oldsock="$define"
11671                         fi
11672                         break
11673                     fi
11674                 fi
11675             done
11676             if test "X$d_socket" != "X$define"; then
11677                echo "or anywhere else I see." >&4
11678                d_socket="$undef"
11679                d_oldsock="$undef"
11680             fi
11681         fi
11682     fi
11683 fi
11684
11685 : see if socketpair exists
11686 set socketpair d_sockpair
11687 eval $inlibc
11688
11689
11690 echo " "
11691 echo "Checking the availability sa_len in the sock struct ..." >&4
11692 $cat >try.c <<EOF
11693 #include <sys/types.h>
11694 #include <sys/socket.h>
11695 int main() {
11696 struct sockaddr sa;
11697 return (sa.sa_len);
11698 }
11699 EOF
11700 val="$undef"
11701 set try; if eval $compile; then
11702     val="$define"
11703 fi
11704 set d_sockaddr_sa_len; eval $setvar
11705 $rm_try
11706
11707 echo " "
11708 echo "Checking the availability struct sockaddr_in6 ..." >&4
11709 $cat >try.c <<EOF
11710 #include <sys/types.h>
11711 #include <sys/socket.h>
11712 #include <netinet/in.h>
11713 int main() {
11714 struct sockaddr_in6 sin6;
11715 return (sin6.sin6_family);
11716 }
11717 EOF
11718 val="$undef"
11719 set try; if eval $compile; then
11720     val="$define"
11721 fi
11722 set d_sockaddr_in6; eval $setvar
11723 $rm_try
11724
11725 echo " "
11726 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11727 $cat >try.c <<EOF
11728 #include <sys/types.h>
11729 #include <sys/socket.h>
11730 #include <netinet/in.h>
11731 int main() {
11732 struct sockaddr_in6 sin6;
11733 return (sin6.sin6_scope_id);
11734 }
11735 EOF
11736 val="$undef"
11737 set try; if eval $compile; then
11738     val="$define"
11739 fi
11740 set d_sin6_scope_id; eval $setvar
11741 $rm_try
11742
11743 echo " "
11744 echo "Checking the availability struct ip_mreq ..." >&4
11745 $cat >try.c <<EOF
11746 #include <sys/types.h>
11747 #include <sys/socket.h>
11748 #include <netinet/in.h>
11749 int main() {
11750 struct ip_mreq mreq;
11751 return (mreq.imr_multiaddr.s_addr);
11752 }
11753 EOF
11754 val="$undef"
11755 set try; if eval $compile; then
11756        val="$define"
11757 fi
11758 set d_ip_mreq; eval $setvar
11759 $rm_try
11760
11761 echo " "
11762 echo "Checking the availability struct ip_mreq_source ..." >&4
11763 $cat >try.c <<EOF
11764 #include <sys/types.h>
11765 #include <sys/socket.h>
11766 #include <netinet/in.h>
11767 int main() {
11768 struct ip_mreq_source mreq;
11769 return (mreq.imr_multiaddr.s_addr);
11770 }
11771 EOF
11772 val="$undef"
11773 set try; if eval $compile; then
11774        val="$define"
11775 fi
11776 set d_ip_mreq_source; eval $setvar
11777 $rm_try
11778
11779 echo " "
11780 echo "Checking the availability struct ipv6_mreq ..." >&4
11781 $cat >try.c <<EOF
11782 #include <sys/types.h>
11783 #include <sys/socket.h>
11784 #include <netinet/in.h>
11785 int main() {
11786 struct ipv6_mreq mreq;
11787 return (mreq.ipv6mr_interface);
11788 }
11789 EOF
11790 val="$undef"
11791 set try; if eval $compile; then
11792     val="$define"
11793 fi
11794 set d_ipv6_mreq; eval $setvar
11795 $rm_try
11796
11797 echo " "
11798 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11799 $cat >try.c <<EOF
11800 #include <sys/types.h>
11801 #include <sys/socket.h>
11802 #include <netinet/in.h>
11803 int main() {
11804 struct ipv6_mreq_source mreq;
11805 return (mreq.imr_multiaddr.s_addr);
11806 }
11807 EOF
11808 val="$undef"
11809 set try; if eval $compile; then
11810        val="$define"
11811 fi
11812 set d_ipv6_mreq_source; eval $setvar
11813 $rm_try
11814
11815 echo " "
11816 echo "Checking the availability of certain socket constants..." >&4
11817 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11818     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11819     $cat >try.c <<EOF
11820 #include <sys/types.h>
11821 #include <sys/socket.h>
11822 int main() {
11823     int i = $ENUM;
11824 }
11825 EOF
11826     val="$undef"
11827     set try; if eval $compile; then
11828         val="$define"
11829     fi
11830     set d_${enum}; eval $setvar
11831     $rm_try
11832 done
11833
11834 : see if this is a sys/uio.h system
11835 set sys/uio.h i_sysuio
11836 eval $inhdr
11837
11838 : Check for cmsghdr support
11839 echo " "
11840 echo "Checking to see if your system supports struct cmsghdr..." >&4
11841 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11842 eval $hasstruct
11843 case "$d_cmsghdr_s" in
11844 "$define")      echo "Yes, it does."   ;;
11845 *)              echo "No, it doesn't." ;;
11846 esac
11847
11848
11849 : check for const keyword
11850 echo " "
11851 echo 'Checking to see if your C compiler knows about "const"...' >&4
11852 $cat >const.c <<'EOCP'
11853 typedef struct spug { int drokk; } spug;
11854 int main()
11855 {
11856         const char *foo;
11857         const spug y = { 0 };
11858 }
11859 EOCP
11860 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11861         val="$define"
11862         echo "Yup, it does."
11863 else
11864         val="$undef"
11865         echo "Nope, it doesn't."
11866 fi
11867 set d_const
11868 eval $setvar
11869
11870 : see if copysignl exists
11871 set copysignl d_copysignl
11872 eval $inlibc
11873
11874 : see if crypt exists
11875 echo " "
11876 set crypt d_crypt
11877 eval $inlibc
11878 case "$d_crypt" in
11879 $define) cryptlib='' ;;
11880 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11881                 echo 'crypt() found.' >&4
11882                 val="$define"
11883                 cryptlib=''
11884         else
11885                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11886                 if $test -z "$cryptlib"; then
11887                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11888                 else
11889                         cryptlib=-lcrypt
11890                 fi
11891                 if $test -z "$cryptlib"; then
11892                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11893                 else
11894                         cryptlib=-lcrypt
11895                 fi
11896                 if $test -z "$cryptlib"; then
11897                         cryptlib=`./loc libcrypt$_a "" $libpth`
11898                 else
11899                         cryptlib=-lcrypt
11900                 fi
11901                 if $test -z "$cryptlib"; then
11902                         echo 'crypt() NOT found.' >&4
11903                         val="$undef"
11904                 else
11905                         val="$define"
11906                 fi
11907         fi
11908         set d_crypt
11909         eval $setvar
11910         ;;
11911 esac
11912
11913 : see if this is a crypt.h system
11914 set crypt.h i_crypt
11915 eval $inhdr
11916
11917 : see if crypt_r exists
11918 set crypt_r d_crypt_r
11919 eval $inlibc
11920 case "$d_crypt_r" in
11921 "$define")
11922         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11923         case "$d_crypt_r_proto:$usethreads" in
11924         ":define")      d_crypt_r_proto=define
11925                 set d_crypt_r_proto crypt_r $hdrs
11926                 eval $hasproto ;;
11927         *)      ;;
11928         esac
11929         case "$d_crypt_r_proto" in
11930         define)
11931         case "$crypt_r_proto" in
11932         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11933         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11934         esac
11935         case "$crypt_r_proto" in
11936         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11937         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11938         esac
11939         case "$crypt_r_proto" in
11940         ''|0)   d_crypt_r=undef
11941                 crypt_r_proto=0
11942                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11943         * )     case "$crypt_r_proto" in
11944                 REENTRANT_PROTO*) ;;
11945                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11946                 esac
11947                 echo "Prototype: $try" ;;
11948         esac
11949         ;;
11950         *)      case "$usethreads" in
11951                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11952                 esac
11953                 d_crypt_r=undef
11954                 crypt_r_proto=0
11955                 ;;
11956         esac
11957         ;;
11958 *)      crypt_r_proto=0
11959         ;;
11960 esac
11961
11962 : get csh whereabouts
11963 case "$csh" in
11964 'csh') val="$undef" ;;
11965 *) val="$define" ;;
11966 esac
11967 set d_csh
11968 eval $setvar
11969 : Respect a hint or command line value for full_csh.
11970 case "$full_csh" in
11971 '') full_csh=$csh ;;
11972 esac
11973
11974 : see if ctermid exists
11975 set ctermid d_ctermid
11976 eval $inlibc
11977
11978 : see if ctermid_r exists
11979 set ctermid_r d_ctermid_r
11980 eval $inlibc
11981 case "$d_ctermid_r" in
11982 "$define")
11983         hdrs="$i_systypes sys/types.h define stdio.h "
11984         case "$d_ctermid_r_proto:$usethreads" in
11985         ":define")      d_ctermid_r_proto=define
11986                 set d_ctermid_r_proto ctermid_r $hdrs
11987                 eval $hasproto ;;
11988         *)      ;;
11989         esac
11990         case "$d_ctermid_r_proto" in
11991         define)
11992         case "$ctermid_r_proto" in
11993         ''|0) try='char* ctermid_r(char*);'
11994         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11995         esac
11996         case "$ctermid_r_proto" in
11997         ''|0)   d_ctermid_r=undef
11998                 ctermid_r_proto=0
11999                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12000         * )     case "$ctermid_r_proto" in
12001                 REENTRANT_PROTO*) ;;
12002                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12003                 esac
12004                 echo "Prototype: $try" ;;
12005         esac
12006         ;;
12007         *)      case "$usethreads" in
12008                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12009                 esac
12010                 d_ctermid_r=undef
12011                 ctermid_r_proto=0
12012                 ;;
12013         esac
12014         ;;
12015 *)      ctermid_r_proto=0
12016         ;;
12017 esac
12018
12019 : see if ctime_r exists
12020 set ctime_r d_ctime_r
12021 eval $inlibc
12022 case "$d_ctime_r" in
12023 "$define")
12024         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12025         case "$d_ctime_r_proto:$usethreads" in
12026         ":define")      d_ctime_r_proto=define
12027                 set d_ctime_r_proto ctime_r $hdrs
12028                 eval $hasproto ;;
12029         *)      ;;
12030         esac
12031         case "$d_ctime_r_proto" in
12032         define)
12033         case "$ctime_r_proto" in
12034         ''|0) try='char* ctime_r(const time_t*, char*);'
12035         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12036         esac
12037         case "$ctime_r_proto" in
12038         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12039         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12040         esac
12041         case "$ctime_r_proto" in
12042         ''|0) try='int ctime_r(const time_t*, char*);'
12043         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12044         esac
12045         case "$ctime_r_proto" in
12046         ''|0) try='int ctime_r(const time_t*, char*, int);'
12047         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12048         esac
12049         case "$ctime_r_proto" in
12050         ''|0)   d_ctime_r=undef
12051                 ctime_r_proto=0
12052                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12053         * )     case "$ctime_r_proto" in
12054                 REENTRANT_PROTO*) ;;
12055                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12056                 esac
12057                 echo "Prototype: $try" ;;
12058         esac
12059         ;;
12060         *)      case "$usethreads" in
12061                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12062                 esac
12063                 d_ctime_r=undef
12064                 ctime_r_proto=0
12065                 ;;
12066         esac
12067         ;;
12068 *)      ctime_r_proto=0
12069         ;;
12070 esac
12071
12072 : see if cuserid exists
12073 set cuserid d_cuserid
12074 eval $inlibc
12075
12076 : see if this is a limits.h system
12077 set limits.h i_limits
12078 eval $inhdr
12079
12080 : See if number of significant digits in a double precision number is known
12081 echo " "
12082 $cat >dbl_dig.c <<EOM
12083 #$i_limits I_LIMITS
12084 #$i_float I_FLOAT
12085 #ifdef I_LIMITS
12086 #include <limits.h>
12087 #endif
12088 #ifdef I_FLOAT
12089 #include <float.h>
12090 #endif
12091 #ifdef DBL_DIG
12092 printf("Contains DBL_DIG");
12093 #endif
12094 EOM
12095 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12096 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12097         echo "DBL_DIG found." >&4
12098         val="$define"
12099 else
12100         echo "DBL_DIG NOT found." >&4
12101         val="$undef"
12102 fi
12103 $rm -f dbl_dig.?
12104 set d_dbl_dig
12105 eval $setvar
12106
12107 : see if dbm.h is available
12108 : see if dbmclose exists
12109 set dbmclose d_dbmclose
12110 eval $inlibc
12111
12112 case "$d_dbmclose" in
12113 $define)
12114         set dbm.h i_dbm
12115         eval $inhdr
12116         case "$i_dbm" in
12117         $define)
12118                 val="$undef"
12119                 set i_rpcsvcdbm
12120                 eval $setvar
12121                 ;;
12122         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12123                 eval $inhdr
12124                 ;;
12125         esac
12126         ;;
12127 *)      echo "We won't be including <dbm.h>"
12128         val="$undef"
12129         set i_dbm
12130         eval $setvar
12131         val="$undef"
12132         set i_rpcsvcdbm
12133         eval $setvar
12134         ;;
12135 esac
12136
12137 : see if prototype for dbminit is available
12138 echo " "
12139 set d_dbminitproto dbminit $i_dbm dbm.h
12140 eval $hasproto
12141
12142 : see if difftime exists
12143 set difftime d_difftime
12144 eval $inlibc
12145
12146 : see if this is a dirent system
12147 echo " "
12148 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12149         val="$define"
12150         echo "<dirent.h> found." >&4
12151 else
12152         val="$undef"
12153         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12154                 echo "<sys/dir.h> found." >&4
12155                 echo " "
12156         else
12157                 xinc=`./findhdr sys/ndir.h`
12158         fi
12159         echo "<dirent.h> NOT found." >&4
12160 fi
12161 set i_dirent
12162 eval $setvar
12163
12164 : Look for type of directory structure.
12165 echo " "
12166 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12167
12168 case "$direntrytype" in
12169 ''|' ')
12170         case "$i_dirent" in
12171         $define) guess1='struct dirent' ;;
12172         *) guess1='struct direct'  ;;
12173         esac
12174         ;;
12175 *)      guess1="$direntrytype"
12176         ;;
12177 esac
12178
12179 case "$guess1" in
12180 'struct dirent') guess2='struct direct' ;;
12181 *) guess2='struct dirent' ;;
12182 esac
12183
12184 if $contains "$guess1" try.c >/dev/null 2>&1; then
12185         direntrytype="$guess1"
12186         echo "Your directory entries are $direntrytype." >&4
12187 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12188         direntrytype="$guess2"
12189         echo "Your directory entries seem to be $direntrytype." >&4
12190 else
12191         echo "I don't recognize your system's directory entries." >&4
12192         rp="What type is used for directory entries on this system?"
12193         dflt="$guess1"
12194         . ./myread
12195         direntrytype="$ans"
12196 fi
12197 $rm_try
12198
12199 : see if the directory entry stores field length
12200 echo " "
12201 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12202 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12203         echo "Good, your directory entry keeps length information in d_namlen." >&4
12204         val="$define"
12205 else
12206         echo "Your directory entry does not know about the d_namlen field." >&4
12207         val="$undef"
12208 fi
12209 set d_dirnamlen
12210 eval $setvar
12211 $rm_try
12212
12213 : Look for DIR.dd_fd
12214 case "$i_dirent" in
12215 "$define")
12216     echo "Checking to see if DIR has a dd_fd member variable" >&4
12217     $cat >try.c <<EOCP
12218 #$i_stdlib I_STDLIB
12219 #ifdef I_STDLIB
12220 #include <stdlib.h>
12221 #endif
12222 #include <dirent.h>
12223
12224 int main() {
12225     DIR dir;
12226     dir.dd_fd = 1;
12227     return 0;
12228 }
12229 EOCP
12230     val=$undef
12231     set try
12232     if eval $compile; then
12233         echo "Yes, it does."
12234         val="$define"
12235     else
12236         echo "No, it does not."
12237         val="$undef"
12238     fi
12239     ;;
12240 *)
12241     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12242     val="$undef"
12243     ;;
12244 esac
12245 set d_dir_dd_fd
12246 eval $setvar
12247 $rm_try
12248
12249 : see if this is an sysdir system
12250 set sys/dir.h i_sysdir
12251 eval $inhdr
12252
12253 : see if this is an sysndir system
12254 set sys/ndir.h i_sysndir
12255 eval $inhdr
12256
12257 : Look for dirfd
12258 echo " "
12259 $cat >dirfd.c <<EOM
12260 #include <stdio.h>
12261 #$i_stdlib I_STDLIB
12262 #ifdef I_STDLIB
12263 #include <stdlib.h>
12264 #endif
12265 #$i_dirent I_DIRENT             /**/
12266 #$i_sysdir I_SYS_DIR            /**/
12267 #$i_sysndir I_SYS_NDIR          /**/
12268 #$i_systypes I_SYS_TYPES        /**/
12269 #if defined(I_SYS_TYPES)
12270 #include <sys/types.h>
12271 #endif
12272 #if defined(I_DIRENT)
12273 #include <dirent.h>
12274 #else
12275 #ifdef I_SYS_NDIR
12276 #include <sys/ndir.h>
12277 #else
12278 #ifdef I_SYS_DIR
12279 #ifdef hp9000s500
12280 #include <ndir.h>       /* may be wrong in the future */
12281 #else
12282 #include <sys/dir.h>
12283 #endif
12284 #endif
12285 #endif
12286 #endif
12287 int main() {
12288         DIR *dirp = opendir(".");
12289         if (dirfd(dirp) >= 0)
12290                 exit(0);
12291         else
12292                 exit(1);
12293 }
12294 EOM
12295 val=$undef
12296 set dirfd
12297 if eval $compile; then
12298         val="$define"
12299 fi
12300 case "$val" in
12301 $define)        echo "dirfd() found." >&4       ;;
12302 *)              echo "dirfd() NOT found." >&4   ;;
12303 esac
12304 set d_dirfd
12305 eval $setvar
12306 $rm -f dirfd*
12307
12308 : see if dladdr exists
12309 set dladdr d_dladdr
12310 eval $inlibc
12311
12312 : see if dlerror exists
12313 xxx_runnm="$runnm"
12314 runnm=false
12315 set dlerror d_dlerror
12316 eval $inlibc
12317 runnm="$xxx_runnm"
12318
12319 : see if dlfcn is available
12320 set dlfcn.h i_dlfcn
12321 eval $inhdr
12322
12323 : Check what extension to use for shared libs
12324 case "$usedl" in
12325 $define|y|true)
12326         $cat << EOM
12327
12328 On a few systems, the dynamically loaded modules that perl generates and uses
12329 will need a different extension than shared libs. The default will probably
12330 be appropriate.
12331
12332 EOM
12333         case "$dlext" in
12334         '')     dflt="$so" ;;
12335         *)      dflt="$dlext" ;;
12336         esac
12337         rp='What is the extension of dynamically loaded modules'
12338         . ./myread
12339         dlext="$ans"
12340         ;;
12341 *)
12342         dlext="none"
12343         ;;
12344 esac
12345
12346 : Check if dlsym need a leading underscore
12347 echo " "
12348 val="$undef"
12349
12350 case "$dlsrc" in
12351 dl_dlopen.xs)
12352         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12353         $cat >dyna.c <<'EOM'
12354 fred () { }
12355 EOM
12356
12357 $cat >fred.c<<EOM
12358
12359 #include <stdio.h>
12360 #$i_stdlib I_STDLIB
12361 #ifdef I_STDLIB
12362 #include <stdlib.h>
12363 #endif
12364 #$i_dlfcn I_DLFCN
12365 #ifdef I_DLFCN
12366 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12367 #else
12368 #include <sys/types.h>
12369 #include <nlist.h>
12370 #include <link.h>
12371 #endif
12372
12373 extern int fred() ;
12374
12375 int main()
12376 {
12377     void * handle ;
12378     void * symbol ;
12379 #ifndef RTLD_LAZY
12380     int mode = 1 ;
12381 #else
12382     int mode = RTLD_LAZY ;
12383 #endif
12384     handle = dlopen("./dyna.$dlext", mode) ;
12385     if (handle == NULL) {
12386         printf ("1\n") ;
12387         fflush (stdout) ;
12388         exit(0);
12389     }
12390     symbol = dlsym(handle, "fred") ;
12391     if (symbol == NULL) {
12392         /* try putting a leading underscore */
12393         symbol = dlsym(handle, "_fred") ;
12394         if (symbol == NULL) {
12395             printf ("2\n") ;
12396             fflush (stdout) ;
12397             exit(0);
12398         }
12399         printf ("3\n") ;
12400     }
12401     else
12402         printf ("4\n") ;
12403     fflush (stdout) ;
12404     exit(0);
12405 }
12406 EOM
12407         : Call the object file tmp-dyna.o in case dlext=o.
12408         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12409                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12410                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12411                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12412                 xxx=`$run ./fred`
12413                 case $xxx in
12414                 1)      echo "Test program failed using dlopen." >&4
12415                         echo "Perhaps you should not use dynamic loading." >&4;;
12416                 2)      echo "Test program failed using dlsym." >&4
12417                         echo "Perhaps you should not use dynamic loading." >&4;;
12418                 3)      echo "dlsym needs a leading underscore" >&4
12419                         val="$define" ;;
12420                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12421                 esac
12422         else
12423                 echo "I can't compile and run the test program." >&4
12424                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12425         fi
12426         ;;
12427 esac
12428
12429 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12430
12431 set d_dlsymun
12432 eval $setvar
12433
12434 : see if drand48_r exists
12435 set drand48_r d_drand48_r
12436 eval $inlibc
12437 case "$d_drand48_r" in
12438 "$define")
12439         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12440         case "$d_drand48_r_proto:$usethreads" in
12441         ":define")      d_drand48_r_proto=define
12442                 set d_drand48_r_proto drand48_r $hdrs
12443                 eval $hasproto ;;
12444         *)      ;;
12445         esac
12446         case "$d_drand48_r_proto" in
12447         define)
12448         case "$drand48_r_proto" in
12449         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12450         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12451         esac
12452         case "$drand48_r_proto" in
12453         ''|0)   d_drand48_r=undef
12454                 drand48_r_proto=0
12455                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12456         * )     case "$drand48_r_proto" in
12457                 REENTRANT_PROTO*) ;;
12458                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12459                 esac
12460                 echo "Prototype: $try" ;;
12461         esac
12462         ;;
12463         *)      case "$usethreads" in
12464                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12465                 esac
12466                 d_drand48_r=undef
12467                 drand48_r_proto=0
12468                 ;;
12469         esac
12470         ;;
12471 *)      drand48_r_proto=0
12472         ;;
12473 esac
12474
12475 : see if prototype for drand48 is available
12476 echo " "
12477 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12478 eval $hasproto
12479
12480 : see if dup2 exists
12481 set dup2 d_dup2
12482 eval $inlibc
12483
12484 : see if eaccess exists
12485 set eaccess d_eaccess
12486 eval $inlibc
12487
12488 : see if endgrent exists
12489 set endgrent d_endgrent
12490 eval $inlibc
12491
12492 : see if this is an grp system
12493 set grp.h i_grp
12494 eval $inhdr
12495
12496 case "$i_grp" in
12497 $define)
12498         xxx=`./findhdr grp.h`
12499         $cppstdin $cppflags $cppminus < $xxx >$$.h
12500
12501         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12502                 val="$define"
12503         else
12504                 val="$undef"
12505         fi
12506         set d_grpasswd
12507         eval $setvar
12508
12509         $rm -f $$.h
12510         ;;
12511 *)
12512         val="$undef";
12513         set d_grpasswd; eval $setvar
12514         ;;
12515 esac
12516
12517 : see if endgrent_r exists
12518 set endgrent_r d_endgrent_r
12519 eval $inlibc
12520 case "$d_endgrent_r" in
12521 "$define")
12522         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12523         case "$d_endgrent_r_proto:$usethreads" in
12524         ":define")      d_endgrent_r_proto=define
12525                 set d_endgrent_r_proto endgrent_r $hdrs
12526                 eval $hasproto ;;
12527         *)      ;;
12528         esac
12529         case "$d_endgrent_r_proto" in
12530         define)
12531         case "$endgrent_r_proto" in
12532         ''|0) try='int endgrent_r(FILE**);'
12533         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12534         esac
12535         case "$endgrent_r_proto" in
12536         ''|0) try='void endgrent_r(FILE**);'
12537         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12538         esac
12539         case "$endgrent_r_proto" in
12540         ''|0)   d_endgrent_r=undef
12541                 endgrent_r_proto=0
12542                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12543         * )     case "$endgrent_r_proto" in
12544                 REENTRANT_PROTO*) ;;
12545                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12546                 esac
12547                 echo "Prototype: $try" ;;
12548         esac
12549         ;;
12550         *)      case "$usethreads" in
12551                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12552                 esac
12553                 d_endgrent_r=undef
12554                 endgrent_r_proto=0
12555                 ;;
12556         esac
12557         ;;
12558 *)      endgrent_r_proto=0
12559         ;;
12560 esac
12561
12562 : see if endhostent exists
12563 set endhostent d_endhent
12564 eval $inlibc
12565
12566 : see if this is a netdb.h system
12567 set netdb.h i_netdb
12568 eval $inhdr
12569
12570 : see if endhostent_r exists
12571 set endhostent_r d_endhostent_r
12572 eval $inlibc
12573 case "$d_endhostent_r" in
12574 "$define")
12575         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12576         case "$d_endhostent_r_proto:$usethreads" in
12577         ":define")      d_endhostent_r_proto=define
12578                 set d_endhostent_r_proto endhostent_r $hdrs
12579                 eval $hasproto ;;
12580         *)      ;;
12581         esac
12582         case "$d_endhostent_r_proto" in
12583         define)
12584         case "$endhostent_r_proto" in
12585         ''|0) try='int endhostent_r(struct hostent_data*);'
12586         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12587         esac
12588         case "$endhostent_r_proto" in
12589         ''|0) try='void endhostent_r(struct hostent_data*);'
12590         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12591         esac
12592         case "$endhostent_r_proto" in
12593         ''|0)   d_endhostent_r=undef
12594                 endhostent_r_proto=0
12595                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12596         * )     case "$endhostent_r_proto" in
12597                 REENTRANT_PROTO*) ;;
12598                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12599                 esac
12600                 echo "Prototype: $try" ;;
12601         esac
12602         ;;
12603         *)      case "$usethreads" in
12604                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12605                 esac
12606                 d_endhostent_r=undef
12607                 endhostent_r_proto=0
12608                 ;;
12609         esac
12610         ;;
12611 *)      endhostent_r_proto=0
12612         ;;
12613 esac
12614
12615 : see if endnetent exists
12616 set endnetent d_endnent
12617 eval $inlibc
12618
12619 : see if endnetent_r exists
12620 set endnetent_r d_endnetent_r
12621 eval $inlibc
12622 case "$d_endnetent_r" in
12623 "$define")
12624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12625         case "$d_endnetent_r_proto:$usethreads" in
12626         ":define")      d_endnetent_r_proto=define
12627                 set d_endnetent_r_proto endnetent_r $hdrs
12628                 eval $hasproto ;;
12629         *)      ;;
12630         esac
12631         case "$d_endnetent_r_proto" in
12632         define)
12633         case "$endnetent_r_proto" in
12634         ''|0) try='int endnetent_r(struct netent_data*);'
12635         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12636         esac
12637         case "$endnetent_r_proto" in
12638         ''|0) try='void endnetent_r(struct netent_data*);'
12639         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12640         esac
12641         case "$endnetent_r_proto" in
12642         ''|0)   d_endnetent_r=undef
12643                 endnetent_r_proto=0
12644                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12645         * )     case "$endnetent_r_proto" in
12646                 REENTRANT_PROTO*) ;;
12647                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12648                 esac
12649                 echo "Prototype: $try" ;;
12650         esac
12651         ;;
12652         *)      case "$usethreads" in
12653                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12654                 esac
12655                 d_endnetent_r=undef
12656                 endnetent_r_proto=0
12657                 ;;
12658         esac
12659         ;;
12660 *)      endnetent_r_proto=0
12661         ;;
12662 esac
12663
12664 : see if endprotoent exists
12665 set endprotoent d_endpent
12666 eval $inlibc
12667
12668 : see if endprotoent_r exists
12669 set endprotoent_r d_endprotoent_r
12670 eval $inlibc
12671 case "$d_endprotoent_r" in
12672 "$define")
12673         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12674         case "$d_endprotoent_r_proto:$usethreads" in
12675         ":define")      d_endprotoent_r_proto=define
12676                 set d_endprotoent_r_proto endprotoent_r $hdrs
12677                 eval $hasproto ;;
12678         *)      ;;
12679         esac
12680         case "$d_endprotoent_r_proto" in
12681         define)
12682         case "$endprotoent_r_proto" in
12683         ''|0) try='int endprotoent_r(struct protoent_data*);'
12684         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12685         esac
12686         case "$endprotoent_r_proto" in
12687         ''|0) try='void endprotoent_r(struct protoent_data*);'
12688         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12689         esac
12690         case "$endprotoent_r_proto" in
12691         ''|0)   d_endprotoent_r=undef
12692                 endprotoent_r_proto=0
12693                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12694         * )     case "$endprotoent_r_proto" in
12695                 REENTRANT_PROTO*) ;;
12696                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12697                 esac
12698                 echo "Prototype: $try" ;;
12699         esac
12700         ;;
12701         *)      case "$usethreads" in
12702                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12703                 esac
12704                 d_endprotoent_r=undef
12705                 endprotoent_r_proto=0
12706                 ;;
12707         esac
12708         ;;
12709 *)      endprotoent_r_proto=0
12710         ;;
12711 esac
12712
12713 : see if endpwent exists
12714 set endpwent d_endpwent
12715 eval $inlibc
12716
12717 : see if this is a pwd.h system
12718 set pwd.h i_pwd
12719 eval $inhdr
12720
12721 case "$i_pwd" in
12722 $define)
12723         xxx=`./findhdr pwd.h`
12724         $cppstdin $cppflags $cppminus < $xxx >$$.h
12725
12726         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12727                 val="$define"
12728         else
12729                 val="$undef"
12730         fi
12731         set d_pwquota
12732         eval $setvar
12733
12734         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12735                 val="$define"
12736         else
12737                 val="$undef"
12738         fi
12739         set d_pwage
12740         eval $setvar
12741
12742         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12743                 val="$define"
12744         else
12745                 val="$undef"
12746         fi
12747         set d_pwchange
12748         eval $setvar
12749
12750         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12751                 val="$define"
12752         else
12753                 val="$undef"
12754         fi
12755         set d_pwclass
12756         eval $setvar
12757
12758         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12759                 val="$define"
12760         else
12761                 val="$undef"
12762         fi
12763         set d_pwexpire
12764         eval $setvar
12765
12766         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12767                 val="$define"
12768         else
12769                 val="$undef"
12770         fi
12771         set d_pwcomment
12772         eval $setvar
12773
12774         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12775                 val="$define"
12776         else
12777                 val="$undef"
12778         fi
12779         set d_pwgecos
12780         eval $setvar
12781
12782         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12783                 val="$define"
12784         else
12785                 val="$undef"
12786         fi
12787         set d_pwpasswd
12788         eval $setvar
12789
12790         $rm -f $$.h
12791         ;;
12792 *)
12793         val="$undef";
12794         set d_pwquota; eval $setvar
12795         set d_pwage; eval $setvar
12796         set d_pwchange; eval $setvar
12797         set d_pwclass; eval $setvar
12798         set d_pwexpire; eval $setvar
12799         set d_pwcomment; eval $setvar
12800         set d_pwgecos; eval $setvar
12801         set d_pwpasswd; eval $setvar
12802         ;;
12803 esac
12804
12805 : see if endpwent_r exists
12806 set endpwent_r d_endpwent_r
12807 eval $inlibc
12808 case "$d_endpwent_r" in
12809 "$define")
12810         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12811         case "$d_endpwent_r_proto:$usethreads" in
12812         ":define")      d_endpwent_r_proto=define
12813                 set d_endpwent_r_proto endpwent_r $hdrs
12814                 eval $hasproto ;;
12815         *)      ;;
12816         esac
12817         case "$d_endpwent_r_proto" in
12818         define)
12819         case "$endpwent_r_proto" in
12820         ''|0) try='int endpwent_r(FILE**);'
12821         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12822         esac
12823         case "$endpwent_r_proto" in
12824         ''|0) try='void endpwent_r(FILE**);'
12825         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12826         esac
12827         case "$endpwent_r_proto" in
12828         ''|0)   d_endpwent_r=undef
12829                 endpwent_r_proto=0
12830                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12831         * )     case "$endpwent_r_proto" in
12832                 REENTRANT_PROTO*) ;;
12833                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12834                 esac
12835                 echo "Prototype: $try" ;;
12836         esac
12837         ;;
12838         *)      case "$usethreads" in
12839                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12840                 esac
12841                 d_endpwent_r=undef
12842                 endpwent_r_proto=0
12843                 ;;
12844         esac
12845         ;;
12846 *)      endpwent_r_proto=0
12847         ;;
12848 esac
12849
12850 : see if endservent exists
12851 set endservent d_endsent
12852 eval $inlibc
12853
12854 : see if endservent_r exists
12855 set endservent_r d_endservent_r
12856 eval $inlibc
12857 case "$d_endservent_r" in
12858 "$define")
12859         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12860         case "$d_endservent_r_proto:$usethreads" in
12861         ":define")      d_endservent_r_proto=define
12862                 set d_endservent_r_proto endservent_r $hdrs
12863                 eval $hasproto ;;
12864         *)      ;;
12865         esac
12866         case "$d_endservent_r_proto" in
12867         define)
12868         case "$endservent_r_proto" in
12869         ''|0) try='int endservent_r(struct servent_data*);'
12870         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12871         esac
12872         case "$endservent_r_proto" in
12873         ''|0) try='void endservent_r(struct servent_data*);'
12874         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12875         esac
12876         case "$endservent_r_proto" in
12877         ''|0)   d_endservent_r=undef
12878                 endservent_r_proto=0
12879                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12880         * )     case "$endservent_r_proto" in
12881                 REENTRANT_PROTO*) ;;
12882                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12883                 esac
12884                 echo "Prototype: $try" ;;
12885         esac
12886         ;;
12887         *)      case "$usethreads" in
12888                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12889                 esac
12890                 d_endservent_r=undef
12891                 endservent_r_proto=0
12892                 ;;
12893         esac
12894         ;;
12895 *)      endservent_r_proto=0
12896         ;;
12897 esac
12898
12899 : Locate the flags for 'open()'
12900 echo " "
12901 $cat >try.c <<EOCP
12902 #include <sys/types.h>
12903 #ifdef I_FCNTL
12904 #include <fcntl.h>
12905 #endif
12906 #ifdef I_SYS_FILE
12907 #include <sys/file.h>
12908 #endif
12909 #$i_stdlib I_STDLIB
12910 #ifdef I_STDLIB
12911 #include <stdlib.h>
12912 #endif
12913 int main() {
12914         if(O_RDONLY);
12915 #ifdef O_TRUNC
12916         exit(0);
12917 #else
12918         exit(1);
12919 #endif
12920 }
12921 EOCP
12922 : check sys/file.h first to get FREAD on Sun
12923 if $test `./findhdr sys/file.h` && \
12924                 set try -DI_SYS_FILE && eval $compile; then
12925         h_sysfile=true;
12926         echo "<sys/file.h> defines the O_* constants..." >&4
12927         if $run ./try; then
12928                 echo "and you have the 3 argument form of open()." >&4
12929                 val="$define"
12930         else
12931                 echo "but not the 3 argument form of open().  Oh, well." >&4
12932                 val="$undef"
12933         fi
12934 elif $test `./findhdr fcntl.h` && \
12935                 set try -DI_FCNTL && eval $compile; then
12936         h_fcntl=true;
12937         echo "<fcntl.h> defines the O_* constants..." >&4
12938         if $run ./try; then
12939                 echo "and you have the 3 argument form of open()." >&4
12940                 val="$define"
12941         else
12942                 echo "but not the 3 argument form of open().  Oh, well." >&4
12943                 val="$undef"
12944         fi
12945 else
12946         val="$undef"
12947         echo "I can't find the O_* constant definitions!  You got problems." >&4
12948 fi
12949 set d_open3
12950 eval $setvar
12951 $rm_try
12952
12953 : see if this is a sys/file.h system
12954 val=''
12955 set sys/file.h val
12956 eval $inhdr
12957
12958 : do we need to include sys/file.h ?
12959 case "$val" in
12960 "$define")
12961         echo " "
12962         if $h_sysfile; then
12963                 val="$define"
12964                 echo "We'll be including <sys/file.h>." >&4
12965         else
12966                 val="$undef"
12967                 echo "We won't be including <sys/file.h>." >&4
12968         fi
12969         ;;
12970 *)
12971         h_sysfile=false
12972         ;;
12973 esac
12974 set i_sysfile
12975 eval $setvar
12976
12977 : see if fcntl.h is there
12978 val=''
12979 set fcntl.h val
12980 eval $inhdr
12981
12982 : see if we can include fcntl.h
12983 case "$val" in
12984 "$define")
12985         echo " "
12986         if $h_fcntl; then
12987                 val="$define"
12988                 echo "We'll be including <fcntl.h>." >&4
12989         else
12990                 val="$undef"
12991                 if $h_sysfile; then
12992         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12993                 else
12994                         echo "We won't be including <fcntl.h>." >&4
12995                 fi
12996         fi
12997         ;;
12998 *)
12999         h_fcntl=false
13000         val="$undef"
13001         ;;
13002 esac
13003 set i_fcntl
13004 eval $setvar
13005
13006 : see if fork exists
13007 set fork d_fork
13008 eval $inlibc
13009
13010 : see if pipe exists
13011 set pipe d_pipe
13012 eval $inlibc
13013
13014 : check for non-blocking I/O stuff
13015 case "$h_sysfile" in
13016 true) echo "#include <sys/file.h>" > head.c;;
13017 *)
13018        case "$h_fcntl" in
13019        true) echo "#include <fcntl.h>" > head.c;;
13020        *) echo "#include <sys/fcntl.h>" > head.c;;
13021        esac
13022        ;;
13023 esac
13024 echo " "
13025 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13026 case "$o_nonblock" in
13027 '')
13028         $cat head.c > try.c
13029         $cat >>try.c <<EOCP
13030 #include <stdio.h>
13031 #$i_stdlib I_STDLIB
13032 #ifdef I_STDLIB
13033 #include <stdlib.h>
13034 #endif
13035 #$i_fcntl I_FCNTL
13036 #ifdef I_FCNTL
13037 #include <fcntl.h>
13038 #endif
13039 int main() {
13040 #ifdef O_NONBLOCK
13041         printf("O_NONBLOCK\n");
13042         exit(0);
13043 #endif
13044 #ifdef O_NDELAY
13045         printf("O_NDELAY\n");
13046         exit(0);
13047 #endif
13048 #ifdef FNDELAY
13049         printf("FNDELAY\n");
13050         exit(0);
13051 #endif
13052         exit(0);
13053 }
13054 EOCP
13055         set try
13056         if eval $compile_ok; then
13057                 o_nonblock=`$run ./try`
13058                 case "$o_nonblock" in
13059                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13060                 *) echo "Seems like we can use $o_nonblock.";;
13061                 esac
13062         else
13063                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13064         fi
13065         ;;
13066 *) echo "Using $hint value $o_nonblock.";;
13067 esac
13068 $rm_try
13069
13070 echo " "
13071 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13072 case "$eagain" in
13073 '')
13074         case "$d_fork:$d_pipe" in
13075         define:define)
13076         $cat head.c > try.c
13077         $cat >>try.c <<EOCP
13078 #include <errno.h>
13079 #include <sys/types.h>
13080 #include <signal.h>
13081 #include <stdio.h>
13082 #$i_stdlib I_STDLIB
13083 #ifdef I_STDLIB
13084 #include <stdlib.h>
13085 #endif
13086 #$i_fcntl I_FCNTL
13087 #ifdef I_FCNTL
13088 #include <fcntl.h>
13089 #endif
13090 #define MY_O_NONBLOCK $o_nonblock
13091 #ifndef errno  /* XXX need better Configure test */
13092 extern int errno;
13093 #endif
13094 #$i_unistd I_UNISTD
13095 #ifdef I_UNISTD
13096 #include <unistd.h>
13097 #endif
13098 #$i_string I_STRING
13099 #ifdef I_STRING
13100 #include <string.h>
13101 #else
13102 #include <strings.h>
13103 #endif
13104 $signal_t blech(int x) { exit(3); }
13105 EOCP
13106         $cat >> try.c <<'EOCP'
13107 int main()
13108 {
13109         int pd[2];
13110         int pu[2];
13111         char buf[1];
13112         char string[100];
13113         int ret;
13114
13115         ret = pipe(pd); /* Down: child -> parent */
13116         if (ret != 0)
13117                 exit(3);
13118         ret = pipe(pu); /* Up: parent -> child */
13119         if (ret != 0)
13120                 exit(3);
13121         if (0 != fork()) {
13122                 close(pd[1]);   /* Parent reads from pd[0] */
13123                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13124 #ifdef F_SETFL
13125                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13126                         exit(1);
13127 #else
13128                 exit(4);
13129 #endif
13130                 signal(SIGALRM, blech);
13131                 alarm(5);
13132                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13133                         exit(2);
13134                 sprintf(string, "%d\n", ret);
13135                 ret = write(2, string, strlen(string));
13136                 if (ret != strlen(string))
13137                         exit(3);
13138                 alarm(0);
13139 #ifdef EAGAIN
13140                 if (errno == EAGAIN) {
13141                         printf("EAGAIN\n");
13142                         goto ok;
13143                 }
13144 #endif
13145 #ifdef EWOULDBLOCK
13146                 if (errno == EWOULDBLOCK)
13147                         printf("EWOULDBLOCK\n");
13148 #endif
13149         ok:
13150                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13151                 if (ret != 1)
13152                         exit(3);
13153                 sleep(2);                               /* Give it time to close our pipe */
13154                 alarm(5);
13155                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13156                 alarm(0);
13157                 sprintf(string, "%d\n", ret);
13158                 ret = write(4, string, strlen(string));
13159                 if (ret != strlen(string))
13160                         exit(3);
13161                 exit(0);
13162         }
13163
13164         close(pd[0]);                   /* We write to pd[1] */
13165         close(pu[1]);                   /* We read from pu[0] */
13166         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13167         if (ret != 1)
13168                 exit(3);
13169         close(pd[1]);                   /* Pipe pd is now fully closed! */
13170         exit(0);                                /* Bye bye, thank you for playing! */
13171 }
13172 EOCP
13173         set try
13174         if eval $compile_ok; then
13175                 echo "$startsh" >mtry
13176                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13177                 chmod +x mtry
13178                 $run ./mtry >/dev/null 2>&1
13179                 case $? in
13180                 0) eagain=`$cat try.out`;;
13181                 1) echo "Could not perform non-blocking setting!";;
13182                 2) echo "I did a successful read() for something that was not there!";;
13183                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13184                 4) echo "Could not find F_SETFL!";;
13185                 *) echo "Something terribly wrong happened during testing.";;
13186                 esac
13187                 rd_nodata=`$cat try.ret`
13188                 echo "A read() system call with no data present returns $rd_nodata."
13189                 case "$rd_nodata" in
13190                 0|-1) ;;
13191                 *)
13192                         echo "(That's peculiar, fixing that to be -1.)"
13193                         rd_nodata=-1
13194                         ;;
13195                 esac
13196                 case "$eagain" in
13197                 '')
13198                         echo "Forcing errno EAGAIN on read() with no data available."
13199                         eagain=EAGAIN
13200                         ;;
13201                 *)
13202                         echo "Your read() sets errno to $eagain when no data is available."
13203                         ;;
13204                 esac
13205                 status=`$cat try.err`
13206                 case "$status" in
13207                 0) echo "And it correctly returns 0 to signal EOF.";;
13208                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13209                 *) echo "However, your read() returns '$status' on EOF??";;
13210                 esac
13211                 val="$define"
13212                 if test "$status" = "$rd_nodata"; then
13213                         echo "WARNING: you can't distinguish between EOF and no data!"
13214                         val="$undef"
13215                 fi
13216         else
13217                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13218                 eagain=EAGAIN
13219         fi
13220         ;;
13221         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13222                 eagain=EAGAIN
13223                 val="$define"
13224                 ;;
13225         esac
13226         set d_eofnblk
13227         eval $setvar
13228         ;;
13229 *)
13230         echo "Using $hint value $eagain."
13231         echo "Your read() returns $rd_nodata when no data is present."
13232         case "$d_eofnblk" in
13233         "$define") echo "And you can see EOF because read() returns 0.";;
13234         "$undef") echo "But you can't see EOF status from read() returned value.";;
13235         *)
13236                 echo "(Assuming you can't see EOF status from read anyway.)"
13237                 d_eofnblk=$undef
13238                 ;;
13239         esac
13240         ;;
13241 esac
13242 $rm_try head.c mtry
13243
13244 : see if _ptr and _cnt from stdio act std
13245 echo " "
13246
13247 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13248         echo "(Looks like you have stdio.h from BSD.)"
13249         case "$stdio_ptr" in
13250         '') stdio_ptr='((fp)->_p)'
13251                 ptr_lval=$define
13252                 ;;
13253         *)      ptr_lval=$d_stdio_ptr_lval;;
13254         esac
13255         case "$stdio_cnt" in
13256         '') stdio_cnt='((fp)->_r)'
13257                 cnt_lval=$define
13258                 ;;
13259         *)      cnt_lval=$d_stdio_cnt_lval;;
13260         esac
13261         case "$stdio_base" in
13262         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13263         esac
13264         case "$stdio_bufsiz" in
13265         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13266         esac
13267 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13268         echo "(Looks like you have stdio.h from Linux.)"
13269         case "$stdio_ptr" in
13270         '') stdio_ptr='((fp)->_IO_read_ptr)'
13271                 ptr_lval=$define
13272                 ;;
13273         *)      ptr_lval=$d_stdio_ptr_lval;;
13274         esac
13275         case "$stdio_cnt" in
13276         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13277                 cnt_lval=$undef
13278                 ;;
13279         *)      cnt_lval=$d_stdio_cnt_lval;;
13280         esac
13281         case "$stdio_base" in
13282         '') stdio_base='((fp)->_IO_read_base)';;
13283         esac
13284         case "$stdio_bufsiz" in
13285         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13286         esac
13287 else
13288         case "$stdio_ptr" in
13289         '') stdio_ptr='((fp)->_ptr)'
13290                 ptr_lval=$define
13291                 ;;
13292         *)      ptr_lval=$d_stdio_ptr_lval;;
13293         esac
13294         case "$stdio_cnt" in
13295         '') stdio_cnt='((fp)->_cnt)'
13296                 cnt_lval=$define
13297                 ;;
13298         *)      cnt_lval=$d_stdio_cnt_lval;;
13299         esac
13300         case "$stdio_base" in
13301         '') stdio_base='((fp)->_base)';;
13302         esac
13303         case "$stdio_bufsiz" in
13304         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13305         esac
13306 fi
13307
13308 : test whether _ptr and _cnt really work
13309 echo "Checking how std your stdio is..." >&4
13310 $cat >try.c <<EOP
13311 #include <stdio.h>
13312 #$i_stdlib I_STDLIB
13313 #ifdef I_STDLIB
13314 #include <stdlib.h>
13315 #endif
13316 #define FILE_ptr(fp)    $stdio_ptr
13317 #define FILE_cnt(fp)    $stdio_cnt
13318 int main() {
13319         FILE *fp = fopen("try.c", "r");
13320         char c = getc(fp);
13321         if (
13322                 18 <= FILE_cnt(fp) &&
13323                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13324         )
13325                 exit(0);
13326         exit(1);
13327 }
13328 EOP
13329 val="$undef"
13330 set try
13331 if eval $compile && $to try.c; then
13332         if $run ./try; then
13333                 echo "Your stdio acts pretty std."
13334                 val="$define"
13335         else
13336                 echo "Your stdio isn't very std."
13337         fi
13338 else
13339         echo "Your stdio doesn't appear very std."
13340 fi
13341 $rm_try
13342
13343 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13344 # direct buffer manipulation no longer works.  The Configure tests
13345 # should be changed to correctly detect this, but until then,
13346 # the following check should at least let perl compile and run.
13347 # (This quick fix should be updated before 5.8.1.)
13348 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13349 # A. Dougherty, June 3, 2002.
13350 case "$d_gnulibc" in
13351 $define)
13352         case "$gnulibc_version" in
13353         2.[01]*)  ;;
13354         2.2) ;;
13355         2.2.[0-9]) ;;
13356         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13357                 val="$undef"
13358                 ;;
13359         esac
13360         ;;
13361 esac
13362 set d_stdstdio
13363 eval $setvar
13364
13365 : Can _ptr be used as an lvalue?
13366 case "$d_stdstdio$ptr_lval" in
13367 $define$define) val=$define ;;
13368 *) val=$undef ;;
13369 esac
13370 set d_stdio_ptr_lval
13371 eval $setvar
13372
13373 : Can _cnt be used as an lvalue?
13374 case "$d_stdstdio$cnt_lval" in
13375 $define$define) val=$define ;;
13376 *) val=$undef ;;
13377 esac
13378 set d_stdio_cnt_lval
13379 eval $setvar
13380
13381
13382 : test whether setting _ptr sets _cnt as a side effect
13383 d_stdio_ptr_lval_sets_cnt="$undef"
13384 d_stdio_ptr_lval_nochange_cnt="$undef"
13385 case "$d_stdio_ptr_lval$d_stdstdio" in
13386 $define$define)
13387         echo "Checking to see what happens if we set the stdio ptr..." >&4
13388 $cat >try.c <<EOP
13389 #include <stdio.h>
13390 /* Can we scream? */
13391 /* Eat dust sed :-) */
13392 /* In the buffer space, no one can hear you scream. */
13393 #$i_stdlib I_STDLIB
13394 #ifdef I_STDLIB
13395 #include <stdlib.h>
13396 #endif
13397 #define FILE_ptr(fp)    $stdio_ptr
13398 #define FILE_cnt(fp)    $stdio_cnt
13399 #include <sys/types.h>
13400 int main() {
13401         FILE *fp = fopen("try.c", "r");
13402         int c;
13403         char *ptr;
13404         size_t cnt;
13405         if (!fp) {
13406             puts("Fail even to read");
13407             exit(1);
13408         }
13409         c = getc(fp); /* Read away the first # */
13410         if (c == EOF) {
13411             puts("Fail even to read");
13412             exit(1);
13413         }
13414         if (!(
13415                 18 <= FILE_cnt(fp) &&
13416                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13417         )) {
13418                 puts("Fail even to read");
13419                 exit (1);
13420         }
13421         ptr = (char*) FILE_ptr(fp);
13422         cnt = (size_t)FILE_cnt(fp);
13423
13424         FILE_ptr(fp) += 42;
13425
13426         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13427                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13428                 exit (1);
13429         }
13430         if (FILE_cnt(fp) <= 20) {
13431                 printf ("Fail (<20 chars to test)");
13432                 exit (1);
13433         }
13434         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13435                 puts("Fail compare");
13436                 exit (1);
13437         }
13438         if (cnt == FILE_cnt(fp)) {
13439                 puts("Pass_unchanged");
13440                 exit (0);
13441         }
13442         if (FILE_cnt(fp) == (cnt - 42)) {
13443                 puts("Pass_changed");
13444                 exit (0);
13445         }
13446         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13447         return 1;
13448
13449 }
13450 EOP
13451         set try
13452         if eval $compile && $to try.c; then
13453                 case `$run ./try` in
13454                 Pass_changed)
13455                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13456                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13457                 Pass_unchanged)
13458                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13459                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13460                 Fail*)
13461                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13462                 *)
13463                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13464         esac
13465         else
13466                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13467         fi
13468         $rm_try
13469         ;;
13470 esac
13471
13472 : see if _base is also standard
13473 val="$undef"
13474 case "$d_stdstdio" in
13475 $define)
13476         $cat >try.c <<EOP
13477 #include <stdio.h>
13478 #$i_stdlib I_STDLIB
13479 #ifdef I_STDLIB
13480 #include <stdlib.h>
13481 #endif
13482 #define FILE_base(fp)   $stdio_base
13483 #define FILE_bufsiz(fp) $stdio_bufsiz
13484 int main() {
13485         FILE *fp = fopen("try.c", "r");
13486         char c = getc(fp);
13487         if (
13488                 19 <= FILE_bufsiz(fp) &&
13489                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13490         )
13491                 exit(0);
13492         exit(1);
13493 }
13494 EOP
13495         set try
13496         if eval $compile && $to try.c; then
13497                 if $run ./try; then
13498                         echo "And its _base field acts std."
13499                         val="$define"
13500                 else
13501                         echo "But its _base field isn't std."
13502                 fi
13503         else
13504                 echo "However, it seems to be lacking the _base field."
13505         fi
13506         $rm_try
13507         ;;
13508 esac
13509 set d_stdiobase
13510 eval $setvar
13511
13512 : see if fast_stdio exists
13513 val="$undef"
13514 case "$d_stdstdio:$d_stdio_ptr_lval" in
13515 "$define:$define")
13516         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13517         *$define*)
13518                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13519                 val="$define"
13520                 ;;
13521         esac
13522         ;;
13523 esac
13524 set d_faststdio
13525 eval $setvar
13526
13527
13528
13529 : see if fchdir exists
13530 set fchdir d_fchdir
13531 eval $inlibc
13532
13533 : see if fchmod exists
13534 set fchmod d_fchmod
13535 eval $inlibc
13536
13537 : see if fchown exists
13538 set fchown d_fchown
13539 eval $inlibc
13540
13541 : see if this is an fcntl system
13542 set fcntl d_fcntl
13543 eval $inlibc
13544
13545 : See if fcntl-based locking works.
13546 echo " "
13547 $cat >try.c <<EOCP
13548 #$i_stdlib I_STDLIB
13549 #ifdef I_STDLIB
13550 #include <stdlib.h>
13551 #endif
13552 #include <unistd.h>
13553 #include <fcntl.h>
13554 #include <signal.h>
13555 $signal_t blech(int x) { exit(3); }
13556 int main() {
13557 #if defined(F_SETLK) && defined(F_SETLKW)
13558      struct flock flock;
13559      int retval, fd;
13560      fd = open("try.c", O_RDONLY);
13561      flock.l_type = F_RDLCK;
13562      flock.l_whence = SEEK_SET;
13563      flock.l_start = flock.l_len = 0;
13564      signal(SIGALRM, blech);
13565      alarm(10);
13566      retval = fcntl(fd, F_SETLK, &flock);
13567      close(fd);
13568      (retval < 0 ? exit(2) : exit(0));
13569 #else
13570      exit(2);
13571 #endif
13572 }
13573 EOCP
13574 echo "Checking if fcntl-based file locking works... "
13575 case "$d_fcntl" in
13576 "$define")
13577         set try
13578         if eval $compile_ok; then
13579                 if $run ./try; then
13580                         echo "Yes, it seems to work."
13581                         val="$define"
13582                 else
13583                         echo "Nope, it didn't work."
13584                         val="$undef"
13585                         case "$?" in
13586                         3) $cat >&4 <<EOM
13587 ***
13588 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13589 *** This is (almost) impossible.
13590 *** If your NFS lock daemons are not feeling well, something like
13591 *** this may happen, please investigate.  Cannot continue, aborting.
13592 ***
13593 EOM
13594                                 exit 1
13595                                 ;;
13596                         esac
13597                 fi
13598         else
13599                 echo "I'm unable to compile the test program, so I'll assume not."
13600                 val="$undef"
13601         fi
13602         ;;
13603 *) val="$undef";
13604         echo "Nope, since you don't even have fcntl()."
13605         ;;
13606 esac
13607 set d_fcntl_can_lock
13608 eval $setvar
13609 $rm_try
13610
13611 : check for fd_set items
13612 $cat <<EOM
13613
13614 Checking to see how well your C compiler handles fd_set and friends ...
13615 EOM
13616 $cat >try.c <<EOCP
13617 #$i_stdlib I_STDLIB
13618 #ifdef I_STDLIB
13619 #include <stdlib.h>
13620 #endif
13621 #$i_systime I_SYS_TIME
13622 #$i_sysselct I_SYS_SELECT
13623 #$d_socket HAS_SOCKET
13624 #include <sys/types.h>
13625 #ifdef HAS_SOCKET
13626 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13627 #endif
13628 #ifdef I_SYS_TIME
13629 #include <sys/time.h>
13630 #endif
13631 #ifdef I_SYS_SELECT
13632 #include <sys/select.h>
13633 #endif
13634 int main() {
13635         fd_set fds;
13636
13637 #ifdef TRYBITS
13638         if(fds.fds_bits);
13639 #endif
13640
13641 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13642         exit(0);
13643 #else
13644         exit(1);
13645 #endif
13646 }
13647 EOCP
13648 set try -DTRYBITS
13649 if eval $compile; then
13650         d_fds_bits="$define"
13651         d_fd_set="$define"
13652         echo "Well, your system knows about the normal fd_set typedef..." >&4
13653         if $run ./try; then
13654                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13655                 d_fd_macros="$define"
13656         else
13657                 $cat >&4 <<'EOM'
13658 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13659 EOM
13660                 d_fd_macros="$undef"
13661         fi
13662 else
13663         $cat <<'EOM'
13664 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13665 EOM
13666         set try
13667         if eval $compile; then
13668                 d_fds_bits="$undef"
13669                 d_fd_set="$define"
13670                 echo "Well, your system has some sort of fd_set available..." >&4
13671                 if $run ./try; then
13672                         echo "and you have the normal fd_set macros." >&4
13673                         d_fd_macros="$define"
13674                 else
13675                         $cat <<'EOM'
13676 but not the normal fd_set macros!  Gross!  More work for me...
13677 EOM
13678                         d_fd_macros="$undef"
13679                 fi
13680         else
13681         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13682                 d_fd_set="$undef"
13683                 d_fds_bits="$undef"
13684                 d_fd_macros="$undef"
13685         fi
13686 fi
13687 $rm_try
13688
13689 : see if fegetround exists
13690 set fegetround d_fegetround
13691 eval $inlibc
13692
13693 : see if fgetpos exists
13694 set fgetpos d_fgetpos
13695 eval $inlibc
13696
13697 : see if finite exists
13698 set finite d_finite
13699 eval $inlibc
13700
13701 : see if finitel exists
13702 set finitel d_finitel
13703 eval $inlibc
13704
13705 : see if flock exists
13706 set flock d_flock
13707 eval $inlibc
13708
13709 : see if prototype for flock is available
13710 echo " "
13711 set d_flockproto flock $i_sysfile sys/file.h
13712 eval $hasproto
13713
13714 : see if fp_class exists
13715 set fp_class d_fp_class
13716 eval $inlibc
13717
13718 : see if fp_classl exists
13719 set fp_classl d_fp_classl
13720 eval $inlibc
13721
13722 : see if pathconf exists
13723 set pathconf d_pathconf
13724 eval $inlibc
13725
13726 : see if fpathconf exists
13727 set fpathconf d_fpathconf
13728 eval $inlibc
13729
13730 : see if fpclass exists
13731 set fpclass d_fpclass
13732 eval $inlibc
13733
13734 : see if fp_classify exists
13735 set fp_classify d_fp_classify
13736 eval $inlibc
13737
13738 : see if fpclassl exists
13739 set fpclassl d_fpclassl
13740 eval $inlibc
13741
13742 : see if fpgetround exists
13743 set fpgetround d_fpgetround
13744 eval $inlibc
13745
13746 : check for fpos64_t
13747 echo " "
13748 echo "Checking to see if you have fpos64_t..." >&4
13749 $cat >try.c <<EOCP
13750 #include <stdio.h>
13751 int main() { fpos64_t x = 7; }
13752 EOCP
13753 set try
13754 if eval $compile; then
13755         val="$define"
13756         echo "You have fpos64_t."
13757 else
13758         val="$undef"
13759         echo "You do not have fpos64_t."
13760         case "$fpossize" in
13761         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13762         esac
13763 fi
13764 $rm_try
13765 set d_fpos64_t
13766 eval $setvar
13767
13768 : see if frexpl exists
13769 set frexpl d_frexpl
13770 eval $inlibc
13771
13772 : see if this is a sys/param system
13773 set sys/param.h i_sysparam
13774 eval $inhdr
13775
13776 : see if this is a sys/mount.h system
13777 set sys/mount.h i_sysmount
13778 eval $inhdr
13779
13780 : Check for fs_data_s
13781 echo " "
13782 echo "Checking to see if your system supports struct fs_data..." >&4
13783 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13784 eval $hasstruct
13785 case "$d_fs_data_s" in
13786 "$define")      echo "Yes, it does."   ;;
13787 *)              echo "No, it doesn't." ;;
13788 esac
13789
13790 : see if fseeko exists
13791 set fseeko d_fseeko
13792 eval $inlibc
13793 case "$longsize" in
13794 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13795 esac
13796
13797 : see if fsetpos exists
13798 set fsetpos d_fsetpos
13799 eval $inlibc
13800
13801 : see if fstatfs exists
13802 set fstatfs d_fstatfs
13803 eval $inlibc
13804
13805 : see if statvfs exists
13806 set statvfs d_statvfs
13807 eval $inlibc
13808
13809 : see if fstatvfs exists
13810 set fstatvfs d_fstatvfs
13811 eval $inlibc
13812
13813
13814 : see if fsync exists
13815 set fsync d_fsync
13816 eval $inlibc
13817
13818 : see if ftello exists
13819 set ftello d_ftello
13820 eval $inlibc
13821 case "$longsize" in
13822 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13823 esac
13824
13825 : check for a working futimes
13826 d_futimes="$undef"
13827 echo " "
13828 echo "Checking if you have a working futimes()" >&4
13829 $cat >try.c <<EOCP
13830 #include <stdio.h>
13831 #include <sys/time.h>
13832 #include <errno.h>
13833 #include <fcntl.h>
13834
13835 int main ()
13836 {
13837     int fd, rv;
13838     fd = open ("try.c", O_RDWR);
13839     if (-1 == fd) exit (1);
13840     rv = futimes (fd, NULL);
13841     exit (rv == -1 ? errno : 0);
13842 }
13843 EOCP
13844 set try
13845 if eval $compile; then
13846     `$run ./try`
13847     rc=$?
13848     case "$rc" in
13849         0)  echo "Yes, you have" >&4
13850             d_futimes="$define"
13851             ;;
13852         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13853             ;;
13854     esac
13855 else
13856     echo "No, it does not (probably harmless)" >&4
13857 fi
13858 $rm_try
13859
13860 : see if ndbm.h is available
13861 set ndbm.h i_ndbm
13862 eval $inhdr
13863 : Compatibility location for RedHat 7.1
13864 set gdbm/ndbm.h i_gdbmndbm
13865 eval $inhdr
13866 : Compatibility location for Debian 4.0
13867 set gdbm-ndbm.h i_gdbm_ndbm
13868 eval $inhdr
13869
13870 val="$undef"
13871 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13872         : see if dbm_open exists
13873         set dbm_open d_dbm_open
13874         eval $inlibc
13875         case "$d_dbm_open" in
13876         $undef)
13877                 i_ndbm="$undef"
13878                 i_gdbmndbm="$undef"
13879                 i_gdbm_ndbm="$undef"
13880                 echo "We won't be including <ndbm.h>"
13881                 val="$undef"
13882                 ;;
13883         *) val="$define"
13884            ;;
13885         esac
13886 fi
13887 set d_ndbm
13888 eval $setvar
13889
13890 ndbm_hdr_protochk='name=$1; hdr=$2;
13891 eval "ihdr=\$""i_$name";
13892 val="$undef";
13893 if $test "$ihdr" = "$define"; then
13894         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13895         case "$d_cplusplus" in
13896         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13897         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13898         esac;
13899         case "$val" in
13900         $define) $echo "Your <$hdr> seems to have prototypes";;
13901         *) $echo "Your <$hdr> does not seem to have prototypes";;
13902         esac;
13903 fi;
13904 set "d_${name}_h_uses_prototypes";
13905 eval $setvar'
13906
13907 set ndbm ndbm.h
13908 eval $ndbm_hdr_protochk
13909 set gdbmndbm gdbm/ndbm.h
13910 eval $ndbm_hdr_protochk
13911 set gdbm_ndbm gdbm-ndbm.h
13912 eval $ndbm_hdr_protochk
13913
13914 : see if getaddrinfo exists
13915 set getaddrinfo d_getaddrinfo
13916 eval $inlibc
13917
13918 : see if getcwd exists
13919 set getcwd d_getcwd
13920 eval $inlibc
13921
13922 : see if getespwnam exists
13923 set getespwnam d_getespwnam
13924 eval $inlibc
13925
13926 : see if getfsstat exists
13927 set getfsstat d_getfsstat
13928 eval $inlibc
13929
13930 : see if getgrent exists
13931 set getgrent d_getgrent
13932 eval $inlibc
13933
13934 : see if getgrent_r exists
13935 set getgrent_r d_getgrent_r
13936 eval $inlibc
13937 case "$d_getgrent_r" in
13938 "$define")
13939         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13940         case "$d_getgrent_r_proto:$usethreads" in
13941         ":define")      d_getgrent_r_proto=define
13942                 set d_getgrent_r_proto getgrent_r $hdrs
13943                 eval $hasproto ;;
13944         *)      ;;
13945         esac
13946         case "$d_getgrent_r_proto" in
13947         define)
13948         case "$getgrent_r_proto" in
13949         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13950         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13951         esac
13952         case "$getgrent_r_proto" in
13953         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13954         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13955         esac
13956         case "$getgrent_r_proto" in
13957         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13958         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13959         esac
13960         case "$getgrent_r_proto" in
13961         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13962         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13963         esac
13964         case "$getgrent_r_proto" in
13965         ''|0) try='int getgrent_r(struct group*, char*, int);'
13966         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13967         esac
13968         case "$getgrent_r_proto" in
13969         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13970         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13971         esac
13972         case "$getgrent_r_proto" in
13973         ''|0)   d_getgrent_r=undef
13974                 getgrent_r_proto=0
13975                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13976         * )     case "$getgrent_r_proto" in
13977                 REENTRANT_PROTO*) ;;
13978                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13979                 esac
13980                 echo "Prototype: $try" ;;
13981         esac
13982         ;;
13983         *)      case "$usethreads" in
13984                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13985                 esac
13986                 d_getgrent_r=undef
13987                 getgrent_r_proto=0
13988                 ;;
13989         esac
13990         ;;
13991 *)      getgrent_r_proto=0
13992         ;;
13993 esac
13994
13995 : see if getgrgid_r exists
13996 set getgrgid_r d_getgrgid_r
13997 eval $inlibc
13998 case "$d_getgrgid_r" in
13999 "$define")
14000         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14001         case "$d_getgrgid_r_proto:$usethreads" in
14002         ":define")      d_getgrgid_r_proto=define
14003                 set d_getgrgid_r_proto getgrgid_r $hdrs
14004                 eval $hasproto ;;
14005         *)      ;;
14006         esac
14007         case "$d_getgrgid_r_proto" in
14008         define)
14009         case "$getgrgid_r_proto" in
14010         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14011         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14012         esac
14013         case "$getgrgid_r_proto" in
14014         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14015         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14016         esac
14017         case "$getgrgid_r_proto" in
14018         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14019         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14020         esac
14021         case "$getgrgid_r_proto" in
14022         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14023         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14024         esac
14025         case "$getgrgid_r_proto" in
14026         ''|0)   d_getgrgid_r=undef
14027                 getgrgid_r_proto=0
14028                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14029         * )     case "$getgrgid_r_proto" in
14030                 REENTRANT_PROTO*) ;;
14031                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14032                 esac
14033                 echo "Prototype: $try" ;;
14034         esac
14035         ;;
14036         *)      case "$usethreads" in
14037                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14038                 esac
14039                 d_getgrgid_r=undef
14040                 getgrgid_r_proto=0
14041                 ;;
14042         esac
14043         ;;
14044 *)      getgrgid_r_proto=0
14045         ;;
14046 esac
14047
14048 : see if getgrnam_r exists
14049 set getgrnam_r d_getgrnam_r
14050 eval $inlibc
14051 case "$d_getgrnam_r" in
14052 "$define")
14053         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14054         case "$d_getgrnam_r_proto:$usethreads" in
14055         ":define")      d_getgrnam_r_proto=define
14056                 set d_getgrnam_r_proto getgrnam_r $hdrs
14057                 eval $hasproto ;;
14058         *)      ;;
14059         esac
14060         case "$d_getgrnam_r_proto" in
14061         define)
14062         case "$getgrnam_r_proto" in
14063         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14064         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14065         esac
14066         case "$getgrnam_r_proto" in
14067         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14068         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14069         esac
14070         case "$getgrnam_r_proto" in
14071         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14072         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14073         esac
14074         case "$getgrnam_r_proto" in
14075         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14076         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14077         esac
14078         case "$getgrnam_r_proto" in
14079         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14080         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14081         esac
14082         case "$getgrnam_r_proto" in
14083         ''|0)   d_getgrnam_r=undef
14084                 getgrnam_r_proto=0
14085                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14086         * )     case "$getgrnam_r_proto" in
14087                 REENTRANT_PROTO*) ;;
14088                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14089                 esac
14090                 echo "Prototype: $try" ;;
14091         esac
14092         ;;
14093         *)      case "$usethreads" in
14094                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14095                 esac
14096                 d_getgrnam_r=undef
14097                 getgrnam_r_proto=0
14098                 ;;
14099         esac
14100         ;;
14101 *)      getgrnam_r_proto=0
14102         ;;
14103 esac
14104
14105 : see if gethostbyaddr exists
14106 set gethostbyaddr d_gethbyaddr
14107 eval $inlibc
14108
14109 : see if gethostbyname exists
14110 set gethostbyname d_gethbyname
14111 eval $inlibc
14112
14113 : see if gethostent exists
14114 set gethostent d_gethent
14115 eval $inlibc
14116
14117 : see how we will look up host name
14118 echo " "
14119 call=''
14120 if set gethostname val -f d_gethname; eval $csym; $val; then
14121         echo 'gethostname() found.' >&4
14122         d_gethname="$define"
14123         call=gethostname
14124 fi
14125 if set uname val -f d_uname; eval $csym; $val; then
14126         if ./xenix; then
14127                 $cat <<'EOM'
14128 uname() was found, but you're running xenix, and older versions of xenix
14129 have a broken uname(). If you don't really know whether your xenix is old
14130 enough to have a broken system call, use the default answer.
14131
14132 EOM
14133                 dflt=y
14134                 case "$d_uname" in
14135                 "$define") dflt=n;;
14136                 esac
14137                 rp='Is your uname() broken?'
14138                 . ./myread
14139                 case "$ans" in
14140                 n*) d_uname="$define"; call=uname;;
14141                 esac
14142         else
14143                 echo 'uname() found.' >&4
14144                 d_uname="$define"
14145                 case "$call" in
14146                 '') call=uname ;;
14147                 esac
14148         fi
14149 fi
14150 case "$d_gethname" in
14151 '') d_gethname="$undef";;
14152 esac
14153 case "$d_uname" in
14154 '') d_uname="$undef";;
14155 esac
14156 case "$d_uname$d_gethname" in
14157 *define*)
14158         dflt=n
14159         cat <<EOM
14160
14161 Every now and then someone has a $call() that lies about the hostname
14162 but can't be fixed for political or economic reasons.  If you wish, I can
14163 pretend $call() isn't there and maybe compute hostname at run-time
14164 thanks to the '$phostname' command.
14165
14166 EOM
14167         rp="Shall I ignore $call() from now on?"
14168         . ./myread
14169         case "$ans" in
14170         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14171         esac;;
14172 esac
14173 case "$phostname" in
14174 '') aphostname='';;
14175 *) case "$aphostname" in
14176         /*) ;;
14177         *) set X $phostname
14178                 shift
14179                 file=$1
14180                 shift
14181                 file=`./loc $file $file $pth`
14182                 aphostname=`echo $file $*`
14183                 ;;
14184         esac
14185         ;;
14186 esac
14187 case "$d_uname$d_gethname" in
14188 *define*) ;;
14189 *)
14190         case "$phostname" in
14191         '')
14192                 echo "There will be no way for $package to get your hostname." >&4;;
14193         *)
14194         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14195                 ;;
14196         esac;;
14197 esac
14198 case "$d_phostname" in
14199 '') d_phostname="$undef";;
14200 esac
14201
14202 : see if gethostbyaddr_r exists
14203 set gethostbyaddr_r d_gethostbyaddr_r
14204 eval $inlibc
14205 case "$d_gethostbyaddr_r" in
14206 "$define")
14207         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14208         case "$d_gethostbyaddr_r_proto:$usethreads" in
14209         ":define")      d_gethostbyaddr_r_proto=define
14210                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14211                 eval $hasproto ;;
14212         *)      ;;
14213         esac
14214         case "$d_gethostbyaddr_r_proto" in
14215         define)
14216         case "$gethostbyaddr_r_proto" in
14217         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14218         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14219         esac
14220         case "$gethostbyaddr_r_proto" in
14221         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14222         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14223         esac
14224         case "$gethostbyaddr_r_proto" in
14225         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14226         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14227         esac
14228         case "$gethostbyaddr_r_proto" in
14229         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14230         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14231         esac
14232         case "$gethostbyaddr_r_proto" in
14233         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14234         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14235         esac
14236         case "$gethostbyaddr_r_proto" in
14237         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14238         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14239         esac
14240         case "$gethostbyaddr_r_proto" in
14241         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14242         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14243         esac
14244         case "$gethostbyaddr_r_proto" in
14245         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14246         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14247         esac
14248         case "$gethostbyaddr_r_proto" in
14249         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14250         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14251         esac
14252         case "$gethostbyaddr_r_proto" in
14253         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14254         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14255         esac
14256         case "$gethostbyaddr_r_proto" in
14257         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14258         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14259         esac
14260         case "$gethostbyaddr_r_proto" in
14261         ''|0)   d_gethostbyaddr_r=undef
14262                 gethostbyaddr_r_proto=0
14263                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14264         * )     case "$gethostbyaddr_r_proto" in
14265                 REENTRANT_PROTO*) ;;
14266                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14267                 esac
14268                 echo "Prototype: $try" ;;
14269         esac
14270         ;;
14271         *)      case "$usethreads" in
14272                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14273                 esac
14274                 d_gethostbyaddr_r=undef
14275                 gethostbyaddr_r_proto=0
14276                 ;;
14277         esac
14278         ;;
14279 *)      gethostbyaddr_r_proto=0
14280         ;;
14281 esac
14282
14283 : see if gethostbyname_r exists
14284 set gethostbyname_r d_gethostbyname_r
14285 eval $inlibc
14286 case "$d_gethostbyname_r" in
14287 "$define")
14288         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14289         case "$d_gethostbyname_r_proto:$usethreads" in
14290         ":define")      d_gethostbyname_r_proto=define
14291                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14292                 eval $hasproto ;;
14293         *)      ;;
14294         esac
14295         case "$d_gethostbyname_r_proto" in
14296         define)
14297         case "$gethostbyname_r_proto" in
14298         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14299         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14300         esac
14301         case "$gethostbyname_r_proto" in
14302         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14303         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14304         esac
14305         case "$gethostbyname_r_proto" in
14306         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14307         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14308         esac
14309         case "$gethostbyname_r_proto" in
14310         ''|0)   d_gethostbyname_r=undef
14311                 gethostbyname_r_proto=0
14312                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14313         * )     case "$gethostbyname_r_proto" in
14314                 REENTRANT_PROTO*) ;;
14315                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14316                 esac
14317                 echo "Prototype: $try" ;;
14318         esac
14319         ;;
14320         *)      case "$usethreads" in
14321                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14322                 esac
14323                 d_gethostbyname_r=undef
14324                 gethostbyname_r_proto=0
14325                 ;;
14326         esac
14327         ;;
14328 *)      gethostbyname_r_proto=0
14329         ;;
14330 esac
14331
14332 : see if gethostent_r exists
14333 set gethostent_r d_gethostent_r
14334 eval $inlibc
14335 case "$d_gethostent_r" in
14336 "$define")
14337         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14338         case "$d_gethostent_r_proto:$usethreads" in
14339         ":define")      d_gethostent_r_proto=define
14340                 set d_gethostent_r_proto gethostent_r $hdrs
14341                 eval $hasproto ;;
14342         *)      ;;
14343         esac
14344         case "$d_gethostent_r_proto" in
14345         define)
14346         case "$gethostent_r_proto" in
14347         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14348         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14349         esac
14350         case "$gethostent_r_proto" in
14351         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14352         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14353         esac
14354         case "$gethostent_r_proto" in
14355         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14356         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14357         esac
14358         case "$gethostent_r_proto" in
14359         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14360         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14361         esac
14362         case "$gethostent_r_proto" in
14363         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14364         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14365         esac
14366         case "$gethostent_r_proto" in
14367         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14368         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14369         esac
14370         case "$gethostent_r_proto" in
14371         ''|0)   d_gethostent_r=undef
14372                 gethostent_r_proto=0
14373                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14374         * )     case "$gethostent_r_proto" in
14375                 REENTRANT_PROTO*) ;;
14376                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14377                 esac
14378                 echo "Prototype: $try" ;;
14379         esac
14380         ;;
14381         *)      case "$usethreads" in
14382                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14383                 esac
14384                 d_gethostent_r=undef
14385                 gethostent_r_proto=0
14386                 ;;
14387         esac
14388         ;;
14389 *)      gethostent_r_proto=0
14390         ;;
14391 esac
14392
14393 : see if prototypes for various gethostxxx netdb.h functions are available
14394 echo " "
14395 set d_gethostprotos gethostent $i_netdb netdb.h
14396 eval $hasproto
14397
14398 : see if getitimer exists
14399 set getitimer d_getitimer
14400 eval $inlibc
14401
14402 : see if getlogin exists
14403 set getlogin d_getlogin
14404 eval $inlibc
14405
14406 : see if getlogin_r exists
14407 set getlogin_r d_getlogin_r
14408 eval $inlibc
14409 case "$d_getlogin_r" in
14410 "$define")
14411         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14412         case "$d_getlogin_r_proto:$usethreads" in
14413         ":define")      d_getlogin_r_proto=define
14414                 set d_getlogin_r_proto getlogin_r $hdrs
14415                 eval $hasproto ;;
14416         *)      ;;
14417         esac
14418         case "$d_getlogin_r_proto" in
14419         define)
14420         case "$getlogin_r_proto" in
14421         ''|0) try='int getlogin_r(char*, size_t);'
14422         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14423         esac
14424         case "$getlogin_r_proto" in
14425         ''|0) try='int getlogin_r(char*, int);'
14426         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14427         esac
14428         case "$getlogin_r_proto" in
14429         ''|0) try='char* getlogin_r(char*, size_t);'
14430         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14431         esac
14432         case "$getlogin_r_proto" in
14433         ''|0) try='char* getlogin_r(char*, int);'
14434         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14435         esac
14436         case "$getlogin_r_proto" in
14437         ''|0)   d_getlogin_r=undef
14438                 getlogin_r_proto=0
14439                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14440         * )     case "$getlogin_r_proto" in
14441                 REENTRANT_PROTO*) ;;
14442                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14443                 esac
14444                 echo "Prototype: $try" ;;
14445         esac
14446         ;;
14447         *)      case "$usethreads" in
14448                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14449                 esac
14450                 d_getlogin_r=undef
14451                 getlogin_r_proto=0
14452                 ;;
14453         esac
14454         ;;
14455 *)      getlogin_r_proto=0
14456         ;;
14457 esac
14458
14459 : see if getmnt exists
14460 set getmnt d_getmnt
14461 eval $inlibc
14462
14463 : see if getmntent exists
14464 set getmntent d_getmntent
14465 eval $inlibc
14466
14467 : see if getnameinfo exists
14468 set getnameinfo d_getnameinfo
14469 eval $inlibc
14470
14471 : see if getnetbyaddr exists
14472 set getnetbyaddr d_getnbyaddr
14473 eval $inlibc
14474
14475 : see if getnetbyname exists
14476 set getnetbyname d_getnbyname
14477 eval $inlibc
14478
14479 : see if getnetent exists
14480 set getnetent d_getnent
14481 eval $inlibc
14482
14483 : see if getnetbyaddr_r exists
14484 set getnetbyaddr_r d_getnetbyaddr_r
14485 eval $inlibc
14486 case "$d_getnetbyaddr_r" in
14487 "$define")
14488         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14489         case "$d_getnetbyaddr_r_proto:$usethreads" in
14490         ":define")      d_getnetbyaddr_r_proto=define
14491                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14492                 eval $hasproto ;;
14493         *)      ;;
14494         esac
14495         case "$d_getnetbyaddr_r_proto" in
14496         define)
14497         case "$getnetbyaddr_r_proto" in
14498         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14499         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14500         esac
14501         case "$getnetbyaddr_r_proto" in
14502         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14503         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14504         esac
14505         case "$getnetbyaddr_r_proto" in
14506         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14507         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14508         esac
14509         case "$getnetbyaddr_r_proto" in
14510         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14511         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14512         esac
14513         case "$getnetbyaddr_r_proto" in
14514         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14515         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14516         esac
14517         case "$getnetbyaddr_r_proto" in
14518         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14519         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14520         esac
14521         case "$getnetbyaddr_r_proto" in
14522         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14523         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14524         esac
14525         case "$getnetbyaddr_r_proto" in
14526         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14527         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14528         esac
14529         case "$getnetbyaddr_r_proto" in
14530         ''|0)   d_getnetbyaddr_r=undef
14531                 getnetbyaddr_r_proto=0
14532                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14533         * )     case "$getnetbyaddr_r_proto" in
14534                 REENTRANT_PROTO*) ;;
14535                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14536                 esac
14537                 echo "Prototype: $try" ;;
14538         esac
14539         ;;
14540         *)      case "$usethreads" in
14541                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14542                 esac
14543                 d_getnetbyaddr_r=undef
14544                 getnetbyaddr_r_proto=0
14545                 ;;
14546         esac
14547         ;;
14548 *)      getnetbyaddr_r_proto=0
14549         ;;
14550 esac
14551
14552 : see if getnetbyname_r exists
14553 set getnetbyname_r d_getnetbyname_r
14554 eval $inlibc
14555 case "$d_getnetbyname_r" in
14556 "$define")
14557         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14558         case "$d_getnetbyname_r_proto:$usethreads" in
14559         ":define")      d_getnetbyname_r_proto=define
14560                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14561                 eval $hasproto ;;
14562         *)      ;;
14563         esac
14564         case "$d_getnetbyname_r_proto" in
14565         define)
14566         case "$getnetbyname_r_proto" in
14567         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14568         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14569         esac
14570         case "$getnetbyname_r_proto" in
14571         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14572         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14573         esac
14574         case "$getnetbyname_r_proto" in
14575         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14576         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14577         esac
14578         case "$getnetbyname_r_proto" in
14579         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14580         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14581         esac
14582         case "$getnetbyname_r_proto" in
14583         ''|0)   d_getnetbyname_r=undef
14584                 getnetbyname_r_proto=0
14585                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14586         * )     case "$getnetbyname_r_proto" in
14587                 REENTRANT_PROTO*) ;;
14588                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14589                 esac
14590                 echo "Prototype: $try" ;;
14591         esac
14592         ;;
14593         *)      case "$usethreads" in
14594                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14595                 esac
14596                 d_getnetbyname_r=undef
14597                 getnetbyname_r_proto=0
14598                 ;;
14599         esac
14600         ;;
14601 *)      getnetbyname_r_proto=0
14602         ;;
14603 esac
14604
14605 : see if getnetent_r exists
14606 set getnetent_r d_getnetent_r
14607 eval $inlibc
14608 case "$d_getnetent_r" in
14609 "$define")
14610         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14611         case "$d_getnetent_r_proto:$usethreads" in
14612         ":define")      d_getnetent_r_proto=define
14613                 set d_getnetent_r_proto getnetent_r $hdrs
14614                 eval $hasproto ;;
14615         *)      ;;
14616         esac
14617         case "$d_getnetent_r_proto" in
14618         define)
14619         case "$getnetent_r_proto" in
14620         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14621         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14622         esac
14623         case "$getnetent_r_proto" in
14624         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14625         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14626         esac
14627         case "$getnetent_r_proto" in
14628         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14629         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14630         esac
14631         case "$getnetent_r_proto" in
14632         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14633         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14634         esac
14635         case "$getnetent_r_proto" in
14636         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14637         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14638         esac
14639         case "$getnetent_r_proto" in
14640         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14641         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14642         esac
14643         case "$getnetent_r_proto" in
14644         ''|0)   d_getnetent_r=undef
14645                 getnetent_r_proto=0
14646                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14647         * )     case "$getnetent_r_proto" in
14648                 REENTRANT_PROTO*) ;;
14649                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14650                 esac
14651                 echo "Prototype: $try" ;;
14652         esac
14653         ;;
14654         *)      case "$usethreads" in
14655                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14656                 esac
14657                 d_getnetent_r=undef
14658                 getnetent_r_proto=0
14659                 ;;
14660         esac
14661         ;;
14662 *)      getnetent_r_proto=0
14663         ;;
14664 esac
14665
14666 : see if prototypes for various getnetxxx netdb.h functions are available
14667 echo " "
14668 set d_getnetprotos getnetent $i_netdb netdb.h
14669 eval $hasproto
14670
14671 : see if getpagesize exists
14672 set getpagesize d_getpagsz
14673 eval $inlibc
14674
14675 : Optional checks for getprotobyname and getprotobynumber
14676
14677 : see if getprotobyname exists
14678 set getprotobyname d_getpbyname
14679 eval $inlibc
14680
14681 : see if getprotobynumber exists
14682 set getprotobynumber d_getpbynumber
14683 eval $inlibc
14684
14685 : see if getprotoent exists
14686 set getprotoent d_getpent
14687 eval $inlibc
14688
14689 : see if getpgid exists
14690 set getpgid d_getpgid
14691 eval $inlibc
14692
14693 : see if getpgrp2 exists
14694 set getpgrp2 d_getpgrp2
14695 eval $inlibc
14696
14697 : see if getppid exists
14698 set getppid d_getppid
14699 eval $inlibc
14700
14701 : see if getpriority exists
14702 set getpriority d_getprior
14703 eval $inlibc
14704
14705 : see if getprotobyname_r exists
14706 set getprotobyname_r d_getprotobyname_r
14707 eval $inlibc
14708 case "$d_getprotobyname_r" in
14709 "$define")
14710         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14711         case "$d_getprotobyname_r_proto:$usethreads" in
14712         ":define")      d_getprotobyname_r_proto=define
14713                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14714                 eval $hasproto ;;
14715         *)      ;;
14716         esac
14717         case "$d_getprotobyname_r_proto" in
14718         define)
14719         case "$getprotobyname_r_proto" in
14720         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14721         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14722         esac
14723         case "$getprotobyname_r_proto" in
14724         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14725         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14726         esac
14727         case "$getprotobyname_r_proto" in
14728         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14729         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14730         esac
14731         case "$getprotobyname_r_proto" in
14732         ''|0)   d_getprotobyname_r=undef
14733                 getprotobyname_r_proto=0
14734                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14735         * )     case "$getprotobyname_r_proto" in
14736                 REENTRANT_PROTO*) ;;
14737                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14738                 esac
14739                 echo "Prototype: $try" ;;
14740         esac
14741         ;;
14742         *)      case "$usethreads" in
14743                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14744                 esac
14745                 d_getprotobyname_r=undef
14746                 getprotobyname_r_proto=0
14747                 ;;
14748         esac
14749         ;;
14750 *)      getprotobyname_r_proto=0
14751         ;;
14752 esac
14753
14754 : see if getprotobynumber_r exists
14755 set getprotobynumber_r d_getprotobynumber_r
14756 eval $inlibc
14757 case "$d_getprotobynumber_r" in
14758 "$define")
14759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14760         case "$d_getprotobynumber_r_proto:$usethreads" in
14761         ":define")      d_getprotobynumber_r_proto=define
14762                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14763                 eval $hasproto ;;
14764         *)      ;;
14765         esac
14766         case "$d_getprotobynumber_r_proto" in
14767         define)
14768         case "$getprotobynumber_r_proto" in
14769         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14770         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14771         esac
14772         case "$getprotobynumber_r_proto" in
14773         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14774         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14775         esac
14776         case "$getprotobynumber_r_proto" in
14777         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14778         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14779         esac
14780         case "$getprotobynumber_r_proto" in
14781         ''|0)   d_getprotobynumber_r=undef
14782                 getprotobynumber_r_proto=0
14783                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14784         * )     case "$getprotobynumber_r_proto" in
14785                 REENTRANT_PROTO*) ;;
14786                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14787                 esac
14788                 echo "Prototype: $try" ;;
14789         esac
14790         ;;
14791         *)      case "$usethreads" in
14792                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14793                 esac
14794                 d_getprotobynumber_r=undef
14795                 getprotobynumber_r_proto=0
14796                 ;;
14797         esac
14798         ;;
14799 *)      getprotobynumber_r_proto=0
14800         ;;
14801 esac
14802
14803 : see if getprotoent_r exists
14804 set getprotoent_r d_getprotoent_r
14805 eval $inlibc
14806 case "$d_getprotoent_r" in
14807 "$define")
14808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14809         case "$d_getprotoent_r_proto:$usethreads" in
14810         ":define")      d_getprotoent_r_proto=define
14811                 set d_getprotoent_r_proto getprotoent_r $hdrs
14812                 eval $hasproto ;;
14813         *)      ;;
14814         esac
14815         case "$d_getprotoent_r_proto" in
14816         define)
14817         case "$getprotoent_r_proto" in
14818         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14819         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14820         esac
14821         case "$getprotoent_r_proto" in
14822         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14823         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14824         esac
14825         case "$getprotoent_r_proto" in
14826         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14827         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14828         esac
14829         case "$getprotoent_r_proto" in
14830         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14831         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14832         esac
14833         case "$getprotoent_r_proto" in
14834         ''|0)   d_getprotoent_r=undef
14835                 getprotoent_r_proto=0
14836                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14837         * )     case "$getprotoent_r_proto" in
14838                 REENTRANT_PROTO*) ;;
14839                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14840                 esac
14841                 echo "Prototype: $try" ;;
14842         esac
14843         ;;
14844         *)      case "$usethreads" in
14845                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14846                 esac
14847                 d_getprotoent_r=undef
14848                 getprotoent_r_proto=0
14849                 ;;
14850         esac
14851         ;;
14852 *)      getprotoent_r_proto=0
14853         ;;
14854 esac
14855
14856 : see if prototypes for various getprotoxxx netdb.h functions are available
14857 echo " "
14858 set d_getprotoprotos getprotoent $i_netdb netdb.h
14859 eval $hasproto
14860
14861 : see if getprpwnam exists
14862 set getprpwnam d_getprpwnam
14863 eval $inlibc
14864
14865 : see if getpwent exists
14866 set getpwent d_getpwent
14867 eval $inlibc
14868
14869 : see if getpwent_r exists
14870 set getpwent_r d_getpwent_r
14871 eval $inlibc
14872 case "$d_getpwent_r" in
14873 "$define")
14874         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14875         case "$d_getpwent_r_proto:$usethreads" in
14876         ":define")      d_getpwent_r_proto=define
14877                 set d_getpwent_r_proto getpwent_r $hdrs
14878                 eval $hasproto ;;
14879         *)      ;;
14880         esac
14881         case "$d_getpwent_r_proto" in
14882         define)
14883         case "$getpwent_r_proto" in
14884         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14885         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14886         esac
14887         case "$getpwent_r_proto" in
14888         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14889         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14890         esac
14891         case "$getpwent_r_proto" in
14892         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14893         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14894         esac
14895         case "$getpwent_r_proto" in
14896         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14897         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14898         esac
14899         case "$getpwent_r_proto" in
14900         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14901         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14902         esac
14903         case "$getpwent_r_proto" in
14904         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14905         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14906         esac
14907         case "$getpwent_r_proto" in
14908         ''|0)   d_getpwent_r=undef
14909                 getpwent_r_proto=0
14910                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14911         * )     case "$getpwent_r_proto" in
14912                 REENTRANT_PROTO*) ;;
14913                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14914                 esac
14915                 echo "Prototype: $try" ;;
14916         esac
14917         ;;
14918         *)      case "$usethreads" in
14919                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14920                 esac
14921                 d_getpwent_r=undef
14922                 getpwent_r_proto=0
14923                 ;;
14924         esac
14925         ;;
14926 *)      getpwent_r_proto=0
14927         ;;
14928 esac
14929
14930 : see if getpwnam_r exists
14931 set getpwnam_r d_getpwnam_r
14932 eval $inlibc
14933 case "$d_getpwnam_r" in
14934 "$define")
14935         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14936         case "$d_getpwnam_r_proto:$usethreads" in
14937         ":define")      d_getpwnam_r_proto=define
14938                 set d_getpwnam_r_proto getpwnam_r $hdrs
14939                 eval $hasproto ;;
14940         *)      ;;
14941         esac
14942         case "$d_getpwnam_r_proto" in
14943         define)
14944         case "$getpwnam_r_proto" in
14945         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14946         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14947         esac
14948         case "$getpwnam_r_proto" in
14949         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14950         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14951         esac
14952         case "$getpwnam_r_proto" in
14953         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14954         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14955         esac
14956         case "$getpwnam_r_proto" in
14957         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14958         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14959         esac
14960         case "$getpwnam_r_proto" in
14961         ''|0)   d_getpwnam_r=undef
14962                 getpwnam_r_proto=0
14963                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14964         * )     case "$getpwnam_r_proto" in
14965                 REENTRANT_PROTO*) ;;
14966                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14967                 esac
14968                 echo "Prototype: $try" ;;
14969         esac
14970         ;;
14971         *)      case "$usethreads" in
14972                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14973                 esac
14974                 d_getpwnam_r=undef
14975                 getpwnam_r_proto=0
14976                 ;;
14977         esac
14978         ;;
14979 *)      getpwnam_r_proto=0
14980         ;;
14981 esac
14982
14983 : see if getpwuid_r exists
14984 set getpwuid_r d_getpwuid_r
14985 eval $inlibc
14986 case "$d_getpwuid_r" in
14987 "$define")
14988         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14989         case "$d_getpwuid_r_proto:$usethreads" in
14990         ":define")      d_getpwuid_r_proto=define
14991                 set d_getpwuid_r_proto getpwuid_r $hdrs
14992                 eval $hasproto ;;
14993         *)      ;;
14994         esac
14995         case "$d_getpwuid_r_proto" in
14996         define)
14997         case "$getpwuid_r_proto" in
14998         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14999         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15000         esac
15001         case "$getpwuid_r_proto" in
15002         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15003         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15004         esac
15005         case "$getpwuid_r_proto" in
15006         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15007         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15008         esac
15009         case "$getpwuid_r_proto" in
15010         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15011         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15012         esac
15013         case "$getpwuid_r_proto" in
15014         ''|0)   d_getpwuid_r=undef
15015                 getpwuid_r_proto=0
15016                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15017         * )     case "$getpwuid_r_proto" in
15018                 REENTRANT_PROTO*) ;;
15019                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15020                 esac
15021                 echo "Prototype: $try" ;;
15022         esac
15023         ;;
15024         *)      case "$usethreads" in
15025                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15026                 esac
15027                 d_getpwuid_r=undef
15028                 getpwuid_r_proto=0
15029                 ;;
15030         esac
15031         ;;
15032 *)      getpwuid_r_proto=0
15033         ;;
15034 esac
15035
15036 : Optional checks for getsbyname and getsbyport
15037
15038 : see if getservbyname exists
15039 set getservbyname d_getsbyname
15040 eval $inlibc
15041
15042 : see if getservbyport exists
15043 set getservbyport d_getsbyport
15044 eval $inlibc
15045
15046 : see if getservent exists
15047 set getservent d_getsent
15048 eval $inlibc
15049
15050 : see if getservbyname_r exists
15051 set getservbyname_r d_getservbyname_r
15052 eval $inlibc
15053 case "$d_getservbyname_r" in
15054 "$define")
15055         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15056         case "$d_getservbyname_r_proto:$usethreads" in
15057         ":define")      d_getservbyname_r_proto=define
15058                 set d_getservbyname_r_proto getservbyname_r $hdrs
15059                 eval $hasproto ;;
15060         *)      ;;
15061         esac
15062         case "$d_getservbyname_r_proto" in
15063         define)
15064         case "$getservbyname_r_proto" in
15065         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15066         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15067         esac
15068         case "$getservbyname_r_proto" in
15069         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15070         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15071         esac
15072         case "$getservbyname_r_proto" in
15073         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15074         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15075         esac
15076         case "$getservbyname_r_proto" in
15077         ''|0)   d_getservbyname_r=undef
15078                 getservbyname_r_proto=0
15079                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15080         * )     case "$getservbyname_r_proto" in
15081                 REENTRANT_PROTO*) ;;
15082                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15083                 esac
15084                 echo "Prototype: $try" ;;
15085         esac
15086         ;;
15087         *)      case "$usethreads" in
15088                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15089                 esac
15090                 d_getservbyname_r=undef
15091                 getservbyname_r_proto=0
15092                 ;;
15093         esac
15094         ;;
15095 *)      getservbyname_r_proto=0
15096         ;;
15097 esac
15098
15099 : see if getservbyport_r exists
15100 set getservbyport_r d_getservbyport_r
15101 eval $inlibc
15102 case "$d_getservbyport_r" in
15103 "$define")
15104         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15105         case "$d_getservbyport_r_proto:$usethreads" in
15106         ":define")      d_getservbyport_r_proto=define
15107                 set d_getservbyport_r_proto getservbyport_r $hdrs
15108                 eval $hasproto ;;
15109         *)      ;;
15110         esac
15111         case "$d_getservbyport_r_proto" in
15112         define)
15113         case "$getservbyport_r_proto" in
15114         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15115         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15116         esac
15117         case "$getservbyport_r_proto" in
15118         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15119         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15120         esac
15121         case "$getservbyport_r_proto" in
15122         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15123         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15124         esac
15125         case "$getservbyport_r_proto" in
15126         ''|0)   d_getservbyport_r=undef
15127                 getservbyport_r_proto=0
15128                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15129         * )     case "$getservbyport_r_proto" in
15130                 REENTRANT_PROTO*) ;;
15131                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15132                 esac
15133                 echo "Prototype: $try" ;;
15134         esac
15135         ;;
15136         *)      case "$usethreads" in
15137                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15138                 esac
15139                 d_getservbyport_r=undef
15140                 getservbyport_r_proto=0
15141                 ;;
15142         esac
15143         ;;
15144 *)      getservbyport_r_proto=0
15145         ;;
15146 esac
15147
15148 : see if getservent_r exists
15149 set getservent_r d_getservent_r
15150 eval $inlibc
15151 case "$d_getservent_r" in
15152 "$define")
15153         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15154         case "$d_getservent_r_proto:$usethreads" in
15155         ":define")      d_getservent_r_proto=define
15156                 set d_getservent_r_proto getservent_r $hdrs
15157                 eval $hasproto ;;
15158         *)      ;;
15159         esac
15160         case "$d_getservent_r_proto" in
15161         define)
15162         case "$getservent_r_proto" in
15163         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15164         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15165         esac
15166         case "$getservent_r_proto" in
15167         ''|0) try='int getservent_r(struct servent*, char*, int);'
15168         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15169         esac
15170         case "$getservent_r_proto" in
15171         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15172         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15173         esac
15174         case "$getservent_r_proto" in
15175         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15176         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15177         esac
15178         case "$getservent_r_proto" in
15179         ''|0)   d_getservent_r=undef
15180                 getservent_r_proto=0
15181                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15182         * )     case "$getservent_r_proto" in
15183                 REENTRANT_PROTO*) ;;
15184                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15185                 esac
15186                 echo "Prototype: $try" ;;
15187         esac
15188         ;;
15189         *)      case "$usethreads" in
15190                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15191                 esac
15192                 d_getservent_r=undef
15193                 getservent_r_proto=0
15194                 ;;
15195         esac
15196         ;;
15197 *)      getservent_r_proto=0
15198         ;;
15199 esac
15200
15201 : see if prototypes for various getservxxx netdb.h functions are available
15202 echo " "
15203 set d_getservprotos getservent $i_netdb netdb.h
15204 eval $hasproto
15205
15206 : see if getspnam exists
15207 set getspnam d_getspnam
15208 eval $inlibc
15209
15210 : see if this is a shadow.h system
15211 set shadow.h i_shadow
15212 eval $inhdr
15213
15214 : see if getspnam_r exists
15215 set getspnam_r d_getspnam_r
15216 eval $inlibc
15217 case "$d_getspnam_r" in
15218 "$define")
15219         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15220         case "$d_getspnam_r_proto:$usethreads" in
15221         ":define")      d_getspnam_r_proto=define
15222                 set d_getspnam_r_proto getspnam_r $hdrs
15223                 eval $hasproto ;;
15224         *)      ;;
15225         esac
15226         case "$d_getspnam_r_proto" in
15227         define)
15228         case "$getspnam_r_proto" in
15229         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15230         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15231         esac
15232         case "$getspnam_r_proto" in
15233         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15234         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15235         esac
15236         case "$getspnam_r_proto" in
15237         ''|0)   d_getspnam_r=undef
15238                 getspnam_r_proto=0
15239                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15240         * )     case "$getspnam_r_proto" in
15241                 REENTRANT_PROTO*) ;;
15242                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15243                 esac
15244                 echo "Prototype: $try" ;;
15245         esac
15246         ;;
15247         *)      case "$usethreads" in
15248                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15249                 esac
15250                 d_getspnam_r=undef
15251                 getspnam_r_proto=0
15252                 ;;
15253         esac
15254         ;;
15255 *)      getspnam_r_proto=0
15256         ;;
15257 esac
15258
15259 : see if gettimeofday or ftime exists
15260 set gettimeofday d_gettimeod
15261 eval $inlibc
15262 case "$d_gettimeod" in
15263 "$undef")
15264         set ftime d_ftime 
15265         eval $inlibc
15266         ;;
15267 *)
15268         val="$undef"; set d_ftime; eval $setvar
15269         ;;
15270 esac
15271 case "$d_gettimeod$d_ftime" in
15272 "$undef$undef")
15273         echo " "
15274         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15275         ;;
15276 esac
15277
15278 : see if gmtime_r exists
15279 set gmtime_r d_gmtime_r
15280 eval $inlibc
15281 case "$d_gmtime_r" in
15282 "$define")
15283         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15284         case "$d_gmtime_r_proto:$usethreads" in
15285         ":define")      d_gmtime_r_proto=define
15286                 set d_gmtime_r_proto gmtime_r $hdrs
15287                 eval $hasproto ;;
15288         *)      ;;
15289         esac
15290         case "$d_gmtime_r_proto" in
15291         define)
15292         case "$gmtime_r_proto" in
15293         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15294         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15295         esac
15296         case "$gmtime_r_proto" in
15297         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15298         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15299         esac
15300         case "$gmtime_r_proto" in
15301         ''|0)   d_gmtime_r=undef
15302                 gmtime_r_proto=0
15303                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15304         * )     case "$gmtime_r_proto" in
15305                 REENTRANT_PROTO*) ;;
15306                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15307                 esac
15308                 echo "Prototype: $try" ;;
15309         esac
15310         ;;
15311         *)      case "$usethreads" in
15312                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15313                 esac
15314                 d_gmtime_r=undef
15315                 gmtime_r_proto=0
15316                 ;;
15317         esac
15318         ;;
15319 *)      gmtime_r_proto=0
15320         ;;
15321 esac
15322
15323 : see if hasmntopt exists
15324 set hasmntopt d_hasmntopt
15325 eval $inlibc
15326
15327 : see if this is a netinet/in.h or sys/in.h system
15328 set netinet/in.h i_niin sys/in.h i_sysin
15329 eval $inhdr
15330
15331 : see if arpa/inet.h has to be included
15332 set arpa/inet.h i_arpainet
15333 eval $inhdr
15334
15335 : see if htonl --and friends-- exists
15336 val=''
15337 set htonl val
15338 eval $inlibc
15339
15340 : Maybe they are macros.
15341 case "$val" in
15342 $undef)
15343         $cat >htonl.c <<EOM
15344 #include <stdio.h>
15345 #include <sys/types.h>
15346 #$i_niin I_NETINET_IN
15347 #$i_sysin I_SYS_IN
15348 #$i_arpainet I_ARPA_INET
15349 #ifdef I_NETINET_IN
15350 #include <netinet/in.h>
15351 #endif
15352 #ifdef I_SYS_IN
15353 #include <sys/in.h>
15354 #endif
15355 #ifdef I_ARPA_INET
15356 #include <arpa/inet.h>
15357 #endif
15358 #ifdef htonl
15359 printf("Defined as a macro.");
15360 #endif
15361 EOM
15362         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15363         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15364                 val="$define"
15365                 echo "But it seems to be defined as a macro." >&4
15366         fi
15367         $rm -f htonl.?
15368         ;;
15369 esac
15370 set d_htonl
15371 eval $setvar
15372
15373 : see if ilogbl exists
15374 set ilogbl d_ilogbl
15375 eval $inlibc
15376
15377 : index or strchr
15378 echo " "
15379 if set index val -f; eval $csym; $val; then
15380         if set strchr val -f d_strchr; eval $csym; $val; then
15381                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15382                         val="$define"
15383                         vali="$undef"
15384                         echo "strchr() found." >&4
15385                 else
15386                         val="$undef"
15387                         vali="$define"
15388                         echo "index() found." >&4
15389                 fi
15390         else
15391                 val="$undef"
15392                 vali="$define"
15393                 echo "index() found." >&4
15394         fi
15395 else
15396         if set strchr val -f d_strchr; eval $csym; $val; then
15397                 val="$define"
15398                 vali="$undef"
15399                 echo "strchr() found." >&4
15400         else
15401                 echo "No index() or strchr() found!" >&4
15402                 val="$undef"
15403                 vali="$undef"
15404         fi
15405 fi
15406 set d_strchr; eval $setvar
15407 val="$vali"
15408 set d_index; eval $setvar
15409
15410 : check whether inet_aton exists
15411 set inet_aton d_inetaton
15412 eval $inlibc
15413
15414 : see if inet_ntop exists
15415 set inet_ntop d_inetntop
15416 eval $inlibc
15417
15418 : see if inet_pton exists
15419 set inet_pton d_inetpton
15420 eval $inlibc
15421
15422 : Look for isascii
15423 echo " "
15424 $cat >isascii.c <<EOCP
15425 #include <stdio.h>
15426 #include <ctype.h>
15427 #$i_stdlib I_STDLIB
15428 #ifdef I_STDLIB
15429 #include <stdlib.h>
15430 #endif
15431 int main() {
15432         int c = 'A';
15433         if (isascii(c))
15434                 exit(0);
15435         else
15436                 exit(1);
15437 }
15438 EOCP
15439 set isascii
15440 if eval $compile; then
15441         echo "isascii() found." >&4
15442         val="$define"
15443 else
15444         echo "isascii() NOT found." >&4
15445         val="$undef"
15446 fi
15447 set d_isascii
15448 eval $setvar
15449 $rm -f isascii*
15450
15451 : Look for isblank
15452 echo " "
15453 $cat >isblank.c <<'EOCP'
15454 #include <stdio.h>
15455 #include <ctype.h>
15456 int main() {
15457         int c = ' ';
15458         if (isblank(c))
15459                 return 0 ;
15460         else
15461                 return 1 ;
15462 }
15463 EOCP
15464 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15465         echo "isblank() found." >&4
15466         val="$define"
15467 else
15468         echo "isblank() NOT found." >&4
15469         val="$undef"
15470 fi
15471 set d_isblank
15472 eval $setvar
15473 $rm -f isblank*
15474
15475 : see if isfinitel exists
15476 set isfinitel d_isfinitel
15477 eval $inlibc
15478
15479 : see if isinfl exists
15480 set isinfl d_isinfl
15481 eval $inlibc
15482
15483 : see if isnanl exists
15484 set isnanl d_isnanl
15485 eval $inlibc
15486
15487 : see if j0 exists
15488 set j0 d_j0
15489 eval $inlibc
15490
15491 : see if j0l exists
15492 set j0l d_j0l
15493 eval $inlibc
15494
15495 : see if killpg exists
15496 set killpg d_killpg
15497 eval $inlibc
15498
15499 : see if lchown exists
15500 echo " "
15501 $cat > try.c <<'EOCP'
15502 /* System header to define __stub macros and hopefully few prototypes,
15503     which can conflict with char lchown(); below.  */
15504 #include <assert.h>
15505 /* Override any gcc2 internal prototype to avoid an error.  */
15506 /* We use char because int might match the return type of a gcc2
15507    builtin and then its argument prototype would still apply.  */
15508 char lchown();
15509 int main() {
15510     /*  The GNU C library defines this for functions which it implements
15511         to always fail with ENOSYS.  Some functions are actually named
15512         something starting with __ and the normal name is an alias.  */
15513 #if defined (__stub_lchown) || defined (__stub___lchown)
15514 choke me
15515 #else
15516 lchown();
15517 #endif
15518 ; return 0; }
15519 EOCP
15520 set try
15521 if eval $compile; then
15522     $echo "lchown() found." >&4
15523     val="$define"
15524 else
15525     $echo "lchown() NOT found." >&4
15526     val="$undef"
15527 fi
15528 set d_lchown
15529 eval $setvar
15530
15531 : See if number of significant digits in a double precision number is known
15532 echo " "
15533 $cat >ldbl_dig.c <<EOM
15534 #$i_limits I_LIMITS
15535 #$i_float I_FLOAT
15536 #ifdef I_LIMITS
15537 #include <limits.h>
15538 #endif
15539 #ifdef I_FLOAT
15540 #include <float.h>
15541 #endif
15542 #ifdef LDBL_DIG
15543 printf("Contains LDBL_DIG");
15544 #endif
15545 EOM
15546 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15547 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15548         echo "LDBL_DIG found." >&4
15549         val="$define"
15550 else
15551         echo "LDBL_DIG NOT found." >&4
15552         val="$undef"
15553 fi
15554 $rm -f ldbl_dig.?
15555 set d_ldbl_dig
15556 eval $setvar
15557
15558 : see if this is a math.h system
15559 set math.h i_math
15560 eval $inhdr
15561
15562 : check to see if math.h defines _LIB_VERSION
15563 d_libm_lib_version="$undef"
15564 case $i_math in
15565     $define)
15566         echo " "
15567         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15568         $cat >try.c <<EOCP
15569 #include <unistd.h>
15570 #include <math.h>
15571 int main (int argc, char *argv[])
15572 {
15573     printf ("%d\n", _LIB_VERSION);
15574     return (0);
15575     } /* main */
15576 EOCP
15577         set try
15578         if eval $compile; then
15579             foo=`$run ./try`
15580             echo "Yes, it does ($foo)" >&4
15581             d_libm_lib_version="$define"
15582         else
15583             echo "No, it does not (probably harmless)" >&4
15584             fi
15585         $rm_try
15586         ;;
15587
15588     esac
15589
15590 : check for fpclassify
15591 echo " "
15592 echo "Checking to see if you have fpclassify..." >&4
15593 $cat >try.c <<EOCP
15594 #$i_math I_MATH
15595 #ifdef I_MATH
15596 #include <math.h>
15597 #endif
15598 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
15599 EOCP
15600 set try
15601 if eval $compile; then
15602         val="$define"
15603         echo "You have fpclassify."
15604 else
15605         val="$undef"
15606         echo "You do not have fpclassify."
15607 fi
15608 $rm_try
15609 set d_fpclassify
15610 eval $setvar
15611
15612 : check for isfinite
15613 echo " "
15614 echo "Checking to see if you have isfinite..." >&4
15615 $cat >try.c <<EOCP
15616 #$i_math I_MATH
15617 #ifdef I_MATH
15618 #include <math.h>
15619 #endif
15620 int main() { return isfinite(0.0); }
15621 EOCP
15622 set try
15623 if eval $compile; then
15624         val="$define"
15625         echo "You have isfinite."
15626 else
15627         val="$undef"
15628         echo "You do not have isfinite."
15629 fi
15630 $rm_try
15631 set d_isfinite
15632 eval $setvar
15633
15634 : check for isinf
15635 echo " "
15636 echo "Checking to see if you have isinf..." >&4
15637 $cat >try.c <<EOCP
15638 #$i_math I_MATH
15639 #ifdef I_MATH
15640 #include <math.h>
15641 #endif
15642 int main() { return isinf(0.0); }
15643 EOCP
15644 set try
15645 if eval $compile; then
15646         val="$define"
15647         echo "You have isinf."
15648 else
15649         val="$undef"
15650         echo "You do not have isinf."
15651 fi
15652 $rm_try
15653 set d_isinf
15654 eval $setvar
15655
15656 : check for isnan
15657 echo " "
15658 echo "Checking to see if you have isnan..." >&4
15659 $cat >try.c <<EOCP
15660 #$i_math I_MATH
15661 #ifdef I_MATH
15662 #include <math.h>
15663 #endif
15664 int main() { return isnan(0.0); }
15665 EOCP
15666 set try
15667 if eval $compile; then
15668         val="$define"
15669         echo "You have isnan."
15670 else
15671         val="$undef"
15672         echo "You do not have isnan."
15673 fi
15674 $rm_try
15675 set d_isnan
15676 eval $setvar
15677
15678 : see if link exists
15679 set link d_link
15680 eval $inlibc
15681
15682 : see if localtime_r exists
15683 set localtime_r d_localtime_r
15684 eval $inlibc
15685 case "$d_localtime_r" in
15686 "$define")
15687         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15688         case "$d_localtime_r_proto:$usethreads" in
15689         ":define")      d_localtime_r_proto=define
15690                 set d_localtime_r_proto localtime_r $hdrs
15691                 eval $hasproto ;;
15692         *)      ;;
15693         esac
15694         case "$d_localtime_r_proto" in
15695         define)
15696         case "$localtime_r_proto" in
15697         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15698         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15699         esac
15700         case "$localtime_r_proto" in
15701         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15702         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15703         esac
15704         case "$localtime_r_proto" in
15705         ''|0)   d_localtime_r=undef
15706                 localtime_r_proto=0
15707                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15708         * )     case "$localtime_r_proto" in
15709                 REENTRANT_PROTO*) ;;
15710                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15711                 esac
15712                 echo "Prototype: $try" ;;
15713         esac
15714         ;;
15715         *)      case "$usethreads" in
15716                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15717                 esac
15718                 d_localtime_r=undef
15719                 localtime_r_proto=0
15720                 ;;
15721         esac
15722         ;;
15723 *)      localtime_r_proto=0
15724         ;;
15725 esac
15726
15727 : see if localtime_r calls tzset
15728 case "$localtime_r_proto" in
15729 REENTRANT_PROTO*)
15730         $cat >try.c <<EOCP
15731 /*  Does our libc's localtime_r call tzset ?
15732  *  return 0 if so, 1 otherwise.
15733  */
15734 #$i_systypes    I_SYS_TYPES
15735 #$i_unistd      I_UNISTD
15736 #$i_time        I_TIME
15737 #$i_stdlib      I_STDLIB
15738 #$i_string      I_STRING
15739 #$i_malloc      I_MALLOC
15740 #ifdef I_SYS_TYPES
15741 #  include <sys/types.h>
15742 #endif
15743 #ifdef I_UNISTD
15744 #  include <unistd.h>
15745 #endif
15746 #ifdef I_TIME
15747 #  include <time.h>
15748 #endif
15749 #ifdef I_STDLIB
15750 #include <stdlib.h>
15751 #endif
15752 #ifdef I_STRING
15753 #  include <string.h>
15754 #else
15755 #  include <strings.h>
15756 #endif
15757 #ifdef I_MALLOC
15758 #  include <malloc.h>
15759 #endif
15760 int main()
15761 {
15762     time_t t = time(0L);
15763     char w_tz[]="TZ" "=GMT+5",
15764          e_tz[]="TZ" "=GMT-5",
15765         *tz_e = (char*)malloc(16),
15766         *tz_w = (char*)malloc(16);
15767     struct tm tm_e, tm_w;
15768     memset(&tm_e,'\0',sizeof(struct tm));
15769     memset(&tm_w,'\0',sizeof(struct tm));
15770     strcpy(tz_e,e_tz);
15771     strcpy(tz_w,w_tz);
15772
15773     putenv(tz_e);
15774     localtime_r(&t, &tm_e);
15775
15776     putenv(tz_w);
15777     localtime_r(&t, &tm_w);
15778
15779     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15780         return 1;
15781     return 0;
15782 }
15783 EOCP
15784         set try
15785         if eval $compile; then
15786             if $run ./try; then
15787                 d_localtime_r_needs_tzset=undef;
15788             else
15789                 d_localtime_r_needs_tzset=define;
15790             fi;
15791         else
15792             d_localtime_r_needs_tzset=undef;
15793         fi;
15794      ;;
15795   *)
15796      d_localtime_r_needs_tzset=undef;
15797      ;;
15798 esac
15799 $rm_try
15800
15801 : see if localeconv exists
15802 set localeconv d_locconv
15803 eval $inlibc
15804
15805 : see if lockf exists
15806 set lockf d_lockf
15807 eval $inlibc
15808
15809 : see if prototype for lseek is available
15810 echo " "
15811 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15812 eval $hasproto
15813
15814 : see if lstat exists
15815 set lstat d_lstat
15816 eval $inlibc
15817
15818 : see if madvise exists
15819 set madvise d_madvise
15820 eval $inlibc
15821
15822 : see if malloc_size exists
15823 set malloc_size d_malloc_size
15824 eval $inlibc
15825
15826 : see if malloc_size_good exists
15827 set malloc_good_size d_malloc_good_size
15828 eval $inlibc
15829
15830 : see if mblen exists
15831 set mblen d_mblen
15832 eval $inlibc
15833
15834 : see if mbstowcs exists
15835 set mbstowcs d_mbstowcs
15836 eval $inlibc
15837
15838 : see if mbtowc exists
15839 set mbtowc d_mbtowc
15840 eval $inlibc
15841
15842 : see if memchr exists
15843 set memchr d_memchr
15844 eval $inlibc
15845
15846 : see if memcmp exists
15847 set memcmp d_memcmp
15848 eval $inlibc
15849
15850 : see if memcpy exists
15851 set memcpy d_memcpy
15852 eval $inlibc
15853
15854 : see if memmove exists
15855 set memmove d_memmove
15856 eval $inlibc
15857
15858 : see if memset exists
15859 set memset d_memset
15860 eval $inlibc
15861
15862 : see if mkdir exists
15863 set mkdir d_mkdir
15864 eval $inlibc
15865
15866 : see if mkdtemp exists
15867 set mkdtemp d_mkdtemp
15868 eval $inlibc
15869
15870 : see if mkfifo exists
15871 set mkfifo d_mkfifo
15872 eval $inlibc
15873
15874 : see if mkstemp exists
15875 set mkstemp d_mkstemp
15876 eval $inlibc
15877
15878 : see if mkstemps exists
15879 set mkstemps d_mkstemps
15880 eval $inlibc
15881
15882 : see if mktime exists
15883 set mktime d_mktime
15884 eval $inlibc
15885
15886 : see if this is a sys/mman.h system
15887 set sys/mman.h i_sysmman
15888 eval $inhdr
15889
15890 : see if mmap exists
15891 set mmap d_mmap
15892 eval $inlibc
15893 : see what shmat returns
15894 : default to something harmless
15895 mmaptype='void *'
15896 case "$i_sysmman$d_mmap" in
15897 "$define$define")
15898         $cat >mmap.c <<'END'
15899 #include <sys/mman.h>
15900 void *mmap();
15901 END
15902         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15903                 mmaptype='void *'
15904         else
15905                 mmaptype='caddr_t'
15906         fi
15907         echo "and it returns ($mmaptype)." >&4
15908         ;;
15909 esac
15910
15911
15912
15913 : see if sqrtl exists
15914 set sqrtl d_sqrtl
15915 eval $inlibc
15916
15917 : see if scalbnl exists
15918 set scalbnl d_scalbnl
15919 eval $inlibc
15920
15921 : see if modfl exists
15922 set modfl d_modfl
15923 eval $inlibc
15924
15925 : see if prototype for modfl is available
15926 echo " "
15927 set d_modflproto modfl $i_math math.h
15928 eval $hasproto
15929
15930 d_modfl_pow32_bug="$undef"
15931
15932 case "$d_longdbl$d_modfl" in
15933 $define$define)
15934         $cat <<EOM
15935 Checking to see whether your modfl() is okay for large values...
15936 EOM
15937 $cat >try.c <<EOCP
15938 #include <math.h>
15939 #include <stdio.h>
15940 EOCP
15941 if $test "X$d_modflproto" != "X$define"; then
15942         $cat >>try.c <<EOCP
15943 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15944 long double modfl (long double, long double *);
15945 EOCP
15946 fi
15947 $cat >>try.c <<EOCP
15948 int main() {
15949     long double nv = 4294967303.15;
15950     long double v, w;
15951     v = modfl(nv, &w);
15952 #ifdef __GLIBC__
15953     printf("glibc");
15954 #endif
15955     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15956     return 0;
15957 }
15958 EOCP
15959         case "$osname:$gccversion" in
15960         aix:)   saveccflags="$ccflags"
15961                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15962         esac
15963         set try
15964         if eval $compile; then
15965                 foo=`$run ./try`
15966                 case "$foo" in
15967                 *" 4294967303.150000 1.150000 4294967302.000000")
15968                         echo >&4 "Your modfl() is broken for large values."
15969                         d_modfl_pow32_bug="$define"
15970                         case "$foo" in
15971                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15972                         ;;
15973                         esac
15974                         ;;
15975                 *" 4294967303.150000 0.150000 4294967303.000000")
15976                         echo >&4 "Your modfl() seems okay for large values."
15977                         ;;
15978                 *)      echo >&4 "I don't understand your modfl() at all."
15979                         d_modfl="$undef"
15980                         ;;
15981                 esac
15982                 $rm_try
15983         else
15984                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15985                 d_modfl="$undef"
15986         fi
15987         case "$osname:$gccversion" in
15988         aix:)   ccflags="$saveccflags" ;; # restore
15989         esac
15990         ;;
15991 esac
15992
15993 if $test "$uselongdouble" = "$define"; then
15994     message=""
15995     if $test "$d_sqrtl" != "$define"; then
15996         message="$message sqrtl"
15997     fi
15998     if $test "$d_modfl" != "$define"; then
15999         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16000             echo "You have both aintl and copysignl, so I can emulate modfl."
16001         else
16002             message="$message modfl"
16003         fi
16004     fi
16005     if $test "$d_frexpl" != "$define"; then
16006         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16007             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16008         else
16009             message="$message frexpl"
16010         fi
16011     fi
16012     if $test "$d_ldexpl" != "$define"; then
16013         message="$message ldexpl"
16014     fi
16015
16016     if $test "$message" != ""; then
16017         $cat <<EOM >&4
16018
16019 *** You requested the use of long doubles but you do not seem to have
16020 *** the following mathematical functions needed for long double support:
16021 ***    $message
16022 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16023 *** Cannot continue, aborting.
16024
16025 EOM
16026
16027         exit 1
16028     fi
16029 fi
16030
16031 : see if mprotect exists
16032 set mprotect d_mprotect
16033 eval $inlibc
16034
16035 : see if msgctl exists
16036 set msgctl d_msgctl
16037 eval $inlibc
16038
16039 : see if msgget exists
16040 set msgget d_msgget
16041 eval $inlibc
16042
16043 : see if msgsnd exists
16044 set msgsnd d_msgsnd
16045 eval $inlibc
16046
16047 : see if msgrcv exists
16048 set msgrcv d_msgrcv
16049 eval $inlibc
16050
16051 : see how much of the 'msg*(2)' library is present.
16052 h_msg=true
16053 echo " "
16054 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16055 *"$undef"*) h_msg=false;;
16056 esac
16057 case "$osname" in
16058 freebsd)
16059     case "`ipcs 2>&1`" in
16060     "SVID messages"*"not configured"*)
16061         echo "Your $osname does not have the msg*(2) configured." >&4
16062         h_msg=false
16063         val="$undef"
16064         set msgctl d_msgctl
16065         eval $setvar
16066         set msgget d_msgget
16067         eval $setvar
16068         set msgsnd d_msgsnd
16069         eval $setvar
16070         set msgrcv d_msgrcv
16071         eval $setvar
16072         ;;
16073     esac
16074     ;;
16075 esac
16076 : we could also check for sys/ipc.h ...
16077 if $h_msg && $test `./findhdr sys/msg.h`; then
16078         echo "You have the full msg*(2) library." >&4
16079         val="$define"
16080 else
16081         echo "You don't have the full msg*(2) library." >&4
16082         val="$undef"
16083 fi
16084 set d_msg
16085 eval $setvar
16086
16087 : Check for msghdr_s
16088 echo " "
16089 echo "Checking to see if your system supports struct msghdr..." >&4
16090 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16091 eval $hasstruct
16092 case "$d_msghdr_s" in
16093 "$define")      echo "Yes, it does."   ;;
16094 *)              echo "No, it doesn't." ;;
16095 esac
16096
16097
16098 : see if msync exists
16099 set msync d_msync
16100 eval $inlibc
16101
16102 : see if munmap exists
16103 set munmap d_munmap
16104 eval $inlibc
16105
16106 : see if nice exists
16107 set nice d_nice
16108 eval $inlibc
16109
16110 : see if this is a langinfo.h system
16111 set langinfo.h i_langinfo
16112 eval $inhdr
16113
16114 : see if nl_langinfo exists
16115 set nl_langinfo d_nl_langinfo
16116 eval $inlibc
16117
16118 : check for volatile keyword
16119 echo " "
16120 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16121 $cat >try.c <<'EOCP'
16122 int main()
16123 {
16124         typedef struct _goo_struct goo_struct;
16125         goo_struct * volatile goo = ((goo_struct *)0);
16126         struct _goo_struct {
16127                 long long_int;
16128                 int reg_int;
16129                 char char_var;
16130         };
16131         typedef unsigned short foo_t;
16132         char *volatile foo;
16133         volatile int bar;
16134         volatile foo_t blech;
16135         foo = foo;
16136 }
16137 EOCP
16138 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16139         val="$define"
16140         echo "Yup, it does."
16141 else
16142         val="$undef"
16143         echo "Nope, it doesn't."
16144 fi
16145 set d_volatile
16146 eval $setvar
16147 $rm_try
16148
16149 : Check basic sizes
16150 echo " "
16151 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16152
16153 case "$use64bitint:$d_quad:$quadtype" in
16154 define:define:?*)
16155         ivtype="$quadtype"
16156         uvtype="$uquadtype"
16157         ivsize=8
16158         uvsize=8
16159         ;;
16160 *)      ivtype="long"
16161         uvtype="unsigned long"
16162         ivsize=$longsize
16163         uvsize=$longsize
16164         ;;
16165 esac
16166
16167 case "$uselongdouble:$d_longdbl" in
16168 define:define)
16169         nvtype="long double"
16170         nvsize=$longdblsize
16171         ;;
16172 *)      nvtype=double
16173         nvsize=$doublesize
16174         ;;
16175 esac
16176
16177 $echo "(IV will be "$ivtype", $ivsize bytes)"
16178 $echo "(UV will be "$uvtype", $uvsize bytes)"
16179 $echo "(NV will be "$nvtype", $nvsize bytes)"
16180
16181 $cat >try.c <<EOCP
16182 #$i_inttypes I_INTTYPES
16183 #ifdef I_INTTYPES
16184 #include <inttypes.h>
16185 #endif
16186 #include <stdio.h>
16187 int main() {
16188 #ifdef INT8
16189    int8_t i =  INT8_MAX;
16190   uint8_t u = UINT8_MAX;
16191   printf("int8_t\n");
16192 #endif
16193 #ifdef INT16
16194    int16_t i =  INT16_MAX;
16195   uint16_t u = UINT16_MAX;
16196   printf("int16_t\n");
16197 #endif
16198 #ifdef INT32
16199    int32_t i =  INT32_MAX;
16200   uint32_t u = UINT32_MAX;
16201   printf("int32_t\n");
16202 #endif
16203 }
16204 EOCP
16205
16206 i8type="signed char"
16207 u8type="unsigned char"
16208 i8size=1
16209 u8size=1
16210
16211 case "$i16type" in
16212 '')     case "$shortsize" in
16213         2)      i16type=short
16214                 u16type="unsigned short"
16215                 i16size=$shortsize
16216                 u16size=$shortsize
16217                 ;;
16218         esac
16219         ;;
16220 esac
16221 case "$i16type" in
16222 '')     set try -DINT16
16223         if eval $compile; then
16224                 case "`$run ./try`" in
16225                 int16_t)
16226                         i16type=int16_t
16227                         u16type=uint16_t
16228                         i16size=2
16229                         u16size=2
16230                         ;;
16231                 esac
16232         fi
16233         ;;
16234 esac
16235 case "$i16type" in
16236 '')     if $test $shortsize -ge 2; then
16237                 i16type=short
16238                 u16type="unsigned short"
16239                 i16size=$shortsize
16240                 u16size=$shortsize
16241         fi
16242         ;;
16243 esac
16244
16245 case "$i32type" in
16246 '')     case "$longsize" in
16247         4)      i32type=long
16248                 u32type="unsigned long"
16249                 i32size=$longsize
16250                 u32size=$longsize
16251                 ;;
16252         *)      case "$intsize" in
16253                 4)      i32type=int
16254                         u32type="unsigned int"
16255                         i32size=$intsize
16256                         u32size=$intsize
16257                         ;;
16258                 esac
16259                 ;;
16260         esac
16261         ;;
16262 esac
16263 case "$i32type" in
16264 '')     set try -DINT32
16265         if eval $compile; then
16266                 case "`$run ./try`" in
16267                 int32_t)
16268                         i32type=int32_t
16269                         u32type=uint32_t
16270                         i32size=4
16271                         u32size=4
16272                         ;;
16273                 esac
16274         fi
16275         ;;
16276 esac
16277 case "$i32type" in
16278 '')     if $test $intsize -ge 4; then
16279                 i32type=int
16280                 u32type="unsigned int"
16281                 i32size=$intsize
16282                 u32size=$intsize
16283         fi
16284         ;;
16285 esac
16286
16287 case "$i64type" in
16288 '')     case "$d_quad:$quadtype" in
16289         define:?*)
16290                 i64type="$quadtype"
16291                 u64type="$uquadtype"
16292                 i64size=8
16293                 u64size=8
16294                 ;;
16295         esac
16296         ;;
16297 esac
16298
16299 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16300 : volatile so that the compiler has to store it out to memory.
16301 if test X"$d_volatile" = X"$define"; then
16302         volatile=volatile
16303 fi
16304 $cat <<EOP >try.c
16305 #include <stdio.h>
16306 #$i_stdlib I_STDLIB
16307 #ifdef I_STDLIB
16308 #include <stdlib.h>
16309 #endif
16310 #include <sys/types.h>
16311 #include <signal.h>
16312 #ifdef SIGFPE
16313 $volatile int bletched = 0;
16314 $signal_t blech(int s) { bletched = 1; }
16315 #endif
16316 int main() {
16317     $uvtype u = 0;
16318     $nvtype d;
16319     int     n = 8 * $uvsize;
16320     int     i;
16321 #ifdef SIGFPE
16322     signal(SIGFPE, blech);
16323 #endif
16324
16325     for (i = 0; i < n; i++) {
16326       u = u << 1 | ($uvtype)1;
16327       d = ($nvtype)u;
16328       if (($uvtype)d != u)
16329         break;
16330       if (d <= 0)
16331         break;
16332       d = ($nvtype)(u - 1);
16333       if (($uvtype)d != (u - 1))
16334         break;
16335 #ifdef SIGFPE
16336       if (bletched)
16337         break;
16338 #endif
16339     }
16340     printf("%d\n", ((i == n) ? -n : i));
16341     exit(0);
16342 }
16343 EOP
16344 set try
16345
16346 d_nv_preserves_uv="$undef"
16347 if eval $compile; then
16348         nv_preserves_uv_bits="`$run ./try`"
16349 fi
16350 case "$nv_preserves_uv_bits" in
16351 \-[1-9]*)
16352         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16353         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16354         d_nv_preserves_uv="$define"
16355         ;;
16356 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16357         d_nv_preserves_uv="$undef" ;;
16358 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16359         nv_preserves_uv_bits="0" ;;
16360 esac
16361 $rm_try
16362
16363 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16364 : volatile so that the compiler has to store it out to memory.
16365 if test X"$d_volatile" = X"$define"; then
16366         volatile=volatile
16367 fi
16368 $cat <<EOP >try.c
16369 #include <stdio.h>
16370
16371 typedef $nvtype NV;
16372
16373 int
16374 main() {
16375   NV value = 2;
16376   int count = 1;
16377
16378   while(count < 256) {
16379     $volatile NV up = value + 1.0;
16380     $volatile NV negated = -value;
16381     $volatile NV down = negated - 1.0;
16382     $volatile NV got_up = up - value;
16383     int up_good = got_up == 1.0;
16384     int got_down = down - negated;
16385     int down_good = got_down == -1.0;
16386
16387     if (down_good != up_good) {
16388       fprintf(stderr,
16389               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16390               up_good, (double) got_up, down_good, (double) got_down,
16391               count, (double) value);
16392       return 1;
16393     }
16394     if (!up_good) {
16395       while (1) {
16396         if (count > 8) {
16397           count -= 8;
16398           fputs("256.0", stdout);
16399         } else {
16400           count--;
16401           fputs("2.0", stdout);
16402         }
16403         if (!count) {
16404           puts("");
16405           return 0;
16406         }
16407         fputs("*", stdout);
16408       }
16409     }
16410     value *= 2;
16411     ++count;
16412   }
16413   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16414           count, (double) value);
16415   return 1;
16416 }
16417 EOP
16418 set try
16419
16420 nv_overflows_integers_at='0'
16421 if eval $compile; then
16422     xxx="`$run ./try`"
16423     case "$?" in
16424         0)
16425             case "$xxx" in
16426                 2*)  cat >&4 <<EOM
16427 The largest integer your NVs can preserve is equal to $xxx
16428 EOM
16429                     nv_overflows_integers_at="$xxx"
16430                     ;;
16431                 *)  cat >&4 <<EOM
16432 Cannot determine the largest integer value your NVs can hold, unexpected output
16433 '$xxx'
16434 EOM
16435                     ;;
16436             esac
16437             ;;
16438         *)  cat >&4 <<EOM
16439 Cannot determine the largest integer value your NVs can hold
16440 EOM
16441             ;;
16442     esac
16443 fi
16444 $rm_try
16445
16446 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16447 : volatile so that the compiler has to store it out to memory.
16448 if test X"$d_volatile" = X"$define"; then
16449         volatile=volatile
16450 fi
16451 $cat <<EOP >try.c
16452 #include <stdio.h>
16453 #$i_stdlib I_STDLIB
16454 #ifdef I_STDLIB
16455 #include <stdlib.h>
16456 #endif
16457 #$i_string I_STRING
16458 #ifdef I_STRING
16459 #  include <string.h>
16460 #else
16461 #  include <strings.h>
16462 #endif
16463 #include <sys/types.h>
16464 #include <signal.h>
16465 #ifdef SIGFPE
16466 $volatile int bletched = 0;
16467 $signal_t blech(int s) { bletched = 1; }
16468 #endif
16469
16470 int checkit($nvtype d, char *where) {
16471     unsigned char *p = (char *)&d;
16472     unsigned char *end = p + sizeof(d);
16473     int fail = 0;
16474
16475     while (p < end)
16476         fail += *p++;
16477
16478     if (!fail)
16479         return 0;
16480
16481     p = (char *)&d;
16482     printf("No - %s: 0x", where);
16483     while (p < end)
16484         printf ("%02X", *p++);
16485     printf("\n");
16486     return 1;
16487 }
16488
16489 int main(int argc, char **argv) {
16490     $nvtype d = 0.0;
16491     int fail = 0;
16492     fail += checkit(d, "0.0");
16493
16494     /* The compiler shouldn't be assuming that bletched is 0  */
16495     d = bletched;
16496
16497     fail += checkit(d, "bleched");
16498
16499 #ifdef SIGFPE
16500     signal(SIGFPE, blech);
16501 #endif
16502
16503     /* Paranoia - the compiler should have no way of knowing that ANSI says
16504        that argv[argc] will always be NULL.  Actually, if it did assume this it
16505        would be buggy, as this is C and main() can be called from elsewhere in
16506        the program.  */
16507     d = argv[argc] ? 1 : 0;
16508
16509     if (d) {
16510         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16511     }
16512
16513     fail += checkit(d, "ternary");
16514
16515     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16516
16517     if (d != 0.0) {
16518         printf("No - memset doesn't give 0.0\n");
16519         /* This might just blow up:  */
16520         printf("(gives %g)\n", d);
16521         return 1;
16522     }
16523
16524 #ifdef SIGFPE
16525     if (bletched) {
16526         printf("No - something bleched\n");
16527         return 1;
16528     }
16529 #endif
16530     if (fail) {
16531       printf("No - %d fail(s)\n", fail);
16532       return 1;
16533     }
16534     printf("Yes\n");
16535     return 0;
16536 }
16537 EOP
16538 set try
16539
16540 d_nv_zero_is_allbits_zero="$undef"
16541 if eval $compile; then
16542     xxx="`$run ./try`"
16543     case "$?" in
16544         0)
16545             case "$xxx" in
16546                 Yes)  cat >&4 <<EOM
16547 0.0 is represented as all bits zero in memory
16548 EOM
16549                     d_nv_zero_is_allbits_zero="$define"
16550                     ;;
16551                 *)  cat >&4 <<EOM
16552 0.0 is not represented as all bits zero in memory
16553 EOM
16554                     d_nv_zero_is_allbits_zero="$undef"
16555                     ;;
16556             esac
16557             ;;
16558         *)  cat >&4 <<EOM
16559 0.0 is not represented as all bits zero in memory
16560 EOM
16561             d_nv_zero_is_allbits_zero="$undef"
16562             ;;
16563     esac
16564 fi
16565 $rm_try
16566
16567 : check for off64_t
16568 echo " "
16569 echo "Checking to see if you have off64_t..." >&4
16570 $cat >try.c <<EOCP
16571 #include <sys/types.h>
16572 #include <unistd.h>
16573 int main() { off64_t x = 7; }
16574 EOCP
16575 set try
16576 if eval $compile; then
16577         val="$define"
16578         echo "You have off64_t."
16579 else
16580         val="$undef"
16581         echo "You do not have off64_t."
16582         case "$lseeksize" in
16583         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16584         esac
16585 fi
16586 $rm_try
16587 set d_off64_t
16588 eval $setvar
16589
16590 : how to create joinable pthreads
16591 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16592         echo " "
16593         echo "Checking what constant to use for creating joinable pthreads..." >&4
16594         $cat >try.c <<'EOCP'
16595 #include <pthread.h>
16596 int main() {
16597     int detachstate = JOINABLE;
16598 }
16599 EOCP
16600         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16601         if eval $compile; then
16602                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16603                 val="$undef" # Yes, undef.
16604                 set d_old_pthread_create_joinable
16605                 eval $setvar
16606                 val=""
16607                 set old_pthread_create_joinable
16608                 eval $setvar
16609         else
16610                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16611                 if eval $compile; then
16612                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16613                         val="$define"
16614                         set d_old_pthread_create_joinable
16615                         eval $setvar
16616                         val=PTHREAD_CREATE_UNDETACHED
16617                         set old_pthread_create_joinable
16618                         eval $setvar
16619                 else
16620                         set try -DJOINABLE=__UNDETACHED
16621                         if eval $compile; then
16622                                 echo "You seem to use __UNDETACHED." >&4
16623                                 val="$define"
16624                                 set d_old_pthread_create_joinable
16625                                 eval $setvar
16626                                 val=__UNDETACHED
16627                                 set old_pthread_create_joinable
16628                                 eval $setvar
16629                         else
16630                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16631                                 val="$define"
16632                                 set d_old_pthread_create_joinable
16633                                 eval $setvar
16634                                 val=0
16635                                 set old_pthread_create_joinable
16636                                 eval $setvar
16637                         fi
16638                 fi
16639         fi
16640         $rm_try
16641 else
16642     d_old_pthread_create_joinable="$undef"
16643     old_pthread_create_joinable=""
16644 fi
16645
16646 : see if pause exists
16647 set pause d_pause
16648 eval $inlibc
16649
16650 : see if poll exists
16651 set poll d_poll
16652 eval $inlibc
16653
16654 : see if prctl exists
16655 set prctl d_prctl
16656 eval $inlibc
16657
16658 : see if prctl supports PR_SET_NAME
16659 d_prctl_set_name=$undef
16660 case $d_prctl in
16661     $define)
16662         $cat >try.c <<EOM
16663 #ifdef __ANDROID__
16664 #include <unistd.h>
16665 #endif
16666 #include <sys/prctl.h>
16667
16668 int main (int argc, char *argv[])
16669 {
16670     return (prctl (PR_SET_NAME, "Test"));
16671     } /* main */
16672 EOM
16673         set try
16674         if eval $compile_ok && $run ./try; then
16675             echo "Your prctl (PR_SET_NAME, ...) works"
16676             d_prctl_set_name=$define
16677             fi
16678         $rm_try
16679         ;;
16680     esac
16681
16682 : see if readlink exists
16683 set readlink d_readlink
16684 eval $inlibc
16685
16686 : Check if exe is symlink to abs path of executing program
16687 echo " "
16688 procselfexe=''
16689 val="$undef"
16690 case "$d_readlink" in
16691     "$define")
16692         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16693         : more tidy to avoid an extra level of symlink
16694         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16695         while test $# -gt 0; do
16696             type=$1; try=$2
16697             shift; shift
16698             if $issymlink $try; then
16699                 $ls -l $try > reflect
16700                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16701                     echo "You have $type-like $try."
16702                     procselfexe='"'$try'"'
16703                     val="$define"
16704                     : This will break out of the loop
16705                     set X; shift
16706                 fi
16707             fi
16708         done
16709         ;;
16710 esac
16711 $rm -f reflect
16712 set d_procselfexe
16713 eval $setvar
16714
16715 : backward compatibility for d_hvfork
16716 if test X$d_hvfork != X; then
16717         d_vfork="$d_hvfork"
16718         d_hvfork=''
16719 fi
16720 : see if there is a vfork
16721 val=''
16722 set vfork val
16723 eval $inlibc
16724
16725 d_pseudofork=$undef
16726
16727 : Ok, but do we want to use it. vfork is reportedly unreliable in
16728 : perl on Solaris 2.x, and probably elsewhere.
16729 case "$val" in
16730 $define)
16731         echo " "
16732         case "$usevfork" in
16733         false) dflt='n';;
16734         *) dflt='y';;
16735         esac
16736         cat <<'EOM'
16737
16738 Perl can only use a vfork() that doesn't suffer from strict
16739 restrictions on calling functions or modifying global data in
16740 the child.  For example, glibc-2.1 contains such a vfork()
16741 that is unsuitable.  If your system provides a proper fork()
16742 call, chances are that you do NOT want perl to use vfork().
16743
16744 EOM
16745         rp="Do you still want to use vfork()?"
16746         . ./myread
16747         case "$ans" in
16748         y|Y) ;;
16749         *)
16750                 echo "Ok, we won't use vfork()."
16751                 val="$undef"
16752                 ;;
16753         esac
16754         ;;
16755 esac
16756 set d_vfork
16757 eval $setvar
16758 case "$d_vfork" in
16759 $define) usevfork='true';;
16760 *) usevfork='false';;
16761 esac
16762
16763 : see whether the pthread_atfork exists
16764 $cat >try.c <<EOP
16765 #include <pthread.h>
16766 #include <stdio.h>
16767 int main() {
16768 #ifdef  PTHREAD_ATFORK
16769         pthread_atfork(NULL,NULL,NULL);
16770 #endif
16771 }
16772 EOP
16773
16774 : see if pthread_atfork exists
16775 set try -DPTHREAD_ATFORK
16776 if eval $compile; then
16777     val="$define"
16778 else
16779     val="$undef"
16780 fi
16781 case "$usethreads" in
16782 $define)
16783         case "$val" in
16784         $define) echo 'pthread_atfork found.' >&4        ;;
16785         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16786         esac
16787 esac
16788 set d_pthread_atfork
16789 eval $setvar
16790
16791 : see if pthread_attr_setscope exists
16792 set pthread_attr_setscope d_pthread_attr_setscope
16793 eval $inlibc
16794
16795 : see whether the various POSIXish _yields exist
16796 $cat >try.c <<EOP
16797 #include <pthread.h>
16798 #include <stdio.h>
16799 int main() {
16800 #ifdef SCHED_YIELD
16801         sched_yield();
16802 #else
16803 #ifdef PTHREAD_YIELD
16804         pthread_yield();
16805 #else
16806 #ifdef PTHREAD_YIELD_NULL
16807         pthread_yield(NULL);
16808 #endif
16809 #endif
16810 #endif
16811 }
16812 EOP
16813 : see if sched_yield exists
16814 set try -DSCHED_YIELD
16815 if eval $compile; then
16816     val="$define"
16817     sched_yield='sched_yield()'
16818 else
16819     val="$undef"
16820 fi
16821 case "$usethreads" in
16822 $define)
16823         case "$val" in
16824         $define) echo 'sched_yield() found.' >&4        ;;
16825         *)       echo 'sched_yield() NOT found.' >&4    ;;
16826         esac
16827 esac
16828 set d_sched_yield
16829 eval $setvar
16830
16831 : see if pthread_yield exists
16832 set try -DPTHREAD_YIELD
16833 if eval $compile; then
16834     val="$define"
16835     case "$sched_yield" in
16836     '') sched_yield='pthread_yield()' ;;
16837     esac
16838 else
16839     set try -DPTHREAD_YIELD_NULL
16840     if eval $compile; then
16841         val="$define"
16842         case "$sched_yield" in
16843         '') sched_yield='pthread_yield(NULL)' ;;
16844         esac
16845     else
16846         val="$undef"
16847     fi
16848 fi
16849 case "$usethreads" in
16850 $define)
16851         case "$val" in
16852         $define) echo 'pthread_yield() found.' >&4      ;;
16853         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16854         esac
16855         ;;
16856 esac
16857 set d_pthread_yield
16858 eval $setvar
16859 case "$sched_yield" in
16860 '') sched_yield=undef ;;
16861 esac
16862 $rm_try
16863
16864 : check for ptrdiff_t
16865 echo " "
16866 echo "Checking to see if you have ptrdiff_t..." >&4
16867 $cat >try.c <<EOCP
16868 #include <stddef.h>
16869 int main() { ptrdiff_t x = 7; }
16870 EOCP
16871 set try
16872 if eval $compile; then
16873         val="$define"
16874         echo "You have ptrdiff_t."
16875 else
16876         val="$undef"
16877         echo "You do not have ptrdiff_t."
16878 fi
16879 $rm_try
16880 set d_ptrdiff_t
16881 eval $setvar
16882
16883 : see if random_r exists
16884 set random_r d_random_r
16885 eval $inlibc
16886 case "$d_random_r" in
16887 "$define")
16888         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16889         case "$d_random_r_proto:$usethreads" in
16890         ":define")      d_random_r_proto=define
16891                 set d_random_r_proto random_r $hdrs
16892                 eval $hasproto ;;
16893         *)      ;;
16894         esac
16895         case "$d_random_r_proto" in
16896         define)
16897         case "$random_r_proto" in
16898         ''|0) try='int random_r(int*, struct random_data*);'
16899         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16900         esac
16901         case "$random_r_proto" in
16902         ''|0) try='int random_r(long*, struct random_data*);'
16903         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16904         esac
16905         case "$random_r_proto" in
16906         ''|0) try='int random_r(struct random_data*, int32_t*);'
16907         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16908         esac
16909         case "$random_r_proto" in
16910         ''|0)   d_random_r=undef
16911                 random_r_proto=0
16912                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16913         * )     case "$random_r_proto" in
16914                 REENTRANT_PROTO*) ;;
16915                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16916                 esac
16917                 echo "Prototype: $try" ;;
16918         esac
16919         ;;
16920         *)      case "$usethreads" in
16921                 define) echo "random_r has no prototype, not using it." >&4 ;;
16922                 esac
16923                 d_random_r=undef
16924                 random_r_proto=0
16925                 ;;
16926         esac
16927         ;;
16928 *)      random_r_proto=0
16929         ;;
16930 esac
16931
16932 : see if readdir and friends exist
16933 set readdir d_readdir
16934 eval $inlibc
16935 set seekdir d_seekdir
16936 eval $inlibc
16937 set telldir d_telldir
16938 eval $inlibc
16939 set rewinddir d_rewinddir
16940 eval $inlibc
16941
16942 : see if readdir64_r exists
16943 set readdir64_r d_readdir64_r
16944 eval $inlibc
16945 case "$d_readdir64_r" in
16946 "$define")
16947         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16948         case "$d_readdir64_r_proto:$usethreads" in
16949         ":define")      d_readdir64_r_proto=define
16950                 set d_readdir64_r_proto readdir64_r $hdrs
16951                 eval $hasproto ;;
16952         *)      ;;
16953         esac
16954         case "$d_readdir64_r_proto" in
16955         define)
16956         case "$readdir64_r_proto" in
16957         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16958         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16959         esac
16960         case "$readdir64_r_proto" in
16961         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16962         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16963         esac
16964         case "$readdir64_r_proto" in
16965         ''|0)   d_readdir64_r=undef
16966                 readdir64_r_proto=0
16967                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16968         * )     case "$readdir64_r_proto" in
16969                 REENTRANT_PROTO*) ;;
16970                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16971                 esac
16972                 echo "Prototype: $try" ;;
16973         esac
16974         ;;
16975         *)      case "$usethreads" in
16976                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16977                 esac
16978                 d_readdir64_r=undef
16979                 readdir64_r_proto=0
16980                 ;;
16981         esac
16982         ;;
16983 *)      readdir64_r_proto=0
16984         ;;
16985 esac
16986
16987 : see if readdir_r exists
16988 set readdir_r d_readdir_r
16989 eval $inlibc
16990 case "$d_readdir_r" in
16991 "$define")
16992         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16993         case "$d_readdir_r_proto:$usethreads" in
16994         ":define")      d_readdir_r_proto=define
16995                 set d_readdir_r_proto readdir_r $hdrs
16996                 eval $hasproto ;;
16997         *)      ;;
16998         esac
16999         case "$d_readdir_r_proto" in
17000         define)
17001         case "$readdir_r_proto" in
17002         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17003         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17004         esac
17005         case "$readdir_r_proto" in
17006         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17007         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17008         esac
17009         case "$readdir_r_proto" in
17010         ''|0)   d_readdir_r=undef
17011                 readdir_r_proto=0
17012                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17013         * )     case "$readdir_r_proto" in
17014                 REENTRANT_PROTO*) ;;
17015                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17016                 esac
17017                 echo "Prototype: $try" ;;
17018         esac
17019         ;;
17020         *)      case "$usethreads" in
17021                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17022                 esac
17023                 d_readdir_r=undef
17024                 readdir_r_proto=0
17025                 ;;
17026         esac
17027         ;;
17028 *)      readdir_r_proto=0
17029         ;;
17030 esac
17031
17032 : see if readv exists
17033 set readv d_readv
17034 eval $inlibc
17035
17036 : see if recvmsg exists
17037 set recvmsg d_recvmsg
17038 eval $inlibc
17039
17040 : see if rename exists
17041 set rename d_rename
17042 eval $inlibc
17043
17044 : see if rmdir exists
17045 set rmdir d_rmdir
17046 eval $inlibc
17047
17048 : see if memory.h is available.
17049 val=''
17050 set memory.h val
17051 eval $inhdr
17052
17053 : See if it conflicts with string.h
17054 case "$val" in
17055 $define)
17056         case "$strings" in
17057         '') ;;
17058         *)
17059                 $cppstdin $cppflags $cppminus < $strings > mem.h
17060                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17061                         echo " "
17062                         echo "We won't be including <memory.h>."
17063                         val="$undef"
17064                 fi
17065                 $rm -f mem.h
17066                 ;;
17067         esac
17068 esac
17069 set i_memory
17070 eval $setvar
17071
17072 : can bcopy handle overlapping blocks?
17073 echo " "
17074 val="$undef"
17075 case "$d_memmove" in
17076 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17077 *)      case "$d_bcopy" in
17078         "$define")
17079                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17080                 $cat >try.c <<EOCP
17081 #$i_memory I_MEMORY
17082 #$i_stdlib I_STDLIB
17083 #$i_string I_STRING
17084 #$i_unistd I_UNISTD
17085 EOCP
17086         $cat >>try.c <<'EOCP'
17087 #include <stdio.h>
17088 #ifdef I_MEMORY
17089 #  include <memory.h>
17090 #endif
17091 #ifdef I_STDLIB
17092 #  include <stdlib.h>
17093 #endif
17094 #ifdef I_STRING
17095 #  include <string.h>
17096 #else
17097 #  include <strings.h>
17098 #endif
17099 #ifdef I_UNISTD
17100 #  include <unistd.h>  /* Needed for NetBSD */
17101 #endif
17102 int main()
17103 {
17104 char buf[128], abc[128];
17105 char *b;
17106 int len;
17107 int off;
17108 int align;
17109
17110 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17111    try to store the string in read-only memory. */
17112 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17113
17114 for (align = 7; align >= 0; align--) {
17115         for (len = 36; len; len--) {
17116                 b = buf+align;
17117                 bcopy(abc, b, len);
17118                 for (off = 1; off <= len; off++) {
17119                         bcopy(b, b+off, len);
17120                         bcopy(b+off, b, len);
17121                         if (bcmp(b, abc, len))
17122                                 exit(1);
17123                 }
17124         }
17125 }
17126 exit(0);
17127 }
17128 EOCP
17129                 set try
17130                 if eval $compile_ok; then
17131                         if $run ./try 2>/dev/null; then
17132                                 echo "Yes, it can."
17133                                 val="$define"
17134                         else
17135                                 echo "It can't, sorry."
17136                         fi
17137                 else
17138                         echo "(I can't compile the test program, so we'll assume not...)"
17139                 fi
17140                 ;;
17141         esac
17142         $rm_try
17143         ;;
17144 esac
17145 set d_safebcpy
17146 eval $setvar
17147
17148 : can memcpy handle overlapping blocks?
17149 echo " "
17150 val="$undef"
17151 case "$d_memmove" in
17152 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17153 *)      case "$d_memcpy" in
17154         "$define")
17155                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17156                 $cat >try.c <<EOCP
17157 #$i_memory I_MEMORY
17158 #$i_stdlib I_STDLIB
17159 #$i_string I_STRING
17160 #$i_unistd I_UNISTD
17161 EOCP
17162         $cat >>try.c <<'EOCP'
17163 #include <stdio.h>
17164 #ifdef I_MEMORY
17165 #  include <memory.h>
17166 #endif
17167 #ifdef I_STDLIB
17168 #  include <stdlib.h>
17169 #endif
17170 #ifdef I_STRING
17171 #  include <string.h>
17172 #else
17173 #  include <strings.h>
17174 #endif
17175 #ifdef I_UNISTD
17176 #  include <unistd.h>  /* Needed for NetBSD */
17177 #endif
17178 int main()
17179 {
17180 char buf[128], abc[128];
17181 char *b;
17182 int len;
17183 int off;
17184 int align;
17185
17186 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17187    try to store the string in read-only memory. */
17188 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17189
17190 for (align = 7; align >= 0; align--) {
17191         for (len = 36; len; len--) {
17192                 b = buf+align;
17193                 memcpy(b, abc, len);
17194                 for (off = 1; off <= len; off++) {
17195                         memcpy(b+off, b, len);
17196                         memcpy(b, b+off, len);
17197                         if (memcmp(b, abc, len))
17198                                 exit(1);
17199                 }
17200         }
17201 }
17202 exit(0);
17203 }
17204 EOCP
17205                 set try
17206                 if eval $compile_ok; then
17207                         if $run ./try 2>/dev/null; then
17208                                 echo "Yes, it can."
17209                                 val="$define"
17210                         else
17211                                 echo "It can't, sorry."
17212                         fi
17213                 else
17214                         echo "(I can't compile the test program, so we'll assume not...)"
17215                 fi
17216                 ;;
17217         esac
17218         $rm_try
17219         ;;
17220 esac
17221 set d_safemcpy
17222 eval $setvar
17223
17224 : can memcmp be trusted to compare relative magnitude?
17225 val="$undef"
17226 case "$d_memcmp" in
17227 "$define")
17228         echo " "
17229         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17230         $cat >try.c <<EOCP
17231 #$i_memory I_MEMORY
17232 #$i_stdlib I_STDLIB
17233 #$i_string I_STRING
17234 #$i_unistd I_UNISTD
17235 EOCP
17236         $cat >>try.c <<'EOCP'
17237 #include <stdio.h>
17238 #ifdef I_MEMORY
17239 #  include <memory.h>
17240 #endif
17241 #ifdef I_STDLIB
17242 #  include <stdlib.h>
17243 #endif
17244 #ifdef I_STRING
17245 #  include <string.h>
17246 #else
17247 #  include <strings.h>
17248 #endif
17249 #ifdef I_UNISTD
17250 #  include <unistd.h>  /* Needed for NetBSD */
17251 #endif
17252 int main()
17253 {
17254 char a = -1;
17255 char b = 0;
17256 if ((a < b) && memcmp(&a, &b, 1) < 0)
17257         exit(1);
17258 exit(0);
17259 }
17260 EOCP
17261         set try
17262         if eval $compile_ok; then
17263                 if $run ./try 2>/dev/null; then
17264                         echo "Yes, it can."
17265                         val="$define"
17266                 else
17267                         echo "No, it can't (it uses signed chars)."
17268                 fi
17269         else
17270                 echo "(I can't compile the test program, so we'll assume not...)"
17271         fi
17272         ;;
17273 esac
17274 $rm_try
17275 set d_sanemcmp
17276 eval $setvar
17277
17278 : see if prototype for sbrk is available
17279 echo " "
17280 set d_sbrkproto sbrk $i_unistd unistd.h
17281 eval $hasproto
17282
17283 : see if select exists
17284 set select d_select
17285 eval $inlibc
17286
17287 : see if semctl exists
17288 set semctl d_semctl
17289 eval $inlibc
17290
17291 : see if semget exists
17292 set semget d_semget
17293 eval $inlibc
17294
17295 : see if semop exists
17296 set semop d_semop
17297 eval $inlibc
17298
17299 : see how much of the 'sem*(2)' library is present.
17300 h_sem=true
17301 echo " "
17302 case "$d_semctl$d_semget$d_semop" in
17303 *"$undef"*) h_sem=false;;
17304 esac
17305 case "$osname" in
17306 freebsd)
17307     case "`ipcs 2>&1`" in
17308     "SVID messages"*"not configured"*)
17309         echo "Your $osname does not have the sem*(2) configured." >&4
17310         h_sem=false
17311         val="$undef"
17312         set semctl d_semctl
17313         eval $setvar
17314         set semget d_semget
17315         eval $setvar
17316         set semop d_semop
17317         eval $setvar
17318         ;;
17319     esac
17320     ;;
17321 esac
17322 : we could also check for sys/ipc.h ...
17323 if $h_sem && $test `./findhdr sys/sem.h`; then
17324         echo "You have the full sem*(2) library." >&4
17325         val="$define"
17326 else
17327         echo "You don't have the full sem*(2) library." >&4
17328         val="$undef"
17329 fi
17330 set d_sem
17331 eval $setvar
17332
17333 : see whether sys/sem.h defines union semun
17334 echo " "
17335 $cat > try.c <<'END'
17336 #include <sys/types.h>
17337 #include <sys/ipc.h>
17338 #include <sys/sem.h>
17339 int main () { union semun semun; semun.buf = 0; }
17340 END
17341 set try
17342 if eval $compile; then
17343     echo "You have union semun in <sys/sem.h>." >&4
17344     val="$define"
17345 else
17346     echo "You do not have union semun in <sys/sem.h>." >&4
17347     val="$undef"
17348 fi
17349 $rm_try
17350 set d_union_semun
17351 eval $setvar
17352
17353 : see how to do semctl IPC_STAT
17354 case "$d_sem" in
17355 $define)
17356     echo " "
17357     $cat > tryh.h <<END
17358 #ifndef S_IRUSR
17359 #   ifdef S_IREAD
17360 #       define S_IRUSR S_IREAD
17361 #       define S_IWUSR S_IWRITE
17362 #       define S_IXUSR S_IEXEC
17363 #   else
17364 #       define S_IRUSR 0400
17365 #       define S_IWUSR 0200
17366 #       define S_IXUSR 0100
17367 #   endif
17368 #   define S_IRGRP (S_IRUSR>>3)
17369 #   define S_IWGRP (S_IWUSR>>3)
17370 #   define S_IXGRP (S_IXUSR>>3)
17371 #   define S_IROTH (S_IRUSR>>6)
17372 #   define S_IWOTH (S_IWUSR>>6)
17373 #   define S_IXOTH (S_IXUSR>>6)
17374 #endif
17375 #ifndef S_IRWXU
17376 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17377 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17378 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17379 #endif
17380 END
17381     : see whether semctl IPC_STAT can use union semun
17382     case "$d_semctl_semun" in
17383     '')
17384       val="$undef"
17385       $cat > try.c <<END
17386 #include <sys/types.h>
17387 #include <sys/ipc.h>
17388 #include <sys/sem.h>
17389 #include <sys/stat.h>
17390 #include <stdio.h>
17391 #include <errno.h>
17392 #include "tryh.h"
17393 #ifndef errno
17394 extern int errno;
17395 #endif
17396 #$d_union_semun HAS_UNION_SEMUN
17397 int main() {
17398     union semun
17399 #ifndef HAS_UNION_SEMUN
17400     {
17401         int val;
17402         struct semid_ds *buf;
17403         unsigned short *array;
17404     }
17405 #endif
17406     arg;
17407     int sem, st;
17408
17409 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17410     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17411     if (sem > -1) {
17412         struct semid_ds argbuf;
17413         arg.buf = &argbuf;
17414 #       ifdef IPC_STAT
17415         st = semctl(sem, 0, IPC_STAT, arg);
17416         if (st == 0)
17417             printf("semun\n");
17418         else
17419 #       endif /* IPC_STAT */
17420             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17421 #       ifdef IPC_RMID
17422         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17423 #       endif /* IPC_RMID */
17424             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17425     } else
17426 #endif /* IPC_PRIVATE && ... */
17427         printf("semget failed: errno = %d\n", errno);
17428   return 0;
17429 }
17430 END
17431       set try
17432       if eval $compile; then
17433           xxx=`$run ./try`
17434           case "$xxx" in
17435           semun) val="$define" ;;
17436           esac
17437       fi
17438       $rm_try
17439       set d_semctl_semun
17440       eval $setvar
17441       ;;
17442     esac
17443     case "$d_semctl_semun" in
17444     $define)
17445         echo "You can use union semun for semctl IPC_STAT." >&4
17446         also='also'
17447         ;;
17448     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17449         also=''
17450         ;;
17451     esac
17452
17453     : see whether semctl IPC_STAT can use struct semid_ds pointer
17454     case "$d_semctl_semid_ds" in
17455     '')
17456       val="$undef"
17457       $cat > try.c <<'END'
17458 #include <sys/types.h>
17459 #include <sys/ipc.h>
17460 #include <sys/sem.h>
17461 #include <sys/stat.h>
17462 #include "tryh.h"
17463 #include <stdio.h>
17464 #include <errno.h>
17465 #ifndef errno
17466 extern int errno;
17467 #endif
17468 int main() {
17469     struct semid_ds arg;
17470     int sem, st;
17471
17472 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17473     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17474     if (sem > -1) {
17475 #       ifdef IPC_STAT
17476         st = semctl(sem, 0, IPC_STAT, &arg);
17477         if (st == 0)
17478             printf("semid_ds\n");
17479         else
17480 #       endif /* IPC_STAT */
17481             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17482 #       ifdef IPC_RMID
17483         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17484 #       endif /* IPC_RMID */
17485             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17486     } else
17487 #endif /* IPC_PRIVATE && ... */
17488         printf("semget failed: errno = %d\n", errno);
17489
17490     return 0;
17491 }
17492 END
17493       set try
17494       if eval $compile; then
17495           xxx=`$run ./try`
17496           case "$xxx" in
17497           semid_ds) val="$define" ;;
17498           esac
17499       fi
17500       $rm_try
17501       set d_semctl_semid_ds
17502       eval $setvar
17503       ;;
17504     esac
17505     case "$d_semctl_semid_ds" in
17506     $define)
17507         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17508         ;;
17509     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17510         ;;
17511     esac
17512     ;;
17513 *)  val="$undef"
17514
17515     # We do not have the full sem*(2) library, so assume we can not
17516     # use either.
17517
17518     set d_semctl_semun
17519     eval $setvar
17520
17521     set d_semctl_semid_ds
17522     eval $setvar
17523     ;;
17524 esac
17525 $rm_try tryh.h
17526
17527 : see if sendmsg exists
17528 set sendmsg d_sendmsg
17529 eval $inlibc
17530
17531 : see if setegid exists
17532 set setegid d_setegid
17533 eval $inlibc
17534
17535 : see if seteuid exists
17536 set seteuid d_seteuid
17537 eval $inlibc
17538
17539 : see if setgrent exists
17540 set setgrent d_setgrent
17541 eval $inlibc
17542
17543 : see if setgrent_r exists
17544 set setgrent_r d_setgrent_r
17545 eval $inlibc
17546 case "$d_setgrent_r" in
17547 "$define")
17548         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17549         case "$d_setgrent_r_proto:$usethreads" in
17550         ":define")      d_setgrent_r_proto=define
17551                 set d_setgrent_r_proto setgrent_r $hdrs
17552                 eval $hasproto ;;
17553         *)      ;;
17554         esac
17555         case "$d_setgrent_r_proto" in
17556         define)
17557         case "$setgrent_r_proto" in
17558         ''|0) try='int setgrent_r(FILE**);'
17559         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17560         esac
17561         case "$setgrent_r_proto" in
17562         ''|0) try='void setgrent_r(FILE**);'
17563         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17564         esac
17565         case "$setgrent_r_proto" in
17566         ''|0)   d_setgrent_r=undef
17567                 setgrent_r_proto=0
17568                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17569         * )     case "$setgrent_r_proto" in
17570                 REENTRANT_PROTO*) ;;
17571                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17572                 esac
17573                 echo "Prototype: $try" ;;
17574         esac
17575         ;;
17576         *)      case "$usethreads" in
17577                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17578                 esac
17579                 d_setgrent_r=undef
17580                 setgrent_r_proto=0
17581                 ;;
17582         esac
17583         ;;
17584 *)      setgrent_r_proto=0
17585         ;;
17586 esac
17587
17588 : see if sethostent exists
17589 set sethostent d_sethent
17590 eval $inlibc
17591
17592 : see if sethostent_r exists
17593 set sethostent_r d_sethostent_r
17594 eval $inlibc
17595 case "$d_sethostent_r" in
17596 "$define")
17597         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17598         case "$d_sethostent_r_proto:$usethreads" in
17599         ":define")      d_sethostent_r_proto=define
17600                 set d_sethostent_r_proto sethostent_r $hdrs
17601                 eval $hasproto ;;
17602         *)      ;;
17603         esac
17604         case "$d_sethostent_r_proto" in
17605         define)
17606         case "$sethostent_r_proto" in
17607         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17608         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17609         esac
17610         case "$sethostent_r_proto" in
17611         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17612         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17613         esac
17614         case "$sethostent_r_proto" in
17615         ''|0)   d_sethostent_r=undef
17616                 sethostent_r_proto=0
17617                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17618         * )     case "$sethostent_r_proto" in
17619                 REENTRANT_PROTO*) ;;
17620                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17621                 esac
17622                 echo "Prototype: $try" ;;
17623         esac
17624         ;;
17625         *)      case "$usethreads" in
17626                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17627                 esac
17628                 d_sethostent_r=undef
17629                 sethostent_r_proto=0
17630                 ;;
17631         esac
17632         ;;
17633 *)      sethostent_r_proto=0
17634         ;;
17635 esac
17636
17637 : see if setitimer exists
17638 set setitimer d_setitimer
17639 eval $inlibc
17640
17641 : see if setlinebuf exists
17642 set setlinebuf d_setlinebuf
17643 eval $inlibc
17644
17645 : see if setlocale exists
17646 set setlocale d_setlocale
17647 eval $inlibc
17648
17649 : see if locale.h is available
17650 set locale.h i_locale
17651 eval $inhdr
17652
17653 : see if setlocale_r exists
17654 set setlocale_r d_setlocale_r
17655 eval $inlibc
17656 case "$d_setlocale_r" in
17657 "$define")
17658         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17659         case "$d_setlocale_r_proto:$usethreads" in
17660         ":define")      d_setlocale_r_proto=define
17661                 set d_setlocale_r_proto setlocale_r $hdrs
17662                 eval $hasproto ;;
17663         *)      ;;
17664         esac
17665         case "$d_setlocale_r_proto" in
17666         define)
17667         case "$setlocale_r_proto" in
17668         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17669         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17670         esac
17671         case "$setlocale_r_proto" in
17672         ''|0)   d_setlocale_r=undef
17673                 setlocale_r_proto=0
17674                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17675         * )     case "$setlocale_r_proto" in
17676                 REENTRANT_PROTO*) ;;
17677                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17678                 esac
17679                 echo "Prototype: $try" ;;
17680         esac
17681         ;;
17682         *)      case "$usethreads" in
17683                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17684                 esac
17685                 d_setlocale_r=undef
17686                 setlocale_r_proto=0
17687                 ;;
17688         esac
17689         ;;
17690 *)      setlocale_r_proto=0
17691         ;;
17692 esac
17693
17694 : see if setnetent exists
17695 set setnetent d_setnent
17696 eval $inlibc
17697
17698 : see if setnetent_r exists
17699 set setnetent_r d_setnetent_r
17700 eval $inlibc
17701 case "$d_setnetent_r" in
17702 "$define")
17703         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17704         case "$d_setnetent_r_proto:$usethreads" in
17705         ":define")      d_setnetent_r_proto=define
17706                 set d_setnetent_r_proto setnetent_r $hdrs
17707                 eval $hasproto ;;
17708         *)      ;;
17709         esac
17710         case "$d_setnetent_r_proto" in
17711         define)
17712         case "$setnetent_r_proto" in
17713         ''|0) try='int setnetent_r(int, struct netent_data*);'
17714         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17715         esac
17716         case "$setnetent_r_proto" in
17717         ''|0) try='void setnetent_r(int, struct netent_data*);'
17718         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17719         esac
17720         case "$setnetent_r_proto" in
17721         ''|0)   d_setnetent_r=undef
17722                 setnetent_r_proto=0
17723                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17724         * )     case "$setnetent_r_proto" in
17725                 REENTRANT_PROTO*) ;;
17726                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17727                 esac
17728                 echo "Prototype: $try" ;;
17729         esac
17730         ;;
17731         *)      case "$usethreads" in
17732                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17733                 esac
17734                 d_setnetent_r=undef
17735                 setnetent_r_proto=0
17736                 ;;
17737         esac
17738         ;;
17739 *)      setnetent_r_proto=0
17740         ;;
17741 esac
17742
17743 : see if setprotoent exists
17744 set setprotoent d_setpent
17745 eval $inlibc
17746
17747 : see if setpgid exists
17748 set setpgid d_setpgid
17749 eval $inlibc
17750
17751 : see if setpgrp2 exists
17752 set setpgrp2 d_setpgrp2
17753 eval $inlibc
17754
17755 : see if setpriority exists
17756 set setpriority d_setprior
17757 eval $inlibc
17758
17759 : see if setproctitle exists
17760 set setproctitle d_setproctitle
17761 eval $inlibc
17762
17763 : see if setprotoent_r exists
17764 set setprotoent_r d_setprotoent_r
17765 eval $inlibc
17766 case "$d_setprotoent_r" in
17767 "$define")
17768         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17769         case "$d_setprotoent_r_proto:$usethreads" in
17770         ":define")      d_setprotoent_r_proto=define
17771                 set d_setprotoent_r_proto setprotoent_r $hdrs
17772                 eval $hasproto ;;
17773         *)      ;;
17774         esac
17775         case "$d_setprotoent_r_proto" in
17776         define)
17777         case "$setprotoent_r_proto" in
17778         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17779         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17780         esac
17781         case "$setprotoent_r_proto" in
17782         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17783         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17784         esac
17785         case "$setprotoent_r_proto" in
17786         ''|0)   d_setprotoent_r=undef
17787                 setprotoent_r_proto=0
17788                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17789         * )     case "$setprotoent_r_proto" in
17790                 REENTRANT_PROTO*) ;;
17791                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17792                 esac
17793                 echo "Prototype: $try" ;;
17794         esac
17795         ;;
17796         *)      case "$usethreads" in
17797                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17798                 esac
17799                 d_setprotoent_r=undef
17800                 setprotoent_r_proto=0
17801                 ;;
17802         esac
17803         ;;
17804 *)      setprotoent_r_proto=0
17805         ;;
17806 esac
17807
17808 : see if setpwent exists
17809 set setpwent d_setpwent
17810 eval $inlibc
17811
17812 : see if setpwent_r exists
17813 set setpwent_r d_setpwent_r
17814 eval $inlibc
17815 case "$d_setpwent_r" in
17816 "$define")
17817         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17818         case "$d_setpwent_r_proto:$usethreads" in
17819         ":define")      d_setpwent_r_proto=define
17820                 set d_setpwent_r_proto setpwent_r $hdrs
17821                 eval $hasproto ;;
17822         *)      ;;
17823         esac
17824         case "$d_setpwent_r_proto" in
17825         define)
17826         case "$setpwent_r_proto" in
17827         ''|0) try='int setpwent_r(FILE**);'
17828         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17829         esac
17830         case "$setpwent_r_proto" in
17831         ''|0) try='void setpwent_r(FILE**);'
17832         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17833         esac
17834         case "$setpwent_r_proto" in
17835         ''|0)   d_setpwent_r=undef
17836                 setpwent_r_proto=0
17837                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17838         * )     case "$setpwent_r_proto" in
17839                 REENTRANT_PROTO*) ;;
17840                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17841                 esac
17842                 echo "Prototype: $try" ;;
17843         esac
17844         ;;
17845         *)      case "$usethreads" in
17846                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17847                 esac
17848                 d_setpwent_r=undef
17849                 setpwent_r_proto=0
17850                 ;;
17851         esac
17852         ;;
17853 *)      setpwent_r_proto=0
17854         ;;
17855 esac
17856
17857 : see if setregid exists
17858 set setregid d_setregid
17859 eval $inlibc
17860 set setresgid d_setresgid
17861 eval $inlibc
17862
17863 : see if setreuid exists
17864 set setreuid d_setreuid
17865 eval $inlibc
17866 set setresuid d_setresuid
17867 eval $inlibc
17868
17869 : see if setrgid exists
17870 set setrgid d_setrgid
17871 eval $inlibc
17872
17873 : see if setruid exists
17874 set setruid d_setruid
17875 eval $inlibc
17876
17877 : see if setservent exists
17878 set setservent d_setsent
17879 eval $inlibc
17880
17881 : see if setservent_r exists
17882 set setservent_r d_setservent_r
17883 eval $inlibc
17884 case "$d_setservent_r" in
17885 "$define")
17886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17887         case "$d_setservent_r_proto:$usethreads" in
17888         ":define")      d_setservent_r_proto=define
17889                 set d_setservent_r_proto setservent_r $hdrs
17890                 eval $hasproto ;;
17891         *)      ;;
17892         esac
17893         case "$d_setservent_r_proto" in
17894         define)
17895         case "$setservent_r_proto" in
17896         ''|0) try='int setservent_r(int, struct servent_data*);'
17897         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17898         esac
17899         case "$setservent_r_proto" in
17900         ''|0) try='void setservent_r(int, struct servent_data*);'
17901         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17902         esac
17903         case "$setservent_r_proto" in
17904         ''|0)   d_setservent_r=undef
17905                 setservent_r_proto=0
17906                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17907         * )     case "$setservent_r_proto" in
17908                 REENTRANT_PROTO*) ;;
17909                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17910                 esac
17911                 echo "Prototype: $try" ;;
17912         esac
17913         ;;
17914         *)      case "$usethreads" in
17915                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17916                 esac
17917                 d_setservent_r=undef
17918                 setservent_r_proto=0
17919                 ;;
17920         esac
17921         ;;
17922 *)      setservent_r_proto=0
17923         ;;
17924 esac
17925
17926 : see if setsid exists
17927 set setsid d_setsid
17928 eval $inlibc
17929
17930 : see if setvbuf exists
17931 set setvbuf d_setvbuf
17932 eval $inlibc
17933
17934 : see if shmctl exists
17935 set shmctl d_shmctl
17936 eval $inlibc
17937
17938 : see if shmget exists
17939 set shmget d_shmget
17940 eval $inlibc
17941
17942 : see if shmat exists
17943 set shmat d_shmat
17944 eval $inlibc
17945 : see what shmat returns
17946 case "$d_shmat" in
17947 "$define")
17948         $cat >shmat.c <<'END'
17949 #include <sys/shm.h>
17950 void *shmat();
17951 END
17952         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17953                 shmattype='void *'
17954         else
17955                 shmattype='char *'
17956         fi
17957         echo "and it returns ($shmattype)." >&4
17958         : see if a prototype for shmat is available
17959         xxx=`./findhdr sys/shm.h`
17960         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17961         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17962                 val="$define"
17963         else
17964                 val="$undef"
17965         fi
17966         $rm -f shmat.[co]
17967         ;;
17968 *)
17969         val="$undef"
17970         ;;
17971 esac
17972 set d_shmatprototype
17973 eval $setvar
17974
17975 : see if shmdt exists
17976 set shmdt d_shmdt
17977 eval $inlibc
17978
17979 : see how much of the 'shm*(2)' library is present.
17980 h_shm=true
17981 echo " "
17982 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17983 *"$undef"*) h_shm=false;;
17984 esac
17985 case "$osname" in
17986 freebsd)
17987     case "`ipcs 2>&1`" in
17988     "SVID shared memory"*"not configured"*)
17989         echo "Your $osname does not have the shm*(2) configured." >&4
17990         h_shm=false
17991         val="$undef"
17992         set shmctl d_shmctl
17993         eval $setvar
17994         set shmget d_shmget
17995         eval $setvar
17996         set shmat d_shmat
17997         eval $setvar
17998         set shmdt d_shmdt
17999         eval $setvar
18000         ;;
18001     esac
18002     ;;
18003 esac
18004 : we could also check for sys/ipc.h ...
18005 if $h_shm && $test `./findhdr sys/shm.h`; then
18006         echo "You have the full shm*(2) library." >&4
18007         val="$define"
18008 else
18009         echo "You don't have the full shm*(2) library." >&4
18010         val="$undef"
18011 fi
18012 set d_shm
18013 eval $setvar
18014
18015 : see if we have sigaction
18016 echo " "
18017 if set sigaction val -f d_sigaction; eval $csym; $val; then
18018         echo 'sigaction() found.' >&4
18019         $cat > try.c <<EOP
18020 #include <stdio.h>
18021 #include <sys/types.h>
18022 #include <signal.h>
18023 #$i_stdlib I_STDLIB
18024 #ifdef I_STDLIB
18025 #include <stdlib.h>
18026 #endif
18027 int main()
18028 {
18029     struct sigaction act, oact;
18030     act.sa_flags = 0;
18031     oact.sa_handler = 0;
18032     /* so that act and oact are used */
18033     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18034 }
18035 EOP
18036         set try
18037         if eval $compile_ok; then
18038                 val="$define"
18039         else
18040                 echo "But you don't seem to have a usable struct sigaction." >&4
18041                 val="$undef"
18042         fi
18043 else
18044         echo 'sigaction NOT found.' >&4
18045         val="$undef"
18046 fi
18047 set d_sigaction; eval $setvar
18048 $rm_try
18049
18050 : see if this is a sunmath.h system
18051 set sunmath.h i_sunmath
18052 eval $inhdr
18053
18054 : see if signbit exists
18055 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18056 $cat >try.c <<EOCP
18057 #$i_math I_MATH
18058 #$i_sunmath I_SUNMATH
18059 #ifdef I_MATH
18060 #  include <math.h>
18061 #endif
18062 #ifdef I_SUNMATH  /* Solaris special math library */
18063 #  include <sunmath.h>
18064 #endif
18065 #define NV $nvtype
18066 int main(int argc, char **argv)
18067 {
18068     NV x = 0.0;
18069     NV y = -0.0;
18070     if ((signbit(x) == 0) && (signbit(y) != 0))
18071         return 0;
18072     else
18073         return 1;
18074 }
18075 EOCP
18076 val="$undef"
18077 set try
18078 if eval $compile; then
18079     if $run ./try; then
18080         $echo "Yes." >&4
18081         val="$define"
18082     else
18083         $echo "Signbit seems to be available, but doesn't work as I expected."
18084         $echo "I won't use it." >&4
18085         val="$undef"
18086     fi
18087 else
18088     $echo "Nope." >&4
18089     dflt="$undef"
18090 fi
18091 set d_signbit
18092 eval $setvar
18093 $rm_try
18094
18095 : see if sigprocmask exists
18096 set sigprocmask d_sigprocmask
18097 eval $inlibc
18098
18099 : see if sigsetjmp exists
18100 echo " "
18101 case "$d_sigsetjmp" in
18102 '')
18103         $cat >try.c <<EOP
18104 #include <setjmp.h>
18105 #$i_stdlib I_STDLIB
18106 #ifdef I_STDLIB
18107 #include <stdlib.h>
18108 #endif
18109 sigjmp_buf env;
18110 int set = 1;
18111 int main()
18112 {
18113         if (sigsetjmp(env,1))
18114                 exit(set);
18115         set = 0;
18116         siglongjmp(env, 1);
18117         exit(1);
18118 }
18119 EOP
18120         set try
18121         if eval $compile; then
18122                 if $run ./try >/dev/null 2>&1; then
18123                         echo "POSIX sigsetjmp found." >&4
18124                         val="$define"
18125                 else
18126                         $cat >&4 <<EOM
18127 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18128 I'll ignore them.
18129 EOM
18130                         val="$undef"
18131                 fi
18132         else
18133                 echo "sigsetjmp not found." >&4
18134                 val="$undef"
18135         fi
18136         ;;
18137 *) val="$d_sigsetjmp"
18138         case "$d_sigsetjmp" in
18139         $define) echo "POSIX sigsetjmp found." >&4;;
18140         $undef) echo "sigsetjmp not found." >&4;;
18141         esac
18142         ;;
18143 esac
18144 set d_sigsetjmp
18145 eval $setvar
18146 $rm_try
18147
18148 : see if snprintf exists
18149 set snprintf d_snprintf
18150 eval $inlibc
18151
18152 : see if vsnprintf exists
18153 set vsnprintf d_vsnprintf
18154 eval $inlibc
18155
18156 case "$d_snprintf-$d_vsnprintf" in
18157 "$define-$define")
18158     $cat <<EOM
18159 Checking whether your snprintf() and vsnprintf() work okay...
18160 EOM
18161     $cat >try.c <<'EOCP'
18162 /* v?snprintf testing logic courtesy of Russ Allbery.
18163  * According to C99:
18164  * - if the buffer is too short it still must be \0-terminated
18165  * - if the buffer is too short the potentially required length
18166  *   must be returned and not -1
18167  * - if the buffer is NULL the potentially required length
18168  *   must be returned and not -1 or core dump
18169  */
18170 #include <stdio.h>
18171 #include <stdarg.h>
18172
18173 char buf[2];
18174
18175 int test (char *format, ...)
18176 {
18177     va_list args;
18178     int count;
18179
18180     va_start (args, format);
18181     count = vsnprintf (buf, sizeof buf, format, args);
18182     va_end (args);
18183     return count;
18184 }
18185
18186 int main ()
18187 {
18188     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18189              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18190 }
18191 EOCP
18192     set try
18193     if eval $compile; then
18194         `$run ./try`
18195         case "$?" in
18196         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18197         *) cat <<EOM >&4
18198 Your snprintf() and snprintf() don't seem to be working okay.
18199 EOM
18200            d_snprintf="$undef"
18201            d_vsnprintf="$undef"
18202            ;;
18203         esac
18204     else
18205         echo "(I can't seem to compile the test program--assuming they don't)"
18206         d_snprintf="$undef"
18207         d_vsnprintf="$undef"
18208     fi
18209     $rm_try
18210     ;;
18211 esac
18212
18213 : see if sockatmark exists
18214 set sockatmark d_sockatmark
18215 eval $inlibc
18216
18217 : see if prototype for sockatmark is available
18218 echo " "
18219 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18220 eval $hasproto
18221
18222 : see if socks5_init exists
18223 set socks5_init d_socks5_init
18224 eval $inlibc
18225
18226 : see if sprintf returns the length of the string in the buffer as per ANSI
18227 $echo "Checking whether sprintf returns the length of the string..." >&4
18228 $cat <<EOP >try.c
18229 #include <stdio.h>
18230 #$i_stdlib I_STDLIB
18231 #ifdef I_STDLIB
18232 #include <stdlib.h>
18233 #endif
18234 #$i_string I_STRING
18235 #ifdef I_STRING
18236 #  include <string.h>
18237 #else
18238 #  include <strings.h>
18239 #endif
18240 #$i_math I_MATH
18241 #ifdef I_MATH
18242 #include <math.h>
18243 #endif
18244
18245 char buffer[256];
18246
18247 int check (size_t expect, int test) {
18248   size_t got = strlen(buffer);
18249   if (expect == got)
18250     return 0;
18251
18252   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18253        test, buffer);
18254   exit (test);
18255 }
18256
18257 int main(int argc, char **argv) {
18258   int test = 0;
18259
18260   check(sprintf(buffer, ""), ++test);
18261   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18262   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18263
18264   return 0;
18265 }
18266 EOP
18267 set try
18268
18269 if eval $compile; then
18270     xxx="`$run ./try`"
18271     case "$?" in
18272         0) cat >&4 <<EOM
18273 sprintf returns the length of the string (as ANSI says it should)
18274 EOM
18275         d_sprintf_returns_strlen="$define"
18276         ;;
18277         *) cat >&4 <<EOM
18278 sprintf does not return the length of the string (how old is this system?)
18279 EOM
18280         d_sprintf_returns_strlen="$undef"
18281         ;;
18282     esac
18283 else
18284     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18285     d_sprintf_returns_strlen="$undef"
18286 fi
18287 $rm_try
18288
18289 : see if srand48_r exists
18290 set srand48_r d_srand48_r
18291 eval $inlibc
18292 case "$d_srand48_r" in
18293 "$define")
18294         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18295         case "$d_srand48_r_proto:$usethreads" in
18296         ":define")      d_srand48_r_proto=define
18297                 set d_srand48_r_proto srand48_r $hdrs
18298                 eval $hasproto ;;
18299         *)      ;;
18300         esac
18301         case "$d_srand48_r_proto" in
18302         define)
18303         case "$srand48_r_proto" in
18304         ''|0) try='int srand48_r(long, struct drand48_data*);'
18305         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18306         esac
18307         case "$srand48_r_proto" in
18308         ''|0)   d_srand48_r=undef
18309                 srand48_r_proto=0
18310                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18311         * )     case "$srand48_r_proto" in
18312                 REENTRANT_PROTO*) ;;
18313                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18314                 esac
18315                 echo "Prototype: $try" ;;
18316         esac
18317         ;;
18318         *)      case "$usethreads" in
18319                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18320                 esac
18321                 d_srand48_r=undef
18322                 srand48_r_proto=0
18323                 ;;
18324         esac
18325         ;;
18326 *)      srand48_r_proto=0
18327         ;;
18328 esac
18329
18330 : see if srandom_r exists
18331 set srandom_r d_srandom_r
18332 eval $inlibc
18333 case "$d_srandom_r" in
18334 "$define")
18335         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18336         case "$d_srandom_r_proto:$usethreads" in
18337         ":define")      d_srandom_r_proto=define
18338                 set d_srandom_r_proto srandom_r $hdrs
18339                 eval $hasproto ;;
18340         *)      ;;
18341         esac
18342         case "$d_srandom_r_proto" in
18343         define)
18344         case "$srandom_r_proto" in
18345         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18346         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18347         esac
18348         case "$srandom_r_proto" in
18349         ''|0)   d_srandom_r=undef
18350                 srandom_r_proto=0
18351                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18352         * )     case "$srandom_r_proto" in
18353                 REENTRANT_PROTO*) ;;
18354                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18355                 esac
18356                 echo "Prototype: $try" ;;
18357         esac
18358         ;;
18359         *)      case "$usethreads" in
18360                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18361                 esac
18362                 d_srandom_r=undef
18363                 srandom_r_proto=0
18364                 ;;
18365         esac
18366         ;;
18367 *)      srandom_r_proto=0
18368         ;;
18369 esac
18370
18371 : see if prototype for setresgid is available
18372 echo " "
18373 set d_sresgproto setresgid $i_unistd unistd.h
18374 eval $hasproto
18375
18376 : see if prototype for setresuid is available
18377 echo " "
18378 set d_sresuproto setresuid $i_unistd unistd.h
18379 eval $hasproto
18380
18381 : see if sys/stat.h is available
18382 set sys/stat.h i_sysstat
18383 eval $inhdr
18384
18385 : see if stat knows about block sizes
18386 echo " "
18387 echo "Checking to see if your struct stat has st_blocks field..." >&4
18388 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18389 eval $hasfield
18390
18391 : see if this is a sys/vfs.h system
18392 set sys/vfs.h i_sysvfs
18393 eval $inhdr
18394
18395 : see if this is a sys/statfs.h system
18396 set sys/statfs.h i_sysstatfs
18397 eval $inhdr
18398
18399 : Check for statfs_s
18400 echo " "
18401 echo "Checking to see if your system supports struct statfs..." >&4
18402 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
18403 eval $hasstruct
18404 case "$d_statfs_s" in
18405 "$define")      echo "Yes, it does."   ;;
18406 *)              echo "No, it doesn't." ;;
18407 esac
18408
18409
18410 : see if struct statfs knows about f_flags
18411 case "$d_statfs_s" in
18412 define)
18413         echo " "
18414         echo "Checking to see if your struct statfs has f_flags field..." >&4
18415         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
18416         eval $hasfield
18417         ;;
18418 *)      val="$undef"
18419         set d_statfs_f_flags
18420         eval $setvar
18421         ;;
18422 esac
18423 case "$d_statfs_f_flags" in
18424 "$define")      echo "Yes, it does."   ;;
18425 *)              echo "No, it doesn't." ;;
18426 esac
18427
18428 : see what flavor, if any, of static inline is supported
18429 echo " "
18430 echo "Checking to see if your system supports static inline..."
18431 $cat > try.c <<'EOCP'
18432 #include <stdlib.h>
18433 extern int f_via_a(int x);
18434 extern int f_via_b(int x);
18435 int main(int argc, char **argv)
18436 {
18437     int y;
18438
18439     y = f_via_a(0);
18440 #ifdef USE_B
18441     y = f_via_b(0);
18442 #endif
18443     if (y == 42) {
18444         return EXIT_SUCCESS;
18445     }
18446     else {
18447         return EXIT_FAILURE;
18448     }
18449 }
18450 EOCP
18451 $cat > a.c <<'EOCP'
18452 static INLINE int f(int x) {
18453     int y;
18454     y = x + 42;
18455     return y;
18456 }
18457
18458 int f_via_a(int x)
18459 {
18460     return f(x);
18461 }
18462 EOCP
18463 $cat > b.c <<'EOCP'
18464 extern int f(int x);
18465
18466 int f_via_b(int x)
18467 {
18468     return f(x);
18469 }
18470 EOCP
18471
18472 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18473 case "$perl_static_inline" in
18474 '')     # Check the various possibilities, and break out on success.
18475         # For gcc, prefer __inline__, which will still permit
18476         # cflags.SH to add in -ansi.
18477         case "$gccversion" in
18478                 '') xxx="inline __inline__ __inline _inline";;
18479                 *)  xxx="__inline__ inline __inline _inline";;
18480         esac
18481         for inline in $xxx; do
18482                 set try -DINLINE=$inline a.c
18483                 if eval $compile && $run ./try; then
18484                         # Now make sure there is no external linkage of static
18485                         # functions
18486                         set try -DINLINE=$inline -DUSE_B a.c b.c
18487                         if eval $compile && $run ./try; then
18488                                 $echo "Your compiler supports static $inline, " >&4
18489                                 $echo "but it also creates an external definition," >&4
18490                                 $echo "so I won't use it." >&4
18491                                 val=$undef
18492                         else
18493                                 $echo "Your compiler supports static $inline." >&4
18494                                 val=$define
18495                                 perl_static_inline="static $inline";
18496                                 break;
18497                         fi
18498                 else
18499                         $echo "Your compiler does NOT support static $inline." >&4
18500                         val="$undef"
18501                 fi
18502         done
18503         ;;
18504 *inline*) # Some variant of inline exists.
18505         echo "Keeping your $hint value of $perl_static_inline."
18506         val=$define
18507         ;;
18508 static)  # No inline capabilities
18509         echo "Keeping your $hint value of $perl_static_inline."
18510         val=$undef
18511         ;;
18512 *)  # Unrecognized previous value -- blindly trust the supplied
18513         # value and hope it makes sense.  Use old value for
18514         # d_static_inline, if there is one.
18515         echo "Keeping your $hint value of $perl_static_inline."
18516         case "$d_static_inline" in
18517                 '') val=$define ;;
18518                 *)  val=$d_static_inline ;;
18519         esac
18520         ;;
18521 esac
18522 # Fallback to plain 'static' if nothing worked.
18523 case "$perl_static_inline" in
18524 '')
18525         perl_static_inline="static"
18526         val=$undef
18527         ;;
18528 esac
18529 set d_static_inline
18530 eval $setvar
18531 $rm -f a.[co] b.[co]
18532 $rm_try
18533
18534 : Check stream access
18535 $cat >&4 <<EOM
18536 Checking how to access stdio streams by file descriptor number...
18537 EOM
18538 case "$stdio_stream_array" in
18539 '')     $cat >try.c <<EOCP
18540 #include <stdio.h>
18541 int main() {
18542   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18543     printf("yes\n");
18544 }
18545 EOCP
18546         for s in _iob __iob __sF
18547         do
18548                 set try -DSTDIO_STREAM_ARRAY=$s
18549                 if eval $compile; then
18550                         case "`$run ./try`" in
18551                         yes)    stdio_stream_array=$s; break ;;
18552                         esac
18553                 fi
18554         done
18555         $rm_try
18556 esac
18557 case "$stdio_stream_array" in
18558 '')     $cat >&4 <<EOM
18559 I can't figure out how to access stdio streams by file descriptor number.
18560 EOM
18561         d_stdio_stream_array="$undef"
18562         ;;
18563 *)      $cat >&4 <<EOM
18564 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18565 EOM
18566         d_stdio_stream_array="$define"
18567         ;;
18568 esac
18569
18570 : see if strcoll exists
18571 set strcoll d_strcoll
18572 eval $inlibc
18573
18574 : check for structure copying
18575 echo " "
18576 echo "Checking to see if your C compiler can copy structs..." >&4
18577 $cat >try.c <<'EOCP'
18578 int main()
18579 {
18580         struct blurfl {
18581                 int dyick;
18582         } foo, bar;
18583
18584         foo = bar;
18585 }
18586 EOCP
18587 if $cc -c try.c >/dev/null 2>&1 ; then
18588         val="$define"
18589         echo "Yup, it can."
18590 else
18591         val="$undef"
18592         echo "Nope, it can't."
18593 fi
18594 set d_strctcpy
18595 eval $setvar
18596 $rm_try
18597
18598 : see if strerror and/or sys_errlist[] exist
18599 echo " "
18600 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18601     if set strerror val -f d_strerror; eval $csym; $val; then
18602                 echo 'strerror() found.' >&4
18603                 d_strerror="$define"
18604                 d_strerrm='strerror(e)'
18605                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18606                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18607                         d_syserrlst="$define"
18608                 else
18609                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18610                         d_syserrlst="$undef"
18611                 fi
18612     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18613                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18614                 echo 'strerror() found in string header.' >&4
18615                 d_strerror="$define"
18616                 d_strerrm='strerror(e)'
18617                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18618                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18619                                 d_syserrlst="$define"
18620                 else
18621                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18622                         d_syserrlst="$undef"
18623                 fi
18624     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18625                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18626                 d_strerror="$undef"
18627                 d_syserrlst="$define"
18628                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18629     else
18630                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18631                 d_strerror="$undef"
18632                 d_syserrlst="$undef"
18633                 d_strerrm='"unknown"'
18634     fi
18635 fi
18636
18637 : see if strerror_r exists
18638 set strerror_r d_strerror_r
18639 eval $inlibc
18640 case "$d_strerror_r" in
18641 "$define")
18642         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18643         case "$d_strerror_r_proto:$usethreads" in
18644         ":define")      d_strerror_r_proto=define
18645                 set d_strerror_r_proto strerror_r $hdrs
18646                 eval $hasproto ;;
18647         *)      ;;
18648         esac
18649         case "$d_strerror_r_proto" in
18650         define)
18651         case "$strerror_r_proto" in
18652         ''|0) try='int strerror_r(int, char*, size_t);'
18653         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18654         esac
18655         case "$strerror_r_proto" in
18656         ''|0) try='int strerror_r(int, char*, int);'
18657         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18658         esac
18659         case "$strerror_r_proto" in
18660         ''|0) try='char* strerror_r(int, char*, size_t);'
18661         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18662         esac
18663         case "$strerror_r_proto" in
18664         ''|0)   d_strerror_r=undef
18665                 strerror_r_proto=0
18666                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18667         * )     case "$strerror_r_proto" in
18668                 REENTRANT_PROTO*) ;;
18669                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18670                 esac
18671                 echo "Prototype: $try" ;;
18672         esac
18673         ;;
18674         *)      case "$usethreads" in
18675                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18676                 esac
18677                 d_strerror_r=undef
18678                 strerror_r_proto=0
18679                 ;;
18680         esac
18681         ;;
18682 *)      strerror_r_proto=0
18683         ;;
18684 esac
18685
18686 : see if strftime exists
18687 set strftime d_strftime
18688 eval $inlibc
18689
18690 : see if strlcat exists
18691 set strlcat d_strlcat
18692 eval $inlibc
18693
18694 : see if strlcpy exists
18695 set strlcpy d_strlcpy
18696 eval $inlibc
18697
18698 : see if strtod exists
18699 set strtod d_strtod
18700 eval $inlibc
18701
18702 : see if strtol exists
18703 set strtol d_strtol
18704 eval $inlibc
18705
18706 : see if strtold exists
18707 set strtold d_strtold
18708 eval $inlibc
18709
18710 : see if strtoll exists
18711 set strtoll d_strtoll
18712 eval $inlibc
18713
18714 case "$d_longlong-$d_strtoll" in
18715 "$define-$define")
18716         $cat <<EOM
18717 Checking whether your strtoll() works okay...
18718 EOM
18719         $cat >try.c <<'EOCP'
18720 #include <errno.h>
18721 #ifdef __hpux
18722 #define strtoll __strtoll
18723 #endif
18724 #ifdef __EMX__
18725 #define strtoll _strtoll
18726 #endif
18727 #include <stdio.h>
18728 extern long long int strtoll(char *s, char **, int);
18729 static int bad = 0;
18730 int check(char *s, long long ell, int een) {
18731         long long gll;
18732         errno = 0;
18733         gll = strtoll(s, 0, 10);
18734         if (!((gll == ell) && (errno == een)))
18735                 bad++;
18736 }
18737 int main() {
18738         check(" 1",                                      1LL, 0);
18739         check(" 0",                                      0LL, 0);
18740         check("-1",                                     -1LL, 0);
18741         check("-9223372036854775808", -9223372036854775808LL, 0);
18742         check("-9223372036854775808", -9223372036854775808LL, 0);
18743         check(" 9223372036854775807",  9223372036854775807LL, 0);
18744         check("-9223372036854775808", -9223372036854775808LL, 0);
18745         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18746         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18747         if (!bad)
18748                 printf("ok\n");
18749 }
18750 EOCP
18751         set try
18752         if eval $compile; then
18753                 yyy=`$run ./try`
18754                 case "$yyy" in
18755                 ok) echo "Your strtoll() seems to be working okay." ;;
18756                 *) cat <<EOM >&4
18757 Your strtoll() doesn't seem to be working okay.
18758 EOM
18759                    d_strtoll="$undef"
18760                    ;;
18761                 esac
18762         else
18763                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18764                 d_strtoll="$undef"
18765         fi
18766         ;;
18767 esac
18768
18769 : see if strtoq exists
18770 set strtoq d_strtoq
18771 eval $inlibc
18772
18773 : see if strtoul exists
18774 set strtoul d_strtoul
18775 eval $inlibc
18776
18777 case "$d_strtoul" in
18778 "$define")
18779         $cat <<EOM
18780 Checking whether your strtoul() works okay...
18781 EOM
18782         $cat >try.c <<'EOCP'
18783 #include <errno.h>
18784 #include <stdio.h>
18785 extern unsigned long int strtoul(char *s, char **, int);
18786 static int bad = 0;
18787 void check(char *s, unsigned long eul, int een) {
18788         unsigned long gul;
18789         errno = 0;
18790         gul = strtoul(s, 0, 10);
18791         if (!((gul == eul) && (errno == een)))
18792                 bad++;
18793 }
18794 int main() {
18795         check(" 1", 1L, 0);
18796         check(" 0", 0L, 0);
18797 EOCP
18798         case "$longsize" in
18799         8)
18800             $cat >>try.c <<'EOCP'
18801         check("18446744073709551615", 18446744073709551615UL, 0);
18802         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18803 #if 0 /* strtoul() for /^-/ strings is undefined. */
18804         check("-1", 18446744073709551615UL, 0);
18805         check("-18446744073709551614", 2, 0);
18806         check("-18446744073709551615", 1, 0);
18807         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18808         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18809 #endif
18810 EOCP
18811                 ;;
18812         4)
18813                     $cat >>try.c <<'EOCP'
18814         check("4294967295", 4294967295UL, 0);
18815         check("4294967296", 4294967295UL, ERANGE);
18816 #if 0 /* strtoul() for /^-/ strings is undefined. */
18817         check("-1", 4294967295UL, 0);
18818         check("-4294967294", 2, 0);
18819         check("-4294967295", 1, 0);
18820         check("-4294967296", 4294967295UL, ERANGE);
18821         check("-4294967297", 4294967295UL, ERANGE);
18822 #endif
18823 EOCP
18824                 ;;
18825         *)
18826 : Should we write these tests to be more portable by sprintf-ing
18827 : ~0 and then manipulating that char string as input for strtol?
18828                 ;;
18829         esac
18830         $cat >>try.c <<'EOCP'
18831         if (!bad)
18832                 printf("ok\n");
18833         return 0;
18834 }
18835 EOCP
18836         set try
18837         if eval $compile; then
18838                 case "`$run ./try`" in
18839                 ok) echo "Your strtoul() seems to be working okay." ;;
18840                 *) cat <<EOM >&4
18841 Your strtoul() doesn't seem to be working okay.
18842 EOM
18843                    d_strtoul="$undef"
18844                    ;;
18845                 esac
18846         else
18847                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18848                 d_strtoul="$undef"
18849         fi
18850         ;;
18851 esac
18852
18853 : see if strtoull exists
18854 set strtoull d_strtoull
18855 eval $inlibc
18856
18857 case "$d_longlong-$d_strtoull" in
18858 "$define-$define")
18859         $cat <<EOM
18860 Checking whether your strtoull() works okay...
18861 EOM
18862         $cat >try.c <<'EOCP'
18863 #include <errno.h>
18864 #ifdef __hpux
18865 #define strtoull __strtoull
18866 #endif
18867 #include <stdio.h>
18868 extern unsigned long long int strtoull(char *s, char **, int);
18869 static int bad = 0;
18870 int check(char *s, long long eull, int een) {
18871         long long gull;
18872         errno = 0;
18873         gull = strtoull(s, 0, 10);
18874         if (!((gull == eull) && (errno == een)))
18875                 bad++;
18876 }
18877 int main() {
18878         check(" 1",                                        1LL, 0);
18879         check(" 0",                                        0LL, 0);
18880         check("18446744073709551615",  18446744073709551615ULL, 0);
18881         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18882 #if 0 /* strtoull() for /^-/ strings is undefined. */
18883         check("-1",                    18446744073709551615ULL, 0);
18884         check("-18446744073709551614",                     2LL, 0);
18885         check("-18446744073709551615",                     1LL, 0);
18886         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18887         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18888 #endif
18889         if (!bad)
18890                 printf("ok\n");
18891 }
18892 EOCP
18893         set try
18894         if eval $compile; then
18895                 case "`$run ./try`" in
18896                 ok) echo "Your strtoull() seems to be working okay." ;;
18897                 *) cat <<EOM >&4
18898 Your strtoull() doesn't seem to be working okay.
18899 EOM
18900                    d_strtoull="$undef"
18901                    ;;
18902                 esac
18903         else
18904                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18905                 d_strtoull="$undef"
18906         fi
18907         ;;
18908 esac
18909
18910 : see if strtouq exists
18911 set strtouq d_strtouq
18912 eval $inlibc
18913
18914 case "$d_strtouq" in
18915 "$define")
18916         $cat <<EOM
18917 Checking whether your strtouq() works okay...
18918 EOM
18919         $cat >try.c <<'EOCP'
18920 #include <errno.h>
18921 #include <stdio.h>
18922 extern unsigned long long int strtouq(char *s, char **, int);
18923 static int bad = 0;
18924 void check(char *s, unsigned long long eull, int een) {
18925         unsigned long long gull;
18926         errno = 0;
18927         gull = strtouq(s, 0, 10);
18928         if (!((gull == eull) && (errno == een)))
18929                 bad++;
18930 }
18931 int main() {
18932         check(" 1",                                        1LL, 0);
18933         check(" 0",                                        0LL, 0);
18934         check("18446744073709551615",  18446744073709551615ULL, 0);
18935         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18936 #if 0 /* strtouq() for /^-/ strings is undefined. */
18937         check("-1",                    18446744073709551615ULL, 0);
18938         check("-18446744073709551614",                     2LL, 0);
18939         check("-18446744073709551615",                     1LL, 0);
18940         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18941         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18942 #endif
18943         if (!bad)
18944                 printf("ok\n");
18945         return 0;
18946 }
18947 EOCP
18948         set try
18949         if eval $compile; then
18950                 case "`$run ./try`" in
18951                 ok) echo "Your strtouq() seems to be working okay." ;;
18952                 *) cat <<EOM >&4
18953 Your strtouq() doesn't seem to be working okay.
18954 EOM
18955                    d_strtouq="$undef"
18956                    ;;
18957                 esac
18958         else
18959                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18960                 d_strtouq="$undef"
18961         fi
18962         ;;
18963 esac
18964
18965 : see if strxfrm exists
18966 set strxfrm d_strxfrm
18967 eval $inlibc
18968
18969 : see if symlink exists
18970 set symlink d_symlink
18971 eval $inlibc
18972
18973 : see if syscall exists
18974 set syscall d_syscall
18975 eval $inlibc
18976
18977 : see if prototype for syscall is available
18978 echo " "
18979 set d_syscallproto syscall $i_unistd unistd.h
18980 eval $hasproto
18981
18982 : see if sysconf exists
18983 set sysconf d_sysconf
18984 eval $inlibc
18985
18986 : see if system exists
18987 set system d_system
18988 eval $inlibc
18989
18990 : see if tcgetpgrp exists
18991 set tcgetpgrp d_tcgetpgrp
18992 eval $inlibc
18993
18994 : see if tcsetpgrp exists
18995 set tcsetpgrp d_tcsetpgrp
18996 eval $inlibc
18997
18998 : see if prototype for telldir is available
18999 echo " "
19000 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19001 eval $hasproto
19002
19003 : see if time exists
19004 echo " "
19005 if test "X$d_time" = X -o X"$timetype" = X; then
19006     if set time val -f d_time; eval $csym; $val; then
19007                 echo 'time() found.' >&4
19008                 val="$define"
19009                 rp="What is the type returned by time() on this system?"
19010                 set time_t timetype long stdio.h sys/types.h
19011                 eval $typedef_ask
19012     else
19013                 echo 'time() not found, hope that will do.' >&4
19014                 val="$undef"
19015                 timetype='int';
19016     fi
19017     set d_time
19018     eval $setvar
19019 fi
19020
19021 : see if timegm exists
19022 set timegm d_timegm
19023 eval $inlibc
19024
19025 : see if this is a sys/times.h system
19026 set sys/times.h i_systimes
19027 eval $inhdr
19028
19029 : see if times exists
19030 echo " "
19031 if set times val -f d_times; eval $csym; $val; then
19032         echo 'times() found.' >&4
19033         d_times="$define"
19034         inc=''
19035         case "$i_systimes" in
19036         "$define") inc='sys/times.h';;
19037         esac
19038         rp="What is the type returned by times() on this system?"
19039         set clock_t clocktype long stdio.h sys/types.h $inc
19040         eval $typedef_ask
19041 else
19042         echo 'times() NOT found, hope that will do.' >&4
19043         d_times="$undef"
19044         clocktype='int'
19045 fi
19046
19047 : see if tmpnam_r exists
19048 set tmpnam_r d_tmpnam_r
19049 eval $inlibc
19050 case "$d_tmpnam_r" in
19051 "$define")
19052         hdrs="$i_systypes sys/types.h define stdio.h "
19053         case "$d_tmpnam_r_proto:$usethreads" in
19054         ":define")      d_tmpnam_r_proto=define
19055                 set d_tmpnam_r_proto tmpnam_r $hdrs
19056                 eval $hasproto ;;
19057         *)      ;;
19058         esac
19059         case "$d_tmpnam_r_proto" in
19060         define)
19061         case "$tmpnam_r_proto" in
19062         ''|0) try='char* tmpnam_r(char*);'
19063         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19064         esac
19065         case "$tmpnam_r_proto" in
19066         ''|0)   d_tmpnam_r=undef
19067                 tmpnam_r_proto=0
19068                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19069         * )     case "$tmpnam_r_proto" in
19070                 REENTRANT_PROTO*) ;;
19071                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19072                 esac
19073                 echo "Prototype: $try" ;;
19074         esac
19075         ;;
19076         *)      case "$usethreads" in
19077                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19078                 esac
19079                 d_tmpnam_r=undef
19080                 tmpnam_r_proto=0
19081                 ;;
19082         esac
19083         ;;
19084 *)      tmpnam_r_proto=0
19085         ;;
19086 esac
19087
19088 : see if truncate exists
19089 set truncate d_truncate
19090 eval $inlibc
19091
19092 : see if ttyname_r exists
19093 set ttyname_r d_ttyname_r
19094 eval $inlibc
19095 case "$d_ttyname_r" in
19096 "$define")
19097         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19098         case "$d_ttyname_r_proto:$usethreads" in
19099         ":define")      d_ttyname_r_proto=define
19100                 set d_ttyname_r_proto ttyname_r $hdrs
19101                 eval $hasproto ;;
19102         *)      ;;
19103         esac
19104         case "$d_ttyname_r_proto" in
19105         define)
19106         case "$ttyname_r_proto" in
19107         ''|0) try='int ttyname_r(int, char*, size_t);'
19108         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19109         esac
19110         case "$ttyname_r_proto" in
19111         ''|0) try='int ttyname_r(int, char*, int);'
19112         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19113         esac
19114         case "$ttyname_r_proto" in
19115         ''|0) try='char* ttyname_r(int, char*, int);'
19116         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19117         esac
19118         case "$ttyname_r_proto" in
19119         ''|0)   d_ttyname_r=undef
19120                 ttyname_r_proto=0
19121                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19122         * )     case "$ttyname_r_proto" in
19123                 REENTRANT_PROTO*) ;;
19124                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19125                 esac
19126                 echo "Prototype: $try" ;;
19127         esac
19128         ;;
19129         *)      case "$usethreads" in
19130                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19131                 esac
19132                 d_ttyname_r=undef
19133                 ttyname_r_proto=0
19134                 ;;
19135         esac
19136         ;;
19137 *)      ttyname_r_proto=0
19138         ;;
19139 esac
19140
19141 : see if tzname[] exists
19142 echo " "
19143 if set tzname val -a d_tzname; eval $csym; $val; then
19144         val="$define"
19145         echo 'tzname[] found.' >&4
19146 else
19147         val="$undef"
19148         echo 'tzname[] NOT found.' >&4
19149 fi
19150 set d_tzname
19151 eval $setvar
19152
19153 : Check if is a multiplatform env
19154 case "$osname" in
19155 darwin) multiarch="$define" ;;
19156 esac
19157 case "$multiarch" in
19158 ''|[nN]*) multiarch="$undef" ;;
19159 esac
19160
19161 : check for ordering of bytes in a UV
19162 echo " "
19163 case "$multiarch" in
19164 *$define*)
19165         $cat <<EOM
19166 You seem to be doing a multiarchitecture build,
19167 skipping the byteorder check.
19168
19169 EOM
19170         byteorder='ffff'
19171         ;;
19172 *)
19173         case "$byteorder" in
19174         '')
19175                 $cat <<'EOM'
19176 In the following, larger digits indicate more significance.  A big-endian
19177 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19178 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19179 machines may have weird orders like 3412.  A Cray will report 87654321,
19180 an Alpha will report 12345678. If the test program works the default is
19181 probably right.
19182 I'm now running the test program...
19183 EOM
19184                 $cat >try.c <<EOCP
19185 #include <stdio.h>
19186 #$i_stdlib I_STDLIB
19187 #ifdef I_STDLIB
19188 #include <stdlib.h>
19189 #endif
19190 #include <sys/types.h>
19191 typedef $uvtype UV;
19192 int main()
19193 {
19194         int i;
19195         union {
19196                 UV l;
19197                 char c[$uvsize];
19198         } u;
19199
19200         if ($uvsize > 4)
19201                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19202         else
19203                 u.l = (UV)0x04030201;
19204         for (i = 0; i < $uvsize; i++)
19205                 printf("%c", u.c[i]+'0');
19206         printf("\n");
19207         exit(0);
19208 }
19209 EOCP
19210                 xxx_prompt=y
19211                 set try
19212                 if eval $compile && $run ./try > /dev/null; then
19213                         dflt=`$run ./try`
19214                         case "$dflt" in
19215                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19216                                 echo "(The test program ran ok.)"
19217                                 echo "byteorder=$dflt"
19218                                 xxx_prompt=n
19219                         ;;
19220                         ????|????????) echo "(The test program ran ok.)" ;;
19221                         *) echo "(The test program didn't run right for some reason.)" ;;
19222                         esac
19223                 else
19224                         dflt='4321'
19225                         cat <<'EOM'
19226 (I can't seem to compile the test program.  Guessing big-endian...)
19227 EOM
19228                 fi
19229                 case "$xxx_prompt" in
19230                 y)
19231                         rp="What is the order of bytes in $uvtype?"
19232                         . ./myread
19233                         byteorder="$ans"
19234                         ;;
19235                 *)      byteorder=$dflt
19236                         ;;
19237                 esac
19238                 ;;
19239         esac
19240         $rm_try
19241         ;;
19242 esac
19243
19244 : Checking 32bit alignedness
19245 $cat <<EOM
19246
19247 Checking to see whether you can access character data unalignedly...
19248 EOM
19249 case "$d_u32align" in
19250 '')   $cat >try.c <<EOCP
19251 #include <stdio.h>
19252 #$i_stdlib I_STDLIB
19253 #ifdef I_STDLIB
19254 #include <stdlib.h>
19255 #endif
19256 #define U32 $u32type
19257 #define BYTEORDER 0x$byteorder
19258 #define U8 $u8type
19259 #include <signal.h>
19260 #ifdef SIGBUS
19261 $signal_t bletch(int s) { exit(4); }
19262 #endif
19263 int main() {
19264 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19265     volatile U8 buf[8];
19266     volatile U32 *up;
19267     int i;
19268
19269     if (sizeof(U32) != 4) {
19270         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19271         exit(1);
19272     }
19273
19274     fflush(stdout);
19275
19276 #ifdef SIGBUS
19277     signal(SIGBUS, bletch);
19278 #endif
19279
19280     buf[0] = 0;
19281     buf[1] = 0;
19282     buf[2] = 0;
19283     buf[3] = 1;
19284     buf[4] = 0;
19285     buf[5] = 0;
19286     buf[6] = 0;
19287     buf[7] = 1;
19288
19289     for (i = 0; i < 4; i++) {
19290         up = (U32*)(buf + i);
19291         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19292                (*up == 1 << (8*(3-i)))  /* little-endian */
19293               )
19294            )
19295         {
19296             printf("read failed (%x)\n", *up);
19297             exit(2);
19298         }
19299     }
19300
19301     /* write test */
19302     for (i = 0; i < 4; i++) {
19303         up = (U32*)(buf + i);
19304         *up = 0xBeef;
19305         if (*up != 0xBeef) {
19306             printf("write failed (%x)\n", *up);
19307             exit(3);
19308         }
19309     }
19310
19311     exit(0);
19312 #else
19313     printf("1\n");
19314     exit(1);
19315 #endif
19316     return 0;
19317 }
19318 EOCP
19319 set try
19320 if eval $compile_ok; then
19321         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19322         $run ./try 2>&1 >/dev/null
19323         case "$?" in
19324         0)      cat >&4 <<EOM
19325 You can access character data pretty unalignedly.
19326 EOM
19327                 d_u32align="$undef"
19328                 ;;
19329         *)      cat >&4 <<EOM
19330 It seems that you must access character data in an aligned manner.
19331 EOM
19332                 d_u32align="$define"
19333                 ;;
19334         esac
19335 else
19336         rp='Can you access character data at unaligned addresses?'
19337         dflt='n'
19338         . ./myread
19339         case "$ans" in
19340         [yY]*)  d_u32align="$undef"  ;;
19341         *)      d_u32align="$define" ;;
19342         esac
19343 fi
19344 $rm_try
19345 ;;
19346 esac
19347
19348 : see if ualarm exists
19349 set ualarm d_ualarm
19350 eval $inlibc
19351
19352 : see if umask exists
19353 set umask d_umask
19354 eval $inlibc
19355
19356 : see if unordered exists
19357 set unordered d_unordered
19358 eval $inlibc
19359
19360 : see if unsetenv exists
19361 set unsetenv d_unsetenv
19362 eval $inlibc
19363
19364 : see if usleep exists
19365 set usleep d_usleep
19366 eval $inlibc
19367
19368 : see if prototype for usleep is available
19369 echo " "
19370 set d_usleepproto usleep $i_unistd unistd.h
19371 eval $hasproto
19372
19373 : see if ustat exists
19374 set ustat d_ustat
19375 eval $inlibc
19376
19377 : see if closedir exists
19378 set closedir d_closedir
19379 eval $inlibc
19380
19381 case "$d_closedir" in
19382 "$define")
19383         echo " "
19384         echo "Checking whether closedir() returns a status..." >&4
19385         cat > try.c <<EOM
19386 #$i_dirent I_DIRENT             /**/
19387 #$i_sysdir I_SYS_DIR            /**/
19388 #$i_sysndir I_SYS_NDIR          /**/
19389 #$i_systypes I_SYS_TYPES        /**/
19390
19391 #if defined(I_SYS_TYPES)
19392 #include <sys/types.h>
19393 #endif
19394 #if defined(I_DIRENT)
19395 #include <dirent.h>
19396 #else
19397 #ifdef I_SYS_NDIR
19398 #include <sys/ndir.h>
19399 #else
19400 #ifdef I_SYS_DIR
19401 #ifdef hp9000s500
19402 #include <ndir.h>       /* may be wrong in the future */
19403 #else
19404 #include <sys/dir.h>
19405 #endif
19406 #endif
19407 #endif
19408 #endif
19409 int main() { return closedir(opendir(".")); }
19410 EOM
19411         set try
19412         if eval $compile_ok; then
19413                 if $run ./try > /dev/null 2>&1 ; then
19414                         echo "Yes, it does."
19415                         val="$undef"
19416                 else
19417                         echo "No, it doesn't."
19418                         val="$define"
19419                 fi
19420         else
19421                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19422                 val="$define"
19423         fi
19424         ;;
19425 *)
19426         val="$undef";
19427         ;;
19428 esac
19429 set d_void_closedir
19430 eval $setvar
19431 $rm_try
19432
19433 : see if there is a wait4
19434 set wait4 d_wait4
19435 eval $inlibc
19436
19437 : see if waitpid exists
19438 set waitpid d_waitpid
19439 eval $inlibc
19440
19441 : look for wcscmp
19442 echo " "
19443 $cat >try.c <<'EOCP'
19444 #include <stdio.h>
19445 #include <wchar.h>
19446 int main ()
19447 {
19448     wchar_t *s = L" ";
19449     return (wcscmp (s, s) ? 1 : 0);
19450     }
19451 EOCP
19452 set try
19453 val="$undef"
19454 if eval $compile; then
19455     `$run ./try`
19456     case "$?" in
19457         0)  echo "A working wcscmp() found." >&4
19458             val="$define" ;;
19459         *)  echo "wcscmp() found, but it doesn't work" >&4
19460             ;;
19461         esac
19462 else
19463     echo "wcscmp() NOT found." >&4
19464     fi
19465 set d_wcscmp
19466 eval $setvar
19467 $rm_try
19468
19469 : see if wcstombs exists
19470 set wcstombs d_wcstombs
19471 eval $inlibc
19472
19473 : look for wcsxfrm
19474 echo " "
19475 $cat >try.c <<'EOCP'
19476 #include <errno.h>
19477 #include <wchar.h>
19478 int main ()
19479 {
19480     wchar_t dst[4], *src = L" ";
19481     errno = 0;
19482     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19483     }
19484 EOCP
19485 set try
19486 val="$undef"
19487 if eval $compile; then
19488     `$run ./try`
19489     case "$?" in
19490         0)  echo "A working wcsxfrm() found." >&4
19491             val="$define" ;;
19492         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19493             ;;
19494         esac
19495 else
19496     echo "wcsxfrm() NOT found." >&4
19497     fi
19498 set d_wcsxfrm
19499 eval $setvar
19500 $rm_try
19501
19502 : see if wctomb exists
19503 set wctomb d_wctomb
19504 eval $inlibc
19505
19506 : see if writev exists
19507 set writev d_writev
19508 eval $inlibc
19509
19510 : check for alignment requirements
19511 echo " "
19512 case "$alignbytes" in
19513     '') echo "Checking alignment constraints..." >&4
19514         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19515             $cat >try.c <<'EOCP'
19516 typedef long double NV;
19517 EOCP
19518         else
19519             $cat >try.c <<'EOCP'
19520 typedef double NV;
19521 EOCP
19522         fi
19523         $cat >>try.c <<'EOCP'
19524 #include <stdio.h>
19525 struct foobar {
19526     char foo;
19527     NV bar;
19528 } try_algn;
19529 int main()
19530 {
19531     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19532     return(0);
19533 }
19534 EOCP
19535         set try
19536         if eval $compile_ok; then
19537             dflt=`$run ./try`
19538         else
19539             dflt='8'
19540             echo "(I can't seem to compile the test program...)"
19541         fi
19542         case "$multiarch" in
19543             *$define*)
19544                 : The usual safe value is 8, but Darwin with -Duselongdouble
19545                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19546                 : Configure to pick a larger value if needed.
19547                 if $test "$dflt" -lt 8; then
19548                     dflt='8'
19549                     echo "Setting alignment to 8 for multiarch support.">&4
19550                 fi
19551                 ;;
19552         esac
19553         ;;
19554     *) dflt="$alignbytes"
19555         ;;
19556 esac
19557 rp="Doubles must be aligned on a how-many-byte boundary?"
19558 . ./myread
19559 alignbytes="$ans"
19560 $rm_try
19561
19562 : set the base revision
19563 baserev=5.0
19564
19565 : length of character in bytes. Is always 1, otherwise it is not C
19566 : This used to be a test using sizeof
19567 charsize=1
19568
19569 : Check for the number of bits in a character
19570 case "$charbits" in
19571 '')     echo "Checking how long a character is (in bits)..." >&4
19572         $cat >try.c <<EOCP
19573 #include <stdio.h>
19574 int main ()
19575 {
19576     int n;
19577     unsigned char c;
19578     for (c = 1, n = 0; c; c <<= 1, n++) ;
19579     printf ("%d\n", n);
19580     return (0);
19581     }
19582 EOCP
19583         set try
19584         if eval $compile_ok; then
19585                 dflt=`$run ./try`
19586         else
19587                 dflt='8'
19588                 echo "(I can't seem to compile the test program.  Guessing...)"
19589         fi
19590         ;;
19591 *)
19592         dflt="$charbits"
19593         ;;
19594 esac
19595 rp="What is the length of a character (in bits)?"
19596 . ./myread
19597 charbits="$ans"
19598 $rm_try
19599 case "$charbits" in
19600 8)      ;;
19601 *)      cat >&4 << EOM
19602 Your system has an unsigned character size of $charbits bits, which
19603 is rather unusual (normally it is 8 bits).  Perl likely will not work
19604 correctly on your system, with subtle bugs in various places.
19605 EOM
19606         rp='Do you really want to continue?'
19607         dflt='n'
19608         . ./myread
19609         case "$ans" in
19610                 [yY])   echo >&4 "Okay, continuing."    ;;
19611                 *)      exit 1                          ;;
19612         esac
19613 esac
19614
19615 : how do we concatenate cpp tokens here?
19616 echo " "
19617 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19618 $cat >cpp_stuff.c <<'EOCP'
19619 #define RCAT(a,b)a/**/b
19620 #define ACAT(a,b)a ## b
19621 RCAT(Rei,ser)
19622 ACAT(Cir,cus)
19623 EOCP
19624 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19625 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19626         echo "Oh!  Smells like ANSI's been here." >&4
19627         echo "We can catify or stringify, separately or together!"
19628         cpp_stuff=42
19629 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19630         echo "Ah, yes!  The good old days!" >&4
19631         echo "However, in the good old days we don't know how to stringify and"
19632         echo "catify at the same time."
19633         cpp_stuff=1
19634 else
19635         $cat >&4 <<EOM
19636 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19637 You're going to have to edit the values of CAT[2-5] in config.h...
19638 EOM
19639         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19640 fi
19641 $rm -f cpp_stuff.*
19642
19643 : see if this is a db.h system
19644 set db.h i_db
19645 eval $inhdr
19646
19647 case "$i_db" in
19648 $define)
19649         : Check db version.
19650         echo " "
19651         echo "Checking Berkeley DB version ..." >&4
19652         $cat >try.c <<EOCP
19653 #$d_const HASCONST
19654 #ifndef HASCONST
19655 #define const
19656 #endif
19657 #include <sys/types.h>
19658 #include <stdio.h>
19659 #$i_stdlib I_STDLIB
19660 #ifdef I_STDLIB
19661 #include <stdlib.h>
19662 #endif
19663 #include <db.h>
19664 int main(int argc, char *argv[])
19665 {
19666 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19667     int Major, Minor, Patch ;
19668     unsigned long Version ;
19669     (void)db_version(&Major, &Minor, &Patch) ;
19670     if (argc == 2) {
19671         printf("%d %d %d %d %d %d\n",
19672                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19673                Major, Minor, Patch);
19674         exit(0);
19675     }
19676     printf("You have Berkeley DB Version 2 or greater.\n");
19677
19678     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19679                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19680     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19681                 Major, Minor, Patch) ;
19682
19683     /* check that db.h & libdb are compatible */
19684     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19685         printf("db.h and libdb are incompatible.\n") ;
19686         exit(3);
19687     }
19688
19689     printf("db.h and libdb are compatible.\n") ;
19690
19691     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19692                 + DB_VERSION_PATCH ;
19693
19694     /* needs to be >= 2.3.4 */
19695     if (Version < 2003004) {
19696     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19697         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19698         exit(2);
19699     }
19700
19701     exit(0);
19702 #else
19703 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19704     if (argc == 2) {
19705         printf("1 0 0\n");
19706         exit(0);
19707     }
19708     printf("You have Berkeley DB Version 1.\n");
19709     exit(0);    /* DB version < 2: the coast is clear. */
19710 #else
19711     exit(1);    /* <db.h> not Berkeley DB? */
19712 #endif
19713 #endif
19714 }
19715 EOCP
19716         set try
19717         if eval $compile_ok && $run ./try; then
19718                 echo 'Looks OK.' >&4
19719                 set `$run ./try 1`
19720                 db_version_major=$1
19721                 db_version_minor=$2
19722                 db_version_patch=$3
19723         else
19724                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19725                 i_db=$undef
19726                 case " $libs " in
19727                 *"-ldb "*)
19728                         : Remove db from list of libraries to use
19729                         echo "Removing unusable -ldb from library list" >&4
19730                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19731                         shift
19732                         libs="$*"
19733                         echo "libs = $libs" >&4
19734                         ;;
19735                 esac
19736         fi
19737         $rm_try
19738         ;;
19739 esac
19740
19741 case "$i_db" in
19742 define)
19743         : Check the return type needed for hash
19744         echo " "
19745         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19746         $cat >try.c <<EOCP
19747 #$d_const HASCONST
19748 #ifndef HASCONST
19749 #define const
19750 #endif
19751 #include <sys/types.h>
19752 #include <db.h>
19753
19754 #ifndef DB_VERSION_MAJOR
19755 u_int32_t hash_cb (const void* ptr, size_t size)
19756 {
19757 }
19758 HASHINFO info;
19759 int main()
19760 {
19761         info.hash = hash_cb;
19762 }
19763 #endif
19764 EOCP
19765         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19766                 if $contains warning try.out >>/dev/null 2>&1 ; then
19767                         db_hashtype='int'
19768                 else
19769                         db_hashtype='u_int32_t'
19770                 fi
19771         else
19772                 : XXX Maybe we should just give up here.
19773                 db_hashtype=u_int32_t
19774                 $cat try.out >&4
19775                 echo "Help:  I can't seem to compile the db test program." >&4
19776                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19777         fi
19778         $rm_try
19779         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19780         ;;
19781 *)      db_hashtype=u_int32_t
19782         ;;
19783 esac
19784 case "$i_db" in
19785 define)
19786         : Check the return type needed for prefix
19787         echo " "
19788         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19789         cat >try.c <<EOCP
19790 #$d_const HASCONST
19791 #ifndef HASCONST
19792 #define const
19793 #endif
19794 #include <sys/types.h>
19795 #include <db.h>
19796
19797 #ifndef DB_VERSION_MAJOR
19798 size_t prefix_cb (const DBT *key1, const DBT *key2)
19799 {
19800 }
19801 BTREEINFO info;
19802 int main()
19803 {
19804         info.prefix = prefix_cb;
19805 }
19806 #endif
19807 EOCP
19808         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19809                 if $contains warning try.out >>/dev/null 2>&1 ; then
19810                         db_prefixtype='int'
19811                 else
19812                         db_prefixtype='size_t'
19813                 fi
19814         else
19815                 db_prefixtype='size_t'
19816                 : XXX Maybe we should just give up here.
19817                 $cat try.out >&4
19818                 echo "Help:  I can't seem to compile the db test program." >&4
19819                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19820         fi
19821         $rm_try
19822         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19823         ;;
19824 *)      db_prefixtype='size_t'
19825         ;;
19826 esac
19827
19828 : How can we generate normalized random numbers ?
19829 echo " "
19830 echo "Using our internal random number implementation..." >&4
19831
19832 case "$ccflags" in
19833 *-Dmy_rand=*|*-Dmy_srand=*)
19834         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19835         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19836         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19837         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19838         ;;
19839 esac
19840
19841 randfunc=Perl_drand48
19842 drand01="Perl_drand48()"
19843 seedfunc="Perl_drand48_init"
19844 randbits=48
19845 randseedtype=U32
19846
19847 : Determine if this is an EBCDIC system
19848 echo " "
19849 echo "Determining whether or not we are on an EBCDIC system..." >&4
19850 $cat >try.c <<'EOM'
19851 int main()
19852 {
19853   if ('M'==0xd4) return 0;
19854   return 1;
19855 }
19856 EOM
19857
19858 val=$undef
19859 set try
19860 if eval $compile_ok; then
19861         if $run ./try; then
19862                 echo "You seem to speak EBCDIC." >&4
19863                 val="$define"
19864         else
19865                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19866         fi
19867 else
19868         echo "I'm unable to compile the test program." >&4
19869         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19870 fi
19871 $rm_try
19872 set ebcdic
19873 eval $setvar
19874
19875 : Check how to flush
19876 echo " "
19877 $cat >&4 <<EOM
19878 Checking how to flush all pending stdio output...
19879 EOM
19880 # I only know how to find the first 32 possibly open files on SunOS.
19881 # See also hints/sunos_4_1.sh and util.c  --AD
19882 case "$osname" in
19883 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19884 esac
19885 $cat >>try.c <<EOCP
19886 #include <stdio.h>
19887 #$i_stdlib I_STDLIB
19888 #ifdef I_STDLIB
19889 #include <stdlib.h>
19890 #endif
19891 #$i_unistd I_UNISTD
19892 #ifdef I_UNISTD
19893 # include <unistd.h>
19894 #endif
19895 #$d_sysconf HAS_SYSCONF
19896 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19897 #ifdef HAS_STDIO_STREAM_ARRAY
19898 # define STDIO_STREAM_ARRAY $stdio_stream_array
19899 #endif
19900 int main() {
19901   FILE* p;
19902   unlink("try.out");
19903   p = fopen("try.out", "w");
19904 #ifdef TRY_FPUTC
19905   fputc('x', p);
19906 #else
19907 # ifdef TRY_FPRINTF
19908   fprintf(p, "x");
19909 # endif
19910 #endif
19911 #ifdef TRY_FFLUSH_NULL
19912   fflush(NULL);
19913 #endif
19914 #ifdef TRY_FFLUSH_ALL
19915   {
19916     long open_max = -1;
19917 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19918     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19919 # else
19920 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19921     open_max = sysconf(_SC_OPEN_MAX);
19922 #  else
19923 #   ifdef FOPEN_MAX
19924     open_max = FOPEN_MAX;
19925 #   else
19926 #    ifdef OPEN_MAX
19927     open_max = OPEN_MAX;
19928 #    else
19929 #     ifdef _NFILE
19930     open_max = _NFILE;
19931 #     endif
19932 #    endif
19933 #   endif
19934 #  endif
19935 # endif
19936 # ifdef HAS_STDIO_STREAM_ARRAY
19937     if (open_max > 0) {
19938       long i;
19939       for (i = 0; i < open_max; i++)
19940             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19941                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19942                 STDIO_STREAM_ARRAY[i]._flag)
19943                 fflush(&STDIO_STREAM_ARRAY[i]);
19944     }
19945   }
19946 # endif
19947 #endif
19948   _exit(42);
19949 }
19950 EOCP
19951 : first we have to find out how _not_ to flush
19952 $to try.c
19953 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19954     output=''
19955     set try -DTRY_FPUTC
19956     if eval $compile; then
19957             $run ./try 2>/dev/null
19958             code="$?"
19959             $from try.out
19960             if $test ! -s try.out -a "X$code" = X42; then
19961                 output=-DTRY_FPUTC
19962             fi
19963     fi
19964     case "$output" in
19965     '')
19966             set try -DTRY_FPRINTF
19967             if eval $compile; then
19968                     $run ./try 2>/dev/null
19969                     code="$?"
19970                     $from try.out
19971                     if $test ! -s try.out -a "X$code" = X42; then
19972                         output=-DTRY_FPRINTF
19973                     fi
19974             fi
19975         ;;
19976     esac
19977 fi
19978 : check for fflush NULL behavior
19979 case "$fflushNULL" in
19980 '')     set try -DTRY_FFLUSH_NULL $output
19981         if eval $compile; then
19982                 $run ./try 2>/dev/null
19983                 code="$?"
19984                 $from try.out
19985                 if $test -s try.out -a "X$code" = X42; then
19986                         fflushNULL="`$cat try.out`"
19987                 else
19988                         if $test "X$code" != X42; then
19989                                 $cat >&4 <<EOM
19990 (If this test failed, don't worry, we'll try another method shortly.)
19991 EOM
19992                         fi
19993                 fi
19994         fi
19995         $rm -f core try.core core.try.*
19996         case "$fflushNULL" in
19997         x)      $cat >&4 <<EOM
19998 Your fflush(NULL) works okay for output streams.
19999 Let's see if it clobbers input pipes...
20000 EOM
20001 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20002 # bug that improperly flushes the input end of pipes.  So we avoid the
20003 # autoflush on fork/system/exec support for now. :-(
20004 $cat >tryp.c <<EOCP
20005 #include <stdio.h>
20006 int
20007 main(int argc, char **argv)
20008 {
20009     char buf[1024];
20010     int i;
20011     char *bp = buf;
20012     while (1) {
20013         while ((i = getc(stdin)) != -1
20014                && (*bp++ = i) != '\n'
20015                && bp < &buf[1024])
20016         /* DO NOTHING */ ;
20017         *bp = '\0';
20018         fprintf(stdout, "%s", buf);
20019         fflush(NULL);
20020         if (i == -1)
20021             return 0;
20022         bp = buf;
20023     }
20024 }
20025 EOCP
20026                 fflushNULL="$define"
20027                 set tryp
20028                 if eval $compile; then
20029                     $rm -f tryp.out
20030                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20031                     if $test "X$targethost" != X; then
20032                         $to tryp.c
20033                         $to tryp
20034                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20035                     else
20036                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20037                     fi
20038                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20039                        $cat >&4 <<EOM
20040 fflush(NULL) seems to behave okay with input streams.
20041 EOM
20042                         fflushNULL="$define"
20043                     else
20044                         $cat >&4 <<EOM
20045 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20046 EOM
20047                         fflushNULL="$undef"
20048                     fi
20049                 fi
20050                 $rm -f core tryp.c tryp.core core.tryp.*
20051                 ;;
20052         '')     $cat >&4 <<EOM
20053 Your fflush(NULL) isn't working (contrary to ANSI C).
20054 EOM
20055                 fflushNULL="$undef"
20056                 ;;
20057         *)      $cat >&4 <<EOM
20058 Cannot figure out whether your fflush(NULL) works or not.
20059 I'm assuming it doesn't (contrary to ANSI C).
20060 EOM
20061                 fflushNULL="$undef"
20062                 ;;
20063         esac
20064         ;;
20065 $define|true|[yY]*)
20066         fflushNULL="$define"
20067         ;;
20068 *)
20069         fflushNULL="$undef"
20070         ;;
20071 esac
20072 : check explicit looping only if NULL did not work, and if the pipe
20073 : bug does not show up on an explicit flush too
20074 case "$fflushNULL" in
20075 "$undef")
20076         $cat >tryp.c <<EOCP
20077 #include <stdio.h>
20078 int
20079 main(int argc, char **argv)
20080 {
20081     char buf[1024];
20082     int i;
20083     char *bp = buf;
20084     while (1) {
20085         while ((i = getc(stdin)) != -1
20086                && (*bp++ = i) != '\n'
20087                && bp < &buf[1024])
20088         /* DO NOTHING */ ;
20089         *bp = '\0';
20090         fprintf(stdout, "%s", buf);
20091         fflush(stdin);
20092         if (i == -1)
20093             return 0;
20094         bp = buf;
20095     }
20096 }
20097 EOCP
20098         set tryp
20099         if eval $compile; then
20100             $rm -f tryp.out
20101             if $test "X$targethost" != X; then
20102                 $to tryp.c
20103                 $to tryp
20104                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20105             else
20106                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20107             fi
20108             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20109                $cat >&4 <<EOM
20110 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20111 EOM
20112                 : now check for fflushall behaviour
20113                 case "$fflushall" in
20114                 '')     set try -DTRY_FFLUSH_ALL $output
20115                         if eval $compile; then
20116                                 $cat >&4 <<EOM
20117 (Now testing the other method--but note that this also may fail.)
20118 EOM
20119                                 $run ./try 2>/dev/null
20120                                 code=$?
20121                                 $from try.out
20122                                 if $test -s try.out -a "X$code" = X42; then
20123                                         fflushall="`$cat try.out`"
20124                                 fi
20125                         fi
20126                         $rm_try
20127                         case "$fflushall" in
20128                         x)      $cat >&4 <<EOM
20129 Whew. Flushing explicitly all the stdio streams works.
20130 EOM
20131                                 fflushall="$define"
20132                                 ;;
20133                         '')     $cat >&4 <<EOM
20134 Sigh. Flushing explicitly all the stdio streams doesn't work.
20135 EOM
20136                                 fflushall="$undef"
20137                                 ;;
20138                         *)      $cat >&4 <<EOM
20139 Cannot figure out whether flushing stdio streams explicitly works or not.
20140 I'm assuming it doesn't.
20141 EOM
20142                                 fflushall="$undef"
20143                                 ;;
20144                         esac
20145                         ;;
20146                 "$define"|true|[yY]*)
20147                         fflushall="$define"
20148                         ;;
20149                 *)
20150                         fflushall="$undef"
20151                         ;;
20152                 esac
20153             else
20154                 $cat >&4 <<EOM
20155 All is futile.  Even fflush(stdin) clobbers input pipes!
20156 EOM
20157                 fflushall="$undef"
20158             fi
20159         else
20160             fflushall="$undef"
20161         fi
20162         $rm -f core tryp.c tryp.core core.tryp.*
20163         ;;
20164 *)      fflushall="$undef"
20165         ;;
20166 esac
20167
20168 case "$fflushNULL$fflushall" in
20169 undefundef)
20170         $cat <<EOM
20171 OK, I give up.  I cannot figure out how to flush pending stdio output.
20172 We won't be flushing handles at all before fork/exec/popen.
20173 EOM
20174         ;;
20175 esac
20176 $rm_try tryp
20177
20178 : Store the full pathname to the ar program for use in the C program
20179 : Respect a hint or command line value for full_ar.
20180 case "$full_ar" in
20181 '') full_ar=$ar ;;
20182 esac
20183
20184 : Store the full pathname to the sed program for use in the C program
20185 full_sed=$sed
20186
20187 : see what type gids are declared as in the kernel
20188 echo " "
20189 echo "Looking for the type for group ids returned by getgid()."
20190 set gid_t gidtype xxx stdio.h sys/types.h
20191 eval $typedef
20192 case "$gidtype" in
20193 xxx)
20194         xxx=`./findhdr sys/user.h`
20195         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20196         case $1 in
20197         unsigned) dflt="$1 $2" ;;
20198         *) dflt="$1" ;;
20199         esac
20200         ;;
20201 *) dflt="$gidtype";;
20202 esac
20203 case "$gidtype" in
20204 gid_t) echo "gid_t found." ;;
20205 *)      rp="What is the type for group ids returned by getgid()?"
20206         . ./myread
20207         gidtype="$ans"
20208         ;;
20209 esac
20210
20211 : Check the size of GID
20212 echo " "
20213 case "$gidtype" in
20214 *_t) zzz="$gidtype"     ;;
20215 *)   zzz="gid"          ;;
20216 esac
20217 echo "Checking the size of $zzz..." >&4
20218 cat > try.c <<EOCP
20219 #include <sys/types.h>
20220 #include <stdio.h>
20221 #$i_stdlib I_STDLIB
20222 #ifdef I_STDLIB
20223 #include <stdlib.h>
20224 #endif
20225 int main() {
20226     printf("%d\n", (int)sizeof($gidtype));
20227     exit(0);
20228 }
20229 EOCP
20230 set try
20231 if eval $compile_ok; then
20232         yyy=`$run ./try`
20233         case "$yyy" in
20234         '')     gidsize=4
20235                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20236                 ;;
20237         *)      gidsize=$yyy
20238                 echo "Your $zzz is $gidsize bytes long."
20239                 ;;
20240         esac
20241 else
20242         gidsize=4
20243         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20244 fi
20245
20246
20247 : Check if GID is signed
20248 echo " "
20249 case "$gidtype" in
20250 *_t) zzz="$gidtype"     ;;
20251 *)   zzz="gid"          ;;
20252 esac
20253 echo "Checking the sign of $zzz..." >&4
20254 cat > try.c <<EOCP
20255 #include <sys/types.h>
20256 #include <stdio.h>
20257 int main() {
20258         $gidtype foo = -1;
20259         if (foo < 0)
20260                 printf("-1\n");
20261         else
20262                 printf("1\n");
20263 }
20264 EOCP
20265 set try
20266 if eval $compile; then
20267         yyy=`$run ./try`
20268         case "$yyy" in
20269         '')     gidsign=1
20270                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20271                 ;;
20272         *)      gidsign=$yyy
20273                 case "$gidsign" in
20274                  1) echo "Your $zzz is unsigned." ;;
20275                 -1) echo "Your $zzz is signed."   ;;
20276                 esac
20277                 ;;
20278         esac
20279 else
20280         gidsign=1
20281         echo "(I can't compile the test program--guessing unsigned.)" >&4
20282 fi
20283
20284
20285 : Check 64bit sizes
20286 echo " "
20287
20288 if $test X"$quadtype" != X; then
20289
20290 echo "Checking how to print 64-bit integers..." >&4
20291
20292 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20293         $cat >try.c <<'EOCP'
20294 #include <sys/types.h>
20295 #include <stdio.h>
20296 int main() {
20297   int q = 12345678901;
20298   printf("%ld\n", q);
20299 }
20300 EOCP
20301         set try
20302         if eval $compile; then
20303                 yyy=`$run ./try`
20304                 case "$yyy" in
20305                 12345678901)
20306                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20307                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20308                         echo "We will use %d."
20309                         ;;
20310                 esac
20311         fi
20312 fi
20313
20314 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20315         $cat >try.c <<'EOCP'
20316 #include <sys/types.h>
20317 #include <stdio.h>
20318 int main() {
20319   long q = 12345678901;
20320   printf("%ld\n", q);
20321 }
20322 EOCP
20323         set try
20324         if eval $compile; then
20325                 yyy=`$run ./try`
20326                 case "$yyy" in
20327                 12345678901)
20328                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20329                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20330                         echo "We will use %ld."
20331                         ;;
20332                 esac
20333         fi
20334 fi
20335
20336 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20337         $cat >try.c <<'EOCP'
20338 #include <sys/types.h>
20339 #include <inttypes.h>
20340 #include <stdio.h>
20341 int main() {
20342   int64_t q = 12345678901;
20343   printf("%" PRId64 "\n", q);
20344 }
20345 EOCP
20346         set try
20347         if eval $compile; then
20348                 yyy=`$run ./try`
20349                 case "$yyy" in
20350                 12345678901)
20351                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20352                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20353                         echo "We will use the C9X style."
20354                         ;;
20355                 esac
20356         fi
20357 fi
20358
20359 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20360         $cat >try.c <<EOCP
20361 #include <sys/types.h>
20362 #include <stdio.h>
20363 int main() {
20364   $quadtype q = 12345678901;
20365   printf("%Ld\n", q);
20366 }
20367 EOCP
20368         set try
20369         if eval $compile; then
20370                 yyy=`$run ./try`
20371                 case "$yyy" in
20372                 12345678901)
20373                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20374                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20375                         echo "We will use %Ld."
20376                         ;;
20377                 esac
20378         fi
20379 fi
20380
20381 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20382         $cat >try.c <<'EOCP'
20383 #include <sys/types.h>
20384 #include <stdio.h>
20385 int main() {
20386   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20387   printf("%lld\n", q);
20388 }
20389 EOCP
20390         set try
20391         if eval $compile; then
20392                 yyy=`$run ./try`
20393                 case "$yyy" in
20394                 12345678901)
20395                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20396                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20397                         echo "We will use the %lld style."
20398                         ;;
20399                 esac
20400         fi
20401 fi
20402
20403 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20404         $cat >try.c <<EOCP
20405 #include <sys/types.h>
20406 #include <stdio.h>
20407 int main() {
20408   $quadtype q = 12345678901;
20409   printf("%qd\n", q);
20410 }
20411 EOCP
20412         set try
20413         if eval $compile; then
20414                 yyy=`$run ./try`
20415                 case "$yyy" in
20416                 12345678901)
20417                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20418                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20419                         echo "We will use %qd."
20420                         ;;
20421                 esac
20422         fi
20423 fi
20424
20425 if $test X"$sPRId64" = X; then
20426         echo "Cannot figure out how to print 64-bit integers." >&4
20427 fi
20428 $rm_try
20429
20430 fi
20431
20432 case "$sPRId64" in
20433 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20434         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20435         ;;
20436 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20437         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20438         ;;
20439 esac
20440
20441 : Check format strings for internal types
20442 echo " "
20443 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20444
20445 if $test X"$ivsize" = X8; then
20446         ivdformat="$sPRId64"
20447         uvuformat="$sPRIu64"
20448         uvoformat="$sPRIo64"
20449         uvxformat="$sPRIx64"
20450         uvXUformat="$sPRIXU64"
20451 else
20452         if $test X"$ivsize" = X"$longsize"; then
20453                 ivdformat='"ld"'
20454                 uvuformat='"lu"'
20455                 uvoformat='"lo"'
20456                 uvxformat='"lx"'
20457                 uvXUformat='"lX"'
20458         else
20459                 if $test X"$ivsize" = X"$intsize"; then
20460                         ivdformat='"d"'
20461                         uvuformat='"u"'
20462                         uvoformat='"o"'
20463                         uvxformat='"x"'
20464                         uvXUformat='"X"'
20465                 else
20466                         : far out
20467                         if $test X"$ivsize" = X"$shortsize"; then
20468                                 ivdformat='"hd"'
20469                                 uvuformat='"hu"'
20470                                 uvoformat='"ho"'
20471                                 uvxformat='"hx"'
20472                                 uvXUformat='"hX"'
20473                         fi
20474                 fi
20475         fi
20476 fi
20477
20478 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20479         nveformat="$sPRIeldbl"
20480         nvfformat="$sPRIfldbl"
20481         nvgformat="$sPRIgldbl"
20482         nvEUformat="$sPRIEUldbl"
20483         nvFUformat="$sPRIFUldbl"
20484         nvGUformat="$sPRIGUldbl"
20485 else
20486         nveformat='"e"'
20487         nvfformat='"f"'
20488         nvgformat='"g"'
20489         nvEUformat='"E"'
20490         nvFUformat='"F"'
20491         nvGUformat='"G"'
20492 fi
20493
20494 case "$ivdformat" in
20495 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20496     exit 1
20497     ;;
20498 esac
20499
20500 : Check format string for GID
20501
20502 echo " "
20503 $echo "Checking the format string to be used for gids..." >&4
20504
20505 case "$gidsign" in
20506 -1)     if $test X"$gidsize" = X"$ivsize"; then
20507                 gidformat="$ivdformat"
20508         else
20509                 if $test X"$gidsize" = X"$longsize"; then
20510                         gidformat='"ld"'
20511                 else
20512                         if $test X"$gidsize" = X"$intsize"; then
20513                                 gidformat='"d"'
20514                         else
20515                                 if $test X"$gidsize" = X"$shortsize"; then
20516                                         gidformat='"hd"'
20517                                 fi
20518                         fi
20519                 fi
20520         fi
20521         ;;
20522 *)      if $test X"$gidsize" = X"$uvsize"; then
20523                 gidformat="$uvuformat"
20524         else
20525                 if $test X"$gidsize" = X"$longsize"; then
20526                         gidformat='"lu"'
20527                 else
20528                         if $test X"$gidsize" = X"$intsize"; then
20529                                 gidformat='"u"'
20530                         else
20531                                 if $test X"$gidsize" = X"$shortsize"; then
20532                                         gidformat='"hu"'
20533                                 fi
20534                         fi
20535                 fi
20536         fi
20537         ;;
20538 esac
20539
20540 : see if getgroups exists
20541 set getgroups d_getgrps
20542 eval $inlibc
20543
20544 : see if setgroups exists
20545 set setgroups d_setgrps
20546 eval $inlibc
20547
20548 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20549 echo " "
20550 case "$d_getgrps$d_setgrps" in
20551 *define*)
20552         case "$groupstype" in
20553         '') dflt="$gidtype" ;;
20554         *)  dflt="$groupstype" ;;
20555         esac
20556         $cat <<EOM
20557 What type of pointer is the second argument to getgroups() and setgroups()?
20558 Usually this is the same as group ids, $gidtype, but not always.
20559
20560 EOM
20561         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20562         . ./myread
20563         groupstype="$ans"
20564         ;;
20565 *)  groupstype="$gidtype";;
20566 esac
20567
20568 : check whether make sets MAKE
20569 echo " "
20570 echo "Checking if your $make program sets \$(MAKE)..." >&4
20571 case "$make_set_make" in
20572 '')
20573         $sed 's/^X //' > testmake.mak << 'EOF'
20574 Xall:
20575 X       @echo 'maketemp="$(MAKE)"'
20576 EOF
20577         case "`$make -f testmake.mak 2>/dev/null`" in
20578         *maketemp=*) make_set_make='#' ;;
20579         *)      make_set_make="MAKE=$make" ;;
20580         esac
20581         $rm -f testmake.mak
20582         ;;
20583 esac
20584 case "$make_set_make" in
20585 '#') echo "Yup, it does.";;
20586 *) echo "Nope, it doesn't.";;
20587 esac
20588
20589 : see what type is used for mode_t
20590 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20591 set mode_t modetype int stdio.h sys/types.h
20592 eval $typedef_ask
20593
20594 : see if we need va_copy
20595 echo " "
20596 case "$i_stdarg" in
20597 "$define")
20598         $cat >try.c <<EOCP
20599 #include <stdarg.h>
20600 #include <stdio.h>
20601 #$i_stdlib I_STDLIB
20602 #ifdef I_STDLIB
20603 #include <stdlib.h>
20604 #endif
20605 #include <signal.h>
20606
20607 int
20608 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20609 {
20610   return vfprintf(f, fmt, *valp);
20611 }
20612
20613 int
20614 myvfprintf(FILE *f, const  char *fmt, va_list val)
20615 {
20616   return ivfprintf(f, fmt, &val);
20617 }
20618
20619 int
20620 myprintf(char *fmt, ...)
20621 {
20622   va_list val;
20623   va_start(val, fmt);
20624   return myvfprintf(stdout, fmt, val);
20625 }
20626
20627 int
20628 main(int ac, char **av)
20629 {
20630   signal(SIGSEGV, exit);
20631
20632   myprintf("%s%cs all right, then\n", "that", '\'');
20633   exit(0);
20634 }
20635 EOCP
20636         set try
20637         if eval $compile && $run ./try 2>&1 >/dev/null; then
20638                 case "`$run ./try`" in
20639                 "that's all right, then")
20640                         okay=yes
20641                         ;;
20642                 esac
20643         fi
20644         case "$okay" in
20645         yes)    echo "It seems that you don't need va_copy()." >&4
20646                 need_va_copy="$undef"
20647                 ;;
20648         *)      echo "It seems that va_copy() or similar will be needed." >&4
20649                 need_va_copy="$define"
20650                 ;;
20651         esac
20652         $rm_try
20653         ;;
20654 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20655         need_va_copy="$undef"
20656         ;;
20657 esac
20658
20659 : see what type is used for size_t
20660 rp="What is the type used for the length parameter for string functions?"
20661 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20662 eval $typedef_ask
20663
20664 : check for type of arguments to gethostbyaddr. 
20665 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20666         case "$d_gethbyaddr" in
20667         $define)
20668                 $cat <<EOM
20669
20670 Checking to see what type of arguments are accepted by gethostbyaddr().
20671 EOM
20672                 hdrs="$define sys/types.h
20673                         $d_socket sys/socket.h 
20674                         $i_niin netinet/in.h 
20675                         $i_netdb netdb.h
20676                         $i_unistd unistd.h"
20677                 : The first arg can 'char *' or 'void *'
20678                 : The second arg is some of integral type
20679                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20680                         for yyy in size_t long int; do
20681                                 case "$netdb_host_type" in
20682                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20683                                         if ./protochk "$try" $hdrs; then
20684                                                 echo "Your system accepts $xxx for the first arg."
20685                                                 echo "...and $yyy for the second arg."
20686                                                 netdb_host_type="$xxx"
20687                                                 netdb_hlen_type="$yyy"
20688                                         fi
20689                                         ;;
20690                                 esac
20691                         done
20692                 done
20693                 : In case none of those worked, prompt the user.
20694                 case "$netdb_host_type" in
20695                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20696                         dflt='char *'
20697                         . ./myread
20698                         netdb_host_type=$ans
20699                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20700                         dflt="$sizetype"
20701                         . ./myread
20702                         netdb_hlen_type=$ans
20703                         ;;
20704                 esac
20705                 ;;
20706         *)      : no gethostbyaddr, so pick harmless defaults
20707                 netdb_host_type='char *'
20708                 netdb_hlen_type="$sizetype"
20709                 ;;
20710         esac
20711         # Remove the "const" if needed. -- but then we'll have a 
20712         # prototype clash!
20713         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20714 fi
20715
20716 : check for type of argument to gethostbyname. 
20717 if test "X$netdb_name_type" = X ; then
20718         case "$d_gethbyname" in
20719         $define)
20720                 $cat <<EOM
20721
20722 Checking to see what type of argument is accepted by gethostbyname().
20723 EOM
20724                 hdrs="$define sys/types.h
20725                         $d_socket sys/socket.h 
20726                         $i_niin netinet/in.h 
20727                         $i_netdb netdb.h
20728                         $i_unistd unistd.h"
20729                 for xxx in "const char *" "char *"; do
20730                         case "$netdb_name_type" in
20731                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20732                                 if ./protochk "$try" $hdrs; then
20733                                         echo "Your system accepts $xxx."
20734                                         netdb_name_type="$xxx"
20735                                 fi
20736                                 ;;
20737                         esac
20738                 done
20739                 : In case none of those worked, prompt the user.
20740                 case "$netdb_name_type" in
20741                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20742                         dflt='char *'
20743                         . ./myread
20744                         netdb_name_type=$ans
20745                         ;;
20746                 esac
20747                 ;;
20748         *)      : no gethostbyname, so pick harmless default
20749                 netdb_name_type='char *'
20750                 ;;
20751         esac
20752 fi
20753
20754 : check for type of 1st argument to getnetbyaddr. 
20755 if test "X$netdb_net_type" = X ; then
20756         case "$d_getnbyaddr" in
20757         $define)
20758                 $cat <<EOM
20759
20760 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20761 EOM
20762                 hdrs="$define sys/types.h
20763                         $d_socket sys/socket.h 
20764                         $i_niin netinet/in.h 
20765                         $i_netdb netdb.h
20766                         $i_unistd unistd.h"
20767                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20768                         case "$netdb_net_type" in
20769                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20770                                 if ./protochk "$try" $hdrs; then
20771                                         echo "Your system accepts $xxx."
20772                                         netdb_net_type="$xxx"
20773                                 fi
20774                                 ;;
20775                         esac
20776                 done
20777                 : In case none of those worked, prompt the user.
20778                 case "$netdb_net_type" in
20779                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20780                         dflt='long'
20781                         . ./myread
20782                         netdb_net_type=$ans
20783                         ;;
20784                 esac
20785                 ;;
20786         *)      : no getnetbyaddr, so pick harmless default
20787                 netdb_net_type='long'
20788                 ;;
20789         esac
20790 fi
20791 : locate the preferred pager for this system
20792 fn=f/
20793 case "$pager" in
20794 '')
20795         dflt=''
20796         case "$pg" in
20797         /*) dflt=$pg;;
20798         [a-zA-Z]:/*) dflt=$pg;;
20799         esac
20800         case "$more" in
20801         /*) dflt=$more;;
20802         [a-zA-Z]:/*) dflt=$more;;
20803         esac
20804         case "$less" in
20805         /*) dflt=$less;;
20806         [a-zA-Z]:/*) dflt=$less;;
20807         esac
20808         case "$dflt" in
20809         '') dflt=/usr/ucb/more;;
20810         esac
20811         ;;
20812 *)      dflt="$pager"
20813         ;;
20814 esac
20815 fn="f/($dflt)"
20816 echo " "
20817 rp='What pager is used on your system?'
20818 . ./getfile
20819 pager="$ans"
20820
20821 : see what type pids are declared as in the kernel
20822 rp="What is the type of process ids on this system?"
20823 set pid_t pidtype int stdio.h sys/types.h
20824 eval $typedef_ask
20825
20826 : see if ar generates random libraries by itself
20827 echo " "
20828 echo "Checking how to generate random libraries on your machine..." >&4
20829 echo 'int bar1() { return bar2(); }' > bar1.c
20830 echo 'int bar2() { return 2; }' > bar2.c
20831 $cat > foo.c <<EOP
20832 #$i_stdlib I_STDLIB
20833 #ifdef I_STDLIB
20834 #include <stdlib.h>
20835 #endif
20836 int main() { printf("%d\n", bar1()); exit(0); }
20837 EOP
20838 $cc $ccflags -c bar1.c >/dev/null 2>&1
20839 $cc $ccflags -c bar2.c >/dev/null 2>&1
20840 $cc $ccflags -c foo.c >/dev/null 2>&1
20841 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20842 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20843         $run ./foobar >/dev/null 2>&1; then
20844         echo "$ar appears to generate random libraries itself."
20845         orderlib=false
20846         if [ "X$ranlib" = "X" ]; then
20847             ranlib=":"
20848         fi
20849 elif $ar s bar$_a >/dev/null 2>&1 &&
20850         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20851         $run ./foobar >/dev/null 2>&1; then
20852                 echo "a table of contents needs to be added with '$ar s'."
20853                 orderlib=false
20854                 ranlib="$ar s"
20855 elif $ar ts bar$_a >/dev/null 2>&1 &&
20856         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20857         $run ./foobar >/dev/null 2>&1; then
20858                 echo "a table of contents needs to be added with '$ar ts'."
20859                 orderlib=false
20860                 ranlib="$ar ts"
20861 else
20862         case "$ranlib" in
20863         :) ranlib='';;
20864         '')
20865                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20866                 $test -f $ranlib || ranlib=''
20867                 ;;
20868         esac
20869         if $test -n "$ranlib"; then
20870                 echo "your system has '$ranlib'; we'll use that."
20871                 orderlib=false
20872         else
20873                 echo "your system doesn't seem to support random libraries"
20874                 echo "so we'll use lorder and tsort to order the libraries."
20875                 orderlib=true
20876                 ranlib=":"
20877         fi
20878 fi
20879 $rm -f foo* bar*
20880
20881 : see if this is a values.h system
20882 set values.h i_values
20883 eval $inhdr
20884
20885 : Check the max offset that gmtime and localtime accept
20886 echo "Checking max offsets that gmtime () accepts"
20887
20888 case $i_values in
20889     define) yyy="#include <values.h>" ;;
20890     *)      yyy="" ;;
20891     esac
20892
20893 case "$sGMTIME_min/$sGMTIME_max" in
20894     0/0|/)
20895         $cat >try.c <<EOCP
20896 #include <sys/types.h>
20897 #include <stdio.h>
20898 #include <time.h>
20899 $yyy
20900
20901 int i;
20902 struct tm *tmp;
20903 time_t pt;
20904
20905 void gm_check (time_t t, int min_year, int max_year)
20906 {
20907     tmp = gmtime (&t);
20908     if ( tmp == NULL ||
20909         /* Check tm_year overflow */
20910          tmp->tm_year < min_year || tmp->tm_year > max_year)
20911         tmp = NULL;
20912     else
20913         pt = t;
20914     } /* gm_check */
20915
20916 int check_max ()
20917 {
20918     tmp = NULL;
20919     pt  = 0;
20920 #ifdef MAXLONG
20921     gm_check (MAXLONG, 69, 0x7fffffff);
20922 #endif
20923     if (tmp == NULL || tmp->tm_year < 0) {
20924         for (i = 63; i >= 0; i--) {
20925             time_t x = pt | ((time_t)1 << i);
20926             if (x < 0 || x < pt) continue;
20927             gm_check (x, 69, 0x7fffffff);
20928             }
20929         }
20930     printf ("sGMTIME_max=%ld\n", pt);
20931     return (0);
20932     } /* check_max */
20933
20934 int check_min ()
20935 {
20936     tmp = NULL;
20937     pt  = 0;
20938 #ifdef MINLONG
20939     gm_check (MINLONG, -1900, 70);
20940 #endif
20941     if (tmp == NULL) {
20942         for (i = 36; i >= 0; i--) {
20943             time_t x = pt - ((time_t)1 << i);
20944             if (x > 0) continue;
20945             gm_check (x, -1900, 70);
20946             }
20947         }
20948     printf ("sGMTIME_min=%ld\n", pt);
20949     return (0);
20950     } /* check_min */
20951
20952 int main (int argc, char *argv[])
20953 {
20954     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20955     check_max ();
20956     check_min ();
20957     return (0);
20958     } /* main */
20959 EOCP
20960         set try
20961         if eval $compile; then
20962             eval `$run ./try`
20963         else
20964             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20965             fi
20966         $rm_try
20967         ;;
20968     esac
20969
20970 echo "Checking max offsets that localtime () accepts"
20971
20972 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20973     0/0|/)
20974         $cat >try.c <<EOCP
20975 #include <sys/types.h>
20976 #include <stdio.h>
20977 #include <time.h>
20978 $yyy
20979
20980 int i;
20981 struct tm *tmp;
20982 time_t pt;
20983
20984 void local_check (time_t t, int min_year, int max_year)
20985 {
20986     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20987         tmp = NULL;
20988     else
20989         tmp = localtime (&t);
20990     if ( tmp == NULL ||
20991         /* Check tm_year overflow */
20992          tmp->tm_year < min_year || tmp->tm_year > max_year)
20993         tmp = NULL;
20994     else
20995         pt = t;
20996     } /* local_check */
20997
20998 int check_max ()
20999 {
21000     tmp = NULL;
21001     pt  = 0;
21002 #ifdef MAXLONG
21003     local_check (MAXLONG, 69, 0x7fffffff);
21004 #endif
21005     if (tmp == NULL || tmp->tm_year < 0) {
21006         for (i = 63; i >= 0; i--) {
21007             time_t x = pt | ((time_t)1 << i);
21008             if (x < 0 || x < pt) continue;
21009             local_check (x, 69, 0x7fffffff);
21010             }
21011         }
21012     printf ("sLOCALTIME_max=%ld\n", pt);
21013     return (0);
21014    } /* check_max */
21015
21016 int check_min ()
21017 {
21018     tmp = NULL;
21019     pt  = 0;
21020 #ifdef MINLONG
21021     local_check (MINLONG, -1900, 70);
21022 #endif
21023     if (tmp == NULL) {
21024         for (i = 36; i >= 0; i--) {
21025             time_t x = pt - ((time_t)1 << i);
21026             if (x > 0) continue;
21027             local_check (x, -1900, 70);
21028             }
21029         }
21030     printf ("sLOCALTIME_min=%ld\n", pt);
21031     return (0);
21032     } /* check_min */
21033
21034 int main (int argc, char *argv[])
21035 {
21036     check_max ();
21037     check_min ();
21038     return (0);
21039     } /* main */
21040 EOCP
21041         set try
21042         if eval $compile; then
21043             eval `$run ./try`
21044         else
21045             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21046             fi
21047         $rm_try
21048         ;;
21049     esac
21050
21051 : check for type of arguments to select.
21052 case "$selecttype" in
21053 '') case "$d_select" in
21054         $define)
21055                 echo " "
21056                 $cat <<EOM
21057 Checking to see what type of arguments are accepted by select().
21058 EOM
21059                 hdrs="$define sys/types.h
21060                         $i_systime sys/time.h
21061                         $i_sysselct sys/select.h
21062                         $d_socket sys/socket.h"
21063                 : The first arg can be int, unsigned, or size_t
21064                 : The last arg may or may not be 'const'
21065                 val=''
21066                 : void pointer has been seen but using that
21067                 : breaks the selectminbits test
21068                 for xxx in 'fd_set *' 'int *'; do
21069                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21070                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21071                                         case "$val" in
21072                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21073                                                 if ./protochk "$try" $hdrs; then
21074                                                         echo "Your system accepts $xxx."
21075                                                         val="$xxx"
21076                                                 fi
21077                                                 ;;
21078                                         esac
21079                                 done
21080                         done
21081                 done
21082                 case "$val" in
21083                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21084                         case "$d_fd_set" in
21085                                 $define) dflt="fd_set *" ;;
21086                                 *)              dflt="int *" ;;
21087                         esac
21088                         . ./myread
21089                         val=$ans
21090                         ;;
21091                 esac
21092                 selecttype="$val"
21093                 ;;
21094         *)      : no select, so pick a harmless default
21095                 selecttype='int *'
21096                 ;;
21097         esac
21098         ;;
21099 esac
21100
21101 : check for the select 'width'
21102 case "$selectminbits" in
21103 '') safebits=`expr $ptrsize \* 8`
21104     case "$d_select" in
21105         $define)
21106                 $cat <<EOM
21107
21108 Checking to see on how many bits at a time your select() operates...
21109 EOM
21110                 $cat >try.c <<EOCP
21111 #include <sys/types.h>
21112 #$i_time I_TIME
21113 #$i_systime I_SYS_TIME
21114 #$i_systimek I_SYS_TIME_KERNEL
21115 #ifdef I_TIME
21116 #   include <time.h>
21117 #endif
21118 #ifdef I_SYS_TIME
21119 #   ifdef I_SYS_TIME_KERNEL
21120 #       define KERNEL
21121 #   endif
21122 #   include <sys/time.h>
21123 #   ifdef I_SYS_TIME_KERNEL
21124 #       undef KERNEL
21125 #   endif
21126 #endif
21127 #$i_sysselct I_SYS_SELECT
21128 #ifdef I_SYS_SELECT
21129 #include <sys/select.h>
21130 #endif
21131 #$d_socket HAS_SOCKET
21132 #ifdef HAS_SOCKET
21133 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21134 #endif
21135 #include <stdio.h>
21136 #$i_stdlib I_STDLIB
21137 #ifdef I_STDLIB
21138 #include <stdlib.h>
21139 #endif
21140 $selecttype b;
21141 #define S sizeof(*(b))
21142 #define MINBITS 64
21143 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21144 #define NBITS  (NBYTES * 8)
21145 int main() {
21146     char *s = (char *)malloc(NBYTES);
21147     struct timeval t;
21148     int i;
21149     FILE* fp;
21150     int fd;
21151
21152     if (!s)
21153         exit(1);
21154     fclose(stdin);
21155     fp = fopen("try.c", "r");
21156     if (fp == 0)
21157       exit(2);
21158     fd = fileno(fp);
21159     if (fd < 0)
21160       exit(3);
21161     b = ($selecttype)s;
21162     for (i = 0; i < NBITS; i++)
21163         FD_SET(i, b);
21164     t.tv_sec  = 0;
21165     t.tv_usec = 0;
21166     select(fd + 1, b, 0, 0, &t);
21167     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21168     free(s);
21169     printf("%d\n", i + 1);
21170     return 0;
21171 }
21172 EOCP
21173                 set try
21174                 if eval $compile_ok; then
21175                         selectminbits=`$run ./try`
21176                         case "$selectminbits" in
21177                         '')     cat >&4 <<EOM
21178 Cannot figure out on how many bits at a time your select() operates.
21179 I'll play safe and guess it is $safebits bits.
21180 EOM
21181                                 selectminbits=$safebits
21182                                 bits="$safebits bits"
21183                                 ;;
21184                         1)      bits="1 bit" ;;
21185                         *)      bits="$selectminbits bits" ;;
21186                         esac
21187                         echo "Your select() operates on $bits at a time." >&4
21188                 else
21189                         rp='What is the minimum number of bits your select() operates on?'
21190                         case "$byteorder" in
21191                         12345678)       dflt=64 ;;
21192                         1234)           dflt=32 ;;
21193                         *)              dflt=1  ;;
21194                         esac
21195                         . ./myread
21196                         val=$ans
21197                         selectminbits="$val"
21198                 fi
21199                 $rm_try
21200                 ;;
21201         *)      : no select, so pick a harmless default
21202                 selectminbits=$safebits
21203                 ;;
21204         esac
21205         ;;
21206 esac
21207
21208 : Trace out the files included by signal.h, then look for SIGxxx names.
21209 if [ "X$fieldn" = X ]; then
21210         : Just make some guesses.  We check them later.
21211         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21212 else
21213         xxx=`echo '#include <signal.h>' |
21214         $cppstdin $cppminus $cppflags 2>/dev/null |
21215         $grep '^[       ]*#.*include' |
21216         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21217                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21218 fi
21219 xxxfiles=''
21220 for xx in $xxx /dev/null ; do
21221         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21222 done
21223 case "$xxxfiles" in
21224 '')     xxxfiles=`./findhdr signal.h` ;;
21225 esac
21226 xxx=`awk '
21227 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21228         print substr($2, 4, 20)
21229 }
21230 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21231         print substr($3, 4, 20)
21232 }' $xxxfiles`
21233 : Append some common names just in case the awk scan failed.
21234 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21235 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21236 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21237 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21238 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21239
21240 : generate a few handy files for later
21241 $cat > signal.c <<EOCP
21242 #include <sys/types.h>
21243 #include <signal.h>
21244 #$i_stdlib I_STDLIB
21245 #ifdef I_STDLIB
21246 #include <stdlib.h>
21247 #endif
21248 #include <stdio.h>
21249 int main() {
21250
21251 /* Strange style to avoid deeply-nested #if/#else/#endif */
21252 #ifndef NSIG
21253 #  ifdef _NSIG
21254 #    define NSIG (_NSIG)
21255 #  endif
21256 #endif
21257
21258 #ifndef NSIG
21259 #  ifdef SIGMAX
21260 #    define NSIG (SIGMAX+1)
21261 #  endif
21262 #endif
21263
21264 #ifndef NSIG
21265 #  ifdef SIG_MAX
21266 #    define NSIG (SIG_MAX+1)
21267 #  endif
21268 #endif
21269
21270 #ifndef NSIG
21271 #  ifdef _SIG_MAX
21272 #    define NSIG (_SIG_MAX+1)
21273 #  endif
21274 #endif
21275
21276 #ifndef NSIG
21277 #  ifdef MAXSIG
21278 #    define NSIG (MAXSIG+1)
21279 #  endif
21280 #endif
21281
21282 #ifndef NSIG
21283 #  ifdef MAX_SIG
21284 #    define NSIG (MAX_SIG+1)
21285 #  endif
21286 #endif
21287
21288 #ifndef NSIG
21289 #  ifdef SIGARRAYSIZE
21290 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21291 #  endif
21292 #endif
21293
21294 #ifndef NSIG
21295 #  ifdef _sys_nsig
21296 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21297 #  endif
21298 #endif
21299
21300 /* Default to some arbitrary number that's big enough to get most
21301    of the common signals.
21302 */
21303 #ifndef NSIG
21304 #    define NSIG 50
21305 #endif
21306
21307 printf("NSIG %d\n", NSIG);
21308
21309 #ifndef JUST_NSIG
21310
21311 EOCP
21312
21313 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21314 {
21315         printf "#ifdef SIG"; printf $1; printf "\n"
21316         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21317         printf $1; printf ");\n"
21318         printf "#endif\n"
21319 }
21320 END {
21321         printf "#endif /* JUST_NSIG */\n";
21322         printf "exit(0);\n}\n";
21323 }
21324 ' >>signal.c
21325 $cat >signal.awk <<'EOP'
21326 BEGIN { ndups = 0 }
21327 $1 ~ /^NSIG$/ { nsig = $2 }
21328 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21329     if ($2 > maxsig) { maxsig = $2 }
21330     if (sig_name[$2]) {
21331         dup_name[ndups] = $1
21332         dup_num[ndups] = $2
21333         ndups++
21334     }
21335     else {
21336         sig_name[$2] = $1
21337         sig_num[$2] = $2
21338     }
21339 }
21340 END {
21341     if (nsig == 0) {
21342         nsig = maxsig + 1
21343     }
21344     printf("NSIG %d\n", nsig);
21345     for (n = 1; n < nsig; n++) {
21346         if (sig_name[n]) {
21347             printf("%s %d\n", sig_name[n], sig_num[n])
21348         }
21349         else {
21350             printf("NUM%d %d\n", n, n)
21351         }
21352     }
21353     for (n = 0; n < ndups; n++) {
21354         printf("%s %d\n", dup_name[n], dup_num[n])
21355     }
21356 }
21357 EOP
21358 $cat >signal_cmd <<EOS
21359 $startsh
21360 if $test -s signal.lst; then
21361     echo "Using your existing signal.lst file"
21362         exit 0
21363 fi
21364 xxx="$xxx"
21365 EOS
21366 $cat >>signal_cmd <<'EOS'
21367
21368 set signal
21369 if eval $compile_ok; then
21370         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21371                 $uniq | $awk -f signal.awk >signal.lst
21372 else
21373         echo "(I can't seem be able to compile the whole test program)" >&4
21374         echo "(I'll try it in little pieces.)" >&4
21375         set signal -DJUST_NSIG
21376         if eval $compile_ok; then
21377                 $run ./signal$_exe > signal.nsg
21378                 $cat signal.nsg
21379         else
21380                 echo "I can't seem to figure out how many signals you have." >&4
21381                 echo "Guessing 50." >&4
21382                 echo 'NSIG 50' > signal.nsg
21383         fi
21384         : Now look at all the signal names, one at a time.
21385         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21386                 $cat > signal.c <<EOCP
21387 #include <sys/types.h>
21388 #include <signal.h>
21389 #include <stdio.h>
21390 int main() {
21391 printf("$xx %d\n", SIG${xx});
21392 return 0;
21393 }
21394 EOCP
21395                 set signal
21396                 if eval $compile; then
21397                         echo "SIG${xx} found."
21398                         $run ./signal$_exe  >> signal.ls1
21399                 else
21400                         echo "SIG${xx} NOT found."
21401                 fi
21402         done
21403         if $test -s signal.ls1; then
21404                 $cat signal.nsg signal.ls1 |
21405                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21406         fi
21407
21408 fi
21409 if $test -s signal.lst; then
21410         :
21411 else
21412         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21413         echo 'kill -l' >signal
21414         set X `csh -f <signal`
21415         $rm -f signal
21416         shift
21417         case $# in
21418         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21419         esac
21420         echo $@ | $tr ' ' $trnl | \
21421             $awk '{ printf "%s %d\n", $1, ++s; }
21422                   END { printf "NSIG %d\n", ++s }' >signal.lst
21423 fi
21424 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21425 EOS
21426 chmod a+x signal_cmd
21427 $eunicefix signal_cmd
21428
21429 : generate list of signal names
21430 echo " "
21431 case "$sig_name_init" in
21432 '') doinit=yes ;;
21433 *)  case "$sig_num_init" in
21434     ''|*,*) doinit=yes ;;
21435     esac ;;
21436 esac
21437 case "$doinit" in
21438 yes)
21439         echo "Generating a list of signal names and numbers..." >&4
21440         . ./signal_cmd
21441         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21442         sig_name=`$awk 'BEGIN { printf "ZERO " }
21443                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21444         sig_num=`$awk  'BEGIN { printf "0 " }
21445                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21446         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21447                              !/^NSIG/   { printf "\"%s\", ", $1 }
21448                              END        { printf "0\n" }' signal.lst`
21449         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21450                              !/^NSIG/   { printf "%d, ", $2}
21451                              END        { printf "0\n"}' signal.lst`
21452         ;;
21453 esac
21454 echo "The following $sig_count signals are available:"
21455 echo " "
21456 echo $sig_name | $awk \
21457 'BEGIN { linelen = 0 }
21458 {
21459         for (i = 1; i <= NF; i++) {
21460                 name = "SIG" $i " "
21461                 linelen = linelen + length(name)
21462                 if (linelen > 70) {
21463                         printf "\n"
21464                         linelen = length(name)
21465                 }
21466                 printf "%s", name
21467         }
21468         printf "\n"
21469 }'
21470 sig_size=`echo $sig_name | awk '{print NF}'`
21471 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21472
21473 : Check size of size
21474 echo " "
21475 case "$sizetype" in
21476 *_t) zzz="$sizetype"    ;;
21477 *)   zzz="filesize"     ;;
21478 esac
21479 echo "Checking the size of $zzz..." >&4
21480 cat > try.c <<EOCP
21481 #include <sys/types.h>
21482 #include <stdio.h>
21483 #$i_stdlib I_STDLIB
21484 #ifdef I_STDLIB
21485 #include <stdlib.h>
21486 #endif
21487 int main() {
21488     printf("%d\n", (int)sizeof($sizetype));
21489     exit(0);
21490 }
21491 EOCP
21492 set try
21493 if eval $compile_ok; then
21494         yyy=`$run ./try`
21495         case "$yyy" in
21496         '')     sizesize=4
21497                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21498                 ;;
21499         *)      sizesize=$yyy
21500                 echo "Your $zzz size is $sizesize bytes."
21501                 ;;
21502         esac
21503 else
21504         sizesize=4
21505         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21506 fi
21507
21508
21509 : check for socklen_t
21510 echo " "
21511 echo "Checking to see if you have socklen_t..." >&4
21512 $cat >try.c <<EOCP
21513 #include <sys/types.h>
21514 #$d_socket HAS_SOCKET
21515 #ifdef HAS_SOCKET
21516 #include <sys/socket.h>
21517 #endif
21518 int main() { socklen_t x = 16; }
21519 EOCP
21520 set try
21521 if eval $compile; then
21522         val="$define"
21523         echo "You have socklen_t."
21524 else
21525         val="$undef"
21526         echo "You do not have socklen_t."
21527         case "$sizetype" in
21528         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21529         esac
21530 fi
21531 $rm_try
21532 set d_socklen_t
21533 eval $setvar
21534
21535 : see if this is a socks.h system
21536 set socks.h i_socks
21537 eval $inhdr
21538
21539 : check for type of the size argument to socket calls
21540 case "$d_socket" in
21541 "$define")
21542         $cat <<EOM
21543
21544 Checking to see what type is the last argument of accept().
21545 EOM
21546         yyy=''
21547         case "$d_socklen_t" in
21548         "$define") yyy="$yyy socklen_t"
21549         esac
21550         yyy="$yyy $sizetype int long unsigned"
21551         for xxx in $yyy; do
21552                 case "$socksizetype" in
21553                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21554                         case "$usesocks" in
21555                         "$define")
21556                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21557                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21558                                         socksizetype="$xxx"
21559                                 fi
21560                                 ;;
21561                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21562                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21563                                         socksizetype="$xxx"
21564                                 fi
21565                                 ;;
21566                         esac
21567                         ;;
21568                 esac
21569         done
21570 : In case none of those worked, prompt the user.
21571         case "$socksizetype" in
21572         '')     rp='What is the type for socket address structure sizes?'
21573                 dflt='int'
21574                 . ./myread
21575                 socksizetype=$ans
21576                 ;;
21577         esac
21578         ;;
21579 *)      : no sockets, so pick relatively harmless default
21580         socksizetype='int'
21581         ;;
21582 esac
21583
21584 : see what type is used for signed size_t
21585 set ssize_t ssizetype int stdio.h sys/types.h
21586 eval $typedef
21587 dflt="$ssizetype"
21588 $cat > try.c <<EOM
21589 #include <stdio.h>
21590 #$i_stdlib I_STDLIB
21591 #ifdef I_STDLIB
21592 #include <stdlib.h>
21593 #endif
21594 #include <sys/types.h>
21595 #define Size_t $sizetype
21596 #define SSize_t $dflt
21597 int main()
21598 {
21599         if (sizeof(Size_t) == sizeof(SSize_t))
21600                 printf("$dflt\n");
21601         else if (sizeof(Size_t) == sizeof(int))
21602                 printf("int\n");
21603         else
21604                 printf("long\n");
21605         exit(0);
21606 }
21607 EOM
21608 echo " "
21609 set try
21610 if eval $compile_ok && $run ./try > /dev/null; then
21611         ssizetype=`$run ./try`
21612         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21613 else
21614         $cat >&4 <<EOM
21615 Help! I can't compile and run the ssize_t test program: please enlighten me!
21616 (This is probably a misconfiguration in your system or libraries, and
21617 you really ought to fix it.  Still, I'll try anyway.)
21618
21619 I need a type that is the same size as $sizetype, but is guaranteed to
21620 be signed.  Common values are ssize_t, int and long.
21621
21622 EOM
21623         rp="What signed type is the same size as $sizetype?"
21624         . ./myread
21625         ssizetype="$ans"
21626 fi
21627 $rm_try
21628
21629 : Check the size of st_ino
21630 $echo " "
21631 $echo "Checking the size of st_ino..." >&4
21632 $cat > try.c <<EOCP
21633 #include <sys/stat.h>
21634 #include <stdio.h>
21635 #$i_stdlib I_STDLIB
21636 #ifdef I_STDLIB
21637 #include <stdlib.h>
21638 #endif
21639 int main() {
21640     struct stat st;
21641     printf("%d\n", (int)sizeof(st.st_ino));
21642     exit(0);
21643 }
21644 EOCP
21645 set try
21646 if eval $compile_ok; then
21647         val=`$run ./try`
21648         case "$val" in
21649         '')     st_ino_size=4
21650                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21651                 ;;
21652         *)      st_ino_size=$val
21653                 $echo "Your st_ino is $st_ino_size bytes long."
21654                 ;;
21655         esac
21656 else
21657         st_ino_size=4
21658         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21659 fi
21660 $rm_try
21661
21662 : Check if st_ino is signed
21663 $echo " "
21664 $echo "Checking the sign of st_ino..." >&4
21665 $cat > try.c <<EOCP
21666 #include <sys/stat.h>
21667 #include <stdio.h>
21668 int main() {
21669         struct stat foo;
21670         foo.st_ino = -1;
21671         if (foo.st_ino < 0)
21672                 printf("-1\n");
21673         else
21674                 printf("1\n");
21675 }
21676 EOCP
21677 set try
21678 if eval $compile; then
21679         val=`$run ./try`
21680         case "$val" in
21681         '')     st_ino_sign=1
21682                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21683                 ;;
21684         *)      st_ino_sign=$val
21685                 case "$st_ino_sign" in
21686                  1) $echo "Your st_ino is unsigned." ;;
21687                 -1) $echo "Your st_ino is signed."   ;;
21688                 esac
21689                 ;;
21690         esac
21691 else
21692         st_ino_sign=1
21693         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21694 fi
21695 $rm_try
21696
21697 : see what type of char stdio uses.
21698 echo " "
21699 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21700 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21701         echo "Your stdio uses unsigned chars." >&4
21702         stdchar="unsigned char"
21703 else
21704         echo "Your stdio uses signed chars." >&4
21705         stdchar="char"
21706 fi
21707 $rm -f stdioh
21708
21709 : see what type uids are declared as in the kernel
21710 echo " "
21711 echo "Looking for the type for user ids returned by getuid()."
21712 set uid_t uidtype xxx stdio.h sys/types.h
21713 eval $typedef
21714 case "$uidtype" in
21715 xxx)
21716         xxx=`./findhdr sys/user.h`
21717         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21718         case $1 in
21719         unsigned) dflt="$1 $2" ;;
21720         *) dflt="$1" ;;
21721         esac
21722         ;;
21723 *) dflt="$uidtype";;
21724 esac
21725 case "$uidtype" in
21726 uid_t)  echo "uid_t found." ;;
21727 *)      rp="What is the type for user ids returned by getuid()?"
21728         . ./myread
21729         uidtype="$ans"
21730         ;;
21731 esac
21732
21733 : Check size of UID
21734 echo " "
21735 case "$uidtype" in
21736 *_t) zzz="$uidtype"     ;;
21737 *)   zzz="uid"          ;;
21738 esac
21739 echo "Checking the size of $zzz..." >&4
21740 cat > try.c <<EOCP
21741 #include <sys/types.h>
21742 #include <stdio.h>
21743 #$i_stdlib I_STDLIB
21744 #ifdef I_STDLIB
21745 #include <stdlib.h>
21746 #endif
21747 int main() {
21748     printf("%d\n", (int)sizeof($uidtype));
21749     exit(0);
21750 }
21751 EOCP
21752 set try
21753 if eval $compile_ok; then
21754         yyy=`$run ./try`
21755         case "$yyy" in
21756         '')     uidsize=4
21757                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21758                 ;;
21759         *)      uidsize=$yyy
21760                 echo "Your $zzz is $uidsize bytes long."
21761                 ;;
21762         esac
21763 else
21764         uidsize=4
21765         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21766 fi
21767
21768 : Check if UID is signed
21769 echo " "
21770 case "$uidtype" in
21771 *_t) zzz="$uidtype"     ;;
21772 *)   zzz="uid"          ;;
21773 esac
21774 echo "Checking the sign of $zzz..." >&4
21775 cat > try.c <<EOCP
21776 #include <sys/types.h>
21777 #include <stdio.h>
21778 int main() {
21779         $uidtype foo = -1;
21780         if (foo < 0)
21781                 printf("-1\n");
21782         else
21783                 printf("1\n");
21784 }
21785 EOCP
21786 set try
21787 if eval $compile; then
21788         yyy=`$run ./try`
21789         case "$yyy" in
21790         '')     uidsign=1
21791                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21792                 ;;
21793         *)      uidsign=$yyy
21794                 case "$uidsign" in
21795                  1) echo "Your $zzz is unsigned." ;;
21796                 -1) echo "Your $zzz is signed."   ;;
21797                 esac
21798                 ;;
21799         esac
21800 else
21801         uidsign=1
21802         echo "(I can't compile the test program--guessing unsigned.)" >&4
21803 fi
21804
21805
21806 : Check format string for UID
21807 echo " "
21808 $echo "Checking the format string to be used for uids..." >&4
21809
21810 case "$uidsign" in
21811 -1)     if $test X"$uidsize" = X"$ivsize"; then
21812                 uidformat="$ivdformat"
21813         else
21814                 if $test X"$uidsize" = X"$longsize"; then
21815                         uidformat='"ld"'
21816                 else
21817                         if $test X"$uidsize" = X"$intsize"; then
21818                                 uidformat='"d"'
21819                         else
21820                                 if $test X"$uidsize" = X"$shortsize"; then
21821                                         uidformat='"hd"'
21822                                 fi
21823                         fi
21824                 fi
21825         fi
21826         ;;
21827 *)      if $test X"$uidsize" = X"$uvsize"; then
21828                 uidformat="$uvuformat"
21829         else
21830                 if $test X"$uidsize" = X"$longsize"; then
21831                         uidformat='"lu"'
21832                 else
21833                         if $test X"$uidsize" = X"$intsize"; then
21834                                 uidformat='"u"'
21835                         else
21836                                 if $test X"$uidsize" = X"$shortsize"; then
21837                                         uidformat='"hu"'
21838                                 fi
21839                         fi
21840                 fi
21841         fi
21842         ;;
21843 esac
21844
21845 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21846 echo " "
21847 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21848 $cat >try.c <<'EOM'
21849 /* Intentionally a long probe as I'd like to sanity check that the exact
21850    approach is going to work, as thinking it will work, but only having it
21851    part working at runtime is worse than not having it.  */
21852
21853 #include <sys/types.h>
21854 #include <sys/sysctl.h>
21855 #include <sys/param.h>
21856 #include <stdio.h>
21857 #include <string.h>
21858 #include <stdlib.h>
21859 #include <unistd.h>
21860
21861 int
21862 main(int argc, char **argv) {
21863     char *buffer;
21864     char *argv_leaf = strrchr(argv[0], '/');
21865     char *buffer_leaf;
21866     size_t size = 0;
21867     int mib[4];
21868
21869     mib[0] = CTL_KERN;
21870     mib[1] = KERN_PROC;
21871     mib[2] = KERN_PROC_PATHNAME;
21872     mib[3] = -1;
21873
21874     if (!argv_leaf) {
21875         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21876         return 1;
21877     }
21878
21879     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21880         perror("sysctl");
21881         return 2;
21882     }
21883
21884     if (size < strlen(argv_leaf) + 1) {
21885         fprintf(stderr, "size %lu is too short for a path\n",
21886                 (unsigned long) size);
21887         return 3;
21888     }
21889
21890     if (size > MAXPATHLEN * MAXPATHLEN) {
21891         fprintf(stderr, "size %lu is too long for a path\n",
21892                 (unsigned long) size);
21893         return 4;
21894     }
21895
21896     buffer = malloc(size);
21897     if (!buffer) {
21898         perror("malloc");
21899         return 5;
21900     }
21901
21902     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21903         perror("sysctl");
21904         return 6;
21905     }
21906
21907     if (strlen(buffer) + 1 != size) {
21908         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21909                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21910         return 7;
21911     }
21912
21913
21914     if (*buffer != '/') {
21915         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21916         return 8;
21917     }
21918
21919     if (strstr(buffer, "/./")) {
21920         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21921         return 9;
21922     }
21923
21924     if (strstr(buffer, "/../")) {
21925         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21926         return 10;
21927     }
21928
21929     buffer_leaf = strrchr(buffer, '/');
21930     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21931         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21932         return 11;
21933     }
21934
21935     free(buffer);
21936
21937     return 0;
21938 }
21939 EOM
21940
21941 val=$undef
21942 set try
21943 if eval $compile; then
21944         if $run ./try; then
21945                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21946                 val="$define"
21947         else
21948                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21949                 val="$undef"
21950         fi
21951 else
21952         echo "I'm unable to compile the test program." >&4
21953         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21954         val="$undef"
21955 fi
21956 $rm_try
21957 set usekernprocpathname
21958 eval $setvar
21959
21960 : Determine if we can use _NSGetExecutablePath to find executing program
21961 echo " "
21962 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21963 $cat >try.c <<'EOM'
21964 /* Intentionally a long probe as I'd like to sanity check that the exact
21965    approach is going to work, as thinking it will work, but only having it
21966    part working at runtime is worse than not having it.  */
21967 #include <mach-o/dyld.h>
21968 #include <stdio.h>
21969 #include <stdlib.h>
21970 #include <sys/param.h>
21971 #include <string.h>
21972
21973 int
21974 main(int argc, char **argv) {
21975     char buf[1];
21976     uint32_t size = sizeof(buf);
21977     int result;
21978     char *buffer;
21979     char *tidied;
21980     char *argv_leaf = strrchr(argv[0], '/');
21981     char *tidied_leaf;
21982
21983     if (!argv_leaf) {
21984         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21985         return 1;
21986     }
21987
21988     _NSGetExecutablePath(buf, &size);
21989     if (size > MAXPATHLEN * MAXPATHLEN) {
21990         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21991                 (unsigned int) size);
21992         return 2;
21993     }
21994
21995     buffer = malloc(size);
21996     if (!buffer) {
21997         perror("malloc");
21998         return 3;
21999     }
22000
22001     result = _NSGetExecutablePath(buffer, &size);
22002     if (result != 0) {
22003         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22004                 result, (unsigned int) size);
22005         return 4;
22006     }
22007
22008     tidied = realpath(buffer, NULL);
22009     if (!tidied) {
22010         perror("realpath");
22011         return 5;
22012     }
22013
22014     free(buffer);
22015
22016     if (*tidied != '/') {
22017         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22018         return 6;
22019     }
22020
22021     if (strstr(tidied, "/./")) {
22022         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22023         return 7;
22024     }
22025
22026     if (strstr(tidied, "/../")) {
22027         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22028         return 8;
22029     }
22030
22031     tidied_leaf = strrchr(tidied, '/');
22032     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22033         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22034         return 9;
22035     }
22036
22037     free(tidied);
22038
22039     return 0;
22040 }
22041 EOM
22042
22043 val=$undef
22044 set try
22045 if eval $compile; then
22046         if $run ./try; then
22047                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22048                 val="$define"
22049         else
22050                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22051         fi
22052 else
22053         echo "I'm unable to compile the test program." >&4
22054         echo "I'll assume no _NSGetExecutablePath here." >&4
22055 fi
22056 $rm_try
22057 set usensgetexecutablepath
22058 eval $setvar
22059
22060 : Check if site customization support was requested
22061 case "$usesitecustomize" in
22062     $define|true|[Yy]*)
22063         usesitecustomize="$define"
22064         ;;
22065     *)
22066         usesitecustomize="$undef"
22067         ;;
22068     esac
22069
22070 : see if prototypes support variable argument declarations
22071 echo " "
22072 case "$prototype$i_stdarg" in
22073 $define$define)
22074         echo "It appears we'll be able to prototype varargs functions." >&4
22075         val="$define"
22076         ;;
22077 *)
22078         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22079         val="$undef"
22080         ;;
22081 esac
22082 set vaproto
22083 eval $setvar
22084
22085 : determine compiler compiler
22086 case "$yacc" in
22087 '')
22088         dflt=yacc;;
22089 *)
22090         dflt="$yacc";;
22091 esac
22092 echo " "
22093 comp='yacc'
22094 if $test -f "$byacc$_exe"; then
22095         dflt="$byacc"
22096         comp="byacc or $comp"
22097 fi
22098 if $test -f "$bison$_exe"; then
22099         comp="$comp or bison -y"
22100 fi
22101 rp="Which compiler compiler ($comp) shall I use?"
22102 . ./myread
22103 yacc="$ans"
22104 case "$yacc" in
22105 *bis*)
22106         case "$yacc" in
22107         *-y*) ;;
22108         *)
22109                 yacc="$yacc -y"
22110                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22111                 ;;
22112         esac
22113         ;;
22114 esac
22115
22116 : see if this is a assert.h system
22117 set assert.h i_assert
22118 eval $inhdr
22119
22120 : see if this is a bfd.h system
22121 set bfd.h i_bfd
22122 eval $inhdr
22123
22124 : see if this is an execinfo.h system
22125 set execinfo.h i_execinfo
22126 eval $inhdr
22127
22128 : see if this is a fp.h system
22129 set fp.h i_fp
22130 eval $inhdr
22131
22132 : see if this is a fp_class.h system
22133 set fp_class.h i_fp_class
22134 eval $inhdr
22135
22136 : see if gdbm.h is available
22137 set gdbm.h t_gdbm
22138 eval $inhdr
22139 case "$t_gdbm" in
22140 $define)
22141         : see if gdbm_open exists
22142         set gdbm_open d_gdbm_open
22143         eval $inlibc
22144         case "$d_gdbm_open" in
22145         $undef)
22146                 t_gdbm="$undef"
22147                 echo "We won't be including <gdbm.h>"
22148                 ;;
22149         esac
22150         ;;
22151 esac
22152 val="$t_gdbm"
22153 set i_gdbm
22154 eval $setvar
22155
22156 : see if this is a ieeefp.h system
22157 case "$i_ieeefp" in
22158 '' ) set ieeefp.h i_ieeefp
22159      eval $inhdr
22160      ;;
22161 esac
22162
22163 : see if this is a libutil.h system
22164 set libutil.h i_libutil
22165 eval $inhdr
22166
22167 : see if mach cthreads are available
22168 if test "X$usethreads" = "X$define"; then
22169         set mach/cthreads.h i_machcthr
22170         eval $inhdr
22171 else
22172         i_machcthr="$undef"
22173 fi
22174
22175 : see if this is a mntent.h system
22176 set mntent.h i_mntent
22177 eval $inhdr
22178
22179 : see if net/errno.h is available
22180 val=''
22181 set net/errno.h val
22182 eval $inhdr
22183
22184 : Unfortunately, it causes problems on some systems.  Arrgh.
22185 case "$val" in
22186 $define)
22187         cat > try.c <<'EOM'
22188 #include <stdio.h>
22189 #include <errno.h>
22190 #include <net/errno.h>
22191 int func()
22192 {
22193         return ENOTSOCK;
22194 }
22195 EOM
22196         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22197                 echo "We'll be including <net/errno.h>." >&4
22198         else
22199                 echo "We won't be including <net/errno.h>." >&4
22200                 val="$undef"
22201         fi
22202         $rm_try
22203         ;;
22204 esac
22205 set i_neterrno
22206 eval $setvar
22207
22208 : see if netinet/tcp.h is available
22209 set netinet/tcp.h i_netinettcp
22210 eval $inhdr
22211
22212 : see if this is a poll.h system
22213 set poll.h i_poll
22214 eval $inhdr
22215
22216 : see if this is a prot.h system
22217 set prot.h i_prot
22218 eval $inhdr
22219
22220 : Preprocessor symbols
22221 echo " "
22222 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22223 $cat <<'EOSH' > Cppsym.know
22224 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22225 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22226 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22227 arch_pwr ardent ARM ARM32 atarist att386 att3b
22228 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22229 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22230 byteorder byte_order
22231 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22232 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22233 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22234 ELF encore EPI EXTENSIONS
22235 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22236 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22237 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22238 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22239 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22240 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22241 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22242 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22243 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22244 ksr1
22245 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22246 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22247 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22248 luna88k Lynx
22249 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22250 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22251 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22252 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22253 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22254 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22255 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22256 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22257 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22258 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22259 ns32000 ns32016 ns32332 ns32k nsc32000
22260 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22261 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22262 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22263 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22264 QK_USER QNX
22265 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22266 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22267 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22268 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22269 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22270 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22271 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22272 SYSV4 SYSV5 sysV68 sysV88
22273 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22274 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22275 tower32_800 tower32_850 tss
22276 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22277 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22278 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22279 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22280 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22281 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22282 uxpm uxps
22283 vax venix VMESA vms
22284 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22285 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22286 z8000 zarch
22287 EOSH
22288 # Maybe put other stuff here too.
22289 ./tr '-' '_' <<EOSH >>Cppsym.know
22290 $osname
22291 EOSH
22292 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22293 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22294 $cat Cppsym.know > Cppsym.c
22295 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22296 $rm -f Cppsym.a Cppsym.b Cppsym.c
22297 cat <<EOSH > Cppsym
22298 $startsh
22299 if $test \$# -gt 0; then
22300     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22301     if $test -s Cppsym.got; then
22302         $rm -f Cppsym.got
22303         exit 0
22304     fi
22305     $rm -f Cppsym.got
22306     exit 1
22307 else
22308     $tr " " "$trnl" | ./Cppsym.try
22309     exit 0
22310 fi
22311 EOSH
22312 chmod +x Cppsym
22313 $eunicefix Cppsym
22314 cat <<EOSH > Cppsym.try
22315 $startsh
22316 cat <<'EOCP' > try.c
22317 #include <stdio.h>
22318 #if cpp_stuff == 1
22319 #define STRINGIFY(a)    "a"
22320 #endif
22321 #if cpp_stuff == 42
22322 #define StGiFy(a)  #a
22323 #define STRINGIFY(a)    StGiFy(a)
22324 #endif
22325 #if $cpp_stuff != 1 && $cpp_stuff != 42
22326 #   include "Bletch: How does this C preprocessor stringify macros?"
22327 #endif
22328 int main() {
22329 EOCP
22330 $awk \\
22331 EOSH
22332 cat <<'EOSH' >> Cppsym.try
22333 'length($1) > 0 {
22334     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22335     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22336     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22337     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22338 }'       >> try.c
22339 echo 'return 0;}' >> try.c
22340 EOSH
22341 cat <<EOSH >> Cppsym.try
22342 ccflags="$ccflags"
22343 case "$osname-$gccversion" in
22344 irix-) ccflags="\$ccflags -woff 1178" ;;
22345 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22346 esac
22347 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22348 EOSH
22349 chmod +x Cppsym.try
22350 $eunicefix Cppsym.try
22351 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22352 : Add in any Linux cpp "predefined macros":
22353 case "$osname::$gccversion" in
22354   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22355     tHdrH=_tmpHdr
22356     rm -f $tHdrH'.h' $tHdrH
22357     touch $tHdrH'.h'
22358     # Filter out macro arguments, such as Linux's __INT8_C(c)
22359     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22360        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22361        if [ -s $tHdrH'_cppsym.real' ]; then
22362           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22363        fi
22364     fi
22365     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22366   ;;
22367 esac
22368 : now check the C compiler for additional symbols
22369 postprocess_cc_v=''
22370 case "$osname" in
22371 aix) postprocess_cc_v="|$tr , ' '" ;;
22372 esac
22373 $cat >ccsym <<EOS
22374 $startsh
22375 $cat >tmp.c <<EOF
22376 extern int foo;
22377 EOF
22378 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22379 do
22380         case "\$i" in
22381         -D*) echo "\$i" | $sed 's/^-D//';;
22382         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22383         esac
22384 done
22385 $rm_try
22386 EOS
22387 postprocess_cc_v=''
22388 chmod +x ccsym
22389 $eunicefix ccsym
22390 ./ccsym > ccsym1.raw
22391 if $test -s ccsym1.raw; then
22392     $sort ccsym1.raw | $uniq >ccsym.raw
22393 else
22394     mv ccsym1.raw ccsym.raw
22395 fi
22396
22397 $awk '/\=/ { print $0; next }
22398         { print $0"=1" }' ccsym.raw >ccsym.list
22399 $comm -13 Cppsym.true ccsym.list >ccsym.own
22400 $comm -12 Cppsym.true ccsym.list >ccsym.com
22401 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22402 also=''
22403 if $test -z ccsym.raw; then
22404         echo "Your C compiler doesn't seem to define any symbols!" >&4
22405         echo " "
22406         echo "However, your C preprocessor defines the following symbols:"
22407         $cat Cppsym.true
22408         ccsymbols=''
22409         cppsymbols=`$cat Cppsym.true`
22410         cppsymbols=`echo $cppsymbols`
22411         cppccsymbols="$cppsymbols"
22412 else
22413         if $test -s ccsym.com; then
22414                 echo "Your C compiler and pre-processor define these symbols:"
22415                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22416                 also='also '
22417                 symbols='ones'
22418                 cppccsymbols=`$cat ccsym.com`
22419                 cppccsymbols=`echo $cppccsymbols`
22420                 $test "$silent" || sleep 1
22421         fi
22422         if $test -s ccsym.cpp; then
22423                 $test "$also" && echo " "
22424                 echo "Your C pre-processor ${also}defines the following symbols:"
22425                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22426                 also='further '
22427                 cppsymbols=`$cat ccsym.cpp`
22428                 cppsymbols=`echo $cppsymbols`
22429                 $test "$silent" || sleep 1
22430         fi
22431         if $test -s ccsym.own; then
22432                 $test "$also" && echo " "
22433                 echo "Your C compiler ${also}defines the following cpp symbols:"
22434                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22435                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22436                 ccsymbols=`$cat ccsym.own`
22437                 ccsymbols=`echo $ccsymbols`
22438                 $test "$silent" || sleep 1
22439         fi
22440 fi
22441
22442 : add -D_FORTIFY_SOURCE if feasible and not already there
22443 case "$gccversion" in
22444 4.*)    case "$optimize$ccflags" in
22445         *-O*)   case "$ccflags$cppsymbols" in
22446                 *_FORTIFY_SOURCE=*) # Don't add it again.
22447                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22448                         ;;
22449                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22450                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22451                         ;;
22452                 esac
22453                 ;;
22454         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22455                 ;;
22456         esac
22457         ;;
22458 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22459         ;;
22460 esac
22461
22462 : see if this is a termio system
22463 val="$undef"
22464 val2="$undef"
22465 val3="$undef"
22466 if $test `./findhdr termios.h`; then
22467     set tcsetattr i_termios
22468     eval $inlibc
22469     val3="$i_termios"
22470 fi
22471 echo " "
22472 case "$val3" in
22473     "$define") echo "You have POSIX termios.h... good!" >&4;;
22474     *)  if ./Cppsym pyr; then
22475             case "`$run /bin/universe`" in
22476                 ucb) if $test `./findhdr sgtty.h`; then
22477                         val2="$define"
22478                         echo "<sgtty.h> found." >&4
22479                     else
22480                         echo "System is pyramid with BSD universe."
22481                         ./warn "<sgtty.h> not found--you could have problems."
22482                     fi;;
22483                 *)  if $test `./findhdr termio.h`; then
22484                         val="$define"
22485                         echo "<termio.h> found." >&4
22486                     else
22487                         echo "System is pyramid with USG universe."
22488                         ./warn "<termio.h> not found--you could have problems."
22489                     fi;;
22490             esac
22491         elif ./usg; then
22492             if $test `./findhdr termio.h`; then
22493                 echo "<termio.h> found." >&4
22494                 val="$define"
22495             elif $test `./findhdr sgtty.h`; then
22496                 echo "<sgtty.h> found." >&4
22497                 val2="$define"
22498             else
22499                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22500             fi
22501         else
22502             if $test `./findhdr sgtty.h`; then
22503                 echo "<sgtty.h> found." >&4
22504                 val2="$define"
22505             elif $test `./findhdr termio.h`; then
22506                 echo "<termio.h> found." >&4
22507                 val="$define"
22508             else
22509                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22510             fi
22511         fi;;
22512 esac
22513 set i_termio; eval $setvar
22514 val=$val2; set i_sgtty; eval $setvar
22515 val=$val3; set i_termios; eval $setvar
22516
22517 : see if stdbool is available
22518 : we want a real compile instead of Inhdr because some Solaris systems
22519 : have stdbool.h, but it can only be used if the compiler indicates it
22520 : is sufficiently c99-compliant.
22521 echo " "
22522 $cat >try.c <<EOCP
22523 #include <stdio.h>
22524 #include <stdbool.h>
22525 int func(bool x)
22526 {
22527     return x ? 1 : 0;
22528 }
22529 int main(int argc, char **argv)
22530 {
22531     return func(0);
22532 }
22533 EOCP
22534 set try
22535 if eval $compile; then
22536         echo "<stdbool.h> found." >&4
22537         val="$define"
22538 else
22539         echo "<stdbool.h> NOT found." >&4
22540         val="$undef"
22541 fi
22542 $rm_try
22543 set i_stdbool
22544 eval $setvar
22545
22546 : see if stddef is available
22547 set stddef.h i_stddef
22548 eval $inhdr
22549
22550 : see if sys/access.h is available
22551 set sys/access.h i_sysaccess
22552 eval $inhdr
22553
22554 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22555 set sys/filio.h i_sysfilio
22556 eval $inhdr
22557 echo " "
22558 if $test `./findhdr sys/ioctl.h`; then
22559         val="$define"
22560         echo '<sys/ioctl.h> found.' >&4
22561 else
22562         val="$undef"
22563         if $test $i_sysfilio = "$define"; then
22564             echo '<sys/ioctl.h> NOT found.' >&4
22565         else
22566                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22567                 $test $i_termio = "$define" && xxx="termio.h"
22568                 $test $i_termios = "$define" && xxx="termios.h"
22569 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22570         fi
22571 fi
22572 set i_sysioctl
22573 eval $setvar
22574
22575 : see if socket ioctl defs are in sys/sockio.h
22576 echo " "
22577 xxx=`./findhdr sys/sockio.h`
22578 if $test "$xxx"; then
22579         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22580                 val="$define"
22581                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22582         else
22583                 val="$undef"
22584                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22585         fi
22586 else
22587         val="$undef"
22588         $cat <<EOM
22589 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22590 EOM
22591 fi
22592 set i_syssockio
22593 eval $setvar
22594
22595 : see if this is a syslog.h system
22596 set syslog.h i_syslog
22597 eval $inhdr
22598
22599 : see if this is a sys/mode.h system
22600 set sys/mode.h i_sysmode
22601 eval $inhdr
22602
22603 : see if there is a sys/poll.h file
22604 set sys/poll.h i_syspoll
22605 eval $inhdr
22606
22607 : see if sys/resource.h has to be included
22608 set sys/resource.h i_sysresrc
22609 eval $inhdr
22610
22611 : see if sys/security.h is available
22612 set sys/security.h i_syssecrt
22613 eval $inhdr
22614
22615 : see if this is a sys/statvfs.h system
22616 set sys/statvfs.h i_sysstatvfs
22617 eval $inhdr
22618
22619 : see if this is a sys/un.h system
22620 set sys/un.h i_sysun
22621 eval $inhdr
22622
22623 : see if this is a sys/utsname.h system
22624 set sys/utsname.h i_sysutsname
22625 eval $inhdr
22626
22627 : see if this is a syswait system
22628 set sys/wait.h i_syswait
22629 eval $inhdr
22630
22631 : see if this is a ustat.h system
22632 set ustat.h i_ustat
22633 eval $inhdr
22634
22635 : see if this is an utime system
22636 set utime.h i_utime
22637 eval $inhdr
22638
22639 : see if this is a vfork system
22640 case "$d_vfork" in
22641 "$define")
22642         set vfork.h i_vfork
22643         eval $inhdr
22644         ;;
22645 *)
22646         i_vfork="$undef"
22647         ;;
22648 esac
22649
22650 : Check extensions
22651 echo " "
22652 echo "Looking for extensions..." >&4
22653 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22654 : contain old or inaccurate or duplicate values.
22655 nonxs_extensions=''
22656 xs_extensions=''
22657 : We do not use find because it might not be available.
22658 : We do not just use MANIFEST because the user may have dropped
22659 : some additional extensions into the source tree and expect them
22660 : to be built.
22661
22662 : Function to recursively find available extensions, ignoring DynaLoader
22663 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22664 : In 5.10.1 and later, extensions are stored in directories
22665 : like File-Glob instead of the older File/Glob/.
22666 find_extensions='
22667     for xxx in *; do
22668         case "$xxx" in
22669             DynaLoader|dynaload) ;;
22670             *)
22671             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22672             case "$this_ext" in
22673                 Scalar/List/Utils) this_ext="List/Util" ;;
22674                 PathTools)         this_ext="Cwd"       ;;
22675             esac;
22676             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22677             if $contains " $this_ext " $tdir/$$.tmp; then
22678                 echo >&4;
22679                 echo "Duplicate directories detected for extension $xxx" >&4;
22680                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22681                 case "$knowitall" in
22682                 "") dflt=y;;
22683                 *) dflt=n;;
22684                 esac;
22685                 . ../UU/myread;
22686                 case "$ans" in
22687                 n*|N*) ;;
22688                 *) echo >&4;
22689                     echo "Ok.  Stopping Configure." >&4;
22690                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22691                     exit 1;;
22692                 esac;
22693                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22694             fi;
22695             $ls -1 $xxx > $tdir/$$.tmp;
22696             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22697                 xs_extensions="$xs_extensions $this_ext";
22698             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22699                 xs_extensions="$xs_extensions $this_ext";
22700             elif $test -d $xxx; then
22701                 nonxs_extensions="$nonxs_extensions $this_ext";
22702             fi;
22703             $rm -f $tdir/$$.tmp;
22704             ;;
22705         esac;
22706     done'
22707 tdir=`pwd`
22708 cd "$rsrc/cpan"
22709 set X
22710 shift
22711 eval $find_extensions
22712 cd "$rsrc/dist"
22713 set X
22714 shift
22715 eval $find_extensions
22716 cd "$rsrc/ext"
22717 set X
22718 shift
22719 eval $find_extensions
22720 set X $xs_extensions
22721 shift
22722 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22723 set X $nonxs_extensions
22724 shift
22725 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22726 cd "$tdir"
22727 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22728
22729 : Now see which are supported on this system.
22730 avail_ext=''
22731 for xxx in $xs_extensions ; do
22732         case "$xxx" in
22733         DB_File|db_file)
22734                 case "$i_db" in
22735                 $define) avail_ext="$avail_ext $xxx" ;;
22736                 esac
22737                 ;;
22738         GDBM_File|gdbm_fil)
22739                 case "$i_gdbm" in
22740                 $define) avail_ext="$avail_ext $xxx" ;;
22741                 esac
22742                 ;;
22743         I18N/Langinfo|i18n_lan)
22744                 case "$i_langinfo$d_nl_langinfo" in
22745                 $define$define) avail_ext="$avail_ext $xxx" ;;
22746                 esac
22747                 ;;
22748         IPC/SysV|ipc/sysv)
22749                 : XXX Do we need a useipcsysv variable here
22750                 case "${d_msg}${d_sem}${d_shm}" in
22751                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22752                 esac
22753                 ;;
22754         NDBM_File|ndbm_fil)
22755                 case "$d_ndbm" in
22756                 $define)
22757                     case "$osname-$use64bitint" in
22758                     hpux-define)
22759                         case "$libs" in
22760                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22761                         esac
22762                         ;;
22763                     *) avail_ext="$avail_ext $xxx" ;;
22764                     esac
22765                     ;;
22766                 esac
22767                 ;;
22768         ODBM_File|odbm_fil)
22769                 case "${i_dbm}${i_rpcsvcdbm}" in
22770                 *"${define}"*)
22771                     case "$d_cplusplus" in
22772                     define) ;; # delete as a function name will not work
22773                     *)  case "$osname-$use64bitint" in
22774                         hpux-define)
22775                             case "$libs" in
22776                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22777                             esac
22778                             ;;
22779                         *) avail_ext="$avail_ext $xxx" ;;
22780                         esac
22781                         ;;
22782                     esac
22783                     ;;
22784                 esac
22785                 ;;
22786         Opcode|opcode)
22787                 case "$useopcode" in
22788                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22789                 esac
22790                 ;;
22791         POSIX|posix)
22792                 case "$useposix" in
22793                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22794                 esac
22795                 ;;
22796         Socket|socket)
22797                 case "$d_socket" in
22798                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22799                 esac
22800                 ;;
22801         Sys/Syslog|sys/syslog)
22802                 : XXX syslog requires socket
22803                 case "$d_socket" in
22804                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22805                 esac
22806                 ;;
22807         Thread|thread)
22808                 case "$usethreads" in
22809                 true|$define|y)
22810                         case "$use5005threads" in
22811                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22812                         esac
22813                 esac
22814                 ;;
22815         threads|threads/shared)
22816                 # threads and threads::shared are special cases.
22817                 # To stop people from asking "Perl 5.8.0 was supposed
22818                 # to have this new fancy threads implementation but my
22819                 # perl doesn't have it" and from people trying to
22820                 # (re)install the threads module using CPAN.pm and
22821                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22822                 # the threads.pm and threads/shared.pm will always be
22823                 # there, croaking informatively ("you need to rebuild
22824                 # all of Perl with threads, sorry") when threads haven't
22825                 # been compiled in.
22826                 # --jhi
22827                 avail_ext="$avail_ext $xxx"
22828                 ;;
22829         VMS*)
22830                 ;;
22831         Win32*)
22832                 case "$osname" in
22833                 cygwin) avail_ext="$avail_ext $xxx" ;;
22834                 esac
22835                 ;;
22836         XS/APItest|xs/apitest)
22837                 # This is just for testing.  Skip it unless we have dynamic loading.
22838
22839                 case "$usedl" in
22840                 $define) avail_ext="$avail_ext $xxx" ;;
22841                 esac
22842                 ;;
22843         XS/Typemap|xs/typemap)
22844                 # This is just for testing.  Skip it unless we have dynamic loading.
22845                 case "$usedl" in
22846                 $define) avail_ext="$avail_ext $xxx" ;;
22847                 esac
22848                 ;;
22849         *)      avail_ext="$avail_ext $xxx"
22850                 ;;
22851         esac
22852 done
22853
22854 set X $avail_ext
22855 shift
22856 avail_ext="$*"
22857
22858 case "$onlyextensions" in
22859 '') ;;
22860 *)  keepextensions=''
22861     echo "You have requested that only certain extensions be included..." >&4
22862     for i in $onlyextensions; do
22863         case " $avail_ext " in
22864         *" $i "*)
22865             echo "Keeping extension $i."
22866             keepextensions="$keepextensions $i"
22867             ;;
22868         *) echo "Ignoring extension $i." ;;
22869         esac
22870     done
22871     avail_ext="$keepextensions"
22872     ;;
22873 esac
22874
22875 case "$noextensions" in
22876 '') ;;
22877 *)  keepextensions=''
22878     echo "You have requested that certain extensions be ignored..." >&4
22879     for i in $avail_ext; do
22880         case " $noextensions " in
22881         *" $i "*) echo "Ignoring extension $i." ;;
22882         *) echo "Keeping extension $i.";
22883            keepextensions="$keepextensions $i"
22884            ;;
22885         esac
22886     done
22887     avail_ext="$keepextensions"
22888     ;;
22889 esac
22890
22891 : Now see which nonxs extensions are supported on this system.
22892 : For now assume all are.
22893 nonxs_ext=''
22894 for xxx in $nonxs_extensions ; do
22895         case "$xxx" in
22896         VMS*)
22897                 ;;
22898         *)      nonxs_ext="$nonxs_ext $xxx"
22899                 ;;
22900         esac
22901 done
22902
22903 set X $nonxs_ext
22904 shift
22905 nonxs_ext="$*"
22906
22907 case $usedl in
22908 $define)
22909         $cat <<EOM
22910 A number of extensions are supplied with $package.  You may choose to
22911 compile these extensions for dynamic loading (the default), compile
22912 them into the $package executable (static loading), or not include
22913 them at all.  Answer "none" to include no extensions.
22914 Note that DynaLoader is always built and need not be mentioned here.
22915
22916 EOM
22917         case "$dynamic_ext" in
22918         '')
22919                 : Exclude those listed in static_ext
22920                 dflt=''
22921                 for xxx in $avail_ext; do
22922                         case " $static_ext " in
22923                         *" $xxx "*) ;;
22924                         *) dflt="$dflt $xxx" ;;
22925                         esac
22926                 done
22927                 set X $dflt
22928                 shift
22929                 dflt="$*"
22930                 ;;
22931         *)      dflt="$dynamic_ext"
22932                 # Perhaps we are reusing an old out-of-date config.sh.
22933                 case "$hint" in
22934                 previous)
22935                         if test X"$dynamic_ext" != X"$avail_ext"; then
22936                                 $cat <<EOM
22937 NOTICE:  Your previous config.sh list may be incorrect.
22938 The extensions now available to you are
22939         ${avail_ext}
22940 but the default list from your previous config.sh is
22941         ${dynamic_ext}
22942
22943 EOM
22944                         fi
22945                         ;;
22946                 esac
22947                 ;;
22948         esac
22949         case "$dflt" in
22950         '')     dflt=none;;
22951         esac
22952         rp="What extensions do you wish to load dynamically?"
22953         . ./myread
22954         case "$ans" in
22955         none) dynamic_ext=' ' ;;
22956         *) dynamic_ext="$ans" ;;
22957         esac
22958
22959         case "$static_ext" in
22960         '')
22961                 : Exclude those already listed in dynamic linking
22962                 dflt=''
22963                 for xxx in $avail_ext; do
22964                         case " $dynamic_ext " in
22965                         *" $xxx "*) ;;
22966                         *) dflt="$dflt $xxx" ;;
22967                         esac
22968                 done
22969                 set X $dflt
22970                 shift
22971                 dflt="$*"
22972                 ;;
22973         *)  dflt="$static_ext"
22974                 ;;
22975         esac
22976
22977         case "$dflt" in
22978         '')     dflt=none;;
22979         esac
22980         rp="What extensions do you wish to load statically?"
22981         . ./myread
22982         case "$ans" in
22983         none) static_ext=' ' ;;
22984         *) static_ext="$ans" ;;
22985         esac
22986         ;;
22987 *)
22988         $cat <<EOM
22989 A number of extensions are supplied with $package.  Answer "none"
22990 to include no extensions.
22991 Note that DynaLoader is always built and need not be mentioned here.
22992
22993 EOM
22994         case "$static_ext" in
22995         '') dflt="$avail_ext" ;;
22996         *)      dflt="$static_ext"
22997                 # Perhaps we are reusing an old out-of-date config.sh.
22998                 case "$hint" in
22999                 previous)
23000                         if test X"$static_ext" != X"$avail_ext"; then
23001                                 $cat <<EOM
23002 NOTICE:  Your previous config.sh list may be incorrect.
23003 The extensions now available to you are
23004         ${avail_ext}
23005 but the default list from your previous config.sh is
23006         ${static_ext}
23007
23008 EOM
23009                         fi
23010                         ;;
23011                 esac
23012                 ;;
23013         esac
23014         : Exclude those that are not xs extensions
23015         case "$dflt" in
23016         '')     dflt=none;;
23017         esac
23018         rp="What extensions do you wish to include?"
23019         . ./myread
23020         case "$ans" in
23021         none) static_ext=' ' ;;
23022         *) static_ext="$ans" ;;
23023         esac
23024         ;;
23025 esac
23026 #
23027 # Encode is a special case.  If we are building Encode as a static
23028 # extension, we need to explicitly list its subextensions as well.
23029 # For other nested extensions, this is handled automatically by
23030 # the appropriate Makefile.PL.
23031 case " $static_ext " in
23032         *" Encode "*) # Add the subextensions of Encode
23033         cd "$rsrc/cpan"
23034         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23035                 static_ext="$static_ext Encode/$xxx"
23036                 known_extensions="$known_extensions Encode/$xxx"
23037         done
23038         cd "$tdir"
23039         ;;
23040 esac
23041
23042 set X $dynamic_ext $static_ext $nonxs_ext
23043 shift
23044 extensions="$*"
23045
23046 # Sanity check:  We require an extension suitable for use with
23047 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23048 # should show up as failures in the test suite, but it's helpful to
23049 # catch them now.) The 'extensions' list is normally sorted
23050 # alphabetically, so we need to accept either
23051 #    DB_File ... Fcntl ... IO  ....
23052 # or something like
23053 #    Fcntl ... NDBM_File ... IO  ....
23054 case " $extensions"  in
23055 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23056 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23057 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23058 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23059    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23060    ;;
23061 esac
23062
23063 : Remove libraries needed only for extensions
23064 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23065 : The exception is SunOS 4.x, which needs them.
23066 case "${osname}X${osvers}" in
23067 sunos*X4*)
23068     perllibs="$libs"
23069     ;;
23070 *) case "$usedl" in
23071     $define|true|[yY]*)
23072             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23073             shift
23074             perllibs="$*"
23075             ;;
23076     *)  perllibs="$libs"
23077             ;;
23078     esac
23079     ;;
23080 esac
23081
23082 : Remove build directory name from cppstdin so it can be used from
23083 : either the present location or the final installed location.
23084 echo " "
23085 : Get out of the UU directory to get correct path name.
23086 cd ..
23087 case "$cppstdin" in
23088 `pwd`/cppstdin)
23089         echo "Stripping down cppstdin path name"
23090         cppstdin=cppstdin
23091         ;;
23092 esac
23093 cd UU
23094
23095 : end of configuration questions
23096 echo " "
23097 echo "End of configuration questions."
23098 echo " "
23099
23100 : back to where it started
23101 if test -d ../UU; then
23102         cd ..
23103 fi
23104
23105 : configuration may be unconditionally patched via a 'config.arch' file
23106 if $test -f config.arch; then
23107         echo "I see a config.arch file, loading it." >&4
23108         . ./config.arch
23109 fi
23110
23111 : configuration may be patched via a 'config.over' file
23112 if $test -f config.over; then
23113         echo " "
23114         dflt=y
23115         rp='I see a config.over file.  Do you wish to load it?'
23116         . UU/myread
23117         case "$ans" in
23118         n*) echo "OK, I'll ignore it.";;
23119         *)      . ./config.over
23120                 echo "Configuration override changes have been loaded."
23121                 ;;
23122         esac
23123 fi
23124
23125 : in case they want portability, strip down executable paths
23126 case "$d_portable" in
23127 "$define")
23128         echo " "
23129         echo "Stripping down executable paths..." >&4
23130         for file in $loclist $trylist; do
23131                 eval temp=\$$file
23132                 eval $file=`basename $temp`
23133         done
23134         ;;
23135 esac
23136
23137 : create config.sh file
23138 echo " "
23139 echo "Creating config.sh..." >&4
23140 $spitshell <<EOT >config.sh
23141 $startsh
23142 #
23143 # This file was produced by running the Configure script. It holds all the
23144 # definitions figured out by Configure. Should you modify one of these values,
23145 # do not forget to propagate your changes by running "Configure -der". You may
23146 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23147 #
23148
23149 # Package name      : $package
23150 # Source directory  : $src
23151 # Configuration time: $cf_time
23152 # Configured by     : $cf_by
23153 # Target system     : $myuname
23154
23155 EOT
23156 : Add in command line options if available
23157 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23158
23159 $spitshell <<EOT >>config.sh
23160
23161 Author='$Author'
23162 Date='$Date'
23163 Header='$Header'
23164 Id='$Id'
23165 Locker='$Locker'
23166 Log='$Log'
23167 RCSfile='$RCSfile'
23168 Revision='$Revision'
23169 Source='$Source'
23170 State='$State'
23171 _a='$_a'
23172 _exe='$_exe'
23173 _o='$_o'
23174 afs='$afs'
23175 afsroot='$afsroot'
23176 alignbytes='$alignbytes'
23177 ansi2knr='$ansi2knr'
23178 aphostname='$aphostname'
23179 api_revision='$api_revision'
23180 api_subversion='$api_subversion'
23181 api_version='$api_version'
23182 api_versionstring='$api_versionstring'
23183 ar='$ar'
23184 archlib='$archlib'
23185 archlibexp='$archlibexp'
23186 archname64='$archname64'
23187 archname='$archname'
23188 archobjs='$archobjs'
23189 asctime_r_proto='$asctime_r_proto'
23190 awk='$awk'
23191 baserev='$baserev'
23192 bash='$bash'
23193 bin='$bin'
23194 bin_ELF='$bin_ELF'
23195 binexp='$binexp'
23196 bison='$bison'
23197 byacc='$byacc'
23198 byteorder='$byteorder'
23199 c='$c'
23200 castflags='$castflags'
23201 cat='$cat'
23202 cc='$cc'
23203 cccdlflags='$cccdlflags'
23204 ccdlflags='$ccdlflags'
23205 ccflags='$ccflags'
23206 ccflags_uselargefiles='$ccflags_uselargefiles'
23207 ccname='$ccname'
23208 ccsymbols='$ccsymbols'
23209 ccversion='$ccversion'
23210 cf_by='$cf_by'
23211 cf_email='$cf_email'
23212 cf_time='$cf_time'
23213 charbits='$charbits'
23214 charsize='$charsize'
23215 chgrp='$chgrp'
23216 chmod='$chmod'
23217 chown='$chown'
23218 clocktype='$clocktype'
23219 comm='$comm'
23220 compress='$compress'
23221 contains='$contains'
23222 cp='$cp'
23223 cpio='$cpio'
23224 cpp='$cpp'
23225 cpp_stuff='$cpp_stuff'
23226 cppccsymbols='$cppccsymbols'
23227 cppflags='$cppflags'
23228 cpplast='$cpplast'
23229 cppminus='$cppminus'
23230 cpprun='$cpprun'
23231 cppstdin='$cppstdin'
23232 cppsymbols='$cppsymbols'
23233 crypt_r_proto='$crypt_r_proto'
23234 cryptlib='$cryptlib'
23235 csh='$csh'
23236 ctermid_r_proto='$ctermid_r_proto'
23237 ctime_r_proto='$ctime_r_proto'
23238 d_Gconvert='$d_Gconvert'
23239 d_PRIEUldbl='$d_PRIEUldbl'
23240 d_PRIFUldbl='$d_PRIFUldbl'
23241 d_PRIGUldbl='$d_PRIGUldbl'
23242 d_PRIXU64='$d_PRIXU64'
23243 d_PRId64='$d_PRId64'
23244 d_PRIeldbl='$d_PRIeldbl'
23245 d_PRIfldbl='$d_PRIfldbl'
23246 d_PRIgldbl='$d_PRIgldbl'
23247 d_PRIi64='$d_PRIi64'
23248 d_PRIo64='$d_PRIo64'
23249 d_PRIu64='$d_PRIu64'
23250 d_PRIx64='$d_PRIx64'
23251 d_SCNfldbl='$d_SCNfldbl'
23252 d__fwalk='$d__fwalk'
23253 d_access='$d_access'
23254 d_accessx='$d_accessx'
23255 d_acosh='$d_acosh'
23256 d_aintl='$d_aintl'
23257 d_alarm='$d_alarm'
23258 d_archlib='$d_archlib'
23259 d_asctime64='$d_asctime64'
23260 d_asctime_r='$d_asctime_r'
23261 d_atolf='$d_atolf'
23262 d_atoll='$d_atoll'
23263 d_attribute_deprecated='$d_attribute_deprecated'
23264 d_attribute_format='$d_attribute_format'
23265 d_attribute_malloc='$d_attribute_malloc'
23266 d_attribute_nonnull='$d_attribute_nonnull'
23267 d_attribute_noreturn='$d_attribute_noreturn'
23268 d_attribute_pure='$d_attribute_pure'
23269 d_attribute_unused='$d_attribute_unused'
23270 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23271 d_backtrace='$d_backtrace'
23272 d_bcmp='$d_bcmp'
23273 d_bcopy='$d_bcopy'
23274 d_bsd='$d_bsd'
23275 d_bsdgetpgrp='$d_bsdgetpgrp'
23276 d_bsdsetpgrp='$d_bsdsetpgrp'
23277 d_builtin_choose_expr='$d_builtin_choose_expr'
23278 d_builtin_expect='$d_builtin_expect'
23279 d_bzero='$d_bzero'
23280 d_c99_variadic_macros='$d_c99_variadic_macros'
23281 d_casti32='$d_casti32'
23282 d_castneg='$d_castneg'
23283 d_charvspr='$d_charvspr'
23284 d_chown='$d_chown'
23285 d_chroot='$d_chroot'
23286 d_chsize='$d_chsize'
23287 d_class='$d_class'
23288 d_clearenv='$d_clearenv'
23289 d_closedir='$d_closedir'
23290 d_cmsghdr_s='$d_cmsghdr_s'
23291 d_const='$d_const'
23292 d_copysignl='$d_copysignl'
23293 d_cplusplus='$d_cplusplus'
23294 d_crypt='$d_crypt'
23295 d_crypt_r='$d_crypt_r'
23296 d_csh='$d_csh'
23297 d_ctermid='$d_ctermid'
23298 d_ctermid_r='$d_ctermid_r'
23299 d_ctime64='$d_ctime64'
23300 d_ctime_r='$d_ctime_r'
23301 d_cuserid='$d_cuserid'
23302 d_dbl_dig='$d_dbl_dig'
23303 d_dbminitproto='$d_dbminitproto'
23304 d_difftime64='$d_difftime64'
23305 d_difftime='$d_difftime'
23306 d_dir_dd_fd='$d_dir_dd_fd'
23307 d_dirfd='$d_dirfd'
23308 d_dirnamlen='$d_dirnamlen'
23309 d_dladdr='$d_dladdr'
23310 d_dlerror='$d_dlerror'
23311 d_dlopen='$d_dlopen'
23312 d_dlsymun='$d_dlsymun'
23313 d_dosuid='$d_dosuid'
23314 d_drand48_r='$d_drand48_r'
23315 d_drand48proto='$d_drand48proto'
23316 d_dup2='$d_dup2'
23317 d_eaccess='$d_eaccess'
23318 d_endgrent='$d_endgrent'
23319 d_endgrent_r='$d_endgrent_r'
23320 d_endhent='$d_endhent'
23321 d_endhostent_r='$d_endhostent_r'
23322 d_endnent='$d_endnent'
23323 d_endnetent_r='$d_endnetent_r'
23324 d_endpent='$d_endpent'
23325 d_endprotoent_r='$d_endprotoent_r'
23326 d_endpwent='$d_endpwent'
23327 d_endpwent_r='$d_endpwent_r'
23328 d_endsent='$d_endsent'
23329 d_endservent_r='$d_endservent_r'
23330 d_eofnblk='$d_eofnblk'
23331 d_eunice='$d_eunice'
23332 d_faststdio='$d_faststdio'
23333 d_fchdir='$d_fchdir'
23334 d_fchmod='$d_fchmod'
23335 d_fchown='$d_fchown'
23336 d_fcntl='$d_fcntl'
23337 d_fcntl_can_lock='$d_fcntl_can_lock'
23338 d_fd_macros='$d_fd_macros'
23339 d_fd_set='$d_fd_set'
23340 d_fds_bits='$d_fds_bits'
23341 d_fegetround='$d_fegetround'
23342 d_fgetpos='$d_fgetpos'
23343 d_finite='$d_finite'
23344 d_finitel='$d_finitel'
23345 d_flexfnam='$d_flexfnam'
23346 d_flock='$d_flock'
23347 d_flockproto='$d_flockproto'
23348 d_fork='$d_fork'
23349 d_fp_class='$d_fp_class'
23350 d_fp_classify='$d_fp_classify'
23351 d_fp_classl='$d_fp_classl'
23352 d_fpathconf='$d_fpathconf'
23353 d_fpclass='$d_fpclass'
23354 d_fpclassify='$d_fpclassify'
23355 d_fpclassl='$d_fpclassl'
23356 d_fpgetround='$d_fpgetround'
23357 d_fpos64_t='$d_fpos64_t'
23358 d_frexpl='$d_frexpl'
23359 d_fs_data_s='$d_fs_data_s'
23360 d_fseeko='$d_fseeko'
23361 d_fsetpos='$d_fsetpos'
23362 d_fstatfs='$d_fstatfs'
23363 d_fstatvfs='$d_fstatvfs'
23364 d_fsync='$d_fsync'
23365 d_ftello='$d_ftello'
23366 d_ftime='$d_ftime'
23367 d_futimes='$d_futimes'
23368 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23369 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23370 d_getaddrinfo='$d_getaddrinfo'
23371 d_getcwd='$d_getcwd'
23372 d_getespwnam='$d_getespwnam'
23373 d_getfsstat='$d_getfsstat'
23374 d_getgrent='$d_getgrent'
23375 d_getgrent_r='$d_getgrent_r'
23376 d_getgrgid_r='$d_getgrgid_r'
23377 d_getgrnam_r='$d_getgrnam_r'
23378 d_getgrps='$d_getgrps'
23379 d_gethbyaddr='$d_gethbyaddr'
23380 d_gethbyname='$d_gethbyname'
23381 d_gethent='$d_gethent'
23382 d_gethname='$d_gethname'
23383 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23384 d_gethostbyname_r='$d_gethostbyname_r'
23385 d_gethostent_r='$d_gethostent_r'
23386 d_gethostprotos='$d_gethostprotos'
23387 d_getitimer='$d_getitimer'
23388 d_getlogin='$d_getlogin'
23389 d_getlogin_r='$d_getlogin_r'
23390 d_getmnt='$d_getmnt'
23391 d_getmntent='$d_getmntent'
23392 d_getnameinfo='$d_getnameinfo'
23393 d_getnbyaddr='$d_getnbyaddr'
23394 d_getnbyname='$d_getnbyname'
23395 d_getnent='$d_getnent'
23396 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23397 d_getnetbyname_r='$d_getnetbyname_r'
23398 d_getnetent_r='$d_getnetent_r'
23399 d_getnetprotos='$d_getnetprotos'
23400 d_getpagsz='$d_getpagsz'
23401 d_getpbyname='$d_getpbyname'
23402 d_getpbynumber='$d_getpbynumber'
23403 d_getpent='$d_getpent'
23404 d_getpgid='$d_getpgid'
23405 d_getpgrp2='$d_getpgrp2'
23406 d_getpgrp='$d_getpgrp'
23407 d_getppid='$d_getppid'
23408 d_getprior='$d_getprior'
23409 d_getprotobyname_r='$d_getprotobyname_r'
23410 d_getprotobynumber_r='$d_getprotobynumber_r'
23411 d_getprotoent_r='$d_getprotoent_r'
23412 d_getprotoprotos='$d_getprotoprotos'
23413 d_getprpwnam='$d_getprpwnam'
23414 d_getpwent='$d_getpwent'
23415 d_getpwent_r='$d_getpwent_r'
23416 d_getpwnam_r='$d_getpwnam_r'
23417 d_getpwuid_r='$d_getpwuid_r'
23418 d_getsbyname='$d_getsbyname'
23419 d_getsbyport='$d_getsbyport'
23420 d_getsent='$d_getsent'
23421 d_getservbyname_r='$d_getservbyname_r'
23422 d_getservbyport_r='$d_getservbyport_r'
23423 d_getservent_r='$d_getservent_r'
23424 d_getservprotos='$d_getservprotos'
23425 d_getspnam='$d_getspnam'
23426 d_getspnam_r='$d_getspnam_r'
23427 d_gettimeod='$d_gettimeod'
23428 d_gmtime64='$d_gmtime64'
23429 d_gmtime_r='$d_gmtime_r'
23430 d_gnulibc='$d_gnulibc'
23431 d_grpasswd='$d_grpasswd'
23432 d_hasmntopt='$d_hasmntopt'
23433 d_htonl='$d_htonl'
23434 d_ilogbl='$d_ilogbl'
23435 d_inc_version_list='$d_inc_version_list'
23436 d_index='$d_index'
23437 d_inetaton='$d_inetaton'
23438 d_inetntop='$d_inetntop'
23439 d_inetpton='$d_inetpton'
23440 d_int64_t='$d_int64_t'
23441 d_ip_mreq='$d_ip_mreq'
23442 d_ip_mreq_source='$d_ip_mreq_source'
23443 d_ipv6_mreq='$d_ipv6_mreq'
23444 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23445 d_isascii='$d_isascii'
23446 d_isblank='$d_isblank'
23447 d_isfinite='$d_isfinite'
23448 d_isfinitel='$d_isfinitel'
23449 d_isinf='$d_isinf'
23450 d_isinfl='$d_isinfl'
23451 d_isnan='$d_isnan'
23452 d_isnanl='$d_isnanl'
23453 d_j0='$d_j0'
23454 d_j0l='$d_j0l'
23455 d_killpg='$d_killpg'
23456 d_lchown='$d_lchown'
23457 d_ldbl_dig='$d_ldbl_dig'
23458 d_ldexpl='$d_ldexpl'
23459 d_libm_lib_version='$d_libm_lib_version'
23460 d_libname_unique='$d_libname_unique'
23461 d_link='$d_link'
23462 d_localtime64='$d_localtime64'
23463 d_localtime_r='$d_localtime_r'
23464 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23465 d_locconv='$d_locconv'
23466 d_lockf='$d_lockf'
23467 d_longdbl='$d_longdbl'
23468 d_longlong='$d_longlong'
23469 d_lseekproto='$d_lseekproto'
23470 d_lstat='$d_lstat'
23471 d_madvise='$d_madvise'
23472 d_malloc_good_size='$d_malloc_good_size'
23473 d_malloc_size='$d_malloc_size'
23474 d_mblen='$d_mblen'
23475 d_mbstowcs='$d_mbstowcs'
23476 d_mbtowc='$d_mbtowc'
23477 d_memchr='$d_memchr'
23478 d_memcmp='$d_memcmp'
23479 d_memcpy='$d_memcpy'
23480 d_memmove='$d_memmove'
23481 d_memset='$d_memset'
23482 d_mkdir='$d_mkdir'
23483 d_mkdtemp='$d_mkdtemp'
23484 d_mkfifo='$d_mkfifo'
23485 d_mkstemp='$d_mkstemp'
23486 d_mkstemps='$d_mkstemps'
23487 d_mktime64='$d_mktime64'
23488 d_mktime='$d_mktime'
23489 d_mmap='$d_mmap'
23490 d_modfl='$d_modfl'
23491 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23492 d_modflproto='$d_modflproto'
23493 d_mprotect='$d_mprotect'
23494 d_msg='$d_msg'
23495 d_msg_ctrunc='$d_msg_ctrunc'
23496 d_msg_dontroute='$d_msg_dontroute'
23497 d_msg_oob='$d_msg_oob'
23498 d_msg_peek='$d_msg_peek'
23499 d_msg_proxy='$d_msg_proxy'
23500 d_msgctl='$d_msgctl'
23501 d_msgget='$d_msgget'
23502 d_msghdr_s='$d_msghdr_s'
23503 d_msgrcv='$d_msgrcv'
23504 d_msgsnd='$d_msgsnd'
23505 d_msync='$d_msync'
23506 d_munmap='$d_munmap'
23507 d_mymalloc='$d_mymalloc'
23508 d_ndbm='$d_ndbm'
23509 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23510 d_nice='$d_nice'
23511 d_nl_langinfo='$d_nl_langinfo'
23512 d_nv_preserves_uv='$d_nv_preserves_uv'
23513 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23514 d_off64_t='$d_off64_t'
23515 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23516 d_oldpthreads='$d_oldpthreads'
23517 d_oldsock='$d_oldsock'
23518 d_open3='$d_open3'
23519 d_pathconf='$d_pathconf'
23520 d_pause='$d_pause'
23521 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23522 d_phostname='$d_phostname'
23523 d_pipe='$d_pipe'
23524 d_poll='$d_poll'
23525 d_portable='$d_portable'
23526 d_prctl='$d_prctl'
23527 d_prctl_set_name='$d_prctl_set_name'
23528 d_printf_format_null='$d_printf_format_null'
23529 d_procselfexe='$d_procselfexe'
23530 d_pseudofork='$d_pseudofork'
23531 d_pthread_atfork='$d_pthread_atfork'
23532 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23533 d_pthread_yield='$d_pthread_yield'
23534 d_ptrdiff_t='$d_ptrdiff_t'
23535 d_pwage='$d_pwage'
23536 d_pwchange='$d_pwchange'
23537 d_pwclass='$d_pwclass'
23538 d_pwcomment='$d_pwcomment'
23539 d_pwexpire='$d_pwexpire'
23540 d_pwgecos='$d_pwgecos'
23541 d_pwpasswd='$d_pwpasswd'
23542 d_pwquota='$d_pwquota'
23543 d_qgcvt='$d_qgcvt'
23544 d_quad='$d_quad'
23545 d_random_r='$d_random_r'
23546 d_readdir64_r='$d_readdir64_r'
23547 d_readdir='$d_readdir'
23548 d_readdir_r='$d_readdir_r'
23549 d_readlink='$d_readlink'
23550 d_readv='$d_readv'
23551 d_recvmsg='$d_recvmsg'
23552 d_rename='$d_rename'
23553 d_rewinddir='$d_rewinddir'
23554 d_rmdir='$d_rmdir'
23555 d_safebcpy='$d_safebcpy'
23556 d_safemcpy='$d_safemcpy'
23557 d_sanemcmp='$d_sanemcmp'
23558 d_sbrkproto='$d_sbrkproto'
23559 d_scalbnl='$d_scalbnl'
23560 d_sched_yield='$d_sched_yield'
23561 d_scm_rights='$d_scm_rights'
23562 d_seekdir='$d_seekdir'
23563 d_select='$d_select'
23564 d_sem='$d_sem'
23565 d_semctl='$d_semctl'
23566 d_semctl_semid_ds='$d_semctl_semid_ds'
23567 d_semctl_semun='$d_semctl_semun'
23568 d_semget='$d_semget'
23569 d_semop='$d_semop'
23570 d_sendmsg='$d_sendmsg'
23571 d_setegid='$d_setegid'
23572 d_seteuid='$d_seteuid'
23573 d_setgrent='$d_setgrent'
23574 d_setgrent_r='$d_setgrent_r'
23575 d_setgrps='$d_setgrps'
23576 d_sethent='$d_sethent'
23577 d_sethostent_r='$d_sethostent_r'
23578 d_setitimer='$d_setitimer'
23579 d_setlinebuf='$d_setlinebuf'
23580 d_setlocale='$d_setlocale'
23581 d_setlocale_r='$d_setlocale_r'
23582 d_setnent='$d_setnent'
23583 d_setnetent_r='$d_setnetent_r'
23584 d_setpent='$d_setpent'
23585 d_setpgid='$d_setpgid'
23586 d_setpgrp2='$d_setpgrp2'
23587 d_setpgrp='$d_setpgrp'
23588 d_setprior='$d_setprior'
23589 d_setproctitle='$d_setproctitle'
23590 d_setprotoent_r='$d_setprotoent_r'
23591 d_setpwent='$d_setpwent'
23592 d_setpwent_r='$d_setpwent_r'
23593 d_setregid='$d_setregid'
23594 d_setresgid='$d_setresgid'
23595 d_setresuid='$d_setresuid'
23596 d_setreuid='$d_setreuid'
23597 d_setrgid='$d_setrgid'
23598 d_setruid='$d_setruid'
23599 d_setsent='$d_setsent'
23600 d_setservent_r='$d_setservent_r'
23601 d_setsid='$d_setsid'
23602 d_setvbuf='$d_setvbuf'
23603 d_shm='$d_shm'
23604 d_shmat='$d_shmat'
23605 d_shmatprototype='$d_shmatprototype'
23606 d_shmctl='$d_shmctl'
23607 d_shmdt='$d_shmdt'
23608 d_shmget='$d_shmget'
23609 d_sigaction='$d_sigaction'
23610 d_signbit='$d_signbit'
23611 d_sigprocmask='$d_sigprocmask'
23612 d_sigsetjmp='$d_sigsetjmp'
23613 d_sin6_scope_id='$d_sin6_scope_id'
23614 d_sitearch='$d_sitearch'
23615 d_snprintf='$d_snprintf'
23616 d_sockaddr_in6='$d_sockaddr_in6'
23617 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23618 d_sockatmark='$d_sockatmark'
23619 d_sockatmarkproto='$d_sockatmarkproto'
23620 d_socket='$d_socket'
23621 d_socklen_t='$d_socklen_t'
23622 d_sockpair='$d_sockpair'
23623 d_socks5_init='$d_socks5_init'
23624 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23625 d_sqrtl='$d_sqrtl'
23626 d_srand48_r='$d_srand48_r'
23627 d_srandom_r='$d_srandom_r'
23628 d_sresgproto='$d_sresgproto'
23629 d_sresuproto='$d_sresuproto'
23630 d_statblks='$d_statblks'
23631 d_statfs_f_flags='$d_statfs_f_flags'
23632 d_statfs_s='$d_statfs_s'
23633 d_static_inline='$d_static_inline'
23634 d_statvfs='$d_statvfs'
23635 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23636 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23637 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23638 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23639 d_stdio_stream_array='$d_stdio_stream_array'
23640 d_stdiobase='$d_stdiobase'
23641 d_stdstdio='$d_stdstdio'
23642 d_strchr='$d_strchr'
23643 d_strcoll='$d_strcoll'
23644 d_strctcpy='$d_strctcpy'
23645 d_strerrm='$d_strerrm'
23646 d_strerror='$d_strerror'
23647 d_strerror_r='$d_strerror_r'
23648 d_strftime='$d_strftime'
23649 d_strlcat='$d_strlcat'
23650 d_strlcpy='$d_strlcpy'
23651 d_strtod='$d_strtod'
23652 d_strtol='$d_strtol'
23653 d_strtold='$d_strtold'
23654 d_strtoll='$d_strtoll'
23655 d_strtoq='$d_strtoq'
23656 d_strtoul='$d_strtoul'
23657 d_strtoull='$d_strtoull'
23658 d_strtouq='$d_strtouq'
23659 d_strxfrm='$d_strxfrm'
23660 d_suidsafe='$d_suidsafe'
23661 d_symlink='$d_symlink'
23662 d_syscall='$d_syscall'
23663 d_syscallproto='$d_syscallproto'
23664 d_sysconf='$d_sysconf'
23665 d_sysernlst='$d_sysernlst'
23666 d_syserrlst='$d_syserrlst'
23667 d_system='$d_system'
23668 d_tcgetpgrp='$d_tcgetpgrp'
23669 d_tcsetpgrp='$d_tcsetpgrp'
23670 d_telldir='$d_telldir'
23671 d_telldirproto='$d_telldirproto'
23672 d_time='$d_time'
23673 d_timegm='$d_timegm'
23674 d_times='$d_times'
23675 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23676 d_tm_tm_zone='$d_tm_tm_zone'
23677 d_tmpnam_r='$d_tmpnam_r'
23678 d_truncate='$d_truncate'
23679 d_ttyname_r='$d_ttyname_r'
23680 d_tzname='$d_tzname'
23681 d_u32align='$d_u32align'
23682 d_ualarm='$d_ualarm'
23683 d_umask='$d_umask'
23684 d_uname='$d_uname'
23685 d_union_semun='$d_union_semun'
23686 d_unordered='$d_unordered'
23687 d_unsetenv='$d_unsetenv'
23688 d_usleep='$d_usleep'
23689 d_usleepproto='$d_usleepproto'
23690 d_ustat='$d_ustat'
23691 d_vendorarch='$d_vendorarch'
23692 d_vendorbin='$d_vendorbin'
23693 d_vendorlib='$d_vendorlib'
23694 d_vendorscript='$d_vendorscript'
23695 d_vfork='$d_vfork'
23696 d_void_closedir='$d_void_closedir'
23697 d_voidsig='$d_voidsig'
23698 d_voidtty='$d_voidtty'
23699 d_volatile='$d_volatile'
23700 d_vprintf='$d_vprintf'
23701 d_vsnprintf='$d_vsnprintf'
23702 d_wait4='$d_wait4'
23703 d_waitpid='$d_waitpid'
23704 d_wcscmp='$d_wcscmp'
23705 d_wcstombs='$d_wcstombs'
23706 d_wcsxfrm='$d_wcsxfrm'
23707 d_wctomb='$d_wctomb'
23708 d_writev='$d_writev'
23709 d_xenix='$d_xenix'
23710 date='$date'
23711 db_hashtype='$db_hashtype'
23712 db_prefixtype='$db_prefixtype'
23713 db_version_major='$db_version_major'
23714 db_version_minor='$db_version_minor'
23715 db_version_patch='$db_version_patch'
23716 direntrytype='$direntrytype'
23717 dlext='$dlext'
23718 dlsrc='$dlsrc'
23719 doublesize='$doublesize'
23720 drand01='$drand01'
23721 drand48_r_proto='$drand48_r_proto'
23722 dtrace='$dtrace'
23723 dynamic_ext='$dynamic_ext'
23724 eagain='$eagain'
23725 ebcdic='$ebcdic'
23726 echo='$echo'
23727 egrep='$egrep'
23728 emacs='$emacs'
23729 endgrent_r_proto='$endgrent_r_proto'
23730 endhostent_r_proto='$endhostent_r_proto'
23731 endnetent_r_proto='$endnetent_r_proto'
23732 endprotoent_r_proto='$endprotoent_r_proto'
23733 endpwent_r_proto='$endpwent_r_proto'
23734 endservent_r_proto='$endservent_r_proto'
23735 eunicefix='$eunicefix'
23736 exe_ext='$exe_ext'
23737 expr='$expr'
23738 extensions='$extensions'
23739 extern_C='$extern_C'
23740 extras='$extras'
23741 fflushNULL='$fflushNULL'
23742 fflushall='$fflushall'
23743 find='$find'
23744 firstmakefile='$firstmakefile'
23745 flex='$flex'
23746 fpossize='$fpossize'
23747 fpostype='$fpostype'
23748 freetype='$freetype'
23749 from='$from'
23750 full_ar='$full_ar'
23751 full_csh='$full_csh'
23752 full_sed='$full_sed'
23753 gccansipedantic='$gccansipedantic'
23754 gccosandvers='$gccosandvers'
23755 gccversion='$gccversion'
23756 getgrent_r_proto='$getgrent_r_proto'
23757 getgrgid_r_proto='$getgrgid_r_proto'
23758 getgrnam_r_proto='$getgrnam_r_proto'
23759 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23760 gethostbyname_r_proto='$gethostbyname_r_proto'
23761 gethostent_r_proto='$gethostent_r_proto'
23762 getlogin_r_proto='$getlogin_r_proto'
23763 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23764 getnetbyname_r_proto='$getnetbyname_r_proto'
23765 getnetent_r_proto='$getnetent_r_proto'
23766 getprotobyname_r_proto='$getprotobyname_r_proto'
23767 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23768 getprotoent_r_proto='$getprotoent_r_proto'
23769 getpwent_r_proto='$getpwent_r_proto'
23770 getpwnam_r_proto='$getpwnam_r_proto'
23771 getpwuid_r_proto='$getpwuid_r_proto'
23772 getservbyname_r_proto='$getservbyname_r_proto'
23773 getservbyport_r_proto='$getservbyport_r_proto'
23774 getservent_r_proto='$getservent_r_proto'
23775 getspnam_r_proto='$getspnam_r_proto'
23776 gidformat='$gidformat'
23777 gidsign='$gidsign'
23778 gidsize='$gidsize'
23779 gidtype='$gidtype'
23780 glibpth='$glibpth'
23781 gmake='$gmake'
23782 gmtime_r_proto='$gmtime_r_proto'
23783 gnulibc_version='$gnulibc_version'
23784 grep='$grep'
23785 groupcat='$groupcat'
23786 groupstype='$groupstype'
23787 gzip='$gzip'
23788 h_fcntl='$h_fcntl'
23789 h_sysfile='$h_sysfile'
23790 hint='$hint'
23791 hostcat='$hostcat'
23792 hostgenerate='$hostgenerate'
23793 hostosname='$hostosname'
23794 hostperl='$hostperl'
23795 html1dir='$html1dir'
23796 html1direxp='$html1direxp'
23797 html3dir='$html3dir'
23798 html3direxp='$html3direxp'
23799 i16size='$i16size'
23800 i16type='$i16type'
23801 i32size='$i32size'
23802 i32type='$i32type'
23803 i64size='$i64size'
23804 i64type='$i64type'
23805 i8size='$i8size'
23806 i8type='$i8type'
23807 i_arpainet='$i_arpainet'
23808 i_assert='$i_assert'
23809 i_bfd='$i_bfd'
23810 i_bsdioctl='$i_bsdioctl'
23811 i_crypt='$i_crypt'
23812 i_db='$i_db'
23813 i_dbm='$i_dbm'
23814 i_dirent='$i_dirent'
23815 i_dlfcn='$i_dlfcn'
23816 i_execinfo='$i_execinfo'
23817 i_fcntl='$i_fcntl'
23818 i_fenv='$i_fenv'
23819 i_float='$i_float'
23820 i_fp='$i_fp'
23821 i_fp_class='$i_fp_class'
23822 i_gdbm='$i_gdbm'
23823 i_gdbm_ndbm='$i_gdbm_ndbm'
23824 i_gdbmndbm='$i_gdbmndbm'
23825 i_grp='$i_grp'
23826 i_ieeefp='$i_ieeefp'
23827 i_inttypes='$i_inttypes'
23828 i_langinfo='$i_langinfo'
23829 i_libutil='$i_libutil'
23830 i_limits='$i_limits'
23831 i_locale='$i_locale'
23832 i_machcthr='$i_machcthr'
23833 i_malloc='$i_malloc'
23834 i_mallocmalloc='$i_mallocmalloc'
23835 i_math='$i_math'
23836 i_memory='$i_memory'
23837 i_mntent='$i_mntent'
23838 i_ndbm='$i_ndbm'
23839 i_netdb='$i_netdb'
23840 i_neterrno='$i_neterrno'
23841 i_netinettcp='$i_netinettcp'
23842 i_niin='$i_niin'
23843 i_poll='$i_poll'
23844 i_prot='$i_prot'
23845 i_pthread='$i_pthread'
23846 i_pwd='$i_pwd'
23847 i_rpcsvcdbm='$i_rpcsvcdbm'
23848 i_sgtty='$i_sgtty'
23849 i_shadow='$i_shadow'
23850 i_socks='$i_socks'
23851 i_stdarg='$i_stdarg'
23852 i_stdbool='$i_stdbool'
23853 i_stddef='$i_stddef'
23854 i_stdint='$i_stdint'
23855 i_stdlib='$i_stdlib'
23856 i_string='$i_string'
23857 i_sunmath='$i_sunmath'
23858 i_sysaccess='$i_sysaccess'
23859 i_sysdir='$i_sysdir'
23860 i_sysfile='$i_sysfile'
23861 i_sysfilio='$i_sysfilio'
23862 i_sysin='$i_sysin'
23863 i_sysioctl='$i_sysioctl'
23864 i_syslog='$i_syslog'
23865 i_sysmman='$i_sysmman'
23866 i_sysmode='$i_sysmode'
23867 i_sysmount='$i_sysmount'
23868 i_sysndir='$i_sysndir'
23869 i_sysparam='$i_sysparam'
23870 i_syspoll='$i_syspoll'
23871 i_sysresrc='$i_sysresrc'
23872 i_syssecrt='$i_syssecrt'
23873 i_sysselct='$i_sysselct'
23874 i_syssockio='$i_syssockio'
23875 i_sysstat='$i_sysstat'
23876 i_sysstatfs='$i_sysstatfs'
23877 i_sysstatvfs='$i_sysstatvfs'
23878 i_systime='$i_systime'
23879 i_systimek='$i_systimek'
23880 i_systimes='$i_systimes'
23881 i_systypes='$i_systypes'
23882 i_sysuio='$i_sysuio'
23883 i_sysun='$i_sysun'
23884 i_sysutsname='$i_sysutsname'
23885 i_sysvfs='$i_sysvfs'
23886 i_syswait='$i_syswait'
23887 i_termio='$i_termio'
23888 i_termios='$i_termios'
23889 i_time='$i_time'
23890 i_unistd='$i_unistd'
23891 i_ustat='$i_ustat'
23892 i_utime='$i_utime'
23893 i_values='$i_values'
23894 i_varargs='$i_varargs'
23895 i_varhdr='$i_varhdr'
23896 i_vfork='$i_vfork'
23897 ignore_versioned_solibs='$ignore_versioned_solibs'
23898 inc_version_list='$inc_version_list'
23899 inc_version_list_init='$inc_version_list_init'
23900 incpath='$incpath'
23901 incpth='$incpth'
23902 inews='$inews'
23903 initialinstalllocation='$initialinstalllocation'
23904 installarchlib='$installarchlib'
23905 installbin='$installbin'
23906 installhtml1dir='$installhtml1dir'
23907 installhtml3dir='$installhtml3dir'
23908 installman1dir='$installman1dir'
23909 installman3dir='$installman3dir'
23910 installprefix='$installprefix'
23911 installprefixexp='$installprefixexp'
23912 installprivlib='$installprivlib'
23913 installscript='$installscript'
23914 installsitearch='$installsitearch'
23915 installsitebin='$installsitebin'
23916 installsitehtml1dir='$installsitehtml1dir'
23917 installsitehtml3dir='$installsitehtml3dir'
23918 installsitelib='$installsitelib'
23919 installsiteman1dir='$installsiteman1dir'
23920 installsiteman3dir='$installsiteman3dir'
23921 installsitescript='$installsitescript'
23922 installstyle='$installstyle'
23923 installusrbinperl='$installusrbinperl'
23924 installvendorarch='$installvendorarch'
23925 installvendorbin='$installvendorbin'
23926 installvendorhtml1dir='$installvendorhtml1dir'
23927 installvendorhtml3dir='$installvendorhtml3dir'
23928 installvendorlib='$installvendorlib'
23929 installvendorman1dir='$installvendorman1dir'
23930 installvendorman3dir='$installvendorman3dir'
23931 installvendorscript='$installvendorscript'
23932 intsize='$intsize'
23933 issymlink='$issymlink'
23934 ivdformat='$ivdformat'
23935 ivsize='$ivsize'
23936 ivtype='$ivtype'
23937 known_extensions='$known_extensions'
23938 ksh='$ksh'
23939 ld='$ld'
23940 ld_can_script='$ld_can_script'
23941 lddlflags='$lddlflags'
23942 ldflags='$ldflags'
23943 ldflags_uselargefiles='$ldflags_uselargefiles'
23944 ldlibpthname='$ldlibpthname'
23945 less='$less'
23946 lib_ext='$lib_ext'
23947 libc='$libc'
23948 libperl='$libperl'
23949 libpth='$libpth'
23950 libs='$libs'
23951 libsdirs='$libsdirs'
23952 libsfiles='$libsfiles'
23953 libsfound='$libsfound'
23954 libspath='$libspath'
23955 libswanted='$libswanted'
23956 libswanted_uselargefiles='$libswanted_uselargefiles'
23957 line='$line'
23958 lint='$lint'
23959 lkflags='$lkflags'
23960 ln='$ln'
23961 lns='$lns'
23962 localtime_r_proto='$localtime_r_proto'
23963 locincpth='$locincpth'
23964 loclibpth='$loclibpth'
23965 longdblkind='$longdblkind'
23966 longdblsize='$longdblsize'
23967 longlongsize='$longlongsize'
23968 longsize='$longsize'
23969 lp='$lp'
23970 lpr='$lpr'
23971 ls='$ls'
23972 lseeksize='$lseeksize'
23973 lseektype='$lseektype'
23974 mail='$mail'
23975 mailx='$mailx'
23976 make='$make'
23977 make_set_make='$make_set_make'
23978 mallocobj='$mallocobj'
23979 mallocsrc='$mallocsrc'
23980 malloctype='$malloctype'
23981 man1dir='$man1dir'
23982 man1direxp='$man1direxp'
23983 man1ext='$man1ext'
23984 man3dir='$man3dir'
23985 man3direxp='$man3direxp'
23986 man3ext='$man3ext'
23987 mips_type='$mips_type'
23988 mistrustnm='$mistrustnm'
23989 mkdir='$mkdir'
23990 mmaptype='$mmaptype'
23991 modetype='$modetype'
23992 more='$more'
23993 multiarch='$multiarch'
23994 mv='$mv'
23995 myarchname='$myarchname'
23996 mydomain='$mydomain'
23997 myhostname='$myhostname'
23998 myuname='$myuname'
23999 n='$n'
24000 need_va_copy='$need_va_copy'
24001 netdb_hlen_type='$netdb_hlen_type'
24002 netdb_host_type='$netdb_host_type'
24003 netdb_name_type='$netdb_name_type'
24004 netdb_net_type='$netdb_net_type'
24005 nm='$nm'
24006 nm_opt='$nm_opt'
24007 nm_so_opt='$nm_so_opt'
24008 nonxs_ext='$nonxs_ext'
24009 nroff='$nroff'
24010 nvEUformat='$nvEUformat'
24011 nvFUformat='$nvFUformat'
24012 nvGUformat='$nvGUformat'
24013 nv_overflows_integers_at='$nv_overflows_integers_at'
24014 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24015 nveformat='$nveformat'
24016 nvfformat='$nvfformat'
24017 nvgformat='$nvgformat'
24018 nvsize='$nvsize'
24019 nvtype='$nvtype'
24020 o_nonblock='$o_nonblock'
24021 obj_ext='$obj_ext'
24022 old_pthread_create_joinable='$old_pthread_create_joinable'
24023 optimize='$optimize'
24024 orderlib='$orderlib'
24025 osname='$osname'
24026 osvers='$osvers'
24027 otherlibdirs='$otherlibdirs'
24028 package='$package'
24029 pager='$pager'
24030 passcat='$passcat'
24031 patchlevel='$patchlevel'
24032 path_sep='$path_sep'
24033 perl5='$perl5'
24034 perl='$perl'
24035 perl_patchlevel='$perl_patchlevel'
24036 perl_static_inline='$perl_static_inline'
24037 perladmin='$perladmin'
24038 perllibs='$perllibs'
24039 perlpath='$perlpath'
24040 pg='$pg'
24041 phostname='$phostname'
24042 pidtype='$pidtype'
24043 plibpth='$plibpth'
24044 pmake='$pmake'
24045 pr='$pr'
24046 prefix='$prefix'
24047 prefixexp='$prefixexp'
24048 privlib='$privlib'
24049 privlibexp='$privlibexp'
24050 procselfexe='$procselfexe'
24051 prototype='$prototype'
24052 ptrsize='$ptrsize'
24053 quadkind='$quadkind'
24054 quadtype='$quadtype'
24055 randbits='$randbits'
24056 randfunc='$randfunc'
24057 random_r_proto='$random_r_proto'
24058 randseedtype='$randseedtype'
24059 ranlib='$ranlib'
24060 rd_nodata='$rd_nodata'
24061 readdir64_r_proto='$readdir64_r_proto'
24062 readdir_r_proto='$readdir_r_proto'
24063 revision='$revision'
24064 rm='$rm'
24065 rm_try='$rm_try'
24066 rmail='$rmail'
24067 run='$run'
24068 runnm='$runnm'
24069 sGMTIME_max='$sGMTIME_max'
24070 sGMTIME_min='$sGMTIME_min'
24071 sLOCALTIME_max='$sLOCALTIME_max'
24072 sLOCALTIME_min='$sLOCALTIME_min'
24073 sPRIEUldbl='$sPRIEUldbl'
24074 sPRIFUldbl='$sPRIFUldbl'
24075 sPRIGUldbl='$sPRIGUldbl'
24076 sPRIXU64='$sPRIXU64'
24077 sPRId64='$sPRId64'
24078 sPRIeldbl='$sPRIeldbl'
24079 sPRIfldbl='$sPRIfldbl'
24080 sPRIgldbl='$sPRIgldbl'
24081 sPRIi64='$sPRIi64'
24082 sPRIo64='$sPRIo64'
24083 sPRIu64='$sPRIu64'
24084 sPRIx64='$sPRIx64'
24085 sSCNfldbl='$sSCNfldbl'
24086 sched_yield='$sched_yield'
24087 scriptdir='$scriptdir'
24088 scriptdirexp='$scriptdirexp'
24089 sed='$sed'
24090 seedfunc='$seedfunc'
24091 selectminbits='$selectminbits'
24092 selecttype='$selecttype'
24093 sendmail='$sendmail'
24094 setgrent_r_proto='$setgrent_r_proto'
24095 sethostent_r_proto='$sethostent_r_proto'
24096 setlocale_r_proto='$setlocale_r_proto'
24097 setnetent_r_proto='$setnetent_r_proto'
24098 setprotoent_r_proto='$setprotoent_r_proto'
24099 setpwent_r_proto='$setpwent_r_proto'
24100 setservent_r_proto='$setservent_r_proto'
24101 sh='$sh'
24102 shar='$shar'
24103 sharpbang='$sharpbang'
24104 shmattype='$shmattype'
24105 shortsize='$shortsize'
24106 shrpenv='$shrpenv'
24107 shsharp='$shsharp'
24108 sig_count='$sig_count'
24109 sig_name='$sig_name'
24110 sig_name_init='$sig_name_init'
24111 sig_num='$sig_num'
24112 sig_num_init='$sig_num_init'
24113 sig_size='$sig_size'
24114 signal_t='$signal_t'
24115 sitearch='$sitearch'
24116 sitearchexp='$sitearchexp'
24117 sitebin='$sitebin'
24118 sitebinexp='$sitebinexp'
24119 sitehtml1dir='$sitehtml1dir'
24120 sitehtml1direxp='$sitehtml1direxp'
24121 sitehtml3dir='$sitehtml3dir'
24122 sitehtml3direxp='$sitehtml3direxp'
24123 sitelib='$sitelib'
24124 sitelib_stem='$sitelib_stem'
24125 sitelibexp='$sitelibexp'
24126 siteman1dir='$siteman1dir'
24127 siteman1direxp='$siteman1direxp'
24128 siteman3dir='$siteman3dir'
24129 siteman3direxp='$siteman3direxp'
24130 siteprefix='$siteprefix'
24131 siteprefixexp='$siteprefixexp'
24132 sitescript='$sitescript'
24133 sitescriptexp='$sitescriptexp'
24134 sizesize='$sizesize'
24135 sizetype='$sizetype'
24136 sleep='$sleep'
24137 smail='$smail'
24138 so='$so'
24139 sockethdr='$sockethdr'
24140 socketlib='$socketlib'
24141 socksizetype='$socksizetype'
24142 sort='$sort'
24143 spackage='$spackage'
24144 spitshell='$spitshell'
24145 srand48_r_proto='$srand48_r_proto'
24146 srandom_r_proto='$srandom_r_proto'
24147 src='$src'
24148 ssizetype='$ssizetype'
24149 st_ino_sign='$st_ino_sign'
24150 st_ino_size='$st_ino_size'
24151 startperl='$startperl'
24152 startsh='$startsh'
24153 static_ext='$static_ext'
24154 stdchar='$stdchar'
24155 stdio_base='$stdio_base'
24156 stdio_bufsiz='$stdio_bufsiz'
24157 stdio_cnt='$stdio_cnt'
24158 stdio_filbuf='$stdio_filbuf'
24159 stdio_ptr='$stdio_ptr'
24160 stdio_stream_array='$stdio_stream_array'
24161 strerror_r_proto='$strerror_r_proto'
24162 strings='$strings'
24163 submit='$submit'
24164 subversion='$subversion'
24165 sysman='$sysman'
24166 sysroot='$sysroot'
24167 tail='$tail'
24168 tar='$tar'
24169 targetarch='$targetarch'
24170 targetdir='$targetdir'
24171 targetenv='$targetenv'
24172 targethost='$targethost'
24173 targetmkdir='$targetmkdir'
24174 targetport='$targetport'
24175 targetsh='$targetsh'
24176 tbl='$tbl'
24177 tee='$tee'
24178 test='$test'
24179 timeincl='$timeincl'
24180 timetype='$timetype'
24181 tmpnam_r_proto='$tmpnam_r_proto'
24182 to='$to'
24183 touch='$touch'
24184 tr='$tr'
24185 trnl='$trnl'
24186 troff='$troff'
24187 ttyname_r_proto='$ttyname_r_proto'
24188 u16size='$u16size'
24189 u16type='$u16type'
24190 u32size='$u32size'
24191 u32type='$u32type'
24192 u64size='$u64size'
24193 u64type='$u64type'
24194 u8size='$u8size'
24195 u8type='$u8type'
24196 uidformat='$uidformat'
24197 uidsign='$uidsign'
24198 uidsize='$uidsize'
24199 uidtype='$uidtype'
24200 uname='$uname'
24201 uniq='$uniq'
24202 uquadtype='$uquadtype'
24203 use5005threads='$use5005threads'
24204 use64bitall='$use64bitall'
24205 use64bitint='$use64bitint'
24206 usecbacktrace='$usecbacktrace'
24207 usecrosscompile='$usecrosscompile'
24208 usedevel='$usedevel'
24209 usedl='$usedl'
24210 usedtrace='$usedtrace'
24211 usefaststdio='$usefaststdio'
24212 useithreads='$useithreads'
24213 usekernprocpathname='$usekernprocpathname'
24214 uselargefiles='$uselargefiles'
24215 uselongdouble='$uselongdouble'
24216 usemallocwrap='$usemallocwrap'
24217 usemorebits='$usemorebits'
24218 usemultiplicity='$usemultiplicity'
24219 usemymalloc='$usemymalloc'
24220 usenm='$usenm'
24221 usensgetexecutablepath='$usensgetexecutablepath'
24222 useopcode='$useopcode'
24223 useperlio='$useperlio'
24224 useposix='$useposix'
24225 usereentrant='$usereentrant'
24226 userelocatableinc='$userelocatableinc'
24227 useshrplib='$useshrplib'
24228 usesitecustomize='$usesitecustomize'
24229 usesocks='$usesocks'
24230 usethreads='$usethreads'
24231 usevendorprefix='$usevendorprefix'
24232 useversionedarchname='$useversionedarchname'
24233 usevfork='$usevfork'
24234 usrinc='$usrinc'
24235 uuname='$uuname'
24236 uvXUformat='$uvXUformat'
24237 uvoformat='$uvoformat'
24238 uvsize='$uvsize'
24239 uvtype='$uvtype'
24240 uvuformat='$uvuformat'
24241 uvxformat='$uvxformat'
24242 vaproto='$vaproto'
24243 vendorarch='$vendorarch'
24244 vendorarchexp='$vendorarchexp'
24245 vendorbin='$vendorbin'
24246 vendorbinexp='$vendorbinexp'
24247 vendorhtml1dir='$vendorhtml1dir'
24248 vendorhtml1direxp='$vendorhtml1direxp'
24249 vendorhtml3dir='$vendorhtml3dir'
24250 vendorhtml3direxp='$vendorhtml3direxp'
24251 vendorlib='$vendorlib'
24252 vendorlib_stem='$vendorlib_stem'
24253 vendorlibexp='$vendorlibexp'
24254 vendorman1dir='$vendorman1dir'
24255 vendorman1direxp='$vendorman1direxp'
24256 vendorman3dir='$vendorman3dir'
24257 vendorman3direxp='$vendorman3direxp'
24258 vendorprefix='$vendorprefix'
24259 vendorprefixexp='$vendorprefixexp'
24260 vendorscript='$vendorscript'
24261 vendorscriptexp='$vendorscriptexp'
24262 version='$version'
24263 version_patchlevel_string='$version_patchlevel_string'
24264 versiononly='$versiononly'
24265 vi='$vi'
24266 xlibpth='$xlibpth'
24267 yacc='$yacc'
24268 yaccflags='$yaccflags'
24269 zcat='$zcat'
24270 zip='$zip'
24271 EOT
24272
24273 : add special variables
24274 $test -f $src/patchlevel.h && \
24275 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24276 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24277 echo "PERL_CONFIG_SH=true" >>config.sh
24278
24279 : propagate old symbols
24280 if $test -f UU/config.sh; then
24281         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24282         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24283                 config.sh config.sh UU/oldconfig.sh |\
24284                 $sort | $uniq -u >UU/oldsyms
24285         set X `$cat UU/oldsyms`
24286         shift
24287         case $# in
24288         0) ;;
24289         *)
24290                 $cat <<EOM
24291 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24292 EOM
24293                 echo ": Variables propagated from previous config.sh file." >>config.sh
24294                 for sym in `$cat UU/oldsyms`; do
24295                         echo "    Propagating $hint variable "'$'"$sym..."
24296                         eval 'tmp="$'"${sym}"'"'
24297                         echo "$tmp" | \
24298                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24299                 done
24300                 ;;
24301         esac
24302 fi
24303
24304 : preserve RCS keywords in files with variable substitution, grrr
24305 Id='$Id'
24306
24307 : Finish up by extracting the .SH files
24308 case "$alldone" in
24309 exit)
24310         $rm -rf UU
24311         echo "Extraction done."
24312         exit 0
24313         ;;
24314 cont)
24315         ;;
24316 '')
24317         dflt=''
24318         nostick=true
24319         $cat <<EOM
24320
24321 If you'd like to make any changes to the config.sh file before I begin
24322 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24323
24324 EOM
24325         rp="Press return or use a shell escape to edit config.sh:"
24326         . UU/myread
24327         nostick=''
24328         case "$ans" in
24329         '') ;;
24330         *) : in case they cannot read
24331                 sh 1>&4 -c "$ans";;
24332         esac
24333         ;;
24334 esac
24335
24336 : if this fails, just run all the .SH files by hand
24337 . ./config.sh
24338
24339 echo " "
24340 exec 1>&4
24341 pwd=`pwd`
24342 . ./UU/extract
24343 cd "$pwd"
24344
24345 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24346         dflt=y
24347         case "$silent" in
24348         true) ;;
24349         *)
24350                 $cat <<EOM
24351
24352 Now you need to generate make dependencies by running "$make depend".
24353 You might prefer to run it in background: "$make depend > makedepend.out &"
24354 It can take a while, so you might not want to run it right now.
24355
24356 EOM
24357                 ;;
24358         esac
24359         rp="Run $make depend now?"
24360         . UU/myread
24361         case "$ans" in
24362         y*)
24363                 $make depend && echo "Now you must run '$make'."
24364                 ;;
24365         *)
24366                 echo "You must run '$make depend' then '$make'."
24367                 ;;
24368         esac
24369 elif test -f [Mm]akefile; then
24370         echo " "
24371         echo "Now you must run a $make."
24372 else
24373         echo "Configure done."
24374 fi
24375
24376 if $test -f Policy.sh; then
24377     $cat <<EOM
24378
24379 If you compile $package on a different machine or from a different object
24380 directory, copy the Policy.sh file from this object directory to the
24381 new one before you run Configure -- this will help you with most of
24382 the policy defaults.
24383
24384 EOM
24385 fi
24386 if $test -f config.msg; then
24387     echo "Hmm.  I also noted the following information while running:"
24388     echo " "
24389     $cat config.msg >&4
24390     $rm -f config.msg
24391 fi
24392 $rm -f kit*isdone ark*isdone
24393 $rm -rf UU
24394
24395 : End of Configure
24396