This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add a Perl equivalent to av_delete().
[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.sourceforge.net/svnroot/dist/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 # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
32 #
33 # Generated on Fri May 21 07:59:07 CEST 2010 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_fstatvfs=''
752 d_statvfs=''
753 d_stdio_cnt_lval=''
754 d_stdio_ptr_lval=''
755 d_stdio_ptr_lval_nochange_cnt=''
756 d_stdio_ptr_lval_sets_cnt=''
757 d_stdiobase=''
758 d_stdstdio=''
759 stdio_base=''
760 stdio_bufsiz=''
761 stdio_cnt=''
762 stdio_filbuf=''
763 stdio_ptr=''
764 d_index=''
765 d_strchr=''
766 d_strcoll=''
767 d_strctcpy=''
768 d_strerrm=''
769 d_strerror=''
770 d_sysernlst=''
771 d_syserrlst=''
772 d_strerror_r=''
773 strerror_r_proto=''
774 d_strftime=''
775 d_strlcat=''
776 d_strlcpy=''
777 d_strtod=''
778 d_strtol=''
779 d_strtold=''
780 d_strtoll=''
781 d_strtoq=''
782 d_strtoul=''
783 d_strtoull=''
784 d_strtouq=''
785 d_strxfrm=''
786 d_symlink=''
787 d_syscall=''
788 d_syscallproto=''
789 d_sysconf=''
790 d_system=''
791 d_tcgetpgrp=''
792 d_tcsetpgrp=''
793 d_telldirproto=''
794 d_time=''
795 timetype=''
796 d_asctime64=''
797 d_ctime64=''
798 d_difftime64=''
799 d_gmtime64=''
800 d_localtime64=''
801 d_mktime64=''
802 d_timegm=''
803 clocktype=''
804 d_times=''
805 d_tmpnam_r=''
806 tmpnam_r_proto=''
807 d_truncate=''
808 d_ttyname_r=''
809 ttyname_r_proto=''
810 d_tzname=''
811 d_u32align=''
812 d_ualarm=''
813 d_umask=''
814 d_semctl_semid_ds=''
815 d_semctl_semun=''
816 d_union_semun=''
817 d_unordered=''
818 d_unsetenv=''
819 d_usleep=''
820 d_usleepproto=''
821 d_ustat=''
822 d_pseudofork=''
823 d_vfork=''
824 usevfork=''
825 d_voidsig=''
826 signal_t=''
827 d_volatile=''
828 d_charvspr=''
829 d_vprintf=''
830 d_wait4=''
831 d_waitpid=''
832 d_wcstombs=''
833 d_wctomb=''
834 d_writev=''
835 dlext=''
836 bin_ELF=''
837 cccdlflags=''
838 ccdlflags=''
839 dlsrc=''
840 ld=''
841 lddlflags=''
842 usedl=''
843 doublesize=''
844 ebcdic=''
845 fflushNULL=''
846 fflushall=''
847 fpossize=''
848 fpostype=''
849 gccansipedantic=''
850 gccosandvers=''
851 gccversion=''
852 gidformat=''
853 gidsign=''
854 gidsize=''
855 gidtype=''
856 groupstype=''
857 h_fcntl=''
858 h_sysfile=''
859 html1dir=''
860 html1direxp=''
861 installhtml1dir=''
862 html3dir=''
863 html3direxp=''
864 installhtml3dir=''
865 i_arpainet=''
866 i_assert=''
867 i_crypt=''
868 db_hashtype=''
869 db_prefixtype=''
870 db_version_major=''
871 db_version_minor=''
872 db_version_patch=''
873 i_db=''
874 i_dbm=''
875 i_rpcsvcdbm=''
876 d_dirnamlen=''
877 direntrytype=''
878 i_dirent=''
879 i_dld=''
880 i_dlfcn=''
881 i_fcntl=''
882 i_float=''
883 i_fp=''
884 i_fp_class=''
885 i_gdbm=''
886 d_grpasswd=''
887 i_grp=''
888 i_ieeefp=''
889 i_inttypes=''
890 i_langinfo=''
891 i_libutil=''
892 i_limits=''
893 i_locale=''
894 i_machcthr=''
895 i_malloc=''
896 i_mallocmalloc=''
897 i_math=''
898 i_memory=''
899 i_mntent=''
900 d_gdbm_ndbm_h_uses_prototypes=''
901 d_gdbmndbm_h_uses_prototypes=''
902 d_ndbm=''
903 d_ndbm_h_uses_prototypes=''
904 i_gdbm_ndbm=''
905 i_gdbmndbm=''
906 i_ndbm=''
907 i_netdb=''
908 i_neterrno=''
909 i_netinettcp=''
910 i_niin=''
911 i_sysin=''
912 i_poll=''
913 i_prot=''
914 i_pthread=''
915 d_pwage=''
916 d_pwchange=''
917 d_pwclass=''
918 d_pwcomment=''
919 d_pwexpire=''
920 d_pwgecos=''
921 d_pwpasswd=''
922 d_pwquota=''
923 i_pwd=''
924 i_sfio=''
925 i_shadow=''
926 i_socks=''
927 i_stddef=''
928 i_stdlib=''
929 i_string=''
930 strings=''
931 i_sunmath=''
932 i_sysaccess=''
933 i_sysdir=''
934 i_sysfile=''
935 d_voidtty=''
936 i_bsdioctl=''
937 i_sysfilio=''
938 i_sysioctl=''
939 i_syssockio=''
940 i_syslog=''
941 i_sysmman=''
942 i_sysmode=''
943 i_sysmount=''
944 i_sysndir=''
945 i_sysparam=''
946 i_syspoll=''
947 i_sysresrc=''
948 i_syssecrt=''
949 i_sysselct=''
950 i_sysstat=''
951 i_sysstatfs=''
952 i_sysstatvfs=''
953 i_systimes=''
954 i_systypes=''
955 i_sysuio=''
956 i_sysun=''
957 i_sysutsname=''
958 i_sysvfs=''
959 i_syswait=''
960 i_sgtty=''
961 i_termio=''
962 i_termios=''
963 d_tm_tm_gmtoff=''
964 d_tm_tm_zone=''
965 i_systime=''
966 i_systimek=''
967 i_time=''
968 timeincl=''
969 i_unistd=''
970 i_ustat=''
971 i_utime=''
972 i_values=''
973 i_stdarg=''
974 i_varargs=''
975 i_varhdr=''
976 i_vfork=''
977 d_inc_version_list=''
978 inc_version_list=''
979 inc_version_list_init=''
980 installprefix=''
981 installprefixexp=''
982 installstyle=''
983 installusrbinperl=''
984 intsize=''
985 longsize=''
986 shortsize=''
987 issymlink=''
988 libc=''
989 ldlibpthname=''
990 libperl=''
991 shrpenv=''
992 useshrplib=''
993 glibpth=''
994 libpth=''
995 loclibpth=''
996 plibpth=''
997 xlibpth=''
998 ignore_versioned_solibs=''
999 libs=''
1000 libsdirs=''
1001 libsfiles=''
1002 libsfound=''
1003 libspath=''
1004 lns=''
1005 d_PRIEUldbl=''
1006 d_PRIFUldbl=''
1007 d_PRIGUldbl=''
1008 d_PRIeldbl=''
1009 d_PRIfldbl=''
1010 d_PRIgldbl=''
1011 d_SCNfldbl=''
1012 sPRIEUldbl=''
1013 sPRIFUldbl=''
1014 sPRIGUldbl=''
1015 sPRIeldbl=''
1016 sPRIfldbl=''
1017 sPRIgldbl=''
1018 sSCNfldbl=''
1019 lseeksize=''
1020 lseektype=''
1021 mad=''
1022 madlyh=''
1023 madlyobj=''
1024 madlysrc=''
1025 make_set_make=''
1026 d_mymalloc=''
1027 freetype=''
1028 mallocobj=''
1029 mallocsrc=''
1030 malloctype=''
1031 usemallocwrap=''
1032 usemymalloc=''
1033 installman1dir=''
1034 man1dir=''
1035 man1direxp=''
1036 man1ext=''
1037 installman3dir=''
1038 man3dir=''
1039 man3direxp=''
1040 man3ext=''
1041 modetype=''
1042 multiarch=''
1043 mydomain=''
1044 myhostname=''
1045 phostname=''
1046 c=''
1047 n=''
1048 d_eofnblk=''
1049 eagain=''
1050 o_nonblock=''
1051 rd_nodata=''
1052 need_va_copy=''
1053 netdb_hlen_type=''
1054 netdb_host_type=''
1055 netdb_name_type=''
1056 netdb_net_type=''
1057 groupcat=''
1058 hostcat=''
1059 passcat=''
1060 orderlib=''
1061 ranlib=''
1062 d_perl_otherlibdirs=''
1063 otherlibdirs=''
1064 package=''
1065 spackage=''
1066 pager=''
1067 api_revision=''
1068 api_subversion=''
1069 api_version=''
1070 api_versionstring=''
1071 patchlevel=''
1072 perl_patchlevel=''
1073 revision=''
1074 subversion=''
1075 version=''
1076 version_patchlevel_string=''
1077 perl5=''
1078 perladmin=''
1079 perlpath=''
1080 d_nv_preserves_uv=''
1081 d_nv_zero_is_allbits_zero=''
1082 i16size=''
1083 i16type=''
1084 i32size=''
1085 i32type=''
1086 i64size=''
1087 i64type=''
1088 i8size=''
1089 i8type=''
1090 ivsize=''
1091 ivtype=''
1092 nv_overflows_integers_at=''
1093 nv_preserves_uv_bits=''
1094 nvsize=''
1095 nvtype=''
1096 u16size=''
1097 u16type=''
1098 u32size=''
1099 u32type=''
1100 u64size=''
1101 u64type=''
1102 u8size=''
1103 u8type=''
1104 uvsize=''
1105 uvtype=''
1106 ivdformat=''
1107 nvEUformat=''
1108 nvFUformat=''
1109 nvGUformat=''
1110 nveformat=''
1111 nvfformat=''
1112 nvgformat=''
1113 uvXUformat=''
1114 uvoformat=''
1115 uvuformat=''
1116 uvxformat=''
1117 pidtype=''
1118 prefix=''
1119 prefixexp=''
1120 installprivlib=''
1121 privlib=''
1122 privlibexp=''
1123 prototype=''
1124 ptrsize=''
1125 d_PRIXU64=''
1126 d_PRId64=''
1127 d_PRIi64=''
1128 d_PRIo64=''
1129 d_PRIu64=''
1130 d_PRIx64=''
1131 sPRIXU64=''
1132 sPRId64=''
1133 sPRIi64=''
1134 sPRIo64=''
1135 sPRIu64=''
1136 sPRIx64=''
1137 d_quad=''
1138 quadkind=''
1139 quadtype=''
1140 uquadtype=''
1141 drand01=''
1142 randbits=''
1143 randfunc=''
1144 randseedtype=''
1145 seedfunc=''
1146 installscript=''
1147 scriptdir=''
1148 scriptdirexp=''
1149 selectminbits=''
1150 selecttype=''
1151 sh=''
1152 sig_count=''
1153 sig_name=''
1154 sig_name_init=''
1155 sig_num=''
1156 sig_num_init=''
1157 sig_size=''
1158 d_sitearch=''
1159 installsitearch=''
1160 sitearch=''
1161 sitearchexp=''
1162 installsitebin=''
1163 sitebin=''
1164 sitebinexp=''
1165 installsitehtml1dir=''
1166 sitehtml1dir=''
1167 sitehtml1direxp=''
1168 installsitehtml3dir=''
1169 sitehtml3dir=''
1170 sitehtml3direxp=''
1171 installsitelib=''
1172 sitelib=''
1173 sitelib_stem=''
1174 sitelibexp=''
1175 installsiteman1dir=''
1176 siteman1dir=''
1177 siteman1direxp=''
1178 installsiteman3dir=''
1179 siteman3dir=''
1180 siteman3direxp=''
1181 siteprefix=''
1182 siteprefixexp=''
1183 installsitescript=''
1184 sitescript=''
1185 sitescriptexp=''
1186 sizesize=''
1187 sizetype=''
1188 so=''
1189 socksizetype=''
1190 sharpbang=''
1191 shsharp=''
1192 spitshell=''
1193 src=''
1194 ssizetype=''
1195 startperl=''
1196 startsh=''
1197 stdchar=''
1198 d_stdio_stream_array=''
1199 stdio_stream_array=''
1200 sysman=''
1201 sGMTIME_max=''
1202 sGMTIME_min=''
1203 sLOCALTIME_max=''
1204 sLOCALTIME_min=''
1205 trnl=''
1206 uidformat=''
1207 uidsign=''
1208 uidsize=''
1209 uidtype=''
1210 archname64=''
1211 use64bitall=''
1212 use64bitint=''
1213 dtrace=''
1214 usedtrace=''
1215 usefaststdio=''
1216 ccflags_uselargefiles=''
1217 ldflags_uselargefiles=''
1218 libswanted_uselargefiles=''
1219 uselargefiles=''
1220 uselongdouble=''
1221 usemorebits=''
1222 usemultiplicity=''
1223 nm_opt=''
1224 nm_so_opt=''
1225 runnm=''
1226 usenm=''
1227 useperlio=''
1228 usesocks=''
1229 d_oldpthreads=''
1230 use5005threads=''
1231 useithreads=''
1232 usereentrant=''
1233 usethreads=''
1234 incpath=''
1235 mips_type=''
1236 usrinc=''
1237 vaproto=''
1238 d_vendorarch=''
1239 installvendorarch=''
1240 vendorarch=''
1241 vendorarchexp=''
1242 d_vendorbin=''
1243 installvendorbin=''
1244 vendorbin=''
1245 vendorbinexp=''
1246 installvendorhtml1dir=''
1247 vendorhtml1dir=''
1248 vendorhtml1direxp=''
1249 installvendorhtml3dir=''
1250 vendorhtml3dir=''
1251 vendorhtml3direxp=''
1252 d_vendorlib=''
1253 installvendorlib=''
1254 vendorlib=''
1255 vendorlib_stem=''
1256 vendorlibexp=''
1257 installvendorman1dir=''
1258 vendorman1dir=''
1259 vendorman1direxp=''
1260 installvendorman3dir=''
1261 vendorman3dir=''
1262 vendorman3direxp=''
1263 usevendorprefix=''
1264 vendorprefix=''
1265 vendorprefixexp=''
1266 d_vendorscript=''
1267 installvendorscript=''
1268 vendorscript=''
1269 vendorscriptexp=''
1270 versiononly=''
1271 defvoidused=''
1272 voidflags=''
1273 yacc=''
1274 yaccflags=''
1275 CONFIG=''
1276
1277 : Detect odd OSs
1278 define='define'
1279 undef='undef'
1280 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1281 rmlist=''
1282
1283 : We must find out about Eunice early
1284 eunicefix=':'
1285 if test -f /etc/unixtovms; then
1286         eunicefix=/etc/unixtovms
1287 fi
1288 if test -f /etc/unixtovms.exe; then
1289         eunicefix=/etc/unixtovms.exe
1290 fi
1291
1292 : Set executable suffix now -- needed before hints available
1293 if test -f "/libs/version.library"; then
1294 : Amiga OS
1295     _exe=""
1296 elif test -f "/system/gnu_library/bin/ar.pm"; then
1297 : Stratus VOS
1298     _exe=".pm"
1299 elif test -n "$DJGPP"; then
1300 : DOS DJGPP
1301     _exe=".exe"
1302 elif test -d c:/. -o -n "$is_os2" ; then
1303 : OS/2 or cygwin
1304     _exe=".exe"
1305 fi
1306
1307 groupstype=''
1308 i_whoami=''
1309 : Trailing extension.  Override this in a hint file, if needed.
1310 : Extra object files, if any, needed on this platform.
1311 archobjs=''
1312 archname=''
1313 libnames=''
1314 : change the next line if compiling for Xenix/286 on Xenix/386
1315 xlibpth='/usr/lib/386 /lib/386'
1316 : Possible local library directories to search.
1317 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1318 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1319
1320 : general looking path for locating libraries
1321 glibpth="/lib /usr/lib $xlibpth"
1322 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1323 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1324 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1325 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1326
1327 : Private path used by Configure to find libraries.  Its value
1328 : is prepended to libpth. This variable takes care of special
1329 : machines, like the mips.  Usually, it should be empty.
1330 plibpth=''
1331
1332 : default library list
1333 libswanted=''
1334 : some systems want to use only the non-versioned libso:s
1335 ignore_versioned_solibs=''
1336 : set usethreads on the Configure command line to enable threads.
1337 usereentrant='undef'
1338 : full support for void wanted by default
1339 defvoidused=15
1340
1341 : Possible local include directories to search.
1342 : Set locincpth to "" in a hint file to defeat local include searches.
1343 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1344 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1345 :
1346 : no include file wanted by default
1347 inclwanted=''
1348
1349 : Enable -DEBUGGING and -DDEBUGGING from the command line
1350 EBUGGING=''
1351 DEBUGGING=old
1352
1353 ccname=''
1354 ccversion=''
1355 perllibs=''
1356 : set useposix=false in your hint file to disable the POSIX extension.
1357 useposix=true
1358 : set useopcode=false in your hint file to disable the Opcode extension.
1359 useopcode=true
1360 archname64=''
1361 ccflags_uselargefiles=''
1362 ldflags_uselargefiles=''
1363 libswanted_uselargefiles=''
1364 : set usemultiplicity on the Configure command line to enable multiplicity.
1365 : set usesocks on the Configure command line to enable socks.
1366 : List of libraries we want.
1367 : If anyone needs extra -lxxx, put those in a hint file.
1368 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1369 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1370 : We probably want to search /usr/shlib before most other libraries.
1371 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1372 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1373 glibpth="/usr/shlib $glibpth"
1374 : Do not use vfork unless overridden by a hint file.
1375 usevfork=false
1376
1377 : Find the basic shell for Bourne shell scripts
1378 case "$sh" in
1379 '')
1380         case "$SYSTYPE" in
1381         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1382         *) xxx='/bin/sh';;
1383         esac
1384         if test -f "$xxx"; then
1385                 sh="$xxx"
1386         else
1387                 : Build up a list and do a single loop so we can 'break' out.
1388                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1389                 for xxx in sh bash ksh pdksh ash; do
1390                         for p in $pth; do
1391                                 try="$try ${p}/${xxx}"
1392                         done
1393                 done
1394                 for xxx in $try; do
1395                         if test -f "$xxx"; then
1396                                 sh="$xxx";
1397                                 break
1398                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1399                                 sh="$xxx";
1400                                 break
1401                         elif test -f "$xxx.exe"; then
1402                                 sh="$xxx";
1403                                 break
1404                         fi
1405                 done
1406         fi
1407         ;;
1408 esac
1409
1410 case "$sh" in
1411 '')     cat >&2 <<EOM
1412 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1413
1414 Usually it's in /bin/sh.  How did you even get this far?
1415 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1416 we'll try to straighten this all out.
1417 EOM
1418         exit 1
1419         ;;
1420 esac
1421
1422 : see if sh knows # comments
1423 if `$sh -c '#' >/dev/null 2>&1`; then
1424         shsharp=true
1425         spitshell=cat
1426         xcat=/bin/cat
1427         test -f $xcat$_exe || xcat=/usr/bin/cat
1428         if test ! -f $xcat$_exe; then
1429                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1430                         if test -f $p/cat$_exe; then
1431                                 xcat=$p/cat
1432                                 break
1433                         fi
1434                 done
1435                 if test ! -f $xcat$_exe; then
1436                         echo "Can't find cat anywhere!"
1437                         exit 1
1438                 fi
1439         fi
1440         echo "#!$xcat" >sharp
1441         $eunicefix sharp
1442         chmod +x sharp
1443         ./sharp > today 2>/dev/null
1444         if test -s today; then
1445                 sharpbang='#!'
1446         else
1447                 echo "#! $xcat" > sharp
1448                 $eunicefix sharp
1449                 chmod +x sharp
1450                 ./sharp > today 2>/dev/null
1451                 if test -s today; then
1452                         sharpbang='#! '
1453                 else
1454                         sharpbang=': use '
1455                 fi
1456         fi
1457 else
1458         echo " "
1459         echo "Your $sh doesn't grok # comments--I will strip them later on."
1460         shsharp=false
1461         cd ..
1462         echo "exec grep -v '^[  ]*#'" >spitshell
1463         chmod +x spitshell
1464         $eunicefix spitshell
1465         spitshell=`pwd`/spitshell
1466         cd UU
1467         echo "I presume that if # doesn't work, #! won't work either!"
1468         sharpbang=': use '
1469 fi
1470 rm -f sharp today
1471
1472 : figure out how to guarantee sh startup
1473 case "$startsh" in
1474 '') startsh=${sharpbang}${sh} ;;
1475 *)
1476 esac
1477 cat >sharp <<EOSS
1478 $startsh
1479 set abc
1480 test "$?abc" != 1
1481 EOSS
1482
1483 chmod +x sharp
1484 $eunicefix sharp
1485 if ./sharp; then
1486         : echo "Yup, it does."
1487 else
1488         echo "Hmm... '$startsh' does not guarantee sh startup..."
1489         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1490 fi
1491 rm -f sharp
1492
1493 : Save command line options in file UU/cmdline.opt for later use in
1494 : generating config.sh.
1495 cat > cmdline.opt <<EOSH
1496 : Configure command line arguments.
1497 config_arg0='$0'
1498 config_args='$*'
1499 config_argc=$#
1500 EOSH
1501 argn=1
1502 args_exp=''
1503 args_sep=''
1504 for arg in "$@"; do
1505         cat >>cmdline.opt <<EOSH
1506 config_arg$argn='$arg'
1507 EOSH
1508         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1509 $arg
1510 EOC
1511         arg_exp=`cat cmdl.opt`
1512         args_exp="$args_exp$args_sep'$arg_exp'"
1513         argn=`expr $argn + 1`
1514         args_sep=' '
1515 done
1516 rm -f cmdl.opt
1517
1518 : produce awk script to parse command line options
1519 cat >options.awk <<'EOF'
1520 BEGIN {
1521         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1522
1523         len = length(optstr);
1524         for (i = 1; i <= len; i++) {
1525                 c = substr(optstr, i, 1);
1526                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1527                 if (a == ":") {
1528                         arg[c] = 1;
1529                         i++;
1530                 }
1531                 opt[c] = 1;
1532         }
1533 }
1534 {
1535         expect = 0;
1536         str = $0;
1537         if (substr(str, 1, 1) != "-") {
1538                 printf("'%s'\n", str);
1539                 next;
1540         }
1541         len = length($0);
1542         for (i = 2; i <= len; i++) {
1543                 c = substr(str, i, 1);
1544                 if (!opt[c]) {
1545                         printf("-%s\n", substr(str, i));
1546                         next;
1547                 }
1548                 printf("-%s\n", c);
1549                 if (arg[c]) {
1550                         if (i < len)
1551                                 printf("'%s'\n", substr(str, i + 1));
1552                         else
1553                                 expect = 1;
1554                         next;
1555                 }
1556         }
1557 }
1558 END {
1559         if (expect)
1560                 print "?";
1561 }
1562 EOF
1563
1564 : process the command line options
1565 set X `for arg in "$@"; do echo "X$arg"; done |
1566         sed -e s/X// | awk -f options.awk`
1567 eval "set $*"
1568 shift
1569 rm -f options.awk
1570
1571 : set up default values
1572 fastread=''
1573 reuseval=false
1574 config_sh=''
1575 alldone=''
1576 error=''
1577 silent=''
1578 extractsh=''
1579 override=''
1580 knowitall=''
1581 rm -f optdef.sh posthint.sh
1582 cat >optdef.sh <<EOS
1583 $startsh
1584 EOS
1585
1586
1587 : option parsing
1588 while test $# -gt 0; do
1589         case "$1" in
1590         -d) shift; fastread=yes;;
1591         -e) shift; alldone=cont;;
1592         -f)
1593                 shift
1594                 cd ..
1595                 if test -r "$1"; then
1596                         config_sh="$1"
1597                 else
1598                         echo "$me: cannot read config file $1." >&2
1599                         error=true
1600                 fi
1601                 cd UU
1602                 shift;;
1603         --help|\
1604         -h) shift; error=true;;
1605         -r) shift; reuseval=true;;
1606         -s) shift; silent=true; realsilent=true;;
1607         -E) shift; alldone=exit;;
1608         -K) shift; knowitall=true;;
1609         -O) shift; override=true;;
1610         -S) shift; silent=true; extractsh=true;;
1611         -D)
1612                 shift
1613                 case "$1" in
1614                 *=)
1615                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1616                         echo "$me: ignoring -D $1" >&2
1617                         ;;
1618                 *=*) echo "$1" | \
1619                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1620                 *) echo "$1='define'" >> optdef.sh;;
1621                 esac
1622                 shift
1623                 ;;
1624         -U)
1625                 shift
1626                 case "$1" in
1627                 *=) echo "$1" >> optdef.sh;;
1628                 *=*)
1629                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1630                         echo "$me: ignoring -U $1" >&2
1631                         ;;
1632                 *) echo "$1='undef'" >> optdef.sh;;
1633                 esac
1634                 shift
1635                 ;;
1636         -A)
1637             shift
1638             xxx=''
1639             yyy="$1"
1640             zzz=''
1641             uuu=undef
1642             case "$yyy" in
1643             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1644                  case "$zzz" in
1645                  *:*) zzz='' ;;
1646                  *)   xxx=append
1647                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1648                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1649                  esac
1650                  ;;
1651             esac
1652             case "$xxx" in
1653             '')  case "$yyy" in
1654                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1655                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1656                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1657                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1658                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1659                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1660                  esac
1661                  ;;
1662             esac
1663             case "$xxx" in
1664             append)
1665                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1666             clear)
1667                 echo "$yyy=''"                  >> posthint.sh ;;
1668             define)
1669                 case "$zzz" in
1670                 '') zzz=define ;;
1671                 esac
1672                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1673             eval)
1674                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1675             prepend)
1676                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1677             undef)
1678                 case "$zzz" in
1679                 '') zzz="$uuu" ;;
1680                 esac
1681                 echo "$yyy=$zzz"                >> posthint.sh ;;
1682             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1683             esac
1684             shift
1685             ;;
1686         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1687             exit 0;;
1688         --) break;;
1689         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1690         *) break;;
1691         esac
1692 done
1693
1694 case "$error" in
1695 true)
1696         cat >&2 <<EOM
1697 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1698                  [-U symbol] [-U symbol=] [-A command:symbol...]
1699   -d : use defaults for all answers.
1700   -e : go on without questioning past the production of config.sh.
1701   -f : specify an alternate default configuration file.
1702   -h : print this help message and exit (with an error status).
1703   -r : reuse C symbols value if possible (skips costly nm extraction).
1704   -s : silent mode, only echoes questions and essential information.
1705   -D : define symbol to have some value:
1706          -D symbol         symbol gets the value 'define'
1707          -D symbol=value   symbol gets the value 'value'
1708        common used examples (see INSTALL for more info):
1709          -Duse64bitint            use 64bit integers
1710          -Duse64bitall            use 64bit integers and pointers
1711          -Dusethreads             use thread support
1712          -Dinc_version_list=none  do not include older perl trees in @INC
1713          -DEBUGGING=none          DEBUGGING options
1714          -Dcc=gcc                 choose your compiler
1715          -Dprefix=/opt/perl5      choose your destination
1716   -E : stop at the end of questions, after having produced config.sh.
1717   -K : do not use unless you know what you are doing.
1718   -O : let -D and -U override definitions from loaded configuration file.
1719   -S : perform variable substitutions on all .SH files (can mix with -f)
1720   -U : undefine symbol:
1721          -U symbol    symbol gets the value 'undef'
1722          -U symbol=   symbol gets completely empty
1723        e.g.:  -Uversiononly
1724   -A : manipulate symbol after the platform specific hints have been applied:
1725          -A append:symbol=value   append value to symbol
1726          -A symbol=value          like append:, but with a separating space
1727          -A define:symbol=value   define symbol to have value
1728          -A clear:symbol          define symbol to be ''
1729          -A define:symbol         define symbol to be 'define'
1730          -A eval:symbol=value     define symbol to be eval of value
1731          -A prepend:symbol=value  prepend value to symbol
1732          -A undef:symbol          define symbol to be 'undef'
1733          -A undef:symbol=         define symbol to be ''
1734        e.g.:  -A prepend:libswanted='cl pthread '
1735               -A ccflags=-DSOME_MACRO
1736   -V : print version number and exit (with a zero status).
1737 EOM
1738         exit 1
1739         ;;
1740 esac
1741
1742 : Sanity checks
1743 case "$fastread$alldone" in
1744 yescont|yesexit) ;;
1745 *)
1746         case "$extractsh" in
1747         true) ;;
1748         *)
1749                 if test ! -t 0; then
1750                         echo "Say 'sh Configure', not 'sh <Configure'"
1751                         exit 1
1752                 fi
1753                 ;;
1754         esac
1755         ;;
1756 esac
1757
1758 exec 4>&1
1759 case "$silent" in
1760 true) exec 1>/dev/null;;
1761 esac
1762
1763 : run the defines and the undefines, if any, but leave the file out there...
1764 touch optdef.sh
1765 . ./optdef.sh
1766 : create the posthint manipulation script and leave the file out there...
1767 touch posthint.sh
1768
1769 : set package name
1770 package='perl5'
1771 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1772 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1773 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1774 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1775 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1776 esac
1777
1778 : Some greps do not return status, grrr.
1779 echo "grimblepritz" >grimble
1780 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1781         contains=contains
1782 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1783         contains=grep
1784 else
1785         contains=contains
1786 fi
1787 rm -f grimble
1788 : the following should work in any shell
1789 case "$contains" in
1790 contains*)
1791         echo " "
1792         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1793         cat >contains <<'EOSS'
1794 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1795 EOSS
1796 chmod +x contains
1797 esac
1798
1799 : Find the path to the source tree
1800 case "$src" in
1801 '') case "$0" in
1802     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1803          case "$src" in
1804          /*)    ;;
1805          .)     ;;
1806          *)     src=`cd ../$src && pwd` ;;
1807          esac
1808          ;;
1809     *)   src='.';;
1810     esac;;
1811 esac
1812 case "$src" in
1813 '')     src=/
1814         rsrc=/
1815         ;;
1816 /*)     rsrc="$src";;
1817 *)      rsrc="../$src";;
1818 esac
1819 if test -f $rsrc/Configure && \
1820         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1821 then
1822    : found it, so we are ok.
1823 else
1824         rsrc=''
1825         for src in . .. ../.. ../../.. ../../../..; do
1826                 if test -f ../$src/Configure && \
1827                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1828                 then
1829                         rsrc=../$src
1830                         break
1831                 fi
1832         done
1833 fi
1834 case "$rsrc" in
1835 '')
1836         cat <<EOM >&4
1837
1838 Sorry, I can't seem to locate the source dir for $package.  Please start
1839 Configure with an explicit path -- i.e. /some/path/Configure.
1840
1841 EOM
1842         exit 1
1843         ;;
1844 ../.)   rsrc='..';;
1845 *)
1846         echo " "
1847         echo "Sources for $package found in \"$src\"." >&4
1848         ;;
1849 esac
1850
1851 : script used to extract .SH files with variable substitutions
1852 cat >extract <<'EOS'
1853 PERL_CONFIG_SH=true
1854 echo "Doing variable substitutions on .SH files..."
1855 if test -f MANIFEST; then
1856         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1857 else
1858         echo "(Looking for .SH files under the source directory.)"
1859         set x `(cd "$src"; find . -name "*.SH" -print)`
1860 fi
1861 shift
1862 case $# in
1863 0) set x `(cd "$src"; echo *.SH)`; shift;;
1864 esac
1865 if test ! -f "$src/$1"; then
1866         shift
1867 fi
1868 mkdir_p='
1869 name=$1;
1870 create="";
1871 while test $name; do
1872         if test ! -d "$name"; then
1873                 create="$name $create";
1874                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1875                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1876         else
1877                 name="";
1878         fi;
1879 done;
1880 for file in $create; do
1881         mkdir $file;
1882 done
1883 '
1884 for file in $*; do
1885         case "$src" in
1886         ".")
1887                 case "$file" in
1888                 */*)
1889                         dir=`expr X$file : 'X\(.*\)/'`
1890                         file=`expr X$file : 'X.*/\(.*\)'`
1891                         (cd "$dir" && . ./$file)
1892                         ;;
1893                 *)
1894                         . ./$file
1895                         ;;
1896                 esac
1897                 ;;
1898         *)
1899                 case "$file" in
1900                 */*)
1901                         dir=`expr X$file : 'X\(.*\)/'`
1902                         file=`expr X$file : 'X.*/\(.*\)'`
1903                         (set x $dir; shift; eval $mkdir_p)
1904                         sh <"$src/$dir/$file"
1905                         ;;
1906                 *)
1907                         sh <"$src/$file"
1908                         ;;
1909                 esac
1910                 ;;
1911         esac
1912 done
1913 if test -f "$src/config_h.SH"; then
1914         if test ! -f config.h; then
1915         : oops, they left it out of MANIFEST, probably, so do it anyway.
1916         . "$src/config_h.SH"
1917         fi
1918 fi
1919 EOS
1920
1921 : extract files and exit if asked to do so
1922 case "$extractsh" in
1923 true)
1924         case "$realsilent" in
1925         true) ;;
1926         *) exec 1>&4;;
1927         esac
1928         case "$config_sh" in
1929         '') config_sh='config.sh';;
1930         esac
1931         echo " "
1932         echo "Fetching answers from $config_sh..."
1933         cd ..
1934         . $config_sh
1935         test "$override" && . ./optdef.sh
1936         echo " "
1937         . UU/extract
1938         rm -rf UU
1939         echo "Extraction done."
1940         exit 0
1941         ;;
1942 esac
1943
1944 : Eunice requires " " instead of "", can you believe it
1945 echo " "
1946 : Here we go...
1947 echo "Beginning of configuration questions for $package."
1948
1949 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1950
1951 : first determine how to suppress newline on echo command
1952 echo " "
1953 echo "Checking echo to see how to suppress newlines..."
1954 (echo "hi there\c" ; echo " ") >.echotmp
1955 if $contains c .echotmp >/dev/null 2>&1 ; then
1956         echo "...using -n."
1957         n='-n'
1958         c=''
1959 else
1960         cat <<'EOM'
1961 ...using \c
1962 EOM
1963         n=''
1964         c='\c'
1965 fi
1966 echo $n "The star should be here-->$c"
1967 echo '*'
1968 rm -f .echotmp
1969
1970 : Now test for existence of everything in MANIFEST
1971 echo " "
1972 if test -f "$rsrc/MANIFEST"; then
1973         echo "First let's make sure your kit is complete.  Checking..." >&4
1974         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1975                 (split -l 50 2>/dev/null || split -50)
1976         rm -f missing
1977         tmppwd=`pwd`
1978         for filelist in x??; do
1979                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1980                         >/dev/null 2>>"$tmppwd/missing")
1981         done
1982         if test -s missing; then
1983                 cat missing >&4
1984                 cat >&4 <<'EOM'
1985
1986 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1987
1988 You have the option of continuing the configuration process, despite the
1989 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1990 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1991 and contact the author (perlbug@perl.org).
1992
1993 EOM
1994                 echo $n "Continue? [n] $c" >&4
1995                 read ans
1996                 case "$ans" in
1997                 y*)
1998                         echo "Continuing..." >&4
1999                         rm -f missing
2000                         ;;
2001                 *)
2002                         echo "ABORTING..." >&4
2003                         kill $$
2004                         ;;
2005                 esac
2006         else
2007                 echo "Looks good..."
2008         fi
2009 else
2010         echo "There is no MANIFEST file.  I hope your kit is complete !"
2011 fi
2012 rm -f missing x??
2013
2014 : Find the appropriate value for a newline for tr
2015 echo " "
2016 if test -n "$DJGPP"; then
2017        trnl='\012'
2018 fi
2019 if test X"$trnl" = X; then
2020         case "`echo foo|tr '\n' x 2>/dev/null`" in
2021         foox) trnl='\n' ;;
2022         esac
2023 fi
2024 if test X"$trnl" = X; then
2025         case "`echo foo|tr '\012' x 2>/dev/null`" in
2026         foox) trnl='\012' ;;
2027         esac
2028 fi
2029 if test X"$trnl" = X; then
2030        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2031        fooxy) trnl='\n\r' ;;
2032        esac
2033 fi
2034 if test X"$trnl" = X; then
2035         cat <<EOM >&2
2036
2037 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2038
2039 EOM
2040         exit 1
2041 fi
2042
2043 : compute the number of columns on the terminal for proper question formatting
2044 case "$COLUMNS" in
2045 '') COLUMNS='80';;
2046 esac
2047
2048 : set up the echo used in my read
2049 myecho="case \"\$xxxm\" in
2050 '') echo $n \"\$rp $c\" >&4;;
2051 *) case \"\$rp\" in
2052         '') echo $n \"[\$xxxm] $c\";;
2053         *)
2054                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2055                         echo \"\$rp\" >&4
2056                         echo $n \"[\$xxxm] $c\" >&4
2057                 else
2058                         echo $n \"\$rp [\$xxxm] $c\" >&4
2059                 fi
2060                 ;;
2061         esac;;
2062 esac"
2063
2064 : now set up to do reads with possible shell escape and default assignment
2065 cat <<EOSC >myread
2066 $startsh
2067 xxxm=\$dflt
2068 $myecho
2069 ans='!'
2070 case "\$fastread" in
2071 yes) case "\$dflt" in
2072         '') ;;
2073         *) ans='';
2074                 case "\$silent-\$rp" in
2075                 true-) ;;
2076                 *) echo " " >&4;;
2077                 esac;;
2078         esac;;
2079 *) case "\$silent" in
2080         true) case "\$rp" in
2081                 '') ans='';;
2082                 esac;;
2083         esac;;
2084 esac
2085 while expr "X\$ans" : "X!" >/dev/null; do
2086         read answ
2087         set x \$xxxm
2088         shift
2089         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2090         case  "\$answ" in
2091         "!")
2092                 sh 1>&4
2093                 echo " "
2094                 $myecho
2095                 ;;
2096         !*)
2097                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2098                 shift
2099                 sh 1>&4 -c "\$*"
2100                 echo " "
2101                 $myecho
2102                 ;;
2103         "\$ans")
2104                 case "\$ans" in
2105                 \\&*)
2106                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2107                         shift
2108                         case "\$1" in
2109                         -d)
2110                                 fastread=yes
2111                                 echo "(OK, I'll run with -d after this question.)" >&4
2112                                 ;;
2113                         -*)
2114                                 echo "*** Sorry, \$1 not supported yet." >&4
2115                                 ;;
2116                         esac
2117                         $myecho
2118                         ans=!
2119                         ;;
2120                 esac;;
2121         *)
2122                 case "\$aok" in
2123                 y)
2124                         echo "*** Substitution done -- please confirm."
2125                         xxxm="\$ans"
2126                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2127                         xxxm="\$ans"
2128                         ans=!
2129                         ;;
2130                 *)
2131                         echo "*** Error -- try again."
2132                         ans=!
2133                         ;;
2134                 esac
2135                 $myecho
2136                 ;;
2137         esac
2138         case "\$ans\$xxxm\$nostick" in
2139         '')
2140                 ans=!
2141                 $myecho
2142                 ;;
2143         esac
2144 done
2145 case "\$ans" in
2146 '') ans="\$xxxm";;
2147 esac
2148 EOSC
2149
2150 : create .config dir to save info across Configure sessions
2151 test -d ../.config || mkdir ../.config
2152 cat >../.config/README <<EOF
2153 This directory created by Configure to save information that should
2154 persist across sessions for $package.
2155
2156 You may safely delete it if you wish.
2157 EOF
2158
2159 : See if we are using a devel version and want that
2160 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2161 case "$usedevel" in
2162 $define|true|[yY]*)
2163     usedevel="$define" ;;
2164 *) case "$xversion" in
2165    *[13579])
2166         cat >&4 <<EOH
2167 *** WHOA THERE!!! ***
2168
2169     This is an UNSTABLE DEVELOPMENT release.
2170     The version of this $package distribution is $xversion, that is, odd,
2171     (as opposed to even) and that signifies a development release.
2172     If you want a maintenance release, you want an even-numbered version.
2173
2174     Do ***NOT*** install this into production use.
2175     Data corruption and crashes are possible.
2176
2177     It is most seriously suggested that you do not continue any further
2178     unless you want to help in developing and debugging Perl.
2179
2180     If you *still* want to build perl, you can answer 'y' now,
2181     or pass -Dusedevel to Configure.
2182
2183 EOH
2184         rp='Do you really want to continue?'
2185         dflt='n'
2186         . ./myread
2187         case "$ans" in
2188         [yY]) echo >&4 "Okay, continuing."
2189               usedevel="$define" ;;
2190         *) echo >&4 "Okay, bye."
2191            exit 1
2192            ;;
2193         esac
2194         ;;
2195     esac
2196     usedevel="$undef"
2197     ;;
2198 esac
2199 case "$usedevel" in
2200 $define|true|[yY]*)
2201         case "$versiononly" in
2202         '') versiononly="$define" ;;
2203         esac
2204         case "$installusrbinperl" in
2205         '') installusrbinperl="$undef" ;;
2206         esac
2207         ;;
2208 esac
2209
2210 : general instructions
2211 needman=true
2212 firsttime=true
2213 user=`(logname) 2>/dev/null`
2214 case "$user" in
2215 '') user=`whoami 2>&1`;;
2216 esac
2217 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2218         firsttime=false
2219         echo " "
2220         rp='Would you like to see the instructions?'
2221         dflt=n
2222         . ./myread
2223         case "$ans" in
2224         [yY]*) ;;
2225         *) needman=false;;
2226         esac
2227 fi
2228 if $needman; then
2229         cat <<EOH
2230
2231 This installation shell script will examine your system and ask you questions
2232 to determine how the perl5 package should be installed. If you get
2233 stuck on a question, you may use a ! shell escape to start a subshell or
2234 execute a command.  Many of the questions will have default answers in square
2235 brackets; typing carriage return will give you the default.
2236
2237 On some of the questions which ask for file or directory names you are allowed
2238 to use the ~name construct to specify the login directory belonging to "name",
2239 even if you don't have a shell which knows about that.  Questions where this is
2240 allowed will be marked "(~name ok)".
2241
2242 EOH
2243         rp=''
2244         dflt='Type carriage return to continue'
2245         . ./myread
2246         cat <<'EOH'
2247
2248 The prompter used in this script allows you to use shell variables and
2249 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2250 in the default answer, as if the default line was a set of arguments given to a
2251 script shell.  This means you may also use $* to repeat the whole default line,
2252 so you do not have to re-type everything to add something to the default.
2253
2254 Everytime there is a substitution, you will have to confirm.  If there is an
2255 error (e.g. an unmatched backtick), the default answer will remain unchanged
2256 and you will be prompted again.
2257
2258 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2259 the questions and use the computed defaults (or the previous answers if there
2260 was already a config.sh file). Type 'Configure -h' for a list of options.
2261 You may also start interactively and then answer '& -d' at any prompt to turn
2262 on the non-interactive behaviour for the remainder of the execution.
2263
2264 EOH
2265         . ./myread
2266         cat <<EOH
2267
2268 Much effort has been expended to ensure that this shell script will run on any
2269 Unix system.  If despite that it blows up on yours, your best bet is to edit
2270 Configure and run it again.  If you can't run Configure for some reason,
2271 you'll have to generate a config.sh file by hand.  Whatever problems you
2272 have, let me (perlbug@perl.org) know how I blew it.
2273
2274 This installation script affects things in two ways:
2275
2276 1) it may do direct variable substitutions on some of the files included
2277    in this kit.
2278 2) it builds a config.h file for inclusion in C programs.  You may edit
2279    any of these files as the need arises after running this script.
2280
2281 If you make a mistake on a question, there is no easy way to back up to it
2282 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2283 files.  Configure will offer to let you do this before it runs the SH files.
2284
2285 EOH
2286         dflt='Type carriage return to continue'
2287         . ./myread
2288         case "$firsttime" in
2289         true) echo $user >>../.config/instruct;;
2290         esac
2291 fi
2292
2293 : find out where common programs are
2294 echo " "
2295 echo "Locating common programs..." >&4
2296 cat <<EOSC >loc
2297 $startsh
2298 case \$# in
2299 0) exit 1;;
2300 esac
2301 thing=\$1
2302 shift
2303 dflt=\$1
2304 shift
2305 for dir in \$*; do
2306         case "\$thing" in
2307         .)
2308         if test -d \$dir/\$thing; then
2309                 echo \$dir
2310                 exit 0
2311         fi
2312         ;;
2313         *)
2314         for thisthing in \$dir/\$thing; do
2315                 : just loop through to pick last item
2316         done
2317         if test -f \$thisthing; then
2318                 echo \$thisthing
2319                 exit 0
2320         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2321                 echo \$thisthing
2322                 exit 0
2323         elif test -f \$dir/\$thing.exe; then
2324                 if test -n "$DJGPP"; then
2325                         echo \$dir/\$thing.exe
2326                 elif test "$eunicefix" != ":"; then
2327                         : on Eunice apparently
2328                         echo \$dir/\$thing
2329                 fi
2330                 exit 0
2331         fi
2332         ;;
2333         esac
2334 done
2335 echo \$dflt
2336 exit 1
2337 EOSC
2338 chmod +x loc
2339 $eunicefix loc
2340 loclist="
2341 awk
2342 cat
2343 chmod
2344 comm
2345 cp
2346 echo
2347 expr
2348 grep
2349 ls
2350 mkdir
2351 rm
2352 sed
2353 sort
2354 touch
2355 tr
2356 uniq
2357 "
2358 trylist="
2359 ar
2360 bison
2361 byacc
2362 cpp
2363 csh
2364 date
2365 egrep
2366 gmake
2367 gzip
2368 less
2369 ln
2370 make
2371 more
2372 nm
2373 nroff
2374 pg
2375 test
2376 uname
2377 zip
2378 "
2379 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2380 pth="$pth /lib /usr/lib"
2381 for file in $loclist; do
2382         eval xxx=\$$file
2383         case "$xxx" in
2384         /*|?:[\\/]*)
2385                 if test -f "$xxx"; then
2386                         : ok
2387                 else
2388                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2389                         xxx=`./loc $file $file $pth`
2390                 fi
2391                 ;;
2392         '') xxx=`./loc $file $file $pth`;;
2393         *) xxx=`./loc $xxx $xxx $pth`;;
2394         esac
2395         eval $file=$xxx$_exe
2396         eval _$file=$xxx
2397         case "$xxx" in
2398         /*)
2399                 echo $file is in $xxx.
2400                 ;;
2401         ?:[\\/]*)
2402                 echo $file is in $xxx.
2403                 ;;
2404         *)
2405                 echo "I don't know where '$file' is, and my life depends on it." >&4
2406                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2407                 exit 1
2408                 ;;
2409         esac
2410 done
2411 echo " "
2412 echo "Don't worry if any of the following aren't found..."
2413 say=offhand
2414 for file in $trylist; do
2415         eval xxx=\$$file
2416         case "$xxx" in
2417         /*|?:[\\/]*)
2418                 if test -f "$xxx"; then
2419                         : ok
2420                 else
2421                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2422                         xxx=`./loc $file $file $pth`
2423                 fi
2424                 ;;
2425         '') xxx=`./loc $file $file $pth`;;
2426         *) xxx=`./loc $xxx $xxx $pth`;;
2427         esac
2428         eval $file=$xxx$_exe
2429         eval _$file=$xxx
2430         case "$xxx" in
2431         /*)
2432                 echo $file is in $xxx.
2433                 ;;
2434         ?:[\\/]*)
2435                 echo $file is in $xxx.
2436                 ;;
2437         *)
2438                 echo "I don't see $file out there, $say."
2439                 say=either
2440                 ;;
2441         esac
2442 done
2443 case "$egrep" in
2444 egrep)
2445         echo "Substituting grep for egrep."
2446         egrep=$grep
2447         _egrep=$grep
2448         ;;
2449 esac
2450 case "$less" in
2451 '')     ;;
2452 *)      if $less -R </dev/null >/dev/null; then
2453                echo "Substituting less -R for less."
2454                less="$less -R"
2455                _less=$less
2456         fi
2457         ;;
2458 esac
2459 case "$ln" in
2460 ln)
2461         echo "Substituting cp for ln."
2462         ln=$cp
2463         _ln=$cp
2464         ;;
2465 esac
2466 case "$make" in
2467 make)
2468         case "$gmake" in
2469         gmake)
2470         echo "I can't find make or gmake, and my life depends on it." >&4
2471         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2472         exit 1
2473         ;;
2474         esac
2475         ;;
2476 esac
2477 case "$gmake" in
2478 gmake)  ;;
2479 *)      # We can't have osname yet.
2480         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2481                 # Assume that gmake, if found, is definitely GNU make
2482                 # and prefer it over the system make.
2483                 echo "Substituting gmake for make."
2484                 make=$gmake
2485                 _make=$gmake
2486         fi
2487         ;;
2488 esac
2489 case "$test" in
2490 test)
2491         echo "Hopefully test is built into your sh."
2492         ;;
2493 *)
2494         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2495                 echo "Using the test built into your sh."
2496                 test=test
2497                 _test=test
2498         fi
2499         ;;
2500 esac
2501 case "$echo" in
2502 echo)
2503         echo "Hopefully echo is built into your sh."
2504         ;;
2505 '') ;;
2506 *)
2507         echo " "
2508 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2509         $echo $n "hi there$c" >foo1
2510         echo $n "hi there$c" >foo2
2511         if cmp foo1 foo2 >/dev/null 2>&1; then
2512                 echo "They are compatible.  In fact, they may be identical."
2513         else
2514                 case "$n" in
2515                 '-n') n='' c='\c';;
2516                 *) n='-n' c='';;
2517                 esac
2518                 cat <<FOO
2519 They are not compatible!  You are probably running ksh on a non-USG system.
2520 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2521 have echo built in and we may have to run some Bourne shell scripts.  That
2522 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2523
2524 FOO
2525                 $echo $n "The star should be here-->$c"
2526                 $echo "*"
2527         fi
2528         $rm -f foo1 foo2
2529         ;;
2530 esac
2531
2532 # This question was auctioned at YAPC::Europe-2007 in Vienna
2533 # I never promised you could answer it. I only auctioned the question.
2534 cat <<FOO
2535 The following message is sponsored by
2536
2537   Dresden.pm<--The stars should be here.
2538
2539 Dear Perl user, system administrator or package
2540 maintainer, the Perl community sends greetings to
2541 you. Do you (emblematical) greet back [Y/n]? n
2542
2543 FOO
2544
2545 : Check what type of C compiler we use
2546 cat <<EOS >trygcc
2547 $startsh
2548 EOS
2549 cat <<'EOSC' >>trygcc
2550 case "$cc" in
2551 '') ;;
2552 *)  $rm -f try try.*
2553     $cat >try.c <<EOM
2554 int main(int argc, char *argv[]) {
2555   return 0;
2556 }
2557 EOM
2558     if $cc -o try $ccflags $ldflags try.c; then
2559        :
2560     else
2561         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2562         despair=yes
2563         trygcc=yes
2564         case "$cc" in
2565         *gcc*) trygcc=no ;;
2566         esac
2567         # Skip this test because it gives a false match on output like:
2568         #    ./trygcc: line 23: cc: command not found
2569         # case "`$cc -v -c try.c 2>&1`" in
2570         # *gcc*) trygcc=no ;;
2571         # esac
2572         if $test X"$trygcc" = Xyes; then
2573             if gcc -o try -c try.c; then
2574                 echo " "
2575                 echo "You seem to have a working gcc, though." >&4
2576                 # Switching compilers may undo the work of hints files.
2577                 # The most common problem is -D_REENTRANT for threads.
2578                 # This heuristic catches that case, but gets false positives
2579                 # if -Dusethreads was not actually specified.  Better to
2580                 # bail out here with a useful message than fail 
2581                 # mysteriously later. Should we perhaps just try to
2582                 # re-invoke Configure -Dcc=gcc config_args ?
2583                 if $test -f usethreads.cbu; then
2584                         $cat >&4 <<EOM 
2585
2586 *** However, any setting of the C compiler flags (e.g. for thread support)
2587 *** will be lost.  It may be necessary for you to restart Configure and
2588 *** add -Dcc=gcc to your Configure command line.
2589
2590 EOM
2591                         rp="Would you like to go ahead and try gcc anyway?"
2592                         dflt=n
2593                 else
2594                         rp="Would you like to use it?"
2595                         dflt=y
2596                 fi
2597                 if $test -f myread; then
2598                     . ./myread
2599                 else
2600                     if $test -f UU/myread; then
2601                         . ./UU/myread
2602                     else
2603                         echo "Cannot find myread, sorry.  Aborting." >&2
2604                         exit 1
2605                     fi
2606                 fi  
2607                 case "$ans" in
2608                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2609                 esac
2610             fi
2611         fi
2612     fi
2613     $rm -f try try.*
2614     ;;
2615 esac
2616 EOSC
2617
2618 cat <<EOS >checkcc
2619 $startsh
2620 EOS
2621 cat <<'EOSC' >>checkcc
2622 case "$cc" in        
2623 '') ;;
2624 *)  $rm -f try try.*              
2625     $cat >try.c <<EOM
2626 int main(int argc, char *argv[]) {
2627   return 0;
2628 }
2629 EOM
2630     if $cc -o try $ccflags $ldflags try.c; then
2631        :
2632     else
2633         if $test X"$despair" = Xyes; then
2634            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2635         fi
2636         $cat >&4 <<EOM         
2637 You need to find a working C compiler.
2638 Either (purchase and) install the C compiler supplied by your OS vendor,
2639 or for a free C compiler try http://gcc.gnu.org/
2640 I cannot continue any further, aborting.
2641 EOM
2642         exit 1
2643     fi
2644     $rm -f try try.*
2645     ;;
2646 esac
2647 EOSC
2648
2649 : determine whether symbolic links are supported
2650 echo " "
2651 $touch blurfl
2652 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2653         echo "Symbolic links are supported." >&4
2654         lns="$ln -s"
2655 else
2656         echo "Symbolic links are NOT supported." >&4
2657         lns="$ln"
2658 fi
2659 $rm -f blurfl sym
2660
2661 : determine whether symbolic links are supported
2662 echo " "
2663 case "$lns" in
2664 *"ln"*" -s")
2665         echo "Checking how to test for symbolic links..." >&4
2666         $lns blurfl sym
2667         if $test "X$issymlink" = X; then
2668                 case "$newsh" in
2669                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2670                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2671                 esac
2672                 if test $? = 0; then
2673                         issymlink="test -h"
2674                 else
2675                         echo "Your builtin 'test -h' may be broken." >&4
2676                         case "$test" in
2677                         /*)     ;;
2678                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2679                                 for p in $pth
2680                                 do
2681                                         if test -f "$p/$test"; then
2682                                                 test="$p/$test"
2683                                                 break
2684                                         fi
2685                                 done
2686                                 ;;
2687                         esac
2688                         case "$test" in
2689                         /*)
2690                                 echo "Trying external '$test -h'." >&4
2691                                 issymlink="$test -h"
2692                                 if $test ! -h sym >/dev/null 2>&1; then
2693                                         echo "External '$test -h' is broken, too." >&4
2694                                         issymlink=''
2695                                 fi
2696                                 ;;
2697                         *)      issymlink='' ;;
2698                         esac
2699                 fi              
2700         fi
2701         if $test "X$issymlink" = X; then
2702                 if $test -L sym 2>/dev/null; then
2703                         issymlink="$test -L"
2704                         echo "The builtin '$test -L' worked." >&4
2705                 fi
2706         fi
2707         if $test "X$issymlink" != X; then
2708                 echo "You can test for symbolic links with '$issymlink'." >&4
2709         else
2710                 echo "I do not know how you can test for symbolic links." >&4
2711         fi
2712         $rm -f blurfl sym
2713         ;;
2714 *)      echo "No symbolic links, so not testing for their testing..." >&4
2715         ;;
2716 esac
2717 echo " "
2718
2719 : Make symlinks util
2720 case "$mksymlinks" in
2721 $define|true|[yY]*)
2722         case "$src" in
2723         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2724                 exit 1
2725                 ;;
2726         *)      case "$lns:$issymlink" in
2727                 *"ln"*" -s:"*"test -"?)
2728                         echo "Creating the symbolic links..." >&4
2729                         echo "(First creating the subdirectories...)" >&4
2730                         cd ..
2731                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2732                                 read directory
2733                                 test -z "$directory" && break
2734                                 mkdir -p $directory
2735                         done
2736                         # Sanity check 1.
2737                         if test ! -d t/base; then
2738                                 echo "Failed to create the subdirectories.  Aborting." >&4
2739                                 exit 1
2740                         fi
2741                         echo "(Then creating the symlinks...)" >&4
2742                         awk '{print $1}' $src/MANIFEST | while true; do
2743                                 read filename
2744                                 test -z "$filename" && break
2745                                 if test -f $filename; then
2746                                         if $issymlink $filename; then
2747                                                 rm -f $filename
2748                                         fi
2749                                 fi
2750                                 if test -f $filename; then
2751                                         echo "$filename already exists, not symlinking."
2752                                 else
2753                                         ln -s $src/$filename $filename
2754                                 fi
2755                         done
2756                         # Sanity check 2.
2757                         if test ! -f t/base/lex.t; then
2758                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2759                                 exit 1
2760                         fi
2761                         cd UU
2762                         ;;
2763                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2764                         ;;
2765                 esac
2766                 ;;
2767         esac
2768         ;;
2769 esac
2770
2771 : Check for Cross-Compilation
2772 case "$usecrosscompile" in
2773 $define|true|[yY]*)
2774         $echo "Cross-compiling..."
2775         croak=''
2776         case "$cc" in
2777         *-*-gcc) # A cross-compiling gcc, probably.
2778             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2779             ar=$targetarch-ar
2780             # leave out ld, choosing it is more complex
2781             nm=$targetarch-nm
2782             ranlib=$targetarch-ranlib
2783             $echo 'extern int foo;' > try.c
2784             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2785             shift
2786             if $test $# -gt 0; then
2787                 incpth="$incpth $*"
2788                 incpth="`$echo $incpth|$sed 's/^ //'`"
2789                 echo "Guessing incpth '$incpth'." >&4
2790                 for i in $*; do
2791                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2792                     if $test -d $j; then
2793                         libpth="$libpth $j"
2794                     fi
2795                 done   
2796                 libpth="`$echo $libpth|$sed 's/^ //'`"
2797                 echo "Guessing libpth '$libpth'." >&4
2798             fi
2799             $rm -f try.c
2800             ;;
2801         esac
2802         case "$targetarch" in
2803         '') echo "Targetarch not defined." >&4; croak=y ;;
2804         *)  echo "Using targetarch $targetarch." >&4 ;;
2805         esac
2806         case "$incpth" in
2807         '') echo "Incpth not defined." >&4; croak=y ;;
2808         *)  echo "Using incpth '$incpth'." >&4 ;;
2809         esac
2810         case "$libpth" in
2811         '') echo "Libpth not defined." >&4; croak=y ;;
2812         *)  echo "Using libpth '$libpth'." >&4 ;;
2813         esac
2814         case "$usrinc" in
2815         '') for i in $incpth; do
2816                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2817                     usrinc=$i
2818                     echo "Guessing usrinc $usrinc." >&4
2819                     break
2820                 fi
2821             done
2822             case "$usrinc" in
2823             '') echo "Usrinc not defined." >&4; croak=y ;;
2824             esac
2825             ;;
2826         *)  echo "Using usrinc $usrinc." >&4 ;;
2827         esac
2828         case "$targethost" in
2829         '') echo "Targethost not defined." >&4; croak=y ;;
2830         *)  echo "Using targethost $targethost." >&4
2831         esac
2832         locincpth=' '
2833         loclibpth=' '
2834         case "$croak" in
2835         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2836         esac
2837         case "$src" in
2838         /*) run=$src/Cross/run
2839             targetmkdir=$src/Cross/mkdir
2840             to=$src/Cross/to
2841             from=$src/Cross/from
2842             ;;
2843         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2844             run=$pwd/Cross/run
2845             targetmkdir=$pwd/Cross/mkdir
2846             to=$pwd/Cross/to
2847             from=$pwd/Cross/from
2848             ;;
2849         esac
2850         case "$targetrun" in
2851         '') targetrun=ssh ;;
2852         esac
2853         case "$targetto" in
2854         '') targetto=scp ;;
2855         esac
2856         case "$targetfrom" in
2857         '') targetfrom=scp ;;
2858         esac
2859         run=$run-$targetrun
2860         to=$to-$targetto
2861         from=$from-$targetfrom
2862         case "$targetdir" in
2863         '')  targetdir=/tmp
2864              echo "Guessing targetdir $targetdir." >&4
2865              ;;
2866         esac
2867         case "$targetuser" in
2868         '')  targetuser=root
2869              echo "Guessing targetuser $targetuser." >&4
2870              ;;
2871         esac
2872         case "$targetfrom" in
2873         scp)    q=-q ;;
2874         *)      q='' ;;
2875         esac
2876         case "$targetrun" in
2877         ssh|rsh)
2878             cat >$run <<EOF
2879 #!/bin/sh
2880 case "\$1" in
2881 -cwd)
2882   shift
2883   cwd=\$1
2884   shift
2885   ;;
2886 esac
2887 case "\$cwd" in
2888 '') cwd=$targetdir ;;
2889 esac
2890 exe=\$1
2891 shift
2892 if $test ! -f \$exe.xok; then
2893   $to \$exe
2894   $touch \$exe.xok
2895 fi
2896 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2897 EOF
2898             ;;
2899         *)  echo "Unknown targetrun '$targetrun'" >&4
2900             exit 1
2901             ;;
2902         esac
2903         case "$targetmkdir" in
2904         */Cross/mkdir)
2905             cat >$targetmkdir <<EOF
2906 #!/bin/sh
2907 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2908 EOF
2909             $chmod a+rx $targetmkdir
2910             ;;
2911         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2912             exit 1
2913             ;;
2914         esac
2915         case "$targetto" in
2916         scp|rcp)
2917             cat >$to <<EOF
2918 #!/bin/sh
2919 for f in \$@
2920 do
2921   case "\$f" in
2922   /*)
2923     $targetmkdir \`dirname \$f\`
2924     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2925     ;;
2926   *)
2927     $targetmkdir $targetdir/\`dirname \$f\`
2928     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2929     ;;
2930   esac
2931 done
2932 exit 0
2933 EOF
2934             ;;
2935         cp) cat >$to <<EOF
2936 #!/bin/sh
2937 for f in \$@
2938 do
2939   case "\$f" in
2940   /*)
2941     $mkdir -p $targetdir/\`dirname \$f\`
2942     $cp \$f $targetdir/\$f || exit 1
2943     ;;
2944   *)
2945     $targetmkdir $targetdir/\`dirname \$f\`
2946     $cp \$f $targetdir/\$f || exit 1
2947     ;;
2948   esac
2949 done
2950 exit 0
2951 EOF
2952             ;;
2953         *)  echo "Unknown targetto '$targetto'" >&4
2954             exit 1
2955             ;;
2956         esac
2957         case "$targetfrom" in
2958         scp|rcp)
2959           cat >$from <<EOF
2960 #!/bin/sh
2961 for f in \$@
2962 do
2963   $rm -f \$f
2964   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2965 done
2966 exit 0
2967 EOF
2968             ;;
2969         cp) cat >$from <<EOF
2970 #!/bin/sh
2971 for f in \$@
2972 do
2973   $rm -f \$f
2974   cp $targetdir/\$f . || exit 1
2975 done
2976 exit 0
2977 EOF
2978             ;;
2979         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2980             exit 1
2981             ;;
2982         esac
2983         if $test ! -f $run; then
2984             echo "Target 'run' script '$run' not found." >&4
2985         else
2986             $chmod a+rx $run
2987         fi
2988         if $test ! -f $to; then
2989             echo "Target 'to' script '$to' not found." >&4
2990         else
2991             $chmod a+rx $to
2992         fi
2993         if $test ! -f $from; then
2994             echo "Target 'from' script '$from' not found." >&4
2995         else
2996             $chmod a+rx $from
2997         fi
2998         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2999             exit 1
3000         fi
3001         cat >&4 <<EOF
3002 Using '$run' for remote execution,
3003 and '$from' and '$to'
3004 for remote file transfer.
3005 EOF
3006         ;;
3007 *)      run=''
3008         to=:
3009         from=:
3010         usecrosscompile='undef'
3011         targetarch=''
3012         ;;
3013 esac
3014
3015 : see whether [:lower:] and [:upper:] are supported character classes
3016 echo " "
3017 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3018 ABYZ)
3019         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3020         up='[:upper:]'
3021         low='[:lower:]'
3022         ;;
3023 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3024         # (0xd9 and 0xe2), therefore that is a nice testing point.
3025         if test "X$up" = X -o "X$low" = X; then
3026             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3027             rs) up='[A-Z]'
3028                 low='[a-z]'
3029                 ;;
3030             esac
3031         fi
3032         if test "X$up" = X -o "X$low" = X; then
3033             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3034             rs) up='A-Z'
3035                 low='a-z'
3036                 ;;
3037             esac
3038         fi
3039         if test "X$up" = X -o "X$low" = X; then
3040             case "`echo RS | od -x 2>/dev/null`" in
3041             *D9E2*|*d9e2*)
3042                 echo "Hey, this might be EBCDIC." >&4
3043                 if test "X$up" = X -o "X$low" = X; then
3044                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3045                     rs) up='[A-IJ-RS-Z]'
3046                         low='[a-ij-rs-z]'
3047                         ;;
3048                     esac
3049                 fi
3050                 if test "X$up" = X -o "X$low" = X; then
3051                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3052                     rs) up='A-IJ-RS-Z'
3053                         low='a-ij-rs-z'
3054                         ;;
3055                     esac
3056                 fi
3057                 ;;
3058             esac
3059         fi
3060 esac
3061 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3062 rs)
3063     echo "Using $up and $low to convert case." >&4
3064     ;;
3065 *)
3066     echo "I don't know how to translate letters from upper to lower case." >&4
3067     echo "Your tr is not acting any way I know of." >&4
3068     exit 1
3069     ;;
3070 esac
3071 : set up the translation script tr, must be called with ./tr of course
3072 cat >tr <<EOSC
3073 $startsh
3074 case "\$1\$2" in
3075 '[A-Z][a-z]') exec $tr '$up' '$low';;
3076 '[a-z][A-Z]') exec $tr '$low' '$up';;
3077 esac
3078 exec $tr "\$@"
3079 EOSC
3080 chmod +x tr
3081 $eunicefix tr
3082
3083 : Try to determine whether config.sh was made on this system
3084 case "$config_sh" in
3085 '')
3086 myuname=`$uname -a 2>/dev/null`
3087 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3088 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3089 # because the A-Z/a-z are not consecutive.
3090 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3091         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3092 newmyuname="$myuname"
3093 dflt=n
3094 case "$knowitall" in
3095 '')
3096         if test -f ../config.sh; then
3097                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3098                         eval "`grep myuname= ../config.sh`"
3099                 fi
3100                 if test "X$myuname" = "X$newmyuname"; then
3101                         dflt=y
3102                 fi
3103         fi
3104         ;;
3105 *) dflt=y;;
3106 esac
3107
3108 : Get old answers from old config file if Configure was run on the
3109 : same system, otherwise use the hints.
3110 hint=default
3111 cd ..
3112 if test -f config.sh; then
3113         echo " "
3114         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3115         . UU/myread
3116         case "$ans" in
3117         n*|N*) echo "OK, I'll ignore it."
3118                 mv config.sh config.sh.old
3119                 myuname="$newmyuname"
3120                 ;;
3121         *)  echo "Fetching default answers from your old config.sh file..." >&4
3122                 tmp_n="$n"
3123                 tmp_c="$c"
3124                 tmp_sh="$sh"
3125                 . ./config.sh
3126                 cp config.sh UU
3127                 n="$tmp_n"
3128                 c="$tmp_c"
3129                 : Older versions did not always set $sh.  Catch re-use of such
3130                 : an old config.sh.
3131                 case "$sh" in
3132                 '') sh="$tmp_sh" ;;
3133                 esac
3134                 hint=previous
3135                 ;;
3136         esac
3137 fi
3138 . ./UU/checkcc
3139 if test ! -f config.sh; then
3140         $cat <<EOM
3141
3142 First time through, eh?  I have some defaults handy for some systems
3143 that need some extra help getting the Configure answers right:
3144
3145 EOM
3146         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3147         dflt=''
3148         : Half the following guesses are probably wrong... If you have better
3149         : tests or hints, please send them to perlbug@perl.org
3150         : The metaconfig authors would also appreciate a copy...
3151         $test -f /irix && osname=irix
3152         $test -f /xenix && osname=sco_xenix
3153         $test -f /dynix && osname=dynix
3154         $test -f /dnix && osname=dnix
3155         $test -f /lynx.os && osname=lynxos
3156         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3157         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3158         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3159         $test -f /bin/mips && /bin/mips && osname=mips
3160         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3161                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3162         $test -d /usr/apollo/bin && osname=apollo
3163         $test -f /etc/saf/_sactab && osname=svr4
3164         $test -d /usr/include/minix && osname=minix
3165         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3166         if $test -d /MachTen -o -d /MachTen_Folder; then
3167                 osname=machten
3168                 if $test -x /sbin/version; then
3169                         osvers=`/sbin/version | $awk '{print $2}' |
3170                         $sed -e 's/[A-Za-z]$//'`
3171                 elif $test -x /usr/etc/version; then
3172                         osvers=`/usr/etc/version | $awk '{print $2}' |
3173                         $sed -e 's/[A-Za-z]$//'`
3174                 else
3175                         osvers="$2.$3"
3176                 fi
3177         fi
3178
3179         $test -f /sys/posix.dll &&
3180                 $test -f /usr/bin/what &&
3181                 set X `/usr/bin/what /sys/posix.dll` &&
3182                 $test "$3" = UWIN &&
3183                 osname=uwin &&
3184                 osvers="$5"
3185
3186         if $test -f $uname; then
3187                 set X $myuname
3188                 shift
3189
3190                 case "$5" in
3191                 fps*) osname=fps ;;
3192                 mips*)
3193                         case "$4" in
3194                         umips) osname=umips ;;
3195                         *) osname=mips ;;
3196                         esac;;
3197                 [23]100) osname=mips ;;
3198                 next*) osname=next ;;
3199                 i386*)
3200                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3201                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3202                                 osname='sco'
3203                                 osvers=$tmp
3204                         elif $test -f /etc/kconfig; then
3205                                 osname=isc
3206                                 if test "$lns" = "$ln -s"; then
3207                                         osvers=4
3208                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3209                                         osvers=3
3210                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3211                                         osvers=2
3212                                 fi
3213                         fi
3214                         tmp=''
3215                         ;;
3216                 pc*)
3217                         if test -n "$DJGPP"; then
3218                                 osname=dos
3219                                 osvers=djgpp
3220                         fi
3221                         ;;
3222                 esac
3223
3224                 case "$1" in
3225                 aix) osname=aix
3226                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3227                         case "$tmp" in
3228                         # oslevel can fail with:
3229                         # oslevel: Unable to acquire lock.
3230                         *not\ found) osvers="$4"."$3" ;;
3231                         '<3240'|'<>3240') osvers=3.2.0 ;;
3232                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3233                         '=3250'|'>3250') osvers=3.2.5 ;;
3234                         *) osvers=$tmp;;
3235                         esac
3236                         ;;
3237                 bsd386) osname=bsd386
3238                         osvers=`$uname -r`
3239                         ;;
3240                 cygwin*) osname=cygwin
3241                         osvers="$3"
3242                         ;;
3243                 *dc.osx) osname=dcosx
3244                         osvers="$3"
3245                         ;;
3246                 dnix) osname=dnix
3247                         osvers="$3"
3248                         ;;
3249                 domainos) osname=apollo
3250                         osvers="$3"
3251                         ;;
3252                 dgux)   osname=dgux
3253                         osvers="$3"
3254                         ;;
3255                 dragonfly) osname=dragonfly
3256                         osvers="$3"
3257                         ;;
3258                 dynixptx*) osname=dynixptx
3259                         osvers=`echo "$4"|sed 's/^v//'`
3260                         ;;
3261                 freebsd) osname=freebsd
3262                         osvers="$3" ;;
3263                 genix)  osname=genix ;;
3264                 gnu)    osname=gnu
3265                         osvers="$3" ;;
3266                 hp*)    osname=hpux
3267                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3268                         ;;
3269                 irix*)  osname=irix
3270                         case "$3" in
3271                         4*) osvers=4 ;;
3272                         5*) osvers=5 ;;
3273                         *)      osvers="$3" ;;
3274                         esac
3275                         ;;
3276                 linux)  osname=linux
3277                         case "$3" in
3278                         *)      osvers="$3" ;;
3279                         esac
3280                         ;;
3281                 MiNT)   osname=mint
3282                         ;;
3283                 netbsd*) osname=netbsd
3284                         osvers="$3"
3285                         ;;
3286                 news-os) osvers="$3"
3287                         case "$3" in
3288                         4*) osname=newsos4 ;;
3289                         *) osname=newsos ;;
3290                         esac
3291                         ;;
3292                 next*) osname=next ;;
3293                 nonstop-ux) osname=nonstopux ;;
3294                 openbsd) osname=openbsd
3295                         osvers="$3"
3296                         ;;
3297                 os2)    osname=os2
3298                         osvers="$4"
3299                         ;;
3300                 POSIX-BC | posix-bc ) osname=posix-bc
3301                         osvers="$3"
3302                         ;;
3303                 powerux | power_ux | powermax_os | powermaxos | \
3304                 powerunix | power_unix) osname=powerux
3305                         osvers="$3"
3306                         ;;
3307                 qnx) osname=qnx
3308                         osvers="$4"
3309                         ;;
3310                 solaris) osname=solaris
3311                         case "$3" in
3312                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3313                         *)      osvers="$3" ;;
3314                         esac
3315                         ;;
3316                 sunos) osname=sunos
3317                         case "$3" in
3318                         5*) osname=solaris
3319                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3320                         *)      osvers="$3" ;;
3321                         esac
3322                         ;;
3323                 titanos) osname=titanos
3324                         case "$3" in
3325                         1*) osvers=1 ;;
3326                         2*) osvers=2 ;;
3327                         3*) osvers=3 ;;
3328                         4*) osvers=4 ;;
3329                         *)      osvers="$3" ;;
3330                         esac
3331                         ;;
3332                 ultrix) osname=ultrix
3333                         osvers="$3"
3334                         ;;
3335                 osf1|mls+)      case "$5" in
3336                                 alpha)
3337                                         osname=dec_osf
3338                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3339                                         case "$osvers" in
3340                                         [1-9].[0-9]*) ;;
3341                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3342                                         esac
3343                                         ;;
3344                         hp*)    osname=hp_osf1  ;;
3345                         mips)   osname=mips_osf1 ;;
3346                         esac
3347                         ;;
3348                 # UnixWare 7.1.2 is known as Open UNIX 8
3349                 openunix|unixware) osname=svr5
3350                         osvers="$4"
3351                         ;;
3352                 uts)    osname=uts
3353                         osvers="$3"
3354                         ;;
3355                 vos) osvers="$3"
3356                         ;;
3357                 $2) case "$osname" in
3358                         *isc*) ;;
3359                         *freebsd*) ;;
3360                         svr*)
3361                                 : svr4.x or possibly later
3362                                 case "svr$3" in
3363                                 ${osname}*)
3364                                         osname=svr$3
3365                                         osvers=$4
3366                                         ;;
3367                                 esac
3368                                 case "$osname" in
3369                                 svr4.0)
3370                                         : Check for ESIX
3371                                         if test -f /stand/boot ; then
3372                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3373                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3374                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3375                                                         if test -n "$isesix"; then
3376                                                                 osname=esix4
3377                                                         fi
3378                                                 fi
3379                                         fi
3380                                         ;;
3381                                 esac
3382                                 ;;
3383                         *)      if test -f /etc/systemid; then
3384                                         osname=sco
3385                                         set `echo $3 | $sed 's/\./ /g'` $4
3386                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3387                                                 osvers=$1.$2.$3
3388                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3389                                                 osvers=$1.$2
3390                                         elif $test -f $src/hints/sco_$1.sh; then
3391                                                 osvers=$1
3392                                         fi
3393                                 else
3394                                         case "$osname" in
3395                                         '') : Still unknown.  Probably a generic Sys V.
3396                                                 osname="sysv"
3397                                                 osvers="$3"
3398                                                 ;;
3399                                         esac
3400                                 fi
3401                                 ;;
3402                         esac
3403                         ;;
3404                 *)      case "$osname" in
3405                         '') : Still unknown.  Probably a generic BSD.
3406                                 osname="$1"
3407                                 osvers="$3"
3408                                 ;;
3409                         esac
3410                         ;;
3411                 esac
3412         else
3413                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3414                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3415                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3416                                 osname=news_os
3417                         fi
3418                         $rm -f UU/kernel.what
3419                 elif test -d c:/. -o -n "$is_os2" ; then
3420                         set X $myuname
3421                         osname=os2
3422                         osvers="$5"
3423                 fi
3424         fi
3425
3426         case "$targetarch" in
3427         '') ;;
3428         *)  hostarch=$osname
3429             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3430             osvers=''
3431             ;;
3432         esac
3433
3434         : Now look for a hint file osname_osvers, unless one has been
3435         : specified already.
3436         case "$hintfile" in
3437         ''|' ')
3438                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3439                 : Also try without trailing minor version numbers.
3440                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3441                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3442                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3443                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3444                 case "$file" in
3445                 '') dflt=none ;;
3446                 *)  case "$osvers" in
3447                         '') dflt=$file
3448                                 ;;
3449                         *)  if $test -f $src/hints/$file.sh ; then
3450                                         dflt=$file
3451                                 elif $test -f $src/hints/$xfile.sh ; then
3452                                         dflt=$xfile
3453                                 elif $test -f $src/hints/$xxfile.sh ; then
3454                                         dflt=$xxfile
3455                                 elif $test -f $src/hints/$xxxfile.sh ; then
3456                                         dflt=$xxxfile
3457                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3458                                         dflt=$xxxxfile
3459                                 elif $test -f "$src/hints/${osname}.sh" ; then
3460                                         dflt="${osname}"
3461                                 else
3462                                         dflt=none
3463                                 fi
3464                                 ;;
3465                         esac
3466                         ;;
3467                 esac
3468                 if $test -f Policy.sh ; then
3469                         case "$dflt" in
3470                         *Policy*) ;;
3471                         none) dflt="Policy" ;;
3472                         *) dflt="Policy $dflt" ;;
3473                         esac
3474                 fi
3475                 ;;
3476         *)
3477                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3478                 ;;
3479         esac
3480
3481         if $test -f Policy.sh ; then
3482                 $cat <<EOM
3483
3484 There's also a Policy hint file available, which should make the
3485 site-specific (policy) questions easier to answer.
3486 EOM
3487
3488         fi
3489
3490         $cat <<EOM
3491
3492 You may give one or more space-separated answers, or "none" if appropriate.
3493 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3494 previous run of Configure, you may specify it as well as or instead of
3495 OS-specific hints.  If hints are provided for your OS, you should use them:
3496 although Perl can probably be built without hints on many platforms, using
3497 hints often improve performance and may enable features that Configure can't
3498 set up on its own. If there are no hints that match your OS, specify "none";
3499 DO NOT give a wrong version or a wrong OS.
3500
3501 EOM
3502
3503         rp="Which of these apply, if any?"
3504         . UU/myread
3505         tans=$ans
3506         for file in $tans; do
3507                 if $test X$file = XPolicy -a -f Policy.sh; then
3508                         . Policy.sh
3509                         $cat Policy.sh >> UU/config.sh
3510                 elif $test -f $src/hints/$file.sh; then
3511                         . $src/hints/$file.sh
3512                         $cat $src/hints/$file.sh >> UU/config.sh
3513                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3514                         : nothing
3515                 else
3516                         : Give one chance to correct a possible typo.
3517                         echo "$file.sh does not exist"
3518                         dflt=$file
3519                         rp="hint to use instead?"
3520                         . UU/myread
3521                         for file in $ans; do
3522                                 if $test -f "$src/hints/$file.sh"; then
3523                                         . $src/hints/$file.sh
3524                                         $cat $src/hints/$file.sh >> UU/config.sh
3525                                 elif $test X$ans = X -o X$ans = Xnone ; then
3526                                         : nothing
3527                                 else
3528                                         echo "$file.sh does not exist -- ignored."
3529                                 fi
3530                         done
3531                 fi
3532         done
3533
3534         hint=recommended
3535         : Remember our hint file for later.
3536         if $test -f "$src/hints/$file.sh" ; then
3537                 hintfile="$file"
3538         else
3539                 hintfile=''
3540         fi
3541 fi
3542 cd UU
3543 ;;
3544 *)
3545         echo " "
3546         echo "Fetching default answers from $config_sh..." >&4
3547         tmp_n="$n"
3548         tmp_c="$c"
3549         cd ..
3550         cp $config_sh config.sh 2>/dev/null
3551         chmod +w config.sh
3552         . ./config.sh
3553         cd UU
3554         cp ../config.sh .
3555         n="$tmp_n"
3556         c="$tmp_c"
3557         hint=previous
3558         ;;
3559 esac
3560 test "$override" && . ./optdef.sh
3561
3562 : Restore computed paths
3563 for file in $loclist $trylist; do
3564         eval $file="\$_$file"
3565 done
3566
3567 cat << EOM
3568
3569 Configure uses the operating system name and version to set some defaults.
3570 The default value is probably right if the name rings a bell. Otherwise,
3571 since spelling matters for me, either accept the default or answer "none"
3572 to leave it blank.
3573
3574 EOM
3575 case "$osname" in
3576         ''|' ')
3577                 case "$hintfile" in
3578                 ''|' '|none) dflt=none ;;
3579                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3580                 esac
3581                 ;;
3582         *) dflt="$osname" ;;
3583 esac
3584 rp="Operating system name?"
3585 . ./myread
3586 case "$ans" in
3587 none)  osname='' ;;
3588 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3589 esac
3590 echo " "
3591 case "$osvers" in
3592         ''|' ')
3593                 case "$hintfile" in
3594                 ''|' '|none) dflt=none ;;
3595                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3596                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3597                         case "$dflt" in
3598                         ''|' ') dflt=none ;;
3599                         esac
3600                         ;;
3601                 esac
3602                 ;;
3603         *) dflt="$osvers" ;;
3604 esac
3605 rp="Operating system version?"
3606 . ./myread
3607 case "$ans" in
3608 none)  osvers='' ;;
3609 *) osvers="$ans" ;;
3610 esac
3611
3612
3613 . ./posthint.sh
3614
3615 : who configured the system
3616 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3617 case "$cf_by" in
3618 "")
3619         cf_by=`(logname) 2>/dev/null`
3620         case "$cf_by" in
3621         "")
3622                 cf_by=`(whoami) 2>/dev/null`
3623                 case "$cf_by" in
3624                 "") cf_by=unknown ;;
3625                 esac ;;
3626         esac ;;
3627 esac
3628
3629 : decide how portable to be.  Allow command line overrides.
3630 case "$d_portable" in
3631 "$undef") ;;
3632 *)      d_portable="$define" ;;
3633 esac
3634
3635 : set up shell script to do ~ expansion
3636 cat >filexp <<EOSS
3637 $startsh
3638 : expand filename
3639 case "\$1" in
3640  \~/*|\~)
3641         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3642         ;;
3643  \~*)
3644         if $test -f /bin/csh; then
3645                 /bin/csh -f -c "glob \$1"
3646                 failed=\$?
3647                 echo ""
3648                 exit \$failed
3649         else
3650                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3651                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3652                 if $test ! -d "\$dir"; then
3653                         me=\`basename \$0\`
3654                         echo "\$me: can't locate home directory for: \$name" >&2
3655                         exit 1
3656                 fi
3657                 case "\$1" in
3658                 */*)
3659                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3660                         ;;
3661                 *)
3662                         echo \$dir
3663                         ;;
3664                 esac
3665         fi
3666         ;;
3667 *)
3668         echo \$1
3669         ;;
3670 esac
3671 EOSS
3672 chmod +x filexp
3673 $eunicefix filexp
3674
3675 : now set up to get a file name
3676 cat <<EOS >getfile
3677 $startsh
3678 EOS
3679 cat <<'EOSC' >>getfile
3680 tilde=''
3681 fullpath=''
3682 already=''
3683 skip=''
3684 none_ok=''
3685 exp_file=''
3686 nopath_ok=''
3687 orig_rp="$rp"
3688 orig_dflt="$dflt"
3689 case "$gfpth" in
3690 '') gfpth='.' ;;
3691 esac
3692
3693 case "$fn" in
3694 *\(*)
3695         : getfile will accept an answer from the comma-separated list
3696         : enclosed in parentheses even if it does not meet other criteria.
3697         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3698         fn=`echo $fn | sed 's/(.*)//'`
3699         ;;
3700 esac
3701
3702 case "$fn" in
3703 *:*)
3704         loc_file=`expr $fn : '.*:\(.*\)'`
3705         fn=`expr $fn : '\(.*\):.*'`
3706         ;;
3707 esac
3708
3709 case "$fn" in
3710 *~*) tilde=true;;
3711 esac
3712 case "$fn" in
3713 */*) fullpath=true;;
3714 esac
3715 case "$fn" in
3716 *+*) skip=true;;
3717 esac
3718 case "$fn" in
3719 *n*) none_ok=true;;
3720 esac
3721 case "$fn" in
3722 *e*) exp_file=true;;
3723 esac
3724 case "$fn" in
3725 *p*) nopath_ok=true;;
3726 esac
3727
3728 case "$fn" in
3729 *f*) type='File';;
3730 *d*) type='Directory';;
3731 *l*) type='Locate';;
3732 esac
3733
3734 what="$type"
3735 case "$what" in
3736 Locate) what='File';;
3737 esac
3738
3739 case "$exp_file" in
3740 '')
3741         case "$d_portable" in
3742         "$define") ;;
3743         *) exp_file=true;;
3744         esac
3745         ;;
3746 esac
3747
3748 cd ..
3749 while test "$type"; do
3750         redo=''
3751         rp="$orig_rp"
3752         dflt="$orig_dflt"
3753         case "$tilde" in
3754         true) rp="$rp (~name ok)";;
3755         esac
3756         . UU/myread
3757         if test -f UU/getfile.ok && \
3758                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3759         then
3760                 value="$ans"
3761                 ansexp="$ans"
3762                 break
3763         fi
3764         case "$ans" in
3765         none)
3766                 value=''
3767                 ansexp=''
3768                 case "$none_ok" in
3769                 true) type='';;
3770                 esac
3771                 ;;
3772         *)
3773                 case "$tilde" in
3774                 '') value="$ans"
3775                         ansexp="$ans";;
3776                 *)
3777                         value=`UU/filexp $ans`
3778                         case $? in
3779                         0)
3780                                 if test "$ans" != "$value"; then
3781                                         echo "(That expands to $value on this system.)"
3782                                 fi
3783                                 ;;
3784                         *) value="$ans";;
3785                         esac
3786                         ansexp="$value"
3787                         case "$exp_file" in
3788                         '') value="$ans";;
3789                         esac
3790                         ;;
3791                 esac
3792                 case "$fullpath" in
3793                 true)
3794                         case "$ansexp" in
3795                         /*) value="$ansexp" ;;
3796                         [a-zA-Z]:/*) value="$ansexp" ;;
3797                         *)
3798                                 redo=true
3799                                 case "$already" in
3800                                 true)
3801                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3802                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3803                                         ;;
3804                                 *)
3805                                 echo "Please give a full path name, starting with slash." >&4
3806                                         case "$tilde" in
3807                                         true)
3808                                 echo "Note that using ~name is ok provided it expands well." >&4
3809                                                 already=true
3810                                                 ;;
3811                                         esac
3812                                 esac
3813                                 ;;
3814                         esac
3815                         ;;
3816                 esac
3817                 case "$redo" in
3818                 '')
3819                         case "$type" in
3820                         File)
3821                                 for fp in $gfpth; do
3822                                         if test "X$fp" = X.; then
3823                                             pf="$ansexp"
3824                                         else    
3825                                             pf="$fp/$ansexp"
3826                                         fi
3827                                         if test -f "$pf"; then
3828                                                 type=''
3829                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3830                                         then
3831                                                 echo "($value is not a plain file, but that's ok.)"
3832                                                 type=''
3833                                         fi
3834                                         if test X"$type" = X; then
3835                                             value="$pf"
3836                                             break
3837                                         fi
3838                                 done
3839                                 ;;
3840                         Directory)
3841                                 for fp in $gfpth; do
3842                                         if test "X$fp" = X.; then
3843                                             dir="$ans"
3844                                             direxp="$ansexp"
3845                                         else    
3846                                             dir="$fp/$ansexp"
3847                                             direxp="$fp/$ansexp"
3848                                         fi
3849                                         if test -d "$direxp"; then
3850                                                 type=''
3851                                                 value="$dir"
3852                                                 break
3853                                         fi
3854                                 done
3855                                 ;;
3856                         Locate)
3857                                 if test -d "$ansexp"; then
3858                                         echo "(Looking for $loc_file in directory $value.)"
3859                                         value="$value/$loc_file"
3860                                         ansexp="$ansexp/$loc_file"
3861                                 fi
3862                                 if test -f "$ansexp"; then
3863                                         type=''
3864                                 fi
3865                                 case "$nopath_ok" in
3866                                 true)   case "$value" in
3867                                         */*) ;;
3868                                         *)      echo "Assuming $value will be in people's path."
3869                                                 type=''
3870                                                 ;;
3871                                         esac
3872                                         ;;
3873                                 esac
3874                                 ;;
3875                         esac
3876
3877                         case "$skip" in
3878                         true) type='';
3879                         esac
3880
3881                         case "$type" in
3882                         '') ;;
3883                         *)
3884                                 if test "$fastread" = yes; then
3885                                         dflt=y
3886                                 else
3887                                         dflt=n
3888                                 fi
3889                                 rp="$what $value doesn't exist.  Use that name anyway?"
3890                                 . UU/myread
3891                                 dflt=''
3892                                 case "$ans" in
3893                                 y*) type='';;
3894                                 *) echo " ";;
3895                                 esac
3896                                 ;;
3897                         esac
3898                         ;;
3899                 esac
3900                 ;;
3901         esac
3902 done
3903 cd UU
3904 ans="$value"
3905 rp="$orig_rp"
3906 dflt="$orig_dflt"
3907 rm -f getfile.ok
3908 test "X$gfpthkeep" != Xy && gfpth=""
3909 EOSC
3910
3911 : determine root of directory hierarchy where package will be installed.
3912 case "$prefix" in
3913 '')
3914         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3915         ;;
3916 *?/)
3917         dflt=`echo "$prefix" | sed 's/.$//'`
3918         ;;
3919 *)
3920         dflt="$prefix"
3921         ;;
3922 esac
3923 $cat <<EOM
3924
3925 By default, $package will be installed in $dflt/bin, manual pages
3926 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3927 installation directories. Typically this is something like /usr/local.
3928 If you wish to have binaries under /usr/bin but other parts of the
3929 installation under /usr/local, that's ok: you will be prompted
3930 separately for each of the installation directories, the prefix being
3931 only used to set the defaults.
3932
3933 EOM
3934 fn=d~
3935 rp='Installation prefix to use?'
3936 . ./getfile
3937 oldprefix=''
3938 case "$prefix" in
3939 '') ;;
3940 *)
3941         case "$ans" in
3942         "$prefix") ;;
3943         *) oldprefix="$prefix";;
3944         esac
3945         ;;
3946 esac
3947 prefix="$ans"
3948 prefixexp="$ansexp"
3949
3950 : allow them to override the AFS root
3951 case "$afsroot" in
3952 '')     afsroot=/afs ;;
3953 *)      afsroot=$afsroot ;;
3954 esac
3955
3956 : is AFS running?
3957 echo " "
3958 case "$afs" in
3959 $define|true)   afs=true ;;
3960 $undef|false)   afs=false ;;
3961 *)      if $test -d $afsroot; then
3962                 afs=true
3963         else
3964                 afs=false
3965         fi
3966         ;;
3967 esac
3968 if $afs; then
3969         echo "AFS may be running... I'll be extra cautious then..." >&4
3970 else
3971         echo "AFS does not seem to be running..." >&4
3972 fi
3973
3974 : determine installation prefix for where package is to be installed.
3975 if $afs; then 
3976 $cat <<EOM
3977
3978 Since you are running AFS, I need to distinguish the directory in which
3979 files will reside from the directory in which they are installed (and from
3980 which they are presumably copied to the former directory by occult means).
3981
3982 EOM
3983         case "$installprefix" in
3984         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3985         *) dflt="$installprefix";;
3986         esac
3987 else
3988 $cat <<EOM
3989
3990 In some special cases, particularly when building $package for distribution,
3991 it is convenient to distinguish the directory in which files should be
3992 installed from the directory ($prefix) in which they will
3993 eventually reside.  For most users, these two directories are the same.
3994
3995 EOM
3996         case "$installprefix" in
3997         '') dflt=$prefix ;;
3998         *) dflt=$installprefix;;
3999         esac
4000 fi
4001 fn=d~
4002 rp='What installation prefix should I use for installing files?'
4003 . ./getfile
4004 installprefix="$ans"
4005 installprefixexp="$ansexp"
4006
4007 : Perform the prefixexp/installprefixexp correction if necessary
4008 cat <<EOS >installprefix
4009 $startsh
4010 EOS
4011 cat <<'EOSC' >>installprefix
4012 : Change installation prefix, if necessary.
4013 if $test X"$prefix" != X"$installprefix"; then
4014     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4015 else
4016     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4017 fi
4018 EOSC
4019 chmod +x installprefix
4020 $eunicefix installprefix
4021
4022 : Set variables such as privlib and privlibexp from the output of ./getfile
4023 : performing the prefixexp/installprefixexp correction if necessary.
4024 cat <<EOS >setprefixvar
4025 $startsh
4026 EOS
4027 cat <<'EOSC' >>setprefixvar
4028 eval "${prefixvar}=\"\$ans\""
4029 eval "${prefixvar}exp=\"\$ansexp\""
4030 . ./installprefix
4031 EOSC
4032 chmod +x setprefixvar
4033 $eunicefix setprefixvar
4034
4035 : set up the script used to warn in case of inconsistency
4036 cat <<EOS >whoa
4037 $startsh
4038 EOS
4039 cat <<'EOSC' >>whoa
4040 dflt=y
4041 case "$hint" in
4042     recommended)
4043         case "$hintfile" in
4044         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4045                 ;;
4046         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4047                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4048                 ;;
4049         esac
4050         ;;
4051     *)  echo " "
4052         echo "*** WHOA THERE!!! ***" >&4
4053         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4054         ;;
4055 esac
4056 rp="    Keep the $hint value?"
4057 . ./myread
4058 case "$ans" in
4059 y) td=$was; tu=$was;;
4060 esac
4061 EOSC
4062
4063 : function used to set '$1' to '$val'
4064 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4065 case "$val$was" in
4066 $define$undef) . ./whoa; eval "$var=\$td";;
4067 $undef$define) . ./whoa; eval "$var=\$tu";;
4068 *) eval "$var=$val";;
4069 esac'
4070
4071 : Check is we will use socks
4072 case "$usesocks" in
4073 $define|true|[yY]*)     dflt='y';;
4074 *) dflt='n';;
4075 esac
4076 cat <<EOM
4077
4078 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4079 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4080 to use the PerlIO abstraction layer, this will be implicitly selected.
4081
4082 If this doesn't make any sense to you, just accept the default '$dflt'.
4083 EOM
4084 rp='Build Perl for SOCKS?'
4085 . ./myread
4086 case "$ans" in
4087 y|Y)    val="$define" ;;
4088 *)      val="$undef" ;;
4089 esac
4090 set usesocks
4091 eval $setvar
4092
4093 case "$usesocks" in
4094 $define|true|[yY]*) useperlio="$define";;
4095 esac
4096
4097 : Check if we want perlio
4098 case "$useperlio" in
4099 $define|true|[yY]*|'')  dflt='y';;
4100 *) dflt='n';;
4101 esac
4102 cat <<EOM
4103
4104 Previous version of $package used the standard IO mechanisms as
4105 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4106 alternate IO mechanisms via the PerlIO abstraction layer, but the
4107 stdio mechanism is still available if needed.  The abstraction layer
4108 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4109 Using PerlIO with sfio may cause problems with some extension modules.
4110
4111 If this doesn't make any sense to you, just accept the default '$dflt'.
4112 EOM
4113 rp='Use the PerlIO abstraction layer?'
4114 . ./myread
4115 case "$ans" in
4116 y|Y)
4117         val="$define"
4118         ;;
4119 *)
4120         echo "Ok, doing things the stdio way."
4121         val="$undef"
4122         ;;
4123 esac
4124 set useperlio
4125 eval $setvar
4126
4127 case "$usesocks" in
4128 $define|true|[yY]*)
4129         case "$useperlio" in
4130         $define|true|[yY]*) ;;
4131         *)      cat >&4 <<EOM
4132
4133 You are using the SOCKS proxy protocol library which means that you
4134 should also use the PerlIO layer.  You may be headed for trouble.
4135
4136 EOM
4137                 ;;
4138         esac
4139         ;;
4140 esac
4141
4142 : get the patchlevel
4143 echo " "
4144 echo "Getting the current patchlevel..." >&4
4145 if $test -r $rsrc/patchlevel.h;then
4146         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4147         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4148         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4149         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4150         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4151         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4152         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4153 else
4154         revision=0
4155         patchlevel=0
4156         subversion=0
4157         api_revision=0
4158         api_version=0
4159         api_subversion=0
4160         perl_patchlevel=0
4161         $echo "(You do not have patchlevel.h.  Eek.)"
4162 fi
4163 if $test -r $rsrc/.patch ; then
4164         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4165                 perl_patchlevel=`cat $rsrc/.patch`
4166         fi
4167 fi
4168 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4169 version_patchlevel_string="version $patchlevel subversion $subversion"
4170 case "$perl_patchlevel" in
4171 0|'') ;;
4172 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4173     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4174     ;;
4175 esac
4176
4177 $echo "(You have $package $version_patchlevel_string.)"
4178
4179 case "$osname" in
4180 dos|vms)
4181         : XXX Should be a Configure test for double-dots in filenames.
4182         version=`echo $revision $patchlevel $subversion | \
4183                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4184         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4185                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4186         ;;
4187 *)
4188         version=`echo $revision $patchlevel $subversion | \
4189                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4190         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4191                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4192         ;;
4193 esac
4194 : Special case the 5.005_xx maintenance series, which used 5.005
4195 : without any subversion label as a subdirectory in $sitelib
4196 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4197         api_versionstring='5.005'
4198 fi
4199
4200 : Do we want threads support and if so, what type
4201 case "$usethreads" in
4202 $define|true|[yY]*)     dflt='y';;
4203 *)     # Catch case where user specified ithreads or 5005threads but
4204        # forgot -Dusethreads (A.D. 4/2002)
4205        case "$useithreads$use5005threads" in
4206        *$define*)
4207                 case "$useperlio" in
4208                 "$define")      dflt='y' ;;
4209                 *)              dflt='n' ;;
4210                 esac
4211                 ;;
4212        *)       dflt='n';;
4213        esac
4214        ;;
4215 esac
4216 cat <<EOM
4217
4218 Perl can be built to take advantage of threads on some systems.
4219 To do so, Configure can be run with -Dusethreads.
4220
4221 Note that Perl built with threading support runs slightly slower
4222 and uses more memory than plain Perl. The current implementation
4223 is believed to be stable, but it is fairly new, and so should be
4224 treated with caution.
4225
4226 If this doesn't make any sense to you, just accept the default '$dflt'.
4227 EOM
4228 rp='Build a threading Perl?'
4229 . ./myread
4230 case "$ans" in
4231 y|Y)    val="$define" ;;
4232 *)      val="$undef" ;;
4233 esac
4234 set usethreads
4235 eval $setvar
4236
4237 if $test $patchlevel -lt 9; then
4238     case "$usethreads" in
4239     $define)
4240         $cat <<EOM
4241
4242 Since release 5.6, Perl has had two different threading implementations,
4243 the newer interpreter-based version (ithreads) with one interpreter per
4244 thread, and the older 5.005 version (5005threads).
4245 The 5005threads version is effectively unmaintained and will probably be
4246 removed in Perl 5.10, so there should be no need to build a Perl using it
4247 unless needed for backwards compatibility with some existing 5.005threads
4248 code.
4249
4250 EOM
4251         : Default to ithreads unless overridden on command line or with
4252         : old config.sh
4253         dflt='y'
4254         case "$use5005threads" in
4255                 $define|true|[yY]*) dflt='n';;
4256         esac
4257         case "$useithreads" in
4258                 $undef|false|[nN]*) dflt='n';;
4259         esac
4260         rp='Use the newer interpreter-based ithreads?'
4261         . ./myread
4262         case "$ans" in
4263         y|Y)    val="$define" ;;
4264         *)      val="$undef" ;;
4265         esac
4266         set useithreads
4267         eval $setvar
4268         : Now set use5005threads to the opposite value.
4269         case "$useithreads" in
4270         $define) val="$undef" ;;
4271         *) val="$define" ;;
4272         esac
4273         set use5005threads
4274         eval $setvar
4275         ;;
4276     *)
4277         useithreads="$undef"
4278         use5005threads="$undef"
4279         ;;
4280     esac
4281
4282     case "$useithreads$use5005threads" in
4283     "$define$define")
4284         $cat >&4 <<EOM
4285
4286 You cannot have both the ithreads and the 5.005 threads enabled
4287 at the same time.  Disabling the 5.005 threads since they are
4288 much less stable than the ithreads.
4289
4290 EOM
4291         use5005threads="$undef"
4292         ;;
4293     esac
4294
4295 else
4296 : perl-5.9.x and later
4297
4298     if test X"$usethreads" = "X$define"; then
4299         case "$use5005threads" in
4300             $define|true|[yY]*)
4301                 $cat >&4 <<EOM
4302
4303 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4304
4305 EOM
4306             ;;
4307         esac
4308     fi
4309
4310     use5005threads="$undef"
4311     useithreads="$usethreads"
4312 fi
4313
4314 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4315         cat >&4 <<EOF
4316 ***
4317 *** To build with ithreads you must also use the PerlIO layer.
4318 *** Cannot continue, aborting.
4319 ***
4320 EOF
4321         exit 1
4322 fi
4323
4324 case "$d_oldpthreads" in
4325 '')     : Configure tests would be welcome here.  For now, assume undef.
4326         val="$undef" ;;
4327 *)      val="$d_oldpthreads" ;;
4328 esac
4329 set d_oldpthreads
4330 eval $setvar
4331
4332
4333 : Look for a hint-file generated 'call-back-unit'.  If the
4334 : user has specified that a threading perl is to be built,
4335 : we may need to set or change some other defaults.
4336 if $test -f usethreads.cbu; then
4337     echo "Your platform has some specific hints regarding threaded builds, using them..."
4338     . ./usethreads.cbu
4339 else
4340     case "$usethreads" in
4341         "$define"|true|[yY]*)
4342                 $cat <<EOM
4343 (Your platform does not have any specific hints for threaded builds.
4344  Assuming POSIX threads, then.)
4345 EOM
4346         ;;
4347     esac
4348 fi
4349
4350 : Check if multiplicity is required
4351 cat <<EOM
4352
4353 Perl can be built so that multiple Perl interpreters can coexist
4354 within the same Perl executable.
4355 EOM
4356
4357 case "$useithreads" in
4358 $define)
4359         cat <<EOM
4360 This multiple interpreter support is required for interpreter-based threads.
4361 EOM
4362         val="$define"
4363         ;;
4364 *)      case "$usemultiplicity" in
4365         $define|true|[yY]*)     dflt='y';;
4366         *) dflt='n';;
4367         esac
4368         echo " "
4369         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4370         rp='Build Perl for multiplicity?'
4371         . ./myread
4372         case "$ans" in
4373         y|Y)    val="$define" ;;
4374         *)      val="$undef" ;;
4375         esac
4376         ;;
4377 esac
4378 set usemultiplicity
4379 eval $setvar
4380
4381 : Check if morebits is requested
4382 case "$usemorebits" in
4383 "$define"|true|[yY]*)
4384         use64bitint="$define"
4385         uselongdouble="$define"
4386         usemorebits="$define"
4387         ;;
4388 *)      usemorebits="$undef"
4389         ;;
4390 esac
4391
4392 : Determine the C compiler to be used
4393 echo " "
4394 case "$cc" in
4395 '') dflt=cc;;
4396 *) dflt="$cc";;
4397 esac
4398 rp="Use which C compiler?"
4399 . ./myread
4400 cc="$ans"
4401
4402 : See whether they have no cc but they do have gcc
4403 . ./trygcc
4404 if $test -f cc.cbu; then
4405     . ./cc.cbu
4406 fi
4407 . ./checkcc
4408
4409 : make some quick guesses about what we are up against
4410 echo " "
4411 $echo $n "Hmm...  $c"
4412 echo exit 1 >bsd
4413 echo exit 1 >usg
4414 echo exit 1 >v7
4415 echo exit 1 >osf1
4416 echo exit 1 >eunice
4417 echo exit 1 >xenix
4418 echo exit 1 >venix
4419 echo exit 1 >os2
4420 d_bsd="$undef"
4421 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4422 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4423 then
4424         echo "Looks kind of like an OSF/1 system, but we'll see..."
4425         echo exit 0 >osf1
4426 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4427         xxx=`./loc addbib blurfl $pth`
4428         if $test -f $xxx; then
4429         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4430                 echo exit 0 >bsd
4431                 echo exit 0 >usg
4432         else
4433                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4434                         echo "Looks kind of like an extended USG system, but we'll see..."
4435                 else
4436                         echo "Looks kind of like a USG system, but we'll see..."
4437                 fi
4438                 echo exit 0 >usg
4439         fi
4440 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4441         echo "Looks kind of like a BSD system, but we'll see..."
4442         d_bsd="$define"
4443         echo exit 0 >bsd
4444 else
4445         echo "Looks kind of like a Version 7 system, but we'll see..."
4446         echo exit 0 >v7
4447 fi
4448 case "$eunicefix" in
4449 *unixtovms*)
4450         $cat <<'EOI'
4451 There is, however, a strange, musty smell in the air that reminds me of
4452 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4453 EOI
4454         echo exit 0 >eunice
4455         d_eunice="$define"
4456 : it so happens the Eunice I know will not run shell scripts in Unix format
4457         ;;
4458 *)
4459         echo " "
4460         echo "Congratulations.  You aren't running Eunice."
4461         d_eunice="$undef"
4462         ;;
4463 esac
4464 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4465 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4466 : semicolon as a patch separator
4467 case "$p_" in
4468 :) ;;
4469 *)
4470         $cat <<'EOI'
4471 I have the feeling something is not exactly right, however...don't tell me...
4472 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4473 (Or you may be running DOS with DJGPP.)
4474 EOI
4475         echo exit 0 >os2
4476         ;;
4477 esac
4478 if test -f /xenix; then
4479         echo "Actually, this looks more like a XENIX system..."
4480         echo exit 0 >xenix
4481         d_xenix="$define"
4482 else
4483         echo " "
4484         echo "It's not Xenix..."
4485         d_xenix="$undef"
4486 fi
4487 chmod +x xenix
4488 $eunicefix xenix
4489 if test -f /venix; then
4490         echo "Actually, this looks more like a VENIX system..."
4491         echo exit 0 >venix
4492 else
4493         echo " "
4494         if ./xenix; then
4495                 : null
4496         else
4497                 echo "Nor is it Venix..."
4498         fi
4499 fi
4500 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4501 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4502 $rm -f foo
4503
4504 : Check if we are using GNU gcc and what its version is
4505 echo " "
4506 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4507 $cat >try.c <<EOM
4508 #include <stdio.h>
4509 int main() {
4510 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4511 #ifdef __VERSION__
4512         printf("%s\n", __VERSION__);
4513 #else
4514         printf("%s\n", "1");
4515 #endif
4516 #endif
4517         return(0);
4518 }
4519 EOM
4520 if $cc -o try $ccflags $ldflags try.c; then
4521         gccversion=`$run ./try`
4522         case "$gccversion" in
4523         '') echo "You are not using GNU cc." ;;
4524         *)  echo "You are using GNU cc $gccversion."
4525             ccname=gcc
4526             ;;
4527         esac
4528 else
4529         echo " "
4530         echo "*** WHOA THERE!!! ***" >&4
4531         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4532         case "$knowitall" in
4533         '')
4534         echo "    You'd better start hunting for one and let me know about it." >&4
4535                 exit 1
4536                 ;;
4537         esac
4538 fi
4539 $rm -f try try.*
4540 case "$gccversion" in
4541 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4542 esac
4543 case "$gccversion" in
4544 '') gccosandvers='' ;;
4545 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4546    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4547    gccshortvers=''
4548    case "$gccosandvers" in
4549    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4550    $osname$osvers) ;; # looking good
4551    $osname*) cat <<EOM >&4
4552
4553 *** WHOA THERE!!! ***
4554
4555     Your gcc has not been compiled for the exact release of
4556     your operating system ($gccosandvers versus $osname$osvers).
4557
4558     In general it is a good idea to keep gcc synchronized with
4559     the operating system because otherwise serious problems
4560     may ensue when trying to compile software, like Perl.
4561
4562     I'm trying to be optimistic here, though, and will continue.
4563     If later during the configuration and build icky compilation
4564     problems appear (headerfile conflicts being the most common
4565     manifestation), I suggest reinstalling the gcc to match
4566     your operating system release.
4567
4568 EOM
4569       ;;
4570    *) gccosandvers='' ;; # failed to parse, better be silent
4571    esac
4572    ;;
4573 esac
4574 case "$ccname" in
4575 '') ccname="$cc" ;;
4576 esac
4577
4578 # gcc 3.* complain about adding -Idirectories that they already know about,
4579 # so we will take those off from locincpth.
4580 case "$gccversion" in
4581 3*)
4582     echo "main(){}">try.c
4583     for incdir in $locincpth; do
4584        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4585              grep '^c[cp]p*[01]: warning: changing search order '`
4586        if test "X$warn" != X; then
4587            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4588        fi
4589     done
4590     $rm -f try try.*
4591 esac
4592
4593 : What should the include directory be ?
4594 echo " "
4595 $echo $n "Hmm...  $c"
4596 dflt='/usr/include'
4597 incpath=''
4598 mips_type=''
4599 if $test -f /bin/mips && /bin/mips; then
4600         echo "Looks like a MIPS system..."
4601         $cat >usr.c <<'EOCP'
4602 #ifdef SYSTYPE_BSD43
4603 /bsd43
4604 #endif
4605 EOCP
4606         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4607                 dflt='/bsd43/usr/include'
4608                 incpath='/bsd43'
4609                 mips_type='BSD 4.3'
4610         else
4611                 mips_type='System V'
4612         fi
4613         $rm -f usr.c usr.out
4614         echo "and you're compiling with the $mips_type compiler and libraries."
4615         xxx_prompt=y
4616         echo "exit 0" >mips
4617 else
4618         echo "Doesn't look like a MIPS system."
4619         xxx_prompt=n
4620         echo "exit 1" >mips
4621 fi
4622 chmod +x mips
4623 $eunicefix mips
4624 case "$usrinc" in
4625 '') ;;
4626 *) dflt="$usrinc";;
4627 esac
4628 case "$xxx_prompt" in
4629 y)      fn=d/
4630         echo " "
4631         rp='Where are the include files you want to use?'
4632         . ./getfile
4633         usrinc="$ans"
4634         ;;
4635 *)      usrinc="$dflt"
4636         ;;
4637 esac
4638
4639 : see how we invoke the C preprocessor
4640 echo " "
4641 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4642 cat <<'EOT' >testcpp.c
4643 #define ABC abc
4644 #define XYZ xyz
4645 ABC.XYZ
4646 EOT
4647 cd ..
4648 if test ! -f cppstdin; then
4649         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4650                 # AIX cc -E doesn't show the absolute headerfile
4651                 # locations but we'll cheat by using the -M flag.
4652                 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
4653         else
4654                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4655         fi
4656 else
4657         echo "Keeping your $hint cppstdin wrapper."
4658 fi
4659 chmod 755 cppstdin
4660 wrapper=`pwd`/cppstdin
4661 ok='false'
4662 cd UU
4663
4664 if $test "X$cppstdin" != "X" && \
4665         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4666         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4667 then
4668         echo "You used to use $cppstdin $cppminus so we'll use that again."
4669         case "$cpprun" in
4670         '') echo "But let's see if we can live without a wrapper..." ;;
4671         *)
4672                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4673                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4674                 then
4675                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4676                         ok='true'
4677                 else
4678                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4679                 fi
4680                 ;;
4681         esac
4682 else
4683         case "$cppstdin" in
4684         '') ;;
4685         *)
4686                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4687                 ;;
4688         esac
4689 fi
4690
4691 if $ok; then
4692         : nothing
4693 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4694         $cc -E <testcpp.c >testcpp.out 2>&1; \
4695         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4696         echo "Yup, it does."
4697         x_cpp="$cc -E"
4698         x_minus='';
4699 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4700         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4701         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4702         echo "Yup, it does."
4703         x_cpp="$cc -E"
4704         x_minus='-';
4705 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4706         $cc -P <testcpp.c >testcpp.out 2>&1; \
4707         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4708         echo "Yipee, that works!"
4709         x_cpp="$cc -P"
4710         x_minus='';
4711 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4712         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4713         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4714         echo "At long last!"
4715         x_cpp="$cc -P"
4716         x_minus='-';
4717 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4718         $cpp <testcpp.c >testcpp.out 2>&1; \
4719         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4720         echo "It works!"
4721         x_cpp="$cpp"
4722         x_minus='';
4723 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4724         $cpp - <testcpp.c >testcpp.out 2>&1; \
4725         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4726         echo "Hooray, it works!  I was beginning to wonder."
4727         x_cpp="$cpp"
4728         x_minus='-';
4729 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4730         $wrapper <testcpp.c >testcpp.out 2>&1; \
4731         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4732         x_cpp="$wrapper"
4733         x_minus=''
4734         echo "Eureka!"
4735 else
4736         dflt=''
4737         rp="No dice.  I can't find a C preprocessor.  Name one:"
4738         . ./myread
4739         x_cpp="$ans"
4740         x_minus=''
4741         $x_cpp <testcpp.c >testcpp.out 2>&1
4742         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4743                 echo "OK, that will do." >&4
4744         else
4745 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4746                 exit 1
4747         fi
4748 fi
4749
4750 case "$ok" in
4751 false)
4752         cppstdin="$x_cpp"
4753         cppminus="$x_minus"
4754         cpprun="$x_cpp"
4755         cpplast="$x_minus"
4756         set X $x_cpp
4757         shift
4758         case "$1" in
4759         "$cpp")
4760                 echo "Perhaps can we force $cc -E using a wrapper..."
4761                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4762                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4763                 then
4764                         echo "Yup, we can."
4765                         cppstdin="$wrapper"
4766                         cppminus='';
4767                 else
4768                         echo "Nope, we'll have to live without it..."
4769                 fi
4770                 ;;
4771         esac
4772         case "$cpprun" in
4773         "$wrapper")
4774                 cpprun=''
4775                 cpplast=''
4776                 ;;
4777         esac
4778         ;;
4779 esac
4780
4781 case "$cppstdin" in
4782 "$wrapper"|'cppstdin') ;;
4783 *) $rm -f $wrapper;;
4784 esac
4785 $rm -f testcpp.c testcpp.out
4786
4787 : Set private lib path
4788 case "$plibpth" in
4789 '') if ./mips; then
4790                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4791         fi;;
4792 esac
4793 case "$libpth" in
4794 ' ') dlist='';;
4795 '') dlist="$loclibpth $plibpth $glibpth";;
4796 *) dlist="$libpth";;
4797 esac
4798
4799 : Now check and see which directories actually exist, avoiding duplicates
4800 libpth=''
4801 for xxx in $dlist
4802 do
4803     if $test -d $xxx; then
4804                 case " $libpth " in
4805                 *" $xxx "*) ;;
4806                 *) libpth="$libpth $xxx";;
4807                 esac
4808     fi
4809 done
4810 $cat <<'EOM'
4811
4812 Some systems have incompatible or broken versions of libraries.  Among
4813 the directories listed in the question below, please remove any you
4814 know not to be holding relevant libraries, and add any that are needed.
4815 Say "none" for none.
4816
4817 EOM
4818 case "$libpth" in
4819 '') dflt='none';;
4820 *)
4821         set X $libpth
4822         shift
4823         dflt=${1+"$@"}
4824         ;;
4825 esac
4826 rp="Directories to use for library searches?"
4827 . ./myread
4828 case "$ans" in
4829 none) libpth=' ';;
4830 *) libpth="$ans";;
4831 esac
4832
4833 : compute shared library extension
4834 case "$so" in
4835 '')
4836         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4837                 dflt='sl'
4838         else
4839                 dflt='so'
4840         fi
4841         ;;
4842 *) dflt="$so";;
4843 esac
4844 $cat <<EOM
4845
4846 On some systems, shared libraries may be available.  Answer 'none' if
4847 you want to suppress searching of shared libraries for the remainder
4848 of this configuration.
4849
4850 EOM
4851 rp='What is the file extension used for shared libraries?'
4852 . ./myread
4853 so="$ans"
4854
4855 : Define several unixisms.
4856 : Hints files or command line option can be used to override them.
4857 : The convoluted testing is in case hints files set either the old
4858 : or the new name.
4859 case "$_exe" in
4860 '')     case "$exe_ext" in
4861         '')     ;;
4862         *)      _exe="$exe_ext" ;;
4863         esac
4864         ;;
4865 esac
4866 case "$_a" in
4867 '')     case "$lib_ext" in
4868     '') _a='.a';;
4869         *)      _a="$lib_ext" ;;
4870         esac
4871         ;;
4872 esac
4873 case "$_o" in
4874 '') case "$obj_ext" in
4875         '')     _o='.o';;
4876         *)      _o="$obj_ext";;
4877         esac
4878         ;;
4879 esac
4880 case "$p_" in
4881 '') case "$path_sep" in
4882         '')     p_=':';;
4883         *)      p_="$path_sep";;
4884         esac
4885         ;;
4886 esac
4887 exe_ext=$_exe
4888 lib_ext=$_a
4889 obj_ext=$_o
4890 path_sep=$p_
4891
4892 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4893
4894 : Which makefile gets called first.  This is used by make depend.
4895 case "$firstmakefile" in
4896 '') firstmakefile='makefile';;
4897 esac
4898
4899 : Check for uselongdouble support
4900 case "$ccflags" in
4901 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4902 esac
4903
4904 case "$uselongdouble" in
4905 $define|true|[yY]*)     dflt='y';;
4906 *) dflt='n';;
4907 esac
4908 cat <<EOM
4909
4910 Perl can be built to take advantage of long doubles which
4911 (if available) may give more accuracy and range for floating point numbers.
4912
4913 If this doesn't make any sense to you, just accept the default '$dflt'.
4914 EOM
4915 rp='Try to use long doubles if available?'
4916 . ./myread
4917 case "$ans" in
4918 y|Y)    val="$define"   ;;
4919 *)      val="$undef"    ;;
4920 esac
4921 set uselongdouble
4922 eval $setvar
4923
4924 case "$uselongdouble" in
4925 true|[yY]*) uselongdouble="$define" ;;
4926 esac
4927
4928 : Look for a hint-file generated 'call-back-unit'.  If the
4929 : user has specified that long doubles should be used,
4930 : we may need to set or change some other defaults.
4931 if $test -f uselongdouble.cbu; then
4932     echo "Your platform has some specific hints regarding long doubles, using them..."
4933     . ./uselongdouble.cbu
4934 else
4935     case "$uselongdouble" in
4936         $define)
4937                 $cat <<EOM
4938 (Your platform does not have any specific hints for long doubles.)
4939 EOM
4940         ;;
4941     esac
4942 fi
4943
4944 : Looking for optional libraries
4945 echo " "
4946 echo "Checking for optional libraries..." >&4
4947 case "$libs" in
4948 ' '|'') dflt='';;
4949 *) dflt="$libs";;
4950 esac
4951 case "$libswanted" in
4952 '') libswanted='c_s';;
4953 esac
4954 case "$usesocks" in
4955 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4956 esac
4957 libsfound=''
4958 libsfiles=''
4959 libsdirs=''
4960 libspath=''
4961 for thisdir in $libpth $xlibpth; do
4962   test -d $thisdir && libspath="$libspath $thisdir"
4963 done
4964 for thislib in $libswanted; do
4965         for thisdir in $libspath; do
4966             xxx=''
4967             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4968                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4969                 $test -f "$xxx" && eval $libscheck
4970                 $test -f "$xxx" && libstyle=shared
4971             fi
4972             if test ! -f "$xxx"; then
4973                 xxx=$thisdir/lib$thislib.$so
4974                 $test -f "$xxx" && eval $libscheck
4975                 $test -f "$xxx" && libstyle=shared
4976             fi
4977             if test ! -f "$xxx"; then
4978                 xxx=$thisdir/lib$thislib$_a
4979                 $test -f "$xxx" && eval $libscheck
4980                 $test -f "$xxx" && libstyle=static
4981             fi
4982             if test ! -f "$xxx"; then
4983                 xxx=$thisdir/$thislib$_a
4984                 $test -f "$xxx" && eval $libscheck
4985                 $test -f "$xxx" && libstyle=static
4986             fi
4987             if test ! -f "$xxx"; then
4988                 xxx=$thisdir/lib${thislib}_s$_a
4989                 $test -f "$xxx" && eval $libscheck
4990                 $test -f "$xxx" && libstyle=static
4991                 $test -f "$xxx" && thislib=${thislib}_s
4992             fi
4993             if test ! -f "$xxx"; then
4994                 xxx=$thisdir/Slib$thislib$_a
4995                 $test -f "$xxx" && eval $libscheck
4996                 $test -f "$xxx" && libstyle=static
4997             fi
4998             if $test -f "$xxx"; then
4999                 case "$libstyle" in
5000                 shared) echo "Found -l$thislib (shared)." ;;
5001                 static) echo "Found -l$thislib." ;;
5002                 *)      echo "Found -l$thislib ($libstyle)." ;;
5003                 esac
5004                 case " $dflt " in
5005                 *"-l$thislib "*);;
5006                 *) dflt="$dflt -l$thislib"
5007                    libsfound="$libsfound $xxx"
5008                    yyy=`basename $xxx`
5009                    libsfiles="$libsfiles $yyy"
5010                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5011                    case " $libsdirs " in
5012                    *" $yyy "*) ;;
5013                    *) libsdirs="$libsdirs $yyy" ;;
5014                    esac
5015                    ;;
5016                 esac
5017                 break
5018             fi
5019         done
5020         if $test ! -f "$xxx"; then
5021             echo "No -l$thislib."
5022         fi
5023 done
5024 set X $dflt
5025 shift
5026 dflt="$*"
5027 case "$libs" in
5028 '') dflt="$dflt";;
5029 *) dflt="$libs";;
5030 esac
5031 case "$dflt" in
5032 ' '|'') dflt='none';;
5033 esac
5034
5035 $cat <<EOM
5036
5037 In order to compile $package on your machine, a number of libraries
5038 are usually needed.  Include any other special libraries here as well.
5039 Say "none" for none.  The default list is almost always right.
5040 EOM
5041
5042 echo " "
5043 rp="What libraries to use?"
5044 . ./myread
5045 case "$ans" in
5046 none) libs=' ';;
5047 *) libs="$ans";;
5048 esac
5049
5050 : determine optimization, if desired, or use for debug flag also
5051 case "$optimize" in
5052 ' '|$undef) dflt='none';;
5053 '') dflt='-O';;
5054 *) dflt="$optimize";;
5055 esac
5056 $cat <<EOH
5057
5058 By default, $package compiles with the -O flag to use the optimizer.
5059 Alternately, you might want to use the symbolic debugger, which uses
5060 the -g flag (on traditional Unix systems).  Either flag can be
5061 specified here.  To use neither flag, specify the word "none".
5062
5063 EOH
5064 rp="What optimizer/debugger flag should be used?"
5065 . ./myread
5066 optimize="$ans"
5067 case "$optimize" in
5068 'none') optimize=" ";;
5069 esac
5070
5071 : Check what DEBUGGING is required from the command line
5072 : -DEBUGGING      or -DDEBUGGING or
5073 : -DEBUGGING=both                       = -g + -DDEBUGGING
5074 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5075 : -DEBUGGING=none or -UDEBUGGING        =
5076 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5077 case "$EBUGGING" in
5078 '')     ;;
5079 *)      DEBUGGING=$EBUGGING ;;
5080 esac
5081
5082 case "$DEBUGGING" in
5083 -g|both|$define)
5084     case "$optimize" in
5085         *-g*) ;;
5086         *)    optimize="$optimize -g" ;;
5087     esac ;;
5088 none|$undef)
5089     case "$optimize" in
5090         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5091                 shift
5092                 optimize="$*"
5093                 ;;
5094     esac ;;
5095 esac
5096
5097 dflt=''
5098 case "$DEBUGGING" in
5099 both|$define) dflt='-DDEBUGGING'
5100 esac
5101
5102 : argument order is deliberate, as the flag will start with - which set could
5103 : think is an option
5104 checkccflag='check=$1; flag=$2; callback=$3;
5105 echo " ";
5106 echo "Checking if your compiler accepts $flag" 2>&1;
5107 echo "int main(void) { return 0; }" > gcctest.c;
5108 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5109     echo "Yes, it does." 2>&1;
5110     if $test -s gcctest.out ; then
5111         echo "But your platform does not like it:";
5112         cat gcctest.out;
5113     else
5114         case "$ccflags" in
5115         *$check*)
5116             echo "Leaving current flags $ccflags alone." 2>&1
5117             ;;
5118         *) dflt="$dflt $flag";
5119             eval $callback
5120             ;;
5121         esac
5122     fi
5123 else
5124     echo "Nope, it does not, but that is ok." 2>&1;
5125 fi
5126 '
5127
5128 : We will not override a previous value, but we might want to
5129 : augment a hint file
5130 case "$hint" in
5131 default|recommended)
5132         case "$gccversion" in
5133         1*) dflt="$dflt -fpcc-struct-return" ;;
5134         esac
5135         case "$optimize:$DEBUGGING" in
5136         *-g*:old) dflt="$dflt -DDEBUGGING";;
5137         esac
5138         case "$gccversion" in
5139         2*) if $test -d /etc/conf/kconfig.d &&
5140                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5141                 then
5142                         # Interactive Systems (ISC) POSIX mode.
5143                         dflt="$dflt -posix"
5144                 fi
5145                 ;;
5146         esac
5147         case "$gccversion" in
5148         1*) ;;
5149         2.[0-8]*) ;;
5150         ?*)     set strict-aliasing -fno-strict-aliasing
5151                 eval $checkccflag
5152                 ;;
5153         esac
5154         # For gcc, adding -pipe speeds up compilations for some, but apparently
5155         # some assemblers can't read from stdin.  (It also slows down compilations
5156         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5157         case "$gccversion" in
5158         ?*)     set pipe -pipe
5159                 eval $checkccflag
5160                 ;;
5161         esac
5162
5163         # on x86_64 (at least) we require an extra library (libssp) in the
5164         # link command line. This library is not named, so I infer that it is
5165         # an implementation detail that may change. Hence the safest approach
5166         # is to add the flag to the flags passed to the compiler at link time,
5167         # as that way the compiler can do the right implementation dependant
5168         # thing. (NWC)
5169         case "$gccversion" in
5170         ?*)     set stack-protector -fstack-protector
5171                 eval $checkccflag
5172                 ;;
5173         esac
5174         ;;
5175 esac
5176
5177 case "$mips_type" in
5178 *BSD*|'') inclwanted="$locincpth $usrinc";;
5179 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5180 esac
5181 for thisincl in $inclwanted; do
5182         if $test -d $thisincl; then
5183                 if $test x$thisincl != x$usrinc; then
5184                         case "$dflt" in
5185                         *" -I$thisincl "*);;
5186                         *) dflt="$dflt -I$thisincl ";;
5187                         esac
5188                 fi
5189         fi
5190 done
5191
5192 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5193         xxx=true;
5194 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5195         xxx=true;
5196 else
5197         xxx=false;
5198 fi;
5199 if $xxx; then
5200         case "$dflt" in
5201         *$2*);;
5202         *) dflt="$dflt -D$2";;
5203         esac;
5204 fi'
5205
5206 set signal.h LANGUAGE_C; eval $inctest
5207
5208 case "$usesocks" in
5209 $define)
5210         ccflags="$ccflags -DSOCKS"
5211         ;;
5212 esac
5213
5214 case "$hint" in
5215 default|recommended) dflt="$ccflags $dflt" ;;
5216 *) dflt="$ccflags";;
5217 esac
5218
5219 case "$dflt" in
5220 ''|' ') dflt=none;;
5221 esac
5222
5223 $cat <<EOH
5224
5225 Your C compiler may want other flags.  For this question you should include
5226 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5227 but you should NOT include libraries or ld flags like -lwhatever.  If you
5228 want $package to honor its debug switch, you should include -DDEBUGGING here.
5229 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5230
5231 To use no flags, specify the word "none".
5232
5233 EOH
5234 set X $dflt
5235 shift
5236 dflt=${1+"$@"}
5237 rp="Any additional cc flags?"
5238 . ./myread
5239 case "$ans" in
5240 none) ccflags='';;
5241 *) ccflags="$ans";;
5242 esac
5243
5244 : the following weeds options from ccflags that are of no interest to cpp
5245 case "$cppflags" in
5246 '') cppflags="$ccflags" ;;
5247 *)  cppflags="$cppflags $ccflags" ;;
5248 esac
5249 case "$gccversion" in
5250 1*) cppflags="$cppflags -D__GNUC__"
5251 esac
5252 case "$mips_type" in
5253 '');;
5254 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5255 esac
5256 case "$cppflags" in
5257 '');;
5258 *)
5259         echo " "
5260         echo "Let me guess what the preprocessor flags are..." >&4
5261         set X $cppflags
5262         shift
5263         cppflags=''
5264         $cat >cpp.c <<'EOM'
5265 #define BLURFL foo
5266
5267 BLURFL xx LFRULB
5268 EOM
5269         previous=''
5270         for flag in $*
5271         do
5272                 case "$flag" in
5273                 -*) ftry="$flag";;
5274                 *) ftry="$previous $flag";;
5275                 esac
5276                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5277                         >cpp1.out 2>/dev/null && \
5278                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5279                         >cpp2.out 2>/dev/null && \
5280                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5281                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5282                 then
5283                         cppflags="$cppflags $ftry"
5284                         previous=''
5285                 else
5286                         previous="$flag"
5287                 fi
5288         done
5289         set X $cppflags
5290         shift
5291         cppflags=${1+"$@"}
5292         case "$cppflags" in
5293         *-*)  echo "They appear to be: $cppflags";;
5294         esac
5295         $rm -f cpp.c cpp?.out
5296         ;;
5297 esac
5298
5299 : flags used in final linking phase
5300 case "$ldflags" in
5301 '') if ./venix; then
5302                 dflt='-i -z'
5303         else
5304                 dflt=''
5305         fi
5306         case "$ccflags" in
5307         *-posix*) dflt="$dflt -posix" ;;
5308         esac
5309         ;;
5310 *) dflt="$ldflags";;
5311 esac
5312 # See note above about -fstack-protector
5313 case "$ccflags" in
5314 *-fstack-protector*) 
5315         case "$dflt" in
5316         *-fstack-protector*) ;; # Don't add it again
5317         *) dflt="$dflt -fstack-protector" ;; 
5318         esac
5319         ;;
5320 esac
5321
5322 : Try to guess additional flags to pick up local libraries.
5323 for thislibdir in $libpth; do
5324         case " $loclibpth " in
5325         *" $thislibdir "*)
5326                 case "$dflt " in
5327                 *"-L$thislibdir "*) ;;
5328                 *)  dflt="$dflt -L$thislibdir" ;;
5329                 esac
5330                 ;;
5331         esac
5332 done
5333
5334 case "$dflt" in
5335 '') dflt='none' ;;
5336 esac
5337
5338 $cat <<EOH
5339
5340 Your C linker may need flags.  For this question you should
5341 include -L/whatever and any other flags used by the C linker, but you
5342 should NOT include libraries like -lwhatever.
5343
5344 Make sure you include the appropriate -L/path flags if your C linker
5345 does not normally search all of the directories you specified above,
5346 namely
5347         $libpth
5348 To use no flags, specify the word "none".
5349
5350 EOH
5351
5352 rp="Any additional ld flags (NOT including libraries)?"
5353 . ./myread
5354 case "$ans" in
5355 none) ldflags='';;
5356 *) ldflags="$ans";;
5357 esac
5358 rmlist="$rmlist pdp11"
5359
5360 : coherency check
5361 echo " "
5362 echo "Checking your choice of C compiler and flags for coherency..." >&4
5363 $cat > try.c <<'EOF'
5364 #include <stdio.h>
5365 int main() { printf("Ok\n"); return(0); }
5366 EOF
5367 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5368 shift
5369 $cat >try.msg <<'EOM'
5370 I've tried to compile and run the following simple program:
5371
5372 EOM
5373 $cat try.c >> try.msg
5374
5375 $cat >> try.msg <<EOM
5376
5377 I used the command:
5378
5379         $*
5380         $run ./try
5381
5382 and I got the following output:
5383
5384 EOM
5385 dflt=y
5386 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5387         if $sh -c "$run ./try " >>try.msg 2>&1; then
5388                 xxx=`$run ./try`
5389                 case "$xxx" in
5390                 "Ok") dflt=n ;;
5391                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5392                         case " $libs " in
5393                         *" -lsfio "*)
5394                                 cat >> try.msg <<'EOQS'
5395 If $libs contains -lsfio, and sfio is mis-configured, then it
5396 sometimes (apparently) runs and exits with a 0 status, but with no
5397 output!  It may have to do with sfio's use of _exit vs. exit.
5398
5399 EOQS
5400                                 rp="You have a big problem.  Shall I abort Configure"
5401                                 dflt=y
5402                                 ;;
5403                         esac
5404                         ;;
5405                 esac
5406         else
5407                 echo "The program compiled OK, but exited with status $?." >>try.msg
5408                 rp="You have a problem.  Shall I abort Configure"
5409                 dflt=y
5410         fi
5411 else
5412         echo "I can't compile the test program." >>try.msg
5413         rp="You have a BIG problem.  Shall I abort Configure"
5414         dflt=y
5415 fi
5416 case "$dflt" in
5417 y)
5418         $cat try.msg >&4
5419         case "$knowitall" in
5420         '')
5421                 echo "(The supplied flags or libraries might be incorrect.)"
5422                 ;;
5423         *) dflt=n;;
5424         esac
5425         echo " "
5426         . ./myread
5427         case "$ans" in
5428         n*|N*) ;;
5429         *)      echo "Ok.  Stopping Configure." >&4
5430                 exit 1
5431                 ;;
5432         esac
5433         ;;
5434 n) echo "OK, that should do.";;
5435 esac
5436 $rm_try gcctest gcctest.out
5437
5438 : define a shorthand compile call
5439 compile='
5440 mc_file=$1;
5441 shift;
5442 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5443 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5444 exit 1;
5445 fi;
5446 esac;
5447 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5448 : define a shorthand compile call for compilations that should be ok.
5449 compile_ok='
5450 mc_file=$1;
5451 shift;
5452 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5453
5454 : determine filename position in cpp output
5455 echo " "
5456 echo "Computing filename position in cpp output for #include directives..." >&4
5457 case "$osname" in
5458 vos) testaccess=-e ;;
5459 *)   testaccess=-r ;;
5460 esac
5461 echo '#include <stdio.h>' > foo.c
5462 $cat >fieldn <<EOF
5463 $startsh
5464 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5465 $grep '^[       ]*#.*stdio\.h' | \
5466 while read cline; do
5467         pos=1
5468         set \$cline
5469         while $test \$# -gt 0; do
5470                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5471                         echo "\$pos"
5472                         exit 0
5473                 fi
5474                 shift
5475                 pos=\`expr \$pos + 1\`
5476         done
5477 done
5478 EOF
5479 chmod +x fieldn
5480 fieldn=`./fieldn`
5481 $rm -f foo.c fieldn
5482 case $fieldn in
5483 '') pos='???';;
5484 1) pos=first;;
5485 2) pos=second;;
5486 3) pos=third;;
5487 *) pos="${fieldn}th";;
5488 esac
5489 echo "Your cpp writes the filename in the $pos field of the line."
5490
5491 case "$osname" in
5492 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5493 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5494 *)   cppfilter='' ;;
5495 esac
5496 : locate header file
5497 $cat >findhdr <<EOF
5498 $startsh
5499 wanted=\$1
5500 name=''
5501 for usrincdir in $usrinc
5502 do
5503         if test -f \$usrincdir/\$wanted; then
5504                 echo "\$usrincdir/\$wanted"
5505                 exit 0
5506         fi
5507 done
5508 awkprg='{ print \$$fieldn }'
5509 echo "#include <\$wanted>" > foo\$\$.c
5510 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5511 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5512 while read cline; do
5513         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5514         case "\$name" in
5515         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5516         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5517         *) exit 2;;
5518         esac;
5519 done;
5520 #
5521 # status = 0: grep returned 0 lines, case statement not executed
5522 # status = 1: headerfile found
5523 # status = 2: while loop executed, no headerfile found
5524 #
5525 status=\$?
5526 $rm -f foo\$\$.c;
5527 if test \$status -eq 1; then
5528         exit 0;
5529 fi
5530 exit 1
5531 EOF
5532 chmod +x findhdr
5533
5534 : define an alternate in-header-list? function
5535 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5536 cont=true; xxf="echo \"<\$1> found.\" >&4";
5537 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5538 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5539 esac;
5540 case $# in 4) instead=instead;; *) instead="at last";; esac;
5541 while $test "$cont"; do
5542         xxx=`./findhdr $1`
5543         var=$2; eval "was=\$$2";
5544         if $test "$xxx" && $test -r "$xxx";
5545         then eval $xxf;
5546         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5547                 cont="";
5548         else eval $xxnf;
5549         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5550         set $yyy; shift; shift; yyy=$@;
5551         case $# in 0) cont="";;
5552         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5553                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5554         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5555                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5556         esac;
5557 done;
5558 while $test "$yyy";
5559 do set $yyy; var=$2; eval "was=\$$2";
5560         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5561         set $yyy; shift; shift; yyy=$@;
5562 done'
5563
5564 : see if stdlib is available
5565 set stdlib.h i_stdlib
5566 eval $inhdr
5567
5568 : check for lengths of integral types
5569 echo " "
5570 case "$intsize" in
5571 '')
5572         echo "Checking to see how big your integers are..." >&4
5573         $cat >try.c <<EOCP
5574 #include <stdio.h>
5575 #$i_stdlib I_STDLIB
5576 #ifdef I_STDLIB
5577 #include <stdlib.h>
5578 #endif
5579 int main()
5580 {
5581         printf("intsize=%d;\n", (int)sizeof(int));
5582         printf("longsize=%d;\n", (int)sizeof(long));
5583         printf("shortsize=%d;\n", (int)sizeof(short));
5584         exit(0);
5585 }
5586 EOCP
5587         set try
5588         if eval $compile_ok && $run ./try > /dev/null; then
5589                 eval `$run ./try`
5590                 echo "Your integers are $intsize bytes long."
5591                 echo "Your long integers are $longsize bytes long."
5592                 echo "Your short integers are $shortsize bytes long."
5593         else
5594                 $cat >&4 <<EOM
5595 !
5596 Help! I can't compile and run the intsize test program: please enlighten me!
5597 (This is probably a misconfiguration in your system or libraries, and
5598 you really ought to fix it.  Still, I'll try anyway.)
5599 !
5600 EOM
5601                 dflt=4
5602                 rp="What is the size of an integer (in bytes)?"
5603                 . ./myread
5604                 intsize="$ans"
5605                 dflt=$intsize
5606                 rp="What is the size of a long integer (in bytes)?"
5607                 . ./myread
5608                 longsize="$ans"
5609                 dflt=2
5610                 rp="What is the size of a short integer (in bytes)?"
5611                 . ./myread
5612                 shortsize="$ans"
5613         fi
5614         ;;
5615 esac
5616 $rm_try
5617
5618 : check for long long
5619 echo " "
5620 echo "Checking to see if you have long long..." >&4
5621 echo 'int main() { long long x = 7; return 0; }' > try.c
5622 set try
5623 if eval $compile; then
5624         val="$define"
5625         echo "You have long long."
5626 else
5627         val="$undef"
5628         echo "You do not have long long."
5629 fi
5630 $rm_try
5631 set d_longlong
5632 eval $setvar
5633
5634 : check for length of long long
5635 case "${d_longlong}${longlongsize}" in
5636 $define)
5637         echo " "
5638         echo "Checking to see how big your long longs are..." >&4
5639         $cat >try.c <<'EOCP'
5640 #include <stdio.h>
5641 int main()
5642 {
5643     printf("%d\n", (int)sizeof(long long));
5644     return(0);
5645 }
5646 EOCP
5647         set try
5648         if eval $compile_ok; then
5649                 longlongsize=`$run ./try`
5650                 echo "Your long longs are $longlongsize bytes long."
5651         else
5652                 dflt='8'
5653                 echo " "
5654                 echo "(I can't seem to compile the test program.  Guessing...)"
5655                 rp="What is the size of a long long (in bytes)?"
5656                 . ./myread
5657                 longlongsize="$ans"
5658         fi
5659         if $test "X$longsize" = "X$longlongsize"; then
5660                 echo "(That isn't any different from an ordinary long.)"
5661         fi
5662         ;;
5663 esac
5664 $rm_try
5665
5666 : see if inttypes.h is available
5667 : we want a real compile instead of Inhdr because some systems
5668 : have an inttypes.h which includes non-existent headers
5669 echo " "
5670 $cat >try.c <<EOCP
5671 #include <inttypes.h>
5672 int main() {
5673         static int32_t foo32 = 0x12345678;
5674 }
5675 EOCP
5676 set try
5677 if eval $compile; then
5678         echo "<inttypes.h> found." >&4
5679         val="$define"
5680 else
5681         echo "<inttypes.h> NOT found." >&4
5682         val="$undef"
5683 fi
5684 $rm_try
5685 set i_inttypes
5686 eval $setvar
5687
5688 : check for int64_t
5689 echo " "
5690 echo "Checking to see if you have int64_t..." >&4
5691 $cat >try.c <<EOCP
5692 #include <sys/types.h>
5693 #$i_inttypes I_INTTYPES
5694 #ifdef I_INTTYPES
5695 #include <inttypes.h>
5696 #endif
5697 int main() { int64_t x = 7; }
5698 EOCP
5699 set try
5700 if eval $compile; then
5701         val="$define"
5702         echo "You have int64_t."
5703 else
5704         val="$undef"
5705         echo "You do not have int64_t."
5706 fi
5707 $rm_try
5708 set d_int64_t
5709 eval $setvar
5710
5711 : Check if 64bit ints have a quad type
5712 echo " "
5713 echo "Checking which 64-bit integer type we could use..." >&4
5714
5715 case "$intsize" in
5716 8) val=int
5717    set quadtype
5718    eval $setvar
5719    val='"unsigned int"'
5720    set uquadtype
5721    eval $setvar
5722    quadkind=1
5723    ;;
5724 *) case "$longsize" in
5725    8) val=long
5726       set quadtype
5727       eval $setvar
5728       val='"unsigned long"'
5729       set uquadtype
5730       eval $setvar
5731       quadkind=2
5732       ;;
5733    *) case "$d_longlong:$longlongsize" in
5734       define:8)
5735         val='"long long"'
5736         set quadtype
5737         eval $setvar
5738         val='"unsigned long long"'
5739         set uquadtype
5740         eval $setvar
5741         quadkind=3
5742         ;;
5743       *) case "$d_int64_t" in
5744          define)
5745            val=int64_t
5746            set quadtype
5747            eval $setvar
5748            val=uint64_t
5749            set uquadtype
5750            eval $setvar
5751            quadkind=4
5752            ;;
5753          esac
5754          ;;
5755       esac
5756       ;;
5757    esac
5758    ;;
5759 esac
5760
5761 case "$quadtype" in
5762 '')     echo "Alas, no 64-bit integer types in sight." >&4
5763         d_quad="$undef"
5764         ;;
5765 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5766         d_quad="$define"
5767         ;;
5768 esac
5769
5770 : Do we want 64bit support
5771 case "$uselonglong" in
5772 "$define"|true|[yY]*)
5773         cat <<EOM >&4
5774
5775 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5776 EOM
5777         use64bitint="$define"
5778         ;;
5779 esac
5780 case "$use64bits" in
5781 "$define"|true|[yY]*)
5782         cat <<EOM >&4
5783
5784 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5785 EOM
5786         use64bitint="$define"
5787         ;;
5788 esac
5789 case "$use64bitints" in
5790 "$define"|true|[yY]*)
5791         cat <<EOM >&4
5792
5793 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5794 EOM
5795         use64bitint="$define"
5796         ;;
5797 esac
5798 case "$use64bitsint" in
5799 "$define"|true|[yY]*)
5800         cat <<EOM >&4
5801
5802 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5803 EOM
5804         use64bitint="$define"
5805         ;;
5806 esac
5807 case "$uselonglongs" in
5808 "$define"|true|[yY]*)
5809         cat <<EOM >&4
5810
5811 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5812 EOM
5813         use64bitint="$define"
5814         ;;
5815 esac
5816 case "$use64bitsall" in
5817 "$define"|true|[yY]*)
5818         cat <<EOM >&4
5819
5820 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5821 EOM
5822         use64bitall="$define"
5823         ;;
5824 esac
5825
5826 case "$ccflags" in
5827 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5828 esac
5829 case "$use64bitall" in
5830 "$define"|true|[yY]*) use64bitint="$define" ;;
5831 esac
5832
5833 case "$longsize" in
5834 8) cat <<EOM
5835
5836 You have natively 64-bit long integers.
5837 EOM
5838    val="$define"
5839    ;;
5840 *) case "$use64bitint" in
5841    "$define"|true|[yY]*) dflt='y';;
5842    *) dflt='n';;
5843    esac
5844    case "$d_quad" in
5845    "$define") ;;
5846    *) dflt='n' ;;
5847    esac
5848    cat <<EOM
5849
5850 Perl can be built to take advantage of 64-bit integer types
5851 on some systems.  To do so, Configure can be run with -Duse64bitint.
5852 Choosing this option will most probably introduce binary incompatibilities.
5853
5854 If this doesn't make any sense to you, just accept the default '$dflt'.
5855 (The default has been chosen based on your configuration.)
5856 EOM
5857    rp='Try to use 64-bit integers, if available?'
5858    . ./myread
5859    case "$ans" in
5860    [yY]*) val="$define" ;;
5861    *)     val="$undef"  ;;
5862    esac
5863    ;;
5864 esac
5865 set use64bitint
5866 eval $setvar
5867
5868 case "$use64bitall" in
5869 "$define"|true|[yY]*) dflt='y' ;;
5870 *) case "$longsize" in
5871    8) dflt='y' ;;
5872    *) dflt='n' ;;
5873    esac
5874    ;;
5875 esac
5876 cat <<EOM
5877
5878 You may also choose to try maximal 64-bitness.  It means using as much
5879 64-bitness as possible on the platform.  This in turn means even more
5880 binary incompatibilities.  On the other hand, your platform may not
5881 have any more 64-bitness available than what you already have chosen.
5882
5883 If this doesn't make any sense to you, just accept the default '$dflt'.
5884 (The default has been chosen based on your configuration.)
5885 EOM
5886 rp='Try to use maximal 64-bit support, if available?'
5887 . ./myread
5888 case "$ans" in
5889 [yY]*) val="$define" ;;
5890 *)     val="$undef"  ;;
5891 esac
5892 set use64bitall
5893 eval $setvar
5894 case "$use64bitall" in
5895 "$define")
5896         case "$use64bitint" in
5897         "$undef")
5898                 cat <<EOM
5899
5900 Since you have chosen a maximally 64-bit build, I'm also turning on
5901 the use of 64-bit integers.
5902 EOM
5903                 use64bitint="$define" ;;
5904         esac
5905         ;;
5906 esac
5907
5908 : Look for a hint-file generated 'call-back-unit'.  If the
5909 : user has specified that a 64-bit perl is to be built,
5910 : we may need to set or change some other defaults.
5911 if $test -f use64bitint.cbu; then
5912         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5913         . ./use64bitint.cbu
5914 fi
5915 case "$use64bitint" in
5916 "$define"|true|[yY]*)
5917         case "$longsize" in
5918         4) case "$archname64" in
5919            '') archname64=64int ;;
5920            esac
5921            ;;
5922         esac
5923         ;;
5924 esac
5925
5926 : Look for a hint-file generated 'call-back-unit'.  If the
5927 : user has specified that a maximally 64-bit perl is to be built,
5928 : we may need to set or change some other defaults.
5929 if $test -f use64bitall.cbu; then
5930         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5931         . ./use64bitall.cbu
5932 fi
5933 case "$use64bitall" in
5934 "$define"|true|[yY]*)
5935         case "$longsize" in
5936         4) case "$archname64" in
5937            ''|64int) archname64=64all ;;
5938            esac
5939            ;;
5940         esac
5941         ;;
5942 esac
5943
5944 case "$d_quad:$use64bitint" in
5945 $undef:$define)
5946         cat >&4 <<EOF
5947
5948 *** You have chosen to use 64-bit integers,
5949 *** but none can be found.
5950 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5951 *** Cannot continue, aborting.
5952
5953 EOF
5954         exit 1
5955         ;;
5956 esac
5957
5958 : check for length of double
5959 echo " "
5960 case "$doublesize" in
5961 '')
5962         echo "Checking to see how big your double precision numbers are..." >&4
5963         $cat >try.c <<EOCP
5964 #include <stdio.h>
5965 #$i_stdlib I_STDLIB
5966 #ifdef I_STDLIB
5967 #include <stdlib.h>
5968 #endif
5969 int main()
5970 {
5971     printf("%d\n", (int)sizeof(double));
5972     exit(0);
5973 }
5974 EOCP
5975         set try
5976         if eval $compile_ok; then
5977                 doublesize=`$run ./try`
5978                 echo "Your double is $doublesize bytes long."
5979         else
5980                 dflt='8'
5981                 echo "(I can't seem to compile the test program.  Guessing...)"
5982                 rp="What is the size of a double precision number (in bytes)?"
5983                 . ./myread
5984                 doublesize="$ans"
5985         fi
5986         ;;
5987 esac
5988 $rm_try
5989
5990 : check for long doubles
5991 echo " "
5992 echo "Checking to see if you have long double..." >&4
5993 echo 'int main() { long double x = 7.0; }' > try.c
5994 set try
5995 if eval $compile; then
5996         val="$define"
5997         echo "You have long double."
5998 else
5999         val="$undef"
6000         echo "You do not have long double."
6001 fi
6002 $rm_try
6003 set d_longdbl
6004 eval $setvar
6005
6006 : check for length of long double
6007 case "${d_longdbl}${longdblsize}" in
6008 $define)
6009         echo " "
6010         echo "Checking to see how big your long doubles are..." >&4
6011         $cat >try.c <<'EOCP'
6012 #include <stdio.h>
6013 int main()
6014 {
6015         printf("%d\n", sizeof(long double));
6016 }
6017 EOCP
6018         set try
6019         set try
6020         if eval $compile; then
6021                 longdblsize=`$run ./try`
6022                 echo "Your long doubles are $longdblsize bytes long."
6023         else
6024                 dflt='8'
6025                 echo " "
6026                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6027                 rp="What is the size of a long double (in bytes)?"
6028                 . ./myread
6029                 longdblsize="$ans"
6030         fi
6031         if $test "X$doublesize" = "X$longdblsize"; then
6032                 echo "That isn't any different from an ordinary double."
6033                 echo "I'll keep your setting anyway, but you may see some"
6034                 echo "harmless compilation warnings."
6035         fi
6036         ;;
6037 esac
6038 $rm_try
6039
6040 : determine the architecture name
6041 echo " "
6042 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6043         tarch=`arch`"-$osname"
6044 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6045         if uname -m > tmparch 2>&1 ; then
6046                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6047                         -e 's/$/'"-$osname/" tmparch`
6048         else
6049                 tarch="$osname"
6050         fi
6051         $rm -f tmparch
6052 else
6053         tarch="$osname"
6054 fi
6055 case "$myarchname" in
6056 ''|"$tarch") ;;
6057 *)
6058         echo "(Your architecture name used to be $myarchname.)"
6059         archname=''
6060         ;;
6061 esac
6062 case "$targetarch" in
6063 '') ;;
6064 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6065 esac
6066 myarchname="$tarch"
6067 case "$archname" in
6068 '') dflt="$tarch";;
6069 *) dflt="$archname";;
6070 esac
6071 rp='What is your architecture name'
6072 . ./myread
6073 archname="$ans"
6074 case "$usethreads" in
6075 $define)
6076         echo "Threads selected." >&4
6077         case "$archname" in
6078         *-thread*) echo "...and architecture name already has -thread." >&4
6079                 ;;
6080         *)      archname="$archname-thread"
6081                 echo "...setting architecture name to $archname." >&4
6082                 ;;
6083         esac
6084         ;;
6085 esac
6086 case "$usemultiplicity" in
6087 $define)
6088         echo "Multiplicity selected." >&4
6089         case "$archname" in
6090         *-multi*) echo "...and architecture name already has -multi." >&4
6091                 ;;
6092         *)      archname="$archname-multi"
6093                 echo "...setting architecture name to $archname." >&4
6094                 ;;
6095         esac
6096         ;;
6097 esac
6098 case "$use64bitint$use64bitall" in
6099 *"$define"*)
6100         case "$archname64" in
6101         '')
6102                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6103                 ;;
6104         *)
6105                 case "$use64bitint" in
6106                 "$define") echo "64 bit integers selected." >&4 ;;
6107                 esac
6108                 case "$use64bitall" in
6109                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6110                 esac
6111                 case "$archname" in
6112                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6113                         ;;
6114                 *)      archname="$archname-$archname64"
6115                         echo "...setting architecture name to $archname." >&4
6116                         ;;
6117                 esac
6118                 ;;
6119         esac
6120 esac
6121 case "$uselongdouble" in
6122 $define)
6123         echo "Long doubles selected." >&4
6124         case "$longdblsize" in
6125         $doublesize)
6126                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6127                 ;;
6128         *)
6129                 case "$archname" in
6130                 *-ld*) echo "...and architecture name already has -ld." >&4
6131                         ;;
6132                 *)      archname="$archname-ld"
6133                         echo "...setting architecture name to $archname." >&4
6134                         ;;
6135                 esac
6136                 ;;
6137         esac
6138         ;;
6139 esac
6140 case "$useperlio" in
6141 $define)
6142         echo "Perlio selected." >&4
6143         ;;
6144 *)
6145         echo "Perlio not selected, using stdio." >&4
6146         case "$archname" in
6147         *-stdio*) echo "...and architecture name already has -stdio." >&4
6148                 ;;
6149         *)      archname="$archname-stdio"
6150                 echo "...setting architecture name to $archname." >&4
6151                 ;;
6152         esac
6153         ;;
6154 esac
6155 if $test -f archname.cbu; then
6156         echo "Your platform has some specific hints for architecture name, using them..."
6157         . ./archname.cbu
6158 fi
6159
6160 : set the prefixit variable, to compute a suitable default value
6161 prefixit='case "$3" in
6162 ""|none)
6163         case "$oldprefix" in
6164         "") eval "$1=\"\$$2\"";;
6165         *)
6166                 case "$3" in
6167                 "") eval "$1=";;
6168                 none)
6169                         eval "tp=\"\$$2\"";
6170                         case "$tp" in
6171                         ""|" ") eval "$1=\"\$$2\"";;
6172                         *) eval "$1=";;
6173                         esac;;
6174                 esac;;
6175         esac;;
6176 *)
6177         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6178         case "$tp" in
6179         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6180         /*-$oldprefix/*|\~*-$oldprefix/*)
6181                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6182         *) eval "$1=\"\$$2\"";;
6183         esac;;
6184 esac'
6185
6186 : determine installation style
6187 : For now, try to deduce it from prefix unless it is already set.
6188 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6189 case "$installstyle" in
6190 '')     case "$prefix" in
6191                 *perl*) dflt='lib';;
6192                 *) dflt='lib/perl5' ;;
6193         esac
6194         ;;
6195 *)      dflt="$installstyle" ;;
6196 esac
6197 : Probably not worth prompting for this since we prompt for all
6198 : the directories individually, and the prompt would be too long and
6199 : confusing anyway.
6200 installstyle=$dflt
6201
6202 : determine where public executables go
6203 echo " "
6204 set dflt bin bin
6205 eval $prefixit
6206 fn=d~
6207 rp='Pathname where the public executables will reside?'
6208 . ./getfile
6209 if $test "X$ansexp" != "X$binexp"; then
6210         installbin=''
6211 fi
6212 prefixvar=bin
6213 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6214 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6215 :     this via initialinstalllocation
6216 . ./setprefixvar
6217
6218 case "$userelocatableinc" in
6219 $define|true|[yY]*)     dflt='y' ;;
6220 *)                      dflt='n' ;;
6221 esac
6222 cat <<EOM
6223
6224 Would you like to build Perl so that the installation is relocatable, so that
6225 library paths in @INC are determined relative to the path of the perl binary?
6226 This is not advised for system Perl installs, or if you need to run setid
6227 scripts or scripts under taint mode.
6228
6229 If this doesn't make any sense to you, just accept the default '$dflt'.
6230 EOM
6231 rp='Use relocatable @INC?'
6232 . ./myread
6233 case "$ans" in
6234 y|Y)    val="$define" ;;
6235 *)      val="$undef"  ;;
6236 esac
6237 set userelocatableinc
6238 eval $setvar
6239
6240 initialinstalllocation="$binexp"
6241 : Default prefix is now "up one level from where the binaries are"
6242 case "$userelocatableinc" in
6243 $define|true|[yY]*)
6244     bin=".../"
6245     binexp=".../"
6246     prefix=".../.."
6247     prefixexp=".../.."
6248     installprefixexp=".../.."
6249     ;;
6250 esac
6251
6252 : determine where private library files go
6253 : Usual default is /usr/local/lib/perl5/$version.
6254 : Also allow things like /opt/perl/lib/$version, since
6255 : /opt/perl/lib/perl5... would be redundant.
6256 : The default "style" setting is made in installstyle.U
6257 case "$installstyle" in
6258 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6259 *)       set dflt privlib lib/$version ;;
6260 esac
6261 eval $prefixit
6262 $cat <<EOM
6263
6264 There are some auxiliary files for $package that need to be put into a
6265 private library directory that is accessible by everyone.
6266
6267 EOM
6268 fn=$binexp
6269 fn=d~+
6270 rp='Pathname where the private library files will reside?'
6271 . ./getfile
6272 prefixvar=privlib
6273 . ./setprefixvar
6274
6275 : set the prefixup variable, to restore leading tilda escape
6276 prefixup='case "$prefixexp" in
6277 "$prefix") ;;
6278 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6279 esac'
6280
6281 : determine where public architecture dependent libraries go
6282 set archlib archlib
6283 eval $prefixit
6284 : privlib default is /usr/local/lib/$package/$version
6285 : archlib default is /usr/local/lib/$package/$version/$archname
6286 : privlib may have an optional trailing /share.
6287 tdflt=`echo $privlib | $sed 's,/share$,,'`
6288 tdflt=$tdflt/$archname
6289 case "$archlib" in
6290 '')     dflt=$tdflt
6291         ;;
6292 *)      dflt="$archlib"
6293     ;;
6294 esac
6295 $cat <<EOM
6296
6297 $spackage contains architecture-dependent library files.  If you are
6298 sharing libraries in a heterogeneous environment, you might store
6299 these files in a separate location.  Otherwise, you can just include
6300 them with the rest of the public library files.
6301
6302 EOM
6303 fn=$binexp
6304 fn=d+~
6305 rp='Where do you want to put the public architecture-dependent libraries?'
6306 . ./getfile
6307 prefixvar=archlib
6308 . ./setprefixvar
6309 if $test X"$archlib" = X"$privlib"; then
6310         d_archlib="$undef"
6311 else
6312         d_archlib="$define"
6313 fi
6314
6315 : see if setuid scripts can be secure
6316 $cat <<EOM
6317
6318 Some kernels have a bug that prevents setuid #! scripts from being
6319 secure.  Some sites have disabled setuid #! scripts because of this.
6320
6321 First let's decide if your kernel supports secure setuid #! scripts.
6322 (If setuid #! scripts would be secure but have been disabled anyway,
6323 don't say that they are secure if asked.)
6324
6325 EOM
6326
6327 val="$undef"
6328 if $test -d /dev/fd; then
6329         echo "#!$ls" >reflect
6330         chmod +x,u+s reflect
6331         ./reflect >flect 2>&1
6332         if $contains "/dev/fd" flect >/dev/null; then
6333                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6334                 val="$define"
6335         else
6336                 $cat <<EOM
6337 If you are not sure if they are secure, I can check but I'll need a
6338 username and password different from the one you are using right now.
6339 If you don't have such a username or don't want me to test, simply
6340 enter 'none'.
6341
6342 EOM
6343                 rp='Other username to test security of setuid scripts with?'
6344                 dflt='none'
6345                 . ./myread
6346                 case "$ans" in
6347                 n|none)
6348                         case "$d_suidsafe" in
6349                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6350                                 dflt=n;;
6351                         "$undef")
6352                                 echo "Well, the $hint value is *not* secure." >&4
6353                                 dflt=n;;
6354                         *)      echo "Well, the $hint value *is* secure." >&4
6355                                 dflt=y;;
6356                         esac
6357                         ;;
6358                 *)
6359                         $rm -f reflect flect
6360                         echo "#!$ls" >reflect
6361                         chmod +x,u+s reflect
6362                         echo >flect
6363                         chmod a+w flect
6364                         echo '"su" will (probably) prompt you for '"$ans's password."
6365                         su $ans -c './reflect >flect'
6366                         if $contains "/dev/fd" flect >/dev/null; then
6367                                 echo "Okay, it looks like setuid scripts are secure." >&4
6368                                 dflt=y
6369                         else
6370                                 echo "I don't think setuid scripts are secure." >&4
6371                                 dflt=n
6372                         fi
6373                         ;;
6374                 esac
6375                 rp='Does your kernel have *secure* setuid scripts?'
6376                 . ./myread
6377                 case "$ans" in
6378                 [yY]*)  val="$define";;
6379                 *)      val="$undef";;
6380                 esac
6381         fi
6382 else
6383         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6384         echo "(That's for file descriptors, not floppy disks.)"
6385         val="$undef"
6386 fi
6387 set d_suidsafe
6388 eval $setvar
6389
6390 $rm -f reflect flect
6391
6392 : now see if they want to do setuid emulation
6393 if $test $patchlevel -lt 11; then
6394 echo " "
6395 val="$undef"
6396 case "$d_suidsafe" in
6397 "$define")
6398         val="$undef"
6399         echo "No need to emulate SUID scripts since they are secure here." >&4
6400         ;;
6401 *)
6402         $cat <<EOM
6403 Some systems have disabled setuid scripts, especially systems where
6404 setuid scripts cannot be secure.  On systems where setuid scripts have
6405 been disabled, the setuid/setgid bits on scripts are currently
6406 useless.  It is possible for $package to detect those bits and emulate
6407 setuid/setgid in a secure fashion.  This emulation will only work if
6408 setuid scripts have been disabled in your kernel.
6409
6410 EOM
6411         case "$d_dosuid" in
6412         "$define") dflt=y ;;
6413         *) dflt=n ;;
6414         esac
6415         rp="Do you want to do setuid/setgid emulation?"
6416         . ./myread
6417         case "$ans" in
6418         [yY]*)  val="$define";;
6419         *)      val="$undef";;
6420         esac
6421         ;;
6422 esac
6423 set d_dosuid
6424 eval $setvar
6425 else
6426     case "$d_dosuid" in
6427         "$define")
6428         cat >&4 <<EOH
6429
6430 SUID emulation has been removed for 5.12
6431 Please re-run Configure without -Dd_dosuid
6432
6433 EOH
6434         exit 1;
6435         ;;
6436     esac
6437     d_dosuid=undef
6438 fi
6439
6440 : Find perl5.005 or later.
6441 echo "Looking for a previously installed perl5.005 or later... "
6442 case "$perl5" in
6443 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6444                 : Check if this perl is recent and can load a simple module
6445                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6446                         perl5=$tdir/perl
6447                         break;
6448                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6449                         perl5=$tdir/perl5
6450                         break;
6451                 fi
6452         done
6453         ;;
6454 *)      perl5="$perl5"
6455         ;;
6456 esac
6457 case "$perl5" in
6458 '')     echo "None found.  That's ok.";;
6459 *)      echo "Using $perl5." ;;
6460 esac
6461
6462 : Set the siteprefix variables
6463 $cat <<EOM
6464
6465 After $package is installed, you may wish to install various
6466 add-on modules and utilities.  Typically, these add-ons will
6467 be installed under $prefix with the rest
6468 of this package.  However, you may wish to install such add-ons
6469 elsewhere under a different prefix.
6470
6471 If you do not wish to put everything under a single prefix, that's
6472 ok.  You will be prompted for the individual locations; this siteprefix
6473 is only used to suggest the defaults.
6474
6475 The default should be fine for most people.
6476
6477 EOM
6478 fn=d~+
6479 rp='Installation prefix to use for add-on modules and utilities?'
6480 : XXX Here might be another good place for an installstyle setting.
6481 case "$siteprefix" in
6482 '') dflt=$prefix ;;
6483 *)  dflt=$siteprefix ;;
6484 esac
6485 . ./getfile
6486 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6487 oldsiteprefix=''
6488 case "$siteprefix" in
6489 '') ;;
6490 *)      case "$ans" in
6491         "$prefix") ;;
6492         *) oldsiteprefix="$prefix";;
6493         esac
6494         ;;
6495 esac
6496 siteprefix="$ans"
6497 siteprefixexp="$ansexp"
6498
6499 : determine where site specific libraries go.
6500 : Usual default is /usr/local/lib/perl5/site_perl/$version
6501 : The default "style" setting is made in installstyle.U
6502 : XXX No longer works with Prefixit stuff.
6503 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6504 case "$sitelib" in
6505 '') case "$installstyle" in
6506         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6507         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6508         esac
6509         ;;
6510 *)      dflt="$sitelib"
6511         ;;
6512 esac
6513 $cat <<EOM
6514
6515 The installation process will create a directory for
6516 site-specific extensions and modules.  Most users find it convenient
6517 to place all site-specific files in this directory rather than in the
6518 main distribution directory.
6519
6520 EOM
6521 fn=d~+
6522 rp='Pathname for the site-specific library files?'
6523 . ./getfile
6524 prefixvar=sitelib
6525 . ./setprefixvar
6526 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6527
6528 : Determine list of previous versions to include in @INC
6529 $cat > getverlist <<EOPL
6530 #!$perl5 -w
6531 use File::Basename;
6532 \$api_versionstring = "$api_versionstring";
6533 \$version = "$version";
6534 \$stem = "$sitelib_stem";
6535 \$archname = "$archname";
6536 EOPL
6537         $cat >> getverlist <<'EOPL'
6538 # The list found is store twice for each entry: the original name, and
6539 # the binary broken down version as pack "sss", so sorting is easy and
6540 # unambiguous. This will work for all versions that have a maximum of
6541 # three digit groups, separate by '.'s or '_'s. Names are extended with
6542 # ".0.0" to ensure at least three elements for the pack.
6543 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6544
6545 # Can't have leading @ because metaconfig interprets it as a command!
6546 ;@inc_version_list=();
6547 # XXX Redo to do opendir/readdir?
6548 if (-d $stem) {
6549     chdir($stem);
6550     ;@candidates = map {
6551         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6552     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6553 }
6554 else {
6555     ;@candidates = ();
6556 }
6557
6558 ($pversion, $aversion, $vsn5005) = map {
6559     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6560 foreach $d (@candidates) {
6561     if ($d->[1] lt $pversion) {
6562         if ($d->[1] ge $aversion) {
6563             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6564         }
6565         elsif ($d->[1] ge $vsn5005) {
6566             unshift(@inc_version_list, grep { -d } $d->[0]);
6567         }
6568     }
6569     else {
6570         # Skip newer version.  I.e. don't look in
6571         # 5.7.0 if we're installing 5.6.1.
6572     }
6573 }
6574
6575 if (@inc_version_list) {
6576     print join(' ', @inc_version_list);
6577 }
6578 else {
6579     # Blank space to preserve value for next Configure run.
6580     print " ";
6581 }
6582 EOPL
6583 chmod +x getverlist
6584 case "$inc_version_list" in
6585 '')     if test -x "$perl5$exe_ext"; then
6586                 dflt=`$perl5 getverlist`
6587         else
6588                 dflt='none'
6589         fi
6590         ;;
6591 $undef) dflt='none' ;;
6592 *)  eval dflt=\"$inc_version_list\" ;;
6593 esac
6594 case "$dflt" in
6595 ''|' ') dflt=none ;;
6596 esac
6597 case "$dflt" in
6598 5.005) dflt=none ;;
6599 esac
6600 $cat <<EOM
6601
6602 In order to ease the process of upgrading, this version of perl
6603 can be configured to use modules built and installed with earlier
6604 versions of perl that were installed under $prefix.  Specify here
6605 the list of earlier versions that this version of perl should check.
6606 If Configure detected no earlier versions of perl installed under
6607 $prefix, then the list will be empty.  Answer 'none' to tell perl
6608 to not search earlier versions.
6609
6610 The default should almost always be sensible, so if you're not sure,
6611 just accept the default.
6612 EOM
6613
6614 rp='List of earlier versions to include in @INC?'
6615 . ./myread
6616 case "$ans" in
6617 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6618 *) inc_version_list="$ans" ;;
6619 esac
6620 case "$inc_version_list" in
6621 ''|' ')
6622         inc_version_list_init='0'
6623         d_inc_version_list="$undef"
6624         ;;
6625 *)      inc_version_list_init=`echo $inc_version_list |
6626                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6627         d_inc_version_list="$define"
6628         ;;
6629 esac
6630 $rm -f getverlist
6631
6632 : see if malloc/malloc.h has to be included
6633 set malloc/malloc.h i_mallocmalloc
6634 eval $inhdr
6635
6636 : see if this is a malloc.h system
6637 : we want a real compile instead of Inhdr because some systems have a
6638 : malloc.h that just gives a compile error saying to use stdlib.h instead
6639 echo " "
6640 $cat >try.c <<EOCP
6641 #include <stdlib.h>
6642 #include <malloc.h>
6643 #$i_mallocmalloc I_MALLOCMALLOC
6644 #ifdef I_MALLOCMALLOC
6645 # include <malloc/malloc.h>
6646 #endif
6647
6648 int main () { return 0; }
6649 EOCP
6650 set try
6651 if eval $compile; then
6652     echo "<malloc.h> found." >&4
6653     val="$define"
6654 else
6655     echo "<malloc.h> NOT found." >&4
6656     val="$undef"
6657 fi
6658 $rm_try
6659 set i_malloc
6660 eval $setvar
6661
6662 : check for void type
6663 echo " "
6664 echo "Checking to see how well your C compiler groks the void type..." >&4
6665 case "$voidflags" in
6666 '')
6667         $cat >try.c <<EOCP
6668 #$i_stdlib I_STDLIB
6669 #ifdef I_STDLIB
6670 #include <stdlib.h>
6671 #endif
6672 #if TRY & 1
6673 void sub() {
6674 #else
6675 sub() {
6676 #endif
6677         extern void moo();      /* function returning void */
6678         void (*goo)();          /* ptr to func returning void */
6679 #if TRY & 8
6680         void *hue;              /* generic ptr */
6681 #endif
6682 #if TRY & 2
6683         void (*foo[10])();
6684 #endif
6685
6686 #if TRY & 4
6687         if(goo == moo) {
6688                 exit(0);
6689         }
6690 #endif
6691         exit(0);
6692 }
6693 int main() { sub(); }
6694 EOCP
6695         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6696                 voidflags=$defvoidused
6697         echo "Good.  It appears to support void to the level $package wants.">&4
6698                 if $contains warning .out >/dev/null 2>&1; then
6699                         echo "However, you might get some warnings that look like this:"
6700                         $cat .out
6701                 fi
6702         else
6703 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6704                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6705                         echo "It supports 1..."
6706                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6707                                 echo "It also supports 2..."
6708                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6709                                         voidflags=7
6710                                         echo "And it supports 4 but not 8 definitely."
6711                                 else
6712                                         echo "It doesn't support 4..."
6713                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6714                                                 voidflags=11
6715                                                 echo "But it supports 8."
6716                                         else
6717                                                 voidflags=3
6718                                                 echo "Neither does it support 8."
6719                                         fi
6720                                 fi
6721                         else
6722                                 echo "It does not support 2..."
6723                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6724                                         voidflags=13
6725                                         echo "But it supports 4 and 8."
6726                                 else
6727                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6728                                                 voidflags=5
6729                                                 echo "And it supports 4 but has not heard about 8."
6730                                         else
6731                                                 echo "However it supports 8 but not 4."
6732                                         fi
6733                                 fi
6734                         fi
6735                 else
6736                         echo "There is no support at all for void."
6737                         voidflags=0
6738                 fi
6739         fi
6740 esac
6741 case "$voidflags" in
6742 "$defvoidused") ;;
6743 *)      $cat >&4 <<'EOM'
6744   Support flag bits are:
6745     1: basic void declarations.
6746     2: arrays of pointers to functions returning void.
6747     4: operations between pointers to and addresses of void functions.
6748     8: generic void pointers.
6749 EOM
6750         dflt="$voidflags";
6751         rp="Your void support flags add up to what?"
6752         . ./myread
6753         voidflags="$ans"
6754         ;;
6755 esac
6756 $rm_try
6757
6758 : check for length of pointer
6759 echo " "
6760 case "$ptrsize" in
6761 '')
6762         echo "Checking to see how big your pointers are..." >&4
6763         if test "$voidflags" -gt 7; then
6764                 echo '#define VOID_PTR char *' > try.c
6765         else
6766                 echo '#define VOID_PTR void *' > try.c
6767         fi
6768         $cat >>try.c <<EOCP
6769 #include <stdio.h>
6770 #$i_stdlib I_STDLIB
6771 #ifdef I_STDLIB
6772 #include <stdlib.h>
6773 #endif
6774 int main()
6775 {
6776     printf("%d\n", (int)sizeof(VOID_PTR));
6777     exit(0);
6778 }
6779 EOCP
6780         set try
6781         if eval $compile_ok; then
6782                 ptrsize=`$run ./try`
6783                 echo "Your pointers are $ptrsize bytes long."
6784         else
6785                 dflt='4'
6786                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6787                 rp="What is the size of a pointer (in bytes)?"
6788                 . ./myread
6789                 ptrsize="$ans"
6790         fi
6791         ;;
6792 esac
6793 $rm_try
6794 case "$use64bitall" in
6795 "$define"|true|[yY]*)
6796         case "$ptrsize" in
6797         4)      cat <<EOM >&4
6798
6799 *** You have chosen a maximally 64-bit build,
6800 *** but your pointers are only 4 bytes wide.
6801 *** Please rerun Configure without -Duse64bitall.
6802 EOM
6803                 case "$d_quad" in
6804                 define)
6805                         cat <<EOM >&4
6806 *** Since you have quads, you could possibly try with -Duse64bitint.
6807 EOM
6808                         ;;
6809                 esac
6810                 cat <<EOM >&4
6811 *** Cannot continue, aborting.
6812
6813 EOM
6814
6815                 exit 1
6816                 ;;
6817         esac
6818         ;;
6819 esac
6820
6821
6822 : determine whether to use malloc wrapping
6823 echo " "
6824 case "$usemallocwrap" in
6825 [yY]*|true|$define)     dflt='y' ;;
6826 [nN]*|false|$undef)     dflt='n' ;;
6827 *)      case "$usedevel" in
6828         [yY]*|true|$define)     dflt='y' ;;
6829         *) dflt='n' ;;
6830         esac
6831         ;;
6832 esac
6833 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6834 . ./myread
6835 usemallocwrap="$ans"
6836 case "$ans" in
6837 y*|true)
6838         usemallocwrap="$define" ;;
6839 *)
6840         usemallocwrap="$undef" ;;
6841 esac
6842
6843 : determine which malloc to compile in
6844 echo " "
6845 case "$usemymalloc" in
6846 [yY]*|true|$define)     dflt='y' ;;
6847 [nN]*|false|$undef)     dflt='n' ;;
6848 *)      case "$ptrsize" in
6849         4) dflt='y' ;;
6850         *) dflt='n' ;;
6851         esac
6852         ;;
6853 esac
6854 rp="Do you wish to attempt to use the malloc that comes with $package?"
6855 . ./myread
6856 usemymalloc="$ans"
6857 case "$ans" in
6858 y*|true)
6859         usemymalloc='y'
6860         mallocsrc='malloc.c'
6861         mallocobj="malloc$_o"
6862         d_mymalloc="$define"
6863         case "$libs" in
6864         *-lmalloc*)
6865                 : Remove malloc from list of libraries to use
6866                 echo "Removing unneeded -lmalloc from library list" >&4
6867                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6868                 shift
6869                 libs="$*"
6870                 echo "libs = $libs" >&4
6871                 ;;
6872         esac
6873         ;;
6874 *)
6875         usemymalloc='n'
6876         mallocsrc=''
6877         mallocobj=''
6878         d_mymalloc="$undef"
6879         ;;
6880 esac
6881
6882 : compute the return types of malloc and free
6883 echo " "
6884 $cat >malloc.c <<END
6885 #$i_malloc I_MALLOC
6886 #$i_stdlib I_STDLIB
6887 #include <stdio.h>
6888 #include <sys/types.h>
6889 #ifdef I_MALLOC
6890 #include <malloc.h>
6891 #endif
6892 #ifdef I_STDLIB
6893 #include <stdlib.h>
6894 #endif
6895 #ifdef TRY_MALLOC
6896 void *malloc();
6897 #endif
6898 #ifdef TRY_FREE
6899 void free();
6900 #endif
6901 END
6902 case "$malloctype" in
6903 '')
6904         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6905                 malloctype='void *'
6906         else
6907                 malloctype='char *'
6908         fi
6909         ;;
6910 esac
6911 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6912
6913 case "$freetype" in
6914 '')
6915         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6916                 freetype='void'
6917         else
6918                 freetype='int'
6919         fi
6920         ;;
6921 esac
6922 echo "Your system uses $freetype free(), it would seem." >&4
6923 $rm -f malloc.[co]
6924 : determine where site specific architecture-dependent libraries go.
6925 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6926 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6927 : sitelib may have an optional trailing /share.
6928 case "$sitearch" in
6929 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6930         dflt="$dflt/$archname"
6931         ;;
6932 *)      dflt="$sitearch"
6933         ;;
6934 esac
6935 set sitearch sitearch none
6936 eval $prefixit
6937 $cat <<EOM
6938
6939 The installation process will also create a directory for
6940 architecture-dependent site-specific extensions and modules.
6941
6942 EOM
6943 fn=d~+
6944 rp='Pathname for the site-specific architecture-dependent library files?'
6945 . ./getfile
6946 prefixvar=sitearch
6947 . ./setprefixvar
6948 if $test X"$sitearch" = X"$sitelib"; then
6949         d_sitearch="$undef"
6950 else
6951         d_sitearch="$define"
6952 fi
6953
6954 : Set the vendorprefix variables
6955 $cat <<EOM
6956
6957 The installation process will also create a directory for
6958 vendor-supplied add-ons.  Vendors who supply perl with their system
6959 may find it convenient to place all vendor-supplied files in this
6960 directory rather than in the main distribution directory.  This will
6961 ease upgrades between binary-compatible maintenance versions of perl.
6962
6963 Of course you may also use these directories in whatever way you see
6964 fit.  For example, you might use them to access modules shared over a
6965 company-wide network.
6966
6967 The default answer should be fine for most people.
6968 This causes further questions about vendor add-ons to be skipped
6969 and no vendor-specific directories will be configured for perl.
6970
6971 EOM
6972 rp='Do you want to configure vendor-specific add-on directories?'
6973 case "$usevendorprefix" in
6974 define|true|[yY]*) dflt=y ;;
6975 *)      : User may have set vendorprefix directly on Configure command line.
6976         case "$vendorprefix" in
6977         ''|' ') dflt=n ;;
6978         *)      dflt=y ;;
6979         esac
6980         ;;
6981 esac
6982 . ./myread
6983 case "$ans" in
6984 [yY]*)  fn=d~+
6985         rp='Installation prefix to use for vendor-supplied add-ons?'
6986         case "$vendorprefix" in
6987         '') dflt='' ;;
6988         *)  dflt=$vendorprefix ;;
6989         esac
6990         . ./getfile
6991         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6992         oldvendorprefix=''
6993         case "$vendorprefix" in
6994         '') ;;
6995         *)      case "$ans" in
6996                 "$prefix") ;;
6997                 *) oldvendorprefix="$prefix";;
6998                 esac
6999                 ;;
7000         esac
7001         usevendorprefix="$define"
7002         vendorprefix="$ans"
7003         vendorprefixexp="$ansexp"
7004         ;;
7005 *)      usevendorprefix="$undef"
7006         vendorprefix=''
7007         vendorprefixexp=''
7008         ;;
7009 esac
7010
7011 : Set the vendorlib variables
7012 case "$vendorprefix" in
7013 '')     d_vendorlib="$undef"
7014         vendorlib=''
7015         vendorlibexp=''
7016         ;;
7017 *)      d_vendorlib="$define"
7018         : determine where vendor-supplied modules go.
7019         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7020         case "$vendorlib" in
7021         '')
7022                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7023                 case "$installstyle" in
7024                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7025                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7026                 esac
7027                 ;;
7028         *)      dflt="$vendorlib"
7029                 ;;
7030         esac
7031         fn=d~+
7032         rp='Pathname for the vendor-supplied library files?'
7033         . ./getfile
7034         vendorlib="$ans"
7035         vendorlibexp="$ansexp"
7036         ;;
7037 esac
7038 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7039 prefixvar=vendorlib
7040 . ./installprefix
7041
7042 : Set the vendorarch variables
7043 case "$vendorprefix" in
7044 '')     d_vendorarch="$undef"
7045         vendorarch=''
7046         vendorarchexp=''
7047         ;;
7048 *)      d_vendorarch="$define"
7049         : determine where vendor-supplied architecture-dependent libraries go.
7050         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7051         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7052         : vendorlib may have an optional trailing /share.
7053         case "$vendorarch" in
7054         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7055                 dflt="$dflt/$archname"
7056                 ;;
7057         *)      dflt="$vendorarch" ;;
7058         esac
7059         fn=d~+
7060         rp='Pathname for vendor-supplied architecture-dependent files?'
7061         . ./getfile
7062         vendorarch="$ans"
7063         vendorarchexp="$ansexp"
7064         ;;
7065 esac
7066 prefixvar=vendorarch
7067 . ./installprefix
7068 if $test X"$vendorarch" = X"$vendorlib"; then
7069         d_vendorarch="$undef"
7070 else
7071         d_vendorarch="$define"
7072 fi
7073
7074 : Final catch-all directories to search
7075 $cat <<EOM
7076
7077 Lastly, you can have perl look in other directories for extensions and
7078 modules in addition to those already specified.
7079 These directories will be searched after 
7080         $sitearch 
7081         $sitelib 
7082 EOM
7083 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7084 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7085 echo ' '
7086 case "$otherlibdirs" in
7087 ''|' ') dflt='none' ;;
7088 *)      dflt="$otherlibdirs" ;;
7089 esac
7090 $cat <<EOM
7091 Enter a colon-separated set of extra paths to include in perl's @INC
7092 search path, or enter 'none' for no extra paths.
7093
7094 EOM
7095
7096 rp='Colon-separated list of additional directories for perl to search?'
7097 . ./myread
7098 case "$ans" in
7099 ' '|''|none)    otherlibdirs=' ' ;;     
7100 *)      otherlibdirs="$ans" ;;
7101 esac
7102 case "$otherlibdirs" in
7103 ' ') val=$undef ;;
7104 *)      val=$define ;;
7105 esac
7106 set d_perl_otherlibdirs
7107 eval $setvar
7108
7109 : Cruising for prototypes
7110 echo " "
7111 echo "Checking out function prototypes..." >&4
7112 $cat >prototype.c <<EOCP
7113 #$i_stdlib I_STDLIB
7114 #ifdef I_STDLIB
7115 #include <stdlib.h>
7116 #endif
7117 int main(int argc, char *argv[]) {
7118         exit(0);}
7119 EOCP
7120 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7121         echo "Your C compiler appears to support function prototypes."
7122         val="$define"
7123 else
7124         echo "Your C compiler doesn't seem to understand function prototypes."
7125         val="$undef"
7126 fi
7127 set prototype
7128 eval $setvar
7129 $rm -f prototype*
7130
7131 : Check if ansi2knr is required
7132 case "$prototype" in
7133 "$define") ;;
7134 *)      ansi2knr='ansi2knr'
7135         echo " "
7136         cat <<EOM >&4
7137
7138 $me:  FATAL ERROR:
7139 This version of $package can only be compiled by a compiler that 
7140 understands function prototypes.  Unfortunately, your C compiler 
7141         $cc $ccflags
7142 doesn't seem to understand them.  Sorry about that.
7143
7144 If GNU cc is available for your system, perhaps you could try that instead.  
7145
7146 Eventually, we hope to support building Perl with pre-ANSI compilers.
7147 If you would like to help in that effort, please contact <perlbug@perl.org>.
7148
7149 Aborting Configure now.
7150 EOM
7151         exit 2
7152         ;;
7153 esac
7154
7155 : DTrace support
7156 dflt_dtrace='/usr/sbin/dtrace'
7157 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7158
7159 cat <<EOM
7160
7161 Perl can be built to support DTrace on platforms that support it.
7162 DTrace is a diagnosis and performance analysis tool from Sun.
7163
7164 If this doesn't make any sense to you, just accept the default '$dflt'.
7165 EOM
7166
7167 while $test 1 ; do
7168         case "$usedtrace" in
7169         $define|true|[yY]*)
7170                 dflt='y'
7171                 ;;
7172         ?*)
7173                 dflt='y'
7174                 dflt_dtrace=$usedtrace
7175                 ;;
7176         *)
7177                 dflt='n'
7178                 ;;
7179         esac
7180
7181         rp='Support DTrace if available?'
7182         . ./myread
7183         case "$ans" in
7184         y|Y)    val="$define" ;;
7185         *)      val="$undef" ;;
7186         esac
7187         set usedtrace
7188         eval $setvar
7189
7190         test "X$usedtrace" != "X$define" && break
7191
7192         echo " "
7193         rp='Where is the dtrace executable?'
7194         dflt=$dflt_dtrace
7195         . ./getfile
7196         val="$ans"
7197         set dtrace
7198         eval $setvar
7199
7200         if $test -f $dtrace
7201         then
7202                 if $dtrace -h -s ../perldtrace.d \
7203                         -o perldtrace.tmp >/dev/null 2>&1 \
7204                         && rm -f perldtrace.tmp
7205                 then
7206                         echo " "
7207                         echo "Good: your $dtrace knows about the -h flag."
7208                 else
7209                         cat >&2 <<EOM
7210
7211 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7212 ***
7213 *** Your installed dtrace doesn't support the -h switch to compile a D
7214 *** program into a C header. Can't continue.
7215
7216 EOM
7217                         exit 1
7218                 fi
7219                 break;
7220         fi
7221
7222         case "$fastread" in
7223         yes)
7224                 cat >&2 <<EOM
7225
7226 *** $me:  Fatal Error:  $dtrace not found.
7227 *** Can't continue.
7228
7229 EOM
7230                 exit 1
7231                 ;;
7232         *)
7233                 echo "*** $dtrace was not found."
7234                 echo " "
7235                 ;;
7236         esac
7237 done
7238
7239 : See if we want extra modules installed
7240 echo " "
7241 case "$extras" in
7242 '') dflt='n';;
7243 *) dflt='y';;
7244 esac
7245 cat <<EOM
7246 Perl can be built with extra modules or bundles of modules which
7247 will be fetched from the CPAN and installed alongside Perl.
7248
7249 Notice that you will need access to the CPAN; either via the Internet,
7250 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7251 be asked later to configure the CPAN.pm module which will in turn do
7252 the installation of the rest of the extra modules or bundles.)
7253
7254 Notice also that if the modules require any external software such as
7255 libraries and headers (the libz library and the zlib.h header for the
7256 Compress::Zlib module, for example) you MUST have any such software
7257 already installed, this configuration process will NOT install such
7258 things for you.
7259
7260 If this doesn't make any sense to you, just accept the default '$dflt'.
7261 EOM
7262 rp='Install any extra modules (y or n)?'
7263 . ./myread
7264 case "$ans" in
7265 y|Y)
7266         cat <<EOM
7267
7268 Please list any extra modules or bundles to be installed from CPAN,
7269 with spaces between the names.  The names can be in any format the
7270 'install' command of CPAN.pm will understand.  (Answer 'none',
7271 without the quotes, to install no extra modules or bundles.)
7272 EOM
7273         rp='Extras?'
7274         dflt="$extras"
7275         . ./myread
7276         extras="$ans"
7277 esac
7278 case "$extras" in
7279 ''|'none')
7280         val=''
7281         $rm -f ../extras.lst
7282         ;;
7283 *)      echo "(Saving the list of extras for later...)"
7284         echo "$extras" > ../extras.lst
7285         val="'$extras'"
7286         ;;
7287 esac
7288 set extras
7289 eval $setvar
7290 echo " "
7291
7292 : determine where html pages for programs go
7293 set html1dir html1dir none
7294 eval $prefixit
7295 $cat <<EOM
7296
7297 If you wish to install html files for programs in $spackage, indicate
7298 the appropriate directory here.  To skip installing html files,
7299 answer "none".
7300 EOM
7301 case "$html1dir" in
7302 ''|none|$undef|' ') dflt=none ;;
7303 *) dflt=$html1dir ;;
7304 esac
7305 fn=dn+~
7306 rp="Directory for the main $spackage html pages?"
7307 . ./getfile
7308 prefixvar=html1dir
7309 . ./setprefixvar
7310 : Use ' ' for none so value is preserved next time through Configure
7311 $test X"$html1dir" = "X" && html1dir=' '
7312
7313 : determine where html pages for libraries and modules go
7314 set html3dir html3dir none
7315 eval $prefixit
7316 $cat <<EOM
7317
7318 If you wish to install html files for modules associated with $spackage,
7319 indicate the appropriate directory here.  To skip installing html files,
7320 answer "none".
7321 EOM
7322 : There is no obvious default.  If they have specified html1dir, then
7323 : try to key off that, possibly changing .../html1 into .../html3.
7324 case "$html3dir" in
7325 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7326 *) dflt=$html3dir ;;
7327 esac
7328 fn=dn+~
7329 rp="Directory for the $spackage module html pages?"
7330 . ./getfile
7331 prefixvar=html3dir
7332 . ./setprefixvar
7333 : Use ' ' for none so value is preserved next time through Configure
7334 $test X"$html3dir" = "X" && html3dir=' '
7335
7336 : determine whether to install perl also as /usr/bin/perl
7337
7338 echo " "
7339 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7340         $cat <<EOM
7341 Many scripts expect perl to be installed as /usr/bin/perl.
7342
7343 If you want to, I can install the perl you are about to compile
7344 as /usr/bin/perl (in addition to $bin/perl).
7345 EOM
7346         if test -f /usr/bin/perl; then
7347             $cat <<EOM
7348
7349 However, please note that because you already have a /usr/bin/perl,
7350 overwriting that with a new Perl would very probably cause problems.
7351 Therefore I'm assuming you don't want to do that (unless you insist).
7352
7353 EOM
7354             case "$installusrbinperl" in
7355             "$define"|[yY]*)    dflt='y';;
7356             *)                  dflt='n';;
7357             esac
7358         else
7359             $cat <<EOM
7360
7361 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7362
7363 EOM
7364             case "$installusrbinperl" in
7365             "$undef"|[nN]*)     dflt='n';;
7366             *)                  dflt='y';;
7367             esac
7368         fi
7369         rp="Do you want to install perl as /usr/bin/perl?"
7370         . ./myread
7371         case "$ans" in
7372         [yY]*)  val="$define";;
7373         *)      val="$undef" ;;
7374         esac
7375 else
7376         val="$undef"
7377 fi
7378 set installusrbinperl
7379 eval $setvar
7380
7381 : Check if we are using the GNU C library
7382 echo " "
7383 echo "Checking for GNU C Library..." >&4
7384 cat >try.c <<'EOCP'
7385 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7386    alone are insufficient to distinguish different versions, such as
7387    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7388    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7389 */
7390 #include <stdio.h>
7391 int main(void)
7392 {
7393 #ifdef __GLIBC__
7394 #   ifdef __GLIBC_MINOR__
7395 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7396 #           include <gnu/libc-version.h>
7397             printf("%s\n",  gnu_get_libc_version());
7398 #       else
7399             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7400 #       endif
7401 #   else
7402         printf("%d\n",  __GLIBC__);
7403 #   endif
7404     return 0;
7405 #else
7406     return 1;
7407 #endif
7408 }
7409 EOCP
7410 set try
7411 if eval $compile_ok && $run ./try > glibc.ver; then
7412         val="$define"
7413         gnulibc_version=`$cat glibc.ver`
7414         echo "You are using the GNU C Library version $gnulibc_version"
7415 else
7416         val="$undef"
7417         gnulibc_version=''
7418         echo "You are not using the GNU C Library"
7419 fi
7420 $rm_try glibc.ver
7421 set d_gnulibc
7422 eval $setvar
7423
7424 : see if nm is to be used to determine whether a symbol is defined or not
7425 case "$usenm" in
7426 '')
7427         dflt=''
7428         case "$d_gnulibc" in
7429         "$define")
7430                 echo " "
7431                 echo "nm probably won't work on the GNU C Library." >&4
7432                 dflt=n
7433                 ;;
7434         esac
7435         case "$dflt" in
7436         '') 
7437                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7438                         echo " "
7439                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7440                         echo "'nm' won't be sufficient on this sytem." >&4
7441                         dflt=n
7442                 fi
7443                 ;;
7444         esac
7445         case "$dflt" in
7446         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7447                 if $test $dflt -gt 20; then
7448                         dflt=y
7449                 else
7450                         dflt=n
7451                 fi
7452                 ;;
7453         esac
7454         ;;
7455 *)
7456         case "$usenm" in
7457         true|$define) dflt=y;;
7458         *) dflt=n;;
7459         esac
7460         ;;
7461 esac
7462 $cat <<EOM
7463
7464 I can use $nm to extract the symbols from your C libraries. This
7465 is a time consuming task which may generate huge output on the disk (up
7466 to 3 megabytes) but that should make the symbols extraction faster. The
7467 alternative is to skip the 'nm' extraction part and to compile a small
7468 test program instead to determine whether each symbol is present. If
7469 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7470 this may be the best solution.
7471
7472 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7473
7474 EOM
7475 rp="Shall I use $nm to extract C symbols from the libraries?"
7476 . ./myread
7477 case "$ans" in
7478 [Nn]*) usenm=false;;
7479 *) usenm=true;;
7480 esac
7481
7482 runnm=$usenm
7483 case "$reuseval" in
7484 true) runnm=false;;
7485 esac
7486
7487 : nm options which may be necessary
7488 case "$nm_opt" in
7489 '') if $test -f /mach_boot; then
7490                 nm_opt=''       # Mach
7491         elif $test -d /usr/ccs/lib; then
7492                 nm_opt='-p'     # Solaris (and SunOS?)
7493         elif $test -f /dgux; then
7494                 nm_opt='-p'     # DG-UX
7495         elif $test -f /lib64/rld; then
7496                 nm_opt='-p'     # 64-bit Irix
7497         else
7498                 nm_opt=''
7499         fi;;
7500 esac
7501
7502 : nm options which may be necessary for shared libraries but illegal
7503 : for archive libraries.  Thank you, Linux.
7504 case "$nm_so_opt" in
7505 '')     case "$myuname" in
7506         *linux*|gnu*)
7507                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7508                         nm_so_opt='--dynamic'
7509                 fi
7510                 ;;
7511         esac
7512         ;;
7513 esac
7514
7515 : Figure out where the libc is located
7516 case "$runnm" in
7517 true)
7518 : get list of predefined functions in a handy place
7519 echo " "
7520 case "$libc" in
7521 '') libc=unknown
7522         case "$libs" in
7523         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7524         esac
7525         ;;
7526 esac
7527 case "$libs" in
7528 '') ;;
7529 *)  for thislib in $libs; do
7530         case "$thislib" in
7531         -lc|-lc_s)
7532                 : Handle C library specially below.
7533                 ;;
7534         -l*)
7535                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7536                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7537                         :
7538                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7539                         :
7540                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7541                         :
7542                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7543                         :
7544                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7545                         :
7546                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7547                         :
7548                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7549                         :
7550                 else
7551                         try=''
7552                 fi
7553                 libnames="$libnames $try"
7554                 ;;
7555         *) libnames="$libnames $thislib" ;;
7556         esac
7557         done
7558         ;;
7559 esac
7560 xxx=normal
7561 case "$libc" in
7562 unknown)
7563         set /lib/libc.$so
7564         for xxx in $libpth; do
7565                 $test -r $1 || set $xxx/libc.$so
7566                 : The messy sed command sorts on library version numbers.
7567                 $test -r $1 || \
7568                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7569                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7570                                 h
7571                                 s/[0-9][0-9]*/0000&/g
7572                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7573                                 G
7574                                 s/\n/ /' | \
7575                          $sort | $sed -e 's/^.* //'`
7576                 eval set \$$#
7577         done
7578         $test -r $1 || set /usr/ccs/lib/libc.$so
7579         $test -r $1 || set /lib/libsys_s$_a
7580         ;;
7581 *)
7582         set blurfl
7583         ;;
7584 esac
7585 if $test -r "$1"; then
7586         echo "Your (shared) C library seems to be in $1."
7587         libc="$1"
7588 elif $test -r /lib/libc && $test -r /lib/clib; then
7589         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7590         xxx=apollo
7591         libc='/lib/clib /lib/libc'
7592         if $test -r /lib/syslib; then
7593                 echo "(Your math library is in /lib/syslib.)"
7594                 libc="$libc /lib/syslib"
7595         fi
7596 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7597         echo "Your C library seems to be in $libc, as you said before."
7598 elif $test -r $incpath/usr/lib/libc$_a; then
7599         libc=$incpath/usr/lib/libc$_a;
7600         echo "Your C library seems to be in $libc.  That's fine."
7601 elif $test -r /lib/libc$_a; then
7602         libc=/lib/libc$_a;
7603         echo "Your C library seems to be in $libc.  You're normal."
7604 else
7605         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7606                 :
7607         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7608                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7609         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7610                 :
7611         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7612                 :
7613         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7614                 :
7615         else
7616                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7617         fi
7618         if $test -r "$tans"; then
7619                 echo "Your C library seems to be in $tans, of all places."
7620                 libc=$tans
7621         else
7622                 libc='blurfl'
7623         fi
7624 fi
7625 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7626         dflt="$libc"
7627         cat <<EOM
7628
7629 If the guess above is wrong (which it might be if you're using a strange
7630 compiler, or your machine supports multiple models), you can override it here.
7631
7632 EOM
7633 else
7634         dflt=''
7635         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7636         cat >&4 <<EOM
7637 I can't seem to find your C library.  I've looked in the following places:
7638
7639 EOM
7640         $sed 's/^/      /' libpath
7641         cat <<EOM
7642
7643 None of these seems to contain your C library. I need to get its name...
7644
7645 EOM
7646 fi
7647 fn=f
7648 rp='Where is your C library?'
7649 . ./getfile
7650 libc="$ans"
7651
7652 echo " "
7653 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7654 set X `cat libnames`
7655 shift
7656 xxx=files
7657 case $# in 1) xxx=file; esac
7658 echo "Extracting names from the following $xxx for later perusal:" >&4
7659 echo " "
7660 $sed 's/^/      /' libnames >&4
7661 echo " "
7662 $echo $n "This may take a while...$c" >&4
7663
7664 for file in $*; do
7665         case $file in
7666         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7667         *) $nm $nm_opt $file 2>/dev/null;;
7668         esac
7669 done >libc.tmp
7670
7671 $echo $n ".$c"
7672 $grep fprintf libc.tmp > libc.ptf
7673 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7674 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7675 xxx='[ADTSIW]'
7676 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7677         eval $xscan;\
7678         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7679                 eval $xrun
7680 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7681         eval $xscan;\
7682         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7683                 eval $xrun
7684 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7685         eval $xscan;\
7686         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7687                 eval $xrun
7688 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7693         eval $xscan;\
7694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7695                 eval $xrun
7696 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7697         eval $xscan;\
7698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7699                 eval $xrun
7700 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7701                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7702         eval $xscan;\
7703         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7704                 eval $xrun
7705 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7706         eval $xscan;\
7707         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7708                 eval $xrun
7709 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7710         eval $xscan;\
7711         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7712                 eval $xrun
7713 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7714         eval $xscan;\
7715         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7716                 eval $xrun
7717 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7718         eval $xscan;\
7719         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7720                 eval $xrun
7721 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7722         eval $xscan;\
7723         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7724                 eval $xrun
7725 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7726         eval $xscan;\
7727         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7728                 eval $xrun
7729 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7730         eval $xscan;\
7731         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7732                 eval $xrun
7733 else
7734         $nm -p $* 2>/dev/null >libc.tmp
7735         $grep fprintf libc.tmp > libc.ptf
7736         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7737                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7738         then
7739                 nm_opt='-p'
7740                 eval $xrun
7741         else
7742                 echo " "
7743                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7744                 com=''
7745                 if $ar t $libc > libc.tmp && \
7746                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7747                 then
7748                         for thisname in $libnames $libc; do
7749                                 $ar t $thisname >>libc.tmp
7750                         done
7751                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7752                         echo "Ok." >&4
7753                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7754                         for thisname in $libnames $libc; do
7755                                 $ar tv $thisname >>libc.tmp
7756                                 emximp -o tmp.imp $thisname \
7757                                     2>/dev/null && \
7758                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7759                                     < tmp.imp >>libc.tmp
7760                                 $rm -f tmp.imp
7761                         done
7762                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7763                         echo "Ok." >&4
7764                 else
7765                         echo "$ar didn't seem to work right." >&4
7766                         echo "Maybe this is a Cray...trying bld instead..." >&4
7767                         if  bld t $libc | \
7768                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7769                                 $test -s libc.list
7770                         then
7771                                 for thisname in $libnames; do
7772                                         bld t $libnames | \
7773                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7774                                         $ar t $thisname >>libc.tmp
7775                                 done
7776                                 echo "Ok." >&4
7777                         else
7778                                 echo "That didn't work either.  Giving up." >&4
7779                                 exit 1
7780                         fi
7781                 fi
7782         fi
7783 fi
7784 nm_extract="$com"
7785 case "$PASE" in
7786 define)
7787     echo " "
7788     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7789     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7790     ;;
7791 *)  if $test -f /lib/syscalls.exp; then
7792         echo " "
7793         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7794         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7795                 /lib/syscalls.exp >>libc.list
7796     fi
7797     ;;
7798 esac
7799 ;;
7800 esac
7801 $rm -f libnames libpath
7802
7803 : see if dld is available
7804 set dld.h i_dld
7805 eval $inhdr
7806
7807 : Check if we are using C++
7808 echo " "
7809 echo "Checking for C++..." >&4
7810 $cat >try.c <<'EOCP'
7811 #include <stdio.h>
7812 int main(void)
7813 {
7814 #ifdef __cplusplus
7815     return 0;
7816 #else
7817     return 1;
7818 #endif
7819 }
7820 EOCP
7821 set try
7822 if eval $compile_ok && $run ./try; then
7823         val="$define"
7824         echo "You are using a C++ compiler."
7825 else
7826         val="$undef"
7827         echo "You are not using a C++ compiler."
7828 fi
7829 $rm_try cplusplus$$
7830 set d_cplusplus
7831 eval $setvar
7832
7833 : is a C symbol defined?
7834 csym='tlook=$1;
7835 case "$3" in
7836 -v) tf=libc.tmp; tdc="";;
7837 -a) tf=libc.tmp; tdc="[]";;
7838 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7839 esac;
7840 case "$d_cplusplus" in
7841     $define)    extern_C="extern \"C\"" ;;
7842     *)          extern_C="extern"       ;;
7843 esac;
7844 tx=yes;
7845 case "$reuseval-$4" in
7846 true-) ;;
7847 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7848 esac;
7849 case "$tx" in
7850 yes)
7851         tval=false;
7852         if $test "$runnm" = true; then
7853                 if $contains $tlook $tf >/dev/null 2>&1; then
7854                         tval=true;
7855                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7856                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7857                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7858                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7859                         $rm_try;
7860                 fi;
7861         else
7862                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7863                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7864                 $rm_try;
7865         fi;
7866         ;;
7867 *)
7868         case "$tval" in
7869         $define) tval=true;;
7870         *) tval=false;;
7871         esac;
7872         ;;
7873 esac;
7874 eval "$2=$tval"'
7875
7876 : define an is-in-libc? function
7877 inlibc='echo " "; td=$define; tu=$undef;
7878 sym=$1; var=$2; eval "was=\$$2";
7879 tx=yes;
7880 case "$reuseval$was" in
7881 true) ;;
7882 true*) tx=no;;
7883 esac;
7884 case "$tx" in
7885 yes)
7886         set $sym tres -f;
7887         eval $csym;
7888         case "$tres" in
7889         true)
7890                 echo "$sym() found." >&4;
7891                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7892         *)
7893                 echo "$sym() NOT found." >&4;
7894                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7895         esac;;
7896 *)
7897         case "$was" in
7898         $define) echo "$sym() found." >&4;;
7899         *) echo "$sym() NOT found." >&4;;
7900         esac;;
7901 esac'
7902
7903 : see if dlopen exists
7904 xxx_runnm="$runnm"
7905 xxx_ccflags="$ccflags"
7906 runnm=false
7907 : with g++ one needs -shared to get is-in-libc to work for dlopen
7908 case "$gccversion" in
7909 '')     ;;
7910 *)      case "$d_cplusplus" in
7911         "$define") ccflags="$ccflags -shared" ;;
7912         esac
7913         ;;
7914 esac
7915 set dlopen d_dlopen
7916 eval $inlibc
7917 runnm="$xxx_runnm"
7918 ccflags="$xxx_ccflags"
7919
7920 : see if this is a unistd.h system
7921 set unistd.h i_unistd
7922 eval $inhdr
7923
7924 : determine which dynamic loading, if any, to compile in
7925 echo " "
7926 dldir="ext/DynaLoader"
7927 case "$usedl" in
7928 $define|y|true)
7929         dflt='y'
7930         usedl="$define"
7931         ;;
7932 $undef|n|false)
7933         dflt='n'
7934         usedl="$undef"
7935         ;;
7936 *)
7937         dflt='n'
7938         case "$d_dlopen" in
7939             $define) dflt='y' ;;
7940         esac
7941         case "$i_dld" in
7942             $define) dflt='y' ;;
7943         esac
7944         : Does a dl_xxx.xs file exist for this operating system
7945         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7946         ;;
7947 esac
7948 rp="Do you wish to use dynamic loading?"
7949 . ./myread
7950 usedl="$ans"
7951 bin_ELF="$undef"
7952 case "$ans" in
7953 y*) usedl="$define"
7954         case "$dlsrc" in
7955         '')
7956                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7957                         dflt="$dldir/dl_${osname}.xs"
7958                 elif $test "$d_dlopen" = "$define" ; then
7959                         dflt="$dldir/dl_dlopen.xs"
7960                 elif $test "$i_dld" = "$define" ; then
7961                         dflt="$dldir/dl_dld.xs"
7962                 else
7963                         dflt=''
7964                 fi
7965                 ;;
7966         *)      dflt="$dldir/$dlsrc"
7967                 ;;
7968         esac
7969     echo "The following dynamic loading files are available:"
7970         : Can not go over to $dldir because getfile has path hard-coded in.
7971         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7972         rp="Source file to use for dynamic loading"
7973         fn="fne"
7974         gfpth="$src"
7975         . ./getfile
7976         usedl="$define"
7977         : emulate basename
7978         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7979
7980         $cat << EOM
7981
7982 Some systems may require passing special flags to $cc -c to
7983 compile modules that will be used to create a shared library.
7984 To use no flags, say "none".
7985
7986 EOM
7987     case "$cccdlflags" in
7988     '') case "$gccversion" in
7989                 '') case "$osname" in
7990                         hpux)   dflt='+z' ;;
7991                         next)   dflt='none' ;;
7992                         irix*)  dflt='-KPIC' ;;
7993                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7994                         sunos)  dflt='-pic' ;;
7995                         *)      dflt='none' ;;
7996                     esac
7997                         ;;
7998                 *)  case "$osname" in
7999                         darwin) dflt='none' ;;
8000                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8001                         *)      dflt='-fpic' ;;
8002                     esac ;;
8003             esac ;;
8004         ' ') dflt='none' ;;
8005     *)  dflt="$cccdlflags" ;;
8006     esac
8007     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8008     . ./myread
8009     case "$ans" in
8010     none) cccdlflags=' ' ;;
8011     *) cccdlflags="$ans" ;;
8012     esac
8013
8014     cat << EOM
8015
8016 Some systems use ld to create libraries that can be dynamically loaded,
8017 while other systems (such as those using ELF) use $cc.
8018
8019 EOM
8020         case "$ld" in
8021         '')     $cat >try.c <<EOM
8022 /* Test for whether ELF binaries are produced */
8023 #include <fcntl.h>
8024 #$i_stdlib I_STDLIB
8025 #ifdef I_STDLIB
8026 #include <stdlib.h>
8027 #endif
8028 #$i_unistd I_UNISTD
8029 #ifdef I_UNISTD
8030 #include <unistd.h>
8031 #endif
8032 int main() {
8033         char b[4];
8034         int i = open("a.out",O_RDONLY);
8035         if(i == -1)
8036                 exit(1); /* fail */
8037         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8038                 exit(0); /* succeed (yes, it's ELF) */
8039         else
8040                 exit(1); /* fail */
8041 }
8042 EOM
8043                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8044                         cat <<EOM
8045 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8046 EOM
8047                         dflt="$cc"
8048                         bin_ELF="$define"
8049                 else
8050                         echo "I'll use ld to build dynamic libraries."
8051                         dflt='ld'
8052                 fi
8053                 $rm_try
8054                 ;;
8055         *)      dflt="$ld"
8056                 ;;
8057         esac
8058
8059     rp="What command should be used to create dynamic libraries?"
8060     . ./myread
8061         ld="$ans"
8062
8063     cat << EOM
8064
8065 Some systems may require passing special flags to $ld to create a
8066 library that can be dynamically loaded.  If your ld flags include
8067 -L/other/path options to locate libraries outside your loader's normal
8068 search path, you may need to specify those -L options here as well.  To
8069 use no flags, say "none".
8070
8071 EOM
8072     case "$lddlflags" in
8073     '') case "$osname" in
8074                         beos) dflt='-nostart' ;;
8075                         haiku) dflt='-shared' ;;
8076                         hpux) dflt='-b';
8077                               case "$gccversion" in
8078                               '') dflt="$dflt +vnocompatwarnings" ;;
8079                               esac
8080                               ;;
8081                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8082                         next)  dflt='none' ;;
8083                         solaris) dflt='-G' ;;
8084                         sunos) dflt='-assert nodefinitions' ;;
8085                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8086                 *)     dflt='none' ;;
8087                         esac
8088                         ;;
8089     *) dflt="$lddlflags" ;;
8090     esac
8091
8092         : Try to guess additional flags to pick up local libraries.
8093         : Be careful not to append to a plain 'none'
8094         case "$dflt" in
8095         none) dflt='' ;;
8096         esac
8097         for thisflag in $ldflags; do
8098                 case "$thisflag" in
8099                 -L*|-R*|-Wl,-R*)
8100                         case " $dflt " in
8101                         *" $thisflag "*) ;;
8102                         *) dflt="$dflt $thisflag" ;;
8103                         esac
8104                         ;;
8105                 esac
8106         done
8107
8108         case "$dflt" in
8109         ''|' ') dflt='none' ;;
8110         esac
8111
8112         case "$ldflags" in
8113         *-fstack-protector*)
8114             case "$dflt" in
8115                         *-fstack-protector*) ;; # Don't add it again
8116                         *) dflt="$dflt -fstack-protector" ;; 
8117                 esac
8118                 ;;
8119         esac
8120
8121
8122     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8123     . ./myread
8124     case "$ans" in
8125     none) lddlflags=' ' ;;
8126     *) lddlflags="$ans" ;;
8127     esac
8128
8129         cat <<EOM
8130
8131 Some systems may require passing special flags to $cc to indicate that
8132 the resulting executable will use dynamic linking.  To use no flags,
8133 say "none".
8134
8135 EOM
8136     case "$ccdlflags" in
8137     '') case "$osname" in
8138             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8139             next|sunos) dflt='none' ;;
8140             *)          dflt='none' ;;
8141             esac ;;
8142     ' ')  dflt='none' ;;
8143     *)  dflt="$ccdlflags" ;;
8144     esac
8145     rp="Any special flags to pass to $cc to use dynamic linking?"
8146     . ./myread
8147     case "$ans" in
8148     none) ccdlflags=' ' ;;
8149     *) ccdlflags="$ans" ;;
8150     esac
8151     ;;
8152 *)  usedl="$undef"
8153         ld='ld'
8154     dlsrc='dl_none.xs'
8155     lddlflags=''
8156     ccdlflags=''
8157     ;;
8158 esac
8159
8160 : Do we want a shared libperl?
8161 also=''
8162 case "$usedl" in
8163 $undef)
8164         # No dynamic loading being used, so don't bother even to prompt.
8165         useshrplib='false'
8166         ;;
8167 *)      case "$useshrplib" in
8168         '')     case "$osname" in
8169                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8170                         dflt=y
8171                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8172                         ;;
8173                 next*)
8174                         case "$osvers" in
8175                         4*)     dflt=y
8176                                 also='Building a shared libperl is needed for MAB support.'
8177                                 ;;
8178                         *)      dflt=n
8179                                 ;;
8180                         esac
8181                         ;;
8182                 *)      dflt=n
8183                         ;;
8184                 esac
8185                 ;;
8186         $define|true|[Yy]*)
8187                 dflt=y
8188                 ;;
8189         *)      dflt=n
8190                 ;;
8191         esac
8192         $cat << EOM
8193
8194 The perl executable is normally obtained by linking perlmain.c with
8195 libperl${_a}, any static extensions (usually just DynaLoader), and
8196 any other libraries needed on this system (such as -lm, etc.).  Since
8197 your system supports dynamic loading, it is probably possible to build
8198 a shared libperl.$so.  If you will have more than one executable linked
8199 to libperl.$so, this will significantly reduce the size of each
8200 executable, but it may have a noticeable effect on performance.  The
8201 default is probably sensible for your system.
8202 $also
8203
8204 EOM
8205         rp="Build a shared libperl.$so (y/n)"
8206         . ./myread
8207         case "$ans" in
8208         true|$define|[Yy]*)
8209                 useshrplib='true'  ;;
8210         *)      useshrplib='false' ;;
8211         esac
8212         ;;
8213 esac
8214
8215 case "$useshrplib" in
8216 true)
8217         case "$userelocatableinc" in
8218         true|define)
8219                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8220                 echo "See INSTALL for an explanation why that won't work." >&4
8221                 exit 4
8222                 ;;
8223         esac
8224         case "$libperl" in
8225         '')
8226                 # Figure out a good name for libperl.so.  Since it gets stored in
8227                 # a version-specific architecture-dependent library, the version
8228                 # number isn't really that important, except for making cc/ld happy.
8229                 #
8230                 # A name such as libperl.so.10.1
8231                 majmin="libperl.$so.$patchlevel.$subversion"
8232                 # A name such as libperl.so.100
8233                 majonly=`echo $patchlevel $subversion |
8234                         $awk '{printf "%d%02d", $1, $2}'`
8235                 majonly=libperl.$so.$majonly
8236                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8237                 # rely on figuring it out from the naming of libc.
8238                 case "${osname}${osvers}" in
8239                 next4*)
8240                         dflt=libperl.5.$so
8241                         # XXX How handle the --version stuff for MAB?
8242                         ;;
8243                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8244                         dflt=libperl.$so
8245                         ;;
8246                 cygwin*) # ld links now against the dll directly
8247                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8248                         majonly=`echo $patchlevel $subversion |
8249                                 $awk '{printf "%03d%03d", $1, $2}'`
8250                         majonly=cygperl5.$majonly.$so
8251                         dflt=$majmin
8252                         ;;
8253                 *)      # Try to guess based on whether libc has major.minor.
8254                         case "$libc" in
8255                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8256                         *libc.$so.[0-9]*) dflt=$majonly ;;
8257                         *)      dflt=libperl.$so ;;
8258                         esac
8259                         ;;
8260                 esac
8261                 ;;
8262         *)      dflt=$libperl
8263                 ;;
8264         esac
8265         cat << EOM
8266
8267 I need to select a good name for the shared libperl.  If your system uses
8268 library names with major and minor numbers, then you might want something
8269 like $majmin.  Alternatively, if your system uses a single version
8270 number for shared libraries, then you might want to use $majonly.
8271 Or, your system might be quite happy with a simple libperl.$so.
8272
8273 Since the shared libperl will get installed into a version-specific
8274 architecture-dependent directory, the version number of the shared perl
8275 library probably isn't important, so the default should be o.k.
8276
8277 EOM
8278         rp='What name do you want to give to the shared libperl?'
8279         . ./myread
8280         libperl=$ans
8281         echo "Ok, I'll use $libperl"
8282         ;;
8283 *)
8284         libperl="libperl${_a}"
8285         ;;
8286 esac
8287
8288 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8289 case "$shrpdir" in
8290 '') ;;
8291 *)      $cat >&4 <<EOM
8292 WARNING:  Use of the shrpdir variable for the installation location of
8293 the shared $libperl is not supported.  It was never documented and
8294 will not work in this version.  Let me (perlbug@perl.org)
8295 know of any problems this may cause.
8296
8297 EOM
8298         case "$shrpdir" in
8299         "$archlibexp/CORE")
8300                 $cat >&4 <<EOM
8301 But your current setting of $shrpdir is
8302 the default anyway, so it's harmless.
8303 EOM
8304                 ;;
8305         *)
8306                 $cat >&4 <<EOM
8307 Further, your current attempted setting of $shrpdir
8308 conflicts with the value of $archlibexp/CORE
8309 that installperl will use.
8310 EOM
8311                 ;;
8312         esac
8313         ;;
8314 esac
8315
8316 # How will the perl executable find the installed shared $libperl?
8317 # Add $xxx to ccdlflags.
8318 # If we can't figure out a command-line option, use $shrpenv to
8319 # set env LD_RUN_PATH.  The main perl makefile uses this.
8320 shrpdir=$archlibexp/CORE
8321 xxx=''
8322 tmp_shrpenv=''
8323 if "$useshrplib"; then
8324     case "$osname" in
8325         aix)
8326                 # We'll set it in Makefile.SH...
8327                 ;;
8328         solaris)
8329                 xxx="-R $shrpdir"
8330                 ;;
8331         freebsd|netbsd|openbsd|interix|dragonfly)
8332                 xxx="-Wl,-R$shrpdir"
8333                 ;;
8334         bsdos|linux|irix*|dec_osf|gnu*)
8335                 xxx="-Wl,-rpath,$shrpdir"
8336                 ;;
8337         next)
8338                 # next doesn't like the default...
8339                 ;;
8340         beos)
8341                 # beos doesn't like the default, either.
8342                 ;;
8343         haiku)
8344                 # Haiku doesn't like the default, either.
8345                 ;;
8346         hpux*)
8347                 # hpux doesn't like the default, either.
8348                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8349                 ;;
8350         cygwin)
8351                 # cygwin needs only ldlibpth
8352                 ;;
8353         *)
8354                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8355                 ;;
8356         esac
8357         case "$xxx" in
8358         '') ;;
8359         *)
8360                 # Only add $xxx if it isn't already in ccdlflags.
8361                 case " $ccdlflags " in
8362                 *" $xxx "*)     ;;
8363                 *)      ccdlflags="$ccdlflags $xxx"
8364                         cat <<EOM >&4
8365
8366 Adding $xxx to the flags
8367 passed to $ld so that the perl executable will find the
8368 installed shared $libperl.
8369
8370 EOM
8371                         ;;
8372                 esac
8373                 ;;
8374         esac
8375 fi
8376 # Fix ccdlflags in AIX for building external extensions.
8377 # (For building Perl itself bare -bE:perl.exp is needed,
8378 #  Makefile.SH takes care of this.)
8379 case "$osname" in
8380 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8381 esac
8382 # Respect a hint or command-line value.
8383 case "$shrpenv" in
8384 '') shrpenv="$tmp_shrpenv" ;;
8385 esac
8386 case "$ldlibpthname" in
8387 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8388 none)   ldlibpthname='' ;;
8389 esac
8390
8391 : determine where manual pages are on this system
8392 echo " "
8393 case "$sysman" in
8394 '') 
8395         syspath='/usr/share/man/man1 /usr/man/man1'
8396         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8397         syspath="$syspath /usr/man/u_man/man1"
8398         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8399         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8400         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8401         sysman=`./loc . /usr/man/man1 $syspath`
8402         ;;
8403 esac
8404 if $test -d "$sysman"; then
8405         echo "System manual is in $sysman." >&4
8406 else
8407         echo "Could not find manual pages in source form." >&4
8408 fi
8409
8410 : determine where manual pages go
8411 set man1dir man1dir none
8412 eval $prefixit
8413 $cat <<EOM
8414
8415 $spackage has manual pages available in source form.
8416 EOM
8417 case "$nroff" in
8418 nroff)
8419         echo "However, you don't have nroff, so they're probably useless to you."
8420         case "$man1dir" in
8421         '') man1dir="none";;
8422         esac;;
8423 esac
8424 echo "If you don't want the manual sources installed, answer 'none'."
8425 case "$man1dir" in
8426 ' ') dflt=none
8427         ;;
8428 '')
8429         lookpath="$prefixexp/share/man/man1"
8430         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8431         lookpath="$lookpath $prefixexp/man/p_man/man1"
8432         lookpath="$lookpath $prefixexp/man/u_man/man1"
8433         lookpath="$lookpath $prefixexp/man/man.1"
8434         case "$sysman" in
8435         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8436         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8437         esac
8438         set dflt
8439         eval $prefixup
8440         ;;
8441 *)  dflt="$man1dir"
8442         ;;
8443 esac
8444 echo " "
8445 fn=dn+~
8446 rp="Where do the main $spackage manual pages (source) go?"
8447 . ./getfile
8448 if $test "X$man1direxp" != "X$ansexp"; then
8449         installman1dir=''
8450 fi
8451 prefixvar=man1dir
8452 . ./setprefixvar
8453
8454 case "$man1dir" in
8455 '')     man1dir=' '
8456         installman1dir='';;
8457 esac
8458
8459 : What suffix to use on installed man pages
8460
8461 case "$man1dir" in
8462 ' ')
8463         man1ext='0'
8464         ;;
8465 *)
8466         rp="What suffix should be used for the main $spackage man pages?"
8467         case "$man1ext" in
8468         '')     case "$man1dir" in
8469                 *1)  dflt=1 ;;
8470                 *1p) dflt=1p ;;
8471                 *1pm) dflt=1pm ;;
8472                 *l) dflt=l;;
8473                 *n) dflt=n;;
8474                 *o) dflt=o;;
8475                 *p) dflt=p;;
8476                 *C) dflt=C;;
8477                 *L) dflt=L;;
8478                 *L1) dflt=L1;;
8479                 *) dflt=1;;
8480                 esac
8481                 ;;
8482         *)      dflt="$man1ext";;
8483         esac
8484         . ./myread
8485         man1ext="$ans"
8486         ;;
8487 esac
8488
8489 : see if we can have long filenames
8490 echo " "
8491 first=123456789abcdef
8492 $rm -f $first
8493 if (echo hi >$first) 2>/dev/null; then
8494         if $test -f 123456789abcde; then
8495                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8496                 val="$undef"
8497         else
8498                 echo 'You can have filenames longer than 14 characters.'>&4
8499                 val="$define"
8500         fi
8501 else
8502         $cat <<'EOM'
8503 You can't have filenames longer than 14 chars.
8504 You can't even think about them!
8505 EOM
8506         val="$undef"
8507 fi
8508 set d_flexfnam
8509 eval $setvar
8510 $rm -rf 123456789abcde*
8511
8512 : determine where library module manual pages go
8513 set man3dir man3dir none
8514 eval $prefixit
8515 $cat <<EOM
8516
8517 $spackage has manual pages for many of the library modules.
8518 EOM
8519
8520 case "$nroff" in
8521 nroff)
8522         $cat <<'EOM'
8523 However, you don't have nroff, so they're probably useless to you.
8524 EOM
8525         case "$man3dir" in
8526         '') man3dir="none";;
8527         esac;;
8528 esac
8529
8530 case "$d_flexfnam" in
8531 undef)
8532         $cat <<'EOM'
8533 However, your system can't handle the long file names like File::Basename.3.
8534 EOM
8535         case "$man3dir" in
8536         '') man3dir="none";;
8537         esac;;
8538 esac
8539
8540 echo "If you don't want the manual sources installed, answer 'none'."
8541 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8542 case "$man3dir" in
8543 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8544         if $test -d "$privlib/man/man3"; then
8545                 cat <<EOM >&4
8546
8547 WARNING:  Previous versions of perl installed man3 pages into
8548 $privlib/man/man3.  This version will suggest a
8549 new default of $dflt.
8550 EOM
8551                 tdflt=$dflt
8552                 dflt='n'
8553                 rp='Do you wish to preserve the old behavior?(y/n)'
8554                 . ./myread
8555                 case "$ans" in
8556                 y*) dflt="$privlib/man/man3" ;;
8557                 *)  dflt=$tdflt ;;
8558                 esac
8559     fi
8560         ;;
8561 *)      dflt="$man3dir" ;;
8562 esac
8563 case "$dflt" in
8564 ' ') dflt=none ;;
8565 esac
8566 echo " "
8567 fn=dn+~
8568 rp="Where do the $package library man pages (source) go?"
8569 . ./getfile
8570 prefixvar=man3dir
8571 . ./setprefixvar
8572
8573 case "$man3dir" in
8574 '')     man3dir=' '
8575         installman3dir='';;
8576 esac
8577
8578 : What suffix to use on installed man pages
8579 case "$man3dir" in
8580 ' ')
8581         man3ext='0'
8582         ;;
8583 *)
8584         rp="What suffix should be used for the $package library man pages?"
8585         case "$man3ext" in
8586         '')     case "$man3dir" in
8587                 *3)  dflt=3 ;;
8588                 *3p) dflt=3p ;;
8589                 *3pm) dflt=3pm ;;
8590                 *l) dflt=l;;
8591                 *n) dflt=n;;
8592                 *o) dflt=o;;
8593                 *p) dflt=p;;
8594                 *C) dflt=C;;
8595                 *L) dflt=L;;
8596                 *L3) dflt=L3;;
8597                 *) dflt=3;;
8598                 esac
8599                 ;;
8600         *)      dflt="$man3ext";;
8601         esac
8602         . ./myread
8603         man3ext="$ans"
8604         ;;
8605 esac
8606
8607 : see if we have to deal with yellow pages, now NIS.
8608 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8609         if $test -f /usr/etc/nibindd; then
8610                 echo " "
8611                 echo "I'm fairly confident you're on a NeXT."
8612                 echo " "
8613                 rp='Do you get the hosts file via NetInfo?'
8614                 dflt=y
8615                 case "$hostcat" in
8616                 nidump*) ;;
8617                 '') ;;
8618                 *) dflt=n;;
8619                 esac
8620                 . ./myread
8621                 case "$ans" in
8622                 y*) hostcat='nidump hosts .';;
8623                 *)      case "$hostcat" in
8624                         nidump*) hostcat='';;
8625                         esac
8626                         ;;
8627                 esac
8628         fi
8629         case "$hostcat" in
8630         nidump*) ;;
8631         *)
8632                 case "$hostcat" in
8633                 *ypcat*) dflt=y;;
8634                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8635                                 dflt=y
8636                         else
8637                                 dflt=n
8638                         fi;;
8639                 *) dflt=n;;
8640                 esac
8641                 echo " "
8642                 rp='Are you getting the hosts file via yellow pages?'
8643                 . ./myread
8644                 case "$ans" in
8645                 y*) hostcat='ypcat hosts';;
8646                 *) hostcat='cat /etc/hosts';;
8647                 esac
8648                 ;;
8649         esac
8650 fi
8651 case "$hostcat" in
8652 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8653 esac
8654 case "$groupcat" in
8655 '') test -f /etc/group && groupcat='cat /etc/group';;
8656 esac
8657 case "$passcat" in
8658 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8659 esac
8660
8661 : now get the host name
8662 echo " "
8663 echo "Figuring out host name..." >&4
8664 case "$myhostname" in
8665 '') cont=true
8666         echo 'Maybe "hostname" will work...'
8667         if tans=`sh -c hostname 2>&1` ; then
8668                 myhostname=$tans
8669                 phostname=hostname
8670                 cont=''
8671         fi
8672         ;;
8673 *) cont='';;
8674 esac
8675 if $test "$cont"; then
8676         if ./xenix; then
8677                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8678                 if tans=`cat /etc/systemid 2>&1` ; then
8679                         myhostname=$tans
8680                         phostname='cat /etc/systemid'
8681                         echo "Whadyaknow.  Xenix always was a bit strange..."
8682                         cont=''
8683                 fi
8684         elif $test -r /etc/systemid; then
8685                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8686         fi
8687 fi
8688 if $test "$cont"; then
8689         echo 'No, maybe "uuname -l" will work...'
8690         if tans=`sh -c 'uuname -l' 2>&1` ; then
8691                 myhostname=$tans
8692                 phostname='uuname -l'
8693         else
8694                 echo 'Strange.  Maybe "uname -n" will work...'
8695                 if tans=`sh -c 'uname -n' 2>&1` ; then
8696                         myhostname=$tans
8697                         phostname='uname -n'
8698                 else
8699                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8700                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8701                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8702                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8703                         else
8704                                 case "$myhostname" in
8705                                 '') echo "Does this machine have an identity crisis or something?"
8706                                         phostname='';;
8707                                 *)
8708                                         echo "Well, you said $myhostname before..."
8709                                         phostname='echo $myhostname';;
8710                                 esac
8711                         fi
8712                 fi
8713         fi
8714 fi
8715 case "$myhostname" in
8716 '') myhostname=noname ;;
8717 esac
8718 : you do not want to know about this
8719 set $myhostname
8720 myhostname=$1
8721
8722 : verify guess
8723 if $test "$myhostname" ; then
8724         dflt=y
8725         rp='Your host name appears to be "'$myhostname'".'" Right?"
8726         . ./myread
8727         case "$ans" in
8728         y*) ;;
8729         *) myhostname='';;
8730         esac
8731 fi
8732
8733 : bad guess or no guess
8734 while $test "X$myhostname" = X ; do
8735         dflt=''
8736         rp="Please type the (one word) name of your host:"
8737         . ./myread
8738         myhostname="$ans"
8739 done
8740
8741 : translate upper to lower if necessary
8742 case "$myhostname" in
8743 *[A-Z]*)
8744         echo "(Normalizing case in your host name)"
8745         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8746         ;;
8747 esac
8748
8749 case "$myhostname" in
8750 *.*)
8751         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8752         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8753         echo "(Trimming domain name from host name--host name is now $myhostname)"
8754         ;;
8755 *) case "$mydomain" in
8756         '')
8757                 {
8758                         test "X$hostcat" = "Xypcat hosts" &&
8759                         ypmatch "$myhostname" hosts 2>/dev/null |\
8760                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8761                         $test -s hosts
8762                 } || {
8763                         test "X$hostcat" != "X" &&
8764                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8765                                         /[       ]$myhostname[  . ]/p" > hosts
8766                 }
8767                 tmp_re="[       . ]"
8768                 if $test -f hosts; then
8769                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8770                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8771                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8772                                 hosts | $sort | $uniq | \
8773                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8774                         case `$echo X$dflt` in
8775                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8776                                 dflt=.
8777                                 ;;
8778                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8779                                 ;;
8780                         esac
8781                 else
8782                         echo "(I cannot locate a hosts database anywhere)"
8783                         dflt=.
8784                 fi
8785                 case "$dflt" in
8786                 .)
8787                         tans=`./loc resolv.conf X /etc /usr/etc`
8788                         if $test -f "$tans"; then
8789                                 echo "(Attempting domain name extraction from $tans)"
8790                                 dflt=.`$sed -n -e 's/   / /g' \
8791                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8792                                   -e 1q 2>/dev/null`
8793                                 case "$dflt" in
8794                                 .) dflt=.`$sed -n -e 's/        / /g' \
8795                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8796                                      -e 1q 2>/dev/null`
8797                                         ;;
8798                                 esac
8799                         fi
8800                         ;;
8801                 esac
8802                 case "$dflt" in
8803                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8804                         dflt=.`sh -c domainname 2>/dev/null`
8805                         case "$dflt" in
8806                         '') dflt='.';;
8807                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8808                         esac
8809                         ;;
8810                 esac
8811                 case "$dflt$osname" in
8812                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8813                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8814                         ;;
8815                 esac
8816                 case "$dflt" in
8817                 .) echo "(Lost all hope -- silly guess then)"
8818                         dflt='.nonet'
8819                         ;;
8820                 esac
8821                 $rm -f hosts
8822                 ;;
8823         *) dflt="$mydomain";;
8824         esac;;
8825 esac
8826 echo " "
8827 rp="What is your domain name?"
8828 . ./myread
8829 tans="$ans"
8830 case "$ans" in
8831 '') ;;
8832 .*) ;;
8833 *) tans=".$tans";;
8834 esac
8835 mydomain="$tans"
8836
8837 : translate upper to lower if necessary
8838 case "$mydomain" in
8839 *[A-Z]*)
8840         echo "(Normalizing case in your domain name)"
8841         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8842         ;;
8843 esac
8844
8845 : a little sanity check here
8846 case "$phostname" in
8847 '') ;;
8848 *)
8849         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8850         $myhostname$mydomain|$myhostname) ;;
8851         *)
8852                 case "$phostname" in
8853                 sed*)
8854                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8855                         ;;
8856                 *)
8857                         echo "(That doesn't agree with your $phostname command, by the way.)"
8858                         ;;
8859                 esac
8860         ;;
8861         esac
8862         ;;
8863 esac
8864
8865 : determine the e-mail address of the user who is running us
8866 $cat <<EOM
8867
8868 I need to get your e-mail address in Internet format if possible, i.e.
8869 something like user@host.domain. Please answer accurately since I have
8870 no easy means to double check it. The default value provided below
8871 is most probably close to reality but may not be valid from outside
8872 your organization...
8873
8874 EOM
8875 cont=x
8876 while test "$cont"; do
8877         case "$cf_email" in
8878         '') dflt="$cf_by@$myhostname$mydomain";;
8879         *) dflt="$cf_email";;
8880         esac
8881         rp='What is your e-mail address?'
8882         . ./myread
8883         cf_email="$ans"
8884         case "$cf_email" in
8885         *@*.*) cont='' ;;
8886         *)
8887                 rp='Address does not look like an Internet one.  Use it anyway?'
8888                 case "$fastread" in
8889                 yes) dflt=y ;;
8890                 *) dflt=n ;;
8891                 esac
8892                 . ./myread
8893                 case "$ans" in
8894                 y*) cont='' ;;
8895                 *) echo " " ;;
8896                 esac
8897                 ;;
8898         esac
8899 done
8900
8901 : Ask e-mail of administrator
8902 $cat <<EOM
8903
8904 If you or somebody else will be maintaining perl at your site, please
8905 fill in the correct e-mail address here so that they may be contacted
8906 if necessary. Currently, the "perlbug" program included with perl
8907 will send mail to this address in addition to perlbug@perl.org. You may
8908 enter "none" for no administrator.
8909
8910 EOM
8911 case "$perladmin" in
8912 '') dflt="$cf_email";;
8913 *) dflt="$perladmin";;
8914 esac
8915 rp='Perl administrator e-mail address'
8916 . ./myread
8917 perladmin="$ans"
8918
8919 : determine whether to only install version-specific parts.
8920 echo " "
8921 $cat <<EOM
8922 Do you want to install only the version-specific parts of the perl
8923 distribution?  Usually you do *not* want to do this.
8924 EOM
8925 case "$versiononly" in
8926 "$define"|[Yy]*|true) dflt='y' ;;
8927 *) dflt='n';
8928 esac
8929 rp="Do you want to install only the version-specific parts of perl?"
8930 . ./myread
8931 case "$ans" in
8932 [yY]*)  val="$define";;
8933 *)      val="$undef" ;;
8934 esac
8935 set versiononly
8936 eval $setvar
8937
8938 case "$versiononly" in
8939 "$define") inc_version_list=''
8940            inc_version_list_init=0
8941            ;;
8942 esac
8943
8944 : figure out how to guarantee perl startup
8945 : XXX Note that this currently takes advantage of the bug that binexp ignores
8946 :     the Configure -Dinstallprefix setting, which in turn means that under
8947 :     relocatable @INC, initialinstalllocation is what binexp started as.
8948 case "$startperl" in
8949 '')
8950         case "$sharpbang" in
8951         *!)
8952                 $cat <<EOH
8953
8954 I can use the #! construct to start perl on your system. This will
8955 make startup of perl scripts faster, but may cause problems if you
8956 want to share those scripts and perl is not in a standard place
8957 ($initialinstalllocation/perl) on all your platforms. The alternative
8958 is to force a shell by starting the script with a single ':' character.
8959
8960 EOH
8961                 case "$versiononly" in
8962                 "$define")      dflt="$initialinstalllocation/perl$version";;
8963                 *)              dflt="$initialinstalllocation/perl";;
8964                 esac
8965                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8966                 . ./myread
8967                 case "$ans" in
8968                 none)   startperl=": # use perl";;
8969                 *)      startperl="#!$ans"
8970                         if $test 30 -lt `echo "$ans" | wc -c`; then
8971                                 $cat >&4 <<EOM
8972
8973 WARNING:  Some systems limit the #! command to 32 characters.
8974 If you experience difficulty running Perl scripts with #!, try
8975 installing Perl in a directory with a shorter pathname.
8976
8977 EOM
8978                         fi ;;
8979                 esac
8980                 ;;
8981         *) startperl=": # use perl"
8982                 ;;
8983         esac
8984         ;;
8985 esac
8986 echo "I'll use $startperl to start perl scripts."
8987
8988 : figure best path for perl in scripts
8989 case "$perlpath" in
8990 '')
8991         case "$versiononly" in
8992         "$define")      perlpath="$initialinstalllocation/perl$version";;
8993         *)              perlpath="$initialinstalllocation/perl";;
8994         esac
8995         case "$startperl" in
8996         *!*) ;;
8997         *)
8998                 $cat <<EOH
8999
9000 I will use the "eval 'exec'" idiom to start Perl on your system.
9001 I can use the full path of your Perl binary for this purpose, but
9002 doing so may cause problems if you want to share those scripts and
9003 Perl is not always in a standard place ($initialinstalllocation/perl).
9004
9005 EOH
9006                 dflt="$initialinstalllocation/perl"
9007                 rp="What path shall I use in \"eval 'exec'\"?"
9008                 . ./myread
9009                 perlpath="$ans"
9010                 ;;
9011         esac
9012         ;;
9013 esac
9014 case "$startperl" in
9015 *!*)    ;;
9016 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9017 esac
9018
9019 : determine where public executable scripts go
9020 set scriptdir scriptdir
9021 eval $prefixit
9022 case "$scriptdir" in
9023 '')
9024         dflt="$bin"
9025         : guess some guesses
9026         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9027         $test -d /usr/share/bin     && dflt=/usr/share/bin
9028         $test -d /usr/local/script  && dflt=/usr/local/script
9029         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9030         $test -d $prefixexp/script  && dflt=$prefixexp/script
9031         set dflt
9032         eval $prefixup
9033         ;;
9034 *)  dflt="$scriptdir"
9035         ;;
9036 esac
9037 $cat <<EOM
9038
9039 Some installations have a separate directory just for executable scripts so
9040 that they can mount it across multiple architectures but keep the scripts in
9041 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9042 Or you might just lump your scripts in with all your other executables.
9043
9044 EOM
9045 fn=d~
9046 rp='Where do you keep publicly executable scripts?'
9047 . ./getfile
9048 if $test "X$ansexp" != "X$scriptdirexp"; then
9049         installscript=''
9050 fi
9051 installscriptdir=''
9052 prefixvar=scriptdir
9053 . ./setprefixvar
9054 : A little fix up for an irregularly named variable.
9055 installscript="$installscriptdir"
9056
9057 : determine where add-on public executables go
9058 case "$sitebin" in
9059 '')     dflt=$siteprefix/bin ;;
9060 *)      dflt=$sitebin ;;
9061 esac
9062 fn=d~
9063 rp='Pathname where the add-on public executables should be installed?'
9064 . ./getfile
9065 prefixvar=sitebin
9066 . ./setprefixvar
9067
9068 : determine where add-on html pages go
9069 : There is no standard location, so try to copy the previously-selected
9070 : directory structure for the core html pages.
9071 case "$sitehtml1dir" in
9072 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9073 *)     dflt=$sitehtml1dir ;;
9074 esac
9075 case "$dflt" in
9076 ''|' ') dflt=none ;;
9077 esac
9078 fn=dn+~
9079 rp='Pathname where the site-specific html pages should be installed?'
9080 . ./getfile
9081 prefixvar=sitehtml1dir
9082 . ./setprefixvar
9083
9084 : determine where add-on library html pages go
9085 : There is no standard location, so try to copy the previously-selected
9086 : directory structure for the core html pages.
9087 case "$sitehtml3dir" in
9088 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9089 *)     dflt=$sitehtml3dir ;;
9090 esac
9091 case "$dflt" in
9092 ''|' ') dflt=none ;;
9093 esac
9094 fn=dn+~
9095 rp='Pathname where the site-specific library html pages should be installed?'
9096 . ./getfile
9097 prefixvar=sitehtml3dir
9098 . ./setprefixvar
9099
9100 : determine where add-on manual pages go
9101 case "$siteman1dir" in
9102 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9103 *)      dflt=$siteman1dir ;;
9104 esac
9105 case "$dflt" in
9106 ''|' ') dflt=none ;;
9107 esac
9108 fn=dn+~
9109 rp='Pathname where the site-specific manual pages should be installed?'
9110 . ./getfile
9111 prefixvar=siteman1dir
9112 . ./setprefixvar
9113
9114 : determine where add-on library man pages go
9115 case "$siteman3dir" in
9116 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9117 *)      dflt=$siteman3dir ;;
9118 esac
9119 case "$dflt" in
9120 ''|' ') dflt=none ;;
9121 esac
9122 fn=dn+~
9123 rp='Pathname where the site-specific library manual pages should be installed?'
9124 . ./getfile
9125 prefixvar=siteman3dir
9126 . ./setprefixvar
9127
9128 : determine where add-on public executable scripts go
9129 case "$sitescript" in
9130 '')     dflt=$siteprefix/script
9131         $test -d $dflt || dflt=$sitebin ;;
9132 *)  dflt="$sitescript" ;;
9133 esac
9134 fn=d~+
9135 rp='Pathname where add-on public executable scripts should be installed?'
9136 . ./getfile
9137 prefixvar=sitescript
9138 . ./setprefixvar
9139
9140 : Check if faststdio is requested and available
9141 case "$usefaststdio" in
9142 $define|true|[yY]*|'')
9143         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9144         case "$xversion" in
9145         [68])   dflt='y' ;;
9146         *)      dflt='n' ;;
9147         esac
9148         ;;
9149 *) dflt='n';;
9150 esac
9151 cat <<EOM
9152
9153 Perl can be built to use 'fast stdio', which means using the stdio
9154 library but also directly manipulating the stdio buffers to enable
9155 faster I/O.  Using stdio is better for backward compatibility (especially
9156 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9157 interface has been preferred instead of stdio.
9158
9159 If this doesn't make any sense to you, just accept the default '$dflt'.
9160 EOM
9161 rp='Use the "fast stdio" if available?'
9162 . ./myread
9163 case "$ans" in
9164 y|Y)    val="$define" ;;
9165 *)      val="$undef" ;;
9166 esac
9167 set usefaststdio
9168 eval $setvar
9169
9170
9171 : define an is-a-typedef? function
9172 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9173 case "$inclist" in
9174 "") inclist="sys/types.h";;
9175 esac;
9176 eval "varval=\$$var";
9177 case "$varval" in
9178 "")
9179         $rm -f temp.c;
9180         for inc in $inclist; do
9181                 echo "#include <$inc>" >>temp.c;
9182         done;
9183         echo "#ifdef $type" >> temp.c;
9184         echo "printf(\"We have $type\");" >> temp.c;
9185         echo "#endif" >> temp.c;
9186         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9187         if $contains $type temp.E >/dev/null 2>&1; then
9188                 eval "$var=\$type";
9189         else
9190                 eval "$var=\$def";
9191         fi;
9192         $rm -f temp.?;;
9193 *) eval "$var=\$varval";;
9194 esac'
9195
9196 : define an is-a-typedef? function that prompts if the type is not available.
9197 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9198 case "$inclist" in
9199 "") inclist="sys/types.h";;
9200 esac;
9201 eval "varval=\$$var";
9202 case "$varval" in
9203 "")
9204         $rm -f temp.c;
9205         for inc in $inclist; do
9206                 echo "#include <$inc>" >>temp.c;
9207         done;
9208         echo "#ifdef $type" >> temp.c;
9209         echo "printf(\"We have $type\");" >> temp.c;
9210         echo "#endif" >> temp.c;
9211         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9212         echo " " ;
9213         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9214         if $contains $type temp.E >/dev/null 2>&1; then
9215                 echo "$type found." >&4;
9216                 eval "$var=\$type";
9217         else
9218                 echo "$type NOT found." >&4;
9219                 dflt="$def";
9220                 . ./myread ;
9221                 eval "$var=\$ans";
9222         fi;
9223         $rm -f temp.?;;
9224 *) eval "$var=\$varval";;
9225 esac'
9226
9227 : see what type lseek is declared as in the kernel
9228 rp="What is the type used for lseek's offset on this system?"
9229 set off_t lseektype long stdio.h sys/types.h
9230 eval $typedef_ask
9231
9232 echo " "
9233 echo "Checking to see how big your file offsets are..." >&4
9234 $cat >try.c <<EOCP
9235 #include <sys/types.h>
9236 #include <stdio.h>
9237 int main()
9238 {
9239     printf("%d\n", (int)sizeof($lseektype));
9240     return(0);
9241 }
9242 EOCP
9243 set try
9244 if eval $compile_ok; then
9245         lseeksize=`$run ./try`
9246         echo "Your file offsets are $lseeksize bytes long."
9247 else
9248         dflt=$longsize
9249         echo " "
9250         echo "(I can't seem to compile the test program.  Guessing...)"
9251         rp="What is the size of your file offsets (in bytes)?"
9252         . ./myread
9253         lseeksize="$ans"
9254 fi
9255 $rm_try
9256
9257 : see what type file positions are declared as in the library
9258 rp="What is the type for file position used by fsetpos()?"
9259 set fpos_t fpostype long stdio.h sys/types.h
9260 eval $typedef_ask
9261
9262 : Check size for Fpos_t
9263 echo " "
9264 case "$fpostype" in
9265 *_t) zzz="$fpostype"    ;;
9266 *)   zzz="fpos_t"       ;;
9267 esac
9268 echo "Checking the size of $zzz..." >&4
9269 cat > try.c <<EOCP
9270 #include <sys/types.h>
9271 #include <stdio.h>
9272 #$i_stdlib I_STDLIB
9273 #ifdef I_STDLIB
9274 #include <stdlib.h>
9275 #endif
9276 int main() {
9277     printf("%d\n", (int)sizeof($fpostype));
9278     exit(0);
9279 }
9280 EOCP
9281 set try
9282 if eval $compile_ok; then
9283         yyy=`$run ./try`
9284         case "$yyy" in
9285         '')     fpossize=4
9286                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9287                 ;;
9288         *)      fpossize=$yyy
9289                 echo "Your $zzz is $fpossize bytes long."
9290                 ;;
9291         esac
9292 else
9293         dflt="$longsize"
9294         echo " " >&4
9295         echo "(I can't compile the test program.  Guessing...)" >&4
9296         rp="What is the size of your file positions (in bytes)?"
9297         . ./myread
9298         fpossize="$ans"
9299 fi
9300
9301 : Check for large file support
9302 # Backward compatibility (uselfs is deprecated).
9303 case "$uselfs" in
9304 "$define"|true|[yY]*)
9305         cat <<EOM >&4
9306
9307 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9308 EOM
9309         uselargefiles="$define"
9310         ;;
9311 esac
9312
9313 case "$lseeksize:$fpossize" in
9314 8:8) cat <<EOM
9315
9316 You can have files larger than 2 gigabytes.
9317 EOM
9318    val="$define" ;;
9319 *)    case "$uselargefiles" in
9320    "$undef"|false|[nN]*) dflt='n' ;;
9321    *)   dflt='y' ;;
9322    esac
9323    cat <<EOM
9324
9325 Perl can be built to understand large files (files larger than 2 gigabytes)
9326 on some systems.  To do so, Configure can be run with -Duselargefiles.
9327
9328 If this doesn't make any sense to you, just accept the default '$dflt'.
9329 EOM
9330    rp='Try to understand large files, if available?'
9331    . ./myread
9332    case "$ans" in
9333    y|Y)         val="$define" ;;
9334    *)           val="$undef"  ;;
9335    esac
9336    ;;
9337 esac
9338 set uselargefiles
9339 eval $setvar
9340 : Look for a hint-file generated 'call-back-unit'.  If the
9341 : user has specified that a large files perl is to be built,
9342 : we may need to set or change some other defaults.
9343 if $test -f uselargefiles.cbu; then
9344         echo "Your platform has some specific hints regarding large file builds, using them..."
9345         . ./uselargefiles.cbu
9346 fi
9347 case "$uselargefiles" in
9348 "$define")
9349         if $test -f uselargefiles.cbu; then
9350                 echo " "
9351                 echo "Rechecking to see how big your file offsets are..." >&4
9352                 $cat >try.c <<EOCP
9353 #include <sys/types.h>
9354 #include <stdio.h>
9355 int main()
9356 {
9357     printf("%d\n", (int)sizeof($lseektype));
9358     return(0);
9359 }
9360 EOCP
9361                 set try
9362                 if eval $compile_ok; then
9363                         lseeksize=`$run ./try`
9364                         $echo "Your file offsets are now $lseeksize bytes long."
9365                 else
9366                         dflt="$lseeksize"
9367                         echo " "
9368                         echo "(I can't seem to compile the test program.  Guessing...)"
9369                         rp="What is the size of your file offsets (in bytes)?"
9370                         . ./myread
9371                         lseeksize="$ans"
9372                 fi
9373                 case "$fpostype" in
9374                 *_t) zzz="$fpostype"    ;;
9375                 *)   zzz="fpos_t"       ;;
9376                 esac
9377                 $echo $n "Rechecking the size of $zzz...$c" >&4
9378                 $cat > try.c <<EOCP
9379 #include <sys/types.h>
9380 #include <stdio.h>
9381 #$i_stdlib I_STDLIB
9382 #ifdef I_STDLIB
9383 #include <stdlib.h>
9384 #endif
9385 int main() {
9386     printf("%d\n", (int)sizeof($fpostype));
9387     return(0);
9388 }
9389 EOCP
9390                 set try
9391                 if eval $compile_ok; then
9392                         yyy=`$run ./try`
9393                         dflt="$lseeksize"
9394                         case "$yyy" in
9395                         '')     echo " "
9396                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9397                                 ;;
9398                         *)      fpossize=$yyy
9399                                 echo " $fpossize bytes." >&4
9400                                 ;;
9401                         esac
9402                 else
9403                         dflt="$fpossize"
9404                         echo " "
9405                         echo "(I can't compile the test program.  Guessing...)" >&4
9406                         rp="What is the size of your file positions (in bytes)?"
9407                         . ./myread
9408                         fpossize="$ans"
9409                 fi
9410                 $rm_try
9411         fi
9412         ;;
9413 esac
9414
9415 : Set the vendorbin variables
9416 case "$vendorprefix" in
9417 '')     d_vendorbin="$undef"
9418         vendorbin=''
9419         vendorbinexp=''
9420         ;;
9421 *)      d_vendorbin="$define"
9422         : determine where vendor-supplied executables go.
9423         case "$vendorbin" in
9424         '') dflt=$vendorprefix/bin ;;
9425         *)      dflt="$vendorbin" ;;
9426         esac
9427         fn=d~+
9428         rp='Pathname for the vendor-supplied executables directory?'
9429         . ./getfile
9430         vendorbin="$ans"
9431         vendorbinexp="$ansexp"
9432         ;;
9433 esac
9434 prefixvar=vendorbin
9435 . ./installprefix
9436
9437 : Set the vendorhtml1dir variables
9438 case "$vendorprefix" in
9439 '')     vendorhtml1dir=''
9440         vendorhtml1direxp=''
9441         ;;
9442 *)      : determine where vendor-supplied html pages go.
9443         : There is no standard location, so try to copy the previously-selected
9444         : directory structure for the core html pages.
9445         : XXX Better default suggestions would be welcome.
9446         case "$vendorhtml1dir" in
9447         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9448         *)      dflt=$vendorhtml1dir ;;
9449         esac
9450         case "$dflt" in
9451         ''|' ') dflt=none ;;
9452         esac
9453         fn=dn+~
9454         rp='Pathname for the vendor-supplied html pages?'
9455         . ./getfile
9456         vendorhtml1dir="$ans"
9457         vendorhtml1direxp="$ansexp"
9458         ;;
9459 esac
9460 : Use ' ' for none so value is preserved next time through Configure
9461 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9462 prefixvar=vendorhtml1dir
9463 . ./installprefix
9464
9465 : Set the vendorhtml3dir variables
9466 case "$vendorprefix" in
9467 '')     vendorhtml3dir=''
9468         vendorhtml3direxp=''
9469         ;;
9470 *)      : determine where vendor-supplied module html pages go.
9471         : There is no standard location, so try to copy the previously-selected
9472         : directory structure for the core html pages.
9473         : XXX Better default suggestions would be welcome.
9474         case "$vendorhtml3dir" in
9475         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9476         *)      dflt=$vendorhtml3dir ;;
9477         esac
9478         case "$dflt" in
9479         ''|' ') dflt=none ;;
9480         esac
9481         fn=dn+~
9482         rp='Pathname for the vendor-supplied html pages?'
9483         . ./getfile
9484         vendorhtml3dir="$ans"
9485         vendorhtml3direxp="$ansexp"
9486         ;;
9487 esac
9488 : Use ' ' for none so value is preserved next time through Configure
9489 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9490 prefixvar=vendorhtml3dir
9491 . ./installprefix
9492
9493 : Set the vendorman1dir variables
9494 case "$vendorprefix" in
9495 '')     vendorman1dir=''
9496         vendorman1direxp=''
9497         ;;
9498 *)      : determine where vendor-supplied manual pages go.
9499         case "$vendorman1dir" in
9500         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9501         *)      dflt=$vendorman1dir ;;
9502         esac
9503         case "$dflt" in
9504         ''|' ') dflt=none ;;
9505         esac
9506         fn=nd~+
9507         rp='Pathname for the vendor-supplied manual section 1 pages?'
9508         . ./getfile
9509         vendorman1dir="$ans"
9510         vendorman1direxp="$ansexp"
9511         ;;
9512 esac
9513 : Use ' ' for none so value is preserved next time through Configure
9514 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9515 prefixvar=vendorman1dir
9516 . ./installprefix
9517
9518 : Set the vendorman3dir variables
9519 case "$vendorprefix" in
9520 '')     vendorman3dir=''
9521         vendorman3direxp=''
9522         ;;
9523 *)      : determine where vendor-supplied module manual pages go.
9524         case "$vendorman3dir" in
9525         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9526         *)      dflt=$vendorman3dir ;;
9527         esac
9528         case "$dflt" in
9529         ''|' ') dflt=none ;;
9530         esac
9531         fn=nd~+
9532         rp='Pathname for the vendor-supplied manual section 3 pages?'
9533         . ./getfile
9534         vendorman3dir="$ans"
9535         vendorman3direxp="$ansexp"
9536         ;;
9537 esac
9538 : Use ' ' for none so value is preserved next time through Configure
9539 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9540 prefixvar=vendorman3dir
9541 . ./installprefix
9542
9543 : Set the vendorscript variables
9544 case "$vendorprefix" in
9545 '')     d_vendorscript="$undef"
9546         vendorscript=''
9547         vendorscriptexp=''
9548         ;;
9549 *)      d_vendorscript="$define"
9550         : determine where vendor-supplied scripts go.
9551         case "$vendorscript" in
9552         '')     dflt=$vendorprefix/script
9553                 $test -d $dflt || dflt=$vendorbin ;;
9554         *)  dflt="$vendorscript" ;;
9555         esac
9556         $cat <<EOM
9557
9558 The installation process will create a directory for
9559 vendor-supplied scripts.
9560
9561 EOM
9562         fn=d~+
9563         rp='Pathname for the vendor-supplied scripts directory?'
9564         . ./getfile
9565         vendorscript="$ans"
9566         vendorscriptexp="$ansexp"
9567         ;;
9568 esac
9569 prefixvar=vendorscript
9570 . ./installprefix
9571
9572 : script used to emit important warnings
9573 cat >warn <<EOS
9574 $startsh
9575 if test \$# -gt 0; then
9576         echo "\$@" >msg
9577 else
9578         cat >msg
9579 fi
9580 echo "*** WARNING:" >&4
9581 sed -e 's/^/*** /' <msg >&4
9582 echo "*** " >&4
9583 cat msg >>config.msg
9584 echo " " >>config.msg
9585 rm -f msg
9586 EOS
9587 chmod +x warn
9588 $eunicefix warn
9589
9590 : see which of string.h or strings.h is needed
9591 echo " "
9592 strings=`./findhdr string.h`
9593 if $test "$strings" && $test -r "$strings"; then
9594         echo "Using <string.h> instead of <strings.h>." >&4
9595         val="$define"
9596 else
9597         val="$undef"
9598         strings=`./findhdr strings.h`
9599         if $test "$strings" && $test -r "$strings"; then
9600                 echo "Using <strings.h> instead of <string.h>." >&4
9601         else
9602                 ./warn "No string header found -- You'll surely have problems."
9603         fi
9604 fi
9605 set i_string
9606 eval $setvar
9607 case "$i_string" in
9608 "$undef") strings=`./findhdr strings.h`;;
9609 *)        strings=`./findhdr string.h`;;
9610 esac
9611
9612 : see if qgcvt exists
9613 set qgcvt d_qgcvt
9614 eval $inlibc
9615
9616 : Check print/scan long double stuff
9617 echo " "
9618
9619 if $test X"$d_longdbl" = X"$define"; then
9620
9621 echo "Checking how to print long doubles..." >&4
9622
9623 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9624         $cat >try.c <<'EOCP'
9625 #include <sys/types.h>
9626 #include <stdio.h>
9627 int main() {
9628   double d = 123.456;
9629   printf("%.3f\n", d);
9630 }
9631 EOCP
9632         set try
9633         if eval $compile; then
9634                 yyy=`$run ./try`
9635                 case "$yyy" in
9636                 123.456)
9637                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9638                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9639                         echo "We will use %f."
9640                         ;;
9641                 esac
9642         fi
9643 fi
9644
9645 if $test X"$sPRIfldbl" = X; then
9646         $cat >try.c <<'EOCP'
9647 #include <sys/types.h>
9648 #include <stdio.h>
9649 int main() {
9650   long double d = 123.456;
9651   printf("%.3Lf\n", d);
9652 }
9653 EOCP
9654         set try
9655         if eval $compile; then
9656                 yyy=`$run ./try`
9657                 case "$yyy" in
9658                 123.456)
9659                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9660                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9661                         echo "We will use %Lf."
9662                         ;;
9663                 esac
9664         fi
9665 fi
9666
9667 if $test X"$sPRIfldbl" = X; then
9668         $cat >try.c <<'EOCP'
9669 #include <sys/types.h>
9670 #include <stdio.h>
9671 int main() {
9672   long double d = 123.456;
9673   printf("%.3llf\n", d);
9674 }
9675 EOCP
9676         set try
9677         if eval $compile; then
9678                 yyy=`$run ./try`
9679                 case "$yyy" in
9680                 123.456)
9681                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9682                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9683                         echo "We will use %llf."
9684                         ;;
9685                 esac
9686         fi
9687 fi
9688
9689 if $test X"$sPRIfldbl" = X; then
9690         $cat >try.c <<'EOCP'
9691 #include <sys/types.h>
9692 #include <stdio.h>
9693 int main() {
9694   long double d = 123.456;
9695   printf("%.3lf\n", d);
9696 }
9697 EOCP
9698         set try
9699         if eval $compile; then
9700                 yyy=`$run ./try`
9701                 case "$yyy" in
9702                 123.456)
9703                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9704                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9705                         echo "We will use %lf."
9706                         ;;
9707                 esac
9708         fi
9709 fi
9710
9711 if $test X"$sPRIfldbl" = X; then
9712         echo "Cannot figure out how to print long doubles." >&4
9713 else
9714         sSCNfldbl=$sPRIfldbl    # expect consistency
9715 fi
9716
9717 $rm_try
9718
9719 fi # d_longdbl
9720
9721 case "$sPRIfldbl" in
9722 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9723         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9724         d_SCNfldbl="$undef";
9725         ;;
9726 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9727         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9728         d_SCNfldbl="$define";
9729         ;;
9730 esac
9731
9732 : Check how to convert floats to strings.
9733
9734 if test "X$d_Gconvert" = X; then
9735
9736 echo " "
9737 echo "Checking for an efficient way to convert floats to strings."
9738 echo " " > try.c
9739 case "$uselongdouble" in
9740 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9741 esac
9742 case "$d_longdbl" in
9743 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9744 esac
9745 case "$d_PRIgldbl" in
9746 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9747 esac
9748 $cat >>try.c <<EOP
9749 #ifdef TRY_gconvert
9750 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9751 char *myname = "gconvert";
9752 #endif
9753 #ifdef TRY_gcvt
9754 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9755 char *myname = "gcvt";
9756 #endif
9757 #ifdef TRY_qgcvt
9758 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9759 char *myname = "qgcvt";
9760 #define DOUBLETYPE long double
9761 #endif
9762 #ifdef TRY_sprintf
9763 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9764 #ifdef HAS_PRIgldbl
9765 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9766 #else
9767 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9768 #endif
9769 #else
9770 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9771 #endif
9772 char *myname = "sprintf";
9773 #endif
9774
9775 #ifndef DOUBLETYPE
9776 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9777 #define DOUBLETYPE long double
9778 #else
9779 #define DOUBLETYPE double
9780 #endif
9781 #endif
9782
9783 #include <stdio.h>
9784
9785 #$i_stdlib I_STDLIB
9786 #ifdef I_STDLIB
9787 #include <stdlib.h>
9788 #endif
9789 #$i_string I_STRING
9790 #ifdef I_STRING
9791 #  include <string.h>
9792 #else
9793 #  include <strings.h>
9794 #endif
9795
9796 int checkit(char *expect, char *got)
9797 {
9798     if (strcmp(expect, got)) {
9799                 printf("%s oddity:  Expected %s, got %s\n",
9800                         myname, expect, got);
9801                 exit(1);
9802         }
9803 }
9804
9805 int main()
9806 {
9807         char buf[64];
9808         buf[63] = '\0';
9809
9810         /* This must be 1st test on (which?) platform */
9811         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9812         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9813         checkit("0.1", buf);
9814
9815         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9816         checkit("0.01", buf);
9817
9818         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9819         checkit("0.001", buf);
9820
9821         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9822         checkit("0.0001", buf);
9823
9824         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9825         if (strlen(buf) > 5)
9826             checkit("9e-005", buf); /* for Microsoft ?? */
9827         else
9828             checkit("9e-05", buf);
9829
9830         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9831         checkit("1", buf);
9832
9833         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9834         checkit("1.1", buf);
9835
9836         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9837         checkit("1.01", buf);
9838
9839         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9840         checkit("1.001", buf);
9841
9842         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9843         checkit("1.0001", buf);
9844
9845         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9846         checkit("1.00001", buf);
9847
9848         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9849         checkit("1.000001", buf);
9850
9851         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9852         checkit("0", buf);
9853
9854         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9855         checkit("-1", buf);
9856
9857         /* Some Linux gcvt's give 1.e+5 here. */
9858         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9859         checkit("100000", buf);
9860
9861         /* Some Linux gcvt's give -1.e+5 here. */
9862         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9863         checkit("-100000", buf);
9864
9865         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9866         checkit("123.456", buf);
9867
9868         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9869         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9870         /* 34 should be enough to scare even long double
9871          * places into using the e notation. */
9872         if (strlen(buf) > 5)
9873             checkit("1e+034", buf); /* for Microsoft */
9874         else
9875             checkit("1e+34", buf);
9876
9877         /* For Perl, if you add additional tests here, also add them to
9878          * t/base/num.t for benefit of platforms not using Configure or
9879          * overriding d_Gconvert */
9880
9881         exit(0);
9882 }
9883 EOP
9884 : first add preferred functions to our list
9885 xxx_list=""
9886 for xxx_convert in $gconvert_preference; do
9887     case $xxx_convert in
9888     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9889     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9890     esac
9891 done
9892 : then add any others
9893 for xxx_convert in gconvert gcvt sprintf; do
9894     case "$xxx_list" in
9895     *$xxx_convert*) ;;
9896     *) xxx_list="$xxx_list $xxx_convert" ;;
9897     esac
9898 done
9899
9900 case "$d_longdbl$uselongdouble" in
9901 "$define$define")
9902     : again, add prefered functions to our list first
9903     xxx_ld_list=""
9904     for xxx_convert in $gconvert_ld_preference; do
9905         case $xxx_convert in
9906         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9907         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9908         esac
9909     done
9910     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9911     for xxx_convert in qgcvt sprintf $xxx_list; do
9912         case "$xxx_ld_list" in
9913         $xxx_convert*|*" $xxx_convert"*) ;;
9914         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9915         esac
9916     done
9917     : if sprintf cannot do long doubles, move it to the end
9918     if test "$d_PRIgldbl" != "$define"; then
9919         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9920     fi
9921     : if no qgcvt, remove it
9922     if test "$d_qgcvt" != "$define"; then
9923         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9924     fi
9925     : use the ld_list
9926     xxx_list="$xxx_ld_list"
9927     ;;
9928 esac
9929
9930 for xxx_convert in $xxx_list; do
9931         echo "Trying $xxx_convert..."
9932         $rm -f try try$_o core
9933         set try -DTRY_$xxx_convert
9934         if eval $compile; then
9935                 echo "$xxx_convert() found." >&4
9936                 if $run ./try; then
9937                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9938                         break;
9939                 else
9940                         echo "...But $xxx_convert didn't work as I expected."
9941                         xxx_convert=''
9942                 fi
9943         else
9944                 echo "$xxx_convert NOT found." >&4
9945         fi
9946 done
9947
9948 if test X$xxx_convert = X; then
9949     echo "*** WHOA THERE!!! ***" >&4
9950     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9951     xxx_convert=sprintf
9952 fi
9953
9954 case "$xxx_convert" in
9955 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9956 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9957 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9958 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9959    "$define$define$define")
9960       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9961    "$define$define$undef")
9962       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9963    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9964    esac
9965    ;;
9966 esac
9967
9968 fi
9969 $rm_try
9970
9971 : see if _fwalk exists
9972 set fwalk d__fwalk
9973 eval $inlibc
9974
9975 : Initialize h_fcntl
9976 h_fcntl=false
9977
9978 : Initialize h_sysfile
9979 h_sysfile=false
9980
9981 : access call always available on UNIX
9982 set access d_access
9983 eval $inlibc
9984
9985 : locate the flags for 'access()'
9986 case "$d_access" in
9987 "$define")
9988         echo " "
9989         $cat >access.c <<EOCP
9990 #include <sys/types.h>
9991 #ifdef I_FCNTL
9992 #include <fcntl.h>
9993 #endif
9994 #ifdef I_SYS_FILE
9995 #include <sys/file.h>
9996 #endif
9997 #ifdef I_UNISTD
9998 #include <unistd.h>
9999 #endif
10000 #$i_stdlib I_STDLIB
10001 #ifdef I_STDLIB
10002 #include <stdlib.h>
10003 #endif
10004 int main() {
10005         exit(R_OK);
10006 }
10007 EOCP
10008         : check sys/file.h first, no particular reason here
10009         if $test `./findhdr sys/file.h` && \
10010                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10011                 h_sysfile=true;
10012                 echo "<sys/file.h> defines the *_OK access constants." >&4
10013         elif $test `./findhdr fcntl.h` && \
10014                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10015                 h_fcntl=true;
10016                 echo "<fcntl.h> defines the *_OK access constants." >&4
10017         elif $test `./findhdr unistd.h` && \
10018                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10019                 echo "<unistd.h> defines the *_OK access constants." >&4
10020         else
10021                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10022         fi
10023         ;;
10024 esac
10025 $rm -f access*
10026
10027 : see if accessx exists
10028 set accessx d_accessx
10029 eval $inlibc
10030
10031 : see if aintl exists
10032 set aintl d_aintl
10033 eval $inlibc
10034
10035 : see if alarm exists
10036 set alarm d_alarm
10037 eval $inlibc
10038
10039 : see if 64bit time functions exists
10040
10041 set ctime64 d_ctime64
10042 eval $inlibc
10043
10044 set localtime64 d_localtime64
10045 eval $inlibc
10046
10047 set gmtime64 d_gmtime64
10048 eval $inlibc
10049
10050 set mktime64 d_mktime64
10051 eval $inlibc
10052
10053 set difftime64 d_difftime64
10054 eval $inlibc
10055
10056 set asctime64 d_asctime64
10057 eval $inlibc
10058
10059 : see if POSIX threads are available
10060 set pthread.h i_pthread
10061 eval $inhdr
10062
10063 : define a fucntion to check prototypes
10064 $cat > protochk <<EOSH
10065 $startsh
10066 cc="$cc"
10067 optimize="$optimize"
10068 ccflags="$ccflags"
10069 prototype="$prototype"
10070 define="$define"
10071 rm_try="$rm_try"
10072 usethreads=$usethreads
10073 i_pthread=$i_pthread
10074 pthread_h_first=$pthread_h_first
10075 EOSH
10076
10077 $cat >> protochk <<'EOSH'
10078
10079 $rm_try
10080 foo="$1"
10081 shift
10082 while test $# -ge 2; do
10083         case "$1" in
10084                 $define) echo "#include <$2>" >> try.c ;;
10085                 literal) echo "$2" >> try.c ;;
10086         esac
10087     # Extra magic for the benefit of systems that need pthread.h
10088     # to be included early to correctly detect threadsafe functions.
10089     # Such functions must guarantee themselves, though, that the usethreads
10090     # and i_pthread have been defined, before calling protochk.
10091     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10092         echo "#include <pthread.h>" >> try.c
10093         pthread_h_done=yes
10094     fi
10095     shift 2
10096 done
10097 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10098 cat >> try.c <<'EOCP'
10099 #ifdef CAN_PROTOTYPE
10100 #define _(args) args
10101 #else
10102 #define _(args) ()
10103 #endif
10104 EOCP
10105 echo "$foo" >> try.c
10106 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10107 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10108 status=$?
10109 $rm_try
10110 exit $status
10111 EOSH
10112 chmod +x protochk
10113 $eunicefix protochk
10114
10115 : Define hasproto macro for Configure internal use
10116 hasproto='varname=$1; func=$2; shift; shift;
10117 while $test $# -ge 2; do
10118         case "$1" in
10119         $define) echo "#include <$2>";;
10120         esac ;
10121     shift 2;
10122 done > try.c;
10123 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10124 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10125         echo "$func() prototype found.";
10126         val="$define";
10127 else
10128         echo "$func() prototype NOT found.";
10129         val="$undef";
10130 fi;
10131 set $varname;
10132 eval $setvar;
10133 $rm_try tryout.c'
10134
10135 : see if sys/types.h has to be included
10136 set sys/types.h i_systypes
10137 eval $inhdr
10138
10139 : see if sys/select.h has to be included
10140 set sys/select.h i_sysselct
10141 eval $inhdr
10142
10143 : Define hasfield macro for Configure internal use
10144 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10145 while $test $# -ge 2; do
10146         case "$1" in
10147         $define) echo "#include <$2>";;
10148         esac ;
10149     shift 2;
10150 done > try.c;
10151 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10152 set try;
10153 if eval $compile; then
10154         val="$define";
10155 else
10156         val="$undef";
10157 fi;
10158 set $varname;
10159 eval $setvar;
10160 $rm_try'
10161
10162 : see if we should include time.h, sys/time.h, or both
10163 echo " "
10164 if test "X$timeincl" = X; then
10165         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10166         $echo $n "I'm now running the test program...$c"
10167         $cat >try.c <<EOCP
10168 #include <sys/types.h>
10169 #ifdef I_TIME
10170 #include <time.h>
10171 #endif
10172 #ifdef I_SYSTIME
10173 #ifdef SYSTIMEKERNEL
10174 #define KERNEL
10175 #endif
10176 #include <sys/time.h>
10177 #endif
10178 #ifdef I_SYSSELECT
10179 #include <sys/select.h>
10180 #endif
10181 #$i_stdlib I_STDLIB
10182 #ifdef I_STDLIB
10183 #include <stdlib.h>
10184 #endif
10185 int main()
10186 {
10187         struct tm foo;
10188 #ifdef S_TIMEVAL
10189         struct timeval bar;
10190 #endif
10191 #ifdef S_TIMEZONE
10192         struct timezone tzp;
10193 #endif
10194         if (foo.tm_sec == foo.tm_sec)
10195                 exit(0);
10196 #ifdef S_TIMEVAL
10197         if (bar.tv_sec == bar.tv_sec)
10198                 exit(0);
10199 #endif
10200         exit(1);
10201 }
10202 EOCP
10203         flags=''
10204         for s_timezone in '-DS_TIMEZONE' ''; do
10205         sysselect=''
10206         for s_timeval in '-DS_TIMEVAL' ''; do
10207         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10208         for i_time in '' '-DI_TIME'; do
10209         for i_systime in '-DI_SYSTIME' ''; do
10210                 case "$flags" in
10211                 '') $echo $n ".$c"
10212                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10213                         if eval $compile; then
10214                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10215                                 shift
10216                                 flags="$*"
10217                                 echo " "
10218                                 $echo $n "Succeeded with $flags$c"
10219                         fi
10220                         ;;
10221                 esac
10222         done
10223         done
10224         done
10225         done
10226         done
10227         timeincl=''
10228         echo " "
10229         case "$flags" in
10230         *SYSTIMEKERNEL*) i_systimek="$define"
10231                 timeincl=`./findhdr sys/time.h`
10232                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10233         *) i_systimek="$undef";;
10234         esac
10235         case "$flags" in
10236         *I_TIME*) i_time="$define"
10237                 timeincl=`./findhdr time.h`" $timeincl"
10238                 echo "We'll include <time.h>." >&4;;
10239         *) i_time="$undef";;
10240         esac
10241         case "$flags" in
10242         *I_SYSTIME*) i_systime="$define"
10243                 timeincl=`./findhdr sys/time.h`" $timeincl"
10244                 echo "We'll include <sys/time.h>." >&4;;
10245         *) i_systime="$undef";;
10246         esac
10247         $rm_try
10248 fi
10249 : see if struct tm knows about tm_zone
10250 case "$i_systime$i_time" in
10251 *$define*)
10252         echo " "
10253         echo "Checking to see if your struct tm has tm_zone field..." >&4
10254         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10255         eval $hasfield
10256         ;;
10257 *)      val="$undef"
10258         set d_tm_tm_zone
10259         eval $setvar
10260         ;;
10261 esac
10262 case "$d_tm_tm_zone" in
10263 "$define")      echo "Yes, it does."   ;;
10264 *)              echo "No, it doesn't." ;;
10265 esac
10266 : see if struct tm knows about tm_gmtoff
10267 case "$i_systime$i_time" in
10268 *$define*)
10269         echo " "
10270         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10271         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10272         eval $hasfield
10273         ;;
10274 *)      val="$undef"
10275         set d_tm_tm_gmtoff
10276         eval $setvar
10277         ;;
10278 esac
10279 case "$d_tm_tm_gmtoff" in
10280 "$define")      echo "Yes, it does."   ;;
10281 *)              echo "No, it doesn't." ;;
10282 esac
10283
10284 : see if asctime_r exists
10285 set asctime_r d_asctime_r
10286 eval $inlibc
10287 case "$d_asctime_r" in
10288 "$define")
10289         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10290         case "$d_asctime_r_proto:$usethreads" in
10291         ":define")      d_asctime_r_proto=define
10292                 set d_asctime_r_proto asctime_r $hdrs
10293                 eval $hasproto ;;
10294         *)      ;;
10295         esac
10296         case "$d_asctime_r_proto" in
10297         define)
10298         case "$asctime_r_proto" in
10299         ''|0) try='char* asctime_r(const struct tm*, char*);'
10300         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10301         esac
10302         case "$asctime_r_proto" in
10303         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10304         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10305         esac
10306         case "$asctime_r_proto" in
10307         ''|0) try='int asctime_r(const struct tm*, char*);'
10308         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10309         esac
10310         case "$asctime_r_proto" in
10311         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10312         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10313         esac
10314         case "$asctime_r_proto" in
10315         ''|0)   d_asctime_r=undef
10316                 asctime_r_proto=0
10317                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10318         * )     case "$asctime_r_proto" in
10319                 REENTRANT_PROTO*) ;;
10320                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10321                 esac
10322                 echo "Prototype: $try" ;;
10323         esac
10324         ;;
10325         *)      case "$usethreads" in
10326                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10327                 esac
10328                 d_asctime_r=undef
10329                 asctime_r_proto=0
10330                 ;;
10331         esac
10332         ;;
10333 *)      asctime_r_proto=0
10334         ;;
10335 esac
10336
10337 : see if atolf exists
10338 set atolf d_atolf
10339 eval $inlibc
10340
10341 : see if atoll exists
10342 set atoll d_atoll
10343 eval $inlibc
10344
10345 : Look for GCC-style attribute format
10346 case "$d_attribute_format" in
10347 '')
10348 echo " "
10349 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10350 $cat >attrib.c <<'EOCP'
10351 #include <stdio.h>
10352 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10353 EOCP
10354 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10355         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10356                 echo "Your C compiler doesn't support __attribute__((format))."
10357                 val="$undef"
10358         else
10359                 echo "Your C compiler supports __attribute__((format))."
10360                 val="$define"
10361         fi
10362 else
10363         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10364         val="$undef"
10365 fi
10366 ;;
10367 *) val="$d_attribute_format" ;;
10368 esac
10369 set d_attribute_format
10370 eval $setvar
10371 $rm -f attrib*
10372
10373 : Look for GCC-style attribute format with null format allowed
10374 case "$d_printf_format_null" in
10375 '') case "$d_attribute_format" in
10376     $define)
10377         echo " "
10378         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10379 $cat >attrib.c <<EOCP
10380 #include <stdio.h>
10381 #$i_stdlib I_STDLIB
10382 #ifdef I_STDLIB
10383 #include <stdlib.h>
10384 #endif
10385 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10386 int null_printf (char* pat,...) { return (int)pat; }
10387 int main () { exit(null_printf(NULL)); }
10388 EOCP
10389         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10390             : run the executable in case it produces a run-time warning
10391             if $run ./attrib >>attrib.out 2>&1; then
10392                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10393                     echo "Your C compiler doesn't allow __printf__ format to be null."
10394                     val="$undef"
10395                 else
10396                     echo "Your C compiler allows __printf__ format to be null."
10397                     val="$define"
10398                 fi
10399             else
10400             echo "Your C compiler executable failed with __printf__ format null."
10401             val="$undef"
10402         fi
10403     else
10404         echo "Your C compiler fails with __printf__ format null."
10405         val="$undef"
10406     fi
10407     ;;
10408     *)  val="$undef" ;;
10409     esac
10410 ;;
10411 *)  val="$d_printf_format_null" ;;
10412 esac
10413 set d_printf_format_null
10414 eval $setvar
10415 $rm -f attrib*
10416
10417 : Look for GCC-style attribute malloc
10418 case "$d_attribute_malloc" in
10419 '')
10420 echo " "
10421 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10422 $cat >attrib.c <<'EOCP'
10423 #include <stdio.h>
10424 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10425 EOCP
10426 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10427         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10428                 echo "Your C compiler doesn't support __attribute__((malloc))."
10429                 val="$undef"
10430         else
10431                 echo "Your C compiler supports __attribute__((malloc))."
10432                 val="$define"
10433         fi
10434 else
10435         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10436         val="$undef"
10437 fi
10438 ;;
10439 *) val="$d_attribute_malloc" ;;
10440 esac
10441 set d_attribute_malloc
10442 eval $setvar
10443 $rm -f attrib*
10444
10445 : Look for GCC-style attribute nonnull
10446 case "$d_attribute_nonnull" in
10447 '')
10448 echo " "
10449 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10450 $cat >attrib.c <<'EOCP'
10451 #include <stdio.h>
10452 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10453 EOCP
10454 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10455         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10456                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10457                 val="$undef"
10458         else
10459                 echo "Your C compiler supports __attribute__((nonnull))."
10460                 val="$define"
10461         fi
10462 else
10463         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10464         val="$undef"
10465 fi
10466 ;;
10467 *) val="$d_attribute_nonnull" ;;
10468 esac
10469 set d_attribute_nonnull
10470 eval $setvar
10471 $rm -f attrib*
10472
10473 : Look for GCC-style attribute noreturn
10474 case "$d_attribute_noreturn" in
10475 '')
10476 echo " "
10477 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10478 $cat >attrib.c <<'EOCP'
10479 #include <stdio.h>
10480 void fall_over_dead( void ) __attribute__((noreturn));
10481 EOCP
10482 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10483         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10484                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10485                 val="$undef"
10486         else
10487                 echo "Your C compiler supports __attribute__((noreturn))."
10488                 val="$define"
10489         fi
10490 else
10491         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10492         val="$undef"
10493 fi
10494 ;;
10495 *) val="$d_attribute_noreturn" ;;
10496 esac
10497 set d_attribute_noreturn
10498 eval $setvar
10499 $rm -f attrib*
10500
10501 : Look for GCC-style attribute pure
10502 case "$d_attribute_pure" in
10503 '')
10504 echo " "
10505 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10506 $cat >attrib.c <<'EOCP'
10507 #include <stdio.h>
10508 int square( int n ) __attribute__((pure));
10509 EOCP
10510 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10511         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10512                 echo "Your C compiler doesn't support __attribute__((pure))."
10513                 val="$undef"
10514         else
10515                 echo "Your C compiler supports __attribute__((pure))."
10516                 val="$define"
10517         fi
10518 else
10519         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10520         val="$undef"
10521 fi
10522 ;;
10523 *) val="$d_attribute_pure" ;;
10524 esac
10525 set d_attribute_pure
10526 eval $setvar
10527 $rm -f attrib*
10528
10529 : Look for GCC-style attribute unused
10530 case "$d_attribute_unused" in
10531 '')
10532 echo " "
10533 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10534 $cat >attrib.c <<'EOCP'
10535 #include <stdio.h>
10536 int do_something( int dummy __attribute__((unused)), int n );
10537 EOCP
10538 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10539         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10540                 echo "Your C compiler doesn't support __attribute__((unused))."
10541                 val="$undef"
10542         else
10543                 echo "Your C compiler supports __attribute__((unused))."
10544                 val="$define"
10545         fi
10546 else
10547         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10548         val="$undef"
10549 fi
10550 ;;
10551 *) val="$d_attribute_unused" ;;
10552 esac
10553 set d_attribute_unused
10554 eval $setvar
10555 $rm -f attrib*
10556
10557 : Look for GCC-style attribute deprecated
10558 case "$d_attribute_deprecated" in
10559 '')
10560 echo " "
10561 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10562 $cat >attrib.c <<'EOCP'
10563 #include <stdio.h>
10564 int I_am_deprecated(void) __attribute__((deprecated));
10565 EOCP
10566 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10567         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10568                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10569                 val="$undef"
10570         else
10571                 echo "Your C compiler supports __attribute__((deprecated))."
10572                 val="$define"
10573         fi
10574 else
10575         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10576         val="$undef"
10577 fi
10578 ;;
10579 *) val="$d_attribute_deprecated" ;;
10580 esac
10581 set d_attribute_deprecated
10582 eval $setvar
10583 $rm -f attrib*
10584
10585 : Look for GCC-style attribute warn_unused_result
10586 case "$d_attribute_warn_unused_result" in
10587 '')
10588 echo " "
10589 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10590 $cat >attrib.c <<'EOCP'
10591 #include <stdio.h>
10592 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10593 EOCP
10594 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10595         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10596                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10597                 val="$undef"
10598         else
10599                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10600                 val="$define"
10601         fi
10602 else
10603         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10604         val="$undef"
10605 fi
10606 ;;
10607 *) val="$d_attribute_warn_unused_result" ;;
10608 esac
10609 set d_attribute_warn_unused_result
10610 eval $setvar
10611 $rm -f attrib*
10612
10613 : see if bcmp exists
10614 set bcmp d_bcmp
10615 eval $inlibc
10616
10617 : see if bcopy exists
10618 set bcopy d_bcopy
10619 eval $inlibc
10620
10621 : see if getpgrp exists
10622 set getpgrp d_getpgrp
10623 eval $inlibc
10624
10625 case "$d_getpgrp" in
10626 "$define")
10627         echo " "
10628         echo "Checking to see which flavor of getpgrp is in use..."
10629         $cat >try.c <<EOP
10630 #$i_unistd I_UNISTD
10631 #include <sys/types.h>
10632 #ifdef I_UNISTD
10633 #  include <unistd.h>
10634 #endif
10635 #$i_stdlib I_STDLIB
10636 #ifdef I_STDLIB
10637 #include <stdlib.h>
10638 #endif
10639 int main()
10640 {
10641         if (getuid() == 0) {
10642                 printf("(I see you are running Configure as super-user...)\n");
10643                 setuid(1);
10644         }
10645 #ifdef TRY_BSD_PGRP
10646         if (getpgrp(1) == 0)
10647                 exit(0);
10648 #else
10649         if (getpgrp() > 0)
10650                 exit(0);
10651 #endif
10652         exit(1);
10653 }
10654 EOP
10655         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10656                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10657                 val="$define"
10658         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10659                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10660                 val="$undef"
10661         else
10662                 echo "I can't seem to compile and run the test program."
10663                 if ./usg; then
10664                         xxx="a USG one, i.e. you use getpgrp()."
10665                 else
10666                         # SVR4 systems can appear rather BSD-ish.
10667                         case "$i_unistd" in
10668                         $undef)
10669                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10670                                 val="$define"
10671                                 ;;
10672                         $define)
10673                                 xxx="probably a USG one, i.e. you use getpgrp()."
10674                                 val="$undef"
10675                                 ;;
10676                         esac
10677                 fi
10678                 echo "Assuming your getpgrp is $xxx" >&4
10679         fi
10680         ;;
10681 *) val="$undef";;
10682 esac
10683 set d_bsdgetpgrp
10684 eval $setvar
10685 $rm_try
10686
10687 : see if setpgrp exists
10688 set setpgrp d_setpgrp
10689 eval $inlibc
10690
10691 case "$d_setpgrp" in
10692 "$define")
10693         echo " "
10694         echo "Checking to see which flavor of setpgrp is in use..."
10695         $cat >try.c <<EOP
10696 #$i_unistd I_UNISTD
10697 #include <sys/types.h>
10698 #ifdef I_UNISTD
10699 #  include <unistd.h>
10700 #endif
10701 #$i_stdlib I_STDLIB
10702 #ifdef I_STDLIB
10703 #include <stdlib.h>
10704 #endif
10705 int main()
10706 {
10707         if (getuid() == 0) {
10708                 printf("(I see you are running Configure as super-user...)\n");
10709                 setuid(1);
10710         }
10711 #ifdef TRY_BSD_PGRP
10712         if (-1 == setpgrp(1, 1))
10713                 exit(0);
10714 #else
10715         if (setpgrp() != -1)
10716                 exit(0);
10717 #endif
10718         exit(1);
10719 }
10720 EOP
10721         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10722                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10723                 val="$define"
10724         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10725                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10726                 val="$undef"
10727         else
10728                 echo "(I can't seem to compile and run the test program.)"
10729                 if ./usg; then
10730                         xxx="a USG one, i.e. you use setpgrp()."
10731                 else
10732                         # SVR4 systems can appear rather BSD-ish.
10733                         case "$i_unistd" in
10734                         $undef)
10735                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10736                                 val="$define"
10737                                 ;;
10738                         $define)
10739                                 xxx="probably a USG one, i.e. you use setpgrp()."
10740                                 val="$undef"
10741                                 ;;
10742                         esac
10743                 fi
10744                 echo "Assuming your setpgrp is $xxx" >&4
10745         fi
10746         ;;
10747 *) val="$undef";;
10748 esac
10749 set d_bsdsetpgrp
10750 eval $setvar
10751 $rm_try
10752
10753 : Look for GCC-style __builtin_choose_expr
10754 case "$d_builtin_choose_expr" in
10755 '')
10756     echo " "
10757     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10758     $cat >try.c <<'EOCP'
10759 #include <assert.h>
10760 #include <stdlib.h>
10761 #include <stdio.h>
10762
10763 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10764
10765 int main(void) {
10766     assert( SYRINX(1) == 2112 );
10767     assert( SYRINX(1) != 5150 );
10768     assert( SYRINX(0) == 5150 );
10769     assert( SYRINX(0) != 2112 );
10770     puts( "All good!" );
10771     exit(0);
10772 }
10773
10774 EOCP
10775     set try
10776     if eval $compile && $run ./try; then
10777         echo "Your C compiler supports __builtin_choose_expr."
10778         val="$define"
10779     else
10780         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10781         val="$undef"
10782     fi
10783 ;;
10784 *) val="$d_builtin_choose_expr" ;;
10785 esac
10786
10787 set d_builtin_choose_expr
10788 eval $setvar
10789 $rm_try
10790
10791 : Look for GCC-style __builtin_expect
10792 case "$d_builtin_expect" in
10793 '')
10794     echo " "
10795     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10796     $cat >try.c <<'EOCP'
10797 int main(void) {
10798     int n = 50;
10799     if ( __builtin_expect(n, 0) ) n = 1;
10800     /* Remember shell exit code truth is 0, C truth is non-zero */
10801     return !(n == 1);
10802 }
10803 EOCP
10804     set try
10805     if eval $compile && $run ./try; then
10806         echo "Your C compiler supports __builtin_expect."
10807         val="$define"
10808     else
10809         echo "Your C compiler doesn't seem to understand __builtin_expect."
10810         val="$undef"
10811     fi
10812     ;;
10813 *) val="$d_builtin_expect" ;;
10814 esac
10815
10816 set d_builtin_expect
10817 eval $setvar
10818 $rm_try
10819
10820 : see if bzero exists
10821 set bzero d_bzero
10822 eval $inlibc
10823
10824 : see if stdarg is available
10825 echo " "
10826 if $test `./findhdr stdarg.h`; then
10827         echo "<stdarg.h> found." >&4
10828         valstd="$define"
10829 else
10830         echo "<stdarg.h> NOT found." >&4
10831         valstd="$undef"
10832 fi
10833
10834 : see if varags is available
10835 echo " "
10836 if $test `./findhdr varargs.h`; then
10837         echo "<varargs.h> found." >&4
10838 else
10839         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10840 fi
10841
10842 : set up the varargs testing programs
10843 $cat > varargs.c <<EOP
10844 #ifdef I_STDARG
10845 #include <stdarg.h>
10846 #endif
10847 #ifdef I_VARARGS
10848 #include <varargs.h>
10849 #endif
10850
10851 #ifdef I_STDARG
10852 int f(char *p, ...)
10853 #else
10854 int f(va_alist)
10855 va_dcl
10856 #endif
10857 {
10858         va_list ap;
10859 #ifndef I_STDARG
10860         char *p;
10861 #endif
10862 #ifdef I_STDARG
10863         va_start(ap,p);
10864 #else
10865         va_start(ap);
10866         p = va_arg(ap, char *);
10867 #endif
10868         va_end(ap);
10869         return 0;
10870 }
10871 EOP
10872 $cat > varargs <<EOP
10873 $startsh
10874 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10875         echo "true"
10876 else
10877         echo "false"
10878 fi
10879 $rm -f varargs$_o
10880 EOP
10881 chmod +x varargs
10882
10883 : now check which varargs header should be included
10884 echo " "
10885 i_varhdr=''
10886 case "$valstd" in
10887 "$define")
10888         if `./varargs I_STDARG`; then
10889                 val='stdarg.h'
10890         elif `./varargs I_VARARGS`; then
10891                 val='varargs.h'
10892         fi
10893         ;;
10894 *)
10895         if `./varargs I_VARARGS`; then
10896                 val='varargs.h'
10897         fi
10898         ;;
10899 esac
10900 case "$val" in
10901 '')
10902 echo "I could not find the definition for va_dcl... You have problems..." >&4
10903         val="$undef"; set i_stdarg; eval $setvar
10904         val="$undef"; set i_varargs; eval $setvar
10905         ;;
10906 *)
10907         set i_varhdr
10908         eval $setvar
10909         case "$i_varhdr" in
10910         stdarg.h)
10911                 val="$define"; set i_stdarg; eval $setvar
10912                 val="$undef"; set i_varargs; eval $setvar
10913                 ;;
10914         varargs.h)
10915                 val="$undef"; set i_stdarg; eval $setvar
10916                 val="$define"; set i_varargs; eval $setvar
10917                 ;;
10918         esac
10919         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10920 esac
10921 $rm -f varargs*
10922
10923 : see if the Compiler supports C99 variadic macros
10924 case "$i_stdarg$i_stdlib" in
10925     "$define$define")
10926     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10927     $cat >try.c <<EOCP
10928 #include <stdio.h>
10929 #include <stdarg.h>
10930
10931 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10932
10933 int main() {
10934   char buf[20];
10935   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10936   puts(buf);
10937   return 0;
10938 }
10939 EOCP
10940     set try
10941     if eval $compile && $run ./try 2>&1 >/dev/null; then
10942         case "`$run ./try`" in
10943             "123 456 789")
10944             echo "You have C99 variadic macros." >&4
10945             d_c99_variadic_macros="$define"
10946             ;;
10947             *)
10948             echo "You don't have functional C99 variadic macros." >&4
10949             d_c99_variadic_macros="$undef"
10950             ;;
10951         esac
10952     else
10953         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10954         d_c99_variadic_macros="$undef"
10955     fi
10956     $rm_try
10957     ;;
10958     *)
10959     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10960     d_c99_variadic_macros="$undef"
10961     ;;
10962 esac
10963
10964 : see if signal is declared as pointer to function returning int or void
10965 echo " "
10966 xxx=`./findhdr signal.h`
10967 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10968 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10969         echo "You have int (*signal())() instead of void." >&4
10970         val="$undef"
10971 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10972         echo "You have void (*signal())()." >&4
10973         val="$define"
10974 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10975         echo "You have int (*signal())() instead of void." >&4
10976         val="$undef"
10977 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10978         echo "You have void (*signal())()." >&4
10979         val="$define"
10980 else
10981         case "$d_voidsig" in
10982         '')
10983         echo "I can't determine whether signal handler returns void or int..." >&4
10984                 dflt=void
10985                 rp="What type does your signal handler return?"
10986                 . ./myread
10987                 case "$ans" in
10988                 v*) val="$define";;
10989                 *) val="$undef";;
10990                 esac;;
10991         "$define")
10992                 echo "As you already told me, signal handler returns void." >&4
10993                 val="$define"
10994                 ;;
10995         *)      echo "As you already told me, signal handler returns int." >&4
10996                 val="$undef"
10997                 ;;
10998         esac
10999 fi
11000 set d_voidsig
11001 eval $setvar
11002 case "$d_voidsig" in
11003 "$define") signal_t="void";;
11004 *) signal_t="int";;
11005 esac
11006 $rm -f $$.tmp
11007
11008 : check for ability to cast large floats to 32-bit ints.
11009 echo " "
11010 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11011 if $test "$intsize" -ge 4; then
11012         xxx=int
11013 else
11014         xxx=long
11015 fi
11016 $cat >try.c <<EOCP
11017 #include <stdio.h>
11018 #$i_stdlib I_STDLIB
11019 #ifdef I_STDLIB
11020 #include <stdlib.h>
11021 #endif
11022 #include <sys/types.h>
11023 #include <signal.h>
11024 $signal_t blech(int s) { exit(3); }
11025 int main()
11026 {
11027         $xxx i32;
11028         double f, g;
11029         int result = 0;
11030         char str[16];
11031         signal(SIGFPE, blech);
11032
11033         /* Don't let compiler optimize the test away.  Store the number
11034            in a writable string for gcc to pass to sscanf under HP-UX.
11035         */
11036         sprintf(str, "2147483647");
11037         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11038         g = 10 * f;
11039         i32  = ($xxx) g;
11040
11041         /* x86 processors will probably give 0x8000 0000, which is a
11042            sign change.  We don't want that.  We want to mimic SPARC
11043            behavior here, which is to preserve the sign and give
11044            back 0x7fff ffff.
11045         */
11046         if (i32 != ($xxx) f)
11047                 result |= 1;
11048         exit(result);
11049 }
11050 EOCP
11051 set try
11052 if eval $compile_ok; then
11053         $run ./try
11054         yyy=$?
11055 else
11056         echo "(I can't seem to compile the test program--assuming it can't)"
11057         yyy=1
11058 fi
11059 case "$yyy" in
11060 0)      val="$define"
11061         echo "Yup, it can."
11062         ;;
11063 *)      val="$undef"
11064         echo "Nope, it can't."
11065         ;;
11066 esac
11067 set d_casti32
11068 eval $setvar
11069 $rm_try
11070
11071 : check for ability to cast negative floats to unsigned
11072 echo " "
11073 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11074 $cat >try.c <<EOCP
11075 #include <stdio.h>
11076 #$i_stdlib I_STDLIB
11077 #ifdef I_STDLIB
11078 #include <stdlib.h>
11079 #endif
11080 #include <sys/types.h>
11081 #include <signal.h>
11082 $signal_t blech(int s) { exit(7); }
11083 $signal_t blech_in_list(int s) { exit(4); }
11084 unsigned long dummy_long(unsigned long p) { return p; }
11085 unsigned int dummy_int(unsigned int p) { return p; }
11086 unsigned short dummy_short(unsigned short p) { return p; }
11087 int main()
11088 {
11089         double f;
11090         unsigned long along;
11091         unsigned int aint;
11092         unsigned short ashort;
11093         int result = 0;
11094         char str[16];
11095
11096         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11097            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11098            optimized the whole file away
11099         */
11100         /* Store the number in a writable string for gcc to pass to
11101            sscanf under HP-UX.
11102         */
11103         sprintf(str, "-123");
11104         sscanf(str, "%lf", &f);  /* f = -123.; */
11105
11106         signal(SIGFPE, blech);
11107         along = (unsigned long)f;
11108         aint = (unsigned int)f;
11109         ashort = (unsigned short)f;
11110         if (along != (unsigned long)-123)
11111                 result |= 1;
11112         if (aint != (unsigned int)-123)
11113                 result |= 1;
11114         if (ashort != (unsigned short)-123)
11115                 result |= 1;
11116         sprintf(str, "1073741824.");
11117         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11118         f = f + f;
11119         along = 0;
11120         along = (unsigned long)f;
11121         if (along != 0x80000000)
11122                 result |= 2;
11123         f -= 1.;
11124         along = 0;
11125         along = (unsigned long)f;
11126         if (along != 0x7fffffff)
11127                 result |= 1;
11128         f += 2.;
11129         along = 0;
11130         along = (unsigned long)f;
11131         if (along != 0x80000001)
11132                 result |= 2;
11133         if (result)
11134                 exit(result);
11135         signal(SIGFPE, blech_in_list);
11136         sprintf(str, "123.");
11137         sscanf(str, "%lf", &f);  /* f = 123.; */
11138         along = dummy_long((unsigned long)f);
11139         aint = dummy_int((unsigned int)f);
11140         ashort = dummy_short((unsigned short)f);
11141         if (along != (unsigned long)123)
11142                 result |= 4;
11143         if (aint != (unsigned int)123)
11144                 result |= 4;
11145         if (ashort != (unsigned short)123)
11146                 result |= 4;
11147         exit(result);
11148
11149 }
11150 EOCP
11151 set try
11152 if eval $compile_ok; then
11153         $run ./try
11154         castflags=$?
11155 else
11156         echo "(I can't seem to compile the test program--assuming it can't)"
11157         castflags=7
11158 fi
11159 case "$castflags" in
11160 0)      val="$define"
11161         echo "Yup, it can."
11162         ;;
11163 *)      val="$undef"
11164         echo "Nope, it can't."
11165         ;;
11166 esac
11167 set d_castneg
11168 eval $setvar
11169 $rm_try
11170
11171 : see if vprintf exists
11172 echo " "
11173 if set vprintf val -f d_vprintf; eval $csym; $val; then
11174         echo 'vprintf() found.' >&4
11175         val="$define"
11176         $cat >try.c <<EOF
11177 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11178 #$i_varargs I_VARARGS
11179
11180 #$i_stdlib I_STDLIB
11181 #$i_unistd I_UNISTD
11182
11183 #ifdef I_STDARG
11184 #  include <stdarg.h>
11185 #else /* I_VARARGS */
11186 #  include <varargs.h>
11187 #endif
11188
11189 #ifdef I_UNISTD
11190 #  include <unistd.h>
11191 #endif
11192
11193 #ifdef I_STDLIB
11194 #  include <stdlib.h>
11195 #endif
11196
11197 #include <stdio.h> /* vsprintf prototype */
11198
11199 #ifdef I_STDARG
11200 void xxx(int n, ...)
11201 {
11202     va_list args;
11203     char buf[10];
11204     va_start(args, n);
11205     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11206 }
11207 int main() { xxx(1, "foo"); }
11208
11209 #else /* I_VARARGS */
11210
11211 xxx(va_alist)
11212 va_dcl
11213 {
11214     va_list args;
11215     char buf[10];
11216     va_start(args);
11217     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11218 }
11219 int main() { xxx("foo"); }
11220
11221 #endif
11222
11223 EOF
11224         set try
11225         if eval $compile_ok; then
11226                 if $run ./try; then
11227                         echo "Your vsprintf() returns (int)." >&4
11228                         val2="$undef"
11229                 else
11230                         echo "Your vsprintf() returns (char*)." >&4
11231                         val2="$define"
11232                 fi
11233         else
11234                 echo 'I am unable to compile the vsprintf() test program.' >&4
11235                 # We shouldn't get here.  If we do, assume the standard signature,
11236                 # not the old BSD one.
11237                 echo 'Guessing that vsprintf() returns (int).' >&4
11238                 val2="$undef"
11239         fi
11240 else
11241         echo 'vprintf() NOT found.' >&4
11242         val="$undef"
11243         val2="$undef"
11244 fi
11245 $rm_try
11246 set d_vprintf
11247 eval $setvar
11248 val=$val2
11249 set d_charvspr
11250 eval $setvar
11251
11252 : see if chown exists
11253 set chown d_chown
11254 eval $inlibc
11255
11256 : see if chroot exists
11257 set chroot d_chroot
11258 eval $inlibc
11259
11260 : see if chsize exists
11261 set chsize d_chsize
11262 eval $inlibc
11263
11264 : see if class exists
11265 set class d_class
11266 eval $inlibc
11267
11268 : see if clearenv exists
11269 set clearenv d_clearenv
11270 eval $inlibc
11271
11272 : Define hasstruct macro for Configure internal use
11273 hasstruct='varname=$1; struct=$2; shift; shift;
11274 while $test $# -ge 2; do
11275         case "$1" in
11276         $define) echo "#include <$2>";;
11277         esac ;
11278     shift 2;
11279 done > try.c;
11280 echo "int main () { struct $struct foo; }" >> try.c;
11281 set try;
11282 if eval $compile; then
11283         val="$define";
11284 else
11285         val="$undef";
11286 fi;
11287 set $varname;
11288 eval $setvar;
11289 $rm_try'
11290
11291 : see whether socket exists
11292 socketlib=''
11293 sockethdr=''
11294 echo " "
11295 $echo $n "Hmm... $c" >&4
11296 if set socket val -f d_socket; eval $csym; $val; then
11297         echo "Looks like you have Berkeley networking support." >&4
11298         d_socket="$define"
11299         if set setsockopt val -f; eval $csym; $val; then
11300                 d_oldsock="$undef"
11301         else
11302                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11303                 d_oldsock="$define"
11304         fi
11305 else
11306         if $contains socklib libc.list >/dev/null 2>&1; then
11307                 echo "Looks like you have Berkeley networking support." >&4
11308                 d_socket="$define"
11309                 : we will have to assume that it supports the 4.2 BSD interface
11310                 d_oldsock="$undef"
11311         else
11312                 echo "You don't have Berkeley networking in libc$_a..." >&4
11313                 if test "X$d_socket" = "X$define"; then
11314                    echo "...but you seem to believe that you have sockets." >&4
11315                 else
11316                         for net in net socket
11317                         do
11318                                 if test -f /usr/lib/lib$net$_a; then
11319                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11320                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11321                                         if $contains socket libc.list >/dev/null 2>&1; then
11322                                                 d_socket="$define"
11323                                                 socketlib="-l$net"
11324                                                 case "$net" in
11325                                                 net)
11326                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11327                                                         sockethdr="-I/usr/netinclude"
11328                                                         ;;
11329                                                 esac
11330                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11331                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11332                                                         d_oldsock="$undef"
11333                                                 else
11334                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11335                                                         d_oldsock="$define"
11336                                                 fi
11337                                                 break
11338                                         fi
11339                                 fi
11340                         done
11341                         if test "X$d_socket" != "X$define"; then
11342                            echo "or anywhere else I see." >&4
11343                            d_socket="$undef"
11344                            d_oldsock="$undef"
11345                         fi
11346                 fi
11347         fi
11348 fi
11349
11350 : see if socketpair exists
11351 set socketpair d_sockpair
11352 eval $inlibc
11353
11354
11355 echo " "
11356 echo "Checking the availability of certain socket constants..." >&4
11357 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11358         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11359         $cat >try.c <<EOF
11360 #include <sys/types.h>
11361 #include <sys/socket.h>
11362 int main() {
11363     int i = $ENUM;
11364 }
11365 EOF
11366         val="$undef"
11367         set try; if eval $compile; then
11368                 val="$define"
11369         fi
11370         set d_${enum}; eval $setvar
11371         $rm_try
11372 done
11373
11374 : see if this is a sys/uio.h system
11375 set sys/uio.h i_sysuio
11376 eval $inhdr
11377
11378 : Check for cmsghdr support
11379 echo " "
11380 echo "Checking to see if your system supports struct cmsghdr..." >&4
11381 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11382 eval $hasstruct
11383 case "$d_cmsghdr_s" in
11384 "$define")      echo "Yes, it does."   ;;
11385 *)              echo "No, it doesn't." ;;
11386 esac
11387
11388
11389 : check for const keyword
11390 echo " "
11391 echo 'Checking to see if your C compiler knows about "const"...' >&4
11392 $cat >const.c <<'EOCP'
11393 typedef struct spug { int drokk; } spug;
11394 int main()
11395 {
11396         const char *foo;
11397         const spug y = { 0 };
11398 }
11399 EOCP
11400 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11401         val="$define"
11402         echo "Yup, it does."
11403 else
11404         val="$undef"
11405         echo "Nope, it doesn't."
11406 fi
11407 set d_const
11408 eval $setvar
11409
11410 : see if copysignl exists
11411 set copysignl d_copysignl
11412 eval $inlibc
11413
11414 : see if crypt exists
11415 echo " "
11416 set crypt d_crypt
11417 eval $inlibc
11418 case "$d_crypt" in
11419 $define) cryptlib='' ;;
11420 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11421                 echo 'crypt() found.' >&4
11422                 val="$define"
11423                 cryptlib=''
11424         else
11425                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11426                 if $test -z "$cryptlib"; then
11427                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11428                 else
11429                         cryptlib=-lcrypt
11430                 fi
11431                 if $test -z "$cryptlib"; then
11432                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11433                 else
11434                         cryptlib=-lcrypt
11435                 fi
11436                 if $test -z "$cryptlib"; then
11437                         cryptlib=`./loc libcrypt$_a "" $libpth`
11438                 else
11439                         cryptlib=-lcrypt
11440                 fi
11441                 if $test -z "$cryptlib"; then
11442                         echo 'crypt() NOT found.' >&4
11443                         val="$undef"
11444                 else
11445                         val="$define"
11446                 fi
11447         fi
11448         set d_crypt
11449         eval $setvar
11450         ;;
11451 esac
11452
11453 : see if this is a crypt.h system
11454 set crypt.h i_crypt
11455 eval $inhdr
11456
11457 : see if crypt_r exists
11458 set crypt_r d_crypt_r
11459 eval $inlibc
11460 case "$d_crypt_r" in
11461 "$define")
11462         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11463         case "$d_crypt_r_proto:$usethreads" in
11464         ":define")      d_crypt_r_proto=define
11465                 set d_crypt_r_proto crypt_r $hdrs
11466                 eval $hasproto ;;
11467         *)      ;;
11468         esac
11469         case "$d_crypt_r_proto" in
11470         define)
11471         case "$crypt_r_proto" in
11472         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11473         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11474         esac
11475         case "$crypt_r_proto" in
11476         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11477         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11478         esac
11479         case "$crypt_r_proto" in
11480         ''|0)   d_crypt_r=undef
11481                 crypt_r_proto=0
11482                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11483         * )     case "$crypt_r_proto" in
11484                 REENTRANT_PROTO*) ;;
11485                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11486                 esac
11487                 echo "Prototype: $try" ;;
11488         esac
11489         ;;
11490         *)      case "$usethreads" in
11491                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11492                 esac
11493                 d_crypt_r=undef
11494                 crypt_r_proto=0
11495                 ;;
11496         esac
11497         ;;
11498 *)      crypt_r_proto=0
11499         ;;
11500 esac
11501
11502 : get csh whereabouts
11503 case "$csh" in
11504 'csh') val="$undef" ;;
11505 *) val="$define" ;;
11506 esac
11507 set d_csh
11508 eval $setvar
11509 : Respect a hint or command line value for full_csh.
11510 case "$full_csh" in
11511 '') full_csh=$csh ;;
11512 esac
11513
11514 : see if ctermid exists
11515 set ctermid d_ctermid
11516 eval $inlibc
11517
11518 : see if ctermid_r exists
11519 set ctermid_r d_ctermid_r
11520 eval $inlibc
11521 case "$d_ctermid_r" in
11522 "$define")
11523         hdrs="$i_systypes sys/types.h define stdio.h "
11524         case "$d_ctermid_r_proto:$usethreads" in
11525         ":define")      d_ctermid_r_proto=define
11526                 set d_ctermid_r_proto ctermid_r $hdrs
11527                 eval $hasproto ;;
11528         *)      ;;
11529         esac
11530         case "$d_ctermid_r_proto" in
11531         define)
11532         case "$ctermid_r_proto" in
11533         ''|0) try='char* ctermid_r(char*);'
11534         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11535         esac
11536         case "$ctermid_r_proto" in
11537         ''|0)   d_ctermid_r=undef
11538                 ctermid_r_proto=0
11539                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11540         * )     case "$ctermid_r_proto" in
11541                 REENTRANT_PROTO*) ;;
11542                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11543                 esac
11544                 echo "Prototype: $try" ;;
11545         esac
11546         ;;
11547         *)      case "$usethreads" in
11548                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11549                 esac
11550                 d_ctermid_r=undef
11551                 ctermid_r_proto=0
11552                 ;;
11553         esac
11554         ;;
11555 *)      ctermid_r_proto=0
11556         ;;
11557 esac
11558
11559 : see if ctime_r exists
11560 set ctime_r d_ctime_r
11561 eval $inlibc
11562 case "$d_ctime_r" in
11563 "$define")
11564         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11565         case "$d_ctime_r_proto:$usethreads" in
11566         ":define")      d_ctime_r_proto=define
11567                 set d_ctime_r_proto ctime_r $hdrs
11568                 eval $hasproto ;;
11569         *)      ;;
11570         esac
11571         case "$d_ctime_r_proto" in
11572         define)
11573         case "$ctime_r_proto" in
11574         ''|0) try='char* ctime_r(const time_t*, char*);'
11575         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11576         esac
11577         case "$ctime_r_proto" in
11578         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11579         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11580         esac
11581         case "$ctime_r_proto" in
11582         ''|0) try='int ctime_r(const time_t*, char*);'
11583         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11584         esac
11585         case "$ctime_r_proto" in
11586         ''|0) try='int ctime_r(const time_t*, char*, int);'
11587         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11588         esac
11589         case "$ctime_r_proto" in
11590         ''|0)   d_ctime_r=undef
11591                 ctime_r_proto=0
11592                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11593         * )     case "$ctime_r_proto" in
11594                 REENTRANT_PROTO*) ;;
11595                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11596                 esac
11597                 echo "Prototype: $try" ;;
11598         esac
11599         ;;
11600         *)      case "$usethreads" in
11601                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11602                 esac
11603                 d_ctime_r=undef
11604                 ctime_r_proto=0
11605                 ;;
11606         esac
11607         ;;
11608 *)      ctime_r_proto=0
11609         ;;
11610 esac
11611
11612 : see if cuserid exists
11613 set cuserid d_cuserid
11614 eval $inlibc
11615
11616 : see if this is a limits.h system
11617 set limits.h i_limits
11618 eval $inhdr
11619
11620 : see if this is a float.h system
11621 set float.h i_float
11622 eval $inhdr
11623
11624 : See if number of significant digits in a double precision number is known
11625 echo " "
11626 $cat >dbl_dig.c <<EOM
11627 #$i_limits I_LIMITS
11628 #$i_float I_FLOAT
11629 #ifdef I_LIMITS
11630 #include <limits.h>
11631 #endif
11632 #ifdef I_FLOAT
11633 #include <float.h>
11634 #endif
11635 #ifdef DBL_DIG
11636 printf("Contains DBL_DIG");
11637 #endif
11638 EOM
11639 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11640 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11641         echo "DBL_DIG found." >&4
11642         val="$define"
11643 else
11644         echo "DBL_DIG NOT found." >&4
11645         val="$undef"
11646 fi
11647 $rm -f dbl_dig.?
11648 set d_dbl_dig
11649 eval $setvar
11650
11651 : see if dbm.h is available
11652 : see if dbmclose exists
11653 set dbmclose d_dbmclose
11654 eval $inlibc
11655
11656 case "$d_dbmclose" in
11657 $define)
11658         set dbm.h i_dbm
11659         eval $inhdr
11660         case "$i_dbm" in
11661         $define)
11662                 val="$undef"
11663                 set i_rpcsvcdbm
11664                 eval $setvar
11665                 ;;
11666         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11667                 eval $inhdr
11668                 ;;
11669         esac
11670         ;;
11671 *)      echo "We won't be including <dbm.h>"
11672         val="$undef"
11673         set i_dbm
11674         eval $setvar
11675         val="$undef"
11676         set i_rpcsvcdbm
11677         eval $setvar
11678         ;;
11679 esac
11680
11681 : see if prototype for dbminit is available
11682 echo " "
11683 set d_dbminitproto dbminit $i_dbm dbm.h
11684 eval $hasproto
11685
11686 : see if difftime exists
11687 set difftime d_difftime
11688 eval $inlibc
11689
11690 : see if this is a dirent system
11691 echo " "
11692 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11693         val="$define"
11694         echo "<dirent.h> found." >&4
11695 else
11696         val="$undef"
11697         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11698                 echo "<sys/dir.h> found." >&4
11699                 echo " "
11700         else
11701                 xinc=`./findhdr sys/ndir.h`
11702         fi
11703         echo "<dirent.h> NOT found." >&4
11704 fi
11705 set i_dirent
11706 eval $setvar
11707
11708 : Look for type of directory structure.
11709 echo " "
11710 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11711
11712 case "$direntrytype" in
11713 ''|' ')
11714         case "$i_dirent" in
11715         $define) guess1='struct dirent' ;;
11716         *) guess1='struct direct'  ;;
11717         esac
11718         ;;
11719 *)      guess1="$direntrytype"
11720         ;;
11721 esac
11722
11723 case "$guess1" in
11724 'struct dirent') guess2='struct direct' ;;
11725 *) guess2='struct dirent' ;;
11726 esac
11727
11728 if $contains "$guess1" try.c >/dev/null 2>&1; then
11729         direntrytype="$guess1"
11730         echo "Your directory entries are $direntrytype." >&4
11731 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11732         direntrytype="$guess2"
11733         echo "Your directory entries seem to be $direntrytype." >&4
11734 else
11735         echo "I don't recognize your system's directory entries." >&4
11736         rp="What type is used for directory entries on this system?"
11737         dflt="$guess1"
11738         . ./myread
11739         direntrytype="$ans"
11740 fi
11741 $rm_try
11742
11743 : see if the directory entry stores field length
11744 echo " "
11745 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11746 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11747         echo "Good, your directory entry keeps length information in d_namlen." >&4
11748         val="$define"
11749 else
11750         echo "Your directory entry does not know about the d_namlen field." >&4
11751         val="$undef"
11752 fi
11753 set d_dirnamlen
11754 eval $setvar
11755 $rm_try
11756
11757 : Look for DIR.dd_fd
11758 case "$i_dirent" in
11759 "$define")
11760     echo "Checking to see if DIR has a dd_fd member variable" >&4
11761     $cat >try.c <<EOCP
11762 #$i_stdlib I_STDLIB
11763 #ifdef I_STDLIB
11764 #include <stdlib.h>
11765 #endif
11766 #include <dirent.h>
11767
11768 int main() {
11769     DIR dir;
11770     dir.dd_fd = 1;
11771     return 0;
11772 }
11773 EOCP
11774     val=$undef
11775     set try
11776     if eval $compile; then
11777         echo "Yes, it does."
11778         val="$define"
11779     else
11780         echo "No, it does not."
11781         val="$undef"
11782     fi
11783     ;;
11784 *)
11785     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11786     val="$undef"
11787     ;;
11788 esac
11789 set d_dir_dd_fd
11790 eval $setvar
11791 $rm_try
11792
11793 : see if this is an sysdir system
11794 set sys/dir.h i_sysdir
11795 eval $inhdr
11796
11797 : see if this is an sysndir system
11798 set sys/ndir.h i_sysndir
11799 eval $inhdr
11800
11801 : Look for dirfd
11802 echo " "
11803 $cat >dirfd.c <<EOM
11804 #include <stdio.h>
11805 #$i_stdlib I_STDLIB
11806 #ifdef I_STDLIB
11807 #include <stdlib.h>
11808 #endif
11809 #$i_dirent I_DIRENT             /**/
11810 #$i_sysdir I_SYS_DIR            /**/
11811 #$i_sysndir I_SYS_NDIR          /**/
11812 #$i_systypes I_SYS_TYPES        /**/
11813 #if defined(I_SYS_TYPES)
11814 #include <sys/types.h>
11815 #endif
11816 #if defined(I_DIRENT)
11817 #include <dirent.h>
11818 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11819 #include <sys/dir.h>
11820 #endif
11821 #else
11822 #ifdef I_SYS_NDIR
11823 #include <sys/ndir.h>
11824 #else
11825 #ifdef I_SYS_DIR
11826 #ifdef hp9000s500
11827 #include <ndir.h>       /* may be wrong in the future */
11828 #else
11829 #include <sys/dir.h>
11830 #endif
11831 #endif
11832 #endif
11833 #endif 
11834 int main() {
11835         DIR *dirp = opendir(".");
11836         if (dirfd(dirp) >= 0)
11837                 exit(0);
11838         else
11839                 exit(1);
11840 }
11841 EOM
11842 val=$undef
11843 set dirfd
11844 if eval $compile; then
11845         val="$define"
11846 fi
11847 case "$val" in
11848 $define)        echo "dirfd() found." >&4       ;;
11849 *)              echo "dirfd() NOT found." >&4   ;;
11850 esac
11851 set d_dirfd
11852 eval $setvar
11853 $rm -f dirfd*
11854
11855 : see if dlerror exists
11856 xxx_runnm="$runnm"
11857 runnm=false
11858 set dlerror d_dlerror
11859 eval $inlibc
11860 runnm="$xxx_runnm"
11861
11862 : see if dlfcn is available
11863 set dlfcn.h i_dlfcn
11864 eval $inhdr
11865
11866 : Check what extension to use for shared libs
11867 case "$usedl" in
11868 $define|y|true)
11869         $cat << EOM
11870
11871 On a few systems, the dynamically loaded modules that perl generates and uses
11872 will need a different extension than shared libs. The default will probably
11873 be appropriate.
11874
11875 EOM
11876         case "$dlext" in
11877         '')     dflt="$so" ;;
11878         *)      dflt="$dlext" ;;
11879         esac
11880         rp='What is the extension of dynamically loaded modules'
11881         . ./myread
11882         dlext="$ans"
11883         ;;
11884 *)
11885         dlext="none"
11886         ;;
11887 esac
11888
11889 : Check if dlsym need a leading underscore
11890 echo " "
11891 val="$undef"
11892
11893 case "$dlsrc" in
11894 dl_dlopen.xs)
11895         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11896         $cat >dyna.c <<'EOM'
11897 fred () { }
11898 EOM
11899
11900 $cat >fred.c<<EOM
11901
11902 #include <stdio.h>
11903 #$i_stdlib I_STDLIB
11904 #ifdef I_STDLIB
11905 #include <stdlib.h>
11906 #endif
11907 #$i_dlfcn I_DLFCN
11908 #ifdef I_DLFCN
11909 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11910 #else
11911 #include <sys/types.h>
11912 #include <nlist.h>
11913 #include <link.h>
11914 #endif
11915
11916 extern int fred() ;
11917
11918 int main()
11919 {
11920     void * handle ;
11921     void * symbol ;
11922 #ifndef RTLD_LAZY
11923     int mode = 1 ;
11924 #else
11925     int mode = RTLD_LAZY ;
11926 #endif
11927     handle = dlopen("./dyna.$dlext", mode) ;
11928     if (handle == NULL) {
11929         printf ("1\n") ;
11930         fflush (stdout) ;
11931         exit(0);
11932     }
11933     symbol = dlsym(handle, "fred") ;
11934     if (symbol == NULL) {
11935         /* try putting a leading underscore */
11936         symbol = dlsym(handle, "_fred") ;
11937         if (symbol == NULL) {
11938             printf ("2\n") ;
11939             fflush (stdout) ;
11940             exit(0);
11941         }
11942         printf ("3\n") ;
11943     }
11944     else
11945         printf ("4\n") ;
11946     fflush (stdout) ;
11947     exit(0);
11948 }
11949 EOM
11950         : Call the object file tmp-dyna.o in case dlext=o.
11951         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11952                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11953                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11954                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11955                 xxx=`$run ./fred`
11956                 case $xxx in
11957                 1)      echo "Test program failed using dlopen." >&4
11958                         echo "Perhaps you should not use dynamic loading." >&4;;
11959                 2)      echo "Test program failed using dlsym." >&4
11960                         echo "Perhaps you should not use dynamic loading." >&4;;
11961                 3)      echo "dlsym needs a leading underscore" >&4
11962                         val="$define" ;;
11963                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11964                 esac
11965         else
11966                 echo "I can't compile and run the test program." >&4
11967                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11968         fi
11969         ;;
11970 esac
11971
11972 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11973
11974 set d_dlsymun
11975 eval $setvar
11976
11977 : see if drand48_r exists
11978 set drand48_r d_drand48_r
11979 eval $inlibc
11980 case "$d_drand48_r" in
11981 "$define")
11982         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11983         case "$d_drand48_r_proto:$usethreads" in
11984         ":define")      d_drand48_r_proto=define
11985                 set d_drand48_r_proto drand48_r $hdrs
11986                 eval $hasproto ;;
11987         *)      ;;
11988         esac
11989         case "$d_drand48_r_proto" in
11990         define)
11991         case "$drand48_r_proto" in
11992         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11993         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11994         esac
11995         case "$drand48_r_proto" in
11996         ''|0)   d_drand48_r=undef
11997                 drand48_r_proto=0
11998                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11999         * )     case "$drand48_r_proto" in
12000                 REENTRANT_PROTO*) ;;
12001                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12002                 esac
12003                 echo "Prototype: $try" ;;
12004         esac
12005         ;;
12006         *)      case "$usethreads" in
12007                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12008                 esac
12009                 d_drand48_r=undef
12010                 drand48_r_proto=0
12011                 ;;
12012         esac
12013         ;;
12014 *)      drand48_r_proto=0
12015         ;;
12016 esac
12017
12018 : see if prototype for drand48 is available
12019 echo " "
12020 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12021 eval $hasproto
12022
12023 : see if dup2 exists
12024 set dup2 d_dup2
12025 eval $inlibc
12026
12027 : see if eaccess exists
12028 set eaccess d_eaccess
12029 eval $inlibc
12030
12031 : see if endgrent exists
12032 set endgrent d_endgrent
12033 eval $inlibc
12034
12035 : see if this is an grp system
12036 set grp.h i_grp
12037 eval $inhdr
12038
12039 case "$i_grp" in
12040 $define)
12041         xxx=`./findhdr grp.h`
12042         $cppstdin $cppflags $cppminus < $xxx >$$.h
12043
12044         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12045                 val="$define"
12046         else
12047                 val="$undef"
12048         fi
12049         set d_grpasswd
12050         eval $setvar
12051
12052         $rm -f $$.h
12053         ;;
12054 *)
12055         val="$undef";
12056         set d_grpasswd; eval $setvar
12057         ;;
12058 esac
12059
12060 : see if endgrent_r exists
12061 set endgrent_r d_endgrent_r
12062 eval $inlibc
12063 case "$d_endgrent_r" in
12064 "$define")
12065         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12066         case "$d_endgrent_r_proto:$usethreads" in
12067         ":define")      d_endgrent_r_proto=define
12068                 set d_endgrent_r_proto endgrent_r $hdrs
12069                 eval $hasproto ;;
12070         *)      ;;
12071         esac
12072         case "$d_endgrent_r_proto" in
12073         define)
12074         case "$endgrent_r_proto" in
12075         ''|0) try='int endgrent_r(FILE**);'
12076         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12077         esac
12078         case "$endgrent_r_proto" in
12079         ''|0) try='void endgrent_r(FILE**);'
12080         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12081         esac
12082         case "$endgrent_r_proto" in
12083         ''|0)   d_endgrent_r=undef
12084                 endgrent_r_proto=0
12085                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12086         * )     case "$endgrent_r_proto" in
12087                 REENTRANT_PROTO*) ;;
12088                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12089                 esac
12090                 echo "Prototype: $try" ;;
12091         esac
12092         ;;
12093         *)      case "$usethreads" in
12094                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12095                 esac
12096                 d_endgrent_r=undef
12097                 endgrent_r_proto=0
12098                 ;;
12099         esac
12100         ;;
12101 *)      endgrent_r_proto=0
12102         ;;
12103 esac
12104
12105 : see if endhostent exists
12106 set endhostent d_endhent
12107 eval $inlibc
12108
12109 : see if this is a netdb.h system
12110 set netdb.h i_netdb
12111 eval $inhdr
12112
12113 : see if endhostent_r exists
12114 set endhostent_r d_endhostent_r
12115 eval $inlibc
12116 case "$d_endhostent_r" in
12117 "$define")
12118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12119         case "$d_endhostent_r_proto:$usethreads" in
12120         ":define")      d_endhostent_r_proto=define
12121                 set d_endhostent_r_proto endhostent_r $hdrs
12122                 eval $hasproto ;;
12123         *)      ;;
12124         esac
12125         case "$d_endhostent_r_proto" in
12126         define)
12127         case "$endhostent_r_proto" in
12128         ''|0) try='int endhostent_r(struct hostent_data*);'
12129         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12130         esac
12131         case "$endhostent_r_proto" in
12132         ''|0) try='void endhostent_r(struct hostent_data*);'
12133         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12134         esac
12135         case "$endhostent_r_proto" in
12136         ''|0)   d_endhostent_r=undef
12137                 endhostent_r_proto=0
12138                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12139         * )     case "$endhostent_r_proto" in
12140                 REENTRANT_PROTO*) ;;
12141                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12142                 esac
12143                 echo "Prototype: $try" ;;
12144         esac
12145         ;;
12146         *)      case "$usethreads" in
12147                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12148                 esac
12149                 d_endhostent_r=undef
12150                 endhostent_r_proto=0
12151                 ;;
12152         esac
12153         ;;
12154 *)      endhostent_r_proto=0
12155         ;;
12156 esac
12157
12158 : see if endnetent exists
12159 set endnetent d_endnent
12160 eval $inlibc
12161
12162 : see if endnetent_r exists
12163 set endnetent_r d_endnetent_r
12164 eval $inlibc
12165 case "$d_endnetent_r" in
12166 "$define")
12167         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12168         case "$d_endnetent_r_proto:$usethreads" in
12169         ":define")      d_endnetent_r_proto=define
12170                 set d_endnetent_r_proto endnetent_r $hdrs
12171                 eval $hasproto ;;
12172         *)      ;;
12173         esac
12174         case "$d_endnetent_r_proto" in
12175         define)
12176         case "$endnetent_r_proto" in
12177         ''|0) try='int endnetent_r(struct netent_data*);'
12178         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12179         esac
12180         case "$endnetent_r_proto" in
12181         ''|0) try='void endnetent_r(struct netent_data*);'
12182         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12183         esac
12184         case "$endnetent_r_proto" in
12185         ''|0)   d_endnetent_r=undef
12186                 endnetent_r_proto=0
12187                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12188         * )     case "$endnetent_r_proto" in
12189                 REENTRANT_PROTO*) ;;
12190                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12191                 esac
12192                 echo "Prototype: $try" ;;
12193         esac
12194         ;;
12195         *)      case "$usethreads" in
12196                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12197                 esac
12198                 d_endnetent_r=undef
12199                 endnetent_r_proto=0
12200                 ;;
12201         esac
12202         ;;
12203 *)      endnetent_r_proto=0
12204         ;;
12205 esac
12206
12207 : see if endprotoent exists
12208 set endprotoent d_endpent
12209 eval $inlibc
12210
12211 : see if endprotoent_r exists
12212 set endprotoent_r d_endprotoent_r
12213 eval $inlibc
12214 case "$d_endprotoent_r" in
12215 "$define")
12216         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12217         case "$d_endprotoent_r_proto:$usethreads" in
12218         ":define")      d_endprotoent_r_proto=define
12219                 set d_endprotoent_r_proto endprotoent_r $hdrs
12220                 eval $hasproto ;;
12221         *)      ;;
12222         esac
12223         case "$d_endprotoent_r_proto" in
12224         define)
12225         case "$endprotoent_r_proto" in
12226         ''|0) try='int endprotoent_r(struct protoent_data*);'
12227         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12228         esac
12229         case "$endprotoent_r_proto" in
12230         ''|0) try='void endprotoent_r(struct protoent_data*);'
12231         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12232         esac
12233         case "$endprotoent_r_proto" in
12234         ''|0)   d_endprotoent_r=undef
12235                 endprotoent_r_proto=0
12236                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12237         * )     case "$endprotoent_r_proto" in
12238                 REENTRANT_PROTO*) ;;
12239                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12240                 esac
12241                 echo "Prototype: $try" ;;
12242         esac
12243         ;;
12244         *)      case "$usethreads" in
12245                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12246                 esac
12247                 d_endprotoent_r=undef
12248                 endprotoent_r_proto=0
12249                 ;;
12250         esac
12251         ;;
12252 *)      endprotoent_r_proto=0
12253         ;;
12254 esac
12255
12256 : see if endpwent exists
12257 set endpwent d_endpwent
12258 eval $inlibc
12259
12260 : see if this is a pwd.h system
12261 set pwd.h i_pwd
12262 eval $inhdr
12263
12264 case "$i_pwd" in
12265 $define)
12266         xxx=`./findhdr pwd.h`
12267         $cppstdin $cppflags $cppminus < $xxx >$$.h
12268
12269         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12270                 val="$define"
12271         else
12272                 val="$undef"
12273         fi
12274         set d_pwquota
12275         eval $setvar
12276
12277         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12278                 val="$define"
12279         else
12280                 val="$undef"
12281         fi
12282         set d_pwage
12283         eval $setvar
12284
12285         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12286                 val="$define"
12287         else
12288                 val="$undef"
12289         fi
12290         set d_pwchange
12291         eval $setvar
12292
12293         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12294                 val="$define"
12295         else
12296                 val="$undef"
12297         fi
12298         set d_pwclass
12299         eval $setvar
12300
12301         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12302                 val="$define"
12303         else
12304                 val="$undef"
12305         fi
12306         set d_pwexpire
12307         eval $setvar
12308
12309         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12310                 val="$define"
12311         else
12312                 val="$undef"
12313         fi
12314         set d_pwcomment
12315         eval $setvar
12316
12317         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12318                 val="$define"
12319         else
12320                 val="$undef"
12321         fi
12322         set d_pwgecos
12323         eval $setvar
12324
12325         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12326                 val="$define"
12327         else
12328                 val="$undef"
12329         fi
12330         set d_pwpasswd
12331         eval $setvar
12332
12333         $rm -f $$.h
12334         ;;
12335 *)
12336         val="$undef"; 
12337         set d_pwquota; eval $setvar
12338         set d_pwage; eval $setvar
12339         set d_pwchange; eval $setvar
12340         set d_pwclass; eval $setvar
12341         set d_pwexpire; eval $setvar
12342         set d_pwcomment; eval $setvar
12343         set d_pwgecos; eval $setvar
12344         set d_pwpasswd; eval $setvar
12345         ;;
12346 esac
12347
12348 : see if endpwent_r exists
12349 set endpwent_r d_endpwent_r
12350 eval $inlibc
12351 case "$d_endpwent_r" in
12352 "$define")
12353         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12354         case "$d_endpwent_r_proto:$usethreads" in
12355         ":define")      d_endpwent_r_proto=define
12356                 set d_endpwent_r_proto endpwent_r $hdrs
12357                 eval $hasproto ;;
12358         *)      ;;
12359         esac
12360         case "$d_endpwent_r_proto" in
12361         define)
12362         case "$endpwent_r_proto" in
12363         ''|0) try='int endpwent_r(FILE**);'
12364         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12365         esac
12366         case "$endpwent_r_proto" in
12367         ''|0) try='void endpwent_r(FILE**);'
12368         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12369         esac
12370         case "$endpwent_r_proto" in
12371         ''|0)   d_endpwent_r=undef
12372                 endpwent_r_proto=0
12373                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12374         * )     case "$endpwent_r_proto" in
12375                 REENTRANT_PROTO*) ;;
12376                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12377                 esac
12378                 echo "Prototype: $try" ;;
12379         esac
12380         ;;
12381         *)      case "$usethreads" in
12382                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12383                 esac
12384                 d_endpwent_r=undef
12385                 endpwent_r_proto=0
12386                 ;;
12387         esac
12388         ;;
12389 *)      endpwent_r_proto=0
12390         ;;
12391 esac
12392
12393 : see if endservent exists
12394 set endservent d_endsent
12395 eval $inlibc
12396
12397 : see if endservent_r exists
12398 set endservent_r d_endservent_r
12399 eval $inlibc
12400 case "$d_endservent_r" in
12401 "$define")
12402         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12403         case "$d_endservent_r_proto:$usethreads" in
12404         ":define")      d_endservent_r_proto=define
12405                 set d_endservent_r_proto endservent_r $hdrs
12406                 eval $hasproto ;;
12407         *)      ;;
12408         esac
12409         case "$d_endservent_r_proto" in
12410         define)
12411         case "$endservent_r_proto" in
12412         ''|0) try='int endservent_r(struct servent_data*);'
12413         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12414         esac
12415         case "$endservent_r_proto" in
12416         ''|0) try='void endservent_r(struct servent_data*);'
12417         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12418         esac
12419         case "$endservent_r_proto" in
12420         ''|0)   d_endservent_r=undef
12421                 endservent_r_proto=0
12422                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12423         * )     case "$endservent_r_proto" in
12424                 REENTRANT_PROTO*) ;;
12425                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12426                 esac
12427                 echo "Prototype: $try" ;;
12428         esac
12429         ;;
12430         *)      case "$usethreads" in
12431                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12432                 esac
12433                 d_endservent_r=undef
12434                 endservent_r_proto=0
12435                 ;;
12436         esac
12437         ;;
12438 *)      endservent_r_proto=0
12439         ;;
12440 esac
12441
12442 : Locate the flags for 'open()'
12443 echo " "
12444 $cat >try.c <<EOCP
12445 #include <sys/types.h>
12446 #ifdef I_FCNTL
12447 #include <fcntl.h>
12448 #endif
12449 #ifdef I_SYS_FILE
12450 #include <sys/file.h>
12451 #endif
12452 #$i_stdlib I_STDLIB
12453 #ifdef I_STDLIB
12454 #include <stdlib.h>
12455 #endif
12456 int main() {
12457         if(O_RDONLY);
12458 #ifdef O_TRUNC
12459         exit(0);
12460 #else
12461         exit(1);
12462 #endif
12463 }
12464 EOCP
12465 : check sys/file.h first to get FREAD on Sun
12466 if $test `./findhdr sys/file.h` && \
12467                 set try -DI_SYS_FILE && eval $compile; then
12468         h_sysfile=true;
12469         echo "<sys/file.h> defines the O_* constants..." >&4
12470         if $run ./try; then
12471                 echo "and you have the 3 argument form of open()." >&4
12472                 val="$define"
12473         else
12474                 echo "but not the 3 argument form of open().  Oh, well." >&4
12475                 val="$undef"
12476         fi
12477 elif $test `./findhdr fcntl.h` && \
12478                 set try -DI_FCNTL && eval $compile; then
12479         h_fcntl=true;
12480         echo "<fcntl.h> defines the O_* constants..." >&4
12481         if $run ./try; then
12482                 echo "and you have the 3 argument form of open()." >&4
12483                 val="$define"
12484         else
12485                 echo "but not the 3 argument form of open().  Oh, well." >&4
12486                 val="$undef"
12487         fi
12488 else
12489         val="$undef"
12490         echo "I can't find the O_* constant definitions!  You got problems." >&4
12491 fi
12492 set d_open3
12493 eval $setvar
12494 $rm_try
12495
12496 : see if this is a sys/file.h system
12497 val=''
12498 set sys/file.h val
12499 eval $inhdr
12500
12501 : do we need to include sys/file.h ?
12502 case "$val" in
12503 "$define")
12504         echo " "
12505         if $h_sysfile; then
12506                 val="$define"
12507                 echo "We'll be including <sys/file.h>." >&4
12508         else
12509                 val="$undef"
12510                 echo "We won't be including <sys/file.h>." >&4
12511         fi
12512         ;;
12513 *)
12514         h_sysfile=false
12515         ;;
12516 esac
12517 set i_sysfile
12518 eval $setvar
12519
12520 : see if fcntl.h is there
12521 val=''
12522 set fcntl.h val
12523 eval $inhdr
12524
12525 : see if we can include fcntl.h
12526 case "$val" in
12527 "$define")
12528         echo " "
12529         if $h_fcntl; then
12530                 val="$define"
12531                 echo "We'll be including <fcntl.h>." >&4
12532         else
12533                 val="$undef"
12534                 if $h_sysfile; then
12535         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12536                 else
12537                         echo "We won't be including <fcntl.h>." >&4
12538                 fi
12539         fi
12540         ;;
12541 *)
12542         h_fcntl=false
12543         val="$undef"
12544         ;;
12545 esac
12546 set i_fcntl
12547 eval $setvar
12548
12549 : see if fork exists
12550 set fork d_fork
12551 eval $inlibc
12552
12553 : see if pipe exists
12554 set pipe d_pipe
12555 eval $inlibc
12556
12557 : check for non-blocking I/O stuff
12558 case "$h_sysfile" in
12559 true) echo "#include <sys/file.h>" > head.c;;
12560 *)
12561        case "$h_fcntl" in
12562        true) echo "#include <fcntl.h>" > head.c;;
12563        *) echo "#include <sys/fcntl.h>" > head.c;;
12564        esac
12565        ;;
12566 esac
12567 echo " "
12568 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12569 case "$o_nonblock" in
12570 '')
12571         $cat head.c > try.c
12572         $cat >>try.c <<EOCP
12573 #include <stdio.h>
12574 #$i_stdlib I_STDLIB
12575 #ifdef I_STDLIB
12576 #include <stdlib.h>
12577 #endif
12578 #$i_fcntl I_FCNTL
12579 #ifdef I_FCNTL
12580 #include <fcntl.h>
12581 #endif
12582 int main() {
12583 #ifdef O_NONBLOCK
12584         printf("O_NONBLOCK\n");
12585         exit(0);
12586 #endif
12587 #ifdef O_NDELAY
12588         printf("O_NDELAY\n");
12589         exit(0);
12590 #endif
12591 #ifdef FNDELAY
12592         printf("FNDELAY\n");
12593         exit(0);
12594 #endif
12595         exit(0);
12596 }
12597 EOCP
12598         set try
12599         if eval $compile_ok; then
12600                 o_nonblock=`$run ./try`
12601                 case "$o_nonblock" in
12602                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12603                 *) echo "Seems like we can use $o_nonblock.";;
12604                 esac
12605         else
12606                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12607         fi
12608         ;;
12609 *) echo "Using $hint value $o_nonblock.";;
12610 esac
12611 $rm_try
12612
12613 echo " "
12614 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12615 case "$eagain" in
12616 '')
12617         case "$d_fork:$d_pipe" in
12618         define:define)
12619         $cat head.c > try.c
12620         $cat >>try.c <<EOCP
12621 #include <errno.h>
12622 #include <sys/types.h>
12623 #include <signal.h>
12624 #include <stdio.h>
12625 #$i_stdlib I_STDLIB
12626 #ifdef I_STDLIB
12627 #include <stdlib.h>
12628 #endif
12629 #$i_fcntl I_FCNTL
12630 #ifdef I_FCNTL
12631 #include <fcntl.h>
12632 #endif
12633 #define MY_O_NONBLOCK $o_nonblock
12634 #ifndef errno  /* XXX need better Configure test */
12635 extern int errno;
12636 #endif
12637 #$i_unistd I_UNISTD
12638 #ifdef I_UNISTD
12639 #include <unistd.h>
12640 #endif
12641 #$i_string I_STRING
12642 #ifdef I_STRING
12643 #include <string.h>
12644 #else
12645 #include <strings.h>
12646 #endif
12647 $signal_t blech(int x) { exit(3); }
12648 EOCP
12649         $cat >> try.c <<'EOCP'
12650 int main()
12651 {
12652         int pd[2];
12653         int pu[2];
12654         char buf[1];
12655         char string[100];
12656
12657         pipe(pd);       /* Down: child -> parent */
12658         pipe(pu);       /* Up: parent -> child */
12659         if (0 != fork()) {
12660                 int ret;
12661                 close(pd[1]);   /* Parent reads from pd[0] */
12662                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12663 #ifdef F_SETFL
12664                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12665                         exit(1);
12666 #else
12667                 exit(4);
12668 #endif
12669                 signal(SIGALRM, blech);
12670                 alarm(5);
12671                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12672                         exit(2);
12673                 sprintf(string, "%d\n", ret);
12674                 write(2, string, strlen(string));
12675                 alarm(0);
12676 #ifdef EAGAIN
12677                 if (errno == EAGAIN) {
12678                         printf("EAGAIN\n");
12679                         goto ok;
12680                 }
12681 #endif
12682 #ifdef EWOULDBLOCK
12683                 if (errno == EWOULDBLOCK)
12684                         printf("EWOULDBLOCK\n");
12685 #endif
12686         ok:
12687                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12688                 sleep(2);                               /* Give it time to close our pipe */
12689                 alarm(5);
12690                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12691                 alarm(0);
12692                 sprintf(string, "%d\n", ret);
12693                 write(4, string, strlen(string));
12694                 exit(0);
12695         }
12696
12697         close(pd[0]);                   /* We write to pd[1] */
12698         close(pu[1]);                   /* We read from pu[0] */
12699         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12700         close(pd[1]);                   /* Pipe pd is now fully closed! */
12701         exit(0);                                /* Bye bye, thank you for playing! */
12702 }
12703 EOCP
12704         set try
12705         if eval $compile_ok; then
12706                 echo "$startsh" >mtry
12707                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12708                 chmod +x mtry
12709                 ./mtry >/dev/null 2>&1
12710                 case $? in
12711                 0) eagain=`$cat try.out`;;
12712                 1) echo "Could not perform non-blocking setting!";;
12713                 2) echo "I did a successful read() for something that was not there!";;
12714                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12715                 4) echo "Could not find F_SETFL!";;
12716                 *) echo "Something terribly wrong happened during testing.";;
12717                 esac
12718                 rd_nodata=`$cat try.ret`
12719                 echo "A read() system call with no data present returns $rd_nodata."
12720                 case "$rd_nodata" in
12721                 0|-1) ;;
12722                 *)
12723                         echo "(That's peculiar, fixing that to be -1.)"
12724                         rd_nodata=-1
12725                         ;;
12726                 esac
12727                 case "$eagain" in
12728                 '')
12729                         echo "Forcing errno EAGAIN on read() with no data available."
12730                         eagain=EAGAIN
12731                         ;;
12732                 *)
12733                         echo "Your read() sets errno to $eagain when no data is available."
12734                         ;;
12735                 esac
12736                 status=`$cat try.err`
12737                 case "$status" in
12738                 0) echo "And it correctly returns 0 to signal EOF.";;
12739                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12740                 *) echo "However, your read() returns '$status' on EOF??";;
12741                 esac
12742                 val="$define"
12743                 if test "$status" = "$rd_nodata"; then
12744                         echo "WARNING: you can't distinguish between EOF and no data!"
12745                         val="$undef"
12746                 fi
12747         else
12748                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12749                 eagain=EAGAIN
12750         fi
12751         ;;
12752         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12753                 eagain=EAGAIN
12754                 val="$define"
12755                 ;;
12756         esac
12757         set d_eofnblk
12758         eval $setvar
12759         ;;
12760 *)
12761         echo "Using $hint value $eagain."
12762         echo "Your read() returns $rd_nodata when no data is present."
12763         case "$d_eofnblk" in
12764         "$define") echo "And you can see EOF because read() returns 0.";;
12765         "$undef") echo "But you can't see EOF status from read() returned value.";;
12766         *)
12767                 echo "(Assuming you can't see EOF status from read anyway.)"
12768                 d_eofnblk=$undef
12769                 ;;
12770         esac
12771         ;;
12772 esac
12773 $rm_try head.c mtry
12774
12775 : see if _ptr and _cnt from stdio act std
12776 echo " "
12777
12778 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12779         echo "(Looks like you have stdio.h from BSD.)"
12780         case "$stdio_ptr" in
12781         '') stdio_ptr='((fp)->_p)'
12782                 ptr_lval=$define
12783                 ;;
12784         *)      ptr_lval=$d_stdio_ptr_lval;;
12785         esac
12786         case "$stdio_cnt" in
12787         '') stdio_cnt='((fp)->_r)'
12788                 cnt_lval=$define
12789                 ;;
12790         *)      cnt_lval=$d_stdio_cnt_lval;;
12791         esac
12792         case "$stdio_base" in
12793         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12794         esac
12795         case "$stdio_bufsiz" in
12796         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12797         esac
12798 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12799         echo "(Looks like you have stdio.h from Linux.)"
12800         case "$stdio_ptr" in
12801         '') stdio_ptr='((fp)->_IO_read_ptr)'
12802                 ptr_lval=$define
12803                 ;;
12804         *)      ptr_lval=$d_stdio_ptr_lval;;
12805         esac
12806         case "$stdio_cnt" in
12807         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12808                 cnt_lval=$undef
12809                 ;;
12810         *)      cnt_lval=$d_stdio_cnt_lval;;
12811         esac
12812         case "$stdio_base" in
12813         '') stdio_base='((fp)->_IO_read_base)';;
12814         esac
12815         case "$stdio_bufsiz" in
12816         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12817         esac
12818 else
12819         case "$stdio_ptr" in
12820         '') stdio_ptr='((fp)->_ptr)'
12821                 ptr_lval=$define
12822                 ;;
12823         *)      ptr_lval=$d_stdio_ptr_lval;;
12824         esac
12825         case "$stdio_cnt" in
12826         '') stdio_cnt='((fp)->_cnt)'
12827                 cnt_lval=$define
12828                 ;;
12829         *)      cnt_lval=$d_stdio_cnt_lval;;
12830         esac
12831         case "$stdio_base" in
12832         '') stdio_base='((fp)->_base)';;
12833         esac
12834         case "$stdio_bufsiz" in
12835         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12836         esac
12837 fi
12838
12839 : test whether _ptr and _cnt really work
12840 echo "Checking how std your stdio is..." >&4
12841 $cat >try.c <<EOP
12842 #include <stdio.h>
12843 #$i_stdlib I_STDLIB
12844 #ifdef I_STDLIB
12845 #include <stdlib.h>
12846 #endif
12847 #define FILE_ptr(fp)    $stdio_ptr
12848 #define FILE_cnt(fp)    $stdio_cnt
12849 int main() {
12850         FILE *fp = fopen("try.c", "r");
12851         char c = getc(fp);
12852         if (
12853                 18 <= FILE_cnt(fp) &&
12854                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12855         )
12856                 exit(0);
12857         exit(1);
12858 }
12859 EOP
12860 val="$undef"
12861 set try
12862 if eval $compile && $to try.c; then
12863         if $run ./try; then
12864                 echo "Your stdio acts pretty std."
12865                 val="$define"
12866         else
12867                 echo "Your stdio isn't very std."
12868         fi
12869 else
12870         echo "Your stdio doesn't appear very std."
12871 fi
12872 $rm_try
12873
12874 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12875 # direct buffer manipulation no longer works.  The Configure tests
12876 # should be changed to correctly detect this, but until then,
12877 # the following check should at least let perl compile and run.
12878 # (This quick fix should be updated before 5.8.1.)
12879 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12880 # A. Dougherty, June 3, 2002.
12881 case "$d_gnulibc" in
12882 $define)
12883         case "$gnulibc_version" in
12884         2.[01]*)  ;;
12885         2.2) ;;
12886         2.2.[0-9]) ;;
12887         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12888                 val="$undef"
12889                 ;;
12890         esac
12891         ;;
12892 esac
12893 set d_stdstdio
12894 eval $setvar
12895
12896 : Can _ptr be used as an lvalue?
12897 case "$d_stdstdio$ptr_lval" in
12898 $define$define) val=$define ;;
12899 *) val=$undef ;;
12900 esac
12901 set d_stdio_ptr_lval
12902 eval $setvar
12903
12904 : Can _cnt be used as an lvalue?
12905 case "$d_stdstdio$cnt_lval" in
12906 $define$define) val=$define ;;
12907 *) val=$undef ;;
12908 esac
12909 set d_stdio_cnt_lval
12910 eval $setvar
12911
12912
12913 : test whether setting _ptr sets _cnt as a side effect
12914 d_stdio_ptr_lval_sets_cnt="$undef"
12915 d_stdio_ptr_lval_nochange_cnt="$undef"
12916 case "$d_stdio_ptr_lval$d_stdstdio" in
12917 $define$define)
12918         echo "Checking to see what happens if we set the stdio ptr..." >&4
12919 $cat >try.c <<EOP
12920 #include <stdio.h>
12921 /* Can we scream? */
12922 /* Eat dust sed :-) */
12923 /* In the buffer space, no one can hear you scream. */
12924 #$i_stdlib I_STDLIB
12925 #ifdef I_STDLIB
12926 #include <stdlib.h>
12927 #endif
12928 #define FILE_ptr(fp)    $stdio_ptr
12929 #define FILE_cnt(fp)    $stdio_cnt
12930 #include <sys/types.h>
12931 int main() {
12932         FILE *fp = fopen("try.c", "r");
12933         int c;
12934         char *ptr;
12935         size_t cnt;
12936         if (!fp) {
12937             puts("Fail even to read");
12938             exit(1);
12939         }
12940         c = getc(fp); /* Read away the first # */
12941         if (c == EOF) {
12942             puts("Fail even to read");
12943             exit(1);
12944         }
12945         if (!(
12946                 18 <= FILE_cnt(fp) &&
12947                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12948         )) {
12949                 puts("Fail even to read");
12950                 exit (1);
12951         }
12952         ptr = (char*) FILE_ptr(fp);
12953         cnt = (size_t)FILE_cnt(fp);
12954
12955         FILE_ptr(fp) += 42;
12956
12957         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12958                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12959                 exit (1);
12960         }
12961         if (FILE_cnt(fp) <= 20) {
12962                 printf ("Fail (<20 chars to test)");
12963                 exit (1);
12964         }
12965         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12966                 puts("Fail compare");
12967                 exit (1);
12968         }
12969         if (cnt == FILE_cnt(fp)) {
12970                 puts("Pass_unchanged");
12971                 exit (0);
12972         }
12973         if (FILE_cnt(fp) == (cnt - 42)) {
12974                 puts("Pass_changed");
12975                 exit (0);
12976         }
12977         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12978         return 1;
12979
12980 }
12981 EOP
12982         set try
12983         if eval $compile && $to try.c; then
12984                 case `$run ./try` in
12985                 Pass_changed)
12986                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12987                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12988                 Pass_unchanged)
12989                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12990                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12991                 Fail*)
12992                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12993                 *)
12994                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12995         esac
12996         else
12997                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12998         fi
12999         $rm_try
13000         ;;
13001 esac
13002
13003 : see if _base is also standard
13004 val="$undef"
13005 case "$d_stdstdio" in
13006 $define)
13007         $cat >try.c <<EOP
13008 #include <stdio.h>
13009 #$i_stdlib I_STDLIB
13010 #ifdef I_STDLIB
13011 #include <stdlib.h>
13012 #endif
13013 #define FILE_base(fp)   $stdio_base
13014 #define FILE_bufsiz(fp) $stdio_bufsiz
13015 int main() {
13016         FILE *fp = fopen("try.c", "r");
13017         char c = getc(fp);
13018         if (
13019                 19 <= FILE_bufsiz(fp) &&
13020                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13021         )
13022                 exit(0);
13023         exit(1);
13024 }
13025 EOP
13026         set try
13027         if eval $compile && $to try.c; then
13028                 if $run ./try; then
13029                         echo "And its _base field acts std."
13030                         val="$define"
13031                 else
13032                         echo "But its _base field isn't std."
13033                 fi
13034         else
13035                 echo "However, it seems to be lacking the _base field."
13036         fi
13037         $rm_try
13038         ;;
13039 esac
13040 set d_stdiobase
13041 eval $setvar
13042
13043 : see if fast_stdio exists
13044 val="$undef"
13045 case "$d_stdstdio:$d_stdio_ptr_lval" in
13046 "$define:$define")
13047         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13048         *$define*)
13049                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13050                 val="$define"
13051                 ;;
13052         esac
13053         ;;
13054 esac
13055 set d_faststdio
13056 eval $setvar
13057
13058
13059
13060 : see if fchdir exists
13061 set fchdir d_fchdir
13062 eval $inlibc
13063
13064 : see if fchmod exists
13065 set fchmod d_fchmod
13066 eval $inlibc
13067
13068 : see if fchown exists
13069 set fchown d_fchown
13070 eval $inlibc
13071
13072 : see if this is an fcntl system
13073 set fcntl d_fcntl
13074 eval $inlibc
13075
13076 : See if fcntl-based locking works.
13077 echo " "
13078 $cat >try.c <<EOCP
13079 #$i_stdlib I_STDLIB
13080 #ifdef I_STDLIB
13081 #include <stdlib.h>
13082 #endif
13083 #include <unistd.h>
13084 #include <fcntl.h>
13085 #include <signal.h>
13086 $signal_t blech(int x) { exit(3); }
13087 int main() {
13088 #if defined(F_SETLK) && defined(F_SETLKW)
13089      struct flock flock;
13090      int retval, fd;
13091      fd = open("try.c", O_RDONLY);
13092      flock.l_type = F_RDLCK;
13093      flock.l_whence = SEEK_SET;
13094      flock.l_start = flock.l_len = 0;
13095      signal(SIGALRM, blech);
13096      alarm(10);
13097      retval = fcntl(fd, F_SETLK, &flock);
13098      close(fd);
13099      (retval < 0 ? exit(2) : exit(0));
13100 #else
13101      exit(2);
13102 #endif
13103 }
13104 EOCP
13105 echo "Checking if fcntl-based file locking works... "
13106 case "$d_fcntl" in
13107 "$define")
13108         set try
13109         if eval $compile_ok; then
13110                 if $run ./try; then
13111                         echo "Yes, it seems to work."
13112                         val="$define"
13113                 else
13114                         echo "Nope, it didn't work."
13115                         val="$undef"
13116                         case "$?" in
13117                         3) $cat >&4 <<EOM
13118 ***
13119 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13120 *** This is (almost) impossible.
13121 *** If your NFS lock daemons are not feeling well, something like
13122 *** this may happen, please investigate.  Cannot continue, aborting.
13123 ***
13124 EOM
13125                                 exit 1
13126                                 ;;
13127                         esac
13128                 fi
13129         else
13130                 echo "I'm unable to compile the test program, so I'll assume not."
13131                 val="$undef"
13132         fi
13133         ;;
13134 *) val="$undef";
13135         echo "Nope, since you don't even have fcntl()."
13136         ;;
13137 esac
13138 set d_fcntl_can_lock
13139 eval $setvar
13140 $rm_try
13141
13142 : check for fd_set items
13143 $cat <<EOM
13144
13145 Checking to see how well your C compiler handles fd_set and friends ...
13146 EOM
13147 $cat >try.c <<EOCP
13148 #$i_stdlib I_STDLIB
13149 #ifdef I_STDLIB
13150 #include <stdlib.h>
13151 #endif
13152 #$i_systime I_SYS_TIME
13153 #$i_sysselct I_SYS_SELECT
13154 #$d_socket HAS_SOCKET
13155 #include <sys/types.h>
13156 #ifdef HAS_SOCKET
13157 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13158 #endif
13159 #ifdef I_SYS_TIME
13160 #include <sys/time.h>
13161 #endif
13162 #ifdef I_SYS_SELECT
13163 #include <sys/select.h>
13164 #endif
13165 int main() {
13166         fd_set fds;
13167
13168 #ifdef TRYBITS
13169         if(fds.fds_bits);
13170 #endif
13171
13172 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13173         exit(0);
13174 #else
13175         exit(1);
13176 #endif
13177 }
13178 EOCP
13179 set try -DTRYBITS
13180 if eval $compile; then
13181         d_fds_bits="$define"
13182         d_fd_set="$define"
13183         echo "Well, your system knows about the normal fd_set typedef..." >&4
13184         if $run ./try; then
13185                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13186                 d_fd_macros="$define"
13187         else
13188                 $cat >&4 <<'EOM'
13189 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13190 EOM
13191                 d_fd_macros="$undef"
13192         fi
13193 else
13194         $cat <<'EOM'
13195 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13196 EOM
13197         set try
13198         if eval $compile; then
13199                 d_fds_bits="$undef"
13200                 d_fd_set="$define"
13201                 echo "Well, your system has some sort of fd_set available..." >&4
13202                 if $run ./try; then
13203                         echo "and you have the normal fd_set macros." >&4
13204                         d_fd_macros="$define"
13205                 else
13206                         $cat <<'EOM'
13207 but not the normal fd_set macros!  Gross!  More work for me...
13208 EOM
13209                         d_fd_macros="$undef"
13210                 fi
13211         else
13212         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13213                 d_fd_set="$undef"
13214                 d_fds_bits="$undef"
13215                 d_fd_macros="$undef"
13216         fi
13217 fi
13218 $rm_try
13219
13220 : see if fgetpos exists
13221 set fgetpos d_fgetpos
13222 eval $inlibc
13223
13224 : see if finite exists
13225 set finite d_finite
13226 eval $inlibc
13227
13228 : see if finitel exists
13229 set finitel d_finitel
13230 eval $inlibc
13231
13232 : see if flock exists
13233 set flock d_flock
13234 eval $inlibc
13235
13236 : see if prototype for flock is available
13237 echo " "
13238 set d_flockproto flock $i_sysfile sys/file.h
13239 eval $hasproto
13240
13241 : see if fp_class exists
13242 set fp_class d_fp_class
13243 eval $inlibc
13244
13245 : see if pathconf exists
13246 set pathconf d_pathconf
13247 eval $inlibc
13248
13249 : see if fpathconf exists
13250 set fpathconf d_fpathconf
13251 eval $inlibc
13252
13253 : see if fpclass exists
13254 set fpclass d_fpclass
13255 eval $inlibc
13256
13257 : see if fpclassify exists
13258 set fpclassify d_fpclassify
13259 eval $inlibc
13260
13261 : see if fpclassl exists
13262 set fpclassl d_fpclassl
13263 eval $inlibc
13264
13265 : check for fpos64_t
13266 echo " "
13267 echo "Checking to see if you have fpos64_t..." >&4
13268 $cat >try.c <<EOCP
13269 #include <stdio.h>
13270 int main() { fpos64_t x = 7; }
13271 EOCP
13272 set try
13273 if eval $compile; then
13274         val="$define"
13275         echo "You have fpos64_t."
13276 else
13277         val="$undef"
13278         echo "You do not have fpos64_t."
13279         case "$fpossize" in
13280         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13281         esac
13282 fi
13283 $rm_try
13284 set d_fpos64_t
13285 eval $setvar
13286
13287 : see if frexpl exists
13288 set frexpl d_frexpl
13289 eval $inlibc
13290
13291 : see if this is a sys/param system
13292 set sys/param.h i_sysparam
13293 eval $inhdr
13294
13295 : see if this is a sys/mount.h system
13296 set sys/mount.h i_sysmount
13297 eval $inhdr
13298
13299 : Check for fs_data_s
13300 echo " "
13301 echo "Checking to see if your system supports struct fs_data..." >&4
13302 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13303 eval $hasstruct
13304 case "$d_fs_data_s" in
13305 "$define")      echo "Yes, it does."   ;;
13306 *)              echo "No, it doesn't." ;;
13307 esac
13308
13309 : see if fseeko exists
13310 set fseeko d_fseeko
13311 eval $inlibc
13312 case "$longsize" in
13313 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13314 esac
13315
13316 : see if fsetpos exists
13317 set fsetpos d_fsetpos
13318 eval $inlibc
13319
13320 : see if fstatfs exists
13321 set fstatfs d_fstatfs
13322 eval $inlibc
13323
13324 : see if statvfs exists
13325 set statvfs d_statvfs
13326 eval $inlibc
13327
13328 : see if fstatvfs exists
13329 set fstatvfs d_fstatvfs
13330 eval $inlibc
13331
13332
13333 : see if fsync exists
13334 set fsync d_fsync
13335 eval $inlibc
13336
13337 : see if ftello exists
13338 set ftello d_ftello
13339 eval $inlibc
13340 case "$longsize" in
13341 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13342 esac
13343
13344 : check for a working futimes
13345 d_futimes="$undef"
13346 echo " "
13347 echo "Checking if you have a working futimes()" >&4
13348 $cat >try.c <<EOCP
13349 #include <stdio.h>
13350 #include <sys/time.h>
13351 #include <errno.h>
13352 #include <fcntl.h>
13353
13354 int main ()
13355 {
13356     int fd, rv;
13357     fd = open ("try.c", O_RDWR);
13358     if (-1 == fd) exit (1);
13359     rv = futimes (fd, NULL);
13360     exit (rv == -1 ? errno : 0);
13361 }
13362 EOCP
13363 set try
13364 if eval $compile; then
13365     `$run ./try`
13366     rc=$?
13367     case "$rc" in
13368         0)  echo "Yes, you have" >&4
13369             d_futimes="$define"
13370             ;;
13371         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13372             ;;
13373     esac
13374 else
13375     echo "No, it does not (probably harmless)" >&4
13376 fi
13377 $rm_try
13378
13379 : see if ndbm.h is available
13380 set ndbm.h i_ndbm
13381 eval $inhdr
13382 : Compatibility location for RedHat 7.1
13383 set gdbm/ndbm.h i_gdbmndbm
13384 eval $inhdr
13385 : Compatibility location for Debian 4.0
13386 set gdbm-ndbm.h i_gdbm_ndbm
13387 eval $inhdr
13388
13389 val="$undef"
13390 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13391         : see if dbm_open exists
13392         set dbm_open d_dbm_open
13393         eval $inlibc
13394         case "$d_dbm_open" in
13395         $undef)
13396                 i_ndbm="$undef"
13397                 i_gdbmndbm="$undef"
13398                 i_gdbm_ndbm="$undef"
13399                 echo "We won't be including <ndbm.h>"
13400                 val="$undef"
13401                 ;;
13402         *) val="$define"
13403            ;;
13404         esac
13405 fi
13406 set d_ndbm
13407 eval $setvar
13408
13409 ndbm_hdr_protochk='name=$1; hdr=$2;
13410 eval "ihdr=\$""i_$name";
13411 val="$undef";
13412 if $test "$ihdr" = "$define"; then
13413         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13414         case "$d_cplusplus" in
13415         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13416         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13417         esac;
13418         case "$val" in
13419         $define) $echo "Your <$hdr> seems to have prototypes";;
13420         *) $echo "Your <$hdr> does not seem to have prototypes";;
13421         esac;
13422 fi;
13423 set "d_${name}_h_uses_prototypes";
13424 eval $setvar'
13425
13426 set ndbm ndbm.h
13427 eval $ndbm_hdr_protochk
13428 set gdbmndbm gdbm/ndbm.h
13429 eval $ndbm_hdr_protochk
13430 set gdbm_ndbm gdbm-ndbm.h
13431 eval $ndbm_hdr_protochk
13432
13433 : see if getaddrinfo exists
13434 set getaddrinfo d_getaddrinfo
13435 eval $inlibc
13436
13437 : see if getcwd exists
13438 set getcwd d_getcwd
13439 eval $inlibc
13440
13441 : see if getespwnam exists
13442 set getespwnam d_getespwnam
13443 eval $inlibc
13444
13445 : see if getfsstat exists
13446 set getfsstat d_getfsstat
13447 eval $inlibc
13448
13449 : see if getgrent exists
13450 set getgrent d_getgrent
13451 eval $inlibc
13452
13453 : see if getgrent_r exists
13454 set getgrent_r d_getgrent_r
13455 eval $inlibc
13456 case "$d_getgrent_r" in
13457 "$define")
13458         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13459         case "$d_getgrent_r_proto:$usethreads" in
13460         ":define")      d_getgrent_r_proto=define
13461                 set d_getgrent_r_proto getgrent_r $hdrs
13462                 eval $hasproto ;;
13463         *)      ;;
13464         esac
13465         case "$d_getgrent_r_proto" in
13466         define)
13467         case "$getgrent_r_proto" in
13468         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13469         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13470         esac
13471         case "$getgrent_r_proto" in
13472         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13473         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13474         esac
13475         case "$getgrent_r_proto" in
13476         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13477         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13478         esac
13479         case "$getgrent_r_proto" in
13480         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13481         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13482         esac
13483         case "$getgrent_r_proto" in
13484         ''|0) try='int getgrent_r(struct group*, char*, int);'
13485         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13486         esac
13487         case "$getgrent_r_proto" in
13488         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13489         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13490         esac
13491         case "$getgrent_r_proto" in
13492         ''|0)   d_getgrent_r=undef
13493                 getgrent_r_proto=0
13494                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13495         * )     case "$getgrent_r_proto" in
13496                 REENTRANT_PROTO*) ;;
13497                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13498                 esac
13499                 echo "Prototype: $try" ;;
13500         esac
13501         ;;
13502         *)      case "$usethreads" in
13503                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13504                 esac
13505                 d_getgrent_r=undef
13506                 getgrent_r_proto=0
13507                 ;;
13508         esac
13509         ;;
13510 *)      getgrent_r_proto=0
13511         ;;
13512 esac
13513
13514 : see if getgrgid_r exists
13515 set getgrgid_r d_getgrgid_r
13516 eval $inlibc
13517 case "$d_getgrgid_r" in
13518 "$define")
13519         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13520         case "$d_getgrgid_r_proto:$usethreads" in
13521         ":define")      d_getgrgid_r_proto=define
13522                 set d_getgrgid_r_proto getgrgid_r $hdrs
13523                 eval $hasproto ;;
13524         *)      ;;
13525         esac
13526         case "$d_getgrgid_r_proto" in
13527         define)
13528         case "$getgrgid_r_proto" in
13529         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13530         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13531         esac
13532         case "$getgrgid_r_proto" in
13533         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13534         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13535         esac
13536         case "$getgrgid_r_proto" in
13537         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13538         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13539         esac
13540         case "$getgrgid_r_proto" in
13541         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13542         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13543         esac
13544         case "$getgrgid_r_proto" in
13545         ''|0)   d_getgrgid_r=undef
13546                 getgrgid_r_proto=0
13547                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13548         * )     case "$getgrgid_r_proto" in
13549                 REENTRANT_PROTO*) ;;
13550                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13551                 esac
13552                 echo "Prototype: $try" ;;
13553         esac
13554         ;;
13555         *)      case "$usethreads" in
13556                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13557                 esac
13558                 d_getgrgid_r=undef
13559                 getgrgid_r_proto=0
13560                 ;;
13561         esac
13562         ;;
13563 *)      getgrgid_r_proto=0
13564         ;;
13565 esac
13566
13567 : see if getgrnam_r exists
13568 set getgrnam_r d_getgrnam_r
13569 eval $inlibc
13570 case "$d_getgrnam_r" in
13571 "$define")
13572         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13573         case "$d_getgrnam_r_proto:$usethreads" in
13574         ":define")      d_getgrnam_r_proto=define
13575                 set d_getgrnam_r_proto getgrnam_r $hdrs
13576                 eval $hasproto ;;
13577         *)      ;;
13578         esac
13579         case "$d_getgrnam_r_proto" in
13580         define)
13581         case "$getgrnam_r_proto" in
13582         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13583         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13584         esac
13585         case "$getgrnam_r_proto" in
13586         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13587         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13588         esac
13589         case "$getgrnam_r_proto" in
13590         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13591         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13592         esac
13593         case "$getgrnam_r_proto" in
13594         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13595         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13596         esac
13597         case "$getgrnam_r_proto" in
13598         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13599         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13600         esac
13601         case "$getgrnam_r_proto" in
13602         ''|0)   d_getgrnam_r=undef
13603                 getgrnam_r_proto=0
13604                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13605         * )     case "$getgrnam_r_proto" in
13606                 REENTRANT_PROTO*) ;;
13607                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13608                 esac
13609                 echo "Prototype: $try" ;;
13610         esac
13611         ;;
13612         *)      case "$usethreads" in
13613                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13614                 esac
13615                 d_getgrnam_r=undef
13616                 getgrnam_r_proto=0
13617                 ;;
13618         esac
13619         ;;
13620 *)      getgrnam_r_proto=0
13621         ;;
13622 esac
13623
13624 : see if gethostbyaddr exists
13625 set gethostbyaddr d_gethbyaddr
13626 eval $inlibc
13627
13628 : see if gethostbyname exists
13629 set gethostbyname d_gethbyname
13630 eval $inlibc
13631
13632 : see if gethostent exists
13633 set gethostent d_gethent
13634 eval $inlibc
13635
13636 : see how we will look up host name
13637 echo " "
13638 call=''
13639 if set gethostname val -f d_gethname; eval $csym; $val; then
13640         echo 'gethostname() found.' >&4
13641         d_gethname="$define"
13642         call=gethostname
13643 fi
13644 if set uname val -f d_uname; eval $csym; $val; then
13645         if ./xenix; then
13646                 $cat <<'EOM'
13647 uname() was found, but you're running xenix, and older versions of xenix
13648 have a broken uname(). If you don't really know whether your xenix is old
13649 enough to have a broken system call, use the default answer.
13650
13651 EOM
13652                 dflt=y
13653                 case "$d_uname" in
13654                 "$define") dflt=n;;
13655                 esac
13656                 rp='Is your uname() broken?'
13657                 . ./myread
13658                 case "$ans" in
13659                 n*) d_uname="$define"; call=uname;;
13660                 esac
13661         else
13662                 echo 'uname() found.' >&4
13663                 d_uname="$define"
13664                 case "$call" in
13665                 '') call=uname ;;
13666                 esac
13667         fi
13668 fi
13669 case "$d_gethname" in
13670 '') d_gethname="$undef";;
13671 esac
13672 case "$d_uname" in
13673 '') d_uname="$undef";;
13674 esac
13675 case "$d_uname$d_gethname" in
13676 *define*)
13677         dflt=n
13678         cat <<EOM
13679
13680 Every now and then someone has a $call() that lies about the hostname
13681 but can't be fixed for political or economic reasons.  If you wish, I can
13682 pretend $call() isn't there and maybe compute hostname at run-time
13683 thanks to the '$phostname' command.
13684
13685 EOM
13686         rp="Shall I ignore $call() from now on?"
13687         . ./myread
13688         case "$ans" in
13689         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13690         esac;;
13691 esac
13692 case "$phostname" in
13693 '') aphostname='';;
13694 *) case "$aphostname" in
13695         /*) ;;
13696         *) set X $phostname
13697                 shift
13698                 file=$1
13699                 shift
13700                 file=`./loc $file $file $pth`
13701                 aphostname=`echo $file $*`
13702                 ;;
13703         esac
13704         ;;
13705 esac
13706 case "$d_uname$d_gethname" in
13707 *define*) ;;
13708 *)
13709         case "$phostname" in
13710         '')
13711                 echo "There will be no way for $package to get your hostname." >&4;;
13712         *)
13713         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13714                 ;;
13715         esac;;
13716 esac
13717 case "$d_phostname" in
13718 '') d_phostname="$undef";;
13719 esac
13720
13721 : see if gethostbyaddr_r exists
13722 set gethostbyaddr_r d_gethostbyaddr_r
13723 eval $inlibc
13724 case "$d_gethostbyaddr_r" in
13725 "$define")
13726         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13727         case "$d_gethostbyaddr_r_proto:$usethreads" in
13728         ":define")      d_gethostbyaddr_r_proto=define
13729                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13730                 eval $hasproto ;;
13731         *)      ;;
13732         esac
13733         case "$d_gethostbyaddr_r_proto" in
13734         define)
13735         case "$gethostbyaddr_r_proto" in
13736         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13737         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13738         esac
13739         case "$gethostbyaddr_r_proto" in
13740         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13741         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13742         esac
13743         case "$gethostbyaddr_r_proto" in
13744         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13745         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13746         esac
13747         case "$gethostbyaddr_r_proto" in
13748         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13749         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13750         esac
13751         case "$gethostbyaddr_r_proto" in
13752         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13753         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13754         esac
13755         case "$gethostbyaddr_r_proto" in
13756         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13757         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13758         esac
13759         case "$gethostbyaddr_r_proto" in
13760         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13761         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13762         esac
13763         case "$gethostbyaddr_r_proto" in
13764         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13765         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13766         esac
13767         case "$gethostbyaddr_r_proto" in
13768         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13769         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13770         esac
13771         case "$gethostbyaddr_r_proto" in
13772         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13773         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13774         esac
13775         case "$gethostbyaddr_r_proto" in
13776         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13777         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13778         esac
13779         case "$gethostbyaddr_r_proto" in
13780         ''|0)   d_gethostbyaddr_r=undef
13781                 gethostbyaddr_r_proto=0
13782                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13783         * )     case "$gethostbyaddr_r_proto" in
13784                 REENTRANT_PROTO*) ;;
13785                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13786                 esac
13787                 echo "Prototype: $try" ;;
13788         esac
13789         ;;
13790         *)      case "$usethreads" in
13791                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13792                 esac
13793                 d_gethostbyaddr_r=undef
13794                 gethostbyaddr_r_proto=0
13795                 ;;
13796         esac
13797         ;;
13798 *)      gethostbyaddr_r_proto=0
13799         ;;
13800 esac
13801
13802 : see if gethostbyname_r exists
13803 set gethostbyname_r d_gethostbyname_r
13804 eval $inlibc
13805 case "$d_gethostbyname_r" in
13806 "$define")
13807         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13808         case "$d_gethostbyname_r_proto:$usethreads" in
13809         ":define")      d_gethostbyname_r_proto=define
13810                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13811                 eval $hasproto ;;
13812         *)      ;;
13813         esac
13814         case "$d_gethostbyname_r_proto" in
13815         define)
13816         case "$gethostbyname_r_proto" in
13817         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13818         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13819         esac
13820         case "$gethostbyname_r_proto" in
13821         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13822         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13823         esac
13824         case "$gethostbyname_r_proto" in
13825         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13826         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13827         esac
13828         case "$gethostbyname_r_proto" in
13829         ''|0)   d_gethostbyname_r=undef
13830                 gethostbyname_r_proto=0
13831                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13832         * )     case "$gethostbyname_r_proto" in
13833                 REENTRANT_PROTO*) ;;
13834                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13835                 esac
13836                 echo "Prototype: $try" ;;
13837         esac
13838         ;;
13839         *)      case "$usethreads" in
13840                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13841                 esac
13842                 d_gethostbyname_r=undef
13843                 gethostbyname_r_proto=0
13844                 ;;
13845         esac
13846         ;;
13847 *)      gethostbyname_r_proto=0
13848         ;;
13849 esac
13850
13851 : see if gethostent_r exists
13852 set gethostent_r d_gethostent_r
13853 eval $inlibc
13854 case "$d_gethostent_r" in
13855 "$define")
13856         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13857         case "$d_gethostent_r_proto:$usethreads" in
13858         ":define")      d_gethostent_r_proto=define
13859                 set d_gethostent_r_proto gethostent_r $hdrs
13860                 eval $hasproto ;;
13861         *)      ;;
13862         esac
13863         case "$d_gethostent_r_proto" in
13864         define)
13865         case "$gethostent_r_proto" in
13866         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13867         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13868         esac
13869         case "$gethostent_r_proto" in
13870         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13871         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13872         esac
13873         case "$gethostent_r_proto" in
13874         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13875         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13876         esac
13877         case "$gethostent_r_proto" in
13878         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13879         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13880         esac
13881         case "$gethostent_r_proto" in
13882         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13883         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13884         esac
13885         case "$gethostent_r_proto" in
13886         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13887         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13888         esac
13889         case "$gethostent_r_proto" in
13890         ''|0)   d_gethostent_r=undef
13891                 gethostent_r_proto=0
13892                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13893         * )     case "$gethostent_r_proto" in
13894                 REENTRANT_PROTO*) ;;
13895                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13896                 esac
13897                 echo "Prototype: $try" ;;
13898         esac
13899         ;;
13900         *)      case "$usethreads" in
13901                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13902                 esac
13903                 d_gethostent_r=undef
13904                 gethostent_r_proto=0
13905                 ;;
13906         esac
13907         ;;
13908 *)      gethostent_r_proto=0
13909         ;;
13910 esac
13911
13912 : see if prototypes for various gethostxxx netdb.h functions are available
13913 echo " "
13914 set d_gethostprotos gethostent $i_netdb netdb.h
13915 eval $hasproto
13916
13917 : see if getitimer exists
13918 set getitimer d_getitimer
13919 eval $inlibc
13920
13921 : see if getlogin exists
13922 set getlogin d_getlogin
13923 eval $inlibc
13924
13925 : see if getlogin_r exists
13926 set getlogin_r d_getlogin_r
13927 eval $inlibc
13928 case "$d_getlogin_r" in
13929 "$define")
13930         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13931         case "$d_getlogin_r_proto:$usethreads" in
13932         ":define")      d_getlogin_r_proto=define
13933                 set d_getlogin_r_proto getlogin_r $hdrs
13934                 eval $hasproto ;;
13935         *)      ;;
13936         esac
13937         case "$d_getlogin_r_proto" in
13938         define)
13939         case "$getlogin_r_proto" in
13940         ''|0) try='int getlogin_r(char*, size_t);'
13941         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13942         esac
13943         case "$getlogin_r_proto" in
13944         ''|0) try='int getlogin_r(char*, int);'
13945         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13946         esac
13947         case "$getlogin_r_proto" in
13948         ''|0) try='char* getlogin_r(char*, size_t);'
13949         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13950         esac
13951         case "$getlogin_r_proto" in
13952         ''|0) try='char* getlogin_r(char*, int);'
13953         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13954         esac
13955         case "$getlogin_r_proto" in
13956         ''|0)   d_getlogin_r=undef
13957                 getlogin_r_proto=0
13958                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13959         * )     case "$getlogin_r_proto" in
13960                 REENTRANT_PROTO*) ;;
13961                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13962                 esac
13963                 echo "Prototype: $try" ;;
13964         esac
13965         ;;
13966         *)      case "$usethreads" in
13967                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13968                 esac
13969                 d_getlogin_r=undef
13970                 getlogin_r_proto=0
13971                 ;;
13972         esac
13973         ;;
13974 *)      getlogin_r_proto=0
13975         ;;
13976 esac
13977
13978 : see if getmnt exists
13979 set getmnt d_getmnt
13980 eval $inlibc
13981
13982 : see if getmntent exists
13983 set getmntent d_getmntent
13984 eval $inlibc
13985
13986 : see if getnameinfo exists
13987 set getnameinfo d_getnameinfo
13988 eval $inlibc
13989
13990 : see if getnetbyaddr exists
13991 set getnetbyaddr d_getnbyaddr
13992 eval $inlibc
13993
13994 : see if getnetbyname exists
13995 set getnetbyname d_getnbyname
13996 eval $inlibc
13997
13998 : see if getnetent exists
13999 set getnetent d_getnent
14000 eval $inlibc
14001
14002 : see if getnetbyaddr_r exists
14003 set getnetbyaddr_r d_getnetbyaddr_r
14004 eval $inlibc
14005 case "$d_getnetbyaddr_r" in
14006 "$define")
14007         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14008         case "$d_getnetbyaddr_r_proto:$usethreads" in
14009         ":define")      d_getnetbyaddr_r_proto=define
14010                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14011                 eval $hasproto ;;
14012         *)      ;;
14013         esac
14014         case "$d_getnetbyaddr_r_proto" in
14015         define)
14016         case "$getnetbyaddr_r_proto" in
14017         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14018         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14019         esac
14020         case "$getnetbyaddr_r_proto" in
14021         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14022         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14023         esac
14024         case "$getnetbyaddr_r_proto" in
14025         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14026         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14027         esac
14028         case "$getnetbyaddr_r_proto" in
14029         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14030         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14031         esac
14032         case "$getnetbyaddr_r_proto" in
14033         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14034         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14035         esac
14036         case "$getnetbyaddr_r_proto" in
14037         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14038         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14039         esac
14040         case "$getnetbyaddr_r_proto" in
14041         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14042         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14043         esac
14044         case "$getnetbyaddr_r_proto" in
14045         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14046         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14047         esac
14048         case "$getnetbyaddr_r_proto" in
14049         ''|0)   d_getnetbyaddr_r=undef
14050                 getnetbyaddr_r_proto=0
14051                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14052         * )     case "$getnetbyaddr_r_proto" in
14053                 REENTRANT_PROTO*) ;;
14054                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14055                 esac
14056                 echo "Prototype: $try" ;;
14057         esac
14058         ;;
14059         *)      case "$usethreads" in
14060                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14061                 esac
14062                 d_getnetbyaddr_r=undef
14063                 getnetbyaddr_r_proto=0
14064                 ;;
14065         esac
14066         ;;
14067 *)      getnetbyaddr_r_proto=0
14068         ;;
14069 esac
14070
14071 : see if getnetbyname_r exists
14072 set getnetbyname_r d_getnetbyname_r
14073 eval $inlibc
14074 case "$d_getnetbyname_r" in
14075 "$define")
14076         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14077         case "$d_getnetbyname_r_proto:$usethreads" in
14078         ":define")      d_getnetbyname_r_proto=define
14079                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14080                 eval $hasproto ;;
14081         *)      ;;
14082         esac
14083         case "$d_getnetbyname_r_proto" in
14084         define)
14085         case "$getnetbyname_r_proto" in
14086         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14087         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14088         esac
14089         case "$getnetbyname_r_proto" in
14090         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14091         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14092         esac
14093         case "$getnetbyname_r_proto" in
14094         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14095         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14096         esac
14097         case "$getnetbyname_r_proto" in
14098         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14099         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14100         esac
14101         case "$getnetbyname_r_proto" in
14102         ''|0)   d_getnetbyname_r=undef
14103                 getnetbyname_r_proto=0
14104                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14105         * )     case "$getnetbyname_r_proto" in
14106                 REENTRANT_PROTO*) ;;
14107                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14108                 esac
14109                 echo "Prototype: $try" ;;
14110         esac
14111         ;;
14112         *)      case "$usethreads" in
14113                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14114                 esac
14115                 d_getnetbyname_r=undef
14116                 getnetbyname_r_proto=0
14117                 ;;
14118         esac
14119         ;;
14120 *)      getnetbyname_r_proto=0
14121         ;;
14122 esac
14123
14124 : see if getnetent_r exists
14125 set getnetent_r d_getnetent_r
14126 eval $inlibc
14127 case "$d_getnetent_r" in
14128 "$define")
14129         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14130         case "$d_getnetent_r_proto:$usethreads" in
14131         ":define")      d_getnetent_r_proto=define
14132                 set d_getnetent_r_proto getnetent_r $hdrs
14133                 eval $hasproto ;;
14134         *)      ;;
14135         esac
14136         case "$d_getnetent_r_proto" in
14137         define)
14138         case "$getnetent_r_proto" in
14139         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14140         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14141         esac
14142         case "$getnetent_r_proto" in
14143         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14144         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14145         esac
14146         case "$getnetent_r_proto" in
14147         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14148         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14149         esac
14150         case "$getnetent_r_proto" in
14151         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14152         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14153         esac
14154         case "$getnetent_r_proto" in
14155         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14156         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14157         esac
14158         case "$getnetent_r_proto" in
14159         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14160         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14161         esac
14162         case "$getnetent_r_proto" in
14163         ''|0)   d_getnetent_r=undef
14164                 getnetent_r_proto=0
14165                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14166         * )     case "$getnetent_r_proto" in
14167                 REENTRANT_PROTO*) ;;
14168                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14169                 esac
14170                 echo "Prototype: $try" ;;
14171         esac
14172         ;;
14173         *)      case "$usethreads" in
14174                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14175                 esac
14176                 d_getnetent_r=undef
14177                 getnetent_r_proto=0
14178                 ;;
14179         esac
14180         ;;
14181 *)      getnetent_r_proto=0
14182         ;;
14183 esac
14184
14185 : see if prototypes for various getnetxxx netdb.h functions are available
14186 echo " "
14187 set d_getnetprotos getnetent $i_netdb netdb.h
14188 eval $hasproto
14189
14190 : see if getpagesize exists
14191 set getpagesize d_getpagsz
14192 eval $inlibc
14193
14194 : Optional checks for getprotobyname and getprotobynumber
14195
14196 : see if getprotobyname exists
14197 set getprotobyname d_getpbyname
14198 eval $inlibc
14199
14200 : see if getprotobynumber exists
14201 set getprotobynumber d_getpbynumber
14202 eval $inlibc
14203
14204 : see if getprotoent exists
14205 set getprotoent d_getpent
14206 eval $inlibc
14207
14208 : see if getpgid exists
14209 set getpgid d_getpgid
14210 eval $inlibc
14211
14212 : see if getpgrp2 exists
14213 set getpgrp2 d_getpgrp2
14214 eval $inlibc
14215
14216 : see if getppid exists
14217 set getppid d_getppid
14218 eval $inlibc
14219
14220 : see if getpriority exists
14221 set getpriority d_getprior
14222 eval $inlibc
14223
14224 : see if getprotobyname_r exists
14225 set getprotobyname_r d_getprotobyname_r
14226 eval $inlibc
14227 case "$d_getprotobyname_r" in
14228 "$define")
14229         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14230         case "$d_getprotobyname_r_proto:$usethreads" in
14231         ":define")      d_getprotobyname_r_proto=define
14232                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14233                 eval $hasproto ;;
14234         *)      ;;
14235         esac
14236         case "$d_getprotobyname_r_proto" in
14237         define)
14238         case "$getprotobyname_r_proto" in
14239         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14240         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14241         esac
14242         case "$getprotobyname_r_proto" in
14243         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14244         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14245         esac
14246         case "$getprotobyname_r_proto" in
14247         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14248         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14249         esac
14250         case "$getprotobyname_r_proto" in
14251         ''|0)   d_getprotobyname_r=undef
14252                 getprotobyname_r_proto=0
14253                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14254         * )     case "$getprotobyname_r_proto" in
14255                 REENTRANT_PROTO*) ;;
14256                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14257                 esac
14258                 echo "Prototype: $try" ;;
14259         esac
14260         ;;
14261         *)      case "$usethreads" in
14262                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14263                 esac
14264                 d_getprotobyname_r=undef
14265                 getprotobyname_r_proto=0
14266                 ;;
14267         esac
14268         ;;
14269 *)      getprotobyname_r_proto=0
14270         ;;
14271 esac
14272
14273 : see if getprotobynumber_r exists
14274 set getprotobynumber_r d_getprotobynumber_r
14275 eval $inlibc
14276 case "$d_getprotobynumber_r" in
14277 "$define")
14278         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14279         case "$d_getprotobynumber_r_proto:$usethreads" in
14280         ":define")      d_getprotobynumber_r_proto=define
14281                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14282                 eval $hasproto ;;
14283         *)      ;;
14284         esac
14285         case "$d_getprotobynumber_r_proto" in
14286         define)
14287         case "$getprotobynumber_r_proto" in
14288         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14289         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14290         esac
14291         case "$getprotobynumber_r_proto" in
14292         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14293         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14294         esac
14295         case "$getprotobynumber_r_proto" in
14296         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14297         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14298         esac
14299         case "$getprotobynumber_r_proto" in
14300         ''|0)   d_getprotobynumber_r=undef
14301                 getprotobynumber_r_proto=0
14302                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14303         * )     case "$getprotobynumber_r_proto" in
14304                 REENTRANT_PROTO*) ;;
14305                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14306                 esac
14307                 echo "Prototype: $try" ;;
14308         esac
14309         ;;
14310         *)      case "$usethreads" in
14311                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14312                 esac
14313                 d_getprotobynumber_r=undef
14314                 getprotobynumber_r_proto=0
14315                 ;;
14316         esac
14317         ;;
14318 *)      getprotobynumber_r_proto=0
14319         ;;
14320 esac
14321
14322 : see if getprotoent_r exists
14323 set getprotoent_r d_getprotoent_r
14324 eval $inlibc
14325 case "$d_getprotoent_r" in
14326 "$define")
14327         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14328         case "$d_getprotoent_r_proto:$usethreads" in
14329         ":define")      d_getprotoent_r_proto=define
14330                 set d_getprotoent_r_proto getprotoent_r $hdrs
14331                 eval $hasproto ;;
14332         *)      ;;
14333         esac
14334         case "$d_getprotoent_r_proto" in
14335         define)
14336         case "$getprotoent_r_proto" in
14337         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14338         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14339         esac
14340         case "$getprotoent_r_proto" in
14341         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14342         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14343         esac
14344         case "$getprotoent_r_proto" in
14345         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14346         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14347         esac
14348         case "$getprotoent_r_proto" in
14349         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14350         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14351         esac
14352         case "$getprotoent_r_proto" in
14353         ''|0)   d_getprotoent_r=undef
14354                 getprotoent_r_proto=0
14355                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14356         * )     case "$getprotoent_r_proto" in
14357                 REENTRANT_PROTO*) ;;
14358                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14359                 esac
14360                 echo "Prototype: $try" ;;
14361         esac
14362         ;;
14363         *)      case "$usethreads" in
14364                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14365                 esac
14366                 d_getprotoent_r=undef
14367                 getprotoent_r_proto=0
14368                 ;;
14369         esac
14370         ;;
14371 *)      getprotoent_r_proto=0
14372         ;;
14373 esac
14374
14375 : see if prototypes for various getprotoxxx netdb.h functions are available
14376 echo " "
14377 set d_getprotoprotos getprotoent $i_netdb netdb.h
14378 eval $hasproto
14379
14380 : see if getprpwnam exists
14381 set getprpwnam d_getprpwnam
14382 eval $inlibc
14383
14384 : see if getpwent exists
14385 set getpwent d_getpwent
14386 eval $inlibc
14387
14388 : see if getpwent_r exists
14389 set getpwent_r d_getpwent_r
14390 eval $inlibc
14391 case "$d_getpwent_r" in
14392 "$define")
14393         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14394         case "$d_getpwent_r_proto:$usethreads" in
14395         ":define")      d_getpwent_r_proto=define
14396                 set d_getpwent_r_proto getpwent_r $hdrs
14397                 eval $hasproto ;;
14398         *)      ;;
14399         esac
14400         case "$d_getpwent_r_proto" in
14401         define)
14402         case "$getpwent_r_proto" in
14403         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14404         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14405         esac
14406         case "$getpwent_r_proto" in
14407         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14408         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14409         esac
14410         case "$getpwent_r_proto" in
14411         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14412         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14413         esac
14414         case "$getpwent_r_proto" in
14415         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14416         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14417         esac
14418         case "$getpwent_r_proto" in
14419         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14420         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14421         esac
14422         case "$getpwent_r_proto" in
14423         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14424         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14425         esac
14426         case "$getpwent_r_proto" in
14427         ''|0)   d_getpwent_r=undef
14428                 getpwent_r_proto=0
14429                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14430         * )     case "$getpwent_r_proto" in
14431                 REENTRANT_PROTO*) ;;
14432                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14433                 esac
14434                 echo "Prototype: $try" ;;
14435         esac
14436         ;;
14437         *)      case "$usethreads" in
14438                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14439                 esac
14440                 d_getpwent_r=undef
14441                 getpwent_r_proto=0
14442                 ;;
14443         esac
14444         ;;
14445 *)      getpwent_r_proto=0
14446         ;;
14447 esac
14448
14449 : see if getpwnam_r exists
14450 set getpwnam_r d_getpwnam_r
14451 eval $inlibc
14452 case "$d_getpwnam_r" in
14453 "$define")
14454         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14455         case "$d_getpwnam_r_proto:$usethreads" in
14456         ":define")      d_getpwnam_r_proto=define
14457                 set d_getpwnam_r_proto getpwnam_r $hdrs
14458                 eval $hasproto ;;
14459         *)      ;;
14460         esac
14461         case "$d_getpwnam_r_proto" in
14462         define)
14463         case "$getpwnam_r_proto" in
14464         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14465         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14466         esac
14467         case "$getpwnam_r_proto" in
14468         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14469         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14470         esac
14471         case "$getpwnam_r_proto" in
14472         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14473         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14474         esac
14475         case "$getpwnam_r_proto" in
14476         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14477         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14478         esac
14479         case "$getpwnam_r_proto" in
14480         ''|0)   d_getpwnam_r=undef
14481                 getpwnam_r_proto=0
14482                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14483         * )     case "$getpwnam_r_proto" in
14484                 REENTRANT_PROTO*) ;;
14485                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14486                 esac
14487                 echo "Prototype: $try" ;;
14488         esac
14489         ;;
14490         *)      case "$usethreads" in
14491                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14492                 esac
14493                 d_getpwnam_r=undef
14494                 getpwnam_r_proto=0
14495                 ;;
14496         esac
14497         ;;
14498 *)      getpwnam_r_proto=0
14499         ;;
14500 esac
14501
14502 : see if getpwuid_r exists
14503 set getpwuid_r d_getpwuid_r
14504 eval $inlibc
14505 case "$d_getpwuid_r" in
14506 "$define")
14507         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14508         case "$d_getpwuid_r_proto:$usethreads" in
14509         ":define")      d_getpwuid_r_proto=define
14510                 set d_getpwuid_r_proto getpwuid_r $hdrs
14511                 eval $hasproto ;;
14512         *)      ;;
14513         esac
14514         case "$d_getpwuid_r_proto" in
14515         define)
14516         case "$getpwuid_r_proto" in
14517         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14518         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14519         esac
14520         case "$getpwuid_r_proto" in
14521         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14522         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14523         esac
14524         case "$getpwuid_r_proto" in
14525         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14526         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14527         esac
14528         case "$getpwuid_r_proto" in
14529         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14530         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14531         esac
14532         case "$getpwuid_r_proto" in
14533         ''|0)   d_getpwuid_r=undef
14534                 getpwuid_r_proto=0
14535                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14536         * )     case "$getpwuid_r_proto" in
14537                 REENTRANT_PROTO*) ;;
14538                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14539                 esac
14540                 echo "Prototype: $try" ;;
14541         esac
14542         ;;
14543         *)      case "$usethreads" in
14544                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14545                 esac
14546                 d_getpwuid_r=undef
14547                 getpwuid_r_proto=0
14548                 ;;
14549         esac
14550         ;;
14551 *)      getpwuid_r_proto=0
14552         ;;
14553 esac
14554
14555 : Optional checks for getsbyname and getsbyport
14556
14557 : see if getservbyname exists
14558 set getservbyname d_getsbyname
14559 eval $inlibc
14560
14561 : see if getservbyport exists
14562 set getservbyport d_getsbyport
14563 eval $inlibc
14564
14565 : see if getservent exists
14566 set getservent d_getsent
14567 eval $inlibc
14568
14569 : see if getservbyname_r exists
14570 set getservbyname_r d_getservbyname_r
14571 eval $inlibc
14572 case "$d_getservbyname_r" in
14573 "$define")
14574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14575         case "$d_getservbyname_r_proto:$usethreads" in
14576         ":define")      d_getservbyname_r_proto=define
14577                 set d_getservbyname_r_proto getservbyname_r $hdrs
14578                 eval $hasproto ;;
14579         *)      ;;
14580         esac
14581         case "$d_getservbyname_r_proto" in
14582         define)
14583         case "$getservbyname_r_proto" in
14584         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14585         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14586         esac
14587         case "$getservbyname_r_proto" in
14588         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14589         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14590         esac
14591         case "$getservbyname_r_proto" in
14592         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14593         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14594         esac
14595         case "$getservbyname_r_proto" in
14596         ''|0)   d_getservbyname_r=undef
14597                 getservbyname_r_proto=0
14598                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14599         * )     case "$getservbyname_r_proto" in
14600                 REENTRANT_PROTO*) ;;
14601                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14602                 esac
14603                 echo "Prototype: $try" ;;
14604         esac
14605         ;;
14606         *)      case "$usethreads" in
14607                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14608                 esac
14609                 d_getservbyname_r=undef
14610                 getservbyname_r_proto=0
14611                 ;;
14612         esac
14613         ;;
14614 *)      getservbyname_r_proto=0
14615         ;;
14616 esac
14617
14618 : see if getservbyport_r exists
14619 set getservbyport_r d_getservbyport_r
14620 eval $inlibc
14621 case "$d_getservbyport_r" in
14622 "$define")
14623         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14624         case "$d_getservbyport_r_proto:$usethreads" in
14625         ":define")      d_getservbyport_r_proto=define
14626                 set d_getservbyport_r_proto getservbyport_r $hdrs
14627                 eval $hasproto ;;
14628         *)      ;;
14629         esac
14630         case "$d_getservbyport_r_proto" in
14631         define)
14632         case "$getservbyport_r_proto" in
14633         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14634         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14635         esac
14636         case "$getservbyport_r_proto" in
14637         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14638         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14639         esac
14640         case "$getservbyport_r_proto" in
14641         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14642         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14643         esac
14644         case "$getservbyport_r_proto" in
14645         ''|0)   d_getservbyport_r=undef
14646                 getservbyport_r_proto=0
14647                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14648         * )     case "$getservbyport_r_proto" in
14649                 REENTRANT_PROTO*) ;;
14650                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14651                 esac
14652                 echo "Prototype: $try" ;;
14653         esac
14654         ;;
14655         *)      case "$usethreads" in
14656                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14657                 esac
14658                 d_getservbyport_r=undef
14659                 getservbyport_r_proto=0
14660                 ;;
14661         esac
14662         ;;
14663 *)      getservbyport_r_proto=0
14664         ;;
14665 esac
14666
14667 : see if getservent_r exists
14668 set getservent_r d_getservent_r
14669 eval $inlibc
14670 case "$d_getservent_r" in
14671 "$define")
14672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14673         case "$d_getservent_r_proto:$usethreads" in
14674         ":define")      d_getservent_r_proto=define
14675                 set d_getservent_r_proto getservent_r $hdrs
14676                 eval $hasproto ;;
14677         *)      ;;
14678         esac
14679         case "$d_getservent_r_proto" in
14680         define)
14681         case "$getservent_r_proto" in
14682         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14683         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14684         esac
14685         case "$getservent_r_proto" in
14686         ''|0) try='int getservent_r(struct servent*, char*, int);'
14687         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14688         esac
14689         case "$getservent_r_proto" in
14690         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14691         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14692         esac
14693         case "$getservent_r_proto" in
14694         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14695         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14696         esac
14697         case "$getservent_r_proto" in
14698         ''|0)   d_getservent_r=undef
14699                 getservent_r_proto=0
14700                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14701         * )     case "$getservent_r_proto" in
14702                 REENTRANT_PROTO*) ;;
14703                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14704                 esac
14705                 echo "Prototype: $try" ;;
14706         esac
14707         ;;
14708         *)      case "$usethreads" in
14709                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14710                 esac
14711                 d_getservent_r=undef
14712                 getservent_r_proto=0
14713                 ;;
14714         esac
14715         ;;
14716 *)      getservent_r_proto=0
14717         ;;
14718 esac
14719
14720 : see if prototypes for various getservxxx netdb.h functions are available
14721 echo " "
14722 set d_getservprotos getservent $i_netdb netdb.h
14723 eval $hasproto
14724
14725 : see if getspnam exists
14726 set getspnam d_getspnam
14727 eval $inlibc
14728
14729 : see if this is a shadow.h system
14730 set shadow.h i_shadow
14731 eval $inhdr
14732
14733 : see if getspnam_r exists
14734 set getspnam_r d_getspnam_r
14735 eval $inlibc
14736 case "$d_getspnam_r" in
14737 "$define")
14738         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14739         case "$d_getspnam_r_proto:$usethreads" in
14740         ":define")      d_getspnam_r_proto=define
14741                 set d_getspnam_r_proto getspnam_r $hdrs
14742                 eval $hasproto ;;
14743         *)      ;;
14744         esac
14745         case "$d_getspnam_r_proto" in
14746         define)
14747         case "$getspnam_r_proto" in
14748         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14749         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14750         esac
14751         case "$getspnam_r_proto" in
14752         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14753         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14754         esac
14755         case "$getspnam_r_proto" in
14756         ''|0)   d_getspnam_r=undef
14757                 getspnam_r_proto=0
14758                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14759         * )     case "$getspnam_r_proto" in
14760                 REENTRANT_PROTO*) ;;
14761                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14762                 esac
14763                 echo "Prototype: $try" ;;
14764         esac
14765         ;;
14766         *)      case "$usethreads" in
14767                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14768                 esac
14769                 d_getspnam_r=undef
14770                 getspnam_r_proto=0
14771                 ;;
14772         esac
14773         ;;
14774 *)      getspnam_r_proto=0
14775         ;;
14776 esac
14777
14778 : see if gettimeofday or ftime exists
14779 set gettimeofday d_gettimeod
14780 eval $inlibc
14781 case "$d_gettimeod" in
14782 "$undef")
14783         set ftime d_ftime 
14784         eval $inlibc
14785         ;;
14786 *)
14787         val="$undef"; set d_ftime; eval $setvar
14788         ;;
14789 esac
14790 case "$d_gettimeod$d_ftime" in
14791 "$undef$undef")
14792         echo " "
14793         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14794         ;;
14795 esac
14796
14797 : see if gmtime_r exists
14798 set gmtime_r d_gmtime_r
14799 eval $inlibc
14800 case "$d_gmtime_r" in
14801 "$define")
14802         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14803         case "$d_gmtime_r_proto:$usethreads" in
14804         ":define")      d_gmtime_r_proto=define
14805                 set d_gmtime_r_proto gmtime_r $hdrs
14806                 eval $hasproto ;;
14807         *)      ;;
14808         esac
14809         case "$d_gmtime_r_proto" in
14810         define)
14811         case "$gmtime_r_proto" in
14812         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14813         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14814         esac
14815         case "$gmtime_r_proto" in
14816         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14817         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14818         esac
14819         case "$gmtime_r_proto" in
14820         ''|0)   d_gmtime_r=undef
14821                 gmtime_r_proto=0
14822                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14823         * )     case "$gmtime_r_proto" in
14824                 REENTRANT_PROTO*) ;;
14825                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14826                 esac
14827                 echo "Prototype: $try" ;;
14828         esac
14829         ;;
14830         *)      case "$usethreads" in
14831                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14832                 esac
14833                 d_gmtime_r=undef
14834                 gmtime_r_proto=0
14835                 ;;
14836         esac
14837         ;;
14838 *)      gmtime_r_proto=0
14839         ;;
14840 esac
14841
14842 : see if hasmntopt exists
14843 set hasmntopt d_hasmntopt
14844 eval $inlibc
14845
14846 : see if this is a netinet/in.h or sys/in.h system
14847 set netinet/in.h i_niin sys/in.h i_sysin
14848 eval $inhdr
14849
14850 : see if arpa/inet.h has to be included
14851 set arpa/inet.h i_arpainet
14852 eval $inhdr
14853
14854 : see if htonl --and friends-- exists
14855 val=''
14856 set htonl val
14857 eval $inlibc
14858
14859 : Maybe they are macros.
14860 case "$val" in
14861 $undef)
14862         $cat >htonl.c <<EOM
14863 #include <stdio.h>
14864 #include <sys/types.h>
14865 #$i_niin I_NETINET_IN
14866 #$i_sysin I_SYS_IN
14867 #$i_arpainet I_ARPA_INET
14868 #ifdef I_NETINET_IN
14869 #include <netinet/in.h>
14870 #endif
14871 #ifdef I_SYS_IN
14872 #include <sys/in.h>
14873 #endif
14874 #ifdef I_ARPA_INET
14875 #include <arpa/inet.h>
14876 #endif
14877 #ifdef htonl
14878 printf("Defined as a macro.");
14879 #endif
14880 EOM
14881         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14882         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14883                 val="$define"
14884                 echo "But it seems to be defined as a macro." >&4
14885         fi
14886         $rm -f htonl.?
14887         ;;
14888 esac
14889 set d_htonl
14890 eval $setvar
14891
14892 : see if ilogbl exists
14893 set ilogbl d_ilogbl
14894 eval $inlibc
14895
14896 : index or strchr
14897 echo " "
14898 if set index val -f; eval $csym; $val; then
14899         if set strchr val -f d_strchr; eval $csym; $val; then
14900                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14901                         val="$define"
14902                         vali="$undef"
14903                         echo "strchr() found." >&4
14904                 else
14905                         val="$undef"
14906                         vali="$define"
14907                         echo "index() found." >&4
14908                 fi
14909         else
14910                 val="$undef"
14911                 vali="$define"
14912                 echo "index() found." >&4
14913         fi
14914 else
14915         if set strchr val -f d_strchr; eval $csym; $val; then
14916                 val="$define"
14917                 vali="$undef"
14918                 echo "strchr() found." >&4
14919         else
14920                 echo "No index() or strchr() found!" >&4
14921                 val="$undef"
14922                 vali="$undef"
14923         fi
14924 fi
14925 set d_strchr; eval $setvar
14926 val="$vali"
14927 set d_index; eval $setvar
14928
14929 : check whether inet_aton exists
14930 set inet_aton d_inetaton
14931 eval $inlibc
14932
14933 : see if inet_ntop exists
14934 set inet_ntop d_inetntop
14935 eval $inlibc
14936
14937 : see if inet_pton exists
14938 set inet_pton d_inetpton
14939 eval $inlibc
14940
14941 : Look for isascii
14942 echo " "
14943 $cat >isascii.c <<EOCP
14944 #include <stdio.h>
14945 #include <ctype.h>
14946 #$i_stdlib I_STDLIB
14947 #ifdef I_STDLIB
14948 #include <stdlib.h>
14949 #endif
14950 int main() {
14951         int c = 'A';
14952         if (isascii(c))
14953                 exit(0);
14954         else
14955                 exit(1);
14956 }
14957 EOCP
14958 set isascii
14959 if eval $compile; then
14960         echo "isascii() found." >&4
14961         val="$define"
14962 else
14963         echo "isascii() NOT found." >&4
14964         val="$undef"
14965 fi
14966 set d_isascii
14967 eval $setvar
14968 $rm -f isascii*
14969
14970 : see if isfinite exists
14971 set isfinite d_isfinite
14972 eval $inlibc
14973
14974 : see if isinf exists
14975 set isinf d_isinf
14976 eval $inlibc
14977
14978 : see if isnan exists
14979 set isnan d_isnan
14980 eval $inlibc
14981
14982 : see if isnanl exists
14983 set isnanl d_isnanl
14984 eval $inlibc
14985
14986 : see if killpg exists
14987 set killpg d_killpg
14988 eval $inlibc
14989
14990 : see if lchown exists
14991 echo " "
14992 $cat > try.c <<'EOCP'
14993 /* System header to define __stub macros and hopefully few prototypes,
14994     which can conflict with char lchown(); below.  */
14995 #include <assert.h>
14996 /* Override any gcc2 internal prototype to avoid an error.  */
14997 /* We use char because int might match the return type of a gcc2
14998    builtin and then its argument prototype would still apply.  */
14999 char lchown();
15000 int main() {
15001     /*  The GNU C library defines this for functions which it implements
15002         to always fail with ENOSYS.  Some functions are actually named
15003         something starting with __ and the normal name is an alias.  */
15004 #if defined (__stub_lchown) || defined (__stub___lchown)
15005 choke me
15006 #else
15007 lchown();
15008 #endif
15009 ; return 0; }
15010 EOCP
15011 set try
15012 if eval $compile; then
15013     $echo "lchown() found." >&4
15014     val="$define"
15015 else
15016     $echo "lchown() NOT found." >&4
15017     val="$undef"
15018 fi
15019 set d_lchown
15020 eval $setvar
15021
15022 : See if number of significant digits in a double precision number is known
15023 echo " "
15024 $cat >ldbl_dig.c <<EOM
15025 #$i_limits I_LIMITS
15026 #$i_float I_FLOAT
15027 #ifdef I_LIMITS
15028 #include <limits.h>
15029 #endif
15030 #ifdef I_FLOAT
15031 #include <float.h>
15032 #endif
15033 #ifdef LDBL_DIG
15034 printf("Contains LDBL_DIG");
15035 #endif
15036 EOM
15037 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15038 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15039         echo "LDBL_DIG found." >&4
15040         val="$define"
15041 else
15042         echo "LDBL_DIG NOT found." >&4
15043         val="$undef"
15044 fi
15045 $rm -f ldbl_dig.?
15046 set d_ldbl_dig
15047 eval $setvar
15048
15049 : see if this is a math.h system
15050 set math.h i_math
15051 eval $inhdr
15052
15053 : check to see if math.h defines _LIB_VERSION
15054 d_libm_lib_version="$undef"
15055 case $i_math in
15056     $define)
15057         echo " "
15058         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15059         $cat >try.c <<EOCP
15060 #include <unistd.h>
15061 #include <math.h>
15062 int main (int argc, char *argv[])
15063 {
15064     printf ("%d\n", _LIB_VERSION);
15065     return (0);
15066     } /* main */
15067 EOCP
15068         set try
15069         if eval $compile; then
15070             foo=`$run ./try`
15071             echo "Yes, it does ($foo)" >&4
15072             d_libm_lib_version="$define"
15073         else
15074             echo "No, it does not (probably harmless)" >&4
15075             fi
15076         $rm_try
15077         ;;
15078
15079     esac
15080
15081 : see if link exists
15082 set link d_link
15083 eval $inlibc
15084
15085 : see if localtime_r exists
15086 set localtime_r d_localtime_r
15087 eval $inlibc
15088 case "$d_localtime_r" in
15089 "$define")
15090         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15091         case "$d_localtime_r_proto:$usethreads" in
15092         ":define")      d_localtime_r_proto=define
15093                 set d_localtime_r_proto localtime_r $hdrs
15094                 eval $hasproto ;;
15095         *)      ;;
15096         esac
15097         case "$d_localtime_r_proto" in
15098         define)
15099         case "$localtime_r_proto" in
15100         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15101         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15102         esac
15103         case "$localtime_r_proto" in
15104         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15105         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15106         esac
15107         case "$localtime_r_proto" in
15108         ''|0)   d_localtime_r=undef
15109                 localtime_r_proto=0
15110                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15111         * )     case "$localtime_r_proto" in
15112                 REENTRANT_PROTO*) ;;
15113                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15114                 esac
15115                 echo "Prototype: $try" ;;
15116         esac
15117         ;;
15118         *)      case "$usethreads" in
15119                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15120                 esac
15121                 d_localtime_r=undef
15122                 localtime_r_proto=0
15123                 ;;
15124         esac
15125         ;;
15126 *)      localtime_r_proto=0
15127         ;;
15128 esac
15129
15130 : see if localtime_r calls tzset
15131 case "$localtime_r_proto" in
15132 REENTRANT_PROTO*)
15133         $cat >try.c <<EOCP
15134 /*  Does our libc's localtime_r call tzset ?
15135  *  return 0 if so, 1 otherwise.
15136  */
15137 #$i_systypes    I_SYS_TYPES
15138 #$i_unistd      I_UNISTD
15139 #$i_time        I_TIME
15140 #$i_stdlib      I_STDLIB
15141 #$i_string      I_STRING
15142 #$i_malloc      I_MALLOC
15143 #ifdef I_SYS_TYPES
15144 #  include <sys/types.h>
15145 #endif
15146 #ifdef I_UNISTD
15147 #  include <unistd.h>
15148 #endif
15149 #ifdef I_TIME
15150 #  include <time.h>
15151 #endif
15152 #ifdef I_STDLIB
15153 #include <stdlib.h>
15154 #endif
15155 #ifdef I_STRING
15156 #  include <string.h>
15157 #else
15158 #  include <strings.h>
15159 #endif
15160 #ifdef I_MALLOC
15161 #  include <malloc.h>
15162 #endif
15163 int main()
15164 {
15165     time_t t = time(0L);
15166     char w_tz[]="TZ" "=GMT+5",
15167          e_tz[]="TZ" "=GMT-5",
15168         *tz_e = (char*)malloc(16),
15169         *tz_w = (char*)malloc(16);
15170     struct tm tm_e, tm_w;
15171     memset(&tm_e,'\0',sizeof(struct tm));
15172     memset(&tm_w,'\0',sizeof(struct tm));
15173     strcpy(tz_e,e_tz);
15174     strcpy(tz_w,w_tz);
15175
15176     putenv(tz_e);
15177     localtime_r(&t, &tm_e);
15178
15179     putenv(tz_w);
15180     localtime_r(&t, &tm_w);
15181
15182     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15183         return 1;
15184     return 0;
15185 }
15186 EOCP
15187         set try
15188         if eval $compile; then
15189             if $run ./try; then
15190                 d_localtime_r_needs_tzset=undef;
15191             else
15192                 d_localtime_r_needs_tzset=define;
15193             fi;
15194         else
15195             d_localtime_r_needs_tzset=undef;
15196         fi;
15197      ;;
15198   *)
15199      d_localtime_r_needs_tzset=undef;
15200      ;;
15201 esac
15202 $rm_try
15203
15204 : see if localeconv exists
15205 set localeconv d_locconv
15206 eval $inlibc
15207
15208 : see if lockf exists
15209 set lockf d_lockf
15210 eval $inlibc
15211
15212 : see if prototype for lseek is available
15213 echo " "
15214 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15215 eval $hasproto
15216
15217 : see if lstat exists
15218 set lstat d_lstat
15219 eval $inlibc
15220
15221 : see if madvise exists
15222 set madvise d_madvise
15223 eval $inlibc
15224
15225 : see if malloc_size exists
15226 set malloc_size d_malloc_size
15227 eval $inlibc
15228
15229 : see if malloc_size_good exists
15230 set malloc_good_size d_malloc_good_size
15231 eval $inlibc
15232
15233 : see if mblen exists
15234 set mblen d_mblen
15235 eval $inlibc
15236
15237 : see if mbstowcs exists
15238 set mbstowcs d_mbstowcs
15239 eval $inlibc
15240
15241 : see if mbtowc exists
15242 set mbtowc d_mbtowc
15243 eval $inlibc
15244
15245 : see if memchr exists
15246 set memchr d_memchr
15247 eval $inlibc
15248
15249 : see if memcmp exists
15250 set memcmp d_memcmp
15251 eval $inlibc
15252
15253 : see if memcpy exists
15254 set memcpy d_memcpy
15255 eval $inlibc
15256
15257 : see if memmove exists
15258 set memmove d_memmove
15259 eval $inlibc
15260
15261 : see if memset exists
15262 set memset d_memset
15263 eval $inlibc
15264
15265 : see if mkdir exists
15266 set mkdir d_mkdir
15267 eval $inlibc
15268
15269 : see if mkdtemp exists
15270 set mkdtemp d_mkdtemp
15271 eval $inlibc
15272
15273 : see if mkfifo exists
15274 set mkfifo d_mkfifo
15275 eval $inlibc
15276
15277 : see if mkstemp exists
15278 set mkstemp d_mkstemp
15279 eval $inlibc
15280
15281 : see if mkstemps exists
15282 set mkstemps d_mkstemps
15283 eval $inlibc
15284
15285 : see if mktime exists
15286 set mktime d_mktime
15287 eval $inlibc
15288
15289 : see if this is a sys/mman.h system
15290 set sys/mman.h i_sysmman
15291 eval $inhdr
15292
15293 : see if mmap exists
15294 set mmap d_mmap
15295 eval $inlibc
15296 : see what shmat returns
15297 : default to something harmless
15298 mmaptype='void *'
15299 case "$i_sysmman$d_mmap" in
15300 "$define$define")
15301         $cat >mmap.c <<'END'
15302 #include <sys/mman.h>
15303 void *mmap();
15304 END
15305         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15306                 mmaptype='void *'
15307         else
15308                 mmaptype='caddr_t'
15309         fi
15310         echo "and it returns ($mmaptype)." >&4
15311         ;;
15312 esac
15313
15314
15315
15316 : see if sqrtl exists
15317 set sqrtl d_sqrtl
15318 eval $inlibc
15319
15320 : see if scalbnl exists
15321 set scalbnl d_scalbnl
15322 eval $inlibc
15323
15324 : see if modfl exists
15325 set modfl d_modfl
15326 eval $inlibc
15327
15328 : see if prototype for modfl is available
15329 echo " "
15330 set d_modflproto modfl $i_math math.h
15331 eval $hasproto
15332
15333 d_modfl_pow32_bug="$undef"
15334
15335 case "$d_longdbl$d_modfl" in
15336 $define$define)
15337         $cat <<EOM
15338 Checking to see whether your modfl() is okay for large values...
15339 EOM
15340 $cat >try.c <<EOCP
15341 #include <math.h>
15342 #include <stdio.h>
15343 EOCP
15344 if $test "X$d_modflproto" != "X$define"; then
15345         $cat >>try.c <<EOCP
15346 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15347 long double modfl (long double, long double *);
15348 EOCP
15349 fi
15350 $cat >>try.c <<EOCP
15351 int main() {
15352     long double nv = 4294967303.15;
15353     long double v, w;
15354     v = modfl(nv, &w);
15355 #ifdef __GLIBC__
15356     printf("glibc");
15357 #endif
15358     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15359     return 0;
15360 }
15361 EOCP
15362         case "$osname:$gccversion" in
15363         aix:)   saveccflags="$ccflags"
15364                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15365         esac
15366         set try
15367         if eval $compile; then
15368                 foo=`$run ./try`
15369                 case "$foo" in
15370                 *" 4294967303.150000 1.150000 4294967302.000000")
15371                         echo >&4 "Your modfl() is broken for large values."
15372                         d_modfl_pow32_bug="$define"
15373                         case "$foo" in
15374                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15375                         ;;
15376                         esac
15377                         ;;
15378                 *" 4294967303.150000 0.150000 4294967303.000000")
15379                         echo >&4 "Your modfl() seems okay for large values."
15380                         ;;
15381                 *)      echo >&4 "I don't understand your modfl() at all."
15382                         d_modfl="$undef"
15383                         ;;
15384                 esac
15385                 $rm_try
15386         else
15387                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15388                 d_modfl="$undef"
15389         fi
15390         case "$osname:$gccversion" in
15391         aix:)   ccflags="$saveccflags" ;; # restore
15392         esac
15393         ;;
15394 esac
15395
15396 if $test "$uselongdouble" = "$define"; then
15397     message=""
15398     if $test "$d_sqrtl" != "$define"; then
15399         message="$message sqrtl"
15400     fi
15401     if $test "$d_modfl" != "$define"; then
15402         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15403             echo "You have both aintl and copysignl, so I can emulate modfl."
15404         else
15405             message="$message modfl"
15406         fi
15407     fi
15408     if $test "$d_frexpl" != "$define"; then
15409         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15410             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15411         else
15412             message="$message frexpl"
15413         fi
15414     fi
15415
15416     if $test "$message" != ""; then
15417         $cat <<EOM >&4
15418
15419 *** You requested the use of long doubles but you do not seem to have
15420 *** the following mathematical functions needed for long double support:
15421 ***    $message
15422 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15423 *** Cannot continue, aborting.
15424
15425 EOM
15426
15427         exit 1
15428     fi
15429 fi
15430
15431 : see if mprotect exists
15432 set mprotect d_mprotect
15433 eval $inlibc
15434
15435 : see if msgctl exists
15436 set msgctl d_msgctl
15437 eval $inlibc
15438
15439 : see if msgget exists
15440 set msgget d_msgget
15441 eval $inlibc
15442
15443 : see if msgsnd exists
15444 set msgsnd d_msgsnd
15445 eval $inlibc
15446
15447 : see if msgrcv exists
15448 set msgrcv d_msgrcv
15449 eval $inlibc
15450
15451 : see how much of the 'msg*(2)' library is present.
15452 h_msg=true
15453 echo " "
15454 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15455 *"$undef"*) h_msg=false;;
15456 esac
15457 case "$osname" in
15458 freebsd)
15459     case "`ipcs 2>&1`" in
15460     "SVID messages"*"not configured"*)
15461         echo "Your $osname does not have the msg*(2) configured." >&4
15462         h_msg=false
15463         val="$undef"
15464         set msgctl d_msgctl
15465         eval $setvar
15466         set msgget d_msgget
15467         eval $setvar
15468         set msgsnd d_msgsnd
15469         eval $setvar
15470         set msgrcv d_msgrcv
15471         eval $setvar
15472         ;;
15473     esac
15474     ;;
15475 esac
15476 : we could also check for sys/ipc.h ...
15477 if $h_msg && $test `./findhdr sys/msg.h`; then
15478         echo "You have the full msg*(2) library." >&4
15479         val="$define"
15480 else
15481         echo "You don't have the full msg*(2) library." >&4
15482         val="$undef"
15483 fi
15484 set d_msg
15485 eval $setvar
15486
15487 : Check for msghdr_s
15488 echo " "
15489 echo "Checking to see if your system supports struct msghdr..." >&4
15490 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15491 eval $hasstruct
15492 case "$d_msghdr_s" in
15493 "$define")      echo "Yes, it does."   ;;
15494 *)              echo "No, it doesn't." ;;
15495 esac
15496
15497
15498 : see if msync exists
15499 set msync d_msync
15500 eval $inlibc
15501
15502 : see if munmap exists
15503 set munmap d_munmap
15504 eval $inlibc
15505
15506 : see if nice exists
15507 set nice d_nice
15508 eval $inlibc
15509
15510 : see if this is a langinfo.h system
15511 set langinfo.h i_langinfo
15512 eval $inhdr
15513
15514 : see if nl_langinfo exists
15515 set nl_langinfo d_nl_langinfo
15516 eval $inlibc
15517
15518 : check for volatile keyword
15519 echo " "
15520 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15521 $cat >try.c <<'EOCP'
15522 int main()
15523 {
15524         typedef struct _goo_struct goo_struct;
15525         goo_struct * volatile goo = ((goo_struct *)0);
15526         struct _goo_struct {
15527                 long long_int;
15528                 int reg_int;
15529                 char char_var;
15530         };
15531         typedef unsigned short foo_t;
15532         char *volatile foo;
15533         volatile int bar;
15534         volatile foo_t blech;
15535         foo = foo;
15536 }
15537 EOCP
15538 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15539         val="$define"
15540         echo "Yup, it does."
15541 else
15542         val="$undef"
15543         echo "Nope, it doesn't."
15544 fi
15545 set d_volatile
15546 eval $setvar
15547 $rm_try
15548
15549 : Check basic sizes
15550 echo " "
15551 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15552
15553 case "$use64bitint:$d_quad:$quadtype" in
15554 define:define:?*)
15555         ivtype="$quadtype"
15556         uvtype="$uquadtype"
15557         ivsize=8
15558         uvsize=8
15559         ;;
15560 *)      ivtype="long"
15561         uvtype="unsigned long"
15562         ivsize=$longsize
15563         uvsize=$longsize
15564         ;;
15565 esac
15566
15567 case "$uselongdouble:$d_longdbl" in
15568 define:define)
15569         nvtype="long double"
15570         nvsize=$longdblsize
15571         ;;
15572 *)      nvtype=double
15573         nvsize=$doublesize
15574         ;;
15575 esac
15576
15577 $echo "(IV will be "$ivtype", $ivsize bytes)"
15578 $echo "(UV will be "$uvtype", $uvsize bytes)"
15579 $echo "(NV will be "$nvtype", $nvsize bytes)"
15580
15581 $cat >try.c <<EOCP
15582 #$i_inttypes I_INTTYPES
15583 #ifdef I_INTTYPES
15584 #include <inttypes.h>
15585 #endif
15586 #include <stdio.h>
15587 int main() {
15588 #ifdef INT8
15589    int8_t i =  INT8_MAX;
15590   uint8_t u = UINT8_MAX;
15591   printf("int8_t\n");
15592 #endif
15593 #ifdef INT16
15594    int16_t i =  INT16_MAX;
15595   uint16_t i = UINT16_MAX;
15596   printf("int16_t\n");
15597 #endif
15598 #ifdef INT32
15599    int32_t i =  INT32_MAX;
15600   uint32_t u = UINT32_MAX;
15601   printf("int32_t\n");
15602 #endif
15603 }
15604 EOCP
15605
15606 i8type="signed char"
15607 u8type="unsigned char"
15608 i8size=1
15609 u8size=1
15610
15611 case "$i16type" in
15612 '')     case "$shortsize" in
15613         2)      i16type=short
15614                 u16type="unsigned short"
15615                 i16size=$shortsize
15616                 u16size=$shortsize
15617                 ;;
15618         esac
15619         ;;
15620 esac
15621 case "$i16type" in
15622 '')     set try -DINT16
15623         if eval $compile; then
15624                 case "`$run ./try`" in
15625                 int16_t)
15626                         i16type=int16_t
15627                         u16type=uint16_t
15628                         i16size=2
15629                         u16size=2
15630                         ;;
15631                 esac
15632         fi
15633         ;;
15634 esac
15635 case "$i16type" in
15636 '')     if $test $shortsize -ge 2; then
15637                 i16type=short
15638                 u16type="unsigned short"
15639                 i16size=$shortsize
15640                 u16size=$shortsize
15641         fi
15642         ;;
15643 esac
15644
15645 case "$i32type" in
15646 '')     case "$longsize" in
15647         4)      i32type=long
15648                 u32type="unsigned long"
15649                 i32size=$longsize
15650                 u32size=$longsize
15651                 ;;
15652         *)      case "$intsize" in
15653                 4)      i32type=int
15654                         u32type="unsigned int"
15655                         i32size=$intsize
15656                         u32size=$intsize
15657                         ;;
15658                 esac
15659                 ;;
15660         esac
15661         ;;
15662 esac
15663 case "$i32type" in
15664 '')     set try -DINT32
15665         if eval $compile; then
15666                 case "`$run ./try`" in
15667                 int32_t)
15668                         i32type=int32_t
15669                         u32type=uint32_t
15670                         i32size=4
15671                         u32size=4
15672                         ;;
15673                 esac
15674         fi
15675         ;;
15676 esac
15677 case "$i32type" in
15678 '')     if $test $intsize -ge 4; then
15679                 i32type=int
15680                 u32type="unsigned int"
15681                 i32size=$intsize
15682                 u32size=$intsize
15683         fi
15684         ;;
15685 esac
15686
15687 case "$i64type" in
15688 '')     case "$d_quad:$quadtype" in
15689         define:?*)
15690                 i64type="$quadtype"
15691                 u64type="$uquadtype"
15692                 i64size=8
15693                 u64size=8
15694                 ;;
15695         esac
15696         ;;
15697 esac
15698
15699 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15700 : volatile so that the compiler has to store it out to memory.
15701 if test X"$d_volatile" = X"$define"; then
15702         volatile=volatile
15703 fi
15704 $cat <<EOP >try.c
15705 #include <stdio.h>
15706 #$i_stdlib I_STDLIB
15707 #ifdef I_STDLIB
15708 #include <stdlib.h>
15709 #endif
15710 #include <sys/types.h>
15711 #include <signal.h>
15712 #ifdef SIGFPE
15713 $volatile int bletched = 0;
15714 $signal_t blech(int s) { bletched = 1; }
15715 #endif
15716 int main() {
15717     $uvtype u = 0;
15718     $nvtype d;
15719     int     n = 8 * $uvsize;
15720     int     i;
15721 #ifdef SIGFPE
15722     signal(SIGFPE, blech);
15723 #endif
15724
15725     for (i = 0; i < n; i++) {
15726       u = u << 1 | ($uvtype)1;
15727       d = ($nvtype)u;
15728       if (($uvtype)d != u)
15729         break;
15730       if (d <= 0)
15731         break;
15732       d = ($nvtype)(u - 1);
15733       if (($uvtype)d != (u - 1))
15734         break;
15735 #ifdef SIGFPE
15736       if (bletched)
15737         break;
15738 #endif
15739     }
15740     printf("%d\n", ((i == n) ? -n : i));
15741     exit(0);
15742 }
15743 EOP
15744 set try
15745
15746 d_nv_preserves_uv="$undef"
15747 if eval $compile; then
15748         nv_preserves_uv_bits="`$run ./try`"
15749 fi
15750 case "$nv_preserves_uv_bits" in
15751 \-[1-9]*)
15752         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15753         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15754         d_nv_preserves_uv="$define"
15755         ;;
15756 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15757         d_nv_preserves_uv="$undef" ;;
15758 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15759         nv_preserves_uv_bits="0" ;;
15760 esac
15761 $rm_try
15762
15763 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15764 : volatile so that the compiler has to store it out to memory.
15765 if test X"$d_volatile" = X"$define"; then
15766         volatile=volatile
15767 fi
15768 $cat <<EOP >try.c
15769 #include <stdio.h>
15770
15771 typedef $nvtype NV;
15772
15773 int
15774 main() {
15775   NV value = 2;
15776   int count = 1;
15777
15778   while(count < 256) {
15779     $volatile NV up = value + 1.0;
15780     $volatile NV negated = -value;
15781     $volatile NV down = negated - 1.0;
15782     $volatile NV got_up = up - value;
15783     int up_good = got_up == 1.0;
15784     int got_down = down - negated;
15785     int down_good = got_down == -1.0;
15786
15787     if (down_good != up_good) {
15788       fprintf(stderr,
15789               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15790               up_good, (double) got_up, down_good, (double) got_down,
15791               count, (double) value);
15792       return 1;
15793     }
15794     if (!up_good) {
15795       while (1) {
15796         if (count > 8) {
15797           count -= 8;
15798           fputs("256.0", stdout);
15799         } else {
15800           count--;
15801           fputs("2.0", stdout);
15802         }
15803         if (!count) {
15804           puts("");
15805           return 0;
15806         }
15807         fputs("*", stdout);
15808       }
15809     }
15810     value *= 2;
15811     ++count;
15812   }
15813   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15814           count, (double) value);
15815   return 1;
15816 }
15817 EOP
15818 set try
15819
15820 nv_overflows_integers_at='0'
15821 if eval $compile; then
15822     xxx="`$run ./try`"
15823     case "$?" in
15824         0)
15825             case "$xxx" in
15826                 2*)  cat >&4 <<EOM
15827 The largest integer your NVs can preserve is equal to $xxx
15828 EOM
15829                     nv_overflows_integers_at="$xxx"
15830                     ;;
15831                 *)  cat >&4 <<EOM
15832 Cannot determine the largest integer value your NVs can hold, unexpected output
15833 '$xxx'
15834 EOM
15835                     ;;
15836             esac
15837             ;;
15838         *)  cat >&4 <<EOM
15839 Cannot determine the largest integer value your NVs can hold
15840 EOM
15841             ;;
15842     esac
15843 fi
15844 $rm_try
15845
15846 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15847 : volatile so that the compiler has to store it out to memory.
15848 if test X"$d_volatile" = X"$define"; then
15849         volatile=volatile
15850 fi
15851 $cat <<EOP >try.c
15852 #include <stdio.h>
15853 #$i_stdlib I_STDLIB
15854 #ifdef I_STDLIB
15855 #include <stdlib.h>
15856 #endif
15857 #$i_string I_STRING
15858 #ifdef I_STRING
15859 #  include <string.h>
15860 #else
15861 #  include <strings.h>
15862 #endif
15863 #include <sys/types.h>
15864 #include <signal.h>
15865 #ifdef SIGFPE
15866 $volatile int bletched = 0;
15867 $signal_t blech(int s) { bletched = 1; }
15868 #endif
15869
15870 int checkit($nvtype d, char *where) {
15871     unsigned char *p = (char *)&d;
15872     unsigned char *end = p + sizeof(d);
15873     int fail = 0;
15874
15875     while (p < end)
15876         fail += *p++;
15877
15878     if (!fail)
15879         return 0;
15880
15881     p = (char *)&d;
15882     printf("No - %s: 0x", where);
15883     while (p < end)
15884         printf ("%02X", *p++);
15885     printf("\n");
15886     return 1;
15887 }
15888
15889 int main(int argc, char **argv) {
15890     $nvtype d = 0.0;
15891     int fail = 0;
15892     fail += checkit(d, "0.0");
15893
15894     /* The compiler shouldn't be assuming that bletched is 0  */
15895     d = bletched;
15896
15897     fail += checkit(d, "bleched");
15898
15899 #ifdef SIGFPE
15900     signal(SIGFPE, blech);
15901 #endif
15902
15903     /* Paranoia - the compiler should have no way of knowing that ANSI says
15904        that argv[argc] will always be NULL.  Actually, if it did assume this it
15905        would be buggy, as this is C and main() can be called from elsewhere in
15906        the program.  */
15907     d = argv[argc] ? 1 : 0;
15908
15909     if (d) {
15910         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15911     }
15912
15913     fail += checkit(d, "ternary");
15914
15915     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15916
15917     if (d != 0.0) {
15918         printf("No - memset doesn't give 0.0\n");
15919         /* This might just blow up:  */
15920         printf("(gives %g)\n", d);
15921         return 1;
15922     }
15923
15924 #ifdef SIGFPE
15925     if (bletched) {
15926         printf("No - something bleched\n");
15927         return 1;
15928     }
15929 #endif
15930     if (fail) {
15931       printf("No - %d fail(s)\n", fail);
15932       return 1;
15933     }
15934     printf("Yes\n");
15935     return 0;
15936 }
15937 EOP
15938 set try
15939
15940 d_nv_zero_is_allbits_zero="$undef"
15941 if eval $compile; then
15942     xxx="`$run ./try`"
15943     case "$?" in
15944         0)
15945             case "$xxx" in
15946                 Yes)  cat >&4 <<EOM
15947 0.0 is represented as all bits zero in memory
15948 EOM
15949                     d_nv_zero_is_allbits_zero="$define"
15950                     ;;
15951                 *)  cat >&4 <<EOM
15952 0.0 is not represented as all bits zero in memory
15953 EOM
15954                     d_nv_zero_is_allbits_zero="$undef"
15955                     ;;
15956             esac
15957             ;;
15958         *)  cat >&4 <<EOM
15959 0.0 is not represented as all bits zero in memory
15960 EOM
15961             d_nv_zero_is_allbits_zero="$undef"
15962             ;;
15963     esac
15964 fi
15965 $rm_try
15966
15967 : check for off64_t
15968 echo " "
15969 echo "Checking to see if you have off64_t..." >&4
15970 $cat >try.c <<EOCP
15971 #include <sys/types.h>
15972 #include <unistd.h>
15973 int main() { off64_t x = 7; }
15974 EOCP
15975 set try
15976 if eval $compile; then
15977         val="$define"
15978         echo "You have off64_t."
15979 else
15980         val="$undef"
15981         echo "You do not have off64_t."
15982         case "$lseeksize" in
15983         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15984         esac
15985 fi
15986 $rm_try
15987 set d_off64_t
15988 eval $setvar
15989
15990 : how to create joinable pthreads
15991 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15992         echo " "
15993         echo "Checking what constant to use for creating joinable pthreads..." >&4
15994         $cat >try.c <<'EOCP'
15995 #include <pthread.h>
15996 int main() {
15997     int detachstate = JOINABLE;
15998 }
15999 EOCP
16000         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16001         if eval $compile; then
16002                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16003                 val="$undef" # Yes, undef.
16004                 set d_old_pthread_create_joinable
16005                 eval $setvar
16006                 val=""
16007                 set old_pthread_create_joinable
16008                 eval $setvar
16009         else
16010                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16011                 if eval $compile; then
16012                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16013                         val="$define"
16014                         set d_old_pthread_create_joinable
16015                         eval $setvar
16016                         val=PTHREAD_CREATE_UNDETACHED
16017                         set old_pthread_create_joinable
16018                         eval $setvar
16019                 else
16020                         set try -DJOINABLE=__UNDETACHED
16021                         if eval $compile; then
16022                                 echo "You seem to use __UNDETACHED." >&4
16023                                 val="$define"
16024                                 set d_old_pthread_create_joinable
16025                                 eval $setvar
16026                                 val=__UNDETACHED
16027                                 set old_pthread_create_joinable
16028                                 eval $setvar
16029                         else
16030                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16031                                 val="$define"
16032                                 set d_old_pthread_create_joinable
16033                                 eval $setvar
16034                                 val=0
16035                                 set old_pthread_create_joinable
16036                                 eval $setvar
16037                         fi
16038                 fi
16039         fi
16040         $rm_try
16041 else
16042     d_old_pthread_create_joinable="$undef"
16043     old_pthread_create_joinable=""
16044 fi
16045
16046 : see if pause exists
16047 set pause d_pause
16048 eval $inlibc
16049
16050 : see if poll exists
16051 set poll d_poll
16052 eval $inlibc
16053
16054 : see if prctl exists
16055 set prctl d_prctl
16056 eval $inlibc
16057
16058 : see if prctl supports PR_SET_NAME
16059 d_prctl_set_name=$undef
16060 case $d_prctl in
16061     $define)
16062         $cat >try.c <<EOM
16063 #include <sys/prctl.h>
16064
16065 int main (int argc, char *argv[])
16066 {
16067     return (prctl (PR_SET_NAME, "Test"));
16068     } /* main */
16069 EOM
16070         set try
16071         if eval $compile_ok && $run ./try; then
16072             echo "Your prctl (PR_SET_NAME, ...) works"
16073             d_prctl_set_name=$define
16074             fi
16075         $rm_try
16076         ;;
16077     esac
16078
16079 : see if readlink exists
16080 set readlink d_readlink
16081 eval $inlibc
16082
16083 : Check if exe is symlink to abs path of executing program
16084 echo " "
16085 procselfexe=''
16086 val="$undef"
16087 case "$d_readlink" in
16088 "$define")
16089         if $issymlink /proc/self/exe ; then
16090                 $ls -l /proc/self/exe > reflect
16091                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16092                         echo "You have Linux-like /proc/self/exe."
16093                         procselfexe='"/proc/self/exe"'
16094                         val="$define"
16095                 fi
16096         fi
16097         if $issymlink /proc/curproc/file ; then
16098                 $ls -l /proc/curproc/file > reflect
16099                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16100                         echo "You have BSD-like /proc/curproc/file."
16101                         procselfexe='"/proc/curproc/file"'
16102                         val="$define"
16103                 fi
16104         fi
16105         ;;
16106 esac
16107 $rm -f reflect
16108 set d_procselfexe
16109 eval $setvar
16110
16111 : backward compatibility for d_hvfork
16112 if test X$d_hvfork != X; then
16113         d_vfork="$d_hvfork"
16114         d_hvfork=''
16115 fi
16116 : see if there is a vfork
16117 val=''
16118 set vfork val
16119 eval $inlibc
16120
16121 d_pseudofork=$undef
16122
16123 : Ok, but do we want to use it. vfork is reportedly unreliable in
16124 : perl on Solaris 2.x, and probably elsewhere.
16125 case "$val" in
16126 $define)
16127         echo " "
16128         case "$usevfork" in
16129         false) dflt='n';;
16130         *) dflt='y';;
16131         esac
16132         cat <<'EOM'
16133
16134 Perl can only use a vfork() that doesn't suffer from strict
16135 restrictions on calling functions or modifying global data in
16136 the child.  For example, glibc-2.1 contains such a vfork()
16137 that is unsuitable.  If your system provides a proper fork()
16138 call, chances are that you do NOT want perl to use vfork().
16139
16140 EOM
16141         rp="Do you still want to use vfork()?"
16142         . ./myread
16143         case "$ans" in
16144         y|Y) ;;
16145         *)
16146                 echo "Ok, we won't use vfork()."
16147                 val="$undef"
16148                 ;;
16149         esac
16150         ;;
16151 esac
16152 set d_vfork
16153 eval $setvar
16154 case "$d_vfork" in
16155 $define) usevfork='true';;
16156 *) usevfork='false';;
16157 esac
16158
16159 : see whether the pthread_atfork exists
16160 $cat >try.c <<EOP
16161 #include <pthread.h>
16162 #include <stdio.h>
16163 int main() {
16164 #ifdef  PTHREAD_ATFORK
16165         pthread_atfork(NULL,NULL,NULL);
16166 #endif
16167 }
16168 EOP
16169
16170 : see if pthread_atfork exists
16171 set try -DPTHREAD_ATFORK
16172 if eval $compile; then
16173     val="$define"
16174 else
16175     val="$undef"
16176 fi
16177 case "$usethreads" in
16178 $define)
16179         case "$val" in
16180         $define) echo 'pthread_atfork found.' >&4        ;;
16181         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16182         esac
16183 esac
16184 set d_pthread_atfork
16185 eval $setvar
16186
16187 : see if pthread_attr_setscope exists
16188 set pthread_attr_setscope d_pthread_attr_setscope
16189 eval $inlibc
16190
16191 : see whether the various POSIXish _yields exist
16192 $cat >try.c <<EOP
16193 #include <pthread.h>
16194 #include <stdio.h>
16195 int main() {
16196 #ifdef SCHED_YIELD
16197         sched_yield();
16198 #else
16199 #ifdef PTHREAD_YIELD
16200         pthread_yield();
16201 #else
16202 #ifdef PTHREAD_YIELD_NULL
16203         pthread_yield(NULL);
16204 #endif
16205 #endif
16206 #endif
16207 }
16208 EOP
16209 : see if sched_yield exists
16210 set try -DSCHED_YIELD
16211 if eval $compile; then
16212     val="$define"
16213     sched_yield='sched_yield()'
16214 else
16215     val="$undef"
16216 fi
16217 case "$usethreads" in
16218 $define)
16219         case "$val" in
16220         $define) echo 'sched_yield() found.' >&4        ;;
16221         *)       echo 'sched_yield() NOT found.' >&4    ;;
16222         esac
16223 esac
16224 set d_sched_yield
16225 eval $setvar
16226
16227 : see if pthread_yield exists
16228 set try -DPTHREAD_YIELD
16229 if eval $compile; then
16230     val="$define"
16231     case "$sched_yield" in
16232     '') sched_yield='pthread_yield()' ;;
16233     esac
16234 else
16235     set try -DPTHREAD_YIELD_NULL
16236     if eval $compile; then
16237         val="$define"
16238         case "$sched_yield" in
16239         '') sched_yield='pthread_yield(NULL)' ;;
16240         esac
16241     else
16242         val="$undef"
16243     fi
16244 fi
16245 case "$usethreads" in
16246 $define)
16247         case "$val" in
16248         $define) echo 'pthread_yield() found.' >&4      ;;
16249         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16250         esac
16251         ;;
16252 esac
16253 set d_pthread_yield
16254 eval $setvar
16255 case "$sched_yield" in
16256 '') sched_yield=undef ;;
16257 esac
16258 $rm_try
16259
16260 : see if random_r exists
16261 set random_r d_random_r
16262 eval $inlibc
16263 case "$d_random_r" in
16264 "$define")
16265         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16266         case "$d_random_r_proto:$usethreads" in
16267         ":define")      d_random_r_proto=define
16268                 set d_random_r_proto random_r $hdrs
16269                 eval $hasproto ;;
16270         *)      ;;
16271         esac
16272         case "$d_random_r_proto" in
16273         define)
16274         case "$random_r_proto" in
16275         ''|0) try='int random_r(int*, struct random_data*);'
16276         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16277         esac
16278         case "$random_r_proto" in
16279         ''|0) try='int random_r(long*, struct random_data*);'
16280         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16281         esac
16282         case "$random_r_proto" in
16283         ''|0) try='int random_r(struct random_data*, int32_t*);'
16284         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16285         esac
16286         case "$random_r_proto" in
16287         ''|0)   d_random_r=undef
16288                 random_r_proto=0
16289                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16290         * )     case "$random_r_proto" in
16291                 REENTRANT_PROTO*) ;;
16292                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16293                 esac
16294                 echo "Prototype: $try" ;;
16295         esac
16296         ;;
16297         *)      case "$usethreads" in
16298                 define) echo "random_r has no prototype, not using it." >&4 ;;
16299                 esac
16300                 d_random_r=undef
16301                 random_r_proto=0
16302                 ;;
16303         esac
16304         ;;
16305 *)      random_r_proto=0
16306         ;;
16307 esac
16308
16309 : see if readdir and friends exist
16310 set readdir d_readdir
16311 eval $inlibc
16312 set seekdir d_seekdir
16313 eval $inlibc
16314 set telldir d_telldir
16315 eval $inlibc
16316 set rewinddir d_rewinddir
16317 eval $inlibc
16318
16319 : see if readdir64_r exists
16320 set readdir64_r d_readdir64_r
16321 eval $inlibc
16322 case "$d_readdir64_r" in
16323 "$define")
16324         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16325         case "$d_readdir64_r_proto:$usethreads" in
16326         ":define")      d_readdir64_r_proto=define
16327                 set d_readdir64_r_proto readdir64_r $hdrs
16328                 eval $hasproto ;;
16329         *)      ;;
16330         esac
16331         case "$d_readdir64_r_proto" in
16332         define)
16333         case "$readdir64_r_proto" in
16334         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16335         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16336         esac
16337         case "$readdir64_r_proto" in
16338         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16339         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16340         esac
16341         case "$readdir64_r_proto" in
16342         ''|0)   d_readdir64_r=undef
16343                 readdir64_r_proto=0
16344                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16345         * )     case "$readdir64_r_proto" in
16346                 REENTRANT_PROTO*) ;;
16347                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16348                 esac
16349                 echo "Prototype: $try" ;;
16350         esac
16351         ;;
16352         *)      case "$usethreads" in
16353                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16354                 esac
16355                 d_readdir64_r=undef
16356                 readdir64_r_proto=0
16357                 ;;
16358         esac
16359         ;;
16360 *)      readdir64_r_proto=0
16361         ;;
16362 esac
16363
16364 : see if readdir_r exists
16365 set readdir_r d_readdir_r
16366 eval $inlibc
16367 case "$d_readdir_r" in
16368 "$define")
16369         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16370         case "$d_readdir_r_proto:$usethreads" in
16371         ":define")      d_readdir_r_proto=define
16372                 set d_readdir_r_proto readdir_r $hdrs
16373                 eval $hasproto ;;
16374         *)      ;;
16375         esac
16376         case "$d_readdir_r_proto" in
16377         define)
16378         case "$readdir_r_proto" in
16379         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16380         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16381         esac
16382         case "$readdir_r_proto" in
16383         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16384         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16385         esac
16386         case "$readdir_r_proto" in
16387         ''|0)   d_readdir_r=undef
16388                 readdir_r_proto=0
16389                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16390         * )     case "$readdir_r_proto" in
16391                 REENTRANT_PROTO*) ;;
16392                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16393                 esac
16394                 echo "Prototype: $try" ;;
16395         esac
16396         ;;
16397         *)      case "$usethreads" in
16398                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16399                 esac
16400                 d_readdir_r=undef
16401                 readdir_r_proto=0
16402                 ;;
16403         esac
16404         ;;
16405 *)      readdir_r_proto=0
16406         ;;
16407 esac
16408
16409 : see if readv exists
16410 set readv d_readv
16411 eval $inlibc
16412
16413 : see if recvmsg exists
16414 set recvmsg d_recvmsg
16415 eval $inlibc
16416
16417 : see if rename exists
16418 set rename d_rename
16419 eval $inlibc
16420
16421 : see if rmdir exists
16422 set rmdir d_rmdir
16423 eval $inlibc
16424
16425 : see if memory.h is available.
16426 val=''
16427 set memory.h val
16428 eval $inhdr
16429
16430 : See if it conflicts with string.h
16431 case "$val" in
16432 $define)
16433         case "$strings" in
16434         '') ;;
16435         *)
16436                 $cppstdin $cppflags $cppminus < $strings > mem.h
16437                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16438                         echo " "
16439                         echo "We won't be including <memory.h>."
16440                         val="$undef"
16441                 fi
16442                 $rm -f mem.h
16443                 ;;
16444         esac
16445 esac
16446 set i_memory
16447 eval $setvar
16448
16449 : can bcopy handle overlapping blocks?
16450 echo " "
16451 val="$undef"
16452 case "$d_memmove" in
16453 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16454 *)      case "$d_bcopy" in
16455         "$define")
16456                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16457                 $cat >try.c <<EOCP
16458 #$i_memory I_MEMORY
16459 #$i_stdlib I_STDLIB
16460 #$i_string I_STRING
16461 #$i_unistd I_UNISTD
16462 EOCP
16463         $cat >>try.c <<'EOCP'
16464 #include <stdio.h>
16465 #ifdef I_MEMORY
16466 #  include <memory.h>
16467 #endif
16468 #ifdef I_STDLIB
16469 #  include <stdlib.h>
16470 #endif
16471 #ifdef I_STRING
16472 #  include <string.h>
16473 #else
16474 #  include <strings.h>
16475 #endif
16476 #ifdef I_UNISTD
16477 #  include <unistd.h>  /* Needed for NetBSD */
16478 #endif
16479 int main()
16480 {
16481 char buf[128], abc[128];
16482 char *b;
16483 int len;
16484 int off;
16485 int align;
16486
16487 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16488    try to store the string in read-only memory. */
16489 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16490
16491 for (align = 7; align >= 0; align--) {
16492         for (len = 36; len; len--) {
16493                 b = buf+align;
16494                 bcopy(abc, b, len);
16495                 for (off = 1; off <= len; off++) {
16496                         bcopy(b, b+off, len);
16497                         bcopy(b+off, b, len);
16498                         if (bcmp(b, abc, len))
16499                                 exit(1);
16500                 }
16501         }
16502 }
16503 exit(0);
16504 }
16505 EOCP
16506                 set try
16507                 if eval $compile_ok; then
16508                         if $run ./try 2>/dev/null; then
16509                                 echo "Yes, it can."
16510                                 val="$define"
16511                         else
16512                                 echo "It can't, sorry."
16513                         fi
16514                 else
16515                         echo "(I can't compile the test program, so we'll assume not...)"
16516                 fi
16517                 ;;
16518         esac
16519         $rm_try
16520         ;;
16521 esac
16522 set d_safebcpy
16523 eval $setvar
16524
16525 : can memcpy handle overlapping blocks?
16526 echo " "
16527 val="$undef"
16528 case "$d_memmove" in
16529 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16530 *)      case "$d_memcpy" in
16531         "$define")
16532                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16533                 $cat >try.c <<EOCP
16534 #$i_memory I_MEMORY
16535 #$i_stdlib I_STDLIB
16536 #$i_string I_STRING
16537 #$i_unistd I_UNISTD
16538 EOCP
16539         $cat >>try.c <<'EOCP'
16540 #include <stdio.h>
16541 #ifdef I_MEMORY
16542 #  include <memory.h>
16543 #endif
16544 #ifdef I_STDLIB
16545 #  include <stdlib.h>
16546 #endif
16547 #ifdef I_STRING
16548 #  include <string.h>
16549 #else
16550 #  include <strings.h>
16551 #endif
16552 #ifdef I_UNISTD
16553 #  include <unistd.h>  /* Needed for NetBSD */
16554 #endif
16555 int main()
16556 {
16557 char buf[128], abc[128];
16558 char *b;
16559 int len;
16560 int off;
16561 int align;
16562
16563 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16564    try to store the string in read-only memory. */
16565 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16566
16567 for (align = 7; align >= 0; align--) {
16568         for (len = 36; len; len--) {
16569                 b = buf+align;
16570                 memcpy(b, abc, len);
16571                 for (off = 1; off <= len; off++) {
16572                         memcpy(b+off, b, len);
16573                         memcpy(b, b+off, len);
16574                         if (memcmp(b, abc, len))
16575                                 exit(1);
16576                 }
16577         }
16578 }
16579 exit(0);
16580 }
16581 EOCP
16582                 set try
16583                 if eval $compile_ok; then
16584                         if $run ./try 2>/dev/null; then
16585                                 echo "Yes, it can."
16586                                 val="$define"
16587                         else
16588                                 echo "It can't, sorry."
16589                         fi
16590                 else
16591                         echo "(I can't compile the test program, so we'll assume not...)"
16592                 fi
16593                 ;;
16594         esac
16595         $rm_try
16596         ;;
16597 esac
16598 set d_safemcpy
16599 eval $setvar
16600
16601 : can memcmp be trusted to compare relative magnitude?
16602 val="$undef"
16603 case "$d_memcmp" in
16604 "$define")
16605         echo " "
16606         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16607         $cat >try.c <<EOCP
16608 #$i_memory I_MEMORY
16609 #$i_stdlib I_STDLIB
16610 #$i_string I_STRING
16611 #$i_unistd I_UNISTD
16612 EOCP
16613         $cat >>try.c <<'EOCP'
16614 #include <stdio.h>
16615 #ifdef I_MEMORY
16616 #  include <memory.h>
16617 #endif
16618 #ifdef I_STDLIB
16619 #  include <stdlib.h>
16620 #endif
16621 #ifdef I_STRING
16622 #  include <string.h>
16623 #else
16624 #  include <strings.h>
16625 #endif
16626 #ifdef I_UNISTD
16627 #  include <unistd.h>  /* Needed for NetBSD */
16628 #endif
16629 int main()
16630 {
16631 char a = -1;
16632 char b = 0;
16633 if ((a < b) && memcmp(&a, &b, 1) < 0)
16634         exit(1);
16635 exit(0);
16636 }
16637 EOCP
16638         set try
16639         if eval $compile_ok; then
16640                 if $run ./try 2>/dev/null; then
16641                         echo "Yes, it can."
16642                         val="$define"
16643                 else
16644                         echo "No, it can't (it uses signed chars)."
16645                 fi
16646         else
16647                 echo "(I can't compile the test program, so we'll assume not...)"
16648         fi
16649         ;;
16650 esac
16651 $rm_try
16652 set d_sanemcmp
16653 eval $setvar
16654
16655 : see if prototype for sbrk is available
16656 echo " "
16657 set d_sbrkproto sbrk $i_unistd unistd.h
16658 eval $hasproto
16659
16660 : see if select exists
16661 set select d_select
16662 eval $inlibc
16663
16664 : see if semctl exists
16665 set semctl d_semctl
16666 eval $inlibc
16667
16668 : see if semget exists
16669 set semget d_semget
16670 eval $inlibc
16671
16672 : see if semop exists
16673 set semop d_semop
16674 eval $inlibc
16675
16676 : see how much of the 'sem*(2)' library is present.
16677 h_sem=true
16678 echo " "
16679 case "$d_semctl$d_semget$d_semop" in
16680 *"$undef"*) h_sem=false;;
16681 esac
16682 case "$osname" in
16683 freebsd)
16684     case "`ipcs 2>&1`" in
16685     "SVID messages"*"not configured"*)
16686         echo "Your $osname does not have the sem*(2) configured." >&4
16687         h_sem=false
16688         val="$undef"
16689         set semctl d_semctl
16690         eval $setvar
16691         set semget d_semget
16692         eval $setvar
16693         set semop d_semop
16694         eval $setvar
16695         ;;
16696     esac
16697     ;;
16698 esac
16699 : we could also check for sys/ipc.h ...
16700 if $h_sem && $test `./findhdr sys/sem.h`; then
16701         echo "You have the full sem*(2) library." >&4
16702         val="$define"
16703 else
16704         echo "You don't have the full sem*(2) library." >&4
16705         val="$undef"
16706 fi
16707 set d_sem
16708 eval $setvar
16709
16710 : see whether sys/sem.h defines union semun
16711 echo " "
16712 $cat > try.c <<'END'
16713 #include <sys/types.h>
16714 #include <sys/ipc.h>
16715 #include <sys/sem.h>
16716 int main () { union semun semun; semun.buf = 0; }
16717 END
16718 set try
16719 if eval $compile; then
16720     echo "You have union semun in <sys/sem.h>." >&4
16721     val="$define"
16722 else
16723     echo "You do not have union semun in <sys/sem.h>." >&4
16724     val="$undef"
16725 fi
16726 $rm_try
16727 set d_union_semun
16728 eval $setvar
16729
16730 : see how to do semctl IPC_STAT
16731 case "$d_sem" in
16732 $define)
16733     echo " "
16734     $cat > tryh.h <<END
16735 #ifndef S_IRUSR
16736 #   ifdef S_IREAD
16737 #       define S_IRUSR S_IREAD
16738 #       define S_IWUSR S_IWRITE
16739 #       define S_IXUSR S_IEXEC
16740 #   else
16741 #       define S_IRUSR 0400
16742 #       define S_IWUSR 0200
16743 #       define S_IXUSR 0100
16744 #   endif
16745 #   define S_IRGRP (S_IRUSR>>3)
16746 #   define S_IWGRP (S_IWUSR>>3)
16747 #   define S_IXGRP (S_IXUSR>>3)
16748 #   define S_IROTH (S_IRUSR>>6)
16749 #   define S_IWOTH (S_IWUSR>>6)
16750 #   define S_IXOTH (S_IXUSR>>6)
16751 #endif
16752 #ifndef S_IRWXU
16753 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16754 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16755 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16756 #endif
16757 END
16758     : see whether semctl IPC_STAT can use union semun
16759     case "$d_semctl_semun" in
16760     '')
16761       val="$undef"
16762       $cat > try.c <<END
16763 #include <sys/types.h>
16764 #include <sys/ipc.h>
16765 #include <sys/sem.h>
16766 #include <sys/stat.h>
16767 #include <stdio.h>
16768 #include <errno.h>
16769 #include "tryh.h"
16770 #ifndef errno
16771 extern int errno;
16772 #endif
16773 #$d_union_semun HAS_UNION_SEMUN
16774 int main() {
16775     union semun
16776 #ifndef HAS_UNION_SEMUN
16777     {
16778         int val;
16779         struct semid_ds *buf;
16780         unsigned short *array;
16781     }
16782 #endif
16783     arg;
16784     int sem, st;
16785
16786 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16787     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16788     if (sem > -1) {
16789         struct semid_ds argbuf;
16790         arg.buf = &argbuf;
16791 #       ifdef IPC_STAT
16792         st = semctl(sem, 0, IPC_STAT, arg);
16793         if (st == 0)
16794             printf("semun\n");
16795         else
16796 #       endif /* IPC_STAT */
16797             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16798 #       ifdef IPC_RMID
16799         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16800 #       endif /* IPC_RMID */
16801             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16802     } else
16803 #endif /* IPC_PRIVATE && ... */
16804         printf("semget failed: errno = %d\n", errno);
16805   return 0;
16806 }
16807 END
16808       set try
16809       if eval $compile; then
16810           xxx=`$run ./try`
16811           case "$xxx" in
16812           semun) val="$define" ;;
16813           esac
16814       fi
16815       $rm_try
16816       set d_semctl_semun
16817       eval $setvar
16818       ;;
16819     esac
16820     case "$d_semctl_semun" in
16821     $define)
16822         echo "You can use union semun for semctl IPC_STAT." >&4
16823         also='also'
16824         ;;
16825     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16826         also=''
16827         ;;
16828     esac
16829
16830     : see whether semctl IPC_STAT can use struct semid_ds pointer
16831     case "$d_semctl_semid_ds" in
16832     '')
16833       val="$undef"
16834       $cat > try.c <<'END'
16835 #include <sys/types.h>
16836 #include <sys/ipc.h>
16837 #include <sys/sem.h>
16838 #include <sys/stat.h>
16839 #include "tryh.h"
16840 #include <stdio.h>
16841 #include <errno.h>
16842 #ifndef errno
16843 extern int errno;
16844 #endif
16845 int main() {
16846     struct semid_ds arg;
16847     int sem, st;
16848
16849 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16850     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16851     if (sem > -1) {
16852 #       ifdef IPC_STAT
16853         st = semctl(sem, 0, IPC_STAT, &arg);
16854         if (st == 0)
16855             printf("semid_ds\n");
16856         else
16857 #       endif /* IPC_STAT */
16858             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16859 #       ifdef IPC_RMID
16860         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16861 #       endif /* IPC_RMID */
16862             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16863     } else
16864 #endif /* IPC_PRIVATE && ... */
16865         printf("semget failed: errno = %d\n", errno);
16866
16867     return 0;
16868 }
16869 END
16870       set try
16871       if eval $compile; then
16872           xxx=`$run ./try`
16873           case "$xxx" in
16874           semid_ds) val="$define" ;;
16875           esac
16876       fi
16877       $rm_try
16878       set d_semctl_semid_ds
16879       eval $setvar
16880       ;;
16881     esac
16882     case "$d_semctl_semid_ds" in
16883     $define)
16884         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16885         ;;
16886     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16887         ;;
16888     esac
16889     ;;
16890 *)  val="$undef"
16891
16892     # We do not have the full sem*(2) library, so assume we can not
16893     # use either.
16894
16895     set d_semctl_semun
16896     eval $setvar
16897
16898     set d_semctl_semid_ds
16899     eval $setvar
16900     ;;
16901 esac
16902 $rm_try tryh.h
16903
16904 : see if sendmsg exists
16905 set sendmsg d_sendmsg
16906 eval $inlibc
16907
16908 : see if setegid exists
16909 set setegid d_setegid
16910 eval $inlibc
16911
16912 : see if seteuid exists
16913 set seteuid d_seteuid
16914 eval $inlibc
16915
16916 : see if setgrent exists
16917 set setgrent d_setgrent
16918 eval $inlibc
16919
16920 : see if setgrent_r exists
16921 set setgrent_r d_setgrent_r
16922 eval $inlibc
16923 case "$d_setgrent_r" in
16924 "$define")
16925         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16926         case "$d_setgrent_r_proto:$usethreads" in
16927         ":define")      d_setgrent_r_proto=define
16928                 set d_setgrent_r_proto setgrent_r $hdrs
16929                 eval $hasproto ;;
16930         *)      ;;
16931         esac
16932         case "$d_setgrent_r_proto" in
16933         define)
16934         case "$setgrent_r_proto" in
16935         ''|0) try='int setgrent_r(FILE**);'
16936         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16937         esac
16938         case "$setgrent_r_proto" in
16939         ''|0) try='void setgrent_r(FILE**);'
16940         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16941         esac
16942         case "$setgrent_r_proto" in
16943         ''|0)   d_setgrent_r=undef
16944                 setgrent_r_proto=0
16945                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16946         * )     case "$setgrent_r_proto" in
16947                 REENTRANT_PROTO*) ;;
16948                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16949                 esac
16950                 echo "Prototype: $try" ;;
16951         esac
16952         ;;
16953         *)      case "$usethreads" in
16954                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16955                 esac
16956                 d_setgrent_r=undef
16957                 setgrent_r_proto=0
16958                 ;;
16959         esac
16960         ;;
16961 *)      setgrent_r_proto=0
16962         ;;
16963 esac
16964
16965 : see if sethostent exists
16966 set sethostent d_sethent
16967 eval $inlibc
16968
16969 : see if sethostent_r exists
16970 set sethostent_r d_sethostent_r
16971 eval $inlibc
16972 case "$d_sethostent_r" in
16973 "$define")
16974         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16975         case "$d_sethostent_r_proto:$usethreads" in
16976         ":define")      d_sethostent_r_proto=define
16977                 set d_sethostent_r_proto sethostent_r $hdrs
16978                 eval $hasproto ;;
16979         *)      ;;
16980         esac
16981         case "$d_sethostent_r_proto" in
16982         define)
16983         case "$sethostent_r_proto" in
16984         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16985         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16986         esac
16987         case "$sethostent_r_proto" in
16988         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16989         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16990         esac
16991         case "$sethostent_r_proto" in
16992         ''|0)   d_sethostent_r=undef
16993                 sethostent_r_proto=0
16994                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16995         * )     case "$sethostent_r_proto" in
16996                 REENTRANT_PROTO*) ;;
16997                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16998                 esac
16999                 echo "Prototype: $try" ;;
17000         esac
17001         ;;
17002         *)      case "$usethreads" in
17003                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17004                 esac
17005                 d_sethostent_r=undef
17006                 sethostent_r_proto=0
17007                 ;;
17008         esac
17009         ;;
17010 *)      sethostent_r_proto=0
17011         ;;
17012 esac
17013
17014 : see if setitimer exists
17015 set setitimer d_setitimer
17016 eval $inlibc
17017
17018 : see if setlinebuf exists
17019 set setlinebuf d_setlinebuf
17020 eval $inlibc
17021
17022 : see if setlocale exists
17023 set setlocale d_setlocale
17024 eval $inlibc
17025
17026 : see if locale.h is available
17027 set locale.h i_locale
17028 eval $inhdr
17029
17030 : see if setlocale_r exists
17031 set setlocale_r d_setlocale_r
17032 eval $inlibc
17033 case "$d_setlocale_r" in
17034 "$define")
17035         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17036         case "$d_setlocale_r_proto:$usethreads" in
17037         ":define")      d_setlocale_r_proto=define
17038                 set d_setlocale_r_proto setlocale_r $hdrs
17039                 eval $hasproto ;;
17040         *)      ;;
17041         esac
17042         case "$d_setlocale_r_proto" in
17043         define)
17044         case "$setlocale_r_proto" in
17045         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17046         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17047         esac
17048         case "$setlocale_r_proto" in
17049         ''|0)   d_setlocale_r=undef
17050                 setlocale_r_proto=0
17051                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17052         * )     case "$setlocale_r_proto" in
17053                 REENTRANT_PROTO*) ;;
17054                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17055                 esac
17056                 echo "Prototype: $try" ;;
17057         esac
17058         ;;
17059         *)      case "$usethreads" in
17060                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17061                 esac
17062                 d_setlocale_r=undef
17063                 setlocale_r_proto=0
17064                 ;;
17065         esac
17066         ;;
17067 *)      setlocale_r_proto=0
17068         ;;
17069 esac
17070
17071 : see if setnetent exists
17072 set setnetent d_setnent
17073 eval $inlibc
17074
17075 : see if setnetent_r exists
17076 set setnetent_r d_setnetent_r
17077 eval $inlibc
17078 case "$d_setnetent_r" in
17079 "$define")
17080         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17081         case "$d_setnetent_r_proto:$usethreads" in
17082         ":define")      d_setnetent_r_proto=define
17083                 set d_setnetent_r_proto setnetent_r $hdrs
17084                 eval $hasproto ;;
17085         *)      ;;
17086         esac
17087         case "$d_setnetent_r_proto" in
17088         define)
17089         case "$setnetent_r_proto" in
17090         ''|0) try='int setnetent_r(int, struct netent_data*);'
17091         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17092         esac
17093         case "$setnetent_r_proto" in
17094         ''|0) try='void setnetent_r(int, struct netent_data*);'
17095         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17096         esac
17097         case "$setnetent_r_proto" in
17098         ''|0)   d_setnetent_r=undef
17099                 setnetent_r_proto=0
17100                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17101         * )     case "$setnetent_r_proto" in
17102                 REENTRANT_PROTO*) ;;
17103                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17104                 esac
17105                 echo "Prototype: $try" ;;
17106         esac
17107         ;;
17108         *)      case "$usethreads" in
17109                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17110                 esac
17111                 d_setnetent_r=undef
17112                 setnetent_r_proto=0
17113                 ;;
17114         esac
17115         ;;
17116 *)      setnetent_r_proto=0
17117         ;;
17118 esac
17119
17120 : see if setprotoent exists
17121 set setprotoent d_setpent
17122 eval $inlibc
17123
17124 : see if setpgid exists
17125 set setpgid d_setpgid
17126 eval $inlibc
17127
17128 : see if setpgrp2 exists
17129 set setpgrp2 d_setpgrp2
17130 eval $inlibc
17131
17132 : see if setpriority exists
17133 set setpriority d_setprior
17134 eval $inlibc
17135
17136 : see if setproctitle exists
17137 set setproctitle d_setproctitle
17138 eval $inlibc
17139
17140 : see if setprotoent_r exists
17141 set setprotoent_r d_setprotoent_r
17142 eval $inlibc
17143 case "$d_setprotoent_r" in
17144 "$define")
17145         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17146         case "$d_setprotoent_r_proto:$usethreads" in
17147         ":define")      d_setprotoent_r_proto=define
17148                 set d_setprotoent_r_proto setprotoent_r $hdrs
17149                 eval $hasproto ;;
17150         *)      ;;
17151         esac
17152         case "$d_setprotoent_r_proto" in
17153         define)
17154         case "$setprotoent_r_proto" in
17155         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17156         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17157         esac
17158         case "$setprotoent_r_proto" in
17159         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17160         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17161         esac
17162         case "$setprotoent_r_proto" in
17163         ''|0)   d_setprotoent_r=undef
17164                 setprotoent_r_proto=0
17165                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17166         * )     case "$setprotoent_r_proto" in
17167                 REENTRANT_PROTO*) ;;
17168                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17169                 esac
17170                 echo "Prototype: $try" ;;
17171         esac
17172         ;;
17173         *)      case "$usethreads" in
17174                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17175                 esac
17176                 d_setprotoent_r=undef
17177                 setprotoent_r_proto=0
17178                 ;;
17179         esac
17180         ;;
17181 *)      setprotoent_r_proto=0
17182         ;;
17183 esac
17184
17185 : see if setpwent exists
17186 set setpwent d_setpwent
17187 eval $inlibc
17188
17189 : see if setpwent_r exists
17190 set setpwent_r d_setpwent_r
17191 eval $inlibc
17192 case "$d_setpwent_r" in
17193 "$define")
17194         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17195         case "$d_setpwent_r_proto:$usethreads" in
17196         ":define")      d_setpwent_r_proto=define
17197                 set d_setpwent_r_proto setpwent_r $hdrs
17198                 eval $hasproto ;;
17199         *)      ;;
17200         esac
17201         case "$d_setpwent_r_proto" in
17202         define)
17203         case "$setpwent_r_proto" in
17204         ''|0) try='int setpwent_r(FILE**);'
17205         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17206         esac
17207         case "$setpwent_r_proto" in
17208         ''|0) try='void setpwent_r(FILE**);'
17209         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17210         esac
17211         case "$setpwent_r_proto" in
17212         ''|0)   d_setpwent_r=undef
17213                 setpwent_r_proto=0
17214                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17215         * )     case "$setpwent_r_proto" in
17216                 REENTRANT_PROTO*) ;;
17217                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17218                 esac
17219                 echo "Prototype: $try" ;;
17220         esac
17221         ;;
17222         *)      case "$usethreads" in
17223                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17224                 esac
17225                 d_setpwent_r=undef
17226                 setpwent_r_proto=0
17227                 ;;
17228         esac
17229         ;;
17230 *)      setpwent_r_proto=0
17231         ;;
17232 esac
17233
17234 : see if setregid exists
17235 set setregid d_setregid
17236 eval $inlibc
17237 set setresgid d_setresgid
17238 eval $inlibc
17239
17240 : see if setreuid exists
17241 set setreuid d_setreuid
17242 eval $inlibc
17243 set setresuid d_setresuid
17244 eval $inlibc
17245
17246 : see if setrgid exists
17247 set setrgid d_setrgid
17248 eval $inlibc
17249
17250 : see if setruid exists
17251 set setruid d_setruid
17252 eval $inlibc
17253
17254 : see if setservent exists
17255 set setservent d_setsent
17256 eval $inlibc
17257
17258 : see if setservent_r exists
17259 set setservent_r d_setservent_r
17260 eval $inlibc
17261 case "$d_setservent_r" in
17262 "$define")
17263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17264         case "$d_setservent_r_proto:$usethreads" in
17265         ":define")      d_setservent_r_proto=define
17266                 set d_setservent_r_proto setservent_r $hdrs
17267                 eval $hasproto ;;
17268         *)      ;;
17269         esac
17270         case "$d_setservent_r_proto" in
17271         define)
17272         case "$setservent_r_proto" in
17273         ''|0) try='int setservent_r(int, struct servent_data*);'
17274         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17275         esac
17276         case "$setservent_r_proto" in
17277         ''|0) try='void setservent_r(int, struct servent_data*);'
17278         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17279         esac
17280         case "$setservent_r_proto" in
17281         ''|0)   d_setservent_r=undef
17282                 setservent_r_proto=0
17283                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17284         * )     case "$setservent_r_proto" in
17285                 REENTRANT_PROTO*) ;;
17286                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17287                 esac
17288                 echo "Prototype: $try" ;;
17289         esac
17290         ;;
17291         *)      case "$usethreads" in
17292                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17293                 esac
17294                 d_setservent_r=undef
17295                 setservent_r_proto=0
17296                 ;;
17297         esac
17298         ;;
17299 *)      setservent_r_proto=0
17300         ;;
17301 esac
17302
17303 : see if setsid exists
17304 set setsid d_setsid
17305 eval $inlibc
17306
17307 : see if setvbuf exists
17308 set setvbuf d_setvbuf
17309 eval $inlibc
17310
17311 : see if sfio.h is available
17312 set sfio.h i_sfio
17313 eval $inhdr
17314
17315 : see if sfio library is available
17316 case "$i_sfio" in
17317 $define)
17318         val=''
17319         set sfreserve val
17320         eval $inlibc
17321         ;;
17322 *)
17323         val="$undef"
17324         ;;
17325 esac
17326 : Ok, but do we want to use it.
17327 case "$val" in
17328 $define)
17329         case "$usesfio" in
17330         true|$define|[yY]*) dflt='y';;
17331         *) dflt='n';;
17332         esac
17333         echo "$package can use the sfio library, but it is experimental."
17334         case "$useperlio" in
17335         "$undef")
17336             echo "For sfio also the PerlIO abstraction layer is needed."
17337             echo "Earlier you said you wouldn't want that."
17338             ;;
17339         esac
17340         rp="You seem to have sfio available, do you want to try using it?"
17341         . ./myread
17342         case "$ans" in
17343         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17344                 useperlio="$define"
17345                 val="$define"
17346                 ;;
17347         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17348                 val="$undef"
17349                 ;;
17350         esac
17351         ;;
17352 *)      case "$usesfio" in
17353         true|$define|[yY]*)
17354                 echo "Sorry, cannot find sfio on this machine." >&4
17355                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17356                 val="$undef"
17357                 ;;
17358         esac
17359         ;;
17360 esac
17361 set d_sfio
17362 eval $setvar
17363 case "$d_sfio" in
17364 $define) usesfio='true';;
17365 *) usesfio='false';;
17366 esac
17367 case "$d_sfio" in
17368 $define) ;;
17369 *)      : Remove sfio from list of libraries to use
17370         case "$libs" in
17371         *-lsfio*)
17372                 echo "Removing unneeded -lsfio from library list" >&4
17373                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17374                 shift
17375                 libs="$*"
17376                 echo "libs = $libs" >&4
17377                 ;;
17378         esac
17379 ;;
17380 esac
17381
17382
17383 : see if shmctl exists
17384 set shmctl d_shmctl
17385 eval $inlibc
17386
17387 : see if shmget exists
17388 set shmget d_shmget
17389 eval $inlibc
17390
17391 : see if shmat exists
17392 set shmat d_shmat
17393 eval $inlibc
17394 : see what shmat returns
17395 case "$d_shmat" in
17396 "$define")
17397         $cat >shmat.c <<'END'
17398 #include <sys/shm.h>
17399 void *shmat();
17400 END
17401         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17402                 shmattype='void *'
17403         else
17404                 shmattype='char *'
17405         fi
17406         echo "and it returns ($shmattype)." >&4
17407         : see if a prototype for shmat is available
17408         xxx=`./findhdr sys/shm.h`
17409         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17410         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17411                 val="$define"
17412         else
17413                 val="$undef"
17414         fi
17415         $rm -f shmat.[co]
17416         ;;
17417 *)
17418         val="$undef"
17419         ;;
17420 esac
17421 set d_shmatprototype
17422 eval $setvar
17423
17424 : see if shmdt exists
17425 set shmdt d_shmdt
17426 eval $inlibc
17427
17428 : see how much of the 'shm*(2)' library is present.
17429 h_shm=true
17430 echo " "
17431 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17432 *"$undef"*) h_shm=false;;
17433 esac
17434 case "$osname" in
17435 freebsd)
17436     case "`ipcs 2>&1`" in
17437     "SVID shared memory"*"not configured"*)
17438         echo "Your $osname does not have the shm*(2) configured." >&4
17439         h_shm=false
17440         val="$undef"
17441         set shmctl d_shmctl
17442         evat $setvar
17443         set shmget d_shmget
17444         evat $setvar
17445         set shmat d_shmat
17446         evat $setvar
17447         set shmdt d_shmdt
17448         evat $setvar
17449         ;;
17450     esac
17451     ;;
17452 esac
17453 : we could also check for sys/ipc.h ...
17454 if $h_shm && $test `./findhdr sys/shm.h`; then
17455         echo "You have the full shm*(2) library." >&4
17456         val="$define"
17457 else
17458         echo "You don't have the full shm*(2) library." >&4
17459         val="$undef"
17460 fi
17461 set d_shm
17462 eval $setvar
17463
17464 : see if we have sigaction
17465 echo " "
17466 if set sigaction val -f d_sigaction; eval $csym; $val; then
17467         echo 'sigaction() found.' >&4
17468         $cat > try.c <<EOP
17469 #include <stdio.h>
17470 #include <sys/types.h>
17471 #include <signal.h>
17472 #$i_stdlib I_STDLIB
17473 #ifdef I_STDLIB
17474 #include <stdlib.h>
17475 #endif
17476 int main()
17477 {
17478     struct sigaction act, oact;
17479     act.sa_flags = 0;
17480     oact.sa_handler = 0;
17481     /* so that act and oact are used */
17482     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17483 }
17484 EOP
17485         set try
17486         if eval $compile_ok; then
17487                 val="$define"
17488         else
17489                 echo "But you don't seem to have a useable struct sigaction." >&4
17490                 val="$undef"
17491         fi
17492 else
17493         echo 'sigaction NOT found.' >&4
17494         val="$undef"
17495 fi
17496 set d_sigaction; eval $setvar
17497 $rm_try
17498
17499 : see if this is a sunmath.h system
17500 set sunmath.h i_sunmath
17501 eval $inhdr
17502
17503 : see if signbit exists
17504 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17505 $cat >try.c <<EOCP
17506 #$i_math I_MATH
17507 #$i_sunmath I_SUNMATH
17508 #ifdef I_MATH
17509 #  include <math.h>
17510 #endif
17511 #ifdef I_SUNMATH  /* Solaris special math library */
17512 #  include <sunmath.h>
17513 #endif
17514 #define NV $nvtype
17515 int main(int argc, char **argv)
17516 {
17517     NV x = 0.0;
17518     NV y = -0.0;
17519     if ((signbit(x) == 0) && (signbit(y) != 0))
17520         return 0;
17521     else
17522         return 1;
17523 }
17524 EOCP
17525 val="$undef"
17526 set try
17527 if eval $compile; then
17528     if $run ./try; then
17529         $echo "Yes." >&4
17530         val="$define"
17531     else
17532         $echo "Signbit seems to be available, but doesn't work as I expected."
17533         $echo "I won't use it." >&4
17534         val="$undef"
17535     fi
17536 else
17537     $echo "Nope." >&4
17538     dflt="$undef"
17539 fi
17540 set d_signbit
17541 eval $setvar
17542 $rm_try
17543
17544 : see if sigprocmask exists
17545 set sigprocmask d_sigprocmask
17546 eval $inlibc
17547
17548 : see if sigsetjmp exists
17549 echo " "
17550 case "$d_sigsetjmp" in
17551 '')
17552         $cat >try.c <<EOP
17553 #include <setjmp.h>
17554 #$i_stdlib I_STDLIB
17555 #ifdef I_STDLIB
17556 #include <stdlib.h>
17557 #endif
17558 sigjmp_buf env;
17559 int set = 1;
17560 int main()
17561 {
17562         if (sigsetjmp(env,1))
17563                 exit(set);
17564         set = 0;
17565         siglongjmp(env, 1);
17566         exit(1);
17567 }
17568 EOP
17569         set try
17570         if eval $compile; then
17571                 if $run ./try >/dev/null 2>&1; then
17572                         echo "POSIX sigsetjmp found." >&4
17573                         val="$define"
17574                 else
17575                         $cat >&4 <<EOM
17576 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17577 I'll ignore them.
17578 EOM
17579                         val="$undef"
17580                 fi
17581         else
17582                 echo "sigsetjmp not found." >&4
17583                 val="$undef"
17584         fi
17585         ;;
17586 *) val="$d_sigsetjmp"
17587         case "$d_sigsetjmp" in
17588         $define) echo "POSIX sigsetjmp found." >&4;;
17589         $undef) echo "sigsetjmp not found." >&4;;
17590         esac
17591         ;;
17592 esac
17593 set d_sigsetjmp
17594 eval $setvar
17595 $rm_try
17596
17597 : see if snprintf exists
17598 set snprintf d_snprintf
17599 eval $inlibc
17600
17601 : see if vsnprintf exists
17602 set vsnprintf d_vsnprintf
17603 eval $inlibc
17604
17605 case "$d_snprintf-$d_vsnprintf" in
17606 "$define-$define")
17607     $cat <<EOM
17608 Checking whether your snprintf() and vsnprintf() work okay...
17609 EOM
17610     $cat >try.c <<'EOCP'
17611 /* v?snprintf testing logic courtesy of Russ Allbery.
17612  * According to C99:
17613  * - if the buffer is too short it still must be \0-terminated
17614  * - if the buffer is too short the potentially required length
17615  *   must be returned and not -1
17616  * - if the buffer is NULL the potentially required length
17617  *   must be returned and not -1 or core dump
17618  */
17619 #include <stdio.h>
17620 #include <stdarg.h>
17621
17622 char buf[2];
17623
17624 int test (char *format, ...)
17625 {
17626     va_list args;
17627     int count;
17628
17629     va_start (args, format);
17630     count = vsnprintf (buf, sizeof buf, format, args);
17631     va_end (args);
17632     return count;
17633 }
17634
17635 int main ()
17636 {
17637     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17638              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17639 }
17640 EOCP
17641     set try
17642     if eval $compile; then
17643         `$run ./try`
17644         case "$?" in
17645         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17646         *) cat <<EOM >&4
17647 Your snprintf() and snprintf() don't seem to be working okay.
17648 EOM
17649            d_snprintf="$undef"
17650            d_vsnprintf="$undef"
17651            ;;
17652         esac
17653     else
17654         echo "(I can't seem to compile the test program--assuming they don't)"
17655         d_snprintf="$undef"
17656         d_vsnprintf="$undef"
17657     fi
17658     $rm_try
17659     ;;
17660 esac
17661
17662 : see if sockatmark exists
17663 set sockatmark d_sockatmark
17664 eval $inlibc
17665
17666 : see if prototype for sockatmark is available
17667 echo " "
17668 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17669 eval $hasproto
17670
17671 : see if socks5_init exists
17672 set socks5_init d_socks5_init
17673 eval $inlibc
17674
17675 : see if sprintf returns the length of the string in the buffer as per ANSI
17676 $echo "Checking whether sprintf returns the length of the string..." >&4
17677 $cat <<EOP >try.c
17678 #include <stdio.h>
17679 #$i_stdlib I_STDLIB
17680 #ifdef I_STDLIB
17681 #include <stdlib.h>
17682 #endif
17683 #$i_string I_STRING
17684 #ifdef I_STRING
17685 #  include <string.h>
17686 #else
17687 #  include <strings.h>
17688 #endif
17689 #$i_math I_MATH
17690 #ifdef I_MATH
17691 #include <math.h>
17692 #endif
17693
17694 char buffer[256];
17695
17696 int check (size_t expect, int test) {
17697   size_t got = strlen(buffer);
17698   if (expect == got)
17699     return 0;
17700
17701   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17702        test, buffer);
17703   exit (test);
17704 }
17705
17706 int main(int argc, char **argv) {
17707   int test = 0;
17708
17709   check(sprintf(buffer, ""), ++test);
17710   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17711   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17712
17713   return 0;
17714 }
17715 EOP
17716 set try
17717
17718 if eval $compile; then
17719     xxx="`$run ./try`"
17720     case "$?" in
17721         0) cat >&4 <<EOM
17722 sprintf returns the length of the string (as ANSI says it should)
17723 EOM
17724         d_sprintf_returns_strlen="$define"
17725         ;;
17726         *) cat >&4 <<EOM
17727 sprintf does not return the length of the string (how old is this system?)
17728 EOM
17729         d_sprintf_returns_strlen="$undef"
17730         ;;
17731     esac
17732 else
17733     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17734     d_sprintf_returns_strlen="$undef"
17735 fi
17736 $rm_try
17737
17738 : see if srand48_r exists
17739 set srand48_r d_srand48_r
17740 eval $inlibc
17741 case "$d_srand48_r" in
17742 "$define")
17743         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17744         case "$d_srand48_r_proto:$usethreads" in
17745         ":define")      d_srand48_r_proto=define
17746                 set d_srand48_r_proto srand48_r $hdrs
17747                 eval $hasproto ;;
17748         *)      ;;
17749         esac
17750         case "$d_srand48_r_proto" in
17751         define)
17752         case "$srand48_r_proto" in
17753         ''|0) try='int srand48_r(long, struct drand48_data*);'
17754         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17755         esac
17756         case "$srand48_r_proto" in
17757         ''|0)   d_srand48_r=undef
17758                 srand48_r_proto=0
17759                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17760         * )     case "$srand48_r_proto" in
17761                 REENTRANT_PROTO*) ;;
17762                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17763                 esac
17764                 echo "Prototype: $try" ;;
17765         esac
17766         ;;
17767         *)      case "$usethreads" in
17768                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17769                 esac
17770                 d_srand48_r=undef
17771                 srand48_r_proto=0
17772                 ;;
17773         esac
17774         ;;
17775 *)      srand48_r_proto=0
17776         ;;
17777 esac
17778
17779 : see if srandom_r exists
17780 set srandom_r d_srandom_r
17781 eval $inlibc
17782 case "$d_srandom_r" in
17783 "$define")
17784         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17785         case "$d_srandom_r_proto:$usethreads" in
17786         ":define")      d_srandom_r_proto=define
17787                 set d_srandom_r_proto srandom_r $hdrs
17788                 eval $hasproto ;;
17789         *)      ;;
17790         esac
17791         case "$d_srandom_r_proto" in
17792         define)
17793         case "$srandom_r_proto" in
17794         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17795         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17796         esac
17797         case "$srandom_r_proto" in
17798         ''|0)   d_srandom_r=undef
17799                 srandom_r_proto=0
17800                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17801         * )     case "$srandom_r_proto" in
17802                 REENTRANT_PROTO*) ;;
17803                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17804                 esac
17805                 echo "Prototype: $try" ;;
17806         esac
17807         ;;
17808         *)      case "$usethreads" in
17809                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17810                 esac
17811                 d_srandom_r=undef
17812                 srandom_r_proto=0
17813                 ;;
17814         esac
17815         ;;
17816 *)      srandom_r_proto=0
17817         ;;
17818 esac
17819
17820 : see if prototype for setresgid is available
17821 echo " "
17822 set d_sresgproto setresgid $i_unistd unistd.h
17823 eval $hasproto
17824
17825 : see if prototype for setresuid is available
17826 echo " "
17827 set d_sresuproto setresuid $i_unistd unistd.h
17828 eval $hasproto
17829
17830 : see if sys/stat.h is available
17831 set sys/stat.h i_sysstat
17832 eval $inhdr
17833
17834 : see if stat knows about block sizes
17835 echo " "
17836 echo "Checking to see if your struct stat has st_blocks field..." >&4
17837 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17838 eval $hasfield
17839
17840 : see if this is a sys/vfs.h system
17841 set sys/vfs.h i_sysvfs
17842 eval $inhdr
17843
17844 : see if this is a sys/statfs.h system
17845 set sys/statfs.h i_sysstatfs
17846 eval $inhdr
17847
17848 : Check for statfs_s
17849 echo " "
17850 echo "Checking to see if your system supports struct statfs..." >&4
17851 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
17852 eval $hasstruct
17853 case "$d_statfs_s" in
17854 "$define")      echo "Yes, it does."   ;;
17855 *)              echo "No, it doesn't." ;;
17856 esac
17857
17858
17859 : see if struct statfs knows about f_flags
17860 case "$d_statfs_s" in
17861 define)
17862         echo " "
17863         echo "Checking to see if your struct statfs has f_flags field..." >&4
17864         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
17865         eval $hasfield
17866         ;;
17867 *)      val="$undef"
17868         set d_statfs_f_flags
17869         eval $setvar
17870         ;;
17871 esac
17872 case "$d_statfs_f_flags" in
17873 "$define")      echo "Yes, it does."   ;;
17874 *)              echo "No, it doesn't." ;;
17875 esac
17876
17877 : Check stream access
17878 $cat >&4 <<EOM
17879 Checking how to access stdio streams by file descriptor number...
17880 EOM
17881 case "$stdio_stream_array" in
17882 '')     $cat >try.c <<EOCP
17883 #include <stdio.h>
17884 int main() {
17885   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17886     printf("yes\n");
17887 }
17888 EOCP
17889         for s in _iob __iob __sF
17890         do
17891                 set try -DSTDIO_STREAM_ARRAY=$s
17892                 if eval $compile; then
17893                         case "`$run ./try`" in
17894                         yes)    stdio_stream_array=$s; break ;;
17895                         esac
17896                 fi
17897         done
17898         $rm_try
17899 esac
17900 case "$stdio_stream_array" in
17901 '')     $cat >&4 <<EOM
17902 I can't figure out how to access stdio streams by file descriptor number.
17903 EOM
17904         d_stdio_stream_array="$undef"
17905         ;;
17906 *)      $cat >&4 <<EOM
17907 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17908 EOM
17909         d_stdio_stream_array="$define"
17910         ;;
17911 esac
17912
17913 : see if strcoll exists
17914 set strcoll d_strcoll
17915 eval $inlibc
17916
17917 : check for structure copying
17918 echo " "
17919 echo "Checking to see if your C compiler can copy structs..." >&4
17920 $cat >try.c <<'EOCP'
17921 int main()
17922 {
17923         struct blurfl {
17924                 int dyick;
17925         } foo, bar;
17926
17927         foo = bar;
17928 }
17929 EOCP
17930 if $cc -c try.c >/dev/null 2>&1 ; then
17931         val="$define"
17932         echo "Yup, it can."
17933 else
17934         val="$undef"
17935         echo "Nope, it can't."
17936 fi
17937 set d_strctcpy
17938 eval $setvar
17939 $rm_try
17940
17941 : see if strerror and/or sys_errlist[] exist
17942 echo " "
17943 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17944     if set strerror val -f d_strerror; eval $csym; $val; then
17945                 echo 'strerror() found.' >&4
17946                 d_strerror="$define"
17947                 d_strerrm='strerror(e)'
17948                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17949                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17950                         d_syserrlst="$define"
17951                 else
17952                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17953                         d_syserrlst="$undef"
17954                 fi
17955     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17956                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17957                 echo 'strerror() found in string header.' >&4
17958                 d_strerror="$define"
17959                 d_strerrm='strerror(e)'
17960                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17961                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17962                                 d_syserrlst="$define"
17963                 else
17964                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17965                         d_syserrlst="$undef"
17966                 fi
17967     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17968                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17969                 d_strerror="$undef"
17970                 d_syserrlst="$define"
17971                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17972     else
17973                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17974                 d_strerror="$undef"
17975                 d_syserrlst="$undef"
17976                 d_strerrm='"unknown"'
17977     fi
17978 fi
17979
17980 : see if strerror_r exists
17981 set strerror_r d_strerror_r
17982 eval $inlibc
17983 case "$d_strerror_r" in
17984 "$define")
17985         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17986         case "$d_strerror_r_proto:$usethreads" in
17987         ":define")      d_strerror_r_proto=define
17988                 set d_strerror_r_proto strerror_r $hdrs
17989                 eval $hasproto ;;
17990         *)      ;;
17991         esac
17992         case "$d_strerror_r_proto" in
17993         define)
17994         case "$strerror_r_proto" in
17995         ''|0) try='int strerror_r(int, char*, size_t);'
17996         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17997         esac
17998         case "$strerror_r_proto" in
17999         ''|0) try='int strerror_r(int, char*, int);'
18000         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18001         esac
18002         case "$strerror_r_proto" in
18003         ''|0) try='char* strerror_r(int, char*, size_t);'
18004         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18005         esac
18006         case "$strerror_r_proto" in
18007         ''|0)   d_strerror_r=undef
18008                 strerror_r_proto=0
18009                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18010         * )     case "$strerror_r_proto" in
18011                 REENTRANT_PROTO*) ;;
18012                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18013                 esac
18014                 echo "Prototype: $try" ;;
18015         esac
18016         ;;
18017         *)      case "$usethreads" in
18018                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18019                 esac
18020                 d_strerror_r=undef
18021                 strerror_r_proto=0
18022                 ;;
18023         esac
18024         ;;
18025 *)      strerror_r_proto=0
18026         ;;
18027 esac
18028
18029 : see if strftime exists
18030 set strftime d_strftime
18031 eval $inlibc
18032
18033 : see if strlcat exists
18034 set strlcat d_strlcat
18035 eval $inlibc
18036
18037 : see if strlcpy exists
18038 set strlcpy d_strlcpy
18039 eval $inlibc
18040
18041 : see if strtod exists
18042 set strtod d_strtod
18043 eval $inlibc
18044
18045 : see if strtol exists
18046 set strtol d_strtol
18047 eval $inlibc
18048
18049 : see if strtold exists
18050 set strtold d_strtold
18051 eval $inlibc
18052
18053 : see if strtoll exists
18054 set strtoll d_strtoll
18055 eval $inlibc
18056
18057 case "$d_longlong-$d_strtoll" in
18058 "$define-$define")
18059         $cat <<EOM
18060 Checking whether your strtoll() works okay...
18061 EOM
18062         $cat >try.c <<'EOCP'
18063 #include <errno.h>
18064 #ifdef __hpux
18065 #define strtoll __strtoll
18066 #endif
18067 #ifdef __EMX__
18068 #define strtoll _strtoll
18069 #endif
18070 #include <stdio.h>
18071 extern long long int strtoll(char *s, char **, int);
18072 static int bad = 0;
18073 int check(char *s, long long ell, int een) {
18074         long long gll;
18075         errno = 0;
18076         gll = strtoll(s, 0, 10);
18077         if (!((gll == ell) && (errno == een)))
18078                 bad++;
18079 }
18080 int main() {
18081         check(" 1",                                      1LL, 0);
18082         check(" 0",                                      0LL, 0);
18083         check("-1",                                     -1LL, 0);
18084         check("-9223372036854775808", -9223372036854775808LL, 0);
18085         check("-9223372036854775808", -9223372036854775808LL, 0);
18086         check(" 9223372036854775807",  9223372036854775807LL, 0);
18087         check("-9223372036854775808", -9223372036854775808LL, 0);
18088         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18089         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18090         if (!bad)
18091                 printf("ok\n");
18092 }
18093 EOCP
18094         set try
18095         if eval $compile; then
18096                 yyy=`$run ./try`
18097                 case "$yyy" in
18098                 ok) echo "Your strtoll() seems to be working okay." ;;
18099                 *) cat <<EOM >&4
18100 Your strtoll() doesn't seem to be working okay.
18101 EOM
18102                    d_strtoll="$undef"
18103                    ;;
18104                 esac
18105         else
18106                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18107                 d_strtoll="$undef"
18108         fi
18109         ;;
18110 esac
18111
18112 : see if strtoq exists
18113 set strtoq d_strtoq
18114 eval $inlibc
18115
18116 : see if strtoul exists
18117 set strtoul d_strtoul
18118 eval $inlibc
18119
18120 case "$d_strtoul" in
18121 "$define")
18122         $cat <<EOM
18123 Checking whether your strtoul() works okay...
18124 EOM
18125         $cat >try.c <<'EOCP'
18126 #include <errno.h>
18127 #include <stdio.h>
18128 extern unsigned long int strtoul(char *s, char **, int);
18129 static int bad = 0;
18130 void check(char *s, unsigned long eul, int een) {
18131         unsigned long gul;
18132         errno = 0;
18133         gul = strtoul(s, 0, 10);
18134         if (!((gul == eul) && (errno == een)))
18135                 bad++;
18136 }
18137 int main() {
18138         check(" 1", 1L, 0);
18139         check(" 0", 0L, 0);
18140 EOCP
18141         case "$longsize" in
18142         8)
18143             $cat >>try.c <<'EOCP'
18144         check("18446744073709551615", 18446744073709551615UL, 0);
18145         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18146 #if 0 /* strtoul() for /^-/ strings is undefined. */
18147         check("-1", 18446744073709551615UL, 0);
18148         check("-18446744073709551614", 2, 0);
18149         check("-18446744073709551615", 1, 0);
18150         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18151         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18152 #endif
18153 EOCP
18154                 ;;
18155         4)
18156                     $cat >>try.c <<'EOCP'
18157         check("4294967295", 4294967295UL, 0);
18158         check("4294967296", 4294967295UL, ERANGE);
18159 #if 0 /* strtoul() for /^-/ strings is undefined. */
18160         check("-1", 4294967295UL, 0);
18161         check("-4294967294", 2, 0);
18162         check("-4294967295", 1, 0);
18163         check("-4294967296", 4294967295UL, ERANGE);
18164         check("-4294967297", 4294967295UL, ERANGE);
18165 #endif
18166 EOCP
18167                 ;;
18168         *)
18169 : Should we write these tests to be more portable by sprintf-ing
18170 : ~0 and then manipulating that char string as input for strtol?
18171                 ;;
18172         esac
18173         $cat >>try.c <<'EOCP'
18174         if (!bad)
18175                 printf("ok\n");
18176         return 0;
18177 }
18178 EOCP
18179         set try
18180         if eval $compile; then
18181                 case "`$run ./try`" in
18182                 ok) echo "Your strtoul() seems to be working okay." ;;
18183                 *) cat <<EOM >&4
18184 Your strtoul() doesn't seem to be working okay.
18185 EOM
18186                    d_strtoul="$undef"
18187                    ;;
18188                 esac
18189         else
18190                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18191                 d_strtoul="$undef"
18192         fi
18193         ;;
18194 esac
18195
18196 : see if strtoull exists
18197 set strtoull d_strtoull
18198 eval $inlibc
18199
18200 case "$d_longlong-$d_strtoull" in
18201 "$define-$define")
18202         $cat <<EOM
18203 Checking whether your strtoull() works okay...
18204 EOM
18205         $cat >try.c <<'EOCP'
18206 #include <errno.h>
18207 #ifdef __hpux
18208 #define strtoull __strtoull
18209 #endif
18210 #include <stdio.h>
18211 extern unsigned long long int strtoull(char *s, char **, int);
18212 static int bad = 0;
18213 int check(char *s, long long eull, int een) {
18214         long long gull;
18215         errno = 0;
18216         gull = strtoull(s, 0, 10);
18217         if (!((gull == eull) && (errno == een)))
18218                 bad++;
18219 }
18220 int main() {
18221         check(" 1",                                        1LL, 0);
18222         check(" 0",                                        0LL, 0);
18223         check("18446744073709551615",  18446744073709551615ULL, 0);
18224         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18225 #if 0 /* strtoull() for /^-/ strings is undefined. */
18226         check("-1",                    18446744073709551615ULL, 0);
18227         check("-18446744073709551614",                     2LL, 0);
18228         check("-18446744073709551615",                     1LL, 0);
18229         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18230         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18231 #endif
18232         if (!bad)
18233                 printf("ok\n");
18234 }
18235 EOCP
18236         set try
18237         if eval $compile; then
18238                 case "`$run ./try`" in
18239                 ok) echo "Your strtoull() seems to be working okay." ;;
18240                 *) cat <<EOM >&4
18241 Your strtoull() doesn't seem to be working okay.
18242 EOM
18243                    d_strtoull="$undef"
18244                    ;;
18245                 esac
18246         else
18247                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18248                 d_strtoull="$undef"
18249         fi
18250         ;;
18251 esac
18252
18253 : see if strtouq exists
18254 set strtouq d_strtouq
18255 eval $inlibc
18256
18257 case "$d_strtouq" in
18258 "$define")
18259         $cat <<EOM
18260 Checking whether your strtouq() works okay...
18261 EOM
18262         $cat >try.c <<'EOCP'
18263 #include <errno.h>
18264 #include <stdio.h>
18265 extern unsigned long long int strtouq(char *s, char **, int);
18266 static int bad = 0;
18267 void check(char *s, unsigned long long eull, int een) {
18268         unsigned long long gull;
18269         errno = 0;
18270         gull = strtouq(s, 0, 10);
18271         if (!((gull == eull) && (errno == een)))
18272                 bad++;
18273 }
18274 int main() {
18275         check(" 1",                                        1LL, 0);
18276         check(" 0",                                        0LL, 0);
18277         check("18446744073709551615",  18446744073709551615ULL, 0);
18278         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18279 #if 0 /* strtouq() for /^-/ strings is undefined. */
18280         check("-1",                    18446744073709551615ULL, 0);
18281         check("-18446744073709551614",                     2LL, 0);
18282         check("-18446744073709551615",                     1LL, 0);
18283         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18284         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18285 #endif
18286         if (!bad)
18287                 printf("ok\n");
18288         return 0;
18289 }
18290 EOCP
18291         set try
18292         if eval $compile; then
18293                 case "`$run ./try`" in
18294                 ok) echo "Your strtouq() seems to be working okay." ;;
18295                 *) cat <<EOM >&4
18296 Your strtouq() doesn't seem to be working okay.
18297 EOM
18298                    d_strtouq="$undef"
18299                    ;;
18300                 esac
18301         else
18302                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18303                 d_strtouq="$undef"
18304         fi
18305         ;;
18306 esac
18307
18308 : see if strxfrm exists
18309 set strxfrm d_strxfrm
18310 eval $inlibc
18311
18312 : see if symlink exists
18313 set symlink d_symlink
18314 eval $inlibc
18315
18316 : see if syscall exists
18317 set syscall d_syscall
18318 eval $inlibc
18319
18320 : see if prototype for syscall is available
18321 echo " "
18322 set d_syscallproto syscall $i_unistd unistd.h
18323 eval $hasproto
18324
18325 : see if sysconf exists
18326 set sysconf d_sysconf
18327 eval $inlibc
18328
18329 : see if system exists
18330 set system d_system
18331 eval $inlibc
18332
18333 : see if tcgetpgrp exists
18334 set tcgetpgrp d_tcgetpgrp
18335 eval $inlibc
18336
18337 : see if tcsetpgrp exists
18338 set tcsetpgrp d_tcsetpgrp
18339 eval $inlibc
18340
18341 : see if prototype for telldir is available
18342 echo " "
18343 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18344 eval $hasproto
18345
18346 : see if time exists
18347 echo " "
18348 if test "X$d_time" = X -o X"$timetype" = X; then
18349     if set time val -f d_time; eval $csym; $val; then
18350                 echo 'time() found.' >&4
18351                 val="$define"
18352                 rp="What is the type returned by time() on this system?"
18353                 set time_t timetype long stdio.h sys/types.h
18354                 eval $typedef_ask
18355     else
18356                 echo 'time() not found, hope that will do.' >&4
18357                 val="$undef"
18358                 timetype='int';
18359     fi
18360     set d_time
18361     eval $setvar
18362 fi
18363
18364 : see if timegm exists
18365 set timegm d_timegm
18366 eval $inlibc
18367
18368 : see if this is a sys/times.h system
18369 set sys/times.h i_systimes
18370 eval $inhdr
18371
18372 : see if times exists
18373 echo " "
18374 if set times val -f d_times; eval $csym; $val; then
18375         echo 'times() found.' >&4
18376         d_times="$define"
18377         inc=''
18378         case "$i_systimes" in
18379         "$define") inc='sys/times.h';;
18380         esac
18381         rp="What is the type returned by times() on this system?"
18382         set clock_t clocktype long stdio.h sys/types.h $inc
18383         eval $typedef_ask
18384 else
18385         echo 'times() NOT found, hope that will do.' >&4
18386         d_times="$undef"
18387         clocktype='int'
18388 fi
18389
18390 : see if tmpnam_r exists
18391 set tmpnam_r d_tmpnam_r
18392 eval $inlibc
18393 case "$d_tmpnam_r" in
18394 "$define")
18395         hdrs="$i_systypes sys/types.h define stdio.h "
18396         case "$d_tmpnam_r_proto:$usethreads" in
18397         ":define")      d_tmpnam_r_proto=define
18398                 set d_tmpnam_r_proto tmpnam_r $hdrs
18399                 eval $hasproto ;;
18400         *)      ;;
18401         esac
18402         case "$d_tmpnam_r_proto" in
18403         define)
18404         case "$tmpnam_r_proto" in
18405         ''|0) try='char* tmpnam_r(char*);'
18406         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18407         esac
18408         case "$tmpnam_r_proto" in
18409         ''|0)   d_tmpnam_r=undef
18410                 tmpnam_r_proto=0
18411                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18412         * )     case "$tmpnam_r_proto" in
18413                 REENTRANT_PROTO*) ;;
18414                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18415                 esac
18416                 echo "Prototype: $try" ;;
18417         esac
18418         ;;
18419         *)      case "$usethreads" in
18420                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18421                 esac
18422                 d_tmpnam_r=undef
18423                 tmpnam_r_proto=0
18424                 ;;
18425         esac
18426         ;;
18427 *)      tmpnam_r_proto=0
18428         ;;
18429 esac
18430
18431 : see if truncate exists
18432 set truncate d_truncate
18433 eval $inlibc
18434
18435 : see if ttyname_r exists
18436 set ttyname_r d_ttyname_r
18437 eval $inlibc
18438 case "$d_ttyname_r" in
18439 "$define")
18440         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18441         case "$d_ttyname_r_proto:$usethreads" in
18442         ":define")      d_ttyname_r_proto=define
18443                 set d_ttyname_r_proto ttyname_r $hdrs
18444                 eval $hasproto ;;
18445         *)      ;;
18446         esac
18447         case "$d_ttyname_r_proto" in
18448         define)
18449         case "$ttyname_r_proto" in
18450         ''|0) try='int ttyname_r(int, char*, size_t);'
18451         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18452         esac
18453         case "$ttyname_r_proto" in
18454         ''|0) try='int ttyname_r(int, char*, int);'
18455         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18456         esac
18457         case "$ttyname_r_proto" in
18458         ''|0) try='char* ttyname_r(int, char*, int);'
18459         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18460         esac
18461         case "$ttyname_r_proto" in
18462         ''|0)   d_ttyname_r=undef
18463                 ttyname_r_proto=0
18464                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18465         * )     case "$ttyname_r_proto" in
18466                 REENTRANT_PROTO*) ;;
18467                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18468                 esac
18469                 echo "Prototype: $try" ;;
18470         esac
18471         ;;
18472         *)      case "$usethreads" in
18473                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18474                 esac
18475                 d_ttyname_r=undef
18476                 ttyname_r_proto=0
18477                 ;;
18478         esac
18479         ;;
18480 *)      ttyname_r_proto=0
18481         ;;
18482 esac
18483
18484 : see if tzname[] exists
18485 echo " "
18486 if set tzname val -a d_tzname; eval $csym; $val; then
18487         val="$define"
18488         echo 'tzname[] found.' >&4
18489 else
18490         val="$undef"
18491         echo 'tzname[] NOT found.' >&4
18492 fi
18493 set d_tzname
18494 eval $setvar
18495
18496 : Check if is a multiplatform env
18497 case "$osname" in
18498 next|rhapsody|darwin) multiarch="$define" ;;
18499 esac
18500 case "$multiarch" in
18501 ''|[nN]*) multiarch="$undef" ;;
18502 esac
18503
18504 : check for ordering of bytes in a UV
18505 echo " "
18506 case "$usecrosscompile$multiarch" in
18507 *$define*)
18508         $cat <<EOM
18509 You seem to be either cross-compiling or doing a multiarchitecture build,
18510 skipping the byteorder check.
18511
18512 EOM
18513         byteorder='ffff'
18514         ;;
18515 *)
18516         case "$byteorder" in
18517         '')
18518                 $cat <<'EOM'
18519 In the following, larger digits indicate more significance.  A big-endian
18520 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18521 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18522 machines may have weird orders like 3412.  A Cray will report 87654321,
18523 an Alpha will report 12345678. If the test program works the default is
18524 probably right.
18525 I'm now running the test program...
18526 EOM
18527                 $cat >try.c <<EOCP
18528 #include <stdio.h>
18529 #$i_stdlib I_STDLIB
18530 #ifdef I_STDLIB
18531 #include <stdlib.h>
18532 #endif
18533 #include <sys/types.h>
18534 typedef $uvtype UV;
18535 int main()
18536 {
18537         int i;
18538         union {
18539                 UV l;
18540                 char c[$uvsize];
18541         } u;
18542
18543         if ($uvsize > 4)
18544                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18545         else
18546                 u.l = (UV)0x04030201;
18547         for (i = 0; i < $uvsize; i++)
18548                 printf("%c", u.c[i]+'0');
18549         printf("\n");
18550         exit(0);
18551 }
18552 EOCP
18553                 xxx_prompt=y
18554                 set try
18555                 if eval $compile && $run ./try > /dev/null; then
18556                         dflt=`$run ./try`
18557                         case "$dflt" in
18558                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18559                                 echo "(The test program ran ok.)"
18560                                 echo "byteorder=$dflt"
18561                                 xxx_prompt=n
18562                         ;;
18563                         ????|????????) echo "(The test program ran ok.)" ;;
18564                         *) echo "(The test program didn't run right for some reason.)" ;;
18565                         esac
18566                 else
18567                         dflt='4321'
18568                         cat <<'EOM'
18569 (I can't seem to compile the test program.  Guessing big-endian...)
18570 EOM
18571                 fi
18572                 case "$xxx_prompt" in
18573                 y)
18574                         rp="What is the order of bytes in $uvtype?"
18575                         . ./myread
18576                         byteorder="$ans"
18577                         ;;
18578                 *)      byteorder=$dflt
18579                         ;;
18580                 esac
18581                 ;;
18582         esac
18583         $rm_try
18584         ;;
18585 esac
18586
18587 : Checking 32bit aligndness
18588 $cat <<EOM
18589
18590 Checking to see whether you can access character data unalignedly...
18591 EOM
18592 case "$d_u32align" in
18593 '')   $cat >try.c <<EOCP
18594 #include <stdio.h>
18595 #$i_stdlib I_STDLIB
18596 #ifdef I_STDLIB
18597 #include <stdlib.h>
18598 #endif
18599 #define U32 $u32type
18600 #define BYTEORDER 0x$byteorder
18601 #define U8 $u8type
18602 #include <signal.h>
18603 #ifdef SIGBUS
18604 $signal_t bletch(int s) { exit(4); }
18605 #endif
18606 int main() {
18607 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18608     U8 buf[8];
18609     U32 *up;
18610     int i;
18611
18612     if (sizeof(U32) != 4) {
18613         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18614         exit(1);
18615     }
18616
18617     fflush(stdout);
18618
18619 #ifdef SIGBUS
18620     signal(SIGBUS, bletch);
18621 #endif
18622
18623     buf[0] = 0;
18624     buf[1] = 0;
18625     buf[2] = 0;
18626     buf[3] = 1;
18627     buf[4] = 0;
18628     buf[5] = 0;
18629     buf[6] = 0;
18630     buf[7] = 1;
18631
18632     for (i = 0; i < 4; i++) {
18633         up = (U32*)(buf + i);
18634         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18635                (*up == 1 << (8*(3-i)))  /* little-endian */
18636               )
18637            )
18638         {
18639             printf("read failed (%x)\n", *up);
18640             exit(2);
18641         }
18642     }
18643
18644     /* write test */
18645     for (i = 0; i < 4; i++) {
18646         up = (U32*)(buf + i);
18647         *up = 0xBeef;
18648         if (*up != 0xBeef) {
18649             printf("write failed (%x)\n", *up);
18650             exit(3);
18651         }
18652     }
18653
18654     exit(0);
18655 #else
18656     printf("1\n");
18657     exit(1);
18658 #endif
18659     return 0;
18660 }
18661 EOCP
18662 set try
18663 if eval $compile_ok; then
18664         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18665         $run ./try 2>&1 >/dev/null
18666         case "$?" in
18667         0)      cat >&4 <<EOM
18668 You can access character data pretty unalignedly.
18669 EOM
18670                 d_u32align="$undef"
18671                 ;;
18672         *)      cat >&4 <<EOM
18673 It seems that you must access character data in an aligned manner.
18674 EOM
18675                 d_u32align="$define"
18676                 ;;
18677         esac
18678 else
18679         rp='Can you access character data at unaligned addresses?'
18680         dflt='n'
18681         . ./myread
18682         case "$ans" in
18683         [yY]*)  d_u32align="$undef"  ;;
18684         *)      d_u32align="$define" ;;
18685         esac
18686 fi
18687 $rm_try
18688 ;;
18689 esac
18690
18691 : see if ualarm exists
18692 set ualarm d_ualarm
18693 eval $inlibc
18694
18695 : see if umask exists
18696 set umask d_umask
18697 eval $inlibc
18698
18699 : see if unordered exists
18700 set unordered d_unordered
18701 eval $inlibc
18702
18703 : see if unsetenv exists
18704 set unsetenv d_unsetenv
18705 eval $inlibc
18706
18707 : see if usleep exists
18708 set usleep d_usleep
18709 eval $inlibc
18710
18711 : see if prototype for usleep is available
18712 echo " "
18713 set d_usleepproto usleep $i_unistd unistd.h
18714 eval $hasproto
18715
18716 : see if ustat exists
18717 set ustat d_ustat
18718 eval $inlibc
18719
18720 : see if closedir exists
18721 set closedir d_closedir
18722 eval $inlibc
18723
18724 case "$d_closedir" in
18725 "$define")
18726         echo " "
18727         echo "Checking whether closedir() returns a status..." >&4
18728         cat > try.c <<EOM
18729 #$i_dirent I_DIRENT             /**/
18730 #$i_sysdir I_SYS_DIR            /**/
18731 #$i_sysndir I_SYS_NDIR          /**/
18732 #$i_systypes I_SYS_TYPES        /**/
18733
18734 #if defined(I_SYS_TYPES)
18735 #include <sys/types.h>
18736 #endif
18737 #if defined(I_DIRENT)
18738 #include <dirent.h>
18739 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18740 #include <sys/dir.h>
18741 #endif
18742 #else
18743 #ifdef I_SYS_NDIR
18744 #include <sys/ndir.h>
18745 #else
18746 #ifdef I_SYS_DIR
18747 #ifdef hp9000s500
18748 #include <ndir.h>       /* may be wrong in the future */
18749 #else
18750 #include <sys/dir.h>
18751 #endif
18752 #endif
18753 #endif
18754 #endif
18755 int main() { return closedir(opendir(".")); }
18756 EOM
18757         set try
18758         if eval $compile_ok; then
18759                 if $run ./try > /dev/null 2>&1 ; then
18760                         echo "Yes, it does."
18761                         val="$undef"
18762                 else
18763                         echo "No, it doesn't."
18764                         val="$define"
18765                 fi
18766         else
18767                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18768                 val="$define"
18769         fi
18770         ;;
18771 *)
18772         val="$undef";
18773         ;;
18774 esac
18775 set d_void_closedir
18776 eval $setvar
18777 $rm_try
18778
18779 : see if there is a wait4
18780 set wait4 d_wait4
18781 eval $inlibc
18782
18783 : see if waitpid exists
18784 set waitpid d_waitpid
18785 eval $inlibc
18786
18787 : see if wcstombs exists
18788 set wcstombs d_wcstombs
18789 eval $inlibc
18790
18791 : see if wctomb exists
18792 set wctomb d_wctomb
18793 eval $inlibc
18794
18795 : see if writev exists
18796 set writev d_writev
18797 eval $inlibc
18798
18799 : preserve RCS keywords in files with variable substitution, grrr
18800 Date='$Date'
18801 Id='$Id'
18802 Log='$Log'
18803 RCSfile='$RCSfile'
18804 Revision='$Revision'
18805
18806 : check for alignment requirements
18807 echo " "
18808 case "$usecrosscompile$multiarch" in
18809 *$define*)
18810         $cat <<EOM
18811 You seem to be either cross-compiling or doing a multiarchitecture build,
18812 skipping the memory alignment check.
18813
18814 EOM
18815         case "$alignbytes" in
18816         '') alignbytes=8 ;;
18817         esac
18818         ;;
18819 *)
18820         case "$alignbytes" in
18821         '') echo "Checking alignment constraints..." >&4
18822                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18823                         $cat >try.c <<'EOCP'
18824 typedef long double NV;
18825 EOCP
18826                 else
18827                         $cat >try.c <<'EOCP'
18828 typedef double NV;
18829 EOCP
18830                 fi
18831                 $cat >>try.c <<'EOCP'
18832 #include <stdio.h>
18833 struct foobar {
18834         char foo;
18835         NV bar;
18836 } try_algn;
18837 int main()
18838 {
18839     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18840     return(0);
18841 }
18842 EOCP
18843                 set try
18844                 if eval $compile_ok; then
18845                         dflt=`$run ./try`
18846                 else
18847                         dflt='8'
18848                         echo "(I can't seem to compile the test program...)"
18849                 fi
18850                 ;;
18851         *) dflt="$alignbytes"
18852                 ;;
18853         esac
18854         rp="Doubles must be aligned on a how-many-byte boundary?"
18855         . ./myread
18856         alignbytes="$ans"
18857         $rm_try
18858         ;;
18859 esac
18860
18861
18862 : set the base revision
18863 baserev=5.0
18864
18865 : length of character in bytes. Is always 1, otherwise it isnt C
18866 : This used to be a test using sizeof
18867 charsize=1
18868
18869 : Check for the number of bits in a character
18870 case "$charbits" in
18871 '')     echo "Checking how long a character is (in bits)..." >&4
18872         $cat >try.c <<EOCP
18873 #include <stdio.h>
18874 int main ()
18875 {
18876     int n;
18877     unsigned char c;
18878     for (c = 1, n = 0; c; c <<= 1, n++) ;
18879     printf ("%d\n", n);
18880     return (0);
18881     }
18882 EOCP
18883         set try
18884         if eval $compile_ok; then
18885                 dflt=`$run ./try`
18886         else
18887                 dflt='8'
18888                 echo "(I can't seem to compile the test program.  Guessing...)"
18889         fi
18890         ;;
18891 *)
18892         dflt="$charbits"
18893         ;;
18894 esac
18895 rp="What is the length of a character (in bits)?"
18896 . ./myread
18897 charbits="$ans"
18898 $rm_try
18899 case "$charbits" in
18900 8)      ;;
18901 *)      cat >&4 << EOM
18902 Your system has an unsigned character size of $charbits bits, which
18903 is rather unusual (normally it is 8 bits).  Perl likely will not work
18904 correctly on your system, with subtle bugs in various places.
18905 EOM
18906         rp='Do you really want to continue?'
18907         dflt='n'
18908         . ./myread
18909         case "$ans" in
18910                 [yY])   echo >&4 "Okay, continuing."    ;;
18911                 *)      exit 1                          ;;
18912         esac
18913 esac
18914
18915 : how do we concatenate cpp tokens here?
18916 echo " "
18917 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18918 $cat >cpp_stuff.c <<'EOCP'
18919 #define RCAT(a,b)a/**/b
18920 #define ACAT(a,b)a ## b
18921 RCAT(Rei,ser)
18922 ACAT(Cir,cus)
18923 EOCP
18924 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18925 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18926         echo "Oh!  Smells like ANSI's been here." >&4
18927         echo "We can catify or stringify, separately or together!"
18928         cpp_stuff=42
18929 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18930         echo "Ah, yes!  The good old days!" >&4
18931         echo "However, in the good old days we don't know how to stringify and"
18932         echo "catify at the same time."
18933         cpp_stuff=1
18934 else
18935         $cat >&4 <<EOM
18936 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18937 You're going to have to edit the values of CAT[2-5] in config.h...
18938 EOM
18939         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18940 fi
18941 $rm -f cpp_stuff.*
18942
18943 : see if this is a db.h system
18944 set db.h i_db
18945 eval $inhdr
18946
18947 case "$i_db" in
18948 $define)
18949         : Check db version.
18950         echo " "
18951         echo "Checking Berkeley DB version ..." >&4
18952         $cat >try.c <<EOCP
18953 #$d_const HASCONST
18954 #ifndef HASCONST
18955 #define const
18956 #endif
18957 #include <sys/types.h>
18958 #include <stdio.h>
18959 #$i_stdlib I_STDLIB
18960 #ifdef I_STDLIB
18961 #include <stdlib.h>
18962 #endif
18963 #include <db.h>
18964 int main(int argc, char *argv[])
18965 {
18966 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18967     int Major, Minor, Patch ;
18968     unsigned long Version ;
18969     (void)db_version(&Major, &Minor, &Patch) ;
18970     if (argc == 2) {
18971         printf("%d %d %d %d %d %d\n",
18972                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18973                Major, Minor, Patch);
18974         exit(0);
18975     }
18976     printf("You have Berkeley DB Version 2 or greater.\n");
18977
18978     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18979                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18980     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18981                 Major, Minor, Patch) ;
18982
18983     /* check that db.h & libdb are compatible */
18984     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18985         printf("db.h and libdb are incompatible.\n") ;
18986         exit(3);
18987     }
18988
18989     printf("db.h and libdb are compatible.\n") ;
18990
18991     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18992                 + DB_VERSION_PATCH ;
18993
18994     /* needs to be >= 2.3.4 */
18995     if (Version < 2003004) {
18996     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18997         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18998         exit(2);
18999     }
19000
19001     exit(0);
19002 #else
19003 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19004     if (argc == 2) {
19005         printf("1 0 0\n");
19006         exit(0);
19007     }
19008     printf("You have Berkeley DB Version 1.\n");
19009     exit(0);    /* DB version < 2: the coast is clear. */
19010 #else
19011     exit(1);    /* <db.h> not Berkeley DB? */
19012 #endif
19013 #endif
19014 }
19015 EOCP
19016         set try
19017         if eval $compile_ok && $run ./try; then
19018                 echo 'Looks OK.' >&4
19019                 set `$run ./try 1`
19020                 db_version_major=$1
19021                 db_version_minor=$2
19022                 db_version_patch=$3
19023         else
19024                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19025                 i_db=$undef
19026                 case " $libs " in
19027                 *"-ldb "*)
19028                         : Remove db from list of libraries to use
19029                         echo "Removing unusable -ldb from library list" >&4
19030                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19031                         shift
19032                         libs="$*"
19033                         echo "libs = $libs" >&4
19034                         ;;
19035                 esac
19036         fi
19037         $rm_try
19038         ;;
19039 esac
19040
19041 case "$i_db" in
19042 define)
19043         : Check the return type needed for hash
19044         echo " "
19045         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19046         $cat >try.c <<EOCP
19047 #$d_const HASCONST
19048 #ifndef HASCONST
19049 #define const
19050 #endif
19051 #include <sys/types.h>
19052 #include <db.h>
19053
19054 #ifndef DB_VERSION_MAJOR
19055 u_int32_t hash_cb (ptr, size)
19056 const void *ptr;
19057 size_t size;
19058 {
19059 }
19060 HASHINFO info;
19061 int main()
19062 {
19063         info.hash = hash_cb;
19064 }
19065 #endif
19066 EOCP
19067         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19068                 if $contains warning try.out >>/dev/null 2>&1 ; then
19069                         db_hashtype='int'
19070                 else
19071                         db_hashtype='u_int32_t'
19072                 fi
19073         else
19074                 : XXX Maybe we should just give up here.
19075                 db_hashtype=u_int32_t
19076                 $cat try.out >&4
19077                 echo "Help:  I can't seem to compile the db test program." >&4
19078                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19079         fi
19080         $rm_try
19081         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19082         ;;
19083 *)      db_hashtype=u_int32_t
19084         ;;
19085 esac
19086 case "$i_db" in
19087 define)
19088         : Check the return type needed for prefix
19089         echo " "
19090         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19091         cat >try.c <<EOCP
19092 #$d_const HASCONST
19093 #ifndef HASCONST
19094 #define const
19095 #endif
19096 #include <sys/types.h>
19097 #include <db.h>
19098
19099 #ifndef DB_VERSION_MAJOR
19100 size_t prefix_cb (key1, key2)
19101 const DBT *key1;
19102 const DBT *key2;
19103 {
19104 }
19105 BTREEINFO info;
19106 int main()
19107 {
19108         info.prefix = prefix_cb;
19109 }
19110 #endif
19111 EOCP
19112         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19113                 if $contains warning try.out >>/dev/null 2>&1 ; then
19114                         db_prefixtype='int'
19115                 else
19116                         db_prefixtype='size_t'
19117                 fi
19118         else
19119                 db_prefixtype='size_t'
19120                 : XXX Maybe we should just give up here.
19121                 $cat try.out >&4
19122                 echo "Help:  I can't seem to compile the db test program." >&4
19123                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19124         fi
19125         $rm_try
19126         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19127         ;;
19128 *)      db_prefixtype='size_t'
19129         ;;
19130 esac
19131
19132 : How can we generate normalized random numbers ?
19133 echo " "
19134 echo "Looking for a random number function..." >&4
19135 case "$randfunc" in
19136 '')
19137         if set drand48 val -f; eval $csym; $val; then
19138                 dflt="drand48"
19139                 echo "Good, found drand48()." >&4
19140         elif set random val -f; eval $csym; $val; then
19141                 dflt="random"
19142                 echo "OK, found random()." >&4
19143         else
19144                 dflt="rand"
19145                 echo "Yick, looks like I have to use rand()." >&4
19146         fi
19147         echo " "
19148         ;;
19149 *)
19150         dflt="$randfunc"
19151         ;;
19152 esac
19153 cont=true
19154
19155 case "$ccflags" in
19156 *-Dmy_rand=*|*-Dmy_srand=*)
19157         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19158         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19159         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19160         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19161         ;;
19162 esac
19163
19164 while $test "$cont"; do
19165         rp="Use which function to generate random numbers?"
19166         . ./myread
19167         if $test "$ans" = "$dflt"; then
19168                 : null
19169         else
19170                 randbits=''
19171         fi
19172         randfunc="$ans"
19173         if set $ans val -f; eval $csym; $val; then
19174                 cont=''
19175         else
19176                 dflt=y
19177                 rp="I cannot find function $ans. Use that name anyway?"
19178                 . ./myread
19179                 dflt=rand
19180                 case "$ans" in
19181                         [yY]*) cont='';;
19182                 esac
19183         fi
19184         case "$cont" in
19185         '')
19186                 case "$randfunc" in
19187                 drand48)
19188                         drand01="drand48()"
19189                         seedfunc="srand48"
19190                         randbits=48
19191                         randseedtype=long
19192                         ;;
19193                 rand|random)
19194                         case "$randbits" in
19195                         '')
19196 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19197                                 $cat >try.c <<EOCP
19198 #$i_unistd I_UNISTD
19199 #$i_stdlib I_STDLIB
19200 #include <stdio.h>
19201 #ifdef I_UNISTD
19202 #  include <unistd.h>
19203 #endif
19204 #ifdef I_STDLIB
19205 #  include <stdlib.h>
19206 #endif
19207 int main()
19208 {
19209         register int i;
19210         register unsigned long tmp;
19211         register unsigned long max = 0L;
19212
19213         for (i = 1000; i; i--) {
19214                 tmp = (unsigned long) $randfunc();
19215                 if (tmp > max) max = tmp;
19216         }
19217         for (i = 0; max; i++)
19218                 max /= 2;
19219         printf("%d\n",i);
19220 }
19221 EOCP
19222                                 set try
19223                                 if eval $compile_ok; then
19224                                         dflt=`try`
19225                                 else
19226                                         dflt='?'
19227                                         echo "(I can't seem to compile the test program...)"
19228                                 fi
19229                                 ;;
19230                         *)
19231                                 dflt="$randbits"
19232                                 ;;
19233                         esac
19234                         rp="How many bits does your $randfunc() function produce?"
19235                         . ./myread
19236                         randbits="$ans"
19237                         $rm_try
19238                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19239                         seedfunc="s$randfunc"
19240                         randseedtype=unsigned
19241                         ;;
19242                 *)
19243                         dflt="31"
19244                         rp="How many bits does your $randfunc() function produce?"
19245                         . ./myread
19246                         randbits="$ans"
19247                         seedfunc="s$randfunc"
19248                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19249                         if set $seedfunc val -f; eval $csym; $val; then
19250                                 echo "(Using $seedfunc() to seed random generator)"
19251                         else
19252                                 echo "(Warning: no $seedfunc() to seed random generator)"
19253                                 seedfunc=rand
19254                         fi
19255                         randseedtype=unsigned
19256                         ;;
19257                 esac
19258                 ;;
19259         esac
19260 done
19261
19262 : Determine if this is an EBCDIC system
19263 echo " "
19264 echo "Determining whether or not we are on an EBCDIC system..." >&4
19265 $cat >try.c <<'EOM'
19266 int main()
19267 {
19268   if ('M'==0xd4) return 0;
19269   return 1;
19270 }
19271 EOM
19272
19273 val=$undef
19274 set try
19275 if eval $compile_ok; then
19276         if $run ./try; then
19277                 echo "You seem to speak EBCDIC." >&4
19278                 val="$define"
19279         else
19280                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19281         fi
19282 else
19283         echo "I'm unable to compile the test program." >&4
19284         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19285 fi
19286 $rm_try
19287 set ebcdic
19288 eval $setvar
19289
19290 : Check how to flush
19291 echo " "
19292 $cat >&4 <<EOM
19293 Checking how to flush all pending stdio output...
19294 EOM
19295 # I only know how to find the first 32 possibly open files on SunOS.
19296 # See also hints/sunos_4_1.sh and util.c  --AD
19297 case "$osname" in
19298 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19299 esac
19300 $cat >>try.c <<EOCP
19301 #include <stdio.h>
19302 #$i_stdlib I_STDLIB
19303 #ifdef I_STDLIB
19304 #include <stdlib.h>
19305 #endif
19306 #$i_unistd I_UNISTD
19307 #ifdef I_UNISTD
19308 # include <unistd.h>
19309 #endif
19310 #$d_sysconf HAS_SYSCONF
19311 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19312 #ifdef HAS_STDIO_STREAM_ARRAY
19313 # define STDIO_STREAM_ARRAY $stdio_stream_array
19314 #endif
19315 int main() {
19316   FILE* p;
19317   unlink("try.out");
19318   p = fopen("try.out", "w");
19319 #ifdef TRY_FPUTC
19320   fputc('x', p);
19321 #else
19322 # ifdef TRY_FPRINTF
19323   fprintf(p, "x");
19324 # endif
19325 #endif
19326 #ifdef TRY_FFLUSH_NULL
19327   fflush(NULL);
19328 #endif
19329 #ifdef TRY_FFLUSH_ALL
19330   {
19331     long open_max = -1;
19332 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19333     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19334 # else
19335 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19336     open_max = sysconf(_SC_OPEN_MAX);
19337 #  else
19338 #   ifdef FOPEN_MAX
19339     open_max = FOPEN_MAX;
19340 #   else
19341 #    ifdef OPEN_MAX
19342     open_max = OPEN_MAX;
19343 #    else
19344 #     ifdef _NFILE
19345     open_max = _NFILE;
19346 #     endif
19347 #    endif
19348 #   endif
19349 #  endif
19350 # endif
19351 # ifdef HAS_STDIO_STREAM_ARRAY
19352     if (open_max > 0) {
19353       long i;
19354       for (i = 0; i < open_max; i++)
19355             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19356                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19357                 STDIO_STREAM_ARRAY[i]._flag)
19358                 fflush(&STDIO_STREAM_ARRAY[i]);
19359     }
19360   }
19361 # endif
19362 #endif
19363   _exit(42);
19364 }
19365 EOCP
19366 : first we have to find out how _not_ to flush
19367 $to try.c
19368 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19369     output=''
19370     set try -DTRY_FPUTC
19371     if eval $compile; then
19372             $run ./try 2>/dev/null
19373             code="$?"
19374             $from try.out
19375             if $test ! -s try.out -a "X$code" = X42; then
19376                 output=-DTRY_FPUTC
19377             fi
19378     fi
19379     case "$output" in
19380     '')
19381             set try -DTRY_FPRINTF
19382             if eval $compile; then
19383                     $run ./try 2>/dev/null
19384                     code="$?"
19385                     $from try.out
19386                     if $test ! -s try.out -a "X$code" = X42; then
19387                         output=-DTRY_FPRINTF
19388                     fi
19389             fi
19390         ;;
19391     esac
19392 fi
19393 : check for fflush NULL behaviour
19394 case "$fflushNULL" in
19395 '')     set try -DTRY_FFLUSH_NULL $output
19396         if eval $compile; then
19397                 $run ./try 2>/dev/null
19398                 code="$?"
19399                 $from try.out
19400                 if $test -s try.out -a "X$code" = X42; then
19401                         fflushNULL="`$cat try.out`"
19402                 else
19403                         if $test "X$code" != X42; then
19404                                 $cat >&4 <<EOM
19405 (If this test failed, don't worry, we'll try another method shortly.)
19406 EOM
19407                         fi
19408                 fi
19409         fi
19410         $rm -f core try.core core.try.*
19411         case "$fflushNULL" in
19412         x)      $cat >&4 <<EOM
19413 Your fflush(NULL) works okay for output streams.
19414 Let's see if it clobbers input pipes...
19415 EOM
19416 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19417 # bug that improperly flushes the input end of pipes.  So we avoid the
19418 # autoflush on fork/system/exec support for now. :-(
19419 $cat >tryp.c <<EOCP
19420 #include <stdio.h>
19421 int
19422 main(int argc, char **argv)
19423 {
19424     char buf[1024];
19425     int i;
19426     char *bp = buf;
19427     while (1) {
19428         while ((i = getc(stdin)) != -1
19429                && (*bp++ = i) != '\n'
19430                && bp < &buf[1024])
19431         /* DO NOTHING */ ;
19432         *bp = '\0';
19433         fprintf(stdout, "%s", buf);
19434         fflush(NULL);
19435         if (i == -1)
19436             return 0;
19437         bp = buf;
19438     }
19439 }
19440 EOCP
19441                 fflushNULL="$define"
19442                 set tryp
19443                 if eval $compile; then
19444                     $rm -f tryp.out
19445                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19446                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19447                        $cat >&4 <<EOM
19448 fflush(NULL) seems to behave okay with input streams.
19449 EOM
19450                         fflushNULL="$define"
19451                     else
19452                         $cat >&4 <<EOM
19453 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19454 EOM
19455                         fflushNULL="$undef"
19456                     fi
19457                 fi
19458                 $rm -f core tryp.c tryp.core core.tryp.*
19459                 ;;
19460         '')     $cat >&4 <<EOM
19461 Your fflush(NULL) isn't working (contrary to ANSI C).
19462 EOM
19463                 fflushNULL="$undef"
19464                 ;;
19465         *)      $cat >&4 <<EOM
19466 Cannot figure out whether your fflush(NULL) works or not.
19467 I'm assuming it doesn't (contrary to ANSI C).
19468 EOM
19469                 fflushNULL="$undef"
19470                 ;;
19471         esac
19472         ;;
19473 $define|true|[yY]*)
19474         fflushNULL="$define"
19475         ;;
19476 *)
19477         fflushNULL="$undef"
19478         ;;
19479 esac
19480 : check explicit looping only if NULL did not work, and if the pipe
19481 : bug does not show up on an explicit flush too
19482 case "$fflushNULL" in
19483 "$undef")
19484         $cat >tryp.c <<EOCP
19485 #include <stdio.h>
19486 int
19487 main(int argc, char **argv)
19488 {
19489     char buf[1024];
19490     int i;
19491     char *bp = buf;
19492     while (1) {
19493         while ((i = getc(stdin)) != -1
19494                && (*bp++ = i) != '\n'
19495                && bp < &buf[1024])
19496         /* DO NOTHING */ ;
19497         *bp = '\0';
19498         fprintf(stdout, "%s", buf);
19499         fflush(stdin);
19500         if (i == -1)
19501             return 0;
19502         bp = buf;
19503     }
19504 }
19505 EOCP
19506         set tryp
19507         if eval $compile; then
19508             $rm -f tryp.out
19509             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19510             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19511                $cat >&4 <<EOM
19512 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19513 EOM
19514                 : now check for fflushall behaviour
19515                 case "$fflushall" in
19516                 '')     set try -DTRY_FFLUSH_ALL $output
19517                         if eval $compile; then
19518                                 $cat >&4 <<EOM
19519 (Now testing the other method--but note that this also may fail.)
19520 EOM
19521                                 $run ./try 2>/dev/null
19522                                 code=$?
19523                                 $from try.out
19524                                 if $test -s try.out -a "X$code" = X42; then
19525                                         fflushall="`$cat try.out`"
19526                                 fi
19527                         fi
19528                         $rm_try
19529                         case "$fflushall" in
19530                         x)      $cat >&4 <<EOM
19531 Whew. Flushing explicitly all the stdio streams works.
19532 EOM
19533                                 fflushall="$define"
19534                                 ;;
19535                         '')     $cat >&4 <<EOM
19536 Sigh. Flushing explicitly all the stdio streams doesn't work.
19537 EOM
19538                                 fflushall="$undef"
19539                                 ;;
19540                         *)      $cat >&4 <<EOM
19541 Cannot figure out whether flushing stdio streams explicitly works or not.
19542 I'm assuming it doesn't.
19543 EOM
19544                                 fflushall="$undef"
19545                                 ;;
19546                         esac
19547                         ;;
19548                 "$define"|true|[yY]*)
19549                         fflushall="$define"
19550                         ;;
19551                 *)
19552                         fflushall="$undef"
19553                         ;;
19554                 esac
19555             else
19556                 $cat >&4 <<EOM
19557 All is futile.  Even fflush(stdin) clobbers input pipes!
19558 EOM
19559                 fflushall="$undef"
19560             fi
19561         else
19562             fflushall="$undef"
19563         fi
19564         $rm -f core tryp.c tryp.core core.tryp.*
19565         ;;
19566 *)      fflushall="$undef"
19567         ;;
19568 esac
19569
19570 case "$fflushNULL$fflushall" in
19571 undefundef)
19572         $cat <<EOM
19573 OK, I give up.  I cannot figure out how to flush pending stdio output.
19574 We won't be flushing handles at all before fork/exec/popen.
19575 EOM
19576         ;;
19577 esac
19578 $rm_try tryp
19579
19580 : Store the full pathname to the ar program for use in the C program
19581 : Respect a hint or command line value for full_ar.
19582 case "$full_ar" in
19583 '') full_ar=$ar ;;
19584 esac
19585
19586 : Store the full pathname to the sed program for use in the C program
19587 full_sed=$sed
19588
19589 : see what type gids are declared as in the kernel
19590 echo " "
19591 echo "Looking for the type for group ids returned by getgid()."
19592 set gid_t gidtype xxx stdio.h sys/types.h
19593 eval $typedef
19594 case "$gidtype" in
19595 xxx)
19596         xxx=`./findhdr sys/user.h`
19597         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19598         case $1 in
19599         unsigned) dflt="$1 $2" ;;
19600         *) dflt="$1" ;;
19601         esac
19602         ;;
19603 *) dflt="$gidtype";;
19604 esac
19605 case "$gidtype" in
19606 gid_t) echo "gid_t found." ;;
19607 *)      rp="What is the type for group ids returned by getgid()?"
19608         . ./myread
19609         gidtype="$ans"
19610         ;;
19611 esac
19612
19613 : Check the size of GID
19614 echo " "
19615 case "$gidtype" in
19616 *_t) zzz="$gidtype"     ;;
19617 *)   zzz="gid"          ;;
19618 esac
19619 echo "Checking the size of $zzz..." >&4
19620 cat > try.c <<EOCP
19621 #include <sys/types.h>
19622 #include <stdio.h>
19623 #$i_stdlib I_STDLIB
19624 #ifdef I_STDLIB
19625 #include <stdlib.h>
19626 #endif
19627 int main() {
19628     printf("%d\n", (int)sizeof($gidtype));
19629     exit(0);
19630 }
19631 EOCP
19632 set try
19633 if eval $compile_ok; then
19634         yyy=`$run ./try`
19635         case "$yyy" in
19636         '')     gidsize=4
19637                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19638                 ;;
19639         *)      gidsize=$yyy
19640                 echo "Your $zzz is $gidsize bytes long."
19641                 ;;
19642         esac
19643 else
19644         gidsize=4
19645         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19646 fi
19647
19648
19649 : Check if GID is signed
19650 echo " "
19651 case "$gidtype" in
19652 *_t) zzz="$gidtype"     ;;
19653 *)   zzz="gid"          ;;
19654 esac
19655 echo "Checking the sign of $zzz..." >&4
19656 cat > try.c <<EOCP
19657 #include <sys/types.h>
19658 #include <stdio.h>
19659 int main() {
19660         $gidtype foo = -1;
19661         if (foo < 0)
19662                 printf("-1\n");
19663         else
19664                 printf("1\n");
19665 }
19666 EOCP
19667 set try
19668 if eval $compile; then
19669         yyy=`$run ./try`
19670         case "$yyy" in
19671         '')     gidsign=1
19672                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19673                 ;;
19674         *)      gidsign=$yyy
19675                 case "$gidsign" in
19676                  1) echo "Your $zzz is unsigned." ;;
19677                 -1) echo "Your $zzz is signed."   ;;
19678                 esac
19679                 ;;
19680         esac
19681 else
19682         gidsign=1
19683         echo "(I can't compile the test program--guessing unsigned.)" >&4
19684 fi
19685
19686
19687 : Check 64bit sizes
19688 echo " "
19689
19690 if $test X"$quadtype" != X; then
19691
19692 echo "Checking how to print 64-bit integers..." >&4
19693
19694 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19695         $cat >try.c <<'EOCP'
19696 #include <sys/types.h>
19697 #include <stdio.h>
19698 int main() {
19699   int q = 12345678901;
19700   printf("%ld\n", q);
19701 }
19702 EOCP
19703         set try
19704         if eval $compile; then
19705                 yyy=`$run ./try`
19706                 case "$yyy" in
19707                 12345678901)
19708                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19709                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19710                         echo "We will use %d."
19711                         ;;
19712                 esac
19713         fi
19714 fi
19715
19716 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19717         $cat >try.c <<'EOCP'
19718 #include <sys/types.h>
19719 #include <stdio.h>
19720 int main() {
19721   long q = 12345678901;
19722   printf("%ld\n", q);
19723 }
19724 EOCP
19725         set try
19726         if eval $compile; then
19727                 yyy=`$run ./try`
19728                 case "$yyy" in
19729                 12345678901)
19730                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19731                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19732                         echo "We will use %ld."
19733                         ;;
19734                 esac
19735         fi
19736 fi
19737
19738 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19739         $cat >try.c <<'EOCP'
19740 #include <sys/types.h>
19741 #include <inttypes.h>
19742 #include <stdio.h>
19743 int main() {
19744   int64_t q = 12345678901;
19745   printf("%" PRId64 "\n", q);
19746 }
19747 EOCP
19748         set try
19749         if eval $compile; then
19750                 yyy=`$run ./try`
19751                 case "$yyy" in
19752                 12345678901)
19753                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19754                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19755                         echo "We will use the C9X style."
19756                         ;;
19757                 esac
19758         fi
19759 fi
19760
19761 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19762         $cat >try.c <<EOCP
19763 #include <sys/types.h>
19764 #include <stdio.h>
19765 int main() {
19766   $quadtype q = 12345678901;
19767   printf("%Ld\n", q);
19768 }
19769 EOCP
19770         set try
19771         if eval $compile; then
19772                 yyy=`$run ./try`
19773                 case "$yyy" in
19774                 12345678901)
19775                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19776                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19777                         echo "We will use %Ld."
19778                         ;;
19779                 esac
19780         fi
19781 fi
19782
19783 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19784         $cat >try.c <<'EOCP'
19785 #include <sys/types.h>
19786 #include <stdio.h>
19787 int main() {
19788   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19789   printf("%lld\n", q);
19790 }
19791 EOCP
19792         set try
19793         if eval $compile; then
19794                 yyy=`$run ./try`
19795                 case "$yyy" in
19796                 12345678901)
19797                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19798                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19799                         echo "We will use the %lld style."
19800                         ;;
19801                 esac
19802         fi
19803 fi
19804
19805 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19806         $cat >try.c <<EOCP
19807 #include <sys/types.h>
19808 #include <stdio.h>
19809 int main() {
19810   $quadtype q = 12345678901;
19811   printf("%qd\n", q);
19812 }
19813 EOCP
19814         set try
19815         if eval $compile; then
19816                 yyy=`$run ./try`
19817                 case "$yyy" in
19818                 12345678901)
19819                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19820                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19821                         echo "We will use %qd."
19822                         ;;
19823                 esac
19824         fi
19825 fi
19826
19827 if $test X"$sPRId64" = X; then
19828         echo "Cannot figure out how to print 64-bit integers." >&4
19829 fi
19830 $rm_try
19831
19832 fi
19833
19834 case "$sPRId64" in
19835 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19836         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19837         ;;
19838 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19839         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19840         ;;
19841 esac
19842
19843 : Check format strings for internal types
19844 echo " "
19845 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19846
19847 if $test X"$ivsize" = X8; then
19848         ivdformat="$sPRId64"
19849         uvuformat="$sPRIu64"
19850         uvoformat="$sPRIo64"
19851         uvxformat="$sPRIx64"
19852         uvXUformat="$sPRIXU64"
19853 else
19854         if $test X"$ivsize" = X"$longsize"; then
19855                 ivdformat='"ld"'
19856                 uvuformat='"lu"'
19857                 uvoformat='"lo"'
19858                 uvxformat='"lx"'
19859                 uvXUformat='"lX"'
19860         else
19861                 if $test X"$ivsize" = X"$intsize"; then
19862                         ivdformat='"d"'
19863                         uvuformat='"u"'
19864                         uvoformat='"o"'
19865                         uvxformat='"x"'
19866                         uvXUformat='"X"'
19867                 else
19868                         : far out
19869                         if $test X"$ivsize" = X"$shortsize"; then
19870                                 ivdformat='"hd"'
19871                                 uvuformat='"hu"'
19872                                 uvoformat='"ho"'
19873                                 uvxformat='"hx"'
19874                                 uvXUformat='"hX"'
19875                         fi
19876                 fi
19877         fi
19878 fi
19879
19880 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19881         nveformat="$sPRIeldbl"
19882         nvfformat="$sPRIfldbl"
19883         nvgformat="$sPRIgldbl"
19884         nvEUformat="$sPRIEUldbl"
19885         nvFUformat="$sPRIFUldbl"
19886         nvGUformat="$sPRIGUldbl"
19887 else
19888         nveformat='"e"'
19889         nvfformat='"f"'
19890         nvgformat='"g"'
19891         nvEUformat='"E"'
19892         nvFUformat='"F"'
19893         nvGUformat='"G"'
19894 fi
19895
19896 case "$ivdformat" in
19897 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19898     exit 1
19899     ;;
19900 esac
19901
19902 : Check format string for GID
19903
19904 echo " "
19905 $echo "Checking the format string to be used for gids..." >&4
19906
19907 case "$gidsign" in
19908 -1)     if $test X"$gidsize" = X"$ivsize"; then
19909                 gidformat="$ivdformat"
19910         else
19911                 if $test X"$gidsize" = X"$longsize"; then
19912                         gidformat='"ld"'
19913                 else
19914                         if $test X"$gidsize" = X"$intsize"; then
19915                                 gidformat='"d"'
19916                         else
19917                                 if $test X"$gidsize" = X"$shortsize"; then
19918                                         gidformat='"hd"'
19919                                 fi
19920                         fi
19921                 fi
19922         fi
19923         ;;
19924 *)      if $test X"$gidsize" = X"$uvsize"; then
19925                 gidformat="$uvuformat"
19926         else
19927                 if $test X"$gidsize" = X"$longsize"; then
19928                         gidformat='"lu"'
19929                 else
19930                         if $test X"$gidsize" = X"$intsize"; then
19931                                 gidformat='"u"'
19932                         else
19933                                 if $test X"$gidsize" = X"$shortsize"; then
19934                                         gidformat='"hu"'
19935                                 fi
19936                         fi
19937                 fi
19938         fi
19939         ;;
19940 esac
19941
19942 : see if getgroups exists
19943 set getgroups d_getgrps
19944 eval $inlibc
19945
19946 : see if setgroups exists
19947 set setgroups d_setgrps
19948 eval $inlibc
19949
19950 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19951 echo " "
19952 case "$d_getgrps$d_setgrps" in
19953 *define*)
19954         case "$groupstype" in
19955         '') dflt="$gidtype" ;;
19956         *)  dflt="$groupstype" ;;
19957         esac
19958         $cat <<EOM
19959 What type of pointer is the second argument to getgroups() and setgroups()?
19960 Usually this is the same as group ids, $gidtype, but not always.
19961
19962 EOM
19963         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19964         . ./myread
19965         groupstype="$ans"
19966         ;;
19967 *)  groupstype="$gidtype";;
19968 esac
19969
19970 : MAD = Misc Attribute Definition
19971
19972 if $test $patchlevel -lt 9; then
19973 : MAD is not available in 5.8.x or earlier.
19974     ans=n;
19975 else
19976     case "$mad" in
19977     $define|true|[yY]*) dflt='y' ;;
19978     *)                  dflt='n' ;;
19979     esac
19980     cat <<EOM
19981
19982 Would you like to build with Misc Attribute Decoration? This is development
19983 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19984 overhead on the interpreter.
19985
19986 If this doesn't make any sense to you, just accept the default '$dflt'.
19987 EOM
19988     rp='Build Perl with MAD?'
19989     . ./myread
19990 fi
19991 case "$ans" in
19992 y|Y)    val="$define"
19993         madlyh='madly.h madly.act madly.tab'
19994         madlysrc='madly.c'
19995         madlyobj="madly$_o" ;;
19996 *)      val="$undef"
19997         madlyh=''
19998         madlysrc=''
19999         madlyobj='' ;;
20000 esac
20001 set mad
20002 eval $setvar
20003
20004 : check whether make sets MAKE
20005 echo " "
20006 echo "Checking if your $make program sets \$(MAKE)..." >&4
20007 case "$make_set_make" in
20008 '')
20009         $sed 's/^X //' > testmake.mak << 'EOF'
20010 Xall:
20011 X       @echo 'maketemp="$(MAKE)"'
20012 EOF
20013         case "`$make -f testmake.mak 2>/dev/null`" in
20014         *maketemp=*) make_set_make='#' ;;
20015         *)      make_set_make="MAKE=$make" ;;
20016         esac
20017         $rm -f testmake.mak
20018         ;;
20019 esac
20020 case "$make_set_make" in
20021 '#') echo "Yup, it does.";;
20022 *) echo "Nope, it doesn't.";;
20023 esac
20024
20025 : see what type is used for mode_t
20026 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20027 set mode_t modetype int stdio.h sys/types.h
20028 eval $typedef_ask
20029
20030 : see if we need va_copy
20031 echo " "
20032 case "$i_stdarg" in
20033 "$define")
20034         $cat >try.c <<EOCP
20035 #include <stdarg.h>
20036 #include <stdio.h>
20037 #$i_stdlib I_STDLIB
20038 #ifdef I_STDLIB
20039 #include <stdlib.h>
20040 #endif
20041 #include <signal.h>
20042
20043 int
20044 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20045 {
20046   return vfprintf(f, fmt, *valp);
20047 }
20048
20049 int
20050 myvfprintf(FILE *f, const  char *fmt, va_list val)
20051 {
20052   return ivfprintf(f, fmt, &val);
20053 }
20054
20055 int
20056 myprintf(char *fmt, ...)
20057 {
20058   va_list val;
20059   va_start(val, fmt);
20060   return myvfprintf(stdout, fmt, val);
20061 }
20062
20063 int
20064 main(int ac, char **av)
20065 {
20066   signal(SIGSEGV, exit);
20067
20068   myprintf("%s%cs all right, then\n", "that", '\'');
20069   exit(0);
20070 }
20071 EOCP
20072         set try
20073         if eval $compile && $run ./try 2>&1 >/dev/null; then
20074                 case "`$run ./try`" in
20075                 "that's all right, then")
20076                         okay=yes
20077                         ;;
20078                 esac
20079         fi
20080         case "$okay" in
20081         yes)    echo "It seems that you don't need va_copy()." >&4
20082                 need_va_copy="$undef"
20083                 ;;
20084         *)      echo "It seems that va_copy() or similar will be needed." >&4
20085                 need_va_copy="$define"
20086                 ;;
20087         esac
20088         $rm_try
20089         ;;
20090 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20091         ;;
20092 esac
20093
20094 : see what type is used for size_t
20095 rp="What is the type used for the length parameter for string functions?"
20096 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20097 eval $typedef_ask
20098
20099 : check for type of arguments to gethostbyaddr. 
20100 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20101         case "$d_gethbyaddr" in
20102         $define)
20103                 $cat <<EOM
20104
20105 Checking to see what type of arguments are accepted by gethostbyaddr().
20106 EOM
20107                 hdrs="$define sys/types.h
20108                         $d_socket sys/socket.h 
20109                         $i_niin netinet/in.h 
20110                         $i_netdb netdb.h
20111                         $i_unistd unistd.h"
20112                 : The first arg can 'char *' or 'void *'
20113                 : The second arg is some of integral type
20114                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20115                         for yyy in size_t long int; do
20116                                 case "$netdb_host_type" in
20117                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20118                                         if ./protochk "$try" $hdrs; then
20119                                                 echo "Your system accepts $xxx for the first arg."
20120                                                 echo "...and $yyy for the second arg."
20121                                                 netdb_host_type="$xxx"
20122                                                 netdb_hlen_type="$yyy"
20123                                         fi
20124                                         ;;
20125                                 esac
20126                         done
20127                 done
20128                 : In case none of those worked, prompt the user.
20129                 case "$netdb_host_type" in
20130                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20131                         dflt='char *'
20132                         . ./myread
20133                         netdb_host_type=$ans
20134                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20135                         dflt="$sizetype"
20136                         . ./myread
20137                         netdb_hlen_type=$ans
20138                         ;;
20139                 esac
20140                 ;;
20141         *)      : no gethostbyaddr, so pick harmless defaults
20142                 netdb_host_type='char *'
20143                 netdb_hlen_type="$sizetype"
20144                 ;;
20145         esac
20146         # Remove the "const" if needed. -- but then we'll have a 
20147         # prototype clash!
20148         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20149 fi
20150
20151 : check for type of argument to gethostbyname. 
20152 if test "X$netdb_name_type" = X ; then
20153         case "$d_gethbyname" in
20154         $define)
20155                 $cat <<EOM
20156
20157 Checking to see what type of argument is accepted by gethostbyname().
20158 EOM
20159                 hdrs="$define sys/types.h
20160                         $d_socket sys/socket.h 
20161                         $i_niin netinet/in.h 
20162                         $i_netdb netdb.h
20163                         $i_unistd unistd.h"
20164                 for xxx in "const char *" "char *"; do
20165                         case "$netdb_name_type" in
20166                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20167                                 if ./protochk "$try" $hdrs; then
20168                                         echo "Your system accepts $xxx."
20169                                         netdb_name_type="$xxx"
20170                                 fi
20171                                 ;;
20172                         esac
20173                 done
20174                 : In case none of those worked, prompt the user.
20175                 case "$netdb_name_type" in
20176                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20177                         dflt='char *'
20178                         . ./myread
20179                         netdb_name_type=$ans
20180                         ;;
20181                 esac
20182                 ;;
20183         *)      : no gethostbyname, so pick harmless default
20184                 netdb_name_type='char *'
20185                 ;;
20186         esac
20187 fi
20188
20189 : check for type of 1st argument to getnetbyaddr. 
20190 if test "X$netdb_net_type" = X ; then
20191         case "$d_getnbyaddr" in
20192         $define)
20193                 $cat <<EOM
20194
20195 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20196 EOM
20197                 hdrs="$define sys/types.h
20198                         $d_socket sys/socket.h 
20199                         $i_niin netinet/in.h 
20200                         $i_netdb netdb.h
20201                         $i_unistd unistd.h"
20202                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20203                         case "$netdb_net_type" in
20204                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20205                                 if ./protochk "$try" $hdrs; then
20206                                         echo "Your system accepts $xxx."
20207                                         netdb_net_type="$xxx"
20208                                 fi
20209                                 ;;
20210                         esac
20211                 done
20212                 : In case none of those worked, prompt the user.
20213                 case "$netdb_net_type" in
20214                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20215                         dflt='long'
20216                         . ./myread
20217                         netdb_net_type=$ans
20218                         ;;
20219                 esac
20220                 ;;
20221         *)      : no getnetbyaddr, so pick harmless default
20222                 netdb_net_type='long'
20223                 ;;
20224         esac
20225 fi
20226 : locate the preferred pager for this system
20227 fn=f/
20228 case "$pager" in
20229 '')
20230         dflt=''
20231         case "$pg" in
20232         /*) dflt=$pg;;
20233         [a-zA-Z]:/*) dflt=$pg;;
20234         esac
20235         case "$more" in
20236         /*) dflt=$more;;
20237         [a-zA-Z]:/*) dflt=$more;;
20238         esac
20239         case "$less" in
20240         /*) dflt=$less;;
20241         [a-zA-Z]:/*) dflt=$less;;
20242         esac
20243         case "$dflt" in
20244         '') dflt=/usr/ucb/more;;
20245         esac
20246         ;;
20247 *)      dflt="$pager"
20248         fn="f/($pager)"
20249         ;;
20250 esac
20251 echo " "
20252 rp='What pager is used on your system?'
20253 . ./getfile
20254 pager="$ans"
20255
20256 : see what type pids are declared as in the kernel
20257 rp="What is the type of process ids on this system?"
20258 set pid_t pidtype int stdio.h sys/types.h
20259 eval $typedef_ask
20260
20261 : see if ar generates random libraries by itself
20262 echo " "
20263 echo "Checking how to generate random libraries on your machine..." >&4
20264 echo 'int bar1() { return bar2(); }' > bar1.c
20265 echo 'int bar2() { return 2; }' > bar2.c
20266 $cat > foo.c <<EOP
20267 #$i_stdlib I_STDLIB
20268 #ifdef I_STDLIB
20269 #include <stdlib.h>
20270 #endif
20271 int main() { printf("%d\n", bar1()); exit(0); }
20272 EOP
20273 $cc $ccflags -c bar1.c >/dev/null 2>&1
20274 $cc $ccflags -c bar2.c >/dev/null 2>&1
20275 $cc $ccflags -c foo.c >/dev/null 2>&1
20276 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20277 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20278         $run ./foobar >/dev/null 2>&1; then
20279         echo "$ar appears to generate random libraries itself."
20280         orderlib=false
20281         if [ "X$ranlib" = "X" ]; then
20282             ranlib=":"
20283         fi
20284 elif $ar s bar$_a >/dev/null 2>&1 &&
20285         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20286         $run ./foobar >/dev/null 2>&1; then
20287                 echo "a table of contents needs to be added with '$ar s'."
20288                 orderlib=false
20289                 ranlib="$ar s"
20290 elif $ar ts bar$_a >/dev/null 2>&1 &&
20291         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20292         $run ./foobar >/dev/null 2>&1; then
20293                 echo "a table of contents needs to be added with '$ar ts'."
20294                 orderlib=false
20295                 ranlib="$ar ts"
20296 else
20297         case "$ranlib" in
20298         :) ranlib='';;
20299         '')
20300                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20301                 $test -f $ranlib || ranlib=''
20302                 ;;
20303         esac
20304         if $test -n "$ranlib"; then
20305                 echo "your system has '$ranlib'; we'll use that."
20306                 orderlib=false
20307         else
20308                 echo "your system doesn't seem to support random libraries"
20309                 echo "so we'll use lorder and tsort to order the libraries."
20310                 orderlib=true
20311                 ranlib=":"
20312         fi
20313 fi
20314 $rm -f foo* bar*
20315
20316 : see if this is a values.h system
20317 set values.h i_values
20318 eval $inhdr
20319
20320 : Check the max offset that gmtime and localtime accept
20321 echo "Checking max offsets that gmtime () accepts"
20322
20323 case $i_values in
20324     define) yyy="#include <values.h>" ;;
20325     *)      yyy="" ;;
20326     esac
20327
20328 case "$sGMTIME_min/$sGMTIME_max" in
20329     0/0|/)
20330         $cat >try.c <<EOCP
20331 #include <sys/types.h>
20332 #include <stdio.h>
20333 #include <time.h>
20334 $yyy
20335
20336 int i;
20337 struct tm *tmp;
20338 time_t pt;
20339
20340 void gm_check (time_t t, int min_year, int max_year)
20341 {
20342     tmp = gmtime (&t);
20343     if ( tmp == NULL ||
20344         /* Check tm_year overflow */
20345          tmp->tm_year < min_year || tmp->tm_year > max_year)
20346         tmp = NULL;
20347     else
20348         pt = t;
20349     } /* gm_check */
20350
20351 int check_max ()
20352 {
20353     tmp = NULL;
20354     pt  = 0;
20355 #ifdef MAXLONG
20356     gm_check (MAXLONG, 69, 0x7fffffff);
20357 #endif
20358     if (tmp == NULL || tmp->tm_year < 0) {
20359         for (i = 63; i >= 0; i--) {
20360             time_t x = pt | ((time_t)1 << i);
20361             if (x < 0 || x < pt) continue;
20362             gm_check (x, 69, 0x7fffffff);
20363             }
20364         }
20365     printf ("sGMTIME_max=%ld\n", pt);
20366     return (0);
20367     } /* check_max */
20368
20369 int check_min ()
20370 {
20371     tmp = NULL;
20372     pt  = 0;
20373 #ifdef MINLONG
20374     gm_check (MINLONG, -1900, 70);
20375 #endif
20376     if (tmp == NULL) {
20377         for (i = 36; i >= 0; i--) {
20378             time_t x = pt - ((time_t)1 << i);
20379             if (x > 0) continue;
20380             gm_check (x, -1900, 70);
20381             }
20382         }
20383     printf ("sGMTIME_min=%ld\n", pt);
20384     return (0);
20385     } /* check_min */
20386
20387 int main (int argc, char *argv[])
20388 {
20389     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20390     check_max ();
20391     check_min ();
20392     return (0);
20393     } /* main */
20394 EOCP
20395         set try
20396         if eval $compile; then
20397             eval `$run ./try`
20398         else
20399             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20400             fi
20401         $rm_try
20402         ;;
20403     esac
20404
20405 echo "Checking max offsets that localtime () accepts"
20406
20407 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20408     0/0|/)
20409         $cat >try.c <<EOCP
20410 #include <sys/types.h>
20411 #include <stdio.h>
20412 #include <time.h>
20413 $yyy
20414
20415 int i;
20416 struct tm *tmp;
20417 time_t pt;
20418
20419 void local_check (time_t t, int min_year, int max_year)
20420 {
20421     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20422         tmp = NULL;
20423     else
20424         tmp = localtime (&t);
20425     if ( tmp == NULL ||
20426         /* Check tm_year overflow */
20427          tmp->tm_year < min_year || tmp->tm_year > max_year)
20428         tmp = NULL;
20429     else
20430         pt = t;
20431     } /* local_check */
20432
20433 int check_max ()
20434 {
20435     tmp = NULL;
20436     pt  = 0;
20437 #ifdef MAXLONG
20438     local_check (MAXLONG, 69, 0x7fffffff);
20439 #endif
20440     if (tmp == NULL || tmp->tm_year < 0) {
20441         for (i = 63; i >= 0; i--) {
20442             time_t x = pt | ((time_t)1 << i);
20443             if (x < 0 || x < pt) continue;
20444             local_check (x, 69, 0x7fffffff);
20445             }
20446         }
20447     printf ("sLOCALTIME_max=%ld\n", pt);
20448     return (0);
20449    } /* check_max */
20450
20451 int check_min ()
20452 {
20453     tmp = NULL;
20454     pt  = 0;
20455 #ifdef MINLONG
20456     local_check (MINLONG, -1900, 70);
20457 #endif
20458     if (tmp == NULL) {
20459         for (i = 36; i >= 0; i--) {
20460             time_t x = pt - ((time_t)1 << i);
20461             if (x > 0) continue;
20462             local_check (x, -1900, 70);
20463             }
20464         }
20465     printf ("sLOCALTIME_min=%ld\n", pt);
20466     return (0);
20467     } /* check_min */
20468
20469 int main (int argc, char *argv[])
20470 {
20471     check_max ();
20472     check_min ();
20473     return (0);
20474     } /* main */
20475 EOCP
20476         set try
20477         if eval $compile; then
20478             eval `$run ./try`
20479         else
20480             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20481             fi
20482         $rm_try
20483         ;;
20484     esac
20485
20486 : check for type of arguments to select.
20487 case "$selecttype" in
20488 '') case "$d_select" in
20489         $define)
20490                 echo " "
20491                 $cat <<EOM
20492 Checking to see what type of arguments are accepted by select().
20493 EOM
20494                 hdrs="$define sys/types.h
20495                         $i_systime sys/time.h
20496                         $i_sysselct sys/select.h
20497                         $d_socket sys/socket.h"
20498                 : The first arg can be int, unsigned, or size_t
20499                 : The last arg may or may not be 'const'
20500                 val=''
20501                 : void pointer has been seen but using that
20502                 : breaks the selectminbits test
20503                 for xxx in 'fd_set *' 'int *'; do
20504                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20505                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20506                                         case "$val" in
20507                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20508                                                 if ./protochk "$try" $hdrs; then
20509                                                         echo "Your system accepts $xxx."
20510                                                         val="$xxx"
20511                                                 fi
20512                                                 ;;
20513                                         esac
20514                                 done
20515                         done
20516                 done
20517                 case "$val" in
20518                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20519                         case "$d_fd_set" in
20520                                 $define) dflt="fd_set *" ;;
20521                                 *)              dflt="int *" ;;
20522                         esac
20523                         . ./myread
20524                         val=$ans
20525                         ;;
20526                 esac
20527                 selecttype="$val"
20528                 ;;
20529         *)      : no select, so pick a harmless default
20530                 selecttype='int *'
20531                 ;;
20532         esac
20533         ;;
20534 esac
20535
20536 : check for the select 'width'
20537 case "$selectminbits" in
20538 '') safebits=`expr $ptrsize \* 8`
20539     case "$d_select" in
20540         $define)
20541                 $cat <<EOM
20542
20543 Checking to see on how many bits at a time your select() operates...
20544 EOM
20545                 $cat >try.c <<EOCP
20546 #include <sys/types.h>
20547 #$i_time I_TIME
20548 #$i_systime I_SYS_TIME
20549 #$i_systimek I_SYS_TIME_KERNEL
20550 #ifdef I_TIME
20551 #   include <time.h>
20552 #endif
20553 #ifdef I_SYS_TIME
20554 #   ifdef I_SYS_TIME_KERNEL
20555 #       define KERNEL
20556 #   endif
20557 #   include <sys/time.h>
20558 #   ifdef I_SYS_TIME_KERNEL
20559 #       undef KERNEL
20560 #   endif
20561 #endif
20562 #$i_sysselct I_SYS_SELECT
20563 #ifdef I_SYS_SELECT
20564 #include <sys/select.h>
20565 #endif
20566 #$d_socket HAS_SOCKET
20567 #ifdef HAS_SOCKET
20568 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20569 #endif
20570 #include <stdio.h>
20571 #$i_stdlib I_STDLIB
20572 #ifdef I_STDLIB
20573 #include <stdlib.h>
20574 #endif
20575 $selecttype b;
20576 #define S sizeof(*(b))
20577 #define MINBITS 64
20578 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20579 #define NBITS  (NBYTES * 8)
20580 int main() {
20581     char *s = (char *)malloc(NBYTES);
20582     struct timeval t;
20583     int i;
20584     FILE* fp;
20585     int fd;
20586
20587     if (!s)
20588         exit(1);
20589     fclose(stdin);
20590     fp = fopen("try.c", "r");
20591     if (fp == 0)
20592       exit(2);
20593     fd = fileno(fp);
20594     if (fd < 0)
20595       exit(3);
20596     b = ($selecttype)s;
20597     for (i = 0; i < NBITS; i++)
20598         FD_SET(i, b);
20599     t.tv_sec  = 0;
20600     t.tv_usec = 0;
20601     select(fd + 1, b, 0, 0, &t);
20602     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20603     free(s);
20604     printf("%d\n", i + 1);
20605     return 0;
20606 }
20607 EOCP
20608                 set try
20609                 if eval $compile_ok; then
20610                         selectminbits=`$run ./try`
20611                         case "$selectminbits" in
20612                         '')     cat >&4 <<EOM
20613 Cannot figure out on how many bits at a time your select() operates.
20614 I'll play safe and guess it is $safebits bits.
20615 EOM
20616                                 selectminbits=$safebits
20617                                 bits="$safebits bits"
20618                                 ;;
20619                         1)      bits="1 bit" ;;
20620                         *)      bits="$selectminbits bits" ;;
20621                         esac
20622                         echo "Your select() operates on $bits at a time." >&4
20623                 else
20624                         rp='What is the minimum number of bits your select() operates on?'
20625                         case "$byteorder" in
20626                         12345678)       dflt=64 ;;
20627                         1234)           dflt=32 ;;
20628                         *)              dflt=1  ;;
20629                         esac
20630                         . ./myread
20631                         val=$ans
20632                         selectminbits="$val"
20633                 fi
20634                 $rm_try
20635                 ;;
20636         *)      : no select, so pick a harmless default
20637                 selectminbits=$safebits
20638                 ;;
20639         esac
20640         ;;
20641 esac
20642
20643 : Trace out the files included by signal.h, then look for SIGxxx names.
20644 if [ "X$fieldn" = X ]; then
20645         : Just make some guesses.  We check them later.
20646         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20647 else
20648         xxx=`echo '#include <signal.h>' |
20649         $cppstdin $cppminus $cppflags 2>/dev/null |
20650         $grep '^[       ]*#.*include' |
20651         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20652                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20653 fi
20654 xxxfiles=''
20655 for xx in $xxx /dev/null ; do
20656         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20657 done
20658 case "$xxxfiles" in
20659 '')     xxxfiles=`./findhdr signal.h` ;;
20660 esac
20661 xxx=`awk '
20662 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20663         print substr($2, 4, 20)
20664 }
20665 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20666         print substr($3, 4, 20)
20667 }' $xxxfiles`
20668 : Append some common names just in case the awk scan failed.
20669 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20670 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20671 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20672 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20673 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20674
20675 : generate a few handy files for later
20676 $cat > signal.c <<EOCP
20677 #include <sys/types.h>
20678 #include <signal.h>
20679 #$i_stdlib I_STDLIB
20680 #ifdef I_STDLIB
20681 #include <stdlib.h>
20682 #endif
20683 #include <stdio.h>
20684 int main() {
20685
20686 /* Strange style to avoid deeply-nested #if/#else/#endif */
20687 #ifndef NSIG
20688 #  ifdef _NSIG
20689 #    define NSIG (_NSIG)
20690 #  endif
20691 #endif
20692
20693 #ifndef NSIG
20694 #  ifdef SIGMAX
20695 #    define NSIG (SIGMAX+1)
20696 #  endif
20697 #endif
20698
20699 #ifndef NSIG
20700 #  ifdef SIG_MAX
20701 #    define NSIG (SIG_MAX+1)
20702 #  endif
20703 #endif
20704
20705 #ifndef NSIG
20706 #  ifdef _SIG_MAX
20707 #    define NSIG (_SIG_MAX+1)
20708 #  endif
20709 #endif
20710
20711 #ifndef NSIG
20712 #  ifdef MAXSIG
20713 #    define NSIG (MAXSIG+1)
20714 #  endif
20715 #endif
20716
20717 #ifndef NSIG
20718 #  ifdef MAX_SIG
20719 #    define NSIG (MAX_SIG+1)
20720 #  endif
20721 #endif
20722
20723 #ifndef NSIG
20724 #  ifdef SIGARRAYSIZE
20725 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20726 #  endif
20727 #endif
20728
20729 #ifndef NSIG
20730 #  ifdef _sys_nsig
20731 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20732 #  endif
20733 #endif
20734
20735 /* Default to some arbitrary number that's big enough to get most
20736    of the common signals.
20737 */
20738 #ifndef NSIG
20739 #    define NSIG 50
20740 #endif
20741
20742 printf("NSIG %d\n", NSIG);
20743
20744 #ifndef JUST_NSIG
20745
20746 EOCP
20747
20748 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20749 {
20750         printf "#ifdef SIG"; printf $1; printf "\n"
20751         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20752         printf $1; printf ");\n"
20753         printf "#endif\n"
20754 }
20755 END {
20756         printf "#endif /* JUST_NSIG */\n";
20757         printf "exit(0);\n}\n";
20758 }
20759 ' >>signal.c
20760 $cat >signal.awk <<'EOP'
20761 BEGIN { ndups = 0 }
20762 $1 ~ /^NSIG$/ { nsig = $2 }
20763 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20764     if ($2 > maxsig) { maxsig = $2 }
20765     if (sig_name[$2]) {
20766         dup_name[ndups] = $1
20767         dup_num[ndups] = $2
20768         ndups++
20769     }
20770     else {
20771         sig_name[$2] = $1
20772         sig_num[$2] = $2
20773     }
20774 }
20775 END {
20776     if (nsig == 0) {
20777         nsig = maxsig + 1
20778     }
20779     printf("NSIG %d\n", nsig);
20780     for (n = 1; n < nsig; n++) {
20781         if (sig_name[n]) {
20782             printf("%s %d\n", sig_name[n], sig_num[n])
20783         }
20784         else {
20785             printf("NUM%d %d\n", n, n)
20786         }
20787     }
20788     for (n = 0; n < ndups; n++) {
20789         printf("%s %d\n", dup_name[n], dup_num[n])
20790     }
20791 }
20792 EOP
20793 $cat >signal_cmd <<EOS
20794 $startsh
20795 if $test -s signal.lst; then
20796     echo "Using your existing signal.lst file"
20797         exit 0
20798 fi
20799 xxx="$xxx"
20800 EOS
20801 $cat >>signal_cmd <<'EOS'
20802
20803 set signal
20804 if eval $compile_ok; then
20805         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20806                 $uniq | $awk -f signal.awk >signal.lst
20807 else
20808         echo "(I can't seem be able to compile the whole test program)" >&4
20809         echo "(I'll try it in little pieces.)" >&4
20810         set signal -DJUST_NSIG
20811         if eval $compile_ok; then
20812                 $run ./signal$_exe > signal.nsg
20813                 $cat signal.nsg
20814         else
20815                 echo "I can't seem to figure out how many signals you have." >&4
20816                 echo "Guessing 50." >&4
20817                 echo 'NSIG 50' > signal.nsg
20818         fi
20819         : Now look at all the signal names, one at a time.
20820         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20821                 $cat > signal.c <<EOCP
20822 #include <sys/types.h>
20823 #include <signal.h>
20824 #include <stdio.h>
20825 int main() {
20826 printf("$xx %d\n", SIG${xx});
20827 return 0;
20828 }
20829 EOCP
20830                 set signal
20831                 if eval $compile; then
20832                         echo "SIG${xx} found."
20833                         $run ./signal$_exe  >> signal.ls1
20834                 else
20835                         echo "SIG${xx} NOT found."
20836                 fi
20837         done
20838         if $test -s signal.ls1; then
20839                 $cat signal.nsg signal.ls1 |
20840                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20841         fi
20842
20843 fi
20844 if $test -s signal.lst; then
20845         :
20846 else
20847         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20848         echo 'kill -l' >signal
20849         set X `csh -f <signal`
20850         $rm -f signal
20851         shift
20852         case $# in
20853         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20854         esac
20855         echo $@ | $tr ' ' $trnl | \
20856             $awk '{ printf "%s %d\n", $1, ++s; }
20857                   END { printf "NSIG %d\n", ++s }' >signal.lst
20858 fi
20859 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20860 EOS
20861 chmod a+x signal_cmd
20862 $eunicefix signal_cmd
20863
20864 : generate list of signal names
20865 echo " "
20866 case "$sig_name_init" in
20867 '') doinit=yes ;;
20868 *)  case "$sig_num_init" in
20869     ''|*,*) doinit=yes ;;
20870     esac ;;
20871 esac
20872 case "$doinit" in
20873 yes)
20874         echo "Generating a list of signal names and numbers..." >&4
20875         . ./signal_cmd
20876         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20877         sig_name=`$awk 'BEGIN { printf "ZERO " }
20878                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20879         sig_num=`$awk  'BEGIN { printf "0 " }
20880                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20881         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20882                              !/^NSIG/   { printf "\"%s\", ", $1 }
20883                              END        { printf "0\n" }' signal.lst`
20884         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20885                              !/^NSIG/   { printf "%d, ", $2}
20886                              END        { printf "0\n"}' signal.lst`
20887         ;;
20888 esac
20889 echo "The following $sig_count signals are available:"
20890 echo " "
20891 echo $sig_name | $awk \
20892 'BEGIN { linelen = 0 }
20893 {
20894         for (i = 1; i <= NF; i++) {
20895                 name = "SIG" $i " "
20896                 linelen = linelen + length(name)
20897                 if (linelen > 70) {
20898                         printf "\n"
20899                         linelen = length(name)
20900                 }
20901                 printf "%s", name
20902         }
20903         printf "\n"
20904 }'
20905 sig_size=`echo $sig_name | awk '{print NF}'`
20906 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20907
20908 : Check size of size
20909 echo " "
20910 case "$sizetype" in
20911 *_t) zzz="$sizetype"    ;;
20912 *)   zzz="filesize"     ;;
20913 esac
20914 echo "Checking the size of $zzz..." >&4
20915 cat > try.c <<EOCP
20916 #include <sys/types.h>
20917 #include <stdio.h>
20918 #$i_stdlib I_STDLIB
20919 #ifdef I_STDLIB
20920 #include <stdlib.h>
20921 #endif
20922 int main() {
20923     printf("%d\n", (int)sizeof($sizetype));
20924     exit(0);
20925 }
20926 EOCP
20927 set try
20928 if eval $compile_ok; then
20929         yyy=`$run ./try`
20930         case "$yyy" in
20931         '')     sizesize=4
20932                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20933                 ;;
20934         *)      sizesize=$yyy
20935                 echo "Your $zzz size is $sizesize bytes."
20936                 ;;
20937         esac
20938 else
20939         sizesize=4
20940         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20941 fi
20942
20943
20944 : check for socklen_t
20945 echo " "
20946 echo "Checking to see if you have socklen_t..." >&4
20947 $cat >try.c <<EOCP
20948 #include <sys/types.h>
20949 #$d_socket HAS_SOCKET
20950 #ifdef HAS_SOCKET
20951 #include <sys/socket.h>
20952 #endif
20953 int main() { socklen_t x = 16; }
20954 EOCP
20955 set try
20956 if eval $compile; then
20957         val="$define"
20958         echo "You have socklen_t."
20959 else
20960         val="$undef"
20961         echo "You do not have socklen_t."
20962         case "$sizetype" in
20963         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20964         esac
20965 fi
20966 $rm_try
20967 set d_socklen_t
20968 eval $setvar
20969
20970 : see if this is a socks.h system
20971 set socks.h i_socks
20972 eval $inhdr
20973
20974 : check for type of the size argument to socket calls
20975 case "$d_socket" in
20976 "$define")
20977         $cat <<EOM
20978
20979 Checking to see what type is the last argument of accept().
20980 EOM
20981         yyy=''
20982         case "$d_socklen_t" in
20983         "$define") yyy="$yyy socklen_t"
20984         esac
20985         yyy="$yyy $sizetype int long unsigned"
20986         for xxx in $yyy; do
20987                 case "$socksizetype" in
20988                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20989                         case "$usesocks" in
20990                         "$define")
20991                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20992                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20993                                         socksizetype="$xxx"
20994                                 fi
20995                                 ;;
20996                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20997                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20998                                         socksizetype="$xxx"
20999                                 fi
21000                                 ;;
21001                         esac
21002                         ;;
21003                 esac
21004         done
21005 : In case none of those worked, prompt the user.
21006         case "$socksizetype" in
21007         '')     rp='What is the type for socket address structure sizes?'
21008                 dflt='int'
21009                 . ./myread
21010                 socksizetype=$ans
21011                 ;;
21012         esac
21013         ;;
21014 *)      : no sockets, so pick relatively harmless default
21015         socksizetype='int'
21016         ;;
21017 esac
21018
21019 : see what type is used for signed size_t
21020 set ssize_t ssizetype int stdio.h sys/types.h
21021 eval $typedef
21022 dflt="$ssizetype"
21023 $cat > try.c <<EOM
21024 #include <stdio.h>
21025 #$i_stdlib I_STDLIB
21026 #ifdef I_STDLIB
21027 #include <stdlib.h>
21028 #endif
21029 #include <sys/types.h>
21030 #define Size_t $sizetype
21031 #define SSize_t $dflt
21032 int main()
21033 {
21034         if (sizeof(Size_t) == sizeof(SSize_t))
21035                 printf("$dflt\n");
21036         else if (sizeof(Size_t) == sizeof(int))
21037                 printf("int\n");
21038         else
21039                 printf("long\n");
21040         exit(0);
21041 }
21042 EOM
21043 echo " "
21044 set try
21045 if eval $compile_ok && $run ./try > /dev/null; then
21046         ssizetype=`$run ./try`
21047         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21048 else
21049         $cat >&4 <<EOM
21050 Help! I can't compile and run the ssize_t test program: please enlighten me!
21051 (This is probably a misconfiguration in your system or libraries, and
21052 you really ought to fix it.  Still, I'll try anyway.)
21053
21054 I need a type that is the same size as $sizetype, but is guaranteed to
21055 be signed.  Common values are ssize_t, int and long.
21056
21057 EOM
21058         rp="What signed type is the same size as $sizetype?"
21059         . ./myread
21060         ssizetype="$ans"
21061 fi
21062 $rm_try
21063
21064 : see what type of char stdio uses.
21065 echo " "
21066 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21067 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21068         echo "Your stdio uses unsigned chars." >&4
21069         stdchar="unsigned char"
21070 else
21071         echo "Your stdio uses signed chars." >&4
21072         stdchar="char"
21073 fi
21074 $rm -f stdioh
21075
21076 : see what type uids are declared as in the kernel
21077 echo " "
21078 echo "Looking for the type for user ids returned by getuid()."
21079 set uid_t uidtype xxx stdio.h sys/types.h
21080 eval $typedef
21081 case "$uidtype" in
21082 xxx)
21083         xxx=`./findhdr sys/user.h`
21084         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21085         case $1 in
21086         unsigned) dflt="$1 $2" ;;
21087         *) dflt="$1" ;;
21088         esac
21089         ;;
21090 *) dflt="$uidtype";;
21091 esac
21092 case "$uidtype" in
21093 uid_t)  echo "uid_t found." ;;
21094 *)      rp="What is the type for user ids returned by getuid()?"
21095         . ./myread
21096         uidtype="$ans"
21097         ;;
21098 esac
21099
21100 : Check size of UID
21101 echo " "
21102 case "$uidtype" in
21103 *_t) zzz="$uidtype"     ;;
21104 *)   zzz="uid"          ;;
21105 esac
21106 echo "Checking the size of $zzz..." >&4
21107 cat > try.c <<EOCP
21108 #include <sys/types.h>
21109 #include <stdio.h>
21110 #$i_stdlib I_STDLIB
21111 #ifdef I_STDLIB
21112 #include <stdlib.h>
21113 #endif
21114 int main() {
21115     printf("%d\n", (int)sizeof($uidtype));
21116     exit(0);
21117 }
21118 EOCP
21119 set try
21120 if eval $compile_ok; then
21121         yyy=`$run ./try`
21122         case "$yyy" in
21123         '')     uidsize=4
21124                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21125                 ;;
21126         *)      uidsize=$yyy
21127                 echo "Your $zzz is $uidsize bytes long."
21128                 ;;
21129         esac
21130 else
21131         uidsize=4
21132         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21133 fi
21134
21135 : Check if UID is signed
21136 echo " "
21137 case "$uidtype" in
21138 *_t) zzz="$uidtype"     ;;
21139 *)   zzz="uid"          ;;
21140 esac
21141 echo "Checking the sign of $zzz..." >&4
21142 cat > try.c <<EOCP
21143 #include <sys/types.h>
21144 #include <stdio.h>
21145 int main() {
21146         $uidtype foo = -1;
21147         if (foo < 0)
21148                 printf("-1\n");
21149         else
21150                 printf("1\n");
21151 }
21152 EOCP
21153 set try
21154 if eval $compile; then
21155         yyy=`$run ./try`
21156         case "$yyy" in
21157         '')     uidsign=1
21158                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21159                 ;;
21160         *)      uidsign=$yyy
21161                 case "$uidsign" in
21162                  1) echo "Your $zzz is unsigned." ;;
21163                 -1) echo "Your $zzz is signed."   ;;
21164                 esac
21165                 ;;
21166         esac
21167 else
21168         uidsign=1
21169         echo "(I can't compile the test program--guessing unsigned.)" >&4
21170 fi
21171
21172
21173 : Check format string for UID
21174 echo " "
21175 $echo "Checking the format string to be used for uids..." >&4
21176
21177 case "$uidsign" in
21178 -1)     if $test X"$uidsize" = X"$ivsize"; then
21179                 uidformat="$ivdformat"
21180         else
21181                 if $test X"$uidsize" = X"$longsize"; then
21182                         uidformat='"ld"'
21183                 else
21184                         if $test X"$uidsize" = X"$intsize"; then
21185                                 uidformat='"d"'
21186                         else
21187                                 if $test X"$uidsize" = X"$shortsize"; then
21188                                         uidformat='"hd"'
21189                                 fi
21190                         fi
21191                 fi
21192         fi
21193         ;;
21194 *)      if $test X"$uidsize" = X"$uvsize"; then
21195                 uidformat="$uvuformat"
21196         else
21197                 if $test X"$uidsize" = X"$longsize"; then
21198                         uidformat='"lu"'
21199                 else
21200                         if $test X"$uidsize" = X"$intsize"; then
21201                                 uidformat='"u"'
21202                         else
21203                                 if $test X"$uidsize" = X"$shortsize"; then
21204                                         uidformat='"hu"'
21205                                 fi
21206                         fi
21207                 fi
21208         fi
21209         ;;
21210 esac
21211
21212 : Check if site customization support was requested
21213 case "$usesitecustomize" in
21214     $define|true|[Yy]*)
21215         usesitecustomize="$define"
21216         ;;
21217     *)
21218         usesitecustomize="$undef"
21219         ;;
21220     esac
21221
21222 : see if prototypes support variable argument declarations
21223 echo " "
21224 case "$prototype$i_stdarg" in
21225 $define$define)
21226         echo "It appears we'll be able to prototype varargs functions." >&4
21227         val="$define"
21228         ;;
21229 *)
21230         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21231         val="$undef"
21232         ;;
21233 esac
21234 set vaproto
21235 eval $setvar
21236
21237 : determine compiler compiler
21238 case "$yacc" in
21239 '')
21240         dflt=yacc;;
21241 *)
21242         dflt="$yacc";;
21243 esac
21244 echo " "
21245 comp='yacc'
21246 if $test -f "$byacc$_exe"; then
21247         dflt="$byacc"
21248         comp="byacc or $comp"
21249 fi
21250 if $test -f "$bison$_exe"; then
21251         comp="$comp or bison -y"
21252 fi
21253 rp="Which compiler compiler ($comp) shall I use?"
21254 . ./myread
21255 yacc="$ans"
21256 case "$yacc" in
21257 *bis*)
21258         case "$yacc" in
21259         *-y*) ;;
21260         *)
21261                 yacc="$yacc -y"
21262                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21263                 ;;
21264         esac
21265         ;;
21266 esac
21267
21268 : see if this is a assert.h system
21269 set assert.h i_assert
21270 eval $inhdr
21271
21272 : see if this is a fp.h system
21273 set fp.h i_fp
21274 eval $inhdr
21275
21276 : see if this is a fp_class.h system
21277 set fp_class.h i_fp_class
21278 eval $inhdr
21279
21280 : see if gdbm.h is available
21281 set gdbm.h t_gdbm
21282 eval $inhdr
21283 case "$t_gdbm" in
21284 $define)
21285         : see if gdbm_open exists
21286         set gdbm_open d_gdbm_open
21287         eval $inlibc
21288         case "$d_gdbm_open" in
21289         $undef)
21290                 t_gdbm="$undef"
21291                 echo "We won't be including <gdbm.h>"
21292                 ;;
21293         esac
21294         ;;
21295 esac
21296 val="$t_gdbm"
21297 set i_gdbm
21298 eval $setvar
21299
21300 : see if this is a ieeefp.h system
21301 case "$i_ieeefp" in
21302 '' ) set ieeefp.h i_ieeefp
21303      eval $inhdr
21304      ;;
21305 esac
21306
21307 : see if this is a libutil.h system
21308 set libutil.h i_libutil
21309 eval $inhdr
21310
21311 : see if mach cthreads are available
21312 if test "X$usethreads" = "X$define"; then
21313         set mach/cthreads.h i_machcthr
21314         eval $inhdr
21315 else
21316         i_machcthr="$undef"
21317 fi
21318
21319 : see if this is a mntent.h system
21320 set mntent.h i_mntent
21321 eval $inhdr
21322
21323 : see if net/errno.h is available
21324 val=''
21325 set net/errno.h val
21326 eval $inhdr
21327
21328 : Unfortunately, it causes problems on some systems.  Arrgh.
21329 case "$val" in
21330 $define)
21331         cat > try.c <<'EOM'
21332 #include <stdio.h>
21333 #include <errno.h>
21334 #include <net/errno.h>
21335 int func()
21336 {
21337         return ENOTSOCK;
21338 }
21339 EOM
21340         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21341                 echo "We'll be including <net/errno.h>." >&4
21342         else
21343                 echo "We won't be including <net/errno.h>." >&4
21344                 val="$undef"
21345         fi
21346         $rm_try
21347         ;;
21348 esac
21349 set i_neterrno
21350 eval $setvar
21351
21352 : see if netinet/tcp.h is available
21353 set netinet/tcp.h i_netinettcp
21354 eval $inhdr
21355
21356 : see if this is a poll.h system
21357 set poll.h i_poll
21358 eval $inhdr
21359
21360 : see if this is a prot.h system
21361 set prot.h i_prot
21362 eval $inhdr
21363
21364 : Preprocessor symbols
21365 echo " "
21366 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21367 $cat <<'EOSH' > Cppsym.know
21368 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21369 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21370 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21371 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21372 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21373 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21374 bull c cadmus clipper CMU COFF COMPILER_VERSION
21375 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21376 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21377 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21378 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21379 GLIBC GLIBC_MINOR
21380 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21381 H3050R H3050RX hbullx20 hcx host_mips
21382 hp200 hp300 hp700 HP700 hp800 hp9000
21383 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21384 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21385 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21386 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21387 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21388 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21389 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21390 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21391 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21392 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21393 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21394 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21395 MATH_HAS_NO_SIDE_EFFECTS
21396 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21397 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21398 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21399 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21400 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21401 NetBSD news1500 news1700 news1800 news1900 news3700
21402 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21403 ns32016 ns32332 ns32k nsc32000
21404 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21405 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21406 pc532 pdp11 PGC PIC plexus PORTAR posix
21407 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21408 POSIX_C_SOURCE POSIX_SOURCE POWER
21409 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21410 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21411 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21412 sony sony_news sonyrisc sparc sparclite spectrum
21413 stardent stdc STDC_EXT stratos sun sun3 sun386
21414 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21415 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21416 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21417 sysV68 sysV88 Tek4132 Tek4300 titan
21418 TM3200 TM5400 TM5600
21419 tower tower32 tower32_200 tower32_600 tower32_700
21420 tower32_800 tower32_850 tss
21421 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21422 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21423 unix UNIX95 UNIX99 unixpc unos
21424 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21425 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21426 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21427 USGr4 USGr4_2
21428 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21429 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21430 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21431 z8000
21432 EOSH
21433 # Maybe put other stuff here too.
21434 cat <<EOSH >>Cppsym.know
21435 $osname
21436 EOSH
21437 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21438 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21439 $cat Cppsym.know > Cppsym.c
21440 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21441 $rm -f Cppsym.a Cppsym.b Cppsym.c
21442 cat <<EOSH > Cppsym
21443 $startsh
21444 if $test \$# -gt 0; then
21445     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21446     if $test -s Cppsym.got; then
21447         $rm -f Cppsym.got
21448         exit 0
21449     fi
21450     $rm -f Cppsym.got
21451     exit 1
21452 else
21453     $tr " " "$trnl" | ./Cppsym.try
21454     exit 0
21455 fi
21456 EOSH
21457 chmod +x Cppsym
21458 $eunicefix Cppsym
21459 cat <<EOSH > Cppsym.try
21460 $startsh
21461 cat <<'EOCP' > try.c
21462 #include <stdio.h>
21463 #if cpp_stuff == 1
21464 #define STRINGIFY(a)    "a"
21465 #endif
21466 #if cpp_stuff == 42
21467 #define StGiFy(a)  #a
21468 #define STRINGIFY(a)    StGiFy(a)
21469 #endif
21470 #if $cpp_stuff != 1 && $cpp_stuff != 42
21471 #   include "Bletch: How does this C preprocessor stringify macros?"
21472 #endif
21473 int main() {
21474 EOCP
21475 $awk \\
21476 EOSH
21477 cat <<'EOSH' >> Cppsym.try
21478 'length($1) > 0 {
21479     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21480     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21481     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21482     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21483 }'       >> try.c
21484 echo 'return 0;}' >> try.c
21485 EOSH
21486 cat <<EOSH >> Cppsym.try
21487 ccflags="$ccflags"
21488 case "$osname-$gccversion" in
21489 irix-) ccflags="\$ccflags -woff 1178" ;;
21490 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21491 esac
21492 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21493 EOSH
21494 chmod +x Cppsym.try
21495 $eunicefix Cppsym.try
21496 ./Cppsym < Cppsym.know > Cppsym.true
21497 : Add in any linux cpp "predefined macros":
21498 case "$osname::$gccversion" in
21499   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21500     tHdrH=_tmpHdr
21501     rm -f $tHdrH'.h' $tHdrH
21502     touch $tHdrH'.h'
21503     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21504        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21505        if [ -s $tHdrH'_cppsym.real' ]; then
21506           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21507        fi
21508     fi
21509     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21510   ;;
21511 esac
21512 : now check the C compiler for additional symbols
21513 postprocess_cc_v=''
21514 case "$osname" in
21515 aix) postprocess_cc_v="|$tr , ' '" ;;
21516 esac
21517 $cat >ccsym <<EOS
21518 $startsh
21519 $cat >tmp.c <<EOF
21520 extern int foo;
21521 EOF
21522 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21523 do
21524         case "\$i" in
21525         -D*) echo "\$i" | $sed 's/^-D//';;
21526         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21527         esac
21528 done
21529 $rm_try
21530 EOS
21531 postprocess_cc_v=''
21532 chmod +x ccsym
21533 $eunicefix ccsym
21534 ./ccsym > ccsym1.raw
21535 if $test -s ccsym1.raw; then
21536        $sort ccsym1.raw | $uniq >ccsym.raw
21537 else
21538        mv ccsym1.raw ccsym.raw
21539 fi
21540
21541 $awk '/\=/ { print $0; next }
21542         { print $0"=1" }' ccsym.raw >ccsym.list
21543 $comm -13 Cppsym.true ccsym.list >ccsym.own
21544 $comm -12 Cppsym.true ccsym.list >ccsym.com
21545 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21546 also=''
21547 if $test -z ccsym.raw; then
21548         echo "Your C compiler doesn't seem to define any symbols!" >&4
21549         echo " "
21550         echo "However, your C preprocessor defines the following symbols:"
21551         $cat Cppsym.true
21552         ccsymbols=''
21553         cppsymbols=`$cat Cppsym.true`
21554         cppsymbols=`echo $cppsymbols`
21555         cppccsymbols="$cppsymbols"
21556 else
21557         if $test -s ccsym.com; then
21558                 echo "Your C compiler and pre-processor define these symbols:"
21559                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21560                 also='also '
21561                 symbols='ones'
21562                 cppccsymbols=`$cat ccsym.com`
21563                 cppccsymbols=`echo $cppccsymbols`
21564                 $test "$silent" || sleep 1
21565         fi
21566         if $test -s ccsym.cpp; then
21567                 $test "$also" && echo " "
21568                 echo "Your C pre-processor ${also}defines the following symbols:"
21569                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21570                 also='further '
21571                 cppsymbols=`$cat ccsym.cpp`
21572                 cppsymbols=`echo $cppsymbols`
21573                 $test "$silent" || sleep 1
21574         fi
21575         if $test -s ccsym.own; then
21576                 $test "$also" && echo " "
21577                 echo "Your C compiler ${also}defines the following cpp symbols:"
21578                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21579                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21580                 ccsymbols=`$cat ccsym.own`
21581                 ccsymbols=`echo $ccsymbols`
21582                 $test "$silent" || sleep 1
21583         fi
21584 fi
21585
21586 : see if this is a termio system
21587 val="$undef"
21588 val2="$undef"
21589 val3="$undef"
21590 if $test `./findhdr termios.h`; then
21591         set tcsetattr i_termios
21592         eval $inlibc
21593         val3="$i_termios"
21594 fi
21595 echo " "
21596 case "$val3" in
21597 "$define") echo "You have POSIX termios.h... good!" >&4;;
21598 *) if ./Cppsym pyr; then
21599                 case "`/bin/universe`" in
21600                 ucb) if $test `./findhdr sgtty.h`; then
21601                                 val2="$define"
21602                                 echo "<sgtty.h> found." >&4
21603                         else
21604                                 echo "System is pyramid with BSD universe."
21605                                 ./warn "<sgtty.h> not found--you could have problems."
21606                         fi;;
21607                 *) if $test `./findhdr termio.h`; then
21608                                 val="$define"
21609                                 echo "<termio.h> found." >&4
21610                         else
21611                                 echo "System is pyramid with USG universe."
21612                                 ./warn "<termio.h> not found--you could have problems."
21613                         fi;;
21614                 esac
21615         elif ./usg; then
21616                 if $test `./findhdr termio.h`; then
21617                         echo "<termio.h> found." >&4
21618                         val="$define"
21619                 elif $test `./findhdr sgtty.h`; then
21620                         echo "<sgtty.h> found." >&4
21621                         val2="$define"
21622                 else
21623                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21624                 fi
21625         else
21626                 if $test `./findhdr sgtty.h`; then
21627                         echo "<sgtty.h> found." >&4
21628                         val2="$define"
21629                 elif $test `./findhdr termio.h`; then
21630                         echo "<termio.h> found." >&4
21631                         val="$define"
21632                 else
21633                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21634                 fi
21635         fi;;
21636 esac
21637 set i_termio; eval $setvar
21638 val=$val2; set i_sgtty; eval $setvar
21639 val=$val3; set i_termios; eval $setvar
21640
21641 : see if stddef is available
21642 set stddef.h i_stddef
21643 eval $inhdr
21644
21645 : see if sys/access.h is available
21646 set sys/access.h i_sysaccess
21647 eval $inhdr
21648
21649 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21650 set sys/filio.h i_sysfilio
21651 eval $inhdr
21652 echo " "
21653 if $test `./findhdr sys/ioctl.h`; then
21654         val="$define"
21655         echo '<sys/ioctl.h> found.' >&4
21656 else
21657         val="$undef"
21658         if $test $i_sysfilio = "$define"; then
21659             echo '<sys/ioctl.h> NOT found.' >&4
21660         else
21661                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21662                 $test $i_termio = "$define" && xxx="termio.h"
21663                 $test $i_termios = "$define" && xxx="termios.h"
21664 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21665         fi
21666 fi
21667 set i_sysioctl
21668 eval $setvar
21669
21670 : see if socket ioctl defs are in sys/sockio.h
21671 echo " "
21672 xxx=`./findhdr sys/sockio.h`
21673 if $test "$xxx"; then
21674         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21675                 val="$define"
21676                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21677         else
21678                 val="$undef"
21679                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21680         fi
21681 else
21682         val="$undef"
21683         $cat <<EOM
21684 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21685 EOM
21686 fi
21687 set i_syssockio
21688 eval $setvar
21689
21690 : see if this is a syslog.h system
21691 set syslog.h i_syslog
21692 eval $inhdr
21693
21694 : see if this is a sys/mode.h system
21695 set sys/mode.h i_sysmode
21696 eval $inhdr
21697
21698 : see if there is a sys/poll.h file
21699 set sys/poll.h i_syspoll
21700 eval $inhdr
21701
21702 : see if sys/resource.h has to be included
21703 set sys/resource.h i_sysresrc
21704 eval $inhdr
21705
21706 : see if sys/security.h is available
21707 set sys/security.h i_syssecrt
21708 eval $inhdr
21709
21710 : see if this is a sys/statvfs.h system
21711 set sys/statvfs.h i_sysstatvfs
21712 eval $inhdr
21713
21714 : see if this is a sys/un.h system
21715 set sys/un.h i_sysun
21716 eval $inhdr
21717
21718 : see if this is a sys/utsname.h system
21719 set sys/utsname.h i_sysutsname
21720 eval $inhdr
21721
21722 : see if this is a syswait system
21723 set sys/wait.h i_syswait
21724 eval $inhdr
21725
21726 : see if this is a ustat.h system
21727 set ustat.h i_ustat
21728 eval $inhdr
21729
21730 : see if this is an utime system
21731 set utime.h i_utime
21732 eval $inhdr
21733
21734 : see if this is a vfork system
21735 case "$d_vfork" in
21736 "$define")
21737         set vfork.h i_vfork
21738         eval $inhdr
21739         ;;
21740 *)
21741         i_vfork="$undef"
21742         ;;
21743 esac
21744
21745 : Check extensions
21746 echo " "
21747 echo "Looking for extensions..." >&4
21748 : If we are using the old config.sh, known_extensions may contain
21749 : old or inaccurate or duplicate values.
21750 known_extensions=''
21751 nonxs_extensions=''
21752 : We do not use find because it might not be available.
21753 : We do not just use MANIFEST because the user may have dropped
21754 : some additional extensions into the source tree and expect them
21755 : to be built.
21756
21757 : Function to recursively find available extensions, ignoring DynaLoader
21758 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21759 : In 5.10.1 and later, extensions are stored in directories
21760 : like File-Glob instead of the older File/Glob/.
21761 find_extensions='
21762     for xxx in *; do
21763         case "$xxx" in
21764             DynaLoader|dynaload) ;;
21765             *)
21766             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21767             leaf=`echo $xxx | $sed -e s/.*-//`;
21768             if $test -d File; then
21769                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21770                     known_extensions="$known_extensions $1$this_ext";
21771                 elif $test -f $xxx/Makefile.PL; then
21772                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21773                 else
21774                     if $test -d $xxx -a $# -lt 10; then
21775                         set $1$xxx/ $*;
21776                         cd "$xxx";
21777                         eval $find_extensions;
21778                         cd ..;
21779                         shift;
21780                     fi;
21781                 fi;
21782             else
21783                 $ls -1 $xxx > $$.tmp;
21784                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21785                     known_extensions="$known_extensions $this_ext";
21786                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21787                     known_extensions="$known_extensions $this_ext";
21788                 elif $test -d $xxx; then
21789                     nonxs_extensions="$nonxs_extensions $this_ext";
21790                 fi;
21791                 $rm -f $$.tmp;
21792             fi
21793             ;;
21794         esac;
21795     done'
21796 tdir=`pwd`
21797 cd "$rsrc/cpan"
21798 set X
21799 shift
21800 eval $find_extensions
21801 cd "$rsrc/dist"
21802 set X
21803 shift
21804 eval $find_extensions
21805 cd "$rsrc/ext"
21806 set X
21807 shift
21808 eval $find_extensions
21809 if $test -d File-Glob; then
21810     : All ext/ flattened
21811 else
21812     # Special case:  Add in modules that nest beyond the first level.
21813     # Currently threads/shared and Hash/Util/FieldHash, since they are
21814     # not picked up by the recursive find above (and adding in general
21815     # recursive finding breaks SDBM_File/sdbm).
21816     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21817     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21818 fi
21819 set X $known_extensions
21820 shift
21821 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21822 set X $nonxs_extensions
21823 shift
21824 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21825 cd "$tdir"
21826
21827 : Now see which are supported on this system.
21828 avail_ext=''
21829 for xxx in $known_extensions ; do
21830         case "$xxx" in
21831         DB_File|db_file)
21832                 case "$i_db" in
21833                 $define) avail_ext="$avail_ext $xxx" ;;
21834                 esac
21835                 ;;
21836         GDBM_File|gdbm_fil)
21837                 case "$i_gdbm" in
21838                 $define) avail_ext="$avail_ext $xxx" ;;
21839                 esac
21840                 ;;
21841         I18N/Langinfo|i18n_lan)
21842                 case "$i_langinfo$d_nl_langinfo" in
21843                 $define$define) avail_ext="$avail_ext $xxx" ;;
21844                 esac
21845                 ;;
21846         IPC/SysV|ipc/sysv)
21847                 : XXX Do we need a useipcsysv variable here
21848                 case "${d_msg}${d_sem}${d_shm}" in
21849                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21850                 esac
21851                 ;;
21852         NDBM_File|ndbm_fil)
21853                 case "$d_ndbm" in
21854                 $define)
21855                     case "$osname-$use64bitint" in
21856                     hpux-define)
21857                         case "$libs" in
21858                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21859                         esac
21860                         ;;
21861                     *) avail_ext="$avail_ext $xxx" ;;
21862                     esac
21863                     ;;
21864                 esac
21865                 ;;
21866         ODBM_File|odbm_fil)
21867                 case "${i_dbm}${i_rpcsvcdbm}" in
21868                 *"${define}"*)
21869                     case "$d_cplusplus" in
21870                     define) ;; # delete as a function name will not work
21871                     *)  case "$osname-$use64bitint" in
21872                         hpux-define)
21873                             case "$libs" in
21874                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21875                             esac
21876                             ;;
21877                         *) avail_ext="$avail_ext $xxx" ;;
21878                         esac
21879                         ;;
21880                     esac
21881                     ;;
21882                 esac
21883                 ;;
21884         Opcode|opcode)
21885                 case "$useopcode" in
21886                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21887                 esac
21888                 ;;
21889         POSIX|posix)
21890                 case "$useposix" in
21891                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21892                 esac
21893                 ;;
21894         Socket|socket)
21895                 case "$d_socket" in
21896                 true|$define|y)
21897                     case "$osname" in
21898                     beos) ;; # not unless BONE
21899                     *) avail_ext="$avail_ext $xxx" ;;
21900                     esac
21901                     ;;
21902                 esac
21903                 ;;
21904         Sys/Syslog|sys/syslog)
21905                 : XXX syslog requires socket
21906                 case "$d_socket" in
21907                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21908                 esac
21909                 ;;
21910         Thread|thread)
21911                 case "$usethreads" in
21912                 true|$define|y)
21913                         case "$use5005threads" in
21914                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21915                         esac
21916                 esac
21917                 ;;
21918         threads|threads/shared)
21919                 # threads and threads::shared are special cases.
21920                 # To stop people from asking "Perl 5.8.0 was supposed
21921                 # to have this new fancy threads implementation but my
21922                 # perl doesn't have it" and from people trying to
21923                 # (re)install the threads module using CPAN.pm and
21924                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21925                 # the threads.pm and threads/shared.pm will always be
21926                 # there, croaking informatively ("you need to rebuild
21927                 # all of Perl with threads, sorry") when threads haven't
21928                 # been compiled in.
21929                 # --jhi
21930                 avail_ext="$avail_ext $xxx"
21931                 ;;
21932         VMS*)
21933                 ;;
21934         Win32*)
21935                 case "$osname" in
21936                 cygwin) avail_ext="$avail_ext $xxx" ;;
21937                 esac
21938                 ;;
21939         XS/APItest|xs/apitest)
21940                 # This is just for testing.  Skip it unless we have dynamic loading.
21941
21942                 case "$usedl" in
21943                 $define) avail_ext="$avail_ext $xxx" ;;
21944                 esac
21945                 ;;
21946         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21947                 # This is just for testing.  Skip it unless we have dynamic loading.
21948
21949                 case "$usedl" in
21950                 $define) avail_ext="$avail_ext $xxx" ;;
21951                 esac
21952                 ;;
21953         XS/Typemap|xs/typemap)
21954                 # This is just for testing.  Skip it unless we have dynamic loading.
21955                 case "$usedl" in
21956                 $define) avail_ext="$avail_ext $xxx" ;;
21957                 esac
21958                 ;;
21959         *)      avail_ext="$avail_ext $xxx"
21960                 ;;
21961         esac
21962 done
21963
21964 set X $avail_ext
21965 shift
21966 avail_ext="$*"
21967
21968 case "$onlyextensions" in
21969 '') ;;
21970 *)  keepextensions=''
21971     echo "You have requested that only certains extensions be included..." >&4
21972     for i in $onlyextensions; do
21973         case " $avail_ext " in
21974         *" $i "*)
21975             echo "Keeping extension $i."
21976             keepextensions="$keepextensions $i"
21977             ;;
21978         *) echo "Ignoring extension $i." ;;
21979         esac
21980     done
21981     avail_ext="$keepextensions"
21982     ;;
21983 esac
21984
21985 case "$noextensions" in
21986 '') ;;
21987 *)  keepextensions=''
21988     echo "You have requested that certain extensions be ignored..." >&4
21989     for i in $avail_ext; do
21990         case " $noextensions " in
21991         *" $i "*) echo "Ignoring extension $i." ;;
21992         *) echo "Keeping extension $i.";
21993            keepextensions="$keepextensions $i"
21994            ;;
21995         esac
21996     done
21997     avail_ext="$keepextensions"
21998     ;;
21999 esac
22000
22001 : Now see which nonxs extensions are supported on this system.
22002 : For now assume all are.
22003 nonxs_ext=''
22004 for xxx in $nonxs_extensions ; do
22005         case "$xxx" in
22006         *)      nonxs_ext="$nonxs_ext $xxx"
22007                 ;;
22008         esac
22009 done
22010
22011 set X $nonxs_ext
22012 shift
22013 nonxs_ext="$*"
22014
22015 case $usedl in
22016 $define)
22017         $cat <<EOM
22018 A number of extensions are supplied with $package.  You may choose to
22019 compile these extensions for dynamic loading (the default), compile
22020 them into the $package executable (static loading), or not include
22021 them at all.  Answer "none" to include no extensions.
22022 Note that DynaLoader is always built and need not be mentioned here.
22023
22024 EOM
22025         case "$dynamic_ext" in
22026         '')
22027                 : Exclude those listed in static_ext
22028                 dflt=''
22029                 for xxx in $avail_ext; do
22030                         case " $static_ext " in
22031                         *" $xxx "*) ;;
22032                         *) dflt="$dflt $xxx" ;;
22033                         esac
22034                 done
22035                 set X $dflt
22036                 shift
22037                 dflt="$*"
22038                 ;;
22039         *)      dflt="$dynamic_ext"
22040                 # Perhaps we are reusing an old out-of-date config.sh.
22041                 case "$hint" in
22042                 previous)
22043                         if test X"$dynamic_ext" != X"$avail_ext"; then
22044                                 $cat <<EOM
22045 NOTICE:  Your previous config.sh list may be incorrect.
22046 The extensions now available to you are
22047         ${avail_ext}
22048 but the default list from your previous config.sh is
22049         ${dynamic_ext}
22050
22051 EOM
22052                         fi
22053                         ;;
22054                 esac
22055                 ;;
22056         esac
22057         case "$dflt" in
22058         '')     dflt=none;;
22059         esac
22060         rp="What extensions do you wish to load dynamically?"
22061         . ./myread
22062         case "$ans" in
22063         none) dynamic_ext=' ' ;;
22064         *) dynamic_ext="$ans" ;;
22065         esac
22066
22067         case "$static_ext" in
22068         '')
22069                 : Exclude those already listed in dynamic linking
22070                 dflt=''
22071                 for xxx in $avail_ext; do
22072                         case " $dynamic_ext " in
22073                         *" $xxx "*) ;;
22074                         *) dflt="$dflt $xxx" ;;
22075                         esac
22076                 done
22077                 set X $dflt
22078                 shift
22079                 dflt="$*"
22080                 ;;
22081         *)  dflt="$static_ext"
22082                 ;;
22083         esac
22084
22085         case "$dflt" in
22086         '')     dflt=none;;
22087         esac
22088         rp="What extensions do you wish to load statically?"
22089         . ./myread
22090         case "$ans" in
22091         none) static_ext=' ' ;;
22092         *) static_ext="$ans" ;;
22093         esac
22094         ;;
22095 *)
22096         $cat <<EOM
22097 A number of extensions are supplied with $package.  Answer "none"
22098 to include no extensions.
22099 Note that DynaLoader is always built and need not be mentioned here.
22100
22101 EOM
22102         case "$static_ext" in
22103         '') dflt="$avail_ext" ;;
22104         *)      dflt="$static_ext"
22105                 # Perhaps we are reusing an old out-of-date config.sh.
22106                 case "$hint" in
22107                 previous)
22108                         if test X"$static_ext" != X"$avail_ext"; then
22109                                 $cat <<EOM
22110 NOTICE:  Your previous config.sh list may be incorrect.
22111 The extensions now available to you are
22112         ${avail_ext}
22113 but the default list from your previous config.sh is
22114         ${static_ext}
22115
22116 EOM
22117                         fi
22118                         ;;
22119                 esac
22120                 ;;
22121         esac
22122         : Exclude those that are not xs extensions
22123         case "$dflt" in
22124         '')     dflt=none;;
22125         esac
22126         rp="What extensions do you wish to include?"
22127         . ./myread
22128         case "$ans" in
22129         none) static_ext=' ' ;;
22130         *) static_ext="$ans" ;;
22131         esac
22132         ;;
22133 esac
22134 #
22135 # Encode is a special case.  If we are building Encode as a static
22136 # extension, we need to explicitly list its subextensions as well.
22137 # For other nested extensions, this is handled automatically by
22138 # the appropriate Makefile.PL.
22139 case " $static_ext " in
22140         *" Encode "*) # Add the subextensions of Encode
22141         cd "$rsrc/ext"
22142         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22143                 static_ext="$static_ext Encode/$xxx"
22144         done
22145         cd "$tdir"
22146         ;;
22147 esac
22148
22149 set X $dynamic_ext $static_ext $nonxs_ext
22150 shift
22151 extensions="$*"
22152
22153 # Sanity check:  We require an extension suitable for use with
22154 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22155 # should show up as failures in the test suite, but it's helpful to
22156 # catch them now.) The 'extensions' list is normally sorted
22157 # alphabetically, so we need to accept either
22158 #    DB_File ... Fcntl ... IO  ....
22159 # or something like
22160 #    Fcntl ... NDBM_File ... IO  ....
22161 case " $extensions"  in
22162 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22163 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22164 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22165 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22166    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22167    ;;
22168 esac
22169
22170 : Remove libraries needed only for extensions
22171 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22172 : The exception is SunOS 4.x, which needs them.
22173 case "${osname}X${osvers}" in
22174 sunos*X4*)
22175     perllibs="$libs"
22176     ;;
22177 *) case "$usedl" in
22178     $define|true|[yY]*)
22179             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22180             shift
22181             perllibs="$*"
22182             ;;
22183     *)  perllibs="$libs"
22184             ;;
22185     esac
22186     ;;
22187 esac
22188
22189 : Remove build directory name from cppstdin so it can be used from
22190 : either the present location or the final installed location.
22191 echo " "
22192 : Get out of the UU directory to get correct path name.
22193 cd ..
22194 case "$cppstdin" in
22195 `pwd`/cppstdin)
22196         echo "Stripping down cppstdin path name"
22197         cppstdin=cppstdin
22198         ;;
22199 esac
22200 cd UU
22201
22202 : end of configuration questions
22203 echo " "
22204 echo "End of configuration questions."
22205 echo " "
22206
22207 : back to where it started
22208 if test -d ../UU; then
22209         cd ..
22210 fi
22211
22212 : configuration may be unconditionally patched via a 'config.arch' file
22213 if $test -f config.arch; then
22214         echo "I see a config.arch file, loading it." >&4
22215         . ./config.arch
22216 fi
22217
22218 : configuration may be patched via a 'config.over' file
22219 if $test -f config.over; then
22220         echo " "
22221         dflt=y
22222         rp='I see a config.over file.  Do you wish to load it?'
22223         . UU/myread
22224         case "$ans" in
22225         n*) echo "OK, I'll ignore it.";;
22226         *)      . ./config.over
22227                 echo "Configuration override changes have been loaded."
22228                 ;;
22229         esac
22230 fi
22231
22232 : in case they want portability, strip down executable paths
22233 case "$d_portable" in
22234 "$define")
22235         echo " "
22236         echo "Stripping down executable paths..." >&4
22237         for file in $loclist $trylist; do
22238                 eval temp=\$$file
22239                 eval $file=`basename $temp`
22240         done
22241         ;;
22242 esac
22243
22244 : create config.sh file
22245 echo " "
22246 echo "Creating config.sh..." >&4
22247 $spitshell <<EOT >config.sh
22248 $startsh
22249 #
22250 # This file was produced by running the Configure script. It holds all the
22251 # definitions figured out by Configure. Should you modify one of these values,
22252 # do not forget to propagate your changes by running "Configure -der". You may
22253 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22254 #
22255
22256 # Package name      : $package
22257 # Source directory  : $src
22258 # Configuration time: $cf_time
22259 # Configured by     : $cf_by
22260 # Target system     : $myuname
22261
22262 EOT
22263 : Add in command line options if available
22264 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22265
22266 $spitshell <<EOT >>config.sh
22267
22268 Author='$Author'
22269 Date='$Date'
22270 Header='$Header'
22271 Id='$Id'
22272 Locker='$Locker'
22273 Log='$Log'
22274 RCSfile='$RCSfile'
22275 Revision='$Revision'
22276 Source='$Source'
22277 State='$State'
22278 _a='$_a'
22279 _exe='$_exe'
22280 _o='$_o'
22281 afs='$afs'
22282 afsroot='$afsroot'
22283 alignbytes='$alignbytes'
22284 ansi2knr='$ansi2knr'
22285 aphostname='$aphostname'
22286 api_revision='$api_revision'
22287 api_subversion='$api_subversion'
22288 api_version='$api_version'
22289 api_versionstring='$api_versionstring'
22290 ar='$ar'
22291 archlib='$archlib'
22292 archlibexp='$archlibexp'
22293 archname64='$archname64'
22294 archname='$archname'
22295 archobjs='$archobjs'
22296 asctime_r_proto='$asctime_r_proto'
22297 awk='$awk'
22298 baserev='$baserev'
22299 bash='$bash'
22300 bin='$bin'
22301 bin_ELF='$bin_ELF'
22302 binexp='$binexp'
22303 bison='$bison'
22304 byacc='$byacc'
22305 byteorder='$byteorder'
22306 c='$c'
22307 castflags='$castflags'
22308 cat='$cat'
22309 cc='$cc'
22310 cccdlflags='$cccdlflags'
22311 ccdlflags='$ccdlflags'
22312 ccflags='$ccflags'
22313 ccflags_uselargefiles='$ccflags_uselargefiles'
22314 ccname='$ccname'
22315 ccsymbols='$ccsymbols'
22316 ccversion='$ccversion'
22317 cf_by='$cf_by'
22318 cf_email='$cf_email'
22319 cf_time='$cf_time'
22320 charbits='$charbits'
22321 charsize='$charsize'
22322 chgrp='$chgrp'
22323 chmod='$chmod'
22324 chown='$chown'
22325 clocktype='$clocktype'
22326 comm='$comm'
22327 compress='$compress'
22328 contains='$contains'
22329 cp='$cp'
22330 cpio='$cpio'
22331 cpp='$cpp'
22332 cpp_stuff='$cpp_stuff'
22333 cppccsymbols='$cppccsymbols'
22334 cppflags='$cppflags'
22335 cpplast='$cpplast'
22336 cppminus='$cppminus'
22337 cpprun='$cpprun'
22338 cppstdin='$cppstdin'
22339 cppsymbols='$cppsymbols'
22340 crypt_r_proto='$crypt_r_proto'
22341 cryptlib='$cryptlib'
22342 csh='$csh'
22343 ctermid_r_proto='$ctermid_r_proto'
22344 ctime_r_proto='$ctime_r_proto'
22345 d_Gconvert='$d_Gconvert'
22346 d_PRIEUldbl='$d_PRIEUldbl'
22347 d_PRIFUldbl='$d_PRIFUldbl'
22348 d_PRIGUldbl='$d_PRIGUldbl'
22349 d_PRIXU64='$d_PRIXU64'
22350 d_PRId64='$d_PRId64'
22351 d_PRIeldbl='$d_PRIeldbl'
22352 d_PRIfldbl='$d_PRIfldbl'
22353 d_PRIgldbl='$d_PRIgldbl'
22354 d_PRIi64='$d_PRIi64'
22355 d_PRIo64='$d_PRIo64'
22356 d_PRIu64='$d_PRIu64'
22357 d_PRIx64='$d_PRIx64'
22358 d_SCNfldbl='$d_SCNfldbl'
22359 d__fwalk='$d__fwalk'
22360 d_access='$d_access'
22361 d_accessx='$d_accessx'
22362 d_aintl='$d_aintl'
22363 d_alarm='$d_alarm'
22364 d_archlib='$d_archlib'
22365 d_asctime64='$d_asctime64'
22366 d_asctime_r='$d_asctime_r'
22367 d_atolf='$d_atolf'
22368 d_atoll='$d_atoll'
22369 d_attribute_deprecated='$d_attribute_deprecated'
22370 d_attribute_format='$d_attribute_format'
22371 d_attribute_malloc='$d_attribute_malloc'
22372 d_attribute_nonnull='$d_attribute_nonnull'
22373 d_attribute_noreturn='$d_attribute_noreturn'
22374 d_attribute_pure='$d_attribute_pure'
22375 d_attribute_unused='$d_attribute_unused'
22376 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22377 d_bcmp='$d_bcmp'
22378 d_bcopy='$d_bcopy'
22379 d_bsd='$d_bsd'
22380 d_bsdgetpgrp='$d_bsdgetpgrp'
22381 d_bsdsetpgrp='$d_bsdsetpgrp'
22382 d_builtin_choose_expr='$d_builtin_choose_expr'
22383 d_builtin_expect='$d_builtin_expect'
22384 d_bzero='$d_bzero'
22385 d_c99_variadic_macros='$d_c99_variadic_macros'
22386 d_casti32='$d_casti32'
22387 d_castneg='$d_castneg'
22388 d_charvspr='$d_charvspr'
22389 d_chown='$d_chown'
22390 d_chroot='$d_chroot'
22391 d_chsize='$d_chsize'
22392 d_class='$d_class'
22393 d_clearenv='$d_clearenv'
22394 d_closedir='$d_closedir'
22395 d_cmsghdr_s='$d_cmsghdr_s'
22396 d_const='$d_const'
22397 d_copysignl='$d_copysignl'
22398 d_cplusplus='$d_cplusplus'
22399 d_crypt='$d_crypt'
22400 d_crypt_r='$d_crypt_r'
22401 d_csh='$d_csh'
22402 d_ctermid='$d_ctermid'
22403 d_ctermid_r='$d_ctermid_r'
22404 d_ctime64='$d_ctime64'
22405 d_ctime_r='$d_ctime_r'
22406 d_cuserid='$d_cuserid'
22407 d_dbl_dig='$d_dbl_dig'
22408 d_dbminitproto='$d_dbminitproto'
22409 d_difftime64='$d_difftime64'
22410 d_difftime='$d_difftime'
22411 d_dir_dd_fd='$d_dir_dd_fd'
22412 d_dirfd='$d_dirfd'
22413 d_dirnamlen='$d_dirnamlen'
22414 d_dlerror='$d_dlerror'
22415 d_dlopen='$d_dlopen'
22416 d_dlsymun='$d_dlsymun'
22417 d_dosuid='$d_dosuid'
22418 d_drand48_r='$d_drand48_r'
22419 d_drand48proto='$d_drand48proto'
22420 d_dup2='$d_dup2'
22421 d_eaccess='$d_eaccess'
22422 d_endgrent='$d_endgrent'
22423 d_endgrent_r='$d_endgrent_r'
22424 d_endhent='$d_endhent'
22425 d_endhostent_r='$d_endhostent_r'
22426 d_endnent='$d_endnent'
22427 d_endnetent_r='$d_endnetent_r'
22428 d_endpent='$d_endpent'
22429 d_endprotoent_r='$d_endprotoent_r'
22430 d_endpwent='$d_endpwent'
22431 d_endpwent_r='$d_endpwent_r'
22432 d_endsent='$d_endsent'
22433 d_endservent_r='$d_endservent_r'
22434 d_eofnblk='$d_eofnblk'
22435 d_eunice='$d_eunice'
22436 d_faststdio='$d_faststdio'
22437 d_fchdir='$d_fchdir'
22438 d_fchmod='$d_fchmod'
22439 d_fchown='$d_fchown'
22440 d_fcntl='$d_fcntl'
22441 d_fcntl_can_lock='$d_fcntl_can_lock'
22442 d_fd_macros='$d_fd_macros'
22443 d_fd_set='$d_fd_set'
22444 d_fds_bits='$d_fds_bits'
22445 d_fgetpos='$d_fgetpos'
22446 d_finite='$d_finite'
22447 d_finitel='$d_finitel'
22448 d_flexfnam='$d_flexfnam'
22449 d_flock='$d_flock'
22450 d_flockproto='$d_flockproto'
22451 d_fork='$d_fork'
22452 d_fp_class='$d_fp_class'
22453 d_fpathconf='$d_fpathconf'
22454 d_fpclass='$d_fpclass'
22455 d_fpclassify='$d_fpclassify'
22456 d_fpclassl='$d_fpclassl'
22457 d_fpos64_t='$d_fpos64_t'
22458 d_frexpl='$d_frexpl'
22459 d_fs_data_s='$d_fs_data_s'
22460 d_fseeko='$d_fseeko'
22461 d_fsetpos='$d_fsetpos'
22462 d_fstatfs='$d_fstatfs'
22463 d_fstatvfs='$d_fstatvfs'
22464 d_fsync='$d_fsync'
22465 d_ftello='$d_ftello'
22466 d_ftime='$d_ftime'
22467 d_futimes='$d_futimes'
22468 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22469 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22470 d_getaddrinfo='$d_getaddrinfo'
22471 d_getcwd='$d_getcwd'
22472 d_getespwnam='$d_getespwnam'
22473 d_getfsstat='$d_getfsstat'
22474 d_getgrent='$d_getgrent'
22475 d_getgrent_r='$d_getgrent_r'
22476 d_getgrgid_r='$d_getgrgid_r'
22477 d_getgrnam_r='$d_getgrnam_r'
22478 d_getgrps='$d_getgrps'
22479 d_gethbyaddr='$d_gethbyaddr'
22480 d_gethbyname='$d_gethbyname'
22481 d_gethent='$d_gethent'
22482 d_gethname='$d_gethname'
22483 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22484 d_gethostbyname_r='$d_gethostbyname_r'
22485 d_gethostent_r='$d_gethostent_r'
22486 d_gethostprotos='$d_gethostprotos'
22487 d_getitimer='$d_getitimer'
22488 d_getlogin='$d_getlogin'
22489 d_getlogin_r='$d_getlogin_r'
22490 d_getmnt='$d_getmnt'
22491 d_getmntent='$d_getmntent'
22492 d_getnameinfo='$d_getnameinfo'
22493 d_getnbyaddr='$d_getnbyaddr'
22494 d_getnbyname='$d_getnbyname'
22495 d_getnent='$d_getnent'
22496 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22497 d_getnetbyname_r='$d_getnetbyname_r'
22498 d_getnetent_r='$d_getnetent_r'
22499 d_getnetprotos='$d_getnetprotos'
22500 d_getpagsz='$d_getpagsz'
22501 d_getpbyname='$d_getpbyname'
22502 d_getpbynumber='$d_getpbynumber'
22503 d_getpent='$d_getpent'
22504 d_getpgid='$d_getpgid'
22505 d_getpgrp2='$d_getpgrp2'
22506 d_getpgrp='$d_getpgrp'
22507 d_getppid='$d_getppid'
22508 d_getprior='$d_getprior'
22509 d_getprotobyname_r='$d_getprotobyname_r'
22510 d_getprotobynumber_r='$d_getprotobynumber_r'
22511 d_getprotoent_r='$d_getprotoent_r'
22512 d_getprotoprotos='$d_getprotoprotos'
22513 d_getprpwnam='$d_getprpwnam'
22514 d_getpwent='$d_getpwent'
22515 d_getpwent_r='$d_getpwent_r'
22516 d_getpwnam_r='$d_getpwnam_r'
22517 d_getpwuid_r='$d_getpwuid_r'
22518 d_getsbyname='$d_getsbyname'
22519 d_getsbyport='$d_getsbyport'
22520 d_getsent='$d_getsent'
22521 d_getservbyname_r='$d_getservbyname_r'
22522 d_getservbyport_r='$d_getservbyport_r'
22523 d_getservent_r='$d_getservent_r'
22524 d_getservprotos='$d_getservprotos'
22525 d_getspnam='$d_getspnam'
22526 d_getspnam_r='$d_getspnam_r'
22527 d_gettimeod='$d_gettimeod'
22528 d_gmtime64='$d_gmtime64'
22529 d_gmtime_r='$d_gmtime_r'
22530 d_gnulibc='$d_gnulibc'
22531 d_grpasswd='$d_grpasswd'
22532 d_hasmntopt='$d_hasmntopt'
22533 d_htonl='$d_htonl'
22534 d_ilogbl='$d_ilogbl'
22535 d_inc_version_list='$d_inc_version_list'
22536 d_index='$d_index'
22537 d_inetaton='$d_inetaton'
22538 d_inetntop='$d_inetntop'
22539 d_inetpton='$d_inetpton'
22540 d_int64_t='$d_int64_t'
22541 d_isascii='$d_isascii'
22542 d_isfinite='$d_isfinite'
22543 d_isinf='$d_isinf'
22544 d_isnan='$d_isnan'
22545 d_isnanl='$d_isnanl'
22546 d_killpg='$d_killpg'
22547 d_lchown='$d_lchown'
22548 d_ldbl_dig='$d_ldbl_dig'
22549 d_libm_lib_version='$d_libm_lib_version'
22550 d_link='$d_link'
22551 d_localtime64='$d_localtime64'
22552 d_localtime_r='$d_localtime_r'
22553 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22554 d_locconv='$d_locconv'
22555 d_lockf='$d_lockf'
22556 d_longdbl='$d_longdbl'
22557 d_longlong='$d_longlong'
22558 d_lseekproto='$d_lseekproto'
22559 d_lstat='$d_lstat'
22560 d_madvise='$d_madvise'
22561 d_malloc_good_size='$d_malloc_good_size'
22562 d_malloc_size='$d_malloc_size'
22563 d_mblen='$d_mblen'
22564 d_mbstowcs='$d_mbstowcs'
22565 d_mbtowc='$d_mbtowc'
22566 d_memchr='$d_memchr'
22567 d_memcmp='$d_memcmp'
22568 d_memcpy='$d_memcpy'
22569 d_memmove='$d_memmove'
22570 d_memset='$d_memset'
22571 d_mkdir='$d_mkdir'
22572 d_mkdtemp='$d_mkdtemp'
22573 d_mkfifo='$d_mkfifo'
22574 d_mkstemp='$d_mkstemp'
22575 d_mkstemps='$d_mkstemps'
22576 d_mktime64='$d_mktime64'
22577 d_mktime='$d_mktime'
22578 d_mmap='$d_mmap'
22579 d_modfl='$d_modfl'
22580 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22581 d_modflproto='$d_modflproto'
22582 d_mprotect='$d_mprotect'
22583 d_msg='$d_msg'
22584 d_msg_ctrunc='$d_msg_ctrunc'
22585 d_msg_dontroute='$d_msg_dontroute'
22586 d_msg_oob='$d_msg_oob'
22587 d_msg_peek='$d_msg_peek'
22588 d_msg_proxy='$d_msg_proxy'
22589 d_msgctl='$d_msgctl'
22590 d_msgget='$d_msgget'
22591 d_msghdr_s='$d_msghdr_s'
22592 d_msgrcv='$d_msgrcv'
22593 d_msgsnd='$d_msgsnd'
22594 d_msync='$d_msync'
22595 d_munmap='$d_munmap'
22596 d_mymalloc='$d_mymalloc'
22597 d_ndbm='$d_ndbm'
22598 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22599 d_nice='$d_nice'
22600 d_nl_langinfo='$d_nl_langinfo'
22601 d_nv_preserves_uv='$d_nv_preserves_uv'
22602 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22603 d_off64_t='$d_off64_t'
22604 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22605 d_oldpthreads='$d_oldpthreads'
22606 d_oldsock='$d_oldsock'
22607 d_open3='$d_open3'
22608 d_pathconf='$d_pathconf'
22609 d_pause='$d_pause'
22610 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22611 d_phostname='$d_phostname'
22612 d_pipe='$d_pipe'
22613 d_poll='$d_poll'
22614 d_portable='$d_portable'
22615 d_prctl='$d_prctl'
22616 d_prctl_set_name='$d_prctl_set_name'
22617 d_printf_format_null='$d_printf_format_null'
22618 d_procselfexe='$d_procselfexe'
22619 d_pseudofork='$d_pseudofork'
22620 d_pthread_atfork='$d_pthread_atfork'
22621 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22622 d_pthread_yield='$d_pthread_yield'
22623 d_pwage='$d_pwage'
22624 d_pwchange='$d_pwchange'
22625 d_pwclass='$d_pwclass'
22626 d_pwcomment='$d_pwcomment'
22627 d_pwexpire='$d_pwexpire'
22628 d_pwgecos='$d_pwgecos'
22629 d_pwpasswd='$d_pwpasswd'
22630 d_pwquota='$d_pwquota'
22631 d_qgcvt='$d_qgcvt'
22632 d_quad='$d_quad'
22633 d_random_r='$d_random_r'
22634 d_readdir64_r='$d_readdir64_r'
22635 d_readdir='$d_readdir'
22636 d_readdir_r='$d_readdir_r'
22637 d_readlink='$d_readlink'
22638 d_readv='$d_readv'
22639 d_recvmsg='$d_recvmsg'
22640 d_rename='$d_rename'
22641 d_rewinddir='$d_rewinddir'
22642 d_rmdir='$d_rmdir'
22643 d_safebcpy='$d_safebcpy'
22644 d_safemcpy='$d_safemcpy'
22645 d_sanemcmp='$d_sanemcmp'
22646 d_sbrkproto='$d_sbrkproto'
22647 d_scalbnl='$d_scalbnl'
22648 d_sched_yield='$d_sched_yield'
22649 d_scm_rights='$d_scm_rights'
22650 d_seekdir='$d_seekdir'
22651 d_select='$d_select'
22652 d_sem='$d_sem'
22653 d_semctl='$d_semctl'
22654 d_semctl_semid_ds='$d_semctl_semid_ds'
22655 d_semctl_semun='$d_semctl_semun'
22656 d_semget='$d_semget'
22657 d_semop='$d_semop'
22658 d_sendmsg='$d_sendmsg'
22659 d_setegid='$d_setegid'
22660 d_seteuid='$d_seteuid'
22661 d_setgrent='$d_setgrent'
22662 d_setgrent_r='$d_setgrent_r'
22663 d_setgrps='$d_setgrps'
22664 d_sethent='$d_sethent'
22665 d_sethostent_r='$d_sethostent_r'
22666 d_setitimer='$d_setitimer'
22667 d_setlinebuf='$d_setlinebuf'
22668 d_setlocale='$d_setlocale'
22669 d_setlocale_r='$d_setlocale_r'
22670 d_setnent='$d_setnent'
22671 d_setnetent_r='$d_setnetent_r'
22672 d_setpent='$d_setpent'
22673 d_setpgid='$d_setpgid'
22674 d_setpgrp2='$d_setpgrp2'
22675 d_setpgrp='$d_setpgrp'
22676 d_setprior='$d_setprior'
22677 d_setproctitle='$d_setproctitle'
22678 d_setprotoent_r='$d_setprotoent_r'
22679 d_setpwent='$d_setpwent'
22680 d_setpwent_r='$d_setpwent_r'
22681 d_setregid='$d_setregid'
22682 d_setresgid='$d_setresgid'
22683 d_setresuid='$d_setresuid'
22684 d_setreuid='$d_setreuid'
22685 d_setrgid='$d_setrgid'
22686 d_setruid='$d_setruid'
22687 d_setsent='$d_setsent'
22688 d_setservent_r='$d_setservent_r'
22689 d_setsid='$d_setsid'
22690 d_setvbuf='$d_setvbuf'
22691 d_sfio='$d_sfio'
22692 d_shm='$d_shm'
22693 d_shmat='$d_shmat'
22694 d_shmatprototype='$d_shmatprototype'
22695 d_shmctl='$d_shmctl'
22696 d_shmdt='$d_shmdt'
22697 d_shmget='$d_shmget'
22698 d_sigaction='$d_sigaction'
22699 d_signbit='$d_signbit'
22700 d_sigprocmask='$d_sigprocmask'
22701 d_sigsetjmp='$d_sigsetjmp'
22702 d_sitearch='$d_sitearch'
22703 d_snprintf='$d_snprintf'
22704 d_sockatmark='$d_sockatmark'
22705 d_sockatmarkproto='$d_sockatmarkproto'
22706 d_socket='$d_socket'
22707 d_socklen_t='$d_socklen_t'
22708 d_sockpair='$d_sockpair'
22709 d_socks5_init='$d_socks5_init'
22710 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22711 d_sqrtl='$d_sqrtl'
22712 d_srand48_r='$d_srand48_r'
22713 d_srandom_r='$d_srandom_r'
22714 d_sresgproto='$d_sresgproto'
22715 d_sresuproto='$d_sresuproto'
22716 d_statblks='$d_statblks'
22717 d_statfs_f_flags='$d_statfs_f_flags'
22718 d_statfs_s='$d_statfs_s'
22719 d_statvfs='$d_statvfs'
22720 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22721 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22722 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22723 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22724 d_stdio_stream_array='$d_stdio_stream_array'
22725 d_stdiobase='$d_stdiobase'
22726 d_stdstdio='$d_stdstdio'
22727 d_strchr='$d_strchr'
22728 d_strcoll='$d_strcoll'
22729 d_strctcpy='$d_strctcpy'
22730 d_strerrm='$d_strerrm'
22731 d_strerror='$d_strerror'
22732 d_strerror_r='$d_strerror_r'
22733 d_strftime='$d_strftime'
22734 d_strlcat='$d_strlcat'
22735 d_strlcpy='$d_strlcpy'
22736 d_strtod='$d_strtod'
22737 d_strtol='$d_strtol'
22738 d_strtold='$d_strtold'
22739 d_strtoll='$d_strtoll'
22740 d_strtoq='$d_strtoq'
22741 d_strtoul='$d_strtoul'
22742 d_strtoull='$d_strtoull'
22743 d_strtouq='$d_strtouq'
22744 d_strxfrm='$d_strxfrm'
22745 d_suidsafe='$d_suidsafe'
22746 d_symlink='$d_symlink'
22747 d_syscall='$d_syscall'
22748 d_syscallproto='$d_syscallproto'
22749 d_sysconf='$d_sysconf'
22750 d_sysernlst='$d_sysernlst'
22751 d_syserrlst='$d_syserrlst'
22752 d_system='$d_system'
22753 d_tcgetpgrp='$d_tcgetpgrp'
22754 d_tcsetpgrp='$d_tcsetpgrp'
22755 d_telldir='$d_telldir'
22756 d_telldirproto='$d_telldirproto'
22757 d_time='$d_time'
22758 d_timegm='$d_timegm'
22759 d_times='$d_times'
22760 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22761 d_tm_tm_zone='$d_tm_tm_zone'
22762 d_tmpnam_r='$d_tmpnam_r'
22763 d_truncate='$d_truncate'
22764 d_ttyname_r='$d_ttyname_r'
22765 d_tzname='$d_tzname'
22766 d_u32align='$d_u32align'
22767 d_ualarm='$d_ualarm'
22768 d_umask='$d_umask'
22769 d_uname='$d_uname'
22770 d_union_semun='$d_union_semun'
22771 d_unordered='$d_unordered'
22772 d_unsetenv='$d_unsetenv'
22773 d_usleep='$d_usleep'
22774 d_usleepproto='$d_usleepproto'
22775 d_ustat='$d_ustat'
22776 d_vendorarch='$d_vendorarch'
22777 d_vendorbin='$d_vendorbin'
22778 d_vendorlib='$d_vendorlib'
22779 d_vendorscript='$d_vendorscript'
22780 d_vfork='$d_vfork'
22781 d_void_closedir='$d_void_closedir'
22782 d_voidsig='$d_voidsig'
22783 d_voidtty='$d_voidtty'
22784 d_volatile='$d_volatile'
22785 d_vprintf='$d_vprintf'
22786 d_vsnprintf='$d_vsnprintf'
22787 d_wait4='$d_wait4'
22788 d_waitpid='$d_waitpid'
22789 d_wcstombs='$d_wcstombs'
22790 d_wctomb='$d_wctomb'
22791 d_writev='$d_writev'
22792 d_xenix='$d_xenix'
22793 date='$date'
22794 db_hashtype='$db_hashtype'
22795 db_prefixtype='$db_prefixtype'
22796 db_version_major='$db_version_major'
22797 db_version_minor='$db_version_minor'
22798 db_version_patch='$db_version_patch'
22799 defvoidused='$defvoidused'
22800 direntrytype='$direntrytype'
22801 dlext='$dlext'
22802 dlsrc='$dlsrc'
22803 doublesize='$doublesize'
22804 drand01='$drand01'
22805 drand48_r_proto='$drand48_r_proto'
22806 dtrace='$dtrace'
22807 dynamic_ext='$dynamic_ext'
22808 eagain='$eagain'
22809 ebcdic='$ebcdic'
22810 echo='$echo'
22811 egrep='$egrep'
22812 emacs='$emacs'
22813 endgrent_r_proto='$endgrent_r_proto'
22814 endhostent_r_proto='$endhostent_r_proto'
22815 endnetent_r_proto='$endnetent_r_proto'
22816 endprotoent_r_proto='$endprotoent_r_proto'
22817 endpwent_r_proto='$endpwent_r_proto'
22818 endservent_r_proto='$endservent_r_proto'
22819 eunicefix='$eunicefix'
22820 exe_ext='$exe_ext'
22821 expr='$expr'
22822 extensions='$extensions'
22823 extern_C='$extern_C'
22824 extras='$extras'
22825 fflushNULL='$fflushNULL'
22826 fflushall='$fflushall'
22827 find='$find'
22828 firstmakefile='$firstmakefile'
22829 flex='$flex'
22830 fpossize='$fpossize'
22831 fpostype='$fpostype'
22832 freetype='$freetype'
22833 from='$from'
22834 full_ar='$full_ar'
22835 full_csh='$full_csh'
22836 full_sed='$full_sed'
22837 gccansipedantic='$gccansipedantic'
22838 gccosandvers='$gccosandvers'
22839 gccversion='$gccversion'
22840 getgrent_r_proto='$getgrent_r_proto'
22841 getgrgid_r_proto='$getgrgid_r_proto'
22842 getgrnam_r_proto='$getgrnam_r_proto'
22843 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22844 gethostbyname_r_proto='$gethostbyname_r_proto'
22845 gethostent_r_proto='$gethostent_r_proto'
22846 getlogin_r_proto='$getlogin_r_proto'
22847 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22848 getnetbyname_r_proto='$getnetbyname_r_proto'
22849 getnetent_r_proto='$getnetent_r_proto'
22850 getprotobyname_r_proto='$getprotobyname_r_proto'
22851 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22852 getprotoent_r_proto='$getprotoent_r_proto'
22853 getpwent_r_proto='$getpwent_r_proto'
22854 getpwnam_r_proto='$getpwnam_r_proto'
22855 getpwuid_r_proto='$getpwuid_r_proto'
22856 getservbyname_r_proto='$getservbyname_r_proto'
22857 getservbyport_r_proto='$getservbyport_r_proto'
22858 getservent_r_proto='$getservent_r_proto'
22859 getspnam_r_proto='$getspnam_r_proto'
22860 gidformat='$gidformat'
22861 gidsign='$gidsign'
22862 gidsize='$gidsize'
22863 gidtype='$gidtype'
22864 glibpth='$glibpth'
22865 gmake='$gmake'
22866 gmtime_r_proto='$gmtime_r_proto'
22867 gnulibc_version='$gnulibc_version'
22868 grep='$grep'
22869 groupcat='$groupcat'
22870 groupstype='$groupstype'
22871 gzip='$gzip'
22872 h_fcntl='$h_fcntl'
22873 h_sysfile='$h_sysfile'
22874 hint='$hint'
22875 hostcat='$hostcat'
22876 html1dir='$html1dir'
22877 html1direxp='$html1direxp'
22878 html3dir='$html3dir'
22879 html3direxp='$html3direxp'
22880 i16size='$i16size'
22881 i16type='$i16type'
22882 i32size='$i32size'
22883 i32type='$i32type'
22884 i64size='$i64size'
22885 i64type='$i64type'
22886 i8size='$i8size'
22887 i8type='$i8type'
22888 i_arpainet='$i_arpainet'
22889 i_assert='$i_assert'
22890 i_bsdioctl='$i_bsdioctl'
22891 i_crypt='$i_crypt'
22892 i_db='$i_db'
22893 i_dbm='$i_dbm'
22894 i_dirent='$i_dirent'
22895 i_dld='$i_dld'
22896 i_dlfcn='$i_dlfcn'
22897 i_fcntl='$i_fcntl'
22898 i_float='$i_float'
22899 i_fp='$i_fp'
22900 i_fp_class='$i_fp_class'
22901 i_gdbm='$i_gdbm'
22902 i_gdbm_ndbm='$i_gdbm_ndbm'
22903 i_gdbmndbm='$i_gdbmndbm'
22904 i_grp='$i_grp'
22905 i_ieeefp='$i_ieeefp'
22906 i_inttypes='$i_inttypes'
22907 i_langinfo='$i_langinfo'
22908 i_libutil='$i_libutil'
22909 i_limits='$i_limits'
22910 i_locale='$i_locale'
22911 i_machcthr='$i_machcthr'
22912 i_malloc='$i_malloc'
22913 i_mallocmalloc='$i_mallocmalloc'
22914 i_math='$i_math'
22915 i_memory='$i_memory'
22916 i_mntent='$i_mntent'
22917 i_ndbm='$i_ndbm'
22918 i_netdb='$i_netdb'
22919 i_neterrno='$i_neterrno'
22920 i_netinettcp='$i_netinettcp'
22921 i_niin='$i_niin'
22922 i_poll='$i_poll'
22923 i_prot='$i_prot'
22924 i_pthread='$i_pthread'
22925 i_pwd='$i_pwd'
22926 i_rpcsvcdbm='$i_rpcsvcdbm'
22927 i_sfio='$i_sfio'
22928 i_sgtty='$i_sgtty'
22929 i_shadow='$i_shadow'
22930 i_socks='$i_socks'
22931 i_stdarg='$i_stdarg'
22932 i_stddef='$i_stddef'
22933 i_stdlib='$i_stdlib'
22934 i_string='$i_string'
22935 i_sunmath='$i_sunmath'
22936 i_sysaccess='$i_sysaccess'
22937 i_sysdir='$i_sysdir'
22938 i_sysfile='$i_sysfile'
22939 i_sysfilio='$i_sysfilio'
22940 i_sysin='$i_sysin'
22941 i_sysioctl='$i_sysioctl'
22942 i_syslog='$i_syslog'
22943 i_sysmman='$i_sysmman'
22944 i_sysmode='$i_sysmode'
22945 i_sysmount='$i_sysmount'
22946 i_sysndir='$i_sysndir'
22947 i_sysparam='$i_sysparam'
22948 i_syspoll='$i_syspoll'
22949 i_sysresrc='$i_sysresrc'
22950 i_syssecrt='$i_syssecrt'
22951 i_sysselct='$i_sysselct'
22952 i_syssockio='$i_syssockio'
22953 i_sysstat='$i_sysstat'
22954 i_sysstatfs='$i_sysstatfs'
22955 i_sysstatvfs='$i_sysstatvfs'
22956 i_systime='$i_systime'
22957 i_systimek='$i_systimek'
22958 i_systimes='$i_systimes'
22959 i_systypes='$i_systypes'
22960 i_sysuio='$i_sysuio'
22961 i_sysun='$i_sysun'
22962 i_sysutsname='$i_sysutsname'
22963 i_sysvfs='$i_sysvfs'
22964 i_syswait='$i_syswait'
22965 i_termio='$i_termio'
22966 i_termios='$i_termios'
22967 i_time='$i_time'
22968 i_unistd='$i_unistd'
22969 i_ustat='$i_ustat'
22970 i_utime='$i_utime'
22971 i_values='$i_values'
22972 i_varargs='$i_varargs'
22973 i_varhdr='$i_varhdr'
22974 i_vfork='$i_vfork'
22975 ignore_versioned_solibs='$ignore_versioned_solibs'
22976 inc_version_list='$inc_version_list'
22977 inc_version_list_init='$inc_version_list_init'
22978 incpath='$incpath'
22979 inews='$inews'
22980 initialinstalllocation='$initialinstalllocation'
22981 installarchlib='$installarchlib'
22982 installbin='$installbin'
22983 installhtml1dir='$installhtml1dir'
22984 installhtml3dir='$installhtml3dir'
22985 installman1dir='$installman1dir'
22986 installman3dir='$installman3dir'
22987 installprefix='$installprefix'
22988 installprefixexp='$installprefixexp'
22989 installprivlib='$installprivlib'
22990 installscript='$installscript'
22991 installsitearch='$installsitearch'
22992 installsitebin='$installsitebin'
22993 installsitehtml1dir='$installsitehtml1dir'
22994 installsitehtml3dir='$installsitehtml3dir'
22995 installsitelib='$installsitelib'
22996 installsiteman1dir='$installsiteman1dir'
22997 installsiteman3dir='$installsiteman3dir'
22998 installsitescript='$installsitescript'
22999 installstyle='$installstyle'
23000 installusrbinperl='$installusrbinperl'
23001 installvendorarch='$installvendorarch'
23002 installvendorbin='$installvendorbin'
23003 installvendorhtml1dir='$installvendorhtml1dir'
23004 installvendorhtml3dir='$installvendorhtml3dir'
23005 installvendorlib='$installvendorlib'
23006 installvendorman1dir='$installvendorman1dir'
23007 installvendorman3dir='$installvendorman3dir'
23008 installvendorscript='$installvendorscript'
23009 intsize='$intsize'
23010 issymlink='$issymlink'
23011 ivdformat='$ivdformat'
23012 ivsize='$ivsize'
23013 ivtype='$ivtype'
23014 known_extensions='$known_extensions'
23015 ksh='$ksh'
23016 ld='$ld'
23017 lddlflags='$lddlflags'
23018 ldflags='$ldflags'
23019 ldflags_uselargefiles='$ldflags_uselargefiles'
23020 ldlibpthname='$ldlibpthname'
23021 less='$less'
23022 lib_ext='$lib_ext'
23023 libc='$libc'
23024 libperl='$libperl'
23025 libpth='$libpth'
23026 libs='$libs'
23027 libsdirs='$libsdirs'
23028 libsfiles='$libsfiles'
23029 libsfound='$libsfound'
23030 libspath='$libspath'
23031 libswanted='$libswanted'
23032 libswanted_uselargefiles='$libswanted_uselargefiles'
23033 line='$line'
23034 lint='$lint'
23035 lkflags='$lkflags'
23036 ln='$ln'
23037 lns='$lns'
23038 localtime_r_proto='$localtime_r_proto'
23039 locincpth='$locincpth'
23040 loclibpth='$loclibpth'
23041 longdblsize='$longdblsize'
23042 longlongsize='$longlongsize'
23043 longsize='$longsize'
23044 lp='$lp'
23045 lpr='$lpr'
23046 ls='$ls'
23047 lseeksize='$lseeksize'
23048 lseektype='$lseektype'
23049 mad='$mad'
23050 madlyh='$madlyh'
23051 madlyobj='$madlyobj'
23052 madlysrc='$madlysrc'
23053 mail='$mail'
23054 mailx='$mailx'
23055 make='$make'
23056 make_set_make='$make_set_make'
23057 mallocobj='$mallocobj'
23058 mallocsrc='$mallocsrc'
23059 malloctype='$malloctype'
23060 man1dir='$man1dir'
23061 man1direxp='$man1direxp'
23062 man1ext='$man1ext'
23063 man3dir='$man3dir'
23064 man3direxp='$man3direxp'
23065 man3ext='$man3ext'
23066 mips_type='$mips_type'
23067 mistrustnm='$mistrustnm'
23068 mkdir='$mkdir'
23069 mmaptype='$mmaptype'
23070 modetype='$modetype'
23071 more='$more'
23072 multiarch='$multiarch'
23073 mv='$mv'
23074 myarchname='$myarchname'
23075 mydomain='$mydomain'
23076 myhostname='$myhostname'
23077 myuname='$myuname'
23078 n='$n'
23079 need_va_copy='$need_va_copy'
23080 netdb_hlen_type='$netdb_hlen_type'
23081 netdb_host_type='$netdb_host_type'
23082 netdb_name_type='$netdb_name_type'
23083 netdb_net_type='$netdb_net_type'
23084 nm='$nm'
23085 nm_opt='$nm_opt'
23086 nm_so_opt='$nm_so_opt'
23087 nonxs_ext='$nonxs_ext'
23088 nroff='$nroff'
23089 nvEUformat='$nvEUformat'
23090 nvFUformat='$nvFUformat'
23091 nvGUformat='$nvGUformat'
23092 nv_overflows_integers_at='$nv_overflows_integers_at'
23093 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23094 nveformat='$nveformat'
23095 nvfformat='$nvfformat'
23096 nvgformat='$nvgformat'
23097 nvsize='$nvsize'
23098 nvtype='$nvtype'
23099 o_nonblock='$o_nonblock'
23100 obj_ext='$obj_ext'
23101 old_pthread_create_joinable='$old_pthread_create_joinable'
23102 optimize='$optimize'
23103 orderlib='$orderlib'
23104 osname='$osname'
23105 osvers='$osvers'
23106 otherlibdirs='$otherlibdirs'
23107 package='$package'
23108 pager='$pager'
23109 passcat='$passcat'
23110 patchlevel='$patchlevel'
23111 path_sep='$path_sep'
23112 perl5='$perl5'
23113 perl='$perl'
23114 perl_patchlevel='$perl_patchlevel'
23115 perladmin='$perladmin'
23116 perllibs='$perllibs'
23117 perlpath='$perlpath'
23118 pg='$pg'
23119 phostname='$phostname'
23120 pidtype='$pidtype'
23121 plibpth='$plibpth'
23122 pmake='$pmake'
23123 pr='$pr'
23124 prefix='$prefix'
23125 prefixexp='$prefixexp'
23126 privlib='$privlib'
23127 privlibexp='$privlibexp'
23128 procselfexe='$procselfexe'
23129 prototype='$prototype'
23130 ptrsize='$ptrsize'
23131 quadkind='$quadkind'
23132 quadtype='$quadtype'
23133 randbits='$randbits'
23134 randfunc='$randfunc'
23135 random_r_proto='$random_r_proto'
23136 randseedtype='$randseedtype'
23137 ranlib='$ranlib'
23138 rd_nodata='$rd_nodata'
23139 readdir64_r_proto='$readdir64_r_proto'
23140 readdir_r_proto='$readdir_r_proto'
23141 revision='$revision'
23142 rm='$rm'
23143 rm_try='$rm_try'
23144 rmail='$rmail'
23145 run='$run'
23146 runnm='$runnm'
23147 sGMTIME_max='$sGMTIME_max'
23148 sGMTIME_min='$sGMTIME_min'
23149 sLOCALTIME_max='$sLOCALTIME_max'
23150 sLOCALTIME_min='$sLOCALTIME_min'
23151 sPRIEUldbl='$sPRIEUldbl'
23152 sPRIFUldbl='$sPRIFUldbl'
23153 sPRIGUldbl='$sPRIGUldbl'
23154 sPRIXU64='$sPRIXU64'
23155 sPRId64='$sPRId64'
23156 sPRIeldbl='$sPRIeldbl'
23157 sPRIfldbl='$sPRIfldbl'
23158 sPRIgldbl='$sPRIgldbl'
23159 sPRIi64='$sPRIi64'
23160 sPRIo64='$sPRIo64'
23161 sPRIu64='$sPRIu64'
23162 sPRIx64='$sPRIx64'
23163 sSCNfldbl='$sSCNfldbl'
23164 sched_yield='$sched_yield'
23165 scriptdir='$scriptdir'
23166 scriptdirexp='$scriptdirexp'
23167 sed='$sed'
23168 seedfunc='$seedfunc'
23169 selectminbits='$selectminbits'
23170 selecttype='$selecttype'
23171 sendmail='$sendmail'
23172 setgrent_r_proto='$setgrent_r_proto'
23173 sethostent_r_proto='$sethostent_r_proto'
23174 setlocale_r_proto='$setlocale_r_proto'
23175 setnetent_r_proto='$setnetent_r_proto'
23176 setprotoent_r_proto='$setprotoent_r_proto'
23177 setpwent_r_proto='$setpwent_r_proto'
23178 setservent_r_proto='$setservent_r_proto'
23179 sh='$sh'
23180 shar='$shar'
23181 sharpbang='$sharpbang'
23182 shmattype='$shmattype'
23183 shortsize='$shortsize'
23184 shrpenv='$shrpenv'
23185 shsharp='$shsharp'
23186 sig_count='$sig_count'
23187 sig_name='$sig_name'
23188 sig_name_init='$sig_name_init'
23189 sig_num='$sig_num'
23190 sig_num_init='$sig_num_init'
23191 sig_size='$sig_size'
23192 signal_t='$signal_t'
23193 sitearch='$sitearch'
23194 sitearchexp='$sitearchexp'
23195 sitebin='$sitebin'
23196 sitebinexp='$sitebinexp'
23197 sitehtml1dir='$sitehtml1dir'
23198 sitehtml1direxp='$sitehtml1direxp'
23199 sitehtml3dir='$sitehtml3dir'
23200 sitehtml3direxp='$sitehtml3direxp'
23201 sitelib='$sitelib'
23202 sitelib_stem='$sitelib_stem'
23203 sitelibexp='$sitelibexp'
23204 siteman1dir='$siteman1dir'
23205 siteman1direxp='$siteman1direxp'
23206 siteman3dir='$siteman3dir'
23207 siteman3direxp='$siteman3direxp'
23208 siteprefix='$siteprefix'
23209 siteprefixexp='$siteprefixexp'
23210 sitescript='$sitescript'
23211 sitescriptexp='$sitescriptexp'
23212 sizesize='$sizesize'
23213 sizetype='$sizetype'
23214 sleep='$sleep'
23215 smail='$smail'
23216 so='$so'
23217 sockethdr='$sockethdr'
23218 socketlib='$socketlib'
23219 socksizetype='$socksizetype'
23220 sort='$sort'
23221 spackage='$spackage'
23222 spitshell='$spitshell'
23223 srand48_r_proto='$srand48_r_proto'
23224 srandom_r_proto='$srandom_r_proto'
23225 src='$src'
23226 ssizetype='$ssizetype'
23227 startperl='$startperl'
23228 startsh='$startsh'
23229 static_ext='$static_ext'
23230 stdchar='$stdchar'
23231 stdio_base='$stdio_base'
23232 stdio_bufsiz='$stdio_bufsiz'
23233 stdio_cnt='$stdio_cnt'
23234 stdio_filbuf='$stdio_filbuf'
23235 stdio_ptr='$stdio_ptr'
23236 stdio_stream_array='$stdio_stream_array'
23237 strerror_r_proto='$strerror_r_proto'
23238 strings='$strings'
23239 submit='$submit'
23240 subversion='$subversion'
23241 sysman='$sysman'
23242 tail='$tail'
23243 tar='$tar'
23244 targetarch='$targetarch'
23245 tbl='$tbl'
23246 tee='$tee'
23247 test='$test'
23248 timeincl='$timeincl'
23249 timetype='$timetype'
23250 tmpnam_r_proto='$tmpnam_r_proto'
23251 to='$to'
23252 touch='$touch'
23253 tr='$tr'
23254 trnl='$trnl'
23255 troff='$troff'
23256 ttyname_r_proto='$ttyname_r_proto'
23257 u16size='$u16size'
23258 u16type='$u16type'
23259 u32size='$u32size'
23260 u32type='$u32type'
23261 u64size='$u64size'
23262 u64type='$u64type'
23263 u8size='$u8size'
23264 u8type='$u8type'
23265 uidformat='$uidformat'
23266 uidsign='$uidsign'
23267 uidsize='$uidsize'
23268 uidtype='$uidtype'
23269 uname='$uname'
23270 uniq='$uniq'
23271 uquadtype='$uquadtype'
23272 use5005threads='$use5005threads'
23273 use64bitall='$use64bitall'
23274 use64bitint='$use64bitint'
23275 usecrosscompile='$usecrosscompile'
23276 usedevel='$usedevel'
23277 usedl='$usedl'
23278 usedtrace='$usedtrace'
23279 usefaststdio='$usefaststdio'
23280 useithreads='$useithreads'
23281 uselargefiles='$uselargefiles'
23282 uselongdouble='$uselongdouble'
23283 usemallocwrap='$usemallocwrap'
23284 usemorebits='$usemorebits'
23285 usemultiplicity='$usemultiplicity'
23286 usemymalloc='$usemymalloc'
23287 usenm='$usenm'
23288 useopcode='$useopcode'
23289 useperlio='$useperlio'
23290 useposix='$useposix'
23291 usereentrant='$usereentrant'
23292 userelocatableinc='$userelocatableinc'
23293 usesfio='$usesfio'
23294 useshrplib='$useshrplib'
23295 usesitecustomize='$usesitecustomize'
23296 usesocks='$usesocks'
23297 usethreads='$usethreads'
23298 usevendorprefix='$usevendorprefix'
23299 usevfork='$usevfork'
23300 usrinc='$usrinc'
23301 uuname='$uuname'
23302 uvXUformat='$uvXUformat'
23303 uvoformat='$uvoformat'
23304 uvsize='$uvsize'
23305 uvtype='$uvtype'
23306 uvuformat='$uvuformat'
23307 uvxformat='$uvxformat'
23308 vaproto='$vaproto'
23309 vendorarch='$vendorarch'
23310 vendorarchexp='$vendorarchexp'
23311 vendorbin='$vendorbin'
23312 vendorbinexp='$vendorbinexp'
23313 vendorhtml1dir='$vendorhtml1dir'
23314 vendorhtml1direxp='$vendorhtml1direxp'
23315 vendorhtml3dir='$vendorhtml3dir'
23316 vendorhtml3direxp='$vendorhtml3direxp'
23317 vendorlib='$vendorlib'
23318 vendorlib_stem='$vendorlib_stem'
23319 vendorlibexp='$vendorlibexp'
23320 vendorman1dir='$vendorman1dir'
23321 vendorman1direxp='$vendorman1direxp'
23322 vendorman3dir='$vendorman3dir'
23323 vendorman3direxp='$vendorman3direxp'
23324 vendorprefix='$vendorprefix'
23325 vendorprefixexp='$vendorprefixexp'
23326 vendorscript='$vendorscript'
23327 vendorscriptexp='$vendorscriptexp'
23328 version='$version'
23329 version_patchlevel_string='$version_patchlevel_string'
23330 versiononly='$versiononly'
23331 vi='$vi'
23332 voidflags='$voidflags'
23333 xlibpth='$xlibpth'
23334 yacc='$yacc'
23335 yaccflags='$yaccflags'
23336 zcat='$zcat'
23337 zip='$zip'
23338 EOT
23339
23340 : add special variables
23341 $test -f $src/patchlevel.h && \
23342 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23343 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23344 echo "PERL_CONFIG_SH=true" >>config.sh
23345
23346 : propagate old symbols
23347 if $test -f UU/config.sh; then
23348         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23349         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23350                 config.sh config.sh UU/oldconfig.sh |\
23351                 $sort | $uniq -u >UU/oldsyms
23352         set X `cat UU/oldsyms`
23353         shift
23354         case $# in
23355         0) ;;
23356         *)
23357                 cat <<EOM
23358 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23359 EOM
23360                 echo ": Variables propagated from previous config.sh file." >>config.sh
23361                 for sym in `cat UU/oldsyms`; do
23362                         echo "    Propagating $hint variable "'$'"$sym..."
23363                         eval 'tmp="$'"${sym}"'"'
23364                         echo "$tmp" | \
23365                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23366                 done
23367                 ;;
23368         esac
23369 fi
23370
23371 : Finish up by extracting the .SH files
23372 case "$alldone" in
23373 exit)
23374         $rm -rf UU
23375         echo "Extraction done."
23376         exit 0
23377         ;;
23378 cont)
23379         ;;
23380 '')
23381         dflt=''
23382         nostick=true
23383         $cat <<EOM
23384
23385 If you'd like to make any changes to the config.sh file before I begin
23386 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23387
23388 EOM
23389         rp="Press return or use a shell escape to edit config.sh:"
23390         . UU/myread
23391         nostick=''
23392         case "$ans" in
23393         '') ;;
23394         *) : in case they cannot read
23395                 sh 1>&4 -c "$ans";;
23396         esac
23397         ;;
23398 esac
23399
23400 : if this fails, just run all the .SH files by hand
23401 . ./config.sh
23402
23403 echo " "
23404 exec 1>&4
23405 pwd=`pwd`
23406 . ./UU/extract
23407 cd "$pwd"
23408
23409 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23410         dflt=y
23411         case "$silent" in
23412         true) ;;
23413         *)
23414                 $cat <<EOM
23415
23416 Now you need to generate make dependencies by running "$make depend".
23417 You might prefer to run it in background: "$make depend > makedepend.out &"
23418 It can take a while, so you might not want to run it right now.
23419
23420 EOM
23421                 ;;
23422         esac
23423         rp="Run $make depend now?"
23424         . UU/myread
23425         case "$ans" in
23426         y*)
23427                 $make depend && echo "Now you must run '$make'."
23428                 ;;
23429         *)
23430                 echo "You must run '$make depend' then '$make'."
23431                 ;;
23432         esac
23433 elif test -f [Mm]akefile; then
23434         echo " "
23435         echo "Now you must run a $make."
23436 else
23437         echo "Configure done."
23438 fi
23439
23440 if $test -f Policy.sh; then
23441     $cat <<EOM
23442
23443 If you compile $package on a different machine or from a different object
23444 directory, copy the Policy.sh file from this object directory to the
23445 new one before you run Configure -- this will help you with most of
23446 the policy defaults.
23447
23448 EOM
23449 fi
23450 if $test -f config.msg; then
23451     echo "Hmm.  I also noted the following information while running:"
23452     echo " "
23453     $cat config.msg >&4
23454     $rm -f config.msg
23455 fi
23456 $rm -f kit*isdone ark*isdone
23457 $rm -rf UU
23458
23459 : End of Configure
23460