This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add USE_ATTRIBUTES_FOR_PERLIO to the list of -V's compile-time options.
[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 Tue Jan  5 09:34:08 CET 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_procselfexe=''
632 procselfexe=''
633 d_old_pthread_create_joinable=''
634 old_pthread_create_joinable=''
635 d_pthread_atfork=''
636 d_pthread_attr_setscope=''
637 d_pthread_yield=''
638 d_sched_yield=''
639 sched_yield=''
640 d_qgcvt=''
641 d_random_r=''
642 random_r_proto=''
643 d_readdir64_r=''
644 readdir64_r_proto=''
645 d_readdir=''
646 d_rewinddir=''
647 d_seekdir=''
648 d_telldir=''
649 d_readdir_r=''
650 readdir_r_proto=''
651 d_readlink=''
652 d_readv=''
653 d_recvmsg=''
654 d_rename=''
655 d_rmdir=''
656 d_safebcpy=''
657 d_safemcpy=''
658 d_sanemcmp=''
659 d_sbrkproto=''
660 d_scalbnl=''
661 d_select=''
662 d_sem=''
663 d_semctl=''
664 d_semget=''
665 d_semop=''
666 d_sendmsg=''
667 d_setegid=''
668 d_seteuid=''
669 d_setgrent=''
670 d_setgrent_r=''
671 setgrent_r_proto=''
672 d_setgrps=''
673 d_sethent=''
674 d_sethostent_r=''
675 sethostent_r_proto=''
676 d_setitimer=''
677 d_setlinebuf=''
678 d_setlocale=''
679 d_setlocale_r=''
680 setlocale_r_proto=''
681 d_setnent=''
682 d_setnetent_r=''
683 setnetent_r_proto=''
684 d_setpent=''
685 d_setpgid=''
686 d_setpgrp2=''
687 d_bsdsetpgrp=''
688 d_setpgrp=''
689 d_setprior=''
690 d_setproctitle=''
691 d_setprotoent_r=''
692 setprotoent_r_proto=''
693 d_setpwent=''
694 d_setpwent_r=''
695 setpwent_r_proto=''
696 d_setregid=''
697 d_setresgid=''
698 d_setresuid=''
699 d_setreuid=''
700 d_setrgid=''
701 d_setruid=''
702 d_setsent=''
703 d_setservent_r=''
704 setservent_r_proto=''
705 d_setsid=''
706 d_setvbuf=''
707 d_sfio=''
708 usesfio=''
709 d_shm=''
710 d_shmat=''
711 d_shmatprototype=''
712 shmattype=''
713 d_shmctl=''
714 d_shmdt=''
715 d_shmget=''
716 d_sigaction=''
717 d_signbit=''
718 d_sigprocmask=''
719 d_sigsetjmp=''
720 usesitecustomize=''
721 d_snprintf=''
722 d_vsnprintf=''
723 d_sockatmark=''
724 d_sockatmarkproto=''
725 d_msg_ctrunc=''
726 d_msg_dontroute=''
727 d_msg_oob=''
728 d_msg_peek=''
729 d_msg_proxy=''
730 d_oldsock=''
731 d_scm_rights=''
732 d_socket=''
733 d_sockpair=''
734 sockethdr=''
735 socketlib=''
736 d_socklen_t=''
737 d_socks5_init=''
738 d_sprintf_returns_strlen=''
739 d_sqrtl=''
740 d_srand48_r=''
741 srand48_r_proto=''
742 d_srandom_r=''
743 srandom_r_proto=''
744 d_sresgproto=''
745 d_sresuproto=''
746 d_statblks=''
747 d_statfs_f_flags=''
748 d_statfs_s=''
749 d_fstatvfs=''
750 d_statvfs=''
751 d_stdio_cnt_lval=''
752 d_stdio_ptr_lval=''
753 d_stdio_ptr_lval_nochange_cnt=''
754 d_stdio_ptr_lval_sets_cnt=''
755 d_stdiobase=''
756 d_stdstdio=''
757 stdio_base=''
758 stdio_bufsiz=''
759 stdio_cnt=''
760 stdio_filbuf=''
761 stdio_ptr=''
762 d_index=''
763 d_strchr=''
764 d_strcoll=''
765 d_strctcpy=''
766 d_strerrm=''
767 d_strerror=''
768 d_sysernlst=''
769 d_syserrlst=''
770 d_strerror_r=''
771 strerror_r_proto=''
772 d_strftime=''
773 d_strlcat=''
774 d_strlcpy=''
775 d_strtod=''
776 d_strtol=''
777 d_strtold=''
778 d_strtoll=''
779 d_strtoq=''
780 d_strtoul=''
781 d_strtoull=''
782 d_strtouq=''
783 d_strxfrm=''
784 d_symlink=''
785 d_syscall=''
786 d_syscallproto=''
787 d_sysconf=''
788 d_system=''
789 d_tcgetpgrp=''
790 d_tcsetpgrp=''
791 d_telldirproto=''
792 d_time=''
793 timetype=''
794 d_asctime64=''
795 d_ctime64=''
796 d_difftime64=''
797 d_gmtime64=''
798 d_localtime64=''
799 d_mktime64=''
800 d_timegm=''
801 clocktype=''
802 d_times=''
803 d_tmpnam_r=''
804 tmpnam_r_proto=''
805 d_truncate=''
806 d_ttyname_r=''
807 ttyname_r_proto=''
808 d_tzname=''
809 d_u32align=''
810 d_ualarm=''
811 d_umask=''
812 d_semctl_semid_ds=''
813 d_semctl_semun=''
814 d_union_semun=''
815 d_unordered=''
816 d_unsetenv=''
817 d_usleep=''
818 d_usleepproto=''
819 d_ustat=''
820 d_pseudofork=''
821 d_vfork=''
822 usevfork=''
823 d_voidsig=''
824 signal_t=''
825 d_volatile=''
826 d_charvspr=''
827 d_vprintf=''
828 d_wait4=''
829 d_waitpid=''
830 d_wcstombs=''
831 d_wctomb=''
832 d_writev=''
833 dlext=''
834 bin_ELF=''
835 cccdlflags=''
836 ccdlflags=''
837 dlsrc=''
838 ld=''
839 lddlflags=''
840 usedl=''
841 doublesize=''
842 ebcdic=''
843 fflushNULL=''
844 fflushall=''
845 fpossize=''
846 fpostype=''
847 gccansipedantic=''
848 gccosandvers=''
849 gccversion=''
850 gidformat=''
851 gidsign=''
852 gidsize=''
853 gidtype=''
854 groupstype=''
855 h_fcntl=''
856 h_sysfile=''
857 html1dir=''
858 html1direxp=''
859 installhtml1dir=''
860 html3dir=''
861 html3direxp=''
862 installhtml3dir=''
863 i_arpainet=''
864 i_assert=''
865 i_crypt=''
866 db_hashtype=''
867 db_prefixtype=''
868 db_version_major=''
869 db_version_minor=''
870 db_version_patch=''
871 i_db=''
872 i_dbm=''
873 i_rpcsvcdbm=''
874 d_dirnamlen=''
875 direntrytype=''
876 i_dirent=''
877 i_dld=''
878 i_dlfcn=''
879 i_fcntl=''
880 i_float=''
881 i_fp=''
882 i_fp_class=''
883 i_gdbm=''
884 d_grpasswd=''
885 i_grp=''
886 i_ieeefp=''
887 i_inttypes=''
888 i_langinfo=''
889 i_libutil=''
890 i_limits=''
891 i_locale=''
892 i_machcthr=''
893 i_malloc=''
894 i_mallocmalloc=''
895 i_math=''
896 i_memory=''
897 i_mntent=''
898 d_gdbm_ndbm_h_uses_prototypes=''
899 d_gdbmndbm_h_uses_prototypes=''
900 d_ndbm=''
901 d_ndbm_h_uses_prototypes=''
902 i_gdbm_ndbm=''
903 i_gdbmndbm=''
904 i_ndbm=''
905 i_netdb=''
906 i_neterrno=''
907 i_netinettcp=''
908 i_niin=''
909 i_sysin=''
910 i_poll=''
911 i_prot=''
912 i_pthread=''
913 d_pwage=''
914 d_pwchange=''
915 d_pwclass=''
916 d_pwcomment=''
917 d_pwexpire=''
918 d_pwgecos=''
919 d_pwpasswd=''
920 d_pwquota=''
921 i_pwd=''
922 i_sfio=''
923 i_shadow=''
924 i_socks=''
925 i_stddef=''
926 i_stdlib=''
927 i_string=''
928 strings=''
929 i_sunmath=''
930 i_sysaccess=''
931 i_sysdir=''
932 i_sysfile=''
933 d_voidtty=''
934 i_bsdioctl=''
935 i_sysfilio=''
936 i_sysioctl=''
937 i_syssockio=''
938 i_syslog=''
939 i_sysmman=''
940 i_sysmode=''
941 i_sysmount=''
942 i_sysndir=''
943 i_sysparam=''
944 i_syspoll=''
945 i_sysresrc=''
946 i_syssecrt=''
947 i_sysselct=''
948 i_sysstat=''
949 i_sysstatfs=''
950 i_sysstatvfs=''
951 i_systimes=''
952 i_systypes=''
953 i_sysuio=''
954 i_sysun=''
955 i_sysutsname=''
956 i_sysvfs=''
957 i_syswait=''
958 i_sgtty=''
959 i_termio=''
960 i_termios=''
961 d_tm_tm_gmtoff=''
962 d_tm_tm_zone=''
963 i_systime=''
964 i_systimek=''
965 i_time=''
966 timeincl=''
967 i_unistd=''
968 i_ustat=''
969 i_utime=''
970 i_values=''
971 i_stdarg=''
972 i_varargs=''
973 i_varhdr=''
974 i_vfork=''
975 d_inc_version_list=''
976 inc_version_list=''
977 inc_version_list_init=''
978 installprefix=''
979 installprefixexp=''
980 installstyle=''
981 installusrbinperl=''
982 intsize=''
983 longsize=''
984 shortsize=''
985 issymlink=''
986 libc=''
987 ldlibpthname=''
988 libperl=''
989 shrpenv=''
990 useshrplib=''
991 glibpth=''
992 libpth=''
993 loclibpth=''
994 plibpth=''
995 xlibpth=''
996 ignore_versioned_solibs=''
997 libs=''
998 libsdirs=''
999 libsfiles=''
1000 libsfound=''
1001 libspath=''
1002 lns=''
1003 d_PRIEUldbl=''
1004 d_PRIFUldbl=''
1005 d_PRIGUldbl=''
1006 d_PRIeldbl=''
1007 d_PRIfldbl=''
1008 d_PRIgldbl=''
1009 d_SCNfldbl=''
1010 sPRIEUldbl=''
1011 sPRIFUldbl=''
1012 sPRIGUldbl=''
1013 sPRIeldbl=''
1014 sPRIfldbl=''
1015 sPRIgldbl=''
1016 sSCNfldbl=''
1017 lseeksize=''
1018 lseektype=''
1019 mad=''
1020 madlyh=''
1021 madlyobj=''
1022 madlysrc=''
1023 make_set_make=''
1024 d_mymalloc=''
1025 freetype=''
1026 mallocobj=''
1027 mallocsrc=''
1028 malloctype=''
1029 usemallocwrap=''
1030 usemymalloc=''
1031 installman1dir=''
1032 man1dir=''
1033 man1direxp=''
1034 man1ext=''
1035 installman3dir=''
1036 man3dir=''
1037 man3direxp=''
1038 man3ext=''
1039 modetype=''
1040 multiarch=''
1041 mydomain=''
1042 myhostname=''
1043 phostname=''
1044 c=''
1045 n=''
1046 d_eofnblk=''
1047 eagain=''
1048 o_nonblock=''
1049 rd_nodata=''
1050 need_va_copy=''
1051 netdb_hlen_type=''
1052 netdb_host_type=''
1053 netdb_name_type=''
1054 netdb_net_type=''
1055 groupcat=''
1056 hostcat=''
1057 passcat=''
1058 orderlib=''
1059 ranlib=''
1060 d_perl_otherlibdirs=''
1061 otherlibdirs=''
1062 package=''
1063 spackage=''
1064 pager=''
1065 api_revision=''
1066 api_subversion=''
1067 api_version=''
1068 api_versionstring=''
1069 patchlevel=''
1070 perl_patchlevel=''
1071 revision=''
1072 subversion=''
1073 version=''
1074 version_patchlevel_string=''
1075 perl5=''
1076 perladmin=''
1077 perlpath=''
1078 d_nv_preserves_uv=''
1079 d_nv_zero_is_allbits_zero=''
1080 i16size=''
1081 i16type=''
1082 i32size=''
1083 i32type=''
1084 i64size=''
1085 i64type=''
1086 i8size=''
1087 i8type=''
1088 ivsize=''
1089 ivtype=''
1090 nv_overflows_integers_at=''
1091 nv_preserves_uv_bits=''
1092 nvsize=''
1093 nvtype=''
1094 u16size=''
1095 u16type=''
1096 u32size=''
1097 u32type=''
1098 u64size=''
1099 u64type=''
1100 u8size=''
1101 u8type=''
1102 uvsize=''
1103 uvtype=''
1104 ivdformat=''
1105 nvEUformat=''
1106 nvFUformat=''
1107 nvGUformat=''
1108 nveformat=''
1109 nvfformat=''
1110 nvgformat=''
1111 uvXUformat=''
1112 uvoformat=''
1113 uvuformat=''
1114 uvxformat=''
1115 pidtype=''
1116 prefix=''
1117 prefixexp=''
1118 installprivlib=''
1119 privlib=''
1120 privlibexp=''
1121 prototype=''
1122 ptrsize=''
1123 d_PRIXU64=''
1124 d_PRId64=''
1125 d_PRIi64=''
1126 d_PRIo64=''
1127 d_PRIu64=''
1128 d_PRIx64=''
1129 sPRIXU64=''
1130 sPRId64=''
1131 sPRIi64=''
1132 sPRIo64=''
1133 sPRIu64=''
1134 sPRIx64=''
1135 d_quad=''
1136 quadkind=''
1137 quadtype=''
1138 uquadtype=''
1139 drand01=''
1140 randbits=''
1141 randfunc=''
1142 randseedtype=''
1143 seedfunc=''
1144 installscript=''
1145 scriptdir=''
1146 scriptdirexp=''
1147 selectminbits=''
1148 selecttype=''
1149 sh=''
1150 sig_count=''
1151 sig_name=''
1152 sig_name_init=''
1153 sig_num=''
1154 sig_num_init=''
1155 sig_size=''
1156 d_sitearch=''
1157 installsitearch=''
1158 sitearch=''
1159 sitearchexp=''
1160 installsitebin=''
1161 sitebin=''
1162 sitebinexp=''
1163 installsitehtml1dir=''
1164 sitehtml1dir=''
1165 sitehtml1direxp=''
1166 installsitehtml3dir=''
1167 sitehtml3dir=''
1168 sitehtml3direxp=''
1169 installsitelib=''
1170 sitelib=''
1171 sitelib_stem=''
1172 sitelibexp=''
1173 installsiteman1dir=''
1174 siteman1dir=''
1175 siteman1direxp=''
1176 installsiteman3dir=''
1177 siteman3dir=''
1178 siteman3direxp=''
1179 siteprefix=''
1180 siteprefixexp=''
1181 installsitescript=''
1182 sitescript=''
1183 sitescriptexp=''
1184 sizesize=''
1185 sizetype=''
1186 so=''
1187 socksizetype=''
1188 sharpbang=''
1189 shsharp=''
1190 spitshell=''
1191 src=''
1192 ssizetype=''
1193 startperl=''
1194 startsh=''
1195 stdchar=''
1196 d_stdio_stream_array=''
1197 stdio_stream_array=''
1198 sysman=''
1199 sGMTIME_max=''
1200 sGMTIME_min=''
1201 sLOCALTIME_max=''
1202 sLOCALTIME_min=''
1203 trnl=''
1204 uidformat=''
1205 uidsign=''
1206 uidsize=''
1207 uidtype=''
1208 archname64=''
1209 use64bitall=''
1210 use64bitint=''
1211 dtrace=''
1212 usedtrace=''
1213 usefaststdio=''
1214 ccflags_uselargefiles=''
1215 ldflags_uselargefiles=''
1216 libswanted_uselargefiles=''
1217 uselargefiles=''
1218 uselongdouble=''
1219 usemorebits=''
1220 usemultiplicity=''
1221 nm_opt=''
1222 nm_so_opt=''
1223 runnm=''
1224 usenm=''
1225 useperlio=''
1226 usesocks=''
1227 d_oldpthreads=''
1228 use5005threads=''
1229 useithreads=''
1230 usereentrant=''
1231 usethreads=''
1232 incpath=''
1233 mips_type=''
1234 usrinc=''
1235 vaproto=''
1236 d_vendorarch=''
1237 installvendorarch=''
1238 vendorarch=''
1239 vendorarchexp=''
1240 d_vendorbin=''
1241 installvendorbin=''
1242 vendorbin=''
1243 vendorbinexp=''
1244 installvendorhtml1dir=''
1245 vendorhtml1dir=''
1246 vendorhtml1direxp=''
1247 installvendorhtml3dir=''
1248 vendorhtml3dir=''
1249 vendorhtml3direxp=''
1250 d_vendorlib=''
1251 installvendorlib=''
1252 vendorlib=''
1253 vendorlib_stem=''
1254 vendorlibexp=''
1255 installvendorman1dir=''
1256 vendorman1dir=''
1257 vendorman1direxp=''
1258 installvendorman3dir=''
1259 vendorman3dir=''
1260 vendorman3direxp=''
1261 usevendorprefix=''
1262 vendorprefix=''
1263 vendorprefixexp=''
1264 d_vendorscript=''
1265 installvendorscript=''
1266 vendorscript=''
1267 vendorscriptexp=''
1268 versiononly=''
1269 defvoidused=''
1270 voidflags=''
1271 yacc=''
1272 yaccflags=''
1273 CONFIG=''
1274
1275 : Detect odd OSs
1276 define='define'
1277 undef='undef'
1278 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1279 rmlist=''
1280
1281 : We must find out about Eunice early
1282 eunicefix=':'
1283 if test -f /etc/unixtovms; then
1284         eunicefix=/etc/unixtovms
1285 fi
1286 if test -f /etc/unixtovms.exe; then
1287         eunicefix=/etc/unixtovms.exe
1288 fi
1289
1290 : Set executable suffix now -- needed before hints available
1291 if test -f "/libs/version.library"; then
1292 : Amiga OS
1293     _exe=""
1294 elif test -f "/system/gnu_library/bin/ar.pm"; then
1295 : Stratus VOS
1296     _exe=".pm"
1297 elif test -n "$DJGPP"; then
1298 : DOS DJGPP
1299     _exe=".exe"
1300 elif test -d c:/. -o -n "$is_os2" ; then
1301 : OS/2 or cygwin
1302     _exe=".exe"
1303 fi
1304
1305 groupstype=''
1306 i_whoami=''
1307 : Trailing extension.  Override this in a hint file, if needed.
1308 : Extra object files, if any, needed on this platform.
1309 archobjs=''
1310 archname=''
1311 libnames=''
1312 : change the next line if compiling for Xenix/286 on Xenix/386
1313 xlibpth='/usr/lib/386 /lib/386'
1314 : Possible local library directories to search.
1315 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1316 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1317
1318 : general looking path for locating libraries
1319 glibpth="/lib /usr/lib $xlibpth"
1320 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1321 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1322 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1323 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1324
1325 : Private path used by Configure to find libraries.  Its value
1326 : is prepended to libpth. This variable takes care of special
1327 : machines, like the mips.  Usually, it should be empty.
1328 plibpth=''
1329
1330 : default library list
1331 libswanted=''
1332 : some systems want to use only the non-versioned libso:s
1333 ignore_versioned_solibs=''
1334 : set usethreads on the Configure command line to enable threads.
1335 usereentrant='undef'
1336 : full support for void wanted by default
1337 defvoidused=15
1338
1339 : Possible local include directories to search.
1340 : Set locincpth to "" in a hint file to defeat local include searches.
1341 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1342 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1343 :
1344 : no include file wanted by default
1345 inclwanted=''
1346
1347 : Enable -DEBUGGING and -DDEBUGGING from the command line
1348 EBUGGING=''
1349 DEBUGGING=old
1350
1351 ccname=''
1352 ccversion=''
1353 perllibs=''
1354 : set useposix=false in your hint file to disable the POSIX extension.
1355 useposix=true
1356 : set useopcode=false in your hint file to disable the Opcode extension.
1357 useopcode=true
1358 archname64=''
1359 ccflags_uselargefiles=''
1360 ldflags_uselargefiles=''
1361 libswanted_uselargefiles=''
1362 : set usemultiplicity on the Configure command line to enable multiplicity.
1363 : set usesocks on the Configure command line to enable socks.
1364 : List of libraries we want.
1365 : If anyone needs extra -lxxx, put those in a hint file.
1366 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1367 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1368 : We probably want to search /usr/shlib before most other libraries.
1369 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1370 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1371 glibpth="/usr/shlib $glibpth"
1372 : Do not use vfork unless overridden by a hint file.
1373 usevfork=false
1374
1375 : Find the basic shell for Bourne shell scripts
1376 case "$sh" in
1377 '')
1378         case "$SYSTYPE" in
1379         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1380         *) xxx='/bin/sh';;
1381         esac
1382         if test -f "$xxx"; then
1383                 sh="$xxx"
1384         else
1385                 : Build up a list and do a single loop so we can 'break' out.
1386                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1387                 for xxx in sh bash ksh pdksh ash; do
1388                         for p in $pth; do
1389                                 try="$try ${p}/${xxx}"
1390                         done
1391                 done
1392                 for xxx in $try; do
1393                         if test -f "$xxx"; then
1394                                 sh="$xxx";
1395                                 break
1396                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1397                                 sh="$xxx";
1398                                 break
1399                         elif test -f "$xxx.exe"; then
1400                                 sh="$xxx";
1401                                 break
1402                         fi
1403                 done
1404         fi
1405         ;;
1406 esac
1407
1408 case "$sh" in
1409 '')     cat >&2 <<EOM
1410 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1411
1412 Usually it's in /bin/sh.  How did you even get this far?
1413 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1414 we'll try to straighten this all out.
1415 EOM
1416         exit 1
1417         ;;
1418 esac
1419
1420 : see if sh knows # comments
1421 if `$sh -c '#' >/dev/null 2>&1`; then
1422         shsharp=true
1423         spitshell=cat
1424         xcat=/bin/cat
1425         test -f $xcat$_exe || xcat=/usr/bin/cat
1426         if test ! -f $xcat$_exe; then
1427                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1428                         if test -f $p/cat$_exe; then
1429                                 xcat=$p/cat
1430                                 break
1431                         fi
1432                 done
1433                 if test ! -f $xcat$_exe; then
1434                         echo "Can't find cat anywhere!"
1435                         exit 1
1436                 fi
1437         fi
1438         echo "#!$xcat" >sharp
1439         $eunicefix sharp
1440         chmod +x sharp
1441         ./sharp > today 2>/dev/null
1442         if test -s today; then
1443                 sharpbang='#!'
1444         else
1445                 echo "#! $xcat" > sharp
1446                 $eunicefix sharp
1447                 chmod +x sharp
1448                 ./sharp > today 2>/dev/null
1449                 if test -s today; then
1450                         sharpbang='#! '
1451                 else
1452                         sharpbang=': use '
1453                 fi
1454         fi
1455 else
1456         echo " "
1457         echo "Your $sh doesn't grok # comments--I will strip them later on."
1458         shsharp=false
1459         cd ..
1460         echo "exec grep -v '^[  ]*#'" >spitshell
1461         chmod +x spitshell
1462         $eunicefix spitshell
1463         spitshell=`pwd`/spitshell
1464         cd UU
1465         echo "I presume that if # doesn't work, #! won't work either!"
1466         sharpbang=': use '
1467 fi
1468 rm -f sharp today
1469
1470 : figure out how to guarantee sh startup
1471 case "$startsh" in
1472 '') startsh=${sharpbang}${sh} ;;
1473 *)
1474 esac
1475 cat >sharp <<EOSS
1476 $startsh
1477 set abc
1478 test "$?abc" != 1
1479 EOSS
1480
1481 chmod +x sharp
1482 $eunicefix sharp
1483 if ./sharp; then
1484         : echo "Yup, it does."
1485 else
1486         echo "Hmm... '$startsh' does not guarantee sh startup..."
1487         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1488 fi
1489 rm -f sharp
1490
1491 : Save command line options in file UU/cmdline.opt for later use in
1492 : generating config.sh.
1493 cat > cmdline.opt <<EOSH
1494 : Configure command line arguments.
1495 config_arg0='$0'
1496 config_args='$*'
1497 config_argc=$#
1498 EOSH
1499 argn=1
1500 args_exp=''
1501 args_sep=''
1502 for arg in "$@"; do
1503         cat >>cmdline.opt <<EOSH
1504 config_arg$argn='$arg'
1505 EOSH
1506         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1507 $arg
1508 EOC
1509         arg_exp=`cat cmdl.opt`
1510         args_exp="$args_exp$args_sep'$arg_exp'"
1511         argn=`expr $argn + 1`
1512         args_sep=' '
1513 done
1514 rm -f cmdl.opt
1515
1516 : produce awk script to parse command line options
1517 cat >options.awk <<'EOF'
1518 BEGIN {
1519         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1520
1521         len = length(optstr);
1522         for (i = 1; i <= len; i++) {
1523                 c = substr(optstr, i, 1);
1524                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1525                 if (a == ":") {
1526                         arg[c] = 1;
1527                         i++;
1528                 }
1529                 opt[c] = 1;
1530         }
1531 }
1532 {
1533         expect = 0;
1534         str = $0;
1535         if (substr(str, 1, 1) != "-") {
1536                 printf("'%s'\n", str);
1537                 next;
1538         }
1539         len = length($0);
1540         for (i = 2; i <= len; i++) {
1541                 c = substr(str, i, 1);
1542                 if (!opt[c]) {
1543                         printf("-%s\n", substr(str, i));
1544                         next;
1545                 }
1546                 printf("-%s\n", c);
1547                 if (arg[c]) {
1548                         if (i < len)
1549                                 printf("'%s'\n", substr(str, i + 1));
1550                         else
1551                                 expect = 1;
1552                         next;
1553                 }
1554         }
1555 }
1556 END {
1557         if (expect)
1558                 print "?";
1559 }
1560 EOF
1561
1562 : process the command line options
1563 set X `for arg in "$@"; do echo "X$arg"; done |
1564         sed -e s/X// | awk -f options.awk`
1565 eval "set $*"
1566 shift
1567 rm -f options.awk
1568
1569 : set up default values
1570 fastread=''
1571 reuseval=false
1572 config_sh=''
1573 alldone=''
1574 error=''
1575 silent=''
1576 extractsh=''
1577 override=''
1578 knowitall=''
1579 rm -f optdef.sh posthint.sh
1580 cat >optdef.sh <<EOS
1581 $startsh
1582 EOS
1583
1584
1585 : option parsing
1586 while test $# -gt 0; do
1587         case "$1" in
1588         -d) shift; fastread=yes;;
1589         -e) shift; alldone=cont;;
1590         -f)
1591                 shift
1592                 cd ..
1593                 if test -r "$1"; then
1594                         config_sh="$1"
1595                 else
1596                         echo "$me: cannot read config file $1." >&2
1597                         error=true
1598                 fi
1599                 cd UU
1600                 shift;;
1601         --help|\
1602         -h) shift; error=true;;
1603         -r) shift; reuseval=true;;
1604         -s) shift; silent=true; realsilent=true;;
1605         -E) shift; alldone=exit;;
1606         -K) shift; knowitall=true;;
1607         -O) shift; override=true;;
1608         -S) shift; silent=true; extractsh=true;;
1609         -D)
1610                 shift
1611                 case "$1" in
1612                 *=)
1613                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1614                         echo "$me: ignoring -D $1" >&2
1615                         ;;
1616                 *=*) echo "$1" | \
1617                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1618                 *) echo "$1='define'" >> optdef.sh;;
1619                 esac
1620                 shift
1621                 ;;
1622         -U)
1623                 shift
1624                 case "$1" in
1625                 *=) echo "$1" >> optdef.sh;;
1626                 *=*)
1627                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1628                         echo "$me: ignoring -U $1" >&2
1629                         ;;
1630                 *) echo "$1='undef'" >> optdef.sh;;
1631                 esac
1632                 shift
1633                 ;;
1634         -A)
1635             shift
1636             xxx=''
1637             yyy="$1"
1638             zzz=''
1639             uuu=undef
1640             case "$yyy" in
1641             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1642                  case "$zzz" in
1643                  *:*) zzz='' ;;
1644                  *)   xxx=append
1645                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1646                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1647                  esac
1648                  ;;
1649             esac
1650             case "$xxx" in
1651             '')  case "$yyy" in
1652                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1653                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1654                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1655                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1656                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1658                  esac
1659                  ;;
1660             esac
1661             case "$xxx" in
1662             append)
1663                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1664             clear)
1665                 echo "$yyy=''"                  >> posthint.sh ;;
1666             define)
1667                 case "$zzz" in
1668                 '') zzz=define ;;
1669                 esac
1670                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1671             eval)
1672                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1673             prepend)
1674                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1675             undef)
1676                 case "$zzz" in
1677                 '') zzz="$uuu" ;;
1678                 esac
1679                 echo "$yyy=$zzz"                >> posthint.sh ;;
1680             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1681             esac
1682             shift
1683             ;;
1684         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1685             exit 0;;
1686         --) break;;
1687         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1688         *) break;;
1689         esac
1690 done
1691
1692 case "$error" in
1693 true)
1694         cat >&2 <<EOM
1695 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1696                  [-U symbol] [-U symbol=] [-A command:symbol...]
1697   -d : use defaults for all answers.
1698   -e : go on without questioning past the production of config.sh.
1699   -f : specify an alternate default configuration file.
1700   -h : print this help message and exit (with an error status).
1701   -r : reuse C symbols value if possible (skips costly nm extraction).
1702   -s : silent mode, only echoes questions and essential information.
1703   -D : define symbol to have some value:
1704          -D symbol         symbol gets the value 'define'
1705          -D symbol=value   symbol gets the value 'value'
1706        common used examples (see INSTALL for more info):
1707          -Duse64bitint            use 64bit integers
1708          -Duse64bitall            use 64bit integers and pointers
1709          -Dusethreads             use thread support
1710          -Dinc_version_list=none  do not include older perl trees in @INC
1711          -DEBUGGING=none          DEBUGGING options
1712          -Dcc=gcc                 choose your compiler
1713          -Dprefix=/opt/perl5      choose your destination
1714   -E : stop at the end of questions, after having produced config.sh.
1715   -K : do not use unless you know what you are doing.
1716   -O : let -D and -U override definitions from loaded configuration file.
1717   -S : perform variable substitutions on all .SH files (can mix with -f)
1718   -U : undefine symbol:
1719          -U symbol    symbol gets the value 'undef'
1720          -U symbol=   symbol gets completely empty
1721        e.g.:  -Uversiononly
1722   -A : manipulate symbol after the platform specific hints have been applied:
1723          -A append:symbol=value   append value to symbol
1724          -A symbol=value          like append:, but with a separating space
1725          -A define:symbol=value   define symbol to have value
1726          -A clear:symbol          define symbol to be ''
1727          -A define:symbol         define symbol to be 'define'
1728          -A eval:symbol=value     define symbol to be eval of value
1729          -A prepend:symbol=value  prepend value to symbol
1730          -A undef:symbol          define symbol to be 'undef'
1731          -A undef:symbol=         define symbol to be ''
1732        e.g.:  -A prepend:libswanted='cl pthread '
1733               -A ccflags=-DSOME_MACRO
1734   -V : print version number and exit (with a zero status).
1735 EOM
1736         exit 1
1737         ;;
1738 esac
1739
1740 : Sanity checks
1741 case "$fastread$alldone" in
1742 yescont|yesexit) ;;
1743 *)
1744         case "$extractsh" in
1745         true) ;;
1746         *)
1747                 if test ! -t 0; then
1748                         echo "Say 'sh Configure', not 'sh <Configure'"
1749                         exit 1
1750                 fi
1751                 ;;
1752         esac
1753         ;;
1754 esac
1755
1756 exec 4>&1
1757 case "$silent" in
1758 true) exec 1>/dev/null;;
1759 esac
1760
1761 : run the defines and the undefines, if any, but leave the file out there...
1762 touch optdef.sh
1763 . ./optdef.sh
1764 : create the posthint manipulation script and leave the file out there...
1765 touch posthint.sh
1766
1767 : set package name
1768 package='perl5'
1769 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1770 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1771 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1772 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1773 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1774 esac
1775
1776 : Some greps do not return status, grrr.
1777 echo "grimblepritz" >grimble
1778 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1779         contains=contains
1780 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1781         contains=grep
1782 else
1783         contains=contains
1784 fi
1785 rm -f grimble
1786 : the following should work in any shell
1787 case "$contains" in
1788 contains*)
1789         echo " "
1790         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1791         cat >contains <<'EOSS'
1792 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1793 EOSS
1794 chmod +x contains
1795 esac
1796
1797 : Find the path to the source tree
1798 case "$src" in
1799 '') case "$0" in
1800     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1801          case "$src" in
1802          /*)    ;;
1803          .)     ;;
1804          *)     src=`cd ../$src && pwd` ;;
1805          esac
1806          ;;
1807     *)   src='.';;
1808     esac;;
1809 esac
1810 case "$src" in
1811 '')     src=/
1812         rsrc=/
1813         ;;
1814 /*)     rsrc="$src";;
1815 *)      rsrc="../$src";;
1816 esac
1817 if test -f $rsrc/Configure && \
1818         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1819 then
1820    : found it, so we are ok.
1821 else
1822         rsrc=''
1823         for src in . .. ../.. ../../.. ../../../..; do
1824                 if test -f ../$src/Configure && \
1825                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1826                 then
1827                         rsrc=../$src
1828                         break
1829                 fi
1830         done
1831 fi
1832 case "$rsrc" in
1833 '')
1834         cat <<EOM >&4
1835
1836 Sorry, I can't seem to locate the source dir for $package.  Please start
1837 Configure with an explicit path -- i.e. /some/path/Configure.
1838
1839 EOM
1840         exit 1
1841         ;;
1842 ../.)   rsrc='..';;
1843 *)
1844         echo " "
1845         echo "Sources for $package found in \"$src\"." >&4
1846         ;;
1847 esac
1848
1849 : script used to extract .SH files with variable substitutions
1850 cat >extract <<'EOS'
1851 PERL_CONFIG_SH=true
1852 echo "Doing variable substitutions on .SH files..."
1853 if test -f MANIFEST; then
1854         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1855 else
1856         echo "(Looking for .SH files under the source directory.)"
1857         set x `(cd "$src"; find . -name "*.SH" -print)`
1858 fi
1859 shift
1860 case $# in
1861 0) set x `(cd "$src"; echo *.SH)`; shift;;
1862 esac
1863 if test ! -f "$src/$1"; then
1864         shift
1865 fi
1866 mkdir_p='
1867 name=$1;
1868 create="";
1869 while test $name; do
1870         if test ! -d "$name"; then
1871                 create="$name $create";
1872                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1873                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1874         else
1875                 name="";
1876         fi;
1877 done;
1878 for file in $create; do
1879         mkdir $file;
1880 done
1881 '
1882 for file in $*; do
1883         case "$src" in
1884         ".")
1885                 case "$file" in
1886                 */*)
1887                         dir=`expr X$file : 'X\(.*\)/'`
1888                         file=`expr X$file : 'X.*/\(.*\)'`
1889                         (cd "$dir" && . ./$file)
1890                         ;;
1891                 *)
1892                         . ./$file
1893                         ;;
1894                 esac
1895                 ;;
1896         *)
1897                 case "$file" in
1898                 */*)
1899                         dir=`expr X$file : 'X\(.*\)/'`
1900                         file=`expr X$file : 'X.*/\(.*\)'`
1901                         (set x $dir; shift; eval $mkdir_p)
1902                         sh <"$src/$dir/$file"
1903                         ;;
1904                 *)
1905                         sh <"$src/$file"
1906                         ;;
1907                 esac
1908                 ;;
1909         esac
1910 done
1911 if test -f "$src/config_h.SH"; then
1912         if test ! -f config.h; then
1913         : oops, they left it out of MANIFEST, probably, so do it anyway.
1914         . "$src/config_h.SH"
1915         fi
1916 fi
1917 EOS
1918
1919 : extract files and exit if asked to do so
1920 case "$extractsh" in
1921 true)
1922         case "$realsilent" in
1923         true) ;;
1924         *) exec 1>&4;;
1925         esac
1926         case "$config_sh" in
1927         '') config_sh='config.sh';;
1928         esac
1929         echo " "
1930         echo "Fetching answers from $config_sh..."
1931         cd ..
1932         . $config_sh
1933         test "$override" && . ./optdef.sh
1934         echo " "
1935         . UU/extract
1936         rm -rf UU
1937         echo "Extraction done."
1938         exit 0
1939         ;;
1940 esac
1941
1942 : Eunice requires " " instead of "", can you believe it
1943 echo " "
1944 : Here we go...
1945 echo "Beginning of configuration questions for $package."
1946
1947 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1948
1949 : first determine how to suppress newline on echo command
1950 echo " "
1951 echo "Checking echo to see how to suppress newlines..."
1952 (echo "hi there\c" ; echo " ") >.echotmp
1953 if $contains c .echotmp >/dev/null 2>&1 ; then
1954         echo "...using -n."
1955         n='-n'
1956         c=''
1957 else
1958         cat <<'EOM'
1959 ...using \c
1960 EOM
1961         n=''
1962         c='\c'
1963 fi
1964 echo $n "The star should be here-->$c"
1965 echo '*'
1966 rm -f .echotmp
1967
1968 : Now test for existence of everything in MANIFEST
1969 echo " "
1970 if test -f "$rsrc/MANIFEST"; then
1971         echo "First let's make sure your kit is complete.  Checking..." >&4
1972         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1973                 (split -l 50 2>/dev/null || split -50)
1974         rm -f missing
1975         tmppwd=`pwd`
1976         for filelist in x??; do
1977                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1978                         >/dev/null 2>>"$tmppwd/missing")
1979         done
1980         if test -s missing; then
1981                 cat missing >&4
1982                 cat >&4 <<'EOM'
1983
1984 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1985
1986 You have the option of continuing the configuration process, despite the
1987 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1988 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1989 and contact the author (perlbug@perl.org).
1990
1991 EOM
1992                 echo $n "Continue? [n] $c" >&4
1993                 read ans
1994                 case "$ans" in
1995                 y*)
1996                         echo "Continuing..." >&4
1997                         rm -f missing
1998                         ;;
1999                 *)
2000                         echo "ABORTING..." >&4
2001                         kill $$
2002                         ;;
2003                 esac
2004         else
2005                 echo "Looks good..."
2006         fi
2007 else
2008         echo "There is no MANIFEST file.  I hope your kit is complete !"
2009 fi
2010 rm -f missing x??
2011
2012 : Find the appropriate value for a newline for tr
2013 echo " "
2014 if test -n "$DJGPP"; then
2015        trnl='\012'
2016 fi
2017 if test X"$trnl" = X; then
2018         case "`echo foo|tr '\n' x 2>/dev/null`" in
2019         foox) trnl='\n' ;;
2020         esac
2021 fi
2022 if test X"$trnl" = X; then
2023         case "`echo foo|tr '\012' x 2>/dev/null`" in
2024         foox) trnl='\012' ;;
2025         esac
2026 fi
2027 if test X"$trnl" = X; then
2028        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2029        fooxy) trnl='\n\r' ;;
2030        esac
2031 fi
2032 if test X"$trnl" = X; then
2033         cat <<EOM >&2
2034
2035 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2036
2037 EOM
2038         exit 1
2039 fi
2040
2041 : compute the number of columns on the terminal for proper question formatting
2042 case "$COLUMNS" in
2043 '') COLUMNS='80';;
2044 esac
2045
2046 : set up the echo used in my read
2047 myecho="case \"\$xxxm\" in
2048 '') echo $n \"\$rp $c\" >&4;;
2049 *) case \"\$rp\" in
2050         '') echo $n \"[\$xxxm] $c\";;
2051         *)
2052                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2053                         echo \"\$rp\" >&4
2054                         echo $n \"[\$xxxm] $c\" >&4
2055                 else
2056                         echo $n \"\$rp [\$xxxm] $c\" >&4
2057                 fi
2058                 ;;
2059         esac;;
2060 esac"
2061
2062 : now set up to do reads with possible shell escape and default assignment
2063 cat <<EOSC >myread
2064 $startsh
2065 xxxm=\$dflt
2066 $myecho
2067 ans='!'
2068 case "\$fastread" in
2069 yes) case "\$dflt" in
2070         '') ;;
2071         *) ans='';
2072                 case "\$silent-\$rp" in
2073                 true-) ;;
2074                 *) echo " " >&4;;
2075                 esac;;
2076         esac;;
2077 *) case "\$silent" in
2078         true) case "\$rp" in
2079                 '') ans='';;
2080                 esac;;
2081         esac;;
2082 esac
2083 while expr "X\$ans" : "X!" >/dev/null; do
2084         read answ
2085         set x \$xxxm
2086         shift
2087         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2088         case  "\$answ" in
2089         "!")
2090                 sh 1>&4
2091                 echo " "
2092                 $myecho
2093                 ;;
2094         !*)
2095                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2096                 shift
2097                 sh 1>&4 -c "\$*"
2098                 echo " "
2099                 $myecho
2100                 ;;
2101         "\$ans")
2102                 case "\$ans" in
2103                 \\&*)
2104                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2105                         shift
2106                         case "\$1" in
2107                         -d)
2108                                 fastread=yes
2109                                 echo "(OK, I'll run with -d after this question.)" >&4
2110                                 ;;
2111                         -*)
2112                                 echo "*** Sorry, \$1 not supported yet." >&4
2113                                 ;;
2114                         esac
2115                         $myecho
2116                         ans=!
2117                         ;;
2118                 esac;;
2119         *)
2120                 case "\$aok" in
2121                 y)
2122                         echo "*** Substitution done -- please confirm."
2123                         xxxm="\$ans"
2124                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2125                         xxxm="\$ans"
2126                         ans=!
2127                         ;;
2128                 *)
2129                         echo "*** Error -- try again."
2130                         ans=!
2131                         ;;
2132                 esac
2133                 $myecho
2134                 ;;
2135         esac
2136         case "\$ans\$xxxm\$nostick" in
2137         '')
2138                 ans=!
2139                 $myecho
2140                 ;;
2141         esac
2142 done
2143 case "\$ans" in
2144 '') ans="\$xxxm";;
2145 esac
2146 EOSC
2147
2148 : create .config dir to save info across Configure sessions
2149 test -d ../.config || mkdir ../.config
2150 cat >../.config/README <<EOF
2151 This directory created by Configure to save information that should
2152 persist across sessions for $package.
2153
2154 You may safely delete it if you wish.
2155 EOF
2156
2157 : See if we are using a devel version and want that
2158 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2159 case "$usedevel" in
2160 $define|true|[yY]*)
2161     usedevel="$define" ;;
2162 *) case "$xversion" in
2163    *[13579])
2164         cat >&4 <<EOH
2165 *** WHOA THERE!!! ***
2166
2167     This is an UNSTABLE DEVELOPMENT release.
2168     The version of this $package distribution is $xversion, that is, odd,
2169     (as opposed to even) and that signifies a development release.
2170     If you want a maintenance release, you want an even-numbered version.
2171
2172     Do ***NOT*** install this into production use.
2173     Data corruption and crashes are possible.
2174
2175     It is most seriously suggested that you do not continue any further
2176     unless you want to help in developing and debugging Perl.
2177
2178     If you *still* want to build perl, you can answer 'y' now,
2179     or pass -Dusedevel to Configure.
2180
2181 EOH
2182         rp='Do you really want to continue?'
2183         dflt='n'
2184         . ./myread
2185         case "$ans" in
2186         [yY]) echo >&4 "Okay, continuing."
2187               usedevel="$define" ;;
2188         *) echo >&4 "Okay, bye."
2189            exit 1
2190            ;;
2191         esac
2192         ;;
2193     esac
2194     usedevel="$undef"
2195     ;;
2196 esac
2197 case "$usedevel" in
2198 $define|true|[yY]*)
2199         case "$versiononly" in
2200         '') versiononly="$define" ;;
2201         esac
2202         case "$installusrbinperl" in
2203         '') installusrbinperl="$undef" ;;
2204         esac
2205         ;;
2206 esac
2207
2208 : general instructions
2209 needman=true
2210 firsttime=true
2211 user=`(logname) 2>/dev/null`
2212 case "$user" in
2213 '') user=`whoami 2>&1`;;
2214 esac
2215 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2216         firsttime=false
2217         echo " "
2218         rp='Would you like to see the instructions?'
2219         dflt=n
2220         . ./myread
2221         case "$ans" in
2222         [yY]*) ;;
2223         *) needman=false;;
2224         esac
2225 fi
2226 if $needman; then
2227         cat <<EOH
2228
2229 This installation shell script will examine your system and ask you questions
2230 to determine how the perl5 package should be installed. If you get
2231 stuck on a question, you may use a ! shell escape to start a subshell or
2232 execute a command.  Many of the questions will have default answers in square
2233 brackets; typing carriage return will give you the default.
2234
2235 On some of the questions which ask for file or directory names you are allowed
2236 to use the ~name construct to specify the login directory belonging to "name",
2237 even if you don't have a shell which knows about that.  Questions where this is
2238 allowed will be marked "(~name ok)".
2239
2240 EOH
2241         rp=''
2242         dflt='Type carriage return to continue'
2243         . ./myread
2244         cat <<'EOH'
2245
2246 The prompter used in this script allows you to use shell variables and
2247 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2248 in the default answer, as if the default line was a set of arguments given to a
2249 script shell.  This means you may also use $* to repeat the whole default line,
2250 so you do not have to re-type everything to add something to the default.
2251
2252 Everytime there is a substitution, you will have to confirm.  If there is an
2253 error (e.g. an unmatched backtick), the default answer will remain unchanged
2254 and you will be prompted again.
2255
2256 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2257 the questions and use the computed defaults (or the previous answers if there
2258 was already a config.sh file). Type 'Configure -h' for a list of options.
2259 You may also start interactively and then answer '& -d' at any prompt to turn
2260 on the non-interactive behaviour for the remainder of the execution.
2261
2262 EOH
2263         . ./myread
2264         cat <<EOH
2265
2266 Much effort has been expended to ensure that this shell script will run on any
2267 Unix system.  If despite that it blows up on yours, your best bet is to edit
2268 Configure and run it again.  If you can't run Configure for some reason,
2269 you'll have to generate a config.sh file by hand.  Whatever problems you
2270 have, let me (perlbug@perl.org) know how I blew it.
2271
2272 This installation script affects things in two ways:
2273
2274 1) it may do direct variable substitutions on some of the files included
2275    in this kit.
2276 2) it builds a config.h file for inclusion in C programs.  You may edit
2277    any of these files as the need arises after running this script.
2278
2279 If you make a mistake on a question, there is no easy way to back up to it
2280 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2281 files.  Configure will offer to let you do this before it runs the SH files.
2282
2283 EOH
2284         dflt='Type carriage return to continue'
2285         . ./myread
2286         case "$firsttime" in
2287         true) echo $user >>../.config/instruct;;
2288         esac
2289 fi
2290
2291 : find out where common programs are
2292 echo " "
2293 echo "Locating common programs..." >&4
2294 cat <<EOSC >loc
2295 $startsh
2296 case \$# in
2297 0) exit 1;;
2298 esac
2299 thing=\$1
2300 shift
2301 dflt=\$1
2302 shift
2303 for dir in \$*; do
2304         case "\$thing" in
2305         .)
2306         if test -d \$dir/\$thing; then
2307                 echo \$dir
2308                 exit 0
2309         fi
2310         ;;
2311         *)
2312         for thisthing in \$dir/\$thing; do
2313                 : just loop through to pick last item
2314         done
2315         if test -f \$thisthing; then
2316                 echo \$thisthing
2317                 exit 0
2318         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2319                 echo \$thisthing
2320                 exit 0
2321         elif test -f \$dir/\$thing.exe; then
2322                 if test -n "$DJGPP"; then
2323                         echo \$dir/\$thing.exe
2324                 elif test "$eunicefix" != ":"; then
2325                         : on Eunice apparently
2326                         echo \$dir/\$thing
2327                 fi
2328                 exit 0
2329         fi
2330         ;;
2331         esac
2332 done
2333 echo \$dflt
2334 exit 1
2335 EOSC
2336 chmod +x loc
2337 $eunicefix loc
2338 loclist="
2339 awk
2340 cat
2341 chmod
2342 comm
2343 cp
2344 echo
2345 expr
2346 grep
2347 ls
2348 mkdir
2349 rm
2350 sed
2351 sort
2352 touch
2353 tr
2354 uniq
2355 "
2356 trylist="
2357 ar
2358 bison
2359 byacc
2360 cpp
2361 csh
2362 date
2363 egrep
2364 gmake
2365 gzip
2366 less
2367 ln
2368 make
2369 more
2370 nm
2371 nroff
2372 pg
2373 test
2374 uname
2375 zip
2376 "
2377 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2378 pth="$pth /lib /usr/lib"
2379 for file in $loclist; do
2380         eval xxx=\$$file
2381         case "$xxx" in
2382         /*|?:[\\/]*)
2383                 if test -f "$xxx"; then
2384                         : ok
2385                 else
2386                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2387                         xxx=`./loc $file $file $pth`
2388                 fi
2389                 ;;
2390         '') xxx=`./loc $file $file $pth`;;
2391         *) xxx=`./loc $xxx $xxx $pth`;;
2392         esac
2393         eval $file=$xxx$_exe
2394         eval _$file=$xxx
2395         case "$xxx" in
2396         /*)
2397                 echo $file is in $xxx.
2398                 ;;
2399         ?:[\\/]*)
2400                 echo $file is in $xxx.
2401                 ;;
2402         *)
2403                 echo "I don't know where '$file' is, and my life depends on it." >&4
2404                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2405                 exit 1
2406                 ;;
2407         esac
2408 done
2409 echo " "
2410 echo "Don't worry if any of the following aren't found..."
2411 say=offhand
2412 for file in $trylist; do
2413         eval xxx=\$$file
2414         case "$xxx" in
2415         /*|?:[\\/]*)
2416                 if test -f "$xxx"; then
2417                         : ok
2418                 else
2419                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2420                         xxx=`./loc $file $file $pth`
2421                 fi
2422                 ;;
2423         '') xxx=`./loc $file $file $pth`;;
2424         *) xxx=`./loc $xxx $xxx $pth`;;
2425         esac
2426         eval $file=$xxx$_exe
2427         eval _$file=$xxx
2428         case "$xxx" in
2429         /*)
2430                 echo $file is in $xxx.
2431                 ;;
2432         ?:[\\/]*)
2433                 echo $file is in $xxx.
2434                 ;;
2435         *)
2436                 echo "I don't see $file out there, $say."
2437                 say=either
2438                 ;;
2439         esac
2440 done
2441 case "$egrep" in
2442 egrep)
2443         echo "Substituting grep for egrep."
2444         egrep=$grep
2445         _egrep=$grep
2446         ;;
2447 esac
2448 case "$ln" in
2449 ln)
2450         echo "Substituting cp for ln."
2451         ln=$cp
2452         _ln=$cp
2453         ;;
2454 esac
2455 case "$make" in
2456 make)
2457         case "$gmake" in
2458         gmake)
2459         echo "I can't find make or gmake, and my life depends on it." >&4
2460         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2461         exit 1
2462         ;;
2463         esac
2464         ;;
2465 esac
2466 case "$gmake" in
2467 gmake)  ;;
2468 *)      # We can't have osname yet.
2469         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2470                 # Assume that gmake, if found, is definitely GNU make
2471                 # and prefer it over the system make.
2472                 echo "Substituting gmake for make."
2473                 make=$gmake
2474                 _make=$gmake
2475         fi
2476         ;;
2477 esac
2478 case "$test" in
2479 test)
2480         echo "Hopefully test is built into your sh."
2481         ;;
2482 *)
2483         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2484                 echo "Using the test built into your sh."
2485                 test=test
2486                 _test=test
2487         fi
2488         ;;
2489 esac
2490 case "$echo" in
2491 echo)
2492         echo "Hopefully echo is built into your sh."
2493         ;;
2494 '') ;;
2495 *)
2496         echo " "
2497 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2498         $echo $n "hi there$c" >foo1
2499         echo $n "hi there$c" >foo2
2500         if cmp foo1 foo2 >/dev/null 2>&1; then
2501                 echo "They are compatible.  In fact, they may be identical."
2502         else
2503                 case "$n" in
2504                 '-n') n='' c='\c';;
2505                 *) n='-n' c='';;
2506                 esac
2507                 cat <<FOO
2508 They are not compatible!  You are probably running ksh on a non-USG system.
2509 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2510 have echo built in and we may have to run some Bourne shell scripts.  That
2511 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2512
2513 FOO
2514                 $echo $n "The star should be here-->$c"
2515                 $echo "*"
2516         fi
2517         $rm -f foo1 foo2
2518         ;;
2519 esac
2520
2521 # This question was auctioned at YAPC::Europe-2007 in Vienna
2522 # I never promised you could answer it. I only auctioned the question.
2523 cat <<FOO
2524 The following message is sponsored by
2525
2526   Dresden.pm<--The stars should be here.
2527
2528 Dear Perl user, system administrator or package
2529 maintainer, the Perl community sends greetings to
2530 you. Do you (emblematical) greet back [Y/n]? n
2531
2532 FOO
2533
2534 : Check what type of C compiler we use
2535 cat <<EOS >trygcc
2536 $startsh
2537 EOS
2538 cat <<'EOSC' >>trygcc
2539 case "$cc" in
2540 '') ;;
2541 *)  $rm -f try try.*
2542     $cat >try.c <<EOM
2543 int main(int argc, char *argv[]) {
2544   return 0;
2545 }
2546 EOM
2547     if $cc -o try $ccflags $ldflags try.c; then
2548        :
2549     else
2550         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2551         despair=yes
2552         trygcc=yes
2553         case "$cc" in
2554         *gcc*) trygcc=no ;;
2555         esac
2556         # Skip this test because it gives a false match on output like:
2557         #    ./trygcc: line 23: cc: command not found
2558         # case "`$cc -v -c try.c 2>&1`" in
2559         # *gcc*) trygcc=no ;;
2560         # esac
2561         if $test X"$trygcc" = Xyes; then
2562             if gcc -o try -c try.c; then
2563                 echo " "
2564                 echo "You seem to have a working gcc, though." >&4
2565                 # Switching compilers may undo the work of hints files.
2566                 # The most common problem is -D_REENTRANT for threads.
2567                 # This heuristic catches that case, but gets false positives
2568                 # if -Dusethreads was not actually specified.  Better to
2569                 # bail out here with a useful message than fail 
2570                 # mysteriously later. Should we perhaps just try to
2571                 # re-invoke Configure -Dcc=gcc config_args ?
2572                 if $test -f usethreads.cbu; then
2573                         $cat >&4 <<EOM 
2574
2575 *** However, any setting of the C compiler flags (e.g. for thread support)
2576 *** will be lost.  It may be necessary for you to restart Configure and
2577 *** add -Dcc=gcc to your Configure command line.
2578
2579 EOM
2580                         rp="Would you like to go ahead and try gcc anyway?"
2581                         dflt=n
2582                 else
2583                         rp="Would you like to use it?"
2584                         dflt=y
2585                 fi
2586                 if $test -f myread; then
2587                     . ./myread
2588                 else
2589                     if $test -f UU/myread; then
2590                         . ./UU/myread
2591                     else
2592                         echo "Cannot find myread, sorry.  Aborting." >&2
2593                         exit 1
2594                     fi
2595                 fi  
2596                 case "$ans" in
2597                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2598                 esac
2599             fi
2600         fi
2601     fi
2602     $rm -f try try.*
2603     ;;
2604 esac
2605 EOSC
2606
2607 cat <<EOS >checkcc
2608 $startsh
2609 EOS
2610 cat <<'EOSC' >>checkcc
2611 case "$cc" in        
2612 '') ;;
2613 *)  $rm -f try try.*              
2614     $cat >try.c <<EOM
2615 int main(int argc, char *argv[]) {
2616   return 0;
2617 }
2618 EOM
2619     if $cc -o try $ccflags $ldflags try.c; then
2620        :
2621     else
2622         if $test X"$despair" = Xyes; then
2623            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2624         fi
2625         $cat >&4 <<EOM         
2626 You need to find a working C compiler.
2627 Either (purchase and) install the C compiler supplied by your OS vendor,
2628 or for a free C compiler try http://gcc.gnu.org/
2629 I cannot continue any further, aborting.
2630 EOM
2631         exit 1
2632     fi
2633     $rm -f try try.*
2634     ;;
2635 esac
2636 EOSC
2637
2638 : determine whether symbolic links are supported
2639 echo " "
2640 $touch blurfl
2641 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2642         echo "Symbolic links are supported." >&4
2643         lns="$ln -s"
2644 else
2645         echo "Symbolic links are NOT supported." >&4
2646         lns="$ln"
2647 fi
2648 $rm -f blurfl sym
2649
2650 : determine whether symbolic links are supported
2651 echo " "
2652 case "$lns" in
2653 *"ln"*" -s")
2654         echo "Checking how to test for symbolic links..." >&4
2655         $lns blurfl sym
2656         if $test "X$issymlink" = X; then
2657                 case "$newsh" in
2658                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2659                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2660                 esac
2661                 if test $? = 0; then
2662                         issymlink="test -h"
2663                 else
2664                         echo "Your builtin 'test -h' may be broken." >&4
2665                         case "$test" in
2666                         /*)     ;;
2667                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2668                                 for p in $pth
2669                                 do
2670                                         if test -f "$p/$test"; then
2671                                                 test="$p/$test"
2672                                                 break
2673                                         fi
2674                                 done
2675                                 ;;
2676                         esac
2677                         case "$test" in
2678                         /*)
2679                                 echo "Trying external '$test -h'." >&4
2680                                 issymlink="$test -h"
2681                                 if $test ! -h sym >/dev/null 2>&1; then
2682                                         echo "External '$test -h' is broken, too." >&4
2683                                         issymlink=''
2684                                 fi
2685                                 ;;
2686                         *)      issymlink='' ;;
2687                         esac
2688                 fi              
2689         fi
2690         if $test "X$issymlink" = X; then
2691                 if $test -L sym 2>/dev/null; then
2692                         issymlink="$test -L"
2693                         echo "The builtin '$test -L' worked." >&4
2694                 fi
2695         fi
2696         if $test "X$issymlink" != X; then
2697                 echo "You can test for symbolic links with '$issymlink'." >&4
2698         else
2699                 echo "I do not know how you can test for symbolic links." >&4
2700         fi
2701         $rm -f blurfl sym
2702         ;;
2703 *)      echo "No symbolic links, so not testing for their testing..." >&4
2704         ;;
2705 esac
2706 echo " "
2707
2708 : Make symlinks util
2709 case "$mksymlinks" in
2710 $define|true|[yY]*)
2711         case "$src" in
2712         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2713                 exit 1
2714                 ;;
2715         *)      case "$lns:$issymlink" in
2716                 *"ln"*" -s:"*"test -"?)
2717                         echo "Creating the symbolic links..." >&4
2718                         echo "(First creating the subdirectories...)" >&4
2719                         cd ..
2720                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2721                                 read directory
2722                                 test -z "$directory" && break
2723                                 mkdir -p $directory
2724                         done
2725                         # Sanity check 1.
2726                         if test ! -d t/base; then
2727                                 echo "Failed to create the subdirectories.  Aborting." >&4
2728                                 exit 1
2729                         fi
2730                         echo "(Then creating the symlinks...)" >&4
2731                         awk '{print $1}' $src/MANIFEST | while true; do
2732                                 read filename
2733                                 test -z "$filename" && break
2734                                 if test -f $filename; then
2735                                         if $issymlink $filename; then
2736                                                 rm -f $filename
2737                                         fi
2738                                 fi
2739                                 if test -f $filename; then
2740                                         echo "$filename already exists, not symlinking."
2741                                 else
2742                                         ln -s $src/$filename $filename
2743                                 fi
2744                         done
2745                         # Sanity check 2.
2746                         if test ! -f t/base/lex.t; then
2747                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2748                                 exit 1
2749                         fi
2750                         cd UU
2751                         ;;
2752                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2753                         ;;
2754                 esac
2755                 ;;
2756         esac
2757         ;;
2758 esac
2759
2760 : Check for Cross-Compilation
2761 case "$usecrosscompile" in
2762 $define|true|[yY]*)
2763         $echo "Cross-compiling..."
2764         croak=''
2765         case "$cc" in
2766         *-*-gcc) # A cross-compiling gcc, probably.
2767             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2768             ar=$targetarch-ar
2769             # leave out ld, choosing it is more complex
2770             nm=$targetarch-nm
2771             ranlib=$targetarch-ranlib
2772             $echo 'extern int foo;' > try.c
2773             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2774             shift
2775             if $test $# -gt 0; then
2776                 incpth="$incpth $*"
2777                 incpth="`$echo $incpth|$sed 's/^ //'`"
2778                 echo "Guessing incpth '$incpth'." >&4
2779                 for i in $*; do
2780                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2781                     if $test -d $j; then
2782                         libpth="$libpth $j"
2783                     fi
2784                 done   
2785                 libpth="`$echo $libpth|$sed 's/^ //'`"
2786                 echo "Guessing libpth '$libpth'." >&4
2787             fi
2788             $rm -f try.c
2789             ;;
2790         esac
2791         case "$targetarch" in
2792         '') echo "Targetarch not defined." >&4; croak=y ;;
2793         *)  echo "Using targetarch $targetarch." >&4 ;;
2794         esac
2795         case "$incpth" in
2796         '') echo "Incpth not defined." >&4; croak=y ;;
2797         *)  echo "Using incpth '$incpth'." >&4 ;;
2798         esac
2799         case "$libpth" in
2800         '') echo "Libpth not defined." >&4; croak=y ;;
2801         *)  echo "Using libpth '$libpth'." >&4 ;;
2802         esac
2803         case "$usrinc" in
2804         '') for i in $incpth; do
2805                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2806                     usrinc=$i
2807                     echo "Guessing usrinc $usrinc." >&4
2808                     break
2809                 fi
2810             done
2811             case "$usrinc" in
2812             '') echo "Usrinc not defined." >&4; croak=y ;;
2813             esac
2814             ;;
2815         *)  echo "Using usrinc $usrinc." >&4 ;;
2816         esac
2817         case "$targethost" in
2818         '') echo "Targethost not defined." >&4; croak=y ;;
2819         *)  echo "Using targethost $targethost." >&4
2820         esac
2821         locincpth=' '
2822         loclibpth=' '
2823         case "$croak" in
2824         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2825         esac
2826         case "$src" in
2827         /*) run=$src/Cross/run
2828             targetmkdir=$src/Cross/mkdir
2829             to=$src/Cross/to
2830             from=$src/Cross/from
2831             ;;
2832         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2833             run=$pwd/Cross/run
2834             targetmkdir=$pwd/Cross/mkdir
2835             to=$pwd/Cross/to
2836             from=$pwd/Cross/from
2837             ;;
2838         esac
2839         case "$targetrun" in
2840         '') targetrun=ssh ;;
2841         esac
2842         case "$targetto" in
2843         '') targetto=scp ;;
2844         esac
2845         case "$targetfrom" in
2846         '') targetfrom=scp ;;
2847         esac
2848         run=$run-$targetrun
2849         to=$to-$targetto
2850         from=$from-$targetfrom
2851         case "$targetdir" in
2852         '')  targetdir=/tmp
2853              echo "Guessing targetdir $targetdir." >&4
2854              ;;
2855         esac
2856         case "$targetuser" in
2857         '')  targetuser=root
2858              echo "Guessing targetuser $targetuser." >&4
2859              ;;
2860         esac
2861         case "$targetfrom" in
2862         scp)    q=-q ;;
2863         *)      q='' ;;
2864         esac
2865         case "$targetrun" in
2866         ssh|rsh)
2867             cat >$run <<EOF
2868 #!/bin/sh
2869 case "\$1" in
2870 -cwd)
2871   shift
2872   cwd=\$1
2873   shift
2874   ;;
2875 esac
2876 case "\$cwd" in
2877 '') cwd=$targetdir ;;
2878 esac
2879 exe=\$1
2880 shift
2881 if $test ! -f \$exe.xok; then
2882   $to \$exe
2883   $touch \$exe.xok
2884 fi
2885 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2886 EOF
2887             ;;
2888         *)  echo "Unknown targetrun '$targetrun'" >&4
2889             exit 1
2890             ;;
2891         esac
2892         case "$targetmkdir" in
2893         */Cross/mkdir)
2894             cat >$targetmkdir <<EOF
2895 #!/bin/sh
2896 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2897 EOF
2898             $chmod a+rx $targetmkdir
2899             ;;
2900         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2901             exit 1
2902             ;;
2903         esac
2904         case "$targetto" in
2905         scp|rcp)
2906             cat >$to <<EOF
2907 #!/bin/sh
2908 for f in \$@
2909 do
2910   case "\$f" in
2911   /*)
2912     $targetmkdir \`dirname \$f\`
2913     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2914     ;;
2915   *)
2916     $targetmkdir $targetdir/\`dirname \$f\`
2917     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2918     ;;
2919   esac
2920 done
2921 exit 0
2922 EOF
2923             ;;
2924         cp) cat >$to <<EOF
2925 #!/bin/sh
2926 for f in \$@
2927 do
2928   case "\$f" in
2929   /*)
2930     $mkdir -p $targetdir/\`dirname \$f\`
2931     $cp \$f $targetdir/\$f || exit 1
2932     ;;
2933   *)
2934     $targetmkdir $targetdir/\`dirname \$f\`
2935     $cp \$f $targetdir/\$f || exit 1
2936     ;;
2937   esac
2938 done
2939 exit 0
2940 EOF
2941             ;;
2942         *)  echo "Unknown targetto '$targetto'" >&4
2943             exit 1
2944             ;;
2945         esac
2946         case "$targetfrom" in
2947         scp|rcp)
2948           cat >$from <<EOF
2949 #!/bin/sh
2950 for f in \$@
2951 do
2952   $rm -f \$f
2953   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2954 done
2955 exit 0
2956 EOF
2957             ;;
2958         cp) cat >$from <<EOF
2959 #!/bin/sh
2960 for f in \$@
2961 do
2962   $rm -f \$f
2963   cp $targetdir/\$f . || exit 1
2964 done
2965 exit 0
2966 EOF
2967             ;;
2968         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2969             exit 1
2970             ;;
2971         esac
2972         if $test ! -f $run; then
2973             echo "Target 'run' script '$run' not found." >&4
2974         else
2975             $chmod a+rx $run
2976         fi
2977         if $test ! -f $to; then
2978             echo "Target 'to' script '$to' not found." >&4
2979         else
2980             $chmod a+rx $to
2981         fi
2982         if $test ! -f $from; then
2983             echo "Target 'from' script '$from' not found." >&4
2984         else
2985             $chmod a+rx $from
2986         fi
2987         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2988             exit 1
2989         fi
2990         cat >&4 <<EOF
2991 Using '$run' for remote execution,
2992 and '$from' and '$to'
2993 for remote file transfer.
2994 EOF
2995         ;;
2996 *)      run=''
2997         to=:
2998         from=:
2999         usecrosscompile='undef'
3000         targetarch=''
3001         ;;
3002 esac
3003
3004 : see whether [:lower:] and [:upper:] are supported character classes
3005 echo " "
3006 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3007 ABYZ)
3008         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3009         up='[:upper:]'
3010         low='[:lower:]'
3011         ;;
3012 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3013         # (0xd9 and 0xe2), therefore that is a nice testing point.
3014         if test "X$up" = X -o "X$low" = X; then
3015             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3016             rs) up='[A-Z]'
3017                 low='[a-z]'
3018                 ;;
3019             esac
3020         fi
3021         if test "X$up" = X -o "X$low" = X; then
3022             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3023             rs) up='A-Z'
3024                 low='a-z'
3025                 ;;
3026             esac
3027         fi
3028         if test "X$up" = X -o "X$low" = X; then
3029             case "`echo RS | od -x 2>/dev/null`" in
3030             *D9E2*|*d9e2*)
3031                 echo "Hey, this might be EBCDIC." >&4
3032                 if test "X$up" = X -o "X$low" = X; then
3033                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3034                     rs) up='[A-IJ-RS-Z]'
3035                         low='[a-ij-rs-z]'
3036                         ;;
3037                     esac
3038                 fi
3039                 if test "X$up" = X -o "X$low" = X; then
3040                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3041                     rs) up='A-IJ-RS-Z'
3042                         low='a-ij-rs-z'
3043                         ;;
3044                     esac
3045                 fi
3046                 ;;
3047             esac
3048         fi
3049 esac
3050 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3051 rs)
3052     echo "Using $up and $low to convert case." >&4
3053     ;;
3054 *)
3055     echo "I don't know how to translate letters from upper to lower case." >&4
3056     echo "Your tr is not acting any way I know of." >&4
3057     exit 1
3058     ;;
3059 esac
3060 : set up the translation script tr, must be called with ./tr of course
3061 cat >tr <<EOSC
3062 $startsh
3063 case "\$1\$2" in
3064 '[A-Z][a-z]') exec $tr '$up' '$low';;
3065 '[a-z][A-Z]') exec $tr '$low' '$up';;
3066 esac
3067 exec $tr "\$@"
3068 EOSC
3069 chmod +x tr
3070 $eunicefix tr
3071
3072 : Try to determine whether config.sh was made on this system
3073 case "$config_sh" in
3074 '')
3075 myuname=`$uname -a 2>/dev/null`
3076 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3077 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3078 # because the A-Z/a-z are not consecutive.
3079 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3080         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3081 newmyuname="$myuname"
3082 dflt=n
3083 case "$knowitall" in
3084 '')
3085         if test -f ../config.sh; then
3086                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3087                         eval "`grep myuname= ../config.sh`"
3088                 fi
3089                 if test "X$myuname" = "X$newmyuname"; then
3090                         dflt=y
3091                 fi
3092         fi
3093         ;;
3094 *) dflt=y;;
3095 esac
3096
3097 : Get old answers from old config file if Configure was run on the
3098 : same system, otherwise use the hints.
3099 hint=default
3100 cd ..
3101 if test -f config.sh; then
3102         echo " "
3103         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3104         . UU/myread
3105         case "$ans" in
3106         n*|N*) echo "OK, I'll ignore it."
3107                 mv config.sh config.sh.old
3108                 myuname="$newmyuname"
3109                 ;;
3110         *)  echo "Fetching default answers from your old config.sh file..." >&4
3111                 tmp_n="$n"
3112                 tmp_c="$c"
3113                 tmp_sh="$sh"
3114                 . ./config.sh
3115                 cp config.sh UU
3116                 n="$tmp_n"
3117                 c="$tmp_c"
3118                 : Older versions did not always set $sh.  Catch re-use of such
3119                 : an old config.sh.
3120                 case "$sh" in
3121                 '') sh="$tmp_sh" ;;
3122                 esac
3123                 hint=previous
3124                 ;;
3125         esac
3126 fi
3127 . ./UU/checkcc
3128 if test ! -f config.sh; then
3129         $cat <<EOM
3130
3131 First time through, eh?  I have some defaults handy for some systems
3132 that need some extra help getting the Configure answers right:
3133
3134 EOM
3135         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3136         dflt=''
3137         : Half the following guesses are probably wrong... If you have better
3138         : tests or hints, please send them to perlbug@perl.org
3139         : The metaconfig authors would also appreciate a copy...
3140         $test -f /irix && osname=irix
3141         $test -f /xenix && osname=sco_xenix
3142         $test -f /dynix && osname=dynix
3143         $test -f /dnix && osname=dnix
3144         $test -f /lynx.os && osname=lynxos
3145         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3146         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3147         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3148         $test -f /bin/mips && /bin/mips && osname=mips
3149         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3150                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3151         $test -d /usr/apollo/bin && osname=apollo
3152         $test -f /etc/saf/_sactab && osname=svr4
3153         $test -d /usr/include/minix && osname=minix
3154         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3155         if $test -d /MachTen -o -d /MachTen_Folder; then
3156                 osname=machten
3157                 if $test -x /sbin/version; then
3158                         osvers=`/sbin/version | $awk '{print $2}' |
3159                         $sed -e 's/[A-Za-z]$//'`
3160                 elif $test -x /usr/etc/version; then
3161                         osvers=`/usr/etc/version | $awk '{print $2}' |
3162                         $sed -e 's/[A-Za-z]$//'`
3163                 else
3164                         osvers="$2.$3"
3165                 fi
3166         fi
3167
3168         $test -f /sys/posix.dll &&
3169                 $test -f /usr/bin/what &&
3170                 set X `/usr/bin/what /sys/posix.dll` &&
3171                 $test "$3" = UWIN &&
3172                 osname=uwin &&
3173                 osvers="$5"
3174
3175         if $test -f $uname; then
3176                 set X $myuname
3177                 shift
3178
3179                 case "$5" in
3180                 fps*) osname=fps ;;
3181                 mips*)
3182                         case "$4" in
3183                         umips) osname=umips ;;
3184                         *) osname=mips ;;
3185                         esac;;
3186                 [23]100) osname=mips ;;
3187                 next*) osname=next ;;
3188                 i386*)
3189                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3190                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3191                                 osname='sco'
3192                                 osvers=$tmp
3193                         elif $test -f /etc/kconfig; then
3194                                 osname=isc
3195                                 if test "$lns" = "$ln -s"; then
3196                                         osvers=4
3197                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3198                                         osvers=3
3199                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3200                                         osvers=2
3201                                 fi
3202                         fi
3203                         tmp=''
3204                         ;;
3205                 pc*)
3206                         if test -n "$DJGPP"; then
3207                                 osname=dos
3208                                 osvers=djgpp
3209                         fi
3210                         ;;
3211                 esac
3212
3213                 case "$1" in
3214                 aix) osname=aix
3215                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3216                         case "$tmp" in
3217                         # oslevel can fail with:
3218                         # oslevel: Unable to acquire lock.
3219                         *not\ found) osvers="$4"."$3" ;;
3220                         '<3240'|'<>3240') osvers=3.2.0 ;;
3221                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3222                         '=3250'|'>3250') osvers=3.2.5 ;;
3223                         *) osvers=$tmp;;
3224                         esac
3225                         ;;
3226                 bsd386) osname=bsd386
3227                         osvers=`$uname -r`
3228                         ;;
3229                 cygwin*) osname=cygwin
3230                         osvers="$3"
3231                         ;;
3232                 *dc.osx) osname=dcosx
3233                         osvers="$3"
3234                         ;;
3235                 dnix) osname=dnix
3236                         osvers="$3"
3237                         ;;
3238                 domainos) osname=apollo
3239                         osvers="$3"
3240                         ;;
3241                 dgux)   osname=dgux
3242                         osvers="$3"
3243                         ;;
3244                 dragonfly) osname=dragonfly
3245                         osvers="$3"
3246                         ;;
3247                 dynixptx*) osname=dynixptx
3248                         osvers=`echo "$4"|sed 's/^v//'`
3249                         ;;
3250                 freebsd) osname=freebsd
3251                         osvers="$3" ;;
3252                 genix)  osname=genix ;;
3253                 gnu)    osname=gnu
3254                         osvers="$3" ;;
3255                 hp*)    osname=hpux
3256                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3257                         ;;
3258                 irix*)  osname=irix
3259                         case "$3" in
3260                         4*) osvers=4 ;;
3261                         5*) osvers=5 ;;
3262                         *)      osvers="$3" ;;
3263                         esac
3264                         ;;
3265                 linux)  osname=linux
3266                         case "$3" in
3267                         *)      osvers="$3" ;;
3268                         esac
3269                         ;;
3270                 MiNT)   osname=mint
3271                         ;;
3272                 netbsd*) osname=netbsd
3273                         osvers="$3"
3274                         ;;
3275                 news-os) osvers="$3"
3276                         case "$3" in
3277                         4*) osname=newsos4 ;;
3278                         *) osname=newsos ;;
3279                         esac
3280                         ;;
3281                 next*) osname=next ;;
3282                 nonstop-ux) osname=nonstopux ;;
3283                 openbsd) osname=openbsd
3284                         osvers="$3"
3285                         ;;
3286                 os2)    osname=os2
3287                         osvers="$4"
3288                         ;;
3289                 POSIX-BC | posix-bc ) osname=posix-bc
3290                         osvers="$3"
3291                         ;;
3292                 powerux | power_ux | powermax_os | powermaxos | \
3293                 powerunix | power_unix) osname=powerux
3294                         osvers="$3"
3295                         ;;
3296                 qnx) osname=qnx
3297                         osvers="$4"
3298                         ;;
3299                 solaris) osname=solaris
3300                         case "$3" in
3301                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3302                         *)      osvers="$3" ;;
3303                         esac
3304                         ;;
3305                 sunos) osname=sunos
3306                         case "$3" in
3307                         5*) osname=solaris
3308                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3309                         *)      osvers="$3" ;;
3310                         esac
3311                         ;;
3312                 titanos) osname=titanos
3313                         case "$3" in
3314                         1*) osvers=1 ;;
3315                         2*) osvers=2 ;;
3316                         3*) osvers=3 ;;
3317                         4*) osvers=4 ;;
3318                         *)      osvers="$3" ;;
3319                         esac
3320                         ;;
3321                 ultrix) osname=ultrix
3322                         osvers="$3"
3323                         ;;
3324                 osf1|mls+)      case "$5" in
3325                                 alpha)
3326                                         osname=dec_osf
3327                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3328                                         case "$osvers" in
3329                                         [1-9].[0-9]*) ;;
3330                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3331                                         esac
3332                                         ;;
3333                         hp*)    osname=hp_osf1  ;;
3334                         mips)   osname=mips_osf1 ;;
3335                         esac
3336                         ;;
3337                 # UnixWare 7.1.2 is known as Open UNIX 8
3338                 openunix|unixware) osname=svr5
3339                         osvers="$4"
3340                         ;;
3341                 uts)    osname=uts
3342                         osvers="$3"
3343                         ;;
3344                 vos) osvers="$3"
3345                         ;;
3346                 $2) case "$osname" in
3347                         *isc*) ;;
3348                         *freebsd*) ;;
3349                         svr*)
3350                                 : svr4.x or possibly later
3351                                 case "svr$3" in
3352                                 ${osname}*)
3353                                         osname=svr$3
3354                                         osvers=$4
3355                                         ;;
3356                                 esac
3357                                 case "$osname" in
3358                                 svr4.0)
3359                                         : Check for ESIX
3360                                         if test -f /stand/boot ; then
3361                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3362                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3363                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3364                                                         if test -n "$isesix"; then
3365                                                                 osname=esix4
3366                                                         fi
3367                                                 fi
3368                                         fi
3369                                         ;;
3370                                 esac
3371                                 ;;
3372                         *)      if test -f /etc/systemid; then
3373                                         osname=sco
3374                                         set `echo $3 | $sed 's/\./ /g'` $4
3375                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3376                                                 osvers=$1.$2.$3
3377                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3378                                                 osvers=$1.$2
3379                                         elif $test -f $src/hints/sco_$1.sh; then
3380                                                 osvers=$1
3381                                         fi
3382                                 else
3383                                         case "$osname" in
3384                                         '') : Still unknown.  Probably a generic Sys V.
3385                                                 osname="sysv"
3386                                                 osvers="$3"
3387                                                 ;;
3388                                         esac
3389                                 fi
3390                                 ;;
3391                         esac
3392                         ;;
3393                 *)      case "$osname" in
3394                         '') : Still unknown.  Probably a generic BSD.
3395                                 osname="$1"
3396                                 osvers="$3"
3397                                 ;;
3398                         esac
3399                         ;;
3400                 esac
3401         else
3402                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3403                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3404                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3405                                 osname=news_os
3406                         fi
3407                         $rm -f UU/kernel.what
3408                 elif test -d c:/. -o -n "$is_os2" ; then
3409                         set X $myuname
3410                         osname=os2
3411                         osvers="$5"
3412                 fi
3413         fi
3414
3415         case "$targetarch" in
3416         '') ;;
3417         *)  hostarch=$osname
3418             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3419             osvers=''
3420             ;;
3421         esac
3422
3423         : Now look for a hint file osname_osvers, unless one has been
3424         : specified already.
3425         case "$hintfile" in
3426         ''|' ')
3427                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3428                 : Also try without trailing minor version numbers.
3429                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3430                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3431                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3432                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3433                 case "$file" in
3434                 '') dflt=none ;;
3435                 *)  case "$osvers" in
3436                         '') dflt=$file
3437                                 ;;
3438                         *)  if $test -f $src/hints/$file.sh ; then
3439                                         dflt=$file
3440                                 elif $test -f $src/hints/$xfile.sh ; then
3441                                         dflt=$xfile
3442                                 elif $test -f $src/hints/$xxfile.sh ; then
3443                                         dflt=$xxfile
3444                                 elif $test -f $src/hints/$xxxfile.sh ; then
3445                                         dflt=$xxxfile
3446                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3447                                         dflt=$xxxxfile
3448                                 elif $test -f "$src/hints/${osname}.sh" ; then
3449                                         dflt="${osname}"
3450                                 else
3451                                         dflt=none
3452                                 fi
3453                                 ;;
3454                         esac
3455                         ;;
3456                 esac
3457                 if $test -f Policy.sh ; then
3458                         case "$dflt" in
3459                         *Policy*) ;;
3460                         none) dflt="Policy" ;;
3461                         *) dflt="Policy $dflt" ;;
3462                         esac
3463                 fi
3464                 ;;
3465         *)
3466                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3467                 ;;
3468         esac
3469
3470         if $test -f Policy.sh ; then
3471                 $cat <<EOM
3472
3473 There's also a Policy hint file available, which should make the
3474 site-specific (policy) questions easier to answer.
3475 EOM
3476
3477         fi
3478
3479         $cat <<EOM
3480
3481 You may give one or more space-separated answers, or "none" if appropriate.
3482 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3483 previous run of Configure, you may specify it as well as or instead of
3484 OS-specific hints.  If hints are provided for your OS, you should use them:
3485 although Perl can probably be built without hints on many platforms, using
3486 hints often improve performance and may enable features that Configure can't
3487 set up on its own. If there are no hints that match your OS, specify "none";
3488 DO NOT give a wrong version or a wrong OS.
3489
3490 EOM
3491
3492         rp="Which of these apply, if any?"
3493         . UU/myread
3494         tans=$ans
3495         for file in $tans; do
3496                 if $test X$file = XPolicy -a -f Policy.sh; then
3497                         . Policy.sh
3498                         $cat Policy.sh >> UU/config.sh
3499                 elif $test -f $src/hints/$file.sh; then
3500                         . $src/hints/$file.sh
3501                         $cat $src/hints/$file.sh >> UU/config.sh
3502                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3503                         : nothing
3504                 else
3505                         : Give one chance to correct a possible typo.
3506                         echo "$file.sh does not exist"
3507                         dflt=$file
3508                         rp="hint to use instead?"
3509                         . UU/myread
3510                         for file in $ans; do
3511                                 if $test -f "$src/hints/$file.sh"; then
3512                                         . $src/hints/$file.sh
3513                                         $cat $src/hints/$file.sh >> UU/config.sh
3514                                 elif $test X$ans = X -o X$ans = Xnone ; then
3515                                         : nothing
3516                                 else
3517                                         echo "$file.sh does not exist -- ignored."
3518                                 fi
3519                         done
3520                 fi
3521         done
3522
3523         hint=recommended
3524         : Remember our hint file for later.
3525         if $test -f "$src/hints/$file.sh" ; then
3526                 hintfile="$file"
3527         else
3528                 hintfile=''
3529         fi
3530 fi
3531 cd UU
3532 ;;
3533 *)
3534         echo " "
3535         echo "Fetching default answers from $config_sh..." >&4
3536         tmp_n="$n"
3537         tmp_c="$c"
3538         cd ..
3539         cp $config_sh config.sh 2>/dev/null
3540         chmod +w config.sh
3541         . ./config.sh
3542         cd UU
3543         cp ../config.sh .
3544         n="$tmp_n"
3545         c="$tmp_c"
3546         hint=previous
3547         ;;
3548 esac
3549 test "$override" && . ./optdef.sh
3550
3551 : Restore computed paths
3552 for file in $loclist $trylist; do
3553         eval $file="\$_$file"
3554 done
3555
3556 cat << EOM
3557
3558 Configure uses the operating system name and version to set some defaults.
3559 The default value is probably right if the name rings a bell. Otherwise,
3560 since spelling matters for me, either accept the default or answer "none"
3561 to leave it blank.
3562
3563 EOM
3564 case "$osname" in
3565         ''|' ')
3566                 case "$hintfile" in
3567                 ''|' '|none) dflt=none ;;
3568                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3569                 esac
3570                 ;;
3571         *) dflt="$osname" ;;
3572 esac
3573 rp="Operating system name?"
3574 . ./myread
3575 case "$ans" in
3576 none)  osname='' ;;
3577 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3578 esac
3579 echo " "
3580 case "$osvers" in
3581         ''|' ')
3582                 case "$hintfile" in
3583                 ''|' '|none) dflt=none ;;
3584                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3585                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3586                         case "$dflt" in
3587                         ''|' ') dflt=none ;;
3588                         esac
3589                         ;;
3590                 esac
3591                 ;;
3592         *) dflt="$osvers" ;;
3593 esac
3594 rp="Operating system version?"
3595 . ./myread
3596 case "$ans" in
3597 none)  osvers='' ;;
3598 *) osvers="$ans" ;;
3599 esac
3600
3601
3602 . ./posthint.sh
3603
3604 : who configured the system
3605 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3606 case "$cf_by" in
3607 "")
3608         cf_by=`(logname) 2>/dev/null`
3609         case "$cf_by" in
3610         "")
3611                 cf_by=`(whoami) 2>/dev/null`
3612                 case "$cf_by" in
3613                 "") cf_by=unknown ;;
3614                 esac ;;
3615         esac ;;
3616 esac
3617
3618 : decide how portable to be.  Allow command line overrides.
3619 case "$d_portable" in
3620 "$undef") ;;
3621 *)      d_portable="$define" ;;
3622 esac
3623
3624 : set up shell script to do ~ expansion
3625 cat >filexp <<EOSS
3626 $startsh
3627 : expand filename
3628 case "\$1" in
3629  \~/*|\~)
3630         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3631         ;;
3632  \~*)
3633         if $test -f /bin/csh; then
3634                 /bin/csh -f -c "glob \$1"
3635                 failed=\$?
3636                 echo ""
3637                 exit \$failed
3638         else
3639                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3640                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3641                 if $test ! -d "\$dir"; then
3642                         me=\`basename \$0\`
3643                         echo "\$me: can't locate home directory for: \$name" >&2
3644                         exit 1
3645                 fi
3646                 case "\$1" in
3647                 */*)
3648                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3649                         ;;
3650                 *)
3651                         echo \$dir
3652                         ;;
3653                 esac
3654         fi
3655         ;;
3656 *)
3657         echo \$1
3658         ;;
3659 esac
3660 EOSS
3661 chmod +x filexp
3662 $eunicefix filexp
3663
3664 : now set up to get a file name
3665 cat <<EOS >getfile
3666 $startsh
3667 EOS
3668 cat <<'EOSC' >>getfile
3669 tilde=''
3670 fullpath=''
3671 already=''
3672 skip=''
3673 none_ok=''
3674 exp_file=''
3675 nopath_ok=''
3676 orig_rp="$rp"
3677 orig_dflt="$dflt"
3678 case "$gfpth" in
3679 '') gfpth='.' ;;
3680 esac
3681
3682 case "$fn" in
3683 *\(*)
3684         : getfile will accept an answer from the comma-separated list
3685         : enclosed in parentheses even if it does not meet other criteria.
3686         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3687         fn=`echo $fn | sed 's/(.*)//'`
3688         ;;
3689 esac
3690
3691 case "$fn" in
3692 *:*)
3693         loc_file=`expr $fn : '.*:\(.*\)'`
3694         fn=`expr $fn : '\(.*\):.*'`
3695         ;;
3696 esac
3697
3698 case "$fn" in
3699 *~*) tilde=true;;
3700 esac
3701 case "$fn" in
3702 */*) fullpath=true;;
3703 esac
3704 case "$fn" in
3705 *+*) skip=true;;
3706 esac
3707 case "$fn" in
3708 *n*) none_ok=true;;
3709 esac
3710 case "$fn" in
3711 *e*) exp_file=true;;
3712 esac
3713 case "$fn" in
3714 *p*) nopath_ok=true;;
3715 esac
3716
3717 case "$fn" in
3718 *f*) type='File';;
3719 *d*) type='Directory';;
3720 *l*) type='Locate';;
3721 esac
3722
3723 what="$type"
3724 case "$what" in
3725 Locate) what='File';;
3726 esac
3727
3728 case "$exp_file" in
3729 '')
3730         case "$d_portable" in
3731         "$define") ;;
3732         *) exp_file=true;;
3733         esac
3734         ;;
3735 esac
3736
3737 cd ..
3738 while test "$type"; do
3739         redo=''
3740         rp="$orig_rp"
3741         dflt="$orig_dflt"
3742         case "$tilde" in
3743         true) rp="$rp (~name ok)";;
3744         esac
3745         . UU/myread
3746         if test -f UU/getfile.ok && \
3747                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3748         then
3749                 value="$ans"
3750                 ansexp="$ans"
3751                 break
3752         fi
3753         case "$ans" in
3754         none)
3755                 value=''
3756                 ansexp=''
3757                 case "$none_ok" in
3758                 true) type='';;
3759                 esac
3760                 ;;
3761         *)
3762                 case "$tilde" in
3763                 '') value="$ans"
3764                         ansexp="$ans";;
3765                 *)
3766                         value=`UU/filexp $ans`
3767                         case $? in
3768                         0)
3769                                 if test "$ans" != "$value"; then
3770                                         echo "(That expands to $value on this system.)"
3771                                 fi
3772                                 ;;
3773                         *) value="$ans";;
3774                         esac
3775                         ansexp="$value"
3776                         case "$exp_file" in
3777                         '') value="$ans";;
3778                         esac
3779                         ;;
3780                 esac
3781                 case "$fullpath" in
3782                 true)
3783                         case "$ansexp" in
3784                         /*) value="$ansexp" ;;
3785                         [a-zA-Z]:/*) value="$ansexp" ;;
3786                         *)
3787                                 redo=true
3788                                 case "$already" in
3789                                 true)
3790                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3791                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3792                                         ;;
3793                                 *)
3794                                 echo "Please give a full path name, starting with slash." >&4
3795                                         case "$tilde" in
3796                                         true)
3797                                 echo "Note that using ~name is ok provided it expands well." >&4
3798                                                 already=true
3799                                                 ;;
3800                                         esac
3801                                 esac
3802                                 ;;
3803                         esac
3804                         ;;
3805                 esac
3806                 case "$redo" in
3807                 '')
3808                         case "$type" in
3809                         File)
3810                                 for fp in $gfpth; do
3811                                         if test "X$fp" = X.; then
3812                                             pf="$ansexp"
3813                                         else    
3814                                             pf="$fp/$ansexp"
3815                                         fi
3816                                         if test -f "$pf"; then
3817                                                 type=''
3818                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3819                                         then
3820                                                 echo "($value is not a plain file, but that's ok.)"
3821                                                 type=''
3822                                         fi
3823                                         if test X"$type" = X; then
3824                                             value="$pf"
3825                                             break
3826                                         fi
3827                                 done
3828                                 ;;
3829                         Directory)
3830                                 for fp in $gfpth; do
3831                                         if test "X$fp" = X.; then
3832                                             dir="$ans"
3833                                             direxp="$ansexp"
3834                                         else    
3835                                             dir="$fp/$ansexp"
3836                                             direxp="$fp/$ansexp"
3837                                         fi
3838                                         if test -d "$direxp"; then
3839                                                 type=''
3840                                                 value="$dir"
3841                                                 break
3842                                         fi
3843                                 done
3844                                 ;;
3845                         Locate)
3846                                 if test -d "$ansexp"; then
3847                                         echo "(Looking for $loc_file in directory $value.)"
3848                                         value="$value/$loc_file"
3849                                         ansexp="$ansexp/$loc_file"
3850                                 fi
3851                                 if test -f "$ansexp"; then
3852                                         type=''
3853                                 fi
3854                                 case "$nopath_ok" in
3855                                 true)   case "$value" in
3856                                         */*) ;;
3857                                         *)      echo "Assuming $value will be in people's path."
3858                                                 type=''
3859                                                 ;;
3860                                         esac
3861                                         ;;
3862                                 esac
3863                                 ;;
3864                         esac
3865
3866                         case "$skip" in
3867                         true) type='';
3868                         esac
3869
3870                         case "$type" in
3871                         '') ;;
3872                         *)
3873                                 if test "$fastread" = yes; then
3874                                         dflt=y
3875                                 else
3876                                         dflt=n
3877                                 fi
3878                                 rp="$what $value doesn't exist.  Use that name anyway?"
3879                                 . UU/myread
3880                                 dflt=''
3881                                 case "$ans" in
3882                                 y*) type='';;
3883                                 *) echo " ";;
3884                                 esac
3885                                 ;;
3886                         esac
3887                         ;;
3888                 esac
3889                 ;;
3890         esac
3891 done
3892 cd UU
3893 ans="$value"
3894 rp="$orig_rp"
3895 dflt="$orig_dflt"
3896 rm -f getfile.ok
3897 test "X$gfpthkeep" != Xy && gfpth=""
3898 EOSC
3899
3900 : determine root of directory hierarchy where package will be installed.
3901 case "$prefix" in
3902 '')
3903         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3904         ;;
3905 *?/)
3906         dflt=`echo "$prefix" | sed 's/.$//'`
3907         ;;
3908 *)
3909         dflt="$prefix"
3910         ;;
3911 esac
3912 $cat <<EOM
3913
3914 By default, $package will be installed in $dflt/bin, manual pages
3915 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3916 installation directories. Typically this is something like /usr/local.
3917 If you wish to have binaries under /usr/bin but other parts of the
3918 installation under /usr/local, that's ok: you will be prompted
3919 separately for each of the installation directories, the prefix being
3920 only used to set the defaults.
3921
3922 EOM
3923 fn=d~
3924 rp='Installation prefix to use?'
3925 . ./getfile
3926 oldprefix=''
3927 case "$prefix" in
3928 '') ;;
3929 *)
3930         case "$ans" in
3931         "$prefix") ;;
3932         *) oldprefix="$prefix";;
3933         esac
3934         ;;
3935 esac
3936 prefix="$ans"
3937 prefixexp="$ansexp"
3938
3939 : allow them to override the AFS root
3940 case "$afsroot" in
3941 '')     afsroot=/afs ;;
3942 *)      afsroot=$afsroot ;;
3943 esac
3944
3945 : is AFS running?
3946 echo " "
3947 case "$afs" in
3948 $define|true)   afs=true ;;
3949 $undef|false)   afs=false ;;
3950 *)      if $test -d $afsroot; then
3951                 afs=true
3952         else
3953                 afs=false
3954         fi
3955         ;;
3956 esac
3957 if $afs; then
3958         echo "AFS may be running... I'll be extra cautious then..." >&4
3959 else
3960         echo "AFS does not seem to be running..." >&4
3961 fi
3962
3963 : determine installation prefix for where package is to be installed.
3964 if $afs; then 
3965 $cat <<EOM
3966
3967 Since you are running AFS, I need to distinguish the directory in which
3968 files will reside from the directory in which they are installed (and from
3969 which they are presumably copied to the former directory by occult means).
3970
3971 EOM
3972         case "$installprefix" in
3973         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3974         *) dflt="$installprefix";;
3975         esac
3976 else
3977 $cat <<EOM
3978
3979 In some special cases, particularly when building $package for distribution,
3980 it is convenient to distinguish the directory in which files should be
3981 installed from the directory ($prefix) in which they will
3982 eventually reside.  For most users, these two directories are the same.
3983
3984 EOM
3985         case "$installprefix" in
3986         '') dflt=$prefix ;;
3987         *) dflt=$installprefix;;
3988         esac
3989 fi
3990 fn=d~
3991 rp='What installation prefix should I use for installing files?'
3992 . ./getfile
3993 installprefix="$ans"
3994 installprefixexp="$ansexp"
3995
3996 : Perform the prefixexp/installprefixexp correction if necessary
3997 cat <<EOS >installprefix
3998 $startsh
3999 EOS
4000 cat <<'EOSC' >>installprefix
4001 : Change installation prefix, if necessary.
4002 if $test X"$prefix" != X"$installprefix"; then
4003     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4004 else
4005     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4006 fi
4007 EOSC
4008 chmod +x installprefix
4009 $eunicefix installprefix
4010
4011 : Set variables such as privlib and privlibexp from the output of ./getfile
4012 : performing the prefixexp/installprefixexp correction if necessary.
4013 cat <<EOS >setprefixvar
4014 $startsh
4015 EOS
4016 cat <<'EOSC' >>setprefixvar
4017 eval "${prefixvar}=\"\$ans\""
4018 eval "${prefixvar}exp=\"\$ansexp\""
4019 . ./installprefix
4020 EOSC
4021 chmod +x setprefixvar
4022 $eunicefix setprefixvar
4023
4024 : set up the script used to warn in case of inconsistency
4025 cat <<EOS >whoa
4026 $startsh
4027 EOS
4028 cat <<'EOSC' >>whoa
4029 dflt=y
4030 case "$hint" in
4031     recommended)
4032         case "$hintfile" in
4033         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4034                 ;;
4035         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4036                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4037                 ;;
4038         esac
4039         ;;
4040     *)  echo " "
4041         echo "*** WHOA THERE!!! ***" >&4
4042         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4043         ;;
4044 esac
4045 rp="    Keep the $hint value?"
4046 . ./myread
4047 case "$ans" in
4048 y) td=$was; tu=$was;;
4049 esac
4050 EOSC
4051
4052 : function used to set '$1' to '$val'
4053 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4054 case "$val$was" in
4055 $define$undef) . ./whoa; eval "$var=\$td";;
4056 $undef$define) . ./whoa; eval "$var=\$tu";;
4057 *) eval "$var=$val";;
4058 esac'
4059
4060 : Check is we will use socks
4061 case "$usesocks" in
4062 $define|true|[yY]*)     dflt='y';;
4063 *) dflt='n';;
4064 esac
4065 cat <<EOM
4066
4067 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4068 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4069 to use the PerlIO abstraction layer, this will be implicitly selected.
4070
4071 If this doesn't make any sense to you, just accept the default '$dflt'.
4072 EOM
4073 rp='Build Perl for SOCKS?'
4074 . ./myread
4075 case "$ans" in
4076 y|Y)    val="$define" ;;
4077 *)      val="$undef" ;;
4078 esac
4079 set usesocks
4080 eval $setvar
4081
4082 case "$usesocks" in
4083 $define|true|[yY]*) useperlio="$define";;
4084 esac
4085
4086 : Check if we want perlio
4087 case "$useperlio" in
4088 $define|true|[yY]*|'')  dflt='y';;
4089 *) dflt='n';;
4090 esac
4091 cat <<EOM
4092
4093 Previous version of $package used the standard IO mechanisms as
4094 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4095 alternate IO mechanisms via the PerlIO abstraction layer, but the
4096 stdio mechanism is still available if needed.  The abstraction layer
4097 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4098 Using PerlIO with sfio may cause problems with some extension modules.
4099
4100 If this doesn't make any sense to you, just accept the default '$dflt'.
4101 EOM
4102 rp='Use the PerlIO abstraction layer?'
4103 . ./myread
4104 case "$ans" in
4105 y|Y)
4106         val="$define"
4107         ;;
4108 *)
4109         echo "Ok, doing things the stdio way."
4110         val="$undef"
4111         ;;
4112 esac
4113 set useperlio
4114 eval $setvar
4115
4116 case "$usesocks" in
4117 $define|true|[yY]*)
4118         case "$useperlio" in
4119         $define|true|[yY]*) ;;
4120         *)      cat >&4 <<EOM
4121
4122 You are using the SOCKS proxy protocol library which means that you
4123 should also use the PerlIO layer.  You may be headed for trouble.
4124
4125 EOM
4126                 ;;
4127         esac
4128         ;;
4129 esac
4130
4131 : get the patchlevel
4132 echo " "
4133 echo "Getting the current patchlevel..." >&4
4134 if $test -r $rsrc/patchlevel.h;then
4135         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4136         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4137         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4138         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4139         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4140         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4141         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4142 else
4143         revision=0
4144         patchlevel=0
4145         subversion=0
4146         api_revision=0
4147         api_version=0
4148         api_subversion=0
4149         perl_patchlevel=0
4150         $echo "(You do not have patchlevel.h.  Eek.)"
4151 fi
4152 if $test -r $rsrc/.patch ; then
4153         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4154                 perl_patchlevel=`cat $rsrc/.patch`
4155         fi
4156 fi
4157 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4158 version_patchlevel_string="version $patchlevel subversion $subversion"
4159 case "$perl_patchlevel" in
4160 0|'') ;;
4161 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4162     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4163     ;;
4164 esac
4165
4166 $echo "(You have $package $version_patchlevel_string.)"
4167
4168 case "$osname" in
4169 dos|vms)
4170         : XXX Should be a Configure test for double-dots in filenames.
4171         version=`echo $revision $patchlevel $subversion | \
4172                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4173         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4174                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4175         ;;
4176 *)
4177         version=`echo $revision $patchlevel $subversion | \
4178                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4179         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4180                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4181         ;;
4182 esac
4183 : Special case the 5.005_xx maintenance series, which used 5.005
4184 : without any subversion label as a subdirectory in $sitelib
4185 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4186         api_versionstring='5.005'
4187 fi
4188
4189 : Do we want threads support and if so, what type
4190 case "$usethreads" in
4191 $define|true|[yY]*)     dflt='y';;
4192 *)     # Catch case where user specified ithreads or 5005threads but
4193        # forgot -Dusethreads (A.D. 4/2002)
4194        case "$useithreads$use5005threads" in
4195        *$define*)
4196                 case "$useperlio" in
4197                 "$define")      dflt='y' ;;
4198                 *)              dflt='n' ;;
4199                 esac
4200                 ;;
4201        *)       dflt='n';;
4202        esac
4203        ;;
4204 esac
4205 cat <<EOM
4206
4207 Perl can be built to take advantage of threads on some systems.
4208 To do so, Configure can be run with -Dusethreads.
4209
4210 Note that Perl built with threading support runs slightly slower
4211 and uses more memory than plain Perl. The current implementation
4212 is believed to be stable, but it is fairly new, and so should be
4213 treated with caution.
4214
4215 If this doesn't make any sense to you, just accept the default '$dflt'.
4216 EOM
4217 rp='Build a threading Perl?'
4218 . ./myread
4219 case "$ans" in
4220 y|Y)    val="$define" ;;
4221 *)      val="$undef" ;;
4222 esac
4223 set usethreads
4224 eval $setvar
4225
4226 if $test $patchlevel -lt 9; then
4227     case "$usethreads" in
4228     $define)
4229         $cat <<EOM
4230
4231 Since release 5.6, Perl has had two different threading implementations,
4232 the newer interpreter-based version (ithreads) with one interpreter per
4233 thread, and the older 5.005 version (5005threads).
4234 The 5005threads version is effectively unmaintained and will probably be
4235 removed in Perl 5.10, so there should be no need to build a Perl using it
4236 unless needed for backwards compatibility with some existing 5.005threads
4237 code.
4238
4239 EOM
4240         : Default to ithreads unless overridden on command line or with
4241         : old config.sh
4242         dflt='y'
4243         case "$use5005threads" in
4244                 $define|true|[yY]*) dflt='n';;
4245         esac
4246         case "$useithreads" in
4247                 $undef|false|[nN]*) dflt='n';;
4248         esac
4249         rp='Use the newer interpreter-based ithreads?'
4250         . ./myread
4251         case "$ans" in
4252         y|Y)    val="$define" ;;
4253         *)      val="$undef" ;;
4254         esac
4255         set useithreads
4256         eval $setvar
4257         : Now set use5005threads to the opposite value.
4258         case "$useithreads" in
4259         $define) val="$undef" ;;
4260         *) val="$define" ;;
4261         esac
4262         set use5005threads
4263         eval $setvar
4264         ;;
4265     *)
4266         useithreads="$undef"
4267         use5005threads="$undef"
4268         ;;
4269     esac
4270
4271     case "$useithreads$use5005threads" in
4272     "$define$define")
4273         $cat >&4 <<EOM
4274
4275 You cannot have both the ithreads and the 5.005 threads enabled
4276 at the same time.  Disabling the 5.005 threads since they are
4277 much less stable than the ithreads.
4278
4279 EOM
4280         use5005threads="$undef"
4281         ;;
4282     esac
4283
4284 else
4285 : perl-5.9.x and later
4286
4287     if test X"$usethreads" = "X$define"; then
4288         case "$use5005threads" in
4289             $define|true|[yY]*)
4290                 $cat >&4 <<EOM
4291
4292 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4293
4294 EOM
4295             ;;
4296         esac
4297     fi
4298
4299     use5005threads="$undef"
4300     useithreads="$usethreads"
4301 fi
4302
4303 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4304         cat >&4 <<EOF
4305 ***
4306 *** To build with ithreads you must also use the PerlIO layer.
4307 *** Cannot continue, aborting.
4308 ***
4309 EOF
4310         exit 1
4311 fi
4312
4313 case "$d_oldpthreads" in
4314 '')     : Configure tests would be welcome here.  For now, assume undef.
4315         val="$undef" ;;
4316 *)      val="$d_oldpthreads" ;;
4317 esac
4318 set d_oldpthreads
4319 eval $setvar
4320
4321
4322 : Look for a hint-file generated 'call-back-unit'.  If the
4323 : user has specified that a threading perl is to be built,
4324 : we may need to set or change some other defaults.
4325 if $test -f usethreads.cbu; then
4326     echo "Your platform has some specific hints regarding threaded builds, using them..."
4327     . ./usethreads.cbu
4328 else
4329     case "$usethreads" in
4330         "$define"|true|[yY]*)
4331                 $cat <<EOM
4332 (Your platform does not have any specific hints for threaded builds.
4333  Assuming POSIX threads, then.)
4334 EOM
4335         ;;
4336     esac
4337 fi
4338
4339 : Check if multiplicity is required
4340 cat <<EOM
4341
4342 Perl can be built so that multiple Perl interpreters can coexist
4343 within the same Perl executable.
4344 EOM
4345
4346 case "$useithreads" in
4347 $define)
4348         cat <<EOM
4349 This multiple interpreter support is required for interpreter-based threads.
4350 EOM
4351         val="$define"
4352         ;;
4353 *)      case "$usemultiplicity" in
4354         $define|true|[yY]*)     dflt='y';;
4355         *) dflt='n';;
4356         esac
4357         echo " "
4358         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4359         rp='Build Perl for multiplicity?'
4360         . ./myread
4361         case "$ans" in
4362         y|Y)    val="$define" ;;
4363         *)      val="$undef" ;;
4364         esac
4365         ;;
4366 esac
4367 set usemultiplicity
4368 eval $setvar
4369
4370 : Check if morebits is requested
4371 case "$usemorebits" in
4372 "$define"|true|[yY]*)
4373         use64bitint="$define"
4374         uselongdouble="$define"
4375         usemorebits="$define"
4376         ;;
4377 *)      usemorebits="$undef"
4378         ;;
4379 esac
4380
4381 : Determine the C compiler to be used
4382 echo " "
4383 case "$cc" in
4384 '') dflt=cc;;
4385 *) dflt="$cc";;
4386 esac
4387 rp="Use which C compiler?"
4388 . ./myread
4389 cc="$ans"
4390
4391 : See whether they have no cc but they do have gcc
4392 . ./trygcc
4393 if $test -f cc.cbu; then
4394     . ./cc.cbu
4395 fi
4396 . ./checkcc
4397
4398 : make some quick guesses about what we are up against
4399 echo " "
4400 $echo $n "Hmm...  $c"
4401 echo exit 1 >bsd
4402 echo exit 1 >usg
4403 echo exit 1 >v7
4404 echo exit 1 >osf1
4405 echo exit 1 >eunice
4406 echo exit 1 >xenix
4407 echo exit 1 >venix
4408 echo exit 1 >os2
4409 d_bsd="$undef"
4410 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4411 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4412 then
4413         echo "Looks kind of like an OSF/1 system, but we'll see..."
4414         echo exit 0 >osf1
4415 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4416         xxx=`./loc addbib blurfl $pth`
4417         if $test -f $xxx; then
4418         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4419                 echo exit 0 >bsd
4420                 echo exit 0 >usg
4421         else
4422                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4423                         echo "Looks kind of like an extended USG system, but we'll see..."
4424                 else
4425                         echo "Looks kind of like a USG system, but we'll see..."
4426                 fi
4427                 echo exit 0 >usg
4428         fi
4429 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4430         echo "Looks kind of like a BSD system, but we'll see..."
4431         d_bsd="$define"
4432         echo exit 0 >bsd
4433 else
4434         echo "Looks kind of like a Version 7 system, but we'll see..."
4435         echo exit 0 >v7
4436 fi
4437 case "$eunicefix" in
4438 *unixtovms*)
4439         $cat <<'EOI'
4440 There is, however, a strange, musty smell in the air that reminds me of
4441 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4442 EOI
4443         echo exit 0 >eunice
4444         d_eunice="$define"
4445 : it so happens the Eunice I know will not run shell scripts in Unix format
4446         ;;
4447 *)
4448         echo " "
4449         echo "Congratulations.  You aren't running Eunice."
4450         d_eunice="$undef"
4451         ;;
4452 esac
4453 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4454 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4455 : semicolon as a patch separator
4456 case "$p_" in
4457 :) ;;
4458 *)
4459         $cat <<'EOI'
4460 I have the feeling something is not exactly right, however...don't tell me...
4461 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4462 (Or you may be running DOS with DJGPP.)
4463 EOI
4464         echo exit 0 >os2
4465         ;;
4466 esac
4467 if test -f /xenix; then
4468         echo "Actually, this looks more like a XENIX system..."
4469         echo exit 0 >xenix
4470         d_xenix="$define"
4471 else
4472         echo " "
4473         echo "It's not Xenix..."
4474         d_xenix="$undef"
4475 fi
4476 chmod +x xenix
4477 $eunicefix xenix
4478 if test -f /venix; then
4479         echo "Actually, this looks more like a VENIX system..."
4480         echo exit 0 >venix
4481 else
4482         echo " "
4483         if ./xenix; then
4484                 : null
4485         else
4486                 echo "Nor is it Venix..."
4487         fi
4488 fi
4489 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4490 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4491 $rm -f foo
4492
4493 : Check if we are using GNU gcc and what its version is
4494 echo " "
4495 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4496 $cat >try.c <<EOM
4497 #include <stdio.h>
4498 int main() {
4499 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4500 #ifdef __VERSION__
4501         printf("%s\n", __VERSION__);
4502 #else
4503         printf("%s\n", "1");
4504 #endif
4505 #endif
4506         return(0);
4507 }
4508 EOM
4509 if $cc -o try $ccflags $ldflags try.c; then
4510         gccversion=`$run ./try`
4511         case "$gccversion" in
4512         '') echo "You are not using GNU cc." ;;
4513         *)  echo "You are using GNU cc $gccversion."
4514             ccname=gcc
4515             ;;
4516         esac
4517 else
4518         echo " "
4519         echo "*** WHOA THERE!!! ***" >&4
4520         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4521         case "$knowitall" in
4522         '')
4523         echo "    You'd better start hunting for one and let me know about it." >&4
4524                 exit 1
4525                 ;;
4526         esac
4527 fi
4528 $rm -f try try.*
4529 case "$gccversion" in
4530 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4531 esac
4532 case "$gccversion" in
4533 '') gccosandvers='' ;;
4534 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4535    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4536    gccshortvers=''
4537    case "$gccosandvers" in
4538    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4539    $osname$osvers) ;; # looking good
4540    $osname*) cat <<EOM >&4
4541
4542 *** WHOA THERE!!! ***
4543
4544     Your gcc has not been compiled for the exact release of
4545     your operating system ($gccosandvers versus $osname$osvers).
4546
4547     In general it is a good idea to keep gcc synchronized with
4548     the operating system because otherwise serious problems
4549     may ensue when trying to compile software, like Perl.
4550
4551     I'm trying to be optimistic here, though, and will continue.
4552     If later during the configuration and build icky compilation
4553     problems appear (headerfile conflicts being the most common
4554     manifestation), I suggest reinstalling the gcc to match
4555     your operating system release.
4556
4557 EOM
4558       ;;
4559    *) gccosandvers='' ;; # failed to parse, better be silent
4560    esac
4561    ;;
4562 esac
4563 case "$ccname" in
4564 '') ccname="$cc" ;;
4565 esac
4566
4567 # gcc 3.* complain about adding -Idirectories that they already know about,
4568 # so we will take those off from locincpth.
4569 case "$gccversion" in
4570 3*)
4571     echo "main(){}">try.c
4572     for incdir in $locincpth; do
4573        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4574              grep '^c[cp]p*[01]: warning: changing search order '`
4575        if test "X$warn" != X; then
4576            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4577        fi
4578     done
4579     $rm -f try try.*
4580 esac
4581
4582 : What should the include directory be ?
4583 echo " "
4584 $echo $n "Hmm...  $c"
4585 dflt='/usr/include'
4586 incpath=''
4587 mips_type=''
4588 if $test -f /bin/mips && /bin/mips; then
4589         echo "Looks like a MIPS system..."
4590         $cat >usr.c <<'EOCP'
4591 #ifdef SYSTYPE_BSD43
4592 /bsd43
4593 #endif
4594 EOCP
4595         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4596                 dflt='/bsd43/usr/include'
4597                 incpath='/bsd43'
4598                 mips_type='BSD 4.3'
4599         else
4600                 mips_type='System V'
4601         fi
4602         $rm -f usr.c usr.out
4603         echo "and you're compiling with the $mips_type compiler and libraries."
4604         xxx_prompt=y
4605         echo "exit 0" >mips
4606 else
4607         echo "Doesn't look like a MIPS system."
4608         xxx_prompt=n
4609         echo "exit 1" >mips
4610 fi
4611 chmod +x mips
4612 $eunicefix mips
4613 case "$usrinc" in
4614 '') ;;
4615 *) dflt="$usrinc";;
4616 esac
4617 case "$xxx_prompt" in
4618 y)      fn=d/
4619         echo " "
4620         rp='Where are the include files you want to use?'
4621         . ./getfile
4622         usrinc="$ans"
4623         ;;
4624 *)      usrinc="$dflt"
4625         ;;
4626 esac
4627
4628 : see how we invoke the C preprocessor
4629 echo " "
4630 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4631 cat <<'EOT' >testcpp.c
4632 #define ABC abc
4633 #define XYZ xyz
4634 ABC.XYZ
4635 EOT
4636 cd ..
4637 if test ! -f cppstdin; then
4638         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4639                 # AIX cc -E doesn't show the absolute headerfile
4640                 # locations but we'll cheat by using the -M flag.
4641                 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
4642         else
4643                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4644         fi
4645 else
4646         echo "Keeping your $hint cppstdin wrapper."
4647 fi
4648 chmod 755 cppstdin
4649 wrapper=`pwd`/cppstdin
4650 ok='false'
4651 cd UU
4652
4653 if $test "X$cppstdin" != "X" && \
4654         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4656 then
4657         echo "You used to use $cppstdin $cppminus so we'll use that again."
4658         case "$cpprun" in
4659         '') echo "But let's see if we can live without a wrapper..." ;;
4660         *)
4661                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4662                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4663                 then
4664                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4665                         ok='true'
4666                 else
4667                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4668                 fi
4669                 ;;
4670         esac
4671 else
4672         case "$cppstdin" in
4673         '') ;;
4674         *)
4675                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4676                 ;;
4677         esac
4678 fi
4679
4680 if $ok; then
4681         : nothing
4682 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4683         $cc -E <testcpp.c >testcpp.out 2>&1; \
4684         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4685         echo "Yup, it does."
4686         x_cpp="$cc -E"
4687         x_minus='';
4688 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4689         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4690         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4691         echo "Yup, it does."
4692         x_cpp="$cc -E"
4693         x_minus='-';
4694 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4695         $cc -P <testcpp.c >testcpp.out 2>&1; \
4696         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4697         echo "Yipee, that works!"
4698         x_cpp="$cc -P"
4699         x_minus='';
4700 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4701         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4702         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4703         echo "At long last!"
4704         x_cpp="$cc -P"
4705         x_minus='-';
4706 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4707         $cpp <testcpp.c >testcpp.out 2>&1; \
4708         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4709         echo "It works!"
4710         x_cpp="$cpp"
4711         x_minus='';
4712 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4713         $cpp - <testcpp.c >testcpp.out 2>&1; \
4714         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4715         echo "Hooray, it works!  I was beginning to wonder."
4716         x_cpp="$cpp"
4717         x_minus='-';
4718 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4719         $wrapper <testcpp.c >testcpp.out 2>&1; \
4720         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4721         x_cpp="$wrapper"
4722         x_minus=''
4723         echo "Eureka!"
4724 else
4725         dflt=''
4726         rp="No dice.  I can't find a C preprocessor.  Name one:"
4727         . ./myread
4728         x_cpp="$ans"
4729         x_minus=''
4730         $x_cpp <testcpp.c >testcpp.out 2>&1
4731         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4732                 echo "OK, that will do." >&4
4733         else
4734 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4735                 exit 1
4736         fi
4737 fi
4738
4739 case "$ok" in
4740 false)
4741         cppstdin="$x_cpp"
4742         cppminus="$x_minus"
4743         cpprun="$x_cpp"
4744         cpplast="$x_minus"
4745         set X $x_cpp
4746         shift
4747         case "$1" in
4748         "$cpp")
4749                 echo "Perhaps can we force $cc -E using a wrapper..."
4750                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4751                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4752                 then
4753                         echo "Yup, we can."
4754                         cppstdin="$wrapper"
4755                         cppminus='';
4756                 else
4757                         echo "Nope, we'll have to live without it..."
4758                 fi
4759                 ;;
4760         esac
4761         case "$cpprun" in
4762         "$wrapper")
4763                 cpprun=''
4764                 cpplast=''
4765                 ;;
4766         esac
4767         ;;
4768 esac
4769
4770 case "$cppstdin" in
4771 "$wrapper"|'cppstdin') ;;
4772 *) $rm -f $wrapper;;
4773 esac
4774 $rm -f testcpp.c testcpp.out
4775
4776 : Set private lib path
4777 case "$plibpth" in
4778 '') if ./mips; then
4779                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4780         fi;;
4781 esac
4782 case "$libpth" in
4783 ' ') dlist='';;
4784 '') dlist="$loclibpth $plibpth $glibpth";;
4785 *) dlist="$libpth";;
4786 esac
4787
4788 : Now check and see which directories actually exist, avoiding duplicates
4789 libpth=''
4790 for xxx in $dlist
4791 do
4792     if $test -d $xxx; then
4793                 case " $libpth " in
4794                 *" $xxx "*) ;;
4795                 *) libpth="$libpth $xxx";;
4796                 esac
4797     fi
4798 done
4799 $cat <<'EOM'
4800
4801 Some systems have incompatible or broken versions of libraries.  Among
4802 the directories listed in the question below, please remove any you
4803 know not to be holding relevant libraries, and add any that are needed.
4804 Say "none" for none.
4805
4806 EOM
4807 case "$libpth" in
4808 '') dflt='none';;
4809 *)
4810         set X $libpth
4811         shift
4812         dflt=${1+"$@"}
4813         ;;
4814 esac
4815 rp="Directories to use for library searches?"
4816 . ./myread
4817 case "$ans" in
4818 none) libpth=' ';;
4819 *) libpth="$ans";;
4820 esac
4821
4822 : compute shared library extension
4823 case "$so" in
4824 '')
4825         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4826                 dflt='sl'
4827         else
4828                 dflt='so'
4829         fi
4830         ;;
4831 *) dflt="$so";;
4832 esac
4833 $cat <<EOM
4834
4835 On some systems, shared libraries may be available.  Answer 'none' if
4836 you want to suppress searching of shared libraries for the remainder
4837 of this configuration.
4838
4839 EOM
4840 rp='What is the file extension used for shared libraries?'
4841 . ./myread
4842 so="$ans"
4843
4844 : Define several unixisms.
4845 : Hints files or command line option can be used to override them.
4846 : The convoluted testing is in case hints files set either the old
4847 : or the new name.
4848 case "$_exe" in
4849 '')     case "$exe_ext" in
4850         '')     ;;
4851         *)      _exe="$exe_ext" ;;
4852         esac
4853         ;;
4854 esac
4855 case "$_a" in
4856 '')     case "$lib_ext" in
4857     '') _a='.a';;
4858         *)      _a="$lib_ext" ;;
4859         esac
4860         ;;
4861 esac
4862 case "$_o" in
4863 '') case "$obj_ext" in
4864         '')     _o='.o';;
4865         *)      _o="$obj_ext";;
4866         esac
4867         ;;
4868 esac
4869 case "$p_" in
4870 '') case "$path_sep" in
4871         '')     p_=':';;
4872         *)      p_="$path_sep";;
4873         esac
4874         ;;
4875 esac
4876 exe_ext=$_exe
4877 lib_ext=$_a
4878 obj_ext=$_o
4879 path_sep=$p_
4880
4881 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4882
4883 : Which makefile gets called first.  This is used by make depend.
4884 case "$firstmakefile" in
4885 '') firstmakefile='makefile';;
4886 esac
4887
4888 : Check for uselongdouble support
4889 case "$ccflags" in
4890 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4891 esac
4892
4893 case "$uselongdouble" in
4894 $define|true|[yY]*)     dflt='y';;
4895 *) dflt='n';;
4896 esac
4897 cat <<EOM
4898
4899 Perl can be built to take advantage of long doubles which
4900 (if available) may give more accuracy and range for floating point numbers.
4901
4902 If this doesn't make any sense to you, just accept the default '$dflt'.
4903 EOM
4904 rp='Try to use long doubles if available?'
4905 . ./myread
4906 case "$ans" in
4907 y|Y)    val="$define"   ;;
4908 *)      val="$undef"    ;;
4909 esac
4910 set uselongdouble
4911 eval $setvar
4912
4913 case "$uselongdouble" in
4914 true|[yY]*) uselongdouble="$define" ;;
4915 esac
4916
4917 : Look for a hint-file generated 'call-back-unit'.  If the
4918 : user has specified that long doubles should be used,
4919 : we may need to set or change some other defaults.
4920 if $test -f uselongdouble.cbu; then
4921     echo "Your platform has some specific hints regarding long doubles, using them..."
4922     . ./uselongdouble.cbu
4923 else
4924     case "$uselongdouble" in
4925         $define)
4926                 $cat <<EOM
4927 (Your platform does not have any specific hints for long doubles.)
4928 EOM
4929         ;;
4930     esac
4931 fi
4932
4933 : Looking for optional libraries
4934 echo " "
4935 echo "Checking for optional libraries..." >&4
4936 case "$libs" in
4937 ' '|'') dflt='';;
4938 *) dflt="$libs";;
4939 esac
4940 case "$libswanted" in
4941 '') libswanted='c_s';;
4942 esac
4943 case "$usesocks" in
4944 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4945 esac
4946 libsfound=''
4947 libsfiles=''
4948 libsdirs=''
4949 libspath=''
4950 for thisdir in $libpth $xlibpth; do
4951   test -d $thisdir && libspath="$libspath $thisdir"
4952 done
4953 for thislib in $libswanted; do
4954         for thisdir in $libspath; do
4955             xxx=''
4956             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4957                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4958                 $test -f "$xxx" && eval $libscheck
4959                 $test -f "$xxx" && libstyle=shared
4960             fi
4961             if test ! -f "$xxx"; then
4962                 xxx=$thisdir/lib$thislib.$so
4963                 $test -f "$xxx" && eval $libscheck
4964                 $test -f "$xxx" && libstyle=shared
4965             fi
4966             if test ! -f "$xxx"; then
4967                 xxx=$thisdir/lib$thislib$_a
4968                 $test -f "$xxx" && eval $libscheck
4969                 $test -f "$xxx" && libstyle=static
4970             fi
4971             if test ! -f "$xxx"; then
4972                 xxx=$thisdir/$thislib$_a
4973                 $test -f "$xxx" && eval $libscheck
4974                 $test -f "$xxx" && libstyle=static
4975             fi
4976             if test ! -f "$xxx"; then
4977                 xxx=$thisdir/lib${thislib}_s$_a
4978                 $test -f "$xxx" && eval $libscheck
4979                 $test -f "$xxx" && libstyle=static
4980                 $test -f "$xxx" && thislib=${thislib}_s
4981             fi
4982             if test ! -f "$xxx"; then
4983                 xxx=$thisdir/Slib$thislib$_a
4984                 $test -f "$xxx" && eval $libscheck
4985                 $test -f "$xxx" && libstyle=static
4986             fi
4987             if $test -f "$xxx"; then
4988                 case "$libstyle" in
4989                 shared) echo "Found -l$thislib (shared)." ;;
4990                 static) echo "Found -l$thislib." ;;
4991                 *)      echo "Found -l$thislib ($libstyle)." ;;
4992                 esac
4993                 case " $dflt " in
4994                 *"-l$thislib "*);;
4995                 *) dflt="$dflt -l$thislib"
4996                    libsfound="$libsfound $xxx"
4997                    yyy=`basename $xxx`
4998                    libsfiles="$libsfiles $yyy"
4999                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5000                    case " $libsdirs " in
5001                    *" $yyy "*) ;;
5002                    *) libsdirs="$libsdirs $yyy" ;;
5003                    esac
5004                    ;;
5005                 esac
5006                 break
5007             fi
5008         done
5009         if $test ! -f "$xxx"; then
5010             echo "No -l$thislib."
5011         fi
5012 done
5013 set X $dflt
5014 shift
5015 dflt="$*"
5016 case "$libs" in
5017 '') dflt="$dflt";;
5018 *) dflt="$libs";;
5019 esac
5020 case "$dflt" in
5021 ' '|'') dflt='none';;
5022 esac
5023
5024 $cat <<EOM
5025
5026 In order to compile $package on your machine, a number of libraries
5027 are usually needed.  Include any other special libraries here as well.
5028 Say "none" for none.  The default list is almost always right.
5029 EOM
5030
5031 echo " "
5032 rp="What libraries to use?"
5033 . ./myread
5034 case "$ans" in
5035 none) libs=' ';;
5036 *) libs="$ans";;
5037 esac
5038
5039 : determine optimization, if desired, or use for debug flag also
5040 case "$optimize" in
5041 ' '|$undef) dflt='none';;
5042 '') dflt='-O';;
5043 *) dflt="$optimize";;
5044 esac
5045 $cat <<EOH
5046
5047 By default, $package compiles with the -O flag to use the optimizer.
5048 Alternately, you might want to use the symbolic debugger, which uses
5049 the -g flag (on traditional Unix systems).  Either flag can be
5050 specified here.  To use neither flag, specify the word "none".
5051
5052 EOH
5053 rp="What optimizer/debugger flag should be used?"
5054 . ./myread
5055 optimize="$ans"
5056 case "$optimize" in
5057 'none') optimize=" ";;
5058 esac
5059
5060 : Check what DEBUGGING is required from the command line
5061 : -DEBUGGING      or -DDEBUGGING or
5062 : -DEBUGGING=both                       = -g + -DDEBUGGING
5063 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5064 : -DEBUGGING=none or -UDEBUGGING        =
5065 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5066 case "$EBUGGING" in
5067 '')     ;;
5068 *)      DEBUGGING=$EBUGGING ;;
5069 esac
5070
5071 case "$DEBUGGING" in
5072 -g|both|$define)
5073     case "$optimize" in
5074         *-g*) ;;
5075         *)    optimize="$optimize -g" ;;
5076     esac ;;
5077 none|$undef)
5078     case "$optimize" in
5079         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5080                 shift
5081                 optimize="$*"
5082                 ;;
5083     esac ;;
5084 esac
5085
5086 dflt=''
5087 case "$DEBUGGING" in
5088 both|$define) dflt='-DDEBUGGING'
5089 esac
5090
5091 : argument order is deliberate, as the flag will start with - which set could
5092 : think is an option
5093 checkccflag='check=$1; flag=$2; callback=$3;
5094 echo " ";
5095 echo "Checking if your compiler accepts $flag" 2>&1;
5096 echo "int main(void) { return 0; }" > gcctest.c;
5097 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5098     echo "Yes, it does." 2>&1;
5099     if $test -s gcctest.out ; then
5100         echo "But your platform does not like it:";
5101         cat gcctest.out;
5102     else
5103         case "$ccflags" in
5104         *$check*)
5105             echo "Leaving current flags $ccflags alone." 2>&1
5106             ;;
5107         *) dflt="$dflt $flag";
5108             eval $callback
5109             ;;
5110         esac
5111     fi
5112 else
5113     echo "Nope, it does not, but that is ok." 2>&1;
5114 fi
5115 '
5116
5117 : We will not override a previous value, but we might want to
5118 : augment a hint file
5119 case "$hint" in
5120 default|recommended)
5121         case "$gccversion" in
5122         1*) dflt="$dflt -fpcc-struct-return" ;;
5123         esac
5124         case "$optimize:$DEBUGGING" in
5125         *-g*:old) dflt="$dflt -DDEBUGGING";;
5126         esac
5127         case "$gccversion" in
5128         2*) if $test -d /etc/conf/kconfig.d &&
5129                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5130                 then
5131                         # Interactive Systems (ISC) POSIX mode.
5132                         dflt="$dflt -posix"
5133                 fi
5134                 ;;
5135         esac
5136         case "$gccversion" in
5137         1*) ;;
5138         2.[0-8]*) ;;
5139         ?*)     set strict-aliasing -fno-strict-aliasing
5140                 eval $checkccflag
5141                 ;;
5142         esac
5143         # For gcc, adding -pipe speeds up compilations for some, but apparently
5144         # some assemblers can't read from stdin.  (It also slows down compilations
5145         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5146         case "$gccversion" in
5147         ?*)     set pipe -pipe
5148                 eval $checkccflag
5149                 ;;
5150         esac
5151
5152         # on x86_64 (at least) we require an extra library (libssp) in the
5153         # link command line. This library is not named, so I infer that it is
5154         # an implementation detail that may change. Hence the safest approach
5155         # is to add the flag to the flags passed to the compiler at link time,
5156         # as that way the compiler can do the right implementation dependant
5157         # thing. (NWC)
5158         case "$gccversion" in
5159         ?*)     set stack-protector -fstack-protector
5160                 eval $checkccflag
5161                 ;;
5162         esac
5163         ;;
5164 esac
5165
5166 case "$mips_type" in
5167 *BSD*|'') inclwanted="$locincpth $usrinc";;
5168 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5169 esac
5170 for thisincl in $inclwanted; do
5171         if $test -d $thisincl; then
5172                 if $test x$thisincl != x$usrinc; then
5173                         case "$dflt" in
5174                         *" -I$thisincl "*);;
5175                         *) dflt="$dflt -I$thisincl ";;
5176                         esac
5177                 fi
5178         fi
5179 done
5180
5181 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5182         xxx=true;
5183 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5184         xxx=true;
5185 else
5186         xxx=false;
5187 fi;
5188 if $xxx; then
5189         case "$dflt" in
5190         *$2*);;
5191         *) dflt="$dflt -D$2";;
5192         esac;
5193 fi'
5194
5195 set signal.h LANGUAGE_C; eval $inctest
5196
5197 case "$usesocks" in
5198 $define)
5199         ccflags="$ccflags -DSOCKS"
5200         ;;
5201 esac
5202
5203 case "$hint" in
5204 default|recommended) dflt="$ccflags $dflt" ;;
5205 *) dflt="$ccflags";;
5206 esac
5207
5208 case "$dflt" in
5209 ''|' ') dflt=none;;
5210 esac
5211
5212 $cat <<EOH
5213
5214 Your C compiler may want other flags.  For this question you should include
5215 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5216 but you should NOT include libraries or ld flags like -lwhatever.  If you
5217 want $package to honor its debug switch, you should include -DDEBUGGING here.
5218 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5219
5220 To use no flags, specify the word "none".
5221
5222 EOH
5223 set X $dflt
5224 shift
5225 dflt=${1+"$@"}
5226 rp="Any additional cc flags?"
5227 . ./myread
5228 case "$ans" in
5229 none) ccflags='';;
5230 *) ccflags="$ans";;
5231 esac
5232
5233 : the following weeds options from ccflags that are of no interest to cpp
5234 case "$cppflags" in
5235 '') cppflags="$ccflags" ;;
5236 *)  cppflags="$cppflags $ccflags" ;;
5237 esac
5238 case "$gccversion" in
5239 1*) cppflags="$cppflags -D__GNUC__"
5240 esac
5241 case "$mips_type" in
5242 '');;
5243 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5244 esac
5245 case "$cppflags" in
5246 '');;
5247 *)
5248         echo " "
5249         echo "Let me guess what the preprocessor flags are..." >&4
5250         set X $cppflags
5251         shift
5252         cppflags=''
5253         $cat >cpp.c <<'EOM'
5254 #define BLURFL foo
5255
5256 BLURFL xx LFRULB
5257 EOM
5258         previous=''
5259         for flag in $*
5260         do
5261                 case "$flag" in
5262                 -*) ftry="$flag";;
5263                 *) ftry="$previous $flag";;
5264                 esac
5265                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5266                         >cpp1.out 2>/dev/null && \
5267                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5268                         >cpp2.out 2>/dev/null && \
5269                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5270                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5271                 then
5272                         cppflags="$cppflags $ftry"
5273                         previous=''
5274                 else
5275                         previous="$flag"
5276                 fi
5277         done
5278         set X $cppflags
5279         shift
5280         cppflags=${1+"$@"}
5281         case "$cppflags" in
5282         *-*)  echo "They appear to be: $cppflags";;
5283         esac
5284         $rm -f cpp.c cpp?.out
5285         ;;
5286 esac
5287
5288 : flags used in final linking phase
5289 case "$ldflags" in
5290 '') if ./venix; then
5291                 dflt='-i -z'
5292         else
5293                 dflt=''
5294         fi
5295         case "$ccflags" in
5296         *-posix*) dflt="$dflt -posix" ;;
5297         esac
5298         ;;
5299 *) dflt="$ldflags";;
5300 esac
5301 # See note above about -fstack-protector
5302 case "$ccflags" in
5303 *-fstack-protector*) 
5304         case "$dflt" in
5305         *-fstack-protector*) ;; # Don't add it again
5306         *) dflt="$dflt -fstack-protector" ;; 
5307         esac
5308         ;;
5309 esac
5310
5311 : Try to guess additional flags to pick up local libraries.
5312 for thislibdir in $libpth; do
5313         case " $loclibpth " in
5314         *" $thislibdir "*)
5315                 case "$dflt " in
5316                 *"-L$thislibdir "*) ;;
5317                 *)  dflt="$dflt -L$thislibdir" ;;
5318                 esac
5319                 ;;
5320         esac
5321 done
5322
5323 case "$dflt" in
5324 '') dflt='none' ;;
5325 esac
5326
5327 $cat <<EOH
5328
5329 Your C linker may need flags.  For this question you should
5330 include -L/whatever and any other flags used by the C linker, but you
5331 should NOT include libraries like -lwhatever.
5332
5333 Make sure you include the appropriate -L/path flags if your C linker
5334 does not normally search all of the directories you specified above,
5335 namely
5336         $libpth
5337 To use no flags, specify the word "none".
5338
5339 EOH
5340
5341 rp="Any additional ld flags (NOT including libraries)?"
5342 . ./myread
5343 case "$ans" in
5344 none) ldflags='';;
5345 *) ldflags="$ans";;
5346 esac
5347 rmlist="$rmlist pdp11"
5348
5349 : coherency check
5350 echo " "
5351 echo "Checking your choice of C compiler and flags for coherency..." >&4
5352 $cat > try.c <<'EOF'
5353 #include <stdio.h>
5354 int main() { printf("Ok\n"); return(0); }
5355 EOF
5356 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5357 shift
5358 $cat >try.msg <<'EOM'
5359 I've tried to compile and run the following simple program:
5360
5361 EOM
5362 $cat try.c >> try.msg
5363
5364 $cat >> try.msg <<EOM
5365
5366 I used the command:
5367
5368         $*
5369         $run ./try
5370
5371 and I got the following output:
5372
5373 EOM
5374 dflt=y
5375 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5376         if $sh -c "$run ./try " >>try.msg 2>&1; then
5377                 xxx=`$run ./try`
5378                 case "$xxx" in
5379                 "Ok") dflt=n ;;
5380                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5381                         case " $libs " in
5382                         *" -lsfio "*)
5383                                 cat >> try.msg <<'EOQS'
5384 If $libs contains -lsfio, and sfio is mis-configured, then it
5385 sometimes (apparently) runs and exits with a 0 status, but with no
5386 output!  It may have to do with sfio's use of _exit vs. exit.
5387
5388 EOQS
5389                                 rp="You have a big problem.  Shall I abort Configure"
5390                                 dflt=y
5391                                 ;;
5392                         esac
5393                         ;;
5394                 esac
5395         else
5396                 echo "The program compiled OK, but exited with status $?." >>try.msg
5397                 rp="You have a problem.  Shall I abort Configure"
5398                 dflt=y
5399         fi
5400 else
5401         echo "I can't compile the test program." >>try.msg
5402         rp="You have a BIG problem.  Shall I abort Configure"
5403         dflt=y
5404 fi
5405 case "$dflt" in
5406 y)
5407         $cat try.msg >&4
5408         case "$knowitall" in
5409         '')
5410                 echo "(The supplied flags or libraries might be incorrect.)"
5411                 ;;
5412         *) dflt=n;;
5413         esac
5414         echo " "
5415         . ./myread
5416         case "$ans" in
5417         n*|N*) ;;
5418         *)      echo "Ok.  Stopping Configure." >&4
5419                 exit 1
5420                 ;;
5421         esac
5422         ;;
5423 n) echo "OK, that should do.";;
5424 esac
5425 $rm_try gcctest gcctest.out
5426
5427 : define a shorthand compile call
5428 compile='
5429 mc_file=$1;
5430 shift;
5431 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5432 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5433 exit 1;
5434 fi;
5435 esac;
5436 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5437 : define a shorthand compile call for compilations that should be ok.
5438 compile_ok='
5439 mc_file=$1;
5440 shift;
5441 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5442
5443 : determine filename position in cpp output
5444 echo " "
5445 echo "Computing filename position in cpp output for #include directives..." >&4
5446 case "$osname" in
5447 vos) testaccess=-e ;;
5448 *)   testaccess=-r ;;
5449 esac
5450 echo '#include <stdio.h>' > foo.c
5451 $cat >fieldn <<EOF
5452 $startsh
5453 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5454 $grep '^[       ]*#.*stdio\.h' | \
5455 while read cline; do
5456         pos=1
5457         set \$cline
5458         while $test \$# -gt 0; do
5459                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5460                         echo "\$pos"
5461                         exit 0
5462                 fi
5463                 shift
5464                 pos=\`expr \$pos + 1\`
5465         done
5466 done
5467 EOF
5468 chmod +x fieldn
5469 fieldn=`./fieldn`
5470 $rm -f foo.c fieldn
5471 case $fieldn in
5472 '') pos='???';;
5473 1) pos=first;;
5474 2) pos=second;;
5475 3) pos=third;;
5476 *) pos="${fieldn}th";;
5477 esac
5478 echo "Your cpp writes the filename in the $pos field of the line."
5479
5480 case "$osname" in
5481 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5482 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5483 *)   cppfilter='' ;;
5484 esac
5485 : locate header file
5486 $cat >findhdr <<EOF
5487 $startsh
5488 wanted=\$1
5489 name=''
5490 for usrincdir in $usrinc
5491 do
5492         if test -f \$usrincdir/\$wanted; then
5493                 echo "\$usrincdir/\$wanted"
5494                 exit 0
5495         fi
5496 done
5497 awkprg='{ print \$$fieldn }'
5498 echo "#include <\$wanted>" > foo\$\$.c
5499 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5500 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5501 while read cline; do
5502         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5503         case "\$name" in
5504         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5505         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5506         *) exit 2;;
5507         esac;
5508 done;
5509 #
5510 # status = 0: grep returned 0 lines, case statement not executed
5511 # status = 1: headerfile found
5512 # status = 2: while loop executed, no headerfile found
5513 #
5514 status=\$?
5515 $rm -f foo\$\$.c;
5516 if test \$status -eq 1; then
5517         exit 0;
5518 fi
5519 exit 1
5520 EOF
5521 chmod +x findhdr
5522
5523 : define an alternate in-header-list? function
5524 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5525 cont=true; xxf="echo \"<\$1> found.\" >&4";
5526 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5527 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5528 esac;
5529 case $# in 4) instead=instead;; *) instead="at last";; esac;
5530 while $test "$cont"; do
5531         xxx=`./findhdr $1`
5532         var=$2; eval "was=\$$2";
5533         if $test "$xxx" && $test -r "$xxx";
5534         then eval $xxf;
5535         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5536                 cont="";
5537         else eval $xxnf;
5538         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5539         set $yyy; shift; shift; yyy=$@;
5540         case $# in 0) cont="";;
5541         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5542                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5543         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5544                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5545         esac;
5546 done;
5547 while $test "$yyy";
5548 do set $yyy; var=$2; eval "was=\$$2";
5549         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5550         set $yyy; shift; shift; yyy=$@;
5551 done'
5552
5553 : see if stdlib is available
5554 set stdlib.h i_stdlib
5555 eval $inhdr
5556
5557 : check for lengths of integral types
5558 echo " "
5559 case "$intsize" in
5560 '')
5561         echo "Checking to see how big your integers are..." >&4
5562         $cat >try.c <<EOCP
5563 #include <stdio.h>
5564 #$i_stdlib I_STDLIB
5565 #ifdef I_STDLIB
5566 #include <stdlib.h>
5567 #endif
5568 int main()
5569 {
5570         printf("intsize=%d;\n", (int)sizeof(int));
5571         printf("longsize=%d;\n", (int)sizeof(long));
5572         printf("shortsize=%d;\n", (int)sizeof(short));
5573         exit(0);
5574 }
5575 EOCP
5576         set try
5577         if eval $compile_ok && $run ./try > /dev/null; then
5578                 eval `$run ./try`
5579                 echo "Your integers are $intsize bytes long."
5580                 echo "Your long integers are $longsize bytes long."
5581                 echo "Your short integers are $shortsize bytes long."
5582         else
5583                 $cat >&4 <<EOM
5584 !
5585 Help! I can't compile and run the intsize test program: please enlighten me!
5586 (This is probably a misconfiguration in your system or libraries, and
5587 you really ought to fix it.  Still, I'll try anyway.)
5588 !
5589 EOM
5590                 dflt=4
5591                 rp="What is the size of an integer (in bytes)?"
5592                 . ./myread
5593                 intsize="$ans"
5594                 dflt=$intsize
5595                 rp="What is the size of a long integer (in bytes)?"
5596                 . ./myread
5597                 longsize="$ans"
5598                 dflt=2
5599                 rp="What is the size of a short integer (in bytes)?"
5600                 . ./myread
5601                 shortsize="$ans"
5602         fi
5603         ;;
5604 esac
5605 $rm_try
5606
5607 : check for long long
5608 echo " "
5609 echo "Checking to see if you have long long..." >&4
5610 echo 'int main() { long long x = 7; return 0; }' > try.c
5611 set try
5612 if eval $compile; then
5613         val="$define"
5614         echo "You have long long."
5615 else
5616         val="$undef"
5617         echo "You do not have long long."
5618 fi
5619 $rm_try
5620 set d_longlong
5621 eval $setvar
5622
5623 : check for length of long long
5624 case "${d_longlong}${longlongsize}" in
5625 $define)
5626         echo " "
5627         echo "Checking to see how big your long longs are..." >&4
5628         $cat >try.c <<'EOCP'
5629 #include <stdio.h>
5630 int main()
5631 {
5632     printf("%d\n", (int)sizeof(long long));
5633     return(0);
5634 }
5635 EOCP
5636         set try
5637         if eval $compile_ok; then
5638                 longlongsize=`$run ./try`
5639                 echo "Your long longs are $longlongsize bytes long."
5640         else
5641                 dflt='8'
5642                 echo " "
5643                 echo "(I can't seem to compile the test program.  Guessing...)"
5644                 rp="What is the size of a long long (in bytes)?"
5645                 . ./myread
5646                 longlongsize="$ans"
5647         fi
5648         if $test "X$longsize" = "X$longlongsize"; then
5649                 echo "(That isn't any different from an ordinary long.)"
5650         fi
5651         ;;
5652 esac
5653 $rm_try
5654
5655 : see if inttypes.h is available
5656 : we want a real compile instead of Inhdr because some systems
5657 : have an inttypes.h which includes non-existent headers
5658 echo " "
5659 $cat >try.c <<EOCP
5660 #include <inttypes.h>
5661 int main() {
5662         static int32_t foo32 = 0x12345678;
5663 }
5664 EOCP
5665 set try
5666 if eval $compile; then
5667         echo "<inttypes.h> found." >&4
5668         val="$define"
5669 else
5670         echo "<inttypes.h> NOT found." >&4
5671         val="$undef"
5672 fi
5673 $rm_try
5674 set i_inttypes
5675 eval $setvar
5676
5677 : check for int64_t
5678 echo " "
5679 echo "Checking to see if you have int64_t..." >&4
5680 $cat >try.c <<EOCP
5681 #include <sys/types.h>
5682 #$i_inttypes I_INTTYPES
5683 #ifdef I_INTTYPES
5684 #include <inttypes.h>
5685 #endif
5686 int main() { int64_t x = 7; }
5687 EOCP
5688 set try
5689 if eval $compile; then
5690         val="$define"
5691         echo "You have int64_t."
5692 else
5693         val="$undef"
5694         echo "You do not have int64_t."
5695 fi
5696 $rm_try
5697 set d_int64_t
5698 eval $setvar
5699
5700 : Check if 64bit ints have a quad type
5701 echo " "
5702 echo "Checking which 64-bit integer type we could use..." >&4
5703
5704 case "$intsize" in
5705 8) val=int
5706    set quadtype
5707    eval $setvar
5708    val='"unsigned int"'
5709    set uquadtype
5710    eval $setvar
5711    quadkind=1
5712    ;;
5713 *) case "$longsize" in
5714    8) val=long
5715       set quadtype
5716       eval $setvar
5717       val='"unsigned long"'
5718       set uquadtype
5719       eval $setvar
5720       quadkind=2
5721       ;;
5722    *) case "$d_longlong:$longlongsize" in
5723       define:8)
5724         val='"long long"'
5725         set quadtype
5726         eval $setvar
5727         val='"unsigned long long"'
5728         set uquadtype
5729         eval $setvar
5730         quadkind=3
5731         ;;
5732       *) case "$d_int64_t" in
5733          define)
5734            val=int64_t
5735            set quadtype
5736            eval $setvar
5737            val=uint64_t
5738            set uquadtype
5739            eval $setvar
5740            quadkind=4
5741            ;;
5742          esac
5743          ;;
5744       esac
5745       ;;
5746    esac
5747    ;;
5748 esac
5749
5750 case "$quadtype" in
5751 '')     echo "Alas, no 64-bit integer types in sight." >&4
5752         d_quad="$undef"
5753         ;;
5754 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5755         d_quad="$define"
5756         ;;
5757 esac
5758
5759 : Do we want 64bit support
5760 case "$uselonglong" in
5761 "$define"|true|[yY]*)
5762         cat <<EOM >&4
5763
5764 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5765 EOM
5766         use64bitint="$define"
5767         ;;
5768 esac
5769 case "$use64bits" in
5770 "$define"|true|[yY]*)
5771         cat <<EOM >&4
5772
5773 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5774 EOM
5775         use64bitint="$define"
5776         ;;
5777 esac
5778 case "$use64bitints" in
5779 "$define"|true|[yY]*)
5780         cat <<EOM >&4
5781
5782 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5783 EOM
5784         use64bitint="$define"
5785         ;;
5786 esac
5787 case "$use64bitsint" in
5788 "$define"|true|[yY]*)
5789         cat <<EOM >&4
5790
5791 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5792 EOM
5793         use64bitint="$define"
5794         ;;
5795 esac
5796 case "$uselonglongs" in
5797 "$define"|true|[yY]*)
5798         cat <<EOM >&4
5799
5800 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5801 EOM
5802         use64bitint="$define"
5803         ;;
5804 esac
5805 case "$use64bitsall" in
5806 "$define"|true|[yY]*)
5807         cat <<EOM >&4
5808
5809 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5810 EOM
5811         use64bitall="$define"
5812         ;;
5813 esac
5814
5815 case "$ccflags" in
5816 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5817 esac
5818 case "$use64bitall" in
5819 "$define"|true|[yY]*) use64bitint="$define" ;;
5820 esac
5821
5822 case "$longsize" in
5823 8) cat <<EOM
5824
5825 You have natively 64-bit long integers.
5826 EOM
5827    val="$define"
5828    ;;
5829 *) case "$use64bitint" in
5830    "$define"|true|[yY]*) dflt='y';;
5831    *) dflt='n';;
5832    esac
5833    case "$d_quad" in
5834    "$define") ;;
5835    *) dflt='n' ;;
5836    esac
5837    cat <<EOM
5838
5839 Perl can be built to take advantage of 64-bit integer types
5840 on some systems.  To do so, Configure can be run with -Duse64bitint.
5841 Choosing this option will most probably introduce binary incompatibilities.
5842
5843 If this doesn't make any sense to you, just accept the default '$dflt'.
5844 (The default has been chosen based on your configuration.)
5845 EOM
5846    rp='Try to use 64-bit integers, if available?'
5847    . ./myread
5848    case "$ans" in
5849    [yY]*) val="$define" ;;
5850    *)     val="$undef"  ;;
5851    esac
5852    ;;
5853 esac
5854 set use64bitint
5855 eval $setvar
5856
5857 case "$use64bitall" in
5858 "$define"|true|[yY]*) dflt='y' ;;
5859 *) case "$longsize" in
5860    8) dflt='y' ;;
5861    *) dflt='n' ;;
5862    esac
5863    ;;
5864 esac
5865 cat <<EOM
5866
5867 You may also choose to try maximal 64-bitness.  It means using as much
5868 64-bitness as possible on the platform.  This in turn means even more
5869 binary incompatibilities.  On the other hand, your platform may not
5870 have any more 64-bitness available than what you already have chosen.
5871
5872 If this doesn't make any sense to you, just accept the default '$dflt'.
5873 (The default has been chosen based on your configuration.)
5874 EOM
5875 rp='Try to use maximal 64-bit support, if available?'
5876 . ./myread
5877 case "$ans" in
5878 [yY]*) val="$define" ;;
5879 *)     val="$undef"  ;;
5880 esac
5881 set use64bitall
5882 eval $setvar
5883 case "$use64bitall" in
5884 "$define")
5885         case "$use64bitint" in
5886         "$undef")
5887                 cat <<EOM
5888
5889 Since you have chosen a maximally 64-bit build, I'm also turning on
5890 the use of 64-bit integers.
5891 EOM
5892                 use64bitint="$define" ;;
5893         esac
5894         ;;
5895 esac
5896
5897 : Look for a hint-file generated 'call-back-unit'.  If the
5898 : user has specified that a 64-bit perl is to be built,
5899 : we may need to set or change some other defaults.
5900 if $test -f use64bitint.cbu; then
5901         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5902         . ./use64bitint.cbu
5903 fi
5904 case "$use64bitint" in
5905 "$define"|true|[yY]*)
5906         case "$longsize" in
5907         4) case "$archname64" in
5908            '') archname64=64int ;;
5909            esac
5910            ;;
5911         esac
5912         ;;
5913 esac
5914
5915 : Look for a hint-file generated 'call-back-unit'.  If the
5916 : user has specified that a maximally 64-bit perl is to be built,
5917 : we may need to set or change some other defaults.
5918 if $test -f use64bitall.cbu; then
5919         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5920         . ./use64bitall.cbu
5921 fi
5922 case "$use64bitall" in
5923 "$define"|true|[yY]*)
5924         case "$longsize" in
5925         4) case "$archname64" in
5926            ''|64int) archname64=64all ;;
5927            esac
5928            ;;
5929         esac
5930         ;;
5931 esac
5932
5933 case "$d_quad:$use64bitint" in
5934 $undef:$define)
5935         cat >&4 <<EOF
5936
5937 *** You have chosen to use 64-bit integers,
5938 *** but none can be found.
5939 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5940 *** Cannot continue, aborting.
5941
5942 EOF
5943         exit 1
5944         ;;
5945 esac
5946
5947 : check for length of double
5948 echo " "
5949 case "$doublesize" in
5950 '')
5951         echo "Checking to see how big your double precision numbers are..." >&4
5952         $cat >try.c <<EOCP
5953 #include <stdio.h>
5954 #$i_stdlib I_STDLIB
5955 #ifdef I_STDLIB
5956 #include <stdlib.h>
5957 #endif
5958 int main()
5959 {
5960     printf("%d\n", (int)sizeof(double));
5961     exit(0);
5962 }
5963 EOCP
5964         set try
5965         if eval $compile_ok; then
5966                 doublesize=`$run ./try`
5967                 echo "Your double is $doublesize bytes long."
5968         else
5969                 dflt='8'
5970                 echo "(I can't seem to compile the test program.  Guessing...)"
5971                 rp="What is the size of a double precision number (in bytes)?"
5972                 . ./myread
5973                 doublesize="$ans"
5974         fi
5975         ;;
5976 esac
5977 $rm_try
5978
5979 : check for long doubles
5980 echo " "
5981 echo "Checking to see if you have long double..." >&4
5982 echo 'int main() { long double x = 7.0; }' > try.c
5983 set try
5984 if eval $compile; then
5985         val="$define"
5986         echo "You have long double."
5987 else
5988         val="$undef"
5989         echo "You do not have long double."
5990 fi
5991 $rm_try
5992 set d_longdbl
5993 eval $setvar
5994
5995 : check for length of long double
5996 case "${d_longdbl}${longdblsize}" in
5997 $define)
5998         echo " "
5999         echo "Checking to see how big your long doubles are..." >&4
6000         $cat >try.c <<'EOCP'
6001 #include <stdio.h>
6002 int main()
6003 {
6004         printf("%d\n", sizeof(long double));
6005 }
6006 EOCP
6007         set try
6008         set try
6009         if eval $compile; then
6010                 longdblsize=`$run ./try`
6011                 echo "Your long doubles are $longdblsize bytes long."
6012         else
6013                 dflt='8'
6014                 echo " "
6015                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6016                 rp="What is the size of a long double (in bytes)?"
6017                 . ./myread
6018                 longdblsize="$ans"
6019         fi
6020         if $test "X$doublesize" = "X$longdblsize"; then
6021                 echo "That isn't any different from an ordinary double."
6022                 echo "I'll keep your setting anyway, but you may see some"
6023                 echo "harmless compilation warnings."
6024         fi
6025         ;;
6026 esac
6027 $rm_try
6028
6029 : determine the architecture name
6030 echo " "
6031 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6032         tarch=`arch`"-$osname"
6033 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6034         if uname -m > tmparch 2>&1 ; then
6035                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6036                         -e 's/$/'"-$osname/" tmparch`
6037         else
6038                 tarch="$osname"
6039         fi
6040         $rm -f tmparch
6041 else
6042         tarch="$osname"
6043 fi
6044 case "$myarchname" in
6045 ''|"$tarch") ;;
6046 *)
6047         echo "(Your architecture name used to be $myarchname.)"
6048         archname=''
6049         ;;
6050 esac
6051 case "$targetarch" in
6052 '') ;;
6053 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6054 esac
6055 myarchname="$tarch"
6056 case "$archname" in
6057 '') dflt="$tarch";;
6058 *) dflt="$archname";;
6059 esac
6060 rp='What is your architecture name'
6061 . ./myread
6062 archname="$ans"
6063 case "$usethreads" in
6064 $define)
6065         echo "Threads selected." >&4
6066         case "$archname" in
6067         *-thread*) echo "...and architecture name already has -thread." >&4
6068                 ;;
6069         *)      archname="$archname-thread"
6070                 echo "...setting architecture name to $archname." >&4
6071                 ;;
6072         esac
6073         ;;
6074 esac
6075 case "$usemultiplicity" in
6076 $define)
6077         echo "Multiplicity selected." >&4
6078         case "$archname" in
6079         *-multi*) echo "...and architecture name already has -multi." >&4
6080                 ;;
6081         *)      archname="$archname-multi"
6082                 echo "...setting architecture name to $archname." >&4
6083                 ;;
6084         esac
6085         ;;
6086 esac
6087 case "$use64bitint$use64bitall" in
6088 *"$define"*)
6089         case "$archname64" in
6090         '')
6091                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6092                 ;;
6093         *)
6094                 case "$use64bitint" in
6095                 "$define") echo "64 bit integers selected." >&4 ;;
6096                 esac
6097                 case "$use64bitall" in
6098                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6099                 esac
6100                 case "$archname" in
6101                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6102                         ;;
6103                 *)      archname="$archname-$archname64"
6104                         echo "...setting architecture name to $archname." >&4
6105                         ;;
6106                 esac
6107                 ;;
6108         esac
6109 esac
6110 case "$uselongdouble" in
6111 $define)
6112         echo "Long doubles selected." >&4
6113         case "$longdblsize" in
6114         $doublesize)
6115                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6116                 ;;
6117         *)
6118                 case "$archname" in
6119                 *-ld*) echo "...and architecture name already has -ld." >&4
6120                         ;;
6121                 *)      archname="$archname-ld"
6122                         echo "...setting architecture name to $archname." >&4
6123                         ;;
6124                 esac
6125                 ;;
6126         esac
6127         ;;
6128 esac
6129 case "$useperlio" in
6130 $define)
6131         echo "Perlio selected." >&4
6132         ;;
6133 *)
6134         echo "Perlio not selected, using stdio." >&4
6135         case "$archname" in
6136         *-stdio*) echo "...and architecture name already has -stdio." >&4
6137                 ;;
6138         *)      archname="$archname-stdio"
6139                 echo "...setting architecture name to $archname." >&4
6140                 ;;
6141         esac
6142         ;;
6143 esac
6144 if $test -f archname.cbu; then
6145         echo "Your platform has some specific hints for architecture name, using them..."
6146         . ./archname.cbu
6147 fi
6148
6149 : set the prefixit variable, to compute a suitable default value
6150 prefixit='case "$3" in
6151 ""|none)
6152         case "$oldprefix" in
6153         "") eval "$1=\"\$$2\"";;
6154         *)
6155                 case "$3" in
6156                 "") eval "$1=";;
6157                 none)
6158                         eval "tp=\"\$$2\"";
6159                         case "$tp" in
6160                         ""|" ") eval "$1=\"\$$2\"";;
6161                         *) eval "$1=";;
6162                         esac;;
6163                 esac;;
6164         esac;;
6165 *)
6166         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6167         case "$tp" in
6168         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6169         /*-$oldprefix/*|\~*-$oldprefix/*)
6170                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6171         *) eval "$1=\"\$$2\"";;
6172         esac;;
6173 esac'
6174
6175 : determine installation style
6176 : For now, try to deduce it from prefix unless it is already set.
6177 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6178 case "$installstyle" in
6179 '')     case "$prefix" in
6180                 *perl*) dflt='lib';;
6181                 *) dflt='lib/perl5' ;;
6182         esac
6183         ;;
6184 *)      dflt="$installstyle" ;;
6185 esac
6186 : Probably not worth prompting for this since we prompt for all
6187 : the directories individually, and the prompt would be too long and
6188 : confusing anyway.
6189 installstyle=$dflt
6190
6191 : determine where public executables go
6192 echo " "
6193 set dflt bin bin
6194 eval $prefixit
6195 fn=d~
6196 rp='Pathname where the public executables will reside?'
6197 . ./getfile
6198 if $test "X$ansexp" != "X$binexp"; then
6199         installbin=''
6200 fi
6201 prefixvar=bin
6202 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6203 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6204 :     this via initialinstalllocation
6205 . ./setprefixvar
6206
6207 case "$userelocatableinc" in
6208 $define|true|[yY]*)     dflt='y' ;;
6209 *)                      dflt='n' ;;
6210 esac
6211 cat <<EOM
6212
6213 Would you like to build Perl so that the installation is relocatable, so that
6214 library paths in @INC are determined relative to the path of the perl binary?
6215 This is not advised for system Perl installs, or if you need to run setid
6216 scripts or scripts under taint mode.
6217
6218 If this doesn't make any sense to you, just accept the default '$dflt'.
6219 EOM
6220 rp='Use relocatable @INC?'
6221 . ./myread
6222 case "$ans" in
6223 y|Y)    val="$define" ;;
6224 *)      val="$undef"  ;;
6225 esac
6226 set userelocatableinc
6227 eval $setvar
6228
6229 initialinstalllocation="$binexp"
6230 : Default prefix is now "up one level from where the binaries are"
6231 case "$userelocatableinc" in
6232 $define|true|[yY]*)
6233     bin=".../"
6234     binexp=".../"
6235     prefix=".../.."
6236     prefixexp=".../.."
6237     installprefixexp=".../.."
6238     ;;
6239 esac
6240
6241 : determine where private library files go
6242 : Usual default is /usr/local/lib/perl5/$version.
6243 : Also allow things like /opt/perl/lib/$version, since
6244 : /opt/perl/lib/perl5... would be redundant.
6245 : The default "style" setting is made in installstyle.U
6246 case "$installstyle" in
6247 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6248 *)       set dflt privlib lib/$version ;;
6249 esac
6250 eval $prefixit
6251 $cat <<EOM
6252
6253 There are some auxiliary files for $package that need to be put into a
6254 private library directory that is accessible by everyone.
6255
6256 EOM
6257 fn=$binexp
6258 fn=d~+
6259 rp='Pathname where the private library files will reside?'
6260 . ./getfile
6261 prefixvar=privlib
6262 . ./setprefixvar
6263
6264 : set the prefixup variable, to restore leading tilda escape
6265 prefixup='case "$prefixexp" in
6266 "$prefix") ;;
6267 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6268 esac'
6269
6270 : determine where public architecture dependent libraries go
6271 set archlib archlib
6272 eval $prefixit
6273 : privlib default is /usr/local/lib/$package/$version
6274 : archlib default is /usr/local/lib/$package/$version/$archname
6275 : privlib may have an optional trailing /share.
6276 tdflt=`echo $privlib | $sed 's,/share$,,'`
6277 tdflt=$tdflt/$archname
6278 case "$archlib" in
6279 '')     dflt=$tdflt
6280         ;;
6281 *)      dflt="$archlib"
6282     ;;
6283 esac
6284 $cat <<EOM
6285
6286 $spackage contains architecture-dependent library files.  If you are
6287 sharing libraries in a heterogeneous environment, you might store
6288 these files in a separate location.  Otherwise, you can just include
6289 them with the rest of the public library files.
6290
6291 EOM
6292 fn=$binexp
6293 fn=d+~
6294 rp='Where do you want to put the public architecture-dependent libraries?'
6295 . ./getfile
6296 prefixvar=archlib
6297 . ./setprefixvar
6298 if $test X"$archlib" = X"$privlib"; then
6299         d_archlib="$undef"
6300 else
6301         d_archlib="$define"
6302 fi
6303
6304 : see if setuid scripts can be secure
6305 $cat <<EOM
6306
6307 Some kernels have a bug that prevents setuid #! scripts from being
6308 secure.  Some sites have disabled setuid #! scripts because of this.
6309
6310 First let's decide if your kernel supports secure setuid #! scripts.
6311 (If setuid #! scripts would be secure but have been disabled anyway,
6312 don't say that they are secure if asked.)
6313
6314 EOM
6315
6316 val="$undef"
6317 if $test -d /dev/fd; then
6318         echo "#!$ls" >reflect
6319         chmod +x,u+s reflect
6320         ./reflect >flect 2>&1
6321         if $contains "/dev/fd" flect >/dev/null; then
6322                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6323                 val="$define"
6324         else
6325                 $cat <<EOM
6326 If you are not sure if they are secure, I can check but I'll need a
6327 username and password different from the one you are using right now.
6328 If you don't have such a username or don't want me to test, simply
6329 enter 'none'.
6330
6331 EOM
6332                 rp='Other username to test security of setuid scripts with?'
6333                 dflt='none'
6334                 . ./myread
6335                 case "$ans" in
6336                 n|none)
6337                         case "$d_suidsafe" in
6338                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6339                                 dflt=n;;
6340                         "$undef")
6341                                 echo "Well, the $hint value is *not* secure." >&4
6342                                 dflt=n;;
6343                         *)      echo "Well, the $hint value *is* secure." >&4
6344                                 dflt=y;;
6345                         esac
6346                         ;;
6347                 *)
6348                         $rm -f reflect flect
6349                         echo "#!$ls" >reflect
6350                         chmod +x,u+s reflect
6351                         echo >flect
6352                         chmod a+w flect
6353                         echo '"su" will (probably) prompt you for '"$ans's password."
6354                         su $ans -c './reflect >flect'
6355                         if $contains "/dev/fd" flect >/dev/null; then
6356                                 echo "Okay, it looks like setuid scripts are secure." >&4
6357                                 dflt=y
6358                         else
6359                                 echo "I don't think setuid scripts are secure." >&4
6360                                 dflt=n
6361                         fi
6362                         ;;
6363                 esac
6364                 rp='Does your kernel have *secure* setuid scripts?'
6365                 . ./myread
6366                 case "$ans" in
6367                 [yY]*)  val="$define";;
6368                 *)      val="$undef";;
6369                 esac
6370         fi
6371 else
6372         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6373         echo "(That's for file descriptors, not floppy disks.)"
6374         val="$undef"
6375 fi
6376 set d_suidsafe
6377 eval $setvar
6378
6379 $rm -f reflect flect
6380
6381 : now see if they want to do setuid emulation
6382 if $test $patchlevel -lt 11; then
6383 echo " "
6384 val="$undef"
6385 case "$d_suidsafe" in
6386 "$define")
6387         val="$undef"
6388         echo "No need to emulate SUID scripts since they are secure here." >&4
6389         ;;
6390 *)
6391         $cat <<EOM
6392 Some systems have disabled setuid scripts, especially systems where
6393 setuid scripts cannot be secure.  On systems where setuid scripts have
6394 been disabled, the setuid/setgid bits on scripts are currently
6395 useless.  It is possible for $package to detect those bits and emulate
6396 setuid/setgid in a secure fashion.  This emulation will only work if
6397 setuid scripts have been disabled in your kernel.
6398
6399 EOM
6400         case "$d_dosuid" in
6401         "$define") dflt=y ;;
6402         *) dflt=n ;;
6403         esac
6404         rp="Do you want to do setuid/setgid emulation?"
6405         . ./myread
6406         case "$ans" in
6407         [yY]*)  val="$define";;
6408         *)      val="$undef";;
6409         esac
6410         ;;
6411 esac
6412 set d_dosuid
6413 eval $setvar
6414 else
6415     case "$d_dosuid" in
6416         "$define")
6417         cat >&4 <<EOH
6418
6419 SUID emulation has been removed for 5.12
6420 Please re-run Configure without -Dd_dosuid
6421
6422 EOH
6423         exit 1;
6424         ;;
6425     esac
6426     d_dosuid=undef
6427 fi
6428
6429 : Find perl5.005 or later.
6430 echo "Looking for a previously installed perl5.005 or later... "
6431 case "$perl5" in
6432 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6433                 : Check if this perl is recent and can load a simple module
6434                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6435                         perl5=$tdir/perl
6436                         break;
6437                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6438                         perl5=$tdir/perl5
6439                         break;
6440                 fi
6441         done
6442         ;;
6443 *)      perl5="$perl5"
6444         ;;
6445 esac
6446 case "$perl5" in
6447 '')     echo "None found.  That's ok.";;
6448 *)      echo "Using $perl5." ;;
6449 esac
6450
6451 : Set the siteprefix variables
6452 $cat <<EOM
6453
6454 After $package is installed, you may wish to install various
6455 add-on modules and utilities.  Typically, these add-ons will
6456 be installed under $prefix with the rest
6457 of this package.  However, you may wish to install such add-ons
6458 elsewhere under a different prefix.
6459
6460 If you do not wish to put everything under a single prefix, that's
6461 ok.  You will be prompted for the individual locations; this siteprefix
6462 is only used to suggest the defaults.
6463
6464 The default should be fine for most people.
6465
6466 EOM
6467 fn=d~+
6468 rp='Installation prefix to use for add-on modules and utilities?'
6469 : XXX Here might be another good place for an installstyle setting.
6470 case "$siteprefix" in
6471 '') dflt=$prefix ;;
6472 *)  dflt=$siteprefix ;;
6473 esac
6474 . ./getfile
6475 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6476 oldsiteprefix=''
6477 case "$siteprefix" in
6478 '') ;;
6479 *)      case "$ans" in
6480         "$prefix") ;;
6481         *) oldsiteprefix="$prefix";;
6482         esac
6483         ;;
6484 esac
6485 siteprefix="$ans"
6486 siteprefixexp="$ansexp"
6487
6488 : determine where site specific libraries go.
6489 : Usual default is /usr/local/lib/perl5/site_perl/$version
6490 : The default "style" setting is made in installstyle.U
6491 : XXX No longer works with Prefixit stuff.
6492 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6493 case "$sitelib" in
6494 '') case "$installstyle" in
6495         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6496         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6497         esac
6498         ;;
6499 *)      dflt="$sitelib"
6500         ;;
6501 esac
6502 $cat <<EOM
6503
6504 The installation process will create a directory for
6505 site-specific extensions and modules.  Most users find it convenient
6506 to place all site-specific files in this directory rather than in the
6507 main distribution directory.
6508
6509 EOM
6510 fn=d~+
6511 rp='Pathname for the site-specific library files?'
6512 . ./getfile
6513 prefixvar=sitelib
6514 . ./setprefixvar
6515 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6516
6517 : Determine list of previous versions to include in @INC
6518 $cat > getverlist <<EOPL
6519 #!$perl5 -w
6520 use File::Basename;
6521 \$api_versionstring = "$api_versionstring";
6522 \$version = "$version";
6523 \$stem = "$sitelib_stem";
6524 \$archname = "$archname";
6525 EOPL
6526         $cat >> getverlist <<'EOPL'
6527 # The list found is store twice for each entry: the original name, and
6528 # the binary broken down version as pack "sss", so sorting is easy and
6529 # unambiguous. This will work for all versions that have a maximum of
6530 # three digit groups, separate by '.'s or '_'s. Names are extended with
6531 # ".0.0" to ensure at least three elements for the pack.
6532 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6533
6534 # Can't have leading @ because metaconfig interprets it as a command!
6535 ;@inc_version_list=();
6536 # XXX Redo to do opendir/readdir?
6537 if (-d $stem) {
6538     chdir($stem);
6539     ;@candidates = map {
6540         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6541     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6542 }
6543 else {
6544     ;@candidates = ();
6545 }
6546
6547 ($pversion, $aversion, $vsn5005) = map {
6548     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6549 foreach $d (@candidates) {
6550     if ($d->[1] lt $pversion) {
6551         if ($d->[1] ge $aversion) {
6552             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6553         }
6554         elsif ($d->[1] ge $vsn5005) {
6555             unshift(@inc_version_list, grep { -d } $d->[0]);
6556         }
6557     }
6558     else {
6559         # Skip newer version.  I.e. don't look in
6560         # 5.7.0 if we're installing 5.6.1.
6561     }
6562 }
6563
6564 if (@inc_version_list) {
6565     print join(' ', @inc_version_list);
6566 }
6567 else {
6568     # Blank space to preserve value for next Configure run.
6569     print " ";
6570 }
6571 EOPL
6572 chmod +x getverlist
6573 case "$inc_version_list" in
6574 '')     if test -x "$perl5$exe_ext"; then
6575                 dflt=`$perl5 getverlist`
6576         else
6577                 dflt='none'
6578         fi
6579         ;;
6580 $undef) dflt='none' ;;
6581 *)  eval dflt=\"$inc_version_list\" ;;
6582 esac
6583 case "$dflt" in
6584 ''|' ') dflt=none ;;
6585 esac
6586 case "$dflt" in
6587 5.005) dflt=none ;;
6588 esac
6589 $cat <<EOM
6590
6591 In order to ease the process of upgrading, this version of perl
6592 can be configured to use modules built and installed with earlier
6593 versions of perl that were installed under $prefix.  Specify here
6594 the list of earlier versions that this version of perl should check.
6595 If Configure detected no earlier versions of perl installed under
6596 $prefix, then the list will be empty.  Answer 'none' to tell perl
6597 to not search earlier versions.
6598
6599 The default should almost always be sensible, so if you're not sure,
6600 just accept the default.
6601 EOM
6602
6603 rp='List of earlier versions to include in @INC?'
6604 . ./myread
6605 case "$ans" in
6606 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6607 *) inc_version_list="$ans" ;;
6608 esac
6609 case "$inc_version_list" in
6610 ''|' ')
6611         inc_version_list_init='0'
6612         d_inc_version_list="$undef"
6613         ;;
6614 *)      inc_version_list_init=`echo $inc_version_list |
6615                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6616         d_inc_version_list="$define"
6617         ;;
6618 esac
6619 $rm -f getverlist
6620
6621 : see if malloc/malloc.h has to be included
6622 set malloc/malloc.h i_mallocmalloc
6623 eval $inhdr
6624
6625 : see if this is a malloc.h system
6626 : we want a real compile instead of Inhdr because some systems have a
6627 : malloc.h that just gives a compile error saying to use stdlib.h instead
6628 echo " "
6629 $cat >try.c <<EOCP
6630 #include <stdlib.h>
6631 #include <malloc.h>
6632 #$i_mallocmalloc I_MALLOCMALLOC
6633 #ifdef I_MALLOCMALLOC
6634 # include <malloc/malloc.h>
6635 #endif
6636
6637 int main () { return 0; }
6638 EOCP
6639 set try
6640 if eval $compile; then
6641     echo "<malloc.h> found." >&4
6642     val="$define"
6643 else
6644     echo "<malloc.h> NOT found." >&4
6645     val="$undef"
6646 fi
6647 $rm_try
6648 set i_malloc
6649 eval $setvar
6650
6651 : check for void type
6652 echo " "
6653 echo "Checking to see how well your C compiler groks the void type..." >&4
6654 case "$voidflags" in
6655 '')
6656         $cat >try.c <<EOCP
6657 #$i_stdlib I_STDLIB
6658 #ifdef I_STDLIB
6659 #include <stdlib.h>
6660 #endif
6661 #if TRY & 1
6662 void sub() {
6663 #else
6664 sub() {
6665 #endif
6666         extern void moo();      /* function returning void */
6667         void (*goo)();          /* ptr to func returning void */
6668 #if TRY & 8
6669         void *hue;              /* generic ptr */
6670 #endif
6671 #if TRY & 2
6672         void (*foo[10])();
6673 #endif
6674
6675 #if TRY & 4
6676         if(goo == moo) {
6677                 exit(0);
6678         }
6679 #endif
6680         exit(0);
6681 }
6682 int main() { sub(); }
6683 EOCP
6684         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6685                 voidflags=$defvoidused
6686         echo "Good.  It appears to support void to the level $package wants.">&4
6687                 if $contains warning .out >/dev/null 2>&1; then
6688                         echo "However, you might get some warnings that look like this:"
6689                         $cat .out
6690                 fi
6691         else
6692 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6693                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6694                         echo "It supports 1..."
6695                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6696                                 echo "It also supports 2..."
6697                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6698                                         voidflags=7
6699                                         echo "And it supports 4 but not 8 definitely."
6700                                 else
6701                                         echo "It doesn't support 4..."
6702                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6703                                                 voidflags=11
6704                                                 echo "But it supports 8."
6705                                         else
6706                                                 voidflags=3
6707                                                 echo "Neither does it support 8."
6708                                         fi
6709                                 fi
6710                         else
6711                                 echo "It does not support 2..."
6712                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6713                                         voidflags=13
6714                                         echo "But it supports 4 and 8."
6715                                 else
6716                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6717                                                 voidflags=5
6718                                                 echo "And it supports 4 but has not heard about 8."
6719                                         else
6720                                                 echo "However it supports 8 but not 4."
6721                                         fi
6722                                 fi
6723                         fi
6724                 else
6725                         echo "There is no support at all for void."
6726                         voidflags=0
6727                 fi
6728         fi
6729 esac
6730 case "$voidflags" in
6731 "$defvoidused") ;;
6732 *)      $cat >&4 <<'EOM'
6733   Support flag bits are:
6734     1: basic void declarations.
6735     2: arrays of pointers to functions returning void.
6736     4: operations between pointers to and addresses of void functions.
6737     8: generic void pointers.
6738 EOM
6739         dflt="$voidflags";
6740         rp="Your void support flags add up to what?"
6741         . ./myread
6742         voidflags="$ans"
6743         ;;
6744 esac
6745 $rm_try
6746
6747 : check for length of pointer
6748 echo " "
6749 case "$ptrsize" in
6750 '')
6751         echo "Checking to see how big your pointers are..." >&4
6752         if test "$voidflags" -gt 7; then
6753                 echo '#define VOID_PTR char *' > try.c
6754         else
6755                 echo '#define VOID_PTR void *' > try.c
6756         fi
6757         $cat >>try.c <<EOCP
6758 #include <stdio.h>
6759 #$i_stdlib I_STDLIB
6760 #ifdef I_STDLIB
6761 #include <stdlib.h>
6762 #endif
6763 int main()
6764 {
6765     printf("%d\n", (int)sizeof(VOID_PTR));
6766     exit(0);
6767 }
6768 EOCP
6769         set try
6770         if eval $compile_ok; then
6771                 ptrsize=`$run ./try`
6772                 echo "Your pointers are $ptrsize bytes long."
6773         else
6774                 dflt='4'
6775                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6776                 rp="What is the size of a pointer (in bytes)?"
6777                 . ./myread
6778                 ptrsize="$ans"
6779         fi
6780         ;;
6781 esac
6782 $rm_try
6783 case "$use64bitall" in
6784 "$define"|true|[yY]*)
6785         case "$ptrsize" in
6786         4)      cat <<EOM >&4
6787
6788 *** You have chosen a maximally 64-bit build,
6789 *** but your pointers are only 4 bytes wide.
6790 *** Please rerun Configure without -Duse64bitall.
6791 EOM
6792                 case "$d_quad" in
6793                 define)
6794                         cat <<EOM >&4
6795 *** Since you have quads, you could possibly try with -Duse64bitint.
6796 EOM
6797                         ;;
6798                 esac
6799                 cat <<EOM >&4
6800 *** Cannot continue, aborting.
6801
6802 EOM
6803
6804                 exit 1
6805                 ;;
6806         esac
6807         ;;
6808 esac
6809
6810
6811 : determine whether to use malloc wrapping
6812 echo " "
6813 case "$usemallocwrap" in
6814 [yY]*|true|$define)     dflt='y' ;;
6815 [nN]*|false|$undef)     dflt='n' ;;
6816 *)      case "$usedevel" in
6817         [yY]*|true|$define)     dflt='y' ;;
6818         *) dflt='n' ;;
6819         esac
6820         ;;
6821 esac
6822 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6823 . ./myread
6824 usemallocwrap="$ans"
6825 case "$ans" in
6826 y*|true)
6827         usemallocwrap="$define" ;;
6828 *)
6829         usemallocwrap="$undef" ;;
6830 esac
6831
6832 : determine which malloc to compile in
6833 echo " "
6834 case "$usemymalloc" in
6835 [yY]*|true|$define)     dflt='y' ;;
6836 [nN]*|false|$undef)     dflt='n' ;;
6837 *)      case "$ptrsize" in
6838         4) dflt='y' ;;
6839         *) dflt='n' ;;
6840         esac
6841         ;;
6842 esac
6843 rp="Do you wish to attempt to use the malloc that comes with $package?"
6844 . ./myread
6845 usemymalloc="$ans"
6846 case "$ans" in
6847 y*|true)
6848         usemymalloc='y'
6849         mallocsrc='malloc.c'
6850         mallocobj="malloc$_o"
6851         d_mymalloc="$define"
6852         case "$libs" in
6853         *-lmalloc*)
6854                 : Remove malloc from list of libraries to use
6855                 echo "Removing unneeded -lmalloc from library list" >&4
6856                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6857                 shift
6858                 libs="$*"
6859                 echo "libs = $libs" >&4
6860                 ;;
6861         esac
6862         ;;
6863 *)
6864         usemymalloc='n'
6865         mallocsrc=''
6866         mallocobj=''
6867         d_mymalloc="$undef"
6868         ;;
6869 esac
6870
6871 : compute the return types of malloc and free
6872 echo " "
6873 $cat >malloc.c <<END
6874 #$i_malloc I_MALLOC
6875 #$i_stdlib I_STDLIB
6876 #include <stdio.h>
6877 #include <sys/types.h>
6878 #ifdef I_MALLOC
6879 #include <malloc.h>
6880 #endif
6881 #ifdef I_STDLIB
6882 #include <stdlib.h>
6883 #endif
6884 #ifdef TRY_MALLOC
6885 void *malloc();
6886 #endif
6887 #ifdef TRY_FREE
6888 void free();
6889 #endif
6890 END
6891 case "$malloctype" in
6892 '')
6893         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6894                 malloctype='void *'
6895         else
6896                 malloctype='char *'
6897         fi
6898         ;;
6899 esac
6900 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6901
6902 case "$freetype" in
6903 '')
6904         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6905                 freetype='void'
6906         else
6907                 freetype='int'
6908         fi
6909         ;;
6910 esac
6911 echo "Your system uses $freetype free(), it would seem." >&4
6912 $rm -f malloc.[co]
6913 : determine where site specific architecture-dependent libraries go.
6914 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6915 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6916 : sitelib may have an optional trailing /share.
6917 case "$sitearch" in
6918 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6919         dflt="$dflt/$archname"
6920         ;;
6921 *)      dflt="$sitearch"
6922         ;;
6923 esac
6924 set sitearch sitearch none
6925 eval $prefixit
6926 $cat <<EOM
6927
6928 The installation process will also create a directory for
6929 architecture-dependent site-specific extensions and modules.
6930
6931 EOM
6932 fn=d~+
6933 rp='Pathname for the site-specific architecture-dependent library files?'
6934 . ./getfile
6935 prefixvar=sitearch
6936 . ./setprefixvar
6937 if $test X"$sitearch" = X"$sitelib"; then
6938         d_sitearch="$undef"
6939 else
6940         d_sitearch="$define"
6941 fi
6942
6943 : Set the vendorprefix variables
6944 $cat <<EOM
6945
6946 The installation process will also create a directory for
6947 vendor-supplied add-ons.  Vendors who supply perl with their system
6948 may find it convenient to place all vendor-supplied files in this
6949 directory rather than in the main distribution directory.  This will
6950 ease upgrades between binary-compatible maintenance versions of perl.
6951
6952 Of course you may also use these directories in whatever way you see
6953 fit.  For example, you might use them to access modules shared over a
6954 company-wide network.
6955
6956 The default answer should be fine for most people.
6957 This causes further questions about vendor add-ons to be skipped
6958 and no vendor-specific directories will be configured for perl.
6959
6960 EOM
6961 rp='Do you want to configure vendor-specific add-on directories?'
6962 case "$usevendorprefix" in
6963 define|true|[yY]*) dflt=y ;;
6964 *)      : User may have set vendorprefix directly on Configure command line.
6965         case "$vendorprefix" in
6966         ''|' ') dflt=n ;;
6967         *)      dflt=y ;;
6968         esac
6969         ;;
6970 esac
6971 . ./myread
6972 case "$ans" in
6973 [yY]*)  fn=d~+
6974         rp='Installation prefix to use for vendor-supplied add-ons?'
6975         case "$vendorprefix" in
6976         '') dflt='' ;;
6977         *)  dflt=$vendorprefix ;;
6978         esac
6979         . ./getfile
6980         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6981         oldvendorprefix=''
6982         case "$vendorprefix" in
6983         '') ;;
6984         *)      case "$ans" in
6985                 "$prefix") ;;
6986                 *) oldvendorprefix="$prefix";;
6987                 esac
6988                 ;;
6989         esac
6990         usevendorprefix="$define"
6991         vendorprefix="$ans"
6992         vendorprefixexp="$ansexp"
6993         ;;
6994 *)      usevendorprefix="$undef"
6995         vendorprefix=''
6996         vendorprefixexp=''
6997         ;;
6998 esac
6999
7000 : Set the vendorlib variables
7001 case "$vendorprefix" in
7002 '')     d_vendorlib="$undef"
7003         vendorlib=''
7004         vendorlibexp=''
7005         ;;
7006 *)      d_vendorlib="$define"
7007         : determine where vendor-supplied modules go.
7008         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7009         case "$vendorlib" in
7010         '')
7011                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7012                 case "$installstyle" in
7013                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7014                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7015                 esac
7016                 ;;
7017         *)      dflt="$vendorlib"
7018                 ;;
7019         esac
7020         fn=d~+
7021         rp='Pathname for the vendor-supplied library files?'
7022         . ./getfile
7023         vendorlib="$ans"
7024         vendorlibexp="$ansexp"
7025         ;;
7026 esac
7027 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7028 prefixvar=vendorlib
7029 . ./installprefix
7030
7031 : Set the vendorarch variables
7032 case "$vendorprefix" in
7033 '')     d_vendorarch="$undef"
7034         vendorarch=''
7035         vendorarchexp=''
7036         ;;
7037 *)      d_vendorarch="$define"
7038         : determine where vendor-supplied architecture-dependent libraries go.
7039         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7040         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7041         : vendorlib may have an optional trailing /share.
7042         case "$vendorarch" in
7043         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7044                 dflt="$dflt/$archname"
7045                 ;;
7046         *)      dflt="$vendorarch" ;;
7047         esac
7048         fn=d~+
7049         rp='Pathname for vendor-supplied architecture-dependent files?'
7050         . ./getfile
7051         vendorarch="$ans"
7052         vendorarchexp="$ansexp"
7053         ;;
7054 esac
7055 prefixvar=vendorarch
7056 . ./installprefix
7057 if $test X"$vendorarch" = X"$vendorlib"; then
7058         d_vendorarch="$undef"
7059 else
7060         d_vendorarch="$define"
7061 fi
7062
7063 : Final catch-all directories to search
7064 $cat <<EOM
7065
7066 Lastly, you can have perl look in other directories for extensions and
7067 modules in addition to those already specified.
7068 These directories will be searched after 
7069         $sitearch 
7070         $sitelib 
7071 EOM
7072 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7073 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7074 echo ' '
7075 case "$otherlibdirs" in
7076 ''|' ') dflt='none' ;;
7077 *)      dflt="$otherlibdirs" ;;
7078 esac
7079 $cat <<EOM
7080 Enter a colon-separated set of extra paths to include in perl's @INC
7081 search path, or enter 'none' for no extra paths.
7082
7083 EOM
7084
7085 rp='Colon-separated list of additional directories for perl to search?'
7086 . ./myread
7087 case "$ans" in
7088 ' '|''|none)    otherlibdirs=' ' ;;     
7089 *)      otherlibdirs="$ans" ;;
7090 esac
7091 case "$otherlibdirs" in
7092 ' ') val=$undef ;;
7093 *)      val=$define ;;
7094 esac
7095 set d_perl_otherlibdirs
7096 eval $setvar
7097
7098 : Cruising for prototypes
7099 echo " "
7100 echo "Checking out function prototypes..." >&4
7101 $cat >prototype.c <<EOCP
7102 #$i_stdlib I_STDLIB
7103 #ifdef I_STDLIB
7104 #include <stdlib.h>
7105 #endif
7106 int main(int argc, char *argv[]) {
7107         exit(0);}
7108 EOCP
7109 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7110         echo "Your C compiler appears to support function prototypes."
7111         val="$define"
7112 else
7113         echo "Your C compiler doesn't seem to understand function prototypes."
7114         val="$undef"
7115 fi
7116 set prototype
7117 eval $setvar
7118 $rm -f prototype*
7119
7120 : Check if ansi2knr is required
7121 case "$prototype" in
7122 "$define") ;;
7123 *)      ansi2knr='ansi2knr'
7124         echo " "
7125         cat <<EOM >&4
7126
7127 $me:  FATAL ERROR:
7128 This version of $package can only be compiled by a compiler that 
7129 understands function prototypes.  Unfortunately, your C compiler 
7130         $cc $ccflags
7131 doesn't seem to understand them.  Sorry about that.
7132
7133 If GNU cc is available for your system, perhaps you could try that instead.  
7134
7135 Eventually, we hope to support building Perl with pre-ANSI compilers.
7136 If you would like to help in that effort, please contact <perlbug@perl.org>.
7137
7138 Aborting Configure now.
7139 EOM
7140         exit 2
7141         ;;
7142 esac
7143
7144 : DTrace support
7145 dflt_dtrace='/usr/sbin/dtrace'
7146 cat <<EOM
7147
7148 Perl can be built to support DTrace on platforms that support it.
7149 DTrace is a diagnosis and performance analysis tool from Sun.
7150
7151 If this doesn't make any sense to you, just accept the default '$dflt'.
7152 EOM
7153
7154 while $test 1 ; do
7155         case "$usedtrace" in
7156         $define|true|[yY]*)
7157                 dflt='y'
7158                 ;;
7159         ?*)
7160                 dflt='y'
7161                 dflt_dtrace=$usedtrace
7162                 ;;
7163         *)
7164                 dflt='n'
7165                 ;;
7166         esac
7167
7168         rp='Support DTrace if available?'
7169         . ./myread
7170         case "$ans" in
7171         y|Y)    val="$define" ;;
7172         *)      val="$undef" ;;
7173         esac
7174         set usedtrace
7175         eval $setvar
7176
7177         test "X$usedtrace" != "X$define" && break
7178
7179         echo " "
7180         rp='Where is the dtrace executable?'
7181         dflt=$dflt_dtrace
7182         . ./getfile
7183         val="$ans"
7184         set dtrace
7185         eval $setvar
7186
7187         if $test -f $dtrace
7188         then
7189                 if $dtrace -h -s ../perldtrace.d \
7190                         -o perldtrace.tmp >/dev/null 2>&1 \
7191                         && rm -f perldtrace.tmp
7192                 then
7193                         echo " "
7194                         echo "Good: your $dtrace knows about the -h flag."
7195                 else
7196                         cat >&2 <<EOM
7197
7198 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7199 ***
7200 *** Your installed dtrace doesn't support the -h switch to compile a D
7201 *** program into a C header. Can't continue.
7202
7203 EOM
7204                         exit 1
7205                 fi
7206                 break;
7207         fi
7208
7209         case "$fastread" in
7210         yes)
7211                 cat >&2 <<EOM
7212
7213 *** $me:  Fatal Error:  $dtrace not found.
7214 *** Can't continue.
7215
7216 EOM
7217                 exit 1
7218                 ;;
7219         *)
7220                 echo "*** $dtrace was not found."
7221                 echo " "
7222                 ;;
7223         esac
7224 done
7225
7226 : See if we want extra modules installed
7227 echo " "
7228 case "$extras" in
7229 '') dflt='n';;
7230 *) dflt='y';;
7231 esac
7232 cat <<EOM
7233 Perl can be built with extra modules or bundles of modules which
7234 will be fetched from the CPAN and installed alongside Perl.
7235
7236 Notice that you will need access to the CPAN; either via the Internet,
7237 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7238 be asked later to configure the CPAN.pm module which will in turn do
7239 the installation of the rest of the extra modules or bundles.)
7240
7241 Notice also that if the modules require any external software such as
7242 libraries and headers (the libz library and the zlib.h header for the
7243 Compress::Zlib module, for example) you MUST have any such software
7244 already installed, this configuration process will NOT install such
7245 things for you.
7246
7247 If this doesn't make any sense to you, just accept the default '$dflt'.
7248 EOM
7249 rp='Install any extra modules (y or n)?'
7250 . ./myread
7251 case "$ans" in
7252 y|Y)
7253         cat <<EOM
7254
7255 Please list any extra modules or bundles to be installed from CPAN,
7256 with spaces between the names.  The names can be in any format the
7257 'install' command of CPAN.pm will understand.  (Answer 'none',
7258 without the quotes, to install no extra modules or bundles.)
7259 EOM
7260         rp='Extras?'
7261         dflt="$extras"
7262         . ./myread
7263         extras="$ans"
7264 esac
7265 case "$extras" in
7266 ''|'none')
7267         val=''
7268         $rm -f ../extras.lst
7269         ;;
7270 *)      echo "(Saving the list of extras for later...)"
7271         echo "$extras" > ../extras.lst
7272         val="'$extras'"
7273         ;;
7274 esac
7275 set extras
7276 eval $setvar
7277 echo " "
7278
7279 : determine where html pages for programs go
7280 set html1dir html1dir none
7281 eval $prefixit
7282 $cat <<EOM
7283
7284 If you wish to install html files for programs in $spackage, indicate
7285 the appropriate directory here.  To skip installing html files,
7286 answer "none".
7287 EOM
7288 case "$html1dir" in
7289 ''|none|$undef|' ') dflt=none ;;
7290 *) dflt=$html1dir ;;
7291 esac
7292 fn=dn+~
7293 rp="Directory for the main $spackage html pages?"
7294 . ./getfile
7295 prefixvar=html1dir
7296 . ./setprefixvar
7297 : Use ' ' for none so value is preserved next time through Configure
7298 $test X"$html1dir" = "X" && html1dir=' '
7299
7300 : determine where html pages for libraries and modules go
7301 set html3dir html3dir none
7302 eval $prefixit
7303 $cat <<EOM
7304
7305 If you wish to install html files for modules associated with $spackage,
7306 indicate the appropriate directory here.  To skip installing html files,
7307 answer "none".
7308 EOM
7309 : There is no obvious default.  If they have specified html1dir, then
7310 : try to key off that, possibly changing .../html1 into .../html3.
7311 case "$html3dir" in
7312 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7313 *) dflt=$html3dir ;;
7314 esac
7315 fn=dn+~
7316 rp="Directory for the $spackage module html pages?"
7317 . ./getfile
7318 prefixvar=html3dir
7319 . ./setprefixvar
7320 : Use ' ' for none so value is preserved next time through Configure
7321 $test X"$html3dir" = "X" && html3dir=' '
7322
7323 : determine whether to install perl also as /usr/bin/perl
7324
7325 echo " "
7326 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7327         $cat <<EOM
7328 Many scripts expect perl to be installed as /usr/bin/perl.
7329
7330 If you want to, I can install the perl you are about to compile
7331 as /usr/bin/perl (in addition to $bin/perl).
7332 EOM
7333         if test -f /usr/bin/perl; then
7334             $cat <<EOM
7335
7336 However, please note that because you already have a /usr/bin/perl,
7337 overwriting that with a new Perl would very probably cause problems.
7338 Therefore I'm assuming you don't want to do that (unless you insist).
7339
7340 EOM
7341             case "$installusrbinperl" in
7342             "$define"|[yY]*)    dflt='y';;
7343             *)                  dflt='n';;
7344             esac
7345         else
7346             $cat <<EOM
7347
7348 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7349
7350 EOM
7351             case "$installusrbinperl" in
7352             "$undef"|[nN]*)     dflt='n';;
7353             *)                  dflt='y';;
7354             esac
7355         fi
7356         rp="Do you want to install perl as /usr/bin/perl?"
7357         . ./myread
7358         case "$ans" in
7359         [yY]*)  val="$define";;
7360         *)      val="$undef" ;;
7361         esac
7362 else
7363         val="$undef"
7364 fi
7365 set installusrbinperl
7366 eval $setvar
7367
7368 : Check if we are using the GNU C library
7369 echo " "
7370 echo "Checking for GNU C Library..." >&4
7371 cat >try.c <<'EOCP'
7372 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7373    alone are insufficient to distinguish different versions, such as
7374    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7375    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7376 */
7377 #include <stdio.h>
7378 int main(void)
7379 {
7380 #ifdef __GLIBC__
7381 #   ifdef __GLIBC_MINOR__
7382 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7383 #           include <gnu/libc-version.h>
7384             printf("%s\n",  gnu_get_libc_version());
7385 #       else
7386             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7387 #       endif
7388 #   else
7389         printf("%d\n",  __GLIBC__);
7390 #   endif
7391     return 0;
7392 #else
7393     return 1;
7394 #endif
7395 }
7396 EOCP
7397 set try
7398 if eval $compile_ok && $run ./try > glibc.ver; then
7399         val="$define"
7400         gnulibc_version=`$cat glibc.ver`
7401         echo "You are using the GNU C Library version $gnulibc_version"
7402 else
7403         val="$undef"
7404         gnulibc_version=''
7405         echo "You are not using the GNU C Library"
7406 fi
7407 $rm_try glibc.ver
7408 set d_gnulibc
7409 eval $setvar
7410
7411 : see if nm is to be used to determine whether a symbol is defined or not
7412 case "$usenm" in
7413 '')
7414         dflt=''
7415         case "$d_gnulibc" in
7416         "$define")
7417                 echo " "
7418                 echo "nm probably won't work on the GNU C Library." >&4
7419                 dflt=n
7420                 ;;
7421         esac
7422         case "$dflt" in
7423         '') 
7424                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7425                         echo " "
7426                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7427                         echo "'nm' won't be sufficient on this sytem." >&4
7428                         dflt=n
7429                 fi
7430                 ;;
7431         esac
7432         case "$dflt" in
7433         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7434                 if $test $dflt -gt 20; then
7435                         dflt=y
7436                 else
7437                         dflt=n
7438                 fi
7439                 ;;
7440         esac
7441         ;;
7442 *)
7443         case "$usenm" in
7444         true|$define) dflt=y;;
7445         *) dflt=n;;
7446         esac
7447         ;;
7448 esac
7449 $cat <<EOM
7450
7451 I can use $nm to extract the symbols from your C libraries. This
7452 is a time consuming task which may generate huge output on the disk (up
7453 to 3 megabytes) but that should make the symbols extraction faster. The
7454 alternative is to skip the 'nm' extraction part and to compile a small
7455 test program instead to determine whether each symbol is present. If
7456 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7457 this may be the best solution.
7458
7459 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7460
7461 EOM
7462 rp="Shall I use $nm to extract C symbols from the libraries?"
7463 . ./myread
7464 case "$ans" in
7465 [Nn]*) usenm=false;;
7466 *) usenm=true;;
7467 esac
7468
7469 runnm=$usenm
7470 case "$reuseval" in
7471 true) runnm=false;;
7472 esac
7473
7474 : nm options which may be necessary
7475 case "$nm_opt" in
7476 '') if $test -f /mach_boot; then
7477                 nm_opt=''       # Mach
7478         elif $test -d /usr/ccs/lib; then
7479                 nm_opt='-p'     # Solaris (and SunOS?)
7480         elif $test -f /dgux; then
7481                 nm_opt='-p'     # DG-UX
7482         elif $test -f /lib64/rld; then
7483                 nm_opt='-p'     # 64-bit Irix
7484         else
7485                 nm_opt=''
7486         fi;;
7487 esac
7488
7489 : nm options which may be necessary for shared libraries but illegal
7490 : for archive libraries.  Thank you, Linux.
7491 case "$nm_so_opt" in
7492 '')     case "$myuname" in
7493         *linux*|gnu*)
7494                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7495                         nm_so_opt='--dynamic'
7496                 fi
7497                 ;;
7498         esac
7499         ;;
7500 esac
7501
7502 : Figure out where the libc is located
7503 case "$runnm" in
7504 true)
7505 : get list of predefined functions in a handy place
7506 echo " "
7507 case "$libc" in
7508 '') libc=unknown
7509         case "$libs" in
7510         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7511         esac
7512         ;;
7513 esac
7514 case "$libs" in
7515 '') ;;
7516 *)  for thislib in $libs; do
7517         case "$thislib" in
7518         -lc|-lc_s)
7519                 : Handle C library specially below.
7520                 ;;
7521         -l*)
7522                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7523                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7524                         :
7525                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7526                         :
7527                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7528                         :
7529                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7530                         :
7531                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7532                         :
7533                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7534                         :
7535                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7536                         :
7537                 else
7538                         try=''
7539                 fi
7540                 libnames="$libnames $try"
7541                 ;;
7542         *) libnames="$libnames $thislib" ;;
7543         esac
7544         done
7545         ;;
7546 esac
7547 xxx=normal
7548 case "$libc" in
7549 unknown)
7550         set /lib/libc.$so
7551         for xxx in $libpth; do
7552                 $test -r $1 || set $xxx/libc.$so
7553                 : The messy sed command sorts on library version numbers.
7554                 $test -r $1 || \
7555                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7556                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7557                                 h
7558                                 s/[0-9][0-9]*/0000&/g
7559                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7560                                 G
7561                                 s/\n/ /' | \
7562                          $sort | $sed -e 's/^.* //'`
7563                 eval set \$$#
7564         done
7565         $test -r $1 || set /usr/ccs/lib/libc.$so
7566         $test -r $1 || set /lib/libsys_s$_a
7567         ;;
7568 *)
7569         set blurfl
7570         ;;
7571 esac
7572 if $test -r "$1"; then
7573         echo "Your (shared) C library seems to be in $1."
7574         libc="$1"
7575 elif $test -r /lib/libc && $test -r /lib/clib; then
7576         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7577         xxx=apollo
7578         libc='/lib/clib /lib/libc'
7579         if $test -r /lib/syslib; then
7580                 echo "(Your math library is in /lib/syslib.)"
7581                 libc="$libc /lib/syslib"
7582         fi
7583 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7584         echo "Your C library seems to be in $libc, as you said before."
7585 elif $test -r $incpath/usr/lib/libc$_a; then
7586         libc=$incpath/usr/lib/libc$_a;
7587         echo "Your C library seems to be in $libc.  That's fine."
7588 elif $test -r /lib/libc$_a; then
7589         libc=/lib/libc$_a;
7590         echo "Your C library seems to be in $libc.  You're normal."
7591 else
7592         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7593                 :
7594         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7595                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7596         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7597                 :
7598         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7599                 :
7600         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7601                 :
7602         else
7603                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7604         fi
7605         if $test -r "$tans"; then
7606                 echo "Your C library seems to be in $tans, of all places."
7607                 libc=$tans
7608         else
7609                 libc='blurfl'
7610         fi
7611 fi
7612 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7613         dflt="$libc"
7614         cat <<EOM
7615
7616 If the guess above is wrong (which it might be if you're using a strange
7617 compiler, or your machine supports multiple models), you can override it here.
7618
7619 EOM
7620 else
7621         dflt=''
7622         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7623         cat >&4 <<EOM
7624 I can't seem to find your C library.  I've looked in the following places:
7625
7626 EOM
7627         $sed 's/^/      /' libpath
7628         cat <<EOM
7629
7630 None of these seems to contain your C library. I need to get its name...
7631
7632 EOM
7633 fi
7634 fn=f
7635 rp='Where is your C library?'
7636 . ./getfile
7637 libc="$ans"
7638
7639 echo " "
7640 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7641 set X `cat libnames`
7642 shift
7643 xxx=files
7644 case $# in 1) xxx=file; esac
7645 echo "Extracting names from the following $xxx for later perusal:" >&4
7646 echo " "
7647 $sed 's/^/      /' libnames >&4
7648 echo " "
7649 $echo $n "This may take a while...$c" >&4
7650
7651 for file in $*; do
7652         case $file in
7653         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7654         *) $nm $nm_opt $file 2>/dev/null;;
7655         esac
7656 done >libc.tmp
7657
7658 $echo $n ".$c"
7659 $grep fprintf libc.tmp > libc.ptf
7660 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7661 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7662 xxx='[ADTSIW]'
7663 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7664         eval $xscan;\
7665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666                 eval $xrun
7667 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7668         eval $xscan;\
7669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7670                 eval $xrun
7671 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7672         eval $xscan;\
7673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7674                 eval $xrun
7675 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7676         eval $xscan;\
7677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678                 eval $xrun
7679 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7680         eval $xscan;\
7681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682                 eval $xrun
7683 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7684         eval $xscan;\
7685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686                 eval $xrun
7687 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7688                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7689         eval $xscan;\
7690         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7691                 eval $xrun
7692 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7693         eval $xscan;\
7694         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7695                 eval $xrun
7696 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7697         eval $xscan;\
7698         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7699                 eval $xrun
7700 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7701         eval $xscan;\
7702         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7703                 eval $xrun
7704 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7705         eval $xscan;\
7706         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7707                 eval $xrun
7708 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7709         eval $xscan;\
7710         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7711                 eval $xrun
7712 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7713         eval $xscan;\
7714         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7715                 eval $xrun
7716 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7717         eval $xscan;\
7718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7719                 eval $xrun
7720 else
7721         $nm -p $* 2>/dev/null >libc.tmp
7722         $grep fprintf libc.tmp > libc.ptf
7723         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7724                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7725         then
7726                 nm_opt='-p'
7727                 eval $xrun
7728         else
7729                 echo " "
7730                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7731                 com=''
7732                 if $ar t $libc > libc.tmp && \
7733                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7734                 then
7735                         for thisname in $libnames $libc; do
7736                                 $ar t $thisname >>libc.tmp
7737                         done
7738                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7739                         echo "Ok." >&4
7740                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7741                         for thisname in $libnames $libc; do
7742                                 $ar tv $thisname >>libc.tmp
7743                                 emximp -o tmp.imp $thisname \
7744                                     2>/dev/null && \
7745                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7746                                     < tmp.imp >>libc.tmp
7747                                 $rm -f tmp.imp
7748                         done
7749                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7750                         echo "Ok." >&4
7751                 else
7752                         echo "$ar didn't seem to work right." >&4
7753                         echo "Maybe this is a Cray...trying bld instead..." >&4
7754                         if  bld t $libc | \
7755                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7756                                 $test -s libc.list
7757                         then
7758                                 for thisname in $libnames; do
7759                                         bld t $libnames | \
7760                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7761                                         $ar t $thisname >>libc.tmp
7762                                 done
7763                                 echo "Ok." >&4
7764                         else
7765                                 echo "That didn't work either.  Giving up." >&4
7766                                 exit 1
7767                         fi
7768                 fi
7769         fi
7770 fi
7771 nm_extract="$com"
7772 case "$PASE" in
7773 define)
7774     echo " "
7775     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7776     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7777     ;;
7778 *)  if $test -f /lib/syscalls.exp; then
7779         echo " "
7780         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7781         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7782                 /lib/syscalls.exp >>libc.list
7783     fi
7784     ;;
7785 esac
7786 ;;
7787 esac
7788 $rm -f libnames libpath
7789
7790 : see if dld is available
7791 set dld.h i_dld
7792 eval $inhdr
7793
7794 : Check if we are using C++
7795 echo " "
7796 echo "Checking for C++..." >&4
7797 $cat >try.c <<'EOCP'
7798 #include <stdio.h>
7799 int main(void)
7800 {
7801 #ifdef __cplusplus
7802     return 0;
7803 #else
7804     return 1;
7805 #endif
7806 }
7807 EOCP
7808 set try
7809 if eval $compile_ok && $run ./try; then
7810         val="$define"
7811         echo "You are using a C++ compiler."
7812 else
7813         val="$undef"
7814         echo "You are not using a C++ compiler."
7815 fi
7816 $rm_try cplusplus$$
7817 set d_cplusplus
7818 eval $setvar
7819
7820 : is a C symbol defined?
7821 csym='tlook=$1;
7822 case "$3" in
7823 -v) tf=libc.tmp; tdc="";;
7824 -a) tf=libc.tmp; tdc="[]";;
7825 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7826 esac;
7827 case "$d_cplusplus" in
7828     $define)    extern_C="extern \"C\"" ;;
7829     *)          extern_C="extern"       ;;
7830 esac;
7831 tx=yes;
7832 case "$reuseval-$4" in
7833 true-) ;;
7834 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7835 esac;
7836 case "$tx" in
7837 yes)
7838         tval=false;
7839         if $test "$runnm" = true; then
7840                 if $contains $tlook $tf >/dev/null 2>&1; then
7841                         tval=true;
7842                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7843                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7844                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7845                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7846                         $rm_try;
7847                 fi;
7848         else
7849                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7850                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7851                 $rm_try;
7852         fi;
7853         ;;
7854 *)
7855         case "$tval" in
7856         $define) tval=true;;
7857         *) tval=false;;
7858         esac;
7859         ;;
7860 esac;
7861 eval "$2=$tval"'
7862
7863 : define an is-in-libc? function
7864 inlibc='echo " "; td=$define; tu=$undef;
7865 sym=$1; var=$2; eval "was=\$$2";
7866 tx=yes;
7867 case "$reuseval$was" in
7868 true) ;;
7869 true*) tx=no;;
7870 esac;
7871 case "$tx" in
7872 yes)
7873         set $sym tres -f;
7874         eval $csym;
7875         case "$tres" in
7876         true)
7877                 echo "$sym() found." >&4;
7878                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7879         *)
7880                 echo "$sym() NOT found." >&4;
7881                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7882         esac;;
7883 *)
7884         case "$was" in
7885         $define) echo "$sym() found." >&4;;
7886         *) echo "$sym() NOT found." >&4;;
7887         esac;;
7888 esac'
7889
7890 : see if dlopen exists
7891 xxx_runnm="$runnm"
7892 xxx_ccflags="$ccflags"
7893 runnm=false
7894 : with g++ one needs -shared to get is-in-libc to work for dlopen
7895 case "$gccversion" in
7896 '')     ;;
7897 *)      case "$d_cplusplus" in
7898         "$define") ccflags="$ccflags -shared" ;;
7899         esac
7900         ;;
7901 esac
7902 set dlopen d_dlopen
7903 eval $inlibc
7904 runnm="$xxx_runnm"
7905 ccflags="$xxx_ccflags"
7906
7907 : see if this is a unistd.h system
7908 set unistd.h i_unistd
7909 eval $inhdr
7910
7911 : determine which dynamic loading, if any, to compile in
7912 echo " "
7913 dldir="ext/DynaLoader"
7914 case "$usedl" in
7915 $define|y|true)
7916         dflt='y'
7917         usedl="$define"
7918         ;;
7919 $undef|n|false)
7920         dflt='n'
7921         usedl="$undef"
7922         ;;
7923 *)
7924         dflt='n'
7925         case "$d_dlopen" in
7926             $define) dflt='y' ;;
7927         esac
7928         case "$i_dld" in
7929             $define) dflt='y' ;;
7930         esac
7931         : Does a dl_xxx.xs file exist for this operating system
7932         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7933         ;;
7934 esac
7935 rp="Do you wish to use dynamic loading?"
7936 . ./myread
7937 usedl="$ans"
7938 bin_ELF="$undef"
7939 case "$ans" in
7940 y*) usedl="$define"
7941         case "$dlsrc" in
7942         '')
7943                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7944                         dflt="$dldir/dl_${osname}.xs"
7945                 elif $test "$d_dlopen" = "$define" ; then
7946                         dflt="$dldir/dl_dlopen.xs"
7947                 elif $test "$i_dld" = "$define" ; then
7948                         dflt="$dldir/dl_dld.xs"
7949                 else
7950                         dflt=''
7951                 fi
7952                 ;;
7953         *)      dflt="$dldir/$dlsrc"
7954                 ;;
7955         esac
7956     echo "The following dynamic loading files are available:"
7957         : Can not go over to $dldir because getfile has path hard-coded in.
7958         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7959         rp="Source file to use for dynamic loading"
7960         fn="fne"
7961         gfpth="$src"
7962         . ./getfile
7963         usedl="$define"
7964         : emulate basename
7965         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7966
7967         $cat << EOM
7968
7969 Some systems may require passing special flags to $cc -c to
7970 compile modules that will be used to create a shared library.
7971 To use no flags, say "none".
7972
7973 EOM
7974     case "$cccdlflags" in
7975     '') case "$gccversion" in
7976                 '') case "$osname" in
7977                         hpux)   dflt='+z' ;;
7978                         next)   dflt='none' ;;
7979                         irix*)  dflt='-KPIC' ;;
7980                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7981                         sunos)  dflt='-pic' ;;
7982                         *)      dflt='none' ;;
7983                     esac
7984                         ;;
7985                 *)  case "$osname" in
7986                         darwin) dflt='none' ;;
7987                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7988                         *)      dflt='-fpic' ;;
7989                     esac ;;
7990             esac ;;
7991         ' ') dflt='none' ;;
7992     *)  dflt="$cccdlflags" ;;
7993     esac
7994     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7995     . ./myread
7996     case "$ans" in
7997     none) cccdlflags=' ' ;;
7998     *) cccdlflags="$ans" ;;
7999     esac
8000
8001     cat << EOM
8002
8003 Some systems use ld to create libraries that can be dynamically loaded,
8004 while other systems (such as those using ELF) use $cc.
8005
8006 EOM
8007         case "$ld" in
8008         '')     $cat >try.c <<EOM
8009 /* Test for whether ELF binaries are produced */
8010 #include <fcntl.h>
8011 #$i_stdlib I_STDLIB
8012 #ifdef I_STDLIB
8013 #include <stdlib.h>
8014 #endif
8015 #$i_unistd I_UNISTD
8016 #ifdef I_UNISTD
8017 #include <unistd.h>
8018 #endif
8019 int main() {
8020         char b[4];
8021         int i = open("a.out",O_RDONLY);
8022         if(i == -1)
8023                 exit(1); /* fail */
8024         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8025                 exit(0); /* succeed (yes, it's ELF) */
8026         else
8027                 exit(1); /* fail */
8028 }
8029 EOM
8030                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8031                         cat <<EOM
8032 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8033 EOM
8034                         dflt="$cc"
8035                         bin_ELF="$define"
8036                 else
8037                         echo "I'll use ld to build dynamic libraries."
8038                         dflt='ld'
8039                 fi
8040                 $rm_try
8041                 ;;
8042         *)      dflt="$ld"
8043                 ;;
8044         esac
8045
8046     rp="What command should be used to create dynamic libraries?"
8047     . ./myread
8048         ld="$ans"
8049
8050     cat << EOM
8051
8052 Some systems may require passing special flags to $ld to create a
8053 library that can be dynamically loaded.  If your ld flags include
8054 -L/other/path options to locate libraries outside your loader's normal
8055 search path, you may need to specify those -L options here as well.  To
8056 use no flags, say "none".
8057
8058 EOM
8059     case "$lddlflags" in
8060     '') case "$osname" in
8061                         beos) dflt='-nostart' ;;
8062                         haiku) dflt='-shared' ;;
8063                         hpux) dflt='-b';
8064                               case "$gccversion" in
8065                               '') dflt="$dflt +vnocompatwarnings" ;;
8066                               esac
8067                               ;;
8068                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8069                         next)  dflt='none' ;;
8070                         solaris) dflt='-G' ;;
8071                         sunos) dflt='-assert nodefinitions' ;;
8072                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8073                 *)     dflt='none' ;;
8074                         esac
8075                         ;;
8076     *) dflt="$lddlflags" ;;
8077     esac
8078
8079         : Try to guess additional flags to pick up local libraries.
8080         : Be careful not to append to a plain 'none'
8081         case "$dflt" in
8082         none) dflt='' ;;
8083         esac
8084         for thisflag in $ldflags; do
8085                 case "$thisflag" in
8086                 -L*|-R*|-Wl,-R*)
8087                         case " $dflt " in
8088                         *" $thisflag "*) ;;
8089                         *) dflt="$dflt $thisflag" ;;
8090                         esac
8091                         ;;
8092                 esac
8093         done
8094
8095         case "$dflt" in
8096         ''|' ') dflt='none' ;;
8097         esac
8098
8099         case "$ldflags" in
8100         *-fstack-protector*)
8101             case "$dflt" in
8102                         *-fstack-protector*) ;; # Don't add it again
8103                         *) dflt="$dflt -fstack-protector" ;; 
8104                 esac
8105                 ;;
8106         esac
8107
8108
8109     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8110     . ./myread
8111     case "$ans" in
8112     none) lddlflags=' ' ;;
8113     *) lddlflags="$ans" ;;
8114     esac
8115
8116         cat <<EOM
8117
8118 Some systems may require passing special flags to $cc to indicate that
8119 the resulting executable will use dynamic linking.  To use no flags,
8120 say "none".
8121
8122 EOM
8123     case "$ccdlflags" in
8124     '') case "$osname" in
8125             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8126             next|sunos) dflt='none' ;;
8127             *)          dflt='none' ;;
8128             esac ;;
8129     ' ')  dflt='none' ;;
8130     *)  dflt="$ccdlflags" ;;
8131     esac
8132     rp="Any special flags to pass to $cc to use dynamic linking?"
8133     . ./myread
8134     case "$ans" in
8135     none) ccdlflags=' ' ;;
8136     *) ccdlflags="$ans" ;;
8137     esac
8138     ;;
8139 *)  usedl="$undef"
8140         ld='ld'
8141     dlsrc='dl_none.xs'
8142     lddlflags=''
8143     ccdlflags=''
8144     ;;
8145 esac
8146
8147 : Do we want a shared libperl?
8148 also=''
8149 case "$usedl" in
8150 $undef)
8151         # No dynamic loading being used, so don't bother even to prompt.
8152         useshrplib='false'
8153         ;;
8154 *)      case "$useshrplib" in
8155         '')     case "$osname" in
8156                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8157                         dflt=y
8158                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8159                         ;;
8160                 next*)
8161                         case "$osvers" in
8162                         4*)     dflt=y
8163                                 also='Building a shared libperl is needed for MAB support.'
8164                                 ;;
8165                         *)      dflt=n
8166                                 ;;
8167                         esac
8168                         ;;
8169                 *)      dflt=n
8170                         ;;
8171                 esac
8172                 ;;
8173         $define|true|[Yy]*)
8174                 dflt=y
8175                 ;;
8176         *)      dflt=n
8177                 ;;
8178         esac
8179         $cat << EOM
8180
8181 The perl executable is normally obtained by linking perlmain.c with
8182 libperl${_a}, any static extensions (usually just DynaLoader), and
8183 any other libraries needed on this system (such as -lm, etc.).  Since
8184 your system supports dynamic loading, it is probably possible to build
8185 a shared libperl.$so.  If you will have more than one executable linked
8186 to libperl.$so, this will significantly reduce the size of each
8187 executable, but it may have a noticeable effect on performance.  The
8188 default is probably sensible for your system.
8189 $also
8190
8191 EOM
8192         rp="Build a shared libperl.$so (y/n)"
8193         . ./myread
8194         case "$ans" in
8195         true|$define|[Yy]*)
8196                 useshrplib='true'  ;;
8197         *)      useshrplib='false' ;;
8198         esac
8199         ;;
8200 esac
8201
8202 case "$useshrplib" in
8203 true)
8204         case "$userelocatableinc" in
8205         true|define)
8206                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8207                 echo "See INSTALL for an explanation why that won't work." >&4
8208                 exit 4
8209                 ;;
8210         esac
8211         case "$libperl" in
8212         '')
8213                 # Figure out a good name for libperl.so.  Since it gets stored in
8214                 # a version-specific architecture-dependent library, the version
8215                 # number isn't really that important, except for making cc/ld happy.
8216                 #
8217                 # A name such as libperl.so.10.1
8218                 majmin="libperl.$so.$patchlevel.$subversion"
8219                 # A name such as libperl.so.100
8220                 majonly=`echo $patchlevel $subversion |
8221                         $awk '{printf "%d%02d", $1, $2}'`
8222                 majonly=libperl.$so.$majonly
8223                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8224                 # rely on figuring it out from the naming of libc.
8225                 case "${osname}${osvers}" in
8226                 next4*)
8227                         dflt=libperl.5.$so
8228                         # XXX How handle the --version stuff for MAB?
8229                         ;;
8230                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8231                         dflt=libperl.$so
8232                         ;;
8233                 cygwin*) # ld links now against the dll directly
8234                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8235                         majonly=`echo $patchlevel $subversion |
8236                                 $awk '{printf "%03d%03d", $1, $2}'`
8237                         majonly=cygperl5.$majonly.$so
8238                         dflt=$majmin
8239                         ;;
8240                 *)      # Try to guess based on whether libc has major.minor.
8241                         case "$libc" in
8242                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8243                         *libc.$so.[0-9]*) dflt=$majonly ;;
8244                         *)      dflt=libperl.$so ;;
8245                         esac
8246                         ;;
8247                 esac
8248                 ;;
8249         *)      dflt=$libperl
8250                 ;;
8251         esac
8252         cat << EOM
8253
8254 I need to select a good name for the shared libperl.  If your system uses
8255 library names with major and minor numbers, then you might want something
8256 like $majmin.  Alternatively, if your system uses a single version
8257 number for shared libraries, then you might want to use $majonly.
8258 Or, your system might be quite happy with a simple libperl.$so.
8259
8260 Since the shared libperl will get installed into a version-specific
8261 architecture-dependent directory, the version number of the shared perl
8262 library probably isn't important, so the default should be o.k.
8263
8264 EOM
8265         rp='What name do you want to give to the shared libperl?'
8266         . ./myread
8267         libperl=$ans
8268         echo "Ok, I'll use $libperl"
8269         ;;
8270 *)
8271         libperl="libperl${_a}"
8272         ;;
8273 esac
8274
8275 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8276 case "$shrpdir" in
8277 '') ;;
8278 *)      $cat >&4 <<EOM
8279 WARNING:  Use of the shrpdir variable for the installation location of
8280 the shared $libperl is not supported.  It was never documented and
8281 will not work in this version.  Let me (perlbug@perl.org)
8282 know of any problems this may cause.
8283
8284 EOM
8285         case "$shrpdir" in
8286         "$archlibexp/CORE")
8287                 $cat >&4 <<EOM
8288 But your current setting of $shrpdir is
8289 the default anyway, so it's harmless.
8290 EOM
8291                 ;;
8292         *)
8293                 $cat >&4 <<EOM
8294 Further, your current attempted setting of $shrpdir
8295 conflicts with the value of $archlibexp/CORE
8296 that installperl will use.
8297 EOM
8298                 ;;
8299         esac
8300         ;;
8301 esac
8302
8303 # How will the perl executable find the installed shared $libperl?
8304 # Add $xxx to ccdlflags.
8305 # If we can't figure out a command-line option, use $shrpenv to
8306 # set env LD_RUN_PATH.  The main perl makefile uses this.
8307 shrpdir=$archlibexp/CORE
8308 xxx=''
8309 tmp_shrpenv=''
8310 if "$useshrplib"; then
8311     case "$osname" in
8312         aix)
8313                 # We'll set it in Makefile.SH...
8314                 ;;
8315         solaris)
8316                 xxx="-R $shrpdir"
8317                 ;;
8318         freebsd|netbsd|openbsd|interix|dragonfly)
8319                 xxx="-Wl,-R$shrpdir"
8320                 ;;
8321         bsdos|linux|irix*|dec_osf|gnu*)
8322                 xxx="-Wl,-rpath,$shrpdir"
8323                 ;;
8324         next)
8325                 # next doesn't like the default...
8326                 ;;
8327         beos)
8328                 # beos doesn't like the default, either.
8329                 ;;
8330         haiku)
8331                 # Haiku doesn't like the default, either.
8332                 ;;
8333         hpux*)
8334                 # hpux doesn't like the default, either.
8335                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8336                 ;;
8337         cygwin)
8338                 # cygwin needs only ldlibpth
8339                 ;;
8340         *)
8341                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8342                 ;;
8343         esac
8344         case "$xxx" in
8345         '') ;;
8346         *)
8347                 # Only add $xxx if it isn't already in ccdlflags.
8348                 case " $ccdlflags " in
8349                 *" $xxx "*)     ;;
8350                 *)      ccdlflags="$ccdlflags $xxx"
8351                         cat <<EOM >&4
8352
8353 Adding $xxx to the flags
8354 passed to $ld so that the perl executable will find the
8355 installed shared $libperl.
8356
8357 EOM
8358                         ;;
8359                 esac
8360                 ;;
8361         esac
8362 fi
8363 # Fix ccdlflags in AIX for building external extensions.
8364 # (For building Perl itself bare -bE:perl.exp is needed,
8365 #  Makefile.SH takes care of this.)
8366 case "$osname" in
8367 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8368 esac
8369 # Respect a hint or command-line value.
8370 case "$shrpenv" in
8371 '') shrpenv="$tmp_shrpenv" ;;
8372 esac
8373 case "$ldlibpthname" in
8374 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8375 none)   ldlibpthname='' ;;
8376 esac
8377
8378 : determine where manual pages are on this system
8379 echo " "
8380 case "$sysman" in
8381 '') 
8382         syspath='/usr/share/man/man1 /usr/man/man1'
8383         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8384         syspath="$syspath /usr/man/u_man/man1"
8385         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8386         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8387         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8388         sysman=`./loc . /usr/man/man1 $syspath`
8389         ;;
8390 esac
8391 if $test -d "$sysman"; then
8392         echo "System manual is in $sysman." >&4
8393 else
8394         echo "Could not find manual pages in source form." >&4
8395 fi
8396
8397 : determine where manual pages go
8398 set man1dir man1dir none
8399 eval $prefixit
8400 $cat <<EOM
8401
8402 $spackage has manual pages available in source form.
8403 EOM
8404 case "$nroff" in
8405 nroff)
8406         echo "However, you don't have nroff, so they're probably useless to you."
8407         case "$man1dir" in
8408         '') man1dir="none";;
8409         esac;;
8410 esac
8411 echo "If you don't want the manual sources installed, answer 'none'."
8412 case "$man1dir" in
8413 ' ') dflt=none
8414         ;;
8415 '')
8416         lookpath="$prefixexp/share/man/man1"
8417         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8418         lookpath="$lookpath $prefixexp/man/p_man/man1"
8419         lookpath="$lookpath $prefixexp/man/u_man/man1"
8420         lookpath="$lookpath $prefixexp/man/man.1"
8421         case "$sysman" in
8422         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8423         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8424         esac
8425         set dflt
8426         eval $prefixup
8427         ;;
8428 *)  dflt="$man1dir"
8429         ;;
8430 esac
8431 echo " "
8432 fn=dn+~
8433 rp="Where do the main $spackage manual pages (source) go?"
8434 . ./getfile
8435 if $test "X$man1direxp" != "X$ansexp"; then
8436         installman1dir=''
8437 fi
8438 prefixvar=man1dir
8439 . ./setprefixvar
8440
8441 case "$man1dir" in
8442 '')     man1dir=' '
8443         installman1dir='';;
8444 esac
8445
8446 : What suffix to use on installed man pages
8447
8448 case "$man1dir" in
8449 ' ')
8450         man1ext='0'
8451         ;;
8452 *)
8453         rp="What suffix should be used for the main $spackage man pages?"
8454         case "$man1ext" in
8455         '')     case "$man1dir" in
8456                 *1)  dflt=1 ;;
8457                 *1p) dflt=1p ;;
8458                 *1pm) dflt=1pm ;;
8459                 *l) dflt=l;;
8460                 *n) dflt=n;;
8461                 *o) dflt=o;;
8462                 *p) dflt=p;;
8463                 *C) dflt=C;;
8464                 *L) dflt=L;;
8465                 *L1) dflt=L1;;
8466                 *) dflt=1;;
8467                 esac
8468                 ;;
8469         *)      dflt="$man1ext";;
8470         esac
8471         . ./myread
8472         man1ext="$ans"
8473         ;;
8474 esac
8475
8476 : see if we can have long filenames
8477 echo " "
8478 first=123456789abcdef
8479 $rm -f $first
8480 if (echo hi >$first) 2>/dev/null; then
8481         if $test -f 123456789abcde; then
8482                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8483                 val="$undef"
8484         else
8485                 echo 'You can have filenames longer than 14 characters.'>&4
8486                 val="$define"
8487         fi
8488 else
8489         $cat <<'EOM'
8490 You can't have filenames longer than 14 chars.
8491 You can't even think about them!
8492 EOM
8493         val="$undef"
8494 fi
8495 set d_flexfnam
8496 eval $setvar
8497 $rm -rf 123456789abcde*
8498
8499 : determine where library module manual pages go
8500 set man3dir man3dir none
8501 eval $prefixit
8502 $cat <<EOM
8503
8504 $spackage has manual pages for many of the library modules.
8505 EOM
8506
8507 case "$nroff" in
8508 nroff)
8509         $cat <<'EOM'
8510 However, you don't have nroff, so they're probably useless to you.
8511 EOM
8512         case "$man3dir" in
8513         '') man3dir="none";;
8514         esac;;
8515 esac
8516
8517 case "$d_flexfnam" in
8518 undef)
8519         $cat <<'EOM'
8520 However, your system can't handle the long file names like File::Basename.3.
8521 EOM
8522         case "$man3dir" in
8523         '') man3dir="none";;
8524         esac;;
8525 esac
8526
8527 echo "If you don't want the manual sources installed, answer 'none'."
8528 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8529 case "$man3dir" in
8530 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8531         if $test -d "$privlib/man/man3"; then
8532                 cat <<EOM >&4
8533
8534 WARNING:  Previous versions of perl installed man3 pages into
8535 $privlib/man/man3.  This version will suggest a
8536 new default of $dflt.
8537 EOM
8538                 tdflt=$dflt
8539                 dflt='n'
8540                 rp='Do you wish to preserve the old behavior?(y/n)'
8541                 . ./myread
8542                 case "$ans" in
8543                 y*) dflt="$privlib/man/man3" ;;
8544                 *)  dflt=$tdflt ;;
8545                 esac
8546     fi
8547         ;;
8548 *)      dflt="$man3dir" ;;
8549 esac
8550 case "$dflt" in
8551 ' ') dflt=none ;;
8552 esac
8553 echo " "
8554 fn=dn+~
8555 rp="Where do the $package library man pages (source) go?"
8556 . ./getfile
8557 prefixvar=man3dir
8558 . ./setprefixvar
8559
8560 case "$man3dir" in
8561 '')     man3dir=' '
8562         installman3dir='';;
8563 esac
8564
8565 : What suffix to use on installed man pages
8566 case "$man3dir" in
8567 ' ')
8568         man3ext='0'
8569         ;;
8570 *)
8571         rp="What suffix should be used for the $package library man pages?"
8572         case "$man3ext" in
8573         '')     case "$man3dir" in
8574                 *3)  dflt=3 ;;
8575                 *3p) dflt=3p ;;
8576                 *3pm) dflt=3pm ;;
8577                 *l) dflt=l;;
8578                 *n) dflt=n;;
8579                 *o) dflt=o;;
8580                 *p) dflt=p;;
8581                 *C) dflt=C;;
8582                 *L) dflt=L;;
8583                 *L3) dflt=L3;;
8584                 *) dflt=3;;
8585                 esac
8586                 ;;
8587         *)      dflt="$man3ext";;
8588         esac
8589         . ./myread
8590         man3ext="$ans"
8591         ;;
8592 esac
8593
8594 : see if we have to deal with yellow pages, now NIS.
8595 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8596         if $test -f /usr/etc/nibindd; then
8597                 echo " "
8598                 echo "I'm fairly confident you're on a NeXT."
8599                 echo " "
8600                 rp='Do you get the hosts file via NetInfo?'
8601                 dflt=y
8602                 case "$hostcat" in
8603                 nidump*) ;;
8604                 '') ;;
8605                 *) dflt=n;;
8606                 esac
8607                 . ./myread
8608                 case "$ans" in
8609                 y*) hostcat='nidump hosts .';;
8610                 *)      case "$hostcat" in
8611                         nidump*) hostcat='';;
8612                         esac
8613                         ;;
8614                 esac
8615         fi
8616         case "$hostcat" in
8617         nidump*) ;;
8618         *)
8619                 case "$hostcat" in
8620                 *ypcat*) dflt=y;;
8621                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8622                                 dflt=y
8623                         else
8624                                 dflt=n
8625                         fi;;
8626                 *) dflt=n;;
8627                 esac
8628                 echo " "
8629                 rp='Are you getting the hosts file via yellow pages?'
8630                 . ./myread
8631                 case "$ans" in
8632                 y*) hostcat='ypcat hosts';;
8633                 *) hostcat='cat /etc/hosts';;
8634                 esac
8635                 ;;
8636         esac
8637 fi
8638 case "$hostcat" in
8639 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8640 esac
8641 case "$groupcat" in
8642 '') test -f /etc/group && groupcat='cat /etc/group';;
8643 esac
8644 case "$passcat" in
8645 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8646 esac
8647
8648 : now get the host name
8649 echo " "
8650 echo "Figuring out host name..." >&4
8651 case "$myhostname" in
8652 '') cont=true
8653         echo 'Maybe "hostname" will work...'
8654         if tans=`sh -c hostname 2>&1` ; then
8655                 myhostname=$tans
8656                 phostname=hostname
8657                 cont=''
8658         fi
8659         ;;
8660 *) cont='';;
8661 esac
8662 if $test "$cont"; then
8663         if ./xenix; then
8664                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8665                 if tans=`cat /etc/systemid 2>&1` ; then
8666                         myhostname=$tans
8667                         phostname='cat /etc/systemid'
8668                         echo "Whadyaknow.  Xenix always was a bit strange..."
8669                         cont=''
8670                 fi
8671         elif $test -r /etc/systemid; then
8672                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8673         fi
8674 fi
8675 if $test "$cont"; then
8676         echo 'No, maybe "uuname -l" will work...'
8677         if tans=`sh -c 'uuname -l' 2>&1` ; then
8678                 myhostname=$tans
8679                 phostname='uuname -l'
8680         else
8681                 echo 'Strange.  Maybe "uname -n" will work...'
8682                 if tans=`sh -c 'uname -n' 2>&1` ; then
8683                         myhostname=$tans
8684                         phostname='uname -n'
8685                 else
8686                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8687                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8688                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8689                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8690                         else
8691                                 case "$myhostname" in
8692                                 '') echo "Does this machine have an identity crisis or something?"
8693                                         phostname='';;
8694                                 *)
8695                                         echo "Well, you said $myhostname before..."
8696                                         phostname='echo $myhostname';;
8697                                 esac
8698                         fi
8699                 fi
8700         fi
8701 fi
8702 case "$myhostname" in
8703 '') myhostname=noname ;;
8704 esac
8705 : you do not want to know about this
8706 set $myhostname
8707 myhostname=$1
8708
8709 : verify guess
8710 if $test "$myhostname" ; then
8711         dflt=y
8712         rp='Your host name appears to be "'$myhostname'".'" Right?"
8713         . ./myread
8714         case "$ans" in
8715         y*) ;;
8716         *) myhostname='';;
8717         esac
8718 fi
8719
8720 : bad guess or no guess
8721 while $test "X$myhostname" = X ; do
8722         dflt=''
8723         rp="Please type the (one word) name of your host:"
8724         . ./myread
8725         myhostname="$ans"
8726 done
8727
8728 : translate upper to lower if necessary
8729 case "$myhostname" in
8730 *[A-Z]*)
8731         echo "(Normalizing case in your host name)"
8732         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8733         ;;
8734 esac
8735
8736 case "$myhostname" in
8737 *.*)
8738         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8739         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8740         echo "(Trimming domain name from host name--host name is now $myhostname)"
8741         ;;
8742 *) case "$mydomain" in
8743         '')
8744                 {
8745                         test "X$hostcat" = "Xypcat hosts" &&
8746                         ypmatch "$myhostname" hosts 2>/dev/null |\
8747                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8748                         $test -s hosts
8749                 } || {
8750                         test "X$hostcat" != "X" &&
8751                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8752                                         /[       ]$myhostname[  . ]/p" > hosts
8753                 }
8754                 tmp_re="[       . ]"
8755                 if $test -f hosts; then
8756                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8757                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8758                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8759                                 hosts | $sort | $uniq | \
8760                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8761                         case `$echo X$dflt` in
8762                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8763                                 dflt=.
8764                                 ;;
8765                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8766                                 ;;
8767                         esac
8768                 else
8769                         echo "(I cannot locate a hosts database anywhere)"
8770                         dflt=.
8771                 fi
8772                 case "$dflt" in
8773                 .)
8774                         tans=`./loc resolv.conf X /etc /usr/etc`
8775                         if $test -f "$tans"; then
8776                                 echo "(Attempting domain name extraction from $tans)"
8777                                 dflt=.`$sed -n -e 's/   / /g' \
8778                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8779                                   -e 1q 2>/dev/null`
8780                                 case "$dflt" in
8781                                 .) dflt=.`$sed -n -e 's/        / /g' \
8782                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8783                                      -e 1q 2>/dev/null`
8784                                         ;;
8785                                 esac
8786                         fi
8787                         ;;
8788                 esac
8789                 case "$dflt" in
8790                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8791                         dflt=.`sh -c domainname 2>/dev/null`
8792                         case "$dflt" in
8793                         '') dflt='.';;
8794                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8795                         esac
8796                         ;;
8797                 esac
8798                 case "$dflt$osname" in
8799                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8800                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8801                         ;;
8802                 esac
8803                 case "$dflt" in
8804                 .) echo "(Lost all hope -- silly guess then)"
8805                         dflt='.nonet'
8806                         ;;
8807                 esac
8808                 $rm -f hosts
8809                 ;;
8810         *) dflt="$mydomain";;
8811         esac;;
8812 esac
8813 echo " "
8814 rp="What is your domain name?"
8815 . ./myread
8816 tans="$ans"
8817 case "$ans" in
8818 '') ;;
8819 .*) ;;
8820 *) tans=".$tans";;
8821 esac
8822 mydomain="$tans"
8823
8824 : translate upper to lower if necessary
8825 case "$mydomain" in
8826 *[A-Z]*)
8827         echo "(Normalizing case in your domain name)"
8828         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8829         ;;
8830 esac
8831
8832 : a little sanity check here
8833 case "$phostname" in
8834 '') ;;
8835 *)
8836         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8837         $myhostname$mydomain|$myhostname) ;;
8838         *)
8839                 case "$phostname" in
8840                 sed*)
8841                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8842                         ;;
8843                 *)
8844                         echo "(That doesn't agree with your $phostname command, by the way.)"
8845                         ;;
8846                 esac
8847         ;;
8848         esac
8849         ;;
8850 esac
8851
8852 : determine the e-mail address of the user who is running us
8853 $cat <<EOM
8854
8855 I need to get your e-mail address in Internet format if possible, i.e.
8856 something like user@host.domain. Please answer accurately since I have
8857 no easy means to double check it. The default value provided below
8858 is most probably close to reality but may not be valid from outside
8859 your organization...
8860
8861 EOM
8862 cont=x
8863 while test "$cont"; do
8864         case "$cf_email" in
8865         '') dflt="$cf_by@$myhostname$mydomain";;
8866         *) dflt="$cf_email";;
8867         esac
8868         rp='What is your e-mail address?'
8869         . ./myread
8870         cf_email="$ans"
8871         case "$cf_email" in
8872         *@*.*) cont='' ;;
8873         *)
8874                 rp='Address does not look like an Internet one.  Use it anyway?'
8875                 case "$fastread" in
8876                 yes) dflt=y ;;
8877                 *) dflt=n ;;
8878                 esac
8879                 . ./myread
8880                 case "$ans" in
8881                 y*) cont='' ;;
8882                 *) echo " " ;;
8883                 esac
8884                 ;;
8885         esac
8886 done
8887
8888 : Ask e-mail of administrator
8889 $cat <<EOM
8890
8891 If you or somebody else will be maintaining perl at your site, please
8892 fill in the correct e-mail address here so that they may be contacted
8893 if necessary. Currently, the "perlbug" program included with perl
8894 will send mail to this address in addition to perlbug@perl.org. You may
8895 enter "none" for no administrator.
8896
8897 EOM
8898 case "$perladmin" in
8899 '') dflt="$cf_email";;
8900 *) dflt="$perladmin";;
8901 esac
8902 rp='Perl administrator e-mail address'
8903 . ./myread
8904 perladmin="$ans"
8905
8906 : determine whether to only install version-specific parts.
8907 echo " "
8908 $cat <<EOM
8909 Do you want to install only the version-specific parts of the perl
8910 distribution?  Usually you do *not* want to do this.
8911 EOM
8912 case "$versiononly" in
8913 "$define"|[Yy]*|true) dflt='y' ;;
8914 *) dflt='n';
8915 esac
8916 rp="Do you want to install only the version-specific parts of perl?"
8917 . ./myread
8918 case "$ans" in
8919 [yY]*)  val="$define";;
8920 *)      val="$undef" ;;
8921 esac
8922 set versiononly
8923 eval $setvar
8924
8925 case "$versiononly" in
8926 "$define") inc_version_list=''
8927            inc_version_list_init=0
8928            ;;
8929 esac
8930
8931 : figure out how to guarantee perl startup
8932 : XXX Note that this currently takes advantage of the bug that binexp ignores
8933 :     the Configure -Dinstallprefix setting, which in turn means that under
8934 :     relocatable @INC, initialinstalllocation is what binexp started as.
8935 case "$startperl" in
8936 '')
8937         case "$sharpbang" in
8938         *!)
8939                 $cat <<EOH
8940
8941 I can use the #! construct to start perl on your system. This will
8942 make startup of perl scripts faster, but may cause problems if you
8943 want to share those scripts and perl is not in a standard place
8944 ($initialinstalllocation/perl) on all your platforms. The alternative
8945 is to force a shell by starting the script with a single ':' character.
8946
8947 EOH
8948                 case "$versiononly" in
8949                 "$define")      dflt="$initialinstalllocation/perl$version";;
8950                 *)              dflt="$initialinstalllocation/perl";;
8951                 esac
8952                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8953                 . ./myread
8954                 case "$ans" in
8955                 none)   startperl=": # use perl";;
8956                 *)      startperl="#!$ans"
8957                         if $test 30 -lt `echo "$ans" | wc -c`; then
8958                                 $cat >&4 <<EOM
8959
8960 WARNING:  Some systems limit the #! command to 32 characters.
8961 If you experience difficulty running Perl scripts with #!, try
8962 installing Perl in a directory with a shorter pathname.
8963
8964 EOM
8965                         fi ;;
8966                 esac
8967                 ;;
8968         *) startperl=": # use perl"
8969                 ;;
8970         esac
8971         ;;
8972 esac
8973 echo "I'll use $startperl to start perl scripts."
8974
8975 : figure best path for perl in scripts
8976 case "$perlpath" in
8977 '')
8978         case "$versiononly" in
8979         "$define")      perlpath="$initialinstalllocation/perl$version";;
8980         *)              perlpath="$initialinstalllocation/perl";;
8981         esac
8982         case "$startperl" in
8983         *!*) ;;
8984         *)
8985                 $cat <<EOH
8986
8987 I will use the "eval 'exec'" idiom to start Perl on your system.
8988 I can use the full path of your Perl binary for this purpose, but
8989 doing so may cause problems if you want to share those scripts and
8990 Perl is not always in a standard place ($initialinstalllocation/perl).
8991
8992 EOH
8993                 dflt="$initialinstalllocation/perl"
8994                 rp="What path shall I use in \"eval 'exec'\"?"
8995                 . ./myread
8996                 perlpath="$ans"
8997                 ;;
8998         esac
8999         ;;
9000 esac
9001 case "$startperl" in
9002 *!*)    ;;
9003 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9004 esac
9005
9006 : determine where public executable scripts go
9007 set scriptdir scriptdir
9008 eval $prefixit
9009 case "$scriptdir" in
9010 '')
9011         dflt="$bin"
9012         : guess some guesses
9013         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9014         $test -d /usr/share/bin     && dflt=/usr/share/bin
9015         $test -d /usr/local/script  && dflt=/usr/local/script
9016         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9017         $test -d $prefixexp/script  && dflt=$prefixexp/script
9018         set dflt
9019         eval $prefixup
9020         ;;
9021 *)  dflt="$scriptdir"
9022         ;;
9023 esac
9024 $cat <<EOM
9025
9026 Some installations have a separate directory just for executable scripts so
9027 that they can mount it across multiple architectures but keep the scripts in
9028 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9029 Or you might just lump your scripts in with all your other executables.
9030
9031 EOM
9032 fn=d~
9033 rp='Where do you keep publicly executable scripts?'
9034 . ./getfile
9035 if $test "X$ansexp" != "X$scriptdirexp"; then
9036         installscript=''
9037 fi
9038 installscriptdir=''
9039 prefixvar=scriptdir
9040 . ./setprefixvar
9041 : A little fix up for an irregularly named variable.
9042 installscript="$installscriptdir"
9043
9044 : determine where add-on public executables go
9045 case "$sitebin" in
9046 '')     dflt=$siteprefix/bin ;;
9047 *)      dflt=$sitebin ;;
9048 esac
9049 fn=d~
9050 rp='Pathname where the add-on public executables should be installed?'
9051 . ./getfile
9052 prefixvar=sitebin
9053 . ./setprefixvar
9054
9055 : determine where add-on html pages go
9056 : There is no standard location, so try to copy the previously-selected
9057 : directory structure for the core html pages.
9058 case "$sitehtml1dir" in
9059 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9060 *)     dflt=$sitehtml1dir ;;
9061 esac
9062 case "$dflt" in
9063 ''|' ') dflt=none ;;
9064 esac
9065 fn=dn+~
9066 rp='Pathname where the site-specific html pages should be installed?'
9067 . ./getfile
9068 prefixvar=sitehtml1dir
9069 . ./setprefixvar
9070
9071 : determine where add-on library html pages go
9072 : There is no standard location, so try to copy the previously-selected
9073 : directory structure for the core html pages.
9074 case "$sitehtml3dir" in
9075 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9076 *)     dflt=$sitehtml3dir ;;
9077 esac
9078 case "$dflt" in
9079 ''|' ') dflt=none ;;
9080 esac
9081 fn=dn+~
9082 rp='Pathname where the site-specific library html pages should be installed?'
9083 . ./getfile
9084 prefixvar=sitehtml3dir
9085 . ./setprefixvar
9086
9087 : determine where add-on manual pages go
9088 case "$siteman1dir" in
9089 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9090 *)      dflt=$siteman1dir ;;
9091 esac
9092 case "$dflt" in
9093 ''|' ') dflt=none ;;
9094 esac
9095 fn=dn+~
9096 rp='Pathname where the site-specific manual pages should be installed?'
9097 . ./getfile
9098 prefixvar=siteman1dir
9099 . ./setprefixvar
9100
9101 : determine where add-on library man pages go
9102 case "$siteman3dir" in
9103 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9104 *)      dflt=$siteman3dir ;;
9105 esac
9106 case "$dflt" in
9107 ''|' ') dflt=none ;;
9108 esac
9109 fn=dn+~
9110 rp='Pathname where the site-specific library manual pages should be installed?'
9111 . ./getfile
9112 prefixvar=siteman3dir
9113 . ./setprefixvar
9114
9115 : determine where add-on public executable scripts go
9116 case "$sitescript" in
9117 '')     dflt=$siteprefix/script
9118         $test -d $dflt || dflt=$sitebin ;;
9119 *)  dflt="$sitescript" ;;
9120 esac
9121 fn=d~+
9122 rp='Pathname where add-on public executable scripts should be installed?'
9123 . ./getfile
9124 prefixvar=sitescript
9125 . ./setprefixvar
9126
9127 : Check if faststdio is requested and available
9128 case "$usefaststdio" in
9129 $define|true|[yY]*|'')
9130         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9131         case "$xversion" in
9132         [68])   dflt='y' ;;
9133         *)      dflt='n' ;;
9134         esac
9135         ;;
9136 *) dflt='n';;
9137 esac
9138 cat <<EOM
9139
9140 Perl can be built to use 'fast stdio', which means using the stdio
9141 library but also directly manipulating the stdio buffers to enable
9142 faster I/O.  Using stdio is better for backward compatibility (especially
9143 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9144 interface has been preferred instead of stdio.
9145
9146 If this doesn't make any sense to you, just accept the default '$dflt'.
9147 EOM
9148 rp='Use the "fast stdio" if available?'
9149 . ./myread
9150 case "$ans" in
9151 y|Y)    val="$define" ;;
9152 *)      val="$undef" ;;
9153 esac
9154 set usefaststdio
9155 eval $setvar
9156
9157
9158 : define an is-a-typedef? function
9159 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9160 case "$inclist" in
9161 "") inclist="sys/types.h";;
9162 esac;
9163 eval "varval=\$$var";
9164 case "$varval" in
9165 "")
9166         $rm -f temp.c;
9167         for inc in $inclist; do
9168                 echo "#include <$inc>" >>temp.c;
9169         done;
9170         echo "#ifdef $type" >> temp.c;
9171         echo "printf(\"We have $type\");" >> temp.c;
9172         echo "#endif" >> temp.c;
9173         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9174         if $contains $type temp.E >/dev/null 2>&1; then
9175                 eval "$var=\$type";
9176         else
9177                 eval "$var=\$def";
9178         fi;
9179         $rm -f temp.?;;
9180 *) eval "$var=\$varval";;
9181 esac'
9182
9183 : define an is-a-typedef? function that prompts if the type is not available.
9184 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9185 case "$inclist" in
9186 "") inclist="sys/types.h";;
9187 esac;
9188 eval "varval=\$$var";
9189 case "$varval" in
9190 "")
9191         $rm -f temp.c;
9192         for inc in $inclist; do
9193                 echo "#include <$inc>" >>temp.c;
9194         done;
9195         echo "#ifdef $type" >> temp.c;
9196         echo "printf(\"We have $type\");" >> temp.c;
9197         echo "#endif" >> temp.c;
9198         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9199         echo " " ;
9200         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9201         if $contains $type temp.E >/dev/null 2>&1; then
9202                 echo "$type found." >&4;
9203                 eval "$var=\$type";
9204         else
9205                 echo "$type NOT found." >&4;
9206                 dflt="$def";
9207                 . ./myread ;
9208                 eval "$var=\$ans";
9209         fi;
9210         $rm -f temp.?;;
9211 *) eval "$var=\$varval";;
9212 esac'
9213
9214 : see what type lseek is declared as in the kernel
9215 rp="What is the type used for lseek's offset on this system?"
9216 set off_t lseektype long stdio.h sys/types.h
9217 eval $typedef_ask
9218
9219 echo " "
9220 echo "Checking to see how big your file offsets are..." >&4
9221 $cat >try.c <<EOCP
9222 #include <sys/types.h>
9223 #include <stdio.h>
9224 int main()
9225 {
9226     printf("%d\n", (int)sizeof($lseektype));
9227     return(0);
9228 }
9229 EOCP
9230 set try
9231 if eval $compile_ok; then
9232         lseeksize=`$run ./try`
9233         echo "Your file offsets are $lseeksize bytes long."
9234 else
9235         dflt=$longsize
9236         echo " "
9237         echo "(I can't seem to compile the test program.  Guessing...)"
9238         rp="What is the size of your file offsets (in bytes)?"
9239         . ./myread
9240         lseeksize="$ans"
9241 fi
9242 $rm_try
9243
9244 : see what type file positions are declared as in the library
9245 rp="What is the type for file position used by fsetpos()?"
9246 set fpos_t fpostype long stdio.h sys/types.h
9247 eval $typedef_ask
9248
9249 : Check size for Fpos_t
9250 echo " "
9251 case "$fpostype" in
9252 *_t) zzz="$fpostype"    ;;
9253 *)   zzz="fpos_t"       ;;
9254 esac
9255 echo "Checking the size of $zzz..." >&4
9256 cat > try.c <<EOCP
9257 #include <sys/types.h>
9258 #include <stdio.h>
9259 #$i_stdlib I_STDLIB
9260 #ifdef I_STDLIB
9261 #include <stdlib.h>
9262 #endif
9263 int main() {
9264     printf("%d\n", (int)sizeof($fpostype));
9265     exit(0);
9266 }
9267 EOCP
9268 set try
9269 if eval $compile_ok; then
9270         yyy=`$run ./try`
9271         case "$yyy" in
9272         '')     fpossize=4
9273                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9274                 ;;
9275         *)      fpossize=$yyy
9276                 echo "Your $zzz is $fpossize bytes long."
9277                 ;;
9278         esac
9279 else
9280         dflt="$longsize"
9281         echo " " >&4
9282         echo "(I can't compile the test program.  Guessing...)" >&4
9283         rp="What is the size of your file positions (in bytes)?"
9284         . ./myread
9285         fpossize="$ans"
9286 fi
9287
9288 : Check for large file support
9289 # Backward compatibility (uselfs is deprecated).
9290 case "$uselfs" in
9291 "$define"|true|[yY]*)
9292         cat <<EOM >&4
9293
9294 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9295 EOM
9296         uselargefiles="$define"
9297         ;;
9298 esac
9299
9300 case "$lseeksize:$fpossize" in
9301 8:8) cat <<EOM
9302
9303 You can have files larger than 2 gigabytes.
9304 EOM
9305    val="$define" ;;
9306 *)    case "$uselargefiles" in
9307    "$undef"|false|[nN]*) dflt='n' ;;
9308    *)   dflt='y' ;;
9309    esac
9310    cat <<EOM
9311
9312 Perl can be built to understand large files (files larger than 2 gigabytes)
9313 on some systems.  To do so, Configure can be run with -Duselargefiles.
9314
9315 If this doesn't make any sense to you, just accept the default '$dflt'.
9316 EOM
9317    rp='Try to understand large files, if available?'
9318    . ./myread
9319    case "$ans" in
9320    y|Y)         val="$define" ;;
9321    *)           val="$undef"  ;;
9322    esac
9323    ;;
9324 esac
9325 set uselargefiles
9326 eval $setvar
9327 : Look for a hint-file generated 'call-back-unit'.  If the
9328 : user has specified that a large files perl is to be built,
9329 : we may need to set or change some other defaults.
9330 if $test -f uselargefiles.cbu; then
9331         echo "Your platform has some specific hints regarding large file builds, using them..."
9332         . ./uselargefiles.cbu
9333 fi
9334 case "$uselargefiles" in
9335 "$define")
9336         if $test -f uselargefiles.cbu; then
9337                 echo " "
9338                 echo "Rechecking to see how big your file offsets are..." >&4
9339                 $cat >try.c <<EOCP
9340 #include <sys/types.h>
9341 #include <stdio.h>
9342 int main()
9343 {
9344     printf("%d\n", (int)sizeof($lseektype));
9345     return(0);
9346 }
9347 EOCP
9348                 set try
9349                 if eval $compile_ok; then
9350                         lseeksize=`$run ./try`
9351                         $echo "Your file offsets are now $lseeksize bytes long."
9352                 else
9353                         dflt="$lseeksize"
9354                         echo " "
9355                         echo "(I can't seem to compile the test program.  Guessing...)"
9356                         rp="What is the size of your file offsets (in bytes)?"
9357                         . ./myread
9358                         lseeksize="$ans"
9359                 fi
9360                 case "$fpostype" in
9361                 *_t) zzz="$fpostype"    ;;
9362                 *)   zzz="fpos_t"       ;;
9363                 esac
9364                 $echo $n "Rechecking the size of $zzz...$c" >&4
9365                 $cat > try.c <<EOCP
9366 #include <sys/types.h>
9367 #include <stdio.h>
9368 #$i_stdlib I_STDLIB
9369 #ifdef I_STDLIB
9370 #include <stdlib.h>
9371 #endif
9372 int main() {
9373     printf("%d\n", (int)sizeof($fpostype));
9374     return(0);
9375 }
9376 EOCP
9377                 set try
9378                 if eval $compile_ok; then
9379                         yyy=`$run ./try`
9380                         dflt="$lseeksize"
9381                         case "$yyy" in
9382                         '')     echo " "
9383                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9384                                 ;;
9385                         *)      fpossize=$yyy
9386                                 echo " $fpossize bytes." >&4
9387                                 ;;
9388                         esac
9389                 else
9390                         dflt="$fpossize"
9391                         echo " "
9392                         echo "(I can't compile the test program.  Guessing...)" >&4
9393                         rp="What is the size of your file positions (in bytes)?"
9394                         . ./myread
9395                         fpossize="$ans"
9396                 fi
9397                 $rm_try
9398         fi
9399         ;;
9400 esac
9401
9402 : Set the vendorbin variables
9403 case "$vendorprefix" in
9404 '')     d_vendorbin="$undef"
9405         vendorbin=''
9406         vendorbinexp=''
9407         ;;
9408 *)      d_vendorbin="$define"
9409         : determine where vendor-supplied executables go.
9410         case "$vendorbin" in
9411         '') dflt=$vendorprefix/bin ;;
9412         *)      dflt="$vendorbin" ;;
9413         esac
9414         fn=d~+
9415         rp='Pathname for the vendor-supplied executables directory?'
9416         . ./getfile
9417         vendorbin="$ans"
9418         vendorbinexp="$ansexp"
9419         ;;
9420 esac
9421 prefixvar=vendorbin
9422 . ./installprefix
9423
9424 : Set the vendorhtml1dir variables
9425 case "$vendorprefix" in
9426 '')     vendorhtml1dir=''
9427         vendorhtml1direxp=''
9428         ;;
9429 *)      : determine where vendor-supplied html pages go.
9430         : There is no standard location, so try to copy the previously-selected
9431         : directory structure for the core html pages.
9432         : XXX Better default suggestions would be welcome.
9433         case "$vendorhtml1dir" in
9434         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9435         *)      dflt=$vendorhtml1dir ;;
9436         esac
9437         case "$dflt" in
9438         ''|' ') dflt=none ;;
9439         esac
9440         fn=dn+~
9441         rp='Pathname for the vendor-supplied html pages?'
9442         . ./getfile
9443         vendorhtml1dir="$ans"
9444         vendorhtml1direxp="$ansexp"
9445         ;;
9446 esac
9447 : Use ' ' for none so value is preserved next time through Configure
9448 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9449 prefixvar=vendorhtml1dir
9450 . ./installprefix
9451
9452 : Set the vendorhtml3dir variables
9453 case "$vendorprefix" in
9454 '')     vendorhtml3dir=''
9455         vendorhtml3direxp=''
9456         ;;
9457 *)      : determine where vendor-supplied module html pages go.
9458         : There is no standard location, so try to copy the previously-selected
9459         : directory structure for the core html pages.
9460         : XXX Better default suggestions would be welcome.
9461         case "$vendorhtml3dir" in
9462         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9463         *)      dflt=$vendorhtml3dir ;;
9464         esac
9465         case "$dflt" in
9466         ''|' ') dflt=none ;;
9467         esac
9468         fn=dn+~
9469         rp='Pathname for the vendor-supplied html pages?'
9470         . ./getfile
9471         vendorhtml3dir="$ans"
9472         vendorhtml3direxp="$ansexp"
9473         ;;
9474 esac
9475 : Use ' ' for none so value is preserved next time through Configure
9476 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9477 prefixvar=vendorhtml3dir
9478 . ./installprefix
9479
9480 : Set the vendorman1dir variables
9481 case "$vendorprefix" in
9482 '')     vendorman1dir=''
9483         vendorman1direxp=''
9484         ;;
9485 *)      : determine where vendor-supplied manual pages go.
9486         case "$vendorman1dir" in
9487         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9488         *)      dflt=$vendorman1dir ;;
9489         esac
9490         case "$dflt" in
9491         ''|' ') dflt=none ;;
9492         esac
9493         fn=nd~+
9494         rp='Pathname for the vendor-supplied manual section 1 pages?'
9495         . ./getfile
9496         vendorman1dir="$ans"
9497         vendorman1direxp="$ansexp"
9498         ;;
9499 esac
9500 : Use ' ' for none so value is preserved next time through Configure
9501 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9502 prefixvar=vendorman1dir
9503 . ./installprefix
9504
9505 : Set the vendorman3dir variables
9506 case "$vendorprefix" in
9507 '')     vendorman3dir=''
9508         vendorman3direxp=''
9509         ;;
9510 *)      : determine where vendor-supplied module manual pages go.
9511         case "$vendorman3dir" in
9512         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9513         *)      dflt=$vendorman3dir ;;
9514         esac
9515         case "$dflt" in
9516         ''|' ') dflt=none ;;
9517         esac
9518         fn=nd~+
9519         rp='Pathname for the vendor-supplied manual section 3 pages?'
9520         . ./getfile
9521         vendorman3dir="$ans"
9522         vendorman3direxp="$ansexp"
9523         ;;
9524 esac
9525 : Use ' ' for none so value is preserved next time through Configure
9526 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9527 prefixvar=vendorman3dir
9528 . ./installprefix
9529
9530 : Set the vendorscript variables
9531 case "$vendorprefix" in
9532 '')     d_vendorscript="$undef"
9533         vendorscript=''
9534         vendorscriptexp=''
9535         ;;
9536 *)      d_vendorscript="$define"
9537         : determine where vendor-supplied scripts go.
9538         case "$vendorscript" in
9539         '')     dflt=$vendorprefix/script
9540                 $test -d $dflt || dflt=$vendorbin ;;
9541         *)  dflt="$vendorscript" ;;
9542         esac
9543         $cat <<EOM
9544
9545 The installation process will create a directory for
9546 vendor-supplied scripts.
9547
9548 EOM
9549         fn=d~+
9550         rp='Pathname for the vendor-supplied scripts directory?'
9551         . ./getfile
9552         vendorscript="$ans"
9553         vendorscriptexp="$ansexp"
9554         ;;
9555 esac
9556 prefixvar=vendorscript
9557 . ./installprefix
9558
9559 : script used to emit important warnings
9560 cat >warn <<EOS
9561 $startsh
9562 if test \$# -gt 0; then
9563         echo "\$@" >msg
9564 else
9565         cat >msg
9566 fi
9567 echo "*** WARNING:" >&4
9568 sed -e 's/^/*** /' <msg >&4
9569 echo "*** " >&4
9570 cat msg >>config.msg
9571 echo " " >>config.msg
9572 rm -f msg
9573 EOS
9574 chmod +x warn
9575 $eunicefix warn
9576
9577 : see which of string.h or strings.h is needed
9578 echo " "
9579 strings=`./findhdr string.h`
9580 if $test "$strings" && $test -r "$strings"; then
9581         echo "Using <string.h> instead of <strings.h>." >&4
9582         val="$define"
9583 else
9584         val="$undef"
9585         strings=`./findhdr strings.h`
9586         if $test "$strings" && $test -r "$strings"; then
9587                 echo "Using <strings.h> instead of <string.h>." >&4
9588         else
9589                 ./warn "No string header found -- You'll surely have problems."
9590         fi
9591 fi
9592 set i_string
9593 eval $setvar
9594 case "$i_string" in
9595 "$undef") strings=`./findhdr strings.h`;;
9596 *)        strings=`./findhdr string.h`;;
9597 esac
9598
9599 : see if qgcvt exists
9600 set qgcvt d_qgcvt
9601 eval $inlibc
9602
9603 : Check print/scan long double stuff
9604 echo " "
9605
9606 if $test X"$d_longdbl" = X"$define"; then
9607
9608 echo "Checking how to print long doubles..." >&4
9609
9610 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9611         $cat >try.c <<'EOCP'
9612 #include <sys/types.h>
9613 #include <stdio.h>
9614 int main() {
9615   double d = 123.456;
9616   printf("%.3f\n", d);
9617 }
9618 EOCP
9619         set try
9620         if eval $compile; then
9621                 yyy=`$run ./try`
9622                 case "$yyy" in
9623                 123.456)
9624                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9625                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9626                         echo "We will use %f."
9627                         ;;
9628                 esac
9629         fi
9630 fi
9631
9632 if $test X"$sPRIfldbl" = X; then
9633         $cat >try.c <<'EOCP'
9634 #include <sys/types.h>
9635 #include <stdio.h>
9636 int main() {
9637   long double d = 123.456;
9638   printf("%.3Lf\n", d);
9639 }
9640 EOCP
9641         set try
9642         if eval $compile; then
9643                 yyy=`$run ./try`
9644                 case "$yyy" in
9645                 123.456)
9646                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9647                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9648                         echo "We will use %Lf."
9649                         ;;
9650                 esac
9651         fi
9652 fi
9653
9654 if $test X"$sPRIfldbl" = X; then
9655         $cat >try.c <<'EOCP'
9656 #include <sys/types.h>
9657 #include <stdio.h>
9658 int main() {
9659   long double d = 123.456;
9660   printf("%.3llf\n", d);
9661 }
9662 EOCP
9663         set try
9664         if eval $compile; then
9665                 yyy=`$run ./try`
9666                 case "$yyy" in
9667                 123.456)
9668                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9669                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9670                         echo "We will use %llf."
9671                         ;;
9672                 esac
9673         fi
9674 fi
9675
9676 if $test X"$sPRIfldbl" = X; then
9677         $cat >try.c <<'EOCP'
9678 #include <sys/types.h>
9679 #include <stdio.h>
9680 int main() {
9681   long double d = 123.456;
9682   printf("%.3lf\n", d);
9683 }
9684 EOCP
9685         set try
9686         if eval $compile; then
9687                 yyy=`$run ./try`
9688                 case "$yyy" in
9689                 123.456)
9690                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9691                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9692                         echo "We will use %lf."
9693                         ;;
9694                 esac
9695         fi
9696 fi
9697
9698 if $test X"$sPRIfldbl" = X; then
9699         echo "Cannot figure out how to print long doubles." >&4
9700 else
9701         sSCNfldbl=$sPRIfldbl    # expect consistency
9702 fi
9703
9704 $rm_try
9705
9706 fi # d_longdbl
9707
9708 case "$sPRIfldbl" in
9709 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9710         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9711         d_SCNfldbl="$undef";
9712         ;;
9713 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9714         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9715         d_SCNfldbl="$define";
9716         ;;
9717 esac
9718
9719 : Check how to convert floats to strings.
9720
9721 if test "X$d_Gconvert" = X; then
9722
9723 echo " "
9724 echo "Checking for an efficient way to convert floats to strings."
9725 echo " " > try.c
9726 case "$uselongdouble" in
9727 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9728 esac
9729 case "$d_longdbl" in
9730 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9731 esac
9732 case "$d_PRIgldbl" in
9733 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9734 esac
9735 $cat >>try.c <<EOP
9736 #ifdef TRY_gconvert
9737 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9738 char *myname = "gconvert";
9739 #endif
9740 #ifdef TRY_gcvt
9741 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9742 char *myname = "gcvt";
9743 #endif
9744 #ifdef TRY_qgcvt
9745 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9746 char *myname = "qgcvt";
9747 #define DOUBLETYPE long double
9748 #endif
9749 #ifdef TRY_sprintf
9750 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9751 #ifdef HAS_PRIgldbl
9752 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9753 #else
9754 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9755 #endif
9756 #else
9757 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9758 #endif
9759 char *myname = "sprintf";
9760 #endif
9761
9762 #ifndef DOUBLETYPE
9763 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9764 #define DOUBLETYPE long double
9765 #else
9766 #define DOUBLETYPE double
9767 #endif
9768 #endif
9769
9770 #include <stdio.h>
9771
9772 #$i_stdlib I_STDLIB
9773 #ifdef I_STDLIB
9774 #include <stdlib.h>
9775 #endif
9776 #$i_string I_STRING
9777 #ifdef I_STRING
9778 #  include <string.h>
9779 #else
9780 #  include <strings.h>
9781 #endif
9782
9783 int checkit(char *expect, char *got)
9784 {
9785     if (strcmp(expect, got)) {
9786                 printf("%s oddity:  Expected %s, got %s\n",
9787                         myname, expect, got);
9788                 exit(1);
9789         }
9790 }
9791
9792 int main()
9793 {
9794         char buf[64];
9795         buf[63] = '\0';
9796
9797         /* This must be 1st test on (which?) platform */
9798         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9799         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9800         checkit("0.1", buf);
9801
9802         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9803         checkit("0.01", buf);
9804
9805         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9806         checkit("0.001", buf);
9807
9808         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9809         checkit("0.0001", buf);
9810
9811         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9812         if (strlen(buf) > 5)
9813             checkit("9e-005", buf); /* for Microsoft ?? */
9814         else
9815             checkit("9e-05", buf);
9816
9817         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9818         checkit("1", buf);
9819
9820         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9821         checkit("1.1", buf);
9822
9823         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9824         checkit("1.01", buf);
9825
9826         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9827         checkit("1.001", buf);
9828
9829         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9830         checkit("1.0001", buf);
9831
9832         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9833         checkit("1.00001", buf);
9834
9835         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9836         checkit("1.000001", buf);
9837
9838         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9839         checkit("0", buf);
9840
9841         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9842         checkit("-1", buf);
9843
9844         /* Some Linux gcvt's give 1.e+5 here. */
9845         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9846         checkit("100000", buf);
9847
9848         /* Some Linux gcvt's give -1.e+5 here. */
9849         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9850         checkit("-100000", buf);
9851
9852         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9853         checkit("123.456", buf);
9854
9855         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9856         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9857         /* 34 should be enough to scare even long double
9858          * places into using the e notation. */
9859         if (strlen(buf) > 5)
9860             checkit("1e+034", buf); /* for Microsoft */
9861         else
9862             checkit("1e+34", buf);
9863
9864         /* For Perl, if you add additional tests here, also add them to
9865          * t/base/num.t for benefit of platforms not using Configure or
9866          * overriding d_Gconvert */
9867
9868         exit(0);
9869 }
9870 EOP
9871 : first add preferred functions to our list
9872 xxx_list=""
9873 for xxx_convert in $gconvert_preference; do
9874     case $xxx_convert in
9875     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9876     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9877     esac
9878 done
9879 : then add any others
9880 for xxx_convert in gconvert gcvt sprintf; do
9881     case "$xxx_list" in
9882     *$xxx_convert*) ;;
9883     *) xxx_list="$xxx_list $xxx_convert" ;;
9884     esac
9885 done
9886
9887 case "$d_longdbl$uselongdouble" in
9888 "$define$define")
9889     : again, add prefered functions to our list first
9890     xxx_ld_list=""
9891     for xxx_convert in $gconvert_ld_preference; do
9892         case $xxx_convert in
9893         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9894         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9895         esac
9896     done
9897     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9898     for xxx_convert in qgcvt sprintf $xxx_list; do
9899         case "$xxx_ld_list" in
9900         $xxx_convert*|*" $xxx_convert"*) ;;
9901         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9902         esac
9903     done
9904     : if sprintf cannot do long doubles, move it to the end
9905     if test "$d_PRIgldbl" != "$define"; then
9906         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9907     fi
9908     : if no qgcvt, remove it
9909     if test "$d_qgcvt" != "$define"; then
9910         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9911     fi
9912     : use the ld_list
9913     xxx_list="$xxx_ld_list"
9914     ;;
9915 esac
9916
9917 for xxx_convert in $xxx_list; do
9918         echo "Trying $xxx_convert..."
9919         $rm -f try try$_o core
9920         set try -DTRY_$xxx_convert
9921         if eval $compile; then
9922                 echo "$xxx_convert() found." >&4
9923                 if $run ./try; then
9924                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9925                         break;
9926                 else
9927                         echo "...But $xxx_convert didn't work as I expected."
9928                         xxx_convert=''
9929                 fi
9930         else
9931                 echo "$xxx_convert NOT found." >&4
9932         fi
9933 done
9934
9935 if test X$xxx_convert = X; then
9936     echo "*** WHOA THERE!!! ***" >&4
9937     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9938     xxx_convert=sprintf
9939 fi
9940
9941 case "$xxx_convert" in
9942 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9943 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9944 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9945 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9946    "$define$define$define")
9947       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9948    "$define$define$undef")
9949       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9950    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9951    esac
9952    ;;
9953 esac
9954
9955 fi
9956 $rm_try
9957
9958 : see if _fwalk exists
9959 set fwalk d__fwalk
9960 eval $inlibc
9961
9962 : Initialize h_fcntl
9963 h_fcntl=false
9964
9965 : Initialize h_sysfile
9966 h_sysfile=false
9967
9968 : access call always available on UNIX
9969 set access d_access
9970 eval $inlibc
9971
9972 : locate the flags for 'access()'
9973 case "$d_access" in
9974 "$define")
9975         echo " "
9976         $cat >access.c <<EOCP
9977 #include <sys/types.h>
9978 #ifdef I_FCNTL
9979 #include <fcntl.h>
9980 #endif
9981 #ifdef I_SYS_FILE
9982 #include <sys/file.h>
9983 #endif
9984 #ifdef I_UNISTD
9985 #include <unistd.h>
9986 #endif
9987 #$i_stdlib I_STDLIB
9988 #ifdef I_STDLIB
9989 #include <stdlib.h>
9990 #endif
9991 int main() {
9992         exit(R_OK);
9993 }
9994 EOCP
9995         : check sys/file.h first, no particular reason here
9996         if $test `./findhdr sys/file.h` && \
9997                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9998                 h_sysfile=true;
9999                 echo "<sys/file.h> defines the *_OK access constants." >&4
10000         elif $test `./findhdr fcntl.h` && \
10001                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10002                 h_fcntl=true;
10003                 echo "<fcntl.h> defines the *_OK access constants." >&4
10004         elif $test `./findhdr unistd.h` && \
10005                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10006                 echo "<unistd.h> defines the *_OK access constants." >&4
10007         else
10008                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10009         fi
10010         ;;
10011 esac
10012 $rm -f access*
10013
10014 : see if accessx exists
10015 set accessx d_accessx
10016 eval $inlibc
10017
10018 : see if aintl exists
10019 set aintl d_aintl
10020 eval $inlibc
10021
10022 : see if alarm exists
10023 set alarm d_alarm
10024 eval $inlibc
10025
10026 : see if 64bit time functions exists
10027
10028 set ctime64 d_ctime64
10029 eval $inlibc
10030
10031 set localtime64 d_localtime64
10032 eval $inlibc
10033
10034 set gmtime64 d_gmtime64
10035 eval $inlibc
10036
10037 set mktime64 d_mktime64
10038 eval $inlibc
10039
10040 set difftime64 d_difftime64
10041 eval $inlibc
10042
10043 set asctime64 d_asctime64
10044 eval $inlibc
10045
10046 : see if POSIX threads are available
10047 set pthread.h i_pthread
10048 eval $inhdr
10049
10050 : define a fucntion to check prototypes
10051 $cat > protochk <<EOSH
10052 $startsh
10053 cc="$cc"
10054 optimize="$optimize"
10055 ccflags="$ccflags"
10056 prototype="$prototype"
10057 define="$define"
10058 rm_try="$rm_try"
10059 usethreads=$usethreads
10060 i_pthread=$i_pthread
10061 pthread_h_first=$pthread_h_first
10062 EOSH
10063
10064 $cat >> protochk <<'EOSH'
10065
10066 $rm_try
10067 foo="$1"
10068 shift
10069 while test $# -ge 2; do
10070         case "$1" in
10071                 $define) echo "#include <$2>" >> try.c ;;
10072                 literal) echo "$2" >> try.c ;;
10073         esac
10074     # Extra magic for the benefit of systems that need pthread.h
10075     # to be included early to correctly detect threadsafe functions.
10076     # Such functions must guarantee themselves, though, that the usethreads
10077     # and i_pthread have been defined, before calling protochk.
10078     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10079         echo "#include <pthread.h>" >> try.c
10080         pthread_h_done=yes
10081     fi
10082     shift 2
10083 done
10084 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10085 cat >> try.c <<'EOCP'
10086 #ifdef CAN_PROTOTYPE
10087 #define _(args) args
10088 #else
10089 #define _(args) ()
10090 #endif
10091 EOCP
10092 echo "$foo" >> try.c
10093 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10094 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10095 status=$?
10096 $rm_try
10097 exit $status
10098 EOSH
10099 chmod +x protochk
10100 $eunicefix protochk
10101
10102 : Define hasproto macro for Configure internal use
10103 hasproto='varname=$1; func=$2; shift; shift;
10104 while $test $# -ge 2; do
10105         case "$1" in
10106         $define) echo "#include <$2>";;
10107         esac ;
10108     shift 2;
10109 done > try.c;
10110 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10111 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10112         echo "$func() prototype found.";
10113         val="$define";
10114 else
10115         echo "$func() prototype NOT found.";
10116         val="$undef";
10117 fi;
10118 set $varname;
10119 eval $setvar;
10120 $rm_try tryout.c'
10121
10122 : see if sys/types.h has to be included
10123 set sys/types.h i_systypes
10124 eval $inhdr
10125
10126 : see if sys/select.h has to be included
10127 set sys/select.h i_sysselct
10128 eval $inhdr
10129
10130 : Define hasfield macro for Configure internal use
10131 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10132 while $test $# -ge 2; do
10133         case "$1" in
10134         $define) echo "#include <$2>";;
10135         esac ;
10136     shift 2;
10137 done > try.c;
10138 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10139 set try;
10140 if eval $compile; then
10141         val="$define";
10142 else
10143         val="$undef";
10144 fi;
10145 set $varname;
10146 eval $setvar;
10147 $rm_try'
10148
10149 : see if we should include time.h, sys/time.h, or both
10150 echo " "
10151 if test "X$timeincl" = X; then
10152         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10153         $echo $n "I'm now running the test program...$c"
10154         $cat >try.c <<EOCP
10155 #include <sys/types.h>
10156 #ifdef I_TIME
10157 #include <time.h>
10158 #endif
10159 #ifdef I_SYSTIME
10160 #ifdef SYSTIMEKERNEL
10161 #define KERNEL
10162 #endif
10163 #include <sys/time.h>
10164 #endif
10165 #ifdef I_SYSSELECT
10166 #include <sys/select.h>
10167 #endif
10168 #$i_stdlib I_STDLIB
10169 #ifdef I_STDLIB
10170 #include <stdlib.h>
10171 #endif
10172 int main()
10173 {
10174         struct tm foo;
10175 #ifdef S_TIMEVAL
10176         struct timeval bar;
10177 #endif
10178 #ifdef S_TIMEZONE
10179         struct timezone tzp;
10180 #endif
10181         if (foo.tm_sec == foo.tm_sec)
10182                 exit(0);
10183 #ifdef S_TIMEVAL
10184         if (bar.tv_sec == bar.tv_sec)
10185                 exit(0);
10186 #endif
10187         exit(1);
10188 }
10189 EOCP
10190         flags=''
10191         for s_timezone in '-DS_TIMEZONE' ''; do
10192         sysselect=''
10193         for s_timeval in '-DS_TIMEVAL' ''; do
10194         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10195         for i_time in '' '-DI_TIME'; do
10196         for i_systime in '-DI_SYSTIME' ''; do
10197                 case "$flags" in
10198                 '') $echo $n ".$c"
10199                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10200                         if eval $compile; then
10201                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10202                                 shift
10203                                 flags="$*"
10204                                 echo " "
10205                                 $echo $n "Succeeded with $flags$c"
10206                         fi
10207                         ;;
10208                 esac
10209         done
10210         done
10211         done
10212         done
10213         done
10214         timeincl=''
10215         echo " "
10216         case "$flags" in
10217         *SYSTIMEKERNEL*) i_systimek="$define"
10218                 timeincl=`./findhdr sys/time.h`
10219                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10220         *) i_systimek="$undef";;
10221         esac
10222         case "$flags" in
10223         *I_TIME*) i_time="$define"
10224                 timeincl=`./findhdr time.h`" $timeincl"
10225                 echo "We'll include <time.h>." >&4;;
10226         *) i_time="$undef";;
10227         esac
10228         case "$flags" in
10229         *I_SYSTIME*) i_systime="$define"
10230                 timeincl=`./findhdr sys/time.h`" $timeincl"
10231                 echo "We'll include <sys/time.h>." >&4;;
10232         *) i_systime="$undef";;
10233         esac
10234         $rm_try
10235 fi
10236 : see if struct tm knows about tm_zone
10237 case "$i_systime$i_time" in
10238 *$define*)
10239         echo " "
10240         echo "Checking to see if your struct tm has tm_zone field..." >&4
10241         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10242         eval $hasfield
10243         ;;
10244 *)      val="$undef"
10245         set d_tm_tm_zone
10246         eval $setvar
10247         ;;
10248 esac
10249 case "$d_tm_tm_zone" in
10250 "$define")      echo "Yes, it does."   ;;
10251 *)              echo "No, it doesn't." ;;
10252 esac
10253 : see if struct tm knows about tm_gmtoff
10254 case "$i_systime$i_time" in
10255 *$define*)
10256         echo " "
10257         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10258         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10259         eval $hasfield
10260         ;;
10261 *)      val="$undef"
10262         set d_tm_tm_gmtoff
10263         eval $setvar
10264         ;;
10265 esac
10266 case "$d_tm_tm_gmtoff" in
10267 "$define")      echo "Yes, it does."   ;;
10268 *)              echo "No, it doesn't." ;;
10269 esac
10270
10271 : see if asctime_r exists
10272 set asctime_r d_asctime_r
10273 eval $inlibc
10274 case "$d_asctime_r" in
10275 "$define")
10276         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10277         case "$d_asctime_r_proto:$usethreads" in
10278         ":define")      d_asctime_r_proto=define
10279                 set d_asctime_r_proto asctime_r $hdrs
10280                 eval $hasproto ;;
10281         *)      ;;
10282         esac
10283         case "$d_asctime_r_proto" in
10284         define)
10285         case "$asctime_r_proto" in
10286         ''|0) try='char* asctime_r(const struct tm*, char*);'
10287         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10288         esac
10289         case "$asctime_r_proto" in
10290         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10291         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10292         esac
10293         case "$asctime_r_proto" in
10294         ''|0) try='int asctime_r(const struct tm*, char*);'
10295         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10296         esac
10297         case "$asctime_r_proto" in
10298         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10299         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10300         esac
10301         case "$asctime_r_proto" in
10302         ''|0)   d_asctime_r=undef
10303                 asctime_r_proto=0
10304                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10305         * )     case "$asctime_r_proto" in
10306                 REENTRANT_PROTO*) ;;
10307                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10308                 esac
10309                 echo "Prototype: $try" ;;
10310         esac
10311         ;;
10312         *)      case "$usethreads" in
10313                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10314                 esac
10315                 d_asctime_r=undef
10316                 asctime_r_proto=0
10317                 ;;
10318         esac
10319         ;;
10320 *)      asctime_r_proto=0
10321         ;;
10322 esac
10323
10324 : see if atolf exists
10325 set atolf d_atolf
10326 eval $inlibc
10327
10328 : see if atoll exists
10329 set atoll d_atoll
10330 eval $inlibc
10331
10332 : Look for GCC-style attribute format
10333 case "$d_attribute_format" in
10334 '')
10335 echo " "
10336 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10337 $cat >attrib.c <<'EOCP'
10338 #include <stdio.h>
10339 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10340 EOCP
10341 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10342         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10343                 echo "Your C compiler doesn't support __attribute__((format))."
10344                 val="$undef"
10345         else
10346                 echo "Your C compiler supports __attribute__((format))."
10347                 val="$define"
10348         fi
10349 else
10350         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10351         val="$undef"
10352 fi
10353 ;;
10354 *) val="$d_attribute_format" ;;
10355 esac
10356 set d_attribute_format
10357 eval $setvar
10358 $rm -f attrib*
10359
10360 : Look for GCC-style attribute format with null format allowed
10361 case "$d_printf_format_null" in
10362 '') case "$d_attribute_format" in
10363     $define)
10364         echo " "
10365         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10366 $cat >attrib.c <<EOCP
10367 #include <stdio.h>
10368 #$i_stdlib I_STDLIB
10369 #ifdef I_STDLIB
10370 #include <stdlib.h>
10371 #endif
10372 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10373 int null_printf (char* pat,...) { return (int)pat; }
10374 int main () { exit(null_printf(NULL)); }
10375 EOCP
10376         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10377             : run the executable in case it produces a run-time warning
10378             if $run ./attrib >>attrib.out 2>&1; then
10379                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10380                     echo "Your C compiler doesn't allow __printf__ format to be null."
10381                     val="$undef"
10382                 else
10383                     echo "Your C compiler allows __printf__ format to be null."
10384                     val="$define"
10385                 fi
10386             else
10387             echo "Your C compiler executable failed with __printf__ format null."
10388             val="$undef"
10389         fi
10390     else
10391         echo "Your C compiler fails with __printf__ format null."
10392         val="$undef"
10393     fi
10394     ;;
10395     *)  val="$undef" ;;
10396     esac
10397 ;;
10398 *)  val="$d_printf_format_null" ;;
10399 esac
10400 set d_printf_format_null
10401 eval $setvar
10402 $rm -f attrib*
10403
10404 : Look for GCC-style attribute malloc
10405 case "$d_attribute_malloc" in
10406 '')
10407 echo " "
10408 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10409 $cat >attrib.c <<'EOCP'
10410 #include <stdio.h>
10411 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10412 EOCP
10413 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10414         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10415                 echo "Your C compiler doesn't support __attribute__((malloc))."
10416                 val="$undef"
10417         else
10418                 echo "Your C compiler supports __attribute__((malloc))."
10419                 val="$define"
10420         fi
10421 else
10422         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10423         val="$undef"
10424 fi
10425 ;;
10426 *) val="$d_attribute_malloc" ;;
10427 esac
10428 set d_attribute_malloc
10429 eval $setvar
10430 $rm -f attrib*
10431
10432 : Look for GCC-style attribute nonnull
10433 case "$d_attribute_nonnull" in
10434 '')
10435 echo " "
10436 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10437 $cat >attrib.c <<'EOCP'
10438 #include <stdio.h>
10439 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10440 EOCP
10441 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10442         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10443                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10444                 val="$undef"
10445         else
10446                 echo "Your C compiler supports __attribute__((nonnull))."
10447                 val="$define"
10448         fi
10449 else
10450         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10451         val="$undef"
10452 fi
10453 ;;
10454 *) val="$d_attribute_nonnull" ;;
10455 esac
10456 set d_attribute_nonnull
10457 eval $setvar
10458 $rm -f attrib*
10459
10460 : Look for GCC-style attribute noreturn
10461 case "$d_attribute_noreturn" in
10462 '')
10463 echo " "
10464 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10465 $cat >attrib.c <<'EOCP'
10466 #include <stdio.h>
10467 void fall_over_dead( void ) __attribute__((noreturn));
10468 EOCP
10469 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10470         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10471                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10472                 val="$undef"
10473         else
10474                 echo "Your C compiler supports __attribute__((noreturn))."
10475                 val="$define"
10476         fi
10477 else
10478         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10479         val="$undef"
10480 fi
10481 ;;
10482 *) val="$d_attribute_noreturn" ;;
10483 esac
10484 set d_attribute_noreturn
10485 eval $setvar
10486 $rm -f attrib*
10487
10488 : Look for GCC-style attribute pure
10489 case "$d_attribute_pure" in
10490 '')
10491 echo " "
10492 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10493 $cat >attrib.c <<'EOCP'
10494 #include <stdio.h>
10495 int square( int n ) __attribute__((pure));
10496 EOCP
10497 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10498         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10499                 echo "Your C compiler doesn't support __attribute__((pure))."
10500                 val="$undef"
10501         else
10502                 echo "Your C compiler supports __attribute__((pure))."
10503                 val="$define"
10504         fi
10505 else
10506         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10507         val="$undef"
10508 fi
10509 ;;
10510 *) val="$d_attribute_pure" ;;
10511 esac
10512 set d_attribute_pure
10513 eval $setvar
10514 $rm -f attrib*
10515
10516 : Look for GCC-style attribute unused
10517 case "$d_attribute_unused" in
10518 '')
10519 echo " "
10520 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10521 $cat >attrib.c <<'EOCP'
10522 #include <stdio.h>
10523 int do_something( int dummy __attribute__((unused)), int n );
10524 EOCP
10525 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10526         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10527                 echo "Your C compiler doesn't support __attribute__((unused))."
10528                 val="$undef"
10529         else
10530                 echo "Your C compiler supports __attribute__((unused))."
10531                 val="$define"
10532         fi
10533 else
10534         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10535         val="$undef"
10536 fi
10537 ;;
10538 *) val="$d_attribute_unused" ;;
10539 esac
10540 set d_attribute_unused
10541 eval $setvar
10542 $rm -f attrib*
10543
10544 : Look for GCC-style attribute deprecated
10545 case "$d_attribute_deprecated" in
10546 '')
10547 echo " "
10548 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10549 $cat >attrib.c <<'EOCP'
10550 #include <stdio.h>
10551 int I_am_deprecated(void) __attribute__((deprecated));
10552 EOCP
10553 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10554         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10555                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10556                 val="$undef"
10557         else
10558                 echo "Your C compiler supports __attribute__((deprecated))."
10559                 val="$define"
10560         fi
10561 else
10562         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10563         val="$undef"
10564 fi
10565 ;;
10566 *) val="$d_attribute_deprecated" ;;
10567 esac
10568 set d_attribute_deprecated
10569 eval $setvar
10570 $rm -f attrib*
10571
10572 : Look for GCC-style attribute warn_unused_result
10573 case "$d_attribute_warn_unused_result" in
10574 '')
10575 echo " "
10576 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10577 $cat >attrib.c <<'EOCP'
10578 #include <stdio.h>
10579 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10580 EOCP
10581 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10582         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10583                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10584                 val="$undef"
10585         else
10586                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10587                 val="$define"
10588         fi
10589 else
10590         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10591         val="$undef"
10592 fi
10593 ;;
10594 *) val="$d_attribute_warn_unused_result" ;;
10595 esac
10596 set d_attribute_warn_unused_result
10597 eval $setvar
10598 $rm -f attrib*
10599
10600 : see if bcmp exists
10601 set bcmp d_bcmp
10602 eval $inlibc
10603
10604 : see if bcopy exists
10605 set bcopy d_bcopy
10606 eval $inlibc
10607
10608 : see if getpgrp exists
10609 set getpgrp d_getpgrp
10610 eval $inlibc
10611
10612 case "$d_getpgrp" in
10613 "$define")
10614         echo " "
10615         echo "Checking to see which flavor of getpgrp is in use..."
10616         $cat >try.c <<EOP
10617 #$i_unistd I_UNISTD
10618 #include <sys/types.h>
10619 #ifdef I_UNISTD
10620 #  include <unistd.h>
10621 #endif
10622 #$i_stdlib I_STDLIB
10623 #ifdef I_STDLIB
10624 #include <stdlib.h>
10625 #endif
10626 int main()
10627 {
10628         if (getuid() == 0) {
10629                 printf("(I see you are running Configure as super-user...)\n");
10630                 setuid(1);
10631         }
10632 #ifdef TRY_BSD_PGRP
10633         if (getpgrp(1) == 0)
10634                 exit(0);
10635 #else
10636         if (getpgrp() > 0)
10637                 exit(0);
10638 #endif
10639         exit(1);
10640 }
10641 EOP
10642         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10643                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10644                 val="$define"
10645         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10646                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10647                 val="$undef"
10648         else
10649                 echo "I can't seem to compile and run the test program."
10650                 if ./usg; then
10651                         xxx="a USG one, i.e. you use getpgrp()."
10652                 else
10653                         # SVR4 systems can appear rather BSD-ish.
10654                         case "$i_unistd" in
10655                         $undef)
10656                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10657                                 val="$define"
10658                                 ;;
10659                         $define)
10660                                 xxx="probably a USG one, i.e. you use getpgrp()."
10661                                 val="$undef"
10662                                 ;;
10663                         esac
10664                 fi
10665                 echo "Assuming your getpgrp is $xxx" >&4
10666         fi
10667         ;;
10668 *) val="$undef";;
10669 esac
10670 set d_bsdgetpgrp
10671 eval $setvar
10672 $rm_try
10673
10674 : see if setpgrp exists
10675 set setpgrp d_setpgrp
10676 eval $inlibc
10677
10678 case "$d_setpgrp" in
10679 "$define")
10680         echo " "
10681         echo "Checking to see which flavor of setpgrp is in use..."
10682         $cat >try.c <<EOP
10683 #$i_unistd I_UNISTD
10684 #include <sys/types.h>
10685 #ifdef I_UNISTD
10686 #  include <unistd.h>
10687 #endif
10688 #$i_stdlib I_STDLIB
10689 #ifdef I_STDLIB
10690 #include <stdlib.h>
10691 #endif
10692 int main()
10693 {
10694         if (getuid() == 0) {
10695                 printf("(I see you are running Configure as super-user...)\n");
10696                 setuid(1);
10697         }
10698 #ifdef TRY_BSD_PGRP
10699         if (-1 == setpgrp(1, 1))
10700                 exit(0);
10701 #else
10702         if (setpgrp() != -1)
10703                 exit(0);
10704 #endif
10705         exit(1);
10706 }
10707 EOP
10708         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10709                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10710                 val="$define"
10711         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10712                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10713                 val="$undef"
10714         else
10715                 echo "(I can't seem to compile and run the test program.)"
10716                 if ./usg; then
10717                         xxx="a USG one, i.e. you use setpgrp()."
10718                 else
10719                         # SVR4 systems can appear rather BSD-ish.
10720                         case "$i_unistd" in
10721                         $undef)
10722                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10723                                 val="$define"
10724                                 ;;
10725                         $define)
10726                                 xxx="probably a USG one, i.e. you use setpgrp()."
10727                                 val="$undef"
10728                                 ;;
10729                         esac
10730                 fi
10731                 echo "Assuming your setpgrp is $xxx" >&4
10732         fi
10733         ;;
10734 *) val="$undef";;
10735 esac
10736 set d_bsdsetpgrp
10737 eval $setvar
10738 $rm_try
10739
10740 : Look for GCC-style __builtin_choose_expr
10741 case "$d_builtin_choose_expr" in
10742 '')
10743     echo " "
10744     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10745     $cat >try.c <<'EOCP'
10746 #include <assert.h>
10747 #include <stdlib.h>
10748 #include <stdio.h>
10749
10750 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10751
10752 int main(void) {
10753     assert( SYRINX(1) == 2112 );
10754     assert( SYRINX(1) != 5150 );
10755     assert( SYRINX(0) == 5150 );
10756     assert( SYRINX(0) != 2112 );
10757     puts( "All good!" );
10758     exit(0);
10759 }
10760
10761 EOCP
10762     set try
10763     if eval $compile && $run ./try; then
10764         echo "Your C compiler supports __builtin_choose_expr."
10765         val="$define"
10766     else
10767         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10768         val="$undef"
10769     fi
10770 ;;
10771 *) val="$d_builtin_choose_expr" ;;
10772 esac
10773
10774 set d_builtin_choose_expr
10775 eval $setvar
10776 $rm_try
10777
10778 : Look for GCC-style __builtin_expect
10779 case "$d_builtin_expect" in
10780 '')
10781     echo " "
10782     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10783     $cat >try.c <<'EOCP'
10784 int main(void) {
10785     int n = 50;
10786     if ( __builtin_expect(n, 0) ) n = 1;
10787     /* Remember shell exit code truth is 0, C truth is non-zero */
10788     return !(n == 1);
10789 }
10790 EOCP
10791     set try
10792     if eval $compile && $run ./try; then
10793         echo "Your C compiler supports __builtin_expect."
10794         val="$define"
10795     else
10796         echo "Your C compiler doesn't seem to understand __builtin_expect."
10797         val="$undef"
10798     fi
10799     ;;
10800 *) val="$d_builtin_expect" ;;
10801 esac
10802
10803 set d_builtin_expect
10804 eval $setvar
10805 $rm_try
10806
10807 : see if bzero exists
10808 set bzero d_bzero
10809 eval $inlibc
10810
10811 : see if stdarg is available
10812 echo " "
10813 if $test `./findhdr stdarg.h`; then
10814         echo "<stdarg.h> found." >&4
10815         valstd="$define"
10816 else
10817         echo "<stdarg.h> NOT found." >&4
10818         valstd="$undef"
10819 fi
10820
10821 : see if varags is available
10822 echo " "
10823 if $test `./findhdr varargs.h`; then
10824         echo "<varargs.h> found." >&4
10825 else
10826         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10827 fi
10828
10829 : set up the varargs testing programs
10830 $cat > varargs.c <<EOP
10831 #ifdef I_STDARG
10832 #include <stdarg.h>
10833 #endif
10834 #ifdef I_VARARGS
10835 #include <varargs.h>
10836 #endif
10837
10838 #ifdef I_STDARG
10839 int f(char *p, ...)
10840 #else
10841 int f(va_alist)
10842 va_dcl
10843 #endif
10844 {
10845         va_list ap;
10846 #ifndef I_STDARG
10847         char *p;
10848 #endif
10849 #ifdef I_STDARG
10850         va_start(ap,p);
10851 #else
10852         va_start(ap);
10853         p = va_arg(ap, char *);
10854 #endif
10855         va_end(ap);
10856         return 0;
10857 }
10858 EOP
10859 $cat > varargs <<EOP
10860 $startsh
10861 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10862         echo "true"
10863 else
10864         echo "false"
10865 fi
10866 $rm -f varargs$_o
10867 EOP
10868 chmod +x varargs
10869
10870 : now check which varargs header should be included
10871 echo " "
10872 i_varhdr=''
10873 case "$valstd" in
10874 "$define")
10875         if `./varargs I_STDARG`; then
10876                 val='stdarg.h'
10877         elif `./varargs I_VARARGS`; then
10878                 val='varargs.h'
10879         fi
10880         ;;
10881 *)
10882         if `./varargs I_VARARGS`; then
10883                 val='varargs.h'
10884         fi
10885         ;;
10886 esac
10887 case "$val" in
10888 '')
10889 echo "I could not find the definition for va_dcl... You have problems..." >&4
10890         val="$undef"; set i_stdarg; eval $setvar
10891         val="$undef"; set i_varargs; eval $setvar
10892         ;;
10893 *)
10894         set i_varhdr
10895         eval $setvar
10896         case "$i_varhdr" in
10897         stdarg.h)
10898                 val="$define"; set i_stdarg; eval $setvar
10899                 val="$undef"; set i_varargs; eval $setvar
10900                 ;;
10901         varargs.h)
10902                 val="$undef"; set i_stdarg; eval $setvar
10903                 val="$define"; set i_varargs; eval $setvar
10904                 ;;
10905         esac
10906         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10907 esac
10908 $rm -f varargs*
10909
10910 : see if the Compiler supports C99 variadic macros
10911 case "$i_stdarg$i_stdlib" in
10912     "$define$define")
10913     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10914     $cat >try.c <<EOCP
10915 #include <stdio.h>
10916 #include <stdarg.h>
10917
10918 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10919
10920 int main() {
10921   char buf[20];
10922   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10923   puts(buf);
10924   return 0;
10925 }
10926 EOCP
10927     set try
10928     if eval $compile && $run ./try 2>&1 >/dev/null; then
10929         case "`$run ./try`" in
10930             "123 456 789")
10931             echo "You have C99 variadic macros." >&4
10932             d_c99_variadic_macros="$define"
10933             ;;
10934             *)
10935             echo "You don't have functional C99 variadic macros." >&4
10936             d_c99_variadic_macros="$undef"
10937             ;;
10938         esac
10939     else
10940         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10941         d_c99_variadic_macros="$undef"
10942     fi
10943     $rm_try
10944     ;;
10945     *)
10946     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10947     d_c99_variadic_macros="$undef"
10948     ;;
10949 esac
10950
10951 : see if signal is declared as pointer to function returning int or void
10952 echo " "
10953 xxx=`./findhdr signal.h`
10954 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10955 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10956         echo "You have int (*signal())() instead of void." >&4
10957         val="$undef"
10958 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10959         echo "You have void (*signal())()." >&4
10960         val="$define"
10961 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10962         echo "You have int (*signal())() instead of void." >&4
10963         val="$undef"
10964 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10965         echo "You have void (*signal())()." >&4
10966         val="$define"
10967 else
10968         case "$d_voidsig" in
10969         '')
10970         echo "I can't determine whether signal handler returns void or int..." >&4
10971                 dflt=void
10972                 rp="What type does your signal handler return?"
10973                 . ./myread
10974                 case "$ans" in
10975                 v*) val="$define";;
10976                 *) val="$undef";;
10977                 esac;;
10978         "$define")
10979                 echo "As you already told me, signal handler returns void." >&4
10980                 val="$define"
10981                 ;;
10982         *)      echo "As you already told me, signal handler returns int." >&4
10983                 val="$undef"
10984                 ;;
10985         esac
10986 fi
10987 set d_voidsig
10988 eval $setvar
10989 case "$d_voidsig" in
10990 "$define") signal_t="void";;
10991 *) signal_t="int";;
10992 esac
10993 $rm -f $$.tmp
10994
10995 : check for ability to cast large floats to 32-bit ints.
10996 echo " "
10997 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10998 if $test "$intsize" -ge 4; then
10999         xxx=int
11000 else
11001         xxx=long
11002 fi
11003 $cat >try.c <<EOCP
11004 #include <stdio.h>
11005 #$i_stdlib I_STDLIB
11006 #ifdef I_STDLIB
11007 #include <stdlib.h>
11008 #endif
11009 #include <sys/types.h>
11010 #include <signal.h>
11011 $signal_t blech(int s) { exit(3); }
11012 int main()
11013 {
11014         $xxx i32;
11015         double f, g;
11016         int result = 0;
11017         char str[16];
11018         signal(SIGFPE, blech);
11019
11020         /* Don't let compiler optimize the test away.  Store the number
11021            in a writable string for gcc to pass to sscanf under HP-UX.
11022         */
11023         sprintf(str, "2147483647");
11024         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11025         g = 10 * f;
11026         i32  = ($xxx) g;
11027
11028         /* x86 processors will probably give 0x8000 0000, which is a
11029            sign change.  We don't want that.  We want to mimic SPARC
11030            behavior here, which is to preserve the sign and give
11031            back 0x7fff ffff.
11032         */
11033         if (i32 != ($xxx) f)
11034                 result |= 1;
11035         exit(result);
11036 }
11037 EOCP
11038 set try
11039 if eval $compile_ok; then
11040         $run ./try
11041         yyy=$?
11042 else
11043         echo "(I can't seem to compile the test program--assuming it can't)"
11044         yyy=1
11045 fi
11046 case "$yyy" in
11047 0)      val="$define"
11048         echo "Yup, it can."
11049         ;;
11050 *)      val="$undef"
11051         echo "Nope, it can't."
11052         ;;
11053 esac
11054 set d_casti32
11055 eval $setvar
11056 $rm_try
11057
11058 : check for ability to cast negative floats to unsigned
11059 echo " "
11060 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11061 $cat >try.c <<EOCP
11062 #include <stdio.h>
11063 #$i_stdlib I_STDLIB
11064 #ifdef I_STDLIB
11065 #include <stdlib.h>
11066 #endif
11067 #include <sys/types.h>
11068 #include <signal.h>
11069 $signal_t blech(int s) { exit(7); }
11070 $signal_t blech_in_list(int s) { exit(4); }
11071 unsigned long dummy_long(unsigned long p) { return p; }
11072 unsigned int dummy_int(unsigned int p) { return p; }
11073 unsigned short dummy_short(unsigned short p) { return p; }
11074 int main()
11075 {
11076         double f;
11077         unsigned long along;
11078         unsigned int aint;
11079         unsigned short ashort;
11080         int result = 0;
11081         char str[16];
11082
11083         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11084            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11085            optimized the whole file away
11086         */
11087         /* Store the number in a writable string for gcc to pass to
11088            sscanf under HP-UX.
11089         */
11090         sprintf(str, "-123");
11091         sscanf(str, "%lf", &f);  /* f = -123.; */
11092
11093         signal(SIGFPE, blech);
11094         along = (unsigned long)f;
11095         aint = (unsigned int)f;
11096         ashort = (unsigned short)f;
11097         if (along != (unsigned long)-123)
11098                 result |= 1;
11099         if (aint != (unsigned int)-123)
11100                 result |= 1;
11101         if (ashort != (unsigned short)-123)
11102                 result |= 1;
11103         sprintf(str, "1073741824.");
11104         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11105         f = f + f;
11106         along = 0;
11107         along = (unsigned long)f;
11108         if (along != 0x80000000)
11109                 result |= 2;
11110         f -= 1.;
11111         along = 0;
11112         along = (unsigned long)f;
11113         if (along != 0x7fffffff)
11114                 result |= 1;
11115         f += 2.;
11116         along = 0;
11117         along = (unsigned long)f;
11118         if (along != 0x80000001)
11119                 result |= 2;
11120         if (result)
11121                 exit(result);
11122         signal(SIGFPE, blech_in_list);
11123         sprintf(str, "123.");
11124         sscanf(str, "%lf", &f);  /* f = 123.; */
11125         along = dummy_long((unsigned long)f);
11126         aint = dummy_int((unsigned int)f);
11127         ashort = dummy_short((unsigned short)f);
11128         if (along != (unsigned long)123)
11129                 result |= 4;
11130         if (aint != (unsigned int)123)
11131                 result |= 4;
11132         if (ashort != (unsigned short)123)
11133                 result |= 4;
11134         exit(result);
11135
11136 }
11137 EOCP
11138 set try
11139 if eval $compile_ok; then
11140         $run ./try
11141         castflags=$?
11142 else
11143         echo "(I can't seem to compile the test program--assuming it can't)"
11144         castflags=7
11145 fi
11146 case "$castflags" in
11147 0)      val="$define"
11148         echo "Yup, it can."
11149         ;;
11150 *)      val="$undef"
11151         echo "Nope, it can't."
11152         ;;
11153 esac
11154 set d_castneg
11155 eval $setvar
11156 $rm_try
11157
11158 : see if vprintf exists
11159 echo " "
11160 if set vprintf val -f d_vprintf; eval $csym; $val; then
11161         echo 'vprintf() found.' >&4
11162         val="$define"
11163         $cat >try.c <<EOF
11164 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11165 #$i_varargs I_VARARGS
11166
11167 #$i_stdlib I_STDLIB
11168 #$i_unistd I_UNISTD
11169
11170 #ifdef I_STDARG
11171 #  include <stdarg.h>
11172 #else /* I_VARARGS */
11173 #  include <varargs.h>
11174 #endif
11175
11176 #ifdef I_UNISTD
11177 #  include <unistd.h>
11178 #endif
11179
11180 #ifdef I_STDLIB
11181 #  include <stdlib.h>
11182 #endif
11183
11184 #include <stdio.h> /* vsprintf prototype */
11185
11186 #ifdef I_STDARG
11187 void xxx(int n, ...)
11188 {
11189     va_list args;
11190     char buf[10];
11191     va_start(args, n);
11192     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11193 }
11194 int main() { xxx(1, "foo"); }
11195
11196 #else /* I_VARARGS */
11197
11198 xxx(va_alist)
11199 va_dcl
11200 {
11201     va_list args;
11202     char buf[10];
11203     va_start(args);
11204     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11205 }
11206 int main() { xxx("foo"); }
11207
11208 #endif
11209
11210 EOF
11211         set try
11212         if eval $compile_ok; then
11213                 if $run ./try; then
11214                         echo "Your vsprintf() returns (int)." >&4
11215                         val2="$undef"
11216                 else
11217                         echo "Your vsprintf() returns (char*)." >&4
11218                         val2="$define"
11219                 fi
11220         else
11221                 echo 'I am unable to compile the vsprintf() test program.' >&4
11222                 # We shouldn't get here.  If we do, assume the standard signature,
11223                 # not the old BSD one.
11224                 echo 'Guessing that vsprintf() returns (int).' >&4
11225                 val2="$undef"
11226         fi
11227 else
11228         echo 'vprintf() NOT found.' >&4
11229         val="$undef"
11230         val2="$undef"
11231 fi
11232 $rm_try
11233 set d_vprintf
11234 eval $setvar
11235 val=$val2
11236 set d_charvspr
11237 eval $setvar
11238
11239 : see if chown exists
11240 set chown d_chown
11241 eval $inlibc
11242
11243 : see if chroot exists
11244 set chroot d_chroot
11245 eval $inlibc
11246
11247 : see if chsize exists
11248 set chsize d_chsize
11249 eval $inlibc
11250
11251 : see if class exists
11252 set class d_class
11253 eval $inlibc
11254
11255 : see if clearenv exists
11256 set clearenv d_clearenv
11257 eval $inlibc
11258
11259 : Define hasstruct macro for Configure internal use
11260 hasstruct='varname=$1; struct=$2; shift; shift;
11261 while $test $# -ge 2; do
11262         case "$1" in
11263         $define) echo "#include <$2>";;
11264         esac ;
11265     shift 2;
11266 done > try.c;
11267 echo "int main () { struct $struct foo; }" >> try.c;
11268 set try;
11269 if eval $compile; then
11270         val="$define";
11271 else
11272         val="$undef";
11273 fi;
11274 set $varname;
11275 eval $setvar;
11276 $rm_try'
11277
11278 : see whether socket exists
11279 socketlib=''
11280 sockethdr=''
11281 echo " "
11282 $echo $n "Hmm... $c" >&4
11283 if set socket val -f d_socket; eval $csym; $val; then
11284         echo "Looks like you have Berkeley networking support." >&4
11285         d_socket="$define"
11286         if set setsockopt val -f; eval $csym; $val; then
11287                 d_oldsock="$undef"
11288         else
11289                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11290                 d_oldsock="$define"
11291         fi
11292 else
11293         if $contains socklib libc.list >/dev/null 2>&1; then
11294                 echo "Looks like you have Berkeley networking support." >&4
11295                 d_socket="$define"
11296                 : we will have to assume that it supports the 4.2 BSD interface
11297                 d_oldsock="$undef"
11298         else
11299                 echo "You don't have Berkeley networking in libc$_a..." >&4
11300                 if test "X$d_socket" = "X$define"; then
11301                    echo "...but you seem to believe that you have sockets." >&4
11302                 else
11303                         for net in net socket
11304                         do
11305                                 if test -f /usr/lib/lib$net$_a; then
11306                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11307                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11308                                         if $contains socket libc.list >/dev/null 2>&1; then
11309                                                 d_socket="$define"
11310                                                 socketlib="-l$net"
11311                                                 case "$net" in
11312                                                 net)
11313                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11314                                                         sockethdr="-I/usr/netinclude"
11315                                                         ;;
11316                                                 esac
11317                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11318                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11319                                                         d_oldsock="$undef"
11320                                                 else
11321                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11322                                                         d_oldsock="$define"
11323                                                 fi
11324                                                 break
11325                                         fi
11326                                 fi
11327                         done
11328                         if test "X$d_socket" != "X$define"; then
11329                            echo "or anywhere else I see." >&4
11330                            d_socket="$undef"
11331                            d_oldsock="$undef"
11332                         fi
11333                 fi
11334         fi
11335 fi
11336
11337 : see if socketpair exists
11338 set socketpair d_sockpair
11339 eval $inlibc
11340
11341
11342 echo " "
11343 echo "Checking the availability of certain socket constants..." >&4
11344 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11345         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11346         $cat >try.c <<EOF
11347 #include <sys/types.h>
11348 #include <sys/socket.h>
11349 int main() {
11350     int i = $ENUM;
11351 }
11352 EOF
11353         val="$undef"
11354         set try; if eval $compile; then
11355                 val="$define"
11356         fi
11357         set d_${enum}; eval $setvar
11358         $rm_try
11359 done
11360
11361 : see if this is a sys/uio.h system
11362 set sys/uio.h i_sysuio
11363 eval $inhdr
11364
11365 : Check for cmsghdr support
11366 echo " "
11367 echo "Checking to see if your system supports struct cmsghdr..." >&4
11368 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11369 eval $hasstruct
11370 case "$d_cmsghdr_s" in
11371 "$define")      echo "Yes, it does."   ;;
11372 *)              echo "No, it doesn't." ;;
11373 esac
11374
11375
11376 : check for const keyword
11377 echo " "
11378 echo 'Checking to see if your C compiler knows about "const"...' >&4
11379 $cat >const.c <<'EOCP'
11380 typedef struct spug { int drokk; } spug;
11381 int main()
11382 {
11383         const char *foo;
11384         const spug y = { 0 };
11385 }
11386 EOCP
11387 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11388         val="$define"
11389         echo "Yup, it does."
11390 else
11391         val="$undef"
11392         echo "Nope, it doesn't."
11393 fi
11394 set d_const
11395 eval $setvar
11396
11397 : see if copysignl exists
11398 set copysignl d_copysignl
11399 eval $inlibc
11400
11401 : see if crypt exists
11402 echo " "
11403 set crypt d_crypt
11404 eval $inlibc
11405 case "$d_crypt" in
11406 $define) cryptlib='' ;;
11407 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11408                 echo 'crypt() found.' >&4
11409                 val="$define"
11410                 cryptlib=''
11411         else
11412                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11413                 if $test -z "$cryptlib"; then
11414                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11415                 else
11416                         cryptlib=-lcrypt
11417                 fi
11418                 if $test -z "$cryptlib"; then
11419                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11420                 else
11421                         cryptlib=-lcrypt
11422                 fi
11423                 if $test -z "$cryptlib"; then
11424                         cryptlib=`./loc libcrypt$_a "" $libpth`
11425                 else
11426                         cryptlib=-lcrypt
11427                 fi
11428                 if $test -z "$cryptlib"; then
11429                         echo 'crypt() NOT found.' >&4
11430                         val="$undef"
11431                 else
11432                         val="$define"
11433                 fi
11434         fi
11435         set d_crypt
11436         eval $setvar
11437         ;;
11438 esac
11439
11440 : see if this is a crypt.h system
11441 set crypt.h i_crypt
11442 eval $inhdr
11443
11444 : see if crypt_r exists
11445 set crypt_r d_crypt_r
11446 eval $inlibc
11447 case "$d_crypt_r" in
11448 "$define")
11449         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11450         case "$d_crypt_r_proto:$usethreads" in
11451         ":define")      d_crypt_r_proto=define
11452                 set d_crypt_r_proto crypt_r $hdrs
11453                 eval $hasproto ;;
11454         *)      ;;
11455         esac
11456         case "$d_crypt_r_proto" in
11457         define)
11458         case "$crypt_r_proto" in
11459         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11460         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11461         esac
11462         case "$crypt_r_proto" in
11463         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11464         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11465         esac
11466         case "$crypt_r_proto" in
11467         ''|0)   d_crypt_r=undef
11468                 crypt_r_proto=0
11469                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11470         * )     case "$crypt_r_proto" in
11471                 REENTRANT_PROTO*) ;;
11472                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11473                 esac
11474                 echo "Prototype: $try" ;;
11475         esac
11476         ;;
11477         *)      case "$usethreads" in
11478                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11479                 esac
11480                 d_crypt_r=undef
11481                 crypt_r_proto=0
11482                 ;;
11483         esac
11484         ;;
11485 *)      crypt_r_proto=0
11486         ;;
11487 esac
11488
11489 : get csh whereabouts
11490 case "$csh" in
11491 'csh') val="$undef" ;;
11492 *) val="$define" ;;
11493 esac
11494 set d_csh
11495 eval $setvar
11496 : Respect a hint or command line value for full_csh.
11497 case "$full_csh" in
11498 '') full_csh=$csh ;;
11499 esac
11500
11501 : see if ctermid exists
11502 set ctermid d_ctermid
11503 eval $inlibc
11504
11505 : see if ctermid_r exists
11506 set ctermid_r d_ctermid_r
11507 eval $inlibc
11508 case "$d_ctermid_r" in
11509 "$define")
11510         hdrs="$i_systypes sys/types.h define stdio.h "
11511         case "$d_ctermid_r_proto:$usethreads" in
11512         ":define")      d_ctermid_r_proto=define
11513                 set d_ctermid_r_proto ctermid_r $hdrs
11514                 eval $hasproto ;;
11515         *)      ;;
11516         esac
11517         case "$d_ctermid_r_proto" in
11518         define)
11519         case "$ctermid_r_proto" in
11520         ''|0) try='char* ctermid_r(char*);'
11521         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11522         esac
11523         case "$ctermid_r_proto" in
11524         ''|0)   d_ctermid_r=undef
11525                 ctermid_r_proto=0
11526                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11527         * )     case "$ctermid_r_proto" in
11528                 REENTRANT_PROTO*) ;;
11529                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11530                 esac
11531                 echo "Prototype: $try" ;;
11532         esac
11533         ;;
11534         *)      case "$usethreads" in
11535                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11536                 esac
11537                 d_ctermid_r=undef
11538                 ctermid_r_proto=0
11539                 ;;
11540         esac
11541         ;;
11542 *)      ctermid_r_proto=0
11543         ;;
11544 esac
11545
11546 : see if ctime_r exists
11547 set ctime_r d_ctime_r
11548 eval $inlibc
11549 case "$d_ctime_r" in
11550 "$define")
11551         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11552         case "$d_ctime_r_proto:$usethreads" in
11553         ":define")      d_ctime_r_proto=define
11554                 set d_ctime_r_proto ctime_r $hdrs
11555                 eval $hasproto ;;
11556         *)      ;;
11557         esac
11558         case "$d_ctime_r_proto" in
11559         define)
11560         case "$ctime_r_proto" in
11561         ''|0) try='char* ctime_r(const time_t*, char*);'
11562         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11563         esac
11564         case "$ctime_r_proto" in
11565         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11566         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11567         esac
11568         case "$ctime_r_proto" in
11569         ''|0) try='int ctime_r(const time_t*, char*);'
11570         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11571         esac
11572         case "$ctime_r_proto" in
11573         ''|0) try='int ctime_r(const time_t*, char*, int);'
11574         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11575         esac
11576         case "$ctime_r_proto" in
11577         ''|0)   d_ctime_r=undef
11578                 ctime_r_proto=0
11579                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11580         * )     case "$ctime_r_proto" in
11581                 REENTRANT_PROTO*) ;;
11582                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11583                 esac
11584                 echo "Prototype: $try" ;;
11585         esac
11586         ;;
11587         *)      case "$usethreads" in
11588                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11589                 esac
11590                 d_ctime_r=undef
11591                 ctime_r_proto=0
11592                 ;;
11593         esac
11594         ;;
11595 *)      ctime_r_proto=0
11596         ;;
11597 esac
11598
11599 : see if cuserid exists
11600 set cuserid d_cuserid
11601 eval $inlibc
11602
11603 : see if this is a limits.h system
11604 set limits.h i_limits
11605 eval $inhdr
11606
11607 : see if this is a float.h system
11608 set float.h i_float
11609 eval $inhdr
11610
11611 : See if number of significant digits in a double precision number is known
11612 echo " "
11613 $cat >dbl_dig.c <<EOM
11614 #$i_limits I_LIMITS
11615 #$i_float I_FLOAT
11616 #ifdef I_LIMITS
11617 #include <limits.h>
11618 #endif
11619 #ifdef I_FLOAT
11620 #include <float.h>
11621 #endif
11622 #ifdef DBL_DIG
11623 printf("Contains DBL_DIG");
11624 #endif
11625 EOM
11626 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11627 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11628         echo "DBL_DIG found." >&4
11629         val="$define"
11630 else
11631         echo "DBL_DIG NOT found." >&4
11632         val="$undef"
11633 fi
11634 $rm -f dbl_dig.?
11635 set d_dbl_dig
11636 eval $setvar
11637
11638 : see if dbm.h is available
11639 : see if dbmclose exists
11640 set dbmclose d_dbmclose
11641 eval $inlibc
11642
11643 case "$d_dbmclose" in
11644 $define)
11645         set dbm.h i_dbm
11646         eval $inhdr
11647         case "$i_dbm" in
11648         $define)
11649                 val="$undef"
11650                 set i_rpcsvcdbm
11651                 eval $setvar
11652                 ;;
11653         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11654                 eval $inhdr
11655                 ;;
11656         esac
11657         ;;
11658 *)      echo "We won't be including <dbm.h>"
11659         val="$undef"
11660         set i_dbm
11661         eval $setvar
11662         val="$undef"
11663         set i_rpcsvcdbm
11664         eval $setvar
11665         ;;
11666 esac
11667
11668 : see if prototype for dbminit is available
11669 echo " "
11670 set d_dbminitproto dbminit $i_dbm dbm.h
11671 eval $hasproto
11672
11673 : see if difftime exists
11674 set difftime d_difftime
11675 eval $inlibc
11676
11677 : see if this is a dirent system
11678 echo " "
11679 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11680         val="$define"
11681         echo "<dirent.h> found." >&4
11682 else
11683         val="$undef"
11684         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11685                 echo "<sys/dir.h> found." >&4
11686                 echo " "
11687         else
11688                 xinc=`./findhdr sys/ndir.h`
11689         fi
11690         echo "<dirent.h> NOT found." >&4
11691 fi
11692 set i_dirent
11693 eval $setvar
11694
11695 : Look for type of directory structure.
11696 echo " "
11697 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11698
11699 case "$direntrytype" in
11700 ''|' ')
11701         case "$i_dirent" in
11702         $define) guess1='struct dirent' ;;
11703         *) guess1='struct direct'  ;;
11704         esac
11705         ;;
11706 *)      guess1="$direntrytype"
11707         ;;
11708 esac
11709
11710 case "$guess1" in
11711 'struct dirent') guess2='struct direct' ;;
11712 *) guess2='struct dirent' ;;
11713 esac
11714
11715 if $contains "$guess1" try.c >/dev/null 2>&1; then
11716         direntrytype="$guess1"
11717         echo "Your directory entries are $direntrytype." >&4
11718 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11719         direntrytype="$guess2"
11720         echo "Your directory entries seem to be $direntrytype." >&4
11721 else
11722         echo "I don't recognize your system's directory entries." >&4
11723         rp="What type is used for directory entries on this system?"
11724         dflt="$guess1"
11725         . ./myread
11726         direntrytype="$ans"
11727 fi
11728 $rm_try
11729
11730 : see if the directory entry stores field length
11731 echo " "
11732 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11733 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11734         echo "Good, your directory entry keeps length information in d_namlen." >&4
11735         val="$define"
11736 else
11737         echo "Your directory entry does not know about the d_namlen field." >&4
11738         val="$undef"
11739 fi
11740 set d_dirnamlen
11741 eval $setvar
11742 $rm_try
11743
11744 : Look for DIR.dd_fd
11745 case "$i_dirent" in
11746 "$define")
11747     echo "Checking to see if DIR has a dd_fd member variable" >&4
11748     $cat >try.c <<EOCP
11749 #$i_stdlib I_STDLIB
11750 #ifdef I_STDLIB
11751 #include <stdlib.h>
11752 #endif
11753 #include <dirent.h>
11754
11755 int main() {
11756     DIR dir;
11757     dir.dd_fd = 1;
11758     return 0;
11759 }
11760 EOCP
11761     val=$undef
11762     set try
11763     if eval $compile; then
11764         echo "Yes, it does."
11765         val="$define"
11766     else
11767         echo "No, it does not."
11768         val="$undef"
11769     fi
11770     ;;
11771 *)
11772     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11773     val="$undef"
11774     ;;
11775 esac
11776 set d_dir_dd_fd
11777 eval $setvar
11778 $rm_try
11779
11780 : see if this is an sysdir system
11781 set sys/dir.h i_sysdir
11782 eval $inhdr
11783
11784 : see if this is an sysndir system
11785 set sys/ndir.h i_sysndir
11786 eval $inhdr
11787
11788 : Look for dirfd
11789 echo " "
11790 $cat >dirfd.c <<EOM
11791 #include <stdio.h>
11792 #$i_stdlib I_STDLIB
11793 #ifdef I_STDLIB
11794 #include <stdlib.h>
11795 #endif
11796 #$i_dirent I_DIRENT             /**/
11797 #$i_sysdir I_SYS_DIR            /**/
11798 #$i_sysndir I_SYS_NDIR          /**/
11799 #$i_systypes I_SYS_TYPES        /**/
11800 #if defined(I_SYS_TYPES)
11801 #include <sys/types.h>
11802 #endif
11803 #if defined(I_DIRENT)
11804 #include <dirent.h>
11805 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11806 #include <sys/dir.h>
11807 #endif
11808 #else
11809 #ifdef I_SYS_NDIR
11810 #include <sys/ndir.h>
11811 #else
11812 #ifdef I_SYS_DIR
11813 #ifdef hp9000s500
11814 #include <ndir.h>       /* may be wrong in the future */
11815 #else
11816 #include <sys/dir.h>
11817 #endif
11818 #endif
11819 #endif
11820 #endif 
11821 int main() {
11822         DIR *dirp = opendir(".");
11823         if (dirfd(dirp) >= 0)
11824                 exit(0);
11825         else
11826                 exit(1);
11827 }
11828 EOM
11829 val=$undef
11830 set dirfd
11831 if eval $compile; then
11832         val="$define"
11833 fi
11834 case "$val" in
11835 $define)        echo "dirfd() found." >&4       ;;
11836 *)              echo "dirfd() NOT found." >&4   ;;
11837 esac
11838 set d_dirfd
11839 eval $setvar
11840 $rm -f dirfd*
11841
11842 : see if dlerror exists
11843 xxx_runnm="$runnm"
11844 runnm=false
11845 set dlerror d_dlerror
11846 eval $inlibc
11847 runnm="$xxx_runnm"
11848
11849 : see if dlfcn is available
11850 set dlfcn.h i_dlfcn
11851 eval $inhdr
11852
11853 : Check what extension to use for shared libs
11854 case "$usedl" in
11855 $define|y|true)
11856         $cat << EOM
11857
11858 On a few systems, the dynamically loaded modules that perl generates and uses
11859 will need a different extension than shared libs. The default will probably
11860 be appropriate.
11861
11862 EOM
11863         case "$dlext" in
11864         '')     dflt="$so" ;;
11865         *)      dflt="$dlext" ;;
11866         esac
11867         rp='What is the extension of dynamically loaded modules'
11868         . ./myread
11869         dlext="$ans"
11870         ;;
11871 *)
11872         dlext="none"
11873         ;;
11874 esac
11875
11876 : Check if dlsym need a leading underscore
11877 echo " "
11878 val="$undef"
11879
11880 case "$dlsrc" in
11881 dl_dlopen.xs)
11882         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11883         $cat >dyna.c <<'EOM'
11884 fred () { }
11885 EOM
11886
11887 $cat >fred.c<<EOM
11888
11889 #include <stdio.h>
11890 #$i_stdlib I_STDLIB
11891 #ifdef I_STDLIB
11892 #include <stdlib.h>
11893 #endif
11894 #$i_dlfcn I_DLFCN
11895 #ifdef I_DLFCN
11896 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11897 #else
11898 #include <sys/types.h>
11899 #include <nlist.h>
11900 #include <link.h>
11901 #endif
11902
11903 extern int fred() ;
11904
11905 int main()
11906 {
11907     void * handle ;
11908     void * symbol ;
11909 #ifndef RTLD_LAZY
11910     int mode = 1 ;
11911 #else
11912     int mode = RTLD_LAZY ;
11913 #endif
11914     handle = dlopen("./dyna.$dlext", mode) ;
11915     if (handle == NULL) {
11916         printf ("1\n") ;
11917         fflush (stdout) ;
11918         exit(0);
11919     }
11920     symbol = dlsym(handle, "fred") ;
11921     if (symbol == NULL) {
11922         /* try putting a leading underscore */
11923         symbol = dlsym(handle, "_fred") ;
11924         if (symbol == NULL) {
11925             printf ("2\n") ;
11926             fflush (stdout) ;
11927             exit(0);
11928         }
11929         printf ("3\n") ;
11930     }
11931     else
11932         printf ("4\n") ;
11933     fflush (stdout) ;
11934     exit(0);
11935 }
11936 EOM
11937         : Call the object file tmp-dyna.o in case dlext=o.
11938         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11939                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11940                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11941                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11942                 xxx=`$run ./fred`
11943                 case $xxx in
11944                 1)      echo "Test program failed using dlopen." >&4
11945                         echo "Perhaps you should not use dynamic loading." >&4;;
11946                 2)      echo "Test program failed using dlsym." >&4
11947                         echo "Perhaps you should not use dynamic loading." >&4;;
11948                 3)      echo "dlsym needs a leading underscore" >&4
11949                         val="$define" ;;
11950                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11951                 esac
11952         else
11953                 echo "I can't compile and run the test program." >&4
11954                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11955         fi
11956         ;;
11957 esac
11958
11959 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11960
11961 set d_dlsymun
11962 eval $setvar
11963
11964 : see if drand48_r exists
11965 set drand48_r d_drand48_r
11966 eval $inlibc
11967 case "$d_drand48_r" in
11968 "$define")
11969         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11970         case "$d_drand48_r_proto:$usethreads" in
11971         ":define")      d_drand48_r_proto=define
11972                 set d_drand48_r_proto drand48_r $hdrs
11973                 eval $hasproto ;;
11974         *)      ;;
11975         esac
11976         case "$d_drand48_r_proto" in
11977         define)
11978         case "$drand48_r_proto" in
11979         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11980         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11981         esac
11982         case "$drand48_r_proto" in
11983         ''|0)   d_drand48_r=undef
11984                 drand48_r_proto=0
11985                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11986         * )     case "$drand48_r_proto" in
11987                 REENTRANT_PROTO*) ;;
11988                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11989                 esac
11990                 echo "Prototype: $try" ;;
11991         esac
11992         ;;
11993         *)      case "$usethreads" in
11994                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11995                 esac
11996                 d_drand48_r=undef
11997                 drand48_r_proto=0
11998                 ;;
11999         esac
12000         ;;
12001 *)      drand48_r_proto=0
12002         ;;
12003 esac
12004
12005 : see if prototype for drand48 is available
12006 echo " "
12007 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12008 eval $hasproto
12009
12010 : see if dup2 exists
12011 set dup2 d_dup2
12012 eval $inlibc
12013
12014 : see if eaccess exists
12015 set eaccess d_eaccess
12016 eval $inlibc
12017
12018 : see if endgrent exists
12019 set endgrent d_endgrent
12020 eval $inlibc
12021
12022 : see if this is an grp system
12023 set grp.h i_grp
12024 eval $inhdr
12025
12026 case "$i_grp" in
12027 $define)
12028         xxx=`./findhdr grp.h`
12029         $cppstdin $cppflags $cppminus < $xxx >$$.h
12030
12031         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12032                 val="$define"
12033         else
12034                 val="$undef"
12035         fi
12036         set d_grpasswd
12037         eval $setvar
12038
12039         $rm -f $$.h
12040         ;;
12041 *)
12042         val="$undef";
12043         set d_grpasswd; eval $setvar
12044         ;;
12045 esac
12046
12047 : see if endgrent_r exists
12048 set endgrent_r d_endgrent_r
12049 eval $inlibc
12050 case "$d_endgrent_r" in
12051 "$define")
12052         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12053         case "$d_endgrent_r_proto:$usethreads" in
12054         ":define")      d_endgrent_r_proto=define
12055                 set d_endgrent_r_proto endgrent_r $hdrs
12056                 eval $hasproto ;;
12057         *)      ;;
12058         esac
12059         case "$d_endgrent_r_proto" in
12060         define)
12061         case "$endgrent_r_proto" in
12062         ''|0) try='int endgrent_r(FILE**);'
12063         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12064         esac
12065         case "$endgrent_r_proto" in
12066         ''|0) try='void endgrent_r(FILE**);'
12067         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12068         esac
12069         case "$endgrent_r_proto" in
12070         ''|0)   d_endgrent_r=undef
12071                 endgrent_r_proto=0
12072                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12073         * )     case "$endgrent_r_proto" in
12074                 REENTRANT_PROTO*) ;;
12075                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12076                 esac
12077                 echo "Prototype: $try" ;;
12078         esac
12079         ;;
12080         *)      case "$usethreads" in
12081                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12082                 esac
12083                 d_endgrent_r=undef
12084                 endgrent_r_proto=0
12085                 ;;
12086         esac
12087         ;;
12088 *)      endgrent_r_proto=0
12089         ;;
12090 esac
12091
12092 : see if endhostent exists
12093 set endhostent d_endhent
12094 eval $inlibc
12095
12096 : see if this is a netdb.h system
12097 set netdb.h i_netdb
12098 eval $inhdr
12099
12100 : see if endhostent_r exists
12101 set endhostent_r d_endhostent_r
12102 eval $inlibc
12103 case "$d_endhostent_r" in
12104 "$define")
12105         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12106         case "$d_endhostent_r_proto:$usethreads" in
12107         ":define")      d_endhostent_r_proto=define
12108                 set d_endhostent_r_proto endhostent_r $hdrs
12109                 eval $hasproto ;;
12110         *)      ;;
12111         esac
12112         case "$d_endhostent_r_proto" in
12113         define)
12114         case "$endhostent_r_proto" in
12115         ''|0) try='int endhostent_r(struct hostent_data*);'
12116         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12117         esac
12118         case "$endhostent_r_proto" in
12119         ''|0) try='void endhostent_r(struct hostent_data*);'
12120         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12121         esac
12122         case "$endhostent_r_proto" in
12123         ''|0)   d_endhostent_r=undef
12124                 endhostent_r_proto=0
12125                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12126         * )     case "$endhostent_r_proto" in
12127                 REENTRANT_PROTO*) ;;
12128                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12129                 esac
12130                 echo "Prototype: $try" ;;
12131         esac
12132         ;;
12133         *)      case "$usethreads" in
12134                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12135                 esac
12136                 d_endhostent_r=undef
12137                 endhostent_r_proto=0
12138                 ;;
12139         esac
12140         ;;
12141 *)      endhostent_r_proto=0
12142         ;;
12143 esac
12144
12145 : see if endnetent exists
12146 set endnetent d_endnent
12147 eval $inlibc
12148
12149 : see if endnetent_r exists
12150 set endnetent_r d_endnetent_r
12151 eval $inlibc
12152 case "$d_endnetent_r" in
12153 "$define")
12154         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12155         case "$d_endnetent_r_proto:$usethreads" in
12156         ":define")      d_endnetent_r_proto=define
12157                 set d_endnetent_r_proto endnetent_r $hdrs
12158                 eval $hasproto ;;
12159         *)      ;;
12160         esac
12161         case "$d_endnetent_r_proto" in
12162         define)
12163         case "$endnetent_r_proto" in
12164         ''|0) try='int endnetent_r(struct netent_data*);'
12165         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12166         esac
12167         case "$endnetent_r_proto" in
12168         ''|0) try='void endnetent_r(struct netent_data*);'
12169         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12170         esac
12171         case "$endnetent_r_proto" in
12172         ''|0)   d_endnetent_r=undef
12173                 endnetent_r_proto=0
12174                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12175         * )     case "$endnetent_r_proto" in
12176                 REENTRANT_PROTO*) ;;
12177                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12178                 esac
12179                 echo "Prototype: $try" ;;
12180         esac
12181         ;;
12182         *)      case "$usethreads" in
12183                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12184                 esac
12185                 d_endnetent_r=undef
12186                 endnetent_r_proto=0
12187                 ;;
12188         esac
12189         ;;
12190 *)      endnetent_r_proto=0
12191         ;;
12192 esac
12193
12194 : see if endprotoent exists
12195 set endprotoent d_endpent
12196 eval $inlibc
12197
12198 : see if endprotoent_r exists
12199 set endprotoent_r d_endprotoent_r
12200 eval $inlibc
12201 case "$d_endprotoent_r" in
12202 "$define")
12203         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12204         case "$d_endprotoent_r_proto:$usethreads" in
12205         ":define")      d_endprotoent_r_proto=define
12206                 set d_endprotoent_r_proto endprotoent_r $hdrs
12207                 eval $hasproto ;;
12208         *)      ;;
12209         esac
12210         case "$d_endprotoent_r_proto" in
12211         define)
12212         case "$endprotoent_r_proto" in
12213         ''|0) try='int endprotoent_r(struct protoent_data*);'
12214         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12215         esac
12216         case "$endprotoent_r_proto" in
12217         ''|0) try='void endprotoent_r(struct protoent_data*);'
12218         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12219         esac
12220         case "$endprotoent_r_proto" in
12221         ''|0)   d_endprotoent_r=undef
12222                 endprotoent_r_proto=0
12223                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12224         * )     case "$endprotoent_r_proto" in
12225                 REENTRANT_PROTO*) ;;
12226                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12227                 esac
12228                 echo "Prototype: $try" ;;
12229         esac
12230         ;;
12231         *)      case "$usethreads" in
12232                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12233                 esac
12234                 d_endprotoent_r=undef
12235                 endprotoent_r_proto=0
12236                 ;;
12237         esac
12238         ;;
12239 *)      endprotoent_r_proto=0
12240         ;;
12241 esac
12242
12243 : see if endpwent exists
12244 set endpwent d_endpwent
12245 eval $inlibc
12246
12247 : see if this is a pwd.h system
12248 set pwd.h i_pwd
12249 eval $inhdr
12250
12251 case "$i_pwd" in
12252 $define)
12253         xxx=`./findhdr pwd.h`
12254         $cppstdin $cppflags $cppminus < $xxx >$$.h
12255
12256         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12257                 val="$define"
12258         else
12259                 val="$undef"
12260         fi
12261         set d_pwquota
12262         eval $setvar
12263
12264         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12265                 val="$define"
12266         else
12267                 val="$undef"
12268         fi
12269         set d_pwage
12270         eval $setvar
12271
12272         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12273                 val="$define"
12274         else
12275                 val="$undef"
12276         fi
12277         set d_pwchange
12278         eval $setvar
12279
12280         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12281                 val="$define"
12282         else
12283                 val="$undef"
12284         fi
12285         set d_pwclass
12286         eval $setvar
12287
12288         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12289                 val="$define"
12290         else
12291                 val="$undef"
12292         fi
12293         set d_pwexpire
12294         eval $setvar
12295
12296         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12297                 val="$define"
12298         else
12299                 val="$undef"
12300         fi
12301         set d_pwcomment
12302         eval $setvar
12303
12304         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12305                 val="$define"
12306         else
12307                 val="$undef"
12308         fi
12309         set d_pwgecos
12310         eval $setvar
12311
12312         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12313                 val="$define"
12314         else
12315                 val="$undef"
12316         fi
12317         set d_pwpasswd
12318         eval $setvar
12319
12320         $rm -f $$.h
12321         ;;
12322 *)
12323         val="$undef"; 
12324         set d_pwquota; eval $setvar
12325         set d_pwage; eval $setvar
12326         set d_pwchange; eval $setvar
12327         set d_pwclass; eval $setvar
12328         set d_pwexpire; eval $setvar
12329         set d_pwcomment; eval $setvar
12330         set d_pwgecos; eval $setvar
12331         set d_pwpasswd; eval $setvar
12332         ;;
12333 esac
12334
12335 : see if endpwent_r exists
12336 set endpwent_r d_endpwent_r
12337 eval $inlibc
12338 case "$d_endpwent_r" in
12339 "$define")
12340         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12341         case "$d_endpwent_r_proto:$usethreads" in
12342         ":define")      d_endpwent_r_proto=define
12343                 set d_endpwent_r_proto endpwent_r $hdrs
12344                 eval $hasproto ;;
12345         *)      ;;
12346         esac
12347         case "$d_endpwent_r_proto" in
12348         define)
12349         case "$endpwent_r_proto" in
12350         ''|0) try='int endpwent_r(FILE**);'
12351         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12352         esac
12353         case "$endpwent_r_proto" in
12354         ''|0) try='void endpwent_r(FILE**);'
12355         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12356         esac
12357         case "$endpwent_r_proto" in
12358         ''|0)   d_endpwent_r=undef
12359                 endpwent_r_proto=0
12360                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12361         * )     case "$endpwent_r_proto" in
12362                 REENTRANT_PROTO*) ;;
12363                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12364                 esac
12365                 echo "Prototype: $try" ;;
12366         esac
12367         ;;
12368         *)      case "$usethreads" in
12369                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12370                 esac
12371                 d_endpwent_r=undef
12372                 endpwent_r_proto=0
12373                 ;;
12374         esac
12375         ;;
12376 *)      endpwent_r_proto=0
12377         ;;
12378 esac
12379
12380 : see if endservent exists
12381 set endservent d_endsent
12382 eval $inlibc
12383
12384 : see if endservent_r exists
12385 set endservent_r d_endservent_r
12386 eval $inlibc
12387 case "$d_endservent_r" in
12388 "$define")
12389         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12390         case "$d_endservent_r_proto:$usethreads" in
12391         ":define")      d_endservent_r_proto=define
12392                 set d_endservent_r_proto endservent_r $hdrs
12393                 eval $hasproto ;;
12394         *)      ;;
12395         esac
12396         case "$d_endservent_r_proto" in
12397         define)
12398         case "$endservent_r_proto" in
12399         ''|0) try='int endservent_r(struct servent_data*);'
12400         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12401         esac
12402         case "$endservent_r_proto" in
12403         ''|0) try='void endservent_r(struct servent_data*);'
12404         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12405         esac
12406         case "$endservent_r_proto" in
12407         ''|0)   d_endservent_r=undef
12408                 endservent_r_proto=0
12409                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12410         * )     case "$endservent_r_proto" in
12411                 REENTRANT_PROTO*) ;;
12412                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12413                 esac
12414                 echo "Prototype: $try" ;;
12415         esac
12416         ;;
12417         *)      case "$usethreads" in
12418                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12419                 esac
12420                 d_endservent_r=undef
12421                 endservent_r_proto=0
12422                 ;;
12423         esac
12424         ;;
12425 *)      endservent_r_proto=0
12426         ;;
12427 esac
12428
12429 : Locate the flags for 'open()'
12430 echo " "
12431 $cat >try.c <<EOCP
12432 #include <sys/types.h>
12433 #ifdef I_FCNTL
12434 #include <fcntl.h>
12435 #endif
12436 #ifdef I_SYS_FILE
12437 #include <sys/file.h>
12438 #endif
12439 #$i_stdlib I_STDLIB
12440 #ifdef I_STDLIB
12441 #include <stdlib.h>
12442 #endif
12443 int main() {
12444         if(O_RDONLY);
12445 #ifdef O_TRUNC
12446         exit(0);
12447 #else
12448         exit(1);
12449 #endif
12450 }
12451 EOCP
12452 : check sys/file.h first to get FREAD on Sun
12453 if $test `./findhdr sys/file.h` && \
12454                 set try -DI_SYS_FILE && eval $compile; then
12455         h_sysfile=true;
12456         echo "<sys/file.h> defines the O_* constants..." >&4
12457         if $run ./try; then
12458                 echo "and you have the 3 argument form of open()." >&4
12459                 val="$define"
12460         else
12461                 echo "but not the 3 argument form of open().  Oh, well." >&4
12462                 val="$undef"
12463         fi
12464 elif $test `./findhdr fcntl.h` && \
12465                 set try -DI_FCNTL && eval $compile; then
12466         h_fcntl=true;
12467         echo "<fcntl.h> defines the O_* constants..." >&4
12468         if $run ./try; then
12469                 echo "and you have the 3 argument form of open()." >&4
12470                 val="$define"
12471         else
12472                 echo "but not the 3 argument form of open().  Oh, well." >&4
12473                 val="$undef"
12474         fi
12475 else
12476         val="$undef"
12477         echo "I can't find the O_* constant definitions!  You got problems." >&4
12478 fi
12479 set d_open3
12480 eval $setvar
12481 $rm_try
12482
12483 : see if this is a sys/file.h system
12484 val=''
12485 set sys/file.h val
12486 eval $inhdr
12487
12488 : do we need to include sys/file.h ?
12489 case "$val" in
12490 "$define")
12491         echo " "
12492         if $h_sysfile; then
12493                 val="$define"
12494                 echo "We'll be including <sys/file.h>." >&4
12495         else
12496                 val="$undef"
12497                 echo "We won't be including <sys/file.h>." >&4
12498         fi
12499         ;;
12500 *)
12501         h_sysfile=false
12502         ;;
12503 esac
12504 set i_sysfile
12505 eval $setvar
12506
12507 : see if fcntl.h is there
12508 val=''
12509 set fcntl.h val
12510 eval $inhdr
12511
12512 : see if we can include fcntl.h
12513 case "$val" in
12514 "$define")
12515         echo " "
12516         if $h_fcntl; then
12517                 val="$define"
12518                 echo "We'll be including <fcntl.h>." >&4
12519         else
12520                 val="$undef"
12521                 if $h_sysfile; then
12522         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12523                 else
12524                         echo "We won't be including <fcntl.h>." >&4
12525                 fi
12526         fi
12527         ;;
12528 *)
12529         h_fcntl=false
12530         val="$undef"
12531         ;;
12532 esac
12533 set i_fcntl
12534 eval $setvar
12535
12536 : see if fork exists
12537 set fork d_fork
12538 eval $inlibc
12539
12540 : see if pipe exists
12541 set pipe d_pipe
12542 eval $inlibc
12543
12544 : check for non-blocking I/O stuff
12545 case "$h_sysfile" in
12546 true) echo "#include <sys/file.h>" > head.c;;
12547 *)
12548        case "$h_fcntl" in
12549        true) echo "#include <fcntl.h>" > head.c;;
12550        *) echo "#include <sys/fcntl.h>" > head.c;;
12551        esac
12552        ;;
12553 esac
12554 echo " "
12555 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12556 case "$o_nonblock" in
12557 '')
12558         $cat head.c > try.c
12559         $cat >>try.c <<EOCP
12560 #include <stdio.h>
12561 #$i_stdlib I_STDLIB
12562 #ifdef I_STDLIB
12563 #include <stdlib.h>
12564 #endif
12565 #$i_fcntl I_FCNTL
12566 #ifdef I_FCNTL
12567 #include <fcntl.h>
12568 #endif
12569 int main() {
12570 #ifdef O_NONBLOCK
12571         printf("O_NONBLOCK\n");
12572         exit(0);
12573 #endif
12574 #ifdef O_NDELAY
12575         printf("O_NDELAY\n");
12576         exit(0);
12577 #endif
12578 #ifdef FNDELAY
12579         printf("FNDELAY\n");
12580         exit(0);
12581 #endif
12582         exit(0);
12583 }
12584 EOCP
12585         set try
12586         if eval $compile_ok; then
12587                 o_nonblock=`$run ./try`
12588                 case "$o_nonblock" in
12589                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12590                 *) echo "Seems like we can use $o_nonblock.";;
12591                 esac
12592         else
12593                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12594         fi
12595         ;;
12596 *) echo "Using $hint value $o_nonblock.";;
12597 esac
12598 $rm_try
12599
12600 echo " "
12601 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12602 case "$eagain" in
12603 '')
12604         case "$d_fork:$d_pipe" in
12605         define:define)
12606         $cat head.c > try.c
12607         $cat >>try.c <<EOCP
12608 #include <errno.h>
12609 #include <sys/types.h>
12610 #include <signal.h>
12611 #include <stdio.h>
12612 #$i_stdlib I_STDLIB
12613 #ifdef I_STDLIB
12614 #include <stdlib.h>
12615 #endif
12616 #$i_fcntl I_FCNTL
12617 #ifdef I_FCNTL
12618 #include <fcntl.h>
12619 #endif
12620 #define MY_O_NONBLOCK $o_nonblock
12621 #ifndef errno  /* XXX need better Configure test */
12622 extern int errno;
12623 #endif
12624 #$i_unistd I_UNISTD
12625 #ifdef I_UNISTD
12626 #include <unistd.h>
12627 #endif
12628 #$i_string I_STRING
12629 #ifdef I_STRING
12630 #include <string.h>
12631 #else
12632 #include <strings.h>
12633 #endif
12634 $signal_t blech(int x) { exit(3); }
12635 EOCP
12636         $cat >> try.c <<'EOCP'
12637 int main()
12638 {
12639         int pd[2];
12640         int pu[2];
12641         char buf[1];
12642         char string[100];
12643
12644         pipe(pd);       /* Down: child -> parent */
12645         pipe(pu);       /* Up: parent -> child */
12646         if (0 != fork()) {
12647                 int ret;
12648                 close(pd[1]);   /* Parent reads from pd[0] */
12649                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12650 #ifdef F_SETFL
12651                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12652                         exit(1);
12653 #else
12654                 exit(4);
12655 #endif
12656                 signal(SIGALRM, blech);
12657                 alarm(5);
12658                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12659                         exit(2);
12660                 sprintf(string, "%d\n", ret);
12661                 write(2, string, strlen(string));
12662                 alarm(0);
12663 #ifdef EAGAIN
12664                 if (errno == EAGAIN) {
12665                         printf("EAGAIN\n");
12666                         goto ok;
12667                 }
12668 #endif
12669 #ifdef EWOULDBLOCK
12670                 if (errno == EWOULDBLOCK)
12671                         printf("EWOULDBLOCK\n");
12672 #endif
12673         ok:
12674                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12675                 sleep(2);                               /* Give it time to close our pipe */
12676                 alarm(5);
12677                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12678                 alarm(0);
12679                 sprintf(string, "%d\n", ret);
12680                 write(4, string, strlen(string));
12681                 exit(0);
12682         }
12683
12684         close(pd[0]);                   /* We write to pd[1] */
12685         close(pu[1]);                   /* We read from pu[0] */
12686         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12687         close(pd[1]);                   /* Pipe pd is now fully closed! */
12688         exit(0);                                /* Bye bye, thank you for playing! */
12689 }
12690 EOCP
12691         set try
12692         if eval $compile_ok; then
12693                 echo "$startsh" >mtry
12694                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12695                 chmod +x mtry
12696                 ./mtry >/dev/null 2>&1
12697                 case $? in
12698                 0) eagain=`$cat try.out`;;
12699                 1) echo "Could not perform non-blocking setting!";;
12700                 2) echo "I did a successful read() for something that was not there!";;
12701                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12702                 4) echo "Could not find F_SETFL!";;
12703                 *) echo "Something terribly wrong happened during testing.";;
12704                 esac
12705                 rd_nodata=`$cat try.ret`
12706                 echo "A read() system call with no data present returns $rd_nodata."
12707                 case "$rd_nodata" in
12708                 0|-1) ;;
12709                 *)
12710                         echo "(That's peculiar, fixing that to be -1.)"
12711                         rd_nodata=-1
12712                         ;;
12713                 esac
12714                 case "$eagain" in
12715                 '')
12716                         echo "Forcing errno EAGAIN on read() with no data available."
12717                         eagain=EAGAIN
12718                         ;;
12719                 *)
12720                         echo "Your read() sets errno to $eagain when no data is available."
12721                         ;;
12722                 esac
12723                 status=`$cat try.err`
12724                 case "$status" in
12725                 0) echo "And it correctly returns 0 to signal EOF.";;
12726                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12727                 *) echo "However, your read() returns '$status' on EOF??";;
12728                 esac
12729                 val="$define"
12730                 if test "$status" = "$rd_nodata"; then
12731                         echo "WARNING: you can't distinguish between EOF and no data!"
12732                         val="$undef"
12733                 fi
12734         else
12735                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12736                 eagain=EAGAIN
12737         fi
12738         ;;
12739         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12740                 eagain=EAGAIN
12741                 val="$define"
12742                 ;;
12743         esac
12744         set d_eofnblk
12745         eval $setvar
12746         ;;
12747 *)
12748         echo "Using $hint value $eagain."
12749         echo "Your read() returns $rd_nodata when no data is present."
12750         case "$d_eofnblk" in
12751         "$define") echo "And you can see EOF because read() returns 0.";;
12752         "$undef") echo "But you can't see EOF status from read() returned value.";;
12753         *)
12754                 echo "(Assuming you can't see EOF status from read anyway.)"
12755                 d_eofnblk=$undef
12756                 ;;
12757         esac
12758         ;;
12759 esac
12760 $rm_try head.c mtry
12761
12762 : see if _ptr and _cnt from stdio act std
12763 echo " "
12764
12765 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12766         echo "(Looks like you have stdio.h from BSD.)"
12767         case "$stdio_ptr" in
12768         '') stdio_ptr='((fp)->_p)'
12769                 ptr_lval=$define
12770                 ;;
12771         *)      ptr_lval=$d_stdio_ptr_lval;;
12772         esac
12773         case "$stdio_cnt" in
12774         '') stdio_cnt='((fp)->_r)'
12775                 cnt_lval=$define
12776                 ;;
12777         *)      cnt_lval=$d_stdio_cnt_lval;;
12778         esac
12779         case "$stdio_base" in
12780         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12781         esac
12782         case "$stdio_bufsiz" in
12783         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12784         esac
12785 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12786         echo "(Looks like you have stdio.h from Linux.)"
12787         case "$stdio_ptr" in
12788         '') stdio_ptr='((fp)->_IO_read_ptr)'
12789                 ptr_lval=$define
12790                 ;;
12791         *)      ptr_lval=$d_stdio_ptr_lval;;
12792         esac
12793         case "$stdio_cnt" in
12794         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12795                 cnt_lval=$undef
12796                 ;;
12797         *)      cnt_lval=$d_stdio_cnt_lval;;
12798         esac
12799         case "$stdio_base" in
12800         '') stdio_base='((fp)->_IO_read_base)';;
12801         esac
12802         case "$stdio_bufsiz" in
12803         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12804         esac
12805 else
12806         case "$stdio_ptr" in
12807         '') stdio_ptr='((fp)->_ptr)'
12808                 ptr_lval=$define
12809                 ;;
12810         *)      ptr_lval=$d_stdio_ptr_lval;;
12811         esac
12812         case "$stdio_cnt" in
12813         '') stdio_cnt='((fp)->_cnt)'
12814                 cnt_lval=$define
12815                 ;;
12816         *)      cnt_lval=$d_stdio_cnt_lval;;
12817         esac
12818         case "$stdio_base" in
12819         '') stdio_base='((fp)->_base)';;
12820         esac
12821         case "$stdio_bufsiz" in
12822         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12823         esac
12824 fi
12825
12826 : test whether _ptr and _cnt really work
12827 echo "Checking how std your stdio is..." >&4
12828 $cat >try.c <<EOP
12829 #include <stdio.h>
12830 #$i_stdlib I_STDLIB
12831 #ifdef I_STDLIB
12832 #include <stdlib.h>
12833 #endif
12834 #define FILE_ptr(fp)    $stdio_ptr
12835 #define FILE_cnt(fp)    $stdio_cnt
12836 int main() {
12837         FILE *fp = fopen("try.c", "r");
12838         char c = getc(fp);
12839         if (
12840                 18 <= FILE_cnt(fp) &&
12841                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12842         )
12843                 exit(0);
12844         exit(1);
12845 }
12846 EOP
12847 val="$undef"
12848 set try
12849 if eval $compile && $to try.c; then
12850         if $run ./try; then
12851                 echo "Your stdio acts pretty std."
12852                 val="$define"
12853         else
12854                 echo "Your stdio isn't very std."
12855         fi
12856 else
12857         echo "Your stdio doesn't appear very std."
12858 fi
12859 $rm_try
12860
12861 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12862 # direct buffer manipulation no longer works.  The Configure tests
12863 # should be changed to correctly detect this, but until then,
12864 # the following check should at least let perl compile and run.
12865 # (This quick fix should be updated before 5.8.1.)
12866 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12867 # A. Dougherty, June 3, 2002.
12868 case "$d_gnulibc" in
12869 $define)
12870         case "$gnulibc_version" in
12871         2.[01]*)  ;;
12872         2.2) ;;
12873         2.2.[0-9]) ;;
12874         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12875                 val="$undef"
12876                 ;;
12877         esac
12878         ;;
12879 esac
12880 set d_stdstdio
12881 eval $setvar
12882
12883 : Can _ptr be used as an lvalue?
12884 case "$d_stdstdio$ptr_lval" in
12885 $define$define) val=$define ;;
12886 *) val=$undef ;;
12887 esac
12888 set d_stdio_ptr_lval
12889 eval $setvar
12890
12891 : Can _cnt be used as an lvalue?
12892 case "$d_stdstdio$cnt_lval" in
12893 $define$define) val=$define ;;
12894 *) val=$undef ;;
12895 esac
12896 set d_stdio_cnt_lval
12897 eval $setvar
12898
12899
12900 : test whether setting _ptr sets _cnt as a side effect
12901 d_stdio_ptr_lval_sets_cnt="$undef"
12902 d_stdio_ptr_lval_nochange_cnt="$undef"
12903 case "$d_stdio_ptr_lval$d_stdstdio" in
12904 $define$define)
12905         echo "Checking to see what happens if we set the stdio ptr..." >&4
12906 $cat >try.c <<EOP
12907 #include <stdio.h>
12908 /* Can we scream? */
12909 /* Eat dust sed :-) */
12910 /* In the buffer space, no one can hear you scream. */
12911 #$i_stdlib I_STDLIB
12912 #ifdef I_STDLIB
12913 #include <stdlib.h>
12914 #endif
12915 #define FILE_ptr(fp)    $stdio_ptr
12916 #define FILE_cnt(fp)    $stdio_cnt
12917 #include <sys/types.h>
12918 int main() {
12919         FILE *fp = fopen("try.c", "r");
12920         int c;
12921         char *ptr;
12922         size_t cnt;
12923         if (!fp) {
12924             puts("Fail even to read");
12925             exit(1);
12926         }
12927         c = getc(fp); /* Read away the first # */
12928         if (c == EOF) {
12929             puts("Fail even to read");
12930             exit(1);
12931         }
12932         if (!(
12933                 18 <= FILE_cnt(fp) &&
12934                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12935         )) {
12936                 puts("Fail even to read");
12937                 exit (1);
12938         }
12939         ptr = (char*) FILE_ptr(fp);
12940         cnt = (size_t)FILE_cnt(fp);
12941
12942         FILE_ptr(fp) += 42;
12943
12944         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12945                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12946                 exit (1);
12947         }
12948         if (FILE_cnt(fp) <= 20) {
12949                 printf ("Fail (<20 chars to test)");
12950                 exit (1);
12951         }
12952         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12953                 puts("Fail compare");
12954                 exit (1);
12955         }
12956         if (cnt == FILE_cnt(fp)) {
12957                 puts("Pass_unchanged");
12958                 exit (0);
12959         }
12960         if (FILE_cnt(fp) == (cnt - 42)) {
12961                 puts("Pass_changed");
12962                 exit (0);
12963         }
12964         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12965         return 1;
12966
12967 }
12968 EOP
12969         set try
12970         if eval $compile && $to try.c; then
12971                 case `$run ./try` in
12972                 Pass_changed)
12973                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12974                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12975                 Pass_unchanged)
12976                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12977                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12978                 Fail*)
12979                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12980                 *)
12981                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12982         esac
12983         else
12984                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12985         fi
12986         $rm_try
12987         ;;
12988 esac
12989
12990 : see if _base is also standard
12991 val="$undef"
12992 case "$d_stdstdio" in
12993 $define)
12994         $cat >try.c <<EOP
12995 #include <stdio.h>
12996 #$i_stdlib I_STDLIB
12997 #ifdef I_STDLIB
12998 #include <stdlib.h>
12999 #endif
13000 #define FILE_base(fp)   $stdio_base
13001 #define FILE_bufsiz(fp) $stdio_bufsiz
13002 int main() {
13003         FILE *fp = fopen("try.c", "r");
13004         char c = getc(fp);
13005         if (
13006                 19 <= FILE_bufsiz(fp) &&
13007                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13008         )
13009                 exit(0);
13010         exit(1);
13011 }
13012 EOP
13013         set try
13014         if eval $compile && $to try.c; then
13015                 if $run ./try; then
13016                         echo "And its _base field acts std."
13017                         val="$define"
13018                 else
13019                         echo "But its _base field isn't std."
13020                 fi
13021         else
13022                 echo "However, it seems to be lacking the _base field."
13023         fi
13024         $rm_try
13025         ;;
13026 esac
13027 set d_stdiobase
13028 eval $setvar
13029
13030 : see if fast_stdio exists
13031 val="$undef"
13032 case "$d_stdstdio:$d_stdio_ptr_lval" in
13033 "$define:$define")
13034         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13035         *$define*)
13036                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13037                 val="$define"
13038                 ;;
13039         esac
13040         ;;
13041 esac
13042 set d_faststdio
13043 eval $setvar
13044
13045
13046
13047 : see if fchdir exists
13048 set fchdir d_fchdir
13049 eval $inlibc
13050
13051 : see if fchmod exists
13052 set fchmod d_fchmod
13053 eval $inlibc
13054
13055 : see if fchown exists
13056 set fchown d_fchown
13057 eval $inlibc
13058
13059 : see if this is an fcntl system
13060 set fcntl d_fcntl
13061 eval $inlibc
13062
13063 : See if fcntl-based locking works.
13064 echo " "
13065 $cat >try.c <<EOCP
13066 #$i_stdlib I_STDLIB
13067 #ifdef I_STDLIB
13068 #include <stdlib.h>
13069 #endif
13070 #include <unistd.h>
13071 #include <fcntl.h>
13072 #include <signal.h>
13073 $signal_t blech(int x) { exit(3); }
13074 int main() {
13075 #if defined(F_SETLK) && defined(F_SETLKW)
13076      struct flock flock;
13077      int retval, fd;
13078      fd = open("try.c", O_RDONLY);
13079      flock.l_type = F_RDLCK;
13080      flock.l_whence = SEEK_SET;
13081      flock.l_start = flock.l_len = 0;
13082      signal(SIGALRM, blech);
13083      alarm(10);
13084      retval = fcntl(fd, F_SETLK, &flock);
13085      close(fd);
13086      (retval < 0 ? exit(2) : exit(0));
13087 #else
13088      exit(2);
13089 #endif
13090 }
13091 EOCP
13092 echo "Checking if fcntl-based file locking works... "
13093 case "$d_fcntl" in
13094 "$define")
13095         set try
13096         if eval $compile_ok; then
13097                 if $run ./try; then
13098                         echo "Yes, it seems to work."
13099                         val="$define"
13100                 else
13101                         echo "Nope, it didn't work."
13102                         val="$undef"
13103                         case "$?" in
13104                         3) $cat >&4 <<EOM
13105 ***
13106 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13107 *** This is (almost) impossible.
13108 *** If your NFS lock daemons are not feeling well, something like
13109 *** this may happen, please investigate.  Cannot continue, aborting.
13110 ***
13111 EOM
13112                                 exit 1
13113                                 ;;
13114                         esac
13115                 fi
13116         else
13117                 echo "I'm unable to compile the test program, so I'll assume not."
13118                 val="$undef"
13119         fi
13120         ;;
13121 *) val="$undef";
13122         echo "Nope, since you don't even have fcntl()."
13123         ;;
13124 esac
13125 set d_fcntl_can_lock
13126 eval $setvar
13127 $rm_try
13128
13129 : check for fd_set items
13130 $cat <<EOM
13131
13132 Checking to see how well your C compiler handles fd_set and friends ...
13133 EOM
13134 $cat >try.c <<EOCP
13135 #$i_stdlib I_STDLIB
13136 #ifdef I_STDLIB
13137 #include <stdlib.h>
13138 #endif
13139 #$i_systime I_SYS_TIME
13140 #$i_sysselct I_SYS_SELECT
13141 #$d_socket HAS_SOCKET
13142 #include <sys/types.h>
13143 #ifdef HAS_SOCKET
13144 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13145 #endif
13146 #ifdef I_SYS_TIME
13147 #include <sys/time.h>
13148 #endif
13149 #ifdef I_SYS_SELECT
13150 #include <sys/select.h>
13151 #endif
13152 int main() {
13153         fd_set fds;
13154
13155 #ifdef TRYBITS
13156         if(fds.fds_bits);
13157 #endif
13158
13159 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13160         exit(0);
13161 #else
13162         exit(1);
13163 #endif
13164 }
13165 EOCP
13166 set try -DTRYBITS
13167 if eval $compile; then
13168         d_fds_bits="$define"
13169         d_fd_set="$define"
13170         echo "Well, your system knows about the normal fd_set typedef..." >&4
13171         if $run ./try; then
13172                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13173                 d_fd_macros="$define"
13174         else
13175                 $cat >&4 <<'EOM'
13176 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13177 EOM
13178                 d_fd_macros="$undef"
13179         fi
13180 else
13181         $cat <<'EOM'
13182 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13183 EOM
13184         set try
13185         if eval $compile; then
13186                 d_fds_bits="$undef"
13187                 d_fd_set="$define"
13188                 echo "Well, your system has some sort of fd_set available..." >&4
13189                 if $run ./try; then
13190                         echo "and you have the normal fd_set macros." >&4
13191                         d_fd_macros="$define"
13192                 else
13193                         $cat <<'EOM'
13194 but not the normal fd_set macros!  Gross!  More work for me...
13195 EOM
13196                         d_fd_macros="$undef"
13197                 fi
13198         else
13199         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13200                 d_fd_set="$undef"
13201                 d_fds_bits="$undef"
13202                 d_fd_macros="$undef"
13203         fi
13204 fi
13205 $rm_try
13206
13207 : see if fgetpos exists
13208 set fgetpos d_fgetpos
13209 eval $inlibc
13210
13211 : see if finite exists
13212 set finite d_finite
13213 eval $inlibc
13214
13215 : see if finitel exists
13216 set finitel d_finitel
13217 eval $inlibc
13218
13219 : see if flock exists
13220 set flock d_flock
13221 eval $inlibc
13222
13223 : see if prototype for flock is available
13224 echo " "
13225 set d_flockproto flock $i_sysfile sys/file.h
13226 eval $hasproto
13227
13228 : see if fp_class exists
13229 set fp_class d_fp_class
13230 eval $inlibc
13231
13232 : see if pathconf exists
13233 set pathconf d_pathconf
13234 eval $inlibc
13235
13236 : see if fpathconf exists
13237 set fpathconf d_fpathconf
13238 eval $inlibc
13239
13240 : see if fpclass exists
13241 set fpclass d_fpclass
13242 eval $inlibc
13243
13244 : see if fpclassify exists
13245 set fpclassify d_fpclassify
13246 eval $inlibc
13247
13248 : see if fpclassl exists
13249 set fpclassl d_fpclassl
13250 eval $inlibc
13251
13252 : check for fpos64_t
13253 echo " "
13254 echo "Checking to see if you have fpos64_t..." >&4
13255 $cat >try.c <<EOCP
13256 #include <stdio.h>
13257 int main() { fpos64_t x = 7; }
13258 EOCP
13259 set try
13260 if eval $compile; then
13261         val="$define"
13262         echo "You have fpos64_t."
13263 else
13264         val="$undef"
13265         echo "You do not have fpos64_t."
13266         case "$fpossize" in
13267         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13268         esac
13269 fi
13270 $rm_try
13271 set d_fpos64_t
13272 eval $setvar
13273
13274 : see if frexpl exists
13275 set frexpl d_frexpl
13276 eval $inlibc
13277
13278 : see if this is a sys/param system
13279 set sys/param.h i_sysparam
13280 eval $inhdr
13281
13282 : see if this is a sys/mount.h system
13283 set sys/mount.h i_sysmount
13284 eval $inhdr
13285
13286 : Check for fs_data_s
13287 echo " "
13288 echo "Checking to see if your system supports struct fs_data..." >&4
13289 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13290 eval $hasstruct
13291 case "$d_fs_data_s" in
13292 "$define")      echo "Yes, it does."   ;;
13293 *)              echo "No, it doesn't." ;;
13294 esac
13295
13296 : see if fseeko exists
13297 set fseeko d_fseeko
13298 eval $inlibc
13299 case "$longsize" in
13300 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13301 esac
13302
13303 : see if fsetpos exists
13304 set fsetpos d_fsetpos
13305 eval $inlibc
13306
13307 : see if fstatfs exists
13308 set fstatfs d_fstatfs
13309 eval $inlibc
13310
13311 : see if statvfs exists
13312 set statvfs d_statvfs
13313 eval $inlibc
13314
13315 : see if fstatvfs exists
13316 set fstatvfs d_fstatvfs
13317 eval $inlibc
13318
13319
13320 : see if fsync exists
13321 set fsync d_fsync
13322 eval $inlibc
13323
13324 : see if ftello exists
13325 set ftello d_ftello
13326 eval $inlibc
13327 case "$longsize" in
13328 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13329 esac
13330
13331 : check for a working futimes
13332 d_futimes="$undef"
13333 echo " "
13334 echo "Checking if you have a working futimes()" >&4
13335 $cat >try.c <<EOCP
13336 #include <stdio.h>
13337 #include <sys/time.h>
13338 #include <errno.h>
13339 #include <fcntl.h>
13340
13341 int main ()
13342 {
13343     int fd, rv;
13344     fd = open ("try.c", O_RDWR);
13345     if (-1 == fd) exit (1);
13346     rv = futimes (fd, NULL);
13347     exit (rv == -1 ? errno : 0);
13348 }
13349 EOCP
13350 set try
13351 if eval $compile; then
13352     `$run ./try`
13353     rc=$?
13354     case "$rc" in
13355         0)  echo "Yes, you have" >&4
13356             d_futimes="$define"
13357             ;;
13358         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13359             ;;
13360     esac
13361 else
13362     echo "No, it does not (probably harmless)" >&4
13363 fi
13364 $rm_try
13365
13366 : see if ndbm.h is available
13367 set ndbm.h i_ndbm
13368 eval $inhdr
13369 : Compatibility location for RedHat 7.1
13370 set gdbm/ndbm.h i_gdbmndbm
13371 eval $inhdr
13372 : Compatibility location for Debian 4.0
13373 set gdbm-ndbm.h i_gdbm_ndbm
13374 eval $inhdr
13375
13376 val="$undef"
13377 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13378         : see if dbm_open exists
13379         set dbm_open d_dbm_open
13380         eval $inlibc
13381         case "$d_dbm_open" in
13382         $undef)
13383                 i_ndbm="$undef"
13384                 i_gdbmndbm="$undef"
13385                 i_gdbm_ndbm="$undef"
13386                 echo "We won't be including <ndbm.h>"
13387                 val="$undef"
13388                 ;;
13389         *) val="$define"
13390            ;;
13391         esac
13392 fi
13393 set d_ndbm
13394 eval $setvar
13395
13396 ndbm_hdr_protochk='name=$1; hdr=$2;
13397 eval "ihdr=\$""i_$name";
13398 val="$undef";
13399 if $test "$ihdr" = "$define"; then
13400         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13401         case "$d_cplusplus" in
13402         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13403         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13404         esac;
13405         case "$val" in
13406         $define) $echo "Your <$hdr> seems to have prototypes";;
13407         *) $echo "Your <$hdr> does not seem to have prototypes";;
13408         esac;
13409 fi;
13410 set "d_${name}_h_uses_prototypes";
13411 eval $setvar'
13412
13413 set ndbm ndbm.h
13414 eval $ndbm_hdr_protochk
13415 set gdbmndbm gdbm/ndbm.h
13416 eval $ndbm_hdr_protochk
13417 set gdbm_ndbm gdbm-ndbm.h
13418 eval $ndbm_hdr_protochk
13419
13420 : see if getaddrinfo exists
13421 set getaddrinfo d_getaddrinfo
13422 eval $inlibc
13423
13424 : see if getcwd exists
13425 set getcwd d_getcwd
13426 eval $inlibc
13427
13428 : see if getespwnam exists
13429 set getespwnam d_getespwnam
13430 eval $inlibc
13431
13432 : see if getfsstat exists
13433 set getfsstat d_getfsstat
13434 eval $inlibc
13435
13436 : see if getgrent exists
13437 set getgrent d_getgrent
13438 eval $inlibc
13439
13440 : see if getgrent_r exists
13441 set getgrent_r d_getgrent_r
13442 eval $inlibc
13443 case "$d_getgrent_r" in
13444 "$define")
13445         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13446         case "$d_getgrent_r_proto:$usethreads" in
13447         ":define")      d_getgrent_r_proto=define
13448                 set d_getgrent_r_proto getgrent_r $hdrs
13449                 eval $hasproto ;;
13450         *)      ;;
13451         esac
13452         case "$d_getgrent_r_proto" in
13453         define)
13454         case "$getgrent_r_proto" in
13455         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13456         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13457         esac
13458         case "$getgrent_r_proto" in
13459         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13460         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13461         esac
13462         case "$getgrent_r_proto" in
13463         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13464         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13465         esac
13466         case "$getgrent_r_proto" in
13467         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13468         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13469         esac
13470         case "$getgrent_r_proto" in
13471         ''|0) try='int getgrent_r(struct group*, char*, int);'
13472         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13473         esac
13474         case "$getgrent_r_proto" in
13475         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13476         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13477         esac
13478         case "$getgrent_r_proto" in
13479         ''|0)   d_getgrent_r=undef
13480                 getgrent_r_proto=0
13481                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13482         * )     case "$getgrent_r_proto" in
13483                 REENTRANT_PROTO*) ;;
13484                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13485                 esac
13486                 echo "Prototype: $try" ;;
13487         esac
13488         ;;
13489         *)      case "$usethreads" in
13490                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13491                 esac
13492                 d_getgrent_r=undef
13493                 getgrent_r_proto=0
13494                 ;;
13495         esac
13496         ;;
13497 *)      getgrent_r_proto=0
13498         ;;
13499 esac
13500
13501 : see if getgrgid_r exists
13502 set getgrgid_r d_getgrgid_r
13503 eval $inlibc
13504 case "$d_getgrgid_r" in
13505 "$define")
13506         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13507         case "$d_getgrgid_r_proto:$usethreads" in
13508         ":define")      d_getgrgid_r_proto=define
13509                 set d_getgrgid_r_proto getgrgid_r $hdrs
13510                 eval $hasproto ;;
13511         *)      ;;
13512         esac
13513         case "$d_getgrgid_r_proto" in
13514         define)
13515         case "$getgrgid_r_proto" in
13516         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13517         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13518         esac
13519         case "$getgrgid_r_proto" in
13520         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13521         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13522         esac
13523         case "$getgrgid_r_proto" in
13524         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13525         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13526         esac
13527         case "$getgrgid_r_proto" in
13528         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13529         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13530         esac
13531         case "$getgrgid_r_proto" in
13532         ''|0)   d_getgrgid_r=undef
13533                 getgrgid_r_proto=0
13534                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13535         * )     case "$getgrgid_r_proto" in
13536                 REENTRANT_PROTO*) ;;
13537                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13538                 esac
13539                 echo "Prototype: $try" ;;
13540         esac
13541         ;;
13542         *)      case "$usethreads" in
13543                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13544                 esac
13545                 d_getgrgid_r=undef
13546                 getgrgid_r_proto=0
13547                 ;;
13548         esac
13549         ;;
13550 *)      getgrgid_r_proto=0
13551         ;;
13552 esac
13553
13554 : see if getgrnam_r exists
13555 set getgrnam_r d_getgrnam_r
13556 eval $inlibc
13557 case "$d_getgrnam_r" in
13558 "$define")
13559         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13560         case "$d_getgrnam_r_proto:$usethreads" in
13561         ":define")      d_getgrnam_r_proto=define
13562                 set d_getgrnam_r_proto getgrnam_r $hdrs
13563                 eval $hasproto ;;
13564         *)      ;;
13565         esac
13566         case "$d_getgrnam_r_proto" in
13567         define)
13568         case "$getgrnam_r_proto" in
13569         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13570         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13571         esac
13572         case "$getgrnam_r_proto" in
13573         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13574         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13575         esac
13576         case "$getgrnam_r_proto" in
13577         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13578         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13579         esac
13580         case "$getgrnam_r_proto" in
13581         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13582         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13583         esac
13584         case "$getgrnam_r_proto" in
13585         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13586         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13587         esac
13588         case "$getgrnam_r_proto" in
13589         ''|0)   d_getgrnam_r=undef
13590                 getgrnam_r_proto=0
13591                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13592         * )     case "$getgrnam_r_proto" in
13593                 REENTRANT_PROTO*) ;;
13594                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13595                 esac
13596                 echo "Prototype: $try" ;;
13597         esac
13598         ;;
13599         *)      case "$usethreads" in
13600                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13601                 esac
13602                 d_getgrnam_r=undef
13603                 getgrnam_r_proto=0
13604                 ;;
13605         esac
13606         ;;
13607 *)      getgrnam_r_proto=0
13608         ;;
13609 esac
13610
13611 : see if gethostbyaddr exists
13612 set gethostbyaddr d_gethbyaddr
13613 eval $inlibc
13614
13615 : see if gethostbyname exists
13616 set gethostbyname d_gethbyname
13617 eval $inlibc
13618
13619 : see if gethostent exists
13620 set gethostent d_gethent
13621 eval $inlibc
13622
13623 : see how we will look up host name
13624 echo " "
13625 call=''
13626 if set gethostname val -f d_gethname; eval $csym; $val; then
13627         echo 'gethostname() found.' >&4
13628         d_gethname="$define"
13629         call=gethostname
13630 fi
13631 if set uname val -f d_uname; eval $csym; $val; then
13632         if ./xenix; then
13633                 $cat <<'EOM'
13634 uname() was found, but you're running xenix, and older versions of xenix
13635 have a broken uname(). If you don't really know whether your xenix is old
13636 enough to have a broken system call, use the default answer.
13637
13638 EOM
13639                 dflt=y
13640                 case "$d_uname" in
13641                 "$define") dflt=n;;
13642                 esac
13643                 rp='Is your uname() broken?'
13644                 . ./myread
13645                 case "$ans" in
13646                 n*) d_uname="$define"; call=uname;;
13647                 esac
13648         else
13649                 echo 'uname() found.' >&4
13650                 d_uname="$define"
13651                 case "$call" in
13652                 '') call=uname ;;
13653                 esac
13654         fi
13655 fi
13656 case "$d_gethname" in
13657 '') d_gethname="$undef";;
13658 esac
13659 case "$d_uname" in
13660 '') d_uname="$undef";;
13661 esac
13662 case "$d_uname$d_gethname" in
13663 *define*)
13664         dflt=n
13665         cat <<EOM
13666
13667 Every now and then someone has a $call() that lies about the hostname
13668 but can't be fixed for political or economic reasons.  If you wish, I can
13669 pretend $call() isn't there and maybe compute hostname at run-time
13670 thanks to the '$phostname' command.
13671
13672 EOM
13673         rp="Shall I ignore $call() from now on?"
13674         . ./myread
13675         case "$ans" in
13676         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13677         esac;;
13678 esac
13679 case "$phostname" in
13680 '') aphostname='';;
13681 *) case "$aphostname" in
13682         /*) ;;
13683         *) set X $phostname
13684                 shift
13685                 file=$1
13686                 shift
13687                 file=`./loc $file $file $pth`
13688                 aphostname=`echo $file $*`
13689                 ;;
13690         esac
13691         ;;
13692 esac
13693 case "$d_uname$d_gethname" in
13694 *define*) ;;
13695 *)
13696         case "$phostname" in
13697         '')
13698                 echo "There will be no way for $package to get your hostname." >&4;;
13699         *)
13700         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13701                 ;;
13702         esac;;
13703 esac
13704 case "$d_phostname" in
13705 '') d_phostname="$undef";;
13706 esac
13707
13708 : see if gethostbyaddr_r exists
13709 set gethostbyaddr_r d_gethostbyaddr_r
13710 eval $inlibc
13711 case "$d_gethostbyaddr_r" in
13712 "$define")
13713         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13714         case "$d_gethostbyaddr_r_proto:$usethreads" in
13715         ":define")      d_gethostbyaddr_r_proto=define
13716                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13717                 eval $hasproto ;;
13718         *)      ;;
13719         esac
13720         case "$d_gethostbyaddr_r_proto" in
13721         define)
13722         case "$gethostbyaddr_r_proto" in
13723         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13724         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13725         esac
13726         case "$gethostbyaddr_r_proto" in
13727         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13728         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13729         esac
13730         case "$gethostbyaddr_r_proto" in
13731         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13732         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13733         esac
13734         case "$gethostbyaddr_r_proto" in
13735         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13736         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13737         esac
13738         case "$gethostbyaddr_r_proto" in
13739         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13740         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13741         esac
13742         case "$gethostbyaddr_r_proto" in
13743         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13744         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13745         esac
13746         case "$gethostbyaddr_r_proto" in
13747         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13748         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13749         esac
13750         case "$gethostbyaddr_r_proto" in
13751         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13752         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13753         esac
13754         case "$gethostbyaddr_r_proto" in
13755         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13756         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13757         esac
13758         case "$gethostbyaddr_r_proto" in
13759         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13760         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13761         esac
13762         case "$gethostbyaddr_r_proto" in
13763         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13764         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13765         esac
13766         case "$gethostbyaddr_r_proto" in
13767         ''|0)   d_gethostbyaddr_r=undef
13768                 gethostbyaddr_r_proto=0
13769                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13770         * )     case "$gethostbyaddr_r_proto" in
13771                 REENTRANT_PROTO*) ;;
13772                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13773                 esac
13774                 echo "Prototype: $try" ;;
13775         esac
13776         ;;
13777         *)      case "$usethreads" in
13778                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13779                 esac
13780                 d_gethostbyaddr_r=undef
13781                 gethostbyaddr_r_proto=0
13782                 ;;
13783         esac
13784         ;;
13785 *)      gethostbyaddr_r_proto=0
13786         ;;
13787 esac
13788
13789 : see if gethostbyname_r exists
13790 set gethostbyname_r d_gethostbyname_r
13791 eval $inlibc
13792 case "$d_gethostbyname_r" in
13793 "$define")
13794         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13795         case "$d_gethostbyname_r_proto:$usethreads" in
13796         ":define")      d_gethostbyname_r_proto=define
13797                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13798                 eval $hasproto ;;
13799         *)      ;;
13800         esac
13801         case "$d_gethostbyname_r_proto" in
13802         define)
13803         case "$gethostbyname_r_proto" in
13804         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13805         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13806         esac
13807         case "$gethostbyname_r_proto" in
13808         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13809         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13810         esac
13811         case "$gethostbyname_r_proto" in
13812         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13813         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13814         esac
13815         case "$gethostbyname_r_proto" in
13816         ''|0)   d_gethostbyname_r=undef
13817                 gethostbyname_r_proto=0
13818                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13819         * )     case "$gethostbyname_r_proto" in
13820                 REENTRANT_PROTO*) ;;
13821                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13822                 esac
13823                 echo "Prototype: $try" ;;
13824         esac
13825         ;;
13826         *)      case "$usethreads" in
13827                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13828                 esac
13829                 d_gethostbyname_r=undef
13830                 gethostbyname_r_proto=0
13831                 ;;
13832         esac
13833         ;;
13834 *)      gethostbyname_r_proto=0
13835         ;;
13836 esac
13837
13838 : see if gethostent_r exists
13839 set gethostent_r d_gethostent_r
13840 eval $inlibc
13841 case "$d_gethostent_r" in
13842 "$define")
13843         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13844         case "$d_gethostent_r_proto:$usethreads" in
13845         ":define")      d_gethostent_r_proto=define
13846                 set d_gethostent_r_proto gethostent_r $hdrs
13847                 eval $hasproto ;;
13848         *)      ;;
13849         esac
13850         case "$d_gethostent_r_proto" in
13851         define)
13852         case "$gethostent_r_proto" in
13853         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13854         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13855         esac
13856         case "$gethostent_r_proto" in
13857         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13858         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13859         esac
13860         case "$gethostent_r_proto" in
13861         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13862         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13863         esac
13864         case "$gethostent_r_proto" in
13865         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13866         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13867         esac
13868         case "$gethostent_r_proto" in
13869         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13870         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13871         esac
13872         case "$gethostent_r_proto" in
13873         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13874         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13875         esac
13876         case "$gethostent_r_proto" in
13877         ''|0)   d_gethostent_r=undef
13878                 gethostent_r_proto=0
13879                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13880         * )     case "$gethostent_r_proto" in
13881                 REENTRANT_PROTO*) ;;
13882                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13883                 esac
13884                 echo "Prototype: $try" ;;
13885         esac
13886         ;;
13887         *)      case "$usethreads" in
13888                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13889                 esac
13890                 d_gethostent_r=undef
13891                 gethostent_r_proto=0
13892                 ;;
13893         esac
13894         ;;
13895 *)      gethostent_r_proto=0
13896         ;;
13897 esac
13898
13899 : see if prototypes for various gethostxxx netdb.h functions are available
13900 echo " "
13901 set d_gethostprotos gethostent $i_netdb netdb.h
13902 eval $hasproto
13903
13904 : see if getitimer exists
13905 set getitimer d_getitimer
13906 eval $inlibc
13907
13908 : see if getlogin exists
13909 set getlogin d_getlogin
13910 eval $inlibc
13911
13912 : see if getlogin_r exists
13913 set getlogin_r d_getlogin_r
13914 eval $inlibc
13915 case "$d_getlogin_r" in
13916 "$define")
13917         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13918         case "$d_getlogin_r_proto:$usethreads" in
13919         ":define")      d_getlogin_r_proto=define
13920                 set d_getlogin_r_proto getlogin_r $hdrs
13921                 eval $hasproto ;;
13922         *)      ;;
13923         esac
13924         case "$d_getlogin_r_proto" in
13925         define)
13926         case "$getlogin_r_proto" in
13927         ''|0) try='int getlogin_r(char*, size_t);'
13928         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13929         esac
13930         case "$getlogin_r_proto" in
13931         ''|0) try='int getlogin_r(char*, int);'
13932         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13933         esac
13934         case "$getlogin_r_proto" in
13935         ''|0) try='char* getlogin_r(char*, size_t);'
13936         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13937         esac
13938         case "$getlogin_r_proto" in
13939         ''|0) try='char* getlogin_r(char*, int);'
13940         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13941         esac
13942         case "$getlogin_r_proto" in
13943         ''|0)   d_getlogin_r=undef
13944                 getlogin_r_proto=0
13945                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13946         * )     case "$getlogin_r_proto" in
13947                 REENTRANT_PROTO*) ;;
13948                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13949                 esac
13950                 echo "Prototype: $try" ;;
13951         esac
13952         ;;
13953         *)      case "$usethreads" in
13954                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13955                 esac
13956                 d_getlogin_r=undef
13957                 getlogin_r_proto=0
13958                 ;;
13959         esac
13960         ;;
13961 *)      getlogin_r_proto=0
13962         ;;
13963 esac
13964
13965 : see if getmnt exists
13966 set getmnt d_getmnt
13967 eval $inlibc
13968
13969 : see if getmntent exists
13970 set getmntent d_getmntent
13971 eval $inlibc
13972
13973 : see if getnameinfo exists
13974 set getnameinfo d_getnameinfo
13975 eval $inlibc
13976
13977 : see if getnetbyaddr exists
13978 set getnetbyaddr d_getnbyaddr
13979 eval $inlibc
13980
13981 : see if getnetbyname exists
13982 set getnetbyname d_getnbyname
13983 eval $inlibc
13984
13985 : see if getnetent exists
13986 set getnetent d_getnent
13987 eval $inlibc
13988
13989 : see if getnetbyaddr_r exists
13990 set getnetbyaddr_r d_getnetbyaddr_r
13991 eval $inlibc
13992 case "$d_getnetbyaddr_r" in
13993 "$define")
13994         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13995         case "$d_getnetbyaddr_r_proto:$usethreads" in
13996         ":define")      d_getnetbyaddr_r_proto=define
13997                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13998                 eval $hasproto ;;
13999         *)      ;;
14000         esac
14001         case "$d_getnetbyaddr_r_proto" in
14002         define)
14003         case "$getnetbyaddr_r_proto" in
14004         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14005         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14006         esac
14007         case "$getnetbyaddr_r_proto" in
14008         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14009         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14010         esac
14011         case "$getnetbyaddr_r_proto" in
14012         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14013         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14014         esac
14015         case "$getnetbyaddr_r_proto" in
14016         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14017         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14018         esac
14019         case "$getnetbyaddr_r_proto" in
14020         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14021         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14022         esac
14023         case "$getnetbyaddr_r_proto" in
14024         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14025         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14026         esac
14027         case "$getnetbyaddr_r_proto" in
14028         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14029         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14030         esac
14031         case "$getnetbyaddr_r_proto" in
14032         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14033         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14034         esac
14035         case "$getnetbyaddr_r_proto" in
14036         ''|0)   d_getnetbyaddr_r=undef
14037                 getnetbyaddr_r_proto=0
14038                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14039         * )     case "$getnetbyaddr_r_proto" in
14040                 REENTRANT_PROTO*) ;;
14041                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14042                 esac
14043                 echo "Prototype: $try" ;;
14044         esac
14045         ;;
14046         *)      case "$usethreads" in
14047                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14048                 esac
14049                 d_getnetbyaddr_r=undef
14050                 getnetbyaddr_r_proto=0
14051                 ;;
14052         esac
14053         ;;
14054 *)      getnetbyaddr_r_proto=0
14055         ;;
14056 esac
14057
14058 : see if getnetbyname_r exists
14059 set getnetbyname_r d_getnetbyname_r
14060 eval $inlibc
14061 case "$d_getnetbyname_r" in
14062 "$define")
14063         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14064         case "$d_getnetbyname_r_proto:$usethreads" in
14065         ":define")      d_getnetbyname_r_proto=define
14066                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14067                 eval $hasproto ;;
14068         *)      ;;
14069         esac
14070         case "$d_getnetbyname_r_proto" in
14071         define)
14072         case "$getnetbyname_r_proto" in
14073         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14074         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14075         esac
14076         case "$getnetbyname_r_proto" in
14077         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14078         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14079         esac
14080         case "$getnetbyname_r_proto" in
14081         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14082         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14083         esac
14084         case "$getnetbyname_r_proto" in
14085         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14086         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14087         esac
14088         case "$getnetbyname_r_proto" in
14089         ''|0)   d_getnetbyname_r=undef
14090                 getnetbyname_r_proto=0
14091                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14092         * )     case "$getnetbyname_r_proto" in
14093                 REENTRANT_PROTO*) ;;
14094                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14095                 esac
14096                 echo "Prototype: $try" ;;
14097         esac
14098         ;;
14099         *)      case "$usethreads" in
14100                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14101                 esac
14102                 d_getnetbyname_r=undef
14103                 getnetbyname_r_proto=0
14104                 ;;
14105         esac
14106         ;;
14107 *)      getnetbyname_r_proto=0
14108         ;;
14109 esac
14110
14111 : see if getnetent_r exists
14112 set getnetent_r d_getnetent_r
14113 eval $inlibc
14114 case "$d_getnetent_r" in
14115 "$define")
14116         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14117         case "$d_getnetent_r_proto:$usethreads" in
14118         ":define")      d_getnetent_r_proto=define
14119                 set d_getnetent_r_proto getnetent_r $hdrs
14120                 eval $hasproto ;;
14121         *)      ;;
14122         esac
14123         case "$d_getnetent_r_proto" in
14124         define)
14125         case "$getnetent_r_proto" in
14126         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14127         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14128         esac
14129         case "$getnetent_r_proto" in
14130         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14131         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14132         esac
14133         case "$getnetent_r_proto" in
14134         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14135         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14136         esac
14137         case "$getnetent_r_proto" in
14138         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14139         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14140         esac
14141         case "$getnetent_r_proto" in
14142         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14143         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14144         esac
14145         case "$getnetent_r_proto" in
14146         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14147         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14148         esac
14149         case "$getnetent_r_proto" in
14150         ''|0)   d_getnetent_r=undef
14151                 getnetent_r_proto=0
14152                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14153         * )     case "$getnetent_r_proto" in
14154                 REENTRANT_PROTO*) ;;
14155                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14156                 esac
14157                 echo "Prototype: $try" ;;
14158         esac
14159         ;;
14160         *)      case "$usethreads" in
14161                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14162                 esac
14163                 d_getnetent_r=undef
14164                 getnetent_r_proto=0
14165                 ;;
14166         esac
14167         ;;
14168 *)      getnetent_r_proto=0
14169         ;;
14170 esac
14171
14172 : see if prototypes for various getnetxxx netdb.h functions are available
14173 echo " "
14174 set d_getnetprotos getnetent $i_netdb netdb.h
14175 eval $hasproto
14176
14177 : see if getpagesize exists
14178 set getpagesize d_getpagsz
14179 eval $inlibc
14180
14181 : Optional checks for getprotobyname and getprotobynumber
14182
14183 : see if getprotobyname exists
14184 set getprotobyname d_getpbyname
14185 eval $inlibc
14186
14187 : see if getprotobynumber exists
14188 set getprotobynumber d_getpbynumber
14189 eval $inlibc
14190
14191 : see if getprotoent exists
14192 set getprotoent d_getpent
14193 eval $inlibc
14194
14195 : see if getpgid exists
14196 set getpgid d_getpgid
14197 eval $inlibc
14198
14199 : see if getpgrp2 exists
14200 set getpgrp2 d_getpgrp2
14201 eval $inlibc
14202
14203 : see if getppid exists
14204 set getppid d_getppid
14205 eval $inlibc
14206
14207 : see if getpriority exists
14208 set getpriority d_getprior
14209 eval $inlibc
14210
14211 : see if getprotobyname_r exists
14212 set getprotobyname_r d_getprotobyname_r
14213 eval $inlibc
14214 case "$d_getprotobyname_r" in
14215 "$define")
14216         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14217         case "$d_getprotobyname_r_proto:$usethreads" in
14218         ":define")      d_getprotobyname_r_proto=define
14219                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14220                 eval $hasproto ;;
14221         *)      ;;
14222         esac
14223         case "$d_getprotobyname_r_proto" in
14224         define)
14225         case "$getprotobyname_r_proto" in
14226         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14227         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14228         esac
14229         case "$getprotobyname_r_proto" in
14230         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14231         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14232         esac
14233         case "$getprotobyname_r_proto" in
14234         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14235         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14236         esac
14237         case "$getprotobyname_r_proto" in
14238         ''|0)   d_getprotobyname_r=undef
14239                 getprotobyname_r_proto=0
14240                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14241         * )     case "$getprotobyname_r_proto" in
14242                 REENTRANT_PROTO*) ;;
14243                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14244                 esac
14245                 echo "Prototype: $try" ;;
14246         esac
14247         ;;
14248         *)      case "$usethreads" in
14249                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14250                 esac
14251                 d_getprotobyname_r=undef
14252                 getprotobyname_r_proto=0
14253                 ;;
14254         esac
14255         ;;
14256 *)      getprotobyname_r_proto=0
14257         ;;
14258 esac
14259
14260 : see if getprotobynumber_r exists
14261 set getprotobynumber_r d_getprotobynumber_r
14262 eval $inlibc
14263 case "$d_getprotobynumber_r" in
14264 "$define")
14265         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14266         case "$d_getprotobynumber_r_proto:$usethreads" in
14267         ":define")      d_getprotobynumber_r_proto=define
14268                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14269                 eval $hasproto ;;
14270         *)      ;;
14271         esac
14272         case "$d_getprotobynumber_r_proto" in
14273         define)
14274         case "$getprotobynumber_r_proto" in
14275         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14276         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14277         esac
14278         case "$getprotobynumber_r_proto" in
14279         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14280         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14281         esac
14282         case "$getprotobynumber_r_proto" in
14283         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14284         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14285         esac
14286         case "$getprotobynumber_r_proto" in
14287         ''|0)   d_getprotobynumber_r=undef
14288                 getprotobynumber_r_proto=0
14289                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14290         * )     case "$getprotobynumber_r_proto" in
14291                 REENTRANT_PROTO*) ;;
14292                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14293                 esac
14294                 echo "Prototype: $try" ;;
14295         esac
14296         ;;
14297         *)      case "$usethreads" in
14298                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14299                 esac
14300                 d_getprotobynumber_r=undef
14301                 getprotobynumber_r_proto=0
14302                 ;;
14303         esac
14304         ;;
14305 *)      getprotobynumber_r_proto=0
14306         ;;
14307 esac
14308
14309 : see if getprotoent_r exists
14310 set getprotoent_r d_getprotoent_r
14311 eval $inlibc
14312 case "$d_getprotoent_r" in
14313 "$define")
14314         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14315         case "$d_getprotoent_r_proto:$usethreads" in
14316         ":define")      d_getprotoent_r_proto=define
14317                 set d_getprotoent_r_proto getprotoent_r $hdrs
14318                 eval $hasproto ;;
14319         *)      ;;
14320         esac
14321         case "$d_getprotoent_r_proto" in
14322         define)
14323         case "$getprotoent_r_proto" in
14324         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14325         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14326         esac
14327         case "$getprotoent_r_proto" in
14328         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14329         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14330         esac
14331         case "$getprotoent_r_proto" in
14332         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14333         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14334         esac
14335         case "$getprotoent_r_proto" in
14336         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14337         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14338         esac
14339         case "$getprotoent_r_proto" in
14340         ''|0)   d_getprotoent_r=undef
14341                 getprotoent_r_proto=0
14342                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14343         * )     case "$getprotoent_r_proto" in
14344                 REENTRANT_PROTO*) ;;
14345                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14346                 esac
14347                 echo "Prototype: $try" ;;
14348         esac
14349         ;;
14350         *)      case "$usethreads" in
14351                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14352                 esac
14353                 d_getprotoent_r=undef
14354                 getprotoent_r_proto=0
14355                 ;;
14356         esac
14357         ;;
14358 *)      getprotoent_r_proto=0
14359         ;;
14360 esac
14361
14362 : see if prototypes for various getprotoxxx netdb.h functions are available
14363 echo " "
14364 set d_getprotoprotos getprotoent $i_netdb netdb.h
14365 eval $hasproto
14366
14367 : see if getprpwnam exists
14368 set getprpwnam d_getprpwnam
14369 eval $inlibc
14370
14371 : see if getpwent exists
14372 set getpwent d_getpwent
14373 eval $inlibc
14374
14375 : see if getpwent_r exists
14376 set getpwent_r d_getpwent_r
14377 eval $inlibc
14378 case "$d_getpwent_r" in
14379 "$define")
14380         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14381         case "$d_getpwent_r_proto:$usethreads" in
14382         ":define")      d_getpwent_r_proto=define
14383                 set d_getpwent_r_proto getpwent_r $hdrs
14384                 eval $hasproto ;;
14385         *)      ;;
14386         esac
14387         case "$d_getpwent_r_proto" in
14388         define)
14389         case "$getpwent_r_proto" in
14390         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14391         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14392         esac
14393         case "$getpwent_r_proto" in
14394         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14395         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14396         esac
14397         case "$getpwent_r_proto" in
14398         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14399         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14400         esac
14401         case "$getpwent_r_proto" in
14402         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14403         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14404         esac
14405         case "$getpwent_r_proto" in
14406         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14407         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14408         esac
14409         case "$getpwent_r_proto" in
14410         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14411         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14412         esac
14413         case "$getpwent_r_proto" in
14414         ''|0)   d_getpwent_r=undef
14415                 getpwent_r_proto=0
14416                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14417         * )     case "$getpwent_r_proto" in
14418                 REENTRANT_PROTO*) ;;
14419                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14420                 esac
14421                 echo "Prototype: $try" ;;
14422         esac
14423         ;;
14424         *)      case "$usethreads" in
14425                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14426                 esac
14427                 d_getpwent_r=undef
14428                 getpwent_r_proto=0
14429                 ;;
14430         esac
14431         ;;
14432 *)      getpwent_r_proto=0
14433         ;;
14434 esac
14435
14436 : see if getpwnam_r exists
14437 set getpwnam_r d_getpwnam_r
14438 eval $inlibc
14439 case "$d_getpwnam_r" in
14440 "$define")
14441         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14442         case "$d_getpwnam_r_proto:$usethreads" in
14443         ":define")      d_getpwnam_r_proto=define
14444                 set d_getpwnam_r_proto getpwnam_r $hdrs
14445                 eval $hasproto ;;
14446         *)      ;;
14447         esac
14448         case "$d_getpwnam_r_proto" in
14449         define)
14450         case "$getpwnam_r_proto" in
14451         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14452         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14453         esac
14454         case "$getpwnam_r_proto" in
14455         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14456         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14457         esac
14458         case "$getpwnam_r_proto" in
14459         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14460         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14461         esac
14462         case "$getpwnam_r_proto" in
14463         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14464         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14465         esac
14466         case "$getpwnam_r_proto" in
14467         ''|0)   d_getpwnam_r=undef
14468                 getpwnam_r_proto=0
14469                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14470         * )     case "$getpwnam_r_proto" in
14471                 REENTRANT_PROTO*) ;;
14472                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14473                 esac
14474                 echo "Prototype: $try" ;;
14475         esac
14476         ;;
14477         *)      case "$usethreads" in
14478                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14479                 esac
14480                 d_getpwnam_r=undef
14481                 getpwnam_r_proto=0
14482                 ;;
14483         esac
14484         ;;
14485 *)      getpwnam_r_proto=0
14486         ;;
14487 esac
14488
14489 : see if getpwuid_r exists
14490 set getpwuid_r d_getpwuid_r
14491 eval $inlibc
14492 case "$d_getpwuid_r" in
14493 "$define")
14494         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14495         case "$d_getpwuid_r_proto:$usethreads" in
14496         ":define")      d_getpwuid_r_proto=define
14497                 set d_getpwuid_r_proto getpwuid_r $hdrs
14498                 eval $hasproto ;;
14499         *)      ;;
14500         esac
14501         case "$d_getpwuid_r_proto" in
14502         define)
14503         case "$getpwuid_r_proto" in
14504         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14505         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14506         esac
14507         case "$getpwuid_r_proto" in
14508         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14509         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14510         esac
14511         case "$getpwuid_r_proto" in
14512         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14513         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14514         esac
14515         case "$getpwuid_r_proto" in
14516         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14517         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14518         esac
14519         case "$getpwuid_r_proto" in
14520         ''|0)   d_getpwuid_r=undef
14521                 getpwuid_r_proto=0
14522                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14523         * )     case "$getpwuid_r_proto" in
14524                 REENTRANT_PROTO*) ;;
14525                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14526                 esac
14527                 echo "Prototype: $try" ;;
14528         esac
14529         ;;
14530         *)      case "$usethreads" in
14531                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14532                 esac
14533                 d_getpwuid_r=undef
14534                 getpwuid_r_proto=0
14535                 ;;
14536         esac
14537         ;;
14538 *)      getpwuid_r_proto=0
14539         ;;
14540 esac
14541
14542 : Optional checks for getsbyname and getsbyport
14543
14544 : see if getservbyname exists
14545 set getservbyname d_getsbyname
14546 eval $inlibc
14547
14548 : see if getservbyport exists
14549 set getservbyport d_getsbyport
14550 eval $inlibc
14551
14552 : see if getservent exists
14553 set getservent d_getsent
14554 eval $inlibc
14555
14556 : see if getservbyname_r exists
14557 set getservbyname_r d_getservbyname_r
14558 eval $inlibc
14559 case "$d_getservbyname_r" in
14560 "$define")
14561         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14562         case "$d_getservbyname_r_proto:$usethreads" in
14563         ":define")      d_getservbyname_r_proto=define
14564                 set d_getservbyname_r_proto getservbyname_r $hdrs
14565                 eval $hasproto ;;
14566         *)      ;;
14567         esac
14568         case "$d_getservbyname_r_proto" in
14569         define)
14570         case "$getservbyname_r_proto" in
14571         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14572         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14573         esac
14574         case "$getservbyname_r_proto" in
14575         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14576         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14577         esac
14578         case "$getservbyname_r_proto" in
14579         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14580         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14581         esac
14582         case "$getservbyname_r_proto" in
14583         ''|0)   d_getservbyname_r=undef
14584                 getservbyname_r_proto=0
14585                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14586         * )     case "$getservbyname_r_proto" in
14587                 REENTRANT_PROTO*) ;;
14588                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14589                 esac
14590                 echo "Prototype: $try" ;;
14591         esac
14592         ;;
14593         *)      case "$usethreads" in
14594                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14595                 esac
14596                 d_getservbyname_r=undef
14597                 getservbyname_r_proto=0
14598                 ;;
14599         esac
14600         ;;
14601 *)      getservbyname_r_proto=0
14602         ;;
14603 esac
14604
14605 : see if getservbyport_r exists
14606 set getservbyport_r d_getservbyport_r
14607 eval $inlibc
14608 case "$d_getservbyport_r" in
14609 "$define")
14610         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14611         case "$d_getservbyport_r_proto:$usethreads" in
14612         ":define")      d_getservbyport_r_proto=define
14613                 set d_getservbyport_r_proto getservbyport_r $hdrs
14614                 eval $hasproto ;;
14615         *)      ;;
14616         esac
14617         case "$d_getservbyport_r_proto" in
14618         define)
14619         case "$getservbyport_r_proto" in
14620         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14621         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14622         esac
14623         case "$getservbyport_r_proto" in
14624         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14625         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14626         esac
14627         case "$getservbyport_r_proto" in
14628         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14629         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14630         esac
14631         case "$getservbyport_r_proto" in
14632         ''|0)   d_getservbyport_r=undef
14633                 getservbyport_r_proto=0
14634                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14635         * )     case "$getservbyport_r_proto" in
14636                 REENTRANT_PROTO*) ;;
14637                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14638                 esac
14639                 echo "Prototype: $try" ;;
14640         esac
14641         ;;
14642         *)      case "$usethreads" in
14643                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14644                 esac
14645                 d_getservbyport_r=undef
14646                 getservbyport_r_proto=0
14647                 ;;
14648         esac
14649         ;;
14650 *)      getservbyport_r_proto=0
14651         ;;
14652 esac
14653
14654 : see if getservent_r exists
14655 set getservent_r d_getservent_r
14656 eval $inlibc
14657 case "$d_getservent_r" in
14658 "$define")
14659         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14660         case "$d_getservent_r_proto:$usethreads" in
14661         ":define")      d_getservent_r_proto=define
14662                 set d_getservent_r_proto getservent_r $hdrs
14663                 eval $hasproto ;;
14664         *)      ;;
14665         esac
14666         case "$d_getservent_r_proto" in
14667         define)
14668         case "$getservent_r_proto" in
14669         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14670         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14671         esac
14672         case "$getservent_r_proto" in
14673         ''|0) try='int getservent_r(struct servent*, char*, int);'
14674         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14675         esac
14676         case "$getservent_r_proto" in
14677         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14678         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14679         esac
14680         case "$getservent_r_proto" in
14681         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14682         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14683         esac
14684         case "$getservent_r_proto" in
14685         ''|0)   d_getservent_r=undef
14686                 getservent_r_proto=0
14687                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14688         * )     case "$getservent_r_proto" in
14689                 REENTRANT_PROTO*) ;;
14690                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14691                 esac
14692                 echo "Prototype: $try" ;;
14693         esac
14694         ;;
14695         *)      case "$usethreads" in
14696                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14697                 esac
14698                 d_getservent_r=undef
14699                 getservent_r_proto=0
14700                 ;;
14701         esac
14702         ;;
14703 *)      getservent_r_proto=0
14704         ;;
14705 esac
14706
14707 : see if prototypes for various getservxxx netdb.h functions are available
14708 echo " "
14709 set d_getservprotos getservent $i_netdb netdb.h
14710 eval $hasproto
14711
14712 : see if getspnam exists
14713 set getspnam d_getspnam
14714 eval $inlibc
14715
14716 : see if this is a shadow.h system
14717 set shadow.h i_shadow
14718 eval $inhdr
14719
14720 : see if getspnam_r exists
14721 set getspnam_r d_getspnam_r
14722 eval $inlibc
14723 case "$d_getspnam_r" in
14724 "$define")
14725         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14726         case "$d_getspnam_r_proto:$usethreads" in
14727         ":define")      d_getspnam_r_proto=define
14728                 set d_getspnam_r_proto getspnam_r $hdrs
14729                 eval $hasproto ;;
14730         *)      ;;
14731         esac
14732         case "$d_getspnam_r_proto" in
14733         define)
14734         case "$getspnam_r_proto" in
14735         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14736         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14737         esac
14738         case "$getspnam_r_proto" in
14739         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14740         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14741         esac
14742         case "$getspnam_r_proto" in
14743         ''|0)   d_getspnam_r=undef
14744                 getspnam_r_proto=0
14745                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14746         * )     case "$getspnam_r_proto" in
14747                 REENTRANT_PROTO*) ;;
14748                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14749                 esac
14750                 echo "Prototype: $try" ;;
14751         esac
14752         ;;
14753         *)      case "$usethreads" in
14754                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14755                 esac
14756                 d_getspnam_r=undef
14757                 getspnam_r_proto=0
14758                 ;;
14759         esac
14760         ;;
14761 *)      getspnam_r_proto=0
14762         ;;
14763 esac
14764
14765 : see if gettimeofday or ftime exists
14766 set gettimeofday d_gettimeod
14767 eval $inlibc
14768 case "$d_gettimeod" in
14769 "$undef")
14770         set ftime d_ftime 
14771         eval $inlibc
14772         ;;
14773 *)
14774         val="$undef"; set d_ftime; eval $setvar
14775         ;;
14776 esac
14777 case "$d_gettimeod$d_ftime" in
14778 "$undef$undef")
14779         echo " "
14780         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14781         ;;
14782 esac
14783
14784 : see if gmtime_r exists
14785 set gmtime_r d_gmtime_r
14786 eval $inlibc
14787 case "$d_gmtime_r" in
14788 "$define")
14789         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14790         case "$d_gmtime_r_proto:$usethreads" in
14791         ":define")      d_gmtime_r_proto=define
14792                 set d_gmtime_r_proto gmtime_r $hdrs
14793                 eval $hasproto ;;
14794         *)      ;;
14795         esac
14796         case "$d_gmtime_r_proto" in
14797         define)
14798         case "$gmtime_r_proto" in
14799         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14800         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14801         esac
14802         case "$gmtime_r_proto" in
14803         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14804         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14805         esac
14806         case "$gmtime_r_proto" in
14807         ''|0)   d_gmtime_r=undef
14808                 gmtime_r_proto=0
14809                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14810         * )     case "$gmtime_r_proto" in
14811                 REENTRANT_PROTO*) ;;
14812                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14813                 esac
14814                 echo "Prototype: $try" ;;
14815         esac
14816         ;;
14817         *)      case "$usethreads" in
14818                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14819                 esac
14820                 d_gmtime_r=undef
14821                 gmtime_r_proto=0
14822                 ;;
14823         esac
14824         ;;
14825 *)      gmtime_r_proto=0
14826         ;;
14827 esac
14828
14829 : see if hasmntopt exists
14830 set hasmntopt d_hasmntopt
14831 eval $inlibc
14832
14833 : see if this is a netinet/in.h or sys/in.h system
14834 set netinet/in.h i_niin sys/in.h i_sysin
14835 eval $inhdr
14836
14837 : see if arpa/inet.h has to be included
14838 set arpa/inet.h i_arpainet
14839 eval $inhdr
14840
14841 : see if htonl --and friends-- exists
14842 val=''
14843 set htonl val
14844 eval $inlibc
14845
14846 : Maybe they are macros.
14847 case "$val" in
14848 $undef)
14849         $cat >htonl.c <<EOM
14850 #include <stdio.h>
14851 #include <sys/types.h>
14852 #$i_niin I_NETINET_IN
14853 #$i_sysin I_SYS_IN
14854 #$i_arpainet I_ARPA_INET
14855 #ifdef I_NETINET_IN
14856 #include <netinet/in.h>
14857 #endif
14858 #ifdef I_SYS_IN
14859 #include <sys/in.h>
14860 #endif
14861 #ifdef I_ARPA_INET
14862 #include <arpa/inet.h>
14863 #endif
14864 #ifdef htonl
14865 printf("Defined as a macro.");
14866 #endif
14867 EOM
14868         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14869         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14870                 val="$define"
14871                 echo "But it seems to be defined as a macro." >&4
14872         fi
14873         $rm -f htonl.?
14874         ;;
14875 esac
14876 set d_htonl
14877 eval $setvar
14878
14879 : see if ilogbl exists
14880 set ilogbl d_ilogbl
14881 eval $inlibc
14882
14883 : index or strchr
14884 echo " "
14885 if set index val -f; eval $csym; $val; then
14886         if set strchr val -f d_strchr; eval $csym; $val; then
14887                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14888                         val="$define"
14889                         vali="$undef"
14890                         echo "strchr() found." >&4
14891                 else
14892                         val="$undef"
14893                         vali="$define"
14894                         echo "index() found." >&4
14895                 fi
14896         else
14897                 val="$undef"
14898                 vali="$define"
14899                 echo "index() found." >&4
14900         fi
14901 else
14902         if set strchr val -f d_strchr; eval $csym; $val; then
14903                 val="$define"
14904                 vali="$undef"
14905                 echo "strchr() found." >&4
14906         else
14907                 echo "No index() or strchr() found!" >&4
14908                 val="$undef"
14909                 vali="$undef"
14910         fi
14911 fi
14912 set d_strchr; eval $setvar
14913 val="$vali"
14914 set d_index; eval $setvar
14915
14916 : check whether inet_aton exists
14917 set inet_aton d_inetaton
14918 eval $inlibc
14919
14920 : see if inet_ntop exists
14921 set inet_ntop d_inetntop
14922 eval $inlibc
14923
14924 : see if inet_pton exists
14925 set inet_pton d_inetpton
14926 eval $inlibc
14927
14928 : Look for isascii
14929 echo " "
14930 $cat >isascii.c <<EOCP
14931 #include <stdio.h>
14932 #include <ctype.h>
14933 #$i_stdlib I_STDLIB
14934 #ifdef I_STDLIB
14935 #include <stdlib.h>
14936 #endif
14937 int main() {
14938         int c = 'A';
14939         if (isascii(c))
14940                 exit(0);
14941         else
14942                 exit(1);
14943 }
14944 EOCP
14945 set isascii
14946 if eval $compile; then
14947         echo "isascii() found." >&4
14948         val="$define"
14949 else
14950         echo "isascii() NOT found." >&4
14951         val="$undef"
14952 fi
14953 set d_isascii
14954 eval $setvar
14955 $rm -f isascii*
14956
14957 : see if isfinite exists
14958 set isfinite d_isfinite
14959 eval $inlibc
14960
14961 : see if isinf exists
14962 set isinf d_isinf
14963 eval $inlibc
14964
14965 : see if isnan exists
14966 set isnan d_isnan
14967 eval $inlibc
14968
14969 : see if isnanl exists
14970 set isnanl d_isnanl
14971 eval $inlibc
14972
14973 : see if killpg exists
14974 set killpg d_killpg
14975 eval $inlibc
14976
14977 : see if lchown exists
14978 echo " "
14979 $cat > try.c <<'EOCP'
14980 /* System header to define __stub macros and hopefully few prototypes,
14981     which can conflict with char lchown(); below.  */
14982 #include <assert.h>
14983 /* Override any gcc2 internal prototype to avoid an error.  */
14984 /* We use char because int might match the return type of a gcc2
14985    builtin and then its argument prototype would still apply.  */
14986 char lchown();
14987 int main() {
14988     /*  The GNU C library defines this for functions which it implements
14989         to always fail with ENOSYS.  Some functions are actually named
14990         something starting with __ and the normal name is an alias.  */
14991 #if defined (__stub_lchown) || defined (__stub___lchown)
14992 choke me
14993 #else
14994 lchown();
14995 #endif
14996 ; return 0; }
14997 EOCP
14998 set try
14999 if eval $compile; then
15000     $echo "lchown() found." >&4
15001     val="$define"
15002 else
15003     $echo "lchown() NOT found." >&4
15004     val="$undef"
15005 fi
15006 set d_lchown
15007 eval $setvar
15008
15009 : See if number of significant digits in a double precision number is known
15010 echo " "
15011 $cat >ldbl_dig.c <<EOM
15012 #$i_limits I_LIMITS
15013 #$i_float I_FLOAT
15014 #ifdef I_LIMITS
15015 #include <limits.h>
15016 #endif
15017 #ifdef I_FLOAT
15018 #include <float.h>
15019 #endif
15020 #ifdef LDBL_DIG
15021 printf("Contains LDBL_DIG");
15022 #endif
15023 EOM
15024 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15025 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15026         echo "LDBL_DIG found." >&4
15027         val="$define"
15028 else
15029         echo "LDBL_DIG NOT found." >&4
15030         val="$undef"
15031 fi
15032 $rm -f ldbl_dig.?
15033 set d_ldbl_dig
15034 eval $setvar
15035
15036 : see if this is a math.h system
15037 set math.h i_math
15038 eval $inhdr
15039
15040 : check to see if math.h defines _LIB_VERSION
15041 d_libm_lib_version="$undef"
15042 case $i_math in
15043     $define)
15044         echo " "
15045         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15046         $cat >try.c <<EOCP
15047 #include <unistd.h>
15048 #include <math.h>
15049 int main (int argc, char *argv[])
15050 {
15051     printf ("%d\n", _LIB_VERSION);
15052     return (0);
15053     } /* main */
15054 EOCP
15055         set try
15056         if eval $compile; then
15057             foo=`$run ./try`
15058             echo "Yes, it does ($foo)" >&4
15059             d_libm_lib_version="$define"
15060         else
15061             echo "No, it does not (probably harmless)" >&4
15062             fi
15063         $rm_try
15064         ;;
15065
15066     esac
15067
15068 : see if link exists
15069 set link d_link
15070 eval $inlibc
15071
15072 : see if localtime_r exists
15073 set localtime_r d_localtime_r
15074 eval $inlibc
15075 case "$d_localtime_r" in
15076 "$define")
15077         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15078         case "$d_localtime_r_proto:$usethreads" in
15079         ":define")      d_localtime_r_proto=define
15080                 set d_localtime_r_proto localtime_r $hdrs
15081                 eval $hasproto ;;
15082         *)      ;;
15083         esac
15084         case "$d_localtime_r_proto" in
15085         define)
15086         case "$localtime_r_proto" in
15087         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15088         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15089         esac
15090         case "$localtime_r_proto" in
15091         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15092         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15093         esac
15094         case "$localtime_r_proto" in
15095         ''|0)   d_localtime_r=undef
15096                 localtime_r_proto=0
15097                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15098         * )     case "$localtime_r_proto" in
15099                 REENTRANT_PROTO*) ;;
15100                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15101                 esac
15102                 echo "Prototype: $try" ;;
15103         esac
15104         ;;
15105         *)      case "$usethreads" in
15106                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15107                 esac
15108                 d_localtime_r=undef
15109                 localtime_r_proto=0
15110                 ;;
15111         esac
15112         ;;
15113 *)      localtime_r_proto=0
15114         ;;
15115 esac
15116
15117 : see if localtime_r calls tzset
15118 case "$localtime_r_proto" in
15119 REENTRANT_PROTO*)
15120         $cat >try.c <<EOCP
15121 /*  Does our libc's localtime_r call tzset ?
15122  *  return 0 if so, 1 otherwise.
15123  */
15124 #$i_systypes    I_SYS_TYPES
15125 #$i_unistd      I_UNISTD
15126 #$i_time        I_TIME
15127 #$i_stdlib      I_STDLIB
15128 #$i_string      I_STRING
15129 #$i_malloc      I_MALLOC
15130 #ifdef I_SYS_TYPES
15131 #  include <sys/types.h>
15132 #endif
15133 #ifdef I_UNISTD
15134 #  include <unistd.h>
15135 #endif
15136 #ifdef I_TIME
15137 #  include <time.h>
15138 #endif
15139 #ifdef I_STDLIB
15140 #include <stdlib.h>
15141 #endif
15142 #ifdef I_STRING
15143 #  include <string.h>
15144 #else
15145 #  include <strings.h>
15146 #endif
15147 #ifdef I_MALLOC
15148 #  include <malloc.h>
15149 #endif
15150 int main()
15151 {
15152     time_t t = time(0L);
15153     char w_tz[]="TZ" "=GMT+5",
15154          e_tz[]="TZ" "=GMT-5",
15155         *tz_e = (char*)malloc(16),
15156         *tz_w = (char*)malloc(16);
15157     struct tm tm_e, tm_w;
15158     memset(&tm_e,'\0',sizeof(struct tm));
15159     memset(&tm_w,'\0',sizeof(struct tm));
15160     strcpy(tz_e,e_tz);
15161     strcpy(tz_w,w_tz);
15162
15163     putenv(tz_e);
15164     localtime_r(&t, &tm_e);
15165
15166     putenv(tz_w);
15167     localtime_r(&t, &tm_w);
15168
15169     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15170         return 1;
15171     return 0;
15172 }
15173 EOCP
15174         set try
15175         if eval $compile; then
15176             if $run ./try; then
15177                 d_localtime_r_needs_tzset=undef;
15178             else
15179                 d_localtime_r_needs_tzset=define;
15180             fi;
15181         else
15182             d_localtime_r_needs_tzset=undef;
15183         fi;
15184      ;;
15185   *)
15186      d_localtime_r_needs_tzset=undef;
15187      ;;
15188 esac
15189 $rm_try
15190
15191 : see if localeconv exists
15192 set localeconv d_locconv
15193 eval $inlibc
15194
15195 : see if lockf exists
15196 set lockf d_lockf
15197 eval $inlibc
15198
15199 : see if prototype for lseek is available
15200 echo " "
15201 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15202 eval $hasproto
15203
15204 : see if lstat exists
15205 set lstat d_lstat
15206 eval $inlibc
15207
15208 : see if madvise exists
15209 set madvise d_madvise
15210 eval $inlibc
15211
15212 : see if malloc_size exists
15213 set malloc_size d_malloc_size
15214 eval $inlibc
15215
15216 : see if malloc_size_good exists
15217 set malloc_good_size d_malloc_good_size
15218 eval $inlibc
15219
15220 : see if mblen exists
15221 set mblen d_mblen
15222 eval $inlibc
15223
15224 : see if mbstowcs exists
15225 set mbstowcs d_mbstowcs
15226 eval $inlibc
15227
15228 : see if mbtowc exists
15229 set mbtowc d_mbtowc
15230 eval $inlibc
15231
15232 : see if memchr exists
15233 set memchr d_memchr
15234 eval $inlibc
15235
15236 : see if memcmp exists
15237 set memcmp d_memcmp
15238 eval $inlibc
15239
15240 : see if memcpy exists
15241 set memcpy d_memcpy
15242 eval $inlibc
15243
15244 : see if memmove exists
15245 set memmove d_memmove
15246 eval $inlibc
15247
15248 : see if memset exists
15249 set memset d_memset
15250 eval $inlibc
15251
15252 : see if mkdir exists
15253 set mkdir d_mkdir
15254 eval $inlibc
15255
15256 : see if mkdtemp exists
15257 set mkdtemp d_mkdtemp
15258 eval $inlibc
15259
15260 : see if mkfifo exists
15261 set mkfifo d_mkfifo
15262 eval $inlibc
15263
15264 : see if mkstemp exists
15265 set mkstemp d_mkstemp
15266 eval $inlibc
15267
15268 : see if mkstemps exists
15269 set mkstemps d_mkstemps
15270 eval $inlibc
15271
15272 : see if mktime exists
15273 set mktime d_mktime
15274 eval $inlibc
15275
15276 : see if this is a sys/mman.h system
15277 set sys/mman.h i_sysmman
15278 eval $inhdr
15279
15280 : see if mmap exists
15281 set mmap d_mmap
15282 eval $inlibc
15283 : see what shmat returns
15284 : default to something harmless
15285 mmaptype='void *'
15286 case "$i_sysmman$d_mmap" in
15287 "$define$define")
15288         $cat >mmap.c <<'END'
15289 #include <sys/mman.h>
15290 void *mmap();
15291 END
15292         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15293                 mmaptype='void *'
15294         else
15295                 mmaptype='caddr_t'
15296         fi
15297         echo "and it returns ($mmaptype)." >&4
15298         ;;
15299 esac
15300
15301
15302
15303 : see if sqrtl exists
15304 set sqrtl d_sqrtl
15305 eval $inlibc
15306
15307 : see if scalbnl exists
15308 set scalbnl d_scalbnl
15309 eval $inlibc
15310
15311 : see if modfl exists
15312 set modfl d_modfl
15313 eval $inlibc
15314
15315 : see if prototype for modfl is available
15316 echo " "
15317 set d_modflproto modfl $i_math math.h
15318 eval $hasproto
15319
15320 d_modfl_pow32_bug="$undef"
15321
15322 case "$d_longdbl$d_modfl" in
15323 $define$define)
15324         $cat <<EOM
15325 Checking to see whether your modfl() is okay for large values...
15326 EOM
15327 $cat >try.c <<EOCP
15328 #include <math.h>
15329 #include <stdio.h>
15330 EOCP
15331 if $test "X$d_modflproto" != "X$define"; then
15332         $cat >>try.c <<EOCP
15333 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15334 long double modfl (long double, long double *);
15335 EOCP
15336 fi
15337 $cat >>try.c <<EOCP
15338 int main() {
15339     long double nv = 4294967303.15;
15340     long double v, w;
15341     v = modfl(nv, &w);
15342 #ifdef __GLIBC__
15343     printf("glibc");
15344 #endif
15345     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15346     return 0;
15347 }
15348 EOCP
15349         case "$osname:$gccversion" in
15350         aix:)   saveccflags="$ccflags"
15351                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15352         esac
15353         set try
15354         if eval $compile; then
15355                 foo=`$run ./try`
15356                 case "$foo" in
15357                 *" 4294967303.150000 1.150000 4294967302.000000")
15358                         echo >&4 "Your modfl() is broken for large values."
15359                         d_modfl_pow32_bug="$define"
15360                         case "$foo" in
15361                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15362                         ;;
15363                         esac
15364                         ;;
15365                 *" 4294967303.150000 0.150000 4294967303.000000")
15366                         echo >&4 "Your modfl() seems okay for large values."
15367                         ;;
15368                 *)      echo >&4 "I don't understand your modfl() at all."
15369                         d_modfl="$undef"
15370                         ;;
15371                 esac
15372                 $rm_try
15373         else
15374                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15375                 d_modfl="$undef"
15376         fi
15377         case "$osname:$gccversion" in
15378         aix:)   ccflags="$saveccflags" ;; # restore
15379         esac
15380         ;;
15381 esac
15382
15383 if $test "$uselongdouble" = "$define"; then
15384     message=""
15385     if $test "$d_sqrtl" != "$define"; then
15386         message="$message sqrtl"
15387     fi
15388     if $test "$d_modfl" != "$define"; then
15389         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15390             echo "You have both aintl and copysignl, so I can emulate modfl."
15391         else
15392             message="$message modfl"
15393         fi
15394     fi
15395     if $test "$d_frexpl" != "$define"; then
15396         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15397             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15398         else
15399             message="$message frexpl"
15400         fi
15401     fi
15402
15403     if $test "$message" != ""; then
15404         $cat <<EOM >&4
15405
15406 *** You requested the use of long doubles but you do not seem to have
15407 *** the following mathematical functions needed for long double support:
15408 ***    $message
15409 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15410 *** Cannot continue, aborting.
15411
15412 EOM
15413
15414         exit 1
15415     fi
15416 fi
15417
15418 : see if mprotect exists
15419 set mprotect d_mprotect
15420 eval $inlibc
15421
15422 : see if msgctl exists
15423 set msgctl d_msgctl
15424 eval $inlibc
15425
15426 : see if msgget exists
15427 set msgget d_msgget
15428 eval $inlibc
15429
15430 : see if msgsnd exists
15431 set msgsnd d_msgsnd
15432 eval $inlibc
15433
15434 : see if msgrcv exists
15435 set msgrcv d_msgrcv
15436 eval $inlibc
15437
15438 : see how much of the 'msg*(2)' library is present.
15439 h_msg=true
15440 echo " "
15441 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15442 *"$undef"*) h_msg=false;;
15443 esac
15444 case "$osname" in
15445 freebsd)
15446     case "`ipcs 2>&1`" in
15447     "SVID messages"*"not configured"*)
15448         echo "Your $osname does not have the msg*(2) configured." >&4
15449         h_msg=false
15450         val="$undef"
15451         set msgctl d_msgctl
15452         eval $setvar
15453         set msgget d_msgget
15454         eval $setvar
15455         set msgsnd d_msgsnd
15456         eval $setvar
15457         set msgrcv d_msgrcv
15458         eval $setvar
15459         ;;
15460     esac
15461     ;;
15462 esac
15463 : we could also check for sys/ipc.h ...
15464 if $h_msg && $test `./findhdr sys/msg.h`; then
15465         echo "You have the full msg*(2) library." >&4
15466         val="$define"
15467 else
15468         echo "You don't have the full msg*(2) library." >&4
15469         val="$undef"
15470 fi
15471 set d_msg
15472 eval $setvar
15473
15474 : Check for msghdr_s
15475 echo " "
15476 echo "Checking to see if your system supports struct msghdr..." >&4
15477 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15478 eval $hasstruct
15479 case "$d_msghdr_s" in
15480 "$define")      echo "Yes, it does."   ;;
15481 *)              echo "No, it doesn't." ;;
15482 esac
15483
15484
15485 : see if msync exists
15486 set msync d_msync
15487 eval $inlibc
15488
15489 : see if munmap exists
15490 set munmap d_munmap
15491 eval $inlibc
15492
15493 : see if nice exists
15494 set nice d_nice
15495 eval $inlibc
15496
15497 : see if this is a langinfo.h system
15498 set langinfo.h i_langinfo
15499 eval $inhdr
15500
15501 : see if nl_langinfo exists
15502 set nl_langinfo d_nl_langinfo
15503 eval $inlibc
15504
15505 : check for volatile keyword
15506 echo " "
15507 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15508 $cat >try.c <<'EOCP'
15509 int main()
15510 {
15511         typedef struct _goo_struct goo_struct;
15512         goo_struct * volatile goo = ((goo_struct *)0);
15513         struct _goo_struct {
15514                 long long_int;
15515                 int reg_int;
15516                 char char_var;
15517         };
15518         typedef unsigned short foo_t;
15519         char *volatile foo;
15520         volatile int bar;
15521         volatile foo_t blech;
15522         foo = foo;
15523 }
15524 EOCP
15525 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15526         val="$define"
15527         echo "Yup, it does."
15528 else
15529         val="$undef"
15530         echo "Nope, it doesn't."
15531 fi
15532 set d_volatile
15533 eval $setvar
15534 $rm_try
15535
15536 : Check basic sizes
15537 echo " "
15538 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15539
15540 case "$use64bitint:$d_quad:$quadtype" in
15541 define:define:?*)
15542         ivtype="$quadtype"
15543         uvtype="$uquadtype"
15544         ivsize=8
15545         uvsize=8
15546         ;;
15547 *)      ivtype="long"
15548         uvtype="unsigned long"
15549         ivsize=$longsize
15550         uvsize=$longsize
15551         ;;
15552 esac
15553
15554 case "$uselongdouble:$d_longdbl" in
15555 define:define)
15556         nvtype="long double"
15557         nvsize=$longdblsize
15558         ;;
15559 *)      nvtype=double
15560         nvsize=$doublesize
15561         ;;
15562 esac
15563
15564 $echo "(IV will be "$ivtype", $ivsize bytes)"
15565 $echo "(UV will be "$uvtype", $uvsize bytes)"
15566 $echo "(NV will be "$nvtype", $nvsize bytes)"
15567
15568 $cat >try.c <<EOCP
15569 #$i_inttypes I_INTTYPES
15570 #ifdef I_INTTYPES
15571 #include <inttypes.h>
15572 #endif
15573 #include <stdio.h>
15574 int main() {
15575 #ifdef INT8
15576    int8_t i =  INT8_MAX;
15577   uint8_t u = UINT8_MAX;
15578   printf("int8_t\n");
15579 #endif
15580 #ifdef INT16
15581    int16_t i =  INT16_MAX;
15582   uint16_t i = UINT16_MAX;
15583   printf("int16_t\n");
15584 #endif
15585 #ifdef INT32
15586    int32_t i =  INT32_MAX;
15587   uint32_t u = UINT32_MAX;
15588   printf("int32_t\n");
15589 #endif
15590 }
15591 EOCP
15592
15593 i8type="signed char"
15594 u8type="unsigned char"
15595 i8size=1
15596 u8size=1
15597
15598 case "$i16type" in
15599 '')     case "$shortsize" in
15600         2)      i16type=short
15601                 u16type="unsigned short"
15602                 i16size=$shortsize
15603                 u16size=$shortsize
15604                 ;;
15605         esac
15606         ;;
15607 esac
15608 case "$i16type" in
15609 '')     set try -DINT16
15610         if eval $compile; then
15611                 case "`$run ./try`" in
15612                 int16_t)
15613                         i16type=int16_t
15614                         u16type=uint16_t
15615                         i16size=2
15616                         u16size=2
15617                         ;;
15618                 esac
15619         fi
15620         ;;
15621 esac
15622 case "$i16type" in
15623 '')     if $test $shortsize -ge 2; then
15624                 i16type=short
15625                 u16type="unsigned short"
15626                 i16size=$shortsize
15627                 u16size=$shortsize
15628         fi
15629         ;;
15630 esac
15631
15632 case "$i32type" in
15633 '')     case "$longsize" in
15634         4)      i32type=long
15635                 u32type="unsigned long"
15636                 i32size=$longsize
15637                 u32size=$longsize
15638                 ;;
15639         *)      case "$intsize" in
15640                 4)      i32type=int
15641                         u32type="unsigned int"
15642                         i32size=$intsize
15643                         u32size=$intsize
15644                         ;;
15645                 esac
15646                 ;;
15647         esac
15648         ;;
15649 esac
15650 case "$i32type" in
15651 '')     set try -DINT32
15652         if eval $compile; then
15653                 case "`$run ./try`" in
15654                 int32_t)
15655                         i32type=int32_t
15656                         u32type=uint32_t
15657                         i32size=4
15658                         u32size=4
15659                         ;;
15660                 esac
15661         fi
15662         ;;
15663 esac
15664 case "$i32type" in
15665 '')     if $test $intsize -ge 4; then
15666                 i32type=int
15667                 u32type="unsigned int"
15668                 i32size=$intsize
15669                 u32size=$intsize
15670         fi
15671         ;;
15672 esac
15673
15674 case "$i64type" in
15675 '')     case "$d_quad:$quadtype" in
15676         define:?*)
15677                 i64type="$quadtype"
15678                 u64type="$uquadtype"
15679                 i64size=8
15680                 u64size=8
15681                 ;;
15682         esac
15683         ;;
15684 esac
15685
15686 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15687 : volatile so that the compiler has to store it out to memory.
15688 if test X"$d_volatile" = X"$define"; then
15689         volatile=volatile
15690 fi
15691 $cat <<EOP >try.c
15692 #include <stdio.h>
15693 #$i_stdlib I_STDLIB
15694 #ifdef I_STDLIB
15695 #include <stdlib.h>
15696 #endif
15697 #include <sys/types.h>
15698 #include <signal.h>
15699 #ifdef SIGFPE
15700 $volatile int bletched = 0;
15701 $signal_t blech(int s) { bletched = 1; }
15702 #endif
15703 int main() {
15704     $uvtype u = 0;
15705     $nvtype d;
15706     int     n = 8 * $uvsize;
15707     int     i;
15708 #ifdef SIGFPE
15709     signal(SIGFPE, blech);
15710 #endif
15711
15712     for (i = 0; i < n; i++) {
15713       u = u << 1 | ($uvtype)1;
15714       d = ($nvtype)u;
15715       if (($uvtype)d != u)
15716         break;
15717       if (d <= 0)
15718         break;
15719       d = ($nvtype)(u - 1);
15720       if (($uvtype)d != (u - 1))
15721         break;
15722 #ifdef SIGFPE
15723       if (bletched)
15724         break;
15725 #endif
15726     }
15727     printf("%d\n", ((i == n) ? -n : i));
15728     exit(0);
15729 }
15730 EOP
15731 set try
15732
15733 d_nv_preserves_uv="$undef"
15734 if eval $compile; then
15735         nv_preserves_uv_bits="`$run ./try`"
15736 fi
15737 case "$nv_preserves_uv_bits" in
15738 \-[1-9]*)
15739         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15740         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15741         d_nv_preserves_uv="$define"
15742         ;;
15743 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15744         d_nv_preserves_uv="$undef" ;;
15745 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15746         nv_preserves_uv_bits="0" ;;
15747 esac
15748 $rm_try
15749
15750 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15751 : volatile so that the compiler has to store it out to memory.
15752 if test X"$d_volatile" = X"$define"; then
15753         volatile=volatile
15754 fi
15755 $cat <<EOP >try.c
15756 #include <stdio.h>
15757
15758 typedef $nvtype NV;
15759
15760 int
15761 main() {
15762   NV value = 2;
15763   int count = 1;
15764
15765   while(count < 256) {
15766     $volatile NV up = value + 1.0;
15767     $volatile NV negated = -value;
15768     $volatile NV down = negated - 1.0;
15769     $volatile NV got_up = up - value;
15770     int up_good = got_up == 1.0;
15771     int got_down = down - negated;
15772     int down_good = got_down == -1.0;
15773
15774     if (down_good != up_good) {
15775       fprintf(stderr,
15776               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15777               up_good, (double) got_up, down_good, (double) got_down,
15778               count, (double) value);
15779       return 1;
15780     }
15781     if (!up_good) {
15782       while (1) {
15783         if (count > 8) {
15784           count -= 8;
15785           fputs("256.0", stdout);
15786         } else {
15787           count--;
15788           fputs("2.0", stdout);
15789         }
15790         if (!count) {
15791           puts("");
15792           return 0;
15793         }
15794         fputs("*", stdout);
15795       }
15796     }
15797     value *= 2;
15798     ++count;
15799   }
15800   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15801           count, (double) value);
15802   return 1;
15803 }
15804 EOP
15805 set try
15806
15807 nv_overflows_integers_at='0'
15808 if eval $compile; then
15809     xxx="`$run ./try`"
15810     case "$?" in
15811         0)
15812             case "$xxx" in
15813                 2*)  cat >&4 <<EOM
15814 The largest integer your NVs can preserve is equal to $xxx
15815 EOM
15816                     nv_overflows_integers_at="$xxx"
15817                     ;;
15818                 *)  cat >&4 <<EOM
15819 Cannot determine the largest integer value your NVs can hold, unexpected output
15820 '$xxx'
15821 EOM
15822                     ;;
15823             esac
15824             ;;
15825         *)  cat >&4 <<EOM
15826 Cannot determine the largest integer value your NVs can hold
15827 EOM
15828             ;;
15829     esac
15830 fi
15831 $rm_try
15832
15833 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15834 : volatile so that the compiler has to store it out to memory.
15835 if test X"$d_volatile" = X"$define"; then
15836         volatile=volatile
15837 fi
15838 $cat <<EOP >try.c
15839 #include <stdio.h>
15840 #$i_stdlib I_STDLIB
15841 #ifdef I_STDLIB
15842 #include <stdlib.h>
15843 #endif
15844 #$i_string I_STRING
15845 #ifdef I_STRING
15846 #  include <string.h>
15847 #else
15848 #  include <strings.h>
15849 #endif
15850 #include <sys/types.h>
15851 #include <signal.h>
15852 #ifdef SIGFPE
15853 $volatile int bletched = 0;
15854 $signal_t blech(int s) { bletched = 1; }
15855 #endif
15856
15857 int checkit($nvtype d, char *where) {
15858     unsigned char *p = (char *)&d;
15859     unsigned char *end = p + sizeof(d);
15860     int fail = 0;
15861
15862     while (p < end)
15863         fail += *p++;
15864
15865     if (!fail)
15866         return 0;
15867
15868     p = (char *)&d;
15869     printf("No - %s: 0x", where);
15870     while (p < end)
15871         printf ("%02X", *p++);
15872     printf("\n");
15873     return 1;
15874 }
15875
15876 int main(int argc, char **argv) {
15877     $nvtype d = 0.0;
15878     int fail = 0;
15879     fail += checkit(d, "0.0");
15880
15881     /* The compiler shouldn't be assuming that bletched is 0  */
15882     d = bletched;
15883
15884     fail += checkit(d, "bleched");
15885
15886 #ifdef SIGFPE
15887     signal(SIGFPE, blech);
15888 #endif
15889
15890     /* Paranoia - the compiler should have no way of knowing that ANSI says
15891        that argv[argc] will always be NULL.  Actually, if it did assume this it
15892        would be buggy, as this is C and main() can be called from elsewhere in
15893        the program.  */
15894     d = argv[argc] ? 1 : 0;
15895
15896     if (d) {
15897         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15898     }
15899
15900     fail += checkit(d, "ternary");
15901
15902     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15903
15904     if (d != 0.0) {
15905         printf("No - memset doesn't give 0.0\n");
15906         /* This might just blow up:  */
15907         printf("(gives %g)\n", d);
15908         return 1;
15909     }
15910
15911 #ifdef SIGFPE
15912     if (bletched) {
15913         printf("No - something bleched\n");
15914         return 1;
15915     }
15916 #endif
15917     if (fail) {
15918       printf("No - %d fail(s)\n", fail);
15919       return 1;
15920     }
15921     printf("Yes\n");
15922     return 0;
15923 }
15924 EOP
15925 set try
15926
15927 d_nv_zero_is_allbits_zero="$undef"
15928 if eval $compile; then
15929     xxx="`$run ./try`"
15930     case "$?" in
15931         0)
15932             case "$xxx" in
15933                 Yes)  cat >&4 <<EOM
15934 0.0 is represented as all bits zero in memory
15935 EOM
15936                     d_nv_zero_is_allbits_zero="$define"
15937                     ;;
15938                 *)  cat >&4 <<EOM
15939 0.0 is not represented as all bits zero in memory
15940 EOM
15941                     d_nv_zero_is_allbits_zero="$undef"
15942                     ;;
15943             esac
15944             ;;
15945         *)  cat >&4 <<EOM
15946 0.0 is not represented as all bits zero in memory
15947 EOM
15948             d_nv_zero_is_allbits_zero="$undef"
15949             ;;
15950     esac
15951 fi
15952 $rm_try
15953
15954 : check for off64_t
15955 echo " "
15956 echo "Checking to see if you have off64_t..." >&4
15957 $cat >try.c <<EOCP
15958 #include <sys/types.h>
15959 #include <unistd.h>
15960 int main() { off64_t x = 7; }
15961 EOCP
15962 set try
15963 if eval $compile; then
15964         val="$define"
15965         echo "You have off64_t."
15966 else
15967         val="$undef"
15968         echo "You do not have off64_t."
15969         case "$lseeksize" in
15970         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15971         esac
15972 fi
15973 $rm_try
15974 set d_off64_t
15975 eval $setvar
15976
15977 : how to create joinable pthreads
15978 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15979         echo " "
15980         echo "Checking what constant to use for creating joinable pthreads..." >&4
15981         $cat >try.c <<'EOCP'
15982 #include <pthread.h>
15983 int main() {
15984     int detachstate = JOINABLE;
15985 }
15986 EOCP
15987         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15988         if eval $compile; then
15989                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15990                 val="$undef" # Yes, undef.
15991                 set d_old_pthread_create_joinable
15992                 eval $setvar
15993                 val=""
15994                 set old_pthread_create_joinable
15995                 eval $setvar
15996         else
15997                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15998                 if eval $compile; then
15999                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16000                         val="$define"
16001                         set d_old_pthread_create_joinable
16002                         eval $setvar
16003                         val=PTHREAD_CREATE_UNDETACHED
16004                         set old_pthread_create_joinable
16005                         eval $setvar
16006                 else
16007                         set try -DJOINABLE=__UNDETACHED
16008                         if eval $compile; then
16009                                 echo "You seem to use __UNDETACHED." >&4
16010                                 val="$define"
16011                                 set d_old_pthread_create_joinable
16012                                 eval $setvar
16013                                 val=__UNDETACHED
16014                                 set old_pthread_create_joinable
16015                                 eval $setvar
16016                         else
16017                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16018                                 val="$define"
16019                                 set d_old_pthread_create_joinable
16020                                 eval $setvar
16021                                 val=0
16022                                 set old_pthread_create_joinable
16023                                 eval $setvar
16024                         fi
16025                 fi
16026         fi
16027         $rm_try
16028 else
16029     d_old_pthread_create_joinable="$undef"
16030     old_pthread_create_joinable=""
16031 fi
16032
16033 : see if pause exists
16034 set pause d_pause
16035 eval $inlibc
16036
16037 : see if poll exists
16038 set poll d_poll
16039 eval $inlibc
16040
16041 : see if readlink exists
16042 set readlink d_readlink
16043 eval $inlibc
16044
16045 : Check if exe is symlink to abs path of executing program
16046 echo " "
16047 procselfexe=''
16048 val="$undef"
16049 case "$d_readlink" in
16050 "$define")
16051         if $issymlink /proc/self/exe ; then
16052                 $ls -l /proc/self/exe > reflect
16053                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16054                         echo "You have Linux-like /proc/self/exe."
16055                         procselfexe='"/proc/self/exe"'
16056                         val="$define"
16057                 fi
16058         fi
16059         if $issymlink /proc/curproc/file ; then
16060                 $ls -l /proc/curproc/file > reflect
16061                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16062                         echo "You have BSD-like /proc/curproc/file."
16063                         procselfexe='"/proc/curproc/file"'
16064                         val="$define"
16065                 fi
16066         fi
16067         ;;
16068 esac
16069 $rm -f reflect
16070 set d_procselfexe
16071 eval $setvar
16072
16073 : backward compatibility for d_hvfork
16074 if test X$d_hvfork != X; then
16075         d_vfork="$d_hvfork"
16076         d_hvfork=''
16077 fi
16078 : see if there is a vfork
16079 val=''
16080 set vfork val
16081 eval $inlibc
16082
16083 d_pseudofork=$undef
16084
16085 : Ok, but do we want to use it. vfork is reportedly unreliable in
16086 : perl on Solaris 2.x, and probably elsewhere.
16087 case "$val" in
16088 $define)
16089         echo " "
16090         case "$usevfork" in
16091         false) dflt='n';;
16092         *) dflt='y';;
16093         esac
16094         cat <<'EOM'
16095
16096 Perl can only use a vfork() that doesn't suffer from strict
16097 restrictions on calling functions or modifying global data in
16098 the child.  For example, glibc-2.1 contains such a vfork()
16099 that is unsuitable.  If your system provides a proper fork()
16100 call, chances are that you do NOT want perl to use vfork().
16101
16102 EOM
16103         rp="Do you still want to use vfork()?"
16104         . ./myread
16105         case "$ans" in
16106         y|Y) ;;
16107         *)
16108                 echo "Ok, we won't use vfork()."
16109                 val="$undef"
16110                 ;;
16111         esac
16112         ;;
16113 esac
16114 set d_vfork
16115 eval $setvar
16116 case "$d_vfork" in
16117 $define) usevfork='true';;
16118 *) usevfork='false';;
16119 esac
16120
16121 : see whether the pthread_atfork exists
16122 $cat >try.c <<EOP
16123 #include <pthread.h>
16124 #include <stdio.h>
16125 int main() {
16126 #ifdef  PTHREAD_ATFORK
16127         pthread_atfork(NULL,NULL,NULL);
16128 #endif
16129 }
16130 EOP
16131
16132 : see if pthread_atfork exists
16133 set try -DPTHREAD_ATFORK
16134 if eval $compile; then
16135     val="$define"
16136 else
16137     val="$undef"
16138 fi
16139 case "$usethreads" in
16140 $define)
16141         case "$val" in
16142         $define) echo 'pthread_atfork found.' >&4        ;;
16143         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16144         esac
16145 esac
16146 set d_pthread_atfork
16147 eval $setvar
16148
16149 : see if pthread_attr_setscope exists
16150 set pthread_attr_setscope d_pthread_attr_setscope
16151 eval $inlibc
16152
16153 : see whether the various POSIXish _yields exist
16154 $cat >try.c <<EOP
16155 #include <pthread.h>
16156 #include <stdio.h>
16157 int main() {
16158 #ifdef SCHED_YIELD
16159         sched_yield();
16160 #else
16161 #ifdef PTHREAD_YIELD
16162         pthread_yield();
16163 #else
16164 #ifdef PTHREAD_YIELD_NULL
16165         pthread_yield(NULL);
16166 #endif
16167 #endif
16168 #endif
16169 }
16170 EOP
16171 : see if sched_yield exists
16172 set try -DSCHED_YIELD
16173 if eval $compile; then
16174     val="$define"
16175     sched_yield='sched_yield()'
16176 else
16177     val="$undef"
16178 fi
16179 case "$usethreads" in
16180 $define)
16181         case "$val" in
16182         $define) echo 'sched_yield() found.' >&4        ;;
16183         *)       echo 'sched_yield() NOT found.' >&4    ;;
16184         esac
16185 esac
16186 set d_sched_yield
16187 eval $setvar
16188
16189 : see if pthread_yield exists
16190 set try -DPTHREAD_YIELD
16191 if eval $compile; then
16192     val="$define"
16193     case "$sched_yield" in
16194     '') sched_yield='pthread_yield()' ;;
16195     esac
16196 else
16197     set try -DPTHREAD_YIELD_NULL
16198     if eval $compile; then
16199         val="$define"
16200         case "$sched_yield" in
16201         '') sched_yield='pthread_yield(NULL)' ;;
16202         esac
16203     else
16204         val="$undef"
16205     fi
16206 fi
16207 case "$usethreads" in
16208 $define)
16209         case "$val" in
16210         $define) echo 'pthread_yield() found.' >&4      ;;
16211         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16212         esac
16213         ;;
16214 esac
16215 set d_pthread_yield
16216 eval $setvar
16217 case "$sched_yield" in
16218 '') sched_yield=undef ;;
16219 esac
16220 $rm_try
16221
16222 : see if random_r exists
16223 set random_r d_random_r
16224 eval $inlibc
16225 case "$d_random_r" in
16226 "$define")
16227         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16228         case "$d_random_r_proto:$usethreads" in
16229         ":define")      d_random_r_proto=define
16230                 set d_random_r_proto random_r $hdrs
16231                 eval $hasproto ;;
16232         *)      ;;
16233         esac
16234         case "$d_random_r_proto" in
16235         define)
16236         case "$random_r_proto" in
16237         ''|0) try='int random_r(int*, struct random_data*);'
16238         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16239         esac
16240         case "$random_r_proto" in
16241         ''|0) try='int random_r(long*, struct random_data*);'
16242         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16243         esac
16244         case "$random_r_proto" in
16245         ''|0) try='int random_r(struct random_data*, int32_t*);'
16246         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16247         esac
16248         case "$random_r_proto" in
16249         ''|0)   d_random_r=undef
16250                 random_r_proto=0
16251                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16252         * )     case "$random_r_proto" in
16253                 REENTRANT_PROTO*) ;;
16254                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16255                 esac
16256                 echo "Prototype: $try" ;;
16257         esac
16258         ;;
16259         *)      case "$usethreads" in
16260                 define) echo "random_r has no prototype, not using it." >&4 ;;
16261                 esac
16262                 d_random_r=undef
16263                 random_r_proto=0
16264                 ;;
16265         esac
16266         ;;
16267 *)      random_r_proto=0
16268         ;;
16269 esac
16270
16271 : see if readdir and friends exist
16272 set readdir d_readdir
16273 eval $inlibc
16274 set seekdir d_seekdir
16275 eval $inlibc
16276 set telldir d_telldir
16277 eval $inlibc
16278 set rewinddir d_rewinddir
16279 eval $inlibc
16280
16281 : see if readdir64_r exists
16282 set readdir64_r d_readdir64_r
16283 eval $inlibc
16284 case "$d_readdir64_r" in
16285 "$define")
16286         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16287         case "$d_readdir64_r_proto:$usethreads" in
16288         ":define")      d_readdir64_r_proto=define
16289                 set d_readdir64_r_proto readdir64_r $hdrs
16290                 eval $hasproto ;;
16291         *)      ;;
16292         esac
16293         case "$d_readdir64_r_proto" in
16294         define)
16295         case "$readdir64_r_proto" in
16296         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16297         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16298         esac
16299         case "$readdir64_r_proto" in
16300         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16301         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16302         esac
16303         case "$readdir64_r_proto" in
16304         ''|0)   d_readdir64_r=undef
16305                 readdir64_r_proto=0
16306                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16307         * )     case "$readdir64_r_proto" in
16308                 REENTRANT_PROTO*) ;;
16309                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16310                 esac
16311                 echo "Prototype: $try" ;;
16312         esac
16313         ;;
16314         *)      case "$usethreads" in
16315                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16316                 esac
16317                 d_readdir64_r=undef
16318                 readdir64_r_proto=0
16319                 ;;
16320         esac
16321         ;;
16322 *)      readdir64_r_proto=0
16323         ;;
16324 esac
16325
16326 : see if readdir_r exists
16327 set readdir_r d_readdir_r
16328 eval $inlibc
16329 case "$d_readdir_r" in
16330 "$define")
16331         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16332         case "$d_readdir_r_proto:$usethreads" in
16333         ":define")      d_readdir_r_proto=define
16334                 set d_readdir_r_proto readdir_r $hdrs
16335                 eval $hasproto ;;
16336         *)      ;;
16337         esac
16338         case "$d_readdir_r_proto" in
16339         define)
16340         case "$readdir_r_proto" in
16341         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16342         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16343         esac
16344         case "$readdir_r_proto" in
16345         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16346         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16347         esac
16348         case "$readdir_r_proto" in
16349         ''|0)   d_readdir_r=undef
16350                 readdir_r_proto=0
16351                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16352         * )     case "$readdir_r_proto" in
16353                 REENTRANT_PROTO*) ;;
16354                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16355                 esac
16356                 echo "Prototype: $try" ;;
16357         esac
16358         ;;
16359         *)      case "$usethreads" in
16360                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16361                 esac
16362                 d_readdir_r=undef
16363                 readdir_r_proto=0
16364                 ;;
16365         esac
16366         ;;
16367 *)      readdir_r_proto=0
16368         ;;
16369 esac
16370
16371 : see if readv exists
16372 set readv d_readv
16373 eval $inlibc
16374
16375 : see if recvmsg exists
16376 set recvmsg d_recvmsg
16377 eval $inlibc
16378
16379 : see if rename exists
16380 set rename d_rename
16381 eval $inlibc
16382
16383 : see if rmdir exists
16384 set rmdir d_rmdir
16385 eval $inlibc
16386
16387 : see if memory.h is available.
16388 val=''
16389 set memory.h val
16390 eval $inhdr
16391
16392 : See if it conflicts with string.h
16393 case "$val" in
16394 $define)
16395         case "$strings" in
16396         '') ;;
16397         *)
16398                 $cppstdin $cppflags $cppminus < $strings > mem.h
16399                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16400                         echo " "
16401                         echo "We won't be including <memory.h>."
16402                         val="$undef"
16403                 fi
16404                 $rm -f mem.h
16405                 ;;
16406         esac
16407 esac
16408 set i_memory
16409 eval $setvar
16410
16411 : can bcopy handle overlapping blocks?
16412 echo " "
16413 val="$undef"
16414 case "$d_memmove" in
16415 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16416 *)      case "$d_bcopy" in
16417         "$define")
16418                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16419                 $cat >try.c <<EOCP
16420 #$i_memory I_MEMORY
16421 #$i_stdlib I_STDLIB
16422 #$i_string I_STRING
16423 #$i_unistd I_UNISTD
16424 EOCP
16425         $cat >>try.c <<'EOCP'
16426 #include <stdio.h>
16427 #ifdef I_MEMORY
16428 #  include <memory.h>
16429 #endif
16430 #ifdef I_STDLIB
16431 #  include <stdlib.h>
16432 #endif
16433 #ifdef I_STRING
16434 #  include <string.h>
16435 #else
16436 #  include <strings.h>
16437 #endif
16438 #ifdef I_UNISTD
16439 #  include <unistd.h>  /* Needed for NetBSD */
16440 #endif
16441 int main()
16442 {
16443 char buf[128], abc[128];
16444 char *b;
16445 int len;
16446 int off;
16447 int align;
16448
16449 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16450    try to store the string in read-only memory. */
16451 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16452
16453 for (align = 7; align >= 0; align--) {
16454         for (len = 36; len; len--) {
16455                 b = buf+align;
16456                 bcopy(abc, b, len);
16457                 for (off = 1; off <= len; off++) {
16458                         bcopy(b, b+off, len);
16459                         bcopy(b+off, b, len);
16460                         if (bcmp(b, abc, len))
16461                                 exit(1);
16462                 }
16463         }
16464 }
16465 exit(0);
16466 }
16467 EOCP
16468                 set try
16469                 if eval $compile_ok; then
16470                         if $run ./try 2>/dev/null; then
16471                                 echo "Yes, it can."
16472                                 val="$define"
16473                         else
16474                                 echo "It can't, sorry."
16475                         fi
16476                 else
16477                         echo "(I can't compile the test program, so we'll assume not...)"
16478                 fi
16479                 ;;
16480         esac
16481         $rm_try
16482         ;;
16483 esac
16484 set d_safebcpy
16485 eval $setvar
16486
16487 : can memcpy handle overlapping blocks?
16488 echo " "
16489 val="$undef"
16490 case "$d_memmove" in
16491 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16492 *)      case "$d_memcpy" in
16493         "$define")
16494                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16495                 $cat >try.c <<EOCP
16496 #$i_memory I_MEMORY
16497 #$i_stdlib I_STDLIB
16498 #$i_string I_STRING
16499 #$i_unistd I_UNISTD
16500 EOCP
16501         $cat >>try.c <<'EOCP'
16502 #include <stdio.h>
16503 #ifdef I_MEMORY
16504 #  include <memory.h>
16505 #endif
16506 #ifdef I_STDLIB
16507 #  include <stdlib.h>
16508 #endif
16509 #ifdef I_STRING
16510 #  include <string.h>
16511 #else
16512 #  include <strings.h>
16513 #endif
16514 #ifdef I_UNISTD
16515 #  include <unistd.h>  /* Needed for NetBSD */
16516 #endif
16517 int main()
16518 {
16519 char buf[128], abc[128];
16520 char *b;
16521 int len;
16522 int off;
16523 int align;
16524
16525 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16526    try to store the string in read-only memory. */
16527 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16528
16529 for (align = 7; align >= 0; align--) {
16530         for (len = 36; len; len--) {
16531                 b = buf+align;
16532                 memcpy(b, abc, len);
16533                 for (off = 1; off <= len; off++) {
16534                         memcpy(b+off, b, len);
16535                         memcpy(b, b+off, len);
16536                         if (memcmp(b, abc, len))
16537                                 exit(1);
16538                 }
16539         }
16540 }
16541 exit(0);
16542 }
16543 EOCP
16544                 set try
16545                 if eval $compile_ok; then
16546                         if $run ./try 2>/dev/null; then
16547                                 echo "Yes, it can."
16548                                 val="$define"
16549                         else
16550                                 echo "It can't, sorry."
16551                         fi
16552                 else
16553                         echo "(I can't compile the test program, so we'll assume not...)"
16554                 fi
16555                 ;;
16556         esac
16557         $rm_try
16558         ;;
16559 esac
16560 set d_safemcpy
16561 eval $setvar
16562
16563 : can memcmp be trusted to compare relative magnitude?
16564 val="$undef"
16565 case "$d_memcmp" in
16566 "$define")
16567         echo " "
16568         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16569         $cat >try.c <<EOCP
16570 #$i_memory I_MEMORY
16571 #$i_stdlib I_STDLIB
16572 #$i_string I_STRING
16573 #$i_unistd I_UNISTD
16574 EOCP
16575         $cat >>try.c <<'EOCP'
16576 #include <stdio.h>
16577 #ifdef I_MEMORY
16578 #  include <memory.h>
16579 #endif
16580 #ifdef I_STDLIB
16581 #  include <stdlib.h>
16582 #endif
16583 #ifdef I_STRING
16584 #  include <string.h>
16585 #else
16586 #  include <strings.h>
16587 #endif
16588 #ifdef I_UNISTD
16589 #  include <unistd.h>  /* Needed for NetBSD */
16590 #endif
16591 int main()
16592 {
16593 char a = -1;
16594 char b = 0;
16595 if ((a < b) && memcmp(&a, &b, 1) < 0)
16596         exit(1);
16597 exit(0);
16598 }
16599 EOCP
16600         set try
16601         if eval $compile_ok; then
16602                 if $run ./try 2>/dev/null; then
16603                         echo "Yes, it can."
16604                         val="$define"
16605                 else
16606                         echo "No, it can't (it uses signed chars)."
16607                 fi
16608         else
16609                 echo "(I can't compile the test program, so we'll assume not...)"
16610         fi
16611         ;;
16612 esac
16613 $rm_try
16614 set d_sanemcmp
16615 eval $setvar
16616
16617 : see if prototype for sbrk is available
16618 echo " "
16619 set d_sbrkproto sbrk $i_unistd unistd.h
16620 eval $hasproto
16621
16622 : see if select exists
16623 set select d_select
16624 eval $inlibc
16625
16626 : see if semctl exists
16627 set semctl d_semctl
16628 eval $inlibc
16629
16630 : see if semget exists
16631 set semget d_semget
16632 eval $inlibc
16633
16634 : see if semop exists
16635 set semop d_semop
16636 eval $inlibc
16637
16638 : see how much of the 'sem*(2)' library is present.
16639 h_sem=true
16640 echo " "
16641 case "$d_semctl$d_semget$d_semop" in
16642 *"$undef"*) h_sem=false;;
16643 esac
16644 case "$osname" in
16645 freebsd)
16646     case "`ipcs 2>&1`" in
16647     "SVID messages"*"not configured"*)
16648         echo "Your $osname does not have the sem*(2) configured." >&4
16649         h_sem=false
16650         val="$undef"
16651         set semctl d_semctl
16652         eval $setvar
16653         set semget d_semget
16654         eval $setvar
16655         set semop d_semop
16656         eval $setvar
16657         ;;
16658     esac
16659     ;;
16660 esac
16661 : we could also check for sys/ipc.h ...
16662 if $h_sem && $test `./findhdr sys/sem.h`; then
16663         echo "You have the full sem*(2) library." >&4
16664         val="$define"
16665 else
16666         echo "You don't have the full sem*(2) library." >&4
16667         val="$undef"
16668 fi
16669 set d_sem
16670 eval $setvar
16671
16672 : see whether sys/sem.h defines union semun
16673 echo " "
16674 $cat > try.c <<'END'
16675 #include <sys/types.h>
16676 #include <sys/ipc.h>
16677 #include <sys/sem.h>
16678 int main () { union semun semun; semun.buf = 0; }
16679 END
16680 set try
16681 if eval $compile; then
16682     echo "You have union semun in <sys/sem.h>." >&4
16683     val="$define"
16684 else
16685     echo "You do not have union semun in <sys/sem.h>." >&4
16686     val="$undef"
16687 fi
16688 $rm_try
16689 set d_union_semun
16690 eval $setvar
16691
16692 : see how to do semctl IPC_STAT
16693 case "$d_sem" in
16694 $define)
16695     echo " "
16696     $cat > tryh.h <<END
16697 #ifndef S_IRUSR
16698 #   ifdef S_IREAD
16699 #       define S_IRUSR S_IREAD
16700 #       define S_IWUSR S_IWRITE
16701 #       define S_IXUSR S_IEXEC
16702 #   else
16703 #       define S_IRUSR 0400
16704 #       define S_IWUSR 0200
16705 #       define S_IXUSR 0100
16706 #   endif
16707 #   define S_IRGRP (S_IRUSR>>3)
16708 #   define S_IWGRP (S_IWUSR>>3)
16709 #   define S_IXGRP (S_IXUSR>>3)
16710 #   define S_IROTH (S_IRUSR>>6)
16711 #   define S_IWOTH (S_IWUSR>>6)
16712 #   define S_IXOTH (S_IXUSR>>6)
16713 #endif
16714 #ifndef S_IRWXU
16715 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16716 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16717 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16718 #endif
16719 END
16720     : see whether semctl IPC_STAT can use union semun
16721     case "$d_semctl_semun" in
16722     '')
16723       val="$undef"
16724       $cat > try.c <<END
16725 #include <sys/types.h>
16726 #include <sys/ipc.h>
16727 #include <sys/sem.h>
16728 #include <sys/stat.h>
16729 #include <stdio.h>
16730 #include <errno.h>
16731 #include "tryh.h"
16732 #ifndef errno
16733 extern int errno;
16734 #endif
16735 #$d_union_semun HAS_UNION_SEMUN
16736 int main() {
16737     union semun
16738 #ifndef HAS_UNION_SEMUN
16739     {
16740         int val;
16741         struct semid_ds *buf;
16742         unsigned short *array;
16743     }
16744 #endif
16745     arg;
16746     int sem, st;
16747
16748 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16749     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16750     if (sem > -1) {
16751         struct semid_ds argbuf;
16752         arg.buf = &argbuf;
16753 #       ifdef IPC_STAT
16754         st = semctl(sem, 0, IPC_STAT, arg);
16755         if (st == 0)
16756             printf("semun\n");
16757         else
16758 #       endif /* IPC_STAT */
16759             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16760 #       ifdef IPC_RMID
16761         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16762 #       endif /* IPC_RMID */
16763             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16764     } else
16765 #endif /* IPC_PRIVATE && ... */
16766         printf("semget failed: errno = %d\n", errno);
16767   return 0;
16768 }
16769 END
16770       set try
16771       if eval $compile; then
16772           xxx=`$run ./try`
16773           case "$xxx" in
16774           semun) val="$define" ;;
16775           esac
16776       fi
16777       $rm_try
16778       set d_semctl_semun
16779       eval $setvar
16780       ;;
16781     esac
16782     case "$d_semctl_semun" in
16783     $define)
16784         echo "You can use union semun for semctl IPC_STAT." >&4
16785         also='also'
16786         ;;
16787     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16788         also=''
16789         ;;
16790     esac
16791
16792     : see whether semctl IPC_STAT can use struct semid_ds pointer
16793     case "$d_semctl_semid_ds" in
16794     '')
16795       val="$undef"
16796       $cat > try.c <<'END'
16797 #include <sys/types.h>
16798 #include <sys/ipc.h>
16799 #include <sys/sem.h>
16800 #include <sys/stat.h>
16801 #include "tryh.h"
16802 #include <stdio.h>
16803 #include <errno.h>
16804 #ifndef errno
16805 extern int errno;
16806 #endif
16807 int main() {
16808     struct semid_ds arg;
16809     int sem, st;
16810
16811 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16812     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16813     if (sem > -1) {
16814 #       ifdef IPC_STAT
16815         st = semctl(sem, 0, IPC_STAT, &arg);
16816         if (st == 0)
16817             printf("semid_ds\n");
16818         else
16819 #       endif /* IPC_STAT */
16820             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16821 #       ifdef IPC_RMID
16822         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16823 #       endif /* IPC_RMID */
16824             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16825     } else
16826 #endif /* IPC_PRIVATE && ... */
16827         printf("semget failed: errno = %d\n", errno);
16828
16829     return 0;
16830 }
16831 END
16832       set try
16833       if eval $compile; then
16834           xxx=`$run ./try`
16835           case "$xxx" in
16836           semid_ds) val="$define" ;;
16837           esac
16838       fi
16839       $rm_try
16840       set d_semctl_semid_ds
16841       eval $setvar
16842       ;;
16843     esac
16844     case "$d_semctl_semid_ds" in
16845     $define)
16846         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16847         ;;
16848     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16849         ;;
16850     esac
16851     ;;
16852 *)  val="$undef"
16853
16854     # We do not have the full sem*(2) library, so assume we can not
16855     # use either.
16856
16857     set d_semctl_semun
16858     eval $setvar
16859
16860     set d_semctl_semid_ds
16861     eval $setvar
16862     ;;
16863 esac
16864 $rm_try tryh.h
16865
16866 : see if sendmsg exists
16867 set sendmsg d_sendmsg
16868 eval $inlibc
16869
16870 : see if setegid exists
16871 set setegid d_setegid
16872 eval $inlibc
16873
16874 : see if seteuid exists
16875 set seteuid d_seteuid
16876 eval $inlibc
16877
16878 : see if setgrent exists
16879 set setgrent d_setgrent
16880 eval $inlibc
16881
16882 : see if setgrent_r exists
16883 set setgrent_r d_setgrent_r
16884 eval $inlibc
16885 case "$d_setgrent_r" in
16886 "$define")
16887         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16888         case "$d_setgrent_r_proto:$usethreads" in
16889         ":define")      d_setgrent_r_proto=define
16890                 set d_setgrent_r_proto setgrent_r $hdrs
16891                 eval $hasproto ;;
16892         *)      ;;
16893         esac
16894         case "$d_setgrent_r_proto" in
16895         define)
16896         case "$setgrent_r_proto" in
16897         ''|0) try='int setgrent_r(FILE**);'
16898         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16899         esac
16900         case "$setgrent_r_proto" in
16901         ''|0) try='void setgrent_r(FILE**);'
16902         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16903         esac
16904         case "$setgrent_r_proto" in
16905         ''|0)   d_setgrent_r=undef
16906                 setgrent_r_proto=0
16907                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16908         * )     case "$setgrent_r_proto" in
16909                 REENTRANT_PROTO*) ;;
16910                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16911                 esac
16912                 echo "Prototype: $try" ;;
16913         esac
16914         ;;
16915         *)      case "$usethreads" in
16916                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16917                 esac
16918                 d_setgrent_r=undef
16919                 setgrent_r_proto=0
16920                 ;;
16921         esac
16922         ;;
16923 *)      setgrent_r_proto=0
16924         ;;
16925 esac
16926
16927 : see if sethostent exists
16928 set sethostent d_sethent
16929 eval $inlibc
16930
16931 : see if sethostent_r exists
16932 set sethostent_r d_sethostent_r
16933 eval $inlibc
16934 case "$d_sethostent_r" in
16935 "$define")
16936         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16937         case "$d_sethostent_r_proto:$usethreads" in
16938         ":define")      d_sethostent_r_proto=define
16939                 set d_sethostent_r_proto sethostent_r $hdrs
16940                 eval $hasproto ;;
16941         *)      ;;
16942         esac
16943         case "$d_sethostent_r_proto" in
16944         define)
16945         case "$sethostent_r_proto" in
16946         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16947         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16948         esac
16949         case "$sethostent_r_proto" in
16950         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16951         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16952         esac
16953         case "$sethostent_r_proto" in
16954         ''|0)   d_sethostent_r=undef
16955                 sethostent_r_proto=0
16956                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16957         * )     case "$sethostent_r_proto" in
16958                 REENTRANT_PROTO*) ;;
16959                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16960                 esac
16961                 echo "Prototype: $try" ;;
16962         esac
16963         ;;
16964         *)      case "$usethreads" in
16965                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16966                 esac
16967                 d_sethostent_r=undef
16968                 sethostent_r_proto=0
16969                 ;;
16970         esac
16971         ;;
16972 *)      sethostent_r_proto=0
16973         ;;
16974 esac
16975
16976 : see if setitimer exists
16977 set setitimer d_setitimer
16978 eval $inlibc
16979
16980 : see if setlinebuf exists
16981 set setlinebuf d_setlinebuf
16982 eval $inlibc
16983
16984 : see if setlocale exists
16985 set setlocale d_setlocale
16986 eval $inlibc
16987
16988 : see if locale.h is available
16989 set locale.h i_locale
16990 eval $inhdr
16991
16992 : see if setlocale_r exists
16993 set setlocale_r d_setlocale_r
16994 eval $inlibc
16995 case "$d_setlocale_r" in
16996 "$define")
16997         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16998         case "$d_setlocale_r_proto:$usethreads" in
16999         ":define")      d_setlocale_r_proto=define
17000                 set d_setlocale_r_proto setlocale_r $hdrs
17001                 eval $hasproto ;;
17002         *)      ;;
17003         esac
17004         case "$d_setlocale_r_proto" in
17005         define)
17006         case "$setlocale_r_proto" in
17007         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17008         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17009         esac
17010         case "$setlocale_r_proto" in
17011         ''|0)   d_setlocale_r=undef
17012                 setlocale_r_proto=0
17013                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17014         * )     case "$setlocale_r_proto" in
17015                 REENTRANT_PROTO*) ;;
17016                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17017                 esac
17018                 echo "Prototype: $try" ;;
17019         esac
17020         ;;
17021         *)      case "$usethreads" in
17022                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17023                 esac
17024                 d_setlocale_r=undef
17025                 setlocale_r_proto=0
17026                 ;;
17027         esac
17028         ;;
17029 *)      setlocale_r_proto=0
17030         ;;
17031 esac
17032
17033 : see if setnetent exists
17034 set setnetent d_setnent
17035 eval $inlibc
17036
17037 : see if setnetent_r exists
17038 set setnetent_r d_setnetent_r
17039 eval $inlibc
17040 case "$d_setnetent_r" in
17041 "$define")
17042         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17043         case "$d_setnetent_r_proto:$usethreads" in
17044         ":define")      d_setnetent_r_proto=define
17045                 set d_setnetent_r_proto setnetent_r $hdrs
17046                 eval $hasproto ;;
17047         *)      ;;
17048         esac
17049         case "$d_setnetent_r_proto" in
17050         define)
17051         case "$setnetent_r_proto" in
17052         ''|0) try='int setnetent_r(int, struct netent_data*);'
17053         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17054         esac
17055         case "$setnetent_r_proto" in
17056         ''|0) try='void setnetent_r(int, struct netent_data*);'
17057         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17058         esac
17059         case "$setnetent_r_proto" in
17060         ''|0)   d_setnetent_r=undef
17061                 setnetent_r_proto=0
17062                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17063         * )     case "$setnetent_r_proto" in
17064                 REENTRANT_PROTO*) ;;
17065                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17066                 esac
17067                 echo "Prototype: $try" ;;
17068         esac
17069         ;;
17070         *)      case "$usethreads" in
17071                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17072                 esac
17073                 d_setnetent_r=undef
17074                 setnetent_r_proto=0
17075                 ;;
17076         esac
17077         ;;
17078 *)      setnetent_r_proto=0
17079         ;;
17080 esac
17081
17082 : see if setprotoent exists
17083 set setprotoent d_setpent
17084 eval $inlibc
17085
17086 : see if setpgid exists
17087 set setpgid d_setpgid
17088 eval $inlibc
17089
17090 : see if setpgrp2 exists
17091 set setpgrp2 d_setpgrp2
17092 eval $inlibc
17093
17094 : see if setpriority exists
17095 set setpriority d_setprior
17096 eval $inlibc
17097
17098 : see if setproctitle exists
17099 set setproctitle d_setproctitle
17100 eval $inlibc
17101
17102 : see if setprotoent_r exists
17103 set setprotoent_r d_setprotoent_r
17104 eval $inlibc
17105 case "$d_setprotoent_r" in
17106 "$define")
17107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17108         case "$d_setprotoent_r_proto:$usethreads" in
17109         ":define")      d_setprotoent_r_proto=define
17110                 set d_setprotoent_r_proto setprotoent_r $hdrs
17111                 eval $hasproto ;;
17112         *)      ;;
17113         esac
17114         case "$d_setprotoent_r_proto" in
17115         define)
17116         case "$setprotoent_r_proto" in
17117         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17118         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17119         esac
17120         case "$setprotoent_r_proto" in
17121         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17122         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17123         esac
17124         case "$setprotoent_r_proto" in
17125         ''|0)   d_setprotoent_r=undef
17126                 setprotoent_r_proto=0
17127                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17128         * )     case "$setprotoent_r_proto" in
17129                 REENTRANT_PROTO*) ;;
17130                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17131                 esac
17132                 echo "Prototype: $try" ;;
17133         esac
17134         ;;
17135         *)      case "$usethreads" in
17136                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17137                 esac
17138                 d_setprotoent_r=undef
17139                 setprotoent_r_proto=0
17140                 ;;
17141         esac
17142         ;;
17143 *)      setprotoent_r_proto=0
17144         ;;
17145 esac
17146
17147 : see if setpwent exists
17148 set setpwent d_setpwent
17149 eval $inlibc
17150
17151 : see if setpwent_r exists
17152 set setpwent_r d_setpwent_r
17153 eval $inlibc
17154 case "$d_setpwent_r" in
17155 "$define")
17156         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17157         case "$d_setpwent_r_proto:$usethreads" in
17158         ":define")      d_setpwent_r_proto=define
17159                 set d_setpwent_r_proto setpwent_r $hdrs
17160                 eval $hasproto ;;
17161         *)      ;;
17162         esac
17163         case "$d_setpwent_r_proto" in
17164         define)
17165         case "$setpwent_r_proto" in
17166         ''|0) try='int setpwent_r(FILE**);'
17167         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17168         esac
17169         case "$setpwent_r_proto" in
17170         ''|0) try='void setpwent_r(FILE**);'
17171         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17172         esac
17173         case "$setpwent_r_proto" in
17174         ''|0)   d_setpwent_r=undef
17175                 setpwent_r_proto=0
17176                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17177         * )     case "$setpwent_r_proto" in
17178                 REENTRANT_PROTO*) ;;
17179                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17180                 esac
17181                 echo "Prototype: $try" ;;
17182         esac
17183         ;;
17184         *)      case "$usethreads" in
17185                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17186                 esac
17187                 d_setpwent_r=undef
17188                 setpwent_r_proto=0
17189                 ;;
17190         esac
17191         ;;
17192 *)      setpwent_r_proto=0
17193         ;;
17194 esac
17195
17196 : see if setregid exists
17197 set setregid d_setregid
17198 eval $inlibc
17199 set setresgid d_setresgid
17200 eval $inlibc
17201
17202 : see if setreuid exists
17203 set setreuid d_setreuid
17204 eval $inlibc
17205 set setresuid d_setresuid
17206 eval $inlibc
17207
17208 : see if setrgid exists
17209 set setrgid d_setrgid
17210 eval $inlibc
17211
17212 : see if setruid exists
17213 set setruid d_setruid
17214 eval $inlibc
17215
17216 : see if setservent exists
17217 set setservent d_setsent
17218 eval $inlibc
17219
17220 : see if setservent_r exists
17221 set setservent_r d_setservent_r
17222 eval $inlibc
17223 case "$d_setservent_r" in
17224 "$define")
17225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17226         case "$d_setservent_r_proto:$usethreads" in
17227         ":define")      d_setservent_r_proto=define
17228                 set d_setservent_r_proto setservent_r $hdrs
17229                 eval $hasproto ;;
17230         *)      ;;
17231         esac
17232         case "$d_setservent_r_proto" in
17233         define)
17234         case "$setservent_r_proto" in
17235         ''|0) try='int setservent_r(int, struct servent_data*);'
17236         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17237         esac
17238         case "$setservent_r_proto" in
17239         ''|0) try='void setservent_r(int, struct servent_data*);'
17240         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17241         esac
17242         case "$setservent_r_proto" in
17243         ''|0)   d_setservent_r=undef
17244                 setservent_r_proto=0
17245                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17246         * )     case "$setservent_r_proto" in
17247                 REENTRANT_PROTO*) ;;
17248                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17249                 esac
17250                 echo "Prototype: $try" ;;
17251         esac
17252         ;;
17253         *)      case "$usethreads" in
17254                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17255                 esac
17256                 d_setservent_r=undef
17257                 setservent_r_proto=0
17258                 ;;
17259         esac
17260         ;;
17261 *)      setservent_r_proto=0
17262         ;;
17263 esac
17264
17265 : see if setsid exists
17266 set setsid d_setsid
17267 eval $inlibc
17268
17269 : see if setvbuf exists
17270 set setvbuf d_setvbuf
17271 eval $inlibc
17272
17273 : see if sfio.h is available
17274 set sfio.h i_sfio
17275 eval $inhdr
17276
17277 : see if sfio library is available
17278 case "$i_sfio" in
17279 $define)
17280         val=''
17281         set sfreserve val
17282         eval $inlibc
17283         ;;
17284 *)
17285         val="$undef"
17286         ;;
17287 esac
17288 : Ok, but do we want to use it.
17289 case "$val" in
17290 $define)
17291         case "$usesfio" in
17292         true|$define|[yY]*) dflt='y';;
17293         *) dflt='n';;
17294         esac
17295         echo "$package can use the sfio library, but it is experimental."
17296         case "$useperlio" in
17297         "$undef")
17298             echo "For sfio also the PerlIO abstraction layer is needed."
17299             echo "Earlier you said you wouldn't want that."
17300             ;;
17301         esac
17302         rp="You seem to have sfio available, do you want to try using it?"
17303         . ./myread
17304         case "$ans" in
17305         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17306                 useperlio="$define"
17307                 val="$define"
17308                 ;;
17309         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17310                 val="$undef"
17311                 ;;
17312         esac
17313         ;;
17314 *)      case "$usesfio" in
17315         true|$define|[yY]*)
17316                 echo "Sorry, cannot find sfio on this machine." >&4
17317                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17318                 val="$undef"
17319                 ;;
17320         esac
17321         ;;
17322 esac
17323 set d_sfio
17324 eval $setvar
17325 case "$d_sfio" in
17326 $define) usesfio='true';;
17327 *) usesfio='false';;
17328 esac
17329 case "$d_sfio" in
17330 $define) ;;
17331 *)      : Remove sfio from list of libraries to use
17332         case "$libs" in
17333         *-lsfio*)
17334                 echo "Removing unneeded -lsfio from library list" >&4
17335                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17336                 shift
17337                 libs="$*"
17338                 echo "libs = $libs" >&4
17339                 ;;
17340         esac
17341 ;;
17342 esac
17343
17344
17345 : see if shmctl exists
17346 set shmctl d_shmctl
17347 eval $inlibc
17348
17349 : see if shmget exists
17350 set shmget d_shmget
17351 eval $inlibc
17352
17353 : see if shmat exists
17354 set shmat d_shmat
17355 eval $inlibc
17356 : see what shmat returns
17357 case "$d_shmat" in
17358 "$define")
17359         $cat >shmat.c <<'END'
17360 #include <sys/shm.h>
17361 void *shmat();
17362 END
17363         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17364                 shmattype='void *'
17365         else
17366                 shmattype='char *'
17367         fi
17368         echo "and it returns ($shmattype)." >&4
17369         : see if a prototype for shmat is available
17370         xxx=`./findhdr sys/shm.h`
17371         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17372         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17373                 val="$define"
17374         else
17375                 val="$undef"
17376         fi
17377         $rm -f shmat.[co]
17378         ;;
17379 *)
17380         val="$undef"
17381         ;;
17382 esac
17383 set d_shmatprototype
17384 eval $setvar
17385
17386 : see if shmdt exists
17387 set shmdt d_shmdt
17388 eval $inlibc
17389
17390 : see how much of the 'shm*(2)' library is present.
17391 h_shm=true
17392 echo " "
17393 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17394 *"$undef"*) h_shm=false;;
17395 esac
17396 case "$osname" in
17397 freebsd)
17398     case "`ipcs 2>&1`" in
17399     "SVID shared memory"*"not configured"*)
17400         echo "Your $osname does not have the shm*(2) configured." >&4
17401         h_shm=false
17402         val="$undef"
17403         set shmctl d_shmctl
17404         evat $setvar
17405         set shmget d_shmget
17406         evat $setvar
17407         set shmat d_shmat
17408         evat $setvar
17409         set shmdt d_shmdt
17410         evat $setvar
17411         ;;
17412     esac
17413     ;;
17414 esac
17415 : we could also check for sys/ipc.h ...
17416 if $h_shm && $test `./findhdr sys/shm.h`; then
17417         echo "You have the full shm*(2) library." >&4
17418         val="$define"
17419 else
17420         echo "You don't have the full shm*(2) library." >&4
17421         val="$undef"
17422 fi
17423 set d_shm
17424 eval $setvar
17425
17426 : see if we have sigaction
17427 echo " "
17428 if set sigaction val -f d_sigaction; eval $csym; $val; then
17429         echo 'sigaction() found.' >&4
17430         $cat > try.c <<EOP
17431 #include <stdio.h>
17432 #include <sys/types.h>
17433 #include <signal.h>
17434 #$i_stdlib I_STDLIB
17435 #ifdef I_STDLIB
17436 #include <stdlib.h>
17437 #endif
17438 int main()
17439 {
17440     struct sigaction act, oact;
17441     act.sa_flags = 0;
17442     oact.sa_handler = 0;
17443     /* so that act and oact are used */
17444     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17445 }
17446 EOP
17447         set try
17448         if eval $compile_ok; then
17449                 val="$define"
17450         else
17451                 echo "But you don't seem to have a useable struct sigaction." >&4
17452                 val="$undef"
17453         fi
17454 else
17455         echo 'sigaction NOT found.' >&4
17456         val="$undef"
17457 fi
17458 set d_sigaction; eval $setvar
17459 $rm_try
17460
17461 : see if this is a sunmath.h system
17462 set sunmath.h i_sunmath
17463 eval $inhdr
17464
17465 : see if signbit exists
17466 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17467 $cat >try.c <<EOCP
17468 #$i_math I_MATH
17469 #$i_sunmath I_SUNMATH
17470 #ifdef I_MATH
17471 #  include <math.h>
17472 #endif
17473 #ifdef I_SUNMATH  /* Solaris special math library */
17474 #  include <sunmath.h>
17475 #endif
17476 #define NV $nvtype
17477 int main(int argc, char **argv)
17478 {
17479     NV x = 0.0;
17480     NV y = -0.0;
17481     if ((signbit(x) == 0) && (signbit(y) != 0))
17482         return 0;
17483     else
17484         return 1;
17485 }
17486 EOCP
17487 val="$undef"
17488 set try
17489 if eval $compile; then
17490     if $run ./try; then
17491         $echo "Yes." >&4
17492         val="$define"
17493     else
17494         $echo "Signbit seems to be available, but doesn't work as I expected."
17495         $echo "I won't use it." >&4
17496         val="$undef"
17497     fi
17498 else
17499     $echo "Nope." >&4
17500     dflt="$undef"
17501 fi
17502 set d_signbit
17503 eval $setvar
17504 $rm_try
17505
17506 : see if sigprocmask exists
17507 set sigprocmask d_sigprocmask
17508 eval $inlibc
17509
17510 : see if sigsetjmp exists
17511 echo " "
17512 case "$d_sigsetjmp" in
17513 '')
17514         $cat >try.c <<EOP
17515 #include <setjmp.h>
17516 #$i_stdlib I_STDLIB
17517 #ifdef I_STDLIB
17518 #include <stdlib.h>
17519 #endif
17520 sigjmp_buf env;
17521 int set = 1;
17522 int main()
17523 {
17524         if (sigsetjmp(env,1))
17525                 exit(set);
17526         set = 0;
17527         siglongjmp(env, 1);
17528         exit(1);
17529 }
17530 EOP
17531         set try
17532         if eval $compile; then
17533                 if $run ./try >/dev/null 2>&1; then
17534                         echo "POSIX sigsetjmp found." >&4
17535                         val="$define"
17536                 else
17537                         $cat >&4 <<EOM
17538 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17539 I'll ignore them.
17540 EOM
17541                         val="$undef"
17542                 fi
17543         else
17544                 echo "sigsetjmp not found." >&4
17545                 val="$undef"
17546         fi
17547         ;;
17548 *) val="$d_sigsetjmp"
17549         case "$d_sigsetjmp" in
17550         $define) echo "POSIX sigsetjmp found." >&4;;
17551         $undef) echo "sigsetjmp not found." >&4;;
17552         esac
17553         ;;
17554 esac
17555 set d_sigsetjmp
17556 eval $setvar
17557 $rm_try
17558
17559 : see if snprintf exists
17560 set snprintf d_snprintf
17561 eval $inlibc
17562
17563 : see if vsnprintf exists
17564 set vsnprintf d_vsnprintf
17565 eval $inlibc
17566
17567 case "$d_snprintf-$d_vsnprintf" in
17568 "$define-$define")
17569     $cat <<EOM
17570 Checking whether your snprintf() and vsnprintf() work okay...
17571 EOM
17572     $cat >try.c <<'EOCP'
17573 /* v?snprintf testing logic courtesy of Russ Allbery.
17574  * According to C99:
17575  * - if the buffer is too short it still must be \0-terminated
17576  * - if the buffer is too short the potentially required length
17577  *   must be returned and not -1
17578  * - if the buffer is NULL the potentially required length
17579  *   must be returned and not -1 or core dump
17580  */
17581 #include <stdio.h>
17582 #include <stdarg.h>
17583
17584 char buf[2];
17585
17586 int test (char *format, ...)
17587 {
17588     va_list args;
17589     int count;
17590
17591     va_start (args, format);
17592     count = vsnprintf (buf, sizeof buf, format, args);
17593     va_end (args);
17594     return count;
17595 }
17596
17597 int main ()
17598 {
17599     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17600              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17601 }
17602 EOCP
17603     set try
17604     if eval $compile; then
17605         `$run ./try`
17606         case "$?" in
17607         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17608         *) cat <<EOM >&4
17609 Your snprintf() and snprintf() don't seem to be working okay.
17610 EOM
17611            d_snprintf="$undef"
17612            d_vsnprintf="$undef"
17613            ;;
17614         esac
17615     else
17616         echo "(I can't seem to compile the test program--assuming they don't)"
17617         d_snprintf="$undef"
17618         d_vsnprintf="$undef"
17619     fi
17620     $rm_try
17621     ;;
17622 esac
17623
17624 : see if sockatmark exists
17625 set sockatmark d_sockatmark
17626 eval $inlibc
17627
17628 : see if prototype for sockatmark is available
17629 echo " "
17630 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17631 eval $hasproto
17632
17633 : see if socks5_init exists
17634 set socks5_init d_socks5_init
17635 eval $inlibc
17636
17637 : see if sprintf returns the length of the string in the buffer as per ANSI
17638 $echo "Checking whether sprintf returns the length of the string..." >&4
17639 $cat <<EOP >try.c
17640 #include <stdio.h>
17641 #$i_stdlib I_STDLIB
17642 #ifdef I_STDLIB
17643 #include <stdlib.h>
17644 #endif
17645 #$i_string I_STRING
17646 #ifdef I_STRING
17647 #  include <string.h>
17648 #else
17649 #  include <strings.h>
17650 #endif
17651 #$i_math I_MATH
17652 #ifdef I_MATH
17653 #include <math.h>
17654 #endif
17655
17656 char buffer[256];
17657
17658 int check (size_t expect, int test) {
17659   size_t got = strlen(buffer);
17660   if (expect == got)
17661     return 0;
17662
17663   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17664        test, buffer);
17665   exit (test);
17666 }
17667
17668 int main(int argc, char **argv) {
17669   int test = 0;
17670
17671   check(sprintf(buffer, ""), ++test);
17672   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17673   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17674
17675   return 0;
17676 }
17677 EOP
17678 set try
17679
17680 if eval $compile; then
17681     xxx="`$run ./try`"
17682     case "$?" in
17683         0) cat >&4 <<EOM
17684 sprintf returns the length of the string (as ANSI says it should)
17685 EOM
17686         d_sprintf_returns_strlen="$define"
17687         ;;
17688         *) cat >&4 <<EOM
17689 sprintf does not return the length of the string (how old is this system?)
17690 EOM
17691         d_sprintf_returns_strlen="$undef"
17692         ;;
17693     esac
17694 else
17695     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17696     d_sprintf_returns_strlen="$undef"
17697 fi
17698 $rm_try
17699
17700 : see if srand48_r exists
17701 set srand48_r d_srand48_r
17702 eval $inlibc
17703 case "$d_srand48_r" in
17704 "$define")
17705         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17706         case "$d_srand48_r_proto:$usethreads" in
17707         ":define")      d_srand48_r_proto=define
17708                 set d_srand48_r_proto srand48_r $hdrs
17709                 eval $hasproto ;;
17710         *)      ;;
17711         esac
17712         case "$d_srand48_r_proto" in
17713         define)
17714         case "$srand48_r_proto" in
17715         ''|0) try='int srand48_r(long, struct drand48_data*);'
17716         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17717         esac
17718         case "$srand48_r_proto" in
17719         ''|0)   d_srand48_r=undef
17720                 srand48_r_proto=0
17721                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17722         * )     case "$srand48_r_proto" in
17723                 REENTRANT_PROTO*) ;;
17724                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17725                 esac
17726                 echo "Prototype: $try" ;;
17727         esac
17728         ;;
17729         *)      case "$usethreads" in
17730                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17731                 esac
17732                 d_srand48_r=undef
17733                 srand48_r_proto=0
17734                 ;;
17735         esac
17736         ;;
17737 *)      srand48_r_proto=0
17738         ;;
17739 esac
17740
17741 : see if srandom_r exists
17742 set srandom_r d_srandom_r
17743 eval $inlibc
17744 case "$d_srandom_r" in
17745 "$define")
17746         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17747         case "$d_srandom_r_proto:$usethreads" in
17748         ":define")      d_srandom_r_proto=define
17749                 set d_srandom_r_proto srandom_r $hdrs
17750                 eval $hasproto ;;
17751         *)      ;;
17752         esac
17753         case "$d_srandom_r_proto" in
17754         define)
17755         case "$srandom_r_proto" in
17756         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17757         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17758         esac
17759         case "$srandom_r_proto" in
17760         ''|0)   d_srandom_r=undef
17761                 srandom_r_proto=0
17762                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17763         * )     case "$srandom_r_proto" in
17764                 REENTRANT_PROTO*) ;;
17765                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17766                 esac
17767                 echo "Prototype: $try" ;;
17768         esac
17769         ;;
17770         *)      case "$usethreads" in
17771                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17772                 esac
17773                 d_srandom_r=undef
17774                 srandom_r_proto=0
17775                 ;;
17776         esac
17777         ;;
17778 *)      srandom_r_proto=0
17779         ;;
17780 esac
17781
17782 : see if prototype for setresgid is available
17783 echo " "
17784 set d_sresgproto setresgid $i_unistd unistd.h
17785 eval $hasproto
17786
17787 : see if prototype for setresuid is available
17788 echo " "
17789 set d_sresuproto setresuid $i_unistd unistd.h
17790 eval $hasproto
17791
17792 : see if sys/stat.h is available
17793 set sys/stat.h i_sysstat
17794 eval $inhdr
17795
17796 : see if stat knows about block sizes
17797 echo " "
17798 echo "Checking to see if your struct stat has st_blocks field..." >&4
17799 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17800 eval $hasfield
17801
17802 : see if this is a sys/vfs.h system
17803 set sys/vfs.h i_sysvfs
17804 eval $inhdr
17805
17806 : see if this is a sys/statfs.h system
17807 set sys/statfs.h i_sysstatfs
17808 eval $inhdr
17809
17810 : Check for statfs_s
17811 echo " "
17812 echo "Checking to see if your system supports struct statfs..." >&4
17813 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
17814 eval $hasstruct
17815 case "$d_statfs_s" in
17816 "$define")      echo "Yes, it does."   ;;
17817 *)              echo "No, it doesn't." ;;
17818 esac
17819
17820
17821 : see if struct statfs knows about f_flags
17822 case "$d_statfs_s" in
17823 define)
17824         echo " "
17825         echo "Checking to see if your struct statfs has f_flags field..." >&4
17826         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
17827         eval $hasfield
17828         ;;
17829 *)      val="$undef"
17830         set d_statfs_f_flags
17831         eval $setvar
17832         ;;
17833 esac
17834 case "$d_statfs_f_flags" in
17835 "$define")      echo "Yes, it does."   ;;
17836 *)              echo "No, it doesn't." ;;
17837 esac
17838
17839 : Check stream access
17840 $cat >&4 <<EOM
17841 Checking how to access stdio streams by file descriptor number...
17842 EOM
17843 case "$stdio_stream_array" in
17844 '')     $cat >try.c <<EOCP
17845 #include <stdio.h>
17846 int main() {
17847   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17848     printf("yes\n");
17849 }
17850 EOCP
17851         for s in _iob __iob __sF
17852         do
17853                 set try -DSTDIO_STREAM_ARRAY=$s
17854                 if eval $compile; then
17855                         case "`$run ./try`" in
17856                         yes)    stdio_stream_array=$s; break ;;
17857                         esac
17858                 fi
17859         done
17860         $rm_try
17861 esac
17862 case "$stdio_stream_array" in
17863 '')     $cat >&4 <<EOM
17864 I can't figure out how to access stdio streams by file descriptor number.
17865 EOM
17866         d_stdio_stream_array="$undef"
17867         ;;
17868 *)      $cat >&4 <<EOM
17869 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17870 EOM
17871         d_stdio_stream_array="$define"
17872         ;;
17873 esac
17874
17875 : see if strcoll exists
17876 set strcoll d_strcoll
17877 eval $inlibc
17878
17879 : check for structure copying
17880 echo " "
17881 echo "Checking to see if your C compiler can copy structs..." >&4
17882 $cat >try.c <<'EOCP'
17883 int main()
17884 {
17885         struct blurfl {
17886                 int dyick;
17887         } foo, bar;
17888
17889         foo = bar;
17890 }
17891 EOCP
17892 if $cc -c try.c >/dev/null 2>&1 ; then
17893         val="$define"
17894         echo "Yup, it can."
17895 else
17896         val="$undef"
17897         echo "Nope, it can't."
17898 fi
17899 set d_strctcpy
17900 eval $setvar
17901 $rm_try
17902
17903 : see if strerror and/or sys_errlist[] exist
17904 echo " "
17905 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17906     if set strerror val -f d_strerror; eval $csym; $val; then
17907                 echo 'strerror() found.' >&4
17908                 d_strerror="$define"
17909                 d_strerrm='strerror(e)'
17910                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17911                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17912                         d_syserrlst="$define"
17913                 else
17914                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17915                         d_syserrlst="$undef"
17916                 fi
17917     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17918                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17919                 echo 'strerror() found in string header.' >&4
17920                 d_strerror="$define"
17921                 d_strerrm='strerror(e)'
17922                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17923                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17924                                 d_syserrlst="$define"
17925                 else
17926                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17927                         d_syserrlst="$undef"
17928                 fi
17929     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17930                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17931                 d_strerror="$undef"
17932                 d_syserrlst="$define"
17933                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17934     else
17935                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17936                 d_strerror="$undef"
17937                 d_syserrlst="$undef"
17938                 d_strerrm='"unknown"'
17939     fi
17940 fi
17941
17942 : see if strerror_r exists
17943 set strerror_r d_strerror_r
17944 eval $inlibc
17945 case "$d_strerror_r" in
17946 "$define")
17947         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17948         case "$d_strerror_r_proto:$usethreads" in
17949         ":define")      d_strerror_r_proto=define
17950                 set d_strerror_r_proto strerror_r $hdrs
17951                 eval $hasproto ;;
17952         *)      ;;
17953         esac
17954         case "$d_strerror_r_proto" in
17955         define)
17956         case "$strerror_r_proto" in
17957         ''|0) try='int strerror_r(int, char*, size_t);'
17958         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
17959         esac
17960         case "$strerror_r_proto" in
17961         ''|0) try='int strerror_r(int, char*, int);'
17962         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
17963         esac
17964         case "$strerror_r_proto" in
17965         ''|0) try='char* strerror_r(int, char*, size_t);'
17966         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
17967         esac
17968         case "$strerror_r_proto" in
17969         ''|0)   d_strerror_r=undef
17970                 strerror_r_proto=0
17971                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17972         * )     case "$strerror_r_proto" in
17973                 REENTRANT_PROTO*) ;;
17974                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17975                 esac
17976                 echo "Prototype: $try" ;;
17977         esac
17978         ;;
17979         *)      case "$usethreads" in
17980                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17981                 esac
17982                 d_strerror_r=undef
17983                 strerror_r_proto=0
17984                 ;;
17985         esac
17986         ;;
17987 *)      strerror_r_proto=0
17988         ;;
17989 esac
17990
17991 : see if strftime exists
17992 set strftime d_strftime
17993 eval $inlibc
17994
17995 : see if strlcat exists
17996 set strlcat d_strlcat
17997 eval $inlibc
17998
17999 : see if strlcpy exists
18000 set strlcpy d_strlcpy
18001 eval $inlibc
18002
18003 : see if strtod exists
18004 set strtod d_strtod
18005 eval $inlibc
18006
18007 : see if strtol exists
18008 set strtol d_strtol
18009 eval $inlibc
18010
18011 : see if strtold exists
18012 set strtold d_strtold
18013 eval $inlibc
18014
18015 : see if strtoll exists
18016 set strtoll d_strtoll
18017 eval $inlibc
18018
18019 case "$d_longlong-$d_strtoll" in
18020 "$define-$define")
18021         $cat <<EOM
18022 Checking whether your strtoll() works okay...
18023 EOM
18024         $cat >try.c <<'EOCP'
18025 #include <errno.h>
18026 #ifdef __hpux
18027 #define strtoll __strtoll
18028 #endif
18029 #ifdef __EMX__
18030 #define strtoll _strtoll
18031 #endif
18032 #include <stdio.h>
18033 extern long long int strtoll(char *s, char **, int);
18034 static int bad = 0;
18035 int check(char *s, long long ell, int een) {
18036         long long gll;
18037         errno = 0;
18038         gll = strtoll(s, 0, 10);
18039         if (!((gll == ell) && (errno == een)))
18040                 bad++;
18041 }
18042 int main() {
18043         check(" 1",                                      1LL, 0);
18044         check(" 0",                                      0LL, 0);
18045         check("-1",                                     -1LL, 0);
18046         check("-9223372036854775808", -9223372036854775808LL, 0);
18047         check("-9223372036854775808", -9223372036854775808LL, 0);
18048         check(" 9223372036854775807",  9223372036854775807LL, 0);
18049         check("-9223372036854775808", -9223372036854775808LL, 0);
18050         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18051         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18052         if (!bad)
18053                 printf("ok\n");
18054 }
18055 EOCP
18056         set try
18057         if eval $compile; then
18058                 yyy=`$run ./try`
18059                 case "$yyy" in
18060                 ok) echo "Your strtoll() seems to be working okay." ;;
18061                 *) cat <<EOM >&4
18062 Your strtoll() doesn't seem to be working okay.
18063 EOM
18064                    d_strtoll="$undef"
18065                    ;;
18066                 esac
18067         else
18068                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18069                 d_strtoll="$undef"
18070         fi
18071         ;;
18072 esac
18073
18074 : see if strtoq exists
18075 set strtoq d_strtoq
18076 eval $inlibc
18077
18078 : see if strtoul exists
18079 set strtoul d_strtoul
18080 eval $inlibc
18081
18082 case "$d_strtoul" in
18083 "$define")
18084         $cat <<EOM
18085 Checking whether your strtoul() works okay...
18086 EOM
18087         $cat >try.c <<'EOCP'
18088 #include <errno.h>
18089 #include <stdio.h>
18090 extern unsigned long int strtoul(char *s, char **, int);
18091 static int bad = 0;
18092 void check(char *s, unsigned long eul, int een) {
18093         unsigned long gul;
18094         errno = 0;
18095         gul = strtoul(s, 0, 10);
18096         if (!((gul == eul) && (errno == een)))
18097                 bad++;
18098 }
18099 int main() {
18100         check(" 1", 1L, 0);
18101         check(" 0", 0L, 0);
18102 EOCP
18103         case "$longsize" in
18104         8)
18105             $cat >>try.c <<'EOCP'
18106         check("18446744073709551615", 18446744073709551615UL, 0);
18107         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18108 #if 0 /* strtoul() for /^-/ strings is undefined. */
18109         check("-1", 18446744073709551615UL, 0);
18110         check("-18446744073709551614", 2, 0);
18111         check("-18446744073709551615", 1, 0);
18112         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18113         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18114 #endif
18115 EOCP
18116                 ;;
18117         4)
18118                     $cat >>try.c <<'EOCP'
18119         check("4294967295", 4294967295UL, 0);
18120         check("4294967296", 4294967295UL, ERANGE);
18121 #if 0 /* strtoul() for /^-/ strings is undefined. */
18122         check("-1", 4294967295UL, 0);
18123         check("-4294967294", 2, 0);
18124         check("-4294967295", 1, 0);
18125         check("-4294967296", 4294967295UL, ERANGE);
18126         check("-4294967297", 4294967295UL, ERANGE);
18127 #endif
18128 EOCP
18129                 ;;
18130         *)
18131 : Should we write these tests to be more portable by sprintf-ing
18132 : ~0 and then manipulating that char string as input for strtol?
18133                 ;;
18134         esac
18135         $cat >>try.c <<'EOCP'
18136         if (!bad)
18137                 printf("ok\n");
18138         return 0;
18139 }
18140 EOCP
18141         set try
18142         if eval $compile; then
18143                 case "`$run ./try`" in
18144                 ok) echo "Your strtoul() seems to be working okay." ;;
18145                 *) cat <<EOM >&4
18146 Your strtoul() doesn't seem to be working okay.
18147 EOM
18148                    d_strtoul="$undef"
18149                    ;;
18150                 esac
18151         else
18152                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18153                 d_strtoul="$undef"
18154         fi
18155         ;;
18156 esac
18157
18158 : see if strtoull exists
18159 set strtoull d_strtoull
18160 eval $inlibc
18161
18162 case "$d_longlong-$d_strtoull" in
18163 "$define-$define")
18164         $cat <<EOM
18165 Checking whether your strtoull() works okay...
18166 EOM
18167         $cat >try.c <<'EOCP'
18168 #include <errno.h>
18169 #ifdef __hpux
18170 #define strtoull __strtoull
18171 #endif
18172 #include <stdio.h>
18173 extern unsigned long long int strtoull(char *s, char **, int);
18174 static int bad = 0;
18175 int check(char *s, long long eull, int een) {
18176         long long gull;
18177         errno = 0;
18178         gull = strtoull(s, 0, 10);
18179         if (!((gull == eull) && (errno == een)))
18180                 bad++;
18181 }
18182 int main() {
18183         check(" 1",                                        1LL, 0);
18184         check(" 0",                                        0LL, 0);
18185         check("18446744073709551615",  18446744073709551615ULL, 0);
18186         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18187 #if 0 /* strtoull() for /^-/ strings is undefined. */
18188         check("-1",                    18446744073709551615ULL, 0);
18189         check("-18446744073709551614",                     2LL, 0);
18190         check("-18446744073709551615",                     1LL, 0);
18191         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18192         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18193 #endif
18194         if (!bad)
18195                 printf("ok\n");
18196 }
18197 EOCP
18198         set try
18199         if eval $compile; then
18200                 case "`$run ./try`" in
18201                 ok) echo "Your strtoull() seems to be working okay." ;;
18202                 *) cat <<EOM >&4
18203 Your strtoull() doesn't seem to be working okay.
18204 EOM
18205                    d_strtoull="$undef"
18206                    ;;
18207                 esac
18208         else
18209                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18210                 d_strtoull="$undef"
18211         fi
18212         ;;
18213 esac
18214
18215 : see if strtouq exists
18216 set strtouq d_strtouq
18217 eval $inlibc
18218
18219 case "$d_strtouq" in
18220 "$define")
18221         $cat <<EOM
18222 Checking whether your strtouq() works okay...
18223 EOM
18224         $cat >try.c <<'EOCP'
18225 #include <errno.h>
18226 #include <stdio.h>
18227 extern unsigned long long int strtouq(char *s, char **, int);
18228 static int bad = 0;
18229 void check(char *s, unsigned long long eull, int een) {
18230         unsigned long long gull;
18231         errno = 0;
18232         gull = strtouq(s, 0, 10);
18233         if (!((gull == eull) && (errno == een)))
18234                 bad++;
18235 }
18236 int main() {
18237         check(" 1",                                        1LL, 0);
18238         check(" 0",                                        0LL, 0);
18239         check("18446744073709551615",  18446744073709551615ULL, 0);
18240         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18241 #if 0 /* strtouq() for /^-/ strings is undefined. */
18242         check("-1",                    18446744073709551615ULL, 0);
18243         check("-18446744073709551614",                     2LL, 0);
18244         check("-18446744073709551615",                     1LL, 0);
18245         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18246         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18247 #endif
18248         if (!bad)
18249                 printf("ok\n");
18250         return 0;
18251 }
18252 EOCP
18253         set try
18254         if eval $compile; then
18255                 case "`$run ./try`" in
18256                 ok) echo "Your strtouq() seems to be working okay." ;;
18257                 *) cat <<EOM >&4
18258 Your strtouq() doesn't seem to be working okay.
18259 EOM
18260                    d_strtouq="$undef"
18261                    ;;
18262                 esac
18263         else
18264                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18265                 d_strtouq="$undef"
18266         fi
18267         ;;
18268 esac
18269
18270 : see if strxfrm exists
18271 set strxfrm d_strxfrm
18272 eval $inlibc
18273
18274 : see if symlink exists
18275 set symlink d_symlink
18276 eval $inlibc
18277
18278 : see if syscall exists
18279 set syscall d_syscall
18280 eval $inlibc
18281
18282 : see if prototype for syscall is available
18283 echo " "
18284 set d_syscallproto syscall $i_unistd unistd.h
18285 eval $hasproto
18286
18287 : see if sysconf exists
18288 set sysconf d_sysconf
18289 eval $inlibc
18290
18291 : see if system exists
18292 set system d_system
18293 eval $inlibc
18294
18295 : see if tcgetpgrp exists
18296 set tcgetpgrp d_tcgetpgrp
18297 eval $inlibc
18298
18299 : see if tcsetpgrp exists
18300 set tcsetpgrp d_tcsetpgrp
18301 eval $inlibc
18302
18303 : see if prototype for telldir is available
18304 echo " "
18305 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18306 eval $hasproto
18307
18308 : see if time exists
18309 echo " "
18310 if test "X$d_time" = X -o X"$timetype" = X; then
18311     if set time val -f d_time; eval $csym; $val; then
18312                 echo 'time() found.' >&4
18313                 val="$define"
18314                 rp="What is the type returned by time() on this system?"
18315                 set time_t timetype long stdio.h sys/types.h
18316                 eval $typedef_ask
18317     else
18318                 echo 'time() not found, hope that will do.' >&4
18319                 val="$undef"
18320                 timetype='int';
18321     fi
18322     set d_time
18323     eval $setvar
18324 fi
18325
18326 : see if timegm exists
18327 set timegm d_timegm
18328 eval $inlibc
18329
18330 : see if this is a sys/times.h system
18331 set sys/times.h i_systimes
18332 eval $inhdr
18333
18334 : see if times exists
18335 echo " "
18336 if set times val -f d_times; eval $csym; $val; then
18337         echo 'times() found.' >&4
18338         d_times="$define"
18339         inc=''
18340         case "$i_systimes" in
18341         "$define") inc='sys/times.h';;
18342         esac
18343         rp="What is the type returned by times() on this system?"
18344         set clock_t clocktype long stdio.h sys/types.h $inc
18345         eval $typedef_ask
18346 else
18347         echo 'times() NOT found, hope that will do.' >&4
18348         d_times="$undef"
18349         clocktype='int'
18350 fi
18351
18352 : see if tmpnam_r exists
18353 set tmpnam_r d_tmpnam_r
18354 eval $inlibc
18355 case "$d_tmpnam_r" in
18356 "$define")
18357         hdrs="$i_systypes sys/types.h define stdio.h "
18358         case "$d_tmpnam_r_proto:$usethreads" in
18359         ":define")      d_tmpnam_r_proto=define
18360                 set d_tmpnam_r_proto tmpnam_r $hdrs
18361                 eval $hasproto ;;
18362         *)      ;;
18363         esac
18364         case "$d_tmpnam_r_proto" in
18365         define)
18366         case "$tmpnam_r_proto" in
18367         ''|0) try='char* tmpnam_r(char*);'
18368         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18369         esac
18370         case "$tmpnam_r_proto" in
18371         ''|0)   d_tmpnam_r=undef
18372                 tmpnam_r_proto=0
18373                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18374         * )     case "$tmpnam_r_proto" in
18375                 REENTRANT_PROTO*) ;;
18376                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18377                 esac
18378                 echo "Prototype: $try" ;;
18379         esac
18380         ;;
18381         *)      case "$usethreads" in
18382                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18383                 esac
18384                 d_tmpnam_r=undef
18385                 tmpnam_r_proto=0
18386                 ;;
18387         esac
18388         ;;
18389 *)      tmpnam_r_proto=0
18390         ;;
18391 esac
18392
18393 : see if truncate exists
18394 set truncate d_truncate
18395 eval $inlibc
18396
18397 : see if ttyname_r exists
18398 set ttyname_r d_ttyname_r
18399 eval $inlibc
18400 case "$d_ttyname_r" in
18401 "$define")
18402         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18403         case "$d_ttyname_r_proto:$usethreads" in
18404         ":define")      d_ttyname_r_proto=define
18405                 set d_ttyname_r_proto ttyname_r $hdrs
18406                 eval $hasproto ;;
18407         *)      ;;
18408         esac
18409         case "$d_ttyname_r_proto" in
18410         define)
18411         case "$ttyname_r_proto" in
18412         ''|0) try='int ttyname_r(int, char*, size_t);'
18413         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18414         esac
18415         case "$ttyname_r_proto" in
18416         ''|0) try='int ttyname_r(int, char*, int);'
18417         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18418         esac
18419         case "$ttyname_r_proto" in
18420         ''|0) try='char* ttyname_r(int, char*, int);'
18421         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18422         esac
18423         case "$ttyname_r_proto" in
18424         ''|0)   d_ttyname_r=undef
18425                 ttyname_r_proto=0
18426                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18427         * )     case "$ttyname_r_proto" in
18428                 REENTRANT_PROTO*) ;;
18429                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18430                 esac
18431                 echo "Prototype: $try" ;;
18432         esac
18433         ;;
18434         *)      case "$usethreads" in
18435                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18436                 esac
18437                 d_ttyname_r=undef
18438                 ttyname_r_proto=0
18439                 ;;
18440         esac
18441         ;;
18442 *)      ttyname_r_proto=0
18443         ;;
18444 esac
18445
18446 : see if tzname[] exists
18447 echo " "
18448 if set tzname val -a d_tzname; eval $csym; $val; then
18449         val="$define"
18450         echo 'tzname[] found.' >&4
18451 else
18452         val="$undef"
18453         echo 'tzname[] NOT found.' >&4
18454 fi
18455 set d_tzname
18456 eval $setvar
18457
18458 : Check if is a multiplatform env
18459 case "$osname" in
18460 next|rhapsody|darwin) multiarch="$define" ;;
18461 esac
18462 case "$multiarch" in
18463 ''|[nN]*) multiarch="$undef" ;;
18464 esac
18465
18466 : check for ordering of bytes in a UV
18467 echo " "
18468 case "$usecrosscompile$multiarch" in
18469 *$define*)
18470         $cat <<EOM
18471 You seem to be either cross-compiling or doing a multiarchitecture build,
18472 skipping the byteorder check.
18473
18474 EOM
18475         byteorder='ffff'
18476         ;;
18477 *)
18478         case "$byteorder" in
18479         '')
18480                 $cat <<'EOM'
18481 In the following, larger digits indicate more significance.  A big-endian
18482 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18483 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18484 machines may have weird orders like 3412.  A Cray will report 87654321,
18485 an Alpha will report 12345678. If the test program works the default is
18486 probably right.
18487 I'm now running the test program...
18488 EOM
18489                 $cat >try.c <<EOCP
18490 #include <stdio.h>
18491 #$i_stdlib I_STDLIB
18492 #ifdef I_STDLIB
18493 #include <stdlib.h>
18494 #endif
18495 #include <sys/types.h>
18496 typedef $uvtype UV;
18497 int main()
18498 {
18499         int i;
18500         union {
18501                 UV l;
18502                 char c[$uvsize];
18503         } u;
18504
18505         if ($uvsize > 4)
18506                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18507         else
18508                 u.l = (UV)0x04030201;
18509         for (i = 0; i < $uvsize; i++)
18510                 printf("%c", u.c[i]+'0');
18511         printf("\n");
18512         exit(0);
18513 }
18514 EOCP
18515                 xxx_prompt=y
18516                 set try
18517                 if eval $compile && $run ./try > /dev/null; then
18518                         dflt=`$run ./try`
18519                         case "$dflt" in
18520                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18521                                 echo "(The test program ran ok.)"
18522                                 echo "byteorder=$dflt"
18523                                 xxx_prompt=n
18524                         ;;
18525                         ????|????????) echo "(The test program ran ok.)" ;;
18526                         *) echo "(The test program didn't run right for some reason.)" ;;
18527                         esac
18528                 else
18529                         dflt='4321'
18530                         cat <<'EOM'
18531 (I can't seem to compile the test program.  Guessing big-endian...)
18532 EOM
18533                 fi
18534                 case "$xxx_prompt" in
18535                 y)
18536                         rp="What is the order of bytes in $uvtype?"
18537                         . ./myread
18538                         byteorder="$ans"
18539                         ;;
18540                 *)      byteorder=$dflt
18541                         ;;
18542                 esac
18543                 ;;
18544         esac
18545         $rm_try
18546         ;;
18547 esac
18548
18549 : Checking 32bit aligndness
18550 $cat <<EOM
18551
18552 Checking to see whether you can access character data unalignedly...
18553 EOM
18554 case "$d_u32align" in
18555 '')   $cat >try.c <<EOCP
18556 #include <stdio.h>
18557 #$i_stdlib I_STDLIB
18558 #ifdef I_STDLIB
18559 #include <stdlib.h>
18560 #endif
18561 #define U32 $u32type
18562 #define BYTEORDER 0x$byteorder
18563 #define U8 $u8type
18564 #include <signal.h>
18565 #ifdef SIGBUS
18566 $signal_t bletch(int s) { exit(4); }
18567 #endif
18568 int main() {
18569 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18570     U8 buf[8];
18571     U32 *up;
18572     int i;
18573
18574     if (sizeof(U32) != 4) {
18575         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18576         exit(1);
18577     }
18578
18579     fflush(stdout);
18580
18581 #ifdef SIGBUS
18582     signal(SIGBUS, bletch);
18583 #endif
18584
18585     buf[0] = 0;
18586     buf[1] = 0;
18587     buf[2] = 0;
18588     buf[3] = 1;
18589     buf[4] = 0;
18590     buf[5] = 0;
18591     buf[6] = 0;
18592     buf[7] = 1;
18593
18594     for (i = 0; i < 4; i++) {
18595         up = (U32*)(buf + i);
18596         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18597                (*up == 1 << (8*(3-i)))  /* little-endian */
18598               )
18599            )
18600         {
18601             printf("read failed (%x)\n", *up);
18602             exit(2);
18603         }
18604     }
18605
18606     /* write test */
18607     for (i = 0; i < 4; i++) {
18608         up = (U32*)(buf + i);
18609         *up = 0xBeef;
18610         if (*up != 0xBeef) {
18611             printf("write failed (%x)\n", *up);
18612             exit(3);
18613         }
18614     }
18615
18616     exit(0);
18617 #else
18618     printf("1\n");
18619     exit(1);
18620 #endif
18621     return 0;
18622 }
18623 EOCP
18624 set try
18625 if eval $compile_ok; then
18626         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18627         $run ./try 2>&1 >/dev/null
18628         case "$?" in
18629         0)      cat >&4 <<EOM
18630 You can access character data pretty unalignedly.
18631 EOM
18632                 d_u32align="$undef"
18633                 ;;
18634         *)      cat >&4 <<EOM
18635 It seems that you must access character data in an aligned manner.
18636 EOM
18637                 d_u32align="$define"
18638                 ;;
18639         esac
18640 else
18641         rp='Can you access character data at unaligned addresses?'
18642         dflt='n'
18643         . ./myread
18644         case "$ans" in
18645         [yY]*)  d_u32align="$undef"  ;;
18646         *)      d_u32align="$define" ;;
18647         esac
18648 fi
18649 $rm_try
18650 ;;
18651 esac
18652
18653 : see if ualarm exists
18654 set ualarm d_ualarm
18655 eval $inlibc
18656
18657 : see if umask exists
18658 set umask d_umask
18659 eval $inlibc
18660
18661 : see if unordered exists
18662 set unordered d_unordered
18663 eval $inlibc
18664
18665 : see if unsetenv exists
18666 set unsetenv d_unsetenv
18667 eval $inlibc
18668
18669 : see if usleep exists
18670 set usleep d_usleep
18671 eval $inlibc
18672
18673 : see if prototype for usleep is available
18674 echo " "
18675 set d_usleepproto usleep $i_unistd unistd.h
18676 eval $hasproto
18677
18678 : see if ustat exists
18679 set ustat d_ustat
18680 eval $inlibc
18681
18682 : see if closedir exists
18683 set closedir d_closedir
18684 eval $inlibc
18685
18686 case "$d_closedir" in
18687 "$define")
18688         echo " "
18689         echo "Checking whether closedir() returns a status..." >&4
18690         cat > try.c <<EOM
18691 #$i_dirent I_DIRENT             /**/
18692 #$i_sysdir I_SYS_DIR            /**/
18693 #$i_sysndir I_SYS_NDIR          /**/
18694 #$i_systypes I_SYS_TYPES        /**/
18695
18696 #if defined(I_SYS_TYPES)
18697 #include <sys/types.h>
18698 #endif
18699 #if defined(I_DIRENT)
18700 #include <dirent.h>
18701 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18702 #include <sys/dir.h>
18703 #endif
18704 #else
18705 #ifdef I_SYS_NDIR
18706 #include <sys/ndir.h>
18707 #else
18708 #ifdef I_SYS_DIR
18709 #ifdef hp9000s500
18710 #include <ndir.h>       /* may be wrong in the future */
18711 #else
18712 #include <sys/dir.h>
18713 #endif
18714 #endif
18715 #endif
18716 #endif
18717 int main() { return closedir(opendir(".")); }
18718 EOM
18719         set try
18720         if eval $compile_ok; then
18721                 if $run ./try > /dev/null 2>&1 ; then
18722                         echo "Yes, it does."
18723                         val="$undef"
18724                 else
18725                         echo "No, it doesn't."
18726                         val="$define"
18727                 fi
18728         else
18729                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18730                 val="$define"
18731         fi
18732         ;;
18733 *)
18734         val="$undef";
18735         ;;
18736 esac
18737 set d_void_closedir
18738 eval $setvar
18739 $rm_try
18740
18741 : see if there is a wait4
18742 set wait4 d_wait4
18743 eval $inlibc
18744
18745 : see if waitpid exists
18746 set waitpid d_waitpid
18747 eval $inlibc
18748
18749 : see if wcstombs exists
18750 set wcstombs d_wcstombs
18751 eval $inlibc
18752
18753 : see if wctomb exists
18754 set wctomb d_wctomb
18755 eval $inlibc
18756
18757 : see if writev exists
18758 set writev d_writev
18759 eval $inlibc
18760
18761 : preserve RCS keywords in files with variable substitution, grrr
18762 Date='$Date'
18763 Id='$Id'
18764 Log='$Log'
18765 RCSfile='$RCSfile'
18766 Revision='$Revision'
18767
18768 : check for alignment requirements
18769 echo " "
18770 case "$usecrosscompile$multiarch" in
18771 *$define*)
18772         $cat <<EOM
18773 You seem to be either cross-compiling or doing a multiarchitecture build,
18774 skipping the memory alignment check.
18775
18776 EOM
18777         case "$alignbytes" in
18778         '') alignbytes=8 ;;
18779         esac
18780         ;;
18781 *)
18782         case "$alignbytes" in
18783         '') echo "Checking alignment constraints..." >&4
18784                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18785                         $cat >try.c <<'EOCP'
18786 typedef long double NV;
18787 EOCP
18788                 else
18789                         $cat >try.c <<'EOCP'
18790 typedef double NV;
18791 EOCP
18792                 fi
18793                 $cat >>try.c <<'EOCP'
18794 #include <stdio.h>
18795 struct foobar {
18796         char foo;
18797         NV bar;
18798 } try_algn;
18799 int main()
18800 {
18801     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18802     return(0);
18803 }
18804 EOCP
18805                 set try
18806                 if eval $compile_ok; then
18807                         dflt=`$run ./try`
18808                 else
18809                         dflt='8'
18810                         echo "(I can't seem to compile the test program...)"
18811                 fi
18812                 ;;
18813         *) dflt="$alignbytes"
18814                 ;;
18815         esac
18816         rp="Doubles must be aligned on a how-many-byte boundary?"
18817         . ./myread
18818         alignbytes="$ans"
18819         $rm_try
18820         ;;
18821 esac
18822
18823
18824 : set the base revision
18825 baserev=5.0
18826
18827 : check for length of character
18828 echo " "
18829 case "$charsize" in
18830 '')
18831         echo "Checking to see how big your characters are (hey, you never know)..." >&4
18832         $cat >try.c <<EOCP
18833 #include <stdio.h>
18834 #$i_stdlib I_STDLIB
18835 #ifdef I_STDLIB
18836 #include <stdlib.h>
18837 #endif
18838 int main()
18839 {
18840     printf("%d\n", (int)sizeof(char));
18841     exit(0);
18842 }
18843 EOCP
18844         set try
18845         if eval $compile_ok; then
18846                 dflt=`$run ./try`
18847         else
18848                 dflt='1'
18849                 echo "(I can't seem to compile the test program.  Guessing...)"
18850         fi
18851         ;;
18852 *)
18853         dflt="$charsize"
18854         ;;
18855 esac
18856 rp="What is the size of a character (in bytes)?"
18857 . ./myread
18858 charsize="$ans"
18859 $rm_try
18860
18861 : Check for the number of bits in a character
18862 case "$charbits" in
18863 '')     echo "Checking how long a character is (in bits)..." >&4
18864         $cat >try.c <<EOCP
18865 #include <stdio.h>
18866 int main ()
18867 {
18868     int n;
18869     unsigned char c;
18870     for (c = 1, n = 0; c; c <<= 1, n++) ;
18871     printf ("%d\n", n);
18872     return (0);
18873     }
18874 EOCP
18875         set try
18876         if eval $compile_ok; then
18877                 dflt=`$run ./try`
18878         else
18879                 dflt='8'
18880                 echo "(I can't seem to compile the test program.  Guessing...)"
18881         fi
18882         ;;
18883 *)
18884         dflt="$charbits"
18885         ;;
18886 esac
18887 rp="What is the length of a character (in bits)?"
18888 . ./myread
18889 charbits="$ans"
18890 $rm_try
18891 case "$charbits" in
18892 8)      ;;
18893 *)      cat >&4 << EOM
18894 Your system has an unsigned character size of $charbits bits, which
18895 is rather unusual (normally it is 8 bits).  Perl likely will not work
18896 correctly on your system, with subtle bugs in various places.
18897 EOM
18898         rp='Do you really want to continue?'
18899         dflt='n'
18900         . ./myread
18901         case "$ans" in
18902                 [yY])   echo >&4 "Okay, continuing."    ;;
18903                 *)      exit 1                          ;;
18904         esac
18905 esac
18906
18907 : how do we concatenate cpp tokens here?
18908 echo " "
18909 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18910 $cat >cpp_stuff.c <<'EOCP'
18911 #define RCAT(a,b)a/**/b
18912 #define ACAT(a,b)a ## b
18913 RCAT(Rei,ser)
18914 ACAT(Cir,cus)
18915 EOCP
18916 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18917 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18918         echo "Oh!  Smells like ANSI's been here." >&4
18919         echo "We can catify or stringify, separately or together!"
18920         cpp_stuff=42
18921 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18922         echo "Ah, yes!  The good old days!" >&4
18923         echo "However, in the good old days we don't know how to stringify and"
18924         echo "catify at the same time."
18925         cpp_stuff=1
18926 else
18927         $cat >&4 <<EOM
18928 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18929 You're going to have to edit the values of CAT[2-5] in config.h...
18930 EOM
18931         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18932 fi
18933 $rm -f cpp_stuff.*
18934
18935 : see if this is a db.h system
18936 set db.h i_db
18937 eval $inhdr
18938
18939 case "$i_db" in
18940 $define)
18941         : Check db version.
18942         echo " "
18943         echo "Checking Berkeley DB version ..." >&4
18944         $cat >try.c <<EOCP
18945 #$d_const HASCONST
18946 #ifndef HASCONST
18947 #define const
18948 #endif
18949 #include <sys/types.h>
18950 #include <stdio.h>
18951 #$i_stdlib I_STDLIB
18952 #ifdef I_STDLIB
18953 #include <stdlib.h>
18954 #endif
18955 #include <db.h>
18956 int main(int argc, char *argv[])
18957 {
18958 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18959     int Major, Minor, Patch ;
18960     unsigned long Version ;
18961     (void)db_version(&Major, &Minor, &Patch) ;
18962     if (argc == 2) {
18963         printf("%d %d %d %d %d %d\n",
18964                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18965                Major, Minor, Patch);
18966         exit(0);
18967     }
18968     printf("You have Berkeley DB Version 2 or greater.\n");
18969
18970     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18971                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18972     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18973                 Major, Minor, Patch) ;
18974
18975     /* check that db.h & libdb are compatible */
18976     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18977         printf("db.h and libdb are incompatible.\n") ;
18978         exit(3);
18979     }
18980
18981     printf("db.h and libdb are compatible.\n") ;
18982
18983     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18984                 + DB_VERSION_PATCH ;
18985
18986     /* needs to be >= 2.3.4 */
18987     if (Version < 2003004) {
18988     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18989         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18990         exit(2);
18991     }
18992
18993     exit(0);
18994 #else
18995 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18996     if (argc == 2) {
18997         printf("1 0 0\n");
18998         exit(0);
18999     }
19000     printf("You have Berkeley DB Version 1.\n");
19001     exit(0);    /* DB version < 2: the coast is clear. */
19002 #else
19003     exit(1);    /* <db.h> not Berkeley DB? */
19004 #endif
19005 #endif
19006 }
19007 EOCP
19008         set try
19009         if eval $compile_ok && $run ./try; then
19010                 echo 'Looks OK.' >&4
19011                 set `$run ./try 1`
19012                 db_version_major=$1
19013                 db_version_minor=$2
19014                 db_version_patch=$3
19015         else
19016                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19017                 i_db=$undef
19018                 case " $libs " in
19019                 *"-ldb "*)
19020                         : Remove db from list of libraries to use
19021                         echo "Removing unusable -ldb from library list" >&4
19022                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19023                         shift
19024                         libs="$*"
19025                         echo "libs = $libs" >&4
19026                         ;;
19027                 esac
19028         fi
19029         $rm_try
19030         ;;
19031 esac
19032
19033 case "$i_db" in
19034 define)
19035         : Check the return type needed for hash
19036         echo " "
19037         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19038         $cat >try.c <<EOCP
19039 #$d_const HASCONST
19040 #ifndef HASCONST
19041 #define const
19042 #endif
19043 #include <sys/types.h>
19044 #include <db.h>
19045
19046 #ifndef DB_VERSION_MAJOR
19047 u_int32_t hash_cb (ptr, size)
19048 const void *ptr;
19049 size_t size;
19050 {
19051 }
19052 HASHINFO info;
19053 int main()
19054 {
19055         info.hash = hash_cb;
19056 }
19057 #endif
19058 EOCP
19059         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19060                 if $contains warning try.out >>/dev/null 2>&1 ; then
19061                         db_hashtype='int'
19062                 else
19063                         db_hashtype='u_int32_t'
19064                 fi
19065         else
19066                 : XXX Maybe we should just give up here.
19067                 db_hashtype=u_int32_t
19068                 $cat try.out >&4
19069                 echo "Help:  I can't seem to compile the db test program." >&4
19070                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19071         fi
19072         $rm_try
19073         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19074         ;;
19075 *)      db_hashtype=u_int32_t
19076         ;;
19077 esac
19078 case "$i_db" in
19079 define)
19080         : Check the return type needed for prefix
19081         echo " "
19082         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19083         cat >try.c <<EOCP
19084 #$d_const HASCONST
19085 #ifndef HASCONST
19086 #define const
19087 #endif
19088 #include <sys/types.h>
19089 #include <db.h>
19090
19091 #ifndef DB_VERSION_MAJOR
19092 size_t prefix_cb (key1, key2)
19093 const DBT *key1;
19094 const DBT *key2;
19095 {
19096 }
19097 BTREEINFO info;
19098 int main()
19099 {
19100         info.prefix = prefix_cb;
19101 }
19102 #endif
19103 EOCP
19104         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19105                 if $contains warning try.out >>/dev/null 2>&1 ; then
19106                         db_prefixtype='int'
19107                 else
19108                         db_prefixtype='size_t'
19109                 fi
19110         else
19111                 db_prefixtype='size_t'
19112                 : XXX Maybe we should just give up here.
19113                 $cat try.out >&4
19114                 echo "Help:  I can't seem to compile the db test program." >&4
19115                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19116         fi
19117         $rm_try
19118         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19119         ;;
19120 *)      db_prefixtype='size_t'
19121         ;;
19122 esac
19123
19124 : How can we generate normalized random numbers ?
19125 echo " "
19126 echo "Looking for a random number function..." >&4
19127 case "$randfunc" in
19128 '')
19129         if set drand48 val -f; eval $csym; $val; then
19130                 dflt="drand48"
19131                 echo "Good, found drand48()." >&4
19132         elif set random val -f; eval $csym; $val; then
19133                 dflt="random"
19134                 echo "OK, found random()." >&4
19135         else
19136                 dflt="rand"
19137                 echo "Yick, looks like I have to use rand()." >&4
19138         fi
19139         echo " "
19140         ;;
19141 *)
19142         dflt="$randfunc"
19143         ;;
19144 esac
19145 cont=true
19146
19147 case "$ccflags" in
19148 *-Dmy_rand=*|*-Dmy_srand=*)
19149         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19150         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19151         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19152         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19153         ;;
19154 esac
19155
19156 while $test "$cont"; do
19157         rp="Use which function to generate random numbers?"
19158         . ./myread
19159         if $test "$ans" = "$dflt"; then
19160                 : null
19161         else
19162                 randbits=''
19163         fi
19164         randfunc="$ans"
19165         if set $ans val -f; eval $csym; $val; then
19166                 cont=''
19167         else
19168                 dflt=y
19169                 rp="I cannot find function $ans. Use that name anyway?"
19170                 . ./myread
19171                 dflt=rand
19172                 case "$ans" in
19173                         [yY]*) cont='';;
19174                 esac
19175         fi
19176         case "$cont" in
19177         '')
19178                 case "$randfunc" in
19179                 drand48)
19180                         drand01="drand48()"
19181                         seedfunc="srand48"
19182                         randbits=48
19183                         randseedtype=long
19184                         ;;
19185                 rand|random)
19186                         case "$randbits" in
19187                         '')
19188 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19189                                 $cat >try.c <<EOCP
19190 #$i_unistd I_UNISTD
19191 #$i_stdlib I_STDLIB
19192 #include <stdio.h>
19193 #ifdef I_UNISTD
19194 #  include <unistd.h>
19195 #endif
19196 #ifdef I_STDLIB
19197 #  include <stdlib.h>
19198 #endif
19199 int main()
19200 {
19201         register int i;
19202         register unsigned long tmp;
19203         register unsigned long max = 0L;
19204
19205         for (i = 1000; i; i--) {
19206                 tmp = (unsigned long) $randfunc();
19207                 if (tmp > max) max = tmp;
19208         }
19209         for (i = 0; max; i++)
19210                 max /= 2;
19211         printf("%d\n",i);
19212 }
19213 EOCP
19214                                 set try
19215                                 if eval $compile_ok; then
19216                                         dflt=`try`
19217                                 else
19218                                         dflt='?'
19219                                         echo "(I can't seem to compile the test program...)"
19220                                 fi
19221                                 ;;
19222                         *)
19223                                 dflt="$randbits"
19224                                 ;;
19225                         esac
19226                         rp="How many bits does your $randfunc() function produce?"
19227                         . ./myread
19228                         randbits="$ans"
19229                         $rm_try
19230                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19231                         seedfunc="s$randfunc"
19232                         randseedtype=unsigned
19233                         ;;
19234                 *)
19235                         dflt="31"
19236                         rp="How many bits does your $randfunc() function produce?"
19237                         . ./myread
19238                         randbits="$ans"
19239                         seedfunc="s$randfunc"
19240                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19241                         if set $seedfunc val -f; eval $csym; $val; then
19242                                 echo "(Using $seedfunc() to seed random generator)"
19243                         else
19244                                 echo "(Warning: no $seedfunc() to seed random generator)"
19245                                 seedfunc=rand
19246                         fi
19247                         randseedtype=unsigned
19248                         ;;
19249                 esac
19250                 ;;
19251         esac
19252 done
19253
19254 : Determine if this is an EBCDIC system
19255 echo " "
19256 echo "Determining whether or not we are on an EBCDIC system..." >&4
19257 $cat >try.c <<'EOM'
19258 int main()
19259 {
19260   if ('M'==0xd4) return 0;
19261   return 1;
19262 }
19263 EOM
19264
19265 val=$undef
19266 set try
19267 if eval $compile_ok; then
19268         if $run ./try; then
19269                 echo "You seem to speak EBCDIC." >&4
19270                 val="$define"
19271         else
19272                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19273         fi
19274 else
19275         echo "I'm unable to compile the test program." >&4
19276         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19277 fi
19278 $rm_try
19279 set ebcdic
19280 eval $setvar
19281
19282 : Check how to flush
19283 echo " "
19284 $cat >&4 <<EOM
19285 Checking how to flush all pending stdio output...
19286 EOM
19287 # I only know how to find the first 32 possibly open files on SunOS.
19288 # See also hints/sunos_4_1.sh and util.c  --AD
19289 case "$osname" in
19290 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19291 esac
19292 $cat >>try.c <<EOCP
19293 #include <stdio.h>
19294 #$i_stdlib I_STDLIB
19295 #ifdef I_STDLIB
19296 #include <stdlib.h>
19297 #endif
19298 #$i_unistd I_UNISTD
19299 #ifdef I_UNISTD
19300 # include <unistd.h>
19301 #endif
19302 #$d_sysconf HAS_SYSCONF
19303 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19304 #ifdef HAS_STDIO_STREAM_ARRAY
19305 # define STDIO_STREAM_ARRAY $stdio_stream_array
19306 #endif
19307 int main() {
19308   FILE* p;
19309   unlink("try.out");
19310   p = fopen("try.out", "w");
19311 #ifdef TRY_FPUTC
19312   fputc('x', p);
19313 #else
19314 # ifdef TRY_FPRINTF
19315   fprintf(p, "x");
19316 # endif
19317 #endif
19318 #ifdef TRY_FFLUSH_NULL
19319   fflush(NULL);
19320 #endif
19321 #ifdef TRY_FFLUSH_ALL
19322   {
19323     long open_max = -1;
19324 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19325     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19326 # else
19327 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19328     open_max = sysconf(_SC_OPEN_MAX);
19329 #  else
19330 #   ifdef FOPEN_MAX
19331     open_max = FOPEN_MAX;
19332 #   else
19333 #    ifdef OPEN_MAX
19334     open_max = OPEN_MAX;
19335 #    else
19336 #     ifdef _NFILE
19337     open_max = _NFILE;
19338 #     endif
19339 #    endif
19340 #   endif
19341 #  endif
19342 # endif
19343 # ifdef HAS_STDIO_STREAM_ARRAY
19344     if (open_max > 0) {
19345       long i;
19346       for (i = 0; i < open_max; i++)
19347             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19348                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19349                 STDIO_STREAM_ARRAY[i]._flag)
19350                 fflush(&STDIO_STREAM_ARRAY[i]);
19351     }
19352   }
19353 # endif
19354 #endif
19355   _exit(42);
19356 }
19357 EOCP
19358 : first we have to find out how _not_ to flush
19359 $to try.c
19360 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19361     output=''
19362     set try -DTRY_FPUTC
19363     if eval $compile; then
19364             $run ./try 2>/dev/null
19365             code="$?"
19366             $from try.out
19367             if $test ! -s try.out -a "X$code" = X42; then
19368                 output=-DTRY_FPUTC
19369             fi
19370     fi
19371     case "$output" in
19372     '')
19373             set try -DTRY_FPRINTF
19374             if eval $compile; then
19375                     $run ./try 2>/dev/null
19376                     code="$?"
19377                     $from try.out
19378                     if $test ! -s try.out -a "X$code" = X42; then
19379                         output=-DTRY_FPRINTF
19380                     fi
19381             fi
19382         ;;
19383     esac
19384 fi
19385 : check for fflush NULL behaviour
19386 case "$fflushNULL" in
19387 '')     set try -DTRY_FFLUSH_NULL $output
19388         if eval $compile; then
19389                 $run ./try 2>/dev/null
19390                 code="$?"
19391                 $from try.out
19392                 if $test -s try.out -a "X$code" = X42; then
19393                         fflushNULL="`$cat try.out`"
19394                 else
19395                         if $test "X$code" != X42; then
19396                                 $cat >&4 <<EOM
19397 (If this test failed, don't worry, we'll try another method shortly.)
19398 EOM
19399                         fi
19400                 fi
19401         fi
19402         $rm -f core try.core core.try.*
19403         case "$fflushNULL" in
19404         x)      $cat >&4 <<EOM
19405 Your fflush(NULL) works okay for output streams.
19406 Let's see if it clobbers input pipes...
19407 EOM
19408 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19409 # bug that improperly flushes the input end of pipes.  So we avoid the
19410 # autoflush on fork/system/exec support for now. :-(
19411 $cat >tryp.c <<EOCP
19412 #include <stdio.h>
19413 int
19414 main(int argc, char **argv)
19415 {
19416     char buf[1024];
19417     int i;
19418     char *bp = buf;
19419     while (1) {
19420         while ((i = getc(stdin)) != -1
19421                && (*bp++ = i) != '\n'
19422                && bp < &buf[1024])
19423         /* DO NOTHING */ ;
19424         *bp = '\0';
19425         fprintf(stdout, "%s", buf);
19426         fflush(NULL);
19427         if (i == -1)
19428             return 0;
19429         bp = buf;
19430     }
19431 }
19432 EOCP
19433                 fflushNULL="$define"
19434                 set tryp
19435                 if eval $compile; then
19436                     $rm -f tryp.out
19437                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19438                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19439                        $cat >&4 <<EOM
19440 fflush(NULL) seems to behave okay with input streams.
19441 EOM
19442                         fflushNULL="$define"
19443                     else
19444                         $cat >&4 <<EOM
19445 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19446 EOM
19447                         fflushNULL="$undef"
19448                     fi
19449                 fi
19450                 $rm -f core tryp.c tryp.core core.tryp.*
19451                 ;;
19452         '')     $cat >&4 <<EOM
19453 Your fflush(NULL) isn't working (contrary to ANSI C).
19454 EOM
19455                 fflushNULL="$undef"
19456                 ;;
19457         *)      $cat >&4 <<EOM
19458 Cannot figure out whether your fflush(NULL) works or not.
19459 I'm assuming it doesn't (contrary to ANSI C).
19460 EOM
19461                 fflushNULL="$undef"
19462                 ;;
19463         esac
19464         ;;
19465 $define|true|[yY]*)
19466         fflushNULL="$define"
19467         ;;
19468 *)
19469         fflushNULL="$undef"
19470         ;;
19471 esac
19472 : check explicit looping only if NULL did not work, and if the pipe
19473 : bug does not show up on an explicit flush too
19474 case "$fflushNULL" in
19475 "$undef")
19476         $cat >tryp.c <<EOCP
19477 #include <stdio.h>
19478 int
19479 main(int argc, char **argv)
19480 {
19481     char buf[1024];
19482     int i;
19483     char *bp = buf;
19484     while (1) {
19485         while ((i = getc(stdin)) != -1
19486                && (*bp++ = i) != '\n'
19487                && bp < &buf[1024])
19488         /* DO NOTHING */ ;
19489         *bp = '\0';
19490         fprintf(stdout, "%s", buf);
19491         fflush(stdin);
19492         if (i == -1)
19493             return 0;
19494         bp = buf;
19495     }
19496 }
19497 EOCP
19498         set tryp
19499         if eval $compile; then
19500             $rm -f tryp.out
19501             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19502             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19503                $cat >&4 <<EOM
19504 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19505 EOM
19506                 : now check for fflushall behaviour
19507                 case "$fflushall" in
19508                 '')     set try -DTRY_FFLUSH_ALL $output
19509                         if eval $compile; then
19510                                 $cat >&4 <<EOM
19511 (Now testing the other method--but note that this also may fail.)
19512 EOM
19513                                 $run ./try 2>/dev/null
19514                                 code=$?
19515                                 $from try.out
19516                                 if $test -s try.out -a "X$code" = X42; then
19517                                         fflushall="`$cat try.out`"
19518                                 fi
19519                         fi
19520                         $rm_try
19521                         case "$fflushall" in
19522                         x)      $cat >&4 <<EOM
19523 Whew. Flushing explicitly all the stdio streams works.
19524 EOM
19525                                 fflushall="$define"
19526                                 ;;
19527                         '')     $cat >&4 <<EOM
19528 Sigh. Flushing explicitly all the stdio streams doesn't work.
19529 EOM
19530                                 fflushall="$undef"
19531                                 ;;
19532                         *)      $cat >&4 <<EOM
19533 Cannot figure out whether flushing stdio streams explicitly works or not.
19534 I'm assuming it doesn't.
19535 EOM
19536                                 fflushall="$undef"
19537                                 ;;
19538                         esac
19539                         ;;
19540                 "$define"|true|[yY]*)
19541                         fflushall="$define"
19542                         ;;
19543                 *)
19544                         fflushall="$undef"
19545                         ;;
19546                 esac
19547             else
19548                 $cat >&4 <<EOM
19549 All is futile.  Even fflush(stdin) clobbers input pipes!
19550 EOM
19551                 fflushall="$undef"
19552             fi
19553         else
19554             fflushall="$undef"
19555         fi
19556         $rm -f core tryp.c tryp.core core.tryp.*
19557         ;;
19558 *)      fflushall="$undef"
19559         ;;
19560 esac
19561
19562 case "$fflushNULL$fflushall" in
19563 undefundef)
19564         $cat <<EOM
19565 OK, I give up.  I cannot figure out how to flush pending stdio output.
19566 We won't be flushing handles at all before fork/exec/popen.
19567 EOM
19568         ;;
19569 esac
19570 $rm_try tryp
19571
19572 : Store the full pathname to the ar program for use in the C program
19573 : Respect a hint or command line value for full_ar.
19574 case "$full_ar" in
19575 '') full_ar=$ar ;;
19576 esac
19577
19578 : Store the full pathname to the sed program for use in the C program
19579 full_sed=$sed
19580
19581 : see what type gids are declared as in the kernel
19582 echo " "
19583 echo "Looking for the type for group ids returned by getgid()."
19584 set gid_t gidtype xxx stdio.h sys/types.h
19585 eval $typedef
19586 case "$gidtype" in
19587 xxx)
19588         xxx=`./findhdr sys/user.h`
19589         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19590         case $1 in
19591         unsigned) dflt="$1 $2" ;;
19592         *) dflt="$1" ;;
19593         esac
19594         ;;
19595 *) dflt="$gidtype";;
19596 esac
19597 case "$gidtype" in
19598 gid_t) echo "gid_t found." ;;
19599 *)      rp="What is the type for group ids returned by getgid()?"
19600         . ./myread
19601         gidtype="$ans"
19602         ;;
19603 esac
19604
19605 : Check the size of GID
19606 echo " "
19607 case "$gidtype" in
19608 *_t) zzz="$gidtype"     ;;
19609 *)   zzz="gid"          ;;
19610 esac
19611 echo "Checking the size of $zzz..." >&4
19612 cat > try.c <<EOCP
19613 #include <sys/types.h>
19614 #include <stdio.h>
19615 #$i_stdlib I_STDLIB
19616 #ifdef I_STDLIB
19617 #include <stdlib.h>
19618 #endif
19619 int main() {
19620     printf("%d\n", (int)sizeof($gidtype));
19621     exit(0);
19622 }
19623 EOCP
19624 set try
19625 if eval $compile_ok; then
19626         yyy=`$run ./try`
19627         case "$yyy" in
19628         '')     gidsize=4
19629                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19630                 ;;
19631         *)      gidsize=$yyy
19632                 echo "Your $zzz is $gidsize bytes long."
19633                 ;;
19634         esac
19635 else
19636         gidsize=4
19637         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19638 fi
19639
19640
19641 : Check if GID is signed
19642 echo " "
19643 case "$gidtype" in
19644 *_t) zzz="$gidtype"     ;;
19645 *)   zzz="gid"          ;;
19646 esac
19647 echo "Checking the sign of $zzz..." >&4
19648 cat > try.c <<EOCP
19649 #include <sys/types.h>
19650 #include <stdio.h>
19651 int main() {
19652         $gidtype foo = -1;
19653         if (foo < 0)
19654                 printf("-1\n");
19655         else
19656                 printf("1\n");
19657 }
19658 EOCP
19659 set try
19660 if eval $compile; then
19661         yyy=`$run ./try`
19662         case "$yyy" in
19663         '')     gidsign=1
19664                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19665                 ;;
19666         *)      gidsign=$yyy
19667                 case "$gidsign" in
19668                  1) echo "Your $zzz is unsigned." ;;
19669                 -1) echo "Your $zzz is signed."   ;;
19670                 esac
19671                 ;;
19672         esac
19673 else
19674         gidsign=1
19675         echo "(I can't compile the test program--guessing unsigned.)" >&4
19676 fi
19677
19678
19679 : Check 64bit sizes
19680 echo " "
19681
19682 if $test X"$quadtype" != X; then
19683
19684 echo "Checking how to print 64-bit integers..." >&4
19685
19686 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19687         $cat >try.c <<'EOCP'
19688 #include <sys/types.h>
19689 #include <stdio.h>
19690 int main() {
19691   int q = 12345678901;
19692   printf("%ld\n", q);
19693 }
19694 EOCP
19695         set try
19696         if eval $compile; then
19697                 yyy=`$run ./try`
19698                 case "$yyy" in
19699                 12345678901)
19700                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19701                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19702                         echo "We will use %d."
19703                         ;;
19704                 esac
19705         fi
19706 fi
19707
19708 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19709         $cat >try.c <<'EOCP'
19710 #include <sys/types.h>
19711 #include <stdio.h>
19712 int main() {
19713   long q = 12345678901;
19714   printf("%ld\n", q);
19715 }
19716 EOCP
19717         set try
19718         if eval $compile; then
19719                 yyy=`$run ./try`
19720                 case "$yyy" in
19721                 12345678901)
19722                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19723                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19724                         echo "We will use %ld."
19725                         ;;
19726                 esac
19727         fi
19728 fi
19729
19730 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19731         $cat >try.c <<'EOCP'
19732 #include <sys/types.h>
19733 #include <inttypes.h>
19734 #include <stdio.h>
19735 int main() {
19736   int64_t q = 12345678901;
19737   printf("%" PRId64 "\n", q);
19738 }
19739 EOCP
19740         set try
19741         if eval $compile; then
19742                 yyy=`$run ./try`
19743                 case "$yyy" in
19744                 12345678901)
19745                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19746                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19747                         echo "We will use the C9X style."
19748                         ;;
19749                 esac
19750         fi
19751 fi
19752
19753 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19754         $cat >try.c <<EOCP
19755 #include <sys/types.h>
19756 #include <stdio.h>
19757 int main() {
19758   $quadtype q = 12345678901;
19759   printf("%Ld\n", q);
19760 }
19761 EOCP
19762         set try
19763         if eval $compile; then
19764                 yyy=`$run ./try`
19765                 case "$yyy" in
19766                 12345678901)
19767                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19768                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19769                         echo "We will use %Ld."
19770                         ;;
19771                 esac
19772         fi
19773 fi
19774
19775 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19776         $cat >try.c <<'EOCP'
19777 #include <sys/types.h>
19778 #include <stdio.h>
19779 int main() {
19780   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19781   printf("%lld\n", q);
19782 }
19783 EOCP
19784         set try
19785         if eval $compile; then
19786                 yyy=`$run ./try`
19787                 case "$yyy" in
19788                 12345678901)
19789                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19790                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19791                         echo "We will use the %lld style."
19792                         ;;
19793                 esac
19794         fi
19795 fi
19796
19797 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19798         $cat >try.c <<EOCP
19799 #include <sys/types.h>
19800 #include <stdio.h>
19801 int main() {
19802   $quadtype q = 12345678901;
19803   printf("%qd\n", q);
19804 }
19805 EOCP
19806         set try
19807         if eval $compile; then
19808                 yyy=`$run ./try`
19809                 case "$yyy" in
19810                 12345678901)
19811                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19812                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19813                         echo "We will use %qd."
19814                         ;;
19815                 esac
19816         fi
19817 fi
19818
19819 if $test X"$sPRId64" = X; then
19820         echo "Cannot figure out how to print 64-bit integers." >&4
19821 fi
19822 $rm_try
19823
19824 fi
19825
19826 case "$sPRId64" in
19827 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19828         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19829         ;;
19830 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19831         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19832         ;;
19833 esac
19834
19835 : Check format strings for internal types
19836 echo " "
19837 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19838
19839 if $test X"$ivsize" = X8; then
19840         ivdformat="$sPRId64"
19841         uvuformat="$sPRIu64"
19842         uvoformat="$sPRIo64"
19843         uvxformat="$sPRIx64"
19844         uvXUformat="$sPRIXU64"
19845 else
19846         if $test X"$ivsize" = X"$longsize"; then
19847                 ivdformat='"ld"'
19848                 uvuformat='"lu"'
19849                 uvoformat='"lo"'
19850                 uvxformat='"lx"'
19851                 uvXUformat='"lX"'
19852         else
19853                 if $test X"$ivsize" = X"$intsize"; then
19854                         ivdformat='"d"'
19855                         uvuformat='"u"'
19856                         uvoformat='"o"'
19857                         uvxformat='"x"'
19858                         uvXUformat='"X"'
19859                 else
19860                         : far out
19861                         if $test X"$ivsize" = X"$shortsize"; then
19862                                 ivdformat='"hd"'
19863                                 uvuformat='"hu"'
19864                                 uvoformat='"ho"'
19865                                 uvxformat='"hx"'
19866                                 uvXUformat='"hX"'
19867                         fi
19868                 fi
19869         fi
19870 fi
19871
19872 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19873         nveformat="$sPRIeldbl"
19874         nvfformat="$sPRIfldbl"
19875         nvgformat="$sPRIgldbl"
19876         nvEUformat="$sPRIEUldbl"
19877         nvFUformat="$sPRIFUldbl"
19878         nvGUformat="$sPRIGUldbl"
19879 else
19880         nveformat='"e"'
19881         nvfformat='"f"'
19882         nvgformat='"g"'
19883         nvEUformat='"E"'
19884         nvFUformat='"F"'
19885         nvGUformat='"G"'
19886 fi
19887
19888 case "$ivdformat" in
19889 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19890     exit 1
19891     ;;
19892 esac
19893
19894 : Check format string for GID
19895
19896 echo " "
19897 $echo "Checking the format string to be used for gids..." >&4
19898
19899 case "$gidsign" in
19900 -1)     if $test X"$gidsize" = X"$ivsize"; then
19901                 gidformat="$ivdformat"
19902         else
19903                 if $test X"$gidsize" = X"$longsize"; then
19904                         gidformat='"ld"'
19905                 else
19906                         if $test X"$gidsize" = X"$intsize"; then
19907                                 gidformat='"d"'
19908                         else
19909                                 if $test X"$gidsize" = X"$shortsize"; then
19910                                         gidformat='"hd"'
19911                                 fi
19912                         fi
19913                 fi
19914         fi
19915         ;;
19916 *)      if $test X"$gidsize" = X"$uvsize"; then
19917                 gidformat="$uvuformat"
19918         else
19919                 if $test X"$gidsize" = X"$longsize"; then
19920                         gidformat='"lu"'
19921                 else
19922                         if $test X"$gidsize" = X"$intsize"; then
19923                                 gidformat='"u"'
19924                         else
19925                                 if $test X"$gidsize" = X"$shortsize"; then
19926                                         gidformat='"hu"'
19927                                 fi
19928                         fi
19929                 fi
19930         fi
19931         ;;
19932 esac
19933
19934 : see if getgroups exists
19935 set getgroups d_getgrps
19936 eval $inlibc
19937
19938 : see if setgroups exists
19939 set setgroups d_setgrps
19940 eval $inlibc
19941
19942 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19943 echo " "
19944 case "$d_getgrps$d_setgrps" in
19945 *define*)
19946         case "$groupstype" in
19947         '') dflt="$gidtype" ;;
19948         *)  dflt="$groupstype" ;;
19949         esac
19950         $cat <<EOM
19951 What type of pointer is the second argument to getgroups() and setgroups()?
19952 Usually this is the same as group ids, $gidtype, but not always.
19953
19954 EOM
19955         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19956         . ./myread
19957         groupstype="$ans"
19958         ;;
19959 *)  groupstype="$gidtype";;
19960 esac
19961
19962 : MAD = Misc Attribute Definition
19963
19964 if $test $patchlevel -lt 9; then
19965 : MAD is not available in 5.8.x or earlier.
19966     ans=n;
19967 else
19968     case "$mad" in
19969     $define|true|[yY]*) dflt='y' ;;
19970     *)                  dflt='n' ;;
19971     esac
19972     cat <<EOM
19973
19974 Would you like to build with Misc Attribute Decoration? This is development
19975 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19976 overhead on the interpreter.
19977
19978 If this doesn't make any sense to you, just accept the default '$dflt'.
19979 EOM
19980     rp='Build Perl with MAD?'
19981     . ./myread
19982 fi
19983 case "$ans" in
19984 y|Y)    val="$define"
19985         madlyh='madly.h madly.act madly.tab'
19986         madlysrc='madly.c'
19987         madlyobj="madly$_o" ;;
19988 *)      val="$undef"
19989         madlyh=''
19990         madlysrc=''
19991         madlyobj='' ;;
19992 esac
19993 set mad
19994 eval $setvar
19995
19996 : check whether make sets MAKE
19997 echo " "
19998 echo "Checking if your $make program sets \$(MAKE)..." >&4
19999 case "$make_set_make" in
20000 '')
20001         $sed 's/^X //' > testmake.mak << 'EOF'
20002 Xall:
20003 X       @echo 'maketemp="$(MAKE)"'
20004 EOF
20005         case "`$make -f testmake.mak 2>/dev/null`" in
20006         *maketemp=*) make_set_make='#' ;;
20007         *)      make_set_make="MAKE=$make" ;;
20008         esac
20009         $rm -f testmake.mak
20010         ;;
20011 esac
20012 case "$make_set_make" in
20013 '#') echo "Yup, it does.";;
20014 *) echo "Nope, it doesn't.";;
20015 esac
20016
20017 : see what type is used for mode_t
20018 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20019 set mode_t modetype int stdio.h sys/types.h
20020 eval $typedef_ask
20021
20022 : see if we need va_copy
20023 echo " "
20024 case "$i_stdarg" in
20025 "$define")
20026         $cat >try.c <<EOCP
20027 #include <stdarg.h>
20028 #include <stdio.h>
20029 #$i_stdlib I_STDLIB
20030 #ifdef I_STDLIB
20031 #include <stdlib.h>
20032 #endif
20033 #include <signal.h>
20034
20035 int
20036 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20037 {
20038   return vfprintf(f, fmt, *valp);
20039 }
20040
20041 int
20042 myvfprintf(FILE *f, const  char *fmt, va_list val)
20043 {
20044   return ivfprintf(f, fmt, &val);
20045 }
20046
20047 int
20048 myprintf(char *fmt, ...)
20049 {
20050   va_list val;
20051   va_start(val, fmt);
20052   return myvfprintf(stdout, fmt, val);
20053 }
20054
20055 int
20056 main(int ac, char **av)
20057 {
20058   signal(SIGSEGV, exit);
20059
20060   myprintf("%s%cs all right, then\n", "that", '\'');
20061   exit(0);
20062 }
20063 EOCP
20064         set try
20065         if eval $compile && $run ./try 2>&1 >/dev/null; then
20066                 case "`$run ./try`" in
20067                 "that's all right, then")
20068                         okay=yes
20069                         ;;
20070                 esac
20071         fi
20072         case "$okay" in
20073         yes)    echo "It seems that you don't need va_copy()." >&4
20074                 need_va_copy="$undef"
20075                 ;;
20076         *)      echo "It seems that va_copy() or similar will be needed." >&4
20077                 need_va_copy="$define"
20078                 ;;
20079         esac
20080         $rm_try
20081         ;;
20082 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20083         ;;
20084 esac
20085
20086 : see what type is used for size_t
20087 rp="What is the type used for the length parameter for string functions?"
20088 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20089 eval $typedef_ask
20090
20091 : check for type of arguments to gethostbyaddr. 
20092 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20093         case "$d_gethbyaddr" in
20094         $define)
20095                 $cat <<EOM
20096
20097 Checking to see what type of arguments are accepted by gethostbyaddr().
20098 EOM
20099                 hdrs="$define sys/types.h
20100                         $d_socket sys/socket.h 
20101                         $i_niin netinet/in.h 
20102                         $i_netdb netdb.h
20103                         $i_unistd unistd.h"
20104                 : The first arg can 'char *' or 'void *'
20105                 : The second arg is some of integral type
20106                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20107                         for yyy in size_t long int; do
20108                                 case "$netdb_host_type" in
20109                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20110                                         if ./protochk "$try" $hdrs; then
20111                                                 echo "Your system accepts $xxx for the first arg."
20112                                                 echo "...and $yyy for the second arg."
20113                                                 netdb_host_type="$xxx"
20114                                                 netdb_hlen_type="$yyy"
20115                                         fi
20116                                         ;;
20117                                 esac
20118                         done
20119                 done
20120                 : In case none of those worked, prompt the user.
20121                 case "$netdb_host_type" in
20122                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20123                         dflt='char *'
20124                         . ./myread
20125                         netdb_host_type=$ans
20126                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20127                         dflt="$sizetype"
20128                         . ./myread
20129                         netdb_hlen_type=$ans
20130                         ;;
20131                 esac
20132                 ;;
20133         *)      : no gethostbyaddr, so pick harmless defaults
20134                 netdb_host_type='char *'
20135                 netdb_hlen_type="$sizetype"
20136                 ;;
20137         esac
20138         # Remove the "const" if needed. -- but then we'll have a 
20139         # prototype clash!
20140         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20141 fi
20142
20143 : check for type of argument to gethostbyname. 
20144 if test "X$netdb_name_type" = X ; then
20145         case "$d_gethbyname" in
20146         $define)
20147                 $cat <<EOM
20148
20149 Checking to see what type of argument is accepted by gethostbyname().
20150 EOM
20151                 hdrs="$define sys/types.h
20152                         $d_socket sys/socket.h 
20153                         $i_niin netinet/in.h 
20154                         $i_netdb netdb.h
20155                         $i_unistd unistd.h"
20156                 for xxx in "const char *" "char *"; do
20157                         case "$netdb_name_type" in
20158                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20159                                 if ./protochk "$try" $hdrs; then
20160                                         echo "Your system accepts $xxx."
20161                                         netdb_name_type="$xxx"
20162                                 fi
20163                                 ;;
20164                         esac
20165                 done
20166                 : In case none of those worked, prompt the user.
20167                 case "$netdb_name_type" in
20168                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20169                         dflt='char *'
20170                         . ./myread
20171                         netdb_name_type=$ans
20172                         ;;
20173                 esac
20174                 ;;
20175         *)      : no gethostbyname, so pick harmless default
20176                 netdb_name_type='char *'
20177                 ;;
20178         esac
20179 fi
20180
20181 : check for type of 1st argument to getnetbyaddr. 
20182 if test "X$netdb_net_type" = X ; then
20183         case "$d_getnbyaddr" in
20184         $define)
20185                 $cat <<EOM
20186
20187 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20188 EOM
20189                 hdrs="$define sys/types.h
20190                         $d_socket sys/socket.h 
20191                         $i_niin netinet/in.h 
20192                         $i_netdb netdb.h
20193                         $i_unistd unistd.h"
20194                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20195                         case "$netdb_net_type" in
20196                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20197                                 if ./protochk "$try" $hdrs; then
20198                                         echo "Your system accepts $xxx."
20199                                         netdb_net_type="$xxx"
20200                                 fi
20201                                 ;;
20202                         esac
20203                 done
20204                 : In case none of those worked, prompt the user.
20205                 case "$netdb_net_type" in
20206                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20207                         dflt='long'
20208                         . ./myread
20209                         netdb_net_type=$ans
20210                         ;;
20211                 esac
20212                 ;;
20213         *)      : no getnetbyaddr, so pick harmless default
20214                 netdb_net_type='long'
20215                 ;;
20216         esac
20217 fi
20218 : locate the preferred pager for this system
20219 fn=f/
20220 case "$pager" in
20221 '')
20222         dflt=''
20223         case "$pg" in
20224         /*) dflt=$pg;;
20225         [a-zA-Z]:/*) dflt=$pg;;
20226         esac
20227         case "$more" in
20228         /*) dflt=$more;;
20229         [a-zA-Z]:/*) dflt=$more;;
20230         esac
20231         case "$less" in
20232         /*) dflt=$less;;
20233         [a-zA-Z]:/*) dflt=$less;;
20234         esac
20235         case "$dflt" in
20236         '') dflt=/usr/ucb/more;;
20237         esac
20238         ;;
20239 *)      dflt="$pager"
20240         fn="f/($pager)"
20241         ;;
20242 esac
20243 echo " "
20244 rp='What pager is used on your system?'
20245 . ./getfile
20246 pager="$ans"
20247
20248 : see what type pids are declared as in the kernel
20249 rp="What is the type of process ids on this system?"
20250 set pid_t pidtype int stdio.h sys/types.h
20251 eval $typedef_ask
20252
20253 : see if ar generates random libraries by itself
20254 echo " "
20255 echo "Checking how to generate random libraries on your machine..." >&4
20256 echo 'int bar1() { return bar2(); }' > bar1.c
20257 echo 'int bar2() { return 2; }' > bar2.c
20258 $cat > foo.c <<EOP
20259 #$i_stdlib I_STDLIB
20260 #ifdef I_STDLIB
20261 #include <stdlib.h>
20262 #endif
20263 int main() { printf("%d\n", bar1()); exit(0); }
20264 EOP
20265 $cc $ccflags -c bar1.c >/dev/null 2>&1
20266 $cc $ccflags -c bar2.c >/dev/null 2>&1
20267 $cc $ccflags -c foo.c >/dev/null 2>&1
20268 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20269 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20270         $run ./foobar >/dev/null 2>&1; then
20271         echo "$ar appears to generate random libraries itself."
20272         orderlib=false
20273         if [ "X$ranlib" = "X" ]; then
20274             ranlib=":"
20275         fi
20276 elif $ar s bar$_a >/dev/null 2>&1 &&
20277         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20278         $run ./foobar >/dev/null 2>&1; then
20279                 echo "a table of contents needs to be added with '$ar s'."
20280                 orderlib=false
20281                 ranlib="$ar s"
20282 elif $ar ts bar$_a >/dev/null 2>&1 &&
20283         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20284         $run ./foobar >/dev/null 2>&1; then
20285                 echo "a table of contents needs to be added with '$ar ts'."
20286                 orderlib=false
20287                 ranlib="$ar ts"
20288 else
20289         case "$ranlib" in
20290         :) ranlib='';;
20291         '')
20292                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20293                 $test -f $ranlib || ranlib=''
20294                 ;;
20295         esac
20296         if $test -n "$ranlib"; then
20297                 echo "your system has '$ranlib'; we'll use that."
20298                 orderlib=false
20299         else
20300                 echo "your system doesn't seem to support random libraries"
20301                 echo "so we'll use lorder and tsort to order the libraries."
20302                 orderlib=true
20303                 ranlib=":"
20304         fi
20305 fi
20306 $rm -f foo* bar*
20307
20308 : see if this is a values.h system
20309 set values.h i_values
20310 eval $inhdr
20311
20312 : Check the max offset that gmtime and localtime accept
20313 echo "Checking max offsets that gmtime () accepts"
20314
20315 case $i_values in
20316     define) yyy="#include <values.h>" ;;
20317     *)      yyy="" ;;
20318     esac
20319
20320 case "$sGMTIME_min/$sGMTIME_max" in
20321     0/0|/)
20322         $cat >try.c <<EOCP
20323 #include <sys/types.h>
20324 #include <stdio.h>
20325 #include <time.h>
20326 $yyy
20327
20328 int i;
20329 struct tm *tmp;
20330 time_t pt;
20331
20332 void gm_check (time_t t, int min_year, int max_year)
20333 {
20334     tmp = gmtime (&t);
20335     if ( tmp == NULL ||
20336         /* Check tm_year overflow */
20337          tmp->tm_year < min_year || tmp->tm_year > max_year)
20338         tmp = NULL;
20339     else
20340         pt = t;
20341     } /* gm_check */
20342
20343 int check_max ()
20344 {
20345     tmp = NULL;
20346     pt  = 0;
20347 #ifdef MAXLONG
20348     gm_check (MAXLONG, 69, 0x7fffffff);
20349 #endif
20350     if (tmp == NULL || tmp->tm_year < 0) {
20351         for (i = 63; i >= 0; i--) {
20352             time_t x = pt | ((time_t)1 << i);
20353             if (x < 0 || x < pt) continue;
20354             gm_check (x, 69, 0x7fffffff);
20355             }
20356         }
20357     printf ("sGMTIME_max=%ld\n", pt);
20358     return (0);
20359     } /* check_max */
20360
20361 int check_min ()
20362 {
20363     tmp = NULL;
20364     pt  = 0;
20365 #ifdef MINLONG
20366     gm_check (MINLONG, -1900, 70);
20367 #endif
20368     if (tmp == NULL) {
20369         for (i = 36; i >= 0; i--) {
20370             time_t x = pt - ((time_t)1 << i);
20371             if (x > 0) continue;
20372             gm_check (x, -1900, 70);
20373             }
20374         }
20375     printf ("sGMTIME_min=%ld\n", pt);
20376     return (0);
20377     } /* check_min */
20378
20379 int main (int argc, char *argv[])
20380 {
20381     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20382     check_max ();
20383     check_min ();
20384     return (0);
20385     } /* main */
20386 EOCP
20387         set try
20388         if eval $compile; then
20389             eval `$run ./try`
20390         else
20391             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20392             fi
20393         $rm_try
20394         ;;
20395     esac
20396
20397 echo "Checking max offsets that localtime () accepts"
20398
20399 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20400     0/0|/)
20401         $cat >try.c <<EOCP
20402 #include <sys/types.h>
20403 #include <stdio.h>
20404 #include <time.h>
20405 $yyy
20406
20407 int i;
20408 struct tm *tmp;
20409 time_t pt;
20410
20411 void local_check (time_t t, int min_year, int max_year)
20412 {
20413     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20414         tmp = NULL;
20415     else
20416         tmp = localtime (&t);
20417     if ( tmp == NULL ||
20418         /* Check tm_year overflow */
20419          tmp->tm_year < min_year || tmp->tm_year > max_year)
20420         tmp = NULL;
20421     else
20422         pt = t;
20423     } /* local_check */
20424
20425 int check_max ()
20426 {
20427     tmp = NULL;
20428     pt  = 0;
20429 #ifdef MAXLONG
20430     local_check (MAXLONG, 69, 0x7fffffff);
20431 #endif
20432     if (tmp == NULL || tmp->tm_year < 0) {
20433         for (i = 63; i >= 0; i--) {
20434             time_t x = pt | ((time_t)1 << i);
20435             if (x < 0 || x < pt) continue;
20436             local_check (x, 69, 0x7fffffff);
20437             }
20438         }
20439     printf ("sLOCALTIME_max=%ld\n", pt);
20440     return (0);
20441    } /* check_max */
20442
20443 int check_min ()
20444 {
20445     tmp = NULL;
20446     pt  = 0;
20447 #ifdef MINLONG
20448     local_check (MINLONG, -1900, 70);
20449 #endif
20450     if (tmp == NULL) {
20451         for (i = 36; i >= 0; i--) {
20452             time_t x = pt - ((time_t)1 << i);
20453             if (x > 0) continue;
20454             local_check (x, -1900, 70);
20455             }
20456         }
20457     printf ("sLOCALTIME_min=%ld\n", pt);
20458     return (0);
20459     } /* check_min */
20460
20461 int main (int argc, char *argv[])
20462 {
20463     check_max ();
20464     check_min ();
20465     return (0);
20466     } /* main */
20467 EOCP
20468         set try
20469         if eval $compile; then
20470             eval `$run ./try`
20471         else
20472             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20473             fi
20474         $rm_try
20475         ;;
20476     esac
20477
20478 : check for type of arguments to select.
20479 case "$selecttype" in
20480 '') case "$d_select" in
20481         $define)
20482                 echo " "
20483                 $cat <<EOM
20484 Checking to see what type of arguments are accepted by select().
20485 EOM
20486                 hdrs="$define sys/types.h
20487                         $i_systime sys/time.h
20488                         $i_sysselct sys/select.h
20489                         $d_socket sys/socket.h"
20490                 : The first arg can be int, unsigned, or size_t
20491                 : The last arg may or may not be 'const'
20492                 val=''
20493                 : void pointer has been seen but using that
20494                 : breaks the selectminbits test
20495                 for xxx in 'fd_set *' 'int *'; do
20496                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20497                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20498                                         case "$val" in
20499                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20500                                                 if ./protochk "$try" $hdrs; then
20501                                                         echo "Your system accepts $xxx."
20502                                                         val="$xxx"
20503                                                 fi
20504                                                 ;;
20505                                         esac
20506                                 done
20507                         done
20508                 done
20509                 case "$val" in
20510                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20511                         case "$d_fd_set" in
20512                                 $define) dflt="fd_set *" ;;
20513                                 *)              dflt="int *" ;;
20514                         esac
20515                         . ./myread
20516                         val=$ans
20517                         ;;
20518                 esac
20519                 selecttype="$val"
20520                 ;;
20521         *)      : no select, so pick a harmless default
20522                 selecttype='int *'
20523                 ;;
20524         esac
20525         ;;
20526 esac
20527
20528 : check for the select 'width'
20529 case "$selectminbits" in
20530 '') safebits=`expr $ptrsize \* 8`
20531     case "$d_select" in
20532         $define)
20533                 $cat <<EOM
20534
20535 Checking to see on how many bits at a time your select() operates...
20536 EOM
20537                 $cat >try.c <<EOCP
20538 #include <sys/types.h>
20539 #$i_time I_TIME
20540 #$i_systime I_SYS_TIME
20541 #$i_systimek I_SYS_TIME_KERNEL
20542 #ifdef I_TIME
20543 #   include <time.h>
20544 #endif
20545 #ifdef I_SYS_TIME
20546 #   ifdef I_SYS_TIME_KERNEL
20547 #       define KERNEL
20548 #   endif
20549 #   include <sys/time.h>
20550 #   ifdef I_SYS_TIME_KERNEL
20551 #       undef KERNEL
20552 #   endif
20553 #endif
20554 #$i_sysselct I_SYS_SELECT
20555 #ifdef I_SYS_SELECT
20556 #include <sys/select.h>
20557 #endif
20558 #$d_socket HAS_SOCKET
20559 #ifdef HAS_SOCKET
20560 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20561 #endif
20562 #include <stdio.h>
20563 #$i_stdlib I_STDLIB
20564 #ifdef I_STDLIB
20565 #include <stdlib.h>
20566 #endif
20567 $selecttype b;
20568 #define S sizeof(*(b))
20569 #define MINBITS 64
20570 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20571 #define NBITS  (NBYTES * 8)
20572 int main() {
20573     char *s = (char *)malloc(NBYTES);
20574     struct timeval t;
20575     int i;
20576     FILE* fp;
20577     int fd;
20578
20579     if (!s)
20580         exit(1);
20581     fclose(stdin);
20582     fp = fopen("try.c", "r");
20583     if (fp == 0)
20584       exit(2);
20585     fd = fileno(fp);
20586     if (fd < 0)
20587       exit(3);
20588     b = ($selecttype)s;
20589     for (i = 0; i < NBITS; i++)
20590         FD_SET(i, b);
20591     t.tv_sec  = 0;
20592     t.tv_usec = 0;
20593     select(fd + 1, b, 0, 0, &t);
20594     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20595     free(s);
20596     printf("%d\n", i + 1);
20597     return 0;
20598 }
20599 EOCP
20600                 set try
20601                 if eval $compile_ok; then
20602                         selectminbits=`$run ./try`
20603                         case "$selectminbits" in
20604                         '')     cat >&4 <<EOM
20605 Cannot figure out on how many bits at a time your select() operates.
20606 I'll play safe and guess it is $safebits bits.
20607 EOM
20608                                 selectminbits=$safebits
20609                                 bits="$safebits bits"
20610                                 ;;
20611                         1)      bits="1 bit" ;;
20612                         *)      bits="$selectminbits bits" ;;
20613                         esac
20614                         echo "Your select() operates on $bits at a time." >&4
20615                 else
20616                         rp='What is the minimum number of bits your select() operates on?'
20617                         case "$byteorder" in
20618                         12345678)       dflt=64 ;;
20619                         1234)           dflt=32 ;;
20620                         *)              dflt=1  ;;
20621                         esac
20622                         . ./myread
20623                         val=$ans
20624                         selectminbits="$val"
20625                 fi
20626                 $rm_try
20627                 ;;
20628         *)      : no select, so pick a harmless default
20629                 selectminbits=$safebits
20630                 ;;
20631         esac
20632         ;;
20633 esac
20634
20635 : Trace out the files included by signal.h, then look for SIGxxx names.
20636 if [ "X$fieldn" = X ]; then
20637         : Just make some guesses.  We check them later.
20638         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20639 else
20640         xxx=`echo '#include <signal.h>' |
20641         $cppstdin $cppminus $cppflags 2>/dev/null |
20642         $grep '^[       ]*#.*include' |
20643         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20644                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20645 fi
20646 xxxfiles=''
20647 for xx in $xxx /dev/null ; do
20648         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20649 done
20650 case "$xxxfiles" in
20651 '')     xxxfiles=`./findhdr signal.h` ;;
20652 esac
20653 xxx=`awk '
20654 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20655         print substr($2, 4, 20)
20656 }
20657 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20658         print substr($3, 4, 20)
20659 }' $xxxfiles`
20660 : Append some common names just in case the awk scan failed.
20661 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20662 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20663 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20664 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20665 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20666
20667 : generate a few handy files for later
20668 $cat > signal.c <<EOCP
20669 #include <sys/types.h>
20670 #include <signal.h>
20671 #$i_stdlib I_STDLIB
20672 #ifdef I_STDLIB
20673 #include <stdlib.h>
20674 #endif
20675 #include <stdio.h>
20676 int main() {
20677
20678 /* Strange style to avoid deeply-nested #if/#else/#endif */
20679 #ifndef NSIG
20680 #  ifdef _NSIG
20681 #    define NSIG (_NSIG)
20682 #  endif
20683 #endif
20684
20685 #ifndef NSIG
20686 #  ifdef SIGMAX
20687 #    define NSIG (SIGMAX+1)
20688 #  endif
20689 #endif
20690
20691 #ifndef NSIG
20692 #  ifdef SIG_MAX
20693 #    define NSIG (SIG_MAX+1)
20694 #  endif
20695 #endif
20696
20697 #ifndef NSIG
20698 #  ifdef _SIG_MAX
20699 #    define NSIG (_SIG_MAX+1)
20700 #  endif
20701 #endif
20702
20703 #ifndef NSIG
20704 #  ifdef MAXSIG
20705 #    define NSIG (MAXSIG+1)
20706 #  endif
20707 #endif
20708
20709 #ifndef NSIG
20710 #  ifdef MAX_SIG
20711 #    define NSIG (MAX_SIG+1)
20712 #  endif
20713 #endif
20714
20715 #ifndef NSIG
20716 #  ifdef SIGARRAYSIZE
20717 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20718 #  endif
20719 #endif
20720
20721 #ifndef NSIG
20722 #  ifdef _sys_nsig
20723 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20724 #  endif
20725 #endif
20726
20727 /* Default to some arbitrary number that's big enough to get most
20728    of the common signals.
20729 */
20730 #ifndef NSIG
20731 #    define NSIG 50
20732 #endif
20733
20734 printf("NSIG %d\n", NSIG);
20735
20736 #ifndef JUST_NSIG
20737
20738 EOCP
20739
20740 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20741 {
20742         printf "#ifdef SIG"; printf $1; printf "\n"
20743         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20744         printf $1; printf ");\n"
20745         printf "#endif\n"
20746 }
20747 END {
20748         printf "#endif /* JUST_NSIG */\n";
20749         printf "exit(0);\n}\n";
20750 }
20751 ' >>signal.c
20752 $cat >signal.awk <<'EOP'
20753 BEGIN { ndups = 0 }
20754 $1 ~ /^NSIG$/ { nsig = $2 }
20755 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20756     if ($2 > maxsig) { maxsig = $2 }
20757     if (sig_name[$2]) {
20758         dup_name[ndups] = $1
20759         dup_num[ndups] = $2
20760         ndups++
20761     }
20762     else {
20763         sig_name[$2] = $1
20764         sig_num[$2] = $2
20765     }
20766 }
20767 END {
20768     if (nsig == 0) {
20769         nsig = maxsig + 1
20770     }
20771     printf("NSIG %d\n", nsig);
20772     for (n = 1; n < nsig; n++) {
20773         if (sig_name[n]) {
20774             printf("%s %d\n", sig_name[n], sig_num[n])
20775         }
20776         else {
20777             printf("NUM%d %d\n", n, n)
20778         }
20779     }
20780     for (n = 0; n < ndups; n++) {
20781         printf("%s %d\n", dup_name[n], dup_num[n])
20782     }
20783 }
20784 EOP
20785 $cat >signal_cmd <<EOS
20786 $startsh
20787 if $test -s signal.lst; then
20788     echo "Using your existing signal.lst file"
20789         exit 0
20790 fi
20791 xxx="$xxx"
20792 EOS
20793 $cat >>signal_cmd <<'EOS'
20794
20795 set signal
20796 if eval $compile_ok; then
20797         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20798                 $uniq | $awk -f signal.awk >signal.lst
20799 else
20800         echo "(I can't seem be able to compile the whole test program)" >&4
20801         echo "(I'll try it in little pieces.)" >&4
20802         set signal -DJUST_NSIG
20803         if eval $compile_ok; then
20804                 $run ./signal$_exe > signal.nsg
20805                 $cat signal.nsg
20806         else
20807                 echo "I can't seem to figure out how many signals you have." >&4
20808                 echo "Guessing 50." >&4
20809                 echo 'NSIG 50' > signal.nsg
20810         fi
20811         : Now look at all the signal names, one at a time.
20812         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20813                 $cat > signal.c <<EOCP
20814 #include <sys/types.h>
20815 #include <signal.h>
20816 #include <stdio.h>
20817 int main() {
20818 printf("$xx %d\n", SIG${xx});
20819 return 0;
20820 }
20821 EOCP
20822                 set signal
20823                 if eval $compile; then
20824                         echo "SIG${xx} found."
20825                         $run ./signal$_exe  >> signal.ls1
20826                 else
20827                         echo "SIG${xx} NOT found."
20828                 fi
20829         done
20830         if $test -s signal.ls1; then
20831                 $cat signal.nsg signal.ls1 |
20832                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20833         fi
20834
20835 fi
20836 if $test -s signal.lst; then
20837         :
20838 else
20839         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20840         echo 'kill -l' >signal
20841         set X `csh -f <signal`
20842         $rm -f signal
20843         shift
20844         case $# in
20845         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20846         esac
20847         echo $@ | $tr ' ' $trnl | \
20848             $awk '{ printf "%s %d\n", $1, ++s; }
20849                   END { printf "NSIG %d\n", ++s }' >signal.lst
20850 fi
20851 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20852 EOS
20853 chmod a+x signal_cmd
20854 $eunicefix signal_cmd
20855
20856 : generate list of signal names
20857 echo " "
20858 case "$sig_name_init" in
20859 '') doinit=yes ;;
20860 *)  case "$sig_num_init" in
20861     ''|*,*) doinit=yes ;;
20862     esac ;;
20863 esac
20864 case "$doinit" in
20865 yes)
20866         echo "Generating a list of signal names and numbers..." >&4
20867         . ./signal_cmd
20868         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20869         sig_name=`$awk 'BEGIN { printf "ZERO " }
20870                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20871         sig_num=`$awk  'BEGIN { printf "0 " }
20872                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20873         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20874                              !/^NSIG/   { printf "\"%s\", ", $1 }
20875                              END        { printf "0\n" }' signal.lst`
20876         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20877                              !/^NSIG/   { printf "%d, ", $2}
20878                              END        { printf "0\n"}' signal.lst`
20879         ;;
20880 esac
20881 echo "The following $sig_count signals are available:"
20882 echo " "
20883 echo $sig_name | $awk \
20884 'BEGIN { linelen = 0 }
20885 {
20886         for (i = 1; i <= NF; i++) {
20887                 name = "SIG" $i " "
20888                 linelen = linelen + length(name)
20889                 if (linelen > 70) {
20890                         printf "\n"
20891                         linelen = length(name)
20892                 }
20893                 printf "%s", name
20894         }
20895         printf "\n"
20896 }'
20897 sig_size=`echo $sig_name | awk '{print NF}'`
20898 $rm -f signal signal.c signal.awk signal.lst signal_cmd
20899
20900 : Check size of size
20901 echo " "
20902 case "$sizetype" in
20903 *_t) zzz="$sizetype"    ;;
20904 *)   zzz="filesize"     ;;
20905 esac
20906 echo "Checking the size of $zzz..." >&4
20907 cat > try.c <<EOCP
20908 #include <sys/types.h>
20909 #include <stdio.h>
20910 #$i_stdlib I_STDLIB
20911 #ifdef I_STDLIB
20912 #include <stdlib.h>
20913 #endif
20914 int main() {
20915     printf("%d\n", (int)sizeof($sizetype));
20916     exit(0);
20917 }
20918 EOCP
20919 set try
20920 if eval $compile_ok; then
20921         yyy=`$run ./try`
20922         case "$yyy" in
20923         '')     sizesize=4
20924                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20925                 ;;
20926         *)      sizesize=$yyy
20927                 echo "Your $zzz size is $sizesize bytes."
20928                 ;;
20929         esac
20930 else
20931         sizesize=4
20932         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20933 fi
20934
20935
20936 : check for socklen_t
20937 echo " "
20938 echo "Checking to see if you have socklen_t..." >&4
20939 $cat >try.c <<EOCP
20940 #include <sys/types.h>
20941 #$d_socket HAS_SOCKET
20942 #ifdef HAS_SOCKET
20943 #include <sys/socket.h>
20944 #endif
20945 int main() { socklen_t x = 16; }
20946 EOCP
20947 set try
20948 if eval $compile; then
20949         val="$define"
20950         echo "You have socklen_t."
20951 else
20952         val="$undef"
20953         echo "You do not have socklen_t."
20954         case "$sizetype" in
20955         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20956         esac
20957 fi
20958 $rm_try
20959 set d_socklen_t
20960 eval $setvar
20961
20962 : see if this is a socks.h system
20963 set socks.h i_socks
20964 eval $inhdr
20965
20966 : check for type of the size argument to socket calls
20967 case "$d_socket" in
20968 "$define")
20969         $cat <<EOM
20970
20971 Checking to see what type is the last argument of accept().
20972 EOM
20973         yyy=''
20974         case "$d_socklen_t" in
20975         "$define") yyy="$yyy socklen_t"
20976         esac
20977         yyy="$yyy $sizetype int long unsigned"
20978         for xxx in $yyy; do
20979                 case "$socksizetype" in
20980                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
20981                         case "$usesocks" in
20982                         "$define")
20983                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20984                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20985                                         socksizetype="$xxx"
20986                                 fi
20987                                 ;;
20988                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20989                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20990                                         socksizetype="$xxx"
20991                                 fi
20992                                 ;;
20993                         esac
20994                         ;;
20995                 esac
20996         done
20997 : In case none of those worked, prompt the user.
20998         case "$socksizetype" in
20999         '')     rp='What is the type for socket address structure sizes?'
21000                 dflt='int'
21001                 . ./myread
21002                 socksizetype=$ans
21003                 ;;
21004         esac
21005         ;;
21006 *)      : no sockets, so pick relatively harmless default
21007         socksizetype='int'
21008         ;;
21009 esac
21010
21011 : see what type is used for signed size_t
21012 set ssize_t ssizetype int stdio.h sys/types.h
21013 eval $typedef
21014 dflt="$ssizetype"
21015 $cat > try.c <<EOM
21016 #include <stdio.h>
21017 #$i_stdlib I_STDLIB
21018 #ifdef I_STDLIB
21019 #include <stdlib.h>
21020 #endif
21021 #include <sys/types.h>
21022 #define Size_t $sizetype
21023 #define SSize_t $dflt
21024 int main()
21025 {
21026         if (sizeof(Size_t) == sizeof(SSize_t))
21027                 printf("$dflt\n");
21028         else if (sizeof(Size_t) == sizeof(int))
21029                 printf("int\n");
21030         else
21031                 printf("long\n");
21032         exit(0);
21033 }
21034 EOM
21035 echo " "
21036 set try
21037 if eval $compile_ok && $run ./try > /dev/null; then
21038         ssizetype=`$run ./try`
21039         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21040 else
21041         $cat >&4 <<EOM
21042 Help! I can't compile and run the ssize_t test program: please enlighten me!
21043 (This is probably a misconfiguration in your system or libraries, and
21044 you really ought to fix it.  Still, I'll try anyway.)
21045
21046 I need a type that is the same size as $sizetype, but is guaranteed to
21047 be signed.  Common values are ssize_t, int and long.
21048
21049 EOM
21050         rp="What signed type is the same size as $sizetype?"
21051         . ./myread
21052         ssizetype="$ans"
21053 fi
21054 $rm_try
21055
21056 : see what type of char stdio uses.
21057 echo " "
21058 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21059 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21060         echo "Your stdio uses unsigned chars." >&4
21061         stdchar="unsigned char"
21062 else
21063         echo "Your stdio uses signed chars." >&4
21064         stdchar="char"
21065 fi
21066 $rm -f stdioh
21067
21068 : see what type uids are declared as in the kernel
21069 echo " "
21070 echo "Looking for the type for user ids returned by getuid()."
21071 set uid_t uidtype xxx stdio.h sys/types.h
21072 eval $typedef
21073 case "$uidtype" in
21074 xxx)
21075         xxx=`./findhdr sys/user.h`
21076         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21077         case $1 in
21078         unsigned) dflt="$1 $2" ;;
21079         *) dflt="$1" ;;
21080         esac
21081         ;;
21082 *) dflt="$uidtype";;
21083 esac
21084 case "$uidtype" in
21085 uid_t)  echo "uid_t found." ;;
21086 *)      rp="What is the type for user ids returned by getuid()?"
21087         . ./myread
21088         uidtype="$ans"
21089         ;;
21090 esac
21091
21092 : Check size of UID
21093 echo " "
21094 case "$uidtype" in
21095 *_t) zzz="$uidtype"     ;;
21096 *)   zzz="uid"          ;;
21097 esac
21098 echo "Checking the size of $zzz..." >&4
21099 cat > try.c <<EOCP
21100 #include <sys/types.h>
21101 #include <stdio.h>
21102 #$i_stdlib I_STDLIB
21103 #ifdef I_STDLIB
21104 #include <stdlib.h>
21105 #endif
21106 int main() {
21107     printf("%d\n", (int)sizeof($uidtype));
21108     exit(0);
21109 }
21110 EOCP
21111 set try
21112 if eval $compile_ok; then
21113         yyy=`$run ./try`
21114         case "$yyy" in
21115         '')     uidsize=4
21116                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21117                 ;;
21118         *)      uidsize=$yyy
21119                 echo "Your $zzz is $uidsize bytes long."
21120                 ;;
21121         esac
21122 else
21123         uidsize=4
21124         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21125 fi
21126
21127 : Check if UID is signed
21128 echo " "
21129 case "$uidtype" in
21130 *_t) zzz="$uidtype"     ;;
21131 *)   zzz="uid"          ;;
21132 esac
21133 echo "Checking the sign of $zzz..." >&4
21134 cat > try.c <<EOCP
21135 #include <sys/types.h>
21136 #include <stdio.h>
21137 int main() {
21138         $uidtype foo = -1;
21139         if (foo < 0)
21140                 printf("-1\n");
21141         else
21142                 printf("1\n");
21143 }
21144 EOCP
21145 set try
21146 if eval $compile; then
21147         yyy=`$run ./try`
21148         case "$yyy" in
21149         '')     uidsign=1
21150                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21151                 ;;
21152         *)      uidsign=$yyy
21153                 case "$uidsign" in
21154                  1) echo "Your $zzz is unsigned." ;;
21155                 -1) echo "Your $zzz is signed."   ;;
21156                 esac
21157                 ;;
21158         esac
21159 else
21160         uidsign=1
21161         echo "(I can't compile the test program--guessing unsigned.)" >&4
21162 fi
21163
21164
21165 : Check format string for UID
21166 echo " "
21167 $echo "Checking the format string to be used for uids..." >&4
21168
21169 case "$uidsign" in
21170 -1)     if $test X"$uidsize" = X"$ivsize"; then
21171                 uidformat="$ivdformat"
21172         else
21173                 if $test X"$uidsize" = X"$longsize"; then
21174                         uidformat='"ld"'
21175                 else
21176                         if $test X"$uidsize" = X"$intsize"; then
21177                                 uidformat='"d"'
21178                         else
21179                                 if $test X"$uidsize" = X"$shortsize"; then
21180                                         uidformat='"hd"'
21181                                 fi
21182                         fi
21183                 fi
21184         fi
21185         ;;
21186 *)      if $test X"$uidsize" = X"$uvsize"; then
21187                 uidformat="$uvuformat"
21188         else
21189                 if $test X"$uidsize" = X"$longsize"; then
21190                         uidformat='"lu"'
21191                 else
21192                         if $test X"$uidsize" = X"$intsize"; then
21193                                 uidformat='"u"'
21194                         else
21195                                 if $test X"$uidsize" = X"$shortsize"; then
21196                                         uidformat='"hu"'
21197                                 fi
21198                         fi
21199                 fi
21200         fi
21201         ;;
21202 esac
21203
21204 : Check if site customization support was requested
21205 case "$usesitecustomize" in
21206     $define|true|[Yy]*)
21207         usesitecustomize="$define"
21208         ;;
21209     *)
21210         usesitecustomize="$undef"
21211         ;;
21212     esac
21213
21214 : see if prototypes support variable argument declarations
21215 echo " "
21216 case "$prototype$i_stdarg" in
21217 $define$define)
21218         echo "It appears we'll be able to prototype varargs functions." >&4
21219         val="$define"
21220         ;;
21221 *)
21222         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21223         val="$undef"
21224         ;;
21225 esac
21226 set vaproto
21227 eval $setvar
21228
21229 : determine compiler compiler
21230 case "$yacc" in
21231 '')
21232         dflt=yacc;;
21233 *)
21234         dflt="$yacc";;
21235 esac
21236 echo " "
21237 comp='yacc'
21238 if $test -f "$byacc$_exe"; then
21239         dflt="$byacc"
21240         comp="byacc or $comp"
21241 fi
21242 if $test -f "$bison$_exe"; then
21243         comp="$comp or bison -y"
21244 fi
21245 rp="Which compiler compiler ($comp) shall I use?"
21246 . ./myread
21247 yacc="$ans"
21248 case "$yacc" in
21249 *bis*)
21250         case "$yacc" in
21251         *-y*) ;;
21252         *)
21253                 yacc="$yacc -y"
21254                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21255                 ;;
21256         esac
21257         ;;
21258 esac
21259
21260 : see if this is a assert.h system
21261 set assert.h i_assert
21262 eval $inhdr
21263
21264 : see if this is a fp.h system
21265 set fp.h i_fp
21266 eval $inhdr
21267
21268 : see if this is a fp_class.h system
21269 set fp_class.h i_fp_class
21270 eval $inhdr
21271
21272 : see if gdbm.h is available
21273 set gdbm.h t_gdbm
21274 eval $inhdr
21275 case "$t_gdbm" in
21276 $define)
21277         : see if gdbm_open exists
21278         set gdbm_open d_gdbm_open
21279         eval $inlibc
21280         case "$d_gdbm_open" in
21281         $undef)
21282                 t_gdbm="$undef"
21283                 echo "We won't be including <gdbm.h>"
21284                 ;;
21285         esac
21286         ;;
21287 esac
21288 val="$t_gdbm"
21289 set i_gdbm
21290 eval $setvar
21291
21292 : see if this is a ieeefp.h system
21293 case "$i_ieeefp" in
21294 '' ) set ieeefp.h i_ieeefp
21295      eval $inhdr
21296      ;;
21297 esac
21298
21299 : see if this is a libutil.h system
21300 set libutil.h i_libutil
21301 eval $inhdr
21302
21303 : see if mach cthreads are available
21304 if test "X$usethreads" = "X$define"; then
21305         set mach/cthreads.h i_machcthr
21306         eval $inhdr
21307 else
21308         i_machcthr="$undef"
21309 fi
21310
21311 : see if this is a mntent.h system
21312 set mntent.h i_mntent
21313 eval $inhdr
21314
21315 : see if net/errno.h is available
21316 val=''
21317 set net/errno.h val
21318 eval $inhdr
21319
21320 : Unfortunately, it causes problems on some systems.  Arrgh.
21321 case "$val" in
21322 $define)
21323         cat > try.c <<'EOM'
21324 #include <stdio.h>
21325 #include <errno.h>
21326 #include <net/errno.h>
21327 int func()
21328 {
21329         return ENOTSOCK;
21330 }
21331 EOM
21332         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21333                 echo "We'll be including <net/errno.h>." >&4
21334         else
21335                 echo "We won't be including <net/errno.h>." >&4
21336                 val="$undef"
21337         fi
21338         $rm_try
21339         ;;
21340 esac
21341 set i_neterrno
21342 eval $setvar
21343
21344 : see if netinet/tcp.h is available
21345 set netinet/tcp.h i_netinettcp
21346 eval $inhdr
21347
21348 : see if this is a poll.h system
21349 set poll.h i_poll
21350 eval $inhdr
21351
21352 : see if this is a prot.h system
21353 set prot.h i_prot
21354 eval $inhdr
21355
21356 : Preprocessor symbols
21357 echo " "
21358 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21359 $cat <<'EOSH' > Cppsym.know
21360 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21361 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21362 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21363 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21364 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21365 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21366 bull c cadmus clipper CMU COFF COMPILER_VERSION
21367 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21368 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21369 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21370 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21371 GLIBC GLIBC_MINOR
21372 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21373 H3050R H3050RX hbullx20 hcx host_mips
21374 hp200 hp300 hp700 HP700 hp800 hp9000
21375 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21376 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21377 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21378 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21379 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21380 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21381 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21382 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21383 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21384 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21385 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21386 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21387 MATH_HAS_NO_SIDE_EFFECTS
21388 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21389 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21390 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21391 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21392 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21393 NetBSD news1500 news1700 news1800 news1900 news3700
21394 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21395 ns32016 ns32332 ns32k nsc32000
21396 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21397 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21398 pc532 pdp11 PGC PIC plexus PORTAR posix
21399 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21400 POSIX_C_SOURCE POSIX_SOURCE POWER
21401 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21402 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21403 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21404 sony sony_news sonyrisc sparc sparclite spectrum
21405 stardent stdc STDC_EXT stratos sun sun3 sun386
21406 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21407 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21408 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21409 sysV68 sysV88 Tek4132 Tek4300 titan
21410 TM3200 TM5400 TM5600
21411 tower tower32 tower32_200 tower32_600 tower32_700
21412 tower32_800 tower32_850 tss
21413 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21414 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21415 unix UNIX95 UNIX99 unixpc unos
21416 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21417 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21418 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21419 USGr4 USGr4_2
21420 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21421 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21422 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21423 z8000
21424 EOSH
21425 # Maybe put other stuff here too.
21426 cat <<EOSH >>Cppsym.know
21427 $osname
21428 EOSH
21429 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21430 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21431 $cat Cppsym.know > Cppsym.c
21432 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21433 $rm -f Cppsym.a Cppsym.b Cppsym.c
21434 cat <<EOSH > Cppsym
21435 $startsh
21436 if $test \$# -gt 0; then
21437     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21438     if $test -s Cppsym.got; then
21439         $rm -f Cppsym.got
21440         exit 0
21441     fi
21442     $rm -f Cppsym.got
21443     exit 1
21444 else
21445     $tr " " "$trnl" | ./Cppsym.try
21446     exit 0
21447 fi
21448 EOSH
21449 chmod +x Cppsym
21450 $eunicefix Cppsym
21451 cat <<EOSH > Cppsym.try
21452 $startsh
21453 cat <<'EOCP' > try.c
21454 #include <stdio.h>
21455 #if cpp_stuff == 1
21456 #define STRINGIFY(a)    "a"
21457 #endif
21458 #if cpp_stuff == 42
21459 #define StGiFy(a)  #a
21460 #define STRINGIFY(a)    StGiFy(a)
21461 #endif
21462 #if $cpp_stuff != 1 && $cpp_stuff != 42
21463 #   include "Bletch: How does this C preprocessor stringify macros?"
21464 #endif
21465 int main() {
21466 EOCP
21467 $awk \\
21468 EOSH
21469 cat <<'EOSH' >> Cppsym.try
21470 'length($1) > 0 {
21471     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21472     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21473     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21474     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21475 }'       >> try.c
21476 echo 'return 0;}' >> try.c
21477 EOSH
21478 cat <<EOSH >> Cppsym.try
21479 ccflags="$ccflags"
21480 case "$osname-$gccversion" in
21481 irix-) ccflags="\$ccflags -woff 1178" ;;
21482 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21483 esac
21484 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21485 EOSH
21486 chmod +x Cppsym.try
21487 $eunicefix Cppsym.try
21488 ./Cppsym < Cppsym.know > Cppsym.true
21489 : Add in any linux cpp "predefined macros":
21490 case "$osname::$gccversion" in
21491   *linux*::*.*|*gnukfreebsd*::*.*)
21492     tHdrH=_tmpHdr
21493     rm -f $tHdrH'.h' $tHdrH
21494     touch $tHdrH'.h'
21495     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21496        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21497        if [ -s $tHdrH'_cppsym.real' ]; then
21498           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21499        fi
21500     fi
21501     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21502   ;;
21503 esac
21504 : now check the C compiler for additional symbols
21505 postprocess_cc_v=''
21506 case "$osname" in
21507 aix) postprocess_cc_v="|$tr , ' '" ;;
21508 esac
21509 $cat >ccsym <<EOS
21510 $startsh
21511 $cat >tmp.c <<EOF
21512 extern int foo;
21513 EOF
21514 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21515 do
21516         case "\$i" in
21517         -D*) echo "\$i" | $sed 's/^-D//';;
21518         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21519         esac
21520 done
21521 $rm_try
21522 EOS
21523 postprocess_cc_v=''
21524 chmod +x ccsym
21525 $eunicefix ccsym
21526 ./ccsym > ccsym1.raw
21527 if $test -s ccsym1.raw; then
21528        $sort ccsym1.raw | $uniq >ccsym.raw
21529 else
21530        mv ccsym1.raw ccsym.raw
21531 fi
21532
21533 $awk '/\=/ { print $0; next }
21534         { print $0"=1" }' ccsym.raw >ccsym.list
21535 $comm -13 Cppsym.true ccsym.list >ccsym.own
21536 $comm -12 Cppsym.true ccsym.list >ccsym.com
21537 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21538 also=''
21539 if $test -z ccsym.raw; then
21540         echo "Your C compiler doesn't seem to define any symbols!" >&4
21541         echo " "
21542         echo "However, your C preprocessor defines the following symbols:"
21543         $cat Cppsym.true
21544         ccsymbols=''
21545         cppsymbols=`$cat Cppsym.true`
21546         cppsymbols=`echo $cppsymbols`
21547         cppccsymbols="$cppsymbols"
21548 else
21549         if $test -s ccsym.com; then
21550                 echo "Your C compiler and pre-processor define these symbols:"
21551                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21552                 also='also '
21553                 symbols='ones'
21554                 cppccsymbols=`$cat ccsym.com`
21555                 cppccsymbols=`echo $cppccsymbols`
21556                 $test "$silent" || sleep 1
21557         fi
21558         if $test -s ccsym.cpp; then
21559                 $test "$also" && echo " "
21560                 echo "Your C pre-processor ${also}defines the following symbols:"
21561                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21562                 also='further '
21563                 cppsymbols=`$cat ccsym.cpp`
21564                 cppsymbols=`echo $cppsymbols`
21565                 $test "$silent" || sleep 1
21566         fi
21567         if $test -s ccsym.own; then
21568                 $test "$also" && echo " "
21569                 echo "Your C compiler ${also}defines the following cpp symbols:"
21570                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21571                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21572                 ccsymbols=`$cat ccsym.own`
21573                 ccsymbols=`echo $ccsymbols`
21574                 $test "$silent" || sleep 1
21575         fi
21576 fi
21577
21578 : see if this is a termio system
21579 val="$undef"
21580 val2="$undef"
21581 val3="$undef"
21582 if $test `./findhdr termios.h`; then
21583         set tcsetattr i_termios
21584         eval $inlibc
21585         val3="$i_termios"
21586 fi
21587 echo " "
21588 case "$val3" in
21589 "$define") echo "You have POSIX termios.h... good!" >&4;;
21590 *) if ./Cppsym pyr; then
21591                 case "`/bin/universe`" in
21592                 ucb) if $test `./findhdr sgtty.h`; then
21593                                 val2="$define"
21594                                 echo "<sgtty.h> found." >&4
21595                         else
21596                                 echo "System is pyramid with BSD universe."
21597                                 ./warn "<sgtty.h> not found--you could have problems."
21598                         fi;;
21599                 *) if $test `./findhdr termio.h`; then
21600                                 val="$define"
21601                                 echo "<termio.h> found." >&4
21602                         else
21603                                 echo "System is pyramid with USG universe."
21604                                 ./warn "<termio.h> not found--you could have problems."
21605                         fi;;
21606                 esac
21607         elif ./usg; then
21608                 if $test `./findhdr termio.h`; then
21609                         echo "<termio.h> found." >&4
21610                         val="$define"
21611                 elif $test `./findhdr sgtty.h`; then
21612                         echo "<sgtty.h> found." >&4
21613                         val2="$define"
21614                 else
21615                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21616                 fi
21617         else
21618                 if $test `./findhdr sgtty.h`; then
21619                         echo "<sgtty.h> found." >&4
21620                         val2="$define"
21621                 elif $test `./findhdr termio.h`; then
21622                         echo "<termio.h> found." >&4
21623                         val="$define"
21624                 else
21625                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21626                 fi
21627         fi;;
21628 esac
21629 set i_termio; eval $setvar
21630 val=$val2; set i_sgtty; eval $setvar
21631 val=$val3; set i_termios; eval $setvar
21632
21633 : see if stddef is available
21634 set stddef.h i_stddef
21635 eval $inhdr
21636
21637 : see if sys/access.h is available
21638 set sys/access.h i_sysaccess
21639 eval $inhdr
21640
21641 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21642 set sys/filio.h i_sysfilio
21643 eval $inhdr
21644 echo " "
21645 if $test `./findhdr sys/ioctl.h`; then
21646         val="$define"
21647         echo '<sys/ioctl.h> found.' >&4
21648 else
21649         val="$undef"
21650         if $test $i_sysfilio = "$define"; then
21651             echo '<sys/ioctl.h> NOT found.' >&4
21652         else
21653                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21654                 $test $i_termio = "$define" && xxx="termio.h"
21655                 $test $i_termios = "$define" && xxx="termios.h"
21656 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21657         fi
21658 fi
21659 set i_sysioctl
21660 eval $setvar
21661
21662 : see if socket ioctl defs are in sys/sockio.h
21663 echo " "
21664 xxx=`./findhdr sys/sockio.h`
21665 if $test "$xxx"; then
21666         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21667                 val="$define"
21668                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21669         else
21670                 val="$undef"
21671                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21672         fi
21673 else
21674         val="$undef"
21675         $cat <<EOM
21676 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21677 EOM
21678 fi
21679 set i_syssockio
21680 eval $setvar
21681
21682 : see if this is a syslog.h system
21683 set syslog.h i_syslog
21684 eval $inhdr
21685
21686 : see if this is a sys/mode.h system
21687 set sys/mode.h i_sysmode
21688 eval $inhdr
21689
21690 : see if there is a sys/poll.h file
21691 set sys/poll.h i_syspoll
21692 eval $inhdr
21693
21694 : see if sys/resource.h has to be included
21695 set sys/resource.h i_sysresrc
21696 eval $inhdr
21697
21698 : see if sys/security.h is available
21699 set sys/security.h i_syssecrt
21700 eval $inhdr
21701
21702 : see if this is a sys/statvfs.h system
21703 set sys/statvfs.h i_sysstatvfs
21704 eval $inhdr
21705
21706 : see if this is a sys/un.h system
21707 set sys/un.h i_sysun
21708 eval $inhdr
21709
21710 : see if this is a sys/utsname.h system
21711 set sys/utsname.h i_sysutsname
21712 eval $inhdr
21713
21714 : see if this is a syswait system
21715 set sys/wait.h i_syswait
21716 eval $inhdr
21717
21718 : see if this is a ustat.h system
21719 set ustat.h i_ustat
21720 eval $inhdr
21721
21722 : see if this is an utime system
21723 set utime.h i_utime
21724 eval $inhdr
21725
21726 : see if this is a vfork system
21727 case "$d_vfork" in
21728 "$define")
21729         set vfork.h i_vfork
21730         eval $inhdr
21731         ;;
21732 *)
21733         i_vfork="$undef"
21734         ;;
21735 esac
21736
21737 : Check extensions
21738 echo " "
21739 echo "Looking for extensions..." >&4
21740 : If we are using the old config.sh, known_extensions may contain
21741 : old or inaccurate or duplicate values.
21742 known_extensions=''
21743 nonxs_extensions=''
21744 : We do not use find because it might not be available.
21745 : We do not just use MANIFEST because the user may have dropped
21746 : some additional extensions into the source tree and expect them
21747 : to be built.
21748
21749 : Function to recursively find available extensions, ignoring DynaLoader
21750 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21751 : In 5.10.1 and later, extensions are stored in directories
21752 : like File-Glob instead of the older File/Glob/.
21753 find_extensions='
21754     for xxx in *; do
21755         case "$xxx" in
21756             DynaLoader|dynaload) ;;
21757             *)
21758             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21759             leaf=`echo $xxx | $sed -e s/.*-//`;
21760             if $test -d File; then
21761                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21762                     known_extensions="$known_extensions $1$this_ext";
21763                 elif $test -f $xxx/Makefile.PL; then
21764                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21765                 else
21766                     if $test -d $xxx -a $# -lt 10; then
21767                         set $1$xxx/ $*;
21768                         cd "$xxx";
21769                         eval $find_extensions;
21770                         cd ..;
21771                         shift;
21772                     fi;
21773                 fi;
21774             else
21775                 $ls -1 $xxx > $$.tmp;
21776                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21777                     known_extensions="$known_extensions $this_ext";
21778                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21779                     known_extensions="$known_extensions $this_ext";
21780                 elif $test -d $xxx; then
21781                     nonxs_extensions="$nonxs_extensions $this_ext";
21782                 fi;
21783                 $rm -f $$.tmp;
21784             fi
21785             ;;
21786         esac;
21787     done'
21788 tdir=`pwd`
21789 cd "$rsrc/cpan"
21790 set X
21791 shift
21792 eval $find_extensions
21793 cd "$rsrc/dist"
21794 set X
21795 shift
21796 eval $find_extensions
21797 cd "$rsrc/ext"
21798 set X
21799 shift
21800 eval $find_extensions
21801 if $test -d File-Glob; then
21802     : All ext/ flattened
21803 else
21804     # Special case:  Add in modules that nest beyond the first level.
21805     # Currently threads/shared and Hash/Util/FieldHash, since they are
21806     # not picked up by the recursive find above (and adding in general
21807     # recursive finding breaks SDBM_File/sdbm).
21808     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21809     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21810 fi
21811 set X $known_extensions
21812 shift
21813 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21814 set X $nonxs_extensions
21815 shift
21816 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21817 cd "$tdir"
21818
21819 : Now see which are supported on this system.
21820 avail_ext=''
21821 for xxx in $known_extensions ; do
21822         case "$xxx" in
21823         DB_File|db_file)
21824                 case "$i_db" in
21825                 $define) avail_ext="$avail_ext $xxx" ;;
21826                 esac
21827                 ;;
21828         GDBM_File|gdbm_fil)
21829                 case "$i_gdbm" in
21830                 $define) avail_ext="$avail_ext $xxx" ;;
21831                 esac
21832                 ;;
21833         I18N/Langinfo|i18n_lan)
21834                 case "$i_langinfo$d_nl_langinfo" in
21835                 $define$define) avail_ext="$avail_ext $xxx" ;;
21836                 esac
21837                 ;;
21838         IPC/SysV|ipc/sysv)
21839                 : XXX Do we need a useipcsysv variable here
21840                 case "${d_msg}${d_sem}${d_shm}" in
21841                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21842                 esac
21843                 ;;
21844         NDBM_File|ndbm_fil)
21845                 case "$d_ndbm" in
21846                 $define)
21847                     case "$osname-$use64bitint" in
21848                     hpux-define)
21849                         case "$libs" in
21850                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21851                         esac
21852                         ;;
21853                     *) avail_ext="$avail_ext $xxx" ;;
21854                     esac
21855                     ;;
21856                 esac
21857                 ;;
21858         ODBM_File|odbm_fil)
21859                 case "${i_dbm}${i_rpcsvcdbm}" in
21860                 *"${define}"*)
21861                     case "$d_cplusplus" in
21862                     define) ;; # delete as a function name will not work
21863                     *)  case "$osname-$use64bitint" in
21864                         hpux-define)
21865                             case "$libs" in
21866                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21867                             esac
21868                             ;;
21869                         *) avail_ext="$avail_ext $xxx" ;;
21870                         esac
21871                         ;;
21872                     esac
21873                     ;;
21874                 esac
21875                 ;;
21876         Opcode|opcode)
21877                 case "$useopcode" in
21878                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21879                 esac
21880                 ;;
21881         POSIX|posix)
21882                 case "$useposix" in
21883                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21884                 esac
21885                 ;;
21886         Socket|socket)
21887                 case "$d_socket" in
21888                 true|$define|y)
21889                     case "$osname" in
21890                     beos) ;; # not unless BONE
21891                     *) avail_ext="$avail_ext $xxx" ;;
21892                     esac
21893                     ;;
21894                 esac
21895                 ;;
21896         Sys/Syslog|sys/syslog)
21897                 : XXX syslog requires socket
21898                 case "$d_socket" in
21899                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21900                 esac
21901                 ;;
21902         Thread|thread)
21903                 case "$usethreads" in
21904                 true|$define|y)
21905                         case "$use5005threads" in
21906                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21907                         esac
21908                 esac
21909                 ;;
21910         threads|threads/shared)
21911                 # threads and threads::shared are special cases.
21912                 # To stop people from asking "Perl 5.8.0 was supposed
21913                 # to have this new fancy threads implementation but my
21914                 # perl doesn't have it" and from people trying to
21915                 # (re)install the threads module using CPAN.pm and
21916                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21917                 # the threads.pm and threads/shared.pm will always be
21918                 # there, croaking informatively ("you need to rebuild
21919                 # all of Perl with threads, sorry") when threads haven't
21920                 # been compiled in.
21921                 # --jhi
21922                 avail_ext="$avail_ext $xxx"
21923                 ;;
21924         VMS*)
21925                 ;;
21926         Win32*)
21927                 case "$osname" in
21928                 cygwin) avail_ext="$avail_ext $xxx" ;;
21929                 esac
21930                 ;;
21931         XS/APItest|xs/apitest)
21932                 # This is just for testing.  Skip it unless we have dynamic loading.
21933
21934                 case "$usedl" in
21935                 $define) avail_ext="$avail_ext $xxx" ;;
21936                 esac
21937                 ;;
21938         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
21939                 # This is just for testing.  Skip it unless we have dynamic loading.
21940
21941                 case "$usedl" in
21942                 $define) avail_ext="$avail_ext $xxx" ;;
21943                 esac
21944                 ;;
21945         XS/Typemap|xs/typemap)
21946                 # This is just for testing.  Skip it unless we have dynamic loading.
21947                 case "$usedl" in
21948                 $define) avail_ext="$avail_ext $xxx" ;;
21949                 esac
21950                 ;;
21951         *)      avail_ext="$avail_ext $xxx"
21952                 ;;
21953         esac
21954 done
21955
21956 set X $avail_ext
21957 shift
21958 avail_ext="$*"
21959
21960 case "$onlyextensions" in
21961 '') ;;
21962 *)  keepextensions=''
21963     echo "You have requested that only certains extensions be included..." >&4
21964     for i in $onlyextensions; do
21965         case " $avail_ext " in
21966         *" $i "*)
21967             echo "Keeping extension $i."
21968             keepextensions="$keepextensions $i"
21969             ;;
21970         *) echo "Ignoring extension $i." ;;
21971         esac
21972     done
21973     avail_ext="$keepextensions"
21974     ;;
21975 esac
21976
21977 case "$noextensions" in
21978 '') ;;
21979 *)  keepextensions=''
21980     echo "You have requested that certain extensions be ignored..." >&4
21981     for i in $avail_ext; do
21982         case " $noextensions " in
21983         *" $i "*) echo "Ignoring extension $i." ;;
21984         *) echo "Keeping extension $i.";
21985            keepextensions="$keepextensions $i"
21986            ;;
21987         esac
21988     done
21989     avail_ext="$keepextensions"
21990     ;;
21991 esac
21992
21993 : Now see which nonxs extensions are supported on this system.
21994 : For now assume all are.
21995 nonxs_ext=''
21996 for xxx in $nonxs_extensions ; do
21997         case "$xxx" in
21998         *)      nonxs_ext="$nonxs_ext $xxx"
21999                 ;;
22000         esac
22001 done
22002
22003 set X $nonxs_ext
22004 shift
22005 nonxs_ext="$*"
22006
22007 case $usedl in
22008 $define)
22009         $cat <<EOM
22010 A number of extensions are supplied with $package.  You may choose to
22011 compile these extensions for dynamic loading (the default), compile
22012 them into the $package executable (static loading), or not include
22013 them at all.  Answer "none" to include no extensions.
22014 Note that DynaLoader is always built and need not be mentioned here.
22015
22016 EOM
22017         case "$dynamic_ext" in
22018         '')
22019                 : Exclude those listed in static_ext
22020                 dflt=''
22021                 for xxx in $avail_ext; do
22022                         case " $static_ext " in
22023                         *" $xxx "*) ;;
22024                         *) dflt="$dflt $xxx" ;;
22025                         esac
22026                 done
22027                 set X $dflt
22028                 shift
22029                 dflt="$*"
22030                 ;;
22031         *)      dflt="$dynamic_ext"
22032                 # Perhaps we are reusing an old out-of-date config.sh.
22033                 case "$hint" in
22034                 previous)
22035                         if test X"$dynamic_ext" != X"$avail_ext"; then
22036                                 $cat <<EOM
22037 NOTICE:  Your previous config.sh list may be incorrect.
22038 The extensions now available to you are
22039         ${avail_ext}
22040 but the default list from your previous config.sh is
22041         ${dynamic_ext}
22042
22043 EOM
22044                         fi
22045                         ;;
22046                 esac
22047                 ;;
22048         esac
22049         case "$dflt" in
22050         '')     dflt=none;;
22051         esac
22052         rp="What extensions do you wish to load dynamically?"
22053         . ./myread
22054         case "$ans" in
22055         none) dynamic_ext=' ' ;;
22056         *) dynamic_ext="$ans" ;;
22057         esac
22058
22059         case "$static_ext" in
22060         '')
22061                 : Exclude those already listed in dynamic linking
22062                 dflt=''
22063                 for xxx in $avail_ext; do
22064                         case " $dynamic_ext " in
22065                         *" $xxx "*) ;;
22066                         *) dflt="$dflt $xxx" ;;
22067                         esac
22068                 done
22069                 set X $dflt
22070                 shift
22071                 dflt="$*"
22072                 ;;
22073         *)  dflt="$static_ext"
22074                 ;;
22075         esac
22076
22077         case "$dflt" in
22078         '')     dflt=none;;
22079         esac
22080         rp="What extensions do you wish to load statically?"
22081         . ./myread
22082         case "$ans" in
22083         none) static_ext=' ' ;;
22084         *) static_ext="$ans" ;;
22085         esac
22086         ;;
22087 *)
22088         $cat <<EOM
22089 A number of extensions are supplied with $package.  Answer "none"
22090 to include no extensions.
22091 Note that DynaLoader is always built and need not be mentioned here.
22092
22093 EOM
22094         case "$static_ext" in
22095         '') dflt="$avail_ext" ;;
22096         *)      dflt="$static_ext"
22097                 # Perhaps we are reusing an old out-of-date config.sh.
22098                 case "$hint" in
22099                 previous)
22100                         if test X"$static_ext" != X"$avail_ext"; then
22101                                 $cat <<EOM
22102 NOTICE:  Your previous config.sh list may be incorrect.
22103 The extensions now available to you are
22104         ${avail_ext}
22105 but the default list from your previous config.sh is
22106         ${static_ext}
22107
22108 EOM
22109                         fi
22110                         ;;
22111                 esac
22112                 ;;
22113         esac
22114         : Exclude those that are not xs extensions
22115         case "$dflt" in
22116         '')     dflt=none;;
22117         esac
22118         rp="What extensions do you wish to include?"
22119         . ./myread
22120         case "$ans" in
22121         none) static_ext=' ' ;;
22122         *) static_ext="$ans" ;;
22123         esac
22124         ;;
22125 esac
22126 #
22127 # Encode is a special case.  If we are building Encode as a static
22128 # extension, we need to explicitly list its subextensions as well.
22129 # For other nested extensions, this is handled automatically by
22130 # the appropriate Makefile.PL.
22131 case " $static_ext " in
22132         *" Encode "*) # Add the subextensions of Encode
22133         cd "$rsrc/ext"
22134         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22135                 static_ext="$static_ext Encode/$xxx"
22136         done
22137         cd "$tdir"
22138         ;;
22139 esac
22140
22141 set X $dynamic_ext $static_ext $nonxs_ext
22142 shift
22143 extensions="$*"
22144
22145 # Sanity check:  We require an extension suitable for use with
22146 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22147 # should show up as failures in the test suite, but it's helpful to
22148 # catch them now.) The 'extensions' list is normally sorted
22149 # alphabetically, so we need to accept either
22150 #    DB_File ... Fcntl ... IO  ....
22151 # or something like
22152 #    Fcntl ... NDBM_File ... IO  ....
22153 case " $extensions"  in
22154 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22155 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22156 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22157 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22158    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22159    ;;
22160 esac
22161
22162 : Remove libraries needed only for extensions
22163 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22164 : The exception is SunOS 4.x, which needs them.
22165 case "${osname}X${osvers}" in
22166 sunos*X4*)
22167     perllibs="$libs"
22168     ;;
22169 *) case "$usedl" in
22170     $define|true|[yY]*)
22171             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22172             shift
22173             perllibs="$*"
22174             ;;
22175     *)  perllibs="$libs"
22176             ;;
22177     esac
22178     ;;
22179 esac
22180
22181 : Remove build directory name from cppstdin so it can be used from
22182 : either the present location or the final installed location.
22183 echo " "
22184 : Get out of the UU directory to get correct path name.
22185 cd ..
22186 case "$cppstdin" in
22187 `pwd`/cppstdin)
22188         echo "Stripping down cppstdin path name"
22189         cppstdin=cppstdin
22190         ;;
22191 esac
22192 cd UU
22193
22194 : end of configuration questions
22195 echo " "
22196 echo "End of configuration questions."
22197 echo " "
22198
22199 : back to where it started
22200 if test -d ../UU; then
22201         cd ..
22202 fi
22203
22204 : configuration may be unconditionally patched via a 'config.arch' file
22205 if $test -f config.arch; then
22206         echo "I see a config.arch file, loading it." >&4
22207         . ./config.arch
22208 fi
22209
22210 : configuration may be patched via a 'config.over' file
22211 if $test -f config.over; then
22212         echo " "
22213         dflt=y
22214         rp='I see a config.over file.  Do you wish to load it?'
22215         . UU/myread
22216         case "$ans" in
22217         n*) echo "OK, I'll ignore it.";;
22218         *)      . ./config.over
22219                 echo "Configuration override changes have been loaded."
22220                 ;;
22221         esac
22222 fi
22223
22224 : in case they want portability, strip down executable paths
22225 case "$d_portable" in
22226 "$define")
22227         echo " "
22228         echo "Stripping down executable paths..." >&4
22229         for file in $loclist $trylist; do
22230                 eval temp=\$$file
22231                 eval $file=`basename $temp`
22232         done
22233         ;;
22234 esac
22235
22236 : create config.sh file
22237 echo " "
22238 echo "Creating config.sh..." >&4
22239 $spitshell <<EOT >config.sh
22240 $startsh
22241 #
22242 # This file was produced by running the Configure script. It holds all the
22243 # definitions figured out by Configure. Should you modify one of these values,
22244 # do not forget to propagate your changes by running "Configure -der". You may
22245 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22246 #
22247
22248 # Package name      : $package
22249 # Source directory  : $src
22250 # Configuration time: $cf_time
22251 # Configured by     : $cf_by
22252 # Target system     : $myuname
22253
22254 EOT
22255 : Add in command line options if available
22256 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22257
22258 $spitshell <<EOT >>config.sh
22259
22260 Author='$Author'
22261 Date='$Date'
22262 Header='$Header'
22263 Id='$Id'
22264 Locker='$Locker'
22265 Log='$Log'
22266 RCSfile='$RCSfile'
22267 Revision='$Revision'
22268 Source='$Source'
22269 State='$State'
22270 _a='$_a'
22271 _exe='$_exe'
22272 _o='$_o'
22273 afs='$afs'
22274 afsroot='$afsroot'
22275 alignbytes='$alignbytes'
22276 ansi2knr='$ansi2knr'
22277 aphostname='$aphostname'
22278 api_revision='$api_revision'
22279 api_subversion='$api_subversion'
22280 api_version='$api_version'
22281 api_versionstring='$api_versionstring'
22282 ar='$ar'
22283 archlib='$archlib'
22284 archlibexp='$archlibexp'
22285 archname64='$archname64'
22286 archname='$archname'
22287 archobjs='$archobjs'
22288 asctime_r_proto='$asctime_r_proto'
22289 awk='$awk'
22290 baserev='$baserev'
22291 bash='$bash'
22292 bin='$bin'
22293 bin_ELF='$bin_ELF'
22294 binexp='$binexp'
22295 bison='$bison'
22296 byacc='$byacc'
22297 byteorder='$byteorder'
22298 c='$c'
22299 castflags='$castflags'
22300 cat='$cat'
22301 cc='$cc'
22302 cccdlflags='$cccdlflags'
22303 ccdlflags='$ccdlflags'
22304 ccflags='$ccflags'
22305 ccflags_uselargefiles='$ccflags_uselargefiles'
22306 ccname='$ccname'
22307 ccsymbols='$ccsymbols'
22308 ccversion='$ccversion'
22309 cf_by='$cf_by'
22310 cf_email='$cf_email'
22311 cf_time='$cf_time'
22312 charbits='$charbits'
22313 charsize='$charsize'
22314 chgrp='$chgrp'
22315 chmod='$chmod'
22316 chown='$chown'
22317 clocktype='$clocktype'
22318 comm='$comm'
22319 compress='$compress'
22320 contains='$contains'
22321 cp='$cp'
22322 cpio='$cpio'
22323 cpp='$cpp'
22324 cpp_stuff='$cpp_stuff'
22325 cppccsymbols='$cppccsymbols'
22326 cppflags='$cppflags'
22327 cpplast='$cpplast'
22328 cppminus='$cppminus'
22329 cpprun='$cpprun'
22330 cppstdin='$cppstdin'
22331 cppsymbols='$cppsymbols'
22332 crypt_r_proto='$crypt_r_proto'
22333 cryptlib='$cryptlib'
22334 csh='$csh'
22335 ctermid_r_proto='$ctermid_r_proto'
22336 ctime_r_proto='$ctime_r_proto'
22337 d_Gconvert='$d_Gconvert'
22338 d_PRIEUldbl='$d_PRIEUldbl'
22339 d_PRIFUldbl='$d_PRIFUldbl'
22340 d_PRIGUldbl='$d_PRIGUldbl'
22341 d_PRIXU64='$d_PRIXU64'
22342 d_PRId64='$d_PRId64'
22343 d_PRIeldbl='$d_PRIeldbl'
22344 d_PRIfldbl='$d_PRIfldbl'
22345 d_PRIgldbl='$d_PRIgldbl'
22346 d_PRIi64='$d_PRIi64'
22347 d_PRIo64='$d_PRIo64'
22348 d_PRIu64='$d_PRIu64'
22349 d_PRIx64='$d_PRIx64'
22350 d_SCNfldbl='$d_SCNfldbl'
22351 d__fwalk='$d__fwalk'
22352 d_access='$d_access'
22353 d_accessx='$d_accessx'
22354 d_aintl='$d_aintl'
22355 d_alarm='$d_alarm'
22356 d_archlib='$d_archlib'
22357 d_asctime64='$d_asctime64'
22358 d_asctime_r='$d_asctime_r'
22359 d_atolf='$d_atolf'
22360 d_atoll='$d_atoll'
22361 d_attribute_deprecated='$d_attribute_deprecated'
22362 d_attribute_format='$d_attribute_format'
22363 d_attribute_malloc='$d_attribute_malloc'
22364 d_attribute_nonnull='$d_attribute_nonnull'
22365 d_attribute_noreturn='$d_attribute_noreturn'
22366 d_attribute_pure='$d_attribute_pure'
22367 d_attribute_unused='$d_attribute_unused'
22368 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22369 d_bcmp='$d_bcmp'
22370 d_bcopy='$d_bcopy'
22371 d_bsd='$d_bsd'
22372 d_bsdgetpgrp='$d_bsdgetpgrp'
22373 d_bsdsetpgrp='$d_bsdsetpgrp'
22374 d_builtin_choose_expr='$d_builtin_choose_expr'
22375 d_builtin_expect='$d_builtin_expect'
22376 d_bzero='$d_bzero'
22377 d_c99_variadic_macros='$d_c99_variadic_macros'
22378 d_casti32='$d_casti32'
22379 d_castneg='$d_castneg'
22380 d_charvspr='$d_charvspr'
22381 d_chown='$d_chown'
22382 d_chroot='$d_chroot'
22383 d_chsize='$d_chsize'
22384 d_class='$d_class'
22385 d_clearenv='$d_clearenv'
22386 d_closedir='$d_closedir'
22387 d_cmsghdr_s='$d_cmsghdr_s'
22388 d_const='$d_const'
22389 d_copysignl='$d_copysignl'
22390 d_cplusplus='$d_cplusplus'
22391 d_crypt='$d_crypt'
22392 d_crypt_r='$d_crypt_r'
22393 d_csh='$d_csh'
22394 d_ctermid='$d_ctermid'
22395 d_ctermid_r='$d_ctermid_r'
22396 d_ctime64='$d_ctime64'
22397 d_ctime_r='$d_ctime_r'
22398 d_cuserid='$d_cuserid'
22399 d_dbl_dig='$d_dbl_dig'
22400 d_dbminitproto='$d_dbminitproto'
22401 d_difftime64='$d_difftime64'
22402 d_difftime='$d_difftime'
22403 d_dir_dd_fd='$d_dir_dd_fd'
22404 d_dirfd='$d_dirfd'
22405 d_dirnamlen='$d_dirnamlen'
22406 d_dlerror='$d_dlerror'
22407 d_dlopen='$d_dlopen'
22408 d_dlsymun='$d_dlsymun'
22409 d_dosuid='$d_dosuid'
22410 d_drand48_r='$d_drand48_r'
22411 d_drand48proto='$d_drand48proto'
22412 d_dup2='$d_dup2'
22413 d_eaccess='$d_eaccess'
22414 d_endgrent='$d_endgrent'
22415 d_endgrent_r='$d_endgrent_r'
22416 d_endhent='$d_endhent'
22417 d_endhostent_r='$d_endhostent_r'
22418 d_endnent='$d_endnent'
22419 d_endnetent_r='$d_endnetent_r'
22420 d_endpent='$d_endpent'
22421 d_endprotoent_r='$d_endprotoent_r'
22422 d_endpwent='$d_endpwent'
22423 d_endpwent_r='$d_endpwent_r'
22424 d_endsent='$d_endsent'
22425 d_endservent_r='$d_endservent_r'
22426 d_eofnblk='$d_eofnblk'
22427 d_eunice='$d_eunice'
22428 d_faststdio='$d_faststdio'
22429 d_fchdir='$d_fchdir'
22430 d_fchmod='$d_fchmod'
22431 d_fchown='$d_fchown'
22432 d_fcntl='$d_fcntl'
22433 d_fcntl_can_lock='$d_fcntl_can_lock'
22434 d_fd_macros='$d_fd_macros'
22435 d_fd_set='$d_fd_set'
22436 d_fds_bits='$d_fds_bits'
22437 d_fgetpos='$d_fgetpos'
22438 d_finite='$d_finite'
22439 d_finitel='$d_finitel'
22440 d_flexfnam='$d_flexfnam'
22441 d_flock='$d_flock'
22442 d_flockproto='$d_flockproto'
22443 d_fork='$d_fork'
22444 d_fp_class='$d_fp_class'
22445 d_fpathconf='$d_fpathconf'
22446 d_fpclass='$d_fpclass'
22447 d_fpclassify='$d_fpclassify'
22448 d_fpclassl='$d_fpclassl'
22449 d_fpos64_t='$d_fpos64_t'
22450 d_frexpl='$d_frexpl'
22451 d_fs_data_s='$d_fs_data_s'
22452 d_fseeko='$d_fseeko'
22453 d_fsetpos='$d_fsetpos'
22454 d_fstatfs='$d_fstatfs'
22455 d_fstatvfs='$d_fstatvfs'
22456 d_fsync='$d_fsync'
22457 d_ftello='$d_ftello'
22458 d_ftime='$d_ftime'
22459 d_futimes='$d_futimes'
22460 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22461 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22462 d_getaddrinfo='$d_getaddrinfo'
22463 d_getcwd='$d_getcwd'
22464 d_getespwnam='$d_getespwnam'
22465 d_getfsstat='$d_getfsstat'
22466 d_getgrent='$d_getgrent'
22467 d_getgrent_r='$d_getgrent_r'
22468 d_getgrgid_r='$d_getgrgid_r'
22469 d_getgrnam_r='$d_getgrnam_r'
22470 d_getgrps='$d_getgrps'
22471 d_gethbyaddr='$d_gethbyaddr'
22472 d_gethbyname='$d_gethbyname'
22473 d_gethent='$d_gethent'
22474 d_gethname='$d_gethname'
22475 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22476 d_gethostbyname_r='$d_gethostbyname_r'
22477 d_gethostent_r='$d_gethostent_r'
22478 d_gethostprotos='$d_gethostprotos'
22479 d_getitimer='$d_getitimer'
22480 d_getlogin='$d_getlogin'
22481 d_getlogin_r='$d_getlogin_r'
22482 d_getmnt='$d_getmnt'
22483 d_getmntent='$d_getmntent'
22484 d_getnameinfo='$d_getnameinfo'
22485 d_getnbyaddr='$d_getnbyaddr'
22486 d_getnbyname='$d_getnbyname'
22487 d_getnent='$d_getnent'
22488 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22489 d_getnetbyname_r='$d_getnetbyname_r'
22490 d_getnetent_r='$d_getnetent_r'
22491 d_getnetprotos='$d_getnetprotos'
22492 d_getpagsz='$d_getpagsz'
22493 d_getpbyname='$d_getpbyname'
22494 d_getpbynumber='$d_getpbynumber'
22495 d_getpent='$d_getpent'
22496 d_getpgid='$d_getpgid'
22497 d_getpgrp2='$d_getpgrp2'
22498 d_getpgrp='$d_getpgrp'
22499 d_getppid='$d_getppid'
22500 d_getprior='$d_getprior'
22501 d_getprotobyname_r='$d_getprotobyname_r'
22502 d_getprotobynumber_r='$d_getprotobynumber_r'
22503 d_getprotoent_r='$d_getprotoent_r'
22504 d_getprotoprotos='$d_getprotoprotos'
22505 d_getprpwnam='$d_getprpwnam'
22506 d_getpwent='$d_getpwent'
22507 d_getpwent_r='$d_getpwent_r'
22508 d_getpwnam_r='$d_getpwnam_r'
22509 d_getpwuid_r='$d_getpwuid_r'
22510 d_getsbyname='$d_getsbyname'
22511 d_getsbyport='$d_getsbyport'
22512 d_getsent='$d_getsent'
22513 d_getservbyname_r='$d_getservbyname_r'
22514 d_getservbyport_r='$d_getservbyport_r'
22515 d_getservent_r='$d_getservent_r'
22516 d_getservprotos='$d_getservprotos'
22517 d_getspnam='$d_getspnam'
22518 d_getspnam_r='$d_getspnam_r'
22519 d_gettimeod='$d_gettimeod'
22520 d_gmtime64='$d_gmtime64'
22521 d_gmtime_r='$d_gmtime_r'
22522 d_gnulibc='$d_gnulibc'
22523 d_grpasswd='$d_grpasswd'
22524 d_hasmntopt='$d_hasmntopt'
22525 d_htonl='$d_htonl'
22526 d_ilogbl='$d_ilogbl'
22527 d_inc_version_list='$d_inc_version_list'
22528 d_index='$d_index'
22529 d_inetaton='$d_inetaton'
22530 d_inetntop='$d_inetntop'
22531 d_inetpton='$d_inetpton'
22532 d_int64_t='$d_int64_t'
22533 d_isascii='$d_isascii'
22534 d_isfinite='$d_isfinite'
22535 d_isinf='$d_isinf'
22536 d_isnan='$d_isnan'
22537 d_isnanl='$d_isnanl'
22538 d_killpg='$d_killpg'
22539 d_lchown='$d_lchown'
22540 d_ldbl_dig='$d_ldbl_dig'
22541 d_libm_lib_version='$d_libm_lib_version'
22542 d_link='$d_link'
22543 d_localtime64='$d_localtime64'
22544 d_localtime_r='$d_localtime_r'
22545 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22546 d_locconv='$d_locconv'
22547 d_lockf='$d_lockf'
22548 d_longdbl='$d_longdbl'
22549 d_longlong='$d_longlong'
22550 d_lseekproto='$d_lseekproto'
22551 d_lstat='$d_lstat'
22552 d_madvise='$d_madvise'
22553 d_malloc_good_size='$d_malloc_good_size'
22554 d_malloc_size='$d_malloc_size'
22555 d_mblen='$d_mblen'
22556 d_mbstowcs='$d_mbstowcs'
22557 d_mbtowc='$d_mbtowc'
22558 d_memchr='$d_memchr'
22559 d_memcmp='$d_memcmp'
22560 d_memcpy='$d_memcpy'
22561 d_memmove='$d_memmove'
22562 d_memset='$d_memset'
22563 d_mkdir='$d_mkdir'
22564 d_mkdtemp='$d_mkdtemp'
22565 d_mkfifo='$d_mkfifo'
22566 d_mkstemp='$d_mkstemp'
22567 d_mkstemps='$d_mkstemps'
22568 d_mktime64='$d_mktime64'
22569 d_mktime='$d_mktime'
22570 d_mmap='$d_mmap'
22571 d_modfl='$d_modfl'
22572 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22573 d_modflproto='$d_modflproto'
22574 d_mprotect='$d_mprotect'
22575 d_msg='$d_msg'
22576 d_msg_ctrunc='$d_msg_ctrunc'
22577 d_msg_dontroute='$d_msg_dontroute'
22578 d_msg_oob='$d_msg_oob'
22579 d_msg_peek='$d_msg_peek'
22580 d_msg_proxy='$d_msg_proxy'
22581 d_msgctl='$d_msgctl'
22582 d_msgget='$d_msgget'
22583 d_msghdr_s='$d_msghdr_s'
22584 d_msgrcv='$d_msgrcv'
22585 d_msgsnd='$d_msgsnd'
22586 d_msync='$d_msync'
22587 d_munmap='$d_munmap'
22588 d_mymalloc='$d_mymalloc'
22589 d_ndbm='$d_ndbm'
22590 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22591 d_nice='$d_nice'
22592 d_nl_langinfo='$d_nl_langinfo'
22593 d_nv_preserves_uv='$d_nv_preserves_uv'
22594 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22595 d_off64_t='$d_off64_t'
22596 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22597 d_oldpthreads='$d_oldpthreads'
22598 d_oldsock='$d_oldsock'
22599 d_open3='$d_open3'
22600 d_pathconf='$d_pathconf'
22601 d_pause='$d_pause'
22602 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22603 d_phostname='$d_phostname'
22604 d_pipe='$d_pipe'
22605 d_poll='$d_poll'
22606 d_portable='$d_portable'
22607 d_printf_format_null='$d_printf_format_null'
22608 d_procselfexe='$d_procselfexe'
22609 d_pseudofork='$d_pseudofork'
22610 d_pthread_atfork='$d_pthread_atfork'
22611 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22612 d_pthread_yield='$d_pthread_yield'
22613 d_pwage='$d_pwage'
22614 d_pwchange='$d_pwchange'
22615 d_pwclass='$d_pwclass'
22616 d_pwcomment='$d_pwcomment'
22617 d_pwexpire='$d_pwexpire'
22618 d_pwgecos='$d_pwgecos'
22619 d_pwpasswd='$d_pwpasswd'
22620 d_pwquota='$d_pwquota'
22621 d_qgcvt='$d_qgcvt'
22622 d_quad='$d_quad'
22623 d_random_r='$d_random_r'
22624 d_readdir64_r='$d_readdir64_r'
22625 d_readdir='$d_readdir'
22626 d_readdir_r='$d_readdir_r'
22627 d_readlink='$d_readlink'
22628 d_readv='$d_readv'
22629 d_recvmsg='$d_recvmsg'
22630 d_rename='$d_rename'
22631 d_rewinddir='$d_rewinddir'
22632 d_rmdir='$d_rmdir'
22633 d_safebcpy='$d_safebcpy'
22634 d_safemcpy='$d_safemcpy'
22635 d_sanemcmp='$d_sanemcmp'
22636 d_sbrkproto='$d_sbrkproto'
22637 d_scalbnl='$d_scalbnl'
22638 d_sched_yield='$d_sched_yield'
22639 d_scm_rights='$d_scm_rights'
22640 d_seekdir='$d_seekdir'
22641 d_select='$d_select'
22642 d_sem='$d_sem'
22643 d_semctl='$d_semctl'
22644 d_semctl_semid_ds='$d_semctl_semid_ds'
22645 d_semctl_semun='$d_semctl_semun'
22646 d_semget='$d_semget'
22647 d_semop='$d_semop'
22648 d_sendmsg='$d_sendmsg'
22649 d_setegid='$d_setegid'
22650 d_seteuid='$d_seteuid'
22651 d_setgrent='$d_setgrent'
22652 d_setgrent_r='$d_setgrent_r'
22653 d_setgrps='$d_setgrps'
22654 d_sethent='$d_sethent'
22655 d_sethostent_r='$d_sethostent_r'
22656 d_setitimer='$d_setitimer'
22657 d_setlinebuf='$d_setlinebuf'
22658 d_setlocale='$d_setlocale'
22659 d_setlocale_r='$d_setlocale_r'
22660 d_setnent='$d_setnent'
22661 d_setnetent_r='$d_setnetent_r'
22662 d_setpent='$d_setpent'
22663 d_setpgid='$d_setpgid'
22664 d_setpgrp2='$d_setpgrp2'
22665 d_setpgrp='$d_setpgrp'
22666 d_setprior='$d_setprior'
22667 d_setproctitle='$d_setproctitle'
22668 d_setprotoent_r='$d_setprotoent_r'
22669 d_setpwent='$d_setpwent'
22670 d_setpwent_r='$d_setpwent_r'
22671 d_setregid='$d_setregid'
22672 d_setresgid='$d_setresgid'
22673 d_setresuid='$d_setresuid'
22674 d_setreuid='$d_setreuid'
22675 d_setrgid='$d_setrgid'
22676 d_setruid='$d_setruid'
22677 d_setsent='$d_setsent'
22678 d_setservent_r='$d_setservent_r'
22679 d_setsid='$d_setsid'
22680 d_setvbuf='$d_setvbuf'
22681 d_sfio='$d_sfio'
22682 d_shm='$d_shm'
22683 d_shmat='$d_shmat'
22684 d_shmatprototype='$d_shmatprototype'
22685 d_shmctl='$d_shmctl'
22686 d_shmdt='$d_shmdt'
22687 d_shmget='$d_shmget'
22688 d_sigaction='$d_sigaction'
22689 d_signbit='$d_signbit'
22690 d_sigprocmask='$d_sigprocmask'
22691 d_sigsetjmp='$d_sigsetjmp'
22692 d_sitearch='$d_sitearch'
22693 d_snprintf='$d_snprintf'
22694 d_sockatmark='$d_sockatmark'
22695 d_sockatmarkproto='$d_sockatmarkproto'
22696 d_socket='$d_socket'
22697 d_socklen_t='$d_socklen_t'
22698 d_sockpair='$d_sockpair'
22699 d_socks5_init='$d_socks5_init'
22700 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22701 d_sqrtl='$d_sqrtl'
22702 d_srand48_r='$d_srand48_r'
22703 d_srandom_r='$d_srandom_r'
22704 d_sresgproto='$d_sresgproto'
22705 d_sresuproto='$d_sresuproto'
22706 d_statblks='$d_statblks'
22707 d_statfs_f_flags='$d_statfs_f_flags'
22708 d_statfs_s='$d_statfs_s'
22709 d_statvfs='$d_statvfs'
22710 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22711 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22712 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22713 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22714 d_stdio_stream_array='$d_stdio_stream_array'
22715 d_stdiobase='$d_stdiobase'
22716 d_stdstdio='$d_stdstdio'
22717 d_strchr='$d_strchr'
22718 d_strcoll='$d_strcoll'
22719 d_strctcpy='$d_strctcpy'
22720 d_strerrm='$d_strerrm'
22721 d_strerror='$d_strerror'
22722 d_strerror_r='$d_strerror_r'
22723 d_strftime='$d_strftime'
22724 d_strlcat='$d_strlcat'
22725 d_strlcpy='$d_strlcpy'
22726 d_strtod='$d_strtod'
22727 d_strtol='$d_strtol'
22728 d_strtold='$d_strtold'
22729 d_strtoll='$d_strtoll'
22730 d_strtoq='$d_strtoq'
22731 d_strtoul='$d_strtoul'
22732 d_strtoull='$d_strtoull'
22733 d_strtouq='$d_strtouq'
22734 d_strxfrm='$d_strxfrm'
22735 d_suidsafe='$d_suidsafe'
22736 d_symlink='$d_symlink'
22737 d_syscall='$d_syscall'
22738 d_syscallproto='$d_syscallproto'
22739 d_sysconf='$d_sysconf'
22740 d_sysernlst='$d_sysernlst'
22741 d_syserrlst='$d_syserrlst'
22742 d_system='$d_system'
22743 d_tcgetpgrp='$d_tcgetpgrp'
22744 d_tcsetpgrp='$d_tcsetpgrp'
22745 d_telldir='$d_telldir'
22746 d_telldirproto='$d_telldirproto'
22747 d_time='$d_time'
22748 d_timegm='$d_timegm'
22749 d_times='$d_times'
22750 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22751 d_tm_tm_zone='$d_tm_tm_zone'
22752 d_tmpnam_r='$d_tmpnam_r'
22753 d_truncate='$d_truncate'
22754 d_ttyname_r='$d_ttyname_r'
22755 d_tzname='$d_tzname'
22756 d_u32align='$d_u32align'
22757 d_ualarm='$d_ualarm'
22758 d_umask='$d_umask'
22759 d_uname='$d_uname'
22760 d_union_semun='$d_union_semun'
22761 d_unordered='$d_unordered'
22762 d_unsetenv='$d_unsetenv'
22763 d_usleep='$d_usleep'
22764 d_usleepproto='$d_usleepproto'
22765 d_ustat='$d_ustat'
22766 d_vendorarch='$d_vendorarch'
22767 d_vendorbin='$d_vendorbin'
22768 d_vendorlib='$d_vendorlib'
22769 d_vendorscript='$d_vendorscript'
22770 d_vfork='$d_vfork'
22771 d_void_closedir='$d_void_closedir'
22772 d_voidsig='$d_voidsig'
22773 d_voidtty='$d_voidtty'
22774 d_volatile='$d_volatile'
22775 d_vprintf='$d_vprintf'
22776 d_vsnprintf='$d_vsnprintf'
22777 d_wait4='$d_wait4'
22778 d_waitpid='$d_waitpid'
22779 d_wcstombs='$d_wcstombs'
22780 d_wctomb='$d_wctomb'
22781 d_writev='$d_writev'
22782 d_xenix='$d_xenix'
22783 date='$date'
22784 db_hashtype='$db_hashtype'
22785 db_prefixtype='$db_prefixtype'
22786 db_version_major='$db_version_major'
22787 db_version_minor='$db_version_minor'
22788 db_version_patch='$db_version_patch'
22789 defvoidused='$defvoidused'
22790 direntrytype='$direntrytype'
22791 dlext='$dlext'
22792 dlsrc='$dlsrc'
22793 doublesize='$doublesize'
22794 drand01='$drand01'
22795 drand48_r_proto='$drand48_r_proto'
22796 dtrace='$dtrace'
22797 dynamic_ext='$dynamic_ext'
22798 eagain='$eagain'
22799 ebcdic='$ebcdic'
22800 echo='$echo'
22801 egrep='$egrep'
22802 emacs='$emacs'
22803 endgrent_r_proto='$endgrent_r_proto'
22804 endhostent_r_proto='$endhostent_r_proto'
22805 endnetent_r_proto='$endnetent_r_proto'
22806 endprotoent_r_proto='$endprotoent_r_proto'
22807 endpwent_r_proto='$endpwent_r_proto'
22808 endservent_r_proto='$endservent_r_proto'
22809 eunicefix='$eunicefix'
22810 exe_ext='$exe_ext'
22811 expr='$expr'
22812 extensions='$extensions'
22813 extern_C='$extern_C'
22814 extras='$extras'
22815 fflushNULL='$fflushNULL'
22816 fflushall='$fflushall'
22817 find='$find'
22818 firstmakefile='$firstmakefile'
22819 flex='$flex'
22820 fpossize='$fpossize'
22821 fpostype='$fpostype'
22822 freetype='$freetype'
22823 from='$from'
22824 full_ar='$full_ar'
22825 full_csh='$full_csh'
22826 full_sed='$full_sed'
22827 gccansipedantic='$gccansipedantic'
22828 gccosandvers='$gccosandvers'
22829 gccversion='$gccversion'
22830 getgrent_r_proto='$getgrent_r_proto'
22831 getgrgid_r_proto='$getgrgid_r_proto'
22832 getgrnam_r_proto='$getgrnam_r_proto'
22833 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22834 gethostbyname_r_proto='$gethostbyname_r_proto'
22835 gethostent_r_proto='$gethostent_r_proto'
22836 getlogin_r_proto='$getlogin_r_proto'
22837 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22838 getnetbyname_r_proto='$getnetbyname_r_proto'
22839 getnetent_r_proto='$getnetent_r_proto'
22840 getprotobyname_r_proto='$getprotobyname_r_proto'
22841 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22842 getprotoent_r_proto='$getprotoent_r_proto'
22843 getpwent_r_proto='$getpwent_r_proto'
22844 getpwnam_r_proto='$getpwnam_r_proto'
22845 getpwuid_r_proto='$getpwuid_r_proto'
22846 getservbyname_r_proto='$getservbyname_r_proto'
22847 getservbyport_r_proto='$getservbyport_r_proto'
22848 getservent_r_proto='$getservent_r_proto'
22849 getspnam_r_proto='$getspnam_r_proto'
22850 gidformat='$gidformat'
22851 gidsign='$gidsign'
22852 gidsize='$gidsize'
22853 gidtype='$gidtype'
22854 glibpth='$glibpth'
22855 gmake='$gmake'
22856 gmtime_r_proto='$gmtime_r_proto'
22857 gnulibc_version='$gnulibc_version'
22858 grep='$grep'
22859 groupcat='$groupcat'
22860 groupstype='$groupstype'
22861 gzip='$gzip'
22862 h_fcntl='$h_fcntl'
22863 h_sysfile='$h_sysfile'
22864 hint='$hint'
22865 hostcat='$hostcat'
22866 html1dir='$html1dir'
22867 html1direxp='$html1direxp'
22868 html3dir='$html3dir'
22869 html3direxp='$html3direxp'
22870 i16size='$i16size'
22871 i16type='$i16type'
22872 i32size='$i32size'
22873 i32type='$i32type'
22874 i64size='$i64size'
22875 i64type='$i64type'
22876 i8size='$i8size'
22877 i8type='$i8type'
22878 i_arpainet='$i_arpainet'
22879 i_assert='$i_assert'
22880 i_bsdioctl='$i_bsdioctl'
22881 i_crypt='$i_crypt'
22882 i_db='$i_db'
22883 i_dbm='$i_dbm'
22884 i_dirent='$i_dirent'
22885 i_dld='$i_dld'
22886 i_dlfcn='$i_dlfcn'
22887 i_fcntl='$i_fcntl'
22888 i_float='$i_float'
22889 i_fp='$i_fp'
22890 i_fp_class='$i_fp_class'
22891 i_gdbm='$i_gdbm'
22892 i_gdbm_ndbm='$i_gdbm_ndbm'
22893 i_gdbmndbm='$i_gdbmndbm'
22894 i_grp='$i_grp'
22895 i_ieeefp='$i_ieeefp'
22896 i_inttypes='$i_inttypes'
22897 i_langinfo='$i_langinfo'
22898 i_libutil='$i_libutil'
22899 i_limits='$i_limits'
22900 i_locale='$i_locale'
22901 i_machcthr='$i_machcthr'
22902 i_malloc='$i_malloc'
22903 i_mallocmalloc='$i_mallocmalloc'
22904 i_math='$i_math'
22905 i_memory='$i_memory'
22906 i_mntent='$i_mntent'
22907 i_ndbm='$i_ndbm'
22908 i_netdb='$i_netdb'
22909 i_neterrno='$i_neterrno'
22910 i_netinettcp='$i_netinettcp'
22911 i_niin='$i_niin'
22912 i_poll='$i_poll'
22913 i_prot='$i_prot'
22914 i_pthread='$i_pthread'
22915 i_pwd='$i_pwd'
22916 i_rpcsvcdbm='$i_rpcsvcdbm'
22917 i_sfio='$i_sfio'
22918 i_sgtty='$i_sgtty'
22919 i_shadow='$i_shadow'
22920 i_socks='$i_socks'
22921 i_stdarg='$i_stdarg'
22922 i_stddef='$i_stddef'
22923 i_stdlib='$i_stdlib'
22924 i_string='$i_string'
22925 i_sunmath='$i_sunmath'
22926 i_sysaccess='$i_sysaccess'
22927 i_sysdir='$i_sysdir'
22928 i_sysfile='$i_sysfile'
22929 i_sysfilio='$i_sysfilio'
22930 i_sysin='$i_sysin'
22931 i_sysioctl='$i_sysioctl'
22932 i_syslog='$i_syslog'
22933 i_sysmman='$i_sysmman'
22934 i_sysmode='$i_sysmode'
22935 i_sysmount='$i_sysmount'
22936 i_sysndir='$i_sysndir'
22937 i_sysparam='$i_sysparam'
22938 i_syspoll='$i_syspoll'
22939 i_sysresrc='$i_sysresrc'
22940 i_syssecrt='$i_syssecrt'
22941 i_sysselct='$i_sysselct'
22942 i_syssockio='$i_syssockio'
22943 i_sysstat='$i_sysstat'
22944 i_sysstatfs='$i_sysstatfs'
22945 i_sysstatvfs='$i_sysstatvfs'
22946 i_systime='$i_systime'
22947 i_systimek='$i_systimek'
22948 i_systimes='$i_systimes'
22949 i_systypes='$i_systypes'
22950 i_sysuio='$i_sysuio'
22951 i_sysun='$i_sysun'
22952 i_sysutsname='$i_sysutsname'
22953 i_sysvfs='$i_sysvfs'
22954 i_syswait='$i_syswait'
22955 i_termio='$i_termio'
22956 i_termios='$i_termios'
22957 i_time='$i_time'
22958 i_unistd='$i_unistd'
22959 i_ustat='$i_ustat'
22960 i_utime='$i_utime'
22961 i_values='$i_values'
22962 i_varargs='$i_varargs'
22963 i_varhdr='$i_varhdr'
22964 i_vfork='$i_vfork'
22965 ignore_versioned_solibs='$ignore_versioned_solibs'
22966 inc_version_list='$inc_version_list'
22967 inc_version_list_init='$inc_version_list_init'
22968 incpath='$incpath'
22969 inews='$inews'
22970 initialinstalllocation='$initialinstalllocation'
22971 installarchlib='$installarchlib'
22972 installbin='$installbin'
22973 installhtml1dir='$installhtml1dir'
22974 installhtml3dir='$installhtml3dir'
22975 installman1dir='$installman1dir'
22976 installman3dir='$installman3dir'
22977 installprefix='$installprefix'
22978 installprefixexp='$installprefixexp'
22979 installprivlib='$installprivlib'
22980 installscript='$installscript'
22981 installsitearch='$installsitearch'
22982 installsitebin='$installsitebin'
22983 installsitehtml1dir='$installsitehtml1dir'
22984 installsitehtml3dir='$installsitehtml3dir'
22985 installsitelib='$installsitelib'
22986 installsiteman1dir='$installsiteman1dir'
22987 installsiteman3dir='$installsiteman3dir'
22988 installsitescript='$installsitescript'
22989 installstyle='$installstyle'
22990 installusrbinperl='$installusrbinperl'
22991 installvendorarch='$installvendorarch'
22992 installvendorbin='$installvendorbin'
22993 installvendorhtml1dir='$installvendorhtml1dir'
22994 installvendorhtml3dir='$installvendorhtml3dir'
22995 installvendorlib='$installvendorlib'
22996 installvendorman1dir='$installvendorman1dir'
22997 installvendorman3dir='$installvendorman3dir'
22998 installvendorscript='$installvendorscript'
22999 intsize='$intsize'
23000 issymlink='$issymlink'
23001 ivdformat='$ivdformat'
23002 ivsize='$ivsize'
23003 ivtype='$ivtype'
23004 known_extensions='$known_extensions'
23005 ksh='$ksh'
23006 ld='$ld'
23007 lddlflags='$lddlflags'
23008 ldflags='$ldflags'
23009 ldflags_uselargefiles='$ldflags_uselargefiles'
23010 ldlibpthname='$ldlibpthname'
23011 less='$less'
23012 lib_ext='$lib_ext'
23013 libc='$libc'
23014 libperl='$libperl'
23015 libpth='$libpth'
23016 libs='$libs'
23017 libsdirs='$libsdirs'
23018 libsfiles='$libsfiles'
23019 libsfound='$libsfound'
23020 libspath='$libspath'
23021 libswanted='$libswanted'
23022 libswanted_uselargefiles='$libswanted_uselargefiles'
23023 line='$line'
23024 lint='$lint'
23025 lkflags='$lkflags'
23026 ln='$ln'
23027 lns='$lns'
23028 localtime_r_proto='$localtime_r_proto'
23029 locincpth='$locincpth'
23030 loclibpth='$loclibpth'
23031 longdblsize='$longdblsize'
23032 longlongsize='$longlongsize'
23033 longsize='$longsize'
23034 lp='$lp'
23035 lpr='$lpr'
23036 ls='$ls'
23037 lseeksize='$lseeksize'
23038 lseektype='$lseektype'
23039 mad='$mad'
23040 madlyh='$madlyh'
23041 madlyobj='$madlyobj'
23042 madlysrc='$madlysrc'
23043 mail='$mail'
23044 mailx='$mailx'
23045 make='$make'
23046 make_set_make='$make_set_make'
23047 mallocobj='$mallocobj'
23048 mallocsrc='$mallocsrc'
23049 malloctype='$malloctype'
23050 man1dir='$man1dir'
23051 man1direxp='$man1direxp'
23052 man1ext='$man1ext'
23053 man3dir='$man3dir'
23054 man3direxp='$man3direxp'
23055 man3ext='$man3ext'
23056 mips_type='$mips_type'
23057 mistrustnm='$mistrustnm'
23058 mkdir='$mkdir'
23059 mmaptype='$mmaptype'
23060 modetype='$modetype'
23061 more='$more'
23062 multiarch='$multiarch'
23063 mv='$mv'
23064 myarchname='$myarchname'
23065 mydomain='$mydomain'
23066 myhostname='$myhostname'
23067 myuname='$myuname'
23068 n='$n'
23069 need_va_copy='$need_va_copy'
23070 netdb_hlen_type='$netdb_hlen_type'
23071 netdb_host_type='$netdb_host_type'
23072 netdb_name_type='$netdb_name_type'
23073 netdb_net_type='$netdb_net_type'
23074 nm='$nm'
23075 nm_opt='$nm_opt'
23076 nm_so_opt='$nm_so_opt'
23077 nonxs_ext='$nonxs_ext'
23078 nroff='$nroff'
23079 nvEUformat='$nvEUformat'
23080 nvFUformat='$nvFUformat'
23081 nvGUformat='$nvGUformat'
23082 nv_overflows_integers_at='$nv_overflows_integers_at'
23083 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23084 nveformat='$nveformat'
23085 nvfformat='$nvfformat'
23086 nvgformat='$nvgformat'
23087 nvsize='$nvsize'
23088 nvtype='$nvtype'
23089 o_nonblock='$o_nonblock'
23090 obj_ext='$obj_ext'
23091 old_pthread_create_joinable='$old_pthread_create_joinable'
23092 optimize='$optimize'
23093 orderlib='$orderlib'
23094 osname='$osname'
23095 osvers='$osvers'
23096 otherlibdirs='$otherlibdirs'
23097 package='$package'
23098 pager='$pager'
23099 passcat='$passcat'
23100 patchlevel='$patchlevel'
23101 path_sep='$path_sep'
23102 perl5='$perl5'
23103 perl='$perl'
23104 perl_patchlevel='$perl_patchlevel'
23105 perladmin='$perladmin'
23106 perllibs='$perllibs'
23107 perlpath='$perlpath'
23108 pg='$pg'
23109 phostname='$phostname'
23110 pidtype='$pidtype'
23111 plibpth='$plibpth'
23112 pmake='$pmake'
23113 pr='$pr'
23114 prefix='$prefix'
23115 prefixexp='$prefixexp'
23116 privlib='$privlib'
23117 privlibexp='$privlibexp'
23118 procselfexe='$procselfexe'
23119 prototype='$prototype'
23120 ptrsize='$ptrsize'
23121 quadkind='$quadkind'
23122 quadtype='$quadtype'
23123 randbits='$randbits'
23124 randfunc='$randfunc'
23125 random_r_proto='$random_r_proto'
23126 randseedtype='$randseedtype'
23127 ranlib='$ranlib'
23128 rd_nodata='$rd_nodata'
23129 readdir64_r_proto='$readdir64_r_proto'
23130 readdir_r_proto='$readdir_r_proto'
23131 revision='$revision'
23132 rm='$rm'
23133 rm_try='$rm_try'
23134 rmail='$rmail'
23135 run='$run'
23136 runnm='$runnm'
23137 sGMTIME_max='$sGMTIME_max'
23138 sGMTIME_min='$sGMTIME_min'
23139 sLOCALTIME_max='$sLOCALTIME_max'
23140 sLOCALTIME_min='$sLOCALTIME_min'
23141 sPRIEUldbl='$sPRIEUldbl'
23142 sPRIFUldbl='$sPRIFUldbl'
23143 sPRIGUldbl='$sPRIGUldbl'
23144 sPRIXU64='$sPRIXU64'
23145 sPRId64='$sPRId64'
23146 sPRIeldbl='$sPRIeldbl'
23147 sPRIfldbl='$sPRIfldbl'
23148 sPRIgldbl='$sPRIgldbl'
23149 sPRIi64='$sPRIi64'
23150 sPRIo64='$sPRIo64'
23151 sPRIu64='$sPRIu64'
23152 sPRIx64='$sPRIx64'
23153 sSCNfldbl='$sSCNfldbl'
23154 sched_yield='$sched_yield'
23155 scriptdir='$scriptdir'
23156 scriptdirexp='$scriptdirexp'
23157 sed='$sed'
23158 seedfunc='$seedfunc'
23159 selectminbits='$selectminbits'
23160 selecttype='$selecttype'
23161 sendmail='$sendmail'
23162 setgrent_r_proto='$setgrent_r_proto'
23163 sethostent_r_proto='$sethostent_r_proto'
23164 setlocale_r_proto='$setlocale_r_proto'
23165 setnetent_r_proto='$setnetent_r_proto'
23166 setprotoent_r_proto='$setprotoent_r_proto'
23167 setpwent_r_proto='$setpwent_r_proto'
23168 setservent_r_proto='$setservent_r_proto'
23169 sh='$sh'
23170 shar='$shar'
23171 sharpbang='$sharpbang'
23172 shmattype='$shmattype'
23173 shortsize='$shortsize'
23174 shrpenv='$shrpenv'
23175 shsharp='$shsharp'
23176 sig_count='$sig_count'
23177 sig_name='$sig_name'
23178 sig_name_init='$sig_name_init'
23179 sig_num='$sig_num'
23180 sig_num_init='$sig_num_init'
23181 sig_size='$sig_size'
23182 signal_t='$signal_t'
23183 sitearch='$sitearch'
23184 sitearchexp='$sitearchexp'
23185 sitebin='$sitebin'
23186 sitebinexp='$sitebinexp'
23187 sitehtml1dir='$sitehtml1dir'
23188 sitehtml1direxp='$sitehtml1direxp'
23189 sitehtml3dir='$sitehtml3dir'
23190 sitehtml3direxp='$sitehtml3direxp'
23191 sitelib='$sitelib'
23192 sitelib_stem='$sitelib_stem'
23193 sitelibexp='$sitelibexp'
23194 siteman1dir='$siteman1dir'
23195 siteman1direxp='$siteman1direxp'
23196 siteman3dir='$siteman3dir'
23197 siteman3direxp='$siteman3direxp'
23198 siteprefix='$siteprefix'
23199 siteprefixexp='$siteprefixexp'
23200 sitescript='$sitescript'
23201 sitescriptexp='$sitescriptexp'
23202 sizesize='$sizesize'
23203 sizetype='$sizetype'
23204 sleep='$sleep'
23205 smail='$smail'
23206 so='$so'
23207 sockethdr='$sockethdr'
23208 socketlib='$socketlib'
23209 socksizetype='$socksizetype'
23210 sort='$sort'
23211 spackage='$spackage'
23212 spitshell='$spitshell'
23213 srand48_r_proto='$srand48_r_proto'
23214 srandom_r_proto='$srandom_r_proto'
23215 src='$src'
23216 ssizetype='$ssizetype'
23217 startperl='$startperl'
23218 startsh='$startsh'
23219 static_ext='$static_ext'
23220 stdchar='$stdchar'
23221 stdio_base='$stdio_base'
23222 stdio_bufsiz='$stdio_bufsiz'
23223 stdio_cnt='$stdio_cnt'
23224 stdio_filbuf='$stdio_filbuf'
23225 stdio_ptr='$stdio_ptr'
23226 stdio_stream_array='$stdio_stream_array'
23227 strerror_r_proto='$strerror_r_proto'
23228 strings='$strings'
23229 submit='$submit'
23230 subversion='$subversion'
23231 sysman='$sysman'
23232 tail='$tail'
23233 tar='$tar'
23234 targetarch='$targetarch'
23235 tbl='$tbl'
23236 tee='$tee'
23237 test='$test'
23238 timeincl='$timeincl'
23239 timetype='$timetype'
23240 tmpnam_r_proto='$tmpnam_r_proto'
23241 to='$to'
23242 touch='$touch'
23243 tr='$tr'
23244 trnl='$trnl'
23245 troff='$troff'
23246 ttyname_r_proto='$ttyname_r_proto'
23247 u16size='$u16size'
23248 u16type='$u16type'
23249 u32size='$u32size'
23250 u32type='$u32type'
23251 u64size='$u64size'
23252 u64type='$u64type'
23253 u8size='$u8size'
23254 u8type='$u8type'
23255 uidformat='$uidformat'
23256 uidsign='$uidsign'
23257 uidsize='$uidsize'
23258 uidtype='$uidtype'
23259 uname='$uname'
23260 uniq='$uniq'
23261 uquadtype='$uquadtype'
23262 use5005threads='$use5005threads'
23263 use64bitall='$use64bitall'
23264 use64bitint='$use64bitint'
23265 usecrosscompile='$usecrosscompile'
23266 usedevel='$usedevel'
23267 usedl='$usedl'
23268 usedtrace='$usedtrace'
23269 usefaststdio='$usefaststdio'
23270 useithreads='$useithreads'
23271 uselargefiles='$uselargefiles'
23272 uselongdouble='$uselongdouble'
23273 usemallocwrap='$usemallocwrap'
23274 usemorebits='$usemorebits'
23275 usemultiplicity='$usemultiplicity'
23276 usemymalloc='$usemymalloc'
23277 usenm='$usenm'
23278 useopcode='$useopcode'
23279 useperlio='$useperlio'
23280 useposix='$useposix'
23281 usereentrant='$usereentrant'
23282 userelocatableinc='$userelocatableinc'
23283 usesfio='$usesfio'
23284 useshrplib='$useshrplib'
23285 usesitecustomize='$usesitecustomize'
23286 usesocks='$usesocks'
23287 usethreads='$usethreads'
23288 usevendorprefix='$usevendorprefix'
23289 usevfork='$usevfork'
23290 usrinc='$usrinc'
23291 uuname='$uuname'
23292 uvXUformat='$uvXUformat'
23293 uvoformat='$uvoformat'
23294 uvsize='$uvsize'
23295 uvtype='$uvtype'
23296 uvuformat='$uvuformat'
23297 uvxformat='$uvxformat'
23298 vaproto='$vaproto'
23299 vendorarch='$vendorarch'
23300 vendorarchexp='$vendorarchexp'
23301 vendorbin='$vendorbin'
23302 vendorbinexp='$vendorbinexp'
23303 vendorhtml1dir='$vendorhtml1dir'
23304 vendorhtml1direxp='$vendorhtml1direxp'
23305 vendorhtml3dir='$vendorhtml3dir'
23306 vendorhtml3direxp='$vendorhtml3direxp'
23307 vendorlib='$vendorlib'
23308 vendorlib_stem='$vendorlib_stem'
23309 vendorlibexp='$vendorlibexp'
23310 vendorman1dir='$vendorman1dir'
23311 vendorman1direxp='$vendorman1direxp'
23312 vendorman3dir='$vendorman3dir'
23313 vendorman3direxp='$vendorman3direxp'
23314 vendorprefix='$vendorprefix'
23315 vendorprefixexp='$vendorprefixexp'
23316 vendorscript='$vendorscript'
23317 vendorscriptexp='$vendorscriptexp'
23318 version='$version'
23319 version_patchlevel_string='$version_patchlevel_string'
23320 versiononly='$versiononly'
23321 vi='$vi'
23322 voidflags='$voidflags'
23323 xlibpth='$xlibpth'
23324 yacc='$yacc'
23325 yaccflags='$yaccflags'
23326 zcat='$zcat'
23327 zip='$zip'
23328 EOT
23329
23330 : add special variables
23331 $test -f $src/patchlevel.h && \
23332 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23333 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23334 echo "PERL_CONFIG_SH=true" >>config.sh
23335
23336 : propagate old symbols
23337 if $test -f UU/config.sh; then
23338         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23339         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23340                 config.sh config.sh UU/oldconfig.sh |\
23341                 $sort | $uniq -u >UU/oldsyms
23342         set X `cat UU/oldsyms`
23343         shift
23344         case $# in
23345         0) ;;
23346         *)
23347                 cat <<EOM
23348 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23349 EOM
23350                 echo ": Variables propagated from previous config.sh file." >>config.sh
23351                 for sym in `cat UU/oldsyms`; do
23352                         echo "    Propagating $hint variable "'$'"$sym..."
23353                         eval 'tmp="$'"${sym}"'"'
23354                         echo "$tmp" | \
23355                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23356                 done
23357                 ;;
23358         esac
23359 fi
23360
23361 : Finish up by extracting the .SH files
23362 case "$alldone" in
23363 exit)
23364         $rm -rf UU
23365         echo "Extraction done."
23366         exit 0
23367         ;;
23368 cont)
23369         ;;
23370 '')
23371         dflt=''
23372         nostick=true
23373         $cat <<EOM
23374
23375 If you'd like to make any changes to the config.sh file before I begin
23376 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23377
23378 EOM
23379         rp="Press return or use a shell escape to edit config.sh:"
23380         . UU/myread
23381         nostick=''
23382         case "$ans" in
23383         '') ;;
23384         *) : in case they cannot read
23385                 sh 1>&4 -c "$ans";;
23386         esac
23387         ;;
23388 esac
23389
23390 : if this fails, just run all the .SH files by hand
23391 . ./config.sh
23392
23393 echo " "
23394 exec 1>&4
23395 pwd=`pwd`
23396 . ./UU/extract
23397 cd "$pwd"
23398
23399 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23400         dflt=y
23401         case "$silent" in
23402         true) ;;
23403         *)
23404                 $cat <<EOM
23405
23406 Now you need to generate make dependencies by running "$make depend".
23407 You might prefer to run it in background: "$make depend > makedepend.out &"
23408 It can take a while, so you might not want to run it right now.
23409
23410 EOM
23411                 ;;
23412         esac
23413         rp="Run $make depend now?"
23414         . UU/myread
23415         case "$ans" in
23416         y*)
23417                 $make depend && echo "Now you must run '$make'."
23418                 ;;
23419         *)
23420                 echo "You must run '$make depend' then '$make'."
23421                 ;;
23422         esac
23423 elif test -f [Mm]akefile; then
23424         echo " "
23425         echo "Now you must run a $make."
23426 else
23427         echo "Configure done."
23428 fi
23429
23430 if $test -f Policy.sh; then
23431     $cat <<EOM
23432
23433 If you compile $package on a different machine or from a different object
23434 directory, copy the Policy.sh file from this object directory to the
23435 new one before you run Configure -- this will help you with most of
23436 the policy defaults.
23437
23438 EOM
23439 fi
23440 if $test -f config.msg; then
23441     echo "Hmm.  I also noted the following information while running:"
23442     echo " "
23443     $cat config.msg >&4
23444     $rm -f config.msg
23445 fi
23446 $rm -f kit*isdone ark*isdone
23447 $rm -rf UU
23448
23449 : End of Configure
23450