This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
bad things happened with for $x (...) { *x = *y }
[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 Thu Aug 12 11:38:08 CEST 2010 [metaconfig 3.5 PL0]
34 # (with additional metaconfig patches by perlbug@perl.org)
35
36 cat >c1$$ <<EOF
37 ARGGGHHHH!!!!!
38
39 SCO csh still thinks true is false.  Write to SCO today and tell them that next
40 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
41
42 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
43 we'd have to do is go in and swap the && and || tokens, wherever they are.)
44
45 [End of diatribe. We now return you to your regularly scheduled programming...]
46 EOF
47 cat >c2$$ <<EOF
48
49 OOPS!  You naughty creature!  You didn't run Configure with sh!
50 I will attempt to remedy the situation by running sh for you...
51 EOF
52
53 true || cat c1$$ c2$$
54 true || exec sh $0 $argv:q
55
56 (exit $?0) || cat c2$$
57 (exit $?0) || exec sh $0 $argv:q
58 rm -f c1$$ c2$$
59
60 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
61         cat <<EOF
62 ***
63 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
64 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
65 *** Please read the README.plan9 for further instructions.
66 *** Cannot continue, aborting.
67 ***
68 EOF
69         exit 1
70 fi
71
72 if test ! -c /dev/null ; then
73         cat <<EOF
74 ***
75 *** I'm sorry, but /dev/null appears to be a file rather than a device.
76 *** Please consult your operating sytem's notes for making a device
77 *** in /dev.
78 *** Cannot continue, aborting.
79 ***
80 EOF
81         exit 1
82 fi
83
84 : compute my invocation name
85 me=$0
86 case "$0" in
87 */*)
88         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
89         test "$me" || me=$0
90         ;;
91 esac
92
93 : Proper separator for the PATH environment variable
94 p_=:
95 : On OS/2 this directory should exist if this is not floppy only system ":-]"
96 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
97         if test -n "$OS2_SHELL"; then
98                 p_=\;
99                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
100                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
101                 is_os2=yes
102         elif test -n "$DJGPP"; then
103                 case "X${MACHTYPE:-nonesuchmach}" in
104                 *cygwin) ;;
105                 *) p_=\; ;;
106                 esac
107         fi
108 fi
109
110 : Proper PATH setting
111 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
112 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
113 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
114 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
115 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
116 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
117 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
118 paths="$paths /sbin /usr/sbin /usr/libexec"
119 paths="$paths /system/gnu_library/bin"
120
121 for p in $paths
122 do
123         case "$p_$PATH$p_" in
124         *$p_$p$p_*) ;;
125         *) test -d $p && PATH=$PATH$p_$p ;;
126         esac
127 done
128
129 PATH=.$p_$PATH
130 export PATH
131
132 : shall we be using ksh?
133 inksh=''
134 needksh=''
135 avoidksh=''
136 newsh=/bin/ksh
137 changesh=''
138 if (PATH=.; alias -x) >/dev/null 2>&1; then
139                 inksh=true
140 fi
141 if test -f /hp-ux -a -f /bin/ksh; then
142         needksh='to avoid sh bug in "here document" expansion'
143 fi
144 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
145         if test X`/usr/bin/uname -v` = X4; then
146                 avoidksh="to avoid AIX 4's /bin/sh"
147                 newsh=/usr/bin/bsh
148         fi
149 fi
150 if test -f /osf_boot -a -f /usr/sbin/setld; then
151         if test X`/usr/bin/uname -s` = XOSF1; then
152                 avoidksh="to avoid Digital UNIX' ksh"
153                 newsh=/bin/sh
154                 unset BIN_SH
155         fi
156 fi
157 case "$inksh/$needksh" in
158 /[a-z]*)
159                 ENV=''
160                 changesh=true
161                 reason="$needksh"
162         ;;
163 esac
164 case "$inksh/$avoidksh" in
165 true/[a-z]*)
166         changesh=true
167         reason="$avoidksh"
168         ;;
169 esac
170 case "$inksh/$needksh-$avoidksh-" in
171 true/--)
172                 cat <<EOM
173 (I see you are using the Korn shell.  Some ksh's blow up on $me,
174 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
175 EOM
176         ;;
177 esac
178 case "$changesh" in
179 true)
180         export newsh
181         echo "(Feeding myself to $newsh $reason.)"
182         case "$0" in
183         Configure|*/Configure) exec $newsh $0 "$@";;
184         *) exec $newsh Configure "$@";;
185         esac
186         ;;
187 esac
188 test -x "${newsh}" || unset newsh
189
190 : if needed, set CDPATH to a harmless value that is not chatty
191 : avoid bash 2.02 problems with empty CDPATH.
192 case "$CDPATH" in
193 '')     ;;
194 *)      case "$SHELL" in
195         *bash*) CDPATH='.' ;;
196         *) CDPATH='' ;;
197         esac
198         ;;
199 esac
200
201 : Configure runs within the UU subdirectory
202 test -d UU || mkdir UU
203 cd UU && rm -f ./*
204
205 ccname=''
206 ccversion=''
207 ccsymbols=''
208 cppccsymbols=''
209 cppsymbols=''
210 from=''
211 run=''
212 targetarch=''
213 to=''
214 usecrosscompile=''
215 extern_C=''
216 mistrustnm=''
217 usedevel=''
218 perllibs=''
219 dynamic_ext=''
220 extensions=''
221 known_extensions=''
222 nonxs_ext=''
223 static_ext=''
224 useopcode=''
225 useposix=''
226 extras=''
227 d_bsd=''
228 d_eunice=''
229 d_xenix=''
230 eunicefix=''
231 ar=''
232 awk=''
233 bash=''
234 bison=''
235 byacc=''
236 cat=''
237 chgrp=''
238 chmod=''
239 chown=''
240 comm=''
241 compress=''
242 cp=''
243 cpio=''
244 cpp=''
245 csh=''
246 date=''
247 echo=''
248 egrep=''
249 emacs=''
250 expr=''
251 find=''
252 flex=''
253 gmake=''
254 grep=''
255 gzip=''
256 inews=''
257 ksh=''
258 less=''
259 line=''
260 lint=''
261 ln=''
262 lp=''
263 lpr=''
264 ls=''
265 mail=''
266 mailx=''
267 make=''
268 mkdir=''
269 more=''
270 mv=''
271 nm=''
272 nroff=''
273 perl=''
274 pg=''
275 pmake=''
276 pr=''
277 rm=''
278 rmail=''
279 sed=''
280 sendmail=''
281 shar=''
282 sleep=''
283 smail=''
284 sort=''
285 submit=''
286 tail=''
287 tar=''
288 tbl=''
289 tee=''
290 test=''
291 touch=''
292 tr=''
293 troff=''
294 uname=''
295 uniq=''
296 uuname=''
297 vi=''
298 zcat=''
299 zip=''
300 full_ar=''
301 full_sed=''
302 libswanted=''
303 hint=''
304 myuname=''
305 osname=''
306 osvers=''
307 Author=''
308 Date=''
309 Header=''
310 Id=''
311 Locker=''
312 Log=''
313 RCSfile=''
314 Revision=''
315 Source=''
316 State=''
317 _a=''
318 _exe=''
319 _o=''
320 archobjs=''
321 exe_ext=''
322 firstmakefile=''
323 lib_ext=''
324 obj_ext=''
325 path_sep=''
326 rm_try=''
327 afs=''
328 afsroot=''
329 alignbytes=''
330 ansi2knr=''
331 archlib=''
332 archlibexp=''
333 d_archlib=''
334 installarchlib=''
335 archname=''
336 myarchname=''
337 d_atolf=''
338 d_atoll=''
339 baserev=''
340 bin=''
341 binexp=''
342 initialinstalllocation=''
343 installbin=''
344 userelocatableinc=''
345 byteorder=''
346 cc=''
347 ccflags=''
348 cppflags=''
349 ldflags=''
350 lkflags=''
351 locincpth=''
352 optimize=''
353 cf_email=''
354 cf_by=''
355 cf_time=''
356 charbits=''
357 charsize=''
358 contains=''
359 cpp_stuff=''
360 cpplast=''
361 cppminus=''
362 cpprun=''
363 cppstdin=''
364 d__fwalk=''
365 d_access=''
366 d_accessx=''
367 d_aintl=''
368 d_alarm=''
369 asctime_r_proto=''
370 d_asctime_r=''
371 d_attribute_deprecated=''
372 d_attribute_format=''
373 d_attribute_malloc=''
374 d_attribute_nonnull=''
375 d_attribute_noreturn=''
376 d_attribute_pure=''
377 d_attribute_unused=''
378 d_attribute_warn_unused_result=''
379 d_printf_format_null=''
380 d_bcmp=''
381 d_bcopy=''
382 d_builtin_choose_expr=''
383 d_builtin_expect=''
384 d_bzero=''
385 d_c99_variadic_macros=''
386 d_casti32=''
387 castflags=''
388 d_castneg=''
389 d_chown=''
390 d_chroot=''
391 d_chsize=''
392 d_class=''
393 d_clearenv=''
394 d_closedir=''
395 d_void_closedir=''
396 d_cmsghdr_s=''
397 d_const=''
398 d_copysignl=''
399 d_cplusplus=''
400 cryptlib=''
401 d_crypt=''
402 crypt_r_proto=''
403 d_crypt_r=''
404 d_csh=''
405 full_csh=''
406 d_ctermid=''
407 ctermid_r_proto=''
408 d_ctermid_r=''
409 ctime_r_proto=''
410 d_ctime_r=''
411 d_cuserid=''
412 d_dbl_dig=''
413 d_dbminitproto=''
414 d_difftime=''
415 d_dir_dd_fd=''
416 d_dirfd=''
417 d_dlerror=''
418 d_dlopen=''
419 d_dlsymun=''
420 d_dosuid=''
421 d_suidsafe=''
422 d_drand48_r=''
423 drand48_r_proto=''
424 d_drand48proto=''
425 d_dup2=''
426 d_eaccess=''
427 d_endgrent=''
428 d_endgrent_r=''
429 endgrent_r_proto=''
430 d_endhent=''
431 d_endhostent_r=''
432 endhostent_r_proto=''
433 d_endnent=''
434 d_endnetent_r=''
435 endnetent_r_proto=''
436 d_endpent=''
437 d_endprotoent_r=''
438 endprotoent_r_proto=''
439 d_endpwent=''
440 d_endpwent_r=''
441 endpwent_r_proto=''
442 d_endsent=''
443 d_endservent_r=''
444 endservent_r_proto=''
445 d_faststdio=''
446 d_fchdir=''
447 d_fchmod=''
448 d_fchown=''
449 d_fcntl=''
450 d_fcntl_can_lock=''
451 d_fd_macros=''
452 d_fd_set=''
453 d_fds_bits=''
454 d_fgetpos=''
455 d_finite=''
456 d_finitel=''
457 d_flexfnam=''
458 d_flock=''
459 d_flockproto=''
460 d_fork=''
461 d_fp_class=''
462 d_fpclass=''
463 d_fpclassify=''
464 d_fpclassl=''
465 d_fpos64_t=''
466 d_frexpl=''
467 d_fs_data_s=''
468 d_fseeko=''
469 d_fsetpos=''
470 d_fstatfs=''
471 d_fsync=''
472 d_ftello=''
473 d_ftime=''
474 d_gettimeod=''
475 d_futimes=''
476 d_Gconvert=''
477 d_getaddrinfo=''
478 d_getcwd=''
479 d_getespwnam=''
480 d_getfsstat=''
481 d_getgrent=''
482 d_getgrent_r=''
483 getgrent_r_proto=''
484 d_getgrgid_r=''
485 getgrgid_r_proto=''
486 d_getgrnam_r=''
487 getgrnam_r_proto=''
488 d_getgrps=''
489 d_gethbyaddr=''
490 d_gethbyname=''
491 d_gethent=''
492 aphostname=''
493 d_gethname=''
494 d_phostname=''
495 d_uname=''
496 d_gethostbyaddr_r=''
497 gethostbyaddr_r_proto=''
498 d_gethostbyname_r=''
499 gethostbyname_r_proto=''
500 d_gethostent_r=''
501 gethostent_r_proto=''
502 d_gethostprotos=''
503 d_getitimer=''
504 d_getlogin=''
505 d_getlogin_r=''
506 getlogin_r_proto=''
507 d_getmnt=''
508 d_getmntent=''
509 d_getnameinfo=''
510 d_getnbyaddr=''
511 d_getnbyname=''
512 d_getnent=''
513 d_getnetbyaddr_r=''
514 getnetbyaddr_r_proto=''
515 d_getnetbyname_r=''
516 getnetbyname_r_proto=''
517 d_getnetent_r=''
518 getnetent_r_proto=''
519 d_getnetprotos=''
520 d_getpagsz=''
521 d_getpent=''
522 d_getpgid=''
523 d_getpgrp2=''
524 d_bsdgetpgrp=''
525 d_getpgrp=''
526 d_getppid=''
527 d_getprior=''
528 d_getpbyname=''
529 d_getpbynumber=''
530 d_getprotobyname_r=''
531 getprotobyname_r_proto=''
532 d_getprotobynumber_r=''
533 getprotobynumber_r_proto=''
534 d_getprotoent_r=''
535 getprotoent_r_proto=''
536 d_getprotoprotos=''
537 d_getprpwnam=''
538 d_getpwent=''
539 d_getpwent_r=''
540 getpwent_r_proto=''
541 d_getpwnam_r=''
542 getpwnam_r_proto=''
543 d_getpwuid_r=''
544 getpwuid_r_proto=''
545 d_getsent=''
546 d_getservbyname_r=''
547 getservbyname_r_proto=''
548 d_getservbyport_r=''
549 getservbyport_r_proto=''
550 d_getservent_r=''
551 getservent_r_proto=''
552 d_getservprotos=''
553 d_getspnam=''
554 d_getspnam_r=''
555 getspnam_r_proto=''
556 d_getsbyname=''
557 d_getsbyport=''
558 d_gmtime_r=''
559 gmtime_r_proto=''
560 d_gnulibc=''
561 gnulibc_version=''
562 d_hasmntopt=''
563 d_htonl=''
564 d_ilogbl=''
565 d_inetaton=''
566 d_inetntop=''
567 d_inetpton=''
568 d_int64_t=''
569 d_isascii=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_socket=''
735 d_sockpair=''
736 sockethdr=''
737 socketlib=''
738 d_socklen_t=''
739 d_socks5_init=''
740 d_sprintf_returns_strlen=''
741 d_sqrtl=''
742 d_srand48_r=''
743 srand48_r_proto=''
744 d_srandom_r=''
745 srandom_r_proto=''
746 d_sresgproto=''
747 d_sresuproto=''
748 d_statblks=''
749 d_statfs_f_flags=''
750 d_statfs_s=''
751 d_static_inline=''
752 perl_static_inline=''
753 d_fstatvfs=''
754 d_statvfs=''
755 d_stdio_cnt_lval=''
756 d_stdio_ptr_lval=''
757 d_stdio_ptr_lval_nochange_cnt=''
758 d_stdio_ptr_lval_sets_cnt=''
759 d_stdiobase=''
760 d_stdstdio=''
761 stdio_base=''
762 stdio_bufsiz=''
763 stdio_cnt=''
764 stdio_filbuf=''
765 stdio_ptr=''
766 d_index=''
767 d_strchr=''
768 d_strcoll=''
769 d_strctcpy=''
770 d_strerrm=''
771 d_strerror=''
772 d_sysernlst=''
773 d_syserrlst=''
774 d_strerror_r=''
775 strerror_r_proto=''
776 d_strftime=''
777 d_strlcat=''
778 d_strlcpy=''
779 d_strtod=''
780 d_strtol=''
781 d_strtold=''
782 d_strtoll=''
783 d_strtoq=''
784 d_strtoul=''
785 d_strtoull=''
786 d_strtouq=''
787 d_strxfrm=''
788 d_symlink=''
789 d_syscall=''
790 d_syscallproto=''
791 d_sysconf=''
792 d_system=''
793 d_tcgetpgrp=''
794 d_tcsetpgrp=''
795 d_telldirproto=''
796 d_time=''
797 timetype=''
798 d_asctime64=''
799 d_ctime64=''
800 d_difftime64=''
801 d_gmtime64=''
802 d_localtime64=''
803 d_mktime64=''
804 d_timegm=''
805 clocktype=''
806 d_times=''
807 d_tmpnam_r=''
808 tmpnam_r_proto=''
809 d_truncate=''
810 d_ttyname_r=''
811 ttyname_r_proto=''
812 d_tzname=''
813 d_u32align=''
814 d_ualarm=''
815 d_umask=''
816 d_semctl_semid_ds=''
817 d_semctl_semun=''
818 d_union_semun=''
819 d_unordered=''
820 d_unsetenv=''
821 d_usleep=''
822 d_usleepproto=''
823 d_ustat=''
824 d_pseudofork=''
825 d_vfork=''
826 usevfork=''
827 d_voidsig=''
828 signal_t=''
829 d_volatile=''
830 d_charvspr=''
831 d_vprintf=''
832 d_wait4=''
833 d_waitpid=''
834 d_wcstombs=''
835 d_wctomb=''
836 d_writev=''
837 dlext=''
838 bin_ELF=''
839 cccdlflags=''
840 ccdlflags=''
841 dlsrc=''
842 ld=''
843 lddlflags=''
844 usedl=''
845 doublesize=''
846 ebcdic=''
847 fflushNULL=''
848 fflushall=''
849 fpossize=''
850 fpostype=''
851 gccansipedantic=''
852 gccosandvers=''
853 gccversion=''
854 gidformat=''
855 gidsign=''
856 gidsize=''
857 gidtype=''
858 groupstype=''
859 h_fcntl=''
860 h_sysfile=''
861 html1dir=''
862 html1direxp=''
863 installhtml1dir=''
864 html3dir=''
865 html3direxp=''
866 installhtml3dir=''
867 i_arpainet=''
868 i_assert=''
869 i_crypt=''
870 db_hashtype=''
871 db_prefixtype=''
872 db_version_major=''
873 db_version_minor=''
874 db_version_patch=''
875 i_db=''
876 i_dbm=''
877 i_rpcsvcdbm=''
878 d_dirnamlen=''
879 direntrytype=''
880 i_dirent=''
881 i_dld=''
882 i_dlfcn=''
883 i_fcntl=''
884 i_float=''
885 i_fp=''
886 i_fp_class=''
887 i_gdbm=''
888 d_grpasswd=''
889 i_grp=''
890 i_ieeefp=''
891 i_inttypes=''
892 i_langinfo=''
893 i_libutil=''
894 i_limits=''
895 i_locale=''
896 i_machcthr=''
897 i_malloc=''
898 i_mallocmalloc=''
899 i_math=''
900 i_memory=''
901 i_mntent=''
902 d_gdbm_ndbm_h_uses_prototypes=''
903 d_gdbmndbm_h_uses_prototypes=''
904 d_ndbm=''
905 d_ndbm_h_uses_prototypes=''
906 i_gdbm_ndbm=''
907 i_gdbmndbm=''
908 i_ndbm=''
909 i_netdb=''
910 i_neterrno=''
911 i_netinettcp=''
912 i_niin=''
913 i_sysin=''
914 i_poll=''
915 i_prot=''
916 i_pthread=''
917 d_pwage=''
918 d_pwchange=''
919 d_pwclass=''
920 d_pwcomment=''
921 d_pwexpire=''
922 d_pwgecos=''
923 d_pwpasswd=''
924 d_pwquota=''
925 i_pwd=''
926 i_sfio=''
927 i_shadow=''
928 i_socks=''
929 i_stddef=''
930 i_stdlib=''
931 i_string=''
932 strings=''
933 i_sunmath=''
934 i_sysaccess=''
935 i_sysdir=''
936 i_sysfile=''
937 d_voidtty=''
938 i_bsdioctl=''
939 i_sysfilio=''
940 i_sysioctl=''
941 i_syssockio=''
942 i_syslog=''
943 i_sysmman=''
944 i_sysmode=''
945 i_sysmount=''
946 i_sysndir=''
947 i_sysparam=''
948 i_syspoll=''
949 i_sysresrc=''
950 i_syssecrt=''
951 i_sysselct=''
952 i_sysstat=''
953 i_sysstatfs=''
954 i_sysstatvfs=''
955 i_systimes=''
956 i_systypes=''
957 i_sysuio=''
958 i_sysun=''
959 i_sysutsname=''
960 i_sysvfs=''
961 i_syswait=''
962 i_sgtty=''
963 i_termio=''
964 i_termios=''
965 d_tm_tm_gmtoff=''
966 d_tm_tm_zone=''
967 i_systime=''
968 i_systimek=''
969 i_time=''
970 timeincl=''
971 i_unistd=''
972 i_ustat=''
973 i_utime=''
974 i_values=''
975 i_stdarg=''
976 i_varargs=''
977 i_varhdr=''
978 i_vfork=''
979 d_inc_version_list=''
980 inc_version_list=''
981 inc_version_list_init=''
982 installprefix=''
983 installprefixexp=''
984 installstyle=''
985 installusrbinperl=''
986 intsize=''
987 longsize=''
988 shortsize=''
989 issymlink=''
990 libc=''
991 ldlibpthname=''
992 libperl=''
993 shrpenv=''
994 useshrplib=''
995 glibpth=''
996 libpth=''
997 loclibpth=''
998 plibpth=''
999 xlibpth=''
1000 ignore_versioned_solibs=''
1001 libs=''
1002 libsdirs=''
1003 libsfiles=''
1004 libsfound=''
1005 libspath=''
1006 lns=''
1007 d_PRIEUldbl=''
1008 d_PRIFUldbl=''
1009 d_PRIGUldbl=''
1010 d_PRIeldbl=''
1011 d_PRIfldbl=''
1012 d_PRIgldbl=''
1013 d_SCNfldbl=''
1014 sPRIEUldbl=''
1015 sPRIFUldbl=''
1016 sPRIGUldbl=''
1017 sPRIeldbl=''
1018 sPRIfldbl=''
1019 sPRIgldbl=''
1020 sSCNfldbl=''
1021 lseeksize=''
1022 lseektype=''
1023 mad=''
1024 madlyh=''
1025 madlyobj=''
1026 madlysrc=''
1027 make_set_make=''
1028 d_mymalloc=''
1029 freetype=''
1030 mallocobj=''
1031 mallocsrc=''
1032 malloctype=''
1033 usemallocwrap=''
1034 usemymalloc=''
1035 installman1dir=''
1036 man1dir=''
1037 man1direxp=''
1038 man1ext=''
1039 installman3dir=''
1040 man3dir=''
1041 man3direxp=''
1042 man3ext=''
1043 modetype=''
1044 multiarch=''
1045 mydomain=''
1046 myhostname=''
1047 phostname=''
1048 c=''
1049 n=''
1050 d_eofnblk=''
1051 eagain=''
1052 o_nonblock=''
1053 rd_nodata=''
1054 need_va_copy=''
1055 netdb_hlen_type=''
1056 netdb_host_type=''
1057 netdb_name_type=''
1058 netdb_net_type=''
1059 groupcat=''
1060 hostcat=''
1061 passcat=''
1062 orderlib=''
1063 ranlib=''
1064 d_perl_otherlibdirs=''
1065 otherlibdirs=''
1066 package=''
1067 spackage=''
1068 pager=''
1069 api_revision=''
1070 api_subversion=''
1071 api_version=''
1072 api_versionstring=''
1073 patchlevel=''
1074 perl_patchlevel=''
1075 revision=''
1076 subversion=''
1077 version=''
1078 version_patchlevel_string=''
1079 perl5=''
1080 perladmin=''
1081 perlpath=''
1082 d_nv_preserves_uv=''
1083 d_nv_zero_is_allbits_zero=''
1084 i16size=''
1085 i16type=''
1086 i32size=''
1087 i32type=''
1088 i64size=''
1089 i64type=''
1090 i8size=''
1091 i8type=''
1092 ivsize=''
1093 ivtype=''
1094 nv_overflows_integers_at=''
1095 nv_preserves_uv_bits=''
1096 nvsize=''
1097 nvtype=''
1098 u16size=''
1099 u16type=''
1100 u32size=''
1101 u32type=''
1102 u64size=''
1103 u64type=''
1104 u8size=''
1105 u8type=''
1106 uvsize=''
1107 uvtype=''
1108 ivdformat=''
1109 nvEUformat=''
1110 nvFUformat=''
1111 nvGUformat=''
1112 nveformat=''
1113 nvfformat=''
1114 nvgformat=''
1115 uvXUformat=''
1116 uvoformat=''
1117 uvuformat=''
1118 uvxformat=''
1119 pidtype=''
1120 prefix=''
1121 prefixexp=''
1122 installprivlib=''
1123 privlib=''
1124 privlibexp=''
1125 prototype=''
1126 ptrsize=''
1127 d_PRIXU64=''
1128 d_PRId64=''
1129 d_PRIi64=''
1130 d_PRIo64=''
1131 d_PRIu64=''
1132 d_PRIx64=''
1133 sPRIXU64=''
1134 sPRId64=''
1135 sPRIi64=''
1136 sPRIo64=''
1137 sPRIu64=''
1138 sPRIx64=''
1139 d_quad=''
1140 quadkind=''
1141 quadtype=''
1142 uquadtype=''
1143 drand01=''
1144 randbits=''
1145 randfunc=''
1146 randseedtype=''
1147 seedfunc=''
1148 installscript=''
1149 scriptdir=''
1150 scriptdirexp=''
1151 selectminbits=''
1152 selecttype=''
1153 sh=''
1154 sig_count=''
1155 sig_name=''
1156 sig_name_init=''
1157 sig_num=''
1158 sig_num_init=''
1159 sig_size=''
1160 d_sitearch=''
1161 installsitearch=''
1162 sitearch=''
1163 sitearchexp=''
1164 installsitebin=''
1165 sitebin=''
1166 sitebinexp=''
1167 installsitehtml1dir=''
1168 sitehtml1dir=''
1169 sitehtml1direxp=''
1170 installsitehtml3dir=''
1171 sitehtml3dir=''
1172 sitehtml3direxp=''
1173 installsitelib=''
1174 sitelib=''
1175 sitelib_stem=''
1176 sitelibexp=''
1177 installsiteman1dir=''
1178 siteman1dir=''
1179 siteman1direxp=''
1180 installsiteman3dir=''
1181 siteman3dir=''
1182 siteman3direxp=''
1183 siteprefix=''
1184 siteprefixexp=''
1185 installsitescript=''
1186 sitescript=''
1187 sitescriptexp=''
1188 sizesize=''
1189 sizetype=''
1190 so=''
1191 socksizetype=''
1192 sharpbang=''
1193 shsharp=''
1194 spitshell=''
1195 src=''
1196 ssizetype=''
1197 startperl=''
1198 startsh=''
1199 stdchar=''
1200 d_stdio_stream_array=''
1201 stdio_stream_array=''
1202 sysman=''
1203 sGMTIME_max=''
1204 sGMTIME_min=''
1205 sLOCALTIME_max=''
1206 sLOCALTIME_min=''
1207 trnl=''
1208 uidformat=''
1209 uidsign=''
1210 uidsize=''
1211 uidtype=''
1212 archname64=''
1213 use64bitall=''
1214 use64bitint=''
1215 dtrace=''
1216 usedtrace=''
1217 usefaststdio=''
1218 ccflags_uselargefiles=''
1219 ldflags_uselargefiles=''
1220 libswanted_uselargefiles=''
1221 uselargefiles=''
1222 uselongdouble=''
1223 usemorebits=''
1224 usemultiplicity=''
1225 nm_opt=''
1226 nm_so_opt=''
1227 runnm=''
1228 usenm=''
1229 useperlio=''
1230 usesocks=''
1231 d_oldpthreads=''
1232 use5005threads=''
1233 useithreads=''
1234 usereentrant=''
1235 usethreads=''
1236 incpath=''
1237 mips_type=''
1238 usrinc=''
1239 vaproto=''
1240 d_vendorarch=''
1241 installvendorarch=''
1242 vendorarch=''
1243 vendorarchexp=''
1244 d_vendorbin=''
1245 installvendorbin=''
1246 vendorbin=''
1247 vendorbinexp=''
1248 installvendorhtml1dir=''
1249 vendorhtml1dir=''
1250 vendorhtml1direxp=''
1251 installvendorhtml3dir=''
1252 vendorhtml3dir=''
1253 vendorhtml3direxp=''
1254 d_vendorlib=''
1255 installvendorlib=''
1256 vendorlib=''
1257 vendorlib_stem=''
1258 vendorlibexp=''
1259 installvendorman1dir=''
1260 vendorman1dir=''
1261 vendorman1direxp=''
1262 installvendorman3dir=''
1263 vendorman3dir=''
1264 vendorman3direxp=''
1265 usevendorprefix=''
1266 vendorprefix=''
1267 vendorprefixexp=''
1268 d_vendorscript=''
1269 installvendorscript=''
1270 vendorscript=''
1271 vendorscriptexp=''
1272 versiononly=''
1273 defvoidused=''
1274 voidflags=''
1275 yacc=''
1276 yaccflags=''
1277 CONFIG=''
1278
1279 : Detect odd OSs
1280 define='define'
1281 undef='undef'
1282 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1283 rmlist=''
1284
1285 : We must find out about Eunice early
1286 eunicefix=':'
1287 if test -f /etc/unixtovms; then
1288         eunicefix=/etc/unixtovms
1289 fi
1290 if test -f /etc/unixtovms.exe; then
1291         eunicefix=/etc/unixtovms.exe
1292 fi
1293
1294 : Set executable suffix now -- needed before hints available
1295 if test -f "/libs/version.library"; then
1296 : Amiga OS
1297     _exe=""
1298 elif test -f "/system/gnu_library/bin/ar.pm"; then
1299 : Stratus VOS
1300     _exe=".pm"
1301 elif test -n "$DJGPP"; then
1302 : DOS DJGPP
1303     _exe=".exe"
1304 elif test -d c:/. -o -n "$is_os2" ; then
1305 : OS/2 or cygwin
1306     _exe=".exe"
1307 fi
1308
1309 groupstype=''
1310 i_whoami=''
1311 : Trailing extension.  Override this in a hint file, if needed.
1312 : Extra object files, if any, needed on this platform.
1313 archobjs=''
1314 archname=''
1315 libnames=''
1316 : change the next line if compiling for Xenix/286 on Xenix/386
1317 xlibpth='/usr/lib/386 /lib/386'
1318 : Possible local library directories to search.
1319 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1320 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1321
1322 : general looking path for locating libraries
1323 glibpth="/lib /usr/lib $xlibpth"
1324 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1325 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1326 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1327 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1328
1329 : Private path used by Configure to find libraries.  Its value
1330 : is prepended to libpth. This variable takes care of special
1331 : machines, like the mips.  Usually, it should be empty.
1332 plibpth=''
1333
1334 : default library list
1335 libswanted=''
1336 : some systems want to use only the non-versioned libso:s
1337 ignore_versioned_solibs=''
1338 : set usethreads on the Configure command line to enable threads.
1339 usereentrant='undef'
1340 : full support for void wanted by default
1341 defvoidused=15
1342
1343 : Possible local include directories to search.
1344 : Set locincpth to "" in a hint file to defeat local include searches.
1345 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1346 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1347 :
1348 : no include file wanted by default
1349 inclwanted=''
1350
1351 : Enable -DEBUGGING and -DDEBUGGING from the command line
1352 EBUGGING=''
1353 DEBUGGING=old
1354
1355 ccname=''
1356 ccversion=''
1357 perllibs=''
1358 : set useposix=false in your hint file to disable the POSIX extension.
1359 useposix=true
1360 : set useopcode=false in your hint file to disable the Opcode extension.
1361 useopcode=true
1362 archname64=''
1363 ccflags_uselargefiles=''
1364 ldflags_uselargefiles=''
1365 libswanted_uselargefiles=''
1366 : set usemultiplicity on the Configure command line to enable multiplicity.
1367 : set usesocks on the Configure command line to enable socks.
1368 : List of libraries we want.
1369 : If anyone needs extra -lxxx, put those in a hint file.
1370 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1371 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1372 : We probably want to search /usr/shlib before most other libraries.
1373 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1374 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1375 glibpth="/usr/shlib $glibpth"
1376 : Do not use vfork unless overridden by a hint file.
1377 usevfork=false
1378
1379 : Find the basic shell for Bourne shell scripts
1380 case "$sh" in
1381 '')
1382         case "$SYSTYPE" in
1383         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1384         *) xxx='/bin/sh';;
1385         esac
1386         if test -f "$xxx"; then
1387                 sh="$xxx"
1388         else
1389                 : Build up a list and do a single loop so we can 'break' out.
1390                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1391                 for xxx in sh bash ksh pdksh ash; do
1392                         for p in $pth; do
1393                                 try="$try ${p}/${xxx}"
1394                         done
1395                 done
1396                 for xxx in $try; do
1397                         if test -f "$xxx"; then
1398                                 sh="$xxx";
1399                                 break
1400                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1401                                 sh="$xxx";
1402                                 break
1403                         elif test -f "$xxx.exe"; then
1404                                 sh="$xxx";
1405                                 break
1406                         fi
1407                 done
1408         fi
1409         ;;
1410 esac
1411
1412 case "$sh" in
1413 '')     cat >&2 <<EOM
1414 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1415
1416 Usually it's in /bin/sh.  How did you even get this far?
1417 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1418 we'll try to straighten this all out.
1419 EOM
1420         exit 1
1421         ;;
1422 esac
1423
1424 : see if sh knows # comments
1425 if `$sh -c '#' >/dev/null 2>&1`; then
1426         shsharp=true
1427         spitshell=cat
1428         xcat=/bin/cat
1429         test -f $xcat$_exe || xcat=/usr/bin/cat
1430         if test ! -f $xcat$_exe; then
1431                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1432                         if test -f $p/cat$_exe; then
1433                                 xcat=$p/cat
1434                                 break
1435                         fi
1436                 done
1437                 if test ! -f $xcat$_exe; then
1438                         echo "Can't find cat anywhere!"
1439                         exit 1
1440                 fi
1441         fi
1442         echo "#!$xcat" >sharp
1443         $eunicefix sharp
1444         chmod +x sharp
1445         ./sharp > today 2>/dev/null
1446         if test -s today; then
1447                 sharpbang='#!'
1448         else
1449                 echo "#! $xcat" > sharp
1450                 $eunicefix sharp
1451                 chmod +x sharp
1452                 ./sharp > today 2>/dev/null
1453                 if test -s today; then
1454                         sharpbang='#! '
1455                 else
1456                         sharpbang=': use '
1457                 fi
1458         fi
1459 else
1460         echo " "
1461         echo "Your $sh doesn't grok # comments--I will strip them later on."
1462         shsharp=false
1463         cd ..
1464         echo "exec grep -v '^[  ]*#'" >spitshell
1465         chmod +x spitshell
1466         $eunicefix spitshell
1467         spitshell=`pwd`/spitshell
1468         cd UU
1469         echo "I presume that if # doesn't work, #! won't work either!"
1470         sharpbang=': use '
1471 fi
1472 rm -f sharp today
1473
1474 : figure out how to guarantee sh startup
1475 case "$startsh" in
1476 '') startsh=${sharpbang}${sh} ;;
1477 *)
1478 esac
1479 cat >sharp <<EOSS
1480 $startsh
1481 set abc
1482 test "$?abc" != 1
1483 EOSS
1484
1485 chmod +x sharp
1486 $eunicefix sharp
1487 if ./sharp; then
1488         : echo "Yup, it does."
1489 else
1490         echo "Hmm... '$startsh' does not guarantee sh startup..."
1491         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1492 fi
1493 rm -f sharp
1494
1495 : Save command line options in file UU/cmdline.opt for later use in
1496 : generating config.sh.
1497 cat > cmdline.opt <<EOSH
1498 : Configure command line arguments.
1499 config_arg0='$0'
1500 config_args='$*'
1501 config_argc=$#
1502 EOSH
1503 argn=1
1504 args_exp=''
1505 args_sep=''
1506 for arg in "$@"; do
1507         cat >>cmdline.opt <<EOSH
1508 config_arg$argn='$arg'
1509 EOSH
1510         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1511 $arg
1512 EOC
1513         arg_exp=`cat cmdl.opt`
1514         args_exp="$args_exp$args_sep'$arg_exp'"
1515         argn=`expr $argn + 1`
1516         args_sep=' '
1517 done
1518 rm -f cmdl.opt
1519
1520 : produce awk script to parse command line options
1521 cat >options.awk <<'EOF'
1522 BEGIN {
1523         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1524
1525         len = length(optstr);
1526         for (i = 1; i <= len; i++) {
1527                 c = substr(optstr, i, 1);
1528                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1529                 if (a == ":") {
1530                         arg[c] = 1;
1531                         i++;
1532                 }
1533                 opt[c] = 1;
1534         }
1535 }
1536 {
1537         expect = 0;
1538         str = $0;
1539         if (substr(str, 1, 1) != "-") {
1540                 printf("'%s'\n", str);
1541                 next;
1542         }
1543         len = length($0);
1544         for (i = 2; i <= len; i++) {
1545                 c = substr(str, i, 1);
1546                 if (!opt[c]) {
1547                         printf("-%s\n", substr(str, i));
1548                         next;
1549                 }
1550                 printf("-%s\n", c);
1551                 if (arg[c]) {
1552                         if (i < len)
1553                                 printf("'%s'\n", substr(str, i + 1));
1554                         else
1555                                 expect = 1;
1556                         next;
1557                 }
1558         }
1559 }
1560 END {
1561         if (expect)
1562                 print "?";
1563 }
1564 EOF
1565
1566 : process the command line options
1567 set X `for arg in "$@"; do echo "X$arg"; done |
1568         sed -e s/X// | awk -f options.awk`
1569 eval "set $*"
1570 shift
1571 rm -f options.awk
1572
1573 : set up default values
1574 fastread=''
1575 reuseval=false
1576 config_sh=''
1577 alldone=''
1578 error=''
1579 silent=''
1580 extractsh=''
1581 override=''
1582 knowitall=''
1583 rm -f optdef.sh posthint.sh
1584 cat >optdef.sh <<EOS
1585 $startsh
1586 EOS
1587
1588
1589 : option parsing
1590 while test $# -gt 0; do
1591         case "$1" in
1592         -d) shift; fastread=yes;;
1593         -e) shift; alldone=cont;;
1594         -f)
1595                 shift
1596                 cd ..
1597                 if test -r "$1"; then
1598                         config_sh="$1"
1599                 else
1600                         echo "$me: cannot read config file $1." >&2
1601                         error=true
1602                 fi
1603                 cd UU
1604                 shift;;
1605         --help|\
1606         -h) shift; error=true;;
1607         -r) shift; reuseval=true;;
1608         -s) shift; silent=true; realsilent=true;;
1609         -E) shift; alldone=exit;;
1610         -K) shift; knowitall=true;;
1611         -O) shift; override=true;;
1612         -S) shift; silent=true; extractsh=true;;
1613         -D)
1614                 shift
1615                 case "$1" in
1616                 *=)
1617                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1618                         echo "$me: ignoring -D $1" >&2
1619                         ;;
1620                 *=*) echo "$1" | \
1621                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1622                 *) echo "$1='define'" >> optdef.sh;;
1623                 esac
1624                 shift
1625                 ;;
1626         -U)
1627                 shift
1628                 case "$1" in
1629                 *=) echo "$1" >> optdef.sh;;
1630                 *=*)
1631                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1632                         echo "$me: ignoring -U $1" >&2
1633                         ;;
1634                 *) echo "$1='undef'" >> optdef.sh;;
1635                 esac
1636                 shift
1637                 ;;
1638         -A)
1639             shift
1640             xxx=''
1641             yyy="$1"
1642             zzz=''
1643             uuu=undef
1644             case "$yyy" in
1645             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1646                  case "$zzz" in
1647                  *:*) zzz='' ;;
1648                  *)   xxx=append
1649                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1650                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1651                  esac
1652                  ;;
1653             esac
1654             case "$xxx" in
1655             '')  case "$yyy" in
1656                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1657                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1658                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1659                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1660                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1661                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1662                  esac
1663                  ;;
1664             esac
1665             case "$xxx" in
1666             append)
1667                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1668             clear)
1669                 echo "$yyy=''"                  >> posthint.sh ;;
1670             define)
1671                 case "$zzz" in
1672                 '') zzz=define ;;
1673                 esac
1674                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1675             eval)
1676                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1677             prepend)
1678                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1679             undef)
1680                 case "$zzz" in
1681                 '') zzz="$uuu" ;;
1682                 esac
1683                 echo "$yyy=$zzz"                >> posthint.sh ;;
1684             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1685             esac
1686             shift
1687             ;;
1688         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1689             exit 0;;
1690         --) break;;
1691         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1692         *) break;;
1693         esac
1694 done
1695
1696 case "$error" in
1697 true)
1698         cat >&2 <<EOM
1699 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1700                  [-U symbol] [-U symbol=] [-A command:symbol...]
1701   -d : use defaults for all answers.
1702   -e : go on without questioning past the production of config.sh.
1703   -f : specify an alternate default configuration file.
1704   -h : print this help message and exit (with an error status).
1705   -r : reuse C symbols value if possible (skips costly nm extraction).
1706   -s : silent mode, only echoes questions and essential information.
1707   -D : define symbol to have some value:
1708          -D symbol         symbol gets the value 'define'
1709          -D symbol=value   symbol gets the value 'value'
1710        common used examples (see INSTALL for more info):
1711          -Duse64bitint            use 64bit integers
1712          -Duse64bitall            use 64bit integers and pointers
1713          -Dusethreads             use thread support
1714          -Dinc_version_list=none  do not include older perl trees in @INC
1715          -DEBUGGING=none          DEBUGGING options
1716          -Dcc=gcc                 choose your compiler
1717          -Dprefix=/opt/perl5      choose your destination
1718   -E : stop at the end of questions, after having produced config.sh.
1719   -K : do not use unless you know what you are doing.
1720   -O : let -D and -U override definitions from loaded configuration file.
1721   -S : perform variable substitutions on all .SH files (can mix with -f)
1722   -U : undefine symbol:
1723          -U symbol    symbol gets the value 'undef'
1724          -U symbol=   symbol gets completely empty
1725        e.g.:  -Uversiononly
1726   -A : manipulate symbol after the platform specific hints have been applied:
1727          -A append:symbol=value   append value to symbol
1728          -A symbol=value          like append:, but with a separating space
1729          -A define:symbol=value   define symbol to have value
1730          -A clear:symbol          define symbol to be ''
1731          -A define:symbol         define symbol to be 'define'
1732          -A eval:symbol=value     define symbol to be eval of value
1733          -A prepend:symbol=value  prepend value to symbol
1734          -A undef:symbol          define symbol to be 'undef'
1735          -A undef:symbol=         define symbol to be ''
1736        e.g.:  -A prepend:libswanted='cl pthread '
1737               -A ccflags=-DSOME_MACRO
1738   -V : print version number and exit (with a zero status).
1739 EOM
1740         exit 1
1741         ;;
1742 esac
1743
1744 : Sanity checks
1745 case "$fastread$alldone" in
1746 yescont|yesexit) ;;
1747 *)
1748         case "$extractsh" in
1749         true) ;;
1750         *)
1751                 if test ! -t 0; then
1752                         echo "Say 'sh Configure', not 'sh <Configure'"
1753                         exit 1
1754                 fi
1755                 ;;
1756         esac
1757         ;;
1758 esac
1759
1760 exec 4>&1
1761 case "$silent" in
1762 true) exec 1>/dev/null;;
1763 esac
1764
1765 : run the defines and the undefines, if any, but leave the file out there...
1766 touch optdef.sh
1767 . ./optdef.sh
1768 : create the posthint manipulation script and leave the file out there...
1769 touch posthint.sh
1770
1771 : set package name
1772 package='perl5'
1773 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1774 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1775 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1776 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1777 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1778 esac
1779
1780 : Some greps do not return status, grrr.
1781 echo "grimblepritz" >grimble
1782 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1783         contains=contains
1784 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1785         contains=grep
1786 else
1787         contains=contains
1788 fi
1789 rm -f grimble
1790 : the following should work in any shell
1791 case "$contains" in
1792 contains*)
1793         echo " "
1794         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1795         cat >contains <<'EOSS'
1796 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1797 EOSS
1798 chmod +x contains
1799 esac
1800
1801 : Find the path to the source tree
1802 case "$src" in
1803 '') case "$0" in
1804     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1805          case "$src" in
1806          /*)    ;;
1807          .)     ;;
1808          *)     src=`cd ../$src && pwd` ;;
1809          esac
1810          ;;
1811     *)   src='.';;
1812     esac;;
1813 esac
1814 case "$src" in
1815 '')     src=/
1816         rsrc=/
1817         ;;
1818 /*)     rsrc="$src";;
1819 *)      rsrc="../$src";;
1820 esac
1821 if test -f $rsrc/Configure && \
1822         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1823 then
1824    : found it, so we are ok.
1825 else
1826         rsrc=''
1827         for src in . .. ../.. ../../.. ../../../..; do
1828                 if test -f ../$src/Configure && \
1829                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1830                 then
1831                         rsrc=../$src
1832                         break
1833                 fi
1834         done
1835 fi
1836 case "$rsrc" in
1837 '')
1838         cat <<EOM >&4
1839
1840 Sorry, I can't seem to locate the source dir for $package.  Please start
1841 Configure with an explicit path -- i.e. /some/path/Configure.
1842
1843 EOM
1844         exit 1
1845         ;;
1846 ../.)   rsrc='..';;
1847 *)
1848         echo " "
1849         echo "Sources for $package found in \"$src\"." >&4
1850         ;;
1851 esac
1852
1853 : script used to extract .SH files with variable substitutions
1854 cat >extract <<'EOS'
1855 PERL_CONFIG_SH=true
1856 echo "Doing variable substitutions on .SH files..."
1857 if test -f MANIFEST; then
1858         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1859 else
1860         echo "(Looking for .SH files under the source directory.)"
1861         set x `(cd "$src"; find . -name "*.SH" -print)`
1862 fi
1863 shift
1864 case $# in
1865 0) set x `(cd "$src"; echo *.SH)`; shift;;
1866 esac
1867 if test ! -f "$src/$1"; then
1868         shift
1869 fi
1870 mkdir_p='
1871 name=$1;
1872 create="";
1873 while test $name; do
1874         if test ! -d "$name"; then
1875                 create="$name $create";
1876                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1877                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1878         else
1879                 name="";
1880         fi;
1881 done;
1882 for file in $create; do
1883         mkdir $file;
1884 done
1885 '
1886 for file in $*; do
1887         case "$src" in
1888         ".")
1889                 case "$file" in
1890                 */*)
1891                         dir=`expr X$file : 'X\(.*\)/'`
1892                         file=`expr X$file : 'X.*/\(.*\)'`
1893                         (cd "$dir" && . ./$file)
1894                         ;;
1895                 *)
1896                         . ./$file
1897                         ;;
1898                 esac
1899                 ;;
1900         *)
1901                 case "$file" in
1902                 */*)
1903                         dir=`expr X$file : 'X\(.*\)/'`
1904                         file=`expr X$file : 'X.*/\(.*\)'`
1905                         (set x $dir; shift; eval $mkdir_p)
1906                         sh <"$src/$dir/$file"
1907                         ;;
1908                 *)
1909                         sh <"$src/$file"
1910                         ;;
1911                 esac
1912                 ;;
1913         esac
1914 done
1915 if test -f "$src/config_h.SH"; then
1916         if test ! -f config.h; then
1917         : oops, they left it out of MANIFEST, probably, so do it anyway.
1918         . "$src/config_h.SH"
1919         fi
1920 fi
1921 EOS
1922
1923 : extract files and exit if asked to do so
1924 case "$extractsh" in
1925 true)
1926         case "$realsilent" in
1927         true) ;;
1928         *) exec 1>&4;;
1929         esac
1930         case "$config_sh" in
1931         '') config_sh='config.sh';;
1932         esac
1933         echo " "
1934         echo "Fetching answers from $config_sh..."
1935         cd ..
1936         . $config_sh
1937         test "$override" && . ./optdef.sh
1938         echo " "
1939         . UU/extract
1940         rm -rf UU
1941         echo "Extraction done."
1942         exit 0
1943         ;;
1944 esac
1945
1946 : Eunice requires " " instead of "", can you believe it
1947 echo " "
1948 : Here we go...
1949 echo "Beginning of configuration questions for $package."
1950
1951 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1952
1953 : first determine how to suppress newline on echo command
1954 echo " "
1955 echo "Checking echo to see how to suppress newlines..."
1956 (echo "hi there\c" ; echo " ") >.echotmp
1957 if $contains c .echotmp >/dev/null 2>&1 ; then
1958         echo "...using -n."
1959         n='-n'
1960         c=''
1961 else
1962         cat <<'EOM'
1963 ...using \c
1964 EOM
1965         n=''
1966         c='\c'
1967 fi
1968 echo $n "The star should be here-->$c"
1969 echo '*'
1970 rm -f .echotmp
1971
1972 : Now test for existence of everything in MANIFEST
1973 echo " "
1974 if test -f "$rsrc/MANIFEST"; then
1975         echo "First let's make sure your kit is complete.  Checking..." >&4
1976         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1977                 (split -l 50 2>/dev/null || split -50)
1978         rm -f missing
1979         tmppwd=`pwd`
1980         for filelist in x??; do
1981                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1982                         >/dev/null 2>>"$tmppwd/missing")
1983         done
1984         if test -s missing; then
1985                 cat missing >&4
1986                 cat >&4 <<'EOM'
1987
1988 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1989
1990 You have the option of continuing the configuration process, despite the
1991 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1992 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1993 and contact the author (perlbug@perl.org).
1994
1995 EOM
1996                 echo $n "Continue? [n] $c" >&4
1997                 read ans
1998                 case "$ans" in
1999                 y*)
2000                         echo "Continuing..." >&4
2001                         rm -f missing
2002                         ;;
2003                 *)
2004                         echo "ABORTING..." >&4
2005                         kill $$
2006                         ;;
2007                 esac
2008         else
2009                 echo "Looks good..."
2010         fi
2011 else
2012         echo "There is no MANIFEST file.  I hope your kit is complete !"
2013 fi
2014 rm -f missing x??
2015
2016 : Find the appropriate value for a newline for tr
2017 echo " "
2018 if test -n "$DJGPP"; then
2019        trnl='\012'
2020 fi
2021 if test X"$trnl" = X; then
2022         case "`echo foo|tr '\n' x 2>/dev/null`" in
2023         foox) trnl='\n' ;;
2024         esac
2025 fi
2026 if test X"$trnl" = X; then
2027         case "`echo foo|tr '\012' x 2>/dev/null`" in
2028         foox) trnl='\012' ;;
2029         esac
2030 fi
2031 if test X"$trnl" = X; then
2032        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2033        fooxy) trnl='\n\r' ;;
2034        esac
2035 fi
2036 if test X"$trnl" = X; then
2037         cat <<EOM >&2
2038
2039 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2040
2041 EOM
2042         exit 1
2043 fi
2044
2045 : compute the number of columns on the terminal for proper question formatting
2046 case "$COLUMNS" in
2047 '') COLUMNS='80';;
2048 esac
2049
2050 : set up the echo used in my read
2051 myecho="case \"\$xxxm\" in
2052 '') echo $n \"\$rp $c\" >&4;;
2053 *) case \"\$rp\" in
2054         '') echo $n \"[\$xxxm] $c\";;
2055         *)
2056                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2057                         echo \"\$rp\" >&4
2058                         echo $n \"[\$xxxm] $c\" >&4
2059                 else
2060                         echo $n \"\$rp [\$xxxm] $c\" >&4
2061                 fi
2062                 ;;
2063         esac;;
2064 esac"
2065
2066 : now set up to do reads with possible shell escape and default assignment
2067 cat <<EOSC >myread
2068 $startsh
2069 xxxm=\$dflt
2070 $myecho
2071 ans='!'
2072 case "\$fastread" in
2073 yes) case "\$dflt" in
2074         '') ;;
2075         *) ans='';
2076                 case "\$silent-\$rp" in
2077                 true-) ;;
2078                 *) echo " " >&4;;
2079                 esac;;
2080         esac;;
2081 *) case "\$silent" in
2082         true) case "\$rp" in
2083                 '') ans='';;
2084                 esac;;
2085         esac;;
2086 esac
2087 while expr "X\$ans" : "X!" >/dev/null; do
2088         read answ
2089         set x \$xxxm
2090         shift
2091         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2092         case  "\$answ" in
2093         "!")
2094                 sh 1>&4
2095                 echo " "
2096                 $myecho
2097                 ;;
2098         !*)
2099                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2100                 shift
2101                 sh 1>&4 -c "\$*"
2102                 echo " "
2103                 $myecho
2104                 ;;
2105         "\$ans")
2106                 case "\$ans" in
2107                 \\&*)
2108                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2109                         shift
2110                         case "\$1" in
2111                         -d)
2112                                 fastread=yes
2113                                 echo "(OK, I'll run with -d after this question.)" >&4
2114                                 ;;
2115                         -*)
2116                                 echo "*** Sorry, \$1 not supported yet." >&4
2117                                 ;;
2118                         esac
2119                         $myecho
2120                         ans=!
2121                         ;;
2122                 esac;;
2123         *)
2124                 case "\$aok" in
2125                 y)
2126                         echo "*** Substitution done -- please confirm."
2127                         xxxm="\$ans"
2128                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2129                         xxxm="\$ans"
2130                         ans=!
2131                         ;;
2132                 *)
2133                         echo "*** Error -- try again."
2134                         ans=!
2135                         ;;
2136                 esac
2137                 $myecho
2138                 ;;
2139         esac
2140         case "\$ans\$xxxm\$nostick" in
2141         '')
2142                 ans=!
2143                 $myecho
2144                 ;;
2145         esac
2146 done
2147 case "\$ans" in
2148 '') ans="\$xxxm";;
2149 esac
2150 EOSC
2151
2152 : create .config dir to save info across Configure sessions
2153 test -d ../.config || mkdir ../.config
2154 cat >../.config/README <<EOF
2155 This directory created by Configure to save information that should
2156 persist across sessions for $package.
2157
2158 You may safely delete it if you wish.
2159 EOF
2160
2161 : See if we are using a devel version and want that
2162 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2163 case "$usedevel" in
2164 $define|true|[yY]*)
2165     usedevel="$define" ;;
2166 *) case "$xversion" in
2167    *[13579])
2168         cat >&4 <<EOH
2169 *** WHOA THERE!!! ***
2170
2171     This is an UNSTABLE DEVELOPMENT release.
2172     The version of this $package distribution is $xversion, that is, odd,
2173     (as opposed to even) and that signifies a development release.
2174     If you want a maintenance release, you want an even-numbered version.
2175
2176     Do ***NOT*** install this into production use.
2177     Data corruption and crashes are possible.
2178
2179     It is most seriously suggested that you do not continue any further
2180     unless you want to help in developing and debugging Perl.
2181
2182     If you *still* want to build perl, you can answer 'y' now,
2183     or pass -Dusedevel to Configure.
2184
2185 EOH
2186         rp='Do you really want to continue?'
2187         dflt='n'
2188         . ./myread
2189         case "$ans" in
2190         [yY]) echo >&4 "Okay, continuing."
2191               usedevel="$define" ;;
2192         *) echo >&4 "Okay, bye."
2193            exit 1
2194            ;;
2195         esac
2196         ;;
2197     esac
2198     usedevel="$undef"
2199     ;;
2200 esac
2201 case "$usedevel" in
2202 $define|true|[yY]*)
2203         case "$versiononly" in
2204         '') versiononly="$define" ;;
2205         esac
2206         case "$installusrbinperl" in
2207         '') installusrbinperl="$undef" ;;
2208         esac
2209         ;;
2210 esac
2211
2212 : general instructions
2213 needman=true
2214 firsttime=true
2215 user=`(logname) 2>/dev/null`
2216 case "$user" in
2217 '') user=`whoami 2>&1`;;
2218 esac
2219 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2220         firsttime=false
2221         echo " "
2222         rp='Would you like to see the instructions?'
2223         dflt=n
2224         . ./myread
2225         case "$ans" in
2226         [yY]*) ;;
2227         *) needman=false;;
2228         esac
2229 fi
2230 if $needman; then
2231         cat <<EOH
2232
2233 This installation shell script will examine your system and ask you questions
2234 to determine how the perl5 package should be installed. If you get
2235 stuck on a question, you may use a ! shell escape to start a subshell or
2236 execute a command.  Many of the questions will have default answers in square
2237 brackets; typing carriage return will give you the default.
2238
2239 On some of the questions which ask for file or directory names you are allowed
2240 to use the ~name construct to specify the login directory belonging to "name",
2241 even if you don't have a shell which knows about that.  Questions where this is
2242 allowed will be marked "(~name ok)".
2243
2244 EOH
2245         rp=''
2246         dflt='Type carriage return to continue'
2247         . ./myread
2248         cat <<'EOH'
2249
2250 The prompter used in this script allows you to use shell variables and
2251 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2252 in the default answer, as if the default line was a set of arguments given to a
2253 script shell.  This means you may also use $* to repeat the whole default line,
2254 so you do not have to re-type everything to add something to the default.
2255
2256 Everytime there is a substitution, you will have to confirm.  If there is an
2257 error (e.g. an unmatched backtick), the default answer will remain unchanged
2258 and you will be prompted again.
2259
2260 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2261 the questions and use the computed defaults (or the previous answers if there
2262 was already a config.sh file). Type 'Configure -h' for a list of options.
2263 You may also start interactively and then answer '& -d' at any prompt to turn
2264 on the non-interactive behaviour for the remainder of the execution.
2265
2266 EOH
2267         . ./myread
2268         cat <<EOH
2269
2270 Much effort has been expended to ensure that this shell script will run on any
2271 Unix system.  If despite that it blows up on yours, your best bet is to edit
2272 Configure and run it again.  If you can't run Configure for some reason,
2273 you'll have to generate a config.sh file by hand.  Whatever problems you
2274 have, let me (perlbug@perl.org) know how I blew it.
2275
2276 This installation script affects things in two ways:
2277
2278 1) it may do direct variable substitutions on some of the files included
2279    in this kit.
2280 2) it builds a config.h file for inclusion in C programs.  You may edit
2281    any of these files as the need arises after running this script.
2282
2283 If you make a mistake on a question, there is no easy way to back up to it
2284 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2285 files.  Configure will offer to let you do this before it runs the SH files.
2286
2287 EOH
2288         dflt='Type carriage return to continue'
2289         . ./myread
2290         case "$firsttime" in
2291         true) echo $user >>../.config/instruct;;
2292         esac
2293 fi
2294
2295 : find out where common programs are
2296 echo " "
2297 echo "Locating common programs..." >&4
2298 cat <<EOSC >loc
2299 $startsh
2300 case \$# in
2301 0) exit 1;;
2302 esac
2303 thing=\$1
2304 shift
2305 dflt=\$1
2306 shift
2307 for dir in \$*; do
2308         case "\$thing" in
2309         .)
2310         if test -d \$dir/\$thing; then
2311                 echo \$dir
2312                 exit 0
2313         fi
2314         ;;
2315         *)
2316         for thisthing in \$dir/\$thing; do
2317                 : just loop through to pick last item
2318         done
2319         if test -f \$thisthing; then
2320                 echo \$thisthing
2321                 exit 0
2322         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2323                 echo \$thisthing
2324                 exit 0
2325         elif test -f \$dir/\$thing.exe; then
2326                 if test -n "$DJGPP"; then
2327                         echo \$dir/\$thing.exe
2328                 elif test "$eunicefix" != ":"; then
2329                         : on Eunice apparently
2330                         echo \$dir/\$thing
2331                 fi
2332                 exit 0
2333         fi
2334         ;;
2335         esac
2336 done
2337 echo \$dflt
2338 exit 1
2339 EOSC
2340 chmod +x loc
2341 $eunicefix loc
2342 loclist="
2343 awk
2344 cat
2345 chmod
2346 comm
2347 cp
2348 echo
2349 expr
2350 grep
2351 ls
2352 mkdir
2353 rm
2354 sed
2355 sort
2356 touch
2357 tr
2358 uniq
2359 "
2360 trylist="
2361 ar
2362 bison
2363 byacc
2364 cpp
2365 csh
2366 date
2367 egrep
2368 gmake
2369 gzip
2370 less
2371 ln
2372 make
2373 more
2374 nm
2375 nroff
2376 pg
2377 test
2378 uname
2379 zip
2380 "
2381 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2382 pth="$pth /lib /usr/lib"
2383 for file in $loclist; do
2384         eval xxx=\$$file
2385         case "$xxx" in
2386         /*|?:[\\/]*)
2387                 if test -f "$xxx"; then
2388                         : ok
2389                 else
2390                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2391                         xxx=`./loc $file $file $pth`
2392                 fi
2393                 ;;
2394         '') xxx=`./loc $file $file $pth`;;
2395         *) xxx=`./loc $xxx $xxx $pth`;;
2396         esac
2397         eval $file=$xxx$_exe
2398         eval _$file=$xxx
2399         case "$xxx" in
2400         /*)
2401                 echo $file is in $xxx.
2402                 ;;
2403         ?:[\\/]*)
2404                 echo $file is in $xxx.
2405                 ;;
2406         *)
2407                 echo "I don't know where '$file' is, and my life depends on it." >&4
2408                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2409                 exit 1
2410                 ;;
2411         esac
2412 done
2413 echo " "
2414 echo "Don't worry if any of the following aren't found..."
2415 say=offhand
2416 for file in $trylist; do
2417         eval xxx=\$$file
2418         case "$xxx" in
2419         /*|?:[\\/]*)
2420                 if test -f "$xxx"; then
2421                         : ok
2422                 else
2423                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2424                         xxx=`./loc $file $file $pth`
2425                 fi
2426                 ;;
2427         '') xxx=`./loc $file $file $pth`;;
2428         *) xxx=`./loc $xxx $xxx $pth`;;
2429         esac
2430         eval $file=$xxx$_exe
2431         eval _$file=$xxx
2432         case "$xxx" in
2433         /*)
2434                 echo $file is in $xxx.
2435                 ;;
2436         ?:[\\/]*)
2437                 echo $file is in $xxx.
2438                 ;;
2439         *)
2440                 echo "I don't see $file out there, $say."
2441                 say=either
2442                 ;;
2443         esac
2444 done
2445 case "$egrep" in
2446 egrep)
2447         echo "Substituting grep for egrep."
2448         egrep=$grep
2449         _egrep=$grep
2450         ;;
2451 esac
2452 case "$less" in
2453 '')     ;;
2454 *)      if $less -R </dev/null >/dev/null; then
2455                echo "Substituting less -R for less."
2456                less="$less -R"
2457                _less=$less
2458         fi
2459         ;;
2460 esac
2461 case "$ln" in
2462 ln)
2463         echo "Substituting cp for ln."
2464         ln=$cp
2465         _ln=$cp
2466         ;;
2467 esac
2468 case "$make" in
2469 make)
2470         case "$gmake" in
2471         gmake)
2472         echo "I can't find make or gmake, and my life depends on it." >&4
2473         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2474         exit 1
2475         ;;
2476         esac
2477         ;;
2478 esac
2479 case "$gmake" in
2480 gmake)  ;;
2481 *)      # We can't have osname yet.
2482         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2483                 # Assume that gmake, if found, is definitely GNU make
2484                 # and prefer it over the system make.
2485                 echo "Substituting gmake for make."
2486                 make=$gmake
2487                 _make=$gmake
2488         fi
2489         ;;
2490 esac
2491 case "$test" in
2492 test)
2493         echo "Hopefully test is built into your sh."
2494         ;;
2495 *)
2496         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2497                 echo "Using the test built into your sh."
2498                 test=test
2499                 _test=test
2500         fi
2501         ;;
2502 esac
2503 case "$echo" in
2504 echo)
2505         echo "Hopefully echo is built into your sh."
2506         ;;
2507 '') ;;
2508 *)
2509         echo " "
2510 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2511         $echo $n "hi there$c" >foo1
2512         echo $n "hi there$c" >foo2
2513         if cmp foo1 foo2 >/dev/null 2>&1; then
2514                 echo "They are compatible.  In fact, they may be identical."
2515         else
2516                 case "$n" in
2517                 '-n') n='' c='\c';;
2518                 *) n='-n' c='';;
2519                 esac
2520                 cat <<FOO
2521 They are not compatible!  You are probably running ksh on a non-USG system.
2522 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2523 have echo built in and we may have to run some Bourne shell scripts.  That
2524 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2525
2526 FOO
2527                 $echo $n "The star should be here-->$c"
2528                 $echo "*"
2529         fi
2530         $rm -f foo1 foo2
2531         ;;
2532 esac
2533
2534 # This question was auctioned at YAPC::Europe-2007 in Vienna
2535 # I never promised you could answer it. I only auctioned the question.
2536 cat <<FOO
2537 The following message is sponsored by
2538
2539   Dresden.pm<--The stars should be here.
2540
2541 Dear Perl user, system administrator or package
2542 maintainer, the Perl community sends greetings to
2543 you. Do you (emblematical) greet back [Y/n]? n
2544
2545 FOO
2546
2547 : Check what type of C compiler we use
2548 cat <<EOS >trygcc
2549 $startsh
2550 EOS
2551 cat <<'EOSC' >>trygcc
2552 case "$cc" in
2553 '') ;;
2554 *)  $rm -f try try.*
2555     $cat >try.c <<EOM
2556 int main(int argc, char *argv[]) {
2557   return 0;
2558 }
2559 EOM
2560     if $cc -o try $ccflags $ldflags try.c; then
2561        :
2562     else
2563         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2564         despair=yes
2565         trygcc=yes
2566         case "$cc" in
2567         *gcc*) trygcc=no ;;
2568         esac
2569         # Skip this test because it gives a false match on output like:
2570         #    ./trygcc: line 23: cc: command not found
2571         # case "`$cc -v -c try.c 2>&1`" in
2572         # *gcc*) trygcc=no ;;
2573         # esac
2574         if $test X"$trygcc" = Xyes; then
2575             if gcc -o try -c try.c; then
2576                 echo " "
2577                 echo "You seem to have a working gcc, though." >&4
2578                 # Switching compilers may undo the work of hints files.
2579                 # The most common problem is -D_REENTRANT for threads.
2580                 # This heuristic catches that case, but gets false positives
2581                 # if -Dusethreads was not actually specified.  Better to
2582                 # bail out here with a useful message than fail 
2583                 # mysteriously later. Should we perhaps just try to
2584                 # re-invoke Configure -Dcc=gcc config_args ?
2585                 if $test -f usethreads.cbu; then
2586                         $cat >&4 <<EOM 
2587
2588 *** However, any setting of the C compiler flags (e.g. for thread support)
2589 *** will be lost.  It may be necessary for you to restart Configure and
2590 *** add -Dcc=gcc to your Configure command line.
2591
2592 EOM
2593                         rp="Would you like to go ahead and try gcc anyway?"
2594                         dflt=n
2595                 else
2596                         rp="Would you like to use it?"
2597                         dflt=y
2598                 fi
2599                 if $test -f myread; then
2600                     . ./myread
2601                 else
2602                     if $test -f UU/myread; then
2603                         . ./UU/myread
2604                     else
2605                         echo "Cannot find myread, sorry.  Aborting." >&2
2606                         exit 1
2607                     fi
2608                 fi  
2609                 case "$ans" in
2610                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2611                 esac
2612             fi
2613         fi
2614     fi
2615     $rm -f try try.*
2616     ;;
2617 esac
2618 EOSC
2619
2620 cat <<EOS >checkcc
2621 $startsh
2622 EOS
2623 cat <<'EOSC' >>checkcc
2624 case "$cc" in        
2625 '') ;;
2626 *)  $rm -f try try.*              
2627     $cat >try.c <<EOM
2628 int main(int argc, char *argv[]) {
2629   return 0;
2630 }
2631 EOM
2632     if $cc -o try $ccflags $ldflags try.c; then
2633        :
2634     else
2635         if $test X"$despair" = Xyes; then
2636            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2637         fi
2638         $cat >&4 <<EOM         
2639 You need to find a working C compiler.
2640 Either (purchase and) install the C compiler supplied by your OS vendor,
2641 or for a free C compiler try http://gcc.gnu.org/
2642 I cannot continue any further, aborting.
2643 EOM
2644         exit 1
2645     fi
2646     $rm -f try try.*
2647     ;;
2648 esac
2649 EOSC
2650
2651 : determine whether symbolic links are supported
2652 echo " "
2653 $touch blurfl
2654 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2655         echo "Symbolic links are supported." >&4
2656         lns="$ln -s"
2657 else
2658         echo "Symbolic links are NOT supported." >&4
2659         lns="$ln"
2660 fi
2661 $rm -f blurfl sym
2662
2663 : determine whether symbolic links are supported
2664 echo " "
2665 case "$lns" in
2666 *"ln"*" -s")
2667         echo "Checking how to test for symbolic links..." >&4
2668         $lns blurfl sym
2669         if $test "X$issymlink" = X; then
2670                 case "$newsh" in
2671                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2672                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2673                 esac
2674                 if test $? = 0; then
2675                         issymlink="test -h"
2676                 else
2677                         echo "Your builtin 'test -h' may be broken." >&4
2678                         case "$test" in
2679                         /*)     ;;
2680                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2681                                 for p in $pth
2682                                 do
2683                                         if test -f "$p/$test"; then
2684                                                 test="$p/$test"
2685                                                 break
2686                                         fi
2687                                 done
2688                                 ;;
2689                         esac
2690                         case "$test" in
2691                         /*)
2692                                 echo "Trying external '$test -h'." >&4
2693                                 issymlink="$test -h"
2694                                 if $test ! -h sym >/dev/null 2>&1; then
2695                                         echo "External '$test -h' is broken, too." >&4
2696                                         issymlink=''
2697                                 fi
2698                                 ;;
2699                         *)      issymlink='' ;;
2700                         esac
2701                 fi              
2702         fi
2703         if $test "X$issymlink" = X; then
2704                 if $test -L sym 2>/dev/null; then
2705                         issymlink="$test -L"
2706                         echo "The builtin '$test -L' worked." >&4
2707                 fi
2708         fi
2709         if $test "X$issymlink" != X; then
2710                 echo "You can test for symbolic links with '$issymlink'." >&4
2711         else
2712                 echo "I do not know how you can test for symbolic links." >&4
2713         fi
2714         $rm -f blurfl sym
2715         ;;
2716 *)      echo "No symbolic links, so not testing for their testing..." >&4
2717         ;;
2718 esac
2719 echo " "
2720
2721 : Make symlinks util
2722 case "$mksymlinks" in
2723 $define|true|[yY]*)
2724         case "$src" in
2725         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2726                 exit 1
2727                 ;;
2728         *)      case "$lns:$issymlink" in
2729                 *"ln"*" -s:"*"test -"?)
2730                         echo "Creating the symbolic links..." >&4
2731                         echo "(First creating the subdirectories...)" >&4
2732                         cd ..
2733                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2734                                 read directory
2735                                 test -z "$directory" && break
2736                                 mkdir -p $directory
2737                         done
2738                         # Sanity check 1.
2739                         if test ! -d t/base; then
2740                                 echo "Failed to create the subdirectories.  Aborting." >&4
2741                                 exit 1
2742                         fi
2743                         echo "(Then creating the symlinks...)" >&4
2744                         awk '{print $1}' $src/MANIFEST | while true; do
2745                                 read filename
2746                                 test -z "$filename" && break
2747                                 if test -f $filename; then
2748                                         if $issymlink $filename; then
2749                                                 rm -f $filename
2750                                         fi
2751                                 fi
2752                                 if test -f $filename; then
2753                                         echo "$filename already exists, not symlinking."
2754                                 else
2755                                         ln -s $src/$filename $filename
2756                                 fi
2757                         done
2758                         # Sanity check 2.
2759                         if test ! -f t/base/lex.t; then
2760                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2761                                 exit 1
2762                         fi
2763                         cd UU
2764                         ;;
2765                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2766                         ;;
2767                 esac
2768                 ;;
2769         esac
2770         ;;
2771 esac
2772
2773 : Check for Cross-Compilation
2774 case "$usecrosscompile" in
2775 $define|true|[yY]*)
2776         $echo "Cross-compiling..."
2777         croak=''
2778         case "$cc" in
2779         *-*-gcc) # A cross-compiling gcc, probably.
2780             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2781             ar=$targetarch-ar
2782             # leave out ld, choosing it is more complex
2783             nm=$targetarch-nm
2784             ranlib=$targetarch-ranlib
2785             $echo 'extern int foo;' > try.c
2786             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2787             shift
2788             if $test $# -gt 0; then
2789                 incpth="$incpth $*"
2790                 incpth="`$echo $incpth|$sed 's/^ //'`"
2791                 echo "Guessing incpth '$incpth'." >&4
2792                 for i in $*; do
2793                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2794                     if $test -d $j; then
2795                         libpth="$libpth $j"
2796                     fi
2797                 done   
2798                 libpth="`$echo $libpth|$sed 's/^ //'`"
2799                 echo "Guessing libpth '$libpth'." >&4
2800             fi
2801             $rm -f try.c
2802             ;;
2803         esac
2804         case "$targetarch" in
2805         '') echo "Targetarch not defined." >&4; croak=y ;;
2806         *)  echo "Using targetarch $targetarch." >&4 ;;
2807         esac
2808         case "$incpth" in
2809         '') echo "Incpth not defined." >&4; croak=y ;;
2810         *)  echo "Using incpth '$incpth'." >&4 ;;
2811         esac
2812         case "$libpth" in
2813         '') echo "Libpth not defined." >&4; croak=y ;;
2814         *)  echo "Using libpth '$libpth'." >&4 ;;
2815         esac
2816         case "$usrinc" in
2817         '') for i in $incpth; do
2818                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2819                     usrinc=$i
2820                     echo "Guessing usrinc $usrinc." >&4
2821                     break
2822                 fi
2823             done
2824             case "$usrinc" in
2825             '') echo "Usrinc not defined." >&4; croak=y ;;
2826             esac
2827             ;;
2828         *)  echo "Using usrinc $usrinc." >&4 ;;
2829         esac
2830         case "$targethost" in
2831         '') echo "Targethost not defined." >&4; croak=y ;;
2832         *)  echo "Using targethost $targethost." >&4
2833         esac
2834         locincpth=' '
2835         loclibpth=' '
2836         case "$croak" in
2837         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2838         esac
2839         case "$src" in
2840         /*) run=$src/Cross/run
2841             targetmkdir=$src/Cross/mkdir
2842             to=$src/Cross/to
2843             from=$src/Cross/from
2844             ;;
2845         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2846             run=$pwd/Cross/run
2847             targetmkdir=$pwd/Cross/mkdir
2848             to=$pwd/Cross/to
2849             from=$pwd/Cross/from
2850             ;;
2851         esac
2852         case "$targetrun" in
2853         '') targetrun=ssh ;;
2854         esac
2855         case "$targetto" in
2856         '') targetto=scp ;;
2857         esac
2858         case "$targetfrom" in
2859         '') targetfrom=scp ;;
2860         esac
2861         run=$run-$targetrun
2862         to=$to-$targetto
2863         from=$from-$targetfrom
2864         case "$targetdir" in
2865         '')  targetdir=/tmp
2866              echo "Guessing targetdir $targetdir." >&4
2867              ;;
2868         esac
2869         case "$targetuser" in
2870         '')  targetuser=root
2871              echo "Guessing targetuser $targetuser." >&4
2872              ;;
2873         esac
2874         case "$targetfrom" in
2875         scp)    q=-q ;;
2876         *)      q='' ;;
2877         esac
2878         case "$targetrun" in
2879         ssh|rsh)
2880             cat >$run <<EOF
2881 #!/bin/sh
2882 case "\$1" in
2883 -cwd)
2884   shift
2885   cwd=\$1
2886   shift
2887   ;;
2888 esac
2889 case "\$cwd" in
2890 '') cwd=$targetdir ;;
2891 esac
2892 exe=\$1
2893 shift
2894 if $test ! -f \$exe.xok; then
2895   $to \$exe
2896   $touch \$exe.xok
2897 fi
2898 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2899 EOF
2900             ;;
2901         *)  echo "Unknown targetrun '$targetrun'" >&4
2902             exit 1
2903             ;;
2904         esac
2905         case "$targetmkdir" in
2906         */Cross/mkdir)
2907             cat >$targetmkdir <<EOF
2908 #!/bin/sh
2909 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2910 EOF
2911             $chmod a+rx $targetmkdir
2912             ;;
2913         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2914             exit 1
2915             ;;
2916         esac
2917         case "$targetto" in
2918         scp|rcp)
2919             cat >$to <<EOF
2920 #!/bin/sh
2921 for f in \$@
2922 do
2923   case "\$f" in
2924   /*)
2925     $targetmkdir \`dirname \$f\`
2926     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2927     ;;
2928   *)
2929     $targetmkdir $targetdir/\`dirname \$f\`
2930     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2931     ;;
2932   esac
2933 done
2934 exit 0
2935 EOF
2936             ;;
2937         cp) cat >$to <<EOF
2938 #!/bin/sh
2939 for f in \$@
2940 do
2941   case "\$f" in
2942   /*)
2943     $mkdir -p $targetdir/\`dirname \$f\`
2944     $cp \$f $targetdir/\$f || exit 1
2945     ;;
2946   *)
2947     $targetmkdir $targetdir/\`dirname \$f\`
2948     $cp \$f $targetdir/\$f || exit 1
2949     ;;
2950   esac
2951 done
2952 exit 0
2953 EOF
2954             ;;
2955         *)  echo "Unknown targetto '$targetto'" >&4
2956             exit 1
2957             ;;
2958         esac
2959         case "$targetfrom" in
2960         scp|rcp)
2961           cat >$from <<EOF
2962 #!/bin/sh
2963 for f in \$@
2964 do
2965   $rm -f \$f
2966   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2967 done
2968 exit 0
2969 EOF
2970             ;;
2971         cp) cat >$from <<EOF
2972 #!/bin/sh
2973 for f in \$@
2974 do
2975   $rm -f \$f
2976   cp $targetdir/\$f . || exit 1
2977 done
2978 exit 0
2979 EOF
2980             ;;
2981         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2982             exit 1
2983             ;;
2984         esac
2985         if $test ! -f $run; then
2986             echo "Target 'run' script '$run' not found." >&4
2987         else
2988             $chmod a+rx $run
2989         fi
2990         if $test ! -f $to; then
2991             echo "Target 'to' script '$to' not found." >&4
2992         else
2993             $chmod a+rx $to
2994         fi
2995         if $test ! -f $from; then
2996             echo "Target 'from' script '$from' not found." >&4
2997         else
2998             $chmod a+rx $from
2999         fi
3000         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3001             exit 1
3002         fi
3003         cat >&4 <<EOF
3004 Using '$run' for remote execution,
3005 and '$from' and '$to'
3006 for remote file transfer.
3007 EOF
3008         ;;
3009 *)      run=''
3010         to=:
3011         from=:
3012         usecrosscompile='undef'
3013         targetarch=''
3014         ;;
3015 esac
3016
3017 : see whether [:lower:] and [:upper:] are supported character classes
3018 echo " "
3019 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3020 ABYZ)
3021         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3022         up='[:upper:]'
3023         low='[:lower:]'
3024         ;;
3025 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3026         # (0xd9 and 0xe2), therefore that is a nice testing point.
3027         if test "X$up" = X -o "X$low" = X; then
3028             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3029             rs) up='[A-Z]'
3030                 low='[a-z]'
3031                 ;;
3032             esac
3033         fi
3034         if test "X$up" = X -o "X$low" = X; then
3035             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3036             rs) up='A-Z'
3037                 low='a-z'
3038                 ;;
3039             esac
3040         fi
3041         if test "X$up" = X -o "X$low" = X; then
3042             case "`echo RS | od -x 2>/dev/null`" in
3043             *D9E2*|*d9e2*)
3044                 echo "Hey, this might be EBCDIC." >&4
3045                 if test "X$up" = X -o "X$low" = X; then
3046                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3047                     rs) up='[A-IJ-RS-Z]'
3048                         low='[a-ij-rs-z]'
3049                         ;;
3050                     esac
3051                 fi
3052                 if test "X$up" = X -o "X$low" = X; then
3053                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3054                     rs) up='A-IJ-RS-Z'
3055                         low='a-ij-rs-z'
3056                         ;;
3057                     esac
3058                 fi
3059                 ;;
3060             esac
3061         fi
3062 esac
3063 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3064 rs)
3065     echo "Using $up and $low to convert case." >&4
3066     ;;
3067 *)
3068     echo "I don't know how to translate letters from upper to lower case." >&4
3069     echo "Your tr is not acting any way I know of." >&4
3070     exit 1
3071     ;;
3072 esac
3073 : set up the translation script tr, must be called with ./tr of course
3074 cat >tr <<EOSC
3075 $startsh
3076 case "\$1\$2" in
3077 '[A-Z][a-z]') exec $tr '$up' '$low';;
3078 '[a-z][A-Z]') exec $tr '$low' '$up';;
3079 esac
3080 exec $tr "\$@"
3081 EOSC
3082 chmod +x tr
3083 $eunicefix tr
3084
3085 : Try to determine whether config.sh was made on this system
3086 case "$config_sh" in
3087 '')
3088 myuname=`$uname -a 2>/dev/null`
3089 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3090 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3091 # because the A-Z/a-z are not consecutive.
3092 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3093         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3094 newmyuname="$myuname"
3095 dflt=n
3096 case "$knowitall" in
3097 '')
3098         if test -f ../config.sh; then
3099                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3100                         eval "`grep myuname= ../config.sh`"
3101                 fi
3102                 if test "X$myuname" = "X$newmyuname"; then
3103                         dflt=y
3104                 fi
3105         fi
3106         ;;
3107 *) dflt=y;;
3108 esac
3109
3110 : Get old answers from old config file if Configure was run on the
3111 : same system, otherwise use the hints.
3112 hint=default
3113 cd ..
3114 if test -f config.sh; then
3115         echo " "
3116         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3117         . UU/myread
3118         case "$ans" in
3119         n*|N*) echo "OK, I'll ignore it."
3120                 mv config.sh config.sh.old
3121                 myuname="$newmyuname"
3122                 ;;
3123         *)  echo "Fetching default answers from your old config.sh file..." >&4
3124                 tmp_n="$n"
3125                 tmp_c="$c"
3126                 tmp_sh="$sh"
3127                 . ./config.sh
3128                 cp config.sh UU
3129                 n="$tmp_n"
3130                 c="$tmp_c"
3131                 : Older versions did not always set $sh.  Catch re-use of such
3132                 : an old config.sh.
3133                 case "$sh" in
3134                 '') sh="$tmp_sh" ;;
3135                 esac
3136                 hint=previous
3137                 ;;
3138         esac
3139 fi
3140 . ./UU/checkcc
3141 if test ! -f config.sh; then
3142         $cat <<EOM
3143
3144 First time through, eh?  I have some defaults handy for some systems
3145 that need some extra help getting the Configure answers right:
3146
3147 EOM
3148         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3149         dflt=''
3150         : Half the following guesses are probably wrong... If you have better
3151         : tests or hints, please send them to perlbug@perl.org
3152         : The metaconfig authors would also appreciate a copy...
3153         $test -f /irix && osname=irix
3154         $test -f /xenix && osname=sco_xenix
3155         $test -f /dynix && osname=dynix
3156         $test -f /dnix && osname=dnix
3157         $test -f /lynx.os && osname=lynxos
3158         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3159         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3160         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3161         $test -f /bin/mips && /bin/mips && osname=mips
3162         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3163                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3164         $test -d /usr/apollo/bin && osname=apollo
3165         $test -f /etc/saf/_sactab && osname=svr4
3166         $test -d /usr/include/minix && osname=minix
3167         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3168         if $test -d /MachTen -o -d /MachTen_Folder; then
3169                 osname=machten
3170                 if $test -x /sbin/version; then
3171                         osvers=`/sbin/version | $awk '{print $2}' |
3172                         $sed -e 's/[A-Za-z]$//'`
3173                 elif $test -x /usr/etc/version; then
3174                         osvers=`/usr/etc/version | $awk '{print $2}' |
3175                         $sed -e 's/[A-Za-z]$//'`
3176                 else
3177                         osvers="$2.$3"
3178                 fi
3179         fi
3180
3181         $test -f /sys/posix.dll &&
3182                 $test -f /usr/bin/what &&
3183                 set X `/usr/bin/what /sys/posix.dll` &&
3184                 $test "$3" = UWIN &&
3185                 osname=uwin &&
3186                 osvers="$5"
3187
3188         if $test -f $uname; then
3189                 set X $myuname
3190                 shift
3191
3192                 case "$5" in
3193                 fps*) osname=fps ;;
3194                 mips*)
3195                         case "$4" in
3196                         umips) osname=umips ;;
3197                         *) osname=mips ;;
3198                         esac;;
3199                 [23]100) osname=mips ;;
3200                 next*) osname=next ;;
3201                 i386*)
3202                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3203                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3204                                 osname='sco'
3205                                 osvers=$tmp
3206                         elif $test -f /etc/kconfig; then
3207                                 osname=isc
3208                                 if test "$lns" = "$ln -s"; then
3209                                         osvers=4
3210                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3211                                         osvers=3
3212                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3213                                         osvers=2
3214                                 fi
3215                         fi
3216                         tmp=''
3217                         ;;
3218                 pc*)
3219                         if test -n "$DJGPP"; then
3220                                 osname=dos
3221                                 osvers=djgpp
3222                         fi
3223                         ;;
3224                 esac
3225
3226                 case "$1" in
3227                 aix) osname=aix
3228                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3229                         case "$tmp" in
3230                         # oslevel can fail with:
3231                         # oslevel: Unable to acquire lock.
3232                         *not\ found) osvers="$4"."$3" ;;
3233                         '<3240'|'<>3240') osvers=3.2.0 ;;
3234                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3235                         '=3250'|'>3250') osvers=3.2.5 ;;
3236                         *) osvers=$tmp;;
3237                         esac
3238                         ;;
3239                 bsd386) osname=bsd386
3240                         osvers=`$uname -r`
3241                         ;;
3242                 cygwin*) osname=cygwin
3243                         osvers="$3"
3244                         ;;
3245                 *dc.osx) osname=dcosx
3246                         osvers="$3"
3247                         ;;
3248                 dnix) osname=dnix
3249                         osvers="$3"
3250                         ;;
3251                 domainos) osname=apollo
3252                         osvers="$3"
3253                         ;;
3254                 dgux)   osname=dgux
3255                         osvers="$3"
3256                         ;;
3257                 dragonfly) osname=dragonfly
3258                         osvers="$3"
3259                         ;;
3260                 dynixptx*) osname=dynixptx
3261                         osvers=`echo "$4"|sed 's/^v//'`
3262                         ;;
3263                 freebsd) osname=freebsd
3264                         osvers="$3" ;;
3265                 genix)  osname=genix ;;
3266                 gnu)    osname=gnu
3267                         osvers="$3" ;;
3268                 hp*)    osname=hpux
3269                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3270                         ;;
3271                 irix*)  osname=irix
3272                         case "$3" in
3273                         4*) osvers=4 ;;
3274                         5*) osvers=5 ;;
3275                         *)      osvers="$3" ;;
3276                         esac
3277                         ;;
3278                 linux)  osname=linux
3279                         case "$3" in
3280                         *)      osvers="$3" ;;
3281                         esac
3282                         ;;
3283                 MiNT)   osname=mint
3284                         ;;
3285                 netbsd*) osname=netbsd
3286                         osvers="$3"
3287                         ;;
3288                 news-os) osvers="$3"
3289                         case "$3" in
3290                         4*) osname=newsos4 ;;
3291                         *) osname=newsos ;;
3292                         esac
3293                         ;;
3294                 next*) osname=next ;;
3295                 nonstop-ux) osname=nonstopux ;;
3296                 openbsd) osname=openbsd
3297                         osvers="$3"
3298                         ;;
3299                 os2)    osname=os2
3300                         osvers="$4"
3301                         ;;
3302                 POSIX-BC | posix-bc ) osname=posix-bc
3303                         osvers="$3"
3304                         ;;
3305                 powerux | power_ux | powermax_os | powermaxos | \
3306                 powerunix | power_unix) osname=powerux
3307                         osvers="$3"
3308                         ;;
3309                 qnx) osname=qnx
3310                         osvers="$4"
3311                         ;;
3312                 solaris) osname=solaris
3313                         case "$3" in
3314                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3315                         *)      osvers="$3" ;;
3316                         esac
3317                         ;;
3318                 sunos) osname=sunos
3319                         case "$3" in
3320                         5*) osname=solaris
3321                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3322                         *)      osvers="$3" ;;
3323                         esac
3324                         ;;
3325                 titanos) osname=titanos
3326                         case "$3" in
3327                         1*) osvers=1 ;;
3328                         2*) osvers=2 ;;
3329                         3*) osvers=3 ;;
3330                         4*) osvers=4 ;;
3331                         *)      osvers="$3" ;;
3332                         esac
3333                         ;;
3334                 ultrix) osname=ultrix
3335                         osvers="$3"
3336                         ;;
3337                 osf1|mls+)      case "$5" in
3338                                 alpha)
3339                                         osname=dec_osf
3340                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3341                                         case "$osvers" in
3342                                         [1-9].[0-9]*) ;;
3343                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3344                                         esac
3345                                         ;;
3346                         hp*)    osname=hp_osf1  ;;
3347                         mips)   osname=mips_osf1 ;;
3348                         esac
3349                         ;;
3350                 # UnixWare 7.1.2 is known as Open UNIX 8
3351                 openunix|unixware) osname=svr5
3352                         osvers="$4"
3353                         ;;
3354                 uts)    osname=uts
3355                         osvers="$3"
3356                         ;;
3357                 vos) osvers="$3"
3358                         ;;
3359                 $2) case "$osname" in
3360                         *isc*) ;;
3361                         *freebsd*) ;;
3362                         svr*)
3363                                 : svr4.x or possibly later
3364                                 case "svr$3" in
3365                                 ${osname}*)
3366                                         osname=svr$3
3367                                         osvers=$4
3368                                         ;;
3369                                 esac
3370                                 case "$osname" in
3371                                 svr4.0)
3372                                         : Check for ESIX
3373                                         if test -f /stand/boot ; then
3374                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3375                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3376                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3377                                                         if test -n "$isesix"; then
3378                                                                 osname=esix4
3379                                                         fi
3380                                                 fi
3381                                         fi
3382                                         ;;
3383                                 esac
3384                                 ;;
3385                         *)      if test -f /etc/systemid; then
3386                                         osname=sco
3387                                         set `echo $3 | $sed 's/\./ /g'` $4
3388                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3389                                                 osvers=$1.$2.$3
3390                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3391                                                 osvers=$1.$2
3392                                         elif $test -f $src/hints/sco_$1.sh; then
3393                                                 osvers=$1
3394                                         fi
3395                                 else
3396                                         case "$osname" in
3397                                         '') : Still unknown.  Probably a generic Sys V.
3398                                                 osname="sysv"
3399                                                 osvers="$3"
3400                                                 ;;
3401                                         esac
3402                                 fi
3403                                 ;;
3404                         esac
3405                         ;;
3406                 *)      case "$osname" in
3407                         '') : Still unknown.  Probably a generic BSD.
3408                                 osname="$1"
3409                                 osvers="$3"
3410                                 ;;
3411                         esac
3412                         ;;
3413                 esac
3414         else
3415                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3416                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3417                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3418                                 osname=news_os
3419                         fi
3420                         $rm -f UU/kernel.what
3421                 elif test -d c:/. -o -n "$is_os2" ; then
3422                         set X $myuname
3423                         osname=os2
3424                         osvers="$5"
3425                 fi
3426         fi
3427
3428         case "$targetarch" in
3429         '') ;;
3430         *)  hostarch=$osname
3431             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3432             osvers=''
3433             ;;
3434         esac
3435
3436         : Now look for a hint file osname_osvers, unless one has been
3437         : specified already.
3438         case "$hintfile" in
3439         ''|' ')
3440                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3441                 : Also try without trailing minor version numbers.
3442                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3443                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3444                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3445                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3446                 case "$file" in
3447                 '') dflt=none ;;
3448                 *)  case "$osvers" in
3449                         '') dflt=$file
3450                                 ;;
3451                         *)  if $test -f $src/hints/$file.sh ; then
3452                                         dflt=$file
3453                                 elif $test -f $src/hints/$xfile.sh ; then
3454                                         dflt=$xfile
3455                                 elif $test -f $src/hints/$xxfile.sh ; then
3456                                         dflt=$xxfile
3457                                 elif $test -f $src/hints/$xxxfile.sh ; then
3458                                         dflt=$xxxfile
3459                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3460                                         dflt=$xxxxfile
3461                                 elif $test -f "$src/hints/${osname}.sh" ; then
3462                                         dflt="${osname}"
3463                                 else
3464                                         dflt=none
3465                                 fi
3466                                 ;;
3467                         esac
3468                         ;;
3469                 esac
3470                 if $test -f Policy.sh ; then
3471                         case "$dflt" in
3472                         *Policy*) ;;
3473                         none) dflt="Policy" ;;
3474                         *) dflt="Policy $dflt" ;;
3475                         esac
3476                 fi
3477                 ;;
3478         *)
3479                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3480                 ;;
3481         esac
3482
3483         if $test -f Policy.sh ; then
3484                 $cat <<EOM
3485
3486 There's also a Policy hint file available, which should make the
3487 site-specific (policy) questions easier to answer.
3488 EOM
3489
3490         fi
3491
3492         $cat <<EOM
3493
3494 You may give one or more space-separated answers, or "none" if appropriate.
3495 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3496 previous run of Configure, you may specify it as well as or instead of
3497 OS-specific hints.  If hints are provided for your OS, you should use them:
3498 although Perl can probably be built without hints on many platforms, using
3499 hints often improve performance and may enable features that Configure can't
3500 set up on its own. If there are no hints that match your OS, specify "none";
3501 DO NOT give a wrong version or a wrong OS.
3502
3503 EOM
3504
3505         rp="Which of these apply, if any?"
3506         . UU/myread
3507         tans=$ans
3508         for file in $tans; do
3509                 if $test X$file = XPolicy -a -f Policy.sh; then
3510                         . Policy.sh
3511                         $cat Policy.sh >> UU/config.sh
3512                 elif $test -f $src/hints/$file.sh; then
3513                         . $src/hints/$file.sh
3514                         $cat $src/hints/$file.sh >> UU/config.sh
3515                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3516                         : nothing
3517                 else
3518                         : Give one chance to correct a possible typo.
3519                         echo "$file.sh does not exist"
3520                         dflt=$file
3521                         rp="hint to use instead?"
3522                         . UU/myread
3523                         for file in $ans; do
3524                                 if $test -f "$src/hints/$file.sh"; then
3525                                         . $src/hints/$file.sh
3526                                         $cat $src/hints/$file.sh >> UU/config.sh
3527                                 elif $test X$ans = X -o X$ans = Xnone ; then
3528                                         : nothing
3529                                 else
3530                                         echo "$file.sh does not exist -- ignored."
3531                                 fi
3532                         done
3533                 fi
3534         done
3535
3536         hint=recommended
3537         : Remember our hint file for later.
3538         if $test -f "$src/hints/$file.sh" ; then
3539                 hintfile="$file"
3540         else
3541                 hintfile=''
3542         fi
3543 fi
3544 cd UU
3545 ;;
3546 *)
3547         echo " "
3548         echo "Fetching default answers from $config_sh..." >&4
3549         tmp_n="$n"
3550         tmp_c="$c"
3551         cd ..
3552         cp $config_sh config.sh 2>/dev/null
3553         chmod +w config.sh
3554         . ./config.sh
3555         cd UU
3556         cp ../config.sh .
3557         n="$tmp_n"
3558         c="$tmp_c"
3559         hint=previous
3560         ;;
3561 esac
3562 test "$override" && . ./optdef.sh
3563
3564 : Restore computed paths
3565 for file in $loclist $trylist; do
3566         eval $file="\$_$file"
3567 done
3568
3569 cat << EOM
3570
3571 Configure uses the operating system name and version to set some defaults.
3572 The default value is probably right if the name rings a bell. Otherwise,
3573 since spelling matters for me, either accept the default or answer "none"
3574 to leave it blank.
3575
3576 EOM
3577 case "$osname" in
3578         ''|' ')
3579                 case "$hintfile" in
3580                 ''|' '|none) dflt=none ;;
3581                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3582                 esac
3583                 ;;
3584         *) dflt="$osname" ;;
3585 esac
3586 rp="Operating system name?"
3587 . ./myread
3588 case "$ans" in
3589 none)  osname='' ;;
3590 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3591 esac
3592 echo " "
3593 case "$osvers" in
3594         ''|' ')
3595                 case "$hintfile" in
3596                 ''|' '|none) dflt=none ;;
3597                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3598                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3599                         case "$dflt" in
3600                         ''|' ') dflt=none ;;
3601                         esac
3602                         ;;
3603                 esac
3604                 ;;
3605         *) dflt="$osvers" ;;
3606 esac
3607 rp="Operating system version?"
3608 . ./myread
3609 case "$ans" in
3610 none)  osvers='' ;;
3611 *) osvers="$ans" ;;
3612 esac
3613
3614
3615 . ./posthint.sh
3616
3617 : who configured the system
3618 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3619 case "$cf_by" in
3620 "")
3621         cf_by=`(logname) 2>/dev/null`
3622         case "$cf_by" in
3623         "")
3624                 cf_by=`(whoami) 2>/dev/null`
3625                 case "$cf_by" in
3626                 "") cf_by=unknown ;;
3627                 esac ;;
3628         esac ;;
3629 esac
3630
3631 : decide how portable to be.  Allow command line overrides.
3632 case "$d_portable" in
3633 "$undef") ;;
3634 *)      d_portable="$define" ;;
3635 esac
3636
3637 : set up shell script to do ~ expansion
3638 cat >filexp <<EOSS
3639 $startsh
3640 : expand filename
3641 case "\$1" in
3642  \~/*|\~)
3643         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3644         ;;
3645  \~*)
3646         if $test -f /bin/csh; then
3647                 /bin/csh -f -c "glob \$1"
3648                 failed=\$?
3649                 echo ""
3650                 exit \$failed
3651         else
3652                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3653                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3654                 if $test ! -d "\$dir"; then
3655                         me=\`basename \$0\`
3656                         echo "\$me: can't locate home directory for: \$name" >&2
3657                         exit 1
3658                 fi
3659                 case "\$1" in
3660                 */*)
3661                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3662                         ;;
3663                 *)
3664                         echo \$dir
3665                         ;;
3666                 esac
3667         fi
3668         ;;
3669 *)
3670         echo \$1
3671         ;;
3672 esac
3673 EOSS
3674 chmod +x filexp
3675 $eunicefix filexp
3676
3677 : now set up to get a file name
3678 cat <<EOS >getfile
3679 $startsh
3680 EOS
3681 cat <<'EOSC' >>getfile
3682 tilde=''
3683 fullpath=''
3684 already=''
3685 skip=''
3686 none_ok=''
3687 exp_file=''
3688 nopath_ok=''
3689 orig_rp="$rp"
3690 orig_dflt="$dflt"
3691 case "$gfpth" in
3692 '') gfpth='.' ;;
3693 esac
3694
3695 case "$fn" in
3696 *\(*)
3697         : getfile will accept an answer from the comma-separated list
3698         : enclosed in parentheses even if it does not meet other criteria.
3699         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3700         fn=`echo $fn | sed 's/(.*)//'`
3701         ;;
3702 esac
3703
3704 case "$fn" in
3705 *:*)
3706         loc_file=`expr $fn : '.*:\(.*\)'`
3707         fn=`expr $fn : '\(.*\):.*'`
3708         ;;
3709 esac
3710
3711 case "$fn" in
3712 *~*) tilde=true;;
3713 esac
3714 case "$fn" in
3715 */*) fullpath=true;;
3716 esac
3717 case "$fn" in
3718 *+*) skip=true;;
3719 esac
3720 case "$fn" in
3721 *n*) none_ok=true;;
3722 esac
3723 case "$fn" in
3724 *e*) exp_file=true;;
3725 esac
3726 case "$fn" in
3727 *p*) nopath_ok=true;;
3728 esac
3729
3730 case "$fn" in
3731 *f*) type='File';;
3732 *d*) type='Directory';;
3733 *l*) type='Locate';;
3734 esac
3735
3736 what="$type"
3737 case "$what" in
3738 Locate) what='File';;
3739 esac
3740
3741 case "$exp_file" in
3742 '')
3743         case "$d_portable" in
3744         "$define") ;;
3745         *) exp_file=true;;
3746         esac
3747         ;;
3748 esac
3749
3750 cd ..
3751 while test "$type"; do
3752         redo=''
3753         rp="$orig_rp"
3754         dflt="$orig_dflt"
3755         case "$tilde" in
3756         true) rp="$rp (~name ok)";;
3757         esac
3758         . UU/myread
3759         if test -f UU/getfile.ok && \
3760                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3761         then
3762                 value="$ans"
3763                 ansexp="$ans"
3764                 break
3765         fi
3766         case "$ans" in
3767         none)
3768                 value=''
3769                 ansexp=''
3770                 case "$none_ok" in
3771                 true) type='';;
3772                 esac
3773                 ;;
3774         *)
3775                 case "$tilde" in
3776                 '') value="$ans"
3777                         ansexp="$ans";;
3778                 *)
3779                         value=`UU/filexp $ans`
3780                         case $? in
3781                         0)
3782                                 if test "$ans" != "$value"; then
3783                                         echo "(That expands to $value on this system.)"
3784                                 fi
3785                                 ;;
3786                         *) value="$ans";;
3787                         esac
3788                         ansexp="$value"
3789                         case "$exp_file" in
3790                         '') value="$ans";;
3791                         esac
3792                         ;;
3793                 esac
3794                 case "$fullpath" in
3795                 true)
3796                         case "$ansexp" in
3797                         /*) value="$ansexp" ;;
3798                         [a-zA-Z]:/*) value="$ansexp" ;;
3799                         *)
3800                                 redo=true
3801                                 case "$already" in
3802                                 true)
3803                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3804                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3805                                         ;;
3806                                 *)
3807                                 echo "Please give a full path name, starting with slash." >&4
3808                                         case "$tilde" in
3809                                         true)
3810                                 echo "Note that using ~name is ok provided it expands well." >&4
3811                                                 already=true
3812                                                 ;;
3813                                         esac
3814                                 esac
3815                                 ;;
3816                         esac
3817                         ;;
3818                 esac
3819                 case "$redo" in
3820                 '')
3821                         case "$type" in
3822                         File)
3823                                 for fp in $gfpth; do
3824                                         if test "X$fp" = X.; then
3825                                             pf="$ansexp"
3826                                         else    
3827                                             pf="$fp/$ansexp"
3828                                         fi
3829                                         if test -f "$pf"; then
3830                                                 type=''
3831                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3832                                         then
3833                                                 echo "($value is not a plain file, but that's ok.)"
3834                                                 type=''
3835                                         fi
3836                                         if test X"$type" = X; then
3837                                             value="$pf"
3838                                             break
3839                                         fi
3840                                 done
3841                                 ;;
3842                         Directory)
3843                                 for fp in $gfpth; do
3844                                         if test "X$fp" = X.; then
3845                                             dir="$ans"
3846                                             direxp="$ansexp"
3847                                         else    
3848                                             dir="$fp/$ansexp"
3849                                             direxp="$fp/$ansexp"
3850                                         fi
3851                                         if test -d "$direxp"; then
3852                                                 type=''
3853                                                 value="$dir"
3854                                                 break
3855                                         fi
3856                                 done
3857                                 ;;
3858                         Locate)
3859                                 if test -d "$ansexp"; then
3860                                         echo "(Looking for $loc_file in directory $value.)"
3861                                         value="$value/$loc_file"
3862                                         ansexp="$ansexp/$loc_file"
3863                                 fi
3864                                 if test -f "$ansexp"; then
3865                                         type=''
3866                                 fi
3867                                 case "$nopath_ok" in
3868                                 true)   case "$value" in
3869                                         */*) ;;
3870                                         *)      echo "Assuming $value will be in people's path."
3871                                                 type=''
3872                                                 ;;
3873                                         esac
3874                                         ;;
3875                                 esac
3876                                 ;;
3877                         esac
3878
3879                         case "$skip" in
3880                         true) type='';
3881                         esac
3882
3883                         case "$type" in
3884                         '') ;;
3885                         *)
3886                                 if test "$fastread" = yes; then
3887                                         dflt=y
3888                                 else
3889                                         dflt=n
3890                                 fi
3891                                 rp="$what $value doesn't exist.  Use that name anyway?"
3892                                 . UU/myread
3893                                 dflt=''
3894                                 case "$ans" in
3895                                 y*) type='';;
3896                                 *) echo " ";;
3897                                 esac
3898                                 ;;
3899                         esac
3900                         ;;
3901                 esac
3902                 ;;
3903         esac
3904 done
3905 cd UU
3906 ans="$value"
3907 rp="$orig_rp"
3908 dflt="$orig_dflt"
3909 rm -f getfile.ok
3910 test "X$gfpthkeep" != Xy && gfpth=""
3911 EOSC
3912
3913 : determine root of directory hierarchy where package will be installed.
3914 case "$prefix" in
3915 '')
3916         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3917         ;;
3918 *?/)
3919         dflt=`echo "$prefix" | sed 's/.$//'`
3920         ;;
3921 *)
3922         dflt="$prefix"
3923         ;;
3924 esac
3925 $cat <<EOM
3926
3927 By default, $package will be installed in $dflt/bin, manual pages
3928 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3929 installation directories. Typically this is something like /usr/local.
3930 If you wish to have binaries under /usr/bin but other parts of the
3931 installation under /usr/local, that's ok: you will be prompted
3932 separately for each of the installation directories, the prefix being
3933 only used to set the defaults.
3934
3935 EOM
3936 fn=d~
3937 rp='Installation prefix to use?'
3938 . ./getfile
3939 oldprefix=''
3940 case "$prefix" in
3941 '') ;;
3942 *)
3943         case "$ans" in
3944         "$prefix") ;;
3945         *) oldprefix="$prefix";;
3946         esac
3947         ;;
3948 esac
3949 prefix="$ans"
3950 prefixexp="$ansexp"
3951
3952 : allow them to override the AFS root
3953 case "$afsroot" in
3954 '')     afsroot=/afs ;;
3955 *)      afsroot=$afsroot ;;
3956 esac
3957
3958 : is AFS running?
3959 echo " "
3960 case "$afs" in
3961 $define|true)   afs=true ;;
3962 $undef|false)   afs=false ;;
3963 *)      if $test -d $afsroot; then
3964                 afs=true
3965         else
3966                 afs=false
3967         fi
3968         ;;
3969 esac
3970 if $afs; then
3971         echo "AFS may be running... I'll be extra cautious then..." >&4
3972 else
3973         echo "AFS does not seem to be running..." >&4
3974 fi
3975
3976 : determine installation prefix for where package is to be installed.
3977 if $afs; then 
3978 $cat <<EOM
3979
3980 Since you are running AFS, I need to distinguish the directory in which
3981 files will reside from the directory in which they are installed (and from
3982 which they are presumably copied to the former directory by occult means).
3983
3984 EOM
3985         case "$installprefix" in
3986         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3987         *) dflt="$installprefix";;
3988         esac
3989 else
3990 $cat <<EOM
3991
3992 In some special cases, particularly when building $package for distribution,
3993 it is convenient to distinguish the directory in which files should be
3994 installed from the directory ($prefix) in which they will
3995 eventually reside.  For most users, these two directories are the same.
3996
3997 EOM
3998         case "$installprefix" in
3999         '') dflt=$prefix ;;
4000         *) dflt=$installprefix;;
4001         esac
4002 fi
4003 fn=d~
4004 rp='What installation prefix should I use for installing files?'
4005 . ./getfile
4006 installprefix="$ans"
4007 installprefixexp="$ansexp"
4008
4009 : Perform the prefixexp/installprefixexp correction if necessary
4010 cat <<EOS >installprefix
4011 $startsh
4012 EOS
4013 cat <<'EOSC' >>installprefix
4014 : Change installation prefix, if necessary.
4015 if $test X"$prefix" != X"$installprefix"; then
4016     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4017 else
4018     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4019 fi
4020 EOSC
4021 chmod +x installprefix
4022 $eunicefix installprefix
4023
4024 : Set variables such as privlib and privlibexp from the output of ./getfile
4025 : performing the prefixexp/installprefixexp correction if necessary.
4026 cat <<EOS >setprefixvar
4027 $startsh
4028 EOS
4029 cat <<'EOSC' >>setprefixvar
4030 eval "${prefixvar}=\"\$ans\""
4031 eval "${prefixvar}exp=\"\$ansexp\""
4032 . ./installprefix
4033 EOSC
4034 chmod +x setprefixvar
4035 $eunicefix setprefixvar
4036
4037 : set up the script used to warn in case of inconsistency
4038 cat <<EOS >whoa
4039 $startsh
4040 EOS
4041 cat <<'EOSC' >>whoa
4042 dflt=y
4043 case "$hint" in
4044     recommended)
4045         case "$hintfile" in
4046         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4047                 ;;
4048         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4049                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4050                 ;;
4051         esac
4052         ;;
4053     *)  echo " "
4054         echo "*** WHOA THERE!!! ***" >&4
4055         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4056         ;;
4057 esac
4058 rp="    Keep the $hint value?"
4059 . ./myread
4060 case "$ans" in
4061 y) td=$was; tu=$was;;
4062 esac
4063 EOSC
4064
4065 : function used to set '$1' to '$val'
4066 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4067 case "$val$was" in
4068 $define$undef) . ./whoa; eval "$var=\$td";;
4069 $undef$define) . ./whoa; eval "$var=\$tu";;
4070 *) eval "$var=$val";;
4071 esac'
4072
4073 : Check is we will use socks
4074 case "$usesocks" in
4075 $define|true|[yY]*)     dflt='y';;
4076 *) dflt='n';;
4077 esac
4078 cat <<EOM
4079
4080 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4081 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4082 to use the PerlIO abstraction layer, this will be implicitly selected.
4083
4084 If this doesn't make any sense to you, just accept the default '$dflt'.
4085 EOM
4086 rp='Build Perl for SOCKS?'
4087 . ./myread
4088 case "$ans" in
4089 y|Y)    val="$define" ;;
4090 *)      val="$undef" ;;
4091 esac
4092 set usesocks
4093 eval $setvar
4094
4095 case "$usesocks" in
4096 $define|true|[yY]*) useperlio="$define";;
4097 esac
4098
4099 : Check if we want perlio
4100 case "$useperlio" in
4101 $define|true|[yY]*|'')  dflt='y';;
4102 *) dflt='n';;
4103 esac
4104 cat <<EOM
4105
4106 Previous version of $package used the standard IO mechanisms as
4107 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4108 alternate IO mechanisms via the PerlIO abstraction layer, but the
4109 stdio mechanism is still available if needed.  The abstraction layer
4110 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4111 Using PerlIO with sfio may cause problems with some extension modules.
4112
4113 If this doesn't make any sense to you, just accept the default '$dflt'.
4114 EOM
4115 rp='Use the PerlIO abstraction layer?'
4116 . ./myread
4117 case "$ans" in
4118 y|Y)
4119         val="$define"
4120         ;;
4121 *)
4122         echo "Ok, doing things the stdio way."
4123         val="$undef"
4124         ;;
4125 esac
4126 set useperlio
4127 eval $setvar
4128
4129 case "$usesocks" in
4130 $define|true|[yY]*)
4131         case "$useperlio" in
4132         $define|true|[yY]*) ;;
4133         *)      cat >&4 <<EOM
4134
4135 You are using the SOCKS proxy protocol library which means that you
4136 should also use the PerlIO layer.  You may be headed for trouble.
4137
4138 EOM
4139                 ;;
4140         esac
4141         ;;
4142 esac
4143
4144 : get the patchlevel
4145 echo " "
4146 echo "Getting the current patchlevel..." >&4
4147 if $test -r $rsrc/patchlevel.h;then
4148         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4149         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4150         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4151         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4152         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4153         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4154         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4155 else
4156         revision=0
4157         patchlevel=0
4158         subversion=0
4159         api_revision=0
4160         api_version=0
4161         api_subversion=0
4162         perl_patchlevel=0
4163         $echo "(You do not have patchlevel.h.  Eek.)"
4164 fi
4165 if $test -r $rsrc/.patch ; then
4166         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4167                 perl_patchlevel=`cat $rsrc/.patch`
4168         fi
4169 fi
4170 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4171 version_patchlevel_string="version $patchlevel subversion $subversion"
4172 case "$perl_patchlevel" in
4173 0|'') ;;
4174 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4175     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4176     ;;
4177 esac
4178
4179 $echo "(You have $package $version_patchlevel_string.)"
4180
4181 case "$osname" in
4182 dos|vms)
4183         : XXX Should be a Configure test for double-dots in filenames.
4184         version=`echo $revision $patchlevel $subversion | \
4185                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4186         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4187                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4188         ;;
4189 *)
4190         version=`echo $revision $patchlevel $subversion | \
4191                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4192         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4193                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4194         ;;
4195 esac
4196 : Special case the 5.005_xx maintenance series, which used 5.005
4197 : without any subversion label as a subdirectory in $sitelib
4198 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4199         api_versionstring='5.005'
4200 fi
4201
4202 : Do we want threads support and if so, what type
4203 case "$usethreads" in
4204 $define|true|[yY]*)     dflt='y';;
4205 *)     # Catch case where user specified ithreads or 5005threads but
4206        # forgot -Dusethreads (A.D. 4/2002)
4207        case "$useithreads$use5005threads" in
4208        *$define*)
4209                 case "$useperlio" in
4210                 "$define")      dflt='y' ;;
4211                 *)              dflt='n' ;;
4212                 esac
4213                 ;;
4214        *)       dflt='n';;
4215        esac
4216        ;;
4217 esac
4218 cat <<EOM
4219
4220 Perl can be built to take advantage of threads on some systems.
4221 To do so, Configure can be run with -Dusethreads.
4222
4223 Note that Perl built with threading support runs slightly slower
4224 and uses more memory than plain Perl. The current implementation
4225 is believed to be stable, but it is fairly new, and so should be
4226 treated with caution.
4227
4228 If this doesn't make any sense to you, just accept the default '$dflt'.
4229 EOM
4230 rp='Build a threading Perl?'
4231 . ./myread
4232 case "$ans" in
4233 y|Y)    val="$define" ;;
4234 *)      val="$undef" ;;
4235 esac
4236 set usethreads
4237 eval $setvar
4238
4239 if $test $patchlevel -lt 9; then
4240     case "$usethreads" in
4241     $define)
4242         $cat <<EOM
4243
4244 Since release 5.6, Perl has had two different threading implementations,
4245 the newer interpreter-based version (ithreads) with one interpreter per
4246 thread, and the older 5.005 version (5005threads).
4247 The 5005threads version is effectively unmaintained and will probably be
4248 removed in Perl 5.10, so there should be no need to build a Perl using it
4249 unless needed for backwards compatibility with some existing 5.005threads
4250 code.
4251
4252 EOM
4253         : Default to ithreads unless overridden on command line or with
4254         : old config.sh
4255         dflt='y'
4256         case "$use5005threads" in
4257                 $define|true|[yY]*) dflt='n';;
4258         esac
4259         case "$useithreads" in
4260                 $undef|false|[nN]*) dflt='n';;
4261         esac
4262         rp='Use the newer interpreter-based ithreads?'
4263         . ./myread
4264         case "$ans" in
4265         y|Y)    val="$define" ;;
4266         *)      val="$undef" ;;
4267         esac
4268         set useithreads
4269         eval $setvar
4270         : Now set use5005threads to the opposite value.
4271         case "$useithreads" in
4272         $define) val="$undef" ;;
4273         *) val="$define" ;;
4274         esac
4275         set use5005threads
4276         eval $setvar
4277         ;;
4278     *)
4279         useithreads="$undef"
4280         use5005threads="$undef"
4281         ;;
4282     esac
4283
4284     case "$useithreads$use5005threads" in
4285     "$define$define")
4286         $cat >&4 <<EOM
4287
4288 You cannot have both the ithreads and the 5.005 threads enabled
4289 at the same time.  Disabling the 5.005 threads since they are
4290 much less stable than the ithreads.
4291
4292 EOM
4293         use5005threads="$undef"
4294         ;;
4295     esac
4296
4297 else
4298 : perl-5.9.x and later
4299
4300     if test X"$usethreads" = "X$define"; then
4301         case "$use5005threads" in
4302             $define|true|[yY]*)
4303                 $cat >&4 <<EOM
4304
4305 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4306
4307 EOM
4308             ;;
4309         esac
4310     fi
4311
4312     use5005threads="$undef"
4313     useithreads="$usethreads"
4314 fi
4315
4316 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4317         cat >&4 <<EOF
4318 ***
4319 *** To build with ithreads you must also use the PerlIO layer.
4320 *** Cannot continue, aborting.
4321 ***
4322 EOF
4323         exit 1
4324 fi
4325
4326 case "$d_oldpthreads" in
4327 '')     : Configure tests would be welcome here.  For now, assume undef.
4328         val="$undef" ;;
4329 *)      val="$d_oldpthreads" ;;
4330 esac
4331 set d_oldpthreads
4332 eval $setvar
4333
4334
4335 : Look for a hint-file generated 'call-back-unit'.  If the
4336 : user has specified that a threading perl is to be built,
4337 : we may need to set or change some other defaults.
4338 if $test -f usethreads.cbu; then
4339     echo "Your platform has some specific hints regarding threaded builds, using them..."
4340     . ./usethreads.cbu
4341 else
4342     case "$usethreads" in
4343         "$define"|true|[yY]*)
4344                 $cat <<EOM
4345 (Your platform does not have any specific hints for threaded builds.
4346  Assuming POSIX threads, then.)
4347 EOM
4348         ;;
4349     esac
4350 fi
4351
4352 : Check if multiplicity is required
4353 cat <<EOM
4354
4355 Perl can be built so that multiple Perl interpreters can coexist
4356 within the same Perl executable.
4357 EOM
4358
4359 case "$useithreads" in
4360 $define)
4361         cat <<EOM
4362 This multiple interpreter support is required for interpreter-based threads.
4363 EOM
4364         val="$define"
4365         ;;
4366 *)      case "$usemultiplicity" in
4367         $define|true|[yY]*)     dflt='y';;
4368         *) dflt='n';;
4369         esac
4370         echo " "
4371         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4372         rp='Build Perl for multiplicity?'
4373         . ./myread
4374         case "$ans" in
4375         y|Y)    val="$define" ;;
4376         *)      val="$undef" ;;
4377         esac
4378         ;;
4379 esac
4380 set usemultiplicity
4381 eval $setvar
4382
4383 : Check if morebits is requested
4384 case "$usemorebits" in
4385 "$define"|true|[yY]*)
4386         use64bitint="$define"
4387         uselongdouble="$define"
4388         usemorebits="$define"
4389         ;;
4390 *)      usemorebits="$undef"
4391         ;;
4392 esac
4393
4394 : Determine the C compiler to be used
4395 echo " "
4396 case "$cc" in
4397 '') dflt=cc;;
4398 *) dflt="$cc";;
4399 esac
4400 rp="Use which C compiler?"
4401 . ./myread
4402 cc="$ans"
4403
4404 : See whether they have no cc but they do have gcc
4405 . ./trygcc
4406 if $test -f cc.cbu; then
4407     . ./cc.cbu
4408 fi
4409 . ./checkcc
4410
4411 : make some quick guesses about what we are up against
4412 echo " "
4413 $echo $n "Hmm...  $c"
4414 echo exit 1 >bsd
4415 echo exit 1 >usg
4416 echo exit 1 >v7
4417 echo exit 1 >osf1
4418 echo exit 1 >eunice
4419 echo exit 1 >xenix
4420 echo exit 1 >venix
4421 echo exit 1 >os2
4422 d_bsd="$undef"
4423 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4424 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4425 then
4426         echo "Looks kind of like an OSF/1 system, but we'll see..."
4427         echo exit 0 >osf1
4428 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4429         xxx=`./loc addbib blurfl $pth`
4430         if $test -f $xxx; then
4431         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4432                 echo exit 0 >bsd
4433                 echo exit 0 >usg
4434         else
4435                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4436                         echo "Looks kind of like an extended USG system, but we'll see..."
4437                 else
4438                         echo "Looks kind of like a USG system, but we'll see..."
4439                 fi
4440                 echo exit 0 >usg
4441         fi
4442 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4443         echo "Looks kind of like a BSD system, but we'll see..."
4444         d_bsd="$define"
4445         echo exit 0 >bsd
4446 else
4447         echo "Looks kind of like a Version 7 system, but we'll see..."
4448         echo exit 0 >v7
4449 fi
4450 case "$eunicefix" in
4451 *unixtovms*)
4452         $cat <<'EOI'
4453 There is, however, a strange, musty smell in the air that reminds me of
4454 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4455 EOI
4456         echo exit 0 >eunice
4457         d_eunice="$define"
4458 : it so happens the Eunice I know will not run shell scripts in Unix format
4459         ;;
4460 *)
4461         echo " "
4462         echo "Congratulations.  You aren't running Eunice."
4463         d_eunice="$undef"
4464         ;;
4465 esac
4466 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4467 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4468 : semicolon as a patch separator
4469 case "$p_" in
4470 :) ;;
4471 *)
4472         $cat <<'EOI'
4473 I have the feeling something is not exactly right, however...don't tell me...
4474 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4475 (Or you may be running DOS with DJGPP.)
4476 EOI
4477         echo exit 0 >os2
4478         ;;
4479 esac
4480 if test -f /xenix; then
4481         echo "Actually, this looks more like a XENIX system..."
4482         echo exit 0 >xenix
4483         d_xenix="$define"
4484 else
4485         echo " "
4486         echo "It's not Xenix..."
4487         d_xenix="$undef"
4488 fi
4489 chmod +x xenix
4490 $eunicefix xenix
4491 if test -f /venix; then
4492         echo "Actually, this looks more like a VENIX system..."
4493         echo exit 0 >venix
4494 else
4495         echo " "
4496         if ./xenix; then
4497                 : null
4498         else
4499                 echo "Nor is it Venix..."
4500         fi
4501 fi
4502 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4503 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4504 $rm -f foo
4505
4506 : Check if we are using GNU gcc and what its version is
4507 echo " "
4508 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4509 $cat >try.c <<EOM
4510 #include <stdio.h>
4511 int main() {
4512 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4513 #ifdef __VERSION__
4514         printf("%s\n", __VERSION__);
4515 #else
4516         printf("%s\n", "1");
4517 #endif
4518 #endif
4519         return(0);
4520 }
4521 EOM
4522 if $cc -o try $ccflags $ldflags try.c; then
4523         gccversion=`$run ./try`
4524         case "$gccversion" in
4525         '') echo "You are not using GNU cc." ;;
4526         *)  echo "You are using GNU cc $gccversion."
4527             ccname=gcc
4528             ;;
4529         esac
4530 else
4531         echo " "
4532         echo "*** WHOA THERE!!! ***" >&4
4533         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4534         case "$knowitall" in
4535         '')
4536         echo "    You'd better start hunting for one and let me know about it." >&4
4537                 exit 1
4538                 ;;
4539         esac
4540 fi
4541 $rm -f try try.*
4542 case "$gccversion" in
4543 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4544 esac
4545 case "$gccversion" in
4546 '') gccosandvers='' ;;
4547 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4548    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4549    gccshortvers=''
4550    case "$gccosandvers" in
4551    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4552    $osname$osvers) ;; # looking good
4553    $osname*) cat <<EOM >&4
4554
4555 *** WHOA THERE!!! ***
4556
4557     Your gcc has not been compiled for the exact release of
4558     your operating system ($gccosandvers versus $osname$osvers).
4559
4560     In general it is a good idea to keep gcc synchronized with
4561     the operating system because otherwise serious problems
4562     may ensue when trying to compile software, like Perl.
4563
4564     I'm trying to be optimistic here, though, and will continue.
4565     If later during the configuration and build icky compilation
4566     problems appear (headerfile conflicts being the most common
4567     manifestation), I suggest reinstalling the gcc to match
4568     your operating system release.
4569
4570 EOM
4571       ;;
4572    *) gccosandvers='' ;; # failed to parse, better be silent
4573    esac
4574    ;;
4575 esac
4576 case "$ccname" in
4577 '') ccname="$cc" ;;
4578 esac
4579
4580 # gcc 3.* complain about adding -Idirectories that they already know about,
4581 # so we will take those off from locincpth.
4582 case "$gccversion" in
4583 3*)
4584     echo "main(){}">try.c
4585     for incdir in $locincpth; do
4586        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4587              grep '^c[cp]p*[01]: warning: changing search order '`
4588        if test "X$warn" != X; then
4589            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4590        fi
4591     done
4592     $rm -f try try.*
4593 esac
4594
4595 : What should the include directory be ?
4596 echo " "
4597 $echo $n "Hmm...  $c"
4598 dflt='/usr/include'
4599 incpath=''
4600 mips_type=''
4601 if $test -f /bin/mips && /bin/mips; then
4602         echo "Looks like a MIPS system..."
4603         $cat >usr.c <<'EOCP'
4604 #ifdef SYSTYPE_BSD43
4605 /bsd43
4606 #endif
4607 EOCP
4608         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4609                 dflt='/bsd43/usr/include'
4610                 incpath='/bsd43'
4611                 mips_type='BSD 4.3'
4612         else
4613                 mips_type='System V'
4614         fi
4615         $rm -f usr.c usr.out
4616         echo "and you're compiling with the $mips_type compiler and libraries."
4617         xxx_prompt=y
4618         echo "exit 0" >mips
4619 else
4620         echo "Doesn't look like a MIPS system."
4621         xxx_prompt=n
4622         echo "exit 1" >mips
4623 fi
4624 chmod +x mips
4625 $eunicefix mips
4626 case "$usrinc" in
4627 '') ;;
4628 *) dflt="$usrinc";;
4629 esac
4630 case "$xxx_prompt" in
4631 y)      fn=d/
4632         echo " "
4633         rp='Where are the include files you want to use?'
4634         . ./getfile
4635         usrinc="$ans"
4636         ;;
4637 *)      usrinc="$dflt"
4638         ;;
4639 esac
4640
4641 : see how we invoke the C preprocessor
4642 echo " "
4643 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4644 cat <<'EOT' >testcpp.c
4645 #define ABC abc
4646 #define XYZ xyz
4647 ABC.XYZ
4648 EOT
4649 cd ..
4650 if test ! -f cppstdin; then
4651         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4652                 # AIX cc -E doesn't show the absolute headerfile
4653                 # locations but we'll cheat by using the -M flag.
4654                 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
4655         else
4656                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4657         fi
4658 else
4659         echo "Keeping your $hint cppstdin wrapper."
4660 fi
4661 chmod 755 cppstdin
4662 wrapper=`pwd`/cppstdin
4663 ok='false'
4664 cd UU
4665
4666 if $test "X$cppstdin" != "X" && \
4667         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4668         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4669 then
4670         echo "You used to use $cppstdin $cppminus so we'll use that again."
4671         case "$cpprun" in
4672         '') echo "But let's see if we can live without a wrapper..." ;;
4673         *)
4674                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4675                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4676                 then
4677                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4678                         ok='true'
4679                 else
4680                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4681                 fi
4682                 ;;
4683         esac
4684 else
4685         case "$cppstdin" in
4686         '') ;;
4687         *)
4688                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4689                 ;;
4690         esac
4691 fi
4692
4693 if $ok; then
4694         : nothing
4695 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4696         $cc -E <testcpp.c >testcpp.out 2>&1; \
4697         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4698         echo "Yup, it does."
4699         x_cpp="$cc -E"
4700         x_minus='';
4701 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4702         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4703         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4704         echo "Yup, it does."
4705         x_cpp="$cc -E"
4706         x_minus='-';
4707 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4708         $cc -P <testcpp.c >testcpp.out 2>&1; \
4709         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4710         echo "Yipee, that works!"
4711         x_cpp="$cc -P"
4712         x_minus='';
4713 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4714         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4715         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4716         echo "At long last!"
4717         x_cpp="$cc -P"
4718         x_minus='-';
4719 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4720         $cpp <testcpp.c >testcpp.out 2>&1; \
4721         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4722         echo "It works!"
4723         x_cpp="$cpp"
4724         x_minus='';
4725 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4726         $cpp - <testcpp.c >testcpp.out 2>&1; \
4727         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4728         echo "Hooray, it works!  I was beginning to wonder."
4729         x_cpp="$cpp"
4730         x_minus='-';
4731 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4732         $wrapper <testcpp.c >testcpp.out 2>&1; \
4733         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4734         x_cpp="$wrapper"
4735         x_minus=''
4736         echo "Eureka!"
4737 else
4738         dflt=''
4739         rp="No dice.  I can't find a C preprocessor.  Name one:"
4740         . ./myread
4741         x_cpp="$ans"
4742         x_minus=''
4743         $x_cpp <testcpp.c >testcpp.out 2>&1
4744         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4745                 echo "OK, that will do." >&4
4746         else
4747 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4748                 exit 1
4749         fi
4750 fi
4751
4752 case "$ok" in
4753 false)
4754         cppstdin="$x_cpp"
4755         cppminus="$x_minus"
4756         cpprun="$x_cpp"
4757         cpplast="$x_minus"
4758         set X $x_cpp
4759         shift
4760         case "$1" in
4761         "$cpp")
4762                 echo "Perhaps can we force $cc -E using a wrapper..."
4763                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4764                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4765                 then
4766                         echo "Yup, we can."
4767                         cppstdin="$wrapper"
4768                         cppminus='';
4769                 else
4770                         echo "Nope, we'll have to live without it..."
4771                 fi
4772                 ;;
4773         esac
4774         case "$cpprun" in
4775         "$wrapper")
4776                 cpprun=''
4777                 cpplast=''
4778                 ;;
4779         esac
4780         ;;
4781 esac
4782
4783 case "$cppstdin" in
4784 "$wrapper"|'cppstdin') ;;
4785 *) $rm -f $wrapper;;
4786 esac
4787 $rm -f testcpp.c testcpp.out
4788
4789 : Set private lib path
4790 case "$plibpth" in
4791 '') if ./mips; then
4792                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4793         fi;;
4794 esac
4795 case "$libpth" in
4796 ' ') dlist='';;
4797 '') dlist="$loclibpth $plibpth $glibpth";;
4798 *) dlist="$libpth";;
4799 esac
4800
4801 : Now check and see which directories actually exist, avoiding duplicates
4802 libpth=''
4803 for xxx in $dlist
4804 do
4805     if $test -d $xxx; then
4806                 case " $libpth " in
4807                 *" $xxx "*) ;;
4808                 *) libpth="$libpth $xxx";;
4809                 esac
4810     fi
4811 done
4812 $cat <<'EOM'
4813
4814 Some systems have incompatible or broken versions of libraries.  Among
4815 the directories listed in the question below, please remove any you
4816 know not to be holding relevant libraries, and add any that are needed.
4817 Say "none" for none.
4818
4819 EOM
4820 case "$libpth" in
4821 '') dflt='none';;
4822 *)
4823         set X $libpth
4824         shift
4825         dflt=${1+"$@"}
4826         ;;
4827 esac
4828 rp="Directories to use for library searches?"
4829 . ./myread
4830 case "$ans" in
4831 none) libpth=' ';;
4832 *) libpth="$ans";;
4833 esac
4834
4835 : compute shared library extension
4836 case "$so" in
4837 '')
4838         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4839                 dflt='sl'
4840         else
4841                 dflt='so'
4842         fi
4843         ;;
4844 *) dflt="$so";;
4845 esac
4846 $cat <<EOM
4847
4848 On some systems, shared libraries may be available.  Answer 'none' if
4849 you want to suppress searching of shared libraries for the remainder
4850 of this configuration.
4851
4852 EOM
4853 rp='What is the file extension used for shared libraries?'
4854 . ./myread
4855 so="$ans"
4856
4857 : Define several unixisms.
4858 : Hints files or command line option can be used to override them.
4859 : The convoluted testing is in case hints files set either the old
4860 : or the new name.
4861 case "$_exe" in
4862 '')     case "$exe_ext" in
4863         '')     ;;
4864         *)      _exe="$exe_ext" ;;
4865         esac
4866         ;;
4867 esac
4868 case "$_a" in
4869 '')     case "$lib_ext" in
4870     '') _a='.a';;
4871         *)      _a="$lib_ext" ;;
4872         esac
4873         ;;
4874 esac
4875 case "$_o" in
4876 '') case "$obj_ext" in
4877         '')     _o='.o';;
4878         *)      _o="$obj_ext";;
4879         esac
4880         ;;
4881 esac
4882 case "$p_" in
4883 '') case "$path_sep" in
4884         '')     p_=':';;
4885         *)      p_="$path_sep";;
4886         esac
4887         ;;
4888 esac
4889 exe_ext=$_exe
4890 lib_ext=$_a
4891 obj_ext=$_o
4892 path_sep=$p_
4893
4894 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4895
4896 : Which makefile gets called first.  This is used by make depend.
4897 case "$firstmakefile" in
4898 '') firstmakefile='makefile';;
4899 esac
4900
4901 : Check for uselongdouble support
4902 case "$ccflags" in
4903 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4904 esac
4905
4906 case "$uselongdouble" in
4907 $define|true|[yY]*)     dflt='y';;
4908 *) dflt='n';;
4909 esac
4910 cat <<EOM
4911
4912 Perl can be built to take advantage of long doubles which
4913 (if available) may give more accuracy and range for floating point numbers.
4914
4915 If this doesn't make any sense to you, just accept the default '$dflt'.
4916 EOM
4917 rp='Try to use long doubles if available?'
4918 . ./myread
4919 case "$ans" in
4920 y|Y)    val="$define"   ;;
4921 *)      val="$undef"    ;;
4922 esac
4923 set uselongdouble
4924 eval $setvar
4925
4926 case "$uselongdouble" in
4927 true|[yY]*) uselongdouble="$define" ;;
4928 esac
4929
4930 : Look for a hint-file generated 'call-back-unit'.  If the
4931 : user has specified that long doubles should be used,
4932 : we may need to set or change some other defaults.
4933 if $test -f uselongdouble.cbu; then
4934     echo "Your platform has some specific hints regarding long doubles, using them..."
4935     . ./uselongdouble.cbu
4936 else
4937     case "$uselongdouble" in
4938         $define)
4939                 $cat <<EOM
4940 (Your platform does not have any specific hints for long doubles.)
4941 EOM
4942         ;;
4943     esac
4944 fi
4945
4946 : Looking for optional libraries
4947 echo " "
4948 echo "Checking for optional libraries..." >&4
4949 case "$libs" in
4950 ' '|'') dflt='';;
4951 *) dflt="$libs";;
4952 esac
4953 case "$libswanted" in
4954 '') libswanted='c_s';;
4955 esac
4956 case "$usesocks" in
4957 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4958 esac
4959 libsfound=''
4960 libsfiles=''
4961 libsdirs=''
4962 libspath=''
4963 for thisdir in $libpth $xlibpth; do
4964   test -d $thisdir && libspath="$libspath $thisdir"
4965 done
4966 for thislib in $libswanted; do
4967         for thisdir in $libspath; do
4968             xxx=''
4969             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4970                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4971                 $test -f "$xxx" && eval $libscheck
4972                 $test -f "$xxx" && libstyle=shared
4973             fi
4974             if test ! -f "$xxx"; then
4975                 xxx=$thisdir/lib$thislib.$so
4976                 $test -f "$xxx" && eval $libscheck
4977                 $test -f "$xxx" && libstyle=shared
4978             fi
4979             if test ! -f "$xxx"; then
4980                 xxx=$thisdir/lib$thislib$_a
4981                 $test -f "$xxx" && eval $libscheck
4982                 $test -f "$xxx" && libstyle=static
4983             fi
4984             if test ! -f "$xxx"; then
4985                 xxx=$thisdir/$thislib$_a
4986                 $test -f "$xxx" && eval $libscheck
4987                 $test -f "$xxx" && libstyle=static
4988             fi
4989             if test ! -f "$xxx"; then
4990                 xxx=$thisdir/lib${thislib}_s$_a
4991                 $test -f "$xxx" && eval $libscheck
4992                 $test -f "$xxx" && libstyle=static
4993                 $test -f "$xxx" && thislib=${thislib}_s
4994             fi
4995             if test ! -f "$xxx"; then
4996                 xxx=$thisdir/Slib$thislib$_a
4997                 $test -f "$xxx" && eval $libscheck
4998                 $test -f "$xxx" && libstyle=static
4999             fi
5000             if $test -f "$xxx"; then
5001                 case "$libstyle" in
5002                 shared) echo "Found -l$thislib (shared)." ;;
5003                 static) echo "Found -l$thislib." ;;
5004                 *)      echo "Found -l$thislib ($libstyle)." ;;
5005                 esac
5006                 case " $dflt " in
5007                 *"-l$thislib "*);;
5008                 *) dflt="$dflt -l$thislib"
5009                    libsfound="$libsfound $xxx"
5010                    yyy=`basename $xxx`
5011                    libsfiles="$libsfiles $yyy"
5012                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5013                    case " $libsdirs " in
5014                    *" $yyy "*) ;;
5015                    *) libsdirs="$libsdirs $yyy" ;;
5016                    esac
5017                    ;;
5018                 esac
5019                 break
5020             fi
5021         done
5022         if $test ! -f "$xxx"; then
5023             echo "No -l$thislib."
5024         fi
5025 done
5026 set X $dflt
5027 shift
5028 dflt="$*"
5029 case "$libs" in
5030 '') dflt="$dflt";;
5031 *) dflt="$libs";;
5032 esac
5033 case "$dflt" in
5034 ' '|'') dflt='none';;
5035 esac
5036
5037 $cat <<EOM
5038
5039 In order to compile $package on your machine, a number of libraries
5040 are usually needed.  Include any other special libraries here as well.
5041 Say "none" for none.  The default list is almost always right.
5042 EOM
5043
5044 echo " "
5045 rp="What libraries to use?"
5046 . ./myread
5047 case "$ans" in
5048 none) libs=' ';;
5049 *) libs="$ans";;
5050 esac
5051
5052 : determine optimization, if desired, or use for debug flag also
5053 case "$optimize" in
5054 ' '|$undef) dflt='none';;
5055 '') dflt='-O';;
5056 *) dflt="$optimize";;
5057 esac
5058 $cat <<EOH
5059
5060 By default, $package compiles with the -O flag to use the optimizer.
5061 Alternately, you might want to use the symbolic debugger, which uses
5062 the -g flag (on traditional Unix systems).  Either flag can be
5063 specified here.  To use neither flag, specify the word "none".
5064
5065 EOH
5066 rp="What optimizer/debugger flag should be used?"
5067 . ./myread
5068 optimize="$ans"
5069 case "$optimize" in
5070 'none') optimize=" ";;
5071 esac
5072
5073 : Check what DEBUGGING is required from the command line
5074 : -DEBUGGING      or -DDEBUGGING or
5075 : -DEBUGGING=both                       = -g + -DDEBUGGING
5076 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5077 : -DEBUGGING=none or -UDEBUGGING        =
5078 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5079 case "$EBUGGING" in
5080 '')     ;;
5081 *)      DEBUGGING=$EBUGGING ;;
5082 esac
5083
5084 case "$DEBUGGING" in
5085 -g|both|$define)
5086     case "$optimize" in
5087         *-g*) ;;
5088         *)    optimize="$optimize -g" ;;
5089     esac ;;
5090 none|$undef)
5091     case "$optimize" in
5092         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5093                 shift
5094                 optimize="$*"
5095                 ;;
5096     esac ;;
5097 esac
5098
5099 dflt=''
5100 case "$DEBUGGING" in
5101 both|$define) dflt='-DDEBUGGING'
5102 esac
5103
5104 : argument order is deliberate, as the flag will start with - which set could
5105 : think is an option
5106 checkccflag='check=$1; flag=$2; callback=$3;
5107 echo " ";
5108 echo "Checking if your compiler accepts $flag" 2>&1;
5109 echo "int main(void) { return 0; }" > gcctest.c;
5110 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5111     echo "Yes, it does." 2>&1;
5112     if $test -s gcctest.out ; then
5113         echo "But your platform does not like it:";
5114         cat gcctest.out;
5115     else
5116         case "$ccflags" in
5117         *$check*)
5118             echo "Leaving current flags $ccflags alone." 2>&1
5119             ;;
5120         *) dflt="$dflt $flag";
5121             eval $callback
5122             ;;
5123         esac
5124     fi
5125 else
5126     echo "Nope, it does not, but that is ok." 2>&1;
5127 fi
5128 '
5129
5130 : We will not override a previous value, but we might want to
5131 : augment a hint file
5132 case "$hint" in
5133 default|recommended)
5134         case "$gccversion" in
5135         1*) dflt="$dflt -fpcc-struct-return" ;;
5136         esac
5137         case "$optimize:$DEBUGGING" in
5138         *-g*:old) dflt="$dflt -DDEBUGGING";;
5139         esac
5140         case "$gccversion" in
5141         2*) if $test -d /etc/conf/kconfig.d &&
5142                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5143                 then
5144                         # Interactive Systems (ISC) POSIX mode.
5145                         dflt="$dflt -posix"
5146                 fi
5147                 ;;
5148         esac
5149         case "$gccversion" in
5150         1*) ;;
5151         2.[0-8]*) ;;
5152         ?*)     set strict-aliasing -fno-strict-aliasing
5153                 eval $checkccflag
5154                 ;;
5155         esac
5156         # For gcc, adding -pipe speeds up compilations for some, but apparently
5157         # some assemblers can't read from stdin.  (It also slows down compilations
5158         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5159         case "$gccversion" in
5160         ?*)     set pipe -pipe
5161                 eval $checkccflag
5162                 ;;
5163         esac
5164
5165         # on x86_64 (at least) we require an extra library (libssp) in the
5166         # link command line. This library is not named, so I infer that it is
5167         # an implementation detail that may change. Hence the safest approach
5168         # is to add the flag to the flags passed to the compiler at link time,
5169         # as that way the compiler can do the right implementation dependant
5170         # thing. (NWC)
5171         case "$gccversion" in
5172         ?*)     set stack-protector -fstack-protector
5173                 eval $checkccflag
5174                 ;;
5175         esac
5176         ;;
5177 esac
5178
5179 case "$mips_type" in
5180 *BSD*|'') inclwanted="$locincpth $usrinc";;
5181 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5182 esac
5183 for thisincl in $inclwanted; do
5184         if $test -d $thisincl; then
5185                 if $test x$thisincl != x$usrinc; then
5186                         case "$dflt" in
5187                         *" -I$thisincl "*);;
5188                         *) dflt="$dflt -I$thisincl ";;
5189                         esac
5190                 fi
5191         fi
5192 done
5193
5194 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5195         xxx=true;
5196 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5197         xxx=true;
5198 else
5199         xxx=false;
5200 fi;
5201 if $xxx; then
5202         case "$dflt" in
5203         *$2*);;
5204         *) dflt="$dflt -D$2";;
5205         esac;
5206 fi'
5207
5208 set signal.h LANGUAGE_C; eval $inctest
5209
5210 case "$usesocks" in
5211 $define)
5212         ccflags="$ccflags -DSOCKS"
5213         ;;
5214 esac
5215
5216 case "$hint" in
5217 default|recommended) dflt="$ccflags $dflt" ;;
5218 *) dflt="$ccflags";;
5219 esac
5220
5221 case "$dflt" in
5222 ''|' ') dflt=none;;
5223 esac
5224
5225 $cat <<EOH
5226
5227 Your C compiler may want other flags.  For this question you should include
5228 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5229 but you should NOT include libraries or ld flags like -lwhatever.  If you
5230 want $package to honor its debug switch, you should include -DDEBUGGING here.
5231 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5232
5233 To use no flags, specify the word "none".
5234
5235 EOH
5236 set X $dflt
5237 shift
5238 dflt=${1+"$@"}
5239 rp="Any additional cc flags?"
5240 . ./myread
5241 case "$ans" in
5242 none) ccflags='';;
5243 *) ccflags="$ans";;
5244 esac
5245
5246 : the following weeds options from ccflags that are of no interest to cpp
5247 case "$cppflags" in
5248 '') cppflags="$ccflags" ;;
5249 *)  cppflags="$cppflags $ccflags" ;;
5250 esac
5251 case "$gccversion" in
5252 1*) cppflags="$cppflags -D__GNUC__"
5253 esac
5254 case "$mips_type" in
5255 '');;
5256 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5257 esac
5258 case "$cppflags" in
5259 '');;
5260 *)
5261         echo " "
5262         echo "Let me guess what the preprocessor flags are..." >&4
5263         set X $cppflags
5264         shift
5265         cppflags=''
5266         $cat >cpp.c <<'EOM'
5267 #define BLURFL foo
5268
5269 BLURFL xx LFRULB
5270 EOM
5271         previous=''
5272         for flag in $*
5273         do
5274                 case "$flag" in
5275                 -*) ftry="$flag";;
5276                 *) ftry="$previous $flag";;
5277                 esac
5278                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5279                         >cpp1.out 2>/dev/null && \
5280                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5281                         >cpp2.out 2>/dev/null && \
5282                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5283                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5284                 then
5285                         cppflags="$cppflags $ftry"
5286                         previous=''
5287                 else
5288                         previous="$flag"
5289                 fi
5290         done
5291         set X $cppflags
5292         shift
5293         cppflags=${1+"$@"}
5294         case "$cppflags" in
5295         *-*)  echo "They appear to be: $cppflags";;
5296         esac
5297         $rm -f cpp.c cpp?.out
5298         ;;
5299 esac
5300
5301 : flags used in final linking phase
5302 case "$ldflags" in
5303 '') if ./venix; then
5304                 dflt='-i -z'
5305         else
5306                 dflt=''
5307         fi
5308         case "$ccflags" in
5309         *-posix*) dflt="$dflt -posix" ;;
5310         esac
5311         ;;
5312 *) dflt="$ldflags";;
5313 esac
5314 # See note above about -fstack-protector
5315 case "$ccflags" in
5316 *-fstack-protector*) 
5317         case "$dflt" in
5318         *-fstack-protector*) ;; # Don't add it again
5319         *) dflt="$dflt -fstack-protector" ;; 
5320         esac
5321         ;;
5322 esac
5323
5324 : Try to guess additional flags to pick up local libraries.
5325 for thislibdir in $libpth; do
5326         case " $loclibpth " in
5327         *" $thislibdir "*)
5328                 case "$dflt " in
5329                 *"-L$thislibdir "*) ;;
5330                 *)  dflt="$dflt -L$thislibdir" ;;
5331                 esac
5332                 ;;
5333         esac
5334 done
5335
5336 case "$dflt" in
5337 '') dflt='none' ;;
5338 esac
5339
5340 $cat <<EOH
5341
5342 Your C linker may need flags.  For this question you should
5343 include -L/whatever and any other flags used by the C linker, but you
5344 should NOT include libraries like -lwhatever.
5345
5346 Make sure you include the appropriate -L/path flags if your C linker
5347 does not normally search all of the directories you specified above,
5348 namely
5349         $libpth
5350 To use no flags, specify the word "none".
5351
5352 EOH
5353
5354 rp="Any additional ld flags (NOT including libraries)?"
5355 . ./myread
5356 case "$ans" in
5357 none) ldflags='';;
5358 *) ldflags="$ans";;
5359 esac
5360 rmlist="$rmlist pdp11"
5361
5362 : coherency check
5363 echo " "
5364 echo "Checking your choice of C compiler and flags for coherency..." >&4
5365 $cat > try.c <<'EOF'
5366 #include <stdio.h>
5367 int main() { printf("Ok\n"); return(0); }
5368 EOF
5369 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5370 shift
5371 $cat >try.msg <<'EOM'
5372 I've tried to compile and run the following simple program:
5373
5374 EOM
5375 $cat try.c >> try.msg
5376
5377 $cat >> try.msg <<EOM
5378
5379 I used the command:
5380
5381         $*
5382         $run ./try
5383
5384 and I got the following output:
5385
5386 EOM
5387 dflt=y
5388 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5389         if $sh -c "$run ./try " >>try.msg 2>&1; then
5390                 xxx=`$run ./try`
5391                 case "$xxx" in
5392                 "Ok") dflt=n ;;
5393                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5394                         case " $libs " in
5395                         *" -lsfio "*)
5396                                 cat >> try.msg <<'EOQS'
5397 If $libs contains -lsfio, and sfio is mis-configured, then it
5398 sometimes (apparently) runs and exits with a 0 status, but with no
5399 output!  It may have to do with sfio's use of _exit vs. exit.
5400
5401 EOQS
5402                                 rp="You have a big problem.  Shall I abort Configure"
5403                                 dflt=y
5404                                 ;;
5405                         esac
5406                         ;;
5407                 esac
5408         else
5409                 echo "The program compiled OK, but exited with status $?." >>try.msg
5410                 rp="You have a problem.  Shall I abort Configure"
5411                 dflt=y
5412         fi
5413 else
5414         echo "I can't compile the test program." >>try.msg
5415         rp="You have a BIG problem.  Shall I abort Configure"
5416         dflt=y
5417 fi
5418 case "$dflt" in
5419 y)
5420         $cat try.msg >&4
5421         case "$knowitall" in
5422         '')
5423                 echo "(The supplied flags or libraries might be incorrect.)"
5424                 ;;
5425         *) dflt=n;;
5426         esac
5427         echo " "
5428         . ./myread
5429         case "$ans" in
5430         n*|N*) ;;
5431         *)      echo "Ok.  Stopping Configure." >&4
5432                 exit 1
5433                 ;;
5434         esac
5435         ;;
5436 n) echo "OK, that should do.";;
5437 esac
5438 $rm_try gcctest gcctest.out
5439
5440 : define a shorthand compile call
5441 compile='
5442 mc_file=$1;
5443 shift;
5444 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5445 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5446 exit 1;
5447 fi;
5448 esac;
5449 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5450 : define a shorthand compile call for compilations that should be ok.
5451 compile_ok='
5452 mc_file=$1;
5453 shift;
5454 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5455
5456 : determine filename position in cpp output
5457 echo " "
5458 echo "Computing filename position in cpp output for #include directives..." >&4
5459 case "$osname" in
5460 vos) testaccess=-e ;;
5461 *)   testaccess=-r ;;
5462 esac
5463 echo '#include <stdio.h>' > foo.c
5464 $cat >fieldn <<EOF
5465 $startsh
5466 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5467 $grep '^[       ]*#.*stdio\.h' | \
5468 while read cline; do
5469         pos=1
5470         set \$cline
5471         while $test \$# -gt 0; do
5472                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5473                         echo "\$pos"
5474                         exit 0
5475                 fi
5476                 shift
5477                 pos=\`expr \$pos + 1\`
5478         done
5479 done
5480 EOF
5481 chmod +x fieldn
5482 fieldn=`./fieldn`
5483 $rm -f foo.c fieldn
5484 case $fieldn in
5485 '') pos='???';;
5486 1) pos=first;;
5487 2) pos=second;;
5488 3) pos=third;;
5489 *) pos="${fieldn}th";;
5490 esac
5491 echo "Your cpp writes the filename in the $pos field of the line."
5492
5493 case "$osname" in
5494 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5495 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5496 *)   cppfilter='' ;;
5497 esac
5498 : locate header file
5499 $cat >findhdr <<EOF
5500 $startsh
5501 wanted=\$1
5502 name=''
5503 for usrincdir in $usrinc
5504 do
5505         if test -f \$usrincdir/\$wanted; then
5506                 echo "\$usrincdir/\$wanted"
5507                 exit 0
5508         fi
5509 done
5510 awkprg='{ print \$$fieldn }'
5511 echo "#include <\$wanted>" > foo\$\$.c
5512 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5513 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5514 while read cline; do
5515         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5516         case "\$name" in
5517         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5518         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5519         *) exit 2;;
5520         esac;
5521 done;
5522 #
5523 # status = 0: grep returned 0 lines, case statement not executed
5524 # status = 1: headerfile found
5525 # status = 2: while loop executed, no headerfile found
5526 #
5527 status=\$?
5528 $rm -f foo\$\$.c;
5529 if test \$status -eq 1; then
5530         exit 0;
5531 fi
5532 exit 1
5533 EOF
5534 chmod +x findhdr
5535
5536 : define an alternate in-header-list? function
5537 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5538 cont=true; xxf="echo \"<\$1> found.\" >&4";
5539 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5540 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5541 esac;
5542 case $# in 4) instead=instead;; *) instead="at last";; esac;
5543 while $test "$cont"; do
5544         xxx=`./findhdr $1`
5545         var=$2; eval "was=\$$2";
5546         if $test "$xxx" && $test -r "$xxx";
5547         then eval $xxf;
5548         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5549                 cont="";
5550         else eval $xxnf;
5551         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5552         set $yyy; shift; shift; yyy=$@;
5553         case $# in 0) cont="";;
5554         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5555                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5556         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5557                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5558         esac;
5559 done;
5560 while $test "$yyy";
5561 do set $yyy; var=$2; eval "was=\$$2";
5562         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5563         set $yyy; shift; shift; yyy=$@;
5564 done'
5565
5566 : see if stdlib is available
5567 set stdlib.h i_stdlib
5568 eval $inhdr
5569
5570 : check for lengths of integral types
5571 echo " "
5572 case "$intsize" in
5573 '')
5574         echo "Checking to see how big your integers are..." >&4
5575         $cat >try.c <<EOCP
5576 #include <stdio.h>
5577 #$i_stdlib I_STDLIB
5578 #ifdef I_STDLIB
5579 #include <stdlib.h>
5580 #endif
5581 int main()
5582 {
5583         printf("intsize=%d;\n", (int)sizeof(int));
5584         printf("longsize=%d;\n", (int)sizeof(long));
5585         printf("shortsize=%d;\n", (int)sizeof(short));
5586         exit(0);
5587 }
5588 EOCP
5589         set try
5590         if eval $compile_ok && $run ./try > /dev/null; then
5591                 eval `$run ./try`
5592                 echo "Your integers are $intsize bytes long."
5593                 echo "Your long integers are $longsize bytes long."
5594                 echo "Your short integers are $shortsize bytes long."
5595         else
5596                 $cat >&4 <<EOM
5597 !
5598 Help! I can't compile and run the intsize test program: please enlighten me!
5599 (This is probably a misconfiguration in your system or libraries, and
5600 you really ought to fix it.  Still, I'll try anyway.)
5601 !
5602 EOM
5603                 dflt=4
5604                 rp="What is the size of an integer (in bytes)?"
5605                 . ./myread
5606                 intsize="$ans"
5607                 dflt=$intsize
5608                 rp="What is the size of a long integer (in bytes)?"
5609                 . ./myread
5610                 longsize="$ans"
5611                 dflt=2
5612                 rp="What is the size of a short integer (in bytes)?"
5613                 . ./myread
5614                 shortsize="$ans"
5615         fi
5616         ;;
5617 esac
5618 $rm_try
5619
5620 : check for long long
5621 echo " "
5622 echo "Checking to see if you have long long..." >&4
5623 echo 'int main() { long long x = 7; return 0; }' > try.c
5624 set try
5625 if eval $compile; then
5626         val="$define"
5627         echo "You have long long."
5628 else
5629         val="$undef"
5630         echo "You do not have long long."
5631 fi
5632 $rm_try
5633 set d_longlong
5634 eval $setvar
5635
5636 : check for length of long long
5637 case "${d_longlong}${longlongsize}" in
5638 $define)
5639         echo " "
5640         echo "Checking to see how big your long longs are..." >&4
5641         $cat >try.c <<'EOCP'
5642 #include <stdio.h>
5643 int main()
5644 {
5645     printf("%d\n", (int)sizeof(long long));
5646     return(0);
5647 }
5648 EOCP
5649         set try
5650         if eval $compile_ok; then
5651                 longlongsize=`$run ./try`
5652                 echo "Your long longs are $longlongsize bytes long."
5653         else
5654                 dflt='8'
5655                 echo " "
5656                 echo "(I can't seem to compile the test program.  Guessing...)"
5657                 rp="What is the size of a long long (in bytes)?"
5658                 . ./myread
5659                 longlongsize="$ans"
5660         fi
5661         if $test "X$longsize" = "X$longlongsize"; then
5662                 echo "(That isn't any different from an ordinary long.)"
5663         fi
5664         ;;
5665 esac
5666 $rm_try
5667
5668 : see if inttypes.h is available
5669 : we want a real compile instead of Inhdr because some systems
5670 : have an inttypes.h which includes non-existent headers
5671 echo " "
5672 $cat >try.c <<EOCP
5673 #include <inttypes.h>
5674 int main() {
5675         static int32_t foo32 = 0x12345678;
5676 }
5677 EOCP
5678 set try
5679 if eval $compile; then
5680         echo "<inttypes.h> found." >&4
5681         val="$define"
5682 else
5683         echo "<inttypes.h> NOT found." >&4
5684         val="$undef"
5685 fi
5686 $rm_try
5687 set i_inttypes
5688 eval $setvar
5689
5690 : check for int64_t
5691 echo " "
5692 echo "Checking to see if you have int64_t..." >&4
5693 $cat >try.c <<EOCP
5694 #include <sys/types.h>
5695 #$i_inttypes I_INTTYPES
5696 #ifdef I_INTTYPES
5697 #include <inttypes.h>
5698 #endif
5699 int main() { int64_t x = 7; }
5700 EOCP
5701 set try
5702 if eval $compile; then
5703         val="$define"
5704         echo "You have int64_t."
5705 else
5706         val="$undef"
5707         echo "You do not have int64_t."
5708 fi
5709 $rm_try
5710 set d_int64_t
5711 eval $setvar
5712
5713 : Check if 64bit ints have a quad type
5714 echo " "
5715 echo "Checking which 64-bit integer type we could use..." >&4
5716
5717 case "$intsize" in
5718 8) val=int
5719    set quadtype
5720    eval $setvar
5721    val='"unsigned int"'
5722    set uquadtype
5723    eval $setvar
5724    quadkind=1
5725    ;;
5726 *) case "$longsize" in
5727    8) val=long
5728       set quadtype
5729       eval $setvar
5730       val='"unsigned long"'
5731       set uquadtype
5732       eval $setvar
5733       quadkind=2
5734       ;;
5735    *) case "$d_longlong:$longlongsize" in
5736       define:8)
5737         val='"long long"'
5738         set quadtype
5739         eval $setvar
5740         val='"unsigned long long"'
5741         set uquadtype
5742         eval $setvar
5743         quadkind=3
5744         ;;
5745       *) case "$d_int64_t" in
5746          define)
5747            val=int64_t
5748            set quadtype
5749            eval $setvar
5750            val=uint64_t
5751            set uquadtype
5752            eval $setvar
5753            quadkind=4
5754            ;;
5755          esac
5756          ;;
5757       esac
5758       ;;
5759    esac
5760    ;;
5761 esac
5762
5763 case "$quadtype" in
5764 '')     echo "Alas, no 64-bit integer types in sight." >&4
5765         d_quad="$undef"
5766         ;;
5767 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5768         d_quad="$define"
5769         ;;
5770 esac
5771
5772 : Do we want 64bit support
5773 case "$uselonglong" in
5774 "$define"|true|[yY]*)
5775         cat <<EOM >&4
5776
5777 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5778 EOM
5779         use64bitint="$define"
5780         ;;
5781 esac
5782 case "$use64bits" in
5783 "$define"|true|[yY]*)
5784         cat <<EOM >&4
5785
5786 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5787 EOM
5788         use64bitint="$define"
5789         ;;
5790 esac
5791 case "$use64bitints" in
5792 "$define"|true|[yY]*)
5793         cat <<EOM >&4
5794
5795 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5796 EOM
5797         use64bitint="$define"
5798         ;;
5799 esac
5800 case "$use64bitsint" in
5801 "$define"|true|[yY]*)
5802         cat <<EOM >&4
5803
5804 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5805 EOM
5806         use64bitint="$define"
5807         ;;
5808 esac
5809 case "$uselonglongs" in
5810 "$define"|true|[yY]*)
5811         cat <<EOM >&4
5812
5813 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5814 EOM
5815         use64bitint="$define"
5816         ;;
5817 esac
5818 case "$use64bitsall" in
5819 "$define"|true|[yY]*)
5820         cat <<EOM >&4
5821
5822 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5823 EOM
5824         use64bitall="$define"
5825         ;;
5826 esac
5827
5828 case "$ccflags" in
5829 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5830 esac
5831 case "$use64bitall" in
5832 "$define"|true|[yY]*) use64bitint="$define" ;;
5833 esac
5834
5835 case "$longsize" in
5836 8) cat <<EOM
5837
5838 You have natively 64-bit long integers.
5839 EOM
5840    val="$define"
5841    ;;
5842 *) case "$use64bitint" in
5843    "$define"|true|[yY]*) dflt='y';;
5844    *) dflt='n';;
5845    esac
5846    case "$d_quad" in
5847    "$define") ;;
5848    *) dflt='n' ;;
5849    esac
5850    cat <<EOM
5851
5852 Perl can be built to take advantage of 64-bit integer types
5853 on some systems.  To do so, Configure can be run with -Duse64bitint.
5854 Choosing this option will most probably introduce binary incompatibilities.
5855
5856 If this doesn't make any sense to you, just accept the default '$dflt'.
5857 (The default has been chosen based on your configuration.)
5858 EOM
5859    rp='Try to use 64-bit integers, if available?'
5860    . ./myread
5861    case "$ans" in
5862    [yY]*) val="$define" ;;
5863    *)     val="$undef"  ;;
5864    esac
5865    ;;
5866 esac
5867 set use64bitint
5868 eval $setvar
5869
5870 case "$use64bitall" in
5871 "$define"|true|[yY]*) dflt='y' ;;
5872 *) case "$longsize" in
5873    8) dflt='y' ;;
5874    *) dflt='n' ;;
5875    esac
5876    ;;
5877 esac
5878 cat <<EOM
5879
5880 You may also choose to try maximal 64-bitness.  It means using as much
5881 64-bitness as possible on the platform.  This in turn means even more
5882 binary incompatibilities.  On the other hand, your platform may not
5883 have any more 64-bitness available than what you already have chosen.
5884
5885 If this doesn't make any sense to you, just accept the default '$dflt'.
5886 (The default has been chosen based on your configuration.)
5887 EOM
5888 rp='Try to use maximal 64-bit support, if available?'
5889 . ./myread
5890 case "$ans" in
5891 [yY]*) val="$define" ;;
5892 *)     val="$undef"  ;;
5893 esac
5894 set use64bitall
5895 eval $setvar
5896 case "$use64bitall" in
5897 "$define")
5898         case "$use64bitint" in
5899         "$undef")
5900                 cat <<EOM
5901
5902 Since you have chosen a maximally 64-bit build, I'm also turning on
5903 the use of 64-bit integers.
5904 EOM
5905                 use64bitint="$define" ;;
5906         esac
5907         ;;
5908 esac
5909
5910 : Look for a hint-file generated 'call-back-unit'.  If the
5911 : user has specified that a 64-bit perl is to be built,
5912 : we may need to set or change some other defaults.
5913 if $test -f use64bitint.cbu; then
5914         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5915         . ./use64bitint.cbu
5916 fi
5917 case "$use64bitint" in
5918 "$define"|true|[yY]*)
5919         case "$longsize" in
5920         4) case "$archname64" in
5921            '') archname64=64int ;;
5922            esac
5923            ;;
5924         esac
5925         ;;
5926 esac
5927
5928 : Look for a hint-file generated 'call-back-unit'.  If the
5929 : user has specified that a maximally 64-bit perl is to be built,
5930 : we may need to set or change some other defaults.
5931 if $test -f use64bitall.cbu; then
5932         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5933         . ./use64bitall.cbu
5934 fi
5935 case "$use64bitall" in
5936 "$define"|true|[yY]*)
5937         case "$longsize" in
5938         4) case "$archname64" in
5939            ''|64int) archname64=64all ;;
5940            esac
5941            ;;
5942         esac
5943         ;;
5944 esac
5945
5946 case "$d_quad:$use64bitint" in
5947 $undef:$define)
5948         cat >&4 <<EOF
5949
5950 *** You have chosen to use 64-bit integers,
5951 *** but none can be found.
5952 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5953 *** Cannot continue, aborting.
5954
5955 EOF
5956         exit 1
5957         ;;
5958 esac
5959
5960 : check for length of double
5961 echo " "
5962 case "$doublesize" in
5963 '')
5964         echo "Checking to see how big your double precision numbers are..." >&4
5965         $cat >try.c <<EOCP
5966 #include <stdio.h>
5967 #$i_stdlib I_STDLIB
5968 #ifdef I_STDLIB
5969 #include <stdlib.h>
5970 #endif
5971 int main()
5972 {
5973     printf("%d\n", (int)sizeof(double));
5974     exit(0);
5975 }
5976 EOCP
5977         set try
5978         if eval $compile_ok; then
5979                 doublesize=`$run ./try`
5980                 echo "Your double is $doublesize bytes long."
5981         else
5982                 dflt='8'
5983                 echo "(I can't seem to compile the test program.  Guessing...)"
5984                 rp="What is the size of a double precision number (in bytes)?"
5985                 . ./myread
5986                 doublesize="$ans"
5987         fi
5988         ;;
5989 esac
5990 $rm_try
5991
5992 : check for long doubles
5993 echo " "
5994 echo "Checking to see if you have long double..." >&4
5995 echo 'int main() { long double x = 7.0; }' > try.c
5996 set try
5997 if eval $compile; then
5998         val="$define"
5999         echo "You have long double."
6000 else
6001         val="$undef"
6002         echo "You do not have long double."
6003 fi
6004 $rm_try
6005 set d_longdbl
6006 eval $setvar
6007
6008 : check for length of long double
6009 case "${d_longdbl}${longdblsize}" in
6010 $define)
6011         echo " "
6012         echo "Checking to see how big your long doubles are..." >&4
6013         $cat >try.c <<'EOCP'
6014 #include <stdio.h>
6015 int main()
6016 {
6017         printf("%d\n", sizeof(long double));
6018 }
6019 EOCP
6020         set try
6021         set try
6022         if eval $compile; then
6023                 longdblsize=`$run ./try`
6024                 echo "Your long doubles are $longdblsize bytes long."
6025         else
6026                 dflt='8'
6027                 echo " "
6028                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6029                 rp="What is the size of a long double (in bytes)?"
6030                 . ./myread
6031                 longdblsize="$ans"
6032         fi
6033         if $test "X$doublesize" = "X$longdblsize"; then
6034                 echo "That isn't any different from an ordinary double."
6035                 echo "I'll keep your setting anyway, but you may see some"
6036                 echo "harmless compilation warnings."
6037         fi
6038         ;;
6039 esac
6040 $rm_try
6041
6042 : determine the architecture name
6043 echo " "
6044 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6045         tarch=`arch`"-$osname"
6046 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6047         if uname -m > tmparch 2>&1 ; then
6048                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6049                         -e 's/$/'"-$osname/" tmparch`
6050         else
6051                 tarch="$osname"
6052         fi
6053         $rm -f tmparch
6054 else
6055         tarch="$osname"
6056 fi
6057 case "$myarchname" in
6058 ''|"$tarch") ;;
6059 *)
6060         echo "(Your architecture name used to be $myarchname.)"
6061         archname=''
6062         ;;
6063 esac
6064 case "$targetarch" in
6065 '') ;;
6066 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6067 esac
6068 myarchname="$tarch"
6069 case "$archname" in
6070 '') dflt="$tarch";;
6071 *) dflt="$archname";;
6072 esac
6073 rp='What is your architecture name'
6074 . ./myread
6075 archname="$ans"
6076 case "$usethreads" in
6077 $define)
6078         echo "Threads selected." >&4
6079         case "$archname" in
6080         *-thread*) echo "...and architecture name already has -thread." >&4
6081                 ;;
6082         *)      archname="$archname-thread"
6083                 echo "...setting architecture name to $archname." >&4
6084                 ;;
6085         esac
6086         ;;
6087 esac
6088 case "$usemultiplicity" in
6089 $define)
6090         echo "Multiplicity selected." >&4
6091         case "$archname" in
6092         *-multi*) echo "...and architecture name already has -multi." >&4
6093                 ;;
6094         *)      archname="$archname-multi"
6095                 echo "...setting architecture name to $archname." >&4
6096                 ;;
6097         esac
6098         ;;
6099 esac
6100 case "$use64bitint$use64bitall" in
6101 *"$define"*)
6102         case "$archname64" in
6103         '')
6104                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6105                 ;;
6106         *)
6107                 case "$use64bitint" in
6108                 "$define") echo "64 bit integers selected." >&4 ;;
6109                 esac
6110                 case "$use64bitall" in
6111                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6112                 esac
6113                 case "$archname" in
6114                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6115                         ;;
6116                 *)      archname="$archname-$archname64"
6117                         echo "...setting architecture name to $archname." >&4
6118                         ;;
6119                 esac
6120                 ;;
6121         esac
6122 esac
6123 case "$uselongdouble" in
6124 $define)
6125         echo "Long doubles selected." >&4
6126         case "$longdblsize" in
6127         $doublesize)
6128                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6129                 ;;
6130         *)
6131                 case "$archname" in
6132                 *-ld*) echo "...and architecture name already has -ld." >&4
6133                         ;;
6134                 *)      archname="$archname-ld"
6135                         echo "...setting architecture name to $archname." >&4
6136                         ;;
6137                 esac
6138                 ;;
6139         esac
6140         ;;
6141 esac
6142 case "$useperlio" in
6143 $define)
6144         echo "Perlio selected." >&4
6145         ;;
6146 *)
6147         echo "Perlio not selected, using stdio." >&4
6148         case "$archname" in
6149         *-stdio*) echo "...and architecture name already has -stdio." >&4
6150                 ;;
6151         *)      archname="$archname-stdio"
6152                 echo "...setting architecture name to $archname." >&4
6153                 ;;
6154         esac
6155         ;;
6156 esac
6157 if $test -f archname.cbu; then
6158         echo "Your platform has some specific hints for architecture name, using them..."
6159         . ./archname.cbu
6160 fi
6161
6162 : set the prefixit variable, to compute a suitable default value
6163 prefixit='case "$3" in
6164 ""|none)
6165         case "$oldprefix" in
6166         "") eval "$1=\"\$$2\"";;
6167         *)
6168                 case "$3" in
6169                 "") eval "$1=";;
6170                 none)
6171                         eval "tp=\"\$$2\"";
6172                         case "$tp" in
6173                         ""|" ") eval "$1=\"\$$2\"";;
6174                         *) eval "$1=";;
6175                         esac;;
6176                 esac;;
6177         esac;;
6178 *)
6179         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6180         case "$tp" in
6181         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6182         /*-$oldprefix/*|\~*-$oldprefix/*)
6183                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6184         *) eval "$1=\"\$$2\"";;
6185         esac;;
6186 esac'
6187
6188 : determine installation style
6189 : For now, try to deduce it from prefix unless it is already set.
6190 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6191 case "$installstyle" in
6192 '')     case "$prefix" in
6193                 *perl*) dflt='lib';;
6194                 *) dflt='lib/perl5' ;;
6195         esac
6196         ;;
6197 *)      dflt="$installstyle" ;;
6198 esac
6199 : Probably not worth prompting for this since we prompt for all
6200 : the directories individually, and the prompt would be too long and
6201 : confusing anyway.
6202 installstyle=$dflt
6203
6204 : determine where public executables go
6205 echo " "
6206 set dflt bin bin
6207 eval $prefixit
6208 fn=d~
6209 rp='Pathname where the public executables will reside?'
6210 . ./getfile
6211 if $test "X$ansexp" != "X$binexp"; then
6212         installbin=''
6213 fi
6214 prefixvar=bin
6215 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6216 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6217 :     this via initialinstalllocation
6218 . ./setprefixvar
6219
6220 case "$userelocatableinc" in
6221 $define|true|[yY]*)     dflt='y' ;;
6222 *)                      dflt='n' ;;
6223 esac
6224 cat <<EOM
6225
6226 Would you like to build Perl so that the installation is relocatable, so that
6227 library paths in @INC are determined relative to the path of the perl binary?
6228 This is not advised for system Perl installs, or if you need to run setid
6229 scripts or scripts under taint mode.
6230
6231 If this doesn't make any sense to you, just accept the default '$dflt'.
6232 EOM
6233 rp='Use relocatable @INC?'
6234 . ./myread
6235 case "$ans" in
6236 y|Y)    val="$define" ;;
6237 *)      val="$undef"  ;;
6238 esac
6239 set userelocatableinc
6240 eval $setvar
6241
6242 initialinstalllocation="$binexp"
6243 : Default prefix is now "up one level from where the binaries are"
6244 case "$userelocatableinc" in
6245 $define|true|[yY]*)
6246     bin=".../"
6247     binexp=".../"
6248     prefix=".../.."
6249     prefixexp=".../.."
6250     installprefixexp=".../.."
6251     ;;
6252 esac
6253
6254 : determine where private library files go
6255 : Usual default is /usr/local/lib/perl5/$version.
6256 : Also allow things like /opt/perl/lib/$version, since
6257 : /opt/perl/lib/perl5... would be redundant.
6258 : The default "style" setting is made in installstyle.U
6259 case "$installstyle" in
6260 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6261 *)       set dflt privlib lib/$version ;;
6262 esac
6263 eval $prefixit
6264 $cat <<EOM
6265
6266 There are some auxiliary files for $package that need to be put into a
6267 private library directory that is accessible by everyone.
6268
6269 EOM
6270 fn=$binexp
6271 fn=d~+
6272 rp='Pathname where the private library files will reside?'
6273 . ./getfile
6274 prefixvar=privlib
6275 . ./setprefixvar
6276
6277 : set the prefixup variable, to restore leading tilda escape
6278 prefixup='case "$prefixexp" in
6279 "$prefix") ;;
6280 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6281 esac'
6282
6283 : determine where public architecture dependent libraries go
6284 set archlib archlib
6285 eval $prefixit
6286 : privlib default is /usr/local/lib/$package/$version
6287 : archlib default is /usr/local/lib/$package/$version/$archname
6288 : privlib may have an optional trailing /share.
6289 tdflt=`echo $privlib | $sed 's,/share$,,'`
6290 tdflt=$tdflt/$archname
6291 case "$archlib" in
6292 '')     dflt=$tdflt
6293         ;;
6294 *)      dflt="$archlib"
6295     ;;
6296 esac
6297 $cat <<EOM
6298
6299 $spackage contains architecture-dependent library files.  If you are
6300 sharing libraries in a heterogeneous environment, you might store
6301 these files in a separate location.  Otherwise, you can just include
6302 them with the rest of the public library files.
6303
6304 EOM
6305 fn=$binexp
6306 fn=d+~
6307 rp='Where do you want to put the public architecture-dependent libraries?'
6308 . ./getfile
6309 prefixvar=archlib
6310 . ./setprefixvar
6311 if $test X"$archlib" = X"$privlib"; then
6312         d_archlib="$undef"
6313 else
6314         d_archlib="$define"
6315 fi
6316
6317 : see if setuid scripts can be secure
6318 $cat <<EOM
6319
6320 Some kernels have a bug that prevents setuid #! scripts from being
6321 secure.  Some sites have disabled setuid #! scripts because of this.
6322
6323 First let's decide if your kernel supports secure setuid #! scripts.
6324 (If setuid #! scripts would be secure but have been disabled anyway,
6325 don't say that they are secure if asked.)
6326
6327 EOM
6328
6329 val="$undef"
6330 if $test -d /dev/fd; then
6331         echo "#!$ls" >reflect
6332         chmod +x,u+s reflect
6333         ./reflect >flect 2>&1
6334         if $contains "/dev/fd" flect >/dev/null; then
6335                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6336                 val="$define"
6337         else
6338                 $cat <<EOM
6339 If you are not sure if they are secure, I can check but I'll need a
6340 username and password different from the one you are using right now.
6341 If you don't have such a username or don't want me to test, simply
6342 enter 'none'.
6343
6344 EOM
6345                 rp='Other username to test security of setuid scripts with?'
6346                 dflt='none'
6347                 . ./myread
6348                 case "$ans" in
6349                 n|none)
6350                         case "$d_suidsafe" in
6351                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6352                                 dflt=n;;
6353                         "$undef")
6354                                 echo "Well, the $hint value is *not* secure." >&4
6355                                 dflt=n;;
6356                         *)      echo "Well, the $hint value *is* secure." >&4
6357                                 dflt=y;;
6358                         esac
6359                         ;;
6360                 *)
6361                         $rm -f reflect flect
6362                         echo "#!$ls" >reflect
6363                         chmod +x,u+s reflect
6364                         echo >flect
6365                         chmod a+w flect
6366                         echo '"su" will (probably) prompt you for '"$ans's password."
6367                         su $ans -c './reflect >flect'
6368                         if $contains "/dev/fd" flect >/dev/null; then
6369                                 echo "Okay, it looks like setuid scripts are secure." >&4
6370                                 dflt=y
6371                         else
6372                                 echo "I don't think setuid scripts are secure." >&4
6373                                 dflt=n
6374                         fi
6375                         ;;
6376                 esac
6377                 rp='Does your kernel have *secure* setuid scripts?'
6378                 . ./myread
6379                 case "$ans" in
6380                 [yY]*)  val="$define";;
6381                 *)      val="$undef";;
6382                 esac
6383         fi
6384 else
6385         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6386         echo "(That's for file descriptors, not floppy disks.)"
6387         val="$undef"
6388 fi
6389 set d_suidsafe
6390 eval $setvar
6391
6392 $rm -f reflect flect
6393
6394 : now see if they want to do setuid emulation
6395 if $test $patchlevel -lt 11; then
6396 echo " "
6397 val="$undef"
6398 case "$d_suidsafe" in
6399 "$define")
6400         val="$undef"
6401         echo "No need to emulate SUID scripts since they are secure here." >&4
6402         ;;
6403 *)
6404         $cat <<EOM
6405 Some systems have disabled setuid scripts, especially systems where
6406 setuid scripts cannot be secure.  On systems where setuid scripts have
6407 been disabled, the setuid/setgid bits on scripts are currently
6408 useless.  It is possible for $package to detect those bits and emulate
6409 setuid/setgid in a secure fashion.  This emulation will only work if
6410 setuid scripts have been disabled in your kernel.
6411
6412 EOM
6413         case "$d_dosuid" in
6414         "$define") dflt=y ;;
6415         *) dflt=n ;;
6416         esac
6417         rp="Do you want to do setuid/setgid emulation?"
6418         . ./myread
6419         case "$ans" in
6420         [yY]*)  val="$define";;
6421         *)      val="$undef";;
6422         esac
6423         ;;
6424 esac
6425 set d_dosuid
6426 eval $setvar
6427 else
6428     case "$d_dosuid" in
6429         "$define")
6430         cat >&4 <<EOH
6431
6432 SUID emulation has been removed for 5.12
6433 Please re-run Configure without -Dd_dosuid
6434
6435 EOH
6436         exit 1;
6437         ;;
6438     esac
6439     d_dosuid=undef
6440 fi
6441
6442 : Find perl5.005 or later.
6443 echo "Looking for a previously installed perl5.005 or later... "
6444 case "$perl5" in
6445 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6446                 : Check if this perl is recent and can load a simple module
6447                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6448                         perl5=$tdir/perl
6449                         break;
6450                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6451                         perl5=$tdir/perl5
6452                         break;
6453                 fi
6454         done
6455         ;;
6456 *)      perl5="$perl5"
6457         ;;
6458 esac
6459 case "$perl5" in
6460 '')     echo "None found.  That's ok.";;
6461 *)      echo "Using $perl5." ;;
6462 esac
6463
6464 : Set the siteprefix variables
6465 $cat <<EOM
6466
6467 After $package is installed, you may wish to install various
6468 add-on modules and utilities.  Typically, these add-ons will
6469 be installed under $prefix with the rest
6470 of this package.  However, you may wish to install such add-ons
6471 elsewhere under a different prefix.
6472
6473 If you do not wish to put everything under a single prefix, that's
6474 ok.  You will be prompted for the individual locations; this siteprefix
6475 is only used to suggest the defaults.
6476
6477 The default should be fine for most people.
6478
6479 EOM
6480 fn=d~+
6481 rp='Installation prefix to use for add-on modules and utilities?'
6482 : XXX Here might be another good place for an installstyle setting.
6483 case "$siteprefix" in
6484 '') dflt=$prefix ;;
6485 *)  dflt=$siteprefix ;;
6486 esac
6487 . ./getfile
6488 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6489 oldsiteprefix=''
6490 case "$siteprefix" in
6491 '') ;;
6492 *)      case "$ans" in
6493         "$prefix") ;;
6494         *) oldsiteprefix="$prefix";;
6495         esac
6496         ;;
6497 esac
6498 siteprefix="$ans"
6499 siteprefixexp="$ansexp"
6500
6501 : determine where site specific libraries go.
6502 : Usual default is /usr/local/lib/perl5/site_perl/$version
6503 : The default "style" setting is made in installstyle.U
6504 : XXX No longer works with Prefixit stuff.
6505 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6506 case "$sitelib" in
6507 '') case "$installstyle" in
6508         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6509         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6510         esac
6511         ;;
6512 *)      dflt="$sitelib"
6513         ;;
6514 esac
6515 $cat <<EOM
6516
6517 The installation process will create a directory for
6518 site-specific extensions and modules.  Most users find it convenient
6519 to place all site-specific files in this directory rather than in the
6520 main distribution directory.
6521
6522 EOM
6523 fn=d~+
6524 rp='Pathname for the site-specific library files?'
6525 . ./getfile
6526 prefixvar=sitelib
6527 . ./setprefixvar
6528 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6529
6530 : Determine list of previous versions to include in @INC
6531 $cat > getverlist <<EOPL
6532 #!$perl5 -w
6533 use File::Basename;
6534 \$api_versionstring = "$api_versionstring";
6535 \$version = "$version";
6536 \$stem = "$sitelib_stem";
6537 \$archname = "$archname";
6538 EOPL
6539         $cat >> getverlist <<'EOPL'
6540 # The list found is store twice for each entry: the original name, and
6541 # the binary broken down version as pack "sss", so sorting is easy and
6542 # unambiguous. This will work for all versions that have a maximum of
6543 # three digit groups, separate by '.'s or '_'s. Names are extended with
6544 # ".0.0" to ensure at least three elements for the pack.
6545 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6546
6547 # Can't have leading @ because metaconfig interprets it as a command!
6548 ;@inc_version_list=();
6549 # XXX Redo to do opendir/readdir?
6550 if (-d $stem) {
6551     chdir($stem);
6552     ;@candidates = map {
6553         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6554     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6555 }
6556 else {
6557     ;@candidates = ();
6558 }
6559
6560 ($pversion, $aversion, $vsn5005) = map {
6561     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6562 foreach $d (@candidates) {
6563     if ($d->[1] lt $pversion) {
6564         if ($d->[1] ge $aversion) {
6565             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6566         }
6567         elsif ($d->[1] ge $vsn5005) {
6568             unshift(@inc_version_list, grep { -d } $d->[0]);
6569         }
6570     }
6571     else {
6572         # Skip newer version.  I.e. don't look in
6573         # 5.7.0 if we're installing 5.6.1.
6574     }
6575 }
6576
6577 if (@inc_version_list) {
6578     print join(' ', @inc_version_list);
6579 }
6580 else {
6581     # Blank space to preserve value for next Configure run.
6582     print " ";
6583 }
6584 EOPL
6585 chmod +x getverlist
6586 case "$inc_version_list" in
6587 '')     if test -x "$perl5$exe_ext"; then
6588                 dflt=`$perl5 getverlist`
6589         else
6590                 dflt='none'
6591         fi
6592         ;;
6593 $undef) dflt='none' ;;
6594 *)  eval dflt=\"$inc_version_list\" ;;
6595 esac
6596 case "$dflt" in
6597 ''|' ') dflt=none ;;
6598 esac
6599 case "$dflt" in
6600 5.005) dflt=none ;;
6601 esac
6602 $cat <<EOM
6603
6604 In order to ease the process of upgrading, this version of perl
6605 can be configured to use modules built and installed with earlier
6606 versions of perl that were installed under $prefix.  Specify here
6607 the list of earlier versions that this version of perl should check.
6608 If Configure detected no earlier versions of perl installed under
6609 $prefix, then the list will be empty.  Answer 'none' to tell perl
6610 to not search earlier versions.
6611
6612 The default should almost always be sensible, so if you're not sure,
6613 just accept the default.
6614 EOM
6615
6616 rp='List of earlier versions to include in @INC?'
6617 . ./myread
6618 case "$ans" in
6619 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6620 *) inc_version_list="$ans" ;;
6621 esac
6622 case "$inc_version_list" in
6623 ''|' ')
6624         inc_version_list_init='0'
6625         d_inc_version_list="$undef"
6626         ;;
6627 *)      inc_version_list_init=`echo $inc_version_list |
6628                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6629         d_inc_version_list="$define"
6630         ;;
6631 esac
6632 $rm -f getverlist
6633
6634 : see if malloc/malloc.h has to be included
6635 set malloc/malloc.h i_mallocmalloc
6636 eval $inhdr
6637
6638 : see if this is a malloc.h system
6639 : we want a real compile instead of Inhdr because some systems have a
6640 : malloc.h that just gives a compile error saying to use stdlib.h instead
6641 echo " "
6642 $cat >try.c <<EOCP
6643 #include <stdlib.h>
6644 #include <malloc.h>
6645 #$i_mallocmalloc I_MALLOCMALLOC
6646 #ifdef I_MALLOCMALLOC
6647 # include <malloc/malloc.h>
6648 #endif
6649
6650 int main () { return 0; }
6651 EOCP
6652 set try
6653 if eval $compile; then
6654     echo "<malloc.h> found." >&4
6655     val="$define"
6656 else
6657     echo "<malloc.h> NOT found." >&4
6658     val="$undef"
6659 fi
6660 $rm_try
6661 set i_malloc
6662 eval $setvar
6663
6664 : check for void type
6665 echo " "
6666 echo "Checking to see how well your C compiler groks the void type..." >&4
6667 case "$voidflags" in
6668 '')
6669         $cat >try.c <<EOCP
6670 #$i_stdlib I_STDLIB
6671 #ifdef I_STDLIB
6672 #include <stdlib.h>
6673 #endif
6674 #if TRY & 1
6675 void sub() {
6676 #else
6677 sub() {
6678 #endif
6679         extern void moo();      /* function returning void */
6680         void (*goo)();          /* ptr to func returning void */
6681 #if TRY & 8
6682         void *hue;              /* generic ptr */
6683 #endif
6684 #if TRY & 2
6685         void (*foo[10])();
6686 #endif
6687
6688 #if TRY & 4
6689         if(goo == moo) {
6690                 exit(0);
6691         }
6692 #endif
6693         exit(0);
6694 }
6695 int main() { sub(); }
6696 EOCP
6697         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6698                 voidflags=$defvoidused
6699         echo "Good.  It appears to support void to the level $package wants.">&4
6700                 if $contains warning .out >/dev/null 2>&1; then
6701                         echo "However, you might get some warnings that look like this:"
6702                         $cat .out
6703                 fi
6704         else
6705 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6706                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6707                         echo "It supports 1..."
6708                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6709                                 echo "It also supports 2..."
6710                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6711                                         voidflags=7
6712                                         echo "And it supports 4 but not 8 definitely."
6713                                 else
6714                                         echo "It doesn't support 4..."
6715                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6716                                                 voidflags=11
6717                                                 echo "But it supports 8."
6718                                         else
6719                                                 voidflags=3
6720                                                 echo "Neither does it support 8."
6721                                         fi
6722                                 fi
6723                         else
6724                                 echo "It does not support 2..."
6725                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6726                                         voidflags=13
6727                                         echo "But it supports 4 and 8."
6728                                 else
6729                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6730                                                 voidflags=5
6731                                                 echo "And it supports 4 but has not heard about 8."
6732                                         else
6733                                                 echo "However it supports 8 but not 4."
6734                                         fi
6735                                 fi
6736                         fi
6737                 else
6738                         echo "There is no support at all for void."
6739                         voidflags=0
6740                 fi
6741         fi
6742 esac
6743 case "$voidflags" in
6744 "$defvoidused") ;;
6745 *)      $cat >&4 <<'EOM'
6746   Support flag bits are:
6747     1: basic void declarations.
6748     2: arrays of pointers to functions returning void.
6749     4: operations between pointers to and addresses of void functions.
6750     8: generic void pointers.
6751 EOM
6752         dflt="$voidflags";
6753         rp="Your void support flags add up to what?"
6754         . ./myread
6755         voidflags="$ans"
6756         ;;
6757 esac
6758 $rm_try
6759
6760 : check for length of pointer
6761 echo " "
6762 case "$ptrsize" in
6763 '')
6764         echo "Checking to see how big your pointers are..." >&4
6765         if test "$voidflags" -gt 7; then
6766                 echo '#define VOID_PTR char *' > try.c
6767         else
6768                 echo '#define VOID_PTR void *' > try.c
6769         fi
6770         $cat >>try.c <<EOCP
6771 #include <stdio.h>
6772 #$i_stdlib I_STDLIB
6773 #ifdef I_STDLIB
6774 #include <stdlib.h>
6775 #endif
6776 int main()
6777 {
6778     printf("%d\n", (int)sizeof(VOID_PTR));
6779     exit(0);
6780 }
6781 EOCP
6782         set try
6783         if eval $compile_ok; then
6784                 ptrsize=`$run ./try`
6785                 echo "Your pointers are $ptrsize bytes long."
6786         else
6787                 dflt='4'
6788                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6789                 rp="What is the size of a pointer (in bytes)?"
6790                 . ./myread
6791                 ptrsize="$ans"
6792         fi
6793         ;;
6794 esac
6795 $rm_try
6796 case "$use64bitall" in
6797 "$define"|true|[yY]*)
6798         case "$ptrsize" in
6799         4)      cat <<EOM >&4
6800
6801 *** You have chosen a maximally 64-bit build,
6802 *** but your pointers are only 4 bytes wide.
6803 *** Please rerun Configure without -Duse64bitall.
6804 EOM
6805                 case "$d_quad" in
6806                 define)
6807                         cat <<EOM >&4
6808 *** Since you have quads, you could possibly try with -Duse64bitint.
6809 EOM
6810                         ;;
6811                 esac
6812                 cat <<EOM >&4
6813 *** Cannot continue, aborting.
6814
6815 EOM
6816
6817                 exit 1
6818                 ;;
6819         esac
6820         ;;
6821 esac
6822
6823
6824 : determine whether to use malloc wrapping
6825 echo " "
6826 case "$usemallocwrap" in
6827 [yY]*|true|$define)     dflt='y' ;;
6828 [nN]*|false|$undef)     dflt='n' ;;
6829 *)      case "$usedevel" in
6830         [yY]*|true|$define)     dflt='y' ;;
6831         *) dflt='n' ;;
6832         esac
6833         ;;
6834 esac
6835 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6836 . ./myread
6837 usemallocwrap="$ans"
6838 case "$ans" in
6839 y*|true)
6840         usemallocwrap="$define" ;;
6841 *)
6842         usemallocwrap="$undef" ;;
6843 esac
6844
6845 : determine which malloc to compile in
6846 echo " "
6847 case "$usemymalloc" in
6848 [yY]*|true|$define)     dflt='y' ;;
6849 [nN]*|false|$undef)     dflt='n' ;;
6850 *)      case "$ptrsize" in
6851         4) dflt='y' ;;
6852         *) dflt='n' ;;
6853         esac
6854         ;;
6855 esac
6856 rp="Do you wish to attempt to use the malloc that comes with $package?"
6857 . ./myread
6858 usemymalloc="$ans"
6859 case "$ans" in
6860 y*|true)
6861         usemymalloc='y'
6862         mallocsrc='malloc.c'
6863         mallocobj="malloc$_o"
6864         d_mymalloc="$define"
6865         case "$libs" in
6866         *-lmalloc*)
6867                 : Remove malloc from list of libraries to use
6868                 echo "Removing unneeded -lmalloc from library list" >&4
6869                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6870                 shift
6871                 libs="$*"
6872                 echo "libs = $libs" >&4
6873                 ;;
6874         esac
6875         ;;
6876 *)
6877         usemymalloc='n'
6878         mallocsrc=''
6879         mallocobj=''
6880         d_mymalloc="$undef"
6881         ;;
6882 esac
6883
6884 : compute the return types of malloc and free
6885 echo " "
6886 $cat >malloc.c <<END
6887 #$i_malloc I_MALLOC
6888 #$i_stdlib I_STDLIB
6889 #include <stdio.h>
6890 #include <sys/types.h>
6891 #ifdef I_MALLOC
6892 #include <malloc.h>
6893 #endif
6894 #ifdef I_STDLIB
6895 #include <stdlib.h>
6896 #endif
6897 #ifdef TRY_MALLOC
6898 void *malloc();
6899 #endif
6900 #ifdef TRY_FREE
6901 void free();
6902 #endif
6903 END
6904 case "$malloctype" in
6905 '')
6906         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6907                 malloctype='void *'
6908         else
6909                 malloctype='char *'
6910         fi
6911         ;;
6912 esac
6913 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6914
6915 case "$freetype" in
6916 '')
6917         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6918                 freetype='void'
6919         else
6920                 freetype='int'
6921         fi
6922         ;;
6923 esac
6924 echo "Your system uses $freetype free(), it would seem." >&4
6925 $rm -f malloc.[co]
6926 : determine where site specific architecture-dependent libraries go.
6927 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6928 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6929 : sitelib may have an optional trailing /share.
6930 case "$sitearch" in
6931 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6932         dflt="$dflt/$archname"
6933         ;;
6934 *)      dflt="$sitearch"
6935         ;;
6936 esac
6937 set sitearch sitearch none
6938 eval $prefixit
6939 $cat <<EOM
6940
6941 The installation process will also create a directory for
6942 architecture-dependent site-specific extensions and modules.
6943
6944 EOM
6945 fn=d~+
6946 rp='Pathname for the site-specific architecture-dependent library files?'
6947 . ./getfile
6948 prefixvar=sitearch
6949 . ./setprefixvar
6950 if $test X"$sitearch" = X"$sitelib"; then
6951         d_sitearch="$undef"
6952 else
6953         d_sitearch="$define"
6954 fi
6955
6956 : Set the vendorprefix variables
6957 $cat <<EOM
6958
6959 The installation process will also create a directory for
6960 vendor-supplied add-ons.  Vendors who supply perl with their system
6961 may find it convenient to place all vendor-supplied files in this
6962 directory rather than in the main distribution directory.  This will
6963 ease upgrades between binary-compatible maintenance versions of perl.
6964
6965 Of course you may also use these directories in whatever way you see
6966 fit.  For example, you might use them to access modules shared over a
6967 company-wide network.
6968
6969 The default answer should be fine for most people.
6970 This causes further questions about vendor add-ons to be skipped
6971 and no vendor-specific directories will be configured for perl.
6972
6973 EOM
6974 rp='Do you want to configure vendor-specific add-on directories?'
6975 case "$usevendorprefix" in
6976 define|true|[yY]*) dflt=y ;;
6977 *)      : User may have set vendorprefix directly on Configure command line.
6978         case "$vendorprefix" in
6979         ''|' ') dflt=n ;;
6980         *)      dflt=y ;;
6981         esac
6982         ;;
6983 esac
6984 . ./myread
6985 case "$ans" in
6986 [yY]*)  fn=d~+
6987         rp='Installation prefix to use for vendor-supplied add-ons?'
6988         case "$vendorprefix" in
6989         '') dflt='' ;;
6990         *)  dflt=$vendorprefix ;;
6991         esac
6992         . ./getfile
6993         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6994         oldvendorprefix=''
6995         case "$vendorprefix" in
6996         '') ;;
6997         *)      case "$ans" in
6998                 "$prefix") ;;
6999                 *) oldvendorprefix="$prefix";;
7000                 esac
7001                 ;;
7002         esac
7003         usevendorprefix="$define"
7004         vendorprefix="$ans"
7005         vendorprefixexp="$ansexp"
7006         ;;
7007 *)      usevendorprefix="$undef"
7008         vendorprefix=''
7009         vendorprefixexp=''
7010         ;;
7011 esac
7012
7013 : Set the vendorlib variables
7014 case "$vendorprefix" in
7015 '')     d_vendorlib="$undef"
7016         vendorlib=''
7017         vendorlibexp=''
7018         ;;
7019 *)      d_vendorlib="$define"
7020         : determine where vendor-supplied modules go.
7021         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7022         case "$vendorlib" in
7023         '')
7024                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7025                 case "$installstyle" in
7026                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7027                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7028                 esac
7029                 ;;
7030         *)      dflt="$vendorlib"
7031                 ;;
7032         esac
7033         fn=d~+
7034         rp='Pathname for the vendor-supplied library files?'
7035         . ./getfile
7036         vendorlib="$ans"
7037         vendorlibexp="$ansexp"
7038         ;;
7039 esac
7040 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7041 prefixvar=vendorlib
7042 . ./installprefix
7043
7044 : Set the vendorarch variables
7045 case "$vendorprefix" in
7046 '')     d_vendorarch="$undef"
7047         vendorarch=''
7048         vendorarchexp=''
7049         ;;
7050 *)      d_vendorarch="$define"
7051         : determine where vendor-supplied architecture-dependent libraries go.
7052         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7053         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7054         : vendorlib may have an optional trailing /share.
7055         case "$vendorarch" in
7056         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7057                 dflt="$dflt/$archname"
7058                 ;;
7059         *)      dflt="$vendorarch" ;;
7060         esac
7061         fn=d~+
7062         rp='Pathname for vendor-supplied architecture-dependent files?'
7063         . ./getfile
7064         vendorarch="$ans"
7065         vendorarchexp="$ansexp"
7066         ;;
7067 esac
7068 prefixvar=vendorarch
7069 . ./installprefix
7070 if $test X"$vendorarch" = X"$vendorlib"; then
7071         d_vendorarch="$undef"
7072 else
7073         d_vendorarch="$define"
7074 fi
7075
7076 : Final catch-all directories to search
7077 $cat <<EOM
7078
7079 Lastly, you can have perl look in other directories for extensions and
7080 modules in addition to those already specified.
7081 These directories will be searched after 
7082         $sitearch 
7083         $sitelib 
7084 EOM
7085 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7086 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7087 echo ' '
7088 case "$otherlibdirs" in
7089 ''|' ') dflt='none' ;;
7090 *)      dflt="$otherlibdirs" ;;
7091 esac
7092 $cat <<EOM
7093 Enter a colon-separated set of extra paths to include in perl's @INC
7094 search path, or enter 'none' for no extra paths.
7095
7096 EOM
7097
7098 rp='Colon-separated list of additional directories for perl to search?'
7099 . ./myread
7100 case "$ans" in
7101 ' '|''|none)    otherlibdirs=' ' ;;     
7102 *)      otherlibdirs="$ans" ;;
7103 esac
7104 case "$otherlibdirs" in
7105 ' ') val=$undef ;;
7106 *)      val=$define ;;
7107 esac
7108 set d_perl_otherlibdirs
7109 eval $setvar
7110
7111 : Cruising for prototypes
7112 echo " "
7113 echo "Checking out function prototypes..." >&4
7114 $cat >prototype.c <<EOCP
7115 #$i_stdlib I_STDLIB
7116 #ifdef I_STDLIB
7117 #include <stdlib.h>
7118 #endif
7119 int main(int argc, char *argv[]) {
7120         exit(0);}
7121 EOCP
7122 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7123         echo "Your C compiler appears to support function prototypes."
7124         val="$define"
7125 else
7126         echo "Your C compiler doesn't seem to understand function prototypes."
7127         val="$undef"
7128 fi
7129 set prototype
7130 eval $setvar
7131 $rm -f prototype*
7132
7133 : Check if ansi2knr is required
7134 case "$prototype" in
7135 "$define") ;;
7136 *)      ansi2knr='ansi2knr'
7137         echo " "
7138         cat <<EOM >&4
7139
7140 $me:  FATAL ERROR:
7141 This version of $package can only be compiled by a compiler that 
7142 understands function prototypes.  Unfortunately, your C compiler 
7143         $cc $ccflags
7144 doesn't seem to understand them.  Sorry about that.
7145
7146 If GNU cc is available for your system, perhaps you could try that instead.  
7147
7148 Eventually, we hope to support building Perl with pre-ANSI compilers.
7149 If you would like to help in that effort, please contact <perlbug@perl.org>.
7150
7151 Aborting Configure now.
7152 EOM
7153         exit 2
7154         ;;
7155 esac
7156
7157 : DTrace support
7158 dflt_dtrace='/usr/sbin/dtrace'
7159 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7160
7161 cat <<EOM
7162
7163 Perl can be built to support DTrace on platforms that support it.
7164 DTrace is a diagnosis and performance analysis tool from Sun.
7165
7166 If this doesn't make any sense to you, just accept the default '$dflt'.
7167 EOM
7168
7169 while $test 1 ; do
7170         case "$usedtrace" in
7171         $define|true|[yY]*)
7172                 dflt='y'
7173                 ;;
7174         ?*)
7175                 dflt='y'
7176                 dflt_dtrace=$usedtrace
7177                 ;;
7178         *)
7179                 dflt='n'
7180                 ;;
7181         esac
7182
7183         rp='Support DTrace if available?'
7184         . ./myread
7185         case "$ans" in
7186         y|Y)    val="$define" ;;
7187         *)      val="$undef" ;;
7188         esac
7189         set usedtrace
7190         eval $setvar
7191
7192         test "X$usedtrace" != "X$define" && break
7193
7194         echo " "
7195         rp='Where is the dtrace executable?'
7196         dflt=$dflt_dtrace
7197         . ./getfile
7198         val="$ans"
7199         set dtrace
7200         eval $setvar
7201
7202         if $test -f $dtrace
7203         then
7204                 if $dtrace -h -s ../perldtrace.d \
7205                         -o perldtrace.tmp >/dev/null 2>&1 \
7206                         && rm -f perldtrace.tmp
7207                 then
7208                         echo " "
7209                         echo "Good: your $dtrace knows about the -h flag."
7210                 else
7211                         cat >&2 <<EOM
7212
7213 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7214 ***
7215 *** Your installed dtrace doesn't support the -h switch to compile a D
7216 *** program into a C header. Can't continue.
7217
7218 EOM
7219                         exit 1
7220                 fi
7221                 break;
7222         fi
7223
7224         case "$fastread" in
7225         yes)
7226                 cat >&2 <<EOM
7227
7228 *** $me:  Fatal Error:  $dtrace not found.
7229 *** Can't continue.
7230
7231 EOM
7232                 exit 1
7233                 ;;
7234         *)
7235                 echo "*** $dtrace was not found."
7236                 echo " "
7237                 ;;
7238         esac
7239 done
7240
7241 : See if we want extra modules installed
7242 echo " "
7243 case "$extras" in
7244 '') dflt='n';;
7245 *) dflt='y';;
7246 esac
7247 cat <<EOM
7248 Perl can be built with extra modules or bundles of modules which
7249 will be fetched from the CPAN and installed alongside Perl.
7250
7251 Notice that you will need access to the CPAN; either via the Internet,
7252 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7253 be asked later to configure the CPAN.pm module which will in turn do
7254 the installation of the rest of the extra modules or bundles.)
7255
7256 Notice also that if the modules require any external software such as
7257 libraries and headers (the libz library and the zlib.h header for the
7258 Compress::Zlib module, for example) you MUST have any such software
7259 already installed, this configuration process will NOT install such
7260 things for you.
7261
7262 If this doesn't make any sense to you, just accept the default '$dflt'.
7263 EOM
7264 rp='Install any extra modules (y or n)?'
7265 . ./myread
7266 case "$ans" in
7267 y|Y)
7268         cat <<EOM
7269
7270 Please list any extra modules or bundles to be installed from CPAN,
7271 with spaces between the names.  The names can be in any format the
7272 'install' command of CPAN.pm will understand.  (Answer 'none',
7273 without the quotes, to install no extra modules or bundles.)
7274 EOM
7275         rp='Extras?'
7276         dflt="$extras"
7277         . ./myread
7278         extras="$ans"
7279 esac
7280 case "$extras" in
7281 ''|'none')
7282         val=''
7283         $rm -f ../extras.lst
7284         ;;
7285 *)      echo "(Saving the list of extras for later...)"
7286         echo "$extras" > ../extras.lst
7287         val="'$extras'"
7288         ;;
7289 esac
7290 set extras
7291 eval $setvar
7292 echo " "
7293
7294 : determine where html pages for programs go
7295 set html1dir html1dir none
7296 eval $prefixit
7297 $cat <<EOM
7298
7299 If you wish to install html files for programs in $spackage, indicate
7300 the appropriate directory here.  To skip installing html files,
7301 answer "none".
7302 EOM
7303 case "$html1dir" in
7304 ''|none|$undef|' ') dflt=none ;;
7305 *) dflt=$html1dir ;;
7306 esac
7307 fn=dn+~
7308 rp="Directory for the main $spackage html pages?"
7309 . ./getfile
7310 prefixvar=html1dir
7311 . ./setprefixvar
7312 : Use ' ' for none so value is preserved next time through Configure
7313 $test X"$html1dir" = "X" && html1dir=' '
7314
7315 : determine where html pages for libraries and modules go
7316 set html3dir html3dir none
7317 eval $prefixit
7318 $cat <<EOM
7319
7320 If you wish to install html files for modules associated with $spackage,
7321 indicate the appropriate directory here.  To skip installing html files,
7322 answer "none".
7323 EOM
7324 : There is no obvious default.  If they have specified html1dir, then
7325 : try to key off that, possibly changing .../html1 into .../html3.
7326 case "$html3dir" in
7327 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7328 *) dflt=$html3dir ;;
7329 esac
7330 fn=dn+~
7331 rp="Directory for the $spackage module html pages?"
7332 . ./getfile
7333 prefixvar=html3dir
7334 . ./setprefixvar
7335 : Use ' ' for none so value is preserved next time through Configure
7336 $test X"$html3dir" = "X" && html3dir=' '
7337
7338 : determine whether to install perl also as /usr/bin/perl
7339
7340 echo " "
7341 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7342         $cat <<EOM
7343 Many scripts expect perl to be installed as /usr/bin/perl.
7344
7345 If you want to, I can install the perl you are about to compile
7346 as /usr/bin/perl (in addition to $bin/perl).
7347 EOM
7348         if test -f /usr/bin/perl; then
7349             $cat <<EOM
7350
7351 However, please note that because you already have a /usr/bin/perl,
7352 overwriting that with a new Perl would very probably cause problems.
7353 Therefore I'm assuming you don't want to do that (unless you insist).
7354
7355 EOM
7356             case "$installusrbinperl" in
7357             "$define"|[yY]*)    dflt='y';;
7358             *)                  dflt='n';;
7359             esac
7360         else
7361             $cat <<EOM
7362
7363 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7364
7365 EOM
7366             case "$installusrbinperl" in
7367             "$undef"|[nN]*)     dflt='n';;
7368             *)                  dflt='y';;
7369             esac
7370         fi
7371         rp="Do you want to install perl as /usr/bin/perl?"
7372         . ./myread
7373         case "$ans" in
7374         [yY]*)  val="$define";;
7375         *)      val="$undef" ;;
7376         esac
7377 else
7378         val="$undef"
7379 fi
7380 set installusrbinperl
7381 eval $setvar
7382
7383 : Check if we are using the GNU C library
7384 echo " "
7385 echo "Checking for GNU C Library..." >&4
7386 cat >try.c <<'EOCP'
7387 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7388    alone are insufficient to distinguish different versions, such as
7389    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7390    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7391 */
7392 #include <stdio.h>
7393 int main(void)
7394 {
7395 #ifdef __GLIBC__
7396 #   ifdef __GLIBC_MINOR__
7397 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7398 #           include <gnu/libc-version.h>
7399             printf("%s\n",  gnu_get_libc_version());
7400 #       else
7401             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7402 #       endif
7403 #   else
7404         printf("%d\n",  __GLIBC__);
7405 #   endif
7406     return 0;
7407 #else
7408     return 1;
7409 #endif
7410 }
7411 EOCP
7412 set try
7413 if eval $compile_ok && $run ./try > glibc.ver; then
7414         val="$define"
7415         gnulibc_version=`$cat glibc.ver`
7416         echo "You are using the GNU C Library version $gnulibc_version"
7417 else
7418         val="$undef"
7419         gnulibc_version=''
7420         echo "You are not using the GNU C Library"
7421 fi
7422 $rm_try glibc.ver
7423 set d_gnulibc
7424 eval $setvar
7425
7426 : see if nm is to be used to determine whether a symbol is defined or not
7427 case "$usenm" in
7428 '')
7429         dflt=''
7430         case "$d_gnulibc" in
7431         "$define")
7432                 echo " "
7433                 echo "nm probably won't work on the GNU C Library." >&4
7434                 dflt=n
7435                 ;;
7436         esac
7437         case "$dflt" in
7438         '') 
7439                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7440                         echo " "
7441                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7442                         echo "'nm' won't be sufficient on this sytem." >&4
7443                         dflt=n
7444                 fi
7445                 ;;
7446         esac
7447         case "$dflt" in
7448         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7449                 if $test $dflt -gt 20; then
7450                         dflt=y
7451                 else
7452                         dflt=n
7453                 fi
7454                 ;;
7455         esac
7456         ;;
7457 *)
7458         case "$usenm" in
7459         true|$define) dflt=y;;
7460         *) dflt=n;;
7461         esac
7462         ;;
7463 esac
7464 $cat <<EOM
7465
7466 I can use $nm to extract the symbols from your C libraries. This
7467 is a time consuming task which may generate huge output on the disk (up
7468 to 3 megabytes) but that should make the symbols extraction faster. The
7469 alternative is to skip the 'nm' extraction part and to compile a small
7470 test program instead to determine whether each symbol is present. If
7471 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7472 this may be the best solution.
7473
7474 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7475
7476 EOM
7477 rp="Shall I use $nm to extract C symbols from the libraries?"
7478 . ./myread
7479 case "$ans" in
7480 [Nn]*) usenm=false;;
7481 *) usenm=true;;
7482 esac
7483
7484 runnm=$usenm
7485 case "$reuseval" in
7486 true) runnm=false;;
7487 esac
7488
7489 : nm options which may be necessary
7490 case "$nm_opt" in
7491 '') if $test -f /mach_boot; then
7492                 nm_opt=''       # Mach
7493         elif $test -d /usr/ccs/lib; then
7494                 nm_opt='-p'     # Solaris (and SunOS?)
7495         elif $test -f /dgux; then
7496                 nm_opt='-p'     # DG-UX
7497         elif $test -f /lib64/rld; then
7498                 nm_opt='-p'     # 64-bit Irix
7499         else
7500                 nm_opt=''
7501         fi;;
7502 esac
7503
7504 : nm options which may be necessary for shared libraries but illegal
7505 : for archive libraries.  Thank you, Linux.
7506 case "$nm_so_opt" in
7507 '')     case "$myuname" in
7508         *linux*|gnu*)
7509                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7510                         nm_so_opt='--dynamic'
7511                 fi
7512                 ;;
7513         esac
7514         ;;
7515 esac
7516
7517 : Figure out where the libc is located
7518 case "$runnm" in
7519 true)
7520 : get list of predefined functions in a handy place
7521 echo " "
7522 case "$libc" in
7523 '') libc=unknown
7524         case "$libs" in
7525         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7526         esac
7527         ;;
7528 esac
7529 case "$libs" in
7530 '') ;;
7531 *)  for thislib in $libs; do
7532         case "$thislib" in
7533         -lc|-lc_s)
7534                 : Handle C library specially below.
7535                 ;;
7536         -l*)
7537                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7538                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7539                         :
7540                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7541                         :
7542                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7543                         :
7544                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7545                         :
7546                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7547                         :
7548                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7549                         :
7550                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7551                         :
7552                 else
7553                         try=''
7554                 fi
7555                 libnames="$libnames $try"
7556                 ;;
7557         *) libnames="$libnames $thislib" ;;
7558         esac
7559         done
7560         ;;
7561 esac
7562 xxx=normal
7563 case "$libc" in
7564 unknown)
7565         set /lib/libc.$so
7566         for xxx in $libpth; do
7567                 $test -r $1 || set $xxx/libc.$so
7568                 : The messy sed command sorts on library version numbers.
7569                 $test -r $1 || \
7570                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7571                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7572                                 h
7573                                 s/[0-9][0-9]*/0000&/g
7574                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7575                                 G
7576                                 s/\n/ /' | \
7577                          $sort | $sed -e 's/^.* //'`
7578                 eval set \$$#
7579         done
7580         $test -r $1 || set /usr/ccs/lib/libc.$so
7581         $test -r $1 || set /lib/libsys_s$_a
7582         ;;
7583 *)
7584         set blurfl
7585         ;;
7586 esac
7587 if $test -r "$1"; then
7588         echo "Your (shared) C library seems to be in $1."
7589         libc="$1"
7590 elif $test -r /lib/libc && $test -r /lib/clib; then
7591         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7592         xxx=apollo
7593         libc='/lib/clib /lib/libc'
7594         if $test -r /lib/syslib; then
7595                 echo "(Your math library is in /lib/syslib.)"
7596                 libc="$libc /lib/syslib"
7597         fi
7598 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7599         echo "Your C library seems to be in $libc, as you said before."
7600 elif $test -r $incpath/usr/lib/libc$_a; then
7601         libc=$incpath/usr/lib/libc$_a;
7602         echo "Your C library seems to be in $libc.  That's fine."
7603 elif $test -r /lib/libc$_a; then
7604         libc=/lib/libc$_a;
7605         echo "Your C library seems to be in $libc.  You're normal."
7606 else
7607         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7608                 :
7609         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7610                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7611         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7612                 :
7613         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7614                 :
7615         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7616                 :
7617         else
7618                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7619         fi
7620         if $test -r "$tans"; then
7621                 echo "Your C library seems to be in $tans, of all places."
7622                 libc=$tans
7623         else
7624                 libc='blurfl'
7625         fi
7626 fi
7627 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7628         dflt="$libc"
7629         cat <<EOM
7630
7631 If the guess above is wrong (which it might be if you're using a strange
7632 compiler, or your machine supports multiple models), you can override it here.
7633
7634 EOM
7635 else
7636         dflt=''
7637         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7638         cat >&4 <<EOM
7639 I can't seem to find your C library.  I've looked in the following places:
7640
7641 EOM
7642         $sed 's/^/      /' libpath
7643         cat <<EOM
7644
7645 None of these seems to contain your C library. I need to get its name...
7646
7647 EOM
7648 fi
7649 fn=f
7650 rp='Where is your C library?'
7651 . ./getfile
7652 libc="$ans"
7653
7654 echo " "
7655 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7656 set X `cat libnames`
7657 shift
7658 xxx=files
7659 case $# in 1) xxx=file; esac
7660 echo "Extracting names from the following $xxx for later perusal:" >&4
7661 echo " "
7662 $sed 's/^/      /' libnames >&4
7663 echo " "
7664 $echo $n "This may take a while...$c" >&4
7665
7666 for file in $*; do
7667         case $file in
7668         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7669         *) $nm $nm_opt $file 2>/dev/null;;
7670         esac
7671 done >libc.tmp
7672
7673 $echo $n ".$c"
7674 $grep fprintf libc.tmp > libc.ptf
7675 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7676 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7677 xxx='[ADTSIWi]'
7678 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7679         eval $xscan;\
7680         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7681                 eval $xrun
7682 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7683         eval $xscan;\
7684         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7685                 eval $xrun
7686 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7703                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7704         eval $xscan;\
7705         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7706                 eval $xrun
7707 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7708         eval $xscan;\
7709         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7710                 eval $xrun
7711 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7712         eval $xscan;\
7713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714                 eval $xrun
7715 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7716         eval $xscan;\
7717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718                 eval $xrun
7719 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7720         eval $xscan;\
7721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722                 eval $xrun
7723 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7724         eval $xscan;\
7725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726                 eval $xrun
7727 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7728         eval $xscan;\
7729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730                 eval $xrun
7731 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7732         eval $xscan;\
7733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7734                 eval $xrun
7735 else
7736         $nm -p $* 2>/dev/null >libc.tmp
7737         $grep fprintf libc.tmp > libc.ptf
7738         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7739                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7740         then
7741                 nm_opt='-p'
7742                 eval $xrun
7743         else
7744                 echo " "
7745                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7746                 com=''
7747                 if $ar t $libc > libc.tmp && \
7748                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7749                 then
7750                         for thisname in $libnames $libc; do
7751                                 $ar t $thisname >>libc.tmp
7752                         done
7753                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7754                         echo "Ok." >&4
7755                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7756                         for thisname in $libnames $libc; do
7757                                 $ar tv $thisname >>libc.tmp
7758                                 emximp -o tmp.imp $thisname \
7759                                     2>/dev/null && \
7760                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7761                                     < tmp.imp >>libc.tmp
7762                                 $rm -f tmp.imp
7763                         done
7764                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7765                         echo "Ok." >&4
7766                 else
7767                         echo "$ar didn't seem to work right." >&4
7768                         echo "Maybe this is a Cray...trying bld instead..." >&4
7769                         if  bld t $libc | \
7770                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7771                                 $test -s libc.list
7772                         then
7773                                 for thisname in $libnames; do
7774                                         bld t $libnames | \
7775                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7776                                         $ar t $thisname >>libc.tmp
7777                                 done
7778                                 echo "Ok." >&4
7779                         else
7780                                 echo "That didn't work either.  Giving up." >&4
7781                                 exit 1
7782                         fi
7783                 fi
7784         fi
7785 fi
7786 nm_extract="$com"
7787 case "$PASE" in
7788 define)
7789     echo " "
7790     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7791     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7792     ;;
7793 *)  if $test -f /lib/syscalls.exp; then
7794         echo " "
7795         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7796         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7797                 /lib/syscalls.exp >>libc.list
7798     fi
7799     ;;
7800 esac
7801 ;;
7802 esac
7803 $rm -f libnames libpath
7804
7805 : see if dld is available
7806 set dld.h i_dld
7807 eval $inhdr
7808
7809 : Check if we are using C++
7810 echo " "
7811 echo "Checking for C++..." >&4
7812 $cat >try.c <<'EOCP'
7813 #include <stdio.h>
7814 int main(void)
7815 {
7816 #ifdef __cplusplus
7817     return 0;
7818 #else
7819     return 1;
7820 #endif
7821 }
7822 EOCP
7823 set try
7824 if eval $compile_ok && $run ./try; then
7825         val="$define"
7826         echo "You are using a C++ compiler."
7827 else
7828         val="$undef"
7829         echo "You are not using a C++ compiler."
7830 fi
7831 $rm_try cplusplus$$
7832 set d_cplusplus
7833 eval $setvar
7834
7835 : is a C symbol defined?
7836 csym='tlook=$1;
7837 case "$3" in
7838 -v) tf=libc.tmp; tdc="";;
7839 -a) tf=libc.tmp; tdc="[]";;
7840 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7841 esac;
7842 case "$d_cplusplus" in
7843     $define)    extern_C="extern \"C\"" ;;
7844     *)          extern_C="extern"       ;;
7845 esac;
7846 tx=yes;
7847 case "$reuseval-$4" in
7848 true-) ;;
7849 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7850 esac;
7851 case "$tx" in
7852 yes)
7853         tval=false;
7854         if $test "$runnm" = true; then
7855                 if $contains $tlook $tf >/dev/null 2>&1; then
7856                         tval=true;
7857                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7858                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7859                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7860                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7861                         $rm_try;
7862                 fi;
7863         else
7864                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7865                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7866                 $rm_try;
7867         fi;
7868         ;;
7869 *)
7870         case "$tval" in
7871         $define) tval=true;;
7872         *) tval=false;;
7873         esac;
7874         ;;
7875 esac;
7876 eval "$2=$tval"'
7877
7878 : define an is-in-libc? function
7879 inlibc='echo " "; td=$define; tu=$undef;
7880 sym=$1; var=$2; eval "was=\$$2";
7881 tx=yes;
7882 case "$reuseval$was" in
7883 true) ;;
7884 true*) tx=no;;
7885 esac;
7886 case "$tx" in
7887 yes)
7888         set $sym tres -f;
7889         eval $csym;
7890         case "$tres" in
7891         true)
7892                 echo "$sym() found." >&4;
7893                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7894         *)
7895                 echo "$sym() NOT found." >&4;
7896                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7897         esac;;
7898 *)
7899         case "$was" in
7900         $define) echo "$sym() found." >&4;;
7901         *) echo "$sym() NOT found." >&4;;
7902         esac;;
7903 esac'
7904
7905 : see if dlopen exists
7906 xxx_runnm="$runnm"
7907 xxx_ccflags="$ccflags"
7908 runnm=false
7909 : with g++ one needs -shared to get is-in-libc to work for dlopen
7910 case "$gccversion" in
7911 '')     ;;
7912 *)      case "$d_cplusplus" in
7913         "$define") ccflags="$ccflags -shared" ;;
7914         esac
7915         ;;
7916 esac
7917 set dlopen d_dlopen
7918 eval $inlibc
7919 runnm="$xxx_runnm"
7920 ccflags="$xxx_ccflags"
7921
7922 : see if this is a unistd.h system
7923 set unistd.h i_unistd
7924 eval $inhdr
7925
7926 : determine which dynamic loading, if any, to compile in
7927 echo " "
7928 dldir="ext/DynaLoader"
7929 case "$usedl" in
7930 $define|y|true)
7931         dflt='y'
7932         usedl="$define"
7933         ;;
7934 $undef|n|false)
7935         dflt='n'
7936         usedl="$undef"
7937         ;;
7938 *)
7939         dflt='n'
7940         case "$d_dlopen" in
7941             $define) dflt='y' ;;
7942         esac
7943         case "$i_dld" in
7944             $define) dflt='y' ;;
7945         esac
7946         : Does a dl_xxx.xs file exist for this operating system
7947         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7948         ;;
7949 esac
7950 rp="Do you wish to use dynamic loading?"
7951 . ./myread
7952 usedl="$ans"
7953 bin_ELF="$undef"
7954 case "$ans" in
7955 y*) usedl="$define"
7956         case "$dlsrc" in
7957         '')
7958                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7959                         dflt="$dldir/dl_${osname}.xs"
7960                 elif $test "$d_dlopen" = "$define" ; then
7961                         dflt="$dldir/dl_dlopen.xs"
7962                 elif $test "$i_dld" = "$define" ; then
7963                         dflt="$dldir/dl_dld.xs"
7964                 else
7965                         dflt=''
7966                 fi
7967                 ;;
7968         *)      dflt="$dldir/$dlsrc"
7969                 ;;
7970         esac
7971     echo "The following dynamic loading files are available:"
7972         : Can not go over to $dldir because getfile has path hard-coded in.
7973         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7974         rp="Source file to use for dynamic loading"
7975         fn="fne"
7976         gfpth="$src"
7977         . ./getfile
7978         usedl="$define"
7979         : emulate basename
7980         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7981
7982         $cat << EOM
7983
7984 Some systems may require passing special flags to $cc -c to
7985 compile modules that will be used to create a shared library.
7986 To use no flags, say "none".
7987
7988 EOM
7989     case "$cccdlflags" in
7990     '') case "$gccversion" in
7991                 '') case "$osname" in
7992                         hpux)   dflt='+z' ;;
7993                         next)   dflt='none' ;;
7994                         irix*)  dflt='-KPIC' ;;
7995                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7996                         sunos)  dflt='-pic' ;;
7997                         *)      dflt='none' ;;
7998                     esac
7999                         ;;
8000                 *)  case "$osname" in
8001                         darwin) dflt='none' ;;
8002                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8003                         *)      dflt='-fpic' ;;
8004                     esac ;;
8005             esac ;;
8006         ' ') dflt='none' ;;
8007     *)  dflt="$cccdlflags" ;;
8008     esac
8009     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8010     . ./myread
8011     case "$ans" in
8012     none) cccdlflags=' ' ;;
8013     *) cccdlflags="$ans" ;;
8014     esac
8015
8016     cat << EOM
8017
8018 Some systems use ld to create libraries that can be dynamically loaded,
8019 while other systems (such as those using ELF) use $cc.
8020
8021 EOM
8022         case "$ld" in
8023         '')     $cat >try.c <<EOM
8024 /* Test for whether ELF binaries are produced */
8025 #include <fcntl.h>
8026 #$i_stdlib I_STDLIB
8027 #ifdef I_STDLIB
8028 #include <stdlib.h>
8029 #endif
8030 #$i_unistd I_UNISTD
8031 #ifdef I_UNISTD
8032 #include <unistd.h>
8033 #endif
8034 int main() {
8035         char b[4];
8036         int i = open("a.out",O_RDONLY);
8037         if(i == -1)
8038                 exit(1); /* fail */
8039         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8040                 exit(0); /* succeed (yes, it's ELF) */
8041         else
8042                 exit(1); /* fail */
8043 }
8044 EOM
8045                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8046                         cat <<EOM
8047 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8048 EOM
8049                         dflt="$cc"
8050                         bin_ELF="$define"
8051                 else
8052                         echo "I'll use ld to build dynamic libraries."
8053                         dflt='ld'
8054                 fi
8055                 $rm_try
8056                 ;;
8057         *)      dflt="$ld"
8058                 ;;
8059         esac
8060
8061     rp="What command should be used to create dynamic libraries?"
8062     . ./myread
8063         ld="$ans"
8064
8065     cat << EOM
8066
8067 Some systems may require passing special flags to $ld to create a
8068 library that can be dynamically loaded.  If your ld flags include
8069 -L/other/path options to locate libraries outside your loader's normal
8070 search path, you may need to specify those -L options here as well.  To
8071 use no flags, say "none".
8072
8073 EOM
8074     case "$lddlflags" in
8075     '') case "$osname" in
8076                         beos) dflt='-nostart' ;;
8077                         haiku) dflt='-shared' ;;
8078                         hpux) dflt='-b';
8079                               case "$gccversion" in
8080                               '') dflt="$dflt +vnocompatwarnings" ;;
8081                               esac
8082                               ;;
8083                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8084                         next)  dflt='none' ;;
8085                         solaris) dflt='-G' ;;
8086                         sunos) dflt='-assert nodefinitions' ;;
8087                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8088                 *)     dflt='none' ;;
8089                         esac
8090                         ;;
8091     *) dflt="$lddlflags" ;;
8092     esac
8093
8094         : Try to guess additional flags to pick up local libraries.
8095         : Be careful not to append to a plain 'none'
8096         case "$dflt" in
8097         none) dflt='' ;;
8098         esac
8099         for thisflag in $ldflags; do
8100                 case "$thisflag" in
8101                 -L*|-R*|-Wl,-R*)
8102                         case " $dflt " in
8103                         *" $thisflag "*) ;;
8104                         *) dflt="$dflt $thisflag" ;;
8105                         esac
8106                         ;;
8107                 esac
8108         done
8109
8110         case "$dflt" in
8111         ''|' ') dflt='none' ;;
8112         esac
8113
8114         case "$ldflags" in
8115         *-fstack-protector*)
8116             case "$dflt" in
8117                         *-fstack-protector*) ;; # Don't add it again
8118                         *) dflt="$dflt -fstack-protector" ;; 
8119                 esac
8120                 ;;
8121         esac
8122
8123
8124     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8125     . ./myread
8126     case "$ans" in
8127     none) lddlflags=' ' ;;
8128     *) lddlflags="$ans" ;;
8129     esac
8130
8131         cat <<EOM
8132
8133 Some systems may require passing special flags to $cc to indicate that
8134 the resulting executable will use dynamic linking.  To use no flags,
8135 say "none".
8136
8137 EOM
8138     case "$ccdlflags" in
8139     '') case "$osname" in
8140             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8141             next|sunos) dflt='none' ;;
8142             *)          dflt='none' ;;
8143             esac ;;
8144     ' ')  dflt='none' ;;
8145     *)  dflt="$ccdlflags" ;;
8146     esac
8147     rp="Any special flags to pass to $cc to use dynamic linking?"
8148     . ./myread
8149     case "$ans" in
8150     none) ccdlflags=' ' ;;
8151     *) ccdlflags="$ans" ;;
8152     esac
8153     ;;
8154 *)  usedl="$undef"
8155         ld='ld'
8156     dlsrc='dl_none.xs'
8157     lddlflags=''
8158     ccdlflags=''
8159     ;;
8160 esac
8161
8162 : Do we want a shared libperl?
8163 also=''
8164 case "$usedl" in
8165 $undef)
8166         # No dynamic loading being used, so don't bother even to prompt.
8167         useshrplib='false'
8168         ;;
8169 *)      case "$useshrplib" in
8170         '')     case "$osname" in
8171                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8172                         dflt=y
8173                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8174                         ;;
8175                 next*)
8176                         case "$osvers" in
8177                         4*)     dflt=y
8178                                 also='Building a shared libperl is needed for MAB support.'
8179                                 ;;
8180                         *)      dflt=n
8181                                 ;;
8182                         esac
8183                         ;;
8184                 *)      dflt=n
8185                         ;;
8186                 esac
8187                 ;;
8188         $define|true|[Yy]*)
8189                 dflt=y
8190                 ;;
8191         *)      dflt=n
8192                 ;;
8193         esac
8194         $cat << EOM
8195
8196 The perl executable is normally obtained by linking perlmain.c with
8197 libperl${_a}, any static extensions (usually just DynaLoader), and
8198 any other libraries needed on this system (such as -lm, etc.).  Since
8199 your system supports dynamic loading, it is probably possible to build
8200 a shared libperl.$so.  If you will have more than one executable linked
8201 to libperl.$so, this will significantly reduce the size of each
8202 executable, but it may have a noticeable effect on performance.  The
8203 default is probably sensible for your system.
8204 $also
8205
8206 EOM
8207         rp="Build a shared libperl.$so (y/n)"
8208         . ./myread
8209         case "$ans" in
8210         true|$define|[Yy]*)
8211                 useshrplib='true'  ;;
8212         *)      useshrplib='false' ;;
8213         esac
8214         ;;
8215 esac
8216
8217 case "$useshrplib" in
8218 true)
8219         case "$userelocatableinc" in
8220         true|define)
8221                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8222                 echo "See INSTALL for an explanation why that won't work." >&4
8223                 exit 4
8224                 ;;
8225         esac
8226         case "$libperl" in
8227         '')
8228                 # Figure out a good name for libperl.so.  Since it gets stored in
8229                 # a version-specific architecture-dependent library, the version
8230                 # number isn't really that important, except for making cc/ld happy.
8231                 #
8232                 # A name such as libperl.so.10.1
8233                 majmin="libperl.$so.$patchlevel.$subversion"
8234                 # A name such as libperl.so.100
8235                 majonly=`echo $patchlevel $subversion |
8236                         $awk '{printf "%d%02d", $1, $2}'`
8237                 majonly=libperl.$so.$majonly
8238                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8239                 # rely on figuring it out from the naming of libc.
8240                 case "${osname}${osvers}" in
8241                 next4*)
8242                         dflt=libperl.5.$so
8243                         # XXX How handle the --version stuff for MAB?
8244                         ;;
8245                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8246                         dflt=libperl.$so
8247                         ;;
8248                 cygwin*) # ld links now against the dll directly
8249                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8250                         majonly=`echo $patchlevel $subversion |
8251                                 $awk '{printf "%03d%03d", $1, $2}'`
8252                         majonly=cygperl5.$majonly.$so
8253                         dflt=$majmin
8254                         ;;
8255                 *)      # Try to guess based on whether libc has major.minor.
8256                         case "$libc" in
8257                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8258                         *libc.$so.[0-9]*) dflt=$majonly ;;
8259                         *)      dflt=libperl.$so ;;
8260                         esac
8261                         ;;
8262                 esac
8263                 ;;
8264         *)      dflt=$libperl
8265                 ;;
8266         esac
8267         cat << EOM
8268
8269 I need to select a good name for the shared libperl.  If your system uses
8270 library names with major and minor numbers, then you might want something
8271 like $majmin.  Alternatively, if your system uses a single version
8272 number for shared libraries, then you might want to use $majonly.
8273 Or, your system might be quite happy with a simple libperl.$so.
8274
8275 Since the shared libperl will get installed into a version-specific
8276 architecture-dependent directory, the version number of the shared perl
8277 library probably isn't important, so the default should be o.k.
8278
8279 EOM
8280         rp='What name do you want to give to the shared libperl?'
8281         . ./myread
8282         libperl=$ans
8283         echo "Ok, I'll use $libperl"
8284         ;;
8285 *)
8286         libperl="libperl${_a}"
8287         ;;
8288 esac
8289
8290 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8291 case "$shrpdir" in
8292 '') ;;
8293 *)      $cat >&4 <<EOM
8294 WARNING:  Use of the shrpdir variable for the installation location of
8295 the shared $libperl is not supported.  It was never documented and
8296 will not work in this version.  Let me (perlbug@perl.org)
8297 know of any problems this may cause.
8298
8299 EOM
8300         case "$shrpdir" in
8301         "$archlibexp/CORE")
8302                 $cat >&4 <<EOM
8303 But your current setting of $shrpdir is
8304 the default anyway, so it's harmless.
8305 EOM
8306                 ;;
8307         *)
8308                 $cat >&4 <<EOM
8309 Further, your current attempted setting of $shrpdir
8310 conflicts with the value of $archlibexp/CORE
8311 that installperl will use.
8312 EOM
8313                 ;;
8314         esac
8315         ;;
8316 esac
8317
8318 # How will the perl executable find the installed shared $libperl?
8319 # Add $xxx to ccdlflags.
8320 # If we can't figure out a command-line option, use $shrpenv to
8321 # set env LD_RUN_PATH.  The main perl makefile uses this.
8322 shrpdir=$archlibexp/CORE
8323 xxx=''
8324 tmp_shrpenv=''
8325 if "$useshrplib"; then
8326     case "$osname" in
8327         aix)
8328                 # We'll set it in Makefile.SH...
8329                 ;;
8330         solaris)
8331                 xxx="-R $shrpdir"
8332                 ;;
8333         freebsd|netbsd|openbsd|interix|dragonfly)
8334                 xxx="-Wl,-R$shrpdir"
8335                 ;;
8336         bsdos|linux|irix*|dec_osf|gnu*)
8337                 xxx="-Wl,-rpath,$shrpdir"
8338                 ;;
8339         next)
8340                 # next doesn't like the default...
8341                 ;;
8342         beos)
8343                 # beos doesn't like the default, either.
8344                 ;;
8345         haiku)
8346                 # Haiku doesn't like the default, either.
8347                 ;;
8348         hpux*)
8349                 # hpux doesn't like the default, either.
8350                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8351                 ;;
8352         cygwin)
8353                 # cygwin needs only ldlibpth
8354                 ;;
8355         *)
8356                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8357                 ;;
8358         esac
8359         case "$xxx" in
8360         '') ;;
8361         *)
8362                 # Only add $xxx if it isn't already in ccdlflags.
8363                 case " $ccdlflags " in
8364                 *" $xxx "*)     ;;
8365                 *)      ccdlflags="$ccdlflags $xxx"
8366                         cat <<EOM >&4
8367
8368 Adding $xxx to the flags
8369 passed to $ld so that the perl executable will find the
8370 installed shared $libperl.
8371
8372 EOM
8373                         ;;
8374                 esac
8375                 ;;
8376         esac
8377 fi
8378 # Fix ccdlflags in AIX for building external extensions.
8379 # (For building Perl itself bare -bE:perl.exp is needed,
8380 #  Makefile.SH takes care of this.)
8381 case "$osname" in
8382 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8383 esac
8384 # Respect a hint or command-line value.
8385 case "$shrpenv" in
8386 '') shrpenv="$tmp_shrpenv" ;;
8387 esac
8388 case "$ldlibpthname" in
8389 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8390 none)   ldlibpthname='' ;;
8391 esac
8392
8393 : determine where manual pages are on this system
8394 echo " "
8395 case "$sysman" in
8396 '') 
8397         syspath='/usr/share/man/man1 /usr/man/man1'
8398         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8399         syspath="$syspath /usr/man/u_man/man1"
8400         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8401         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8402         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8403         sysman=`./loc . /usr/man/man1 $syspath`
8404         ;;
8405 esac
8406 if $test -d "$sysman"; then
8407         echo "System manual is in $sysman." >&4
8408 else
8409         echo "Could not find manual pages in source form." >&4
8410 fi
8411
8412 : determine where manual pages go
8413 set man1dir man1dir none
8414 eval $prefixit
8415 $cat <<EOM
8416
8417 $spackage has manual pages available in source form.
8418 EOM
8419 case "$nroff" in
8420 nroff)
8421         echo "However, you don't have nroff, so they're probably useless to you."
8422         case "$man1dir" in
8423         '') man1dir="none";;
8424         esac;;
8425 esac
8426 echo "If you don't want the manual sources installed, answer 'none'."
8427 case "$man1dir" in
8428 ' ') dflt=none
8429         ;;
8430 '')
8431         lookpath="$prefixexp/share/man/man1"
8432         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8433         lookpath="$lookpath $prefixexp/man/p_man/man1"
8434         lookpath="$lookpath $prefixexp/man/u_man/man1"
8435         lookpath="$lookpath $prefixexp/man/man.1"
8436         case "$sysman" in
8437         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8438         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8439         esac
8440         set dflt
8441         eval $prefixup
8442         ;;
8443 *)  dflt="$man1dir"
8444         ;;
8445 esac
8446 echo " "
8447 fn=dn+~
8448 rp="Where do the main $spackage manual pages (source) go?"
8449 . ./getfile
8450 if $test "X$man1direxp" != "X$ansexp"; then
8451         installman1dir=''
8452 fi
8453 prefixvar=man1dir
8454 . ./setprefixvar
8455
8456 case "$man1dir" in
8457 '')     man1dir=' '
8458         installman1dir='';;
8459 esac
8460
8461 : What suffix to use on installed man pages
8462
8463 case "$man1dir" in
8464 ' ')
8465         man1ext='0'
8466         ;;
8467 *)
8468         rp="What suffix should be used for the main $spackage man pages?"
8469         case "$man1ext" in
8470         '')     case "$man1dir" in
8471                 *1)  dflt=1 ;;
8472                 *1p) dflt=1p ;;
8473                 *1pm) dflt=1pm ;;
8474                 *l) dflt=l;;
8475                 *n) dflt=n;;
8476                 *o) dflt=o;;
8477                 *p) dflt=p;;
8478                 *C) dflt=C;;
8479                 *L) dflt=L;;
8480                 *L1) dflt=L1;;
8481                 *) dflt=1;;
8482                 esac
8483                 ;;
8484         *)      dflt="$man1ext";;
8485         esac
8486         . ./myread
8487         man1ext="$ans"
8488         ;;
8489 esac
8490
8491 : see if we can have long filenames
8492 echo " "
8493 first=123456789abcdef
8494 $rm -f $first
8495 if (echo hi >$first) 2>/dev/null; then
8496         if $test -f 123456789abcde; then
8497                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8498                 val="$undef"
8499         else
8500                 echo 'You can have filenames longer than 14 characters.'>&4
8501                 val="$define"
8502         fi
8503 else
8504         $cat <<'EOM'
8505 You can't have filenames longer than 14 chars.
8506 You can't even think about them!
8507 EOM
8508         val="$undef"
8509 fi
8510 set d_flexfnam
8511 eval $setvar
8512 $rm -rf 123456789abcde*
8513
8514 : determine where library module manual pages go
8515 set man3dir man3dir none
8516 eval $prefixit
8517 $cat <<EOM
8518
8519 $spackage has manual pages for many of the library modules.
8520 EOM
8521
8522 case "$nroff" in
8523 nroff)
8524         $cat <<'EOM'
8525 However, you don't have nroff, so they're probably useless to you.
8526 EOM
8527         case "$man3dir" in
8528         '') man3dir="none";;
8529         esac;;
8530 esac
8531
8532 case "$d_flexfnam" in
8533 undef)
8534         $cat <<'EOM'
8535 However, your system can't handle the long file names like File::Basename.3.
8536 EOM
8537         case "$man3dir" in
8538         '') man3dir="none";;
8539         esac;;
8540 esac
8541
8542 echo "If you don't want the manual sources installed, answer 'none'."
8543 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8544 case "$man3dir" in
8545 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8546         if $test -d "$privlib/man/man3"; then
8547                 cat <<EOM >&4
8548
8549 WARNING:  Previous versions of perl installed man3 pages into
8550 $privlib/man/man3.  This version will suggest a
8551 new default of $dflt.
8552 EOM
8553                 tdflt=$dflt
8554                 dflt='n'
8555                 rp='Do you wish to preserve the old behavior?(y/n)'
8556                 . ./myread
8557                 case "$ans" in
8558                 y*) dflt="$privlib/man/man3" ;;
8559                 *)  dflt=$tdflt ;;
8560                 esac
8561     fi
8562         ;;
8563 *)      dflt="$man3dir" ;;
8564 esac
8565 case "$dflt" in
8566 ' ') dflt=none ;;
8567 esac
8568 echo " "
8569 fn=dn+~
8570 rp="Where do the $package library man pages (source) go?"
8571 . ./getfile
8572 prefixvar=man3dir
8573 . ./setprefixvar
8574
8575 case "$man3dir" in
8576 '')     man3dir=' '
8577         installman3dir='';;
8578 esac
8579
8580 : What suffix to use on installed man pages
8581 case "$man3dir" in
8582 ' ')
8583         man3ext='0'
8584         ;;
8585 *)
8586         rp="What suffix should be used for the $package library man pages?"
8587         case "$man3ext" in
8588         '')     case "$man3dir" in
8589                 *3)  dflt=3 ;;
8590                 *3p) dflt=3p ;;
8591                 *3pm) dflt=3pm ;;
8592                 *l) dflt=l;;
8593                 *n) dflt=n;;
8594                 *o) dflt=o;;
8595                 *p) dflt=p;;
8596                 *C) dflt=C;;
8597                 *L) dflt=L;;
8598                 *L3) dflt=L3;;
8599                 *) dflt=3;;
8600                 esac
8601                 ;;
8602         *)      dflt="$man3ext";;
8603         esac
8604         . ./myread
8605         man3ext="$ans"
8606         ;;
8607 esac
8608
8609 : see if we have to deal with yellow pages, now NIS.
8610 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8611         if $test -f /usr/etc/nibindd; then
8612                 echo " "
8613                 echo "I'm fairly confident you're on a NeXT."
8614                 echo " "
8615                 rp='Do you get the hosts file via NetInfo?'
8616                 dflt=y
8617                 case "$hostcat" in
8618                 nidump*) ;;
8619                 '') ;;
8620                 *) dflt=n;;
8621                 esac
8622                 . ./myread
8623                 case "$ans" in
8624                 y*) hostcat='nidump hosts .';;
8625                 *)      case "$hostcat" in
8626                         nidump*) hostcat='';;
8627                         esac
8628                         ;;
8629                 esac
8630         fi
8631         case "$hostcat" in
8632         nidump*) ;;
8633         *)
8634                 case "$hostcat" in
8635                 *ypcat*) dflt=y;;
8636                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8637                                 dflt=y
8638                         else
8639                                 dflt=n
8640                         fi;;
8641                 *) dflt=n;;
8642                 esac
8643                 echo " "
8644                 rp='Are you getting the hosts file via yellow pages?'
8645                 . ./myread
8646                 case "$ans" in
8647                 y*) hostcat='ypcat hosts';;
8648                 *) hostcat='cat /etc/hosts';;
8649                 esac
8650                 ;;
8651         esac
8652 fi
8653 case "$hostcat" in
8654 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8655 esac
8656 case "$groupcat" in
8657 '') test -f /etc/group && groupcat='cat /etc/group';;
8658 esac
8659 case "$passcat" in
8660 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8661 esac
8662
8663 : now get the host name
8664 echo " "
8665 echo "Figuring out host name..." >&4
8666 case "$myhostname" in
8667 '') cont=true
8668         echo 'Maybe "hostname" will work...'
8669         if tans=`sh -c hostname 2>&1` ; then
8670                 myhostname=$tans
8671                 phostname=hostname
8672                 cont=''
8673         fi
8674         ;;
8675 *) cont='';;
8676 esac
8677 if $test "$cont"; then
8678         if ./xenix; then
8679                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8680                 if tans=`cat /etc/systemid 2>&1` ; then
8681                         myhostname=$tans
8682                         phostname='cat /etc/systemid'
8683                         echo "Whadyaknow.  Xenix always was a bit strange..."
8684                         cont=''
8685                 fi
8686         elif $test -r /etc/systemid; then
8687                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8688         fi
8689 fi
8690 if $test "$cont"; then
8691         echo 'No, maybe "uuname -l" will work...'
8692         if tans=`sh -c 'uuname -l' 2>&1` ; then
8693                 myhostname=$tans
8694                 phostname='uuname -l'
8695         else
8696                 echo 'Strange.  Maybe "uname -n" will work...'
8697                 if tans=`sh -c 'uname -n' 2>&1` ; then
8698                         myhostname=$tans
8699                         phostname='uname -n'
8700                 else
8701                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8702                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8703                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8704                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8705                         else
8706                                 case "$myhostname" in
8707                                 '') echo "Does this machine have an identity crisis or something?"
8708                                         phostname='';;
8709                                 *)
8710                                         echo "Well, you said $myhostname before..."
8711                                         phostname='echo $myhostname';;
8712                                 esac
8713                         fi
8714                 fi
8715         fi
8716 fi
8717 case "$myhostname" in
8718 '') myhostname=noname ;;
8719 esac
8720 : you do not want to know about this
8721 set $myhostname
8722 myhostname=$1
8723
8724 : verify guess
8725 if $test "$myhostname" ; then
8726         dflt=y
8727         rp='Your host name appears to be "'$myhostname'".'" Right?"
8728         . ./myread
8729         case "$ans" in
8730         y*) ;;
8731         *) myhostname='';;
8732         esac
8733 fi
8734
8735 : bad guess or no guess
8736 while $test "X$myhostname" = X ; do
8737         dflt=''
8738         rp="Please type the (one word) name of your host:"
8739         . ./myread
8740         myhostname="$ans"
8741 done
8742
8743 : translate upper to lower if necessary
8744 case "$myhostname" in
8745 *[A-Z]*)
8746         echo "(Normalizing case in your host name)"
8747         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8748         ;;
8749 esac
8750
8751 case "$myhostname" in
8752 *.*)
8753         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8754         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8755         echo "(Trimming domain name from host name--host name is now $myhostname)"
8756         ;;
8757 *) case "$mydomain" in
8758         '')
8759                 {
8760                         test "X$hostcat" = "Xypcat hosts" &&
8761                         ypmatch "$myhostname" hosts 2>/dev/null |\
8762                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8763                         $test -s hosts
8764                 } || {
8765                         test "X$hostcat" != "X" &&
8766                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8767                                         /[       ]$myhostname[  . ]/p" > hosts
8768                 }
8769                 tmp_re="[       . ]"
8770                 if $test -f hosts; then
8771                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8772                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8773                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8774                                 hosts | $sort | $uniq | \
8775                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8776                         case `$echo X$dflt` in
8777                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8778                                 dflt=.
8779                                 ;;
8780                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8781                                 ;;
8782                         esac
8783                 else
8784                         echo "(I cannot locate a hosts database anywhere)"
8785                         dflt=.
8786                 fi
8787                 case "$dflt" in
8788                 .)
8789                         tans=`./loc resolv.conf X /etc /usr/etc`
8790                         if $test -f "$tans"; then
8791                                 echo "(Attempting domain name extraction from $tans)"
8792                                 dflt=.`$sed -n -e 's/   / /g' \
8793                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8794                                   -e 1q 2>/dev/null`
8795                                 case "$dflt" in
8796                                 .) dflt=.`$sed -n -e 's/        / /g' \
8797                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8798                                      -e 1q 2>/dev/null`
8799                                         ;;
8800                                 esac
8801                         fi
8802                         ;;
8803                 esac
8804                 case "$dflt" in
8805                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8806                         dflt=.`sh -c domainname 2>/dev/null`
8807                         case "$dflt" in
8808                         '') dflt='.';;
8809                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8810                         esac
8811                         ;;
8812                 esac
8813                 case "$dflt$osname" in
8814                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8815                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8816                         ;;
8817                 esac
8818                 case "$dflt" in
8819                 .) echo "(Lost all hope -- silly guess then)"
8820                         dflt='.nonet'
8821                         ;;
8822                 esac
8823                 $rm -f hosts
8824                 ;;
8825         *) dflt="$mydomain";;
8826         esac;;
8827 esac
8828 echo " "
8829 rp="What is your domain name?"
8830 . ./myread
8831 tans="$ans"
8832 case "$ans" in
8833 '') ;;
8834 .*) ;;
8835 *) tans=".$tans";;
8836 esac
8837 mydomain="$tans"
8838
8839 : translate upper to lower if necessary
8840 case "$mydomain" in
8841 *[A-Z]*)
8842         echo "(Normalizing case in your domain name)"
8843         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8844         ;;
8845 esac
8846
8847 : a little sanity check here
8848 case "$phostname" in
8849 '') ;;
8850 *)
8851         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8852         $myhostname$mydomain|$myhostname) ;;
8853         *)
8854                 case "$phostname" in
8855                 sed*)
8856                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8857                         ;;
8858                 *)
8859                         echo "(That doesn't agree with your $phostname command, by the way.)"
8860                         ;;
8861                 esac
8862         ;;
8863         esac
8864         ;;
8865 esac
8866
8867 : determine the e-mail address of the user who is running us
8868 $cat <<EOM
8869
8870 I need to get your e-mail address in Internet format if possible, i.e.
8871 something like user@host.domain. Please answer accurately since I have
8872 no easy means to double check it. The default value provided below
8873 is most probably close to reality but may not be valid from outside
8874 your organization...
8875
8876 EOM
8877 cont=x
8878 while test "$cont"; do
8879         case "$cf_email" in
8880         '') dflt="$cf_by@$myhostname$mydomain";;
8881         *) dflt="$cf_email";;
8882         esac
8883         rp='What is your e-mail address?'
8884         . ./myread
8885         cf_email="$ans"
8886         case "$cf_email" in
8887         *@*.*) cont='' ;;
8888         *)
8889                 rp='Address does not look like an Internet one.  Use it anyway?'
8890                 case "$fastread" in
8891                 yes) dflt=y ;;
8892                 *) dflt=n ;;
8893                 esac
8894                 . ./myread
8895                 case "$ans" in
8896                 y*) cont='' ;;
8897                 *) echo " " ;;
8898                 esac
8899                 ;;
8900         esac
8901 done
8902
8903 : Ask e-mail of administrator
8904 $cat <<EOM
8905
8906 If you or somebody else will be maintaining perl at your site, please
8907 fill in the correct e-mail address here so that they may be contacted
8908 if necessary. Currently, the "perlbug" program included with perl
8909 will send mail to this address in addition to perlbug@perl.org. You may
8910 enter "none" for no administrator.
8911
8912 EOM
8913 case "$perladmin" in
8914 '') dflt="$cf_email";;
8915 *) dflt="$perladmin";;
8916 esac
8917 rp='Perl administrator e-mail address'
8918 . ./myread
8919 perladmin="$ans"
8920
8921 : determine whether to only install version-specific parts.
8922 echo " "
8923 $cat <<EOM
8924 Do you want to install only the version-specific parts of the perl
8925 distribution?  Usually you do *not* want to do this.
8926 EOM
8927 case "$versiononly" in
8928 "$define"|[Yy]*|true) dflt='y' ;;
8929 *) dflt='n';
8930 esac
8931 rp="Do you want to install only the version-specific parts of perl?"
8932 . ./myread
8933 case "$ans" in
8934 [yY]*)  val="$define";;
8935 *)      val="$undef" ;;
8936 esac
8937 set versiononly
8938 eval $setvar
8939
8940 case "$versiononly" in
8941 "$define") inc_version_list=''
8942            inc_version_list_init=0
8943            ;;
8944 esac
8945
8946 : figure out how to guarantee perl startup
8947 : XXX Note that this currently takes advantage of the bug that binexp ignores
8948 :     the Configure -Dinstallprefix setting, which in turn means that under
8949 :     relocatable @INC, initialinstalllocation is what binexp started as.
8950 case "$startperl" in
8951 '')
8952         case "$sharpbang" in
8953         *!)
8954                 $cat <<EOH
8955
8956 I can use the #! construct to start perl on your system. This will
8957 make startup of perl scripts faster, but may cause problems if you
8958 want to share those scripts and perl is not in a standard place
8959 ($initialinstalllocation/perl) on all your platforms. The alternative
8960 is to force a shell by starting the script with a single ':' character.
8961
8962 EOH
8963                 case "$versiononly" in
8964                 "$define")      dflt="$initialinstalllocation/perl$version";;
8965                 *)              dflt="$initialinstalllocation/perl";;
8966                 esac
8967                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8968                 . ./myread
8969                 case "$ans" in
8970                 none)   startperl=": # use perl";;
8971                 *)      startperl="#!$ans"
8972                         if $test 30 -lt `echo "$ans" | wc -c`; then
8973                                 $cat >&4 <<EOM
8974
8975 WARNING:  Some systems limit the #! command to 32 characters.
8976 If you experience difficulty running Perl scripts with #!, try
8977 installing Perl in a directory with a shorter pathname.
8978
8979 EOM
8980                         fi ;;
8981                 esac
8982                 ;;
8983         *) startperl=": # use perl"
8984                 ;;
8985         esac
8986         ;;
8987 esac
8988 echo "I'll use $startperl to start perl scripts."
8989
8990 : figure best path for perl in scripts
8991 case "$perlpath" in
8992 '')
8993         case "$versiononly" in
8994         "$define")      perlpath="$initialinstalllocation/perl$version";;
8995         *)              perlpath="$initialinstalllocation/perl";;
8996         esac
8997         case "$startperl" in
8998         *!*) ;;
8999         *)
9000                 $cat <<EOH
9001
9002 I will use the "eval 'exec'" idiom to start Perl on your system.
9003 I can use the full path of your Perl binary for this purpose, but
9004 doing so may cause problems if you want to share those scripts and
9005 Perl is not always in a standard place ($initialinstalllocation/perl).
9006
9007 EOH
9008                 dflt="$initialinstalllocation/perl"
9009                 rp="What path shall I use in \"eval 'exec'\"?"
9010                 . ./myread
9011                 perlpath="$ans"
9012                 ;;
9013         esac
9014         ;;
9015 esac
9016 case "$startperl" in
9017 *!*)    ;;
9018 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9019 esac
9020
9021 : determine where public executable scripts go
9022 set scriptdir scriptdir
9023 eval $prefixit
9024 case "$scriptdir" in
9025 '')
9026         dflt="$bin"
9027         : guess some guesses
9028         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9029         $test -d /usr/share/bin     && dflt=/usr/share/bin
9030         $test -d /usr/local/script  && dflt=/usr/local/script
9031         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9032         $test -d $prefixexp/script  && dflt=$prefixexp/script
9033         set dflt
9034         eval $prefixup
9035         ;;
9036 *)  dflt="$scriptdir"
9037         ;;
9038 esac
9039 $cat <<EOM
9040
9041 Some installations have a separate directory just for executable scripts so
9042 that they can mount it across multiple architectures but keep the scripts in
9043 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9044 Or you might just lump your scripts in with all your other executables.
9045
9046 EOM
9047 fn=d~
9048 rp='Where do you keep publicly executable scripts?'
9049 . ./getfile
9050 if $test "X$ansexp" != "X$scriptdirexp"; then
9051         installscript=''
9052 fi
9053 installscriptdir=''
9054 prefixvar=scriptdir
9055 . ./setprefixvar
9056 : A little fix up for an irregularly named variable.
9057 installscript="$installscriptdir"
9058
9059 : determine where add-on public executables go
9060 case "$sitebin" in
9061 '')     dflt=$siteprefix/bin ;;
9062 *)      dflt=$sitebin ;;
9063 esac
9064 fn=d~
9065 rp='Pathname where the add-on public executables should be installed?'
9066 . ./getfile
9067 prefixvar=sitebin
9068 . ./setprefixvar
9069
9070 : determine where add-on html pages go
9071 : There is no standard location, so try to copy the previously-selected
9072 : directory structure for the core html pages.
9073 case "$sitehtml1dir" in
9074 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9075 *)     dflt=$sitehtml1dir ;;
9076 esac
9077 case "$dflt" in
9078 ''|' ') dflt=none ;;
9079 esac
9080 fn=dn+~
9081 rp='Pathname where the site-specific html pages should be installed?'
9082 . ./getfile
9083 prefixvar=sitehtml1dir
9084 . ./setprefixvar
9085
9086 : determine where add-on library html pages go
9087 : There is no standard location, so try to copy the previously-selected
9088 : directory structure for the core html pages.
9089 case "$sitehtml3dir" in
9090 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9091 *)     dflt=$sitehtml3dir ;;
9092 esac
9093 case "$dflt" in
9094 ''|' ') dflt=none ;;
9095 esac
9096 fn=dn+~
9097 rp='Pathname where the site-specific library html pages should be installed?'
9098 . ./getfile
9099 prefixvar=sitehtml3dir
9100 . ./setprefixvar
9101
9102 : determine where add-on manual pages go
9103 case "$siteman1dir" in
9104 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9105 *)      dflt=$siteman1dir ;;
9106 esac
9107 case "$dflt" in
9108 ''|' ') dflt=none ;;
9109 esac
9110 fn=dn+~
9111 rp='Pathname where the site-specific manual pages should be installed?'
9112 . ./getfile
9113 prefixvar=siteman1dir
9114 . ./setprefixvar
9115
9116 : determine where add-on library man pages go
9117 case "$siteman3dir" in
9118 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9119 *)      dflt=$siteman3dir ;;
9120 esac
9121 case "$dflt" in
9122 ''|' ') dflt=none ;;
9123 esac
9124 fn=dn+~
9125 rp='Pathname where the site-specific library manual pages should be installed?'
9126 . ./getfile
9127 prefixvar=siteman3dir
9128 . ./setprefixvar
9129
9130 : determine where add-on public executable scripts go
9131 case "$sitescript" in
9132 '')     dflt=$siteprefix/script
9133         $test -d $dflt || dflt=$sitebin ;;
9134 *)  dflt="$sitescript" ;;
9135 esac
9136 fn=d~+
9137 rp='Pathname where add-on public executable scripts should be installed?'
9138 . ./getfile
9139 prefixvar=sitescript
9140 . ./setprefixvar
9141
9142 : Check if faststdio is requested and available
9143 case "$usefaststdio" in
9144 $define|true|[yY]*|'')
9145         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9146         case "$xversion" in
9147         [68])   dflt='y' ;;
9148         *)      dflt='n' ;;
9149         esac
9150         ;;
9151 *) dflt='n';;
9152 esac
9153 cat <<EOM
9154
9155 Perl can be built to use 'fast stdio', which means using the stdio
9156 library but also directly manipulating the stdio buffers to enable
9157 faster I/O.  Using stdio is better for backward compatibility (especially
9158 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9159 interface has been preferred instead of stdio.
9160
9161 If this doesn't make any sense to you, just accept the default '$dflt'.
9162 EOM
9163 rp='Use the "fast stdio" if available?'
9164 . ./myread
9165 case "$ans" in
9166 y|Y)    val="$define" ;;
9167 *)      val="$undef" ;;
9168 esac
9169 set usefaststdio
9170 eval $setvar
9171
9172
9173 : define an is-a-typedef? function
9174 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9175 case "$inclist" in
9176 "") inclist="sys/types.h";;
9177 esac;
9178 eval "varval=\$$var";
9179 case "$varval" in
9180 "")
9181         $rm -f temp.c;
9182         for inc in $inclist; do
9183                 echo "#include <$inc>" >>temp.c;
9184         done;
9185         echo "#ifdef $type" >> temp.c;
9186         echo "printf(\"We have $type\");" >> temp.c;
9187         echo "#endif" >> temp.c;
9188         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9189         if $contains $type temp.E >/dev/null 2>&1; then
9190                 eval "$var=\$type";
9191         else
9192                 eval "$var=\$def";
9193         fi;
9194         $rm -f temp.?;;
9195 *) eval "$var=\$varval";;
9196 esac'
9197
9198 : define an is-a-typedef? function that prompts if the type is not available.
9199 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9200 case "$inclist" in
9201 "") inclist="sys/types.h";;
9202 esac;
9203 eval "varval=\$$var";
9204 case "$varval" in
9205 "")
9206         $rm -f temp.c;
9207         for inc in $inclist; do
9208                 echo "#include <$inc>" >>temp.c;
9209         done;
9210         echo "#ifdef $type" >> temp.c;
9211         echo "printf(\"We have $type\");" >> temp.c;
9212         echo "#endif" >> temp.c;
9213         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9214         echo " " ;
9215         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9216         if $contains $type temp.E >/dev/null 2>&1; then
9217                 echo "$type found." >&4;
9218                 eval "$var=\$type";
9219         else
9220                 echo "$type NOT found." >&4;
9221                 dflt="$def";
9222                 . ./myread ;
9223                 eval "$var=\$ans";
9224         fi;
9225         $rm -f temp.?;;
9226 *) eval "$var=\$varval";;
9227 esac'
9228
9229 : see what type lseek is declared as in the kernel
9230 rp="What is the type used for lseek's offset on this system?"
9231 set off_t lseektype long stdio.h sys/types.h
9232 eval $typedef_ask
9233
9234 echo " "
9235 echo "Checking to see how big your file offsets are..." >&4
9236 $cat >try.c <<EOCP
9237 #include <sys/types.h>
9238 #include <stdio.h>
9239 int main()
9240 {
9241     printf("%d\n", (int)sizeof($lseektype));
9242     return(0);
9243 }
9244 EOCP
9245 set try
9246 if eval $compile_ok; then
9247         lseeksize=`$run ./try`
9248         echo "Your file offsets are $lseeksize bytes long."
9249 else
9250         dflt=$longsize
9251         echo " "
9252         echo "(I can't seem to compile the test program.  Guessing...)"
9253         rp="What is the size of your file offsets (in bytes)?"
9254         . ./myread
9255         lseeksize="$ans"
9256 fi
9257 $rm_try
9258
9259 : see what type file positions are declared as in the library
9260 rp="What is the type for file position used by fsetpos()?"
9261 set fpos_t fpostype long stdio.h sys/types.h
9262 eval $typedef_ask
9263
9264 : Check size for Fpos_t
9265 echo " "
9266 case "$fpostype" in
9267 *_t) zzz="$fpostype"    ;;
9268 *)   zzz="fpos_t"       ;;
9269 esac
9270 echo "Checking the size of $zzz..." >&4
9271 cat > try.c <<EOCP
9272 #include <sys/types.h>
9273 #include <stdio.h>
9274 #$i_stdlib I_STDLIB
9275 #ifdef I_STDLIB
9276 #include <stdlib.h>
9277 #endif
9278 int main() {
9279     printf("%d\n", (int)sizeof($fpostype));
9280     exit(0);
9281 }
9282 EOCP
9283 set try
9284 if eval $compile_ok; then
9285         yyy=`$run ./try`
9286         case "$yyy" in
9287         '')     fpossize=4
9288                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9289                 ;;
9290         *)      fpossize=$yyy
9291                 echo "Your $zzz is $fpossize bytes long."
9292                 ;;
9293         esac
9294 else
9295         dflt="$longsize"
9296         echo " " >&4
9297         echo "(I can't compile the test program.  Guessing...)" >&4
9298         rp="What is the size of your file positions (in bytes)?"
9299         . ./myread
9300         fpossize="$ans"
9301 fi
9302
9303 : Check for large file support
9304 # Backward compatibility (uselfs is deprecated).
9305 case "$uselfs" in
9306 "$define"|true|[yY]*)
9307         cat <<EOM >&4
9308
9309 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9310 EOM
9311         uselargefiles="$define"
9312         ;;
9313 esac
9314
9315 case "$lseeksize:$fpossize" in
9316 8:8) cat <<EOM
9317
9318 You can have files larger than 2 gigabytes.
9319 EOM
9320    val="$define" ;;
9321 *)    case "$uselargefiles" in
9322    "$undef"|false|[nN]*) dflt='n' ;;
9323    *)   dflt='y' ;;
9324    esac
9325    cat <<EOM
9326
9327 Perl can be built to understand large files (files larger than 2 gigabytes)
9328 on some systems.  To do so, Configure can be run with -Duselargefiles.
9329
9330 If this doesn't make any sense to you, just accept the default '$dflt'.
9331 EOM
9332    rp='Try to understand large files, if available?'
9333    . ./myread
9334    case "$ans" in
9335    y|Y)         val="$define" ;;
9336    *)           val="$undef"  ;;
9337    esac
9338    ;;
9339 esac
9340 set uselargefiles
9341 eval $setvar
9342 : Look for a hint-file generated 'call-back-unit'.  If the
9343 : user has specified that a large files perl is to be built,
9344 : we may need to set or change some other defaults.
9345 if $test -f uselargefiles.cbu; then
9346         echo "Your platform has some specific hints regarding large file builds, using them..."
9347         . ./uselargefiles.cbu
9348 fi
9349 case "$uselargefiles" in
9350 "$define")
9351         if $test -f uselargefiles.cbu; then
9352                 echo " "
9353                 echo "Rechecking to see how big your file offsets are..." >&4
9354                 $cat >try.c <<EOCP
9355 #include <sys/types.h>
9356 #include <stdio.h>
9357 int main()
9358 {
9359     printf("%d\n", (int)sizeof($lseektype));
9360     return(0);
9361 }
9362 EOCP
9363                 set try
9364                 if eval $compile_ok; then
9365                         lseeksize=`$run ./try`
9366                         $echo "Your file offsets are now $lseeksize bytes long."
9367                 else
9368                         dflt="$lseeksize"
9369                         echo " "
9370                         echo "(I can't seem to compile the test program.  Guessing...)"
9371                         rp="What is the size of your file offsets (in bytes)?"
9372                         . ./myread
9373                         lseeksize="$ans"
9374                 fi
9375                 case "$fpostype" in
9376                 *_t) zzz="$fpostype"    ;;
9377                 *)   zzz="fpos_t"       ;;
9378                 esac
9379                 $echo $n "Rechecking the size of $zzz...$c" >&4
9380                 $cat > try.c <<EOCP
9381 #include <sys/types.h>
9382 #include <stdio.h>
9383 #$i_stdlib I_STDLIB
9384 #ifdef I_STDLIB
9385 #include <stdlib.h>
9386 #endif
9387 int main() {
9388     printf("%d\n", (int)sizeof($fpostype));
9389     return(0);
9390 }
9391 EOCP
9392                 set try
9393                 if eval $compile_ok; then
9394                         yyy=`$run ./try`
9395                         dflt="$lseeksize"
9396                         case "$yyy" in
9397                         '')     echo " "
9398                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9399                                 ;;
9400                         *)      fpossize=$yyy
9401                                 echo " $fpossize bytes." >&4
9402                                 ;;
9403                         esac
9404                 else
9405                         dflt="$fpossize"
9406                         echo " "
9407                         echo "(I can't compile the test program.  Guessing...)" >&4
9408                         rp="What is the size of your file positions (in bytes)?"
9409                         . ./myread
9410                         fpossize="$ans"
9411                 fi
9412                 $rm_try
9413         fi
9414         ;;
9415 esac
9416
9417 : Set the vendorbin variables
9418 case "$vendorprefix" in
9419 '')     d_vendorbin="$undef"
9420         vendorbin=''
9421         vendorbinexp=''
9422         ;;
9423 *)      d_vendorbin="$define"
9424         : determine where vendor-supplied executables go.
9425         case "$vendorbin" in
9426         '') dflt=$vendorprefix/bin ;;
9427         *)      dflt="$vendorbin" ;;
9428         esac
9429         fn=d~+
9430         rp='Pathname for the vendor-supplied executables directory?'
9431         . ./getfile
9432         vendorbin="$ans"
9433         vendorbinexp="$ansexp"
9434         ;;
9435 esac
9436 prefixvar=vendorbin
9437 . ./installprefix
9438
9439 : Set the vendorhtml1dir variables
9440 case "$vendorprefix" in
9441 '')     vendorhtml1dir=''
9442         vendorhtml1direxp=''
9443         ;;
9444 *)      : determine where vendor-supplied html pages go.
9445         : There is no standard location, so try to copy the previously-selected
9446         : directory structure for the core html pages.
9447         : XXX Better default suggestions would be welcome.
9448         case "$vendorhtml1dir" in
9449         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9450         *)      dflt=$vendorhtml1dir ;;
9451         esac
9452         case "$dflt" in
9453         ''|' ') dflt=none ;;
9454         esac
9455         fn=dn+~
9456         rp='Pathname for the vendor-supplied html pages?'
9457         . ./getfile
9458         vendorhtml1dir="$ans"
9459         vendorhtml1direxp="$ansexp"
9460         ;;
9461 esac
9462 : Use ' ' for none so value is preserved next time through Configure
9463 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9464 prefixvar=vendorhtml1dir
9465 . ./installprefix
9466
9467 : Set the vendorhtml3dir variables
9468 case "$vendorprefix" in
9469 '')     vendorhtml3dir=''
9470         vendorhtml3direxp=''
9471         ;;
9472 *)      : determine where vendor-supplied module html pages go.
9473         : There is no standard location, so try to copy the previously-selected
9474         : directory structure for the core html pages.
9475         : XXX Better default suggestions would be welcome.
9476         case "$vendorhtml3dir" in
9477         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9478         *)      dflt=$vendorhtml3dir ;;
9479         esac
9480         case "$dflt" in
9481         ''|' ') dflt=none ;;
9482         esac
9483         fn=dn+~
9484         rp='Pathname for the vendor-supplied html pages?'
9485         . ./getfile
9486         vendorhtml3dir="$ans"
9487         vendorhtml3direxp="$ansexp"
9488         ;;
9489 esac
9490 : Use ' ' for none so value is preserved next time through Configure
9491 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9492 prefixvar=vendorhtml3dir
9493 . ./installprefix
9494
9495 : Set the vendorman1dir variables
9496 case "$vendorprefix" in
9497 '')     vendorman1dir=''
9498         vendorman1direxp=''
9499         ;;
9500 *)      : determine where vendor-supplied manual pages go.
9501         case "$vendorman1dir" in
9502         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9503         *)      dflt=$vendorman1dir ;;
9504         esac
9505         case "$dflt" in
9506         ''|' ') dflt=none ;;
9507         esac
9508         fn=nd~+
9509         rp='Pathname for the vendor-supplied manual section 1 pages?'
9510         . ./getfile
9511         vendorman1dir="$ans"
9512         vendorman1direxp="$ansexp"
9513         ;;
9514 esac
9515 : Use ' ' for none so value is preserved next time through Configure
9516 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9517 prefixvar=vendorman1dir
9518 . ./installprefix
9519
9520 : Set the vendorman3dir variables
9521 case "$vendorprefix" in
9522 '')     vendorman3dir=''
9523         vendorman3direxp=''
9524         ;;
9525 *)      : determine where vendor-supplied module manual pages go.
9526         case "$vendorman3dir" in
9527         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9528         *)      dflt=$vendorman3dir ;;
9529         esac
9530         case "$dflt" in
9531         ''|' ') dflt=none ;;
9532         esac
9533         fn=nd~+
9534         rp='Pathname for the vendor-supplied manual section 3 pages?'
9535         . ./getfile
9536         vendorman3dir="$ans"
9537         vendorman3direxp="$ansexp"
9538         ;;
9539 esac
9540 : Use ' ' for none so value is preserved next time through Configure
9541 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9542 prefixvar=vendorman3dir
9543 . ./installprefix
9544
9545 : Set the vendorscript variables
9546 case "$vendorprefix" in
9547 '')     d_vendorscript="$undef"
9548         vendorscript=''
9549         vendorscriptexp=''
9550         ;;
9551 *)      d_vendorscript="$define"
9552         : determine where vendor-supplied scripts go.
9553         case "$vendorscript" in
9554         '')     dflt=$vendorprefix/script
9555                 $test -d $dflt || dflt=$vendorbin ;;
9556         *)  dflt="$vendorscript" ;;
9557         esac
9558         $cat <<EOM
9559
9560 The installation process will create a directory for
9561 vendor-supplied scripts.
9562
9563 EOM
9564         fn=d~+
9565         rp='Pathname for the vendor-supplied scripts directory?'
9566         . ./getfile
9567         vendorscript="$ans"
9568         vendorscriptexp="$ansexp"
9569         ;;
9570 esac
9571 prefixvar=vendorscript
9572 . ./installprefix
9573
9574 : script used to emit important warnings
9575 cat >warn <<EOS
9576 $startsh
9577 if test \$# -gt 0; then
9578         echo "\$@" >msg
9579 else
9580         cat >msg
9581 fi
9582 echo "*** WARNING:" >&4
9583 sed -e 's/^/*** /' <msg >&4
9584 echo "*** " >&4
9585 cat msg >>config.msg
9586 echo " " >>config.msg
9587 rm -f msg
9588 EOS
9589 chmod +x warn
9590 $eunicefix warn
9591
9592 : see which of string.h or strings.h is needed
9593 echo " "
9594 strings=`./findhdr string.h`
9595 if $test "$strings" && $test -r "$strings"; then
9596         echo "Using <string.h> instead of <strings.h>." >&4
9597         val="$define"
9598 else
9599         val="$undef"
9600         strings=`./findhdr strings.h`
9601         if $test "$strings" && $test -r "$strings"; then
9602                 echo "Using <strings.h> instead of <string.h>." >&4
9603         else
9604                 ./warn "No string header found -- You'll surely have problems."
9605         fi
9606 fi
9607 set i_string
9608 eval $setvar
9609 case "$i_string" in
9610 "$undef") strings=`./findhdr strings.h`;;
9611 *)        strings=`./findhdr string.h`;;
9612 esac
9613
9614 : see if qgcvt exists
9615 set qgcvt d_qgcvt
9616 eval $inlibc
9617
9618 : Check print/scan long double stuff
9619 echo " "
9620
9621 if $test X"$d_longdbl" = X"$define"; then
9622
9623 echo "Checking how to print long doubles..." >&4
9624
9625 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9626         $cat >try.c <<'EOCP'
9627 #include <sys/types.h>
9628 #include <stdio.h>
9629 int main() {
9630   double d = 123.456;
9631   printf("%.3f\n", d);
9632 }
9633 EOCP
9634         set try
9635         if eval $compile; then
9636                 yyy=`$run ./try`
9637                 case "$yyy" in
9638                 123.456)
9639                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9640                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9641                         echo "We will use %f."
9642                         ;;
9643                 esac
9644         fi
9645 fi
9646
9647 if $test X"$sPRIfldbl" = X; then
9648         $cat >try.c <<'EOCP'
9649 #include <sys/types.h>
9650 #include <stdio.h>
9651 int main() {
9652   long double d = 123.456;
9653   printf("%.3Lf\n", d);
9654 }
9655 EOCP
9656         set try
9657         if eval $compile; then
9658                 yyy=`$run ./try`
9659                 case "$yyy" in
9660                 123.456)
9661                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9662                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9663                         echo "We will use %Lf."
9664                         ;;
9665                 esac
9666         fi
9667 fi
9668
9669 if $test X"$sPRIfldbl" = X; then
9670         $cat >try.c <<'EOCP'
9671 #include <sys/types.h>
9672 #include <stdio.h>
9673 int main() {
9674   long double d = 123.456;
9675   printf("%.3llf\n", d);
9676 }
9677 EOCP
9678         set try
9679         if eval $compile; then
9680                 yyy=`$run ./try`
9681                 case "$yyy" in
9682                 123.456)
9683                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9684                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9685                         echo "We will use %llf."
9686                         ;;
9687                 esac
9688         fi
9689 fi
9690
9691 if $test X"$sPRIfldbl" = X; then
9692         $cat >try.c <<'EOCP'
9693 #include <sys/types.h>
9694 #include <stdio.h>
9695 int main() {
9696   long double d = 123.456;
9697   printf("%.3lf\n", d);
9698 }
9699 EOCP
9700         set try
9701         if eval $compile; then
9702                 yyy=`$run ./try`
9703                 case "$yyy" in
9704                 123.456)
9705                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9706                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9707                         echo "We will use %lf."
9708                         ;;
9709                 esac
9710         fi
9711 fi
9712
9713 if $test X"$sPRIfldbl" = X; then
9714         echo "Cannot figure out how to print long doubles." >&4
9715 else
9716         sSCNfldbl=$sPRIfldbl    # expect consistency
9717 fi
9718
9719 $rm_try
9720
9721 fi # d_longdbl
9722
9723 case "$sPRIfldbl" in
9724 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9725         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9726         d_SCNfldbl="$undef";
9727         ;;
9728 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9729         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9730         d_SCNfldbl="$define";
9731         ;;
9732 esac
9733
9734 : Check how to convert floats to strings.
9735
9736 if test "X$d_Gconvert" = X; then
9737
9738 echo " "
9739 echo "Checking for an efficient way to convert floats to strings."
9740 echo " " > try.c
9741 case "$uselongdouble" in
9742 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9743 esac
9744 case "$d_longdbl" in
9745 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9746 esac
9747 case "$d_PRIgldbl" in
9748 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9749 esac
9750 $cat >>try.c <<EOP
9751 #ifdef TRY_gconvert
9752 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9753 char *myname = "gconvert";
9754 #endif
9755 #ifdef TRY_gcvt
9756 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9757 char *myname = "gcvt";
9758 #endif
9759 #ifdef TRY_qgcvt
9760 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9761 char *myname = "qgcvt";
9762 #define DOUBLETYPE long double
9763 #endif
9764 #ifdef TRY_sprintf
9765 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9766 #ifdef HAS_PRIgldbl
9767 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9768 #else
9769 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9770 #endif
9771 #else
9772 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9773 #endif
9774 char *myname = "sprintf";
9775 #endif
9776
9777 #ifndef DOUBLETYPE
9778 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9779 #define DOUBLETYPE long double
9780 #else
9781 #define DOUBLETYPE double
9782 #endif
9783 #endif
9784
9785 #include <stdio.h>
9786
9787 #$i_stdlib I_STDLIB
9788 #ifdef I_STDLIB
9789 #include <stdlib.h>
9790 #endif
9791 #$i_string I_STRING
9792 #ifdef I_STRING
9793 #  include <string.h>
9794 #else
9795 #  include <strings.h>
9796 #endif
9797
9798 int checkit(char *expect, char *got)
9799 {
9800     if (strcmp(expect, got)) {
9801                 printf("%s oddity:  Expected %s, got %s\n",
9802                         myname, expect, got);
9803                 exit(1);
9804         }
9805 }
9806
9807 int main()
9808 {
9809         char buf[64];
9810         buf[63] = '\0';
9811
9812         /* This must be 1st test on (which?) platform */
9813         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9814         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9815         checkit("0.1", buf);
9816
9817         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9818         checkit("0.01", buf);
9819
9820         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9821         checkit("0.001", buf);
9822
9823         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9824         checkit("0.0001", buf);
9825
9826         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9827         if (strlen(buf) > 5)
9828             checkit("9e-005", buf); /* for Microsoft ?? */
9829         else
9830             checkit("9e-05", buf);
9831
9832         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9833         checkit("1", buf);
9834
9835         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9836         checkit("1.1", buf);
9837
9838         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9839         checkit("1.01", buf);
9840
9841         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9842         checkit("1.001", buf);
9843
9844         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9845         checkit("1.0001", buf);
9846
9847         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9848         checkit("1.00001", buf);
9849
9850         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9851         checkit("1.000001", buf);
9852
9853         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9854         checkit("0", buf);
9855
9856         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9857         checkit("-1", buf);
9858
9859         /* Some Linux gcvt's give 1.e+5 here. */
9860         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9861         checkit("100000", buf);
9862
9863         /* Some Linux gcvt's give -1.e+5 here. */
9864         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9865         checkit("-100000", buf);
9866
9867         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9868         checkit("123.456", buf);
9869
9870         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9871         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9872         /* 34 should be enough to scare even long double
9873          * places into using the e notation. */
9874         if (strlen(buf) > 5)
9875             checkit("1e+034", buf); /* for Microsoft */
9876         else
9877             checkit("1e+34", buf);
9878
9879         /* For Perl, if you add additional tests here, also add them to
9880          * t/base/num.t for benefit of platforms not using Configure or
9881          * overriding d_Gconvert */
9882
9883         exit(0);
9884 }
9885 EOP
9886 : first add preferred functions to our list
9887 xxx_list=""
9888 for xxx_convert in $gconvert_preference; do
9889     case $xxx_convert in
9890     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9891     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9892     esac
9893 done
9894 : then add any others
9895 for xxx_convert in gconvert gcvt sprintf; do
9896     case "$xxx_list" in
9897     *$xxx_convert*) ;;
9898     *) xxx_list="$xxx_list $xxx_convert" ;;
9899     esac
9900 done
9901
9902 case "$d_longdbl$uselongdouble" in
9903 "$define$define")
9904     : again, add prefered functions to our list first
9905     xxx_ld_list=""
9906     for xxx_convert in $gconvert_ld_preference; do
9907         case $xxx_convert in
9908         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9909         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9910         esac
9911     done
9912     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9913     for xxx_convert in qgcvt sprintf $xxx_list; do
9914         case "$xxx_ld_list" in
9915         $xxx_convert*|*" $xxx_convert"*) ;;
9916         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9917         esac
9918     done
9919     : if sprintf cannot do long doubles, move it to the end
9920     if test "$d_PRIgldbl" != "$define"; then
9921         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9922     fi
9923     : if no qgcvt, remove it
9924     if test "$d_qgcvt" != "$define"; then
9925         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9926     fi
9927     : use the ld_list
9928     xxx_list="$xxx_ld_list"
9929     ;;
9930 esac
9931
9932 for xxx_convert in $xxx_list; do
9933         echo "Trying $xxx_convert..."
9934         $rm -f try try$_o core
9935         set try -DTRY_$xxx_convert
9936         if eval $compile; then
9937                 echo "$xxx_convert() found." >&4
9938                 if $run ./try; then
9939                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9940                         break;
9941                 else
9942                         echo "...But $xxx_convert didn't work as I expected."
9943                         xxx_convert=''
9944                 fi
9945         else
9946                 echo "$xxx_convert NOT found." >&4
9947         fi
9948 done
9949
9950 if test X$xxx_convert = X; then
9951     echo "*** WHOA THERE!!! ***" >&4
9952     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9953     xxx_convert=sprintf
9954 fi
9955
9956 case "$xxx_convert" in
9957 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9958 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9959 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9960 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9961    "$define$define$define")
9962       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9963    "$define$define$undef")
9964       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9965    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9966    esac
9967    ;;
9968 esac
9969
9970 fi
9971 $rm_try
9972
9973 : see if _fwalk exists
9974 set fwalk d__fwalk
9975 eval $inlibc
9976
9977 : Initialize h_fcntl
9978 h_fcntl=false
9979
9980 : Initialize h_sysfile
9981 h_sysfile=false
9982
9983 : access call always available on UNIX
9984 set access d_access
9985 eval $inlibc
9986
9987 : locate the flags for 'access()'
9988 case "$d_access" in
9989 "$define")
9990         echo " "
9991         $cat >access.c <<EOCP
9992 #include <sys/types.h>
9993 #ifdef I_FCNTL
9994 #include <fcntl.h>
9995 #endif
9996 #ifdef I_SYS_FILE
9997 #include <sys/file.h>
9998 #endif
9999 #ifdef I_UNISTD
10000 #include <unistd.h>
10001 #endif
10002 #$i_stdlib I_STDLIB
10003 #ifdef I_STDLIB
10004 #include <stdlib.h>
10005 #endif
10006 int main() {
10007         exit(R_OK);
10008 }
10009 EOCP
10010         : check sys/file.h first, no particular reason here
10011         if $test `./findhdr sys/file.h` && \
10012                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10013                 h_sysfile=true;
10014                 echo "<sys/file.h> defines the *_OK access constants." >&4
10015         elif $test `./findhdr fcntl.h` && \
10016                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10017                 h_fcntl=true;
10018                 echo "<fcntl.h> defines the *_OK access constants." >&4
10019         elif $test `./findhdr unistd.h` && \
10020                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10021                 echo "<unistd.h> defines the *_OK access constants." >&4
10022         else
10023                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10024         fi
10025         ;;
10026 esac
10027 $rm -f access*
10028
10029 : see if accessx exists
10030 set accessx d_accessx
10031 eval $inlibc
10032
10033 : see if aintl exists
10034 set aintl d_aintl
10035 eval $inlibc
10036
10037 : see if alarm exists
10038 set alarm d_alarm
10039 eval $inlibc
10040
10041 : see if 64bit time functions exists
10042
10043 set ctime64 d_ctime64
10044 eval $inlibc
10045
10046 set localtime64 d_localtime64
10047 eval $inlibc
10048
10049 set gmtime64 d_gmtime64
10050 eval $inlibc
10051
10052 set mktime64 d_mktime64
10053 eval $inlibc
10054
10055 set difftime64 d_difftime64
10056 eval $inlibc
10057
10058 set asctime64 d_asctime64
10059 eval $inlibc
10060
10061 : see if POSIX threads are available
10062 set pthread.h i_pthread
10063 eval $inhdr
10064
10065 : define a fucntion to check prototypes
10066 $cat > protochk <<EOSH
10067 $startsh
10068 cc="$cc"
10069 optimize="$optimize"
10070 ccflags="$ccflags"
10071 prototype="$prototype"
10072 define="$define"
10073 rm_try="$rm_try"
10074 usethreads=$usethreads
10075 i_pthread=$i_pthread
10076 pthread_h_first=$pthread_h_first
10077 EOSH
10078
10079 $cat >> protochk <<'EOSH'
10080
10081 $rm_try
10082 foo="$1"
10083 shift
10084 while test $# -ge 2; do
10085         case "$1" in
10086                 $define) echo "#include <$2>" >> try.c ;;
10087                 literal) echo "$2" >> try.c ;;
10088         esac
10089     # Extra magic for the benefit of systems that need pthread.h
10090     # to be included early to correctly detect threadsafe functions.
10091     # Such functions must guarantee themselves, though, that the usethreads
10092     # and i_pthread have been defined, before calling protochk.
10093     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10094         echo "#include <pthread.h>" >> try.c
10095         pthread_h_done=yes
10096     fi
10097     shift 2
10098 done
10099 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10100 cat >> try.c <<'EOCP'
10101 #ifdef CAN_PROTOTYPE
10102 #define _(args) args
10103 #else
10104 #define _(args) ()
10105 #endif
10106 EOCP
10107 echo "$foo" >> try.c
10108 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10109 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10110 status=$?
10111 $rm_try
10112 exit $status
10113 EOSH
10114 chmod +x protochk
10115 $eunicefix protochk
10116
10117 : Define hasproto macro for Configure internal use
10118 hasproto='varname=$1; func=$2; shift; shift;
10119 while $test $# -ge 2; do
10120         case "$1" in
10121         $define) echo "#include <$2>";;
10122         esac ;
10123     shift 2;
10124 done > try.c;
10125 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10126 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10127         echo "$func() prototype found.";
10128         val="$define";
10129 else
10130         echo "$func() prototype NOT found.";
10131         val="$undef";
10132 fi;
10133 set $varname;
10134 eval $setvar;
10135 $rm_try tryout.c'
10136
10137 : see if sys/types.h has to be included
10138 set sys/types.h i_systypes
10139 eval $inhdr
10140
10141 : see if sys/select.h has to be included
10142 set sys/select.h i_sysselct
10143 eval $inhdr
10144
10145 : Define hasfield macro for Configure internal use
10146 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10147 while $test $# -ge 2; do
10148         case "$1" in
10149         $define) echo "#include <$2>";;
10150         esac ;
10151     shift 2;
10152 done > try.c;
10153 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10154 set try;
10155 if eval $compile; then
10156         val="$define";
10157 else
10158         val="$undef";
10159 fi;
10160 set $varname;
10161 eval $setvar;
10162 $rm_try'
10163
10164 : see if we should include time.h, sys/time.h, or both
10165 echo " "
10166 if test "X$timeincl" = X; then
10167         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10168         $echo $n "I'm now running the test program...$c"
10169         $cat >try.c <<EOCP
10170 #include <sys/types.h>
10171 #ifdef I_TIME
10172 #include <time.h>
10173 #endif
10174 #ifdef I_SYSTIME
10175 #ifdef SYSTIMEKERNEL
10176 #define KERNEL
10177 #endif
10178 #include <sys/time.h>
10179 #endif
10180 #ifdef I_SYSSELECT
10181 #include <sys/select.h>
10182 #endif
10183 #$i_stdlib I_STDLIB
10184 #ifdef I_STDLIB
10185 #include <stdlib.h>
10186 #endif
10187 int main()
10188 {
10189         struct tm foo;
10190 #ifdef S_TIMEVAL
10191         struct timeval bar;
10192 #endif
10193 #ifdef S_TIMEZONE
10194         struct timezone tzp;
10195 #endif
10196         if (foo.tm_sec == foo.tm_sec)
10197                 exit(0);
10198 #ifdef S_TIMEVAL
10199         if (bar.tv_sec == bar.tv_sec)
10200                 exit(0);
10201 #endif
10202         exit(1);
10203 }
10204 EOCP
10205         flags=''
10206         for s_timezone in '-DS_TIMEZONE' ''; do
10207         sysselect=''
10208         for s_timeval in '-DS_TIMEVAL' ''; do
10209         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10210         for i_time in '' '-DI_TIME'; do
10211         for i_systime in '-DI_SYSTIME' ''; do
10212                 case "$flags" in
10213                 '') $echo $n ".$c"
10214                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10215                         if eval $compile; then
10216                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10217                                 shift
10218                                 flags="$*"
10219                                 echo " "
10220                                 $echo $n "Succeeded with $flags$c"
10221                         fi
10222                         ;;
10223                 esac
10224         done
10225         done
10226         done
10227         done
10228         done
10229         timeincl=''
10230         echo " "
10231         case "$flags" in
10232         *SYSTIMEKERNEL*) i_systimek="$define"
10233                 timeincl=`./findhdr sys/time.h`
10234                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10235         *) i_systimek="$undef";;
10236         esac
10237         case "$flags" in
10238         *I_TIME*) i_time="$define"
10239                 timeincl=`./findhdr time.h`" $timeincl"
10240                 echo "We'll include <time.h>." >&4;;
10241         *) i_time="$undef";;
10242         esac
10243         case "$flags" in
10244         *I_SYSTIME*) i_systime="$define"
10245                 timeincl=`./findhdr sys/time.h`" $timeincl"
10246                 echo "We'll include <sys/time.h>." >&4;;
10247         *) i_systime="$undef";;
10248         esac
10249         $rm_try
10250 fi
10251 : see if struct tm knows about tm_zone
10252 case "$i_systime$i_time" in
10253 *$define*)
10254         echo " "
10255         echo "Checking to see if your struct tm has tm_zone field..." >&4
10256         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10257         eval $hasfield
10258         ;;
10259 *)      val="$undef"
10260         set d_tm_tm_zone
10261         eval $setvar
10262         ;;
10263 esac
10264 case "$d_tm_tm_zone" in
10265 "$define")      echo "Yes, it does."   ;;
10266 *)              echo "No, it doesn't." ;;
10267 esac
10268 : see if struct tm knows about tm_gmtoff
10269 case "$i_systime$i_time" in
10270 *$define*)
10271         echo " "
10272         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10273         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10274         eval $hasfield
10275         ;;
10276 *)      val="$undef"
10277         set d_tm_tm_gmtoff
10278         eval $setvar
10279         ;;
10280 esac
10281 case "$d_tm_tm_gmtoff" in
10282 "$define")      echo "Yes, it does."   ;;
10283 *)              echo "No, it doesn't." ;;
10284 esac
10285
10286 : see if asctime_r exists
10287 set asctime_r d_asctime_r
10288 eval $inlibc
10289 case "$d_asctime_r" in
10290 "$define")
10291         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10292         case "$d_asctime_r_proto:$usethreads" in
10293         ":define")      d_asctime_r_proto=define
10294                 set d_asctime_r_proto asctime_r $hdrs
10295                 eval $hasproto ;;
10296         *)      ;;
10297         esac
10298         case "$d_asctime_r_proto" in
10299         define)
10300         case "$asctime_r_proto" in
10301         ''|0) try='char* asctime_r(const struct tm*, char*);'
10302         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10303         esac
10304         case "$asctime_r_proto" in
10305         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10306         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10307         esac
10308         case "$asctime_r_proto" in
10309         ''|0) try='int asctime_r(const struct tm*, char*);'
10310         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10311         esac
10312         case "$asctime_r_proto" in
10313         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10314         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10315         esac
10316         case "$asctime_r_proto" in
10317         ''|0)   d_asctime_r=undef
10318                 asctime_r_proto=0
10319                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10320         * )     case "$asctime_r_proto" in
10321                 REENTRANT_PROTO*) ;;
10322                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10323                 esac
10324                 echo "Prototype: $try" ;;
10325         esac
10326         ;;
10327         *)      case "$usethreads" in
10328                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10329                 esac
10330                 d_asctime_r=undef
10331                 asctime_r_proto=0
10332                 ;;
10333         esac
10334         ;;
10335 *)      asctime_r_proto=0
10336         ;;
10337 esac
10338
10339 : see if atolf exists
10340 set atolf d_atolf
10341 eval $inlibc
10342
10343 : see if atoll exists
10344 set atoll d_atoll
10345 eval $inlibc
10346
10347 : Look for GCC-style attribute format
10348 case "$d_attribute_format" in
10349 '')
10350 echo " "
10351 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10352 $cat >attrib.c <<'EOCP'
10353 #include <stdio.h>
10354 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10355 EOCP
10356 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10357         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10358                 echo "Your C compiler doesn't support __attribute__((format))."
10359                 val="$undef"
10360         else
10361                 echo "Your C compiler supports __attribute__((format))."
10362                 val="$define"
10363         fi
10364 else
10365         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10366         val="$undef"
10367 fi
10368 ;;
10369 *) val="$d_attribute_format" ;;
10370 esac
10371 set d_attribute_format
10372 eval $setvar
10373 $rm -f attrib*
10374
10375 : Look for GCC-style attribute format with null format allowed
10376 case "$d_printf_format_null" in
10377 '') case "$d_attribute_format" in
10378     $define)
10379         echo " "
10380         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10381 $cat >attrib.c <<EOCP
10382 #include <stdio.h>
10383 #$i_stdlib I_STDLIB
10384 #ifdef I_STDLIB
10385 #include <stdlib.h>
10386 #endif
10387 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10388 int null_printf (char* pat,...) { return (int)pat; }
10389 int main () { exit(null_printf(NULL)); }
10390 EOCP
10391         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10392             : run the executable in case it produces a run-time warning
10393             if $run ./attrib >>attrib.out 2>&1; then
10394                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10395                     echo "Your C compiler doesn't allow __printf__ format to be null."
10396                     val="$undef"
10397                 else
10398                     echo "Your C compiler allows __printf__ format to be null."
10399                     val="$define"
10400                 fi
10401             else
10402             echo "Your C compiler executable failed with __printf__ format null."
10403             val="$undef"
10404         fi
10405     else
10406         echo "Your C compiler fails with __printf__ format null."
10407         val="$undef"
10408     fi
10409     ;;
10410     *)  val="$undef" ;;
10411     esac
10412 ;;
10413 *)  val="$d_printf_format_null" ;;
10414 esac
10415 set d_printf_format_null
10416 eval $setvar
10417 $rm -f attrib*
10418
10419 : Look for GCC-style attribute malloc
10420 case "$d_attribute_malloc" in
10421 '')
10422 echo " "
10423 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10424 $cat >attrib.c <<'EOCP'
10425 #include <stdio.h>
10426 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10427 EOCP
10428 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10429         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10430                 echo "Your C compiler doesn't support __attribute__((malloc))."
10431                 val="$undef"
10432         else
10433                 echo "Your C compiler supports __attribute__((malloc))."
10434                 val="$define"
10435         fi
10436 else
10437         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10438         val="$undef"
10439 fi
10440 ;;
10441 *) val="$d_attribute_malloc" ;;
10442 esac
10443 set d_attribute_malloc
10444 eval $setvar
10445 $rm -f attrib*
10446
10447 : Look for GCC-style attribute nonnull
10448 case "$d_attribute_nonnull" in
10449 '')
10450 echo " "
10451 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10452 $cat >attrib.c <<'EOCP'
10453 #include <stdio.h>
10454 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10455 EOCP
10456 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10457         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10458                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10459                 val="$undef"
10460         else
10461                 echo "Your C compiler supports __attribute__((nonnull))."
10462                 val="$define"
10463         fi
10464 else
10465         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10466         val="$undef"
10467 fi
10468 ;;
10469 *) val="$d_attribute_nonnull" ;;
10470 esac
10471 set d_attribute_nonnull
10472 eval $setvar
10473 $rm -f attrib*
10474
10475 : Look for GCC-style attribute noreturn
10476 case "$d_attribute_noreturn" in
10477 '')
10478 echo " "
10479 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10480 $cat >attrib.c <<'EOCP'
10481 #include <stdio.h>
10482 void fall_over_dead( void ) __attribute__((noreturn));
10483 EOCP
10484 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10485         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10486                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10487                 val="$undef"
10488         else
10489                 echo "Your C compiler supports __attribute__((noreturn))."
10490                 val="$define"
10491         fi
10492 else
10493         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10494         val="$undef"
10495 fi
10496 ;;
10497 *) val="$d_attribute_noreturn" ;;
10498 esac
10499 set d_attribute_noreturn
10500 eval $setvar
10501 $rm -f attrib*
10502
10503 : Look for GCC-style attribute pure
10504 case "$d_attribute_pure" in
10505 '')
10506 echo " "
10507 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10508 $cat >attrib.c <<'EOCP'
10509 #include <stdio.h>
10510 int square( int n ) __attribute__((pure));
10511 EOCP
10512 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10513         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10514                 echo "Your C compiler doesn't support __attribute__((pure))."
10515                 val="$undef"
10516         else
10517                 echo "Your C compiler supports __attribute__((pure))."
10518                 val="$define"
10519         fi
10520 else
10521         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10522         val="$undef"
10523 fi
10524 ;;
10525 *) val="$d_attribute_pure" ;;
10526 esac
10527 set d_attribute_pure
10528 eval $setvar
10529 $rm -f attrib*
10530
10531 : Look for GCC-style attribute unused
10532 case "$d_attribute_unused" in
10533 '')
10534 echo " "
10535 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10536 $cat >attrib.c <<'EOCP'
10537 #include <stdio.h>
10538 int do_something( int dummy __attribute__((unused)), int n );
10539 EOCP
10540 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10541         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10542                 echo "Your C compiler doesn't support __attribute__((unused))."
10543                 val="$undef"
10544         else
10545                 echo "Your C compiler supports __attribute__((unused))."
10546                 val="$define"
10547         fi
10548 else
10549         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10550         val="$undef"
10551 fi
10552 ;;
10553 *) val="$d_attribute_unused" ;;
10554 esac
10555 set d_attribute_unused
10556 eval $setvar
10557 $rm -f attrib*
10558
10559 : Look for GCC-style attribute deprecated
10560 case "$d_attribute_deprecated" in
10561 '')
10562 echo " "
10563 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10564 $cat >attrib.c <<'EOCP'
10565 #include <stdio.h>
10566 int I_am_deprecated(void) __attribute__((deprecated));
10567 EOCP
10568 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10569         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10570                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10571                 val="$undef"
10572         else
10573                 echo "Your C compiler supports __attribute__((deprecated))."
10574                 val="$define"
10575         fi
10576 else
10577         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10578         val="$undef"
10579 fi
10580 ;;
10581 *) val="$d_attribute_deprecated" ;;
10582 esac
10583 set d_attribute_deprecated
10584 eval $setvar
10585 $rm -f attrib*
10586
10587 : Look for GCC-style attribute warn_unused_result
10588 case "$d_attribute_warn_unused_result" in
10589 '')
10590 echo " "
10591 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10592 $cat >attrib.c <<'EOCP'
10593 #include <stdio.h>
10594 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10595 EOCP
10596 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10597         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10598                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10599                 val="$undef"
10600         else
10601                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10602                 val="$define"
10603         fi
10604 else
10605         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10606         val="$undef"
10607 fi
10608 ;;
10609 *) val="$d_attribute_warn_unused_result" ;;
10610 esac
10611 set d_attribute_warn_unused_result
10612 eval $setvar
10613 $rm -f attrib*
10614
10615 : see if bcmp exists
10616 set bcmp d_bcmp
10617 eval $inlibc
10618
10619 : see if bcopy exists
10620 set bcopy d_bcopy
10621 eval $inlibc
10622
10623 : see if getpgrp exists
10624 set getpgrp d_getpgrp
10625 eval $inlibc
10626
10627 case "$d_getpgrp" in
10628 "$define")
10629         echo " "
10630         echo "Checking to see which flavor of getpgrp is in use..."
10631         $cat >try.c <<EOP
10632 #$i_unistd I_UNISTD
10633 #include <sys/types.h>
10634 #ifdef I_UNISTD
10635 #  include <unistd.h>
10636 #endif
10637 #$i_stdlib I_STDLIB
10638 #ifdef I_STDLIB
10639 #include <stdlib.h>
10640 #endif
10641 int main()
10642 {
10643         if (getuid() == 0) {
10644                 printf("(I see you are running Configure as super-user...)\n");
10645                 setuid(1);
10646         }
10647 #ifdef TRY_BSD_PGRP
10648         if (getpgrp(1) == 0)
10649                 exit(0);
10650 #else
10651         if (getpgrp() > 0)
10652                 exit(0);
10653 #endif
10654         exit(1);
10655 }
10656 EOP
10657         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10658                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10659                 val="$define"
10660         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10661                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10662                 val="$undef"
10663         else
10664                 echo "I can't seem to compile and run the test program."
10665                 if ./usg; then
10666                         xxx="a USG one, i.e. you use getpgrp()."
10667                 else
10668                         # SVR4 systems can appear rather BSD-ish.
10669                         case "$i_unistd" in
10670                         $undef)
10671                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10672                                 val="$define"
10673                                 ;;
10674                         $define)
10675                                 xxx="probably a USG one, i.e. you use getpgrp()."
10676                                 val="$undef"
10677                                 ;;
10678                         esac
10679                 fi
10680                 echo "Assuming your getpgrp is $xxx" >&4
10681         fi
10682         ;;
10683 *) val="$undef";;
10684 esac
10685 set d_bsdgetpgrp
10686 eval $setvar
10687 $rm_try
10688
10689 : see if setpgrp exists
10690 set setpgrp d_setpgrp
10691 eval $inlibc
10692
10693 case "$d_setpgrp" in
10694 "$define")
10695         echo " "
10696         echo "Checking to see which flavor of setpgrp is in use..."
10697         $cat >try.c <<EOP
10698 #$i_unistd I_UNISTD
10699 #include <sys/types.h>
10700 #ifdef I_UNISTD
10701 #  include <unistd.h>
10702 #endif
10703 #$i_stdlib I_STDLIB
10704 #ifdef I_STDLIB
10705 #include <stdlib.h>
10706 #endif
10707 int main()
10708 {
10709         if (getuid() == 0) {
10710                 printf("(I see you are running Configure as super-user...)\n");
10711                 setuid(1);
10712         }
10713 #ifdef TRY_BSD_PGRP
10714         if (-1 == setpgrp(1, 1))
10715                 exit(0);
10716 #else
10717         if (setpgrp() != -1)
10718                 exit(0);
10719 #endif
10720         exit(1);
10721 }
10722 EOP
10723         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10724                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10725                 val="$define"
10726         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10727                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10728                 val="$undef"
10729         else
10730                 echo "(I can't seem to compile and run the test program.)"
10731                 if ./usg; then
10732                         xxx="a USG one, i.e. you use setpgrp()."
10733                 else
10734                         # SVR4 systems can appear rather BSD-ish.
10735                         case "$i_unistd" in
10736                         $undef)
10737                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10738                                 val="$define"
10739                                 ;;
10740                         $define)
10741                                 xxx="probably a USG one, i.e. you use setpgrp()."
10742                                 val="$undef"
10743                                 ;;
10744                         esac
10745                 fi
10746                 echo "Assuming your setpgrp is $xxx" >&4
10747         fi
10748         ;;
10749 *) val="$undef";;
10750 esac
10751 set d_bsdsetpgrp
10752 eval $setvar
10753 $rm_try
10754
10755 : Look for GCC-style __builtin_choose_expr
10756 case "$d_builtin_choose_expr" in
10757 '')
10758     echo " "
10759     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10760     $cat >try.c <<'EOCP'
10761 #include <assert.h>
10762 #include <stdlib.h>
10763 #include <stdio.h>
10764
10765 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10766
10767 int main(void) {
10768     assert( SYRINX(1) == 2112 );
10769     assert( SYRINX(1) != 5150 );
10770     assert( SYRINX(0) == 5150 );
10771     assert( SYRINX(0) != 2112 );
10772     puts( "All good!" );
10773     exit(0);
10774 }
10775
10776 EOCP
10777     set try
10778     if eval $compile && $run ./try; then
10779         echo "Your C compiler supports __builtin_choose_expr."
10780         val="$define"
10781     else
10782         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10783         val="$undef"
10784     fi
10785 ;;
10786 *) val="$d_builtin_choose_expr" ;;
10787 esac
10788
10789 set d_builtin_choose_expr
10790 eval $setvar
10791 $rm_try
10792
10793 : Look for GCC-style __builtin_expect
10794 case "$d_builtin_expect" in
10795 '')
10796     echo " "
10797     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10798     $cat >try.c <<'EOCP'
10799 int main(void) {
10800     int n = 50;
10801     if ( __builtin_expect(n, 0) ) n = 1;
10802     /* Remember shell exit code truth is 0, C truth is non-zero */
10803     return !(n == 1);
10804 }
10805 EOCP
10806     set try
10807     if eval $compile && $run ./try; then
10808         echo "Your C compiler supports __builtin_expect."
10809         val="$define"
10810     else
10811         echo "Your C compiler doesn't seem to understand __builtin_expect."
10812         val="$undef"
10813     fi
10814     ;;
10815 *) val="$d_builtin_expect" ;;
10816 esac
10817
10818 set d_builtin_expect
10819 eval $setvar
10820 $rm_try
10821
10822 : see if bzero exists
10823 set bzero d_bzero
10824 eval $inlibc
10825
10826 : see if stdarg is available
10827 echo " "
10828 if $test `./findhdr stdarg.h`; then
10829         echo "<stdarg.h> found." >&4
10830         valstd="$define"
10831 else
10832         echo "<stdarg.h> NOT found." >&4
10833         valstd="$undef"
10834 fi
10835
10836 : see if varags is available
10837 echo " "
10838 if $test `./findhdr varargs.h`; then
10839         echo "<varargs.h> found." >&4
10840 else
10841         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10842 fi
10843
10844 : set up the varargs testing programs
10845 $cat > varargs.c <<EOP
10846 #ifdef I_STDARG
10847 #include <stdarg.h>
10848 #endif
10849 #ifdef I_VARARGS
10850 #include <varargs.h>
10851 #endif
10852
10853 #ifdef I_STDARG
10854 int f(char *p, ...)
10855 #else
10856 int f(va_alist)
10857 va_dcl
10858 #endif
10859 {
10860         va_list ap;
10861 #ifndef I_STDARG
10862         char *p;
10863 #endif
10864 #ifdef I_STDARG
10865         va_start(ap,p);
10866 #else
10867         va_start(ap);
10868         p = va_arg(ap, char *);
10869 #endif
10870         va_end(ap);
10871         return 0;
10872 }
10873 EOP
10874 $cat > varargs <<EOP
10875 $startsh
10876 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10877         echo "true"
10878 else
10879         echo "false"
10880 fi
10881 $rm -f varargs$_o
10882 EOP
10883 chmod +x varargs
10884
10885 : now check which varargs header should be included
10886 echo " "
10887 i_varhdr=''
10888 case "$valstd" in
10889 "$define")
10890         if `./varargs I_STDARG`; then
10891                 val='stdarg.h'
10892         elif `./varargs I_VARARGS`; then
10893                 val='varargs.h'
10894         fi
10895         ;;
10896 *)
10897         if `./varargs I_VARARGS`; then
10898                 val='varargs.h'
10899         fi
10900         ;;
10901 esac
10902 case "$val" in
10903 '')
10904 echo "I could not find the definition for va_dcl... You have problems..." >&4
10905         val="$undef"; set i_stdarg; eval $setvar
10906         val="$undef"; set i_varargs; eval $setvar
10907         ;;
10908 *)
10909         set i_varhdr
10910         eval $setvar
10911         case "$i_varhdr" in
10912         stdarg.h)
10913                 val="$define"; set i_stdarg; eval $setvar
10914                 val="$undef"; set i_varargs; eval $setvar
10915                 ;;
10916         varargs.h)
10917                 val="$undef"; set i_stdarg; eval $setvar
10918                 val="$define"; set i_varargs; eval $setvar
10919                 ;;
10920         esac
10921         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10922 esac
10923 $rm -f varargs*
10924
10925 : see if the Compiler supports C99 variadic macros
10926 case "$i_stdarg$i_stdlib" in
10927     "$define$define")
10928     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10929     $cat >try.c <<EOCP
10930 #include <stdio.h>
10931 #include <stdarg.h>
10932
10933 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10934
10935 int main() {
10936   char buf[20];
10937   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10938   puts(buf);
10939   return 0;
10940 }
10941 EOCP
10942     set try
10943     if eval $compile && $run ./try 2>&1 >/dev/null; then
10944         case "`$run ./try`" in
10945             "123 456 789")
10946             echo "You have C99 variadic macros." >&4
10947             d_c99_variadic_macros="$define"
10948             ;;
10949             *)
10950             echo "You don't have functional C99 variadic macros." >&4
10951             d_c99_variadic_macros="$undef"
10952             ;;
10953         esac
10954     else
10955         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10956         d_c99_variadic_macros="$undef"
10957     fi
10958     $rm_try
10959     ;;
10960     *)
10961     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10962     d_c99_variadic_macros="$undef"
10963     ;;
10964 esac
10965
10966 : see if signal is declared as pointer to function returning int or void
10967 echo " "
10968 xxx=`./findhdr signal.h`
10969 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10970 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10971         echo "You have int (*signal())() instead of void." >&4
10972         val="$undef"
10973 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10974         echo "You have void (*signal())()." >&4
10975         val="$define"
10976 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10977         echo "You have int (*signal())() instead of void." >&4
10978         val="$undef"
10979 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10980         echo "You have void (*signal())()." >&4
10981         val="$define"
10982 else
10983         case "$d_voidsig" in
10984         '')
10985         echo "I can't determine whether signal handler returns void or int..." >&4
10986                 dflt=void
10987                 rp="What type does your signal handler return?"
10988                 . ./myread
10989                 case "$ans" in
10990                 v*) val="$define";;
10991                 *) val="$undef";;
10992                 esac;;
10993         "$define")
10994                 echo "As you already told me, signal handler returns void." >&4
10995                 val="$define"
10996                 ;;
10997         *)      echo "As you already told me, signal handler returns int." >&4
10998                 val="$undef"
10999                 ;;
11000         esac
11001 fi
11002 set d_voidsig
11003 eval $setvar
11004 case "$d_voidsig" in
11005 "$define") signal_t="void";;
11006 *) signal_t="int";;
11007 esac
11008 $rm -f $$.tmp
11009
11010 : check for ability to cast large floats to 32-bit ints.
11011 echo " "
11012 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11013 if $test "$intsize" -ge 4; then
11014         xxx=int
11015 else
11016         xxx=long
11017 fi
11018 $cat >try.c <<EOCP
11019 #include <stdio.h>
11020 #$i_stdlib I_STDLIB
11021 #ifdef I_STDLIB
11022 #include <stdlib.h>
11023 #endif
11024 #include <sys/types.h>
11025 #include <signal.h>
11026 $signal_t blech(int s) { exit(3); }
11027 int main()
11028 {
11029         $xxx i32;
11030         double f, g;
11031         int result = 0;
11032         char str[16];
11033         signal(SIGFPE, blech);
11034
11035         /* Don't let compiler optimize the test away.  Store the number
11036            in a writable string for gcc to pass to sscanf under HP-UX.
11037         */
11038         sprintf(str, "2147483647");
11039         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11040         g = 10 * f;
11041         i32  = ($xxx) g;
11042
11043         /* x86 processors will probably give 0x8000 0000, which is a
11044            sign change.  We don't want that.  We want to mimic SPARC
11045            behavior here, which is to preserve the sign and give
11046            back 0x7fff ffff.
11047         */
11048         if (i32 != ($xxx) f)
11049                 result |= 1;
11050         exit(result);
11051 }
11052 EOCP
11053 set try
11054 if eval $compile_ok; then
11055         $run ./try
11056         yyy=$?
11057 else
11058         echo "(I can't seem to compile the test program--assuming it can't)"
11059         yyy=1
11060 fi
11061 case "$yyy" in
11062 0)      val="$define"
11063         echo "Yup, it can."
11064         ;;
11065 *)      val="$undef"
11066         echo "Nope, it can't."
11067         ;;
11068 esac
11069 set d_casti32
11070 eval $setvar
11071 $rm_try
11072
11073 : check for ability to cast negative floats to unsigned
11074 echo " "
11075 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11076 $cat >try.c <<EOCP
11077 #include <stdio.h>
11078 #$i_stdlib I_STDLIB
11079 #ifdef I_STDLIB
11080 #include <stdlib.h>
11081 #endif
11082 #include <sys/types.h>
11083 #include <signal.h>
11084 $signal_t blech(int s) { exit(7); }
11085 $signal_t blech_in_list(int s) { exit(4); }
11086 unsigned long dummy_long(unsigned long p) { return p; }
11087 unsigned int dummy_int(unsigned int p) { return p; }
11088 unsigned short dummy_short(unsigned short p) { return p; }
11089 int main()
11090 {
11091         double f;
11092         unsigned long along;
11093         unsigned int aint;
11094         unsigned short ashort;
11095         int result = 0;
11096         char str[16];
11097
11098         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11099            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11100            optimized the whole file away
11101         */
11102         /* Store the number in a writable string for gcc to pass to
11103            sscanf under HP-UX.
11104         */
11105         sprintf(str, "-123");
11106         sscanf(str, "%lf", &f);  /* f = -123.; */
11107
11108         signal(SIGFPE, blech);
11109         along = (unsigned long)f;
11110         aint = (unsigned int)f;
11111         ashort = (unsigned short)f;
11112         if (along != (unsigned long)-123)
11113                 result |= 1;
11114         if (aint != (unsigned int)-123)
11115                 result |= 1;
11116         if (ashort != (unsigned short)-123)
11117                 result |= 1;
11118         sprintf(str, "1073741824.");
11119         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11120         f = f + f;
11121         along = 0;
11122         along = (unsigned long)f;
11123         if (along != 0x80000000)
11124                 result |= 2;
11125         f -= 1.;
11126         along = 0;
11127         along = (unsigned long)f;
11128         if (along != 0x7fffffff)
11129                 result |= 1;
11130         f += 2.;
11131         along = 0;
11132         along = (unsigned long)f;
11133         if (along != 0x80000001)
11134                 result |= 2;
11135         if (result)
11136                 exit(result);
11137         signal(SIGFPE, blech_in_list);
11138         sprintf(str, "123.");
11139         sscanf(str, "%lf", &f);  /* f = 123.; */
11140         along = dummy_long((unsigned long)f);
11141         aint = dummy_int((unsigned int)f);
11142         ashort = dummy_short((unsigned short)f);
11143         if (along != (unsigned long)123)
11144                 result |= 4;
11145         if (aint != (unsigned int)123)
11146                 result |= 4;
11147         if (ashort != (unsigned short)123)
11148                 result |= 4;
11149         exit(result);
11150
11151 }
11152 EOCP
11153 set try
11154 if eval $compile_ok; then
11155         $run ./try
11156         castflags=$?
11157 else
11158         echo "(I can't seem to compile the test program--assuming it can't)"
11159         castflags=7
11160 fi
11161 case "$castflags" in
11162 0)      val="$define"
11163         echo "Yup, it can."
11164         ;;
11165 *)      val="$undef"
11166         echo "Nope, it can't."
11167         ;;
11168 esac
11169 set d_castneg
11170 eval $setvar
11171 $rm_try
11172
11173 : see if vprintf exists
11174 echo " "
11175 if set vprintf val -f d_vprintf; eval $csym; $val; then
11176         echo 'vprintf() found.' >&4
11177         val="$define"
11178         $cat >try.c <<EOF
11179 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11180 #$i_varargs I_VARARGS
11181
11182 #$i_stdlib I_STDLIB
11183 #$i_unistd I_UNISTD
11184
11185 #ifdef I_STDARG
11186 #  include <stdarg.h>
11187 #else /* I_VARARGS */
11188 #  include <varargs.h>
11189 #endif
11190
11191 #ifdef I_UNISTD
11192 #  include <unistd.h>
11193 #endif
11194
11195 #ifdef I_STDLIB
11196 #  include <stdlib.h>
11197 #endif
11198
11199 #include <stdio.h> /* vsprintf prototype */
11200
11201 #ifdef I_STDARG
11202 void xxx(int n, ...)
11203 {
11204     va_list args;
11205     char buf[10];
11206     va_start(args, n);
11207     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11208 }
11209 int main() { xxx(1, "foo"); }
11210
11211 #else /* I_VARARGS */
11212
11213 xxx(va_alist)
11214 va_dcl
11215 {
11216     va_list args;
11217     char buf[10];
11218     va_start(args);
11219     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11220 }
11221 int main() { xxx("foo"); }
11222
11223 #endif
11224
11225 EOF
11226         set try
11227         if eval $compile_ok; then
11228                 if $run ./try; then
11229                         echo "Your vsprintf() returns (int)." >&4
11230                         val2="$undef"
11231                 else
11232                         echo "Your vsprintf() returns (char*)." >&4
11233                         val2="$define"
11234                 fi
11235         else
11236                 echo 'I am unable to compile the vsprintf() test program.' >&4
11237                 # We shouldn't get here.  If we do, assume the standard signature,
11238                 # not the old BSD one.
11239                 echo 'Guessing that vsprintf() returns (int).' >&4
11240                 val2="$undef"
11241         fi
11242 else
11243         echo 'vprintf() NOT found.' >&4
11244         val="$undef"
11245         val2="$undef"
11246 fi
11247 $rm_try
11248 set d_vprintf
11249 eval $setvar
11250 val=$val2
11251 set d_charvspr
11252 eval $setvar
11253
11254 : see if chown exists
11255 set chown d_chown
11256 eval $inlibc
11257
11258 : see if chroot exists
11259 set chroot d_chroot
11260 eval $inlibc
11261
11262 : see if chsize exists
11263 set chsize d_chsize
11264 eval $inlibc
11265
11266 : see if class exists
11267 set class d_class
11268 eval $inlibc
11269
11270 : see if clearenv exists
11271 set clearenv d_clearenv
11272 eval $inlibc
11273
11274 : Define hasstruct macro for Configure internal use
11275 hasstruct='varname=$1; struct=$2; shift; shift;
11276 while $test $# -ge 2; do
11277         case "$1" in
11278         $define) echo "#include <$2>";;
11279         esac ;
11280     shift 2;
11281 done > try.c;
11282 echo "int main () { struct $struct foo; }" >> try.c;
11283 set try;
11284 if eval $compile; then
11285         val="$define";
11286 else
11287         val="$undef";
11288 fi;
11289 set $varname;
11290 eval $setvar;
11291 $rm_try'
11292
11293 : see whether socket exists
11294 socketlib=''
11295 sockethdr=''
11296 echo " "
11297 $echo $n "Hmm... $c" >&4
11298 if set socket val -f d_socket; eval $csym; $val; then
11299         echo "Looks like you have Berkeley networking support." >&4
11300         d_socket="$define"
11301         if set setsockopt val -f; eval $csym; $val; then
11302                 d_oldsock="$undef"
11303         else
11304                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11305                 d_oldsock="$define"
11306         fi
11307 else
11308         if $contains socklib libc.list >/dev/null 2>&1; then
11309                 echo "Looks like you have Berkeley networking support." >&4
11310                 d_socket="$define"
11311                 : we will have to assume that it supports the 4.2 BSD interface
11312                 d_oldsock="$undef"
11313         else
11314                 echo "You don't have Berkeley networking in libc$_a..." >&4
11315                 if test "X$d_socket" = "X$define"; then
11316                    echo "...but you seem to believe that you have sockets." >&4
11317                 else
11318                         for net in net socket
11319                         do
11320                                 if test -f /usr/lib/lib$net$_a; then
11321                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11322                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11323                                         if $contains socket libc.list >/dev/null 2>&1; then
11324                                                 d_socket="$define"
11325                                                 socketlib="-l$net"
11326                                                 case "$net" in
11327                                                 net)
11328                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11329                                                         sockethdr="-I/usr/netinclude"
11330                                                         ;;
11331                                                 esac
11332                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11333                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11334                                                         d_oldsock="$undef"
11335                                                 else
11336                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11337                                                         d_oldsock="$define"
11338                                                 fi
11339                                                 break
11340                                         fi
11341                                 fi
11342                         done
11343                         if test "X$d_socket" != "X$define"; then
11344                            echo "or anywhere else I see." >&4
11345                            d_socket="$undef"
11346                            d_oldsock="$undef"
11347                         fi
11348                 fi
11349         fi
11350 fi
11351
11352 : see if socketpair exists
11353 set socketpair d_sockpair
11354 eval $inlibc
11355
11356
11357 echo " "
11358 echo "Checking the availability of certain socket constants..." >&4
11359 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11360         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11361         $cat >try.c <<EOF
11362 #include <sys/types.h>
11363 #include <sys/socket.h>
11364 int main() {
11365     int i = $ENUM;
11366 }
11367 EOF
11368         val="$undef"
11369         set try; if eval $compile; then
11370                 val="$define"
11371         fi
11372         set d_${enum}; eval $setvar
11373         $rm_try
11374 done
11375
11376 : see if this is a sys/uio.h system
11377 set sys/uio.h i_sysuio
11378 eval $inhdr
11379
11380 : Check for cmsghdr support
11381 echo " "
11382 echo "Checking to see if your system supports struct cmsghdr..." >&4
11383 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11384 eval $hasstruct
11385 case "$d_cmsghdr_s" in
11386 "$define")      echo "Yes, it does."   ;;
11387 *)              echo "No, it doesn't." ;;
11388 esac
11389
11390
11391 : check for const keyword
11392 echo " "
11393 echo 'Checking to see if your C compiler knows about "const"...' >&4
11394 $cat >const.c <<'EOCP'
11395 typedef struct spug { int drokk; } spug;
11396 int main()
11397 {
11398         const char *foo;
11399         const spug y = { 0 };
11400 }
11401 EOCP
11402 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11403         val="$define"
11404         echo "Yup, it does."
11405 else
11406         val="$undef"
11407         echo "Nope, it doesn't."
11408 fi
11409 set d_const
11410 eval $setvar
11411
11412 : see if copysignl exists
11413 set copysignl d_copysignl
11414 eval $inlibc
11415
11416 : see if crypt exists
11417 echo " "
11418 set crypt d_crypt
11419 eval $inlibc
11420 case "$d_crypt" in
11421 $define) cryptlib='' ;;
11422 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11423                 echo 'crypt() found.' >&4
11424                 val="$define"
11425                 cryptlib=''
11426         else
11427                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11428                 if $test -z "$cryptlib"; then
11429                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11430                 else
11431                         cryptlib=-lcrypt
11432                 fi
11433                 if $test -z "$cryptlib"; then
11434                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11435                 else
11436                         cryptlib=-lcrypt
11437                 fi
11438                 if $test -z "$cryptlib"; then
11439                         cryptlib=`./loc libcrypt$_a "" $libpth`
11440                 else
11441                         cryptlib=-lcrypt
11442                 fi
11443                 if $test -z "$cryptlib"; then
11444                         echo 'crypt() NOT found.' >&4
11445                         val="$undef"
11446                 else
11447                         val="$define"
11448                 fi
11449         fi
11450         set d_crypt
11451         eval $setvar
11452         ;;
11453 esac
11454
11455 : see if this is a crypt.h system
11456 set crypt.h i_crypt
11457 eval $inhdr
11458
11459 : see if crypt_r exists
11460 set crypt_r d_crypt_r
11461 eval $inlibc
11462 case "$d_crypt_r" in
11463 "$define")
11464         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11465         case "$d_crypt_r_proto:$usethreads" in
11466         ":define")      d_crypt_r_proto=define
11467                 set d_crypt_r_proto crypt_r $hdrs
11468                 eval $hasproto ;;
11469         *)      ;;
11470         esac
11471         case "$d_crypt_r_proto" in
11472         define)
11473         case "$crypt_r_proto" in
11474         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11475         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11476         esac
11477         case "$crypt_r_proto" in
11478         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11479         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11480         esac
11481         case "$crypt_r_proto" in
11482         ''|0)   d_crypt_r=undef
11483                 crypt_r_proto=0
11484                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11485         * )     case "$crypt_r_proto" in
11486                 REENTRANT_PROTO*) ;;
11487                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11488                 esac
11489                 echo "Prototype: $try" ;;
11490         esac
11491         ;;
11492         *)      case "$usethreads" in
11493                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11494                 esac
11495                 d_crypt_r=undef
11496                 crypt_r_proto=0
11497                 ;;
11498         esac
11499         ;;
11500 *)      crypt_r_proto=0
11501         ;;
11502 esac
11503
11504 : get csh whereabouts
11505 case "$csh" in
11506 'csh') val="$undef" ;;
11507 *) val="$define" ;;
11508 esac
11509 set d_csh
11510 eval $setvar
11511 : Respect a hint or command line value for full_csh.
11512 case "$full_csh" in
11513 '') full_csh=$csh ;;
11514 esac
11515
11516 : see if ctermid exists
11517 set ctermid d_ctermid
11518 eval $inlibc
11519
11520 : see if ctermid_r exists
11521 set ctermid_r d_ctermid_r
11522 eval $inlibc
11523 case "$d_ctermid_r" in
11524 "$define")
11525         hdrs="$i_systypes sys/types.h define stdio.h "
11526         case "$d_ctermid_r_proto:$usethreads" in
11527         ":define")      d_ctermid_r_proto=define
11528                 set d_ctermid_r_proto ctermid_r $hdrs
11529                 eval $hasproto ;;
11530         *)      ;;
11531         esac
11532         case "$d_ctermid_r_proto" in
11533         define)
11534         case "$ctermid_r_proto" in
11535         ''|0) try='char* ctermid_r(char*);'
11536         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11537         esac
11538         case "$ctermid_r_proto" in
11539         ''|0)   d_ctermid_r=undef
11540                 ctermid_r_proto=0
11541                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11542         * )     case "$ctermid_r_proto" in
11543                 REENTRANT_PROTO*) ;;
11544                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11545                 esac
11546                 echo "Prototype: $try" ;;
11547         esac
11548         ;;
11549         *)      case "$usethreads" in
11550                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11551                 esac
11552                 d_ctermid_r=undef
11553                 ctermid_r_proto=0
11554                 ;;
11555         esac
11556         ;;
11557 *)      ctermid_r_proto=0
11558         ;;
11559 esac
11560
11561 : see if ctime_r exists
11562 set ctime_r d_ctime_r
11563 eval $inlibc
11564 case "$d_ctime_r" in
11565 "$define")
11566         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11567         case "$d_ctime_r_proto:$usethreads" in
11568         ":define")      d_ctime_r_proto=define
11569                 set d_ctime_r_proto ctime_r $hdrs
11570                 eval $hasproto ;;
11571         *)      ;;
11572         esac
11573         case "$d_ctime_r_proto" in
11574         define)
11575         case "$ctime_r_proto" in
11576         ''|0) try='char* ctime_r(const time_t*, char*);'
11577         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11578         esac
11579         case "$ctime_r_proto" in
11580         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11581         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11582         esac
11583         case "$ctime_r_proto" in
11584         ''|0) try='int ctime_r(const time_t*, char*);'
11585         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11586         esac
11587         case "$ctime_r_proto" in
11588         ''|0) try='int ctime_r(const time_t*, char*, int);'
11589         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11590         esac
11591         case "$ctime_r_proto" in
11592         ''|0)   d_ctime_r=undef
11593                 ctime_r_proto=0
11594                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11595         * )     case "$ctime_r_proto" in
11596                 REENTRANT_PROTO*) ;;
11597                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11598                 esac
11599                 echo "Prototype: $try" ;;
11600         esac
11601         ;;
11602         *)      case "$usethreads" in
11603                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11604                 esac
11605                 d_ctime_r=undef
11606                 ctime_r_proto=0
11607                 ;;
11608         esac
11609         ;;
11610 *)      ctime_r_proto=0
11611         ;;
11612 esac
11613
11614 : see if cuserid exists
11615 set cuserid d_cuserid
11616 eval $inlibc
11617
11618 : see if this is a limits.h system
11619 set limits.h i_limits
11620 eval $inhdr
11621
11622 : see if this is a float.h system
11623 set float.h i_float
11624 eval $inhdr
11625
11626 : See if number of significant digits in a double precision number is known
11627 echo " "
11628 $cat >dbl_dig.c <<EOM
11629 #$i_limits I_LIMITS
11630 #$i_float I_FLOAT
11631 #ifdef I_LIMITS
11632 #include <limits.h>
11633 #endif
11634 #ifdef I_FLOAT
11635 #include <float.h>
11636 #endif
11637 #ifdef DBL_DIG
11638 printf("Contains DBL_DIG");
11639 #endif
11640 EOM
11641 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11642 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11643         echo "DBL_DIG found." >&4
11644         val="$define"
11645 else
11646         echo "DBL_DIG NOT found." >&4
11647         val="$undef"
11648 fi
11649 $rm -f dbl_dig.?
11650 set d_dbl_dig
11651 eval $setvar
11652
11653 : see if dbm.h is available
11654 : see if dbmclose exists
11655 set dbmclose d_dbmclose
11656 eval $inlibc
11657
11658 case "$d_dbmclose" in
11659 $define)
11660         set dbm.h i_dbm
11661         eval $inhdr
11662         case "$i_dbm" in
11663         $define)
11664                 val="$undef"
11665                 set i_rpcsvcdbm
11666                 eval $setvar
11667                 ;;
11668         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11669                 eval $inhdr
11670                 ;;
11671         esac
11672         ;;
11673 *)      echo "We won't be including <dbm.h>"
11674         val="$undef"
11675         set i_dbm
11676         eval $setvar
11677         val="$undef"
11678         set i_rpcsvcdbm
11679         eval $setvar
11680         ;;
11681 esac
11682
11683 : see if prototype for dbminit is available
11684 echo " "
11685 set d_dbminitproto dbminit $i_dbm dbm.h
11686 eval $hasproto
11687
11688 : see if difftime exists
11689 set difftime d_difftime
11690 eval $inlibc
11691
11692 : see if this is a dirent system
11693 echo " "
11694 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11695         val="$define"
11696         echo "<dirent.h> found." >&4
11697 else
11698         val="$undef"
11699         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11700                 echo "<sys/dir.h> found." >&4
11701                 echo " "
11702         else
11703                 xinc=`./findhdr sys/ndir.h`
11704         fi
11705         echo "<dirent.h> NOT found." >&4
11706 fi
11707 set i_dirent
11708 eval $setvar
11709
11710 : Look for type of directory structure.
11711 echo " "
11712 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11713
11714 case "$direntrytype" in
11715 ''|' ')
11716         case "$i_dirent" in
11717         $define) guess1='struct dirent' ;;
11718         *) guess1='struct direct'  ;;
11719         esac
11720         ;;
11721 *)      guess1="$direntrytype"
11722         ;;
11723 esac
11724
11725 case "$guess1" in
11726 'struct dirent') guess2='struct direct' ;;
11727 *) guess2='struct dirent' ;;
11728 esac
11729
11730 if $contains "$guess1" try.c >/dev/null 2>&1; then
11731         direntrytype="$guess1"
11732         echo "Your directory entries are $direntrytype." >&4
11733 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11734         direntrytype="$guess2"
11735         echo "Your directory entries seem to be $direntrytype." >&4
11736 else
11737         echo "I don't recognize your system's directory entries." >&4
11738         rp="What type is used for directory entries on this system?"
11739         dflt="$guess1"
11740         . ./myread
11741         direntrytype="$ans"
11742 fi
11743 $rm_try
11744
11745 : see if the directory entry stores field length
11746 echo " "
11747 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11748 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11749         echo "Good, your directory entry keeps length information in d_namlen." >&4
11750         val="$define"
11751 else
11752         echo "Your directory entry does not know about the d_namlen field." >&4
11753         val="$undef"
11754 fi
11755 set d_dirnamlen
11756 eval $setvar
11757 $rm_try
11758
11759 : Look for DIR.dd_fd
11760 case "$i_dirent" in
11761 "$define")
11762     echo "Checking to see if DIR has a dd_fd member variable" >&4
11763     $cat >try.c <<EOCP
11764 #$i_stdlib I_STDLIB
11765 #ifdef I_STDLIB
11766 #include <stdlib.h>
11767 #endif
11768 #include <dirent.h>
11769
11770 int main() {
11771     DIR dir;
11772     dir.dd_fd = 1;
11773     return 0;
11774 }
11775 EOCP
11776     val=$undef
11777     set try
11778     if eval $compile; then
11779         echo "Yes, it does."
11780         val="$define"
11781     else
11782         echo "No, it does not."
11783         val="$undef"
11784     fi
11785     ;;
11786 *)
11787     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11788     val="$undef"
11789     ;;
11790 esac
11791 set d_dir_dd_fd
11792 eval $setvar
11793 $rm_try
11794
11795 : see if this is an sysdir system
11796 set sys/dir.h i_sysdir
11797 eval $inhdr
11798
11799 : see if this is an sysndir system
11800 set sys/ndir.h i_sysndir
11801 eval $inhdr
11802
11803 : Look for dirfd
11804 echo " "
11805 $cat >dirfd.c <<EOM
11806 #include <stdio.h>
11807 #$i_stdlib I_STDLIB
11808 #ifdef I_STDLIB
11809 #include <stdlib.h>
11810 #endif
11811 #$i_dirent I_DIRENT             /**/
11812 #$i_sysdir I_SYS_DIR            /**/
11813 #$i_sysndir I_SYS_NDIR          /**/
11814 #$i_systypes I_SYS_TYPES        /**/
11815 #if defined(I_SYS_TYPES)
11816 #include <sys/types.h>
11817 #endif
11818 #if defined(I_DIRENT)
11819 #include <dirent.h>
11820 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11821 #include <sys/dir.h>
11822 #endif
11823 #else
11824 #ifdef I_SYS_NDIR
11825 #include <sys/ndir.h>
11826 #else
11827 #ifdef I_SYS_DIR
11828 #ifdef hp9000s500
11829 #include <ndir.h>       /* may be wrong in the future */
11830 #else
11831 #include <sys/dir.h>
11832 #endif
11833 #endif
11834 #endif
11835 #endif 
11836 int main() {
11837         DIR *dirp = opendir(".");
11838         if (dirfd(dirp) >= 0)
11839                 exit(0);
11840         else
11841                 exit(1);
11842 }
11843 EOM
11844 val=$undef
11845 set dirfd
11846 if eval $compile; then
11847         val="$define"
11848 fi
11849 case "$val" in
11850 $define)        echo "dirfd() found." >&4       ;;
11851 *)              echo "dirfd() NOT found." >&4   ;;
11852 esac
11853 set d_dirfd
11854 eval $setvar
11855 $rm -f dirfd*
11856
11857 : see if dlerror exists
11858 xxx_runnm="$runnm"
11859 runnm=false
11860 set dlerror d_dlerror
11861 eval $inlibc
11862 runnm="$xxx_runnm"
11863
11864 : see if dlfcn is available
11865 set dlfcn.h i_dlfcn
11866 eval $inhdr
11867
11868 : Check what extension to use for shared libs
11869 case "$usedl" in
11870 $define|y|true)
11871         $cat << EOM
11872
11873 On a few systems, the dynamically loaded modules that perl generates and uses
11874 will need a different extension than shared libs. The default will probably
11875 be appropriate.
11876
11877 EOM
11878         case "$dlext" in
11879         '')     dflt="$so" ;;
11880         *)      dflt="$dlext" ;;
11881         esac
11882         rp='What is the extension of dynamically loaded modules'
11883         . ./myread
11884         dlext="$ans"
11885         ;;
11886 *)
11887         dlext="none"
11888         ;;
11889 esac
11890
11891 : Check if dlsym need a leading underscore
11892 echo " "
11893 val="$undef"
11894
11895 case "$dlsrc" in
11896 dl_dlopen.xs)
11897         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11898         $cat >dyna.c <<'EOM'
11899 fred () { }
11900 EOM
11901
11902 $cat >fred.c<<EOM
11903
11904 #include <stdio.h>
11905 #$i_stdlib I_STDLIB
11906 #ifdef I_STDLIB
11907 #include <stdlib.h>
11908 #endif
11909 #$i_dlfcn I_DLFCN
11910 #ifdef I_DLFCN
11911 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11912 #else
11913 #include <sys/types.h>
11914 #include <nlist.h>
11915 #include <link.h>
11916 #endif
11917
11918 extern int fred() ;
11919
11920 int main()
11921 {
11922     void * handle ;
11923     void * symbol ;
11924 #ifndef RTLD_LAZY
11925     int mode = 1 ;
11926 #else
11927     int mode = RTLD_LAZY ;
11928 #endif
11929     handle = dlopen("./dyna.$dlext", mode) ;
11930     if (handle == NULL) {
11931         printf ("1\n") ;
11932         fflush (stdout) ;
11933         exit(0);
11934     }
11935     symbol = dlsym(handle, "fred") ;
11936     if (symbol == NULL) {
11937         /* try putting a leading underscore */
11938         symbol = dlsym(handle, "_fred") ;
11939         if (symbol == NULL) {
11940             printf ("2\n") ;
11941             fflush (stdout) ;
11942             exit(0);
11943         }
11944         printf ("3\n") ;
11945     }
11946     else
11947         printf ("4\n") ;
11948     fflush (stdout) ;
11949     exit(0);
11950 }
11951 EOM
11952         : Call the object file tmp-dyna.o in case dlext=o.
11953         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11954                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11955                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11956                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11957                 xxx=`$run ./fred`
11958                 case $xxx in
11959                 1)      echo "Test program failed using dlopen." >&4
11960                         echo "Perhaps you should not use dynamic loading." >&4;;
11961                 2)      echo "Test program failed using dlsym." >&4
11962                         echo "Perhaps you should not use dynamic loading." >&4;;
11963                 3)      echo "dlsym needs a leading underscore" >&4
11964                         val="$define" ;;
11965                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11966                 esac
11967         else
11968                 echo "I can't compile and run the test program." >&4
11969                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11970         fi
11971         ;;
11972 esac
11973
11974 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11975
11976 set d_dlsymun
11977 eval $setvar
11978
11979 : see if drand48_r exists
11980 set drand48_r d_drand48_r
11981 eval $inlibc
11982 case "$d_drand48_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11985         case "$d_drand48_r_proto:$usethreads" in
11986         ":define")      d_drand48_r_proto=define
11987                 set d_drand48_r_proto drand48_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_drand48_r_proto" in
11992         define)
11993         case "$drand48_r_proto" in
11994         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11995         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11996         esac
11997         case "$drand48_r_proto" in
11998         ''|0)   d_drand48_r=undef
11999                 drand48_r_proto=0
12000                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12001         * )     case "$drand48_r_proto" in
12002                 REENTRANT_PROTO*) ;;
12003                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12004                 esac
12005                 echo "Prototype: $try" ;;
12006         esac
12007         ;;
12008         *)      case "$usethreads" in
12009                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12010                 esac
12011                 d_drand48_r=undef
12012                 drand48_r_proto=0
12013                 ;;
12014         esac
12015         ;;
12016 *)      drand48_r_proto=0
12017         ;;
12018 esac
12019
12020 : see if prototype for drand48 is available
12021 echo " "
12022 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12023 eval $hasproto
12024
12025 : see if dup2 exists
12026 set dup2 d_dup2
12027 eval $inlibc
12028
12029 : see if eaccess exists
12030 set eaccess d_eaccess
12031 eval $inlibc
12032
12033 : see if endgrent exists
12034 set endgrent d_endgrent
12035 eval $inlibc
12036
12037 : see if this is an grp system
12038 set grp.h i_grp
12039 eval $inhdr
12040
12041 case "$i_grp" in
12042 $define)
12043         xxx=`./findhdr grp.h`
12044         $cppstdin $cppflags $cppminus < $xxx >$$.h
12045
12046         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12047                 val="$define"
12048         else
12049                 val="$undef"
12050         fi
12051         set d_grpasswd
12052         eval $setvar
12053
12054         $rm -f $$.h
12055         ;;
12056 *)
12057         val="$undef";
12058         set d_grpasswd; eval $setvar
12059         ;;
12060 esac
12061
12062 : see if endgrent_r exists
12063 set endgrent_r d_endgrent_r
12064 eval $inlibc
12065 case "$d_endgrent_r" in
12066 "$define")
12067         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12068         case "$d_endgrent_r_proto:$usethreads" in
12069         ":define")      d_endgrent_r_proto=define
12070                 set d_endgrent_r_proto endgrent_r $hdrs
12071                 eval $hasproto ;;
12072         *)      ;;
12073         esac
12074         case "$d_endgrent_r_proto" in
12075         define)
12076         case "$endgrent_r_proto" in
12077         ''|0) try='int endgrent_r(FILE**);'
12078         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12079         esac
12080         case "$endgrent_r_proto" in
12081         ''|0) try='void endgrent_r(FILE**);'
12082         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12083         esac
12084         case "$endgrent_r_proto" in
12085         ''|0)   d_endgrent_r=undef
12086                 endgrent_r_proto=0
12087                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12088         * )     case "$endgrent_r_proto" in
12089                 REENTRANT_PROTO*) ;;
12090                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12091                 esac
12092                 echo "Prototype: $try" ;;
12093         esac
12094         ;;
12095         *)      case "$usethreads" in
12096                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12097                 esac
12098                 d_endgrent_r=undef
12099                 endgrent_r_proto=0
12100                 ;;
12101         esac
12102         ;;
12103 *)      endgrent_r_proto=0
12104         ;;
12105 esac
12106
12107 : see if endhostent exists
12108 set endhostent d_endhent
12109 eval $inlibc
12110
12111 : see if this is a netdb.h system
12112 set netdb.h i_netdb
12113 eval $inhdr
12114
12115 : see if endhostent_r exists
12116 set endhostent_r d_endhostent_r
12117 eval $inlibc
12118 case "$d_endhostent_r" in
12119 "$define")
12120         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12121         case "$d_endhostent_r_proto:$usethreads" in
12122         ":define")      d_endhostent_r_proto=define
12123                 set d_endhostent_r_proto endhostent_r $hdrs
12124                 eval $hasproto ;;
12125         *)      ;;
12126         esac
12127         case "$d_endhostent_r_proto" in
12128         define)
12129         case "$endhostent_r_proto" in
12130         ''|0) try='int endhostent_r(struct hostent_data*);'
12131         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12132         esac
12133         case "$endhostent_r_proto" in
12134         ''|0) try='void endhostent_r(struct hostent_data*);'
12135         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12136         esac
12137         case "$endhostent_r_proto" in
12138         ''|0)   d_endhostent_r=undef
12139                 endhostent_r_proto=0
12140                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12141         * )     case "$endhostent_r_proto" in
12142                 REENTRANT_PROTO*) ;;
12143                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12144                 esac
12145                 echo "Prototype: $try" ;;
12146         esac
12147         ;;
12148         *)      case "$usethreads" in
12149                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12150                 esac
12151                 d_endhostent_r=undef
12152                 endhostent_r_proto=0
12153                 ;;
12154         esac
12155         ;;
12156 *)      endhostent_r_proto=0
12157         ;;
12158 esac
12159
12160 : see if endnetent exists
12161 set endnetent d_endnent
12162 eval $inlibc
12163
12164 : see if endnetent_r exists
12165 set endnetent_r d_endnetent_r
12166 eval $inlibc
12167 case "$d_endnetent_r" in
12168 "$define")
12169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12170         case "$d_endnetent_r_proto:$usethreads" in
12171         ":define")      d_endnetent_r_proto=define
12172                 set d_endnetent_r_proto endnetent_r $hdrs
12173                 eval $hasproto ;;
12174         *)      ;;
12175         esac
12176         case "$d_endnetent_r_proto" in
12177         define)
12178         case "$endnetent_r_proto" in
12179         ''|0) try='int endnetent_r(struct netent_data*);'
12180         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12181         esac
12182         case "$endnetent_r_proto" in
12183         ''|0) try='void endnetent_r(struct netent_data*);'
12184         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12185         esac
12186         case "$endnetent_r_proto" in
12187         ''|0)   d_endnetent_r=undef
12188                 endnetent_r_proto=0
12189                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12190         * )     case "$endnetent_r_proto" in
12191                 REENTRANT_PROTO*) ;;
12192                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12193                 esac
12194                 echo "Prototype: $try" ;;
12195         esac
12196         ;;
12197         *)      case "$usethreads" in
12198                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12199                 esac
12200                 d_endnetent_r=undef
12201                 endnetent_r_proto=0
12202                 ;;
12203         esac
12204         ;;
12205 *)      endnetent_r_proto=0
12206         ;;
12207 esac
12208
12209 : see if endprotoent exists
12210 set endprotoent d_endpent
12211 eval $inlibc
12212
12213 : see if endprotoent_r exists
12214 set endprotoent_r d_endprotoent_r
12215 eval $inlibc
12216 case "$d_endprotoent_r" in
12217 "$define")
12218         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12219         case "$d_endprotoent_r_proto:$usethreads" in
12220         ":define")      d_endprotoent_r_proto=define
12221                 set d_endprotoent_r_proto endprotoent_r $hdrs
12222                 eval $hasproto ;;
12223         *)      ;;
12224         esac
12225         case "$d_endprotoent_r_proto" in
12226         define)
12227         case "$endprotoent_r_proto" in
12228         ''|0) try='int endprotoent_r(struct protoent_data*);'
12229         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12230         esac
12231         case "$endprotoent_r_proto" in
12232         ''|0) try='void endprotoent_r(struct protoent_data*);'
12233         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12234         esac
12235         case "$endprotoent_r_proto" in
12236         ''|0)   d_endprotoent_r=undef
12237                 endprotoent_r_proto=0
12238                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12239         * )     case "$endprotoent_r_proto" in
12240                 REENTRANT_PROTO*) ;;
12241                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12242                 esac
12243                 echo "Prototype: $try" ;;
12244         esac
12245         ;;
12246         *)      case "$usethreads" in
12247                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12248                 esac
12249                 d_endprotoent_r=undef
12250                 endprotoent_r_proto=0
12251                 ;;
12252         esac
12253         ;;
12254 *)      endprotoent_r_proto=0
12255         ;;
12256 esac
12257
12258 : see if endpwent exists
12259 set endpwent d_endpwent
12260 eval $inlibc
12261
12262 : see if this is a pwd.h system
12263 set pwd.h i_pwd
12264 eval $inhdr
12265
12266 case "$i_pwd" in
12267 $define)
12268         xxx=`./findhdr pwd.h`
12269         $cppstdin $cppflags $cppminus < $xxx >$$.h
12270
12271         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12272                 val="$define"
12273         else
12274                 val="$undef"
12275         fi
12276         set d_pwquota
12277         eval $setvar
12278
12279         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12280                 val="$define"
12281         else
12282                 val="$undef"
12283         fi
12284         set d_pwage
12285         eval $setvar
12286
12287         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12288                 val="$define"
12289         else
12290                 val="$undef"
12291         fi
12292         set d_pwchange
12293         eval $setvar
12294
12295         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12296                 val="$define"
12297         else
12298                 val="$undef"
12299         fi
12300         set d_pwclass
12301         eval $setvar
12302
12303         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12304                 val="$define"
12305         else
12306                 val="$undef"
12307         fi
12308         set d_pwexpire
12309         eval $setvar
12310
12311         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12312                 val="$define"
12313         else
12314                 val="$undef"
12315         fi
12316         set d_pwcomment
12317         eval $setvar
12318
12319         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12320                 val="$define"
12321         else
12322                 val="$undef"
12323         fi
12324         set d_pwgecos
12325         eval $setvar
12326
12327         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12328                 val="$define"
12329         else
12330                 val="$undef"
12331         fi
12332         set d_pwpasswd
12333         eval $setvar
12334
12335         $rm -f $$.h
12336         ;;
12337 *)
12338         val="$undef"; 
12339         set d_pwquota; eval $setvar
12340         set d_pwage; eval $setvar
12341         set d_pwchange; eval $setvar
12342         set d_pwclass; eval $setvar
12343         set d_pwexpire; eval $setvar
12344         set d_pwcomment; eval $setvar
12345         set d_pwgecos; eval $setvar
12346         set d_pwpasswd; eval $setvar
12347         ;;
12348 esac
12349
12350 : see if endpwent_r exists
12351 set endpwent_r d_endpwent_r
12352 eval $inlibc
12353 case "$d_endpwent_r" in
12354 "$define")
12355         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12356         case "$d_endpwent_r_proto:$usethreads" in
12357         ":define")      d_endpwent_r_proto=define
12358                 set d_endpwent_r_proto endpwent_r $hdrs
12359                 eval $hasproto ;;
12360         *)      ;;
12361         esac
12362         case "$d_endpwent_r_proto" in
12363         define)
12364         case "$endpwent_r_proto" in
12365         ''|0) try='int endpwent_r(FILE**);'
12366         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12367         esac
12368         case "$endpwent_r_proto" in
12369         ''|0) try='void endpwent_r(FILE**);'
12370         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12371         esac
12372         case "$endpwent_r_proto" in
12373         ''|0)   d_endpwent_r=undef
12374                 endpwent_r_proto=0
12375                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12376         * )     case "$endpwent_r_proto" in
12377                 REENTRANT_PROTO*) ;;
12378                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12379                 esac
12380                 echo "Prototype: $try" ;;
12381         esac
12382         ;;
12383         *)      case "$usethreads" in
12384                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12385                 esac
12386                 d_endpwent_r=undef
12387                 endpwent_r_proto=0
12388                 ;;
12389         esac
12390         ;;
12391 *)      endpwent_r_proto=0
12392         ;;
12393 esac
12394
12395 : see if endservent exists
12396 set endservent d_endsent
12397 eval $inlibc
12398
12399 : see if endservent_r exists
12400 set endservent_r d_endservent_r
12401 eval $inlibc
12402 case "$d_endservent_r" in
12403 "$define")
12404         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12405         case "$d_endservent_r_proto:$usethreads" in
12406         ":define")      d_endservent_r_proto=define
12407                 set d_endservent_r_proto endservent_r $hdrs
12408                 eval $hasproto ;;
12409         *)      ;;
12410         esac
12411         case "$d_endservent_r_proto" in
12412         define)
12413         case "$endservent_r_proto" in
12414         ''|0) try='int endservent_r(struct servent_data*);'
12415         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12416         esac
12417         case "$endservent_r_proto" in
12418         ''|0) try='void endservent_r(struct servent_data*);'
12419         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12420         esac
12421         case "$endservent_r_proto" in
12422         ''|0)   d_endservent_r=undef
12423                 endservent_r_proto=0
12424                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12425         * )     case "$endservent_r_proto" in
12426                 REENTRANT_PROTO*) ;;
12427                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12428                 esac
12429                 echo "Prototype: $try" ;;
12430         esac
12431         ;;
12432         *)      case "$usethreads" in
12433                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12434                 esac
12435                 d_endservent_r=undef
12436                 endservent_r_proto=0
12437                 ;;
12438         esac
12439         ;;
12440 *)      endservent_r_proto=0
12441         ;;
12442 esac
12443
12444 : Locate the flags for 'open()'
12445 echo " "
12446 $cat >try.c <<EOCP
12447 #include <sys/types.h>
12448 #ifdef I_FCNTL
12449 #include <fcntl.h>
12450 #endif
12451 #ifdef I_SYS_FILE
12452 #include <sys/file.h>
12453 #endif
12454 #$i_stdlib I_STDLIB
12455 #ifdef I_STDLIB
12456 #include <stdlib.h>
12457 #endif
12458 int main() {
12459         if(O_RDONLY);
12460 #ifdef O_TRUNC
12461         exit(0);
12462 #else
12463         exit(1);
12464 #endif
12465 }
12466 EOCP
12467 : check sys/file.h first to get FREAD on Sun
12468 if $test `./findhdr sys/file.h` && \
12469                 set try -DI_SYS_FILE && eval $compile; then
12470         h_sysfile=true;
12471         echo "<sys/file.h> defines the O_* constants..." >&4
12472         if $run ./try; then
12473                 echo "and you have the 3 argument form of open()." >&4
12474                 val="$define"
12475         else
12476                 echo "but not the 3 argument form of open().  Oh, well." >&4
12477                 val="$undef"
12478         fi
12479 elif $test `./findhdr fcntl.h` && \
12480                 set try -DI_FCNTL && eval $compile; then
12481         h_fcntl=true;
12482         echo "<fcntl.h> defines the O_* constants..." >&4
12483         if $run ./try; then
12484                 echo "and you have the 3 argument form of open()." >&4
12485                 val="$define"
12486         else
12487                 echo "but not the 3 argument form of open().  Oh, well." >&4
12488                 val="$undef"
12489         fi
12490 else
12491         val="$undef"
12492         echo "I can't find the O_* constant definitions!  You got problems." >&4
12493 fi
12494 set d_open3
12495 eval $setvar
12496 $rm_try
12497
12498 : see if this is a sys/file.h system
12499 val=''
12500 set sys/file.h val
12501 eval $inhdr
12502
12503 : do we need to include sys/file.h ?
12504 case "$val" in
12505 "$define")
12506         echo " "
12507         if $h_sysfile; then
12508                 val="$define"
12509                 echo "We'll be including <sys/file.h>." >&4
12510         else
12511                 val="$undef"
12512                 echo "We won't be including <sys/file.h>." >&4
12513         fi
12514         ;;
12515 *)
12516         h_sysfile=false
12517         ;;
12518 esac
12519 set i_sysfile
12520 eval $setvar
12521
12522 : see if fcntl.h is there
12523 val=''
12524 set fcntl.h val
12525 eval $inhdr
12526
12527 : see if we can include fcntl.h
12528 case "$val" in
12529 "$define")
12530         echo " "
12531         if $h_fcntl; then
12532                 val="$define"
12533                 echo "We'll be including <fcntl.h>." >&4
12534         else
12535                 val="$undef"
12536                 if $h_sysfile; then
12537         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12538                 else
12539                         echo "We won't be including <fcntl.h>." >&4
12540                 fi
12541         fi
12542         ;;
12543 *)
12544         h_fcntl=false
12545         val="$undef"
12546         ;;
12547 esac
12548 set i_fcntl
12549 eval $setvar
12550
12551 : see if fork exists
12552 set fork d_fork
12553 eval $inlibc
12554
12555 : see if pipe exists
12556 set pipe d_pipe
12557 eval $inlibc
12558
12559 : check for non-blocking I/O stuff
12560 case "$h_sysfile" in
12561 true) echo "#include <sys/file.h>" > head.c;;
12562 *)
12563        case "$h_fcntl" in
12564        true) echo "#include <fcntl.h>" > head.c;;
12565        *) echo "#include <sys/fcntl.h>" > head.c;;
12566        esac
12567        ;;
12568 esac
12569 echo " "
12570 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12571 case "$o_nonblock" in
12572 '')
12573         $cat head.c > try.c
12574         $cat >>try.c <<EOCP
12575 #include <stdio.h>
12576 #$i_stdlib I_STDLIB
12577 #ifdef I_STDLIB
12578 #include <stdlib.h>
12579 #endif
12580 #$i_fcntl I_FCNTL
12581 #ifdef I_FCNTL
12582 #include <fcntl.h>
12583 #endif
12584 int main() {
12585 #ifdef O_NONBLOCK
12586         printf("O_NONBLOCK\n");
12587         exit(0);
12588 #endif
12589 #ifdef O_NDELAY
12590         printf("O_NDELAY\n");
12591         exit(0);
12592 #endif
12593 #ifdef FNDELAY
12594         printf("FNDELAY\n");
12595         exit(0);
12596 #endif
12597         exit(0);
12598 }
12599 EOCP
12600         set try
12601         if eval $compile_ok; then
12602                 o_nonblock=`$run ./try`
12603                 case "$o_nonblock" in
12604                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12605                 *) echo "Seems like we can use $o_nonblock.";;
12606                 esac
12607         else
12608                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12609         fi
12610         ;;
12611 *) echo "Using $hint value $o_nonblock.";;
12612 esac
12613 $rm_try
12614
12615 echo " "
12616 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12617 case "$eagain" in
12618 '')
12619         case "$d_fork:$d_pipe" in
12620         define:define)
12621         $cat head.c > try.c
12622         $cat >>try.c <<EOCP
12623 #include <errno.h>
12624 #include <sys/types.h>
12625 #include <signal.h>
12626 #include <stdio.h>
12627 #$i_stdlib I_STDLIB
12628 #ifdef I_STDLIB
12629 #include <stdlib.h>
12630 #endif
12631 #$i_fcntl I_FCNTL
12632 #ifdef I_FCNTL
12633 #include <fcntl.h>
12634 #endif
12635 #define MY_O_NONBLOCK $o_nonblock
12636 #ifndef errno  /* XXX need better Configure test */
12637 extern int errno;
12638 #endif
12639 #$i_unistd I_UNISTD
12640 #ifdef I_UNISTD
12641 #include <unistd.h>
12642 #endif
12643 #$i_string I_STRING
12644 #ifdef I_STRING
12645 #include <string.h>
12646 #else
12647 #include <strings.h>
12648 #endif
12649 $signal_t blech(int x) { exit(3); }
12650 EOCP
12651         $cat >> try.c <<'EOCP'
12652 int main()
12653 {
12654         int pd[2];
12655         int pu[2];
12656         char buf[1];
12657         char string[100];
12658
12659         pipe(pd);       /* Down: child -> parent */
12660         pipe(pu);       /* Up: parent -> child */
12661         if (0 != fork()) {
12662                 int ret;
12663                 close(pd[1]);   /* Parent reads from pd[0] */
12664                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12665 #ifdef F_SETFL
12666                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12667                         exit(1);
12668 #else
12669                 exit(4);
12670 #endif
12671                 signal(SIGALRM, blech);
12672                 alarm(5);
12673                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12674                         exit(2);
12675                 sprintf(string, "%d\n", ret);
12676                 write(2, string, strlen(string));
12677                 alarm(0);
12678 #ifdef EAGAIN
12679                 if (errno == EAGAIN) {
12680                         printf("EAGAIN\n");
12681                         goto ok;
12682                 }
12683 #endif
12684 #ifdef EWOULDBLOCK
12685                 if (errno == EWOULDBLOCK)
12686                         printf("EWOULDBLOCK\n");
12687 #endif
12688         ok:
12689                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12690                 sleep(2);                               /* Give it time to close our pipe */
12691                 alarm(5);
12692                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12693                 alarm(0);
12694                 sprintf(string, "%d\n", ret);
12695                 write(4, string, strlen(string));
12696                 exit(0);
12697         }
12698
12699         close(pd[0]);                   /* We write to pd[1] */
12700         close(pu[1]);                   /* We read from pu[0] */
12701         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12702         close(pd[1]);                   /* Pipe pd is now fully closed! */
12703         exit(0);                                /* Bye bye, thank you for playing! */
12704 }
12705 EOCP
12706         set try
12707         if eval $compile_ok; then
12708                 echo "$startsh" >mtry
12709                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12710                 chmod +x mtry
12711                 ./mtry >/dev/null 2>&1
12712                 case $? in
12713                 0) eagain=`$cat try.out`;;
12714                 1) echo "Could not perform non-blocking setting!";;
12715                 2) echo "I did a successful read() for something that was not there!";;
12716                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12717                 4) echo "Could not find F_SETFL!";;
12718                 *) echo "Something terribly wrong happened during testing.";;
12719                 esac
12720                 rd_nodata=`$cat try.ret`
12721                 echo "A read() system call with no data present returns $rd_nodata."
12722                 case "$rd_nodata" in
12723                 0|-1) ;;
12724                 *)
12725                         echo "(That's peculiar, fixing that to be -1.)"
12726                         rd_nodata=-1
12727                         ;;
12728                 esac
12729                 case "$eagain" in
12730                 '')
12731                         echo "Forcing errno EAGAIN on read() with no data available."
12732                         eagain=EAGAIN
12733                         ;;
12734                 *)
12735                         echo "Your read() sets errno to $eagain when no data is available."
12736                         ;;
12737                 esac
12738                 status=`$cat try.err`
12739                 case "$status" in
12740                 0) echo "And it correctly returns 0 to signal EOF.";;
12741                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12742                 *) echo "However, your read() returns '$status' on EOF??";;
12743                 esac
12744                 val="$define"
12745                 if test "$status" = "$rd_nodata"; then
12746                         echo "WARNING: you can't distinguish between EOF and no data!"
12747                         val="$undef"
12748                 fi
12749         else
12750                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12751                 eagain=EAGAIN
12752         fi
12753         ;;
12754         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12755                 eagain=EAGAIN
12756                 val="$define"
12757                 ;;
12758         esac
12759         set d_eofnblk
12760         eval $setvar
12761         ;;
12762 *)
12763         echo "Using $hint value $eagain."
12764         echo "Your read() returns $rd_nodata when no data is present."
12765         case "$d_eofnblk" in
12766         "$define") echo "And you can see EOF because read() returns 0.";;
12767         "$undef") echo "But you can't see EOF status from read() returned value.";;
12768         *)
12769                 echo "(Assuming you can't see EOF status from read anyway.)"
12770                 d_eofnblk=$undef
12771                 ;;
12772         esac
12773         ;;
12774 esac
12775 $rm_try head.c mtry
12776
12777 : see if _ptr and _cnt from stdio act std
12778 echo " "
12779
12780 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12781         echo "(Looks like you have stdio.h from BSD.)"
12782         case "$stdio_ptr" in
12783         '') stdio_ptr='((fp)->_p)'
12784                 ptr_lval=$define
12785                 ;;
12786         *)      ptr_lval=$d_stdio_ptr_lval;;
12787         esac
12788         case "$stdio_cnt" in
12789         '') stdio_cnt='((fp)->_r)'
12790                 cnt_lval=$define
12791                 ;;
12792         *)      cnt_lval=$d_stdio_cnt_lval;;
12793         esac
12794         case "$stdio_base" in
12795         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12796         esac
12797         case "$stdio_bufsiz" in
12798         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12799         esac
12800 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12801         echo "(Looks like you have stdio.h from Linux.)"
12802         case "$stdio_ptr" in
12803         '') stdio_ptr='((fp)->_IO_read_ptr)'
12804                 ptr_lval=$define
12805                 ;;
12806         *)      ptr_lval=$d_stdio_ptr_lval;;
12807         esac
12808         case "$stdio_cnt" in
12809         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12810                 cnt_lval=$undef
12811                 ;;
12812         *)      cnt_lval=$d_stdio_cnt_lval;;
12813         esac
12814         case "$stdio_base" in
12815         '') stdio_base='((fp)->_IO_read_base)';;
12816         esac
12817         case "$stdio_bufsiz" in
12818         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12819         esac
12820 else
12821         case "$stdio_ptr" in
12822         '') stdio_ptr='((fp)->_ptr)'
12823                 ptr_lval=$define
12824                 ;;
12825         *)      ptr_lval=$d_stdio_ptr_lval;;
12826         esac
12827         case "$stdio_cnt" in
12828         '') stdio_cnt='((fp)->_cnt)'
12829                 cnt_lval=$define
12830                 ;;
12831         *)      cnt_lval=$d_stdio_cnt_lval;;
12832         esac
12833         case "$stdio_base" in
12834         '') stdio_base='((fp)->_base)';;
12835         esac
12836         case "$stdio_bufsiz" in
12837         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12838         esac
12839 fi
12840
12841 : test whether _ptr and _cnt really work
12842 echo "Checking how std your stdio is..." >&4
12843 $cat >try.c <<EOP
12844 #include <stdio.h>
12845 #$i_stdlib I_STDLIB
12846 #ifdef I_STDLIB
12847 #include <stdlib.h>
12848 #endif
12849 #define FILE_ptr(fp)    $stdio_ptr
12850 #define FILE_cnt(fp)    $stdio_cnt
12851 int main() {
12852         FILE *fp = fopen("try.c", "r");
12853         char c = getc(fp);
12854         if (
12855                 18 <= FILE_cnt(fp) &&
12856                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12857         )
12858                 exit(0);
12859         exit(1);
12860 }
12861 EOP
12862 val="$undef"
12863 set try
12864 if eval $compile && $to try.c; then
12865         if $run ./try; then
12866                 echo "Your stdio acts pretty std."
12867                 val="$define"
12868         else
12869                 echo "Your stdio isn't very std."
12870         fi
12871 else
12872         echo "Your stdio doesn't appear very std."
12873 fi
12874 $rm_try
12875
12876 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12877 # direct buffer manipulation no longer works.  The Configure tests
12878 # should be changed to correctly detect this, but until then,
12879 # the following check should at least let perl compile and run.
12880 # (This quick fix should be updated before 5.8.1.)
12881 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12882 # A. Dougherty, June 3, 2002.
12883 case "$d_gnulibc" in
12884 $define)
12885         case "$gnulibc_version" in
12886         2.[01]*)  ;;
12887         2.2) ;;
12888         2.2.[0-9]) ;;
12889         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12890                 val="$undef"
12891                 ;;
12892         esac
12893         ;;
12894 esac
12895 set d_stdstdio
12896 eval $setvar
12897
12898 : Can _ptr be used as an lvalue?
12899 case "$d_stdstdio$ptr_lval" in
12900 $define$define) val=$define ;;
12901 *) val=$undef ;;
12902 esac
12903 set d_stdio_ptr_lval
12904 eval $setvar
12905
12906 : Can _cnt be used as an lvalue?
12907 case "$d_stdstdio$cnt_lval" in
12908 $define$define) val=$define ;;
12909 *) val=$undef ;;
12910 esac
12911 set d_stdio_cnt_lval
12912 eval $setvar
12913
12914
12915 : test whether setting _ptr sets _cnt as a side effect
12916 d_stdio_ptr_lval_sets_cnt="$undef"
12917 d_stdio_ptr_lval_nochange_cnt="$undef"
12918 case "$d_stdio_ptr_lval$d_stdstdio" in
12919 $define$define)
12920         echo "Checking to see what happens if we set the stdio ptr..." >&4
12921 $cat >try.c <<EOP
12922 #include <stdio.h>
12923 /* Can we scream? */
12924 /* Eat dust sed :-) */
12925 /* In the buffer space, no one can hear you scream. */
12926 #$i_stdlib I_STDLIB
12927 #ifdef I_STDLIB
12928 #include <stdlib.h>
12929 #endif
12930 #define FILE_ptr(fp)    $stdio_ptr
12931 #define FILE_cnt(fp)    $stdio_cnt
12932 #include <sys/types.h>
12933 int main() {
12934         FILE *fp = fopen("try.c", "r");
12935         int c;
12936         char *ptr;
12937         size_t cnt;
12938         if (!fp) {
12939             puts("Fail even to read");
12940             exit(1);
12941         }
12942         c = getc(fp); /* Read away the first # */
12943         if (c == EOF) {
12944             puts("Fail even to read");
12945             exit(1);
12946         }
12947         if (!(
12948                 18 <= FILE_cnt(fp) &&
12949                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12950         )) {
12951                 puts("Fail even to read");
12952                 exit (1);
12953         }
12954         ptr = (char*) FILE_ptr(fp);
12955         cnt = (size_t)FILE_cnt(fp);
12956
12957         FILE_ptr(fp) += 42;
12958
12959         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12960                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12961                 exit (1);
12962         }
12963         if (FILE_cnt(fp) <= 20) {
12964                 printf ("Fail (<20 chars to test)");
12965                 exit (1);
12966         }
12967         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12968                 puts("Fail compare");
12969                 exit (1);
12970         }
12971         if (cnt == FILE_cnt(fp)) {
12972                 puts("Pass_unchanged");
12973                 exit (0);
12974         }
12975         if (FILE_cnt(fp) == (cnt - 42)) {
12976                 puts("Pass_changed");
12977                 exit (0);
12978         }
12979         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12980         return 1;
12981
12982 }
12983 EOP
12984         set try
12985         if eval $compile && $to try.c; then
12986                 case `$run ./try` in
12987                 Pass_changed)
12988                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12989                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12990                 Pass_unchanged)
12991                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12992                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12993                 Fail*)
12994                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12995                 *)
12996                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12997         esac
12998         else
12999                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13000         fi
13001         $rm_try
13002         ;;
13003 esac
13004
13005 : see if _base is also standard
13006 val="$undef"
13007 case "$d_stdstdio" in
13008 $define)
13009         $cat >try.c <<EOP
13010 #include <stdio.h>
13011 #$i_stdlib I_STDLIB
13012 #ifdef I_STDLIB
13013 #include <stdlib.h>
13014 #endif
13015 #define FILE_base(fp)   $stdio_base
13016 #define FILE_bufsiz(fp) $stdio_bufsiz
13017 int main() {
13018         FILE *fp = fopen("try.c", "r");
13019         char c = getc(fp);
13020         if (
13021                 19 <= FILE_bufsiz(fp) &&
13022                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13023         )
13024                 exit(0);
13025         exit(1);
13026 }
13027 EOP
13028         set try
13029         if eval $compile && $to try.c; then
13030                 if $run ./try; then
13031                         echo "And its _base field acts std."
13032                         val="$define"
13033                 else
13034                         echo "But its _base field isn't std."
13035                 fi
13036         else
13037                 echo "However, it seems to be lacking the _base field."
13038         fi
13039         $rm_try
13040         ;;
13041 esac
13042 set d_stdiobase
13043 eval $setvar
13044
13045 : see if fast_stdio exists
13046 val="$undef"
13047 case "$d_stdstdio:$d_stdio_ptr_lval" in
13048 "$define:$define")
13049         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13050         *$define*)
13051                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13052                 val="$define"
13053                 ;;
13054         esac
13055         ;;
13056 esac
13057 set d_faststdio
13058 eval $setvar
13059
13060
13061
13062 : see if fchdir exists
13063 set fchdir d_fchdir
13064 eval $inlibc
13065
13066 : see if fchmod exists
13067 set fchmod d_fchmod
13068 eval $inlibc
13069
13070 : see if fchown exists
13071 set fchown d_fchown
13072 eval $inlibc
13073
13074 : see if this is an fcntl system
13075 set fcntl d_fcntl
13076 eval $inlibc
13077
13078 : See if fcntl-based locking works.
13079 echo " "
13080 $cat >try.c <<EOCP
13081 #$i_stdlib I_STDLIB
13082 #ifdef I_STDLIB
13083 #include <stdlib.h>
13084 #endif
13085 #include <unistd.h>
13086 #include <fcntl.h>
13087 #include <signal.h>
13088 $signal_t blech(int x) { exit(3); }
13089 int main() {
13090 #if defined(F_SETLK) && defined(F_SETLKW)
13091      struct flock flock;
13092      int retval, fd;
13093      fd = open("try.c", O_RDONLY);
13094      flock.l_type = F_RDLCK;
13095      flock.l_whence = SEEK_SET;
13096      flock.l_start = flock.l_len = 0;
13097      signal(SIGALRM, blech);
13098      alarm(10);
13099      retval = fcntl(fd, F_SETLK, &flock);
13100      close(fd);
13101      (retval < 0 ? exit(2) : exit(0));
13102 #else
13103      exit(2);
13104 #endif
13105 }
13106 EOCP
13107 echo "Checking if fcntl-based file locking works... "
13108 case "$d_fcntl" in
13109 "$define")
13110         set try
13111         if eval $compile_ok; then
13112                 if $run ./try; then
13113                         echo "Yes, it seems to work."
13114                         val="$define"
13115                 else
13116                         echo "Nope, it didn't work."
13117                         val="$undef"
13118                         case "$?" in
13119                         3) $cat >&4 <<EOM
13120 ***
13121 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13122 *** This is (almost) impossible.
13123 *** If your NFS lock daemons are not feeling well, something like
13124 *** this may happen, please investigate.  Cannot continue, aborting.
13125 ***
13126 EOM
13127                                 exit 1
13128                                 ;;
13129                         esac
13130                 fi
13131         else
13132                 echo "I'm unable to compile the test program, so I'll assume not."
13133                 val="$undef"
13134         fi
13135         ;;
13136 *) val="$undef";
13137         echo "Nope, since you don't even have fcntl()."
13138         ;;
13139 esac
13140 set d_fcntl_can_lock
13141 eval $setvar
13142 $rm_try
13143
13144 : check for fd_set items
13145 $cat <<EOM
13146
13147 Checking to see how well your C compiler handles fd_set and friends ...
13148 EOM
13149 $cat >try.c <<EOCP
13150 #$i_stdlib I_STDLIB
13151 #ifdef I_STDLIB
13152 #include <stdlib.h>
13153 #endif
13154 #$i_systime I_SYS_TIME
13155 #$i_sysselct I_SYS_SELECT
13156 #$d_socket HAS_SOCKET
13157 #include <sys/types.h>
13158 #ifdef HAS_SOCKET
13159 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13160 #endif
13161 #ifdef I_SYS_TIME
13162 #include <sys/time.h>
13163 #endif
13164 #ifdef I_SYS_SELECT
13165 #include <sys/select.h>
13166 #endif
13167 int main() {
13168         fd_set fds;
13169
13170 #ifdef TRYBITS
13171         if(fds.fds_bits);
13172 #endif
13173
13174 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13175         exit(0);
13176 #else
13177         exit(1);
13178 #endif
13179 }
13180 EOCP
13181 set try -DTRYBITS
13182 if eval $compile; then
13183         d_fds_bits="$define"
13184         d_fd_set="$define"
13185         echo "Well, your system knows about the normal fd_set typedef..." >&4
13186         if $run ./try; then
13187                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13188                 d_fd_macros="$define"
13189         else
13190                 $cat >&4 <<'EOM'
13191 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13192 EOM
13193                 d_fd_macros="$undef"
13194         fi
13195 else
13196         $cat <<'EOM'
13197 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13198 EOM
13199         set try
13200         if eval $compile; then
13201                 d_fds_bits="$undef"
13202                 d_fd_set="$define"
13203                 echo "Well, your system has some sort of fd_set available..." >&4
13204                 if $run ./try; then
13205                         echo "and you have the normal fd_set macros." >&4
13206                         d_fd_macros="$define"
13207                 else
13208                         $cat <<'EOM'
13209 but not the normal fd_set macros!  Gross!  More work for me...
13210 EOM
13211                         d_fd_macros="$undef"
13212                 fi
13213         else
13214         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13215                 d_fd_set="$undef"
13216                 d_fds_bits="$undef"
13217                 d_fd_macros="$undef"
13218         fi
13219 fi
13220 $rm_try
13221
13222 : see if fgetpos exists
13223 set fgetpos d_fgetpos
13224 eval $inlibc
13225
13226 : see if finite exists
13227 set finite d_finite
13228 eval $inlibc
13229
13230 : see if finitel exists
13231 set finitel d_finitel
13232 eval $inlibc
13233
13234 : see if flock exists
13235 set flock d_flock
13236 eval $inlibc
13237
13238 : see if prototype for flock is available
13239 echo " "
13240 set d_flockproto flock $i_sysfile sys/file.h
13241 eval $hasproto
13242
13243 : see if fp_class exists
13244 set fp_class d_fp_class
13245 eval $inlibc
13246
13247 : see if pathconf exists
13248 set pathconf d_pathconf
13249 eval $inlibc
13250
13251 : see if fpathconf exists
13252 set fpathconf d_fpathconf
13253 eval $inlibc
13254
13255 : see if fpclass exists
13256 set fpclass d_fpclass
13257 eval $inlibc
13258
13259 : see if fpclassify exists
13260 set fpclassify d_fpclassify
13261 eval $inlibc
13262
13263 : see if fpclassl exists
13264 set fpclassl d_fpclassl
13265 eval $inlibc
13266
13267 : check for fpos64_t
13268 echo " "
13269 echo "Checking to see if you have fpos64_t..." >&4
13270 $cat >try.c <<EOCP
13271 #include <stdio.h>
13272 int main() { fpos64_t x = 7; }
13273 EOCP
13274 set try
13275 if eval $compile; then
13276         val="$define"
13277         echo "You have fpos64_t."
13278 else
13279         val="$undef"
13280         echo "You do not have fpos64_t."
13281         case "$fpossize" in
13282         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13283         esac
13284 fi
13285 $rm_try
13286 set d_fpos64_t
13287 eval $setvar
13288
13289 : see if frexpl exists
13290 set frexpl d_frexpl
13291 eval $inlibc
13292
13293 : see if this is a sys/param system
13294 set sys/param.h i_sysparam
13295 eval $inhdr
13296
13297 : see if this is a sys/mount.h system
13298 set sys/mount.h i_sysmount
13299 eval $inhdr
13300
13301 : Check for fs_data_s
13302 echo " "
13303 echo "Checking to see if your system supports struct fs_data..." >&4
13304 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13305 eval $hasstruct
13306 case "$d_fs_data_s" in
13307 "$define")      echo "Yes, it does."   ;;
13308 *)              echo "No, it doesn't." ;;
13309 esac
13310
13311 : see if fseeko exists
13312 set fseeko d_fseeko
13313 eval $inlibc
13314 case "$longsize" in
13315 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13316 esac
13317
13318 : see if fsetpos exists
13319 set fsetpos d_fsetpos
13320 eval $inlibc
13321
13322 : see if fstatfs exists
13323 set fstatfs d_fstatfs
13324 eval $inlibc
13325
13326 : see if statvfs exists
13327 set statvfs d_statvfs
13328 eval $inlibc
13329
13330 : see if fstatvfs exists
13331 set fstatvfs d_fstatvfs
13332 eval $inlibc
13333
13334
13335 : see if fsync exists
13336 set fsync d_fsync
13337 eval $inlibc
13338
13339 : see if ftello exists
13340 set ftello d_ftello
13341 eval $inlibc
13342 case "$longsize" in
13343 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13344 esac
13345
13346 : check for a working futimes
13347 d_futimes="$undef"
13348 echo " "
13349 echo "Checking if you have a working futimes()" >&4
13350 $cat >try.c <<EOCP
13351 #include <stdio.h>
13352 #include <sys/time.h>
13353 #include <errno.h>
13354 #include <fcntl.h>
13355
13356 int main ()
13357 {
13358     int fd, rv;
13359     fd = open ("try.c", O_RDWR);
13360     if (-1 == fd) exit (1);
13361     rv = futimes (fd, NULL);
13362     exit (rv == -1 ? errno : 0);
13363 }
13364 EOCP
13365 set try
13366 if eval $compile; then
13367     `$run ./try`
13368     rc=$?
13369     case "$rc" in
13370         0)  echo "Yes, you have" >&4
13371             d_futimes="$define"
13372             ;;
13373         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13374             ;;
13375     esac
13376 else
13377     echo "No, it does not (probably harmless)" >&4
13378 fi
13379 $rm_try
13380
13381 : see if ndbm.h is available
13382 set ndbm.h i_ndbm
13383 eval $inhdr
13384 : Compatibility location for RedHat 7.1
13385 set gdbm/ndbm.h i_gdbmndbm
13386 eval $inhdr
13387 : Compatibility location for Debian 4.0
13388 set gdbm-ndbm.h i_gdbm_ndbm
13389 eval $inhdr
13390
13391 val="$undef"
13392 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13393         : see if dbm_open exists
13394         set dbm_open d_dbm_open
13395         eval $inlibc
13396         case "$d_dbm_open" in
13397         $undef)
13398                 i_ndbm="$undef"
13399                 i_gdbmndbm="$undef"
13400                 i_gdbm_ndbm="$undef"
13401                 echo "We won't be including <ndbm.h>"
13402                 val="$undef"
13403                 ;;
13404         *) val="$define"
13405            ;;
13406         esac
13407 fi
13408 set d_ndbm
13409 eval $setvar
13410
13411 ndbm_hdr_protochk='name=$1; hdr=$2;
13412 eval "ihdr=\$""i_$name";
13413 val="$undef";
13414 if $test "$ihdr" = "$define"; then
13415         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13416         case "$d_cplusplus" in
13417         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13418         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13419         esac;
13420         case "$val" in
13421         $define) $echo "Your <$hdr> seems to have prototypes";;
13422         *) $echo "Your <$hdr> does not seem to have prototypes";;
13423         esac;
13424 fi;
13425 set "d_${name}_h_uses_prototypes";
13426 eval $setvar'
13427
13428 set ndbm ndbm.h
13429 eval $ndbm_hdr_protochk
13430 set gdbmndbm gdbm/ndbm.h
13431 eval $ndbm_hdr_protochk
13432 set gdbm_ndbm gdbm-ndbm.h
13433 eval $ndbm_hdr_protochk
13434
13435 : see if getaddrinfo exists
13436 set getaddrinfo d_getaddrinfo
13437 eval $inlibc
13438
13439 : see if getcwd exists
13440 set getcwd d_getcwd
13441 eval $inlibc
13442
13443 : see if getespwnam exists
13444 set getespwnam d_getespwnam
13445 eval $inlibc
13446
13447 : see if getfsstat exists
13448 set getfsstat d_getfsstat
13449 eval $inlibc
13450
13451 : see if getgrent exists
13452 set getgrent d_getgrent
13453 eval $inlibc
13454
13455 : see if getgrent_r exists
13456 set getgrent_r d_getgrent_r
13457 eval $inlibc
13458 case "$d_getgrent_r" in
13459 "$define")
13460         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13461         case "$d_getgrent_r_proto:$usethreads" in
13462         ":define")      d_getgrent_r_proto=define
13463                 set d_getgrent_r_proto getgrent_r $hdrs
13464                 eval $hasproto ;;
13465         *)      ;;
13466         esac
13467         case "$d_getgrent_r_proto" in
13468         define)
13469         case "$getgrent_r_proto" in
13470         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13471         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13472         esac
13473         case "$getgrent_r_proto" in
13474         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13475         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13476         esac
13477         case "$getgrent_r_proto" in
13478         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13479         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13480         esac
13481         case "$getgrent_r_proto" in
13482         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13483         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13484         esac
13485         case "$getgrent_r_proto" in
13486         ''|0) try='int getgrent_r(struct group*, char*, int);'
13487         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13488         esac
13489         case "$getgrent_r_proto" in
13490         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13491         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13492         esac
13493         case "$getgrent_r_proto" in
13494         ''|0)   d_getgrent_r=undef
13495                 getgrent_r_proto=0
13496                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13497         * )     case "$getgrent_r_proto" in
13498                 REENTRANT_PROTO*) ;;
13499                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13500                 esac
13501                 echo "Prototype: $try" ;;
13502         esac
13503         ;;
13504         *)      case "$usethreads" in
13505                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13506                 esac
13507                 d_getgrent_r=undef
13508                 getgrent_r_proto=0
13509                 ;;
13510         esac
13511         ;;
13512 *)      getgrent_r_proto=0
13513         ;;
13514 esac
13515
13516 : see if getgrgid_r exists
13517 set getgrgid_r d_getgrgid_r
13518 eval $inlibc
13519 case "$d_getgrgid_r" in
13520 "$define")
13521         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13522         case "$d_getgrgid_r_proto:$usethreads" in
13523         ":define")      d_getgrgid_r_proto=define
13524                 set d_getgrgid_r_proto getgrgid_r $hdrs
13525                 eval $hasproto ;;
13526         *)      ;;
13527         esac
13528         case "$d_getgrgid_r_proto" in
13529         define)
13530         case "$getgrgid_r_proto" in
13531         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13532         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13533         esac
13534         case "$getgrgid_r_proto" in
13535         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13536         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13537         esac
13538         case "$getgrgid_r_proto" in
13539         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13540         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13541         esac
13542         case "$getgrgid_r_proto" in
13543         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13544         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13545         esac
13546         case "$getgrgid_r_proto" in
13547         ''|0)   d_getgrgid_r=undef
13548                 getgrgid_r_proto=0
13549                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13550         * )     case "$getgrgid_r_proto" in
13551                 REENTRANT_PROTO*) ;;
13552                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13553                 esac
13554                 echo "Prototype: $try" ;;
13555         esac
13556         ;;
13557         *)      case "$usethreads" in
13558                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13559                 esac
13560                 d_getgrgid_r=undef
13561                 getgrgid_r_proto=0
13562                 ;;
13563         esac
13564         ;;
13565 *)      getgrgid_r_proto=0
13566         ;;
13567 esac
13568
13569 : see if getgrnam_r exists
13570 set getgrnam_r d_getgrnam_r
13571 eval $inlibc
13572 case "$d_getgrnam_r" in
13573 "$define")
13574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13575         case "$d_getgrnam_r_proto:$usethreads" in
13576         ":define")      d_getgrnam_r_proto=define
13577                 set d_getgrnam_r_proto getgrnam_r $hdrs
13578                 eval $hasproto ;;
13579         *)      ;;
13580         esac
13581         case "$d_getgrnam_r_proto" in
13582         define)
13583         case "$getgrnam_r_proto" in
13584         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13585         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13586         esac
13587         case "$getgrnam_r_proto" in
13588         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13589         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13590         esac
13591         case "$getgrnam_r_proto" in
13592         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13593         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13594         esac
13595         case "$getgrnam_r_proto" in
13596         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13597         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13598         esac
13599         case "$getgrnam_r_proto" in
13600         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13601         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13602         esac
13603         case "$getgrnam_r_proto" in
13604         ''|0)   d_getgrnam_r=undef
13605                 getgrnam_r_proto=0
13606                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13607         * )     case "$getgrnam_r_proto" in
13608                 REENTRANT_PROTO*) ;;
13609                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13610                 esac
13611                 echo "Prototype: $try" ;;
13612         esac
13613         ;;
13614         *)      case "$usethreads" in
13615                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13616                 esac
13617                 d_getgrnam_r=undef
13618                 getgrnam_r_proto=0
13619                 ;;
13620         esac
13621         ;;
13622 *)      getgrnam_r_proto=0
13623         ;;
13624 esac
13625
13626 : see if gethostbyaddr exists
13627 set gethostbyaddr d_gethbyaddr
13628 eval $inlibc
13629
13630 : see if gethostbyname exists
13631 set gethostbyname d_gethbyname
13632 eval $inlibc
13633
13634 : see if gethostent exists
13635 set gethostent d_gethent
13636 eval $inlibc
13637
13638 : see how we will look up host name
13639 echo " "
13640 call=''
13641 if set gethostname val -f d_gethname; eval $csym; $val; then
13642         echo 'gethostname() found.' >&4
13643         d_gethname="$define"
13644         call=gethostname
13645 fi
13646 if set uname val -f d_uname; eval $csym; $val; then
13647         if ./xenix; then
13648                 $cat <<'EOM'
13649 uname() was found, but you're running xenix, and older versions of xenix
13650 have a broken uname(). If you don't really know whether your xenix is old
13651 enough to have a broken system call, use the default answer.
13652
13653 EOM
13654                 dflt=y
13655                 case "$d_uname" in
13656                 "$define") dflt=n;;
13657                 esac
13658                 rp='Is your uname() broken?'
13659                 . ./myread
13660                 case "$ans" in
13661                 n*) d_uname="$define"; call=uname;;
13662                 esac
13663         else
13664                 echo 'uname() found.' >&4
13665                 d_uname="$define"
13666                 case "$call" in
13667                 '') call=uname ;;
13668                 esac
13669         fi
13670 fi
13671 case "$d_gethname" in
13672 '') d_gethname="$undef";;
13673 esac
13674 case "$d_uname" in
13675 '') d_uname="$undef";;
13676 esac
13677 case "$d_uname$d_gethname" in
13678 *define*)
13679         dflt=n
13680         cat <<EOM
13681
13682 Every now and then someone has a $call() that lies about the hostname
13683 but can't be fixed for political or economic reasons.  If you wish, I can
13684 pretend $call() isn't there and maybe compute hostname at run-time
13685 thanks to the '$phostname' command.
13686
13687 EOM
13688         rp="Shall I ignore $call() from now on?"
13689         . ./myread
13690         case "$ans" in
13691         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13692         esac;;
13693 esac
13694 case "$phostname" in
13695 '') aphostname='';;
13696 *) case "$aphostname" in
13697         /*) ;;
13698         *) set X $phostname
13699                 shift
13700                 file=$1
13701                 shift
13702                 file=`./loc $file $file $pth`
13703                 aphostname=`echo $file $*`
13704                 ;;
13705         esac
13706         ;;
13707 esac
13708 case "$d_uname$d_gethname" in
13709 *define*) ;;
13710 *)
13711         case "$phostname" in
13712         '')
13713                 echo "There will be no way for $package to get your hostname." >&4;;
13714         *)
13715         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13716                 ;;
13717         esac;;
13718 esac
13719 case "$d_phostname" in
13720 '') d_phostname="$undef";;
13721 esac
13722
13723 : see if gethostbyaddr_r exists
13724 set gethostbyaddr_r d_gethostbyaddr_r
13725 eval $inlibc
13726 case "$d_gethostbyaddr_r" in
13727 "$define")
13728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13729         case "$d_gethostbyaddr_r_proto:$usethreads" in
13730         ":define")      d_gethostbyaddr_r_proto=define
13731                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13732                 eval $hasproto ;;
13733         *)      ;;
13734         esac
13735         case "$d_gethostbyaddr_r_proto" in
13736         define)
13737         case "$gethostbyaddr_r_proto" in
13738         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13740         esac
13741         case "$gethostbyaddr_r_proto" in
13742         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13743         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13744         esac
13745         case "$gethostbyaddr_r_proto" in
13746         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13747         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13748         esac
13749         case "$gethostbyaddr_r_proto" in
13750         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13751         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13752         esac
13753         case "$gethostbyaddr_r_proto" in
13754         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13755         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13756         esac
13757         case "$gethostbyaddr_r_proto" in
13758         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13759         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13760         esac
13761         case "$gethostbyaddr_r_proto" in
13762         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13764         esac
13765         case "$gethostbyaddr_r_proto" in
13766         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13767         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13768         esac
13769         case "$gethostbyaddr_r_proto" in
13770         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13771         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13772         esac
13773         case "$gethostbyaddr_r_proto" in
13774         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13775         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13776         esac
13777         case "$gethostbyaddr_r_proto" in
13778         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13779         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13780         esac
13781         case "$gethostbyaddr_r_proto" in
13782         ''|0)   d_gethostbyaddr_r=undef
13783                 gethostbyaddr_r_proto=0
13784                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13785         * )     case "$gethostbyaddr_r_proto" in
13786                 REENTRANT_PROTO*) ;;
13787                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13788                 esac
13789                 echo "Prototype: $try" ;;
13790         esac
13791         ;;
13792         *)      case "$usethreads" in
13793                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13794                 esac
13795                 d_gethostbyaddr_r=undef
13796                 gethostbyaddr_r_proto=0
13797                 ;;
13798         esac
13799         ;;
13800 *)      gethostbyaddr_r_proto=0
13801         ;;
13802 esac
13803
13804 : see if gethostbyname_r exists
13805 set gethostbyname_r d_gethostbyname_r
13806 eval $inlibc
13807 case "$d_gethostbyname_r" in
13808 "$define")
13809         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13810         case "$d_gethostbyname_r_proto:$usethreads" in
13811         ":define")      d_gethostbyname_r_proto=define
13812                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13813                 eval $hasproto ;;
13814         *)      ;;
13815         esac
13816         case "$d_gethostbyname_r_proto" in
13817         define)
13818         case "$gethostbyname_r_proto" in
13819         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13820         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13821         esac
13822         case "$gethostbyname_r_proto" in
13823         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13824         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13825         esac
13826         case "$gethostbyname_r_proto" in
13827         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13828         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13829         esac
13830         case "$gethostbyname_r_proto" in
13831         ''|0)   d_gethostbyname_r=undef
13832                 gethostbyname_r_proto=0
13833                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13834         * )     case "$gethostbyname_r_proto" in
13835                 REENTRANT_PROTO*) ;;
13836                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13837                 esac
13838                 echo "Prototype: $try" ;;
13839         esac
13840         ;;
13841         *)      case "$usethreads" in
13842                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13843                 esac
13844                 d_gethostbyname_r=undef
13845                 gethostbyname_r_proto=0
13846                 ;;
13847         esac
13848         ;;
13849 *)      gethostbyname_r_proto=0
13850         ;;
13851 esac
13852
13853 : see if gethostent_r exists
13854 set gethostent_r d_gethostent_r
13855 eval $inlibc
13856 case "$d_gethostent_r" in
13857 "$define")
13858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13859         case "$d_gethostent_r_proto:$usethreads" in
13860         ":define")      d_gethostent_r_proto=define
13861                 set d_gethostent_r_proto gethostent_r $hdrs
13862                 eval $hasproto ;;
13863         *)      ;;
13864         esac
13865         case "$d_gethostent_r_proto" in
13866         define)
13867         case "$gethostent_r_proto" in
13868         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13869         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13870         esac
13871         case "$gethostent_r_proto" in
13872         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13873         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13874         esac
13875         case "$gethostent_r_proto" in
13876         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13877         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13878         esac
13879         case "$gethostent_r_proto" in
13880         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13881         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13882         esac
13883         case "$gethostent_r_proto" in
13884         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13885         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13886         esac
13887         case "$gethostent_r_proto" in
13888         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13889         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13890         esac
13891         case "$gethostent_r_proto" in
13892         ''|0)   d_gethostent_r=undef
13893                 gethostent_r_proto=0
13894                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13895         * )     case "$gethostent_r_proto" in
13896                 REENTRANT_PROTO*) ;;
13897                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13898                 esac
13899                 echo "Prototype: $try" ;;
13900         esac
13901         ;;
13902         *)      case "$usethreads" in
13903                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13904                 esac
13905                 d_gethostent_r=undef
13906                 gethostent_r_proto=0
13907                 ;;
13908         esac
13909         ;;
13910 *)      gethostent_r_proto=0
13911         ;;
13912 esac
13913
13914 : see if prototypes for various gethostxxx netdb.h functions are available
13915 echo " "
13916 set d_gethostprotos gethostent $i_netdb netdb.h
13917 eval $hasproto
13918
13919 : see if getitimer exists
13920 set getitimer d_getitimer
13921 eval $inlibc
13922
13923 : see if getlogin exists
13924 set getlogin d_getlogin
13925 eval $inlibc
13926
13927 : see if getlogin_r exists
13928 set getlogin_r d_getlogin_r
13929 eval $inlibc
13930 case "$d_getlogin_r" in
13931 "$define")
13932         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13933         case "$d_getlogin_r_proto:$usethreads" in
13934         ":define")      d_getlogin_r_proto=define
13935                 set d_getlogin_r_proto getlogin_r $hdrs
13936                 eval $hasproto ;;
13937         *)      ;;
13938         esac
13939         case "$d_getlogin_r_proto" in
13940         define)
13941         case "$getlogin_r_proto" in
13942         ''|0) try='int getlogin_r(char*, size_t);'
13943         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13944         esac
13945         case "$getlogin_r_proto" in
13946         ''|0) try='int getlogin_r(char*, int);'
13947         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13948         esac
13949         case "$getlogin_r_proto" in
13950         ''|0) try='char* getlogin_r(char*, size_t);'
13951         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13952         esac
13953         case "$getlogin_r_proto" in
13954         ''|0) try='char* getlogin_r(char*, int);'
13955         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13956         esac
13957         case "$getlogin_r_proto" in
13958         ''|0)   d_getlogin_r=undef
13959                 getlogin_r_proto=0
13960                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getlogin_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getlogin_r=undef
13972                 getlogin_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getlogin_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if getmnt exists
13981 set getmnt d_getmnt
13982 eval $inlibc
13983
13984 : see if getmntent exists
13985 set getmntent d_getmntent
13986 eval $inlibc
13987
13988 : see if getnameinfo exists
13989 set getnameinfo d_getnameinfo
13990 eval $inlibc
13991
13992 : see if getnetbyaddr exists
13993 set getnetbyaddr d_getnbyaddr
13994 eval $inlibc
13995
13996 : see if getnetbyname exists
13997 set getnetbyname d_getnbyname
13998 eval $inlibc
13999
14000 : see if getnetent exists
14001 set getnetent d_getnent
14002 eval $inlibc
14003
14004 : see if getnetbyaddr_r exists
14005 set getnetbyaddr_r d_getnetbyaddr_r
14006 eval $inlibc
14007 case "$d_getnetbyaddr_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14010         case "$d_getnetbyaddr_r_proto:$usethreads" in
14011         ":define")      d_getnetbyaddr_r_proto=define
14012                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_getnetbyaddr_r_proto" in
14017         define)
14018         case "$getnetbyaddr_r_proto" in
14019         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14020         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14021         esac
14022         case "$getnetbyaddr_r_proto" in
14023         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14024         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14025         esac
14026         case "$getnetbyaddr_r_proto" in
14027         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14028         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14029         esac
14030         case "$getnetbyaddr_r_proto" in
14031         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14032         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14033         esac
14034         case "$getnetbyaddr_r_proto" in
14035         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14036         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14037         esac
14038         case "$getnetbyaddr_r_proto" in
14039         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14040         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14041         esac
14042         case "$getnetbyaddr_r_proto" in
14043         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14044         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14045         esac
14046         case "$getnetbyaddr_r_proto" in
14047         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14048         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14049         esac
14050         case "$getnetbyaddr_r_proto" in
14051         ''|0)   d_getnetbyaddr_r=undef
14052                 getnetbyaddr_r_proto=0
14053                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14054         * )     case "$getnetbyaddr_r_proto" in
14055                 REENTRANT_PROTO*) ;;
14056                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14057                 esac
14058                 echo "Prototype: $try" ;;
14059         esac
14060         ;;
14061         *)      case "$usethreads" in
14062                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14063                 esac
14064                 d_getnetbyaddr_r=undef
14065                 getnetbyaddr_r_proto=0
14066                 ;;
14067         esac
14068         ;;
14069 *)      getnetbyaddr_r_proto=0
14070         ;;
14071 esac
14072
14073 : see if getnetbyname_r exists
14074 set getnetbyname_r d_getnetbyname_r
14075 eval $inlibc
14076 case "$d_getnetbyname_r" in
14077 "$define")
14078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14079         case "$d_getnetbyname_r_proto:$usethreads" in
14080         ":define")      d_getnetbyname_r_proto=define
14081                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14082                 eval $hasproto ;;
14083         *)      ;;
14084         esac
14085         case "$d_getnetbyname_r_proto" in
14086         define)
14087         case "$getnetbyname_r_proto" in
14088         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14089         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14090         esac
14091         case "$getnetbyname_r_proto" in
14092         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14093         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14094         esac
14095         case "$getnetbyname_r_proto" in
14096         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14097         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14098         esac
14099         case "$getnetbyname_r_proto" in
14100         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14101         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14102         esac
14103         case "$getnetbyname_r_proto" in
14104         ''|0)   d_getnetbyname_r=undef
14105                 getnetbyname_r_proto=0
14106                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14107         * )     case "$getnetbyname_r_proto" in
14108                 REENTRANT_PROTO*) ;;
14109                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14110                 esac
14111                 echo "Prototype: $try" ;;
14112         esac
14113         ;;
14114         *)      case "$usethreads" in
14115                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14116                 esac
14117                 d_getnetbyname_r=undef
14118                 getnetbyname_r_proto=0
14119                 ;;
14120         esac
14121         ;;
14122 *)      getnetbyname_r_proto=0
14123         ;;
14124 esac
14125
14126 : see if getnetent_r exists
14127 set getnetent_r d_getnetent_r
14128 eval $inlibc
14129 case "$d_getnetent_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14132         case "$d_getnetent_r_proto:$usethreads" in
14133         ":define")      d_getnetent_r_proto=define
14134                 set d_getnetent_r_proto getnetent_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getnetent_r_proto" in
14139         define)
14140         case "$getnetent_r_proto" in
14141         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14142         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14143         esac
14144         case "$getnetent_r_proto" in
14145         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14146         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14147         esac
14148         case "$getnetent_r_proto" in
14149         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14150         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14151         esac
14152         case "$getnetent_r_proto" in
14153         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14154         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14155         esac
14156         case "$getnetent_r_proto" in
14157         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14158         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14159         esac
14160         case "$getnetent_r_proto" in
14161         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14162         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14163         esac
14164         case "$getnetent_r_proto" in
14165         ''|0)   d_getnetent_r=undef
14166                 getnetent_r_proto=0
14167                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14168         * )     case "$getnetent_r_proto" in
14169                 REENTRANT_PROTO*) ;;
14170                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14171                 esac
14172                 echo "Prototype: $try" ;;
14173         esac
14174         ;;
14175         *)      case "$usethreads" in
14176                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14177                 esac
14178                 d_getnetent_r=undef
14179                 getnetent_r_proto=0
14180                 ;;
14181         esac
14182         ;;
14183 *)      getnetent_r_proto=0
14184         ;;
14185 esac
14186
14187 : see if prototypes for various getnetxxx netdb.h functions are available
14188 echo " "
14189 set d_getnetprotos getnetent $i_netdb netdb.h
14190 eval $hasproto
14191
14192 : see if getpagesize exists
14193 set getpagesize d_getpagsz
14194 eval $inlibc
14195
14196 : Optional checks for getprotobyname and getprotobynumber
14197
14198 : see if getprotobyname exists
14199 set getprotobyname d_getpbyname
14200 eval $inlibc
14201
14202 : see if getprotobynumber exists
14203 set getprotobynumber d_getpbynumber
14204 eval $inlibc
14205
14206 : see if getprotoent exists
14207 set getprotoent d_getpent
14208 eval $inlibc
14209
14210 : see if getpgid exists
14211 set getpgid d_getpgid
14212 eval $inlibc
14213
14214 : see if getpgrp2 exists
14215 set getpgrp2 d_getpgrp2
14216 eval $inlibc
14217
14218 : see if getppid exists
14219 set getppid d_getppid
14220 eval $inlibc
14221
14222 : see if getpriority exists
14223 set getpriority d_getprior
14224 eval $inlibc
14225
14226 : see if getprotobyname_r exists
14227 set getprotobyname_r d_getprotobyname_r
14228 eval $inlibc
14229 case "$d_getprotobyname_r" in
14230 "$define")
14231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14232         case "$d_getprotobyname_r_proto:$usethreads" in
14233         ":define")      d_getprotobyname_r_proto=define
14234                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14235                 eval $hasproto ;;
14236         *)      ;;
14237         esac
14238         case "$d_getprotobyname_r_proto" in
14239         define)
14240         case "$getprotobyname_r_proto" in
14241         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14242         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14243         esac
14244         case "$getprotobyname_r_proto" in
14245         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14246         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14247         esac
14248         case "$getprotobyname_r_proto" in
14249         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14250         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14251         esac
14252         case "$getprotobyname_r_proto" in
14253         ''|0)   d_getprotobyname_r=undef
14254                 getprotobyname_r_proto=0
14255                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14256         * )     case "$getprotobyname_r_proto" in
14257                 REENTRANT_PROTO*) ;;
14258                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14259                 esac
14260                 echo "Prototype: $try" ;;
14261         esac
14262         ;;
14263         *)      case "$usethreads" in
14264                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14265                 esac
14266                 d_getprotobyname_r=undef
14267                 getprotobyname_r_proto=0
14268                 ;;
14269         esac
14270         ;;
14271 *)      getprotobyname_r_proto=0
14272         ;;
14273 esac
14274
14275 : see if getprotobynumber_r exists
14276 set getprotobynumber_r d_getprotobynumber_r
14277 eval $inlibc
14278 case "$d_getprotobynumber_r" in
14279 "$define")
14280         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14281         case "$d_getprotobynumber_r_proto:$usethreads" in
14282         ":define")      d_getprotobynumber_r_proto=define
14283                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14284                 eval $hasproto ;;
14285         *)      ;;
14286         esac
14287         case "$d_getprotobynumber_r_proto" in
14288         define)
14289         case "$getprotobynumber_r_proto" in
14290         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14291         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14292         esac
14293         case "$getprotobynumber_r_proto" in
14294         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14295         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14296         esac
14297         case "$getprotobynumber_r_proto" in
14298         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14299         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14300         esac
14301         case "$getprotobynumber_r_proto" in
14302         ''|0)   d_getprotobynumber_r=undef
14303                 getprotobynumber_r_proto=0
14304                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14305         * )     case "$getprotobynumber_r_proto" in
14306                 REENTRANT_PROTO*) ;;
14307                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14308                 esac
14309                 echo "Prototype: $try" ;;
14310         esac
14311         ;;
14312         *)      case "$usethreads" in
14313                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14314                 esac
14315                 d_getprotobynumber_r=undef
14316                 getprotobynumber_r_proto=0
14317                 ;;
14318         esac
14319         ;;
14320 *)      getprotobynumber_r_proto=0
14321         ;;
14322 esac
14323
14324 : see if getprotoent_r exists
14325 set getprotoent_r d_getprotoent_r
14326 eval $inlibc
14327 case "$d_getprotoent_r" in
14328 "$define")
14329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14330         case "$d_getprotoent_r_proto:$usethreads" in
14331         ":define")      d_getprotoent_r_proto=define
14332                 set d_getprotoent_r_proto getprotoent_r $hdrs
14333                 eval $hasproto ;;
14334         *)      ;;
14335         esac
14336         case "$d_getprotoent_r_proto" in
14337         define)
14338         case "$getprotoent_r_proto" in
14339         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14340         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14341         esac
14342         case "$getprotoent_r_proto" in
14343         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14344         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14345         esac
14346         case "$getprotoent_r_proto" in
14347         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14348         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14349         esac
14350         case "$getprotoent_r_proto" in
14351         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14352         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14353         esac
14354         case "$getprotoent_r_proto" in
14355         ''|0)   d_getprotoent_r=undef
14356                 getprotoent_r_proto=0
14357                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14358         * )     case "$getprotoent_r_proto" in
14359                 REENTRANT_PROTO*) ;;
14360                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14361                 esac
14362                 echo "Prototype: $try" ;;
14363         esac
14364         ;;
14365         *)      case "$usethreads" in
14366                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14367                 esac
14368                 d_getprotoent_r=undef
14369                 getprotoent_r_proto=0
14370                 ;;
14371         esac
14372         ;;
14373 *)      getprotoent_r_proto=0
14374         ;;
14375 esac
14376
14377 : see if prototypes for various getprotoxxx netdb.h functions are available
14378 echo " "
14379 set d_getprotoprotos getprotoent $i_netdb netdb.h
14380 eval $hasproto
14381
14382 : see if getprpwnam exists
14383 set getprpwnam d_getprpwnam
14384 eval $inlibc
14385
14386 : see if getpwent exists
14387 set getpwent d_getpwent
14388 eval $inlibc
14389
14390 : see if getpwent_r exists
14391 set getpwent_r d_getpwent_r
14392 eval $inlibc
14393 case "$d_getpwent_r" in
14394 "$define")
14395         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14396         case "$d_getpwent_r_proto:$usethreads" in
14397         ":define")      d_getpwent_r_proto=define
14398                 set d_getpwent_r_proto getpwent_r $hdrs
14399                 eval $hasproto ;;
14400         *)      ;;
14401         esac
14402         case "$d_getpwent_r_proto" in
14403         define)
14404         case "$getpwent_r_proto" in
14405         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14406         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14407         esac
14408         case "$getpwent_r_proto" in
14409         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14410         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14411         esac
14412         case "$getpwent_r_proto" in
14413         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14414         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14415         esac
14416         case "$getpwent_r_proto" in
14417         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14419         esac
14420         case "$getpwent_r_proto" in
14421         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14422         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14423         esac
14424         case "$getpwent_r_proto" in
14425         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14426         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14427         esac
14428         case "$getpwent_r_proto" in
14429         ''|0)   d_getpwent_r=undef
14430                 getpwent_r_proto=0
14431                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14432         * )     case "$getpwent_r_proto" in
14433                 REENTRANT_PROTO*) ;;
14434                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14435                 esac
14436                 echo "Prototype: $try" ;;
14437         esac
14438         ;;
14439         *)      case "$usethreads" in
14440                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14441                 esac
14442                 d_getpwent_r=undef
14443                 getpwent_r_proto=0
14444                 ;;
14445         esac
14446         ;;
14447 *)      getpwent_r_proto=0
14448         ;;
14449 esac
14450
14451 : see if getpwnam_r exists
14452 set getpwnam_r d_getpwnam_r
14453 eval $inlibc
14454 case "$d_getpwnam_r" in
14455 "$define")
14456         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14457         case "$d_getpwnam_r_proto:$usethreads" in
14458         ":define")      d_getpwnam_r_proto=define
14459                 set d_getpwnam_r_proto getpwnam_r $hdrs
14460                 eval $hasproto ;;
14461         *)      ;;
14462         esac
14463         case "$d_getpwnam_r_proto" in
14464         define)
14465         case "$getpwnam_r_proto" in
14466         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14467         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14468         esac
14469         case "$getpwnam_r_proto" in
14470         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14471         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14472         esac
14473         case "$getpwnam_r_proto" in
14474         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14475         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14476         esac
14477         case "$getpwnam_r_proto" in
14478         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14479         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14480         esac
14481         case "$getpwnam_r_proto" in
14482         ''|0)   d_getpwnam_r=undef
14483                 getpwnam_r_proto=0
14484                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14485         * )     case "$getpwnam_r_proto" in
14486                 REENTRANT_PROTO*) ;;
14487                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14488                 esac
14489                 echo "Prototype: $try" ;;
14490         esac
14491         ;;
14492         *)      case "$usethreads" in
14493                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14494                 esac
14495                 d_getpwnam_r=undef
14496                 getpwnam_r_proto=0
14497                 ;;
14498         esac
14499         ;;
14500 *)      getpwnam_r_proto=0
14501         ;;
14502 esac
14503
14504 : see if getpwuid_r exists
14505 set getpwuid_r d_getpwuid_r
14506 eval $inlibc
14507 case "$d_getpwuid_r" in
14508 "$define")
14509         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14510         case "$d_getpwuid_r_proto:$usethreads" in
14511         ":define")      d_getpwuid_r_proto=define
14512                 set d_getpwuid_r_proto getpwuid_r $hdrs
14513                 eval $hasproto ;;
14514         *)      ;;
14515         esac
14516         case "$d_getpwuid_r_proto" in
14517         define)
14518         case "$getpwuid_r_proto" in
14519         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14520         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14521         esac
14522         case "$getpwuid_r_proto" in
14523         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14524         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14525         esac
14526         case "$getpwuid_r_proto" in
14527         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14529         esac
14530         case "$getpwuid_r_proto" in
14531         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14532         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14533         esac
14534         case "$getpwuid_r_proto" in
14535         ''|0)   d_getpwuid_r=undef
14536                 getpwuid_r_proto=0
14537                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14538         * )     case "$getpwuid_r_proto" in
14539                 REENTRANT_PROTO*) ;;
14540                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14541                 esac
14542                 echo "Prototype: $try" ;;
14543         esac
14544         ;;
14545         *)      case "$usethreads" in
14546                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14547                 esac
14548                 d_getpwuid_r=undef
14549                 getpwuid_r_proto=0
14550                 ;;
14551         esac
14552         ;;
14553 *)      getpwuid_r_proto=0
14554         ;;
14555 esac
14556
14557 : Optional checks for getsbyname and getsbyport
14558
14559 : see if getservbyname exists
14560 set getservbyname d_getsbyname
14561 eval $inlibc
14562
14563 : see if getservbyport exists
14564 set getservbyport d_getsbyport
14565 eval $inlibc
14566
14567 : see if getservent exists
14568 set getservent d_getsent
14569 eval $inlibc
14570
14571 : see if getservbyname_r exists
14572 set getservbyname_r d_getservbyname_r
14573 eval $inlibc
14574 case "$d_getservbyname_r" in
14575 "$define")
14576         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14577         case "$d_getservbyname_r_proto:$usethreads" in
14578         ":define")      d_getservbyname_r_proto=define
14579                 set d_getservbyname_r_proto getservbyname_r $hdrs
14580                 eval $hasproto ;;
14581         *)      ;;
14582         esac
14583         case "$d_getservbyname_r_proto" in
14584         define)
14585         case "$getservbyname_r_proto" in
14586         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14587         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14588         esac
14589         case "$getservbyname_r_proto" in
14590         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14591         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14592         esac
14593         case "$getservbyname_r_proto" in
14594         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14595         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14596         esac
14597         case "$getservbyname_r_proto" in
14598         ''|0)   d_getservbyname_r=undef
14599                 getservbyname_r_proto=0
14600                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14601         * )     case "$getservbyname_r_proto" in
14602                 REENTRANT_PROTO*) ;;
14603                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14604                 esac
14605                 echo "Prototype: $try" ;;
14606         esac
14607         ;;
14608         *)      case "$usethreads" in
14609                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14610                 esac
14611                 d_getservbyname_r=undef
14612                 getservbyname_r_proto=0
14613                 ;;
14614         esac
14615         ;;
14616 *)      getservbyname_r_proto=0
14617         ;;
14618 esac
14619
14620 : see if getservbyport_r exists
14621 set getservbyport_r d_getservbyport_r
14622 eval $inlibc
14623 case "$d_getservbyport_r" in
14624 "$define")
14625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14626         case "$d_getservbyport_r_proto:$usethreads" in
14627         ":define")      d_getservbyport_r_proto=define
14628                 set d_getservbyport_r_proto getservbyport_r $hdrs
14629                 eval $hasproto ;;
14630         *)      ;;
14631         esac
14632         case "$d_getservbyport_r_proto" in
14633         define)
14634         case "$getservbyport_r_proto" in
14635         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14636         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14637         esac
14638         case "$getservbyport_r_proto" in
14639         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14640         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14641         esac
14642         case "$getservbyport_r_proto" in
14643         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14644         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14645         esac
14646         case "$getservbyport_r_proto" in
14647         ''|0)   d_getservbyport_r=undef
14648                 getservbyport_r_proto=0
14649                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14650         * )     case "$getservbyport_r_proto" in
14651                 REENTRANT_PROTO*) ;;
14652                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14653                 esac
14654                 echo "Prototype: $try" ;;
14655         esac
14656         ;;
14657         *)      case "$usethreads" in
14658                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14659                 esac
14660                 d_getservbyport_r=undef
14661                 getservbyport_r_proto=0
14662                 ;;
14663         esac
14664         ;;
14665 *)      getservbyport_r_proto=0
14666         ;;
14667 esac
14668
14669 : see if getservent_r exists
14670 set getservent_r d_getservent_r
14671 eval $inlibc
14672 case "$d_getservent_r" in
14673 "$define")
14674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14675         case "$d_getservent_r_proto:$usethreads" in
14676         ":define")      d_getservent_r_proto=define
14677                 set d_getservent_r_proto getservent_r $hdrs
14678                 eval $hasproto ;;
14679         *)      ;;
14680         esac
14681         case "$d_getservent_r_proto" in
14682         define)
14683         case "$getservent_r_proto" in
14684         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14685         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14686         esac
14687         case "$getservent_r_proto" in
14688         ''|0) try='int getservent_r(struct servent*, char*, int);'
14689         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14690         esac
14691         case "$getservent_r_proto" in
14692         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14693         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14694         esac
14695         case "$getservent_r_proto" in
14696         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14697         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14698         esac
14699         case "$getservent_r_proto" in
14700         ''|0)   d_getservent_r=undef
14701                 getservent_r_proto=0
14702                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14703         * )     case "$getservent_r_proto" in
14704                 REENTRANT_PROTO*) ;;
14705                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14706                 esac
14707                 echo "Prototype: $try" ;;
14708         esac
14709         ;;
14710         *)      case "$usethreads" in
14711                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14712                 esac
14713                 d_getservent_r=undef
14714                 getservent_r_proto=0
14715                 ;;
14716         esac
14717         ;;
14718 *)      getservent_r_proto=0
14719         ;;
14720 esac
14721
14722 : see if prototypes for various getservxxx netdb.h functions are available
14723 echo " "
14724 set d_getservprotos getservent $i_netdb netdb.h
14725 eval $hasproto
14726
14727 : see if getspnam exists
14728 set getspnam d_getspnam
14729 eval $inlibc
14730
14731 : see if this is a shadow.h system
14732 set shadow.h i_shadow
14733 eval $inhdr
14734
14735 : see if getspnam_r exists
14736 set getspnam_r d_getspnam_r
14737 eval $inlibc
14738 case "$d_getspnam_r" in
14739 "$define")
14740         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14741         case "$d_getspnam_r_proto:$usethreads" in
14742         ":define")      d_getspnam_r_proto=define
14743                 set d_getspnam_r_proto getspnam_r $hdrs
14744                 eval $hasproto ;;
14745         *)      ;;
14746         esac
14747         case "$d_getspnam_r_proto" in
14748         define)
14749         case "$getspnam_r_proto" in
14750         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14751         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14752         esac
14753         case "$getspnam_r_proto" in
14754         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14755         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14756         esac
14757         case "$getspnam_r_proto" in
14758         ''|0)   d_getspnam_r=undef
14759                 getspnam_r_proto=0
14760                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14761         * )     case "$getspnam_r_proto" in
14762                 REENTRANT_PROTO*) ;;
14763                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14764                 esac
14765                 echo "Prototype: $try" ;;
14766         esac
14767         ;;
14768         *)      case "$usethreads" in
14769                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14770                 esac
14771                 d_getspnam_r=undef
14772                 getspnam_r_proto=0
14773                 ;;
14774         esac
14775         ;;
14776 *)      getspnam_r_proto=0
14777         ;;
14778 esac
14779
14780 : see if gettimeofday or ftime exists
14781 set gettimeofday d_gettimeod
14782 eval $inlibc
14783 case "$d_gettimeod" in
14784 "$undef")
14785         set ftime d_ftime 
14786         eval $inlibc
14787         ;;
14788 *)
14789         val="$undef"; set d_ftime; eval $setvar
14790         ;;
14791 esac
14792 case "$d_gettimeod$d_ftime" in
14793 "$undef$undef")
14794         echo " "
14795         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14796         ;;
14797 esac
14798
14799 : see if gmtime_r exists
14800 set gmtime_r d_gmtime_r
14801 eval $inlibc
14802 case "$d_gmtime_r" in
14803 "$define")
14804         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14805         case "$d_gmtime_r_proto:$usethreads" in
14806         ":define")      d_gmtime_r_proto=define
14807                 set d_gmtime_r_proto gmtime_r $hdrs
14808                 eval $hasproto ;;
14809         *)      ;;
14810         esac
14811         case "$d_gmtime_r_proto" in
14812         define)
14813         case "$gmtime_r_proto" in
14814         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14815         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14816         esac
14817         case "$gmtime_r_proto" in
14818         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14819         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14820         esac
14821         case "$gmtime_r_proto" in
14822         ''|0)   d_gmtime_r=undef
14823                 gmtime_r_proto=0
14824                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14825         * )     case "$gmtime_r_proto" in
14826                 REENTRANT_PROTO*) ;;
14827                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14828                 esac
14829                 echo "Prototype: $try" ;;
14830         esac
14831         ;;
14832         *)      case "$usethreads" in
14833                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14834                 esac
14835                 d_gmtime_r=undef
14836                 gmtime_r_proto=0
14837                 ;;
14838         esac
14839         ;;
14840 *)      gmtime_r_proto=0
14841         ;;
14842 esac
14843
14844 : see if hasmntopt exists
14845 set hasmntopt d_hasmntopt
14846 eval $inlibc
14847
14848 : see if this is a netinet/in.h or sys/in.h system
14849 set netinet/in.h i_niin sys/in.h i_sysin
14850 eval $inhdr
14851
14852 : see if arpa/inet.h has to be included
14853 set arpa/inet.h i_arpainet
14854 eval $inhdr
14855
14856 : see if htonl --and friends-- exists
14857 val=''
14858 set htonl val
14859 eval $inlibc
14860
14861 : Maybe they are macros.
14862 case "$val" in
14863 $undef)
14864         $cat >htonl.c <<EOM
14865 #include <stdio.h>
14866 #include <sys/types.h>
14867 #$i_niin I_NETINET_IN
14868 #$i_sysin I_SYS_IN
14869 #$i_arpainet I_ARPA_INET
14870 #ifdef I_NETINET_IN
14871 #include <netinet/in.h>
14872 #endif
14873 #ifdef I_SYS_IN
14874 #include <sys/in.h>
14875 #endif
14876 #ifdef I_ARPA_INET
14877 #include <arpa/inet.h>
14878 #endif
14879 #ifdef htonl
14880 printf("Defined as a macro.");
14881 #endif
14882 EOM
14883         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14884         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14885                 val="$define"
14886                 echo "But it seems to be defined as a macro." >&4
14887         fi
14888         $rm -f htonl.?
14889         ;;
14890 esac
14891 set d_htonl
14892 eval $setvar
14893
14894 : see if ilogbl exists
14895 set ilogbl d_ilogbl
14896 eval $inlibc
14897
14898 : index or strchr
14899 echo " "
14900 if set index val -f; eval $csym; $val; then
14901         if set strchr val -f d_strchr; eval $csym; $val; then
14902                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14903                         val="$define"
14904                         vali="$undef"
14905                         echo "strchr() found." >&4
14906                 else
14907                         val="$undef"
14908                         vali="$define"
14909                         echo "index() found." >&4
14910                 fi
14911         else
14912                 val="$undef"
14913                 vali="$define"
14914                 echo "index() found." >&4
14915         fi
14916 else
14917         if set strchr val -f d_strchr; eval $csym; $val; then
14918                 val="$define"
14919                 vali="$undef"
14920                 echo "strchr() found." >&4
14921         else
14922                 echo "No index() or strchr() found!" >&4
14923                 val="$undef"
14924                 vali="$undef"
14925         fi
14926 fi
14927 set d_strchr; eval $setvar
14928 val="$vali"
14929 set d_index; eval $setvar
14930
14931 : check whether inet_aton exists
14932 set inet_aton d_inetaton
14933 eval $inlibc
14934
14935 : see if inet_ntop exists
14936 set inet_ntop d_inetntop
14937 eval $inlibc
14938
14939 : see if inet_pton exists
14940 set inet_pton d_inetpton
14941 eval $inlibc
14942
14943 : Look for isascii
14944 echo " "
14945 $cat >isascii.c <<EOCP
14946 #include <stdio.h>
14947 #include <ctype.h>
14948 #$i_stdlib I_STDLIB
14949 #ifdef I_STDLIB
14950 #include <stdlib.h>
14951 #endif
14952 int main() {
14953         int c = 'A';
14954         if (isascii(c))
14955                 exit(0);
14956         else
14957                 exit(1);
14958 }
14959 EOCP
14960 set isascii
14961 if eval $compile; then
14962         echo "isascii() found." >&4
14963         val="$define"
14964 else
14965         echo "isascii() NOT found." >&4
14966         val="$undef"
14967 fi
14968 set d_isascii
14969 eval $setvar
14970 $rm -f isascii*
14971
14972 : see if isfinite exists
14973 set isfinite d_isfinite
14974 eval $inlibc
14975
14976 : see if isinf exists
14977 set isinf d_isinf
14978 eval $inlibc
14979
14980 : see if isnan exists
14981 set isnan d_isnan
14982 eval $inlibc
14983
14984 : see if isnanl exists
14985 set isnanl d_isnanl
14986 eval $inlibc
14987
14988 : see if killpg exists
14989 set killpg d_killpg
14990 eval $inlibc
14991
14992 : see if lchown exists
14993 echo " "
14994 $cat > try.c <<'EOCP'
14995 /* System header to define __stub macros and hopefully few prototypes,
14996     which can conflict with char lchown(); below.  */
14997 #include <assert.h>
14998 /* Override any gcc2 internal prototype to avoid an error.  */
14999 /* We use char because int might match the return type of a gcc2
15000    builtin and then its argument prototype would still apply.  */
15001 char lchown();
15002 int main() {
15003     /*  The GNU C library defines this for functions which it implements
15004         to always fail with ENOSYS.  Some functions are actually named
15005         something starting with __ and the normal name is an alias.  */
15006 #if defined (__stub_lchown) || defined (__stub___lchown)
15007 choke me
15008 #else
15009 lchown();
15010 #endif
15011 ; return 0; }
15012 EOCP
15013 set try
15014 if eval $compile; then
15015     $echo "lchown() found." >&4
15016     val="$define"
15017 else
15018     $echo "lchown() NOT found." >&4
15019     val="$undef"
15020 fi
15021 set d_lchown
15022 eval $setvar
15023
15024 : See if number of significant digits in a double precision number is known
15025 echo " "
15026 $cat >ldbl_dig.c <<EOM
15027 #$i_limits I_LIMITS
15028 #$i_float I_FLOAT
15029 #ifdef I_LIMITS
15030 #include <limits.h>
15031 #endif
15032 #ifdef I_FLOAT
15033 #include <float.h>
15034 #endif
15035 #ifdef LDBL_DIG
15036 printf("Contains LDBL_DIG");
15037 #endif
15038 EOM
15039 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15040 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15041         echo "LDBL_DIG found." >&4
15042         val="$define"
15043 else
15044         echo "LDBL_DIG NOT found." >&4
15045         val="$undef"
15046 fi
15047 $rm -f ldbl_dig.?
15048 set d_ldbl_dig
15049 eval $setvar
15050
15051 : see if this is a math.h system
15052 set math.h i_math
15053 eval $inhdr
15054
15055 : check to see if math.h defines _LIB_VERSION
15056 d_libm_lib_version="$undef"
15057 case $i_math in
15058     $define)
15059         echo " "
15060         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15061         $cat >try.c <<EOCP
15062 #include <unistd.h>
15063 #include <math.h>
15064 int main (int argc, char *argv[])
15065 {
15066     printf ("%d\n", _LIB_VERSION);
15067     return (0);
15068     } /* main */
15069 EOCP
15070         set try
15071         if eval $compile; then
15072             foo=`$run ./try`
15073             echo "Yes, it does ($foo)" >&4
15074             d_libm_lib_version="$define"
15075         else
15076             echo "No, it does not (probably harmless)" >&4
15077             fi
15078         $rm_try
15079         ;;
15080
15081     esac
15082
15083 : see if link exists
15084 set link d_link
15085 eval $inlibc
15086
15087 : see if localtime_r exists
15088 set localtime_r d_localtime_r
15089 eval $inlibc
15090 case "$d_localtime_r" in
15091 "$define")
15092         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15093         case "$d_localtime_r_proto:$usethreads" in
15094         ":define")      d_localtime_r_proto=define
15095                 set d_localtime_r_proto localtime_r $hdrs
15096                 eval $hasproto ;;
15097         *)      ;;
15098         esac
15099         case "$d_localtime_r_proto" in
15100         define)
15101         case "$localtime_r_proto" in
15102         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15103         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15104         esac
15105         case "$localtime_r_proto" in
15106         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15107         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15108         esac
15109         case "$localtime_r_proto" in
15110         ''|0)   d_localtime_r=undef
15111                 localtime_r_proto=0
15112                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15113         * )     case "$localtime_r_proto" in
15114                 REENTRANT_PROTO*) ;;
15115                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15116                 esac
15117                 echo "Prototype: $try" ;;
15118         esac
15119         ;;
15120         *)      case "$usethreads" in
15121                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15122                 esac
15123                 d_localtime_r=undef
15124                 localtime_r_proto=0
15125                 ;;
15126         esac
15127         ;;
15128 *)      localtime_r_proto=0
15129         ;;
15130 esac
15131
15132 : see if localtime_r calls tzset
15133 case "$localtime_r_proto" in
15134 REENTRANT_PROTO*)
15135         $cat >try.c <<EOCP
15136 /*  Does our libc's localtime_r call tzset ?
15137  *  return 0 if so, 1 otherwise.
15138  */
15139 #$i_systypes    I_SYS_TYPES
15140 #$i_unistd      I_UNISTD
15141 #$i_time        I_TIME
15142 #$i_stdlib      I_STDLIB
15143 #$i_string      I_STRING
15144 #$i_malloc      I_MALLOC
15145 #ifdef I_SYS_TYPES
15146 #  include <sys/types.h>
15147 #endif
15148 #ifdef I_UNISTD
15149 #  include <unistd.h>
15150 #endif
15151 #ifdef I_TIME
15152 #  include <time.h>
15153 #endif
15154 #ifdef I_STDLIB
15155 #include <stdlib.h>
15156 #endif
15157 #ifdef I_STRING
15158 #  include <string.h>
15159 #else
15160 #  include <strings.h>
15161 #endif
15162 #ifdef I_MALLOC
15163 #  include <malloc.h>
15164 #endif
15165 int main()
15166 {
15167     time_t t = time(0L);
15168     char w_tz[]="TZ" "=GMT+5",
15169          e_tz[]="TZ" "=GMT-5",
15170         *tz_e = (char*)malloc(16),
15171         *tz_w = (char*)malloc(16);
15172     struct tm tm_e, tm_w;
15173     memset(&tm_e,'\0',sizeof(struct tm));
15174     memset(&tm_w,'\0',sizeof(struct tm));
15175     strcpy(tz_e,e_tz);
15176     strcpy(tz_w,w_tz);
15177
15178     putenv(tz_e);
15179     localtime_r(&t, &tm_e);
15180
15181     putenv(tz_w);
15182     localtime_r(&t, &tm_w);
15183
15184     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15185         return 1;
15186     return 0;
15187 }
15188 EOCP
15189         set try
15190         if eval $compile; then
15191             if $run ./try; then
15192                 d_localtime_r_needs_tzset=undef;
15193             else
15194                 d_localtime_r_needs_tzset=define;
15195             fi;
15196         else
15197             d_localtime_r_needs_tzset=undef;
15198         fi;
15199      ;;
15200   *)
15201      d_localtime_r_needs_tzset=undef;
15202      ;;
15203 esac
15204 $rm_try
15205
15206 : see if localeconv exists
15207 set localeconv d_locconv
15208 eval $inlibc
15209
15210 : see if lockf exists
15211 set lockf d_lockf
15212 eval $inlibc
15213
15214 : see if prototype for lseek is available
15215 echo " "
15216 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15217 eval $hasproto
15218
15219 : see if lstat exists
15220 set lstat d_lstat
15221 eval $inlibc
15222
15223 : see if madvise exists
15224 set madvise d_madvise
15225 eval $inlibc
15226
15227 : see if malloc_size exists
15228 set malloc_size d_malloc_size
15229 eval $inlibc
15230
15231 : see if malloc_size_good exists
15232 set malloc_good_size d_malloc_good_size
15233 eval $inlibc
15234
15235 : see if mblen exists
15236 set mblen d_mblen
15237 eval $inlibc
15238
15239 : see if mbstowcs exists
15240 set mbstowcs d_mbstowcs
15241 eval $inlibc
15242
15243 : see if mbtowc exists
15244 set mbtowc d_mbtowc
15245 eval $inlibc
15246
15247 : see if memchr exists
15248 set memchr d_memchr
15249 eval $inlibc
15250
15251 : see if memcmp exists
15252 set memcmp d_memcmp
15253 eval $inlibc
15254
15255 : see if memcpy exists
15256 set memcpy d_memcpy
15257 eval $inlibc
15258
15259 : see if memmove exists
15260 set memmove d_memmove
15261 eval $inlibc
15262
15263 : see if memset exists
15264 set memset d_memset
15265 eval $inlibc
15266
15267 : see if mkdir exists
15268 set mkdir d_mkdir
15269 eval $inlibc
15270
15271 : see if mkdtemp exists
15272 set mkdtemp d_mkdtemp
15273 eval $inlibc
15274
15275 : see if mkfifo exists
15276 set mkfifo d_mkfifo
15277 eval $inlibc
15278
15279 : see if mkstemp exists
15280 set mkstemp d_mkstemp
15281 eval $inlibc
15282
15283 : see if mkstemps exists
15284 set mkstemps d_mkstemps
15285 eval $inlibc
15286
15287 : see if mktime exists
15288 set mktime d_mktime
15289 eval $inlibc
15290
15291 : see if this is a sys/mman.h system
15292 set sys/mman.h i_sysmman
15293 eval $inhdr
15294
15295 : see if mmap exists
15296 set mmap d_mmap
15297 eval $inlibc
15298 : see what shmat returns
15299 : default to something harmless
15300 mmaptype='void *'
15301 case "$i_sysmman$d_mmap" in
15302 "$define$define")
15303         $cat >mmap.c <<'END'
15304 #include <sys/mman.h>
15305 void *mmap();
15306 END
15307         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15308                 mmaptype='void *'
15309         else
15310                 mmaptype='caddr_t'
15311         fi
15312         echo "and it returns ($mmaptype)." >&4
15313         ;;
15314 esac
15315
15316
15317
15318 : see if sqrtl exists
15319 set sqrtl d_sqrtl
15320 eval $inlibc
15321
15322 : see if scalbnl exists
15323 set scalbnl d_scalbnl
15324 eval $inlibc
15325
15326 : see if modfl exists
15327 set modfl d_modfl
15328 eval $inlibc
15329
15330 : see if prototype for modfl is available
15331 echo " "
15332 set d_modflproto modfl $i_math math.h
15333 eval $hasproto
15334
15335 d_modfl_pow32_bug="$undef"
15336
15337 case "$d_longdbl$d_modfl" in
15338 $define$define)
15339         $cat <<EOM
15340 Checking to see whether your modfl() is okay for large values...
15341 EOM
15342 $cat >try.c <<EOCP
15343 #include <math.h>
15344 #include <stdio.h>
15345 EOCP
15346 if $test "X$d_modflproto" != "X$define"; then
15347         $cat >>try.c <<EOCP
15348 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15349 long double modfl (long double, long double *);
15350 EOCP
15351 fi
15352 $cat >>try.c <<EOCP
15353 int main() {
15354     long double nv = 4294967303.15;
15355     long double v, w;
15356     v = modfl(nv, &w);
15357 #ifdef __GLIBC__
15358     printf("glibc");
15359 #endif
15360     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15361     return 0;
15362 }
15363 EOCP
15364         case "$osname:$gccversion" in
15365         aix:)   saveccflags="$ccflags"
15366                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15367         esac
15368         set try
15369         if eval $compile; then
15370                 foo=`$run ./try`
15371                 case "$foo" in
15372                 *" 4294967303.150000 1.150000 4294967302.000000")
15373                         echo >&4 "Your modfl() is broken for large values."
15374                         d_modfl_pow32_bug="$define"
15375                         case "$foo" in
15376                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15377                         ;;
15378                         esac
15379                         ;;
15380                 *" 4294967303.150000 0.150000 4294967303.000000")
15381                         echo >&4 "Your modfl() seems okay for large values."
15382                         ;;
15383                 *)      echo >&4 "I don't understand your modfl() at all."
15384                         d_modfl="$undef"
15385                         ;;
15386                 esac
15387                 $rm_try
15388         else
15389                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15390                 d_modfl="$undef"
15391         fi
15392         case "$osname:$gccversion" in
15393         aix:)   ccflags="$saveccflags" ;; # restore
15394         esac
15395         ;;
15396 esac
15397
15398 if $test "$uselongdouble" = "$define"; then
15399     message=""
15400     if $test "$d_sqrtl" != "$define"; then
15401         message="$message sqrtl"
15402     fi
15403     if $test "$d_modfl" != "$define"; then
15404         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15405             echo "You have both aintl and copysignl, so I can emulate modfl."
15406         else
15407             message="$message modfl"
15408         fi
15409     fi
15410     if $test "$d_frexpl" != "$define"; then
15411         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15412             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15413         else
15414             message="$message frexpl"
15415         fi
15416     fi
15417
15418     if $test "$message" != ""; then
15419         $cat <<EOM >&4
15420
15421 *** You requested the use of long doubles but you do not seem to have
15422 *** the following mathematical functions needed for long double support:
15423 ***    $message
15424 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15425 *** Cannot continue, aborting.
15426
15427 EOM
15428
15429         exit 1
15430     fi
15431 fi
15432
15433 : see if mprotect exists
15434 set mprotect d_mprotect
15435 eval $inlibc
15436
15437 : see if msgctl exists
15438 set msgctl d_msgctl
15439 eval $inlibc
15440
15441 : see if msgget exists
15442 set msgget d_msgget
15443 eval $inlibc
15444
15445 : see if msgsnd exists
15446 set msgsnd d_msgsnd
15447 eval $inlibc
15448
15449 : see if msgrcv exists
15450 set msgrcv d_msgrcv
15451 eval $inlibc
15452
15453 : see how much of the 'msg*(2)' library is present.
15454 h_msg=true
15455 echo " "
15456 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15457 *"$undef"*) h_msg=false;;
15458 esac
15459 case "$osname" in
15460 freebsd)
15461     case "`ipcs 2>&1`" in
15462     "SVID messages"*"not configured"*)
15463         echo "Your $osname does not have the msg*(2) configured." >&4
15464         h_msg=false
15465         val="$undef"
15466         set msgctl d_msgctl
15467         eval $setvar
15468         set msgget d_msgget
15469         eval $setvar
15470         set msgsnd d_msgsnd
15471         eval $setvar
15472         set msgrcv d_msgrcv
15473         eval $setvar
15474         ;;
15475     esac
15476     ;;
15477 esac
15478 : we could also check for sys/ipc.h ...
15479 if $h_msg && $test `./findhdr sys/msg.h`; then
15480         echo "You have the full msg*(2) library." >&4
15481         val="$define"
15482 else
15483         echo "You don't have the full msg*(2) library." >&4
15484         val="$undef"
15485 fi
15486 set d_msg
15487 eval $setvar
15488
15489 : Check for msghdr_s
15490 echo " "
15491 echo "Checking to see if your system supports struct msghdr..." >&4
15492 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15493 eval $hasstruct
15494 case "$d_msghdr_s" in
15495 "$define")      echo "Yes, it does."   ;;
15496 *)              echo "No, it doesn't." ;;
15497 esac
15498
15499
15500 : see if msync exists
15501 set msync d_msync
15502 eval $inlibc
15503
15504 : see if munmap exists
15505 set munmap d_munmap
15506 eval $inlibc
15507
15508 : see if nice exists
15509 set nice d_nice
15510 eval $inlibc
15511
15512 : see if this is a langinfo.h system
15513 set langinfo.h i_langinfo
15514 eval $inhdr
15515
15516 : see if nl_langinfo exists
15517 set nl_langinfo d_nl_langinfo
15518 eval $inlibc
15519
15520 : check for volatile keyword
15521 echo " "
15522 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15523 $cat >try.c <<'EOCP'
15524 int main()
15525 {
15526         typedef struct _goo_struct goo_struct;
15527         goo_struct * volatile goo = ((goo_struct *)0);
15528         struct _goo_struct {
15529                 long long_int;
15530                 int reg_int;
15531                 char char_var;
15532         };
15533         typedef unsigned short foo_t;
15534         char *volatile foo;
15535         volatile int bar;
15536         volatile foo_t blech;
15537         foo = foo;
15538 }
15539 EOCP
15540 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15541         val="$define"
15542         echo "Yup, it does."
15543 else
15544         val="$undef"
15545         echo "Nope, it doesn't."
15546 fi
15547 set d_volatile
15548 eval $setvar
15549 $rm_try
15550
15551 : Check basic sizes
15552 echo " "
15553 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15554
15555 case "$use64bitint:$d_quad:$quadtype" in
15556 define:define:?*)
15557         ivtype="$quadtype"
15558         uvtype="$uquadtype"
15559         ivsize=8
15560         uvsize=8
15561         ;;
15562 *)      ivtype="long"
15563         uvtype="unsigned long"
15564         ivsize=$longsize
15565         uvsize=$longsize
15566         ;;
15567 esac
15568
15569 case "$uselongdouble:$d_longdbl" in
15570 define:define)
15571         nvtype="long double"
15572         nvsize=$longdblsize
15573         ;;
15574 *)      nvtype=double
15575         nvsize=$doublesize
15576         ;;
15577 esac
15578
15579 $echo "(IV will be "$ivtype", $ivsize bytes)"
15580 $echo "(UV will be "$uvtype", $uvsize bytes)"
15581 $echo "(NV will be "$nvtype", $nvsize bytes)"
15582
15583 $cat >try.c <<EOCP
15584 #$i_inttypes I_INTTYPES
15585 #ifdef I_INTTYPES
15586 #include <inttypes.h>
15587 #endif
15588 #include <stdio.h>
15589 int main() {
15590 #ifdef INT8
15591    int8_t i =  INT8_MAX;
15592   uint8_t u = UINT8_MAX;
15593   printf("int8_t\n");
15594 #endif
15595 #ifdef INT16
15596    int16_t i =  INT16_MAX;
15597   uint16_t i = UINT16_MAX;
15598   printf("int16_t\n");
15599 #endif
15600 #ifdef INT32
15601    int32_t i =  INT32_MAX;
15602   uint32_t u = UINT32_MAX;
15603   printf("int32_t\n");
15604 #endif
15605 }
15606 EOCP
15607
15608 i8type="signed char"
15609 u8type="unsigned char"
15610 i8size=1
15611 u8size=1
15612
15613 case "$i16type" in
15614 '')     case "$shortsize" in
15615         2)      i16type=short
15616                 u16type="unsigned short"
15617                 i16size=$shortsize
15618                 u16size=$shortsize
15619                 ;;
15620         esac
15621         ;;
15622 esac
15623 case "$i16type" in
15624 '')     set try -DINT16
15625         if eval $compile; then
15626                 case "`$run ./try`" in
15627                 int16_t)
15628                         i16type=int16_t
15629                         u16type=uint16_t
15630                         i16size=2
15631                         u16size=2
15632                         ;;
15633                 esac
15634         fi
15635         ;;
15636 esac
15637 case "$i16type" in
15638 '')     if $test $shortsize -ge 2; then
15639                 i16type=short
15640                 u16type="unsigned short"
15641                 i16size=$shortsize
15642                 u16size=$shortsize
15643         fi
15644         ;;
15645 esac
15646
15647 case "$i32type" in
15648 '')     case "$longsize" in
15649         4)      i32type=long
15650                 u32type="unsigned long"
15651                 i32size=$longsize
15652                 u32size=$longsize
15653                 ;;
15654         *)      case "$intsize" in
15655                 4)      i32type=int
15656                         u32type="unsigned int"
15657                         i32size=$intsize
15658                         u32size=$intsize
15659                         ;;
15660                 esac
15661                 ;;
15662         esac
15663         ;;
15664 esac
15665 case "$i32type" in
15666 '')     set try -DINT32
15667         if eval $compile; then
15668                 case "`$run ./try`" in
15669                 int32_t)
15670                         i32type=int32_t
15671                         u32type=uint32_t
15672                         i32size=4
15673                         u32size=4
15674                         ;;
15675                 esac
15676         fi
15677         ;;
15678 esac
15679 case "$i32type" in
15680 '')     if $test $intsize -ge 4; then
15681                 i32type=int
15682                 u32type="unsigned int"
15683                 i32size=$intsize
15684                 u32size=$intsize
15685         fi
15686         ;;
15687 esac
15688
15689 case "$i64type" in
15690 '')     case "$d_quad:$quadtype" in
15691         define:?*)
15692                 i64type="$quadtype"
15693                 u64type="$uquadtype"
15694                 i64size=8
15695                 u64size=8
15696                 ;;
15697         esac
15698         ;;
15699 esac
15700
15701 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15702 : volatile so that the compiler has to store it out to memory.
15703 if test X"$d_volatile" = X"$define"; then
15704         volatile=volatile
15705 fi
15706 $cat <<EOP >try.c
15707 #include <stdio.h>
15708 #$i_stdlib I_STDLIB
15709 #ifdef I_STDLIB
15710 #include <stdlib.h>
15711 #endif
15712 #include <sys/types.h>
15713 #include <signal.h>
15714 #ifdef SIGFPE
15715 $volatile int bletched = 0;
15716 $signal_t blech(int s) { bletched = 1; }
15717 #endif
15718 int main() {
15719     $uvtype u = 0;
15720     $nvtype d;
15721     int     n = 8 * $uvsize;
15722     int     i;
15723 #ifdef SIGFPE
15724     signal(SIGFPE, blech);
15725 #endif
15726
15727     for (i = 0; i < n; i++) {
15728       u = u << 1 | ($uvtype)1;
15729       d = ($nvtype)u;
15730       if (($uvtype)d != u)
15731         break;
15732       if (d <= 0)
15733         break;
15734       d = ($nvtype)(u - 1);
15735       if (($uvtype)d != (u - 1))
15736         break;
15737 #ifdef SIGFPE
15738       if (bletched)
15739         break;
15740 #endif
15741     }
15742     printf("%d\n", ((i == n) ? -n : i));
15743     exit(0);
15744 }
15745 EOP
15746 set try
15747
15748 d_nv_preserves_uv="$undef"
15749 if eval $compile; then
15750         nv_preserves_uv_bits="`$run ./try`"
15751 fi
15752 case "$nv_preserves_uv_bits" in
15753 \-[1-9]*)
15754         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15755         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15756         d_nv_preserves_uv="$define"
15757         ;;
15758 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15759         d_nv_preserves_uv="$undef" ;;
15760 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15761         nv_preserves_uv_bits="0" ;;
15762 esac
15763 $rm_try
15764
15765 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15766 : volatile so that the compiler has to store it out to memory.
15767 if test X"$d_volatile" = X"$define"; then
15768         volatile=volatile
15769 fi
15770 $cat <<EOP >try.c
15771 #include <stdio.h>
15772
15773 typedef $nvtype NV;
15774
15775 int
15776 main() {
15777   NV value = 2;
15778   int count = 1;
15779
15780   while(count < 256) {
15781     $volatile NV up = value + 1.0;
15782     $volatile NV negated = -value;
15783     $volatile NV down = negated - 1.0;
15784     $volatile NV got_up = up - value;
15785     int up_good = got_up == 1.0;
15786     int got_down = down - negated;
15787     int down_good = got_down == -1.0;
15788
15789     if (down_good != up_good) {
15790       fprintf(stderr,
15791               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15792               up_good, (double) got_up, down_good, (double) got_down,
15793               count, (double) value);
15794       return 1;
15795     }
15796     if (!up_good) {
15797       while (1) {
15798         if (count > 8) {
15799           count -= 8;
15800           fputs("256.0", stdout);
15801         } else {
15802           count--;
15803           fputs("2.0", stdout);
15804         }
15805         if (!count) {
15806           puts("");
15807           return 0;
15808         }
15809         fputs("*", stdout);
15810       }
15811     }
15812     value *= 2;
15813     ++count;
15814   }
15815   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15816           count, (double) value);
15817   return 1;
15818 }
15819 EOP
15820 set try
15821
15822 nv_overflows_integers_at='0'
15823 if eval $compile; then
15824     xxx="`$run ./try`"
15825     case "$?" in
15826         0)
15827             case "$xxx" in
15828                 2*)  cat >&4 <<EOM
15829 The largest integer your NVs can preserve is equal to $xxx
15830 EOM
15831                     nv_overflows_integers_at="$xxx"
15832                     ;;
15833                 *)  cat >&4 <<EOM
15834 Cannot determine the largest integer value your NVs can hold, unexpected output
15835 '$xxx'
15836 EOM
15837                     ;;
15838             esac
15839             ;;
15840         *)  cat >&4 <<EOM
15841 Cannot determine the largest integer value your NVs can hold
15842 EOM
15843             ;;
15844     esac
15845 fi
15846 $rm_try
15847
15848 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15849 : volatile so that the compiler has to store it out to memory.
15850 if test X"$d_volatile" = X"$define"; then
15851         volatile=volatile
15852 fi
15853 $cat <<EOP >try.c
15854 #include <stdio.h>
15855 #$i_stdlib I_STDLIB
15856 #ifdef I_STDLIB
15857 #include <stdlib.h>
15858 #endif
15859 #$i_string I_STRING
15860 #ifdef I_STRING
15861 #  include <string.h>
15862 #else
15863 #  include <strings.h>
15864 #endif
15865 #include <sys/types.h>
15866 #include <signal.h>
15867 #ifdef SIGFPE
15868 $volatile int bletched = 0;
15869 $signal_t blech(int s) { bletched = 1; }
15870 #endif
15871
15872 int checkit($nvtype d, char *where) {
15873     unsigned char *p = (char *)&d;
15874     unsigned char *end = p + sizeof(d);
15875     int fail = 0;
15876
15877     while (p < end)
15878         fail += *p++;
15879
15880     if (!fail)
15881         return 0;
15882
15883     p = (char *)&d;
15884     printf("No - %s: 0x", where);
15885     while (p < end)
15886         printf ("%02X", *p++);
15887     printf("\n");
15888     return 1;
15889 }
15890
15891 int main(int argc, char **argv) {
15892     $nvtype d = 0.0;
15893     int fail = 0;
15894     fail += checkit(d, "0.0");
15895
15896     /* The compiler shouldn't be assuming that bletched is 0  */
15897     d = bletched;
15898
15899     fail += checkit(d, "bleched");
15900
15901 #ifdef SIGFPE
15902     signal(SIGFPE, blech);
15903 #endif
15904
15905     /* Paranoia - the compiler should have no way of knowing that ANSI says
15906        that argv[argc] will always be NULL.  Actually, if it did assume this it
15907        would be buggy, as this is C and main() can be called from elsewhere in
15908        the program.  */
15909     d = argv[argc] ? 1 : 0;
15910
15911     if (d) {
15912         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15913     }
15914
15915     fail += checkit(d, "ternary");
15916
15917     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15918
15919     if (d != 0.0) {
15920         printf("No - memset doesn't give 0.0\n");
15921         /* This might just blow up:  */
15922         printf("(gives %g)\n", d);
15923         return 1;
15924     }
15925
15926 #ifdef SIGFPE
15927     if (bletched) {
15928         printf("No - something bleched\n");
15929         return 1;
15930     }
15931 #endif
15932     if (fail) {
15933       printf("No - %d fail(s)\n", fail);
15934       return 1;
15935     }
15936     printf("Yes\n");
15937     return 0;
15938 }
15939 EOP
15940 set try
15941
15942 d_nv_zero_is_allbits_zero="$undef"
15943 if eval $compile; then
15944     xxx="`$run ./try`"
15945     case "$?" in
15946         0)
15947             case "$xxx" in
15948                 Yes)  cat >&4 <<EOM
15949 0.0 is represented as all bits zero in memory
15950 EOM
15951                     d_nv_zero_is_allbits_zero="$define"
15952                     ;;
15953                 *)  cat >&4 <<EOM
15954 0.0 is not represented as all bits zero in memory
15955 EOM
15956                     d_nv_zero_is_allbits_zero="$undef"
15957                     ;;
15958             esac
15959             ;;
15960         *)  cat >&4 <<EOM
15961 0.0 is not represented as all bits zero in memory
15962 EOM
15963             d_nv_zero_is_allbits_zero="$undef"
15964             ;;
15965     esac
15966 fi
15967 $rm_try
15968
15969 : check for off64_t
15970 echo " "
15971 echo "Checking to see if you have off64_t..." >&4
15972 $cat >try.c <<EOCP
15973 #include <sys/types.h>
15974 #include <unistd.h>
15975 int main() { off64_t x = 7; }
15976 EOCP
15977 set try
15978 if eval $compile; then
15979         val="$define"
15980         echo "You have off64_t."
15981 else
15982         val="$undef"
15983         echo "You do not have off64_t."
15984         case "$lseeksize" in
15985         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15986         esac
15987 fi
15988 $rm_try
15989 set d_off64_t
15990 eval $setvar
15991
15992 : how to create joinable pthreads
15993 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15994         echo " "
15995         echo "Checking what constant to use for creating joinable pthreads..." >&4
15996         $cat >try.c <<'EOCP'
15997 #include <pthread.h>
15998 int main() {
15999     int detachstate = JOINABLE;
16000 }
16001 EOCP
16002         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16003         if eval $compile; then
16004                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16005                 val="$undef" # Yes, undef.
16006                 set d_old_pthread_create_joinable
16007                 eval $setvar
16008                 val=""
16009                 set old_pthread_create_joinable
16010                 eval $setvar
16011         else
16012                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16013                 if eval $compile; then
16014                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16015                         val="$define"
16016                         set d_old_pthread_create_joinable
16017                         eval $setvar
16018                         val=PTHREAD_CREATE_UNDETACHED
16019                         set old_pthread_create_joinable
16020                         eval $setvar
16021                 else
16022                         set try -DJOINABLE=__UNDETACHED
16023                         if eval $compile; then
16024                                 echo "You seem to use __UNDETACHED." >&4
16025                                 val="$define"
16026                                 set d_old_pthread_create_joinable
16027                                 eval $setvar
16028                                 val=__UNDETACHED
16029                                 set old_pthread_create_joinable
16030                                 eval $setvar
16031                         else
16032                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16033                                 val="$define"
16034                                 set d_old_pthread_create_joinable
16035                                 eval $setvar
16036                                 val=0
16037                                 set old_pthread_create_joinable
16038                                 eval $setvar
16039                         fi
16040                 fi
16041         fi
16042         $rm_try
16043 else
16044     d_old_pthread_create_joinable="$undef"
16045     old_pthread_create_joinable=""
16046 fi
16047
16048 : see if pause exists
16049 set pause d_pause
16050 eval $inlibc
16051
16052 : see if poll exists
16053 set poll d_poll
16054 eval $inlibc
16055
16056 : see if prctl exists
16057 set prctl d_prctl
16058 eval $inlibc
16059
16060 : see if prctl supports PR_SET_NAME
16061 d_prctl_set_name=$undef
16062 case $d_prctl in
16063     $define)
16064         $cat >try.c <<EOM
16065 #include <sys/prctl.h>
16066
16067 int main (int argc, char *argv[])
16068 {
16069     return (prctl (PR_SET_NAME, "Test"));
16070     } /* main */
16071 EOM
16072         set try
16073         if eval $compile_ok && $run ./try; then
16074             echo "Your prctl (PR_SET_NAME, ...) works"
16075             d_prctl_set_name=$define
16076             fi
16077         $rm_try
16078         ;;
16079     esac
16080
16081 : see if readlink exists
16082 set readlink d_readlink
16083 eval $inlibc
16084
16085 : Check if exe is symlink to abs path of executing program
16086 echo " "
16087 procselfexe=''
16088 val="$undef"
16089 case "$d_readlink" in
16090 "$define")
16091         if $issymlink /proc/self/exe ; then
16092                 $ls -l /proc/self/exe > reflect
16093                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16094                         echo "You have Linux-like /proc/self/exe."
16095                         procselfexe='"/proc/self/exe"'
16096                         val="$define"
16097                 fi
16098         fi
16099         if $issymlink /proc/curproc/file ; then
16100                 $ls -l /proc/curproc/file > reflect
16101                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16102                         echo "You have BSD-like /proc/curproc/file."
16103                         procselfexe='"/proc/curproc/file"'
16104                         val="$define"
16105                 fi
16106         fi
16107         ;;
16108 esac
16109 $rm -f reflect
16110 set d_procselfexe
16111 eval $setvar
16112
16113 : backward compatibility for d_hvfork
16114 if test X$d_hvfork != X; then
16115         d_vfork="$d_hvfork"
16116         d_hvfork=''
16117 fi
16118 : see if there is a vfork
16119 val=''
16120 set vfork val
16121 eval $inlibc
16122
16123 d_pseudofork=$undef
16124
16125 : Ok, but do we want to use it. vfork is reportedly unreliable in
16126 : perl on Solaris 2.x, and probably elsewhere.
16127 case "$val" in
16128 $define)
16129         echo " "
16130         case "$usevfork" in
16131         false) dflt='n';;
16132         *) dflt='y';;
16133         esac
16134         cat <<'EOM'
16135
16136 Perl can only use a vfork() that doesn't suffer from strict
16137 restrictions on calling functions or modifying global data in
16138 the child.  For example, glibc-2.1 contains such a vfork()
16139 that is unsuitable.  If your system provides a proper fork()
16140 call, chances are that you do NOT want perl to use vfork().
16141
16142 EOM
16143         rp="Do you still want to use vfork()?"
16144         . ./myread
16145         case "$ans" in
16146         y|Y) ;;
16147         *)
16148                 echo "Ok, we won't use vfork()."
16149                 val="$undef"
16150                 ;;
16151         esac
16152         ;;
16153 esac
16154 set d_vfork
16155 eval $setvar
16156 case "$d_vfork" in
16157 $define) usevfork='true';;
16158 *) usevfork='false';;
16159 esac
16160
16161 : see whether the pthread_atfork exists
16162 $cat >try.c <<EOP
16163 #include <pthread.h>
16164 #include <stdio.h>
16165 int main() {
16166 #ifdef  PTHREAD_ATFORK
16167         pthread_atfork(NULL,NULL,NULL);
16168 #endif
16169 }
16170 EOP
16171
16172 : see if pthread_atfork exists
16173 set try -DPTHREAD_ATFORK
16174 if eval $compile; then
16175     val="$define"
16176 else
16177     val="$undef"
16178 fi
16179 case "$usethreads" in
16180 $define)
16181         case "$val" in
16182         $define) echo 'pthread_atfork found.' >&4        ;;
16183         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16184         esac
16185 esac
16186 set d_pthread_atfork
16187 eval $setvar
16188
16189 : see if pthread_attr_setscope exists
16190 set pthread_attr_setscope d_pthread_attr_setscope
16191 eval $inlibc
16192
16193 : see whether the various POSIXish _yields exist
16194 $cat >try.c <<EOP
16195 #include <pthread.h>
16196 #include <stdio.h>
16197 int main() {
16198 #ifdef SCHED_YIELD
16199         sched_yield();
16200 #else
16201 #ifdef PTHREAD_YIELD
16202         pthread_yield();
16203 #else
16204 #ifdef PTHREAD_YIELD_NULL
16205         pthread_yield(NULL);
16206 #endif
16207 #endif
16208 #endif
16209 }
16210 EOP
16211 : see if sched_yield exists
16212 set try -DSCHED_YIELD
16213 if eval $compile; then
16214     val="$define"
16215     sched_yield='sched_yield()'
16216 else
16217     val="$undef"
16218 fi
16219 case "$usethreads" in
16220 $define)
16221         case "$val" in
16222         $define) echo 'sched_yield() found.' >&4        ;;
16223         *)       echo 'sched_yield() NOT found.' >&4    ;;
16224         esac
16225 esac
16226 set d_sched_yield
16227 eval $setvar
16228
16229 : see if pthread_yield exists
16230 set try -DPTHREAD_YIELD
16231 if eval $compile; then
16232     val="$define"
16233     case "$sched_yield" in
16234     '') sched_yield='pthread_yield()' ;;
16235     esac
16236 else
16237     set try -DPTHREAD_YIELD_NULL
16238     if eval $compile; then
16239         val="$define"
16240         case "$sched_yield" in
16241         '') sched_yield='pthread_yield(NULL)' ;;
16242         esac
16243     else
16244         val="$undef"
16245     fi
16246 fi
16247 case "$usethreads" in
16248 $define)
16249         case "$val" in
16250         $define) echo 'pthread_yield() found.' >&4      ;;
16251         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16252         esac
16253         ;;
16254 esac
16255 set d_pthread_yield
16256 eval $setvar
16257 case "$sched_yield" in
16258 '') sched_yield=undef ;;
16259 esac
16260 $rm_try
16261
16262 : see if random_r exists
16263 set random_r d_random_r
16264 eval $inlibc
16265 case "$d_random_r" in
16266 "$define")
16267         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16268         case "$d_random_r_proto:$usethreads" in
16269         ":define")      d_random_r_proto=define
16270                 set d_random_r_proto random_r $hdrs
16271                 eval $hasproto ;;
16272         *)      ;;
16273         esac
16274         case "$d_random_r_proto" in
16275         define)
16276         case "$random_r_proto" in
16277         ''|0) try='int random_r(int*, struct random_data*);'
16278         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16279         esac
16280         case "$random_r_proto" in
16281         ''|0) try='int random_r(long*, struct random_data*);'
16282         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16283         esac
16284         case "$random_r_proto" in
16285         ''|0) try='int random_r(struct random_data*, int32_t*);'
16286         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16287         esac
16288         case "$random_r_proto" in
16289         ''|0)   d_random_r=undef
16290                 random_r_proto=0
16291                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16292         * )     case "$random_r_proto" in
16293                 REENTRANT_PROTO*) ;;
16294                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16295                 esac
16296                 echo "Prototype: $try" ;;
16297         esac
16298         ;;
16299         *)      case "$usethreads" in
16300                 define) echo "random_r has no prototype, not using it." >&4 ;;
16301                 esac
16302                 d_random_r=undef
16303                 random_r_proto=0
16304                 ;;
16305         esac
16306         ;;
16307 *)      random_r_proto=0
16308         ;;
16309 esac
16310
16311 : see if readdir and friends exist
16312 set readdir d_readdir
16313 eval $inlibc
16314 set seekdir d_seekdir
16315 eval $inlibc
16316 set telldir d_telldir
16317 eval $inlibc
16318 set rewinddir d_rewinddir
16319 eval $inlibc
16320
16321 : see if readdir64_r exists
16322 set readdir64_r d_readdir64_r
16323 eval $inlibc
16324 case "$d_readdir64_r" in
16325 "$define")
16326         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16327         case "$d_readdir64_r_proto:$usethreads" in
16328         ":define")      d_readdir64_r_proto=define
16329                 set d_readdir64_r_proto readdir64_r $hdrs
16330                 eval $hasproto ;;
16331         *)      ;;
16332         esac
16333         case "$d_readdir64_r_proto" in
16334         define)
16335         case "$readdir64_r_proto" in
16336         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16337         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16338         esac
16339         case "$readdir64_r_proto" in
16340         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16341         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16342         esac
16343         case "$readdir64_r_proto" in
16344         ''|0)   d_readdir64_r=undef
16345                 readdir64_r_proto=0
16346                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16347         * )     case "$readdir64_r_proto" in
16348                 REENTRANT_PROTO*) ;;
16349                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16350                 esac
16351                 echo "Prototype: $try" ;;
16352         esac
16353         ;;
16354         *)      case "$usethreads" in
16355                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16356                 esac
16357                 d_readdir64_r=undef
16358                 readdir64_r_proto=0
16359                 ;;
16360         esac
16361         ;;
16362 *)      readdir64_r_proto=0
16363         ;;
16364 esac
16365
16366 : see if readdir_r exists
16367 set readdir_r d_readdir_r
16368 eval $inlibc
16369 case "$d_readdir_r" in
16370 "$define")
16371         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16372         case "$d_readdir_r_proto:$usethreads" in
16373         ":define")      d_readdir_r_proto=define
16374                 set d_readdir_r_proto readdir_r $hdrs
16375                 eval $hasproto ;;
16376         *)      ;;
16377         esac
16378         case "$d_readdir_r_proto" in
16379         define)
16380         case "$readdir_r_proto" in
16381         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16382         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16383         esac
16384         case "$readdir_r_proto" in
16385         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16386         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16387         esac
16388         case "$readdir_r_proto" in
16389         ''|0)   d_readdir_r=undef
16390                 readdir_r_proto=0
16391                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16392         * )     case "$readdir_r_proto" in
16393                 REENTRANT_PROTO*) ;;
16394                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16395                 esac
16396                 echo "Prototype: $try" ;;
16397         esac
16398         ;;
16399         *)      case "$usethreads" in
16400                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16401                 esac
16402                 d_readdir_r=undef
16403                 readdir_r_proto=0
16404                 ;;
16405         esac
16406         ;;
16407 *)      readdir_r_proto=0
16408         ;;
16409 esac
16410
16411 : see if readv exists
16412 set readv d_readv
16413 eval $inlibc
16414
16415 : see if recvmsg exists
16416 set recvmsg d_recvmsg
16417 eval $inlibc
16418
16419 : see if rename exists
16420 set rename d_rename
16421 eval $inlibc
16422
16423 : see if rmdir exists
16424 set rmdir d_rmdir
16425 eval $inlibc
16426
16427 : see if memory.h is available.
16428 val=''
16429 set memory.h val
16430 eval $inhdr
16431
16432 : See if it conflicts with string.h
16433 case "$val" in
16434 $define)
16435         case "$strings" in
16436         '') ;;
16437         *)
16438                 $cppstdin $cppflags $cppminus < $strings > mem.h
16439                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16440                         echo " "
16441                         echo "We won't be including <memory.h>."
16442                         val="$undef"
16443                 fi
16444                 $rm -f mem.h
16445                 ;;
16446         esac
16447 esac
16448 set i_memory
16449 eval $setvar
16450
16451 : can bcopy handle overlapping blocks?
16452 echo " "
16453 val="$undef"
16454 case "$d_memmove" in
16455 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16456 *)      case "$d_bcopy" in
16457         "$define")
16458                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16459                 $cat >try.c <<EOCP
16460 #$i_memory I_MEMORY
16461 #$i_stdlib I_STDLIB
16462 #$i_string I_STRING
16463 #$i_unistd I_UNISTD
16464 EOCP
16465         $cat >>try.c <<'EOCP'
16466 #include <stdio.h>
16467 #ifdef I_MEMORY
16468 #  include <memory.h>
16469 #endif
16470 #ifdef I_STDLIB
16471 #  include <stdlib.h>
16472 #endif
16473 #ifdef I_STRING
16474 #  include <string.h>
16475 #else
16476 #  include <strings.h>
16477 #endif
16478 #ifdef I_UNISTD
16479 #  include <unistd.h>  /* Needed for NetBSD */
16480 #endif
16481 int main()
16482 {
16483 char buf[128], abc[128];
16484 char *b;
16485 int len;
16486 int off;
16487 int align;
16488
16489 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16490    try to store the string in read-only memory. */
16491 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16492
16493 for (align = 7; align >= 0; align--) {
16494         for (len = 36; len; len--) {
16495                 b = buf+align;
16496                 bcopy(abc, b, len);
16497                 for (off = 1; off <= len; off++) {
16498                         bcopy(b, b+off, len);
16499                         bcopy(b+off, b, len);
16500                         if (bcmp(b, abc, len))
16501                                 exit(1);
16502                 }
16503         }
16504 }
16505 exit(0);
16506 }
16507 EOCP
16508                 set try
16509                 if eval $compile_ok; then
16510                         if $run ./try 2>/dev/null; then
16511                                 echo "Yes, it can."
16512                                 val="$define"
16513                         else
16514                                 echo "It can't, sorry."
16515                         fi
16516                 else
16517                         echo "(I can't compile the test program, so we'll assume not...)"
16518                 fi
16519                 ;;
16520         esac
16521         $rm_try
16522         ;;
16523 esac
16524 set d_safebcpy
16525 eval $setvar
16526
16527 : can memcpy handle overlapping blocks?
16528 echo " "
16529 val="$undef"
16530 case "$d_memmove" in
16531 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16532 *)      case "$d_memcpy" in
16533         "$define")
16534                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16535                 $cat >try.c <<EOCP
16536 #$i_memory I_MEMORY
16537 #$i_stdlib I_STDLIB
16538 #$i_string I_STRING
16539 #$i_unistd I_UNISTD
16540 EOCP
16541         $cat >>try.c <<'EOCP'
16542 #include <stdio.h>
16543 #ifdef I_MEMORY
16544 #  include <memory.h>
16545 #endif
16546 #ifdef I_STDLIB
16547 #  include <stdlib.h>
16548 #endif
16549 #ifdef I_STRING
16550 #  include <string.h>
16551 #else
16552 #  include <strings.h>
16553 #endif
16554 #ifdef I_UNISTD
16555 #  include <unistd.h>  /* Needed for NetBSD */
16556 #endif
16557 int main()
16558 {
16559 char buf[128], abc[128];
16560 char *b;
16561 int len;
16562 int off;
16563 int align;
16564
16565 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16566    try to store the string in read-only memory. */
16567 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16568
16569 for (align = 7; align >= 0; align--) {
16570         for (len = 36; len; len--) {
16571                 b = buf+align;
16572                 memcpy(b, abc, len);
16573                 for (off = 1; off <= len; off++) {
16574                         memcpy(b+off, b, len);
16575                         memcpy(b, b+off, len);
16576                         if (memcmp(b, abc, len))
16577                                 exit(1);
16578                 }
16579         }
16580 }
16581 exit(0);
16582 }
16583 EOCP
16584                 set try
16585                 if eval $compile_ok; then
16586                         if $run ./try 2>/dev/null; then
16587                                 echo "Yes, it can."
16588                                 val="$define"
16589                         else
16590                                 echo "It can't, sorry."
16591                         fi
16592                 else
16593                         echo "(I can't compile the test program, so we'll assume not...)"
16594                 fi
16595                 ;;
16596         esac
16597         $rm_try
16598         ;;
16599 esac
16600 set d_safemcpy
16601 eval $setvar
16602
16603 : can memcmp be trusted to compare relative magnitude?
16604 val="$undef"
16605 case "$d_memcmp" in
16606 "$define")
16607         echo " "
16608         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16609         $cat >try.c <<EOCP
16610 #$i_memory I_MEMORY
16611 #$i_stdlib I_STDLIB
16612 #$i_string I_STRING
16613 #$i_unistd I_UNISTD
16614 EOCP
16615         $cat >>try.c <<'EOCP'
16616 #include <stdio.h>
16617 #ifdef I_MEMORY
16618 #  include <memory.h>
16619 #endif
16620 #ifdef I_STDLIB
16621 #  include <stdlib.h>
16622 #endif
16623 #ifdef I_STRING
16624 #  include <string.h>
16625 #else
16626 #  include <strings.h>
16627 #endif
16628 #ifdef I_UNISTD
16629 #  include <unistd.h>  /* Needed for NetBSD */
16630 #endif
16631 int main()
16632 {
16633 char a = -1;
16634 char b = 0;
16635 if ((a < b) && memcmp(&a, &b, 1) < 0)
16636         exit(1);
16637 exit(0);
16638 }
16639 EOCP
16640         set try
16641         if eval $compile_ok; then
16642                 if $run ./try 2>/dev/null; then
16643                         echo "Yes, it can."
16644                         val="$define"
16645                 else
16646                         echo "No, it can't (it uses signed chars)."
16647                 fi
16648         else
16649                 echo "(I can't compile the test program, so we'll assume not...)"
16650         fi
16651         ;;
16652 esac
16653 $rm_try
16654 set d_sanemcmp
16655 eval $setvar
16656
16657 : see if prototype for sbrk is available
16658 echo " "
16659 set d_sbrkproto sbrk $i_unistd unistd.h
16660 eval $hasproto
16661
16662 : see if select exists
16663 set select d_select
16664 eval $inlibc
16665
16666 : see if semctl exists
16667 set semctl d_semctl
16668 eval $inlibc
16669
16670 : see if semget exists
16671 set semget d_semget
16672 eval $inlibc
16673
16674 : see if semop exists
16675 set semop d_semop
16676 eval $inlibc
16677
16678 : see how much of the 'sem*(2)' library is present.
16679 h_sem=true
16680 echo " "
16681 case "$d_semctl$d_semget$d_semop" in
16682 *"$undef"*) h_sem=false;;
16683 esac
16684 case "$osname" in
16685 freebsd)
16686     case "`ipcs 2>&1`" in
16687     "SVID messages"*"not configured"*)
16688         echo "Your $osname does not have the sem*(2) configured." >&4
16689         h_sem=false
16690         val="$undef"
16691         set semctl d_semctl
16692         eval $setvar
16693         set semget d_semget
16694         eval $setvar
16695         set semop d_semop
16696         eval $setvar
16697         ;;
16698     esac
16699     ;;
16700 esac
16701 : we could also check for sys/ipc.h ...
16702 if $h_sem && $test `./findhdr sys/sem.h`; then
16703         echo "You have the full sem*(2) library." >&4
16704         val="$define"
16705 else
16706         echo "You don't have the full sem*(2) library." >&4
16707         val="$undef"
16708 fi
16709 set d_sem
16710 eval $setvar
16711
16712 : see whether sys/sem.h defines union semun
16713 echo " "
16714 $cat > try.c <<'END'
16715 #include <sys/types.h>
16716 #include <sys/ipc.h>
16717 #include <sys/sem.h>
16718 int main () { union semun semun; semun.buf = 0; }
16719 END
16720 set try
16721 if eval $compile; then
16722     echo "You have union semun in <sys/sem.h>." >&4
16723     val="$define"
16724 else
16725     echo "You do not have union semun in <sys/sem.h>." >&4
16726     val="$undef"
16727 fi
16728 $rm_try
16729 set d_union_semun
16730 eval $setvar
16731
16732 : see how to do semctl IPC_STAT
16733 case "$d_sem" in
16734 $define)
16735     echo " "
16736     $cat > tryh.h <<END
16737 #ifndef S_IRUSR
16738 #   ifdef S_IREAD
16739 #       define S_IRUSR S_IREAD
16740 #       define S_IWUSR S_IWRITE
16741 #       define S_IXUSR S_IEXEC
16742 #   else
16743 #       define S_IRUSR 0400
16744 #       define S_IWUSR 0200
16745 #       define S_IXUSR 0100
16746 #   endif
16747 #   define S_IRGRP (S_IRUSR>>3)
16748 #   define S_IWGRP (S_IWUSR>>3)
16749 #   define S_IXGRP (S_IXUSR>>3)
16750 #   define S_IROTH (S_IRUSR>>6)
16751 #   define S_IWOTH (S_IWUSR>>6)
16752 #   define S_IXOTH (S_IXUSR>>6)
16753 #endif
16754 #ifndef S_IRWXU
16755 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16756 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16757 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16758 #endif
16759 END
16760     : see whether semctl IPC_STAT can use union semun
16761     case "$d_semctl_semun" in
16762     '')
16763       val="$undef"
16764       $cat > try.c <<END
16765 #include <sys/types.h>
16766 #include <sys/ipc.h>
16767 #include <sys/sem.h>
16768 #include <sys/stat.h>
16769 #include <stdio.h>
16770 #include <errno.h>
16771 #include "tryh.h"
16772 #ifndef errno
16773 extern int errno;
16774 #endif
16775 #$d_union_semun HAS_UNION_SEMUN
16776 int main() {
16777     union semun
16778 #ifndef HAS_UNION_SEMUN
16779     {
16780         int val;
16781         struct semid_ds *buf;
16782         unsigned short *array;
16783     }
16784 #endif
16785     arg;
16786     int sem, st;
16787
16788 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16789     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16790     if (sem > -1) {
16791         struct semid_ds argbuf;
16792         arg.buf = &argbuf;
16793 #       ifdef IPC_STAT
16794         st = semctl(sem, 0, IPC_STAT, arg);
16795         if (st == 0)
16796             printf("semun\n");
16797         else
16798 #       endif /* IPC_STAT */
16799             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16800 #       ifdef IPC_RMID
16801         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16802 #       endif /* IPC_RMID */
16803             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16804     } else
16805 #endif /* IPC_PRIVATE && ... */
16806         printf("semget failed: errno = %d\n", errno);
16807   return 0;
16808 }
16809 END
16810       set try
16811       if eval $compile; then
16812           xxx=`$run ./try`
16813           case "$xxx" in
16814           semun) val="$define" ;;
16815           esac
16816       fi
16817       $rm_try
16818       set d_semctl_semun
16819       eval $setvar
16820       ;;
16821     esac
16822     case "$d_semctl_semun" in
16823     $define)
16824         echo "You can use union semun for semctl IPC_STAT." >&4
16825         also='also'
16826         ;;
16827     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16828         also=''
16829         ;;
16830     esac
16831
16832     : see whether semctl IPC_STAT can use struct semid_ds pointer
16833     case "$d_semctl_semid_ds" in
16834     '')
16835       val="$undef"
16836       $cat > try.c <<'END'
16837 #include <sys/types.h>
16838 #include <sys/ipc.h>
16839 #include <sys/sem.h>
16840 #include <sys/stat.h>
16841 #include "tryh.h"
16842 #include <stdio.h>
16843 #include <errno.h>
16844 #ifndef errno
16845 extern int errno;
16846 #endif
16847 int main() {
16848     struct semid_ds arg;
16849     int sem, st;
16850
16851 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16852     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16853     if (sem > -1) {
16854 #       ifdef IPC_STAT
16855         st = semctl(sem, 0, IPC_STAT, &arg);
16856         if (st == 0)
16857             printf("semid_ds\n");
16858         else
16859 #       endif /* IPC_STAT */
16860             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16861 #       ifdef IPC_RMID
16862         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16863 #       endif /* IPC_RMID */
16864             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16865     } else
16866 #endif /* IPC_PRIVATE && ... */
16867         printf("semget failed: errno = %d\n", errno);
16868
16869     return 0;
16870 }
16871 END
16872       set try
16873       if eval $compile; then
16874           xxx=`$run ./try`
16875           case "$xxx" in
16876           semid_ds) val="$define" ;;
16877           esac
16878       fi
16879       $rm_try
16880       set d_semctl_semid_ds
16881       eval $setvar
16882       ;;
16883     esac
16884     case "$d_semctl_semid_ds" in
16885     $define)
16886         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16887         ;;
16888     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16889         ;;
16890     esac
16891     ;;
16892 *)  val="$undef"
16893
16894     # We do not have the full sem*(2) library, so assume we can not
16895     # use either.
16896
16897     set d_semctl_semun
16898     eval $setvar
16899
16900     set d_semctl_semid_ds
16901     eval $setvar
16902     ;;
16903 esac
16904 $rm_try tryh.h
16905
16906 : see if sendmsg exists
16907 set sendmsg d_sendmsg
16908 eval $inlibc
16909
16910 : see if setegid exists
16911 set setegid d_setegid
16912 eval $inlibc
16913
16914 : see if seteuid exists
16915 set seteuid d_seteuid
16916 eval $inlibc
16917
16918 : see if setgrent exists
16919 set setgrent d_setgrent
16920 eval $inlibc
16921
16922 : see if setgrent_r exists
16923 set setgrent_r d_setgrent_r
16924 eval $inlibc
16925 case "$d_setgrent_r" in
16926 "$define")
16927         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16928         case "$d_setgrent_r_proto:$usethreads" in
16929         ":define")      d_setgrent_r_proto=define
16930                 set d_setgrent_r_proto setgrent_r $hdrs
16931                 eval $hasproto ;;
16932         *)      ;;
16933         esac
16934         case "$d_setgrent_r_proto" in
16935         define)
16936         case "$setgrent_r_proto" in
16937         ''|0) try='int setgrent_r(FILE**);'
16938         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16939         esac
16940         case "$setgrent_r_proto" in
16941         ''|0) try='void setgrent_r(FILE**);'
16942         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16943         esac
16944         case "$setgrent_r_proto" in
16945         ''|0)   d_setgrent_r=undef
16946                 setgrent_r_proto=0
16947                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16948         * )     case "$setgrent_r_proto" in
16949                 REENTRANT_PROTO*) ;;
16950                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16951                 esac
16952                 echo "Prototype: $try" ;;
16953         esac
16954         ;;
16955         *)      case "$usethreads" in
16956                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16957                 esac
16958                 d_setgrent_r=undef
16959                 setgrent_r_proto=0
16960                 ;;
16961         esac
16962         ;;
16963 *)      setgrent_r_proto=0
16964         ;;
16965 esac
16966
16967 : see if sethostent exists
16968 set sethostent d_sethent
16969 eval $inlibc
16970
16971 : see if sethostent_r exists
16972 set sethostent_r d_sethostent_r
16973 eval $inlibc
16974 case "$d_sethostent_r" in
16975 "$define")
16976         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16977         case "$d_sethostent_r_proto:$usethreads" in
16978         ":define")      d_sethostent_r_proto=define
16979                 set d_sethostent_r_proto sethostent_r $hdrs
16980                 eval $hasproto ;;
16981         *)      ;;
16982         esac
16983         case "$d_sethostent_r_proto" in
16984         define)
16985         case "$sethostent_r_proto" in
16986         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16987         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
16988         esac
16989         case "$sethostent_r_proto" in
16990         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16991         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
16992         esac
16993         case "$sethostent_r_proto" in
16994         ''|0)   d_sethostent_r=undef
16995                 sethostent_r_proto=0
16996                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16997         * )     case "$sethostent_r_proto" in
16998                 REENTRANT_PROTO*) ;;
16999                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17000                 esac
17001                 echo "Prototype: $try" ;;
17002         esac
17003         ;;
17004         *)      case "$usethreads" in
17005                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17006                 esac
17007                 d_sethostent_r=undef
17008                 sethostent_r_proto=0
17009                 ;;
17010         esac
17011         ;;
17012 *)      sethostent_r_proto=0
17013         ;;
17014 esac
17015
17016 : see if setitimer exists
17017 set setitimer d_setitimer
17018 eval $inlibc
17019
17020 : see if setlinebuf exists
17021 set setlinebuf d_setlinebuf
17022 eval $inlibc
17023
17024 : see if setlocale exists
17025 set setlocale d_setlocale
17026 eval $inlibc
17027
17028 : see if locale.h is available
17029 set locale.h i_locale
17030 eval $inhdr
17031
17032 : see if setlocale_r exists
17033 set setlocale_r d_setlocale_r
17034 eval $inlibc
17035 case "$d_setlocale_r" in
17036 "$define")
17037         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17038         case "$d_setlocale_r_proto:$usethreads" in
17039         ":define")      d_setlocale_r_proto=define
17040                 set d_setlocale_r_proto setlocale_r $hdrs
17041                 eval $hasproto ;;
17042         *)      ;;
17043         esac
17044         case "$d_setlocale_r_proto" in
17045         define)
17046         case "$setlocale_r_proto" in
17047         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17048         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17049         esac
17050         case "$setlocale_r_proto" in
17051         ''|0)   d_setlocale_r=undef
17052                 setlocale_r_proto=0
17053                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17054         * )     case "$setlocale_r_proto" in
17055                 REENTRANT_PROTO*) ;;
17056                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17057                 esac
17058                 echo "Prototype: $try" ;;
17059         esac
17060         ;;
17061         *)      case "$usethreads" in
17062                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17063                 esac
17064                 d_setlocale_r=undef
17065                 setlocale_r_proto=0
17066                 ;;
17067         esac
17068         ;;
17069 *)      setlocale_r_proto=0
17070         ;;
17071 esac
17072
17073 : see if setnetent exists
17074 set setnetent d_setnent
17075 eval $inlibc
17076
17077 : see if setnetent_r exists
17078 set setnetent_r d_setnetent_r
17079 eval $inlibc
17080 case "$d_setnetent_r" in
17081 "$define")
17082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17083         case "$d_setnetent_r_proto:$usethreads" in
17084         ":define")      d_setnetent_r_proto=define
17085                 set d_setnetent_r_proto setnetent_r $hdrs
17086                 eval $hasproto ;;
17087         *)      ;;
17088         esac
17089         case "$d_setnetent_r_proto" in
17090         define)
17091         case "$setnetent_r_proto" in
17092         ''|0) try='int setnetent_r(int, struct netent_data*);'
17093         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17094         esac
17095         case "$setnetent_r_proto" in
17096         ''|0) try='void setnetent_r(int, struct netent_data*);'
17097         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17098         esac
17099         case "$setnetent_r_proto" in
17100         ''|0)   d_setnetent_r=undef
17101                 setnetent_r_proto=0
17102                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17103         * )     case "$setnetent_r_proto" in
17104                 REENTRANT_PROTO*) ;;
17105                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17106                 esac
17107                 echo "Prototype: $try" ;;
17108         esac
17109         ;;
17110         *)      case "$usethreads" in
17111                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17112                 esac
17113                 d_setnetent_r=undef
17114                 setnetent_r_proto=0
17115                 ;;
17116         esac
17117         ;;
17118 *)      setnetent_r_proto=0
17119         ;;
17120 esac
17121
17122 : see if setprotoent exists
17123 set setprotoent d_setpent
17124 eval $inlibc
17125
17126 : see if setpgid exists
17127 set setpgid d_setpgid
17128 eval $inlibc
17129
17130 : see if setpgrp2 exists
17131 set setpgrp2 d_setpgrp2
17132 eval $inlibc
17133
17134 : see if setpriority exists
17135 set setpriority d_setprior
17136 eval $inlibc
17137
17138 : see if setproctitle exists
17139 set setproctitle d_setproctitle
17140 eval $inlibc
17141
17142 : see if setprotoent_r exists
17143 set setprotoent_r d_setprotoent_r
17144 eval $inlibc
17145 case "$d_setprotoent_r" in
17146 "$define")
17147         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17148         case "$d_setprotoent_r_proto:$usethreads" in
17149         ":define")      d_setprotoent_r_proto=define
17150                 set d_setprotoent_r_proto setprotoent_r $hdrs
17151                 eval $hasproto ;;
17152         *)      ;;
17153         esac
17154         case "$d_setprotoent_r_proto" in
17155         define)
17156         case "$setprotoent_r_proto" in
17157         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17158         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17159         esac
17160         case "$setprotoent_r_proto" in
17161         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17162         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17163         esac
17164         case "$setprotoent_r_proto" in
17165         ''|0)   d_setprotoent_r=undef
17166                 setprotoent_r_proto=0
17167                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17168         * )     case "$setprotoent_r_proto" in
17169                 REENTRANT_PROTO*) ;;
17170                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17171                 esac
17172                 echo "Prototype: $try" ;;
17173         esac
17174         ;;
17175         *)      case "$usethreads" in
17176                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17177                 esac
17178                 d_setprotoent_r=undef
17179                 setprotoent_r_proto=0
17180                 ;;
17181         esac
17182         ;;
17183 *)      setprotoent_r_proto=0
17184         ;;
17185 esac
17186
17187 : see if setpwent exists
17188 set setpwent d_setpwent
17189 eval $inlibc
17190
17191 : see if setpwent_r exists
17192 set setpwent_r d_setpwent_r
17193 eval $inlibc
17194 case "$d_setpwent_r" in
17195 "$define")
17196         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17197         case "$d_setpwent_r_proto:$usethreads" in
17198         ":define")      d_setpwent_r_proto=define
17199                 set d_setpwent_r_proto setpwent_r $hdrs
17200                 eval $hasproto ;;
17201         *)      ;;
17202         esac
17203         case "$d_setpwent_r_proto" in
17204         define)
17205         case "$setpwent_r_proto" in
17206         ''|0) try='int setpwent_r(FILE**);'
17207         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17208         esac
17209         case "$setpwent_r_proto" in
17210         ''|0) try='void setpwent_r(FILE**);'
17211         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17212         esac
17213         case "$setpwent_r_proto" in
17214         ''|0)   d_setpwent_r=undef
17215                 setpwent_r_proto=0
17216                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17217         * )     case "$setpwent_r_proto" in
17218                 REENTRANT_PROTO*) ;;
17219                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17220                 esac
17221                 echo "Prototype: $try" ;;
17222         esac
17223         ;;
17224         *)      case "$usethreads" in
17225                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17226                 esac
17227                 d_setpwent_r=undef
17228                 setpwent_r_proto=0
17229                 ;;
17230         esac
17231         ;;
17232 *)      setpwent_r_proto=0
17233         ;;
17234 esac
17235
17236 : see if setregid exists
17237 set setregid d_setregid
17238 eval $inlibc
17239 set setresgid d_setresgid
17240 eval $inlibc
17241
17242 : see if setreuid exists
17243 set setreuid d_setreuid
17244 eval $inlibc
17245 set setresuid d_setresuid
17246 eval $inlibc
17247
17248 : see if setrgid exists
17249 set setrgid d_setrgid
17250 eval $inlibc
17251
17252 : see if setruid exists
17253 set setruid d_setruid
17254 eval $inlibc
17255
17256 : see if setservent exists
17257 set setservent d_setsent
17258 eval $inlibc
17259
17260 : see if setservent_r exists
17261 set setservent_r d_setservent_r
17262 eval $inlibc
17263 case "$d_setservent_r" in
17264 "$define")
17265         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17266         case "$d_setservent_r_proto:$usethreads" in
17267         ":define")      d_setservent_r_proto=define
17268                 set d_setservent_r_proto setservent_r $hdrs
17269                 eval $hasproto ;;
17270         *)      ;;
17271         esac
17272         case "$d_setservent_r_proto" in
17273         define)
17274         case "$setservent_r_proto" in
17275         ''|0) try='int setservent_r(int, struct servent_data*);'
17276         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17277         esac
17278         case "$setservent_r_proto" in
17279         ''|0) try='void setservent_r(int, struct servent_data*);'
17280         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17281         esac
17282         case "$setservent_r_proto" in
17283         ''|0)   d_setservent_r=undef
17284                 setservent_r_proto=0
17285                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17286         * )     case "$setservent_r_proto" in
17287                 REENTRANT_PROTO*) ;;
17288                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17289                 esac
17290                 echo "Prototype: $try" ;;
17291         esac
17292         ;;
17293         *)      case "$usethreads" in
17294                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17295                 esac
17296                 d_setservent_r=undef
17297                 setservent_r_proto=0
17298                 ;;
17299         esac
17300         ;;
17301 *)      setservent_r_proto=0
17302         ;;
17303 esac
17304
17305 : see if setsid exists
17306 set setsid d_setsid
17307 eval $inlibc
17308
17309 : see if setvbuf exists
17310 set setvbuf d_setvbuf
17311 eval $inlibc
17312
17313 : see if sfio.h is available
17314 set sfio.h i_sfio
17315 eval $inhdr
17316
17317 : see if sfio library is available
17318 case "$i_sfio" in
17319 $define)
17320         val=''
17321         set sfreserve val
17322         eval $inlibc
17323         ;;
17324 *)
17325         val="$undef"
17326         ;;
17327 esac
17328 : Ok, but do we want to use it.
17329 case "$val" in
17330 $define)
17331         case "$usesfio" in
17332         true|$define|[yY]*) dflt='y';;
17333         *) dflt='n';;
17334         esac
17335         echo "$package can use the sfio library, but it is experimental."
17336         case "$useperlio" in
17337         "$undef")
17338             echo "For sfio also the PerlIO abstraction layer is needed."
17339             echo "Earlier you said you wouldn't want that."
17340             ;;
17341         esac
17342         rp="You seem to have sfio available, do you want to try using it?"
17343         . ./myread
17344         case "$ans" in
17345         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
17346                 useperlio="$define"
17347                 val="$define"
17348                 ;;
17349         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17350                 val="$undef"
17351                 ;;
17352         esac
17353         ;;
17354 *)      case "$usesfio" in
17355         true|$define|[yY]*)
17356                 echo "Sorry, cannot find sfio on this machine." >&4
17357                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17358                 val="$undef"
17359                 ;;
17360         esac
17361         ;;
17362 esac
17363 set d_sfio
17364 eval $setvar
17365 case "$d_sfio" in
17366 $define) usesfio='true';;
17367 *) usesfio='false';;
17368 esac
17369 case "$d_sfio" in
17370 $define) ;;
17371 *)      : Remove sfio from list of libraries to use
17372         case "$libs" in
17373         *-lsfio*)
17374                 echo "Removing unneeded -lsfio from library list" >&4
17375                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17376                 shift
17377                 libs="$*"
17378                 echo "libs = $libs" >&4
17379                 ;;
17380         esac
17381 ;;
17382 esac
17383
17384
17385 : see if shmctl exists
17386 set shmctl d_shmctl
17387 eval $inlibc
17388
17389 : see if shmget exists
17390 set shmget d_shmget
17391 eval $inlibc
17392
17393 : see if shmat exists
17394 set shmat d_shmat
17395 eval $inlibc
17396 : see what shmat returns
17397 case "$d_shmat" in
17398 "$define")
17399         $cat >shmat.c <<'END'
17400 #include <sys/shm.h>
17401 void *shmat();
17402 END
17403         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17404                 shmattype='void *'
17405         else
17406                 shmattype='char *'
17407         fi
17408         echo "and it returns ($shmattype)." >&4
17409         : see if a prototype for shmat is available
17410         xxx=`./findhdr sys/shm.h`
17411         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17412         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17413                 val="$define"
17414         else
17415                 val="$undef"
17416         fi
17417         $rm -f shmat.[co]
17418         ;;
17419 *)
17420         val="$undef"
17421         ;;
17422 esac
17423 set d_shmatprototype
17424 eval $setvar
17425
17426 : see if shmdt exists
17427 set shmdt d_shmdt
17428 eval $inlibc
17429
17430 : see how much of the 'shm*(2)' library is present.
17431 h_shm=true
17432 echo " "
17433 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17434 *"$undef"*) h_shm=false;;
17435 esac
17436 case "$osname" in
17437 freebsd)
17438     case "`ipcs 2>&1`" in
17439     "SVID shared memory"*"not configured"*)
17440         echo "Your $osname does not have the shm*(2) configured." >&4
17441         h_shm=false
17442         val="$undef"
17443         set shmctl d_shmctl
17444         evat $setvar
17445         set shmget d_shmget
17446         evat $setvar
17447         set shmat d_shmat
17448         evat $setvar
17449         set shmdt d_shmdt
17450         evat $setvar
17451         ;;
17452     esac
17453     ;;
17454 esac
17455 : we could also check for sys/ipc.h ...
17456 if $h_shm && $test `./findhdr sys/shm.h`; then
17457         echo "You have the full shm*(2) library." >&4
17458         val="$define"
17459 else
17460         echo "You don't have the full shm*(2) library." >&4
17461         val="$undef"
17462 fi
17463 set d_shm
17464 eval $setvar
17465
17466 : see if we have sigaction
17467 echo " "
17468 if set sigaction val -f d_sigaction; eval $csym; $val; then
17469         echo 'sigaction() found.' >&4
17470         $cat > try.c <<EOP
17471 #include <stdio.h>
17472 #include <sys/types.h>
17473 #include <signal.h>
17474 #$i_stdlib I_STDLIB
17475 #ifdef I_STDLIB
17476 #include <stdlib.h>
17477 #endif
17478 int main()
17479 {
17480     struct sigaction act, oact;
17481     act.sa_flags = 0;
17482     oact.sa_handler = 0;
17483     /* so that act and oact are used */
17484     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17485 }
17486 EOP
17487         set try
17488         if eval $compile_ok; then
17489                 val="$define"
17490         else
17491                 echo "But you don't seem to have a useable struct sigaction." >&4
17492                 val="$undef"
17493         fi
17494 else
17495         echo 'sigaction NOT found.' >&4
17496         val="$undef"
17497 fi
17498 set d_sigaction; eval $setvar
17499 $rm_try
17500
17501 : see if this is a sunmath.h system
17502 set sunmath.h i_sunmath
17503 eval $inhdr
17504
17505 : see if signbit exists
17506 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17507 $cat >try.c <<EOCP
17508 #$i_math I_MATH
17509 #$i_sunmath I_SUNMATH
17510 #ifdef I_MATH
17511 #  include <math.h>
17512 #endif
17513 #ifdef I_SUNMATH  /* Solaris special math library */
17514 #  include <sunmath.h>
17515 #endif
17516 #define NV $nvtype
17517 int main(int argc, char **argv)
17518 {
17519     NV x = 0.0;
17520     NV y = -0.0;
17521     if ((signbit(x) == 0) && (signbit(y) != 0))
17522         return 0;
17523     else
17524         return 1;
17525 }
17526 EOCP
17527 val="$undef"
17528 set try
17529 if eval $compile; then
17530     if $run ./try; then
17531         $echo "Yes." >&4
17532         val="$define"
17533     else
17534         $echo "Signbit seems to be available, but doesn't work as I expected."
17535         $echo "I won't use it." >&4
17536         val="$undef"
17537     fi
17538 else
17539     $echo "Nope." >&4
17540     dflt="$undef"
17541 fi
17542 set d_signbit
17543 eval $setvar
17544 $rm_try
17545
17546 : see if sigprocmask exists
17547 set sigprocmask d_sigprocmask
17548 eval $inlibc
17549
17550 : see if sigsetjmp exists
17551 echo " "
17552 case "$d_sigsetjmp" in
17553 '')
17554         $cat >try.c <<EOP
17555 #include <setjmp.h>
17556 #$i_stdlib I_STDLIB
17557 #ifdef I_STDLIB
17558 #include <stdlib.h>
17559 #endif
17560 sigjmp_buf env;
17561 int set = 1;
17562 int main()
17563 {
17564         if (sigsetjmp(env,1))
17565                 exit(set);
17566         set = 0;
17567         siglongjmp(env, 1);
17568         exit(1);
17569 }
17570 EOP
17571         set try
17572         if eval $compile; then
17573                 if $run ./try >/dev/null 2>&1; then
17574                         echo "POSIX sigsetjmp found." >&4
17575                         val="$define"
17576                 else
17577                         $cat >&4 <<EOM
17578 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17579 I'll ignore them.
17580 EOM
17581                         val="$undef"
17582                 fi
17583         else
17584                 echo "sigsetjmp not found." >&4
17585                 val="$undef"
17586         fi
17587         ;;
17588 *) val="$d_sigsetjmp"
17589         case "$d_sigsetjmp" in
17590         $define) echo "POSIX sigsetjmp found." >&4;;
17591         $undef) echo "sigsetjmp not found." >&4;;
17592         esac
17593         ;;
17594 esac
17595 set d_sigsetjmp
17596 eval $setvar
17597 $rm_try
17598
17599 : see if snprintf exists
17600 set snprintf d_snprintf
17601 eval $inlibc
17602
17603 : see if vsnprintf exists
17604 set vsnprintf d_vsnprintf
17605 eval $inlibc
17606
17607 case "$d_snprintf-$d_vsnprintf" in
17608 "$define-$define")
17609     $cat <<EOM
17610 Checking whether your snprintf() and vsnprintf() work okay...
17611 EOM
17612     $cat >try.c <<'EOCP'
17613 /* v?snprintf testing logic courtesy of Russ Allbery.
17614  * According to C99:
17615  * - if the buffer is too short it still must be \0-terminated
17616  * - if the buffer is too short the potentially required length
17617  *   must be returned and not -1
17618  * - if the buffer is NULL the potentially required length
17619  *   must be returned and not -1 or core dump
17620  */
17621 #include <stdio.h>
17622 #include <stdarg.h>
17623
17624 char buf[2];
17625
17626 int test (char *format, ...)
17627 {
17628     va_list args;
17629     int count;
17630
17631     va_start (args, format);
17632     count = vsnprintf (buf, sizeof buf, format, args);
17633     va_end (args);
17634     return count;
17635 }
17636
17637 int main ()
17638 {
17639     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17640              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17641 }
17642 EOCP
17643     set try
17644     if eval $compile; then
17645         `$run ./try`
17646         case "$?" in
17647         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17648         *) cat <<EOM >&4
17649 Your snprintf() and snprintf() don't seem to be working okay.
17650 EOM
17651            d_snprintf="$undef"
17652            d_vsnprintf="$undef"
17653            ;;
17654         esac
17655     else
17656         echo "(I can't seem to compile the test program--assuming they don't)"
17657         d_snprintf="$undef"
17658         d_vsnprintf="$undef"
17659     fi
17660     $rm_try
17661     ;;
17662 esac
17663
17664 : see if sockatmark exists
17665 set sockatmark d_sockatmark
17666 eval $inlibc
17667
17668 : see if prototype for sockatmark is available
17669 echo " "
17670 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17671 eval $hasproto
17672
17673 : see if socks5_init exists
17674 set socks5_init d_socks5_init
17675 eval $inlibc
17676
17677 : see if sprintf returns the length of the string in the buffer as per ANSI
17678 $echo "Checking whether sprintf returns the length of the string..." >&4
17679 $cat <<EOP >try.c
17680 #include <stdio.h>
17681 #$i_stdlib I_STDLIB
17682 #ifdef I_STDLIB
17683 #include <stdlib.h>
17684 #endif
17685 #$i_string I_STRING
17686 #ifdef I_STRING
17687 #  include <string.h>
17688 #else
17689 #  include <strings.h>
17690 #endif
17691 #$i_math I_MATH
17692 #ifdef I_MATH
17693 #include <math.h>
17694 #endif
17695
17696 char buffer[256];
17697
17698 int check (size_t expect, int test) {
17699   size_t got = strlen(buffer);
17700   if (expect == got)
17701     return 0;
17702
17703   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17704        test, buffer);
17705   exit (test);
17706 }
17707
17708 int main(int argc, char **argv) {
17709   int test = 0;
17710
17711   check(sprintf(buffer, ""), ++test);
17712   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17713   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17714
17715   return 0;
17716 }
17717 EOP
17718 set try
17719
17720 if eval $compile; then
17721     xxx="`$run ./try`"
17722     case "$?" in
17723         0) cat >&4 <<EOM
17724 sprintf returns the length of the string (as ANSI says it should)
17725 EOM
17726         d_sprintf_returns_strlen="$define"
17727         ;;
17728         *) cat >&4 <<EOM
17729 sprintf does not return the length of the string (how old is this system?)
17730 EOM
17731         d_sprintf_returns_strlen="$undef"
17732         ;;
17733     esac
17734 else
17735     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17736     d_sprintf_returns_strlen="$undef"
17737 fi
17738 $rm_try
17739
17740 : see if srand48_r exists
17741 set srand48_r d_srand48_r
17742 eval $inlibc
17743 case "$d_srand48_r" in
17744 "$define")
17745         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17746         case "$d_srand48_r_proto:$usethreads" in
17747         ":define")      d_srand48_r_proto=define
17748                 set d_srand48_r_proto srand48_r $hdrs
17749                 eval $hasproto ;;
17750         *)      ;;
17751         esac
17752         case "$d_srand48_r_proto" in
17753         define)
17754         case "$srand48_r_proto" in
17755         ''|0) try='int srand48_r(long, struct drand48_data*);'
17756         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17757         esac
17758         case "$srand48_r_proto" in
17759         ''|0)   d_srand48_r=undef
17760                 srand48_r_proto=0
17761                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17762         * )     case "$srand48_r_proto" in
17763                 REENTRANT_PROTO*) ;;
17764                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17765                 esac
17766                 echo "Prototype: $try" ;;
17767         esac
17768         ;;
17769         *)      case "$usethreads" in
17770                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17771                 esac
17772                 d_srand48_r=undef
17773                 srand48_r_proto=0
17774                 ;;
17775         esac
17776         ;;
17777 *)      srand48_r_proto=0
17778         ;;
17779 esac
17780
17781 : see if srandom_r exists
17782 set srandom_r d_srandom_r
17783 eval $inlibc
17784 case "$d_srandom_r" in
17785 "$define")
17786         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17787         case "$d_srandom_r_proto:$usethreads" in
17788         ":define")      d_srandom_r_proto=define
17789                 set d_srandom_r_proto srandom_r $hdrs
17790                 eval $hasproto ;;
17791         *)      ;;
17792         esac
17793         case "$d_srandom_r_proto" in
17794         define)
17795         case "$srandom_r_proto" in
17796         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17797         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17798         esac
17799         case "$srandom_r_proto" in
17800         ''|0)   d_srandom_r=undef
17801                 srandom_r_proto=0
17802                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17803         * )     case "$srandom_r_proto" in
17804                 REENTRANT_PROTO*) ;;
17805                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17806                 esac
17807                 echo "Prototype: $try" ;;
17808         esac
17809         ;;
17810         *)      case "$usethreads" in
17811                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17812                 esac
17813                 d_srandom_r=undef
17814                 srandom_r_proto=0
17815                 ;;
17816         esac
17817         ;;
17818 *)      srandom_r_proto=0
17819         ;;
17820 esac
17821
17822 : see if prototype for setresgid is available
17823 echo " "
17824 set d_sresgproto setresgid $i_unistd unistd.h
17825 eval $hasproto
17826
17827 : see if prototype for setresuid is available
17828 echo " "
17829 set d_sresuproto setresuid $i_unistd unistd.h
17830 eval $hasproto
17831
17832 : see if sys/stat.h is available
17833 set sys/stat.h i_sysstat
17834 eval $inhdr
17835
17836 : see if stat knows about block sizes
17837 echo " "
17838 echo "Checking to see if your struct stat has st_blocks field..." >&4
17839 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17840 eval $hasfield
17841
17842 : see if this is a sys/vfs.h system
17843 set sys/vfs.h i_sysvfs
17844 eval $inhdr
17845
17846 : see if this is a sys/statfs.h system
17847 set sys/statfs.h i_sysstatfs
17848 eval $inhdr
17849
17850 : Check for statfs_s
17851 echo " "
17852 echo "Checking to see if your system supports struct statfs..." >&4
17853 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
17854 eval $hasstruct
17855 case "$d_statfs_s" in
17856 "$define")      echo "Yes, it does."   ;;
17857 *)              echo "No, it doesn't." ;;
17858 esac
17859
17860
17861 : see if struct statfs knows about f_flags
17862 case "$d_statfs_s" in
17863 define)
17864         echo " "
17865         echo "Checking to see if your struct statfs has f_flags field..." >&4
17866         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
17867         eval $hasfield
17868         ;;
17869 *)      val="$undef"
17870         set d_statfs_f_flags
17871         eval $setvar
17872         ;;
17873 esac
17874 case "$d_statfs_f_flags" in
17875 "$define")      echo "Yes, it does."   ;;
17876 *)              echo "No, it doesn't." ;;
17877 esac
17878
17879 : see what flavor, if any, of static inline is supported
17880 echo " "
17881 echo "Checking to see if your system supports static inline..."
17882 $cat > try.c <<'EOCP'
17883 #include <stdlib.h>
17884 extern int f_via_a(int x);
17885 extern int f_via_b(int x);
17886 int main(int argc, char **argv)
17887 {
17888     int y;
17889
17890     y = f_via_a(0);
17891 #ifdef USE_B
17892     y = f_via_b(0);
17893 #endif
17894     if (y == 42) {
17895         return EXIT_SUCCESS;
17896     }
17897     else {
17898         return EXIT_FAILURE;
17899     }
17900 }
17901 EOCP
17902 $cat > a.c <<'EOCP'
17903 static INLINE int f(int x) {
17904     int y;
17905     y = x + 42;
17906     return y;
17907 }
17908
17909 int f_via_a(int x)
17910 {
17911     return f(x);
17912 }
17913 EOCP
17914 $cat > b.c <<'EOCP'
17915 extern int f(int x);
17916
17917 int f_via_b(int x)
17918 {
17919     return f(x);
17920 }
17921 EOCP
17922
17923 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17924 case "$perl_static_inline" in
17925 '')     # Check the various possibilities, and break out on success.
17926         # For gcc, prefer __inline__, which will still permit 
17927         # cflags.SH to add in -ansi.
17928         case "$gccversion" in
17929                 '') xxx="inline __inline__ __inline _inline";;
17930                 *)  xxx="__inline__ inline __inline _inline";;
17931         esac
17932         for inline in $xxx; do
17933                 set try -DINLINE=$inline a.c
17934                 if eval $compile && $run ./try; then
17935                         # Now make sure there is no external linkage of static
17936                         # functions
17937                         set try -DINLINE=$inline -DUSE_B a.c b.c
17938                         if eval $compile && $run ./try; then
17939                                 $echo "Your compiler supports static $inline, " >&4
17940                                 $echo "but it also creates an external definition," >&4
17941                                 $echo "so I won't use it." >&4
17942                                 val=$undef
17943                         else
17944                                 $echo "Your compiler supports static $inline." >&4
17945                                 val=$define
17946                                 perl_static_inline="static $inline";
17947                                 break;
17948                         fi
17949                 else
17950                         $echo "Your compiler does NOT support static $inline." >&4
17951                         val="$undef"
17952                 fi
17953         done
17954         ;;
17955 *inline*) # Some variant of inline exists.
17956         echo "Keeping your $hint value of $perl_static_inline."
17957         val=$define
17958         ;;
17959 static)  # No inline capabilities
17960         echo "Keeping your $hint value of $perl_static_inline."
17961         val=$undef
17962         ;;
17963 *)  # Unrecognized previous value -- blindly trust the supplied
17964         # value and hope it makes sense.  Use old value for
17965         # d_static_inline, if there is one.
17966         echo "Keeping your $hint value of $perl_static_inline."
17967         case "$d_static_inline" in
17968                 '') val=$define ;;
17969                 *)  val=$d_static_inline ;;
17970         esac
17971         ;;
17972 esac
17973 # Fallback to plain 'static' if nothing worked.
17974 case "$perl_static_inline" in
17975 '')
17976         perl_static_inline="static"
17977         val=$undef
17978         ;;
17979 esac
17980 set d_static_inline
17981 eval $setvar
17982 $rm -f a.[co] b.[co]
17983 $rm_try
17984
17985 : Check stream access
17986 $cat >&4 <<EOM
17987 Checking how to access stdio streams by file descriptor number...
17988 EOM
17989 case "$stdio_stream_array" in
17990 '')     $cat >try.c <<EOCP
17991 #include <stdio.h>
17992 int main() {
17993   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17994     printf("yes\n");
17995 }
17996 EOCP
17997         for s in _iob __iob __sF
17998         do
17999                 set try -DSTDIO_STREAM_ARRAY=$s
18000                 if eval $compile; then
18001                         case "`$run ./try`" in
18002                         yes)    stdio_stream_array=$s; break ;;
18003                         esac
18004                 fi
18005         done
18006         $rm_try
18007 esac
18008 case "$stdio_stream_array" in
18009 '')     $cat >&4 <<EOM
18010 I can't figure out how to access stdio streams by file descriptor number.
18011 EOM
18012         d_stdio_stream_array="$undef"
18013         ;;
18014 *)      $cat >&4 <<EOM
18015 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18016 EOM
18017         d_stdio_stream_array="$define"
18018         ;;
18019 esac
18020
18021 : see if strcoll exists
18022 set strcoll d_strcoll
18023 eval $inlibc
18024
18025 : check for structure copying
18026 echo " "
18027 echo "Checking to see if your C compiler can copy structs..." >&4
18028 $cat >try.c <<'EOCP'
18029 int main()
18030 {
18031         struct blurfl {
18032                 int dyick;
18033         } foo, bar;
18034
18035         foo = bar;
18036 }
18037 EOCP
18038 if $cc -c try.c >/dev/null 2>&1 ; then
18039         val="$define"
18040         echo "Yup, it can."
18041 else
18042         val="$undef"
18043         echo "Nope, it can't."
18044 fi
18045 set d_strctcpy
18046 eval $setvar
18047 $rm_try
18048
18049 : see if strerror and/or sys_errlist[] exist
18050 echo " "
18051 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18052     if set strerror val -f d_strerror; eval $csym; $val; then
18053                 echo 'strerror() found.' >&4
18054                 d_strerror="$define"
18055                 d_strerrm='strerror(e)'
18056                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18057                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18058                         d_syserrlst="$define"
18059                 else
18060                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18061                         d_syserrlst="$undef"
18062                 fi
18063     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18064                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18065                 echo 'strerror() found in string header.' >&4
18066                 d_strerror="$define"
18067                 d_strerrm='strerror(e)'
18068                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18069                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18070                                 d_syserrlst="$define"
18071                 else
18072                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18073                         d_syserrlst="$undef"
18074                 fi
18075     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18076                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18077                 d_strerror="$undef"
18078                 d_syserrlst="$define"
18079                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18080     else
18081                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18082                 d_strerror="$undef"
18083                 d_syserrlst="$undef"
18084                 d_strerrm='"unknown"'
18085     fi
18086 fi
18087
18088 : see if strerror_r exists
18089 set strerror_r d_strerror_r
18090 eval $inlibc
18091 case "$d_strerror_r" in
18092 "$define")
18093         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18094         case "$d_strerror_r_proto:$usethreads" in
18095         ":define")      d_strerror_r_proto=define
18096                 set d_strerror_r_proto strerror_r $hdrs
18097                 eval $hasproto ;;
18098         *)      ;;
18099         esac
18100         case "$d_strerror_r_proto" in
18101         define)
18102         case "$strerror_r_proto" in
18103         ''|0) try='int strerror_r(int, char*, size_t);'
18104         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18105         esac
18106         case "$strerror_r_proto" in
18107         ''|0) try='int strerror_r(int, char*, int);'
18108         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18109         esac
18110         case "$strerror_r_proto" in
18111         ''|0) try='char* strerror_r(int, char*, size_t);'
18112         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18113         esac
18114         case "$strerror_r_proto" in
18115         ''|0)   d_strerror_r=undef
18116                 strerror_r_proto=0
18117                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18118         * )     case "$strerror_r_proto" in
18119                 REENTRANT_PROTO*) ;;
18120                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18121                 esac
18122                 echo "Prototype: $try" ;;
18123         esac
18124         ;;
18125         *)      case "$usethreads" in
18126                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18127                 esac
18128                 d_strerror_r=undef
18129                 strerror_r_proto=0
18130                 ;;
18131         esac
18132         ;;
18133 *)      strerror_r_proto=0
18134         ;;
18135 esac
18136
18137 : see if strftime exists
18138 set strftime d_strftime
18139 eval $inlibc
18140
18141 : see if strlcat exists
18142 set strlcat d_strlcat
18143 eval $inlibc
18144
18145 : see if strlcpy exists
18146 set strlcpy d_strlcpy
18147 eval $inlibc
18148
18149 : see if strtod exists
18150 set strtod d_strtod
18151 eval $inlibc
18152
18153 : see if strtol exists
18154 set strtol d_strtol
18155 eval $inlibc
18156
18157 : see if strtold exists
18158 set strtold d_strtold
18159 eval $inlibc
18160
18161 : see if strtoll exists
18162 set strtoll d_strtoll
18163 eval $inlibc
18164
18165 case "$d_longlong-$d_strtoll" in
18166 "$define-$define")
18167         $cat <<EOM
18168 Checking whether your strtoll() works okay...
18169 EOM
18170         $cat >try.c <<'EOCP'
18171 #include <errno.h>
18172 #ifdef __hpux
18173 #define strtoll __strtoll
18174 #endif
18175 #ifdef __EMX__
18176 #define strtoll _strtoll
18177 #endif
18178 #include <stdio.h>
18179 extern long long int strtoll(char *s, char **, int);
18180 static int bad = 0;
18181 int check(char *s, long long ell, int een) {
18182         long long gll;
18183         errno = 0;
18184         gll = strtoll(s, 0, 10);
18185         if (!((gll == ell) && (errno == een)))
18186                 bad++;
18187 }
18188 int main() {
18189         check(" 1",                                      1LL, 0);
18190         check(" 0",                                      0LL, 0);
18191         check("-1",                                     -1LL, 0);
18192         check("-9223372036854775808", -9223372036854775808LL, 0);
18193         check("-9223372036854775808", -9223372036854775808LL, 0);
18194         check(" 9223372036854775807",  9223372036854775807LL, 0);
18195         check("-9223372036854775808", -9223372036854775808LL, 0);
18196         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18197         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18198         if (!bad)
18199                 printf("ok\n");
18200 }
18201 EOCP
18202         set try
18203         if eval $compile; then
18204                 yyy=`$run ./try`
18205                 case "$yyy" in
18206                 ok) echo "Your strtoll() seems to be working okay." ;;
18207                 *) cat <<EOM >&4
18208 Your strtoll() doesn't seem to be working okay.
18209 EOM
18210                    d_strtoll="$undef"
18211                    ;;
18212                 esac
18213         else
18214                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18215                 d_strtoll="$undef"
18216         fi
18217         ;;
18218 esac
18219
18220 : see if strtoq exists
18221 set strtoq d_strtoq
18222 eval $inlibc
18223
18224 : see if strtoul exists
18225 set strtoul d_strtoul
18226 eval $inlibc
18227
18228 case "$d_strtoul" in
18229 "$define")
18230         $cat <<EOM
18231 Checking whether your strtoul() works okay...
18232 EOM
18233         $cat >try.c <<'EOCP'
18234 #include <errno.h>
18235 #include <stdio.h>
18236 extern unsigned long int strtoul(char *s, char **, int);
18237 static int bad = 0;
18238 void check(char *s, unsigned long eul, int een) {
18239         unsigned long gul;
18240         errno = 0;
18241         gul = strtoul(s, 0, 10);
18242         if (!((gul == eul) && (errno == een)))
18243                 bad++;
18244 }
18245 int main() {
18246         check(" 1", 1L, 0);
18247         check(" 0", 0L, 0);
18248 EOCP
18249         case "$longsize" in
18250         8)
18251             $cat >>try.c <<'EOCP'
18252         check("18446744073709551615", 18446744073709551615UL, 0);
18253         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18254 #if 0 /* strtoul() for /^-/ strings is undefined. */
18255         check("-1", 18446744073709551615UL, 0);
18256         check("-18446744073709551614", 2, 0);
18257         check("-18446744073709551615", 1, 0);
18258         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18259         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18260 #endif
18261 EOCP
18262                 ;;
18263         4)
18264                     $cat >>try.c <<'EOCP'
18265         check("4294967295", 4294967295UL, 0);
18266         check("4294967296", 4294967295UL, ERANGE);
18267 #if 0 /* strtoul() for /^-/ strings is undefined. */
18268         check("-1", 4294967295UL, 0);
18269         check("-4294967294", 2, 0);
18270         check("-4294967295", 1, 0);
18271         check("-4294967296", 4294967295UL, ERANGE);
18272         check("-4294967297", 4294967295UL, ERANGE);
18273 #endif
18274 EOCP
18275                 ;;
18276         *)
18277 : Should we write these tests to be more portable by sprintf-ing
18278 : ~0 and then manipulating that char string as input for strtol?
18279                 ;;
18280         esac
18281         $cat >>try.c <<'EOCP'
18282         if (!bad)
18283                 printf("ok\n");
18284         return 0;
18285 }
18286 EOCP
18287         set try
18288         if eval $compile; then
18289                 case "`$run ./try`" in
18290                 ok) echo "Your strtoul() seems to be working okay." ;;
18291                 *) cat <<EOM >&4
18292 Your strtoul() doesn't seem to be working okay.
18293 EOM
18294                    d_strtoul="$undef"
18295                    ;;
18296                 esac
18297         else
18298                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18299                 d_strtoul="$undef"
18300         fi
18301         ;;
18302 esac
18303
18304 : see if strtoull exists
18305 set strtoull d_strtoull
18306 eval $inlibc
18307
18308 case "$d_longlong-$d_strtoull" in
18309 "$define-$define")
18310         $cat <<EOM
18311 Checking whether your strtoull() works okay...
18312 EOM
18313         $cat >try.c <<'EOCP'
18314 #include <errno.h>
18315 #ifdef __hpux
18316 #define strtoull __strtoull
18317 #endif
18318 #include <stdio.h>
18319 extern unsigned long long int strtoull(char *s, char **, int);
18320 static int bad = 0;
18321 int check(char *s, long long eull, int een) {
18322         long long gull;
18323         errno = 0;
18324         gull = strtoull(s, 0, 10);
18325         if (!((gull == eull) && (errno == een)))
18326                 bad++;
18327 }
18328 int main() {
18329         check(" 1",                                        1LL, 0);
18330         check(" 0",                                        0LL, 0);
18331         check("18446744073709551615",  18446744073709551615ULL, 0);
18332         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18333 #if 0 /* strtoull() for /^-/ strings is undefined. */
18334         check("-1",                    18446744073709551615ULL, 0);
18335         check("-18446744073709551614",                     2LL, 0);
18336         check("-18446744073709551615",                     1LL, 0);
18337         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18338         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18339 #endif
18340         if (!bad)
18341                 printf("ok\n");
18342 }
18343 EOCP
18344         set try
18345         if eval $compile; then
18346                 case "`$run ./try`" in
18347                 ok) echo "Your strtoull() seems to be working okay." ;;
18348                 *) cat <<EOM >&4
18349 Your strtoull() doesn't seem to be working okay.
18350 EOM
18351                    d_strtoull="$undef"
18352                    ;;
18353                 esac
18354         else
18355                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18356                 d_strtoull="$undef"
18357         fi
18358         ;;
18359 esac
18360
18361 : see if strtouq exists
18362 set strtouq d_strtouq
18363 eval $inlibc
18364
18365 case "$d_strtouq" in
18366 "$define")
18367         $cat <<EOM
18368 Checking whether your strtouq() works okay...
18369 EOM
18370         $cat >try.c <<'EOCP'
18371 #include <errno.h>
18372 #include <stdio.h>
18373 extern unsigned long long int strtouq(char *s, char **, int);
18374 static int bad = 0;
18375 void check(char *s, unsigned long long eull, int een) {
18376         unsigned long long gull;
18377         errno = 0;
18378         gull = strtouq(s, 0, 10);
18379         if (!((gull == eull) && (errno == een)))
18380                 bad++;
18381 }
18382 int main() {
18383         check(" 1",                                        1LL, 0);
18384         check(" 0",                                        0LL, 0);
18385         check("18446744073709551615",  18446744073709551615ULL, 0);
18386         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18387 #if 0 /* strtouq() for /^-/ strings is undefined. */
18388         check("-1",                    18446744073709551615ULL, 0);
18389         check("-18446744073709551614",                     2LL, 0);
18390         check("-18446744073709551615",                     1LL, 0);
18391         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18392         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18393 #endif
18394         if (!bad)
18395                 printf("ok\n");
18396         return 0;
18397 }
18398 EOCP
18399         set try
18400         if eval $compile; then
18401                 case "`$run ./try`" in
18402                 ok) echo "Your strtouq() seems to be working okay." ;;
18403                 *) cat <<EOM >&4
18404 Your strtouq() doesn't seem to be working okay.
18405 EOM
18406                    d_strtouq="$undef"
18407                    ;;
18408                 esac
18409         else
18410                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18411                 d_strtouq="$undef"
18412         fi
18413         ;;
18414 esac
18415
18416 : see if strxfrm exists
18417 set strxfrm d_strxfrm
18418 eval $inlibc
18419
18420 : see if symlink exists
18421 set symlink d_symlink
18422 eval $inlibc
18423
18424 : see if syscall exists
18425 set syscall d_syscall
18426 eval $inlibc
18427
18428 : see if prototype for syscall is available
18429 echo " "
18430 set d_syscallproto syscall $i_unistd unistd.h
18431 eval $hasproto
18432
18433 : see if sysconf exists
18434 set sysconf d_sysconf
18435 eval $inlibc
18436
18437 : see if system exists
18438 set system d_system
18439 eval $inlibc
18440
18441 : see if tcgetpgrp exists
18442 set tcgetpgrp d_tcgetpgrp
18443 eval $inlibc
18444
18445 : see if tcsetpgrp exists
18446 set tcsetpgrp d_tcsetpgrp
18447 eval $inlibc
18448
18449 : see if prototype for telldir is available
18450 echo " "
18451 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18452 eval $hasproto
18453
18454 : see if time exists
18455 echo " "
18456 if test "X$d_time" = X -o X"$timetype" = X; then
18457     if set time val -f d_time; eval $csym; $val; then
18458                 echo 'time() found.' >&4
18459                 val="$define"
18460                 rp="What is the type returned by time() on this system?"
18461                 set time_t timetype long stdio.h sys/types.h
18462                 eval $typedef_ask
18463     else
18464                 echo 'time() not found, hope that will do.' >&4
18465                 val="$undef"
18466                 timetype='int';
18467     fi
18468     set d_time
18469     eval $setvar
18470 fi
18471
18472 : see if timegm exists
18473 set timegm d_timegm
18474 eval $inlibc
18475
18476 : see if this is a sys/times.h system
18477 set sys/times.h i_systimes
18478 eval $inhdr
18479
18480 : see if times exists
18481 echo " "
18482 if set times val -f d_times; eval $csym; $val; then
18483         echo 'times() found.' >&4
18484         d_times="$define"
18485         inc=''
18486         case "$i_systimes" in
18487         "$define") inc='sys/times.h';;
18488         esac
18489         rp="What is the type returned by times() on this system?"
18490         set clock_t clocktype long stdio.h sys/types.h $inc
18491         eval $typedef_ask
18492 else
18493         echo 'times() NOT found, hope that will do.' >&4
18494         d_times="$undef"
18495         clocktype='int'
18496 fi
18497
18498 : see if tmpnam_r exists
18499 set tmpnam_r d_tmpnam_r
18500 eval $inlibc
18501 case "$d_tmpnam_r" in
18502 "$define")
18503         hdrs="$i_systypes sys/types.h define stdio.h "
18504         case "$d_tmpnam_r_proto:$usethreads" in
18505         ":define")      d_tmpnam_r_proto=define
18506                 set d_tmpnam_r_proto tmpnam_r $hdrs
18507                 eval $hasproto ;;
18508         *)      ;;
18509         esac
18510         case "$d_tmpnam_r_proto" in
18511         define)
18512         case "$tmpnam_r_proto" in
18513         ''|0) try='char* tmpnam_r(char*);'
18514         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18515         esac
18516         case "$tmpnam_r_proto" in
18517         ''|0)   d_tmpnam_r=undef
18518                 tmpnam_r_proto=0
18519                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18520         * )     case "$tmpnam_r_proto" in
18521                 REENTRANT_PROTO*) ;;
18522                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18523                 esac
18524                 echo "Prototype: $try" ;;
18525         esac
18526         ;;
18527         *)      case "$usethreads" in
18528                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18529                 esac
18530                 d_tmpnam_r=undef
18531                 tmpnam_r_proto=0
18532                 ;;
18533         esac
18534         ;;
18535 *)      tmpnam_r_proto=0
18536         ;;
18537 esac
18538
18539 : see if truncate exists
18540 set truncate d_truncate
18541 eval $inlibc
18542
18543 : see if ttyname_r exists
18544 set ttyname_r d_ttyname_r
18545 eval $inlibc
18546 case "$d_ttyname_r" in
18547 "$define")
18548         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18549         case "$d_ttyname_r_proto:$usethreads" in
18550         ":define")      d_ttyname_r_proto=define
18551                 set d_ttyname_r_proto ttyname_r $hdrs
18552                 eval $hasproto ;;
18553         *)      ;;
18554         esac
18555         case "$d_ttyname_r_proto" in
18556         define)
18557         case "$ttyname_r_proto" in
18558         ''|0) try='int ttyname_r(int, char*, size_t);'
18559         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18560         esac
18561         case "$ttyname_r_proto" in
18562         ''|0) try='int ttyname_r(int, char*, int);'
18563         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18564         esac
18565         case "$ttyname_r_proto" in
18566         ''|0) try='char* ttyname_r(int, char*, int);'
18567         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18568         esac
18569         case "$ttyname_r_proto" in
18570         ''|0)   d_ttyname_r=undef
18571                 ttyname_r_proto=0
18572                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18573         * )     case "$ttyname_r_proto" in
18574                 REENTRANT_PROTO*) ;;
18575                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18576                 esac
18577                 echo "Prototype: $try" ;;
18578         esac
18579         ;;
18580         *)      case "$usethreads" in
18581                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18582                 esac
18583                 d_ttyname_r=undef
18584                 ttyname_r_proto=0
18585                 ;;
18586         esac
18587         ;;
18588 *)      ttyname_r_proto=0
18589         ;;
18590 esac
18591
18592 : see if tzname[] exists
18593 echo " "
18594 if set tzname val -a d_tzname; eval $csym; $val; then
18595         val="$define"
18596         echo 'tzname[] found.' >&4
18597 else
18598         val="$undef"
18599         echo 'tzname[] NOT found.' >&4
18600 fi
18601 set d_tzname
18602 eval $setvar
18603
18604 : Check if is a multiplatform env
18605 case "$osname" in
18606 next|rhapsody|darwin) multiarch="$define" ;;
18607 esac
18608 case "$multiarch" in
18609 ''|[nN]*) multiarch="$undef" ;;
18610 esac
18611
18612 : check for ordering of bytes in a UV
18613 echo " "
18614 case "$usecrosscompile$multiarch" in
18615 *$define*)
18616         $cat <<EOM
18617 You seem to be either cross-compiling or doing a multiarchitecture build,
18618 skipping the byteorder check.
18619
18620 EOM
18621         byteorder='ffff'
18622         ;;
18623 *)
18624         case "$byteorder" in
18625         '')
18626                 $cat <<'EOM'
18627 In the following, larger digits indicate more significance.  A big-endian
18628 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18629 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18630 machines may have weird orders like 3412.  A Cray will report 87654321,
18631 an Alpha will report 12345678. If the test program works the default is
18632 probably right.
18633 I'm now running the test program...
18634 EOM
18635                 $cat >try.c <<EOCP
18636 #include <stdio.h>
18637 #$i_stdlib I_STDLIB
18638 #ifdef I_STDLIB
18639 #include <stdlib.h>
18640 #endif
18641 #include <sys/types.h>
18642 typedef $uvtype UV;
18643 int main()
18644 {
18645         int i;
18646         union {
18647                 UV l;
18648                 char c[$uvsize];
18649         } u;
18650
18651         if ($uvsize > 4)
18652                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18653         else
18654                 u.l = (UV)0x04030201;
18655         for (i = 0; i < $uvsize; i++)
18656                 printf("%c", u.c[i]+'0');
18657         printf("\n");
18658         exit(0);
18659 }
18660 EOCP
18661                 xxx_prompt=y
18662                 set try
18663                 if eval $compile && $run ./try > /dev/null; then
18664                         dflt=`$run ./try`
18665                         case "$dflt" in
18666                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18667                                 echo "(The test program ran ok.)"
18668                                 echo "byteorder=$dflt"
18669                                 xxx_prompt=n
18670                         ;;
18671                         ????|????????) echo "(The test program ran ok.)" ;;
18672                         *) echo "(The test program didn't run right for some reason.)" ;;
18673                         esac
18674                 else
18675                         dflt='4321'
18676                         cat <<'EOM'
18677 (I can't seem to compile the test program.  Guessing big-endian...)
18678 EOM
18679                 fi
18680                 case "$xxx_prompt" in
18681                 y)
18682                         rp="What is the order of bytes in $uvtype?"
18683                         . ./myread
18684                         byteorder="$ans"
18685                         ;;
18686                 *)      byteorder=$dflt
18687                         ;;
18688                 esac
18689                 ;;
18690         esac
18691         $rm_try
18692         ;;
18693 esac
18694
18695 : Checking 32bit aligndness
18696 $cat <<EOM
18697
18698 Checking to see whether you can access character data unalignedly...
18699 EOM
18700 case "$d_u32align" in
18701 '')   $cat >try.c <<EOCP
18702 #include <stdio.h>
18703 #$i_stdlib I_STDLIB
18704 #ifdef I_STDLIB
18705 #include <stdlib.h>
18706 #endif
18707 #define U32 $u32type
18708 #define BYTEORDER 0x$byteorder
18709 #define U8 $u8type
18710 #include <signal.h>
18711 #ifdef SIGBUS
18712 $signal_t bletch(int s) { exit(4); }
18713 #endif
18714 int main() {
18715 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18716     volatile U8 buf[8];
18717     volatile U32 *up;
18718     int i;
18719
18720     if (sizeof(U32) != 4) {
18721         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18722         exit(1);
18723     }
18724
18725     fflush(stdout);
18726
18727 #ifdef SIGBUS
18728     signal(SIGBUS, bletch);
18729 #endif
18730
18731     buf[0] = 0;
18732     buf[1] = 0;
18733     buf[2] = 0;
18734     buf[3] = 1;
18735     buf[4] = 0;
18736     buf[5] = 0;
18737     buf[6] = 0;
18738     buf[7] = 1;
18739
18740     for (i = 0; i < 4; i++) {
18741         up = (U32*)(buf + i);
18742         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18743                (*up == 1 << (8*(3-i)))  /* little-endian */
18744               )
18745            )
18746         {
18747             printf("read failed (%x)\n", *up);
18748             exit(2);
18749         }
18750     }
18751
18752     /* write test */
18753     for (i = 0; i < 4; i++) {
18754         up = (U32*)(buf + i);
18755         *up = 0xBeef;
18756         if (*up != 0xBeef) {
18757             printf("write failed (%x)\n", *up);
18758             exit(3);
18759         }
18760     }
18761
18762     exit(0);
18763 #else
18764     printf("1\n");
18765     exit(1);
18766 #endif
18767     return 0;
18768 }
18769 EOCP
18770 set try
18771 if eval $compile_ok; then
18772         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18773         $run ./try 2>&1 >/dev/null
18774         case "$?" in
18775         0)      cat >&4 <<EOM
18776 You can access character data pretty unalignedly.
18777 EOM
18778                 d_u32align="$undef"
18779                 ;;
18780         *)      cat >&4 <<EOM
18781 It seems that you must access character data in an aligned manner.
18782 EOM
18783                 d_u32align="$define"
18784                 ;;
18785         esac
18786 else
18787         rp='Can you access character data at unaligned addresses?'
18788         dflt='n'
18789         . ./myread
18790         case "$ans" in
18791         [yY]*)  d_u32align="$undef"  ;;
18792         *)      d_u32align="$define" ;;
18793         esac
18794 fi
18795 $rm_try
18796 ;;
18797 esac
18798
18799 : see if ualarm exists
18800 set ualarm d_ualarm
18801 eval $inlibc
18802
18803 : see if umask exists
18804 set umask d_umask
18805 eval $inlibc
18806
18807 : see if unordered exists
18808 set unordered d_unordered
18809 eval $inlibc
18810
18811 : see if unsetenv exists
18812 set unsetenv d_unsetenv
18813 eval $inlibc
18814
18815 : see if usleep exists
18816 set usleep d_usleep
18817 eval $inlibc
18818
18819 : see if prototype for usleep is available
18820 echo " "
18821 set d_usleepproto usleep $i_unistd unistd.h
18822 eval $hasproto
18823
18824 : see if ustat exists
18825 set ustat d_ustat
18826 eval $inlibc
18827
18828 : see if closedir exists
18829 set closedir d_closedir
18830 eval $inlibc
18831
18832 case "$d_closedir" in
18833 "$define")
18834         echo " "
18835         echo "Checking whether closedir() returns a status..." >&4
18836         cat > try.c <<EOM
18837 #$i_dirent I_DIRENT             /**/
18838 #$i_sysdir I_SYS_DIR            /**/
18839 #$i_sysndir I_SYS_NDIR          /**/
18840 #$i_systypes I_SYS_TYPES        /**/
18841
18842 #if defined(I_SYS_TYPES)
18843 #include <sys/types.h>
18844 #endif
18845 #if defined(I_DIRENT)
18846 #include <dirent.h>
18847 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18848 #include <sys/dir.h>
18849 #endif
18850 #else
18851 #ifdef I_SYS_NDIR
18852 #include <sys/ndir.h>
18853 #else
18854 #ifdef I_SYS_DIR
18855 #ifdef hp9000s500
18856 #include <ndir.h>       /* may be wrong in the future */
18857 #else
18858 #include <sys/dir.h>
18859 #endif
18860 #endif
18861 #endif
18862 #endif
18863 int main() { return closedir(opendir(".")); }
18864 EOM
18865         set try
18866         if eval $compile_ok; then
18867                 if $run ./try > /dev/null 2>&1 ; then
18868                         echo "Yes, it does."
18869                         val="$undef"
18870                 else
18871                         echo "No, it doesn't."
18872                         val="$define"
18873                 fi
18874         else
18875                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18876                 val="$define"
18877         fi
18878         ;;
18879 *)
18880         val="$undef";
18881         ;;
18882 esac
18883 set d_void_closedir
18884 eval $setvar
18885 $rm_try
18886
18887 : see if there is a wait4
18888 set wait4 d_wait4
18889 eval $inlibc
18890
18891 : see if waitpid exists
18892 set waitpid d_waitpid
18893 eval $inlibc
18894
18895 : see if wcstombs exists
18896 set wcstombs d_wcstombs
18897 eval $inlibc
18898
18899 : see if wctomb exists
18900 set wctomb d_wctomb
18901 eval $inlibc
18902
18903 : see if writev exists
18904 set writev d_writev
18905 eval $inlibc
18906
18907 : preserve RCS keywords in files with variable substitution, grrr
18908 Date='$Date'
18909 Id='$Id'
18910 Log='$Log'
18911 RCSfile='$RCSfile'
18912 Revision='$Revision'
18913
18914 : check for alignment requirements
18915 echo " "
18916 case "$usecrosscompile$multiarch" in
18917 *$define*)
18918         $cat <<EOM
18919 You seem to be either cross-compiling or doing a multiarchitecture build,
18920 skipping the memory alignment check.
18921
18922 EOM
18923         case "$alignbytes" in
18924         '') alignbytes=8 ;;
18925         esac
18926         ;;
18927 *)
18928         case "$alignbytes" in
18929         '') echo "Checking alignment constraints..." >&4
18930                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18931                         $cat >try.c <<'EOCP'
18932 typedef long double NV;
18933 EOCP
18934                 else
18935                         $cat >try.c <<'EOCP'
18936 typedef double NV;
18937 EOCP
18938                 fi
18939                 $cat >>try.c <<'EOCP'
18940 #include <stdio.h>
18941 struct foobar {
18942         char foo;
18943         NV bar;
18944 } try_algn;
18945 int main()
18946 {
18947     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18948     return(0);
18949 }
18950 EOCP
18951                 set try
18952                 if eval $compile_ok; then
18953                         dflt=`$run ./try`
18954                 else
18955                         dflt='8'
18956                         echo "(I can't seem to compile the test program...)"
18957                 fi
18958                 ;;
18959         *) dflt="$alignbytes"
18960                 ;;
18961         esac
18962         rp="Doubles must be aligned on a how-many-byte boundary?"
18963         . ./myread
18964         alignbytes="$ans"
18965         $rm_try
18966         ;;
18967 esac
18968
18969
18970 : set the base revision
18971 baserev=5.0
18972
18973 : length of character in bytes. Is always 1, otherwise it isnt C
18974 : This used to be a test using sizeof
18975 charsize=1
18976
18977 : Check for the number of bits in a character
18978 case "$charbits" in
18979 '')     echo "Checking how long a character is (in bits)..." >&4
18980         $cat >try.c <<EOCP
18981 #include <stdio.h>
18982 int main ()
18983 {
18984     int n;
18985     unsigned char c;
18986     for (c = 1, n = 0; c; c <<= 1, n++) ;
18987     printf ("%d\n", n);
18988     return (0);
18989     }
18990 EOCP
18991         set try
18992         if eval $compile_ok; then
18993                 dflt=`$run ./try`
18994         else
18995                 dflt='8'
18996                 echo "(I can't seem to compile the test program.  Guessing...)"
18997         fi
18998         ;;
18999 *)
19000         dflt="$charbits"
19001         ;;
19002 esac
19003 rp="What is the length of a character (in bits)?"
19004 . ./myread
19005 charbits="$ans"
19006 $rm_try
19007 case "$charbits" in
19008 8)      ;;
19009 *)      cat >&4 << EOM
19010 Your system has an unsigned character size of $charbits bits, which
19011 is rather unusual (normally it is 8 bits).  Perl likely will not work
19012 correctly on your system, with subtle bugs in various places.
19013 EOM
19014         rp='Do you really want to continue?'
19015         dflt='n'
19016         . ./myread
19017         case "$ans" in
19018                 [yY])   echo >&4 "Okay, continuing."    ;;
19019                 *)      exit 1                          ;;
19020         esac
19021 esac
19022
19023 : how do we concatenate cpp tokens here?
19024 echo " "
19025 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19026 $cat >cpp_stuff.c <<'EOCP'
19027 #define RCAT(a,b)a/**/b
19028 #define ACAT(a,b)a ## b
19029 RCAT(Rei,ser)
19030 ACAT(Cir,cus)
19031 EOCP
19032 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19033 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19034         echo "Oh!  Smells like ANSI's been here." >&4
19035         echo "We can catify or stringify, separately or together!"
19036         cpp_stuff=42
19037 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19038         echo "Ah, yes!  The good old days!" >&4
19039         echo "However, in the good old days we don't know how to stringify and"
19040         echo "catify at the same time."
19041         cpp_stuff=1
19042 else
19043         $cat >&4 <<EOM
19044 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19045 You're going to have to edit the values of CAT[2-5] in config.h...
19046 EOM
19047         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19048 fi
19049 $rm -f cpp_stuff.*
19050
19051 : see if this is a db.h system
19052 set db.h i_db
19053 eval $inhdr
19054
19055 case "$i_db" in
19056 $define)
19057         : Check db version.
19058         echo " "
19059         echo "Checking Berkeley DB version ..." >&4
19060         $cat >try.c <<EOCP
19061 #$d_const HASCONST
19062 #ifndef HASCONST
19063 #define const
19064 #endif
19065 #include <sys/types.h>
19066 #include <stdio.h>
19067 #$i_stdlib I_STDLIB
19068 #ifdef I_STDLIB
19069 #include <stdlib.h>
19070 #endif
19071 #include <db.h>
19072 int main(int argc, char *argv[])
19073 {
19074 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19075     int Major, Minor, Patch ;
19076     unsigned long Version ;
19077     (void)db_version(&Major, &Minor, &Patch) ;
19078     if (argc == 2) {
19079         printf("%d %d %d %d %d %d\n",
19080                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19081                Major, Minor, Patch);
19082         exit(0);
19083     }
19084     printf("You have Berkeley DB Version 2 or greater.\n");
19085
19086     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19087                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19088     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19089                 Major, Minor, Patch) ;
19090
19091     /* check that db.h & libdb are compatible */
19092     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19093         printf("db.h and libdb are incompatible.\n") ;
19094         exit(3);
19095     }
19096
19097     printf("db.h and libdb are compatible.\n") ;
19098
19099     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19100                 + DB_VERSION_PATCH ;
19101
19102     /* needs to be >= 2.3.4 */
19103     if (Version < 2003004) {
19104     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19105         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19106         exit(2);
19107     }
19108
19109     exit(0);
19110 #else
19111 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19112     if (argc == 2) {
19113         printf("1 0 0\n");
19114         exit(0);
19115     }
19116     printf("You have Berkeley DB Version 1.\n");
19117     exit(0);    /* DB version < 2: the coast is clear. */
19118 #else
19119     exit(1);    /* <db.h> not Berkeley DB? */
19120 #endif
19121 #endif
19122 }
19123 EOCP
19124         set try
19125         if eval $compile_ok && $run ./try; then
19126                 echo 'Looks OK.' >&4
19127                 set `$run ./try 1`
19128                 db_version_major=$1
19129                 db_version_minor=$2
19130                 db_version_patch=$3
19131         else
19132                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19133                 i_db=$undef
19134                 case " $libs " in
19135                 *"-ldb "*)
19136                         : Remove db from list of libraries to use
19137                         echo "Removing unusable -ldb from library list" >&4
19138                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19139                         shift
19140                         libs="$*"
19141                         echo "libs = $libs" >&4
19142                         ;;
19143                 esac
19144         fi
19145         $rm_try
19146         ;;
19147 esac
19148
19149 case "$i_db" in
19150 define)
19151         : Check the return type needed for hash
19152         echo " "
19153         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19154         $cat >try.c <<EOCP
19155 #$d_const HASCONST
19156 #ifndef HASCONST
19157 #define const
19158 #endif
19159 #include <sys/types.h>
19160 #include <db.h>
19161
19162 #ifndef DB_VERSION_MAJOR
19163 u_int32_t hash_cb (ptr, size)
19164 const void *ptr;
19165 size_t size;
19166 {
19167 }
19168 HASHINFO info;
19169 int main()
19170 {
19171         info.hash = hash_cb;
19172 }
19173 #endif
19174 EOCP
19175         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19176                 if $contains warning try.out >>/dev/null 2>&1 ; then
19177                         db_hashtype='int'
19178                 else
19179                         db_hashtype='u_int32_t'
19180                 fi
19181         else
19182                 : XXX Maybe we should just give up here.
19183                 db_hashtype=u_int32_t
19184                 $cat try.out >&4
19185                 echo "Help:  I can't seem to compile the db test program." >&4
19186                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19187         fi
19188         $rm_try
19189         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19190         ;;
19191 *)      db_hashtype=u_int32_t
19192         ;;
19193 esac
19194 case "$i_db" in
19195 define)
19196         : Check the return type needed for prefix
19197         echo " "
19198         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19199         cat >try.c <<EOCP
19200 #$d_const HASCONST
19201 #ifndef HASCONST
19202 #define const
19203 #endif
19204 #include <sys/types.h>
19205 #include <db.h>
19206
19207 #ifndef DB_VERSION_MAJOR
19208 size_t prefix_cb (key1, key2)
19209 const DBT *key1;
19210 const DBT *key2;
19211 {
19212 }
19213 BTREEINFO info;
19214 int main()
19215 {
19216         info.prefix = prefix_cb;
19217 }
19218 #endif
19219 EOCP
19220         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19221                 if $contains warning try.out >>/dev/null 2>&1 ; then
19222                         db_prefixtype='int'
19223                 else
19224                         db_prefixtype='size_t'
19225                 fi
19226         else
19227                 db_prefixtype='size_t'
19228                 : XXX Maybe we should just give up here.
19229                 $cat try.out >&4
19230                 echo "Help:  I can't seem to compile the db test program." >&4
19231                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19232         fi
19233         $rm_try
19234         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19235         ;;
19236 *)      db_prefixtype='size_t'
19237         ;;
19238 esac
19239
19240 : How can we generate normalized random numbers ?
19241 echo " "
19242 echo "Looking for a random number function..." >&4
19243 case "$randfunc" in
19244 '')
19245         if set drand48 val -f; eval $csym; $val; then
19246                 dflt="drand48"
19247                 echo "Good, found drand48()." >&4
19248         elif set random val -f; eval $csym; $val; then
19249                 dflt="random"
19250                 echo "OK, found random()." >&4
19251         else
19252                 dflt="rand"
19253                 echo "Yick, looks like I have to use rand()." >&4
19254         fi
19255         echo " "
19256         ;;
19257 *)
19258         dflt="$randfunc"
19259         ;;
19260 esac
19261 cont=true
19262
19263 case "$ccflags" in
19264 *-Dmy_rand=*|*-Dmy_srand=*)
19265         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19266         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19267         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19268         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19269         ;;
19270 esac
19271
19272 while $test "$cont"; do
19273         rp="Use which function to generate random numbers?"
19274         . ./myread
19275         if $test "$ans" = "$dflt"; then
19276                 : null
19277         else
19278                 randbits=''
19279         fi
19280         randfunc="$ans"
19281         if set $ans val -f; eval $csym; $val; then
19282                 cont=''
19283         else
19284                 dflt=y
19285                 rp="I cannot find function $ans. Use that name anyway?"
19286                 . ./myread
19287                 dflt=rand
19288                 case "$ans" in
19289                         [yY]*) cont='';;
19290                 esac
19291         fi
19292         case "$cont" in
19293         '')
19294                 case "$randfunc" in
19295                 drand48)
19296                         drand01="drand48()"
19297                         seedfunc="srand48"
19298                         randbits=48
19299                         randseedtype=long
19300                         ;;
19301                 rand|random)
19302                         case "$randbits" in
19303                         '')
19304 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19305                                 $cat >try.c <<EOCP
19306 #$i_unistd I_UNISTD
19307 #$i_stdlib I_STDLIB
19308 #include <stdio.h>
19309 #ifdef I_UNISTD
19310 #  include <unistd.h>
19311 #endif
19312 #ifdef I_STDLIB
19313 #  include <stdlib.h>
19314 #endif
19315 int main()
19316 {
19317         register int i;
19318         register unsigned long tmp;
19319         register unsigned long max = 0L;
19320
19321         for (i = 1000; i; i--) {
19322                 tmp = (unsigned long) $randfunc();
19323                 if (tmp > max) max = tmp;
19324         }
19325         for (i = 0; max; i++)
19326                 max /= 2;
19327         printf("%d\n",i);
19328 }
19329 EOCP
19330                                 set try
19331                                 if eval $compile_ok; then
19332                                         dflt=`try`
19333                                 else
19334                                         dflt='?'
19335                                         echo "(I can't seem to compile the test program...)"
19336                                 fi
19337                                 ;;
19338                         *)
19339                                 dflt="$randbits"
19340                                 ;;
19341                         esac
19342                         rp="How many bits does your $randfunc() function produce?"
19343                         . ./myread
19344                         randbits="$ans"
19345                         $rm_try
19346                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19347                         seedfunc="s$randfunc"
19348                         randseedtype=unsigned
19349                         ;;
19350                 *)
19351                         dflt="31"
19352                         rp="How many bits does your $randfunc() function produce?"
19353                         . ./myread
19354                         randbits="$ans"
19355                         seedfunc="s$randfunc"
19356                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19357                         if set $seedfunc val -f; eval $csym; $val; then
19358                                 echo "(Using $seedfunc() to seed random generator)"
19359                         else
19360                                 echo "(Warning: no $seedfunc() to seed random generator)"
19361                                 seedfunc=rand
19362                         fi
19363                         randseedtype=unsigned
19364                         ;;
19365                 esac
19366                 ;;
19367         esac
19368 done
19369
19370 : Determine if this is an EBCDIC system
19371 echo " "
19372 echo "Determining whether or not we are on an EBCDIC system..." >&4
19373 $cat >try.c <<'EOM'
19374 int main()
19375 {
19376   if ('M'==0xd4) return 0;
19377   return 1;
19378 }
19379 EOM
19380
19381 val=$undef
19382 set try
19383 if eval $compile_ok; then
19384         if $run ./try; then
19385                 echo "You seem to speak EBCDIC." >&4
19386                 val="$define"
19387         else
19388                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19389         fi
19390 else
19391         echo "I'm unable to compile the test program." >&4
19392         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19393 fi
19394 $rm_try
19395 set ebcdic
19396 eval $setvar
19397
19398 : Check how to flush
19399 echo " "
19400 $cat >&4 <<EOM
19401 Checking how to flush all pending stdio output...
19402 EOM
19403 # I only know how to find the first 32 possibly open files on SunOS.
19404 # See also hints/sunos_4_1.sh and util.c  --AD
19405 case "$osname" in
19406 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19407 esac
19408 $cat >>try.c <<EOCP
19409 #include <stdio.h>
19410 #$i_stdlib I_STDLIB
19411 #ifdef I_STDLIB
19412 #include <stdlib.h>
19413 #endif
19414 #$i_unistd I_UNISTD
19415 #ifdef I_UNISTD
19416 # include <unistd.h>
19417 #endif
19418 #$d_sysconf HAS_SYSCONF
19419 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19420 #ifdef HAS_STDIO_STREAM_ARRAY
19421 # define STDIO_STREAM_ARRAY $stdio_stream_array
19422 #endif
19423 int main() {
19424   FILE* p;
19425   unlink("try.out");
19426   p = fopen("try.out", "w");
19427 #ifdef TRY_FPUTC
19428   fputc('x', p);
19429 #else
19430 # ifdef TRY_FPRINTF
19431   fprintf(p, "x");
19432 # endif
19433 #endif
19434 #ifdef TRY_FFLUSH_NULL
19435   fflush(NULL);
19436 #endif
19437 #ifdef TRY_FFLUSH_ALL
19438   {
19439     long open_max = -1;
19440 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19441     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19442 # else
19443 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19444     open_max = sysconf(_SC_OPEN_MAX);
19445 #  else
19446 #   ifdef FOPEN_MAX
19447     open_max = FOPEN_MAX;
19448 #   else
19449 #    ifdef OPEN_MAX
19450     open_max = OPEN_MAX;
19451 #    else
19452 #     ifdef _NFILE
19453     open_max = _NFILE;
19454 #     endif
19455 #    endif
19456 #   endif
19457 #  endif
19458 # endif
19459 # ifdef HAS_STDIO_STREAM_ARRAY
19460     if (open_max > 0) {
19461       long i;
19462       for (i = 0; i < open_max; i++)
19463             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19464                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19465                 STDIO_STREAM_ARRAY[i]._flag)
19466                 fflush(&STDIO_STREAM_ARRAY[i]);
19467     }
19468   }
19469 # endif
19470 #endif
19471   _exit(42);
19472 }
19473 EOCP
19474 : first we have to find out how _not_ to flush
19475 $to try.c
19476 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19477     output=''
19478     set try -DTRY_FPUTC
19479     if eval $compile; then
19480             $run ./try 2>/dev/null
19481             code="$?"
19482             $from try.out
19483             if $test ! -s try.out -a "X$code" = X42; then
19484                 output=-DTRY_FPUTC
19485             fi
19486     fi
19487     case "$output" in
19488     '')
19489             set try -DTRY_FPRINTF
19490             if eval $compile; then
19491                     $run ./try 2>/dev/null
19492                     code="$?"
19493                     $from try.out
19494                     if $test ! -s try.out -a "X$code" = X42; then
19495                         output=-DTRY_FPRINTF
19496                     fi
19497             fi
19498         ;;
19499     esac
19500 fi
19501 : check for fflush NULL behaviour
19502 case "$fflushNULL" in
19503 '')     set try -DTRY_FFLUSH_NULL $output
19504         if eval $compile; then
19505                 $run ./try 2>/dev/null
19506                 code="$?"
19507                 $from try.out
19508                 if $test -s try.out -a "X$code" = X42; then
19509                         fflushNULL="`$cat try.out`"
19510                 else
19511                         if $test "X$code" != X42; then
19512                                 $cat >&4 <<EOM
19513 (If this test failed, don't worry, we'll try another method shortly.)
19514 EOM
19515                         fi
19516                 fi
19517         fi
19518         $rm -f core try.core core.try.*
19519         case "$fflushNULL" in
19520         x)      $cat >&4 <<EOM
19521 Your fflush(NULL) works okay for output streams.
19522 Let's see if it clobbers input pipes...
19523 EOM
19524 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19525 # bug that improperly flushes the input end of pipes.  So we avoid the
19526 # autoflush on fork/system/exec support for now. :-(
19527 $cat >tryp.c <<EOCP
19528 #include <stdio.h>
19529 int
19530 main(int argc, char **argv)
19531 {
19532     char buf[1024];
19533     int i;
19534     char *bp = buf;
19535     while (1) {
19536         while ((i = getc(stdin)) != -1
19537                && (*bp++ = i) != '\n'
19538                && bp < &buf[1024])
19539         /* DO NOTHING */ ;
19540         *bp = '\0';
19541         fprintf(stdout, "%s", buf);
19542         fflush(NULL);
19543         if (i == -1)
19544             return 0;
19545         bp = buf;
19546     }
19547 }
19548 EOCP
19549                 fflushNULL="$define"
19550                 set tryp
19551                 if eval $compile; then
19552                     $rm -f tryp.out
19553                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19554                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19555                        $cat >&4 <<EOM
19556 fflush(NULL) seems to behave okay with input streams.
19557 EOM
19558                         fflushNULL="$define"
19559                     else
19560                         $cat >&4 <<EOM
19561 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19562 EOM
19563                         fflushNULL="$undef"
19564                     fi
19565                 fi
19566                 $rm -f core tryp.c tryp.core core.tryp.*
19567                 ;;
19568         '')     $cat >&4 <<EOM
19569 Your fflush(NULL) isn't working (contrary to ANSI C).
19570 EOM
19571                 fflushNULL="$undef"
19572                 ;;
19573         *)      $cat >&4 <<EOM
19574 Cannot figure out whether your fflush(NULL) works or not.
19575 I'm assuming it doesn't (contrary to ANSI C).
19576 EOM
19577                 fflushNULL="$undef"
19578                 ;;
19579         esac
19580         ;;
19581 $define|true|[yY]*)
19582         fflushNULL="$define"
19583         ;;
19584 *)
19585         fflushNULL="$undef"
19586         ;;
19587 esac
19588 : check explicit looping only if NULL did not work, and if the pipe
19589 : bug does not show up on an explicit flush too
19590 case "$fflushNULL" in
19591 "$undef")
19592         $cat >tryp.c <<EOCP
19593 #include <stdio.h>
19594 int
19595 main(int argc, char **argv)
19596 {
19597     char buf[1024];
19598     int i;
19599     char *bp = buf;
19600     while (1) {
19601         while ((i = getc(stdin)) != -1
19602                && (*bp++ = i) != '\n'
19603                && bp < &buf[1024])
19604         /* DO NOTHING */ ;
19605         *bp = '\0';
19606         fprintf(stdout, "%s", buf);
19607         fflush(stdin);
19608         if (i == -1)
19609             return 0;
19610         bp = buf;
19611     }
19612 }
19613 EOCP
19614         set tryp
19615         if eval $compile; then
19616             $rm -f tryp.out
19617             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19618             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19619                $cat >&4 <<EOM
19620 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19621 EOM
19622                 : now check for fflushall behaviour
19623                 case "$fflushall" in
19624                 '')     set try -DTRY_FFLUSH_ALL $output
19625                         if eval $compile; then
19626                                 $cat >&4 <<EOM
19627 (Now testing the other method--but note that this also may fail.)
19628 EOM
19629                                 $run ./try 2>/dev/null
19630                                 code=$?
19631                                 $from try.out
19632                                 if $test -s try.out -a "X$code" = X42; then
19633                                         fflushall="`$cat try.out`"
19634                                 fi
19635                         fi
19636                         $rm_try
19637                         case "$fflushall" in
19638                         x)      $cat >&4 <<EOM
19639 Whew. Flushing explicitly all the stdio streams works.
19640 EOM
19641                                 fflushall="$define"
19642                                 ;;
19643                         '')     $cat >&4 <<EOM
19644 Sigh. Flushing explicitly all the stdio streams doesn't work.
19645 EOM
19646                                 fflushall="$undef"
19647                                 ;;
19648                         *)      $cat >&4 <<EOM
19649 Cannot figure out whether flushing stdio streams explicitly works or not.
19650 I'm assuming it doesn't.
19651 EOM
19652                                 fflushall="$undef"
19653                                 ;;
19654                         esac
19655                         ;;
19656                 "$define"|true|[yY]*)
19657                         fflushall="$define"
19658                         ;;
19659                 *)
19660                         fflushall="$undef"
19661                         ;;
19662                 esac
19663             else
19664                 $cat >&4 <<EOM
19665 All is futile.  Even fflush(stdin) clobbers input pipes!
19666 EOM
19667                 fflushall="$undef"
19668             fi
19669         else
19670             fflushall="$undef"
19671         fi
19672         $rm -f core tryp.c tryp.core core.tryp.*
19673         ;;
19674 *)      fflushall="$undef"
19675         ;;
19676 esac
19677
19678 case "$fflushNULL$fflushall" in
19679 undefundef)
19680         $cat <<EOM
19681 OK, I give up.  I cannot figure out how to flush pending stdio output.
19682 We won't be flushing handles at all before fork/exec/popen.
19683 EOM
19684         ;;
19685 esac
19686 $rm_try tryp
19687
19688 : Store the full pathname to the ar program for use in the C program
19689 : Respect a hint or command line value for full_ar.
19690 case "$full_ar" in
19691 '') full_ar=$ar ;;
19692 esac
19693
19694 : Store the full pathname to the sed program for use in the C program
19695 full_sed=$sed
19696
19697 : see what type gids are declared as in the kernel
19698 echo " "
19699 echo "Looking for the type for group ids returned by getgid()."
19700 set gid_t gidtype xxx stdio.h sys/types.h
19701 eval $typedef
19702 case "$gidtype" in
19703 xxx)
19704         xxx=`./findhdr sys/user.h`
19705         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19706         case $1 in
19707         unsigned) dflt="$1 $2" ;;
19708         *) dflt="$1" ;;
19709         esac
19710         ;;
19711 *) dflt="$gidtype";;
19712 esac
19713 case "$gidtype" in
19714 gid_t) echo "gid_t found." ;;
19715 *)      rp="What is the type for group ids returned by getgid()?"
19716         . ./myread
19717         gidtype="$ans"
19718         ;;
19719 esac
19720
19721 : Check the size of GID
19722 echo " "
19723 case "$gidtype" in
19724 *_t) zzz="$gidtype"     ;;
19725 *)   zzz="gid"          ;;
19726 esac
19727 echo "Checking the size of $zzz..." >&4
19728 cat > try.c <<EOCP
19729 #include <sys/types.h>
19730 #include <stdio.h>
19731 #$i_stdlib I_STDLIB
19732 #ifdef I_STDLIB
19733 #include <stdlib.h>
19734 #endif
19735 int main() {
19736     printf("%d\n", (int)sizeof($gidtype));
19737     exit(0);
19738 }
19739 EOCP
19740 set try
19741 if eval $compile_ok; then
19742         yyy=`$run ./try`
19743         case "$yyy" in
19744         '')     gidsize=4
19745                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19746                 ;;
19747         *)      gidsize=$yyy
19748                 echo "Your $zzz is $gidsize bytes long."
19749                 ;;
19750         esac
19751 else
19752         gidsize=4
19753         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19754 fi
19755
19756
19757 : Check if GID is signed
19758 echo " "
19759 case "$gidtype" in
19760 *_t) zzz="$gidtype"     ;;
19761 *)   zzz="gid"          ;;
19762 esac
19763 echo "Checking the sign of $zzz..." >&4
19764 cat > try.c <<EOCP
19765 #include <sys/types.h>
19766 #include <stdio.h>
19767 int main() {
19768         $gidtype foo = -1;
19769         if (foo < 0)
19770                 printf("-1\n");
19771         else
19772                 printf("1\n");
19773 }
19774 EOCP
19775 set try
19776 if eval $compile; then
19777         yyy=`$run ./try`
19778         case "$yyy" in
19779         '')     gidsign=1
19780                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19781                 ;;
19782         *)      gidsign=$yyy
19783                 case "$gidsign" in
19784                  1) echo "Your $zzz is unsigned." ;;
19785                 -1) echo "Your $zzz is signed."   ;;
19786                 esac
19787                 ;;
19788         esac
19789 else
19790         gidsign=1
19791         echo "(I can't compile the test program--guessing unsigned.)" >&4
19792 fi
19793
19794
19795 : Check 64bit sizes
19796 echo " "
19797
19798 if $test X"$quadtype" != X; then
19799
19800 echo "Checking how to print 64-bit integers..." >&4
19801
19802 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19803         $cat >try.c <<'EOCP'
19804 #include <sys/types.h>
19805 #include <stdio.h>
19806 int main() {
19807   int q = 12345678901;
19808   printf("%ld\n", q);
19809 }
19810 EOCP
19811         set try
19812         if eval $compile; then
19813                 yyy=`$run ./try`
19814                 case "$yyy" in
19815                 12345678901)
19816                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19817                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19818                         echo "We will use %d."
19819                         ;;
19820                 esac
19821         fi
19822 fi
19823
19824 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19825         $cat >try.c <<'EOCP'
19826 #include <sys/types.h>
19827 #include <stdio.h>
19828 int main() {
19829   long q = 12345678901;
19830   printf("%ld\n", q);
19831 }
19832 EOCP
19833         set try
19834         if eval $compile; then
19835                 yyy=`$run ./try`
19836                 case "$yyy" in
19837                 12345678901)
19838                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19839                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19840                         echo "We will use %ld."
19841                         ;;
19842                 esac
19843         fi
19844 fi
19845
19846 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19847         $cat >try.c <<'EOCP'
19848 #include <sys/types.h>
19849 #include <inttypes.h>
19850 #include <stdio.h>
19851 int main() {
19852   int64_t q = 12345678901;
19853   printf("%" PRId64 "\n", q);
19854 }
19855 EOCP
19856         set try
19857         if eval $compile; then
19858                 yyy=`$run ./try`
19859                 case "$yyy" in
19860                 12345678901)
19861                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19862                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19863                         echo "We will use the C9X style."
19864                         ;;
19865                 esac
19866         fi
19867 fi
19868
19869 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19870         $cat >try.c <<EOCP
19871 #include <sys/types.h>
19872 #include <stdio.h>
19873 int main() {
19874   $quadtype q = 12345678901;
19875   printf("%Ld\n", q);
19876 }
19877 EOCP
19878         set try
19879         if eval $compile; then
19880                 yyy=`$run ./try`
19881                 case "$yyy" in
19882                 12345678901)
19883                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19884                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19885                         echo "We will use %Ld."
19886                         ;;
19887                 esac
19888         fi
19889 fi
19890
19891 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19892         $cat >try.c <<'EOCP'
19893 #include <sys/types.h>
19894 #include <stdio.h>
19895 int main() {
19896   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19897   printf("%lld\n", q);
19898 }
19899 EOCP
19900         set try
19901         if eval $compile; then
19902                 yyy=`$run ./try`
19903                 case "$yyy" in
19904                 12345678901)
19905                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19906                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19907                         echo "We will use the %lld style."
19908                         ;;
19909                 esac
19910         fi
19911 fi
19912
19913 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19914         $cat >try.c <<EOCP
19915 #include <sys/types.h>
19916 #include <stdio.h>
19917 int main() {
19918   $quadtype q = 12345678901;
19919   printf("%qd\n", q);
19920 }
19921 EOCP
19922         set try
19923         if eval $compile; then
19924                 yyy=`$run ./try`
19925                 case "$yyy" in
19926                 12345678901)
19927                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19928                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19929                         echo "We will use %qd."
19930                         ;;
19931                 esac
19932         fi
19933 fi
19934
19935 if $test X"$sPRId64" = X; then
19936         echo "Cannot figure out how to print 64-bit integers." >&4
19937 fi
19938 $rm_try
19939
19940 fi
19941
19942 case "$sPRId64" in
19943 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19944         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19945         ;;
19946 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19947         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19948         ;;
19949 esac
19950
19951 : Check format strings for internal types
19952 echo " "
19953 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19954
19955 if $test X"$ivsize" = X8; then
19956         ivdformat="$sPRId64"
19957         uvuformat="$sPRIu64"
19958         uvoformat="$sPRIo64"
19959         uvxformat="$sPRIx64"
19960         uvXUformat="$sPRIXU64"
19961 else
19962         if $test X"$ivsize" = X"$longsize"; then
19963                 ivdformat='"ld"'
19964                 uvuformat='"lu"'
19965                 uvoformat='"lo"'
19966                 uvxformat='"lx"'
19967                 uvXUformat='"lX"'
19968         else
19969                 if $test X"$ivsize" = X"$intsize"; then
19970                         ivdformat='"d"'
19971                         uvuformat='"u"'
19972                         uvoformat='"o"'
19973                         uvxformat='"x"'
19974                         uvXUformat='"X"'
19975                 else
19976                         : far out
19977                         if $test X"$ivsize" = X"$shortsize"; then
19978                                 ivdformat='"hd"'
19979                                 uvuformat='"hu"'
19980                                 uvoformat='"ho"'
19981                                 uvxformat='"hx"'
19982                                 uvXUformat='"hX"'
19983                         fi
19984                 fi
19985         fi
19986 fi
19987
19988 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19989         nveformat="$sPRIeldbl"
19990         nvfformat="$sPRIfldbl"
19991         nvgformat="$sPRIgldbl"
19992         nvEUformat="$sPRIEUldbl"
19993         nvFUformat="$sPRIFUldbl"
19994         nvGUformat="$sPRIGUldbl"
19995 else
19996         nveformat='"e"'
19997         nvfformat='"f"'
19998         nvgformat='"g"'
19999         nvEUformat='"E"'
20000         nvFUformat='"F"'
20001         nvGUformat='"G"'
20002 fi
20003
20004 case "$ivdformat" in
20005 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20006     exit 1
20007     ;;
20008 esac
20009
20010 : Check format string for GID
20011
20012 echo " "
20013 $echo "Checking the format string to be used for gids..." >&4
20014
20015 case "$gidsign" in
20016 -1)     if $test X"$gidsize" = X"$ivsize"; then
20017                 gidformat="$ivdformat"
20018         else
20019                 if $test X"$gidsize" = X"$longsize"; then
20020                         gidformat='"ld"'
20021                 else
20022                         if $test X"$gidsize" = X"$intsize"; then
20023                                 gidformat='"d"'
20024                         else
20025                                 if $test X"$gidsize" = X"$shortsize"; then
20026                                         gidformat='"hd"'
20027                                 fi
20028                         fi
20029                 fi
20030         fi
20031         ;;
20032 *)      if $test X"$gidsize" = X"$uvsize"; then
20033                 gidformat="$uvuformat"
20034         else
20035                 if $test X"$gidsize" = X"$longsize"; then
20036                         gidformat='"lu"'
20037                 else
20038                         if $test X"$gidsize" = X"$intsize"; then
20039                                 gidformat='"u"'
20040                         else
20041                                 if $test X"$gidsize" = X"$shortsize"; then
20042                                         gidformat='"hu"'
20043                                 fi
20044                         fi
20045                 fi
20046         fi
20047         ;;
20048 esac
20049
20050 : see if getgroups exists
20051 set getgroups d_getgrps
20052 eval $inlibc
20053
20054 : see if setgroups exists
20055 set setgroups d_setgrps
20056 eval $inlibc
20057
20058 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20059 echo " "
20060 case "$d_getgrps$d_setgrps" in
20061 *define*)
20062         case "$groupstype" in
20063         '') dflt="$gidtype" ;;
20064         *)  dflt="$groupstype" ;;
20065         esac
20066         $cat <<EOM
20067 What type of pointer is the second argument to getgroups() and setgroups()?
20068 Usually this is the same as group ids, $gidtype, but not always.
20069
20070 EOM
20071         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20072         . ./myread
20073         groupstype="$ans"
20074         ;;
20075 *)  groupstype="$gidtype";;
20076 esac
20077
20078 : MAD = Misc Attribute Definition
20079
20080 if $test $patchlevel -lt 9; then
20081 : MAD is not available in 5.8.x or earlier.
20082     ans=n;
20083 else
20084     case "$mad" in
20085     $define|true|[yY]*) dflt='y' ;;
20086     *)                  dflt='n' ;;
20087     esac
20088     cat <<EOM
20089
20090 Would you like to build with Misc Attribute Decoration? This is development
20091 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20092 overhead on the interpreter.
20093
20094 If this doesn't make any sense to you, just accept the default '$dflt'.
20095 EOM
20096     rp='Build Perl with MAD?'
20097     . ./myread
20098 fi
20099 case "$ans" in
20100 y|Y)    val="$define"
20101         madlyh='madly.h madly.act madly.tab'
20102         madlysrc='madly.c'
20103         madlyobj="madly$_o" ;;
20104 *)      val="$undef"
20105         madlyh=''
20106         madlysrc=''
20107         madlyobj='' ;;
20108 esac
20109 set mad
20110 eval $setvar
20111
20112 : check whether make sets MAKE
20113 echo " "
20114 echo "Checking if your $make program sets \$(MAKE)..." >&4
20115 case "$make_set_make" in
20116 '')
20117         $sed 's/^X //' > testmake.mak << 'EOF'
20118 Xall:
20119 X       @echo 'maketemp="$(MAKE)"'
20120 EOF
20121         case "`$make -f testmake.mak 2>/dev/null`" in
20122         *maketemp=*) make_set_make='#' ;;
20123         *)      make_set_make="MAKE=$make" ;;
20124         esac
20125         $rm -f testmake.mak
20126         ;;
20127 esac
20128 case "$make_set_make" in
20129 '#') echo "Yup, it does.";;
20130 *) echo "Nope, it doesn't.";;
20131 esac
20132
20133 : see what type is used for mode_t
20134 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20135 set mode_t modetype int stdio.h sys/types.h
20136 eval $typedef_ask
20137
20138 : see if we need va_copy
20139 echo " "
20140 case "$i_stdarg" in
20141 "$define")
20142         $cat >try.c <<EOCP
20143 #include <stdarg.h>
20144 #include <stdio.h>
20145 #$i_stdlib I_STDLIB
20146 #ifdef I_STDLIB
20147 #include <stdlib.h>
20148 #endif
20149 #include <signal.h>
20150
20151 int
20152 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20153 {
20154   return vfprintf(f, fmt, *valp);
20155 }
20156
20157 int
20158 myvfprintf(FILE *f, const  char *fmt, va_list val)
20159 {
20160   return ivfprintf(f, fmt, &val);
20161 }
20162
20163 int
20164 myprintf(char *fmt, ...)
20165 {
20166   va_list val;
20167   va_start(val, fmt);
20168   return myvfprintf(stdout, fmt, val);
20169 }
20170
20171 int
20172 main(int ac, char **av)
20173 {
20174   signal(SIGSEGV, exit);
20175
20176   myprintf("%s%cs all right, then\n", "that", '\'');
20177   exit(0);
20178 }
20179 EOCP
20180         set try
20181         if eval $compile && $run ./try 2>&1 >/dev/null; then
20182                 case "`$run ./try`" in
20183                 "that's all right, then")
20184                         okay=yes
20185                         ;;
20186                 esac
20187         fi
20188         case "$okay" in
20189         yes)    echo "It seems that you don't need va_copy()." >&4
20190                 need_va_copy="$undef"
20191                 ;;
20192         *)      echo "It seems that va_copy() or similar will be needed." >&4
20193                 need_va_copy="$define"
20194                 ;;
20195         esac
20196         $rm_try
20197         ;;
20198 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20199         ;;
20200 esac
20201
20202 : see what type is used for size_t
20203 rp="What is the type used for the length parameter for string functions?"
20204 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20205 eval $typedef_ask
20206
20207 : check for type of arguments to gethostbyaddr. 
20208 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20209         case "$d_gethbyaddr" in
20210         $define)
20211                 $cat <<EOM
20212
20213 Checking to see what type of arguments are accepted by gethostbyaddr().
20214 EOM
20215                 hdrs="$define sys/types.h
20216                         $d_socket sys/socket.h 
20217                         $i_niin netinet/in.h 
20218                         $i_netdb netdb.h
20219                         $i_unistd unistd.h"
20220                 : The first arg can 'char *' or 'void *'
20221                 : The second arg is some of integral type
20222                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20223                         for yyy in size_t long int; do
20224                                 case "$netdb_host_type" in
20225                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20226                                         if ./protochk "$try" $hdrs; then
20227                                                 echo "Your system accepts $xxx for the first arg."
20228                                                 echo "...and $yyy for the second arg."
20229                                                 netdb_host_type="$xxx"
20230                                                 netdb_hlen_type="$yyy"
20231                                         fi
20232                                         ;;
20233                                 esac
20234                         done
20235                 done
20236                 : In case none of those worked, prompt the user.
20237                 case "$netdb_host_type" in
20238                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20239                         dflt='char *'
20240                         . ./myread
20241                         netdb_host_type=$ans
20242                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20243                         dflt="$sizetype"
20244                         . ./myread
20245                         netdb_hlen_type=$ans
20246                         ;;
20247                 esac
20248                 ;;
20249         *)      : no gethostbyaddr, so pick harmless defaults
20250                 netdb_host_type='char *'
20251                 netdb_hlen_type="$sizetype"
20252                 ;;
20253         esac
20254         # Remove the "const" if needed. -- but then we'll have a 
20255         # prototype clash!
20256         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20257 fi
20258
20259 : check for type of argument to gethostbyname. 
20260 if test "X$netdb_name_type" = X ; then
20261         case "$d_gethbyname" in
20262         $define)
20263                 $cat <<EOM
20264
20265 Checking to see what type of argument is accepted by gethostbyname().
20266 EOM
20267                 hdrs="$define sys/types.h
20268                         $d_socket sys/socket.h 
20269                         $i_niin netinet/in.h 
20270                         $i_netdb netdb.h
20271                         $i_unistd unistd.h"
20272                 for xxx in "const char *" "char *"; do
20273                         case "$netdb_name_type" in
20274                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20275                                 if ./protochk "$try" $hdrs; then
20276                                         echo "Your system accepts $xxx."
20277                                         netdb_name_type="$xxx"
20278                                 fi
20279                                 ;;
20280                         esac
20281                 done
20282                 : In case none of those worked, prompt the user.
20283                 case "$netdb_name_type" in
20284                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20285                         dflt='char *'
20286                         . ./myread
20287                         netdb_name_type=$ans
20288                         ;;
20289                 esac
20290                 ;;
20291         *)      : no gethostbyname, so pick harmless default
20292                 netdb_name_type='char *'
20293                 ;;
20294         esac
20295 fi
20296
20297 : check for type of 1st argument to getnetbyaddr. 
20298 if test "X$netdb_net_type" = X ; then
20299         case "$d_getnbyaddr" in
20300         $define)
20301                 $cat <<EOM
20302
20303 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20304 EOM
20305                 hdrs="$define sys/types.h
20306                         $d_socket sys/socket.h 
20307                         $i_niin netinet/in.h 
20308                         $i_netdb netdb.h
20309                         $i_unistd unistd.h"
20310                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20311                         case "$netdb_net_type" in
20312                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20313                                 if ./protochk "$try" $hdrs; then
20314                                         echo "Your system accepts $xxx."
20315                                         netdb_net_type="$xxx"
20316                                 fi
20317                                 ;;
20318                         esac
20319                 done
20320                 : In case none of those worked, prompt the user.
20321                 case "$netdb_net_type" in
20322                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20323                         dflt='long'
20324                         . ./myread
20325                         netdb_net_type=$ans
20326                         ;;
20327                 esac
20328                 ;;
20329         *)      : no getnetbyaddr, so pick harmless default
20330                 netdb_net_type='long'
20331                 ;;
20332         esac
20333 fi
20334 : locate the preferred pager for this system
20335 fn=f/
20336 case "$pager" in
20337 '')
20338         dflt=''
20339         case "$pg" in
20340         /*) dflt=$pg;;
20341         [a-zA-Z]:/*) dflt=$pg;;
20342         esac
20343         case "$more" in
20344         /*) dflt=$more;;
20345         [a-zA-Z]:/*) dflt=$more;;
20346         esac
20347         case "$less" in
20348         /*) dflt=$less;;
20349         [a-zA-Z]:/*) dflt=$less;;
20350         esac
20351         case "$dflt" in
20352         '') dflt=/usr/ucb/more;;
20353         esac
20354         ;;
20355 *)      dflt="$pager"
20356         fn="f/($pager)"
20357         ;;
20358 esac
20359 echo " "
20360 rp='What pager is used on your system?'
20361 . ./getfile
20362 pager="$ans"
20363
20364 : see what type pids are declared as in the kernel
20365 rp="What is the type of process ids on this system?"
20366 set pid_t pidtype int stdio.h sys/types.h
20367 eval $typedef_ask
20368
20369 : see if ar generates random libraries by itself
20370 echo " "
20371 echo "Checking how to generate random libraries on your machine..." >&4
20372 echo 'int bar1() { return bar2(); }' > bar1.c
20373 echo 'int bar2() { return 2; }' > bar2.c
20374 $cat > foo.c <<EOP
20375 #$i_stdlib I_STDLIB
20376 #ifdef I_STDLIB
20377 #include <stdlib.h>
20378 #endif
20379 int main() { printf("%d\n", bar1()); exit(0); }
20380 EOP
20381 $cc $ccflags -c bar1.c >/dev/null 2>&1
20382 $cc $ccflags -c bar2.c >/dev/null 2>&1
20383 $cc $ccflags -c foo.c >/dev/null 2>&1
20384 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20385 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20386         $run ./foobar >/dev/null 2>&1; then
20387         echo "$ar appears to generate random libraries itself."
20388         orderlib=false
20389         if [ "X$ranlib" = "X" ]; then
20390             ranlib=":"
20391         fi
20392 elif $ar s bar$_a >/dev/null 2>&1 &&
20393         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20394         $run ./foobar >/dev/null 2>&1; then
20395                 echo "a table of contents needs to be added with '$ar s'."
20396                 orderlib=false
20397                 ranlib="$ar s"
20398 elif $ar ts bar$_a >/dev/null 2>&1 &&
20399         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20400         $run ./foobar >/dev/null 2>&1; then
20401                 echo "a table of contents needs to be added with '$ar ts'."
20402                 orderlib=false
20403                 ranlib="$ar ts"
20404 else
20405         case "$ranlib" in
20406         :) ranlib='';;
20407         '')
20408                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20409                 $test -f $ranlib || ranlib=''
20410                 ;;
20411         esac
20412         if $test -n "$ranlib"; then
20413                 echo "your system has '$ranlib'; we'll use that."
20414                 orderlib=false
20415         else
20416                 echo "your system doesn't seem to support random libraries"
20417                 echo "so we'll use lorder and tsort to order the libraries."
20418                 orderlib=true
20419                 ranlib=":"
20420         fi
20421 fi
20422 $rm -f foo* bar*
20423
20424 : see if this is a values.h system
20425 set values.h i_values
20426 eval $inhdr
20427
20428 : Check the max offset that gmtime and localtime accept
20429 echo "Checking max offsets that gmtime () accepts"
20430
20431 case $i_values in
20432     define) yyy="#include <values.h>" ;;
20433     *)      yyy="" ;;
20434     esac
20435
20436 case "$sGMTIME_min/$sGMTIME_max" in
20437     0/0|/)
20438         $cat >try.c <<EOCP
20439 #include <sys/types.h>
20440 #include <stdio.h>
20441 #include <time.h>
20442 $yyy
20443
20444 int i;
20445 struct tm *tmp;
20446 time_t pt;
20447
20448 void gm_check (time_t t, int min_year, int max_year)
20449 {
20450     tmp = gmtime (&t);
20451     if ( tmp == NULL ||
20452         /* Check tm_year overflow */
20453          tmp->tm_year < min_year || tmp->tm_year > max_year)
20454         tmp = NULL;
20455     else
20456         pt = t;
20457     } /* gm_check */
20458
20459 int check_max ()
20460 {
20461     tmp = NULL;
20462     pt  = 0;
20463 #ifdef MAXLONG
20464     gm_check (MAXLONG, 69, 0x7fffffff);
20465 #endif
20466     if (tmp == NULL || tmp->tm_year < 0) {
20467         for (i = 63; i >= 0; i--) {
20468             time_t x = pt | ((time_t)1 << i);
20469             if (x < 0 || x < pt) continue;
20470             gm_check (x, 69, 0x7fffffff);
20471             }
20472         }
20473     printf ("sGMTIME_max=%ld\n", pt);
20474     return (0);
20475     } /* check_max */
20476
20477 int check_min ()
20478 {
20479     tmp = NULL;
20480     pt  = 0;
20481 #ifdef MINLONG
20482     gm_check (MINLONG, -1900, 70);
20483 #endif
20484     if (tmp == NULL) {
20485         for (i = 36; i >= 0; i--) {
20486             time_t x = pt - ((time_t)1 << i);
20487             if (x > 0) continue;
20488             gm_check (x, -1900, 70);
20489             }
20490         }
20491     printf ("sGMTIME_min=%ld\n", pt);
20492     return (0);
20493     } /* check_min */
20494
20495 int main (int argc, char *argv[])
20496 {
20497     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20498     check_max ();
20499     check_min ();
20500     return (0);
20501     } /* main */
20502 EOCP
20503         set try
20504         if eval $compile; then
20505             eval `$run ./try`
20506         else
20507             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20508             fi
20509         $rm_try
20510         ;;
20511     esac
20512
20513 echo "Checking max offsets that localtime () accepts"
20514
20515 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20516     0/0|/)
20517         $cat >try.c <<EOCP
20518 #include <sys/types.h>
20519 #include <stdio.h>
20520 #include <time.h>
20521 $yyy
20522
20523 int i;
20524 struct tm *tmp;
20525 time_t pt;
20526
20527 void local_check (time_t t, int min_year, int max_year)
20528 {
20529     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20530         tmp = NULL;
20531     else
20532         tmp = localtime (&t);
20533     if ( tmp == NULL ||
20534         /* Check tm_year overflow */
20535          tmp->tm_year < min_year || tmp->tm_year > max_year)
20536         tmp = NULL;
20537     else
20538         pt = t;
20539     } /* local_check */
20540
20541 int check_max ()
20542 {
20543     tmp = NULL;
20544     pt  = 0;
20545 #ifdef MAXLONG
20546     local_check (MAXLONG, 69, 0x7fffffff);
20547 #endif
20548     if (tmp == NULL || tmp->tm_year < 0) {
20549         for (i = 63; i >= 0; i--) {
20550             time_t x = pt | ((time_t)1 << i);
20551             if (x < 0 || x < pt) continue;
20552             local_check (x, 69, 0x7fffffff);
20553             }
20554         }
20555     printf ("sLOCALTIME_max=%ld\n", pt);
20556     return (0);
20557    } /* check_max */
20558
20559 int check_min ()
20560 {
20561     tmp = NULL;
20562     pt  = 0;
20563 #ifdef MINLONG
20564     local_check (MINLONG, -1900, 70);
20565 #endif
20566     if (tmp == NULL) {
20567         for (i = 36; i >= 0; i--) {
20568             time_t x = pt - ((time_t)1 << i);
20569             if (x > 0) continue;
20570             local_check (x, -1900, 70);
20571             }
20572         }
20573     printf ("sLOCALTIME_min=%ld\n", pt);
20574     return (0);
20575     } /* check_min */
20576
20577 int main (int argc, char *argv[])
20578 {
20579     check_max ();
20580     check_min ();
20581     return (0);
20582     } /* main */
20583 EOCP
20584         set try
20585         if eval $compile; then
20586             eval `$run ./try`
20587         else
20588             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20589             fi
20590         $rm_try
20591         ;;
20592     esac
20593
20594 : check for type of arguments to select.
20595 case "$selecttype" in
20596 '') case "$d_select" in
20597         $define)
20598                 echo " "
20599                 $cat <<EOM
20600 Checking to see what type of arguments are accepted by select().
20601 EOM
20602                 hdrs="$define sys/types.h
20603                         $i_systime sys/time.h
20604                         $i_sysselct sys/select.h
20605                         $d_socket sys/socket.h"
20606                 : The first arg can be int, unsigned, or size_t
20607                 : The last arg may or may not be 'const'
20608                 val=''
20609                 : void pointer has been seen but using that
20610                 : breaks the selectminbits test
20611                 for xxx in 'fd_set *' 'int *'; do
20612                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20613                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20614                                         case "$val" in
20615                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20616                                                 if ./protochk "$try" $hdrs; then
20617                                                         echo "Your system accepts $xxx."
20618                                                         val="$xxx"
20619                                                 fi
20620                                                 ;;
20621                                         esac
20622                                 done
20623                         done
20624                 done
20625                 case "$val" in
20626                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20627                         case "$d_fd_set" in
20628                                 $define) dflt="fd_set *" ;;
20629                                 *)              dflt="int *" ;;
20630                         esac
20631                         . ./myread
20632                         val=$ans
20633                         ;;
20634                 esac
20635                 selecttype="$val"
20636                 ;;
20637         *)      : no select, so pick a harmless default
20638                 selecttype='int *'
20639                 ;;
20640         esac
20641         ;;
20642 esac
20643
20644 : check for the select 'width'
20645 case "$selectminbits" in
20646 '') safebits=`expr $ptrsize \* 8`
20647     case "$d_select" in
20648         $define)
20649                 $cat <<EOM
20650
20651 Checking to see on how many bits at a time your select() operates...
20652 EOM
20653                 $cat >try.c <<EOCP
20654 #include <sys/types.h>
20655 #$i_time I_TIME
20656 #$i_systime I_SYS_TIME
20657 #$i_systimek I_SYS_TIME_KERNEL
20658 #ifdef I_TIME
20659 #   include <time.h>
20660 #endif
20661 #ifdef I_SYS_TIME
20662 #   ifdef I_SYS_TIME_KERNEL
20663 #       define KERNEL
20664 #   endif
20665 #   include <sys/time.h>
20666 #   ifdef I_SYS_TIME_KERNEL
20667 #       undef KERNEL
20668 #   endif
20669 #endif
20670 #$i_sysselct I_SYS_SELECT
20671 #ifdef I_SYS_SELECT
20672 #include <sys/select.h>
20673 #endif
20674 #$d_socket HAS_SOCKET
20675 #ifdef HAS_SOCKET
20676 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20677 #endif
20678 #include <stdio.h>
20679 #$i_stdlib I_STDLIB
20680 #ifdef I_STDLIB
20681 #include <stdlib.h>
20682 #endif
20683 $selecttype b;
20684 #define S sizeof(*(b))
20685 #define MINBITS 64
20686 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20687 #define NBITS  (NBYTES * 8)
20688 int main() {
20689     char *s = (char *)malloc(NBYTES);
20690     struct timeval t;
20691     int i;
20692     FILE* fp;
20693     int fd;
20694
20695     if (!s)
20696         exit(1);
20697     fclose(stdin);
20698     fp = fopen("try.c", "r");
20699     if (fp == 0)
20700       exit(2);
20701     fd = fileno(fp);
20702     if (fd < 0)
20703       exit(3);
20704     b = ($selecttype)s;
20705     for (i = 0; i < NBITS; i++)
20706         FD_SET(i, b);
20707     t.tv_sec  = 0;
20708     t.tv_usec = 0;
20709     select(fd + 1, b, 0, 0, &t);
20710     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20711     free(s);
20712     printf("%d\n", i + 1);
20713     return 0;
20714 }
20715 EOCP
20716                 set try
20717                 if eval $compile_ok; then
20718                         selectminbits=`$run ./try`
20719                         case "$selectminbits" in
20720                         '')     cat >&4 <<EOM
20721 Cannot figure out on how many bits at a time your select() operates.
20722 I'll play safe and guess it is $safebits bits.
20723 EOM
20724                                 selectminbits=$safebits
20725                                 bits="$safebits bits"
20726                                 ;;
20727                         1)      bits="1 bit" ;;
20728                         *)      bits="$selectminbits bits" ;;
20729                         esac
20730                         echo "Your select() operates on $bits at a time." >&4
20731                 else
20732                         rp='What is the minimum number of bits your select() operates on?'
20733                         case "$byteorder" in
20734                         12345678)       dflt=64 ;;
20735                         1234)           dflt=32 ;;
20736                         *)              dflt=1  ;;
20737                         esac
20738                         . ./myread
20739                         val=$ans
20740                         selectminbits="$val"
20741                 fi
20742                 $rm_try
20743                 ;;
20744         *)      : no select, so pick a harmless default
20745                 selectminbits=$safebits
20746                 ;;
20747         esac
20748         ;;
20749 esac
20750
20751 : Trace out the files included by signal.h, then look for SIGxxx names.
20752 if [ "X$fieldn" = X ]; then
20753         : Just make some guesses.  We check them later.
20754         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20755 else
20756         xxx=`echo '#include <signal.h>' |
20757         $cppstdin $cppminus $cppflags 2>/dev/null |
20758         $grep '^[       ]*#.*include' |
20759         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20760                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20761 fi
20762 xxxfiles=''
20763 for xx in $xxx /dev/null ; do
20764         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20765 done
20766 case "$xxxfiles" in
20767 '')     xxxfiles=`./findhdr signal.h` ;;
20768 esac
20769 xxx=`awk '
20770 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20771         print substr($2, 4, 20)
20772 }
20773 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20774         print substr($3, 4, 20)
20775 }' $xxxfiles`
20776 : Append some common names just in case the awk scan failed.
20777 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20778 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20779 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20780 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20781 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20782
20783 : generate a few handy files for later
20784 $cat > signal.c <<EOCP
20785 #include <sys/types.h>
20786 #include <signal.h>
20787 #$i_stdlib I_STDLIB
20788 #ifdef I_STDLIB
20789 #include <stdlib.h>
20790 #endif
20791 #include <stdio.h>
20792 int main() {
20793
20794 /* Strange style to avoid deeply-nested #if/#else/#endif */
20795 #ifndef NSIG
20796 #  ifdef _NSIG
20797 #    define NSIG (_NSIG)
20798 #  endif
20799 #endif
20800
20801 #ifndef NSIG
20802 #  ifdef SIGMAX
20803 #    define NSIG (SIGMAX+1)
20804 #  endif
20805 #endif
20806
20807 #ifndef NSIG
20808 #  ifdef SIG_MAX
20809 #    define NSIG (SIG_MAX+1)
20810 #  endif
20811 #endif
20812
20813 #ifndef NSIG
20814 #  ifdef _SIG_MAX
20815 #    define NSIG (_SIG_MAX+1)
20816 #  endif
20817 #endif
20818
20819 #ifndef NSIG
20820 #  ifdef MAXSIG
20821 #    define NSIG (MAXSIG+1)
20822 #  endif
20823 #endif
20824
20825 #ifndef NSIG
20826 #  ifdef MAX_SIG
20827 #    define NSIG (MAX_SIG+1)
20828 #  endif
20829 #endif
20830
20831 #ifndef NSIG
20832 #  ifdef SIGARRAYSIZE
20833 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20834 #  endif
20835 #endif
20836
20837 #ifndef NSIG
20838 #  ifdef _sys_nsig
20839 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20840 #  endif
20841 #endif
20842
20843 /* Default to some arbitrary number that's big enough to get most
20844    of the common signals.
20845 */
20846 #ifndef NSIG
20847 #    define NSIG 50
20848 #endif
20849
20850 printf("NSIG %d\n", NSIG);
20851
20852 #ifndef JUST_NSIG
20853
20854 EOCP
20855
20856 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20857 {
20858         printf "#ifdef SIG"; printf $1; printf "\n"
20859         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20860         printf $1; printf ");\n"
20861         printf "#endif\n"
20862 }
20863 END {
20864         printf "#endif /* JUST_NSIG */\n";
20865         printf "exit(0);\n}\n";
20866 }
20867 ' >>signal.c
20868 $cat >signal.awk <<'EOP'
20869 BEGIN { ndups = 0 }
20870 $1 ~ /^NSIG$/ { nsig = $2 }
20871 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20872     if ($2 > maxsig) { maxsig = $2 }
20873     if (sig_name[$2]) {
20874         dup_name[ndups] = $1
20875         dup_num[ndups] = $2
20876         ndups++
20877     }
20878     else {
20879         sig_name[$2] = $1
20880         sig_num[$2] = $2
20881     }
20882 }
20883 END {
20884     if (nsig == 0) {
20885         nsig = maxsig + 1
20886     }
20887     printf("NSIG %d\n", nsig);
20888     for (n = 1; n < nsig; n++) {
20889         if (sig_name[n]) {
20890             printf("%s %d\n", sig_name[n], sig_num[n])
20891         }
20892         else {
20893             printf("NUM%d %d\n", n, n)
20894         }
20895     }
20896     for (n = 0; n < ndups; n++) {
20897         printf("%s %d\n", dup_name[n], dup_num[n])
20898     }
20899 }
20900 EOP
20901 $cat >signal_cmd <<EOS
20902 $startsh
20903 if $test -s signal.lst; then
20904     echo "Using your existing signal.lst file"
20905         exit 0
20906 fi
20907 xxx="$xxx"
20908 EOS
20909 $cat >>signal_cmd <<'EOS'
20910
20911 set signal
20912 if eval $compile_ok; then
20913         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20914                 $uniq | $awk -f signal.awk >signal.lst
20915 else
20916         echo "(I can't seem be able to compile the whole test program)" >&4
20917         echo "(I'll try it in little pieces.)" >&4
20918         set signal -DJUST_NSIG
20919         if eval $compile_ok; then
20920                 $run ./signal$_exe > signal.nsg
20921                 $cat signal.nsg
20922         else
20923                 echo "I can't seem to figure out how many signals you have." >&4
20924                 echo "Guessing 50." >&4
20925                 echo 'NSIG 50' > signal.nsg
20926         fi
20927         : Now look at all the signal names, one at a time.
20928         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20929                 $cat > signal.c <<EOCP
20930 #include <sys/types.h>
20931 #include <signal.h>
20932 #include <stdio.h>
20933 int main() {
20934 printf("$xx %d\n", SIG${xx});
20935 return 0;
20936 }
20937 EOCP
20938                 set signal
20939                 if eval $compile; then
20940                         echo "SIG${xx} found."
20941                         $run ./signal$_exe  >> signal.ls1
20942                 else
20943                         echo "SIG${xx} NOT found."
20944                 fi
20945         done
20946         if $test -s signal.ls1; then
20947                 $cat signal.nsg signal.ls1 |
20948                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20949         fi
20950
20951 fi
20952 if $test -s signal.lst; then
20953         :
20954 else
20955         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20956         echo 'kill -l' >signal
20957         set X `csh -f <signal`
20958         $rm -f signal
20959         shift
20960         case $# in
20961         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20962         esac
20963         echo $@ | $tr ' ' $trnl | \
20964             $awk '{ printf "%s %d\n", $1, ++s; }
20965                   END { printf "NSIG %d\n", ++s }' >signal.lst
20966 fi
20967 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20968 EOS
20969 chmod a+x signal_cmd
20970 $eunicefix signal_cmd
20971
20972 : generate list of signal names
20973 echo " "
20974 case "$sig_name_init" in
20975 '') doinit=yes ;;
20976 *)  case "$sig_num_init" in
20977     ''|*,*) doinit=yes ;;
20978     esac ;;
20979 esac
20980 case "$doinit" in
20981 yes)
20982         echo "Generating a list of signal names and numbers..." >&4
20983         . ./signal_cmd
20984         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20985         sig_name=`$awk 'BEGIN { printf "ZERO " }
20986                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20987         sig_num=`$awk  'BEGIN { printf "0 " }
20988                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20989         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20990                              !/^NSIG/   { printf "\"%s\", ", $1 }
20991                              END        { printf "0\n" }' signal.lst`
20992         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20993                              !/^NSIG/   { printf "%d, ", $2}
20994                              END        { printf "0\n"}' signal.lst`
20995         ;;
20996 esac
20997 echo "The following $sig_count signals are available:"
20998 echo " "
20999 echo $sig_name | $awk \
21000 'BEGIN { linelen = 0 }
21001 {
21002         for (i = 1; i <= NF; i++) {
21003                 name = "SIG" $i " "
21004                 linelen = linelen + length(name)
21005                 if (linelen > 70) {
21006                         printf "\n"
21007                         linelen = length(name)
21008                 }
21009                 printf "%s", name
21010         }
21011         printf "\n"
21012 }'
21013 sig_size=`echo $sig_name | awk '{print NF}'`
21014 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21015
21016 : Check size of size
21017 echo " "
21018 case "$sizetype" in
21019 *_t) zzz="$sizetype"    ;;
21020 *)   zzz="filesize"     ;;
21021 esac
21022 echo "Checking the size of $zzz..." >&4
21023 cat > try.c <<EOCP
21024 #include <sys/types.h>
21025 #include <stdio.h>
21026 #$i_stdlib I_STDLIB
21027 #ifdef I_STDLIB
21028 #include <stdlib.h>
21029 #endif
21030 int main() {
21031     printf("%d\n", (int)sizeof($sizetype));
21032     exit(0);
21033 }
21034 EOCP
21035 set try
21036 if eval $compile_ok; then
21037         yyy=`$run ./try`
21038         case "$yyy" in
21039         '')     sizesize=4
21040                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21041                 ;;
21042         *)      sizesize=$yyy
21043                 echo "Your $zzz size is $sizesize bytes."
21044                 ;;
21045         esac
21046 else
21047         sizesize=4
21048         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21049 fi
21050
21051
21052 : check for socklen_t
21053 echo " "
21054 echo "Checking to see if you have socklen_t..." >&4
21055 $cat >try.c <<EOCP
21056 #include <sys/types.h>
21057 #$d_socket HAS_SOCKET
21058 #ifdef HAS_SOCKET
21059 #include <sys/socket.h>
21060 #endif
21061 int main() { socklen_t x = 16; }
21062 EOCP
21063 set try
21064 if eval $compile; then
21065         val="$define"
21066         echo "You have socklen_t."
21067 else
21068         val="$undef"
21069         echo "You do not have socklen_t."
21070         case "$sizetype" in
21071         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21072         esac
21073 fi
21074 $rm_try
21075 set d_socklen_t
21076 eval $setvar
21077
21078 : see if this is a socks.h system
21079 set socks.h i_socks
21080 eval $inhdr
21081
21082 : check for type of the size argument to socket calls
21083 case "$d_socket" in
21084 "$define")
21085         $cat <<EOM
21086
21087 Checking to see what type is the last argument of accept().
21088 EOM
21089         yyy=''
21090         case "$d_socklen_t" in
21091         "$define") yyy="$yyy socklen_t"
21092         esac
21093         yyy="$yyy $sizetype int long unsigned"
21094         for xxx in $yyy; do
21095                 case "$socksizetype" in
21096                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21097                         case "$usesocks" in
21098                         "$define")
21099                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21100                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21101                                         socksizetype="$xxx"
21102                                 fi
21103                                 ;;
21104                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21105                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21106                                         socksizetype="$xxx"
21107                                 fi
21108                                 ;;
21109                         esac
21110                         ;;
21111                 esac
21112         done
21113 : In case none of those worked, prompt the user.
21114         case "$socksizetype" in
21115         '')     rp='What is the type for socket address structure sizes?'
21116                 dflt='int'
21117                 . ./myread
21118                 socksizetype=$ans
21119                 ;;
21120         esac
21121         ;;
21122 *)      : no sockets, so pick relatively harmless default
21123         socksizetype='int'
21124         ;;
21125 esac
21126
21127 : see what type is used for signed size_t
21128 set ssize_t ssizetype int stdio.h sys/types.h
21129 eval $typedef
21130 dflt="$ssizetype"
21131 $cat > try.c <<EOM
21132 #include <stdio.h>
21133 #$i_stdlib I_STDLIB
21134 #ifdef I_STDLIB
21135 #include <stdlib.h>
21136 #endif
21137 #include <sys/types.h>
21138 #define Size_t $sizetype
21139 #define SSize_t $dflt
21140 int main()
21141 {
21142         if (sizeof(Size_t) == sizeof(SSize_t))
21143                 printf("$dflt\n");
21144         else if (sizeof(Size_t) == sizeof(int))
21145                 printf("int\n");
21146         else
21147                 printf("long\n");
21148         exit(0);
21149 }
21150 EOM
21151 echo " "
21152 set try
21153 if eval $compile_ok && $run ./try > /dev/null; then
21154         ssizetype=`$run ./try`
21155         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21156 else
21157         $cat >&4 <<EOM
21158 Help! I can't compile and run the ssize_t test program: please enlighten me!
21159 (This is probably a misconfiguration in your system or libraries, and
21160 you really ought to fix it.  Still, I'll try anyway.)
21161
21162 I need a type that is the same size as $sizetype, but is guaranteed to
21163 be signed.  Common values are ssize_t, int and long.
21164
21165 EOM
21166         rp="What signed type is the same size as $sizetype?"
21167         . ./myread
21168         ssizetype="$ans"
21169 fi
21170 $rm_try
21171
21172 : see what type of char stdio uses.
21173 echo " "
21174 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21175 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21176         echo "Your stdio uses unsigned chars." >&4
21177         stdchar="unsigned char"
21178 else
21179         echo "Your stdio uses signed chars." >&4
21180         stdchar="char"
21181 fi
21182 $rm -f stdioh
21183
21184 : see what type uids are declared as in the kernel
21185 echo " "
21186 echo "Looking for the type for user ids returned by getuid()."
21187 set uid_t uidtype xxx stdio.h sys/types.h
21188 eval $typedef
21189 case "$uidtype" in
21190 xxx)
21191         xxx=`./findhdr sys/user.h`
21192         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21193         case $1 in
21194         unsigned) dflt="$1 $2" ;;
21195         *) dflt="$1" ;;
21196         esac
21197         ;;
21198 *) dflt="$uidtype";;
21199 esac
21200 case "$uidtype" in
21201 uid_t)  echo "uid_t found." ;;
21202 *)      rp="What is the type for user ids returned by getuid()?"
21203         . ./myread
21204         uidtype="$ans"
21205         ;;
21206 esac
21207
21208 : Check size of UID
21209 echo " "
21210 case "$uidtype" in
21211 *_t) zzz="$uidtype"     ;;
21212 *)   zzz="uid"          ;;
21213 esac
21214 echo "Checking the size of $zzz..." >&4
21215 cat > try.c <<EOCP
21216 #include <sys/types.h>
21217 #include <stdio.h>
21218 #$i_stdlib I_STDLIB
21219 #ifdef I_STDLIB
21220 #include <stdlib.h>
21221 #endif
21222 int main() {
21223     printf("%d\n", (int)sizeof($uidtype));
21224     exit(0);
21225 }
21226 EOCP
21227 set try
21228 if eval $compile_ok; then
21229         yyy=`$run ./try`
21230         case "$yyy" in
21231         '')     uidsize=4
21232                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21233                 ;;
21234         *)      uidsize=$yyy
21235                 echo "Your $zzz is $uidsize bytes long."
21236                 ;;
21237         esac
21238 else
21239         uidsize=4
21240         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21241 fi
21242
21243 : Check if UID is signed
21244 echo " "
21245 case "$uidtype" in
21246 *_t) zzz="$uidtype"     ;;
21247 *)   zzz="uid"          ;;
21248 esac
21249 echo "Checking the sign of $zzz..." >&4
21250 cat > try.c <<EOCP
21251 #include <sys/types.h>
21252 #include <stdio.h>
21253 int main() {
21254         $uidtype foo = -1;
21255         if (foo < 0)
21256                 printf("-1\n");
21257         else
21258                 printf("1\n");
21259 }
21260 EOCP
21261 set try
21262 if eval $compile; then
21263         yyy=`$run ./try`
21264         case "$yyy" in
21265         '')     uidsign=1
21266                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21267                 ;;
21268         *)      uidsign=$yyy
21269                 case "$uidsign" in
21270                  1) echo "Your $zzz is unsigned." ;;
21271                 -1) echo "Your $zzz is signed."   ;;
21272                 esac
21273                 ;;
21274         esac
21275 else
21276         uidsign=1
21277         echo "(I can't compile the test program--guessing unsigned.)" >&4
21278 fi
21279
21280
21281 : Check format string for UID
21282 echo " "
21283 $echo "Checking the format string to be used for uids..." >&4
21284
21285 case "$uidsign" in
21286 -1)     if $test X"$uidsize" = X"$ivsize"; then
21287                 uidformat="$ivdformat"
21288         else
21289                 if $test X"$uidsize" = X"$longsize"; then
21290                         uidformat='"ld"'
21291                 else
21292                         if $test X"$uidsize" = X"$intsize"; then
21293                                 uidformat='"d"'
21294                         else
21295                                 if $test X"$uidsize" = X"$shortsize"; then
21296                                         uidformat='"hd"'
21297                                 fi
21298                         fi
21299                 fi
21300         fi
21301         ;;
21302 *)      if $test X"$uidsize" = X"$uvsize"; then
21303                 uidformat="$uvuformat"
21304         else
21305                 if $test X"$uidsize" = X"$longsize"; then
21306                         uidformat='"lu"'
21307                 else
21308                         if $test X"$uidsize" = X"$intsize"; then
21309                                 uidformat='"u"'
21310                         else
21311                                 if $test X"$uidsize" = X"$shortsize"; then
21312                                         uidformat='"hu"'
21313                                 fi
21314                         fi
21315                 fi
21316         fi
21317         ;;
21318 esac
21319
21320 : Check if site customization support was requested
21321 case "$usesitecustomize" in
21322     $define|true|[Yy]*)
21323         usesitecustomize="$define"
21324         ;;
21325     *)
21326         usesitecustomize="$undef"
21327         ;;
21328     esac
21329
21330 : see if prototypes support variable argument declarations
21331 echo " "
21332 case "$prototype$i_stdarg" in
21333 $define$define)
21334         echo "It appears we'll be able to prototype varargs functions." >&4
21335         val="$define"
21336         ;;
21337 *)
21338         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21339         val="$undef"
21340         ;;
21341 esac
21342 set vaproto
21343 eval $setvar
21344
21345 : determine compiler compiler
21346 case "$yacc" in
21347 '')
21348         dflt=yacc;;
21349 *)
21350         dflt="$yacc";;
21351 esac
21352 echo " "
21353 comp='yacc'
21354 if $test -f "$byacc$_exe"; then
21355         dflt="$byacc"
21356         comp="byacc or $comp"
21357 fi
21358 if $test -f "$bison$_exe"; then
21359         comp="$comp or bison -y"
21360 fi
21361 rp="Which compiler compiler ($comp) shall I use?"
21362 . ./myread
21363 yacc="$ans"
21364 case "$yacc" in
21365 *bis*)
21366         case "$yacc" in
21367         *-y*) ;;
21368         *)
21369                 yacc="$yacc -y"
21370                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21371                 ;;
21372         esac
21373         ;;
21374 esac
21375
21376 : see if this is a assert.h system
21377 set assert.h i_assert
21378 eval $inhdr
21379
21380 : see if this is a fp.h system
21381 set fp.h i_fp
21382 eval $inhdr
21383
21384 : see if this is a fp_class.h system
21385 set fp_class.h i_fp_class
21386 eval $inhdr
21387
21388 : see if gdbm.h is available
21389 set gdbm.h t_gdbm
21390 eval $inhdr
21391 case "$t_gdbm" in
21392 $define)
21393         : see if gdbm_open exists
21394         set gdbm_open d_gdbm_open
21395         eval $inlibc
21396         case "$d_gdbm_open" in
21397         $undef)
21398                 t_gdbm="$undef"
21399                 echo "We won't be including <gdbm.h>"
21400                 ;;
21401         esac
21402         ;;
21403 esac
21404 val="$t_gdbm"
21405 set i_gdbm
21406 eval $setvar
21407
21408 : see if this is a ieeefp.h system
21409 case "$i_ieeefp" in
21410 '' ) set ieeefp.h i_ieeefp
21411      eval $inhdr
21412      ;;
21413 esac
21414
21415 : see if this is a libutil.h system
21416 set libutil.h i_libutil
21417 eval $inhdr
21418
21419 : see if mach cthreads are available
21420 if test "X$usethreads" = "X$define"; then
21421         set mach/cthreads.h i_machcthr
21422         eval $inhdr
21423 else
21424         i_machcthr="$undef"
21425 fi
21426
21427 : see if this is a mntent.h system
21428 set mntent.h i_mntent
21429 eval $inhdr
21430
21431 : see if net/errno.h is available
21432 val=''
21433 set net/errno.h val
21434 eval $inhdr
21435
21436 : Unfortunately, it causes problems on some systems.  Arrgh.
21437 case "$val" in
21438 $define)
21439         cat > try.c <<'EOM'
21440 #include <stdio.h>
21441 #include <errno.h>
21442 #include <net/errno.h>
21443 int func()
21444 {
21445         return ENOTSOCK;
21446 }
21447 EOM
21448         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21449                 echo "We'll be including <net/errno.h>." >&4
21450         else
21451                 echo "We won't be including <net/errno.h>." >&4
21452                 val="$undef"
21453         fi
21454         $rm_try
21455         ;;
21456 esac
21457 set i_neterrno
21458 eval $setvar
21459
21460 : see if netinet/tcp.h is available
21461 set netinet/tcp.h i_netinettcp
21462 eval $inhdr
21463
21464 : see if this is a poll.h system
21465 set poll.h i_poll
21466 eval $inhdr
21467
21468 : see if this is a prot.h system
21469 set prot.h i_prot
21470 eval $inhdr
21471
21472 : Preprocessor symbols
21473 echo " "
21474 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21475 $cat <<'EOSH' > Cppsym.know
21476 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21477 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21478 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21479 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21480 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21481 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21482 bull c cadmus clipper CMU COFF COMPILER_VERSION
21483 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21484 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21485 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21486 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21487 GLIBC GLIBC_MINOR
21488 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21489 H3050R H3050RX hbullx20 hcx host_mips
21490 hp200 hp300 hp700 HP700 hp800 hp9000
21491 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21492 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21493 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21494 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21495 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21496 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21497 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21498 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21499 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21500 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21501 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21502 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21503 MATH_HAS_NO_SIDE_EFFECTS
21504 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21505 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21506 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21507 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21508 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21509 NetBSD news1500 news1700 news1800 news1900 news3700
21510 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21511 ns32016 ns32332 ns32k nsc32000
21512 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21513 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21514 pc532 pdp11 PGC PIC plexus PORTAR posix
21515 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21516 POSIX_C_SOURCE POSIX_SOURCE POWER
21517 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21518 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21519 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21520 sony sony_news sonyrisc sparc sparclite spectrum
21521 stardent stdc STDC_EXT stratos sun sun3 sun386
21522 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21523 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21524 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21525 sysV68 sysV88 Tek4132 Tek4300 titan
21526 TM3200 TM5400 TM5600
21527 tower tower32 tower32_200 tower32_600 tower32_700
21528 tower32_800 tower32_850 tss
21529 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21530 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21531 unix UNIX95 UNIX99 unixpc unos
21532 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21533 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21534 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21535 USGr4 USGr4_2
21536 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21537 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21538 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21539 z8000
21540 EOSH
21541 # Maybe put other stuff here too.
21542 cat <<EOSH >>Cppsym.know
21543 $osname
21544 EOSH
21545 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21546 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21547 $cat Cppsym.know > Cppsym.c
21548 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21549 $rm -f Cppsym.a Cppsym.b Cppsym.c
21550 cat <<EOSH > Cppsym
21551 $startsh
21552 if $test \$# -gt 0; then
21553     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21554     if $test -s Cppsym.got; then
21555         $rm -f Cppsym.got
21556         exit 0
21557     fi
21558     $rm -f Cppsym.got
21559     exit 1
21560 else
21561     $tr " " "$trnl" | ./Cppsym.try
21562     exit 0
21563 fi
21564 EOSH
21565 chmod +x Cppsym
21566 $eunicefix Cppsym
21567 cat <<EOSH > Cppsym.try
21568 $startsh
21569 cat <<'EOCP' > try.c
21570 #include <stdio.h>
21571 #if cpp_stuff == 1
21572 #define STRINGIFY(a)    "a"
21573 #endif
21574 #if cpp_stuff == 42
21575 #define StGiFy(a)  #a
21576 #define STRINGIFY(a)    StGiFy(a)
21577 #endif
21578 #if $cpp_stuff != 1 && $cpp_stuff != 42
21579 #   include "Bletch: How does this C preprocessor stringify macros?"
21580 #endif
21581 int main() {
21582 EOCP
21583 $awk \\
21584 EOSH
21585 cat <<'EOSH' >> Cppsym.try
21586 'length($1) > 0 {
21587     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21588     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21589     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21590     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21591 }'       >> try.c
21592 echo 'return 0;}' >> try.c
21593 EOSH
21594 cat <<EOSH >> Cppsym.try
21595 ccflags="$ccflags"
21596 case "$osname-$gccversion" in
21597 irix-) ccflags="\$ccflags -woff 1178" ;;
21598 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21599 esac
21600 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21601 EOSH
21602 chmod +x Cppsym.try
21603 $eunicefix Cppsym.try
21604 ./Cppsym < Cppsym.know > Cppsym.true
21605 : Add in any linux cpp "predefined macros":
21606 case "$osname::$gccversion" in
21607   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21608     tHdrH=_tmpHdr
21609     rm -f $tHdrH'.h' $tHdrH
21610     touch $tHdrH'.h'
21611     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21612        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21613        if [ -s $tHdrH'_cppsym.real' ]; then
21614           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21615        fi
21616     fi
21617     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21618   ;;
21619 esac
21620 : now check the C compiler for additional symbols
21621 postprocess_cc_v=''
21622 case "$osname" in
21623 aix) postprocess_cc_v="|$tr , ' '" ;;
21624 esac
21625 $cat >ccsym <<EOS
21626 $startsh
21627 $cat >tmp.c <<EOF
21628 extern int foo;
21629 EOF
21630 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21631 do
21632         case "\$i" in
21633         -D*) echo "\$i" | $sed 's/^-D//';;
21634         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21635         esac
21636 done
21637 $rm_try
21638 EOS
21639 postprocess_cc_v=''
21640 chmod +x ccsym
21641 $eunicefix ccsym
21642 ./ccsym > ccsym1.raw
21643 if $test -s ccsym1.raw; then
21644        $sort ccsym1.raw | $uniq >ccsym.raw
21645 else
21646        mv ccsym1.raw ccsym.raw
21647 fi
21648
21649 $awk '/\=/ { print $0; next }
21650         { print $0"=1" }' ccsym.raw >ccsym.list
21651 $comm -13 Cppsym.true ccsym.list >ccsym.own
21652 $comm -12 Cppsym.true ccsym.list >ccsym.com
21653 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21654 also=''
21655 if $test -z ccsym.raw; then
21656         echo "Your C compiler doesn't seem to define any symbols!" >&4
21657         echo " "
21658         echo "However, your C preprocessor defines the following symbols:"
21659         $cat Cppsym.true
21660         ccsymbols=''
21661         cppsymbols=`$cat Cppsym.true`
21662         cppsymbols=`echo $cppsymbols`
21663         cppccsymbols="$cppsymbols"
21664 else
21665         if $test -s ccsym.com; then
21666                 echo "Your C compiler and pre-processor define these symbols:"
21667                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21668                 also='also '
21669                 symbols='ones'
21670                 cppccsymbols=`$cat ccsym.com`
21671                 cppccsymbols=`echo $cppccsymbols`
21672                 $test "$silent" || sleep 1
21673         fi
21674         if $test -s ccsym.cpp; then
21675                 $test "$also" && echo " "
21676                 echo "Your C pre-processor ${also}defines the following symbols:"
21677                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21678                 also='further '
21679                 cppsymbols=`$cat ccsym.cpp`
21680                 cppsymbols=`echo $cppsymbols`
21681                 $test "$silent" || sleep 1
21682         fi
21683         if $test -s ccsym.own; then
21684                 $test "$also" && echo " "
21685                 echo "Your C compiler ${also}defines the following cpp symbols:"
21686                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21687                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21688                 ccsymbols=`$cat ccsym.own`
21689                 ccsymbols=`echo $ccsymbols`
21690                 $test "$silent" || sleep 1
21691         fi
21692 fi
21693
21694 : see if this is a termio system
21695 val="$undef"
21696 val2="$undef"
21697 val3="$undef"
21698 if $test `./findhdr termios.h`; then
21699         set tcsetattr i_termios
21700         eval $inlibc
21701         val3="$i_termios"
21702 fi
21703 echo " "
21704 case "$val3" in
21705 "$define") echo "You have POSIX termios.h... good!" >&4;;
21706 *) if ./Cppsym pyr; then
21707                 case "`/bin/universe`" in
21708                 ucb) if $test `./findhdr sgtty.h`; then
21709                                 val2="$define"
21710                                 echo "<sgtty.h> found." >&4
21711                         else
21712                                 echo "System is pyramid with BSD universe."
21713                                 ./warn "<sgtty.h> not found--you could have problems."
21714                         fi;;
21715                 *) if $test `./findhdr termio.h`; then
21716                                 val="$define"
21717                                 echo "<termio.h> found." >&4
21718                         else
21719                                 echo "System is pyramid with USG universe."
21720                                 ./warn "<termio.h> not found--you could have problems."
21721                         fi;;
21722                 esac
21723         elif ./usg; then
21724                 if $test `./findhdr termio.h`; then
21725                         echo "<termio.h> found." >&4
21726                         val="$define"
21727                 elif $test `./findhdr sgtty.h`; then
21728                         echo "<sgtty.h> found." >&4
21729                         val2="$define"
21730                 else
21731                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
21732                 fi
21733         else
21734                 if $test `./findhdr sgtty.h`; then
21735                         echo "<sgtty.h> found." >&4
21736                         val2="$define"
21737                 elif $test `./findhdr termio.h`; then
21738                         echo "<termio.h> found." >&4
21739                         val="$define"
21740                 else
21741                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
21742                 fi
21743         fi;;
21744 esac
21745 set i_termio; eval $setvar
21746 val=$val2; set i_sgtty; eval $setvar
21747 val=$val3; set i_termios; eval $setvar
21748
21749 : see if stddef is available
21750 set stddef.h i_stddef
21751 eval $inhdr
21752
21753 : see if sys/access.h is available
21754 set sys/access.h i_sysaccess
21755 eval $inhdr
21756
21757 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
21758 set sys/filio.h i_sysfilio
21759 eval $inhdr
21760 echo " "
21761 if $test `./findhdr sys/ioctl.h`; then
21762         val="$define"
21763         echo '<sys/ioctl.h> found.' >&4
21764 else
21765         val="$undef"
21766         if $test $i_sysfilio = "$define"; then
21767             echo '<sys/ioctl.h> NOT found.' >&4
21768         else
21769                 $test $i_sgtty = "$define" && xxx="sgtty.h"
21770                 $test $i_termio = "$define" && xxx="termio.h"
21771                 $test $i_termios = "$define" && xxx="termios.h"
21772 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
21773         fi
21774 fi
21775 set i_sysioctl
21776 eval $setvar
21777
21778 : see if socket ioctl defs are in sys/sockio.h
21779 echo " "
21780 xxx=`./findhdr sys/sockio.h`
21781 if $test "$xxx"; then
21782         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
21783                 val="$define"
21784                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
21785         else
21786                 val="$undef"
21787                 echo "No socket ioctls found in <sys/sockio.h>." >&4
21788         fi
21789 else
21790         val="$undef"
21791         $cat <<EOM
21792 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
21793 EOM
21794 fi
21795 set i_syssockio
21796 eval $setvar
21797
21798 : see if this is a syslog.h system
21799 set syslog.h i_syslog
21800 eval $inhdr
21801
21802 : see if this is a sys/mode.h system
21803 set sys/mode.h i_sysmode
21804 eval $inhdr
21805
21806 : see if there is a sys/poll.h file
21807 set sys/poll.h i_syspoll
21808 eval $inhdr
21809
21810 : see if sys/resource.h has to be included
21811 set sys/resource.h i_sysresrc
21812 eval $inhdr
21813
21814 : see if sys/security.h is available
21815 set sys/security.h i_syssecrt
21816 eval $inhdr
21817
21818 : see if this is a sys/statvfs.h system
21819 set sys/statvfs.h i_sysstatvfs
21820 eval $inhdr
21821
21822 : see if this is a sys/un.h system
21823 set sys/un.h i_sysun
21824 eval $inhdr
21825
21826 : see if this is a sys/utsname.h system
21827 set sys/utsname.h i_sysutsname
21828 eval $inhdr
21829
21830 : see if this is a syswait system
21831 set sys/wait.h i_syswait
21832 eval $inhdr
21833
21834 : see if this is a ustat.h system
21835 set ustat.h i_ustat
21836 eval $inhdr
21837
21838 : see if this is an utime system
21839 set utime.h i_utime
21840 eval $inhdr
21841
21842 : see if this is a vfork system
21843 case "$d_vfork" in
21844 "$define")
21845         set vfork.h i_vfork
21846         eval $inhdr
21847         ;;
21848 *)
21849         i_vfork="$undef"
21850         ;;
21851 esac
21852
21853 : Check extensions
21854 echo " "
21855 echo "Looking for extensions..." >&4
21856 : If we are using the old config.sh, known_extensions may contain
21857 : old or inaccurate or duplicate values.
21858 known_extensions=''
21859 nonxs_extensions=''
21860 : We do not use find because it might not be available.
21861 : We do not just use MANIFEST because the user may have dropped
21862 : some additional extensions into the source tree and expect them
21863 : to be built.
21864
21865 : Function to recursively find available extensions, ignoring DynaLoader
21866 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21867 : In 5.10.1 and later, extensions are stored in directories
21868 : like File-Glob instead of the older File/Glob/.
21869 find_extensions='
21870     for xxx in *; do
21871         case "$xxx" in
21872             DynaLoader|dynaload) ;;
21873             *)
21874             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
21875             leaf=`echo $xxx | $sed -e s/.*-//`;
21876             if $test -d File; then
21877                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
21878                     known_extensions="$known_extensions $1$this_ext";
21879                 elif $test -f $xxx/Makefile.PL; then
21880                     nonxs_extensions="$nonxs_extensions $1$this_ext";
21881                 else
21882                     if $test -d $xxx -a $# -lt 10; then
21883                         set $1$xxx/ $*;
21884                         cd "$xxx";
21885                         eval $find_extensions;
21886                         cd ..;
21887                         shift;
21888                     fi;
21889                 fi;
21890             else
21891                 $ls -1 $xxx > $$.tmp;
21892                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
21893                     known_extensions="$known_extensions $this_ext";
21894                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
21895                     known_extensions="$known_extensions $this_ext";
21896                 elif $test -d $xxx; then
21897                     nonxs_extensions="$nonxs_extensions $this_ext";
21898                 fi;
21899                 $rm -f $$.tmp;
21900             fi
21901             ;;
21902         esac;
21903     done'
21904 tdir=`pwd`
21905 cd "$rsrc/cpan"
21906 set X
21907 shift
21908 eval $find_extensions
21909 cd "$rsrc/dist"
21910 set X
21911 shift
21912 eval $find_extensions
21913 cd "$rsrc/ext"
21914 set X
21915 shift
21916 eval $find_extensions
21917 if $test -d File-Glob; then
21918     : All ext/ flattened
21919 else
21920     # Special case:  Add in modules that nest beyond the first level.
21921     # Currently threads/shared and Hash/Util/FieldHash, since they are
21922     # not picked up by the recursive find above (and adding in general
21923     # recursive finding breaks SDBM_File/sdbm).
21924     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
21925     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
21926 fi
21927 set X $known_extensions
21928 shift
21929 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21930 set X $nonxs_extensions
21931 shift
21932 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
21933 cd "$tdir"
21934
21935 : Now see which are supported on this system.
21936 avail_ext=''
21937 for xxx in $known_extensions ; do
21938         case "$xxx" in
21939         DB_File|db_file)
21940                 case "$i_db" in
21941                 $define) avail_ext="$avail_ext $xxx" ;;
21942                 esac
21943                 ;;
21944         GDBM_File|gdbm_fil)
21945                 case "$i_gdbm" in
21946                 $define) avail_ext="$avail_ext $xxx" ;;
21947                 esac
21948                 ;;
21949         I18N/Langinfo|i18n_lan)
21950                 case "$i_langinfo$d_nl_langinfo" in
21951                 $define$define) avail_ext="$avail_ext $xxx" ;;
21952                 esac
21953                 ;;
21954         IPC/SysV|ipc/sysv)
21955                 : XXX Do we need a useipcsysv variable here
21956                 case "${d_msg}${d_sem}${d_shm}" in
21957                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21958                 esac
21959                 ;;
21960         NDBM_File|ndbm_fil)
21961                 case "$d_ndbm" in
21962                 $define)
21963                     case "$osname-$use64bitint" in
21964                     hpux-define)
21965                         case "$libs" in
21966                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21967                         esac
21968                         ;;
21969                     *) avail_ext="$avail_ext $xxx" ;;
21970                     esac
21971                     ;;
21972                 esac
21973                 ;;
21974         ODBM_File|odbm_fil)
21975                 case "${i_dbm}${i_rpcsvcdbm}" in
21976                 *"${define}"*)
21977                     case "$d_cplusplus" in
21978                     define) ;; # delete as a function name will not work
21979                     *)  case "$osname-$use64bitint" in
21980                         hpux-define)
21981                             case "$libs" in
21982                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21983                             esac
21984                             ;;
21985                         *) avail_ext="$avail_ext $xxx" ;;
21986                         esac
21987                         ;;
21988                     esac
21989                     ;;
21990                 esac
21991                 ;;
21992         Opcode|opcode)
21993                 case "$useopcode" in
21994                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21995                 esac
21996                 ;;
21997         POSIX|posix)
21998                 case "$useposix" in
21999                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22000                 esac
22001                 ;;
22002         Socket|socket)
22003                 case "$d_socket" in
22004                 true|$define|y)
22005                     case "$osname" in
22006                     beos) ;; # not unless BONE
22007                     *) avail_ext="$avail_ext $xxx" ;;
22008                     esac
22009                     ;;
22010                 esac
22011                 ;;
22012         Sys/Syslog|sys/syslog)
22013                 : XXX syslog requires socket
22014                 case "$d_socket" in
22015                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22016                 esac
22017                 ;;
22018         Thread|thread)
22019                 case "$usethreads" in
22020                 true|$define|y)
22021                         case "$use5005threads" in
22022                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22023                         esac
22024                 esac
22025                 ;;
22026         threads|threads/shared)
22027                 # threads and threads::shared are special cases.
22028                 # To stop people from asking "Perl 5.8.0 was supposed
22029                 # to have this new fancy threads implementation but my
22030                 # perl doesn't have it" and from people trying to
22031                 # (re)install the threads module using CPAN.pm and
22032                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22033                 # the threads.pm and threads/shared.pm will always be
22034                 # there, croaking informatively ("you need to rebuild
22035                 # all of Perl with threads, sorry") when threads haven't
22036                 # been compiled in.
22037                 # --jhi
22038                 avail_ext="$avail_ext $xxx"
22039                 ;;
22040         VMS*)
22041                 ;;
22042         Win32*)
22043                 case "$osname" in
22044                 cygwin) avail_ext="$avail_ext $xxx" ;;
22045                 esac
22046                 ;;
22047         XS/APItest|xs/apitest)
22048                 # This is just for testing.  Skip it unless we have dynamic loading.
22049
22050                 case "$usedl" in
22051                 $define) avail_ext="$avail_ext $xxx" ;;
22052                 esac
22053                 ;;
22054         XS/APItest/KeywordRPN|xs/apitest/keywordrpn)
22055                 # This is just for testing.  Skip it unless we have dynamic loading.
22056
22057                 case "$usedl" in
22058                 $define) avail_ext="$avail_ext $xxx" ;;
22059                 esac
22060                 ;;
22061         XS/Typemap|xs/typemap)
22062                 # This is just for testing.  Skip it unless we have dynamic loading.
22063                 case "$usedl" in
22064                 $define) avail_ext="$avail_ext $xxx" ;;
22065                 esac
22066                 ;;
22067         *)      avail_ext="$avail_ext $xxx"
22068                 ;;
22069         esac
22070 done
22071
22072 set X $avail_ext
22073 shift
22074 avail_ext="$*"
22075
22076 case "$onlyextensions" in
22077 '') ;;
22078 *)  keepextensions=''
22079     echo "You have requested that only certains extensions be included..." >&4
22080     for i in $onlyextensions; do
22081         case " $avail_ext " in
22082         *" $i "*)
22083             echo "Keeping extension $i."
22084             keepextensions="$keepextensions $i"
22085             ;;
22086         *) echo "Ignoring extension $i." ;;
22087         esac
22088     done
22089     avail_ext="$keepextensions"
22090     ;;
22091 esac
22092
22093 case "$noextensions" in
22094 '') ;;
22095 *)  keepextensions=''
22096     echo "You have requested that certain extensions be ignored..." >&4
22097     for i in $avail_ext; do
22098         case " $noextensions " in
22099         *" $i "*) echo "Ignoring extension $i." ;;
22100         *) echo "Keeping extension $i.";
22101            keepextensions="$keepextensions $i"
22102            ;;
22103         esac
22104     done
22105     avail_ext="$keepextensions"
22106     ;;
22107 esac
22108
22109 : Now see which nonxs extensions are supported on this system.
22110 : For now assume all are.
22111 nonxs_ext=''
22112 for xxx in $nonxs_extensions ; do
22113         case "$xxx" in
22114         *)      nonxs_ext="$nonxs_ext $xxx"
22115                 ;;
22116         esac
22117 done
22118
22119 set X $nonxs_ext
22120 shift
22121 nonxs_ext="$*"
22122
22123 case $usedl in
22124 $define)
22125         $cat <<EOM
22126 A number of extensions are supplied with $package.  You may choose to
22127 compile these extensions for dynamic loading (the default), compile
22128 them into the $package executable (static loading), or not include
22129 them at all.  Answer "none" to include no extensions.
22130 Note that DynaLoader is always built and need not be mentioned here.
22131
22132 EOM
22133         case "$dynamic_ext" in
22134         '')
22135                 : Exclude those listed in static_ext
22136                 dflt=''
22137                 for xxx in $avail_ext; do
22138                         case " $static_ext " in
22139                         *" $xxx "*) ;;
22140                         *) dflt="$dflt $xxx" ;;
22141                         esac
22142                 done
22143                 set X $dflt
22144                 shift
22145                 dflt="$*"
22146                 ;;
22147         *)      dflt="$dynamic_ext"
22148                 # Perhaps we are reusing an old out-of-date config.sh.
22149                 case "$hint" in
22150                 previous)
22151                         if test X"$dynamic_ext" != X"$avail_ext"; then
22152                                 $cat <<EOM
22153 NOTICE:  Your previous config.sh list may be incorrect.
22154 The extensions now available to you are
22155         ${avail_ext}
22156 but the default list from your previous config.sh is
22157         ${dynamic_ext}
22158
22159 EOM
22160                         fi
22161                         ;;
22162                 esac
22163                 ;;
22164         esac
22165         case "$dflt" in
22166         '')     dflt=none;;
22167         esac
22168         rp="What extensions do you wish to load dynamically?"
22169         . ./myread
22170         case "$ans" in
22171         none) dynamic_ext=' ' ;;
22172         *) dynamic_ext="$ans" ;;
22173         esac
22174
22175         case "$static_ext" in
22176         '')
22177                 : Exclude those already listed in dynamic linking
22178                 dflt=''
22179                 for xxx in $avail_ext; do
22180                         case " $dynamic_ext " in
22181                         *" $xxx "*) ;;
22182                         *) dflt="$dflt $xxx" ;;
22183                         esac
22184                 done
22185                 set X $dflt
22186                 shift
22187                 dflt="$*"
22188                 ;;
22189         *)  dflt="$static_ext"
22190                 ;;
22191         esac
22192
22193         case "$dflt" in
22194         '')     dflt=none;;
22195         esac
22196         rp="What extensions do you wish to load statically?"
22197         . ./myread
22198         case "$ans" in
22199         none) static_ext=' ' ;;
22200         *) static_ext="$ans" ;;
22201         esac
22202         ;;
22203 *)
22204         $cat <<EOM
22205 A number of extensions are supplied with $package.  Answer "none"
22206 to include no extensions.
22207 Note that DynaLoader is always built and need not be mentioned here.
22208
22209 EOM
22210         case "$static_ext" in
22211         '') dflt="$avail_ext" ;;
22212         *)      dflt="$static_ext"
22213                 # Perhaps we are reusing an old out-of-date config.sh.
22214                 case "$hint" in
22215                 previous)
22216                         if test X"$static_ext" != X"$avail_ext"; then
22217                                 $cat <<EOM
22218 NOTICE:  Your previous config.sh list may be incorrect.
22219 The extensions now available to you are
22220         ${avail_ext}
22221 but the default list from your previous config.sh is
22222         ${static_ext}
22223
22224 EOM
22225                         fi
22226                         ;;
22227                 esac
22228                 ;;
22229         esac
22230         : Exclude those that are not xs extensions
22231         case "$dflt" in
22232         '')     dflt=none;;
22233         esac
22234         rp="What extensions do you wish to include?"
22235         . ./myread
22236         case "$ans" in
22237         none) static_ext=' ' ;;
22238         *) static_ext="$ans" ;;
22239         esac
22240         ;;
22241 esac
22242 #
22243 # Encode is a special case.  If we are building Encode as a static
22244 # extension, we need to explicitly list its subextensions as well.
22245 # For other nested extensions, this is handled automatically by
22246 # the appropriate Makefile.PL.
22247 case " $static_ext " in
22248         *" Encode "*) # Add the subextensions of Encode
22249         cd "$rsrc/ext"
22250         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22251                 static_ext="$static_ext Encode/$xxx"
22252         done
22253         cd "$tdir"
22254         ;;
22255 esac
22256
22257 set X $dynamic_ext $static_ext $nonxs_ext
22258 shift
22259 extensions="$*"
22260
22261 # Sanity check:  We require an extension suitable for use with
22262 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22263 # should show up as failures in the test suite, but it's helpful to
22264 # catch them now.) The 'extensions' list is normally sorted
22265 # alphabetically, so we need to accept either
22266 #    DB_File ... Fcntl ... IO  ....
22267 # or something like
22268 #    Fcntl ... NDBM_File ... IO  ....
22269 case " $extensions"  in
22270 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22271 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22272 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22273 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22274    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22275    ;;
22276 esac
22277
22278 : Remove libraries needed only for extensions
22279 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22280 : The exception is SunOS 4.x, which needs them.
22281 case "${osname}X${osvers}" in
22282 sunos*X4*)
22283     perllibs="$libs"
22284     ;;
22285 *) case "$usedl" in
22286     $define|true|[yY]*)
22287             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22288             shift
22289             perllibs="$*"
22290             ;;
22291     *)  perllibs="$libs"
22292             ;;
22293     esac
22294     ;;
22295 esac
22296
22297 : Remove build directory name from cppstdin so it can be used from
22298 : either the present location or the final installed location.
22299 echo " "
22300 : Get out of the UU directory to get correct path name.
22301 cd ..
22302 case "$cppstdin" in
22303 `pwd`/cppstdin)
22304         echo "Stripping down cppstdin path name"
22305         cppstdin=cppstdin
22306         ;;
22307 esac
22308 cd UU
22309
22310 : end of configuration questions
22311 echo " "
22312 echo "End of configuration questions."
22313 echo " "
22314
22315 : back to where it started
22316 if test -d ../UU; then
22317         cd ..
22318 fi
22319
22320 : configuration may be unconditionally patched via a 'config.arch' file
22321 if $test -f config.arch; then
22322         echo "I see a config.arch file, loading it." >&4
22323         . ./config.arch
22324 fi
22325
22326 : configuration may be patched via a 'config.over' file
22327 if $test -f config.over; then
22328         echo " "
22329         dflt=y
22330         rp='I see a config.over file.  Do you wish to load it?'
22331         . UU/myread
22332         case "$ans" in
22333         n*) echo "OK, I'll ignore it.";;
22334         *)      . ./config.over
22335                 echo "Configuration override changes have been loaded."
22336                 ;;
22337         esac
22338 fi
22339
22340 : in case they want portability, strip down executable paths
22341 case "$d_portable" in
22342 "$define")
22343         echo " "
22344         echo "Stripping down executable paths..." >&4
22345         for file in $loclist $trylist; do
22346                 eval temp=\$$file
22347                 eval $file=`basename $temp`
22348         done
22349         ;;
22350 esac
22351
22352 : create config.sh file
22353 echo " "
22354 echo "Creating config.sh..." >&4
22355 $spitshell <<EOT >config.sh
22356 $startsh
22357 #
22358 # This file was produced by running the Configure script. It holds all the
22359 # definitions figured out by Configure. Should you modify one of these values,
22360 # do not forget to propagate your changes by running "Configure -der". You may
22361 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22362 #
22363
22364 # Package name      : $package
22365 # Source directory  : $src
22366 # Configuration time: $cf_time
22367 # Configured by     : $cf_by
22368 # Target system     : $myuname
22369
22370 EOT
22371 : Add in command line options if available
22372 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22373
22374 $spitshell <<EOT >>config.sh
22375
22376 Author='$Author'
22377 Date='$Date'
22378 Header='$Header'
22379 Id='$Id'
22380 Locker='$Locker'
22381 Log='$Log'
22382 RCSfile='$RCSfile'
22383 Revision='$Revision'
22384 Source='$Source'
22385 State='$State'
22386 _a='$_a'
22387 _exe='$_exe'
22388 _o='$_o'
22389 afs='$afs'
22390 afsroot='$afsroot'
22391 alignbytes='$alignbytes'
22392 ansi2knr='$ansi2knr'
22393 aphostname='$aphostname'
22394 api_revision='$api_revision'
22395 api_subversion='$api_subversion'
22396 api_version='$api_version'
22397 api_versionstring='$api_versionstring'
22398 ar='$ar'
22399 archlib='$archlib'
22400 archlibexp='$archlibexp'
22401 archname64='$archname64'
22402 archname='$archname'
22403 archobjs='$archobjs'
22404 asctime_r_proto='$asctime_r_proto'
22405 awk='$awk'
22406 baserev='$baserev'
22407 bash='$bash'
22408 bin='$bin'
22409 bin_ELF='$bin_ELF'
22410 binexp='$binexp'
22411 bison='$bison'
22412 byacc='$byacc'
22413 byteorder='$byteorder'
22414 c='$c'
22415 castflags='$castflags'
22416 cat='$cat'
22417 cc='$cc'
22418 cccdlflags='$cccdlflags'
22419 ccdlflags='$ccdlflags'
22420 ccflags='$ccflags'
22421 ccflags_uselargefiles='$ccflags_uselargefiles'
22422 ccname='$ccname'
22423 ccsymbols='$ccsymbols'
22424 ccversion='$ccversion'
22425 cf_by='$cf_by'
22426 cf_email='$cf_email'
22427 cf_time='$cf_time'
22428 charbits='$charbits'
22429 charsize='$charsize'
22430 chgrp='$chgrp'
22431 chmod='$chmod'
22432 chown='$chown'
22433 clocktype='$clocktype'
22434 comm='$comm'
22435 compress='$compress'
22436 contains='$contains'
22437 cp='$cp'
22438 cpio='$cpio'
22439 cpp='$cpp'
22440 cpp_stuff='$cpp_stuff'
22441 cppccsymbols='$cppccsymbols'
22442 cppflags='$cppflags'
22443 cpplast='$cpplast'
22444 cppminus='$cppminus'
22445 cpprun='$cpprun'
22446 cppstdin='$cppstdin'
22447 cppsymbols='$cppsymbols'
22448 crypt_r_proto='$crypt_r_proto'
22449 cryptlib='$cryptlib'
22450 csh='$csh'
22451 ctermid_r_proto='$ctermid_r_proto'
22452 ctime_r_proto='$ctime_r_proto'
22453 d_Gconvert='$d_Gconvert'
22454 d_PRIEUldbl='$d_PRIEUldbl'
22455 d_PRIFUldbl='$d_PRIFUldbl'
22456 d_PRIGUldbl='$d_PRIGUldbl'
22457 d_PRIXU64='$d_PRIXU64'
22458 d_PRId64='$d_PRId64'
22459 d_PRIeldbl='$d_PRIeldbl'
22460 d_PRIfldbl='$d_PRIfldbl'
22461 d_PRIgldbl='$d_PRIgldbl'
22462 d_PRIi64='$d_PRIi64'
22463 d_PRIo64='$d_PRIo64'
22464 d_PRIu64='$d_PRIu64'
22465 d_PRIx64='$d_PRIx64'
22466 d_SCNfldbl='$d_SCNfldbl'
22467 d__fwalk='$d__fwalk'
22468 d_access='$d_access'
22469 d_accessx='$d_accessx'
22470 d_aintl='$d_aintl'
22471 d_alarm='$d_alarm'
22472 d_archlib='$d_archlib'
22473 d_asctime64='$d_asctime64'
22474 d_asctime_r='$d_asctime_r'
22475 d_atolf='$d_atolf'
22476 d_atoll='$d_atoll'
22477 d_attribute_deprecated='$d_attribute_deprecated'
22478 d_attribute_format='$d_attribute_format'
22479 d_attribute_malloc='$d_attribute_malloc'
22480 d_attribute_nonnull='$d_attribute_nonnull'
22481 d_attribute_noreturn='$d_attribute_noreturn'
22482 d_attribute_pure='$d_attribute_pure'
22483 d_attribute_unused='$d_attribute_unused'
22484 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22485 d_bcmp='$d_bcmp'
22486 d_bcopy='$d_bcopy'
22487 d_bsd='$d_bsd'
22488 d_bsdgetpgrp='$d_bsdgetpgrp'
22489 d_bsdsetpgrp='$d_bsdsetpgrp'
22490 d_builtin_choose_expr='$d_builtin_choose_expr'
22491 d_builtin_expect='$d_builtin_expect'
22492 d_bzero='$d_bzero'
22493 d_c99_variadic_macros='$d_c99_variadic_macros'
22494 d_casti32='$d_casti32'
22495 d_castneg='$d_castneg'
22496 d_charvspr='$d_charvspr'
22497 d_chown='$d_chown'
22498 d_chroot='$d_chroot'
22499 d_chsize='$d_chsize'
22500 d_class='$d_class'
22501 d_clearenv='$d_clearenv'
22502 d_closedir='$d_closedir'
22503 d_cmsghdr_s='$d_cmsghdr_s'
22504 d_const='$d_const'
22505 d_copysignl='$d_copysignl'
22506 d_cplusplus='$d_cplusplus'
22507 d_crypt='$d_crypt'
22508 d_crypt_r='$d_crypt_r'
22509 d_csh='$d_csh'
22510 d_ctermid='$d_ctermid'
22511 d_ctermid_r='$d_ctermid_r'
22512 d_ctime64='$d_ctime64'
22513 d_ctime_r='$d_ctime_r'
22514 d_cuserid='$d_cuserid'
22515 d_dbl_dig='$d_dbl_dig'
22516 d_dbminitproto='$d_dbminitproto'
22517 d_difftime64='$d_difftime64'
22518 d_difftime='$d_difftime'
22519 d_dir_dd_fd='$d_dir_dd_fd'
22520 d_dirfd='$d_dirfd'
22521 d_dirnamlen='$d_dirnamlen'
22522 d_dlerror='$d_dlerror'
22523 d_dlopen='$d_dlopen'
22524 d_dlsymun='$d_dlsymun'
22525 d_dosuid='$d_dosuid'
22526 d_drand48_r='$d_drand48_r'
22527 d_drand48proto='$d_drand48proto'
22528 d_dup2='$d_dup2'
22529 d_eaccess='$d_eaccess'
22530 d_endgrent='$d_endgrent'
22531 d_endgrent_r='$d_endgrent_r'
22532 d_endhent='$d_endhent'
22533 d_endhostent_r='$d_endhostent_r'
22534 d_endnent='$d_endnent'
22535 d_endnetent_r='$d_endnetent_r'
22536 d_endpent='$d_endpent'
22537 d_endprotoent_r='$d_endprotoent_r'
22538 d_endpwent='$d_endpwent'
22539 d_endpwent_r='$d_endpwent_r'
22540 d_endsent='$d_endsent'
22541 d_endservent_r='$d_endservent_r'
22542 d_eofnblk='$d_eofnblk'
22543 d_eunice='$d_eunice'
22544 d_faststdio='$d_faststdio'
22545 d_fchdir='$d_fchdir'
22546 d_fchmod='$d_fchmod'
22547 d_fchown='$d_fchown'
22548 d_fcntl='$d_fcntl'
22549 d_fcntl_can_lock='$d_fcntl_can_lock'
22550 d_fd_macros='$d_fd_macros'
22551 d_fd_set='$d_fd_set'
22552 d_fds_bits='$d_fds_bits'
22553 d_fgetpos='$d_fgetpos'
22554 d_finite='$d_finite'
22555 d_finitel='$d_finitel'
22556 d_flexfnam='$d_flexfnam'
22557 d_flock='$d_flock'
22558 d_flockproto='$d_flockproto'
22559 d_fork='$d_fork'
22560 d_fp_class='$d_fp_class'
22561 d_fpathconf='$d_fpathconf'
22562 d_fpclass='$d_fpclass'
22563 d_fpclassify='$d_fpclassify'
22564 d_fpclassl='$d_fpclassl'
22565 d_fpos64_t='$d_fpos64_t'
22566 d_frexpl='$d_frexpl'
22567 d_fs_data_s='$d_fs_data_s'
22568 d_fseeko='$d_fseeko'
22569 d_fsetpos='$d_fsetpos'
22570 d_fstatfs='$d_fstatfs'
22571 d_fstatvfs='$d_fstatvfs'
22572 d_fsync='$d_fsync'
22573 d_ftello='$d_ftello'
22574 d_ftime='$d_ftime'
22575 d_futimes='$d_futimes'
22576 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22577 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22578 d_getaddrinfo='$d_getaddrinfo'
22579 d_getcwd='$d_getcwd'
22580 d_getespwnam='$d_getespwnam'
22581 d_getfsstat='$d_getfsstat'
22582 d_getgrent='$d_getgrent'
22583 d_getgrent_r='$d_getgrent_r'
22584 d_getgrgid_r='$d_getgrgid_r'
22585 d_getgrnam_r='$d_getgrnam_r'
22586 d_getgrps='$d_getgrps'
22587 d_gethbyaddr='$d_gethbyaddr'
22588 d_gethbyname='$d_gethbyname'
22589 d_gethent='$d_gethent'
22590 d_gethname='$d_gethname'
22591 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22592 d_gethostbyname_r='$d_gethostbyname_r'
22593 d_gethostent_r='$d_gethostent_r'
22594 d_gethostprotos='$d_gethostprotos'
22595 d_getitimer='$d_getitimer'
22596 d_getlogin='$d_getlogin'
22597 d_getlogin_r='$d_getlogin_r'
22598 d_getmnt='$d_getmnt'
22599 d_getmntent='$d_getmntent'
22600 d_getnameinfo='$d_getnameinfo'
22601 d_getnbyaddr='$d_getnbyaddr'
22602 d_getnbyname='$d_getnbyname'
22603 d_getnent='$d_getnent'
22604 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22605 d_getnetbyname_r='$d_getnetbyname_r'
22606 d_getnetent_r='$d_getnetent_r'
22607 d_getnetprotos='$d_getnetprotos'
22608 d_getpagsz='$d_getpagsz'
22609 d_getpbyname='$d_getpbyname'
22610 d_getpbynumber='$d_getpbynumber'
22611 d_getpent='$d_getpent'
22612 d_getpgid='$d_getpgid'
22613 d_getpgrp2='$d_getpgrp2'
22614 d_getpgrp='$d_getpgrp'
22615 d_getppid='$d_getppid'
22616 d_getprior='$d_getprior'
22617 d_getprotobyname_r='$d_getprotobyname_r'
22618 d_getprotobynumber_r='$d_getprotobynumber_r'
22619 d_getprotoent_r='$d_getprotoent_r'
22620 d_getprotoprotos='$d_getprotoprotos'
22621 d_getprpwnam='$d_getprpwnam'
22622 d_getpwent='$d_getpwent'
22623 d_getpwent_r='$d_getpwent_r'
22624 d_getpwnam_r='$d_getpwnam_r'
22625 d_getpwuid_r='$d_getpwuid_r'
22626 d_getsbyname='$d_getsbyname'
22627 d_getsbyport='$d_getsbyport'
22628 d_getsent='$d_getsent'
22629 d_getservbyname_r='$d_getservbyname_r'
22630 d_getservbyport_r='$d_getservbyport_r'
22631 d_getservent_r='$d_getservent_r'
22632 d_getservprotos='$d_getservprotos'
22633 d_getspnam='$d_getspnam'
22634 d_getspnam_r='$d_getspnam_r'
22635 d_gettimeod='$d_gettimeod'
22636 d_gmtime64='$d_gmtime64'
22637 d_gmtime_r='$d_gmtime_r'
22638 d_gnulibc='$d_gnulibc'
22639 d_grpasswd='$d_grpasswd'
22640 d_hasmntopt='$d_hasmntopt'
22641 d_htonl='$d_htonl'
22642 d_ilogbl='$d_ilogbl'
22643 d_inc_version_list='$d_inc_version_list'
22644 d_index='$d_index'
22645 d_inetaton='$d_inetaton'
22646 d_inetntop='$d_inetntop'
22647 d_inetpton='$d_inetpton'
22648 d_int64_t='$d_int64_t'
22649 d_isascii='$d_isascii'
22650 d_isfinite='$d_isfinite'
22651 d_isinf='$d_isinf'
22652 d_isnan='$d_isnan'
22653 d_isnanl='$d_isnanl'
22654 d_killpg='$d_killpg'
22655 d_lchown='$d_lchown'
22656 d_ldbl_dig='$d_ldbl_dig'
22657 d_libm_lib_version='$d_libm_lib_version'
22658 d_link='$d_link'
22659 d_localtime64='$d_localtime64'
22660 d_localtime_r='$d_localtime_r'
22661 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22662 d_locconv='$d_locconv'
22663 d_lockf='$d_lockf'
22664 d_longdbl='$d_longdbl'
22665 d_longlong='$d_longlong'
22666 d_lseekproto='$d_lseekproto'
22667 d_lstat='$d_lstat'
22668 d_madvise='$d_madvise'
22669 d_malloc_good_size='$d_malloc_good_size'
22670 d_malloc_size='$d_malloc_size'
22671 d_mblen='$d_mblen'
22672 d_mbstowcs='$d_mbstowcs'
22673 d_mbtowc='$d_mbtowc'
22674 d_memchr='$d_memchr'
22675 d_memcmp='$d_memcmp'
22676 d_memcpy='$d_memcpy'
22677 d_memmove='$d_memmove'
22678 d_memset='$d_memset'
22679 d_mkdir='$d_mkdir'
22680 d_mkdtemp='$d_mkdtemp'
22681 d_mkfifo='$d_mkfifo'
22682 d_mkstemp='$d_mkstemp'
22683 d_mkstemps='$d_mkstemps'
22684 d_mktime64='$d_mktime64'
22685 d_mktime='$d_mktime'
22686 d_mmap='$d_mmap'
22687 d_modfl='$d_modfl'
22688 d_modfl_pow32_bug='$d_modfl_pow32_bug'
22689 d_modflproto='$d_modflproto'
22690 d_mprotect='$d_mprotect'
22691 d_msg='$d_msg'
22692 d_msg_ctrunc='$d_msg_ctrunc'
22693 d_msg_dontroute='$d_msg_dontroute'
22694 d_msg_oob='$d_msg_oob'
22695 d_msg_peek='$d_msg_peek'
22696 d_msg_proxy='$d_msg_proxy'
22697 d_msgctl='$d_msgctl'
22698 d_msgget='$d_msgget'
22699 d_msghdr_s='$d_msghdr_s'
22700 d_msgrcv='$d_msgrcv'
22701 d_msgsnd='$d_msgsnd'
22702 d_msync='$d_msync'
22703 d_munmap='$d_munmap'
22704 d_mymalloc='$d_mymalloc'
22705 d_ndbm='$d_ndbm'
22706 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
22707 d_nice='$d_nice'
22708 d_nl_langinfo='$d_nl_langinfo'
22709 d_nv_preserves_uv='$d_nv_preserves_uv'
22710 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
22711 d_off64_t='$d_off64_t'
22712 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
22713 d_oldpthreads='$d_oldpthreads'
22714 d_oldsock='$d_oldsock'
22715 d_open3='$d_open3'
22716 d_pathconf='$d_pathconf'
22717 d_pause='$d_pause'
22718 d_perl_otherlibdirs='$d_perl_otherlibdirs'
22719 d_phostname='$d_phostname'
22720 d_pipe='$d_pipe'
22721 d_poll='$d_poll'
22722 d_portable='$d_portable'
22723 d_prctl='$d_prctl'
22724 d_prctl_set_name='$d_prctl_set_name'
22725 d_printf_format_null='$d_printf_format_null'
22726 d_procselfexe='$d_procselfexe'
22727 d_pseudofork='$d_pseudofork'
22728 d_pthread_atfork='$d_pthread_atfork'
22729 d_pthread_attr_setscope='$d_pthread_attr_setscope'
22730 d_pthread_yield='$d_pthread_yield'
22731 d_pwage='$d_pwage'
22732 d_pwchange='$d_pwchange'
22733 d_pwclass='$d_pwclass'
22734 d_pwcomment='$d_pwcomment'
22735 d_pwexpire='$d_pwexpire'
22736 d_pwgecos='$d_pwgecos'
22737 d_pwpasswd='$d_pwpasswd'
22738 d_pwquota='$d_pwquota'
22739 d_qgcvt='$d_qgcvt'
22740 d_quad='$d_quad'
22741 d_random_r='$d_random_r'
22742 d_readdir64_r='$d_readdir64_r'
22743 d_readdir='$d_readdir'
22744 d_readdir_r='$d_readdir_r'
22745 d_readlink='$d_readlink'
22746 d_readv='$d_readv'
22747 d_recvmsg='$d_recvmsg'
22748 d_rename='$d_rename'
22749 d_rewinddir='$d_rewinddir'
22750 d_rmdir='$d_rmdir'
22751 d_safebcpy='$d_safebcpy'
22752 d_safemcpy='$d_safemcpy'
22753 d_sanemcmp='$d_sanemcmp'
22754 d_sbrkproto='$d_sbrkproto'
22755 d_scalbnl='$d_scalbnl'
22756 d_sched_yield='$d_sched_yield'
22757 d_scm_rights='$d_scm_rights'
22758 d_seekdir='$d_seekdir'
22759 d_select='$d_select'
22760 d_sem='$d_sem'
22761 d_semctl='$d_semctl'
22762 d_semctl_semid_ds='$d_semctl_semid_ds'
22763 d_semctl_semun='$d_semctl_semun'
22764 d_semget='$d_semget'
22765 d_semop='$d_semop'
22766 d_sendmsg='$d_sendmsg'
22767 d_setegid='$d_setegid'
22768 d_seteuid='$d_seteuid'
22769 d_setgrent='$d_setgrent'
22770 d_setgrent_r='$d_setgrent_r'
22771 d_setgrps='$d_setgrps'
22772 d_sethent='$d_sethent'
22773 d_sethostent_r='$d_sethostent_r'
22774 d_setitimer='$d_setitimer'
22775 d_setlinebuf='$d_setlinebuf'
22776 d_setlocale='$d_setlocale'
22777 d_setlocale_r='$d_setlocale_r'
22778 d_setnent='$d_setnent'
22779 d_setnetent_r='$d_setnetent_r'
22780 d_setpent='$d_setpent'
22781 d_setpgid='$d_setpgid'
22782 d_setpgrp2='$d_setpgrp2'
22783 d_setpgrp='$d_setpgrp'
22784 d_setprior='$d_setprior'
22785 d_setproctitle='$d_setproctitle'
22786 d_setprotoent_r='$d_setprotoent_r'
22787 d_setpwent='$d_setpwent'
22788 d_setpwent_r='$d_setpwent_r'
22789 d_setregid='$d_setregid'
22790 d_setresgid='$d_setresgid'
22791 d_setresuid='$d_setresuid'
22792 d_setreuid='$d_setreuid'
22793 d_setrgid='$d_setrgid'
22794 d_setruid='$d_setruid'
22795 d_setsent='$d_setsent'
22796 d_setservent_r='$d_setservent_r'
22797 d_setsid='$d_setsid'
22798 d_setvbuf='$d_setvbuf'
22799 d_sfio='$d_sfio'
22800 d_shm='$d_shm'
22801 d_shmat='$d_shmat'
22802 d_shmatprototype='$d_shmatprototype'
22803 d_shmctl='$d_shmctl'
22804 d_shmdt='$d_shmdt'
22805 d_shmget='$d_shmget'
22806 d_sigaction='$d_sigaction'
22807 d_signbit='$d_signbit'
22808 d_sigprocmask='$d_sigprocmask'
22809 d_sigsetjmp='$d_sigsetjmp'
22810 d_sitearch='$d_sitearch'
22811 d_snprintf='$d_snprintf'
22812 d_sockatmark='$d_sockatmark'
22813 d_sockatmarkproto='$d_sockatmarkproto'
22814 d_socket='$d_socket'
22815 d_socklen_t='$d_socklen_t'
22816 d_sockpair='$d_sockpair'
22817 d_socks5_init='$d_socks5_init'
22818 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
22819 d_sqrtl='$d_sqrtl'
22820 d_srand48_r='$d_srand48_r'
22821 d_srandom_r='$d_srandom_r'
22822 d_sresgproto='$d_sresgproto'
22823 d_sresuproto='$d_sresuproto'
22824 d_statblks='$d_statblks'
22825 d_statfs_f_flags='$d_statfs_f_flags'
22826 d_statfs_s='$d_statfs_s'
22827 d_static_inline='$d_static_inline'
22828 d_statvfs='$d_statvfs'
22829 d_stdio_cnt_lval='$d_stdio_cnt_lval'
22830 d_stdio_ptr_lval='$d_stdio_ptr_lval'
22831 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
22832 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
22833 d_stdio_stream_array='$d_stdio_stream_array'
22834 d_stdiobase='$d_stdiobase'
22835 d_stdstdio='$d_stdstdio'
22836 d_strchr='$d_strchr'
22837 d_strcoll='$d_strcoll'
22838 d_strctcpy='$d_strctcpy'
22839 d_strerrm='$d_strerrm'
22840 d_strerror='$d_strerror'
22841 d_strerror_r='$d_strerror_r'
22842 d_strftime='$d_strftime'
22843 d_strlcat='$d_strlcat'
22844 d_strlcpy='$d_strlcpy'
22845 d_strtod='$d_strtod'
22846 d_strtol='$d_strtol'
22847 d_strtold='$d_strtold'
22848 d_strtoll='$d_strtoll'
22849 d_strtoq='$d_strtoq'
22850 d_strtoul='$d_strtoul'
22851 d_strtoull='$d_strtoull'
22852 d_strtouq='$d_strtouq'
22853 d_strxfrm='$d_strxfrm'
22854 d_suidsafe='$d_suidsafe'
22855 d_symlink='$d_symlink'
22856 d_syscall='$d_syscall'
22857 d_syscallproto='$d_syscallproto'
22858 d_sysconf='$d_sysconf'
22859 d_sysernlst='$d_sysernlst'
22860 d_syserrlst='$d_syserrlst'
22861 d_system='$d_system'
22862 d_tcgetpgrp='$d_tcgetpgrp'
22863 d_tcsetpgrp='$d_tcsetpgrp'
22864 d_telldir='$d_telldir'
22865 d_telldirproto='$d_telldirproto'
22866 d_time='$d_time'
22867 d_timegm='$d_timegm'
22868 d_times='$d_times'
22869 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
22870 d_tm_tm_zone='$d_tm_tm_zone'
22871 d_tmpnam_r='$d_tmpnam_r'
22872 d_truncate='$d_truncate'
22873 d_ttyname_r='$d_ttyname_r'
22874 d_tzname='$d_tzname'
22875 d_u32align='$d_u32align'
22876 d_ualarm='$d_ualarm'
22877 d_umask='$d_umask'
22878 d_uname='$d_uname'
22879 d_union_semun='$d_union_semun'
22880 d_unordered='$d_unordered'
22881 d_unsetenv='$d_unsetenv'
22882 d_usleep='$d_usleep'
22883 d_usleepproto='$d_usleepproto'
22884 d_ustat='$d_ustat'
22885 d_vendorarch='$d_vendorarch'
22886 d_vendorbin='$d_vendorbin'
22887 d_vendorlib='$d_vendorlib'
22888 d_vendorscript='$d_vendorscript'
22889 d_vfork='$d_vfork'
22890 d_void_closedir='$d_void_closedir'
22891 d_voidsig='$d_voidsig'
22892 d_voidtty='$d_voidtty'
22893 d_volatile='$d_volatile'
22894 d_vprintf='$d_vprintf'
22895 d_vsnprintf='$d_vsnprintf'
22896 d_wait4='$d_wait4'
22897 d_waitpid='$d_waitpid'
22898 d_wcstombs='$d_wcstombs'
22899 d_wctomb='$d_wctomb'
22900 d_writev='$d_writev'
22901 d_xenix='$d_xenix'
22902 date='$date'
22903 db_hashtype='$db_hashtype'
22904 db_prefixtype='$db_prefixtype'
22905 db_version_major='$db_version_major'
22906 db_version_minor='$db_version_minor'
22907 db_version_patch='$db_version_patch'
22908 defvoidused='$defvoidused'
22909 direntrytype='$direntrytype'
22910 dlext='$dlext'
22911 dlsrc='$dlsrc'
22912 doublesize='$doublesize'
22913 drand01='$drand01'
22914 drand48_r_proto='$drand48_r_proto'
22915 dtrace='$dtrace'
22916 dynamic_ext='$dynamic_ext'
22917 eagain='$eagain'
22918 ebcdic='$ebcdic'
22919 echo='$echo'
22920 egrep='$egrep'
22921 emacs='$emacs'
22922 endgrent_r_proto='$endgrent_r_proto'
22923 endhostent_r_proto='$endhostent_r_proto'
22924 endnetent_r_proto='$endnetent_r_proto'
22925 endprotoent_r_proto='$endprotoent_r_proto'
22926 endpwent_r_proto='$endpwent_r_proto'
22927 endservent_r_proto='$endservent_r_proto'
22928 eunicefix='$eunicefix'
22929 exe_ext='$exe_ext'
22930 expr='$expr'
22931 extensions='$extensions'
22932 extern_C='$extern_C'
22933 extras='$extras'
22934 fflushNULL='$fflushNULL'
22935 fflushall='$fflushall'
22936 find='$find'
22937 firstmakefile='$firstmakefile'
22938 flex='$flex'
22939 fpossize='$fpossize'
22940 fpostype='$fpostype'
22941 freetype='$freetype'
22942 from='$from'
22943 full_ar='$full_ar'
22944 full_csh='$full_csh'
22945 full_sed='$full_sed'
22946 gccansipedantic='$gccansipedantic'
22947 gccosandvers='$gccosandvers'
22948 gccversion='$gccversion'
22949 getgrent_r_proto='$getgrent_r_proto'
22950 getgrgid_r_proto='$getgrgid_r_proto'
22951 getgrnam_r_proto='$getgrnam_r_proto'
22952 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22953 gethostbyname_r_proto='$gethostbyname_r_proto'
22954 gethostent_r_proto='$gethostent_r_proto'
22955 getlogin_r_proto='$getlogin_r_proto'
22956 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22957 getnetbyname_r_proto='$getnetbyname_r_proto'
22958 getnetent_r_proto='$getnetent_r_proto'
22959 getprotobyname_r_proto='$getprotobyname_r_proto'
22960 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22961 getprotoent_r_proto='$getprotoent_r_proto'
22962 getpwent_r_proto='$getpwent_r_proto'
22963 getpwnam_r_proto='$getpwnam_r_proto'
22964 getpwuid_r_proto='$getpwuid_r_proto'
22965 getservbyname_r_proto='$getservbyname_r_proto'
22966 getservbyport_r_proto='$getservbyport_r_proto'
22967 getservent_r_proto='$getservent_r_proto'
22968 getspnam_r_proto='$getspnam_r_proto'
22969 gidformat='$gidformat'
22970 gidsign='$gidsign'
22971 gidsize='$gidsize'
22972 gidtype='$gidtype'
22973 glibpth='$glibpth'
22974 gmake='$gmake'
22975 gmtime_r_proto='$gmtime_r_proto'
22976 gnulibc_version='$gnulibc_version'
22977 grep='$grep'
22978 groupcat='$groupcat'
22979 groupstype='$groupstype'
22980 gzip='$gzip'
22981 h_fcntl='$h_fcntl'
22982 h_sysfile='$h_sysfile'
22983 hint='$hint'
22984 hostcat='$hostcat'
22985 html1dir='$html1dir'
22986 html1direxp='$html1direxp'
22987 html3dir='$html3dir'
22988 html3direxp='$html3direxp'
22989 i16size='$i16size'
22990 i16type='$i16type'
22991 i32size='$i32size'
22992 i32type='$i32type'
22993 i64size='$i64size'
22994 i64type='$i64type'
22995 i8size='$i8size'
22996 i8type='$i8type'
22997 i_arpainet='$i_arpainet'
22998 i_assert='$i_assert'
22999 i_bsdioctl='$i_bsdioctl'
23000 i_crypt='$i_crypt'
23001 i_db='$i_db'
23002 i_dbm='$i_dbm'
23003 i_dirent='$i_dirent'
23004 i_dld='$i_dld'
23005 i_dlfcn='$i_dlfcn'
23006 i_fcntl='$i_fcntl'
23007 i_float='$i_float'
23008 i_fp='$i_fp'
23009 i_fp_class='$i_fp_class'
23010 i_gdbm='$i_gdbm'
23011 i_gdbm_ndbm='$i_gdbm_ndbm'
23012 i_gdbmndbm='$i_gdbmndbm'
23013 i_grp='$i_grp'
23014 i_ieeefp='$i_ieeefp'
23015 i_inttypes='$i_inttypes'
23016 i_langinfo='$i_langinfo'
23017 i_libutil='$i_libutil'
23018 i_limits='$i_limits'
23019 i_locale='$i_locale'
23020 i_machcthr='$i_machcthr'
23021 i_malloc='$i_malloc'
23022 i_mallocmalloc='$i_mallocmalloc'
23023 i_math='$i_math'
23024 i_memory='$i_memory'
23025 i_mntent='$i_mntent'
23026 i_ndbm='$i_ndbm'
23027 i_netdb='$i_netdb'
23028 i_neterrno='$i_neterrno'
23029 i_netinettcp='$i_netinettcp'
23030 i_niin='$i_niin'
23031 i_poll='$i_poll'
23032 i_prot='$i_prot'
23033 i_pthread='$i_pthread'
23034 i_pwd='$i_pwd'
23035 i_rpcsvcdbm='$i_rpcsvcdbm'
23036 i_sfio='$i_sfio'
23037 i_sgtty='$i_sgtty'
23038 i_shadow='$i_shadow'
23039 i_socks='$i_socks'
23040 i_stdarg='$i_stdarg'
23041 i_stddef='$i_stddef'
23042 i_stdlib='$i_stdlib'
23043 i_string='$i_string'
23044 i_sunmath='$i_sunmath'
23045 i_sysaccess='$i_sysaccess'
23046 i_sysdir='$i_sysdir'
23047 i_sysfile='$i_sysfile'
23048 i_sysfilio='$i_sysfilio'
23049 i_sysin='$i_sysin'
23050 i_sysioctl='$i_sysioctl'
23051 i_syslog='$i_syslog'
23052 i_sysmman='$i_sysmman'
23053 i_sysmode='$i_sysmode'
23054 i_sysmount='$i_sysmount'
23055 i_sysndir='$i_sysndir'
23056 i_sysparam='$i_sysparam'
23057 i_syspoll='$i_syspoll'
23058 i_sysresrc='$i_sysresrc'
23059 i_syssecrt='$i_syssecrt'
23060 i_sysselct='$i_sysselct'
23061 i_syssockio='$i_syssockio'
23062 i_sysstat='$i_sysstat'
23063 i_sysstatfs='$i_sysstatfs'
23064 i_sysstatvfs='$i_sysstatvfs'
23065 i_systime='$i_systime'
23066 i_systimek='$i_systimek'
23067 i_systimes='$i_systimes'
23068 i_systypes='$i_systypes'
23069 i_sysuio='$i_sysuio'
23070 i_sysun='$i_sysun'
23071 i_sysutsname='$i_sysutsname'
23072 i_sysvfs='$i_sysvfs'
23073 i_syswait='$i_syswait'
23074 i_termio='$i_termio'
23075 i_termios='$i_termios'
23076 i_time='$i_time'
23077 i_unistd='$i_unistd'
23078 i_ustat='$i_ustat'
23079 i_utime='$i_utime'
23080 i_values='$i_values'
23081 i_varargs='$i_varargs'
23082 i_varhdr='$i_varhdr'
23083 i_vfork='$i_vfork'
23084 ignore_versioned_solibs='$ignore_versioned_solibs'
23085 inc_version_list='$inc_version_list'
23086 inc_version_list_init='$inc_version_list_init'
23087 incpath='$incpath'
23088 inews='$inews'
23089 initialinstalllocation='$initialinstalllocation'
23090 installarchlib='$installarchlib'
23091 installbin='$installbin'
23092 installhtml1dir='$installhtml1dir'
23093 installhtml3dir='$installhtml3dir'
23094 installman1dir='$installman1dir'
23095 installman3dir='$installman3dir'
23096 installprefix='$installprefix'
23097 installprefixexp='$installprefixexp'
23098 installprivlib='$installprivlib'
23099 installscript='$installscript'
23100 installsitearch='$installsitearch'
23101 installsitebin='$installsitebin'
23102 installsitehtml1dir='$installsitehtml1dir'
23103 installsitehtml3dir='$installsitehtml3dir'
23104 installsitelib='$installsitelib'
23105 installsiteman1dir='$installsiteman1dir'
23106 installsiteman3dir='$installsiteman3dir'
23107 installsitescript='$installsitescript'
23108 installstyle='$installstyle'
23109 installusrbinperl='$installusrbinperl'
23110 installvendorarch='$installvendorarch'
23111 installvendorbin='$installvendorbin'
23112 installvendorhtml1dir='$installvendorhtml1dir'
23113 installvendorhtml3dir='$installvendorhtml3dir'
23114 installvendorlib='$installvendorlib'
23115 installvendorman1dir='$installvendorman1dir'
23116 installvendorman3dir='$installvendorman3dir'
23117 installvendorscript='$installvendorscript'
23118 intsize='$intsize'
23119 issymlink='$issymlink'
23120 ivdformat='$ivdformat'
23121 ivsize='$ivsize'
23122 ivtype='$ivtype'
23123 known_extensions='$known_extensions'
23124 ksh='$ksh'
23125 ld='$ld'
23126 lddlflags='$lddlflags'
23127 ldflags='$ldflags'
23128 ldflags_uselargefiles='$ldflags_uselargefiles'
23129 ldlibpthname='$ldlibpthname'
23130 less='$less'
23131 lib_ext='$lib_ext'
23132 libc='$libc'
23133 libperl='$libperl'
23134 libpth='$libpth'
23135 libs='$libs'
23136 libsdirs='$libsdirs'
23137 libsfiles='$libsfiles'
23138 libsfound='$libsfound'
23139 libspath='$libspath'
23140 libswanted='$libswanted'
23141 libswanted_uselargefiles='$libswanted_uselargefiles'
23142 line='$line'
23143 lint='$lint'
23144 lkflags='$lkflags'
23145 ln='$ln'
23146 lns='$lns'
23147 localtime_r_proto='$localtime_r_proto'
23148 locincpth='$locincpth'
23149 loclibpth='$loclibpth'
23150 longdblsize='$longdblsize'
23151 longlongsize='$longlongsize'
23152 longsize='$longsize'
23153 lp='$lp'
23154 lpr='$lpr'
23155 ls='$ls'
23156 lseeksize='$lseeksize'
23157 lseektype='$lseektype'
23158 mad='$mad'
23159 madlyh='$madlyh'
23160 madlyobj='$madlyobj'
23161 madlysrc='$madlysrc'
23162 mail='$mail'
23163 mailx='$mailx'
23164 make='$make'
23165 make_set_make='$make_set_make'
23166 mallocobj='$mallocobj'
23167 mallocsrc='$mallocsrc'
23168 malloctype='$malloctype'
23169 man1dir='$man1dir'
23170 man1direxp='$man1direxp'
23171 man1ext='$man1ext'
23172 man3dir='$man3dir'
23173 man3direxp='$man3direxp'
23174 man3ext='$man3ext'
23175 mips_type='$mips_type'
23176 mistrustnm='$mistrustnm'
23177 mkdir='$mkdir'
23178 mmaptype='$mmaptype'
23179 modetype='$modetype'
23180 more='$more'
23181 multiarch='$multiarch'
23182 mv='$mv'
23183 myarchname='$myarchname'
23184 mydomain='$mydomain'
23185 myhostname='$myhostname'
23186 myuname='$myuname'
23187 n='$n'
23188 need_va_copy='$need_va_copy'
23189 netdb_hlen_type='$netdb_hlen_type'
23190 netdb_host_type='$netdb_host_type'
23191 netdb_name_type='$netdb_name_type'
23192 netdb_net_type='$netdb_net_type'
23193 nm='$nm'
23194 nm_opt='$nm_opt'
23195 nm_so_opt='$nm_so_opt'
23196 nonxs_ext='$nonxs_ext'
23197 nroff='$nroff'
23198 nvEUformat='$nvEUformat'
23199 nvFUformat='$nvFUformat'
23200 nvGUformat='$nvGUformat'
23201 nv_overflows_integers_at='$nv_overflows_integers_at'
23202 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23203 nveformat='$nveformat'
23204 nvfformat='$nvfformat'
23205 nvgformat='$nvgformat'
23206 nvsize='$nvsize'
23207 nvtype='$nvtype'
23208 o_nonblock='$o_nonblock'
23209 obj_ext='$obj_ext'
23210 old_pthread_create_joinable='$old_pthread_create_joinable'
23211 optimize='$optimize'
23212 orderlib='$orderlib'
23213 osname='$osname'
23214 osvers='$osvers'
23215 otherlibdirs='$otherlibdirs'
23216 package='$package'
23217 pager='$pager'
23218 passcat='$passcat'
23219 patchlevel='$patchlevel'
23220 path_sep='$path_sep'
23221 perl5='$perl5'
23222 perl='$perl'
23223 perl_patchlevel='$perl_patchlevel'
23224 perl_static_inline='$perl_static_inline'
23225 perladmin='$perladmin'
23226 perllibs='$perllibs'
23227 perlpath='$perlpath'
23228 pg='$pg'
23229 phostname='$phostname'
23230 pidtype='$pidtype'
23231 plibpth='$plibpth'
23232 pmake='$pmake'
23233 pr='$pr'
23234 prefix='$prefix'
23235 prefixexp='$prefixexp'
23236 privlib='$privlib'
23237 privlibexp='$privlibexp'
23238 procselfexe='$procselfexe'
23239 prototype='$prototype'
23240 ptrsize='$ptrsize'
23241 quadkind='$quadkind'
23242 quadtype='$quadtype'
23243 randbits='$randbits'
23244 randfunc='$randfunc'
23245 random_r_proto='$random_r_proto'
23246 randseedtype='$randseedtype'
23247 ranlib='$ranlib'
23248 rd_nodata='$rd_nodata'
23249 readdir64_r_proto='$readdir64_r_proto'
23250 readdir_r_proto='$readdir_r_proto'
23251 revision='$revision'
23252 rm='$rm'
23253 rm_try='$rm_try'
23254 rmail='$rmail'
23255 run='$run'
23256 runnm='$runnm'
23257 sGMTIME_max='$sGMTIME_max'
23258 sGMTIME_min='$sGMTIME_min'
23259 sLOCALTIME_max='$sLOCALTIME_max'
23260 sLOCALTIME_min='$sLOCALTIME_min'
23261 sPRIEUldbl='$sPRIEUldbl'
23262 sPRIFUldbl='$sPRIFUldbl'
23263 sPRIGUldbl='$sPRIGUldbl'
23264 sPRIXU64='$sPRIXU64'
23265 sPRId64='$sPRId64'
23266 sPRIeldbl='$sPRIeldbl'
23267 sPRIfldbl='$sPRIfldbl'
23268 sPRIgldbl='$sPRIgldbl'
23269 sPRIi64='$sPRIi64'
23270 sPRIo64='$sPRIo64'
23271 sPRIu64='$sPRIu64'
23272 sPRIx64='$sPRIx64'
23273 sSCNfldbl='$sSCNfldbl'
23274 sched_yield='$sched_yield'
23275 scriptdir='$scriptdir'
23276 scriptdirexp='$scriptdirexp'
23277 sed='$sed'
23278 seedfunc='$seedfunc'
23279 selectminbits='$selectminbits'
23280 selecttype='$selecttype'
23281 sendmail='$sendmail'
23282 setgrent_r_proto='$setgrent_r_proto'
23283 sethostent_r_proto='$sethostent_r_proto'
23284 setlocale_r_proto='$setlocale_r_proto'
23285 setnetent_r_proto='$setnetent_r_proto'
23286 setprotoent_r_proto='$setprotoent_r_proto'
23287 setpwent_r_proto='$setpwent_r_proto'
23288 setservent_r_proto='$setservent_r_proto'
23289 sh='$sh'
23290 shar='$shar'
23291 sharpbang='$sharpbang'
23292 shmattype='$shmattype'
23293 shortsize='$shortsize'
23294 shrpenv='$shrpenv'
23295 shsharp='$shsharp'
23296 sig_count='$sig_count'
23297 sig_name='$sig_name'
23298 sig_name_init='$sig_name_init'
23299 sig_num='$sig_num'
23300 sig_num_init='$sig_num_init'
23301 sig_size='$sig_size'
23302 signal_t='$signal_t'
23303 sitearch='$sitearch'
23304 sitearchexp='$sitearchexp'
23305 sitebin='$sitebin'
23306 sitebinexp='$sitebinexp'
23307 sitehtml1dir='$sitehtml1dir'
23308 sitehtml1direxp='$sitehtml1direxp'
23309 sitehtml3dir='$sitehtml3dir'
23310 sitehtml3direxp='$sitehtml3direxp'
23311 sitelib='$sitelib'
23312 sitelib_stem='$sitelib_stem'
23313 sitelibexp='$sitelibexp'
23314 siteman1dir='$siteman1dir'
23315 siteman1direxp='$siteman1direxp'
23316 siteman3dir='$siteman3dir'
23317 siteman3direxp='$siteman3direxp'
23318 siteprefix='$siteprefix'
23319 siteprefixexp='$siteprefixexp'
23320 sitescript='$sitescript'
23321 sitescriptexp='$sitescriptexp'
23322 sizesize='$sizesize'
23323 sizetype='$sizetype'
23324 sleep='$sleep'
23325 smail='$smail'
23326 so='$so'
23327 sockethdr='$sockethdr'
23328 socketlib='$socketlib'
23329 socksizetype='$socksizetype'
23330 sort='$sort'
23331 spackage='$spackage'
23332 spitshell='$spitshell'
23333 srand48_r_proto='$srand48_r_proto'
23334 srandom_r_proto='$srandom_r_proto'
23335 src='$src'
23336 ssizetype='$ssizetype'
23337 startperl='$startperl'
23338 startsh='$startsh'
23339 static_ext='$static_ext'
23340 stdchar='$stdchar'
23341 stdio_base='$stdio_base'
23342 stdio_bufsiz='$stdio_bufsiz'
23343 stdio_cnt='$stdio_cnt'
23344 stdio_filbuf='$stdio_filbuf'
23345 stdio_ptr='$stdio_ptr'
23346 stdio_stream_array='$stdio_stream_array'
23347 strerror_r_proto='$strerror_r_proto'
23348 strings='$strings'
23349 submit='$submit'
23350 subversion='$subversion'
23351 sysman='$sysman'
23352 tail='$tail'
23353 tar='$tar'
23354 targetarch='$targetarch'
23355 tbl='$tbl'
23356 tee='$tee'
23357 test='$test'
23358 timeincl='$timeincl'
23359 timetype='$timetype'
23360 tmpnam_r_proto='$tmpnam_r_proto'
23361 to='$to'
23362 touch='$touch'
23363 tr='$tr'
23364 trnl='$trnl'
23365 troff='$troff'
23366 ttyname_r_proto='$ttyname_r_proto'
23367 u16size='$u16size'
23368 u16type='$u16type'
23369 u32size='$u32size'
23370 u32type='$u32type'
23371 u64size='$u64size'
23372 u64type='$u64type'
23373 u8size='$u8size'
23374 u8type='$u8type'
23375 uidformat='$uidformat'
23376 uidsign='$uidsign'
23377 uidsize='$uidsize'
23378 uidtype='$uidtype'
23379 uname='$uname'
23380 uniq='$uniq'
23381 uquadtype='$uquadtype'
23382 use5005threads='$use5005threads'
23383 use64bitall='$use64bitall'
23384 use64bitint='$use64bitint'
23385 usecrosscompile='$usecrosscompile'
23386 usedevel='$usedevel'
23387 usedl='$usedl'
23388 usedtrace='$usedtrace'
23389 usefaststdio='$usefaststdio'
23390 useithreads='$useithreads'
23391 uselargefiles='$uselargefiles'
23392 uselongdouble='$uselongdouble'
23393 usemallocwrap='$usemallocwrap'
23394 usemorebits='$usemorebits'
23395 usemultiplicity='$usemultiplicity'
23396 usemymalloc='$usemymalloc'
23397 usenm='$usenm'
23398 useopcode='$useopcode'
23399 useperlio='$useperlio'
23400 useposix='$useposix'
23401 usereentrant='$usereentrant'
23402 userelocatableinc='$userelocatableinc'
23403 usesfio='$usesfio'
23404 useshrplib='$useshrplib'
23405 usesitecustomize='$usesitecustomize'
23406 usesocks='$usesocks'
23407 usethreads='$usethreads'
23408 usevendorprefix='$usevendorprefix'
23409 usevfork='$usevfork'
23410 usrinc='$usrinc'
23411 uuname='$uuname'
23412 uvXUformat='$uvXUformat'
23413 uvoformat='$uvoformat'
23414 uvsize='$uvsize'
23415 uvtype='$uvtype'
23416 uvuformat='$uvuformat'
23417 uvxformat='$uvxformat'
23418 vaproto='$vaproto'
23419 vendorarch='$vendorarch'
23420 vendorarchexp='$vendorarchexp'
23421 vendorbin='$vendorbin'
23422 vendorbinexp='$vendorbinexp'
23423 vendorhtml1dir='$vendorhtml1dir'
23424 vendorhtml1direxp='$vendorhtml1direxp'
23425 vendorhtml3dir='$vendorhtml3dir'
23426 vendorhtml3direxp='$vendorhtml3direxp'
23427 vendorlib='$vendorlib'
23428 vendorlib_stem='$vendorlib_stem'
23429 vendorlibexp='$vendorlibexp'
23430 vendorman1dir='$vendorman1dir'
23431 vendorman1direxp='$vendorman1direxp'
23432 vendorman3dir='$vendorman3dir'
23433 vendorman3direxp='$vendorman3direxp'
23434 vendorprefix='$vendorprefix'
23435 vendorprefixexp='$vendorprefixexp'
23436 vendorscript='$vendorscript'
23437 vendorscriptexp='$vendorscriptexp'
23438 version='$version'
23439 version_patchlevel_string='$version_patchlevel_string'
23440 versiononly='$versiononly'
23441 vi='$vi'
23442 voidflags='$voidflags'
23443 xlibpth='$xlibpth'
23444 yacc='$yacc'
23445 yaccflags='$yaccflags'
23446 zcat='$zcat'
23447 zip='$zip'
23448 EOT
23449
23450 : add special variables
23451 $test -f $src/patchlevel.h && \
23452 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23453 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23454 echo "PERL_CONFIG_SH=true" >>config.sh
23455
23456 : propagate old symbols
23457 if $test -f UU/config.sh; then
23458         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23459         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23460                 config.sh config.sh UU/oldconfig.sh |\
23461                 $sort | $uniq -u >UU/oldsyms
23462         set X `cat UU/oldsyms`
23463         shift
23464         case $# in
23465         0) ;;
23466         *)
23467                 cat <<EOM
23468 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23469 EOM
23470                 echo ": Variables propagated from previous config.sh file." >>config.sh
23471                 for sym in `cat UU/oldsyms`; do
23472                         echo "    Propagating $hint variable "'$'"$sym..."
23473                         eval 'tmp="$'"${sym}"'"'
23474                         echo "$tmp" | \
23475                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23476                 done
23477                 ;;
23478         esac
23479 fi
23480
23481 : Finish up by extracting the .SH files
23482 case "$alldone" in
23483 exit)
23484         $rm -rf UU
23485         echo "Extraction done."
23486         exit 0
23487         ;;
23488 cont)
23489         ;;
23490 '')
23491         dflt=''
23492         nostick=true
23493         $cat <<EOM
23494
23495 If you'd like to make any changes to the config.sh file before I begin
23496 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23497
23498 EOM
23499         rp="Press return or use a shell escape to edit config.sh:"
23500         . UU/myread
23501         nostick=''
23502         case "$ans" in
23503         '') ;;
23504         *) : in case they cannot read
23505                 sh 1>&4 -c "$ans";;
23506         esac
23507         ;;
23508 esac
23509
23510 : if this fails, just run all the .SH files by hand
23511 . ./config.sh
23512
23513 echo " "
23514 exec 1>&4
23515 pwd=`pwd`
23516 . ./UU/extract
23517 cd "$pwd"
23518
23519 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23520         dflt=y
23521         case "$silent" in
23522         true) ;;
23523         *)
23524                 $cat <<EOM
23525
23526 Now you need to generate make dependencies by running "$make depend".
23527 You might prefer to run it in background: "$make depend > makedepend.out &"
23528 It can take a while, so you might not want to run it right now.
23529
23530 EOM
23531                 ;;
23532         esac
23533         rp="Run $make depend now?"
23534         . UU/myread
23535         case "$ans" in
23536         y*)
23537                 $make depend && echo "Now you must run '$make'."
23538                 ;;
23539         *)
23540                 echo "You must run '$make depend' then '$make'."
23541                 ;;
23542         esac
23543 elif test -f [Mm]akefile; then
23544         echo " "
23545         echo "Now you must run a $make."
23546 else
23547         echo "Configure done."
23548 fi
23549
23550 if $test -f Policy.sh; then
23551     $cat <<EOM
23552
23553 If you compile $package on a different machine or from a different object
23554 directory, copy the Policy.sh file from this object directory to the
23555 new one before you run Configure -- this will help you with most of
23556 the policy defaults.
23557
23558 EOM
23559 fi
23560 if $test -f config.msg; then
23561     echo "Hmm.  I also noted the following information while running:"
23562     echo " "
23563     $cat config.msg >&4
23564     $rm -f config.msg
23565 fi
23566 $rm -f kit*isdone ark*isdone
23567 $rm -rf UU
23568
23569 : End of Configure
23570