Upgrade to Archive-Tar-1.30. Since change #27571 is not included,
[p5sagit/p5-mst-13.2.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-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Aug  2 13:20:07 CEST 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_c99_variadic_macros=''
363 d_casti32=''
364 castflags=''
365 d_castneg=''
366 d_chown=''
367 d_chroot=''
368 d_chsize=''
369 d_class=''
370 d_clearenv=''
371 d_closedir=''
372 d_void_closedir=''
373 d_cmsghdr_s=''
374 d_const=''
375 d_copysignl=''
376 cryptlib=''
377 d_crypt=''
378 crypt_r_proto=''
379 d_crypt_r=''
380 d_csh=''
381 full_csh=''
382 ctermid_r_proto=''
383 d_ctermid_r=''
384 ctime_r_proto=''
385 d_ctime_r=''
386 d_cuserid=''
387 d_dbl_dig=''
388 d_dbminitproto=''
389 d_difftime=''
390 d_dirfd=''
391 d_dlerror=''
392 d_dlopen=''
393 d_dlsymun=''
394 d_dosuid=''
395 d_suidsafe=''
396 d_drand48_r=''
397 drand48_r_proto=''
398 d_drand48proto=''
399 d_dup2=''
400 d_eaccess=''
401 d_endgrent=''
402 d_endgrent_r=''
403 endgrent_r_proto=''
404 d_endhent=''
405 d_endhostent_r=''
406 endhostent_r_proto=''
407 d_endnent=''
408 d_endnetent_r=''
409 endnetent_r_proto=''
410 d_endpent=''
411 d_endprotoent_r=''
412 endprotoent_r_proto=''
413 d_endpwent=''
414 d_endpwent_r=''
415 endpwent_r_proto=''
416 d_endsent=''
417 d_endservent_r=''
418 endservent_r_proto=''
419 d_faststdio=''
420 d_fchdir=''
421 d_fchmod=''
422 d_fchown=''
423 d_fcntl=''
424 d_fcntl_can_lock=''
425 d_fd_macros=''
426 d_fd_set=''
427 d_fds_bits=''
428 d_fgetpos=''
429 d_finite=''
430 d_finitel=''
431 d_flexfnam=''
432 d_flock=''
433 d_flockproto=''
434 d_fork=''
435 d_fp_class=''
436 d_fpclass=''
437 d_fpclassify=''
438 d_fpclassl=''
439 d_fpos64_t=''
440 d_frexpl=''
441 d_fs_data_s=''
442 d_fseeko=''
443 d_fsetpos=''
444 d_fstatfs=''
445 d_fsync=''
446 d_ftello=''
447 d_ftime=''
448 d_gettimeod=''
449 d_futimes=''
450 d_Gconvert=''
451 d_getcwd=''
452 d_getespwnam=''
453 d_getfsstat=''
454 d_getgrent=''
455 d_getgrent_r=''
456 getgrent_r_proto=''
457 d_getgrgid_r=''
458 getgrgid_r_proto=''
459 d_getgrnam_r=''
460 getgrnam_r_proto=''
461 d_getgrps=''
462 d_gethbyaddr=''
463 d_gethbyname=''
464 d_gethent=''
465 aphostname=''
466 d_gethname=''
467 d_phostname=''
468 d_uname=''
469 d_gethostbyaddr_r=''
470 gethostbyaddr_r_proto=''
471 d_gethostbyname_r=''
472 gethostbyname_r_proto=''
473 d_gethostent_r=''
474 gethostent_r_proto=''
475 d_gethostprotos=''
476 d_getitimer=''
477 d_getlogin=''
478 d_getlogin_r=''
479 getlogin_r_proto=''
480 d_getmnt=''
481 d_getmntent=''
482 d_getnbyaddr=''
483 d_getnbyname=''
484 d_getnent=''
485 d_getnetbyaddr_r=''
486 getnetbyaddr_r_proto=''
487 d_getnetbyname_r=''
488 getnetbyname_r_proto=''
489 d_getnetent_r=''
490 getnetent_r_proto=''
491 d_getnetprotos=''
492 d_getpagsz=''
493 d_getpent=''
494 d_getpgid=''
495 d_getpgrp2=''
496 d_bsdgetpgrp=''
497 d_getpgrp=''
498 d_getppid=''
499 d_getprior=''
500 d_getpbyname=''
501 d_getpbynumber=''
502 d_getprotobyname_r=''
503 getprotobyname_r_proto=''
504 d_getprotobynumber_r=''
505 getprotobynumber_r_proto=''
506 d_getprotoent_r=''
507 getprotoent_r_proto=''
508 d_getprotoprotos=''
509 d_getprpwnam=''
510 d_getpwent=''
511 d_getpwent_r=''
512 getpwent_r_proto=''
513 d_getpwnam_r=''
514 getpwnam_r_proto=''
515 d_getpwuid_r=''
516 getpwuid_r_proto=''
517 d_getsent=''
518 d_getservbyname_r=''
519 getservbyname_r_proto=''
520 d_getservbyport_r=''
521 getservbyport_r_proto=''
522 d_getservent_r=''
523 getservent_r_proto=''
524 d_getservprotos=''
525 d_getspnam=''
526 d_getspnam_r=''
527 getspnam_r_proto=''
528 d_getsbyname=''
529 d_getsbyport=''
530 d_gmtime_r=''
531 gmtime_r_proto=''
532 d_gnulibc=''
533 gnulibc_version=''
534 d_hasmntopt=''
535 d_htonl=''
536 d_ilogbl=''
537 d_inetaton=''
538 d_int64_t=''
539 d_isascii=''
540 d_isfinite=''
541 d_isinf=''
542 d_isnan=''
543 d_isnanl=''
544 d_killpg=''
545 d_lchown=''
546 d_ldbl_dig=''
547 d_libm_lib_version=''
548 d_link=''
549 d_localtime_r=''
550 localtime_r_proto=''
551 d_locconv=''
552 d_lockf=''
553 d_longdbl=''
554 longdblsize=''
555 d_longlong=''
556 longlongsize=''
557 d_lseekproto=''
558 d_lstat=''
559 d_madvise=''
560 d_malloc_good_size=''
561 d_malloc_size=''
562 d_mblen=''
563 d_mbstowcs=''
564 d_mbtowc=''
565 d_memchr=''
566 d_memcmp=''
567 d_memcpy=''
568 d_memmove=''
569 d_memset=''
570 d_mkdir=''
571 d_mkdtemp=''
572 d_mkfifo=''
573 d_mkstemp=''
574 d_mkstemps=''
575 d_mktime=''
576 d_mmap=''
577 mmaptype=''
578 d_modfl=''
579 d_modfl_pow32_bug=''
580 d_modflproto=''
581 d_mprotect=''
582 d_msg=''
583 d_msgctl=''
584 d_msgget=''
585 d_msghdr_s=''
586 d_msgrcv=''
587 d_msgsnd=''
588 d_msync=''
589 d_munmap=''
590 d_nice=''
591 d_nl_langinfo=''
592 d_off64_t=''
593 d_open3=''
594 d_fpathconf=''
595 d_pathconf=''
596 d_pause=''
597 d_pipe=''
598 d_poll=''
599 d_portable=''
600 d_procselfexe=''
601 procselfexe=''
602 d_old_pthread_create_joinable=''
603 old_pthread_create_joinable=''
604 d_pthread_atfork=''
605 d_pthread_attr_setscope=''
606 d_pthread_yield=''
607 d_sched_yield=''
608 sched_yield=''
609 d_qgcvt=''
610 d_random_r=''
611 random_r_proto=''
612 d_readdir64_r=''
613 readdir64_r_proto=''
614 d_readdir=''
615 d_rewinddir=''
616 d_seekdir=''
617 d_telldir=''
618 d_readdir_r=''
619 readdir_r_proto=''
620 d_readlink=''
621 d_readv=''
622 d_recvmsg=''
623 d_rename=''
624 d_rmdir=''
625 d_safebcpy=''
626 d_safemcpy=''
627 d_sanemcmp=''
628 d_sbrkproto=''
629 d_scalbnl=''
630 d_select=''
631 d_sem=''
632 d_semctl=''
633 d_semget=''
634 d_semop=''
635 d_sendmsg=''
636 d_setegid=''
637 d_seteuid=''
638 d_setgrent=''
639 d_setgrent_r=''
640 setgrent_r_proto=''
641 d_setgrps=''
642 d_sethent=''
643 d_sethostent_r=''
644 sethostent_r_proto=''
645 d_setitimer=''
646 d_setlinebuf=''
647 d_setlocale=''
648 d_setlocale_r=''
649 setlocale_r_proto=''
650 d_setnent=''
651 d_setnetent_r=''
652 setnetent_r_proto=''
653 d_setpent=''
654 d_setpgid=''
655 d_setpgrp2=''
656 d_bsdsetpgrp=''
657 d_setpgrp=''
658 d_setprior=''
659 d_setproctitle=''
660 d_setprotoent_r=''
661 setprotoent_r_proto=''
662 d_setpwent=''
663 d_setpwent_r=''
664 setpwent_r_proto=''
665 d_setregid=''
666 d_setresgid=''
667 d_setresuid=''
668 d_setreuid=''
669 d_setrgid=''
670 d_setruid=''
671 d_setsent=''
672 d_setservent_r=''
673 setservent_r_proto=''
674 d_setsid=''
675 d_setvbuf=''
676 d_sfio=''
677 usesfio=''
678 d_shm=''
679 d_shmat=''
680 d_shmatprototype=''
681 shmattype=''
682 d_shmctl=''
683 d_shmdt=''
684 d_shmget=''
685 d_sigaction=''
686 d_sigprocmask=''
687 d_sigsetjmp=''
688 usesitecustomize=''
689 d_snprintf=''
690 d_vsnprintf=''
691 d_sockatmark=''
692 d_sockatmarkproto=''
693 d_msg_ctrunc=''
694 d_msg_dontroute=''
695 d_msg_oob=''
696 d_msg_peek=''
697 d_msg_proxy=''
698 d_oldsock=''
699 d_scm_rights=''
700 d_socket=''
701 d_sockpair=''
702 sockethdr=''
703 socketlib=''
704 d_socklen_t=''
705 d_socks5_init=''
706 d_sprintf_returns_strlen=''
707 d_sqrtl=''
708 d_srand48_r=''
709 srand48_r_proto=''
710 d_srandom_r=''
711 srandom_r_proto=''
712 d_sresgproto=''
713 d_sresuproto=''
714 d_statblks=''
715 d_statfs_f_flags=''
716 d_statfs_s=''
717 d_fstatvfs=''
718 d_statvfs=''
719 d_stdio_cnt_lval=''
720 d_stdio_ptr_lval=''
721 d_stdio_ptr_lval_nochange_cnt=''
722 d_stdio_ptr_lval_sets_cnt=''
723 d_stdiobase=''
724 d_stdstdio=''
725 stdio_base=''
726 stdio_bufsiz=''
727 stdio_cnt=''
728 stdio_filbuf=''
729 stdio_ptr=''
730 d_index=''
731 d_strchr=''
732 d_strcoll=''
733 d_strctcpy=''
734 d_strerrm=''
735 d_strerror=''
736 d_sysernlst=''
737 d_syserrlst=''
738 d_strerror_r=''
739 strerror_r_proto=''
740 d_strftime=''
741 d_strlcat=''
742 d_strlcpy=''
743 d_strtod=''
744 d_strtol=''
745 d_strtold=''
746 d_strtoll=''
747 d_strtoq=''
748 d_strtoul=''
749 d_strtoull=''
750 d_strtouq=''
751 d_strxfrm=''
752 d_symlink=''
753 d_syscall=''
754 d_syscallproto=''
755 d_sysconf=''
756 d_system=''
757 d_tcgetpgrp=''
758 d_tcsetpgrp=''
759 d_telldirproto=''
760 d_time=''
761 timetype=''
762 clocktype=''
763 d_times=''
764 d_tmpnam_r=''
765 tmpnam_r_proto=''
766 d_truncate=''
767 d_ttyname_r=''
768 ttyname_r_proto=''
769 d_tzname=''
770 d_u32align=''
771 d_ualarm=''
772 d_umask=''
773 d_semctl_semid_ds=''
774 d_semctl_semun=''
775 d_union_semun=''
776 d_unordered=''
777 d_unsetenv=''
778 d_usleep=''
779 d_usleepproto=''
780 d_ustat=''
781 d_vfork=''
782 usevfork=''
783 d_voidsig=''
784 signal_t=''
785 d_volatile=''
786 d_charvspr=''
787 d_vprintf=''
788 d_wait4=''
789 d_waitpid=''
790 d_wcstombs=''
791 d_wctomb=''
792 d_writev=''
793 dlext=''
794 cccdlflags=''
795 ccdlflags=''
796 dlsrc=''
797 ld=''
798 lddlflags=''
799 usedl=''
800 doublesize=''
801 ebcdic=''
802 fflushNULL=''
803 fflushall=''
804 fpossize=''
805 fpostype=''
806 gccansipedantic=''
807 gccosandvers=''
808 gccversion=''
809 gidformat=''
810 gidsign=''
811 gidsize=''
812 gidtype=''
813 groupstype=''
814 h_fcntl=''
815 h_sysfile=''
816 html1dir=''
817 html1direxp=''
818 installhtml1dir=''
819 html3dir=''
820 html3direxp=''
821 installhtml3dir=''
822 i_arpainet=''
823 i_crypt=''
824 db_hashtype=''
825 db_prefixtype=''
826 db_version_major=''
827 db_version_minor=''
828 db_version_patch=''
829 i_db=''
830 i_dbm=''
831 i_rpcsvcdbm=''
832 d_dirnamlen=''
833 direntrytype=''
834 i_dirent=''
835 i_dld=''
836 i_dlfcn=''
837 i_fcntl=''
838 i_float=''
839 i_fp=''
840 i_fp_class=''
841 i_gdbm=''
842 d_grpasswd=''
843 i_grp=''
844 i_ieeefp=''
845 i_inttypes=''
846 i_langinfo=''
847 i_libutil=''
848 i_limits=''
849 i_locale=''
850 i_machcthr=''
851 i_malloc=''
852 i_math=''
853 i_memory=''
854 i_mntent=''
855 i_ndbm=''
856 i_netdb=''
857 i_neterrno=''
858 i_netinettcp=''
859 i_niin=''
860 i_sysin=''
861 i_poll=''
862 i_prot=''
863 i_pthread=''
864 d_pwage=''
865 d_pwchange=''
866 d_pwclass=''
867 d_pwcomment=''
868 d_pwexpire=''
869 d_pwgecos=''
870 d_pwpasswd=''
871 d_pwquota=''
872 i_pwd=''
873 i_sfio=''
874 i_shadow=''
875 i_socks=''
876 i_stddef=''
877 i_stdlib=''
878 i_string=''
879 strings=''
880 i_sunmath=''
881 i_sysaccess=''
882 i_sysdir=''
883 i_sysfile=''
884 d_voidtty=''
885 i_bsdioctl=''
886 i_sysfilio=''
887 i_sysioctl=''
888 i_syssockio=''
889 i_syslog=''
890 i_sysmman=''
891 i_sysmode=''
892 i_sysmount=''
893 i_sysndir=''
894 i_sysparam=''
895 i_sysresrc=''
896 i_syssecrt=''
897 i_sysselct=''
898 i_sysstat=''
899 i_sysstatfs=''
900 i_sysstatvfs=''
901 i_systimes=''
902 i_systypes=''
903 i_sysuio=''
904 i_sysun=''
905 i_sysutsname=''
906 i_sysvfs=''
907 i_syswait=''
908 i_sgtty=''
909 i_termio=''
910 i_termios=''
911 d_tm_tm_gmtoff=''
912 d_tm_tm_zone=''
913 i_systime=''
914 i_systimek=''
915 i_time=''
916 timeincl=''
917 i_unistd=''
918 i_ustat=''
919 i_utime=''
920 i_values=''
921 i_stdarg=''
922 i_varargs=''
923 i_varhdr=''
924 i_vfork=''
925 d_inc_version_list=''
926 inc_version_list=''
927 inc_version_list_init=''
928 installprefix=''
929 installprefixexp=''
930 installstyle=''
931 installusrbinperl=''
932 intsize=''
933 longsize=''
934 shortsize=''
935 issymlink=''
936 libc=''
937 ldlibpthname=''
938 libperl=''
939 shrpenv=''
940 useshrplib=''
941 glibpth=''
942 libpth=''
943 loclibpth=''
944 plibpth=''
945 xlibpth=''
946 ignore_versioned_solibs=''
947 libs=''
948 libsdirs=''
949 libsfiles=''
950 libsfound=''
951 libspath=''
952 lns=''
953 d_PRIEUldbl=''
954 d_PRIFUldbl=''
955 d_PRIGUldbl=''
956 d_PRIeldbl=''
957 d_PRIfldbl=''
958 d_PRIgldbl=''
959 d_SCNfldbl=''
960 sPRIEUldbl=''
961 sPRIFUldbl=''
962 sPRIGUldbl=''
963 sPRIeldbl=''
964 sPRIfldbl=''
965 sPRIgldbl=''
966 sSCNfldbl=''
967 lseeksize=''
968 lseektype=''
969 mad=''
970 madlyh=''
971 madlyobj=''
972 madlysrc=''
973 make_set_make=''
974 d_mymalloc=''
975 freetype=''
976 mallocobj=''
977 mallocsrc=''
978 malloctype=''
979 usemallocwrap=''
980 usemymalloc=''
981 installman1dir=''
982 man1dir=''
983 man1direxp=''
984 man1ext=''
985 installman3dir=''
986 man3dir=''
987 man3direxp=''
988 man3ext=''
989 modetype=''
990 multiarch=''
991 mydomain=''
992 myhostname=''
993 phostname=''
994 c=''
995 n=''
996 d_eofnblk=''
997 eagain=''
998 o_nonblock=''
999 rd_nodata=''
1000 need_va_copy=''
1001 netdb_hlen_type=''
1002 netdb_host_type=''
1003 netdb_name_type=''
1004 netdb_net_type=''
1005 groupcat=''
1006 hostcat=''
1007 passcat=''
1008 orderlib=''
1009 ranlib=''
1010 d_perl_otherlibdirs=''
1011 otherlibdirs=''
1012 package=''
1013 spackage=''
1014 pager=''
1015 api_revision=''
1016 api_subversion=''
1017 api_version=''
1018 api_versionstring=''
1019 patchlevel=''
1020 perl_patchlevel=''
1021 revision=''
1022 subversion=''
1023 version=''
1024 version_patchlevel_string=''
1025 perl5=''
1026 perladmin=''
1027 perlpath=''
1028 d_nv_preserves_uv=''
1029 d_nv_zero_is_allbits_zero=''
1030 i16size=''
1031 i16type=''
1032 i32size=''
1033 i32type=''
1034 i64size=''
1035 i64type=''
1036 i8size=''
1037 i8type=''
1038 ivsize=''
1039 ivtype=''
1040 nv_preserves_uv_bits=''
1041 nvsize=''
1042 nvtype=''
1043 u16size=''
1044 u16type=''
1045 u32size=''
1046 u32type=''
1047 u64size=''
1048 u64type=''
1049 u8size=''
1050 u8type=''
1051 uvsize=''
1052 uvtype=''
1053 ivdformat=''
1054 nvEUformat=''
1055 nvFUformat=''
1056 nvGUformat=''
1057 nveformat=''
1058 nvfformat=''
1059 nvgformat=''
1060 uvXUformat=''
1061 uvoformat=''
1062 uvuformat=''
1063 uvxformat=''
1064 pidtype=''
1065 prefix=''
1066 prefixexp=''
1067 installprivlib=''
1068 privlib=''
1069 privlibexp=''
1070 prototype=''
1071 ptrsize=''
1072 d_PRIXU64=''
1073 d_PRId64=''
1074 d_PRIi64=''
1075 d_PRIo64=''
1076 d_PRIu64=''
1077 d_PRIx64=''
1078 sPRIXU64=''
1079 sPRId64=''
1080 sPRIi64=''
1081 sPRIo64=''
1082 sPRIu64=''
1083 sPRIx64=''
1084 d_quad=''
1085 quadkind=''
1086 quadtype=''
1087 uquadtype=''
1088 drand01=''
1089 randbits=''
1090 randfunc=''
1091 randseedtype=''
1092 seedfunc=''
1093 installscript=''
1094 scriptdir=''
1095 scriptdirexp=''
1096 selectminbits=''
1097 selecttype=''
1098 sh=''
1099 sig_count=''
1100 sig_name=''
1101 sig_name_init=''
1102 sig_num=''
1103 sig_num_init=''
1104 sig_size=''
1105 d_sitearch=''
1106 installsitearch=''
1107 sitearch=''
1108 sitearchexp=''
1109 installsitebin=''
1110 sitebin=''
1111 sitebinexp=''
1112 installsitehtml1dir=''
1113 sitehtml1dir=''
1114 sitehtml1direxp=''
1115 installsitehtml3dir=''
1116 sitehtml3dir=''
1117 sitehtml3direxp=''
1118 installsitelib=''
1119 sitelib=''
1120 sitelib_stem=''
1121 sitelibexp=''
1122 installsiteman1dir=''
1123 siteman1dir=''
1124 siteman1direxp=''
1125 installsiteman3dir=''
1126 siteman3dir=''
1127 siteman3direxp=''
1128 siteprefix=''
1129 siteprefixexp=''
1130 installsitescript=''
1131 sitescript=''
1132 sitescriptexp=''
1133 sizesize=''
1134 sizetype=''
1135 so=''
1136 socksizetype=''
1137 sharpbang=''
1138 shsharp=''
1139 spitshell=''
1140 src=''
1141 ssizetype=''
1142 startperl=''
1143 startsh=''
1144 stdchar=''
1145 d_stdio_stream_array=''
1146 stdio_stream_array=''
1147 sysman=''
1148 trnl=''
1149 uidformat=''
1150 uidsign=''
1151 uidsize=''
1152 uidtype=''
1153 archname64=''
1154 use64bitall=''
1155 use64bitint=''
1156 usefaststdio=''
1157 ccflags_uselargefiles=''
1158 ldflags_uselargefiles=''
1159 libswanted_uselargefiles=''
1160 uselargefiles=''
1161 uselongdouble=''
1162 usemorebits=''
1163 usemultiplicity=''
1164 nm_opt=''
1165 nm_so_opt=''
1166 runnm=''
1167 usenm=''
1168 useperlio=''
1169 usesocks=''
1170 d_oldpthreads=''
1171 use5005threads=''
1172 useithreads=''
1173 usereentrant=''
1174 usethreads=''
1175 incpath=''
1176 mips_type=''
1177 usrinc=''
1178 d_vendorarch=''
1179 installvendorarch=''
1180 vendorarch=''
1181 vendorarchexp=''
1182 d_vendorbin=''
1183 installvendorbin=''
1184 vendorbin=''
1185 vendorbinexp=''
1186 installvendorhtml1dir=''
1187 vendorhtml1dir=''
1188 vendorhtml1direxp=''
1189 installvendorhtml3dir=''
1190 vendorhtml3dir=''
1191 vendorhtml3direxp=''
1192 d_vendorlib=''
1193 installvendorlib=''
1194 vendorlib=''
1195 vendorlib_stem=''
1196 vendorlibexp=''
1197 installvendorman1dir=''
1198 vendorman1dir=''
1199 vendorman1direxp=''
1200 installvendorman3dir=''
1201 vendorman3dir=''
1202 vendorman3direxp=''
1203 usevendorprefix=''
1204 vendorprefix=''
1205 vendorprefixexp=''
1206 d_vendorscript=''
1207 installvendorscript=''
1208 vendorscript=''
1209 vendorscriptexp=''
1210 versiononly=''
1211 defvoidused=''
1212 voidflags=''
1213 yacc=''
1214 yaccflags=''
1215 CONFIG=''
1216
1217 define='define'
1218 undef='undef'
1219 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1220 rmlist=''
1221
1222 : We must find out about Eunice early
1223 eunicefix=':'
1224 if test -f /etc/unixtovms; then
1225         eunicefix=/etc/unixtovms
1226 fi
1227 if test -f /etc/unixtovms.exe; then
1228         eunicefix=/etc/unixtovms.exe
1229 fi
1230
1231 : Set executable suffix now -- needed before hints available
1232 if test -f "/libs/version.library"; then
1233 : Amiga OS
1234     _exe=""
1235 elif test -f "/system/gnu_library/bin/ar.pm"; then
1236 : Stratus VOS
1237     _exe=".pm"
1238 elif test -n "$DJGPP"; then
1239 : DOS DJGPP
1240     _exe=".exe"
1241 elif test -d c:/. -o -n "$is_os2" ; then
1242 : OS/2 or cygwin
1243     _exe=".exe"
1244 fi
1245
1246 i_whoami=''
1247 ccname=''
1248 ccversion=''
1249 perllibs=''
1250 : set useposix=false in your hint file to disable the POSIX extension.
1251 useposix=true
1252 : set useopcode=false in your hint file to disable the Opcode extension.
1253 useopcode=true
1254 : Trailing extension.  Override this in a hint file, if needed.
1255 : Extra object files, if any, needed on this platform.
1256 archobjs=''
1257 archname=''
1258 : Possible local include directories to search.
1259 : Set locincpth to "" in a hint file to defeat local include searches.
1260 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1261 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1262 :
1263 : no include file wanted by default
1264 inclwanted=''
1265
1266 : Enable -DEBUGGING and -DDEBUGGING from the command line
1267 EBUGGING=''
1268 DEBUGGING=old
1269
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283
1284 : Private path used by Configure to find libraries.  Its value
1285 : is prepended to libpth. This variable takes care of special
1286 : machines, like the mips.  Usually, it should be empty.
1287 plibpth=''
1288
1289 : default library list
1290 libswanted=''
1291 : some systems want to use only the non-versioned libso:s
1292 ignore_versioned_solibs=''
1293 siteman1dir=''
1294 siteman3dir=''
1295 sitescript=''
1296 archname64=''
1297 ccflags_uselargefiles=''
1298 ldflags_uselargefiles=''
1299 libswanted_uselargefiles=''
1300 : set usemultiplicity on the Configure command line to enable multiplicity.
1301 : set usesocks on the Configure command line to enable socks.
1302 : set usethreads on the Configure command line to enable threads.
1303 usereentrant='undef'
1304 : full support for void wanted by default
1305 defvoidused=15
1306
1307 : List of libraries we want.
1308 : If anyone needs extra -lxxx, put those in a hint file.
1309 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1310 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1311 : We probably want to search /usr/shlib before most other libraries.
1312 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1313 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1314 glibpth="/usr/shlib $glibpth"
1315 : Do not use vfork unless overridden by a hint file.
1316 usevfork=false
1317
1318 : Find the basic shell for Bourne shell scripts
1319 case "$sh" in
1320 '')
1321         case "$SYSTYPE" in
1322         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1323         *) xxx='/bin/sh';;
1324         esac
1325         if test -f "$xxx"; then
1326                 sh="$xxx"
1327         else
1328                 : Build up a list and do a single loop so we can 'break' out.
1329                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1330                 for xxx in sh bash ksh pdksh ash; do
1331                         for p in $pth; do
1332                                 try="$try ${p}/${xxx}"
1333                         done
1334                 done
1335                 for xxx in $try; do
1336                         if test -f "$xxx"; then
1337                                 sh="$xxx";
1338                                 break
1339                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1340                                 sh="$xxx";
1341                                 break
1342                         elif test -f "$xxx.exe"; then
1343                                 sh="$xxx";
1344                                 break
1345                         fi
1346                 done
1347         fi
1348         ;;
1349 esac
1350
1351 case "$sh" in
1352 '')     cat >&2 <<EOM
1353 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1354
1355 Usually it's in /bin/sh.  How did you even get this far?
1356 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1357 we'll try to straighten this all out.
1358 EOM
1359         exit 1
1360         ;;
1361 esac
1362
1363 : see if sh knows # comments
1364 if `$sh -c '#' >/dev/null 2>&1`; then
1365         shsharp=true
1366         spitshell=cat
1367         xcat=/bin/cat
1368         test -f $xcat$_exe || xcat=/usr/bin/cat
1369         if test ! -f $xcat$_exe; then
1370                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1371                         if test -f $p/cat$_exe; then
1372                                 xcat=$p/cat
1373                                 break
1374                         fi
1375                 done
1376                 if test ! -f $xcat$_exe; then
1377                         echo "Can't find cat anywhere!"
1378                         exit 1
1379                 fi
1380         fi
1381         echo "#!$xcat" >sharp
1382         $eunicefix sharp
1383         chmod +x sharp
1384         ./sharp > today
1385         if test -s today; then
1386                 sharpbang='#!'
1387         else
1388                 echo "#! $xcat" > sharp
1389                 $eunicefix sharp
1390                 chmod +x sharp
1391                 ./sharp > today
1392                 if test -s today; then
1393                         sharpbang='#! '
1394                 else
1395                         sharpbang=': use '
1396                 fi
1397         fi
1398 else
1399         echo " "
1400         echo "Your $sh doesn't grok # comments--I will strip them later on."
1401         shsharp=false
1402         cd ..
1403         echo "exec grep -v '^[  ]*#'" >spitshell
1404         chmod +x spitshell
1405         $eunicefix spitshell
1406         spitshell=`pwd`/spitshell
1407         cd UU
1408         echo "I presume that if # doesn't work, #! won't work either!"
1409         sharpbang=': use '
1410 fi
1411 rm -f sharp today
1412
1413 : figure out how to guarantee sh startup
1414 case "$startsh" in
1415 '') startsh=${sharpbang}${sh} ;;
1416 *)
1417 esac
1418 cat >sharp <<EOSS
1419 $startsh
1420 set abc
1421 test "$?abc" != 1
1422 EOSS
1423
1424 chmod +x sharp
1425 $eunicefix sharp
1426 if ./sharp; then
1427         : echo "Yup, it does."
1428 else
1429         echo "Hmm... '$startsh' does not guarantee sh startup..."
1430         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1431 fi
1432 rm -f sharp
1433
1434
1435 : Save command line options in file UU/cmdline.opt for later use in
1436 : generating config.sh.
1437 cat > cmdline.opt <<EOSH
1438 # Configure command line arguments.
1439 config_arg0='$0'
1440 config_args='$*'
1441 config_argc=$#
1442 EOSH
1443 argn=1
1444 args_exp=''
1445 args_sep=''
1446 for arg in "$@"; do
1447         cat >>cmdline.opt <<EOSH
1448 config_arg$argn='$arg'
1449 EOSH
1450         # Extreme backslashitis: replace each ' by '"'"'
1451         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1452 $arg
1453 EOC
1454         arg_exp=`cat cmdl.opt`
1455         args_exp="$args_exp$args_sep'$arg_exp'"
1456         argn=`expr $argn + 1`
1457         args_sep=' '
1458 done
1459 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1460 # used by ./hints/os2.sh
1461 rm -f cmdl.opt
1462
1463 : produce awk script to parse command line options
1464 cat >options.awk <<'EOF'
1465 BEGIN {
1466         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1467
1468         len = length(optstr);
1469         for (i = 1; i <= len; i++) {
1470                 c = substr(optstr, i, 1);
1471                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1472                 if (a == ":") {
1473                         arg[c] = 1;
1474                         i++;
1475                 }
1476                 opt[c] = 1;
1477         }
1478 }
1479 {
1480         expect = 0;
1481         str = $0;
1482         if (substr(str, 1, 1) != "-") {
1483                 printf("'%s'\n", str);
1484                 next;
1485         }
1486         len = length($0);
1487         for (i = 2; i <= len; i++) {
1488                 c = substr(str, i, 1);
1489                 if (!opt[c]) {
1490                         printf("-%s\n", substr(str, i));
1491                         next;
1492                 }
1493                 printf("-%s\n", c);
1494                 if (arg[c]) {
1495                         if (i < len)
1496                                 printf("'%s'\n", substr(str, i + 1));
1497                         else
1498                                 expect = 1;
1499                         next;
1500                 }
1501         }
1502 }
1503 END {
1504         if (expect)
1505                 print "?";
1506 }
1507 EOF
1508
1509 : process the command line options
1510 set X `for arg in "$@"; do echo "X$arg"; done |
1511         sed -e s/X// | awk -f options.awk`
1512 eval "set $*"
1513 shift
1514 rm -f options.awk
1515
1516 : set up default values
1517 fastread=''
1518 reuseval=false
1519 config_sh=''
1520 alldone=''
1521 error=''
1522 silent=''
1523 extractsh=''
1524 override=''
1525 knowitall=''
1526 rm -f optdef.sh posthint.sh
1527 cat >optdef.sh <<EOS
1528 $startsh
1529 EOS
1530
1531
1532 : option parsing
1533 while test $# -gt 0; do
1534         case "$1" in
1535         -d) shift; fastread=yes;;
1536         -e) shift; alldone=cont;;
1537         -f)
1538                 shift
1539                 cd ..
1540                 if test -r "$1"; then
1541                         config_sh="$1"
1542                 else
1543                         echo "$me: cannot read config file $1." >&2
1544                         error=true
1545                 fi
1546                 cd UU
1547                 shift;;
1548         -h) shift; error=true;;
1549         -r) shift; reuseval=true;;
1550         -s) shift; silent=true; realsilent=true;;
1551         -E) shift; alldone=exit;;
1552         -K) shift; knowitall=true;;
1553         -O) shift; override=true;;
1554         -S) shift; silent=true; extractsh=true;;
1555         -D)
1556                 shift
1557                 case "$1" in
1558                 *=)
1559                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1560                         echo "$me: ignoring -D $1" >&2
1561                         ;;
1562                 *=*) echo "$1" | \
1563                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1564                 *) echo "$1='define'" >> optdef.sh;;
1565                 esac
1566                 shift
1567                 ;;
1568         -U)
1569                 shift
1570                 case "$1" in
1571                 *=) echo "$1" >> optdef.sh;;
1572                 *=*)
1573                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1574                         echo "$me: ignoring -U $1" >&2
1575                         ;;
1576                 *) echo "$1='undef'" >> optdef.sh;;
1577                 esac
1578                 shift
1579                 ;;
1580         -A)
1581             shift
1582             xxx=''
1583             yyy="$1"
1584             zzz=''
1585             uuu=undef
1586             case "$yyy" in
1587             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1588                  case "$zzz" in
1589                  *:*) zzz='' ;;
1590                  *)   xxx=append
1591                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1592                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1593                  esac
1594                  ;;
1595             esac
1596             case "$xxx" in
1597             '')  case "$yyy" in
1598                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1599                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1600                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1601                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1602                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1603                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1604                  esac
1605                  ;;       
1606             esac
1607             case "$xxx" in
1608             append)
1609                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1610             clear)
1611                 echo "$yyy=''"                  >> posthint.sh ;;
1612             define)
1613                 case "$zzz" in
1614                 '') zzz=define ;;
1615                 esac
1616                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1617             eval)
1618                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1619             prepend)
1620                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1621             undef)
1622                 case "$zzz" in
1623                 '') zzz="$uuu" ;;
1624                 esac
1625                 echo "$yyy=$zzz"                >> posthint.sh ;;
1626             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1627             esac
1628             shift
1629             ;;
1630         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1631             exit 0;;
1632         --) break;;
1633         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1634         *) break;;
1635         esac
1636 done
1637
1638 case "$error" in
1639 true)
1640         cat >&2 <<EOM
1641 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1642                  [-U symbol] [-U symbol=] [-A command:symbol...]
1643   -d : use defaults for all answers.
1644   -e : go on without questioning past the production of config.sh.
1645   -f : specify an alternate default configuration file.
1646   -h : print this help message and exit (with an error status).
1647   -r : reuse C symbols value if possible (skips costly nm extraction).
1648   -s : silent mode, only echoes questions and essential information.
1649   -D : define symbol to have some value:
1650          -D symbol         symbol gets the value 'define'
1651          -D symbol=value   symbol gets the value 'value'
1652   -E : stop at the end of questions, after having produced config.sh.
1653   -K : do not use unless you know what you are doing.
1654   -O : let -D and -U override definitions from loaded configuration file.
1655   -S : perform variable substitutions on all .SH files (can mix with -f)
1656   -U : undefine symbol:
1657          -U symbol    symbol gets the value 'undef'
1658          -U symbol=   symbol gets completely empty
1659   -A : manipulate symbol after the platform specific hints have been applied:
1660          -A symbol=value                append " "value to symbol
1661          -A append:symbol=value         append value to symbol
1662          -A define:symbol=value         define symbol to have value
1663          -A clear:symbol                define symbol to be ''
1664          -A define:symbol               define symbol to be 'define'
1665          -A eval:symbol=value           define symbol to be eval of value
1666          -A prepend:symbol=value        prepend value to symbol
1667          -A undef:symbol                define symbol to be 'undef'
1668          -A undef:symbol=               define symbol to be ''
1669   -V : print version number and exit (with a zero status).
1670 EOM
1671         exit 1
1672         ;;
1673 esac
1674
1675 : Sanity checks
1676 case "$fastread$alldone" in
1677 yescont|yesexit) ;;
1678 *)
1679         case "$extractsh" in
1680         true) ;;
1681         *)
1682                 if test ! -t 0; then
1683                         echo "Say 'sh Configure', not 'sh <Configure'"
1684                         exit 1
1685                 fi
1686                 ;;
1687         esac
1688         ;;
1689 esac
1690
1691 exec 4>&1
1692 case "$silent" in
1693 true) exec 1>/dev/null;;
1694 esac
1695
1696 : run the defines and the undefines, if any, but leave the file out there...
1697 touch optdef.sh
1698 . ./optdef.sh
1699 : create the posthint manipulation script and leave the file out there...
1700 touch posthint.sh
1701
1702 : set package name
1703 package=perl5
1704 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1705 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1706 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1707 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1708 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1709 esac
1710
1711 : Some greps do not return status, grrr.
1712 echo "grimblepritz" >grimble
1713 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1714         contains=contains
1715 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1716         contains=grep
1717 else
1718         contains=contains
1719 fi
1720 rm -f grimble
1721 : the following should work in any shell
1722 case "$contains" in
1723 contains*)
1724         echo " "
1725         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1726         cat >contains <<'EOSS'
1727 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1728 EOSS
1729 chmod +x contains
1730 esac
1731
1732 : Find the path to the source tree
1733 case "$src" in
1734 '') case "$0" in
1735     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1736          case "$src" in
1737          /*)    ;;
1738          .)     ;;
1739          *)     src=`cd ../$src && pwd` ;;
1740          esac
1741          ;;
1742     *)   src='.';;
1743     esac;;
1744 esac
1745 case "$src" in
1746 '')     src=/
1747         rsrc=/
1748         ;;
1749 /*) rsrc="$src";;
1750 *) rsrc="../$src";;
1751 esac
1752 if test -f $rsrc/Configure && \
1753         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1754 then
1755    : found it, so we are ok.
1756 else
1757         rsrc=''
1758         for src in . .. ../.. ../../.. ../../../..; do
1759                 if test -f ../$src/Configure && \
1760                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1761                 then
1762                         rsrc=../$src
1763                         break
1764                 fi
1765         done
1766 fi
1767 case "$rsrc" in
1768 '')
1769         cat <<EOM >&4
1770
1771 Sorry, I can't seem to locate the source dir for $package.  Please start
1772 Configure with an explicit path -- i.e. /some/path/Configure.
1773
1774 EOM
1775         exit 1
1776         ;;
1777 ../.)   rsrc='..';;
1778 *)
1779         echo " "
1780         echo "Sources for $package found in \"$src\"." >&4
1781         ;;
1782 esac
1783
1784 : script used to extract .SH files with variable substitutions
1785 cat >extract <<'EOS'
1786 PERL_CONFIG_SH=true
1787 echo "Doing variable substitutions on .SH files..."
1788 if test -f MANIFEST; then
1789         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1790 else
1791         echo "(Looking for .SH files under the source directory.)"
1792         set x `(cd "$src"; find . -name "*.SH" -print)`
1793 fi
1794 shift
1795 case $# in
1796 0) set x `(cd "$src"; echo *.SH)`; shift;;
1797 esac
1798 if test ! -f "$src/$1"; then
1799         shift
1800 fi
1801 mkdir_p='
1802 name=$1;
1803 create="";
1804 while test $name; do
1805         if test ! -d "$name"; then
1806                 create="$name $create";
1807                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1808                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1809         else
1810                 name="";
1811         fi;
1812 done;
1813 for file in $create; do
1814         mkdir $file;
1815 done
1816 '
1817 for file in $*; do
1818         case "$src" in
1819         ".")
1820                 case "$file" in
1821                 */*)
1822                         dir=`expr X$file : 'X\(.*\)/'`
1823                         file=`expr X$file : 'X.*/\(.*\)'`
1824                         (cd "$dir" && . ./$file)
1825                         ;;
1826                 *)
1827                         . ./$file
1828                         ;;
1829                 esac
1830                 ;;
1831         *)
1832                 case "$file" in
1833                 */*)
1834                         dir=`expr X$file : 'X\(.*\)/'`
1835                         file=`expr X$file : 'X.*/\(.*\)'`
1836                         (set x $dir; shift; eval $mkdir_p)
1837                         sh <"$src/$dir/$file"
1838                         ;;
1839                 *)
1840                         sh <"$src/$file"
1841                         ;;
1842                 esac
1843                 ;;
1844         esac
1845 done
1846 if test -f "$src/config_h.SH"; then
1847         if test ! -f config.h; then
1848         : oops, they left it out of MANIFEST, probably, so do it anyway.
1849         . "$src/config_h.SH"
1850         fi
1851 fi
1852 EOS
1853
1854 : extract files and exit if asked to do so
1855 case "$extractsh" in
1856 true)
1857         case "$realsilent" in
1858         true) ;;
1859         *) exec 1>&4;;
1860         esac
1861         case "$config_sh" in
1862         '') config_sh='config.sh';;
1863         esac
1864         echo " "
1865         echo "Fetching answers from $config_sh..."
1866         cd ..
1867         . $config_sh
1868         test "$override" && . ./optdef.sh
1869         echo " "
1870         . UU/extract
1871         rm -rf UU
1872         echo "Extraction done."
1873         exit 0
1874         ;;
1875 esac
1876
1877 : Eunice requires " " instead of "", can you believe it
1878 echo " "
1879 : Here we go...
1880 echo "Beginning of configuration questions for $package."
1881
1882 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1883
1884 : first determine how to suppress newline on echo command
1885 echo " "
1886 echo "Checking echo to see how to suppress newlines..."
1887 (echo "hi there\c" ; echo " ") >.echotmp
1888 if $contains c .echotmp >/dev/null 2>&1 ; then
1889         echo "...using -n."
1890         n='-n'
1891         c=''
1892 else
1893         cat <<'EOM'
1894 ...using \c
1895 EOM
1896         n=''
1897         c='\c'
1898 fi
1899 echo $n "The star should be here-->$c"
1900 echo '*'
1901 rm -f .echotmp
1902
1903 : Now test for existence of everything in MANIFEST
1904 echo " "
1905 if test -f "$rsrc/MANIFEST"; then
1906         echo "First let's make sure your kit is complete.  Checking..." >&4
1907         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1908         rm -f missing
1909         tmppwd=`pwd`
1910         for filelist in x??; do
1911                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1912         done
1913         if test -s missing; then
1914                 cat missing >&4
1915                 cat >&4 <<'EOM'
1916
1917 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1918
1919 You have the option of continuing the configuration process, despite the
1920 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1921 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1922 and contact the author (perlbug@perl.org).
1923
1924 EOM
1925                 echo $n "Continue? [n] $c" >&4
1926                 read ans
1927                 case "$ans" in
1928                 y*)
1929                         echo "Continuing..." >&4
1930                         rm -f missing
1931                         ;;
1932                 *)
1933                         echo "ABORTING..." >&4
1934                         kill $$
1935                         ;;
1936                 esac
1937         else
1938                 echo "Looks good..."
1939         fi
1940 else
1941         echo "There is no MANIFEST file.  I hope your kit is complete !"
1942 fi
1943 rm -f missing x??
1944
1945 echo " "
1946 : Find the appropriate value for a newline for tr
1947 if test -n "$DJGPP"; then
1948        trnl='\012'
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\n' x 2>/dev/null`" in
1952         foox) trnl='\n' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956         case "`echo foo|tr '\012' x 2>/dev/null`" in
1957         foox) trnl='\012' ;;
1958         esac
1959 fi
1960 if test X"$trnl" = X; then
1961        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1962        fooxy) trnl='\n\r' ;;
1963        esac
1964 fi
1965 if test X"$trnl" = X; then
1966         cat <<EOM >&2
1967
1968 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1969
1970 EOM
1971         exit 1
1972 fi
1973
1974 : compute the number of columns on the terminal for proper question formatting
1975 case "$COLUMNS" in
1976 '') COLUMNS='80';;
1977 esac
1978
1979 : set up the echo used in my read
1980 myecho="case \"\$xxxm\" in
1981 '') echo $n \"\$rp $c\" >&4;;
1982 *) case \"\$rp\" in
1983         '') echo $n \"[\$xxxm] $c\";;
1984         *)
1985                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1986                         echo \"\$rp\" >&4
1987                         echo $n \"[\$xxxm] $c\" >&4
1988                 else
1989                         echo $n \"\$rp [\$xxxm] $c\" >&4
1990                 fi
1991                 ;;
1992         esac;;
1993 esac"
1994
1995 : now set up to do reads with possible shell escape and default assignment
1996 cat <<EOSC >myread
1997 $startsh
1998 xxxm=\$dflt
1999 $myecho
2000 ans='!'
2001 case "\$fastread" in
2002 yes) case "\$dflt" in
2003         '') ;;
2004         *) ans='';
2005                 case "\$silent-\$rp" in
2006                 true-) ;;
2007                 *) echo " " >&4;;
2008                 esac;;
2009         esac;;
2010 *) case "\$silent" in
2011         true) case "\$rp" in
2012                 '') ans='';;
2013                 esac;;
2014         esac;;
2015 esac
2016 while expr "X\$ans" : "X!" >/dev/null; do
2017         read answ
2018         set x \$xxxm
2019         shift
2020         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2021         case  "\$answ" in
2022         "!")
2023                 sh 1>&4
2024                 echo " "
2025                 $myecho
2026                 ;;
2027         !*)
2028                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2029                 shift
2030                 sh 1>&4 -c "\$*"
2031                 echo " "
2032                 $myecho
2033                 ;;
2034         "\$ans")
2035                 case "\$ans" in
2036                 \\&*)
2037                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2038                         shift
2039                         case "\$1" in
2040                         -d)
2041                                 fastread=yes
2042                                 echo "(OK, I'll run with -d after this question.)" >&4
2043                                 ;;
2044                         -*)
2045                                 echo "*** Sorry, \$1 not supported yet." >&4
2046                                 ;;
2047                         esac
2048                         $myecho
2049                         ans=!
2050                         ;;
2051                 esac;;
2052         *)
2053                 case "\$aok" in
2054                 y)
2055                         echo "*** Substitution done -- please confirm."
2056                         xxxm="\$ans"
2057                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2058                         xxxm="\$ans"
2059                         ans=!
2060                         ;;
2061                 *)
2062                         echo "*** Error -- try again."
2063                         ans=!
2064                         ;;
2065                 esac
2066                 $myecho
2067                 ;;
2068         esac
2069         case "\$ans\$xxxm\$nostick" in
2070         '')
2071                 ans=!
2072                 $myecho
2073                 ;;
2074         esac
2075 done
2076 case "\$ans" in
2077 '') ans="\$xxxm";;
2078 esac
2079 EOSC
2080
2081 : create .config dir to save info across Configure sessions
2082 test -d ../.config || mkdir ../.config
2083 cat >../.config/README <<EOF
2084 This directory created by Configure to save information that should
2085 persist across sessions for $package.
2086
2087 You may safely delete it if you wish.
2088 EOF
2089
2090 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2091 case "$usedevel" in
2092 $define|true|[yY]*) ;;
2093 *) case "$xversion" in
2094    *[13579])
2095         cat >&4 <<EOH
2096 *** WHOA THERE!!! ***
2097
2098     This is an UNSTABLE DEVELOPMENT release.
2099     The version of this $package distribution is $xversion, that is, odd,
2100     (as opposed to even) and that signifies a development release.
2101     If you want a maintenance release, you want an even-numbered version.
2102
2103     Do ***NOT*** install this into production use.
2104     Data corruption and crashes are possible.
2105
2106     It is most seriously suggested that you do not continue any further
2107     unless you want to help in developing and debugging Perl.
2108
2109     If you *still* want to build perl, you can answer 'y' now,
2110     or pass -Dusedevel to Configure.
2111
2112 EOH
2113         rp='Do you really want to continue?'
2114         dflt='n'
2115         . ./myread
2116         case "$ans" in
2117         [yY]) echo >&4 "Okay, continuing."
2118               usedevel="$define" ;;
2119         *) echo >&4 "Okay, bye."
2120            exit 1
2121            ;;
2122         esac
2123         ;;
2124     esac
2125     ;;
2126 esac
2127 case "$usedevel" in
2128 $define|true|[yY]*)
2129         case "$versiononly" in
2130         '') versiononly="$define" ;;
2131         esac
2132         case "$installusrbinperl" in
2133         '') installusrbinperl="$undef" ;;
2134         esac
2135         ;;
2136 esac
2137
2138 : general instructions
2139 needman=true
2140 firsttime=true
2141 user=`(logname) 2>/dev/null`
2142 case "$user" in
2143 '') user=`whoami 2>&1`;;
2144 esac
2145 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2146         firsttime=false
2147         echo " "
2148         rp='Would you like to see the instructions?'
2149         dflt=n
2150         . ./myread
2151         case "$ans" in
2152         [yY]*) ;;
2153         *) needman=false;;
2154         esac
2155 fi
2156 if $needman; then
2157         cat <<EOH
2158
2159 This installation shell script will examine your system and ask you questions
2160 to determine how the perl5 package should be installed. If you get
2161 stuck on a question, you may use a ! shell escape to start a subshell or
2162 execute a command.  Many of the questions will have default answers in square
2163 brackets; typing carriage return will give you the default.
2164
2165 On some of the questions which ask for file or directory names you are allowed
2166 to use the ~name construct to specify the login directory belonging to "name",
2167 even if you don't have a shell which knows about that.  Questions where this is
2168 allowed will be marked "(~name ok)".
2169
2170 EOH
2171         rp=''
2172         dflt='Type carriage return to continue'
2173         . ./myread
2174         cat <<'EOH'
2175
2176 The prompter used in this script allows you to use shell variables and
2177 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2178 in the default answer, as if the default line was a set of arguments given to a
2179 script shell.  This means you may also use $* to repeat the whole default line,
2180 so you do not have to re-type everything to add something to the default.
2181
2182 Everytime there is a substitution, you will have to confirm.  If there is an
2183 error (e.g. an unmatched backtick), the default answer will remain unchanged
2184 and you will be prompted again.
2185
2186 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2187 the questions and use the computed defaults (or the previous answers if there
2188 was already a config.sh file). Type 'Configure -h' for a list of options.
2189 You may also start interactively and then answer '& -d' at any prompt to turn
2190 on the non-interactive behaviour for the remainder of the execution.
2191
2192 EOH
2193         . ./myread
2194         cat <<EOH
2195
2196 Much effort has been expended to ensure that this shell script will run on any
2197 Unix system.  If despite that it blows up on yours, your best bet is to edit
2198 Configure and run it again.  If you can't run Configure for some reason,
2199 you'll have to generate a config.sh file by hand.  Whatever problems you
2200 have, let me (perlbug@perl.org) know how I blew it.
2201
2202 This installation script affects things in two ways:
2203
2204 1) it may do direct variable substitutions on some of the files included
2205    in this kit.
2206 2) it builds a config.h file for inclusion in C programs.  You may edit
2207    any of these files as the need arises after running this script.
2208
2209 If you make a mistake on a question, there is no easy way to back up to it
2210 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2211 files.  Configure will offer to let you do this before it runs the SH files.
2212
2213 EOH
2214         dflt='Type carriage return to continue'
2215         . ./myread
2216         case "$firsttime" in
2217         true) echo $user >>../.config/instruct;;
2218         esac
2219 fi
2220
2221 : find out where common programs are
2222 echo " "
2223 echo "Locating common programs..." >&4
2224 cat <<EOSC >loc
2225 $startsh
2226 case \$# in
2227 0) exit 1;;
2228 esac
2229 thing=\$1
2230 shift
2231 dflt=\$1
2232 shift
2233 for dir in \$*; do
2234         case "\$thing" in
2235         .)
2236         if test -d \$dir/\$thing; then
2237                 echo \$dir
2238                 exit 0
2239         fi
2240         ;;
2241         *)
2242         for thisthing in \$dir/\$thing; do
2243                 : just loop through to pick last item
2244         done
2245         if test -f \$thisthing; then
2246                 echo \$thisthing
2247                 exit 0
2248         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2249                 echo \$thisthing
2250                 exit 0
2251         elif test -f \$dir/\$thing.exe; then
2252                 if test -n "$DJGPP"; then
2253                         echo \$dir/\$thing.exe
2254                 elif test "$eunicefix" != ":"; then
2255                         : on Eunice apparently
2256                         echo \$dir/\$thing
2257                         exit 0
2258                 fi
2259                 exit 0
2260         fi
2261         ;;
2262         esac
2263 done
2264 echo \$dflt
2265 exit 1
2266 EOSC
2267 chmod +x loc
2268 $eunicefix loc
2269 loclist="
2270 awk
2271 cat
2272 chmod
2273 comm
2274 cp
2275 echo
2276 expr
2277 grep
2278 ls
2279 mkdir
2280 rm
2281 sed
2282 sort
2283 touch
2284 tr
2285 uniq
2286 "
2287 trylist="
2288 Mcc
2289 ar
2290 bison
2291 byacc
2292 cpp
2293 csh
2294 date
2295 egrep
2296 gmake
2297 gzip
2298 less
2299 ln
2300 make
2301 more
2302 nm
2303 nroff
2304 pg
2305 test
2306 uname
2307 zip
2308 "
2309 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2310 pth="$pth /lib /usr/lib"
2311 for file in $loclist; do
2312         eval xxx=\$$file
2313         case "$xxx" in
2314         /*|?:[\\/]*)
2315                 if test -f "$xxx"; then
2316                         : ok
2317                 else
2318                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2319                         xxx=`./loc $file $file $pth`
2320                 fi
2321                 ;;
2322         '') xxx=`./loc $file $file $pth`;;
2323         *) xxx=`./loc $xxx $xxx $pth`;;
2324         esac
2325         eval $file=$xxx$_exe
2326         eval _$file=$xxx
2327         case "$xxx" in
2328         /*)
2329                 echo $file is in $xxx.
2330                 ;;
2331         ?:[\\/]*)
2332                 echo $file is in $xxx.
2333                 ;;
2334         *)
2335                 echo "I don't know where '$file' is, and my life depends on it." >&4
2336                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337                 exit 1
2338                 ;;
2339         esac
2340 done
2341 echo " "
2342 echo "Don't worry if any of the following aren't found..."
2343 say=offhand
2344 for file in $trylist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't see $file out there, $say."
2369                 say=either
2370                 ;;
2371         esac
2372 done
2373 case "$egrep" in
2374 egrep)
2375         echo "Substituting grep for egrep."
2376         egrep=$grep
2377         _egrep=$grep
2378         ;;
2379 esac
2380 case "$ln" in
2381 ln)
2382         echo "Substituting cp for ln."
2383         ln=$cp
2384         _ln=$cp
2385         ;;
2386 esac
2387 case "$make" in
2388 make)   
2389         case "$gmake" in
2390         gmake)
2391         echo "I can't find make or gmake, and my life depends on it." >&4
2392         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2393         exit 1
2394         ;;
2395         esac
2396         ;;
2397 esac    
2398 case "$gmake" in
2399 gmake)  ;;
2400 *)      # We can't have osname yet.
2401         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2402                 # Assume that gmake, if found, is definitely GNU make
2403                 # and prefer it over the system make.
2404                 echo "Substituting gmake for make."
2405                 make=$gmake
2406                 _make=$gmake
2407         fi
2408         ;;
2409 esac
2410 case "$test" in
2411 test)
2412         echo "Hopefully test is built into your sh."
2413         ;;
2414 *)
2415         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2416                 echo "Using the test built into your sh."
2417                 test=test
2418                 _test=test
2419         fi
2420         ;;
2421 esac
2422 case "$echo" in
2423 echo)
2424         echo "Hopefully echo is built into your sh."
2425         ;;
2426 '') ;;
2427 *)
2428         echo " "
2429 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2430         $echo $n "hi there$c" >foo1
2431         echo $n "hi there$c" >foo2
2432         if cmp foo1 foo2 >/dev/null 2>&1; then
2433                 echo "They are compatible.  In fact, they may be identical."
2434         else
2435                 case "$n" in
2436                 '-n') n='' c='\c';;
2437                 *) n='-n' c='';;
2438                 esac
2439                 cat <<FOO
2440 They are not compatible!  You are probably running ksh on a non-USG system.
2441 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2442 have echo built in and we may have to run some Bourne shell scripts.  That
2443 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2444
2445 FOO
2446                 $echo $n "The star should be here-->$c"
2447                 $echo "*"
2448         fi
2449         $rm -f foo1 foo2
2450         ;;
2451 esac
2452
2453 cat <<EOS >trygcc
2454 $startsh
2455 EOS
2456 cat <<'EOSC' >>trygcc
2457 case "$cc" in
2458 '') ;;
2459 *)  $rm -f try try.*
2460     $cat >try.c <<EOM
2461 int main(int argc, char *argv[]) {
2462   return 0;
2463 }
2464 EOM
2465     if $cc -o try $ccflags $ldflags try.c; then
2466        :
2467     else
2468         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2469         despair=yes
2470         trygcc=yes
2471         case "$cc" in
2472         *gcc*) trygcc=no ;;
2473         esac
2474         case "`$cc -v -c try.c 2>&1`" in
2475         *gcc*) trygcc=no ;;
2476         esac
2477         if $test X"$trygcc" = Xyes; then
2478             if gcc -o try -c try.c; then
2479                 echo " "
2480                 echo "You seem to have a working gcc, though." >&4
2481                 rp="Would you like to use it?"
2482                 dflt=y
2483                 if $test -f myread; then
2484                     . ./myread
2485                 else
2486                     if $test -f UU/myread; then
2487                         . ./UU/myread
2488                     else
2489                         echo "Cannot find myread, sorry.  Aborting." >&2
2490                         exit 1
2491                     fi
2492                 fi  
2493                 case "$ans" in
2494                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2495                        if $test -f usethreads.cbu; then
2496                            $cat >&4 <<EOM 
2497
2498 *** However, any setting of the C compiler flags (e.g. for thread support)
2499 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2500 *** (together with e.g. -Dusethreads).
2501
2502 EOM
2503                        fi;;
2504                 esac
2505             fi
2506         fi
2507     fi
2508     $rm -f try try.*
2509     ;;
2510 esac
2511 EOSC
2512
2513 cat <<EOS >checkcc
2514 $startsh
2515 EOS
2516 cat <<'EOSC' >>checkcc
2517 case "$cc" in        
2518 '') ;;
2519 *)  $rm -f try try.*              
2520     $cat >try.c <<EOM
2521 int main(int argc, char *argv[]) {
2522   return 0;
2523 }
2524 EOM
2525     if $cc -o try $ccflags $ldflags try.c; then
2526        :
2527     else
2528         if $test X"$despair" = Xyes; then
2529            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530         fi
2531         $cat >&4 <<EOM         
2532 You need to find a working C compiler.
2533 Either (purchase and) install the C compiler supplied by your OS vendor,
2534 or for a free C compiler try http://gcc.gnu.org/
2535 I cannot continue any further, aborting.
2536 EOM
2537         exit 1
2538     fi
2539     $rm -f try try.*
2540     ;;
2541 esac
2542 EOSC
2543
2544 : determine whether symbolic links are supported
2545 echo " "
2546 $touch blurfl
2547 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2548         echo "Symbolic links are supported." >&4
2549         lns="$ln -s"
2550 else
2551         echo "Symbolic links are NOT supported." >&4
2552         lns="$ln"
2553 fi
2554 $rm -f blurfl sym
2555
2556 : determine whether symbolic links are supported
2557 echo " "
2558 case "$lns" in
2559 *"ln"*" -s")
2560         echo "Checking how to test for symbolic links..." >&4
2561         $lns blurfl sym
2562         if $test "X$issymlink" = X; then
2563                 case "$newsh" in
2564                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 esac
2567                 if test $? = 0; then
2568                         issymlink="test -h"
2569                 else
2570                         echo "Your builtin 'test -h' may be broken." >&4
2571                         case "$test" in
2572                         /*)     ;;
2573                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2574                                 for p in $pth
2575                                 do
2576                                         if test -f "$p/$test"; then
2577                                                 test="$p/$test"
2578                                                 break
2579                                         fi
2580                                 done
2581                                 ;;
2582                         esac
2583                         case "$test" in
2584                         /*)
2585                                 echo "Trying external '$test -h'." >&4
2586                                 issymlink="$test -h"
2587                                 if $test ! -h sym >/dev/null 2>&1; then
2588                                         echo "External '$test -h' is broken, too." >&4
2589                                         issymlink=''
2590                                 fi
2591                                 ;;
2592                         *)      issymlink='' ;;
2593                         esac
2594                 fi              
2595         fi
2596         if $test "X$issymlink" = X; then
2597                 if $test -L sym 2>/dev/null; then
2598                         issymlink="$test -L"
2599                         echo "The builtin '$test -L' worked." >&4
2600                 fi
2601         fi
2602         if $test "X$issymlink" != X; then
2603                 echo "You can test for symbolic links with '$issymlink'." >&4
2604         else
2605                 echo "I do not know how you can test for symbolic links." >&4
2606         fi
2607         $rm -f blurfl sym
2608         ;;
2609 *)      echo "No symbolic links, so not testing for their testing..." >&4
2610         ;;
2611 esac
2612 echo " "
2613
2614
2615 case "$mksymlinks" in
2616 $define|true|[yY]*)
2617         case "$src" in
2618         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2619                 exit 1
2620                 ;;
2621         *)      case "$lns:$issymlink" in
2622                 *"ln"*" -s:"*"test -"?)
2623                         echo "Creating the symbolic links..." >&4
2624                         echo "(First creating the subdirectories...)" >&4
2625                         cd ..
2626                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2627                                 read directory
2628                                 test -z "$directory" && break
2629                                 mkdir -p $directory
2630                         done
2631                         # Sanity check 1.
2632                         if test ! -d t/base; then
2633                                 echo "Failed to create the subdirectories.  Aborting." >&4
2634                                 exit 1
2635                         fi
2636                         echo "(Then creating the symlinks...)" >&4
2637                         awk '{print $1}' $src/MANIFEST | while true; do
2638                                 read filename
2639                                 test -z "$filename" && break
2640                                 if test -f $filename; then
2641                                         if $issymlink $filename; then
2642                                                 rm -f $filename
2643                                         fi
2644                                 fi
2645                                 if test -f $filename; then
2646                                         echo "$filename already exists, not symlinking."
2647                                 else
2648                                         ln -s $src/$filename $filename
2649                                 fi
2650                         done
2651                         # Sanity check 2.
2652                         if test ! -f t/base/lex.t; then
2653                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         cd UU
2657                         ;;
2658                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2659                         ;;
2660                 esac
2661                 ;;
2662         esac
2663         ;;
2664 esac
2665
2666
2667 case "$usecrosscompile" in
2668 $define|true|[yY]*)
2669         $echo "Cross-compiling..."
2670         croak=''
2671         case "$cc" in
2672         *-*-gcc) # A cross-compiling gcc, probably.
2673             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2674             ar=$targetarch-ar
2675             # leave out ld, choosing it is more complex
2676             nm=$targetarch-nm
2677             ranlib=$targetarch-ranlib
2678             $echo 'extern int foo;' > try.c
2679             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2680             shift
2681             if $test $# -gt 0; then
2682                 incpth="$incpth $*"
2683                 incpth="`$echo $incpth|$sed 's/^ //'`"
2684                 echo "Guessing incpth '$incpth'." >&4
2685                 for i in $*; do
2686                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2687                     if $test -d $j; then
2688                         libpth="$libpth $j"
2689                     fi
2690                 done   
2691                 libpth="`$echo $libpth|$sed 's/^ //'`"
2692                 echo "Guessing libpth '$libpth'." >&4
2693             fi
2694             $rm -f try.c
2695             ;;
2696         esac
2697         case "$targetarch" in
2698         '') echo "Targetarch not defined." >&4; croak=y ;;
2699         *)  echo "Using targetarch $targetarch." >&4 ;;
2700         esac
2701         case "$incpth" in
2702         '') echo "Incpth not defined." >&4; croak=y ;;
2703         *)  echo "Using incpth '$incpth'." >&4 ;;
2704         esac
2705         case "$libpth" in
2706         '') echo "Libpth not defined." >&4; croak=y ;;
2707         *)  echo "Using libpth '$libpth'." >&4 ;;
2708         esac
2709         case "$usrinc" in
2710         '') for i in $incpth; do
2711                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2712                     usrinc=$i
2713                     echo "Guessing usrinc $usrinc." >&4
2714                     break
2715                 fi
2716             done
2717             case "$usrinc" in
2718             '') echo "Usrinc not defined." >&4; croak=y ;;
2719             esac
2720             ;;
2721         *)  echo "Using usrinc $usrinc." >&4 ;;
2722         esac
2723         case "$targethost" in
2724         '') echo "Targethost not defined." >&4; croak=y ;;
2725         *)  echo "Using targethost $targethost." >&4
2726         esac
2727         locincpth=' '
2728         loclibpth=' '
2729         case "$croak" in
2730         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2731         esac
2732         case "$src" in
2733         /*) run=$src/Cross/run
2734             targetmkdir=$src/Cross/mkdir
2735             to=$src/Cross/to
2736             from=$src/Cross/from
2737             ;;
2738         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2739             run=$pwd/Cross/run
2740             targetmkdir=$pwd/Cross/mkdir
2741             to=$pwd/Cross/to
2742             from=$pwd/Cross/from
2743             ;;
2744         esac
2745         case "$targetrun" in
2746         '') targetrun=ssh ;;
2747         esac
2748         case "$targetto" in
2749         '') targetto=scp ;;
2750         esac
2751         case "$targetfrom" in
2752         '') targetfrom=scp ;;
2753         esac
2754         run=$run-$targetrun
2755         to=$to-$targetto
2756         from=$from-$targetfrom
2757         case "$targetdir" in
2758         '')  targetdir=/tmp
2759              echo "Guessing targetdir $targetdir." >&4
2760              ;;
2761         esac
2762         case "$targetuser" in
2763         '')  targetuser=root
2764              echo "Guessing targetuser $targetuser." >&4
2765              ;;
2766         esac
2767         case "$targetfrom" in
2768         scp)    q=-q ;;
2769         *)      q='' ;;
2770         esac
2771         case "$targetrun" in
2772         ssh|rsh)
2773             cat >$run <<EOF
2774 #!/bin/sh
2775 case "\$1" in
2776 -cwd)
2777   shift
2778   cwd=\$1
2779   shift
2780   ;;
2781 esac
2782 case "\$cwd" in
2783 '') cwd=$targetdir ;;
2784 esac
2785 exe=\$1
2786 shift
2787 if $test ! -f \$exe.xok; then
2788   $to \$exe
2789   $touch \$exe.xok
2790 fi
2791 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2792 EOF
2793             ;;
2794         *)  echo "Unknown targetrun '$targetrun'" >&4
2795             exit 1
2796             ;;
2797         esac
2798         case "$targetmkdir" in
2799         */Cross/mkdir)
2800             cat >$targetmkdir <<EOF
2801 #!/bin/sh
2802 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2803 EOF
2804             $chmod a+rx $targetmkdir
2805             ;;
2806         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2807             exit 1
2808             ;;
2809         esac
2810         case "$targetto" in
2811         scp|rcp)
2812             cat >$to <<EOF
2813 #!/bin/sh
2814 for f in \$@
2815 do
2816   case "\$f" in
2817   /*)
2818     $targetmkdir \`dirname \$f\`
2819     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2820     ;;
2821   *)
2822     $targetmkdir $targetdir/\`dirname \$f\`
2823     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2824     ;;
2825   esac
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         cp) cat >$to <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   case "\$f" in
2835   /*)
2836     $mkdir -p $targetdir/\`dirname \$f\`
2837     $cp \$f $targetdir/\$f || exit 1
2838     ;;
2839   *)
2840     $targetmkdir $targetdir/\`dirname \$f\`
2841     $cp \$f $targetdir/\$f || exit 1
2842     ;;
2843   esac
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         *)  echo "Unknown targetto '$targetto'" >&4
2849             exit 1
2850             ;;
2851         esac
2852         case "$targetfrom" in
2853         scp|rcp)
2854           cat >$from <<EOF
2855 #!/bin/sh
2856 for f in \$@
2857 do
2858   $rm -f \$f
2859   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2860 done
2861 exit 0
2862 EOF
2863             ;;
2864         cp) cat >$from <<EOF
2865 #!/bin/sh
2866 for f in \$@
2867 do
2868   $rm -f \$f
2869   cp $targetdir/\$f . || exit 1
2870 done
2871 exit 0
2872 EOF
2873             ;;
2874         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2875             exit 1
2876             ;;
2877         esac
2878         if $test ! -f $run; then
2879             echo "Target 'run' script '$run' not found." >&4
2880         else
2881             $chmod a+rx $run
2882         fi
2883         if $test ! -f $to; then
2884             echo "Target 'to' script '$to' not found." >&4
2885         else
2886             $chmod a+rx $to
2887         fi
2888         if $test ! -f $from; then
2889             echo "Target 'from' script '$from' not found." >&4
2890         else
2891             $chmod a+rx $from
2892         fi
2893         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2894             exit 1
2895         fi
2896         cat >&4 <<EOF
2897 Using '$run' for remote execution,
2898 and '$from' and '$to'
2899 for remote file transfer.
2900 EOF
2901         ;;
2902 *)      run=''
2903         to=:
2904         from=:
2905         usecrosscompile='undef'
2906         targetarch=''
2907         ;;
2908 esac
2909
2910 : see whether [:lower:] and [:upper:] are supported character classes
2911 echo " "
2912 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2913 ABYZ)
2914         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2915         up='[:upper:]'
2916         low='[:lower:]'
2917         ;;
2918 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2919         # (0xd9 and 0xe2), therefore that is a nice testing point.
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2922             rs) up='[A-Z]'
2923                 low='[a-z]'
2924                 ;;
2925             esac
2926         fi
2927         if test "X$up" = X -o "X$low" = X; then
2928             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2929             rs) up='A-Z'
2930                 low='a-z'
2931                 ;;
2932             esac
2933         fi
2934         if test "X$up" = X -o "X$low" = X; then
2935             case "`echo RS | od -x 2>/dev/null`" in
2936             *D9E2*|*d9e2*)
2937                 echo "Hey, this might be EBCDIC." >&4
2938                 if test "X$up" = X -o "X$low" = X; then
2939                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2940                     rs) up='[A-IJ-RS-Z]'
2941                         low='[a-ij-rs-z]'
2942                         ;;
2943                     esac
2944                 fi
2945                 if test "X$up" = X -o "X$low" = X; then
2946                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2947                     rs) up='A-IJ-RS-Z'
2948                         low='a-ij-rs-z'
2949                         ;;
2950                     esac
2951                 fi
2952                 ;;
2953             esac
2954         fi
2955 esac
2956 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2957 rs)
2958     echo "Using $up and $low to convert case." >&4
2959     ;;
2960 *)
2961     echo "I don't know how to translate letters from upper to lower case." >&4
2962     echo "Your tr is not acting any way I know of." >&4
2963     exit 1
2964     ;;
2965 esac
2966 : set up the translation script tr, must be called with ./tr of course
2967 cat >tr <<EOSC
2968 $startsh
2969 case "\$1\$2" in
2970 '[A-Z][a-z]') exec $tr '$up' '$low';;
2971 '[a-z][A-Z]') exec $tr '$low' '$up';;
2972 esac
2973 exec $tr "\$@"
2974 EOSC
2975 chmod +x tr
2976 $eunicefix tr
2977
2978 : Try to determine whether config.sh was made on this system
2979 case "$config_sh" in
2980 '')
2981 myuname=`$uname -a 2>/dev/null`
2982 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2983 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2984 # because the A-Z/a-z are not consecutive.
2985 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2986         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2987 newmyuname="$myuname"
2988 dflt=n
2989 case "$knowitall" in
2990 '')
2991         if test -f ../config.sh; then
2992                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2993                         eval "`grep myuname= ../config.sh`"
2994                 fi
2995                 if test "X$myuname" = "X$newmyuname"; then
2996                         dflt=y
2997                 fi
2998         fi
2999         ;;
3000 *) dflt=y;;
3001 esac
3002
3003 : Get old answers from old config file if Configure was run on the
3004 : same system, otherwise use the hints.
3005 hint=default
3006 cd ..
3007 if test -f config.sh; then
3008         echo " "
3009         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3010         . UU/myread
3011         case "$ans" in
3012         n*|N*) echo "OK, I'll ignore it."
3013                 mv config.sh config.sh.old
3014                 myuname="$newmyuname"
3015                 ;;
3016         *)  echo "Fetching default answers from your old config.sh file..." >&4
3017                 tmp_n="$n"
3018                 tmp_c="$c"
3019                 tmp_sh="$sh"
3020                 . ./config.sh
3021                 cp config.sh UU
3022                 n="$tmp_n"
3023                 c="$tmp_c"
3024                 : Older versions did not always set $sh.  Catch re-use of such
3025                 : an old config.sh.
3026                 case "$sh" in
3027                 '') sh="$tmp_sh" ;;
3028                 esac
3029                 hint=previous
3030                 ;;
3031         esac
3032 fi
3033 . ./UU/checkcc
3034 if test ! -f config.sh; then
3035         $cat <<EOM
3036
3037 First time through, eh?  I have some defaults handy for some systems
3038 that need some extra help getting the Configure answers right:
3039
3040 EOM
3041         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3042         dflt=''
3043         : Half the following guesses are probably wrong... If you have better
3044         : tests or hints, please send them to perlbug@perl.org
3045         : The metaconfig authors would also appreciate a copy...
3046         $test -f /irix && osname=irix
3047         $test -f /xenix && osname=sco_xenix
3048         $test -f /dynix && osname=dynix
3049         $test -f /dnix && osname=dnix
3050         $test -f /lynx.os && osname=lynxos
3051         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3052         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3053         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /bin/mips && /bin/mips && osname=mips
3055         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3056                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3057         $test -d /usr/apollo/bin && osname=apollo
3058         $test -f /etc/saf/_sactab && osname=svr4
3059         $test -d /usr/include/minix && osname=minix
3060         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3061         if $test -d /MachTen -o -d /MachTen_Folder; then
3062                 osname=machten
3063                 if $test -x /sbin/version; then
3064                         osvers=`/sbin/version | $awk '{print $2}' |
3065                         $sed -e 's/[A-Za-z]$//'`
3066                 elif $test -x /usr/etc/version; then
3067                         osvers=`/usr/etc/version | $awk '{print $2}' |
3068                         $sed -e 's/[A-Za-z]$//'`
3069                 else
3070                         osvers="$2.$3"
3071                 fi
3072         fi
3073
3074         $test -f /sys/posix.dll &&
3075                 $test -f /usr/bin/what &&
3076                 set X `/usr/bin/what /sys/posix.dll` &&
3077                 $test "$3" = UWIN &&
3078                 osname=uwin &&
3079                 osvers="$5"
3080
3081         if $test -f $uname; then
3082                 set X $myuname
3083                 shift
3084
3085                 case "$5" in
3086                 fps*) osname=fps ;;
3087                 mips*)
3088                         case "$4" in
3089                         umips) osname=umips ;;
3090                         *) osname=mips ;;
3091                         esac;;
3092                 [23]100) osname=mips ;;
3093                 next*) osname=next ;;
3094                 i386*)
3095                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3096                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3097                                 osname='sco'
3098                                 osvers=$tmp
3099                         elif $test -f /etc/kconfig; then
3100                                 osname=isc
3101                                 if test "$lns" = "$ln -s"; then
3102                                         osvers=4
3103                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3104                                         osvers=3
3105                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3106                                         osvers=2
3107                                 fi
3108                         fi
3109                         tmp=''
3110                         ;;
3111                 pc*)
3112                         if test -n "$DJGPP"; then
3113                                 osname=dos
3114                                 osvers=djgpp
3115                         fi
3116                         ;;
3117                 esac
3118
3119                 case "$1" in
3120                 aix) osname=aix
3121                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3122                         case "$tmp" in
3123                         # oslevel can fail with:
3124                         # oslevel: Unable to acquire lock.
3125                         *not\ found) osvers="$4"."$3" ;;
3126                         '<3240'|'<>3240') osvers=3.2.0 ;;
3127                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3128                         '=3250'|'>3250') osvers=3.2.5 ;;
3129                         *) osvers=$tmp;;
3130                         esac
3131                         ;;
3132                 bsd386) osname=bsd386
3133                         osvers=`$uname -r`
3134                         ;;
3135                 cygwin*) osname=cygwin
3136                         osvers="$3"
3137                         ;;
3138                 *dc.osx) osname=dcosx
3139                         osvers="$3"
3140                         ;;
3141                 dnix) osname=dnix
3142                         osvers="$3"
3143                         ;;
3144                 domainos) osname=apollo
3145                         osvers="$3"
3146                         ;;
3147                 dgux)   osname=dgux
3148                         osvers="$3"
3149                         ;;
3150                 dragonfly) osname=dragonfly
3151                         osvers="$3"
3152                         ;;
3153                 dynixptx*) osname=dynixptx
3154                         osvers=`echo "$4"|sed 's/^v//'`
3155                         ;;
3156                 freebsd) osname=freebsd
3157                         osvers="$3" ;;
3158                 genix)  osname=genix ;;
3159                 gnu)    osname=gnu
3160                         osvers="$3" ;;
3161                 hp*)    osname=hpux
3162                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3163                         ;;
3164                 irix*)  osname=irix
3165                         case "$3" in
3166                         4*) osvers=4 ;;
3167                         5*) osvers=5 ;;
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 linux)  osname=linux
3172                         case "$3" in
3173                         *)      osvers="$3" ;;
3174                         esac
3175                         ;;
3176                 MiNT)   osname=mint
3177                         ;;
3178                 netbsd*) osname=netbsd
3179                         osvers="$3"
3180                         ;;
3181                 news-os) osvers="$3"
3182                         case "$3" in
3183                         4*) osname=newsos4 ;;
3184                         *) osname=newsos ;;
3185                         esac
3186                         ;;
3187                 next*) osname=next ;;
3188                 nonstop-ux) osname=nonstopux ;;
3189                 openbsd) osname=openbsd
3190                         osvers="$3"
3191                         ;;
3192                 os2)    osname=os2
3193                         osvers="$4"
3194                         ;;
3195                 POSIX-BC | posix-bc ) osname=posix-bc
3196                         osvers="$3"
3197                         ;;
3198                 powerux | power_ux | powermax_os | powermaxos | \
3199                 powerunix | power_unix) osname=powerux
3200                         osvers="$3"
3201                         ;;
3202                 qnx) osname=qnx
3203                         osvers="$4"
3204                         ;;
3205                 solaris) osname=solaris
3206                         case "$3" in
3207                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3208                         *)      osvers="$3" ;;
3209                         esac
3210                         ;;
3211                 sunos) osname=sunos
3212                         case "$3" in
3213                         5*) osname=solaris
3214                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3215                         *)      osvers="$3" ;;
3216                         esac
3217                         ;;
3218                 titanos) osname=titanos
3219                         case "$3" in
3220                         1*) osvers=1 ;;
3221                         2*) osvers=2 ;;
3222                         3*) osvers=3 ;;
3223                         4*) osvers=4 ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 ultrix) osname=ultrix
3228                         osvers="$3"
3229                         ;;
3230                 osf1|mls+)      case "$5" in
3231                                 alpha)
3232                                         osname=dec_osf
3233                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3234                                         case "$osvers" in
3235                                         [1-9].[0-9]*) ;;
3236                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3237                                         esac
3238                                         ;;
3239                         hp*)    osname=hp_osf1  ;;
3240                         mips)   osname=mips_osf1 ;;
3241                         esac
3242                         ;;
3243                 # UnixWare 7.1.2 is known as Open UNIX 8
3244                 openunix|unixware) osname=svr5
3245                         osvers="$4"
3246                         ;;
3247                 uts)    osname=uts
3248                         osvers="$3"
3249                         ;;
3250                 vos) osvers="$3"
3251                         ;;
3252                 $2) case "$osname" in
3253                         *isc*) ;;
3254                         *freebsd*) ;;
3255                         svr*)
3256                                 : svr4.x or possibly later
3257                                 case "svr$3" in
3258                                 ${osname}*)
3259                                         osname=svr$3
3260                                         osvers=$4
3261                                         ;;
3262                                 esac
3263                                 case "$osname" in
3264                                 svr4.0)
3265                                         : Check for ESIX
3266                                         if test -f /stand/boot ; then
3267                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3268                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3269                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3270                                                         if test -n "$isesix"; then
3271                                                                 osname=esix4
3272                                                         fi
3273                                                 fi
3274                                         fi
3275                                         ;;
3276                                 esac
3277                                 ;;
3278                         *)      if test -f /etc/systemid; then
3279                                         osname=sco
3280                                         set `echo $3 | $sed 's/\./ /g'` $4
3281                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3282                                                 osvers=$1.$2.$3
3283                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3284                                                 osvers=$1.$2
3285                                         elif $test -f $src/hints/sco_$1.sh; then
3286                                                 osvers=$1
3287                                         fi
3288                                 else
3289                                         case "$osname" in
3290                                         '') : Still unknown.  Probably a generic Sys V.
3291                                                 osname="sysv"
3292                                                 osvers="$3"
3293                                                 ;;
3294                                         esac
3295                                 fi
3296                                 ;;
3297                         esac
3298                         ;;
3299                 *)      case "$osname" in
3300                         '') : Still unknown.  Probably a generic BSD.
3301                                 osname="$1"
3302                                 osvers="$3"
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307         else
3308                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3309                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3310                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3311                                 osname=news_os
3312                         fi
3313                         $rm -f UU/kernel.what
3314                 elif test -d c:/. -o -n "$is_os2" ; then
3315                         set X $myuname
3316                         osname=os2
3317                         osvers="$5"
3318                 fi
3319         fi
3320
3321         case "$targetarch" in
3322         '') ;;
3323         *)  hostarch=$osname
3324             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3325             osvers=''
3326             ;;
3327         esac
3328
3329         : Now look for a hint file osname_osvers, unless one has been
3330         : specified already.
3331         case "$hintfile" in
3332         ''|' ')
3333                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3334                 : Also try without trailing minor version numbers.
3335                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3336                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3337                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3339                 case "$file" in
3340                 '') dflt=none ;;
3341                 *)  case "$osvers" in
3342                         '') dflt=$file
3343                                 ;;
3344                         *)  if $test -f $src/hints/$file.sh ; then
3345                                         dflt=$file
3346                                 elif $test -f $src/hints/$xfile.sh ; then
3347                                         dflt=$xfile
3348                                 elif $test -f $src/hints/$xxfile.sh ; then
3349                                         dflt=$xxfile
3350                                 elif $test -f $src/hints/$xxxfile.sh ; then
3351                                         dflt=$xxxfile
3352                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3353                                         dflt=$xxxxfile
3354                                 elif $test -f "$src/hints/${osname}.sh" ; then
3355                                         dflt="${osname}"
3356                                 else
3357                                         dflt=none
3358                                 fi
3359                                 ;;
3360                         esac
3361                         ;;
3362                 esac
3363                 if $test -f Policy.sh ; then
3364                         case "$dflt" in
3365                         *Policy*) ;;
3366                         none) dflt="Policy" ;;
3367                         *) dflt="Policy $dflt" ;;
3368                         esac
3369                 fi
3370                 ;;
3371         *)
3372                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3373                 ;;
3374         esac
3375
3376         if $test -f Policy.sh ; then
3377                 $cat <<EOM
3378
3379 There's also a Policy hint file available, which should make the
3380 site-specific (policy) questions easier to answer.
3381 EOM
3382
3383         fi
3384
3385         $cat <<EOM
3386
3387 You may give one or more space-separated answers, or "none" if appropriate.
3388 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3389 previous run of Configure, you may specify it as well as or instead of
3390 OS-specific hints.  If hints are provided for your OS, you should use them:
3391 although Perl can probably be built without hints on many platforms, using
3392 hints often improve performance and may enable features that Configure can't
3393 set up on its own. If there are no hints that match your OS, specify "none";
3394 DO NOT give a wrong version or a wrong OS.
3395
3396 EOM
3397
3398         rp="Which of these apply, if any?"
3399         . UU/myread
3400         tans=$ans
3401         for file in $tans; do
3402                 if $test X$file = XPolicy -a -f Policy.sh; then
3403                         . Policy.sh
3404                         $cat Policy.sh >> UU/config.sh
3405                 elif $test -f $src/hints/$file.sh; then
3406                         . $src/hints/$file.sh
3407                         $cat $src/hints/$file.sh >> UU/config.sh
3408                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3409                         : nothing
3410                 else
3411                         : Give one chance to correct a possible typo.
3412                         echo "$file.sh does not exist"
3413                         dflt=$file
3414                         rp="hint to use instead?"
3415                         . UU/myread
3416                         for file in $ans; do
3417                                 if $test -f "$src/hints/$file.sh"; then
3418                                         . $src/hints/$file.sh
3419                                         $cat $src/hints/$file.sh >> UU/config.sh
3420                                 elif $test X$ans = X -o X$ans = Xnone ; then
3421                                         : nothing
3422                                 else
3423                                         echo "$file.sh does not exist -- ignored."
3424                                 fi
3425                         done
3426                 fi
3427         done
3428
3429         hint=recommended
3430         : Remember our hint file for later.
3431         if $test -f "$src/hints/$file.sh" ; then
3432                 hintfile="$file"
3433         else
3434                 hintfile=''
3435         fi
3436 fi
3437 cd UU
3438 ;;
3439 *)
3440         echo " "
3441         echo "Fetching default answers from $config_sh..." >&4
3442         tmp_n="$n"
3443         tmp_c="$c"
3444         cd ..
3445         cp $config_sh config.sh 2>/dev/null
3446         chmod +w config.sh
3447         . ./config.sh
3448         cd UU
3449         cp ../config.sh .
3450         n="$tmp_n"
3451         c="$tmp_c"
3452         hint=previous
3453         ;;
3454 esac
3455 test "$override" && . ./optdef.sh
3456
3457 : Restore computed paths
3458 for file in $loclist $trylist; do
3459         eval $file="\$_$file"
3460 done
3461
3462 cat << EOM
3463
3464 Configure uses the operating system name and version to set some defaults.
3465 The default value is probably right if the name rings a bell. Otherwise,
3466 since spelling matters for me, either accept the default or answer "none"
3467 to leave it blank.
3468
3469 EOM
3470 case "$osname" in
3471         ''|' ')
3472                 case "$hintfile" in
3473                 ''|' '|none) dflt=none ;;
3474                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3475                 esac
3476                 ;;
3477         *) dflt="$osname" ;;
3478 esac
3479 rp="Operating system name?"
3480 . ./myread
3481 case "$ans" in
3482 none)  osname='' ;;
3483 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3484 esac
3485 echo " "
3486 case "$osvers" in
3487         ''|' ')
3488                 case "$hintfile" in
3489                 ''|' '|none) dflt=none ;;
3490                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3491                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3492                         case "$dflt" in
3493                         ''|' ') dflt=none ;;
3494                         esac
3495                         ;;
3496                 esac
3497                 ;;
3498         *) dflt="$osvers" ;;
3499 esac
3500 rp="Operating system version?"
3501 . ./myread
3502 case "$ans" in
3503 none)  osvers='' ;;
3504 *) osvers="$ans" ;;
3505 esac
3506
3507
3508 . ./posthint.sh
3509
3510 : who configured the system
3511 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3512 case "$cf_by" in
3513 "")
3514         cf_by=`(logname) 2>/dev/null`
3515         case "$cf_by" in
3516         "")
3517                 cf_by=`(whoami) 2>/dev/null`
3518                 case "$cf_by" in
3519                 "") cf_by=unknown ;;
3520                 esac ;;
3521         esac ;;
3522 esac
3523
3524 : decide how portable to be.  Allow command line overrides.
3525 case "$d_portable" in
3526 "$undef") ;;
3527 *)      d_portable="$define" ;;
3528 esac
3529
3530 : set up shell script to do ~ expansion
3531 cat >filexp <<EOSS
3532 $startsh
3533 : expand filename
3534 case "\$1" in
3535  ~/*|~)
3536         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3537         ;;
3538  ~*)
3539         if $test -f /bin/csh; then
3540                 /bin/csh -f -c "glob \$1"
3541                 failed=\$?
3542                 echo ""
3543                 exit \$failed
3544         else
3545                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3546                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3547                 if $test ! -d "\$dir"; then
3548                         me=\`basename \$0\`
3549                         echo "\$me: can't locate home directory for: \$name" >&2
3550                         exit 1
3551                 fi
3552                 case "\$1" in
3553                 */*)
3554                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3555                         ;;
3556                 *)
3557                         echo \$dir
3558                         ;;
3559                 esac
3560         fi
3561         ;;
3562 *)
3563         echo \$1
3564         ;;
3565 esac
3566 EOSS
3567 chmod +x filexp
3568 $eunicefix filexp
3569
3570 : now set up to get a file name
3571 cat <<EOS >getfile
3572 $startsh
3573 EOS
3574 cat <<'EOSC' >>getfile
3575 tilde=''
3576 fullpath=''
3577 already=''
3578 skip=''
3579 none_ok=''
3580 exp_file=''
3581 nopath_ok=''
3582 orig_rp="$rp"
3583 orig_dflt="$dflt"
3584 case "$gfpth" in
3585 '') gfpth='.' ;;
3586 esac
3587
3588 case "$fn" in
3589 *\(*)
3590         : getfile will accept an answer from the comma-separated list
3591         : enclosed in parentheses even if it does not meet other criteria.
3592         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3593         fn=`echo $fn | sed 's/(.*)//'`
3594         ;;
3595 esac
3596
3597 case "$fn" in
3598 *:*)
3599         loc_file=`expr $fn : '.*:\(.*\)'`
3600         fn=`expr $fn : '\(.*\):.*'`
3601         ;;
3602 esac
3603
3604 case "$fn" in
3605 *~*) tilde=true;;
3606 esac
3607 case "$fn" in
3608 */*) fullpath=true;;
3609 esac
3610 case "$fn" in
3611 *+*) skip=true;;
3612 esac
3613 case "$fn" in
3614 *n*) none_ok=true;;
3615 esac
3616 case "$fn" in
3617 *e*) exp_file=true;;
3618 esac
3619 case "$fn" in
3620 *p*) nopath_ok=true;;
3621 esac
3622
3623 case "$fn" in
3624 *f*) type='File';;
3625 *d*) type='Directory';;
3626 *l*) type='Locate';;
3627 esac
3628
3629 what="$type"
3630 case "$what" in
3631 Locate) what='File';;
3632 esac
3633
3634 case "$exp_file" in
3635 '')
3636         case "$d_portable" in
3637         "$define") ;;
3638         *) exp_file=true;;
3639         esac
3640         ;;
3641 esac
3642
3643 cd ..
3644 while test "$type"; do
3645         redo=''
3646         rp="$orig_rp"
3647         dflt="$orig_dflt"
3648         case "$tilde" in
3649         true) rp="$rp (~name ok)";;
3650         esac
3651         . UU/myread
3652         if test -f UU/getfile.ok && \
3653                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3654         then
3655                 value="$ans"
3656                 ansexp="$ans"
3657                 break
3658         fi
3659         case "$ans" in
3660         none)
3661                 value=''
3662                 ansexp=''
3663                 case "$none_ok" in
3664                 true) type='';;
3665                 esac
3666                 ;;
3667         *)
3668                 case "$tilde" in
3669                 '') value="$ans"
3670                         ansexp="$ans";;
3671                 *)
3672                         value=`UU/filexp $ans`
3673                         case $? in
3674                         0)
3675                                 if test "$ans" != "$value"; then
3676                                         echo "(That expands to $value on this system.)"
3677                                 fi
3678                                 ;;
3679                         *) value="$ans";;
3680                         esac
3681                         ansexp="$value"
3682                         case "$exp_file" in
3683                         '') value="$ans";;
3684                         esac
3685                         ;;
3686                 esac
3687                 case "$fullpath" in
3688                 true)
3689                         case "$ansexp" in
3690                         /*) value="$ansexp" ;;
3691                         [a-zA-Z]:/*) value="$ansexp" ;;
3692                         *)
3693                                 redo=true
3694                                 case "$already" in
3695                                 true)
3696                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3697                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3698                                         ;;
3699                                 *)
3700                                 echo "Please give a full path name, starting with slash." >&4
3701                                         case "$tilde" in
3702                                         true)
3703                                 echo "Note that using ~name is ok provided it expands well." >&4
3704                                                 already=true
3705                                                 ;;
3706                                         esac
3707                                 esac
3708                                 ;;
3709                         esac
3710                         ;;
3711                 esac
3712                 case "$redo" in
3713                 '')
3714                         case "$type" in
3715                         File)
3716                                 for fp in $gfpth; do
3717                                         if test "X$fp" = X.; then
3718                                             pf="$ansexp"
3719                                         else    
3720                                             pf="$fp/$ansexp"
3721                                         fi
3722                                         if test -f "$pf"; then
3723                                                 type=''
3724                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3725                                         then
3726                                                 echo "($value is not a plain file, but that's ok.)"
3727                                                 type=''
3728                                         fi
3729                                         if test X"$type" = X; then
3730                                             value="$pf"
3731                                             break
3732                                         fi
3733                                 done
3734                                 ;;
3735                         Directory)
3736                                 for fp in $gfpth; do
3737                                         if test "X$fp" = X.; then
3738                                             dir="$ans"
3739                                             direxp="$ansexp"
3740                                         else    
3741                                             dir="$fp/$ansexp"
3742                                             direxp="$fp/$ansexp"
3743                                         fi
3744                                         if test -d "$direxp"; then
3745                                                 type=''
3746                                                 value="$dir"
3747                                                 break
3748                                         fi
3749                                 done
3750                                 ;;
3751                         Locate)
3752                                 if test -d "$ansexp"; then
3753                                         echo "(Looking for $loc_file in directory $value.)"
3754                                         value="$value/$loc_file"
3755                                         ansexp="$ansexp/$loc_file"
3756                                 fi
3757                                 if test -f "$ansexp"; then
3758                                         type=''
3759                                 fi
3760                                 case "$nopath_ok" in
3761                                 true)   case "$value" in
3762                                         */*) ;;
3763                                         *)      echo "Assuming $value will be in people's path."
3764                                                 type=''
3765                                                 ;;
3766                                         esac
3767                                         ;;
3768                                 esac
3769                                 ;;
3770                         esac
3771
3772                         case "$skip" in
3773                         true) type='';
3774                         esac
3775
3776                         case "$type" in
3777                         '') ;;
3778                         *)
3779                                 if test "$fastread" = yes; then
3780                                         dflt=y
3781                                 else
3782                                         dflt=n
3783                                 fi
3784                                 rp="$what $value doesn't exist.  Use that name anyway?"
3785                                 . UU/myread
3786                                 dflt=''
3787                                 case "$ans" in
3788                                 y*) type='';;
3789                                 *) echo " ";;
3790                                 esac
3791                                 ;;
3792                         esac
3793                         ;;
3794                 esac
3795                 ;;
3796         esac
3797 done
3798 cd UU
3799 ans="$value"
3800 rp="$orig_rp"
3801 dflt="$orig_dflt"
3802 rm -f getfile.ok
3803 test "X$gfpthkeep" != Xy && gfpth=""
3804 EOSC
3805
3806 : determine root of directory hierarchy where package will be installed.
3807 case "$prefix" in
3808 '')
3809         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3810         ;;
3811 *?/)
3812         dflt=`echo "$prefix" | sed 's/.$//'`
3813         ;;
3814 *)
3815         dflt="$prefix"
3816         ;;
3817 esac
3818 $cat <<EOM
3819
3820 By default, $package will be installed in $dflt/bin, manual pages
3821 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3822 installation directories. Typically this is something like /usr/local.
3823 If you wish to have binaries under /usr/bin but other parts of the
3824 installation under /usr/local, that's ok: you will be prompted
3825 separately for each of the installation directories, the prefix being
3826 only used to set the defaults.
3827
3828 EOM
3829 fn=d~
3830 rp='Installation prefix to use?'
3831 . ./getfile
3832 oldprefix=''
3833 case "$prefix" in
3834 '') ;;
3835 *)
3836         case "$ans" in
3837         "$prefix") ;;
3838         *) oldprefix="$prefix";;
3839         esac
3840         ;;
3841 esac
3842 prefix="$ans"
3843 prefixexp="$ansexp"
3844
3845 case "$afsroot" in
3846 '')     afsroot=/afs ;;
3847 *)      afsroot=$afsroot ;;
3848 esac
3849
3850 : is AFS running?
3851 echo " "
3852 case "$afs" in
3853 $define|true)   afs=true ;;
3854 $undef|false)   afs=false ;;
3855 *)      if test -d $afsroot; then
3856                 afs=true
3857         else
3858                 afs=false
3859         fi
3860         ;;
3861 esac
3862 if $afs; then
3863         echo "AFS may be running... I'll be extra cautious then..." >&4
3864 else
3865         echo "AFS does not seem to be running..." >&4
3866 fi
3867
3868 : determine installation prefix for where package is to be installed.
3869 if $afs; then 
3870 $cat <<EOM
3871
3872 Since you are running AFS, I need to distinguish the directory in which
3873 files will reside from the directory in which they are installed (and from
3874 which they are presumably copied to the former directory by occult means).
3875
3876 EOM
3877         case "$installprefix" in
3878         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3879         *) dflt="$installprefix";;
3880         esac
3881 else
3882 $cat <<EOM
3883
3884 In some special cases, particularly when building $package for distribution,
3885 it is convenient to distinguish the directory in which files should be
3886 installed from the directory ($prefix) in which they will
3887 eventually reside.  For most users, these two directories are the same.
3888
3889 EOM
3890         case "$installprefix" in
3891         '') dflt=$prefix ;;
3892         *) dflt=$installprefix;;
3893         esac
3894 fi
3895 fn=d~
3896 rp='What installation prefix should I use for installing files?'
3897 . ./getfile
3898 installprefix="$ans"
3899 installprefixexp="$ansexp"
3900
3901 : Perform the prefixexp/installprefixexp correction if necessary
3902 cat <<EOS >installprefix
3903 $startsh
3904 EOS
3905 cat <<'EOSC' >>installprefix
3906 : Change installation prefix, if necessary.
3907 if $test X"$prefix" != X"$installprefix"; then
3908     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3909 else
3910     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3911 fi
3912 EOSC
3913 chmod +x installprefix
3914 $eunicefix installprefix
3915
3916 : Set variables such as privlib and privlibexp from the output of ./getfile
3917 : performing the prefixexp/installprefixexp correction if necessary.
3918 cat <<EOS >setprefixvar
3919 $startsh
3920 EOS
3921 cat <<'EOSC' >>setprefixvar
3922 eval "${prefixvar}=\"\$ans\""
3923 eval "${prefixvar}exp=\"\$ansexp\""
3924 . ./installprefix
3925 EOSC
3926 chmod +x setprefixvar
3927 $eunicefix setprefixvar
3928
3929 : set up the script used to warn in case of inconsistency
3930 cat <<EOS >whoa
3931 $startsh
3932 EOS
3933 cat <<'EOSC' >>whoa
3934 dflt=y
3935 echo " "
3936 echo "*** WHOA THERE!!! ***" >&4
3937 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3938 rp="    Keep the $hint value?"
3939 . ./myread
3940 case "$ans" in
3941 y) td=$was; tu=$was;;
3942 esac
3943 EOSC
3944
3945 : function used to set $1 to $val
3946 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3947 case "$val$was" in
3948 $define$undef) . ./whoa; eval "$var=\$td";;
3949 $undef$define) . ./whoa; eval "$var=\$tu";;
3950 *) eval "$var=$val";;
3951 esac'
3952
3953 case "$usesocks" in
3954 $define|true|[yY]*)     dflt='y';;
3955 *) dflt='n';;
3956 esac
3957 cat <<EOM
3958
3959 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3960 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3961 to use the PerlIO abstraction layer, this will be implicitly selected.
3962
3963 If this doesn't make any sense to you, just accept the default '$dflt'.
3964 EOM
3965 rp='Build Perl for SOCKS?'
3966 . ./myread
3967 case "$ans" in
3968 y|Y)    val="$define" ;;     
3969 *)      val="$undef" ;;
3970 esac
3971 set usesocks
3972 eval $setvar
3973
3974 case "$usesocks" in
3975 $define|true|[yY]*) useperlio="$define";;
3976 esac
3977
3978 case "$useperlio" in
3979 $define|true|[yY]*|'')  dflt='y';;
3980 *) dflt='n';;
3981 esac
3982 cat <<EOM
3983
3984 Previous version of $package used the standard IO mechanisms as
3985 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3986 alternate IO mechanisms via the PerlIO abstraction layer, but the
3987 stdio mechanism is still available if needed.  The abstraction layer
3988 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3989 Using PerlIO with sfio may cause problems with some extension modules.
3990
3991 If this doesn't make any sense to you, just accept the default '$dflt'.
3992 EOM
3993 rp='Use the PerlIO abstraction layer?'
3994 . ./myread
3995 case "$ans" in
3996 y|Y) 
3997         val="$define"
3998         ;;
3999 *)      
4000         echo "Ok, doing things the stdio way."
4001         val="$undef"
4002         ;;
4003 esac
4004 set useperlio
4005 eval $setvar 
4006
4007 case "$usesocks" in
4008 $define|true|[yY]*)
4009         case "$useperlio" in
4010         $define|true|[yY]*) ;;
4011         *)      cat >&4 <<EOM
4012
4013 You are using the SOCKS proxy protocol library which means that you
4014 should also use the PerlIO layer.  You may be headed for trouble.
4015
4016 EOM
4017                 ;;
4018         esac
4019         ;;
4020 esac
4021
4022         
4023 case "$usethreads" in
4024 $define|true|[yY]*)     dflt='y';;
4025 *)     # Catch case where user specified ithreads or 5005threads but
4026        # forgot -Dusethreads (A.D. 4/2002)
4027        case "$useithreads$use5005threads" in
4028        *$define*)      
4029                 case "$useperlio" in
4030                 "$define")      dflt='y' ;;
4031                 *)              dflt='n' ;;
4032                 esac
4033                 ;;
4034        *)       dflt='n';;
4035        esac
4036        ;;
4037 esac
4038 cat <<EOM
4039
4040 Perl can be built to take advantage of threads on some systems.
4041 To do so, Configure can be run with -Dusethreads.
4042
4043 Note that Perl built with threading support runs slightly slower
4044 and uses more memory than plain Perl. The current implementation
4045 is believed to be stable, but it is fairly new, and so should be
4046 treated with caution.
4047
4048 If this doesn't make any sense to you, just accept the default '$dflt'.
4049 EOM
4050 rp='Build a threading Perl?'
4051 . ./myread
4052 case "$ans" in
4053 y|Y)    val="$define" ;;
4054 *)      val="$undef" ;;
4055 esac
4056 set usethreads
4057 eval $setvar
4058
4059 case "$usethreads" in
4060 $define)
4061         $cat <<EOM
4062
4063 Since release 5.6, Perl has had two different threading implementations,
4064 the newer interpreter-based version (ithreads) with one interpreter per
4065 thread, and the older 5.005 version (5005threads).
4066 The 5005threads version is effectively unmaintained and will probably be
4067 removed in Perl 5.10, so there should be no need to build a Perl using it
4068 unless needed for backwards compatibility with some existing 5.005threads
4069 code.
4070
4071 EOM
4072         : Default to ithreads unless overridden on command line or with
4073         : old config.sh
4074         dflt='y'
4075         case "$use5005threads" in
4076                 $define|true|[yY]*) dflt='n';;
4077         esac
4078         case "$useithreads" in
4079                 $undef|false|[nN]*) dflt='n';;
4080         esac
4081         rp='Use the newer interpreter-based ithreads?'
4082         . ./myread
4083         case "$ans" in
4084         y|Y)    val="$define" ;;
4085         *)      val="$undef" ;;
4086         esac
4087         set useithreads
4088         eval $setvar
4089         : Now set use5005threads to the opposite value.
4090         case "$useithreads" in
4091         $define) val="$undef" ;;
4092         *) val="$define" ;;
4093         esac
4094         set use5005threads
4095         eval $setvar
4096         ;;
4097 *)
4098         useithreads="$undef"
4099         use5005threads="$undef"
4100         ;;
4101 esac
4102
4103 case "$useithreads$use5005threads" in
4104 "$define$define")
4105         $cat >&4 <<EOM
4106
4107 You cannot have both the ithreads and the 5.005 threads enabled
4108 at the same time.  Disabling the 5.005 threads since they are
4109 much less stable than the ithreads.
4110
4111 EOM
4112         use5005threads="$undef"
4113         ;;
4114 esac
4115
4116 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4117         cat >&4 <<EOF
4118 ***
4119 *** To build with ithreads you must also use the PerlIO layer.
4120 *** Cannot continue, aborting.
4121 ***
4122 EOF
4123         exit 1
4124 fi
4125
4126 case "$d_oldpthreads" in
4127 '')     : Configure tests would be welcome here.  For now, assume undef.
4128         val="$undef" ;;
4129 *)      val="$d_oldpthreads" ;;
4130 esac
4131 set d_oldpthreads
4132 eval $setvar
4133
4134
4135 : Look for a hint-file generated 'call-back-unit'.  If the
4136 : user has specified that a threading perl is to be built,
4137 : we may need to set or change some other defaults.
4138 if $test -f usethreads.cbu; then
4139     echo "Your platform has some specific hints regarding threaded builds, using them..."
4140     . ./usethreads.cbu
4141 else
4142     case "$usethreads" in
4143         "$define"|true|[yY]*)
4144                 $cat <<EOM
4145 (Your platform does not have any specific hints for threaded builds.
4146  Assuming POSIX threads, then.)
4147 EOM
4148         ;;
4149     esac
4150 fi
4151
4152 cat <<EOM
4153
4154 Perl can be built so that multiple Perl interpreters can coexist
4155 within the same Perl executable.
4156 EOM
4157
4158 case "$useithreads" in
4159 $define)
4160         cat <<EOM
4161 This multiple interpreter support is required for interpreter-based threads.
4162 EOM
4163         val="$define"
4164         ;;
4165 *)      case "$usemultiplicity" in
4166         $define|true|[yY]*)     dflt='y';;
4167         *) dflt='n';;
4168         esac
4169         echo " "
4170         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4171         rp='Build Perl for multiplicity?'
4172         . ./myread
4173         case "$ans" in
4174         y|Y)    val="$define" ;;
4175         *)      val="$undef" ;;
4176         esac
4177         ;;
4178 esac
4179 set usemultiplicity
4180 eval $setvar
4181
4182
4183 case "$usemorebits" in
4184 "$define"|true|[yY]*)
4185         use64bitint="$define"
4186         uselongdouble="$define"
4187         usemorebits="$define"
4188         ;;
4189 *)      usemorebits="$undef"
4190         ;;
4191 esac
4192
4193 : make some quick guesses about what we are up against
4194 echo " "
4195 $echo $n "Hmm...  $c"
4196 echo exit 1 >bsd
4197 echo exit 1 >usg
4198 echo exit 1 >v7
4199 echo exit 1 >osf1
4200 echo exit 1 >eunice
4201 echo exit 1 >xenix
4202 echo exit 1 >venix
4203 echo exit 1 >os2
4204 d_bsd="$undef"
4205 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4206 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4207 then
4208         echo "Looks kind of like an OSF/1 system, but we'll see..."
4209         echo exit 0 >osf1
4210 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4211         xxx=`./loc addbib blurfl $pth`
4212         if $test -f $xxx; then
4213         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4214                 echo exit 0 >bsd
4215                 echo exit 0 >usg
4216         else
4217                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4218                         echo "Looks kind of like an extended USG system, but we'll see..."
4219                 else
4220                         echo "Looks kind of like a USG system, but we'll see..."
4221                 fi
4222                 echo exit 0 >usg
4223         fi
4224 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4225         echo "Looks kind of like a BSD system, but we'll see..."
4226         d_bsd="$define"
4227         echo exit 0 >bsd
4228 else
4229         echo "Looks kind of like a Version 7 system, but we'll see..."
4230         echo exit 0 >v7
4231 fi
4232 case "$eunicefix" in
4233 *unixtovms*)
4234         $cat <<'EOI'
4235 There is, however, a strange, musty smell in the air that reminds me of
4236 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4237 EOI
4238         echo exit 0 >eunice
4239         d_eunice="$define"
4240 : it so happens the Eunice I know will not run shell scripts in Unix format
4241         ;;
4242 *)
4243         echo " "
4244         echo "Congratulations.  You aren't running Eunice."
4245         d_eunice="$undef"
4246         ;;
4247 esac
4248 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4249 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4250 : semicolon as a patch separator
4251 case "$p_" in
4252 :) ;;
4253 *)
4254         $cat <<'EOI'
4255 I have the feeling something is not exactly right, however...don't tell me...
4256 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4257 (Or you may be running DOS with DJGPP.)
4258 EOI
4259         echo exit 0 >os2
4260         ;;
4261 esac
4262 if test -f /xenix; then
4263         echo "Actually, this looks more like a XENIX system..."
4264         echo exit 0 >xenix
4265         d_xenix="$define"
4266 else
4267         echo " "
4268         echo "It's not Xenix..."
4269         d_xenix="$undef"
4270 fi
4271 chmod +x xenix
4272 $eunicefix xenix
4273 if test -f /venix; then
4274         echo "Actually, this looks more like a VENIX system..."
4275         echo exit 0 >venix
4276 else
4277         echo " "
4278         if ./xenix; then
4279                 : null
4280         else
4281                 echo "Nor is it Venix..."
4282         fi
4283 fi
4284 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4285 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4286 $rm -f foo
4287
4288 case "$cc" in
4289 '') dflt=cc;;
4290 *) dflt="$cc";;
4291 esac
4292 rp="Use which C compiler?"
4293 . ./myread
4294 cc="$ans"
4295
4296 : See if they have not cc but they do have gcc
4297 . ./trygcc
4298 : Look for a hint-file generated 'call-back-unit'.  Now that the
4299 : user has specified the compiler, we may need to set or change some
4300 : other defaults.
4301 if $test -f cc.cbu; then
4302     . ./cc.cbu
4303 fi
4304 . ./checkcc
4305
4306 echo " "
4307 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4308 $cat >try.c <<EOM
4309 #include <stdio.h>
4310 int main() {
4311 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4312 #ifdef __VERSION__
4313         printf("%s\n", __VERSION__);
4314 #else
4315         printf("%s\n", "1");
4316 #endif
4317 #endif
4318         return(0);
4319 }
4320 EOM
4321 if $cc -o try $ccflags $ldflags try.c; then
4322         gccversion=`$run ./try`
4323         case "$gccversion" in
4324         '') echo "You are not using GNU cc." ;;
4325         *)  echo "You are using GNU cc $gccversion."
4326             ccname=gcc
4327             ;;
4328         esac
4329 else
4330         echo " "
4331         echo "*** WHOA THERE!!! ***" >&4
4332         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4333         case "$knowitall" in
4334         '')
4335         echo "    You'd better start hunting for one and let me know about it." >&4
4336                 exit 1
4337                 ;;
4338         esac
4339 fi
4340 $rm -f try try.*
4341 case "$gccversion" in
4342 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4343 esac
4344 case "$gccversion" in
4345 '') gccosandvers='' ;;
4346 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4347    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4348    gccshortvers=''
4349    case "$gccosandvers" in
4350    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4351    $osname$osvers) ;; # looking good
4352    $osname*) cat <<EOM >&4
4353
4354 *** WHOA THERE!!! ***
4355
4356     Your gcc has not been compiled for the exact release of
4357     your operating system ($gccosandvers versus $osname$osvers).
4358
4359     In general it is a good idea to keep gcc synchronized with
4360     the operating system because otherwise serious problems
4361     may ensue when trying to compile software, like Perl.
4362
4363     I'm trying to be optimistic here, though, and will continue.
4364     If later during the configuration and build icky compilation
4365     problems appear (headerfile conflicts being the most common
4366     manifestation), I suggest reinstalling the gcc to match
4367     your operating system release.
4368
4369 EOM
4370       ;;
4371    *) gccosandvers='' ;; # failed to parse, better be silent
4372    esac
4373    ;;
4374 esac
4375 case "$ccname" in
4376 '') ccname="$cc" ;;
4377 esac
4378
4379 # gcc 3.* complain about adding -Idirectories that they already know about,
4380 # so we will take those off from locincpth.
4381 case "$gccversion" in
4382 3*)
4383     echo "main(){}">try.c
4384     for incdir in $locincpth; do
4385        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4386              grep '^c[cp]p*[01]: warning: changing search order '`
4387        if test "X$warn" != X; then
4388            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4389        fi
4390     done
4391     $rm -f try try.*
4392 esac
4393
4394 : What should the include directory be ?
4395 echo " "
4396 $echo $n "Hmm...  $c"
4397 dflt='/usr/include'
4398 incpath=''
4399 mips_type=''
4400 if $test -f /bin/mips && /bin/mips; then
4401         echo "Looks like a MIPS system..."
4402         $cat >usr.c <<'EOCP'
4403 #ifdef SYSTYPE_BSD43
4404 /bsd43
4405 #endif
4406 EOCP
4407         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4408                 dflt='/bsd43/usr/include'
4409                 incpath='/bsd43'
4410                 mips_type='BSD 4.3'
4411         else
4412                 mips_type='System V'
4413         fi
4414         $rm -f usr.c usr.out
4415         echo "and you're compiling with the $mips_type compiler and libraries."
4416         xxx_prompt=y
4417         echo "exit 0" >mips
4418 else
4419         echo "Doesn't look like a MIPS system."
4420         xxx_prompt=n
4421         echo "exit 1" >mips
4422 fi
4423 chmod +x mips
4424 $eunicefix mips
4425 case "$usrinc" in
4426 '') ;;
4427 *) dflt="$usrinc";;
4428 esac
4429 case "$xxx_prompt" in
4430 y)      fn=d/
4431         echo " "
4432         rp='Where are the include files you want to use?'
4433         . ./getfile
4434         usrinc="$ans"
4435         ;;
4436 *)      usrinc="$dflt"
4437         ;;
4438 esac
4439
4440 : see how we invoke the C preprocessor
4441 echo " "
4442 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4443 cat <<'EOT' >testcpp.c
4444 #define ABC abc
4445 #define XYZ xyz
4446 ABC.XYZ
4447 EOT
4448 cd ..
4449 if test ! -f cppstdin; then
4450         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4451                 # AIX cc -E doesn't show the absolute headerfile
4452                 # locations but we'll cheat by using the -M flag.
4453                 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
4454         else
4455                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4456         fi
4457 else
4458         echo "Keeping your $hint cppstdin wrapper."
4459 fi
4460 chmod 755 cppstdin
4461 wrapper=`pwd`/cppstdin
4462 ok='false'
4463 cd UU
4464
4465 if $test "X$cppstdin" != "X" && \
4466         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4467         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4468 then
4469         echo "You used to use $cppstdin $cppminus so we'll use that again."
4470         case "$cpprun" in
4471         '') echo "But let's see if we can live without a wrapper..." ;;
4472         *)
4473                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4474                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4475                 then
4476                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4477                         ok='true'
4478                 else
4479                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4480                 fi
4481                 ;;
4482         esac
4483 else
4484         case "$cppstdin" in
4485         '') ;;
4486         *)
4487                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4488                 ;;
4489         esac
4490 fi
4491
4492 if $ok; then
4493         : nothing
4494 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4495         $cc -E <testcpp.c >testcpp.out 2>&1; \
4496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4497         echo "Yup, it does."
4498         x_cpp="$cc -E"
4499         x_minus='';
4500 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4501         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4503         echo "Yup, it does."
4504         x_cpp="$cc -E"
4505         x_minus='-';
4506 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4507         $cc -P <testcpp.c >testcpp.out 2>&1; \
4508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4509         echo "Yipee, that works!"
4510         x_cpp="$cc -P"
4511         x_minus='';
4512 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4513         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4515         echo "At long last!"
4516         x_cpp="$cc -P"
4517         x_minus='-';
4518 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4519         $cpp <testcpp.c >testcpp.out 2>&1; \
4520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4521         echo "It works!"
4522         x_cpp="$cpp"
4523         x_minus='';
4524 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4525         $cpp - <testcpp.c >testcpp.out 2>&1; \
4526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4527         echo "Hooray, it works!  I was beginning to wonder."
4528         x_cpp="$cpp"
4529         x_minus='-';
4530 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4531         $wrapper <testcpp.c >testcpp.out 2>&1; \
4532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4533         x_cpp="$wrapper"
4534         x_minus=''
4535         echo "Eureka!"
4536 else
4537         dflt=''
4538         rp="No dice.  I can't find a C preprocessor.  Name one:"
4539         . ./myread
4540         x_cpp="$ans"
4541         x_minus=''
4542         $x_cpp <testcpp.c >testcpp.out 2>&1
4543         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4544                 echo "OK, that will do." >&4
4545         else
4546 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4547                 exit 1
4548         fi
4549 fi
4550
4551 case "$ok" in
4552 false)
4553         cppstdin="$x_cpp"
4554         cppminus="$x_minus"
4555         cpprun="$x_cpp"
4556         cpplast="$x_minus"
4557         set X $x_cpp
4558         shift
4559         case "$1" in
4560         "$cpp")
4561                 echo "Perhaps can we force $cc -E using a wrapper..."
4562                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4563                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4564                 then
4565                         echo "Yup, we can."
4566                         cppstdin="$wrapper"
4567                         cppminus='';
4568                 else
4569                         echo "Nope, we'll have to live without it..."
4570                 fi
4571                 ;;
4572         esac
4573         case "$cpprun" in
4574         "$wrapper")
4575                 cpprun=''
4576                 cpplast=''
4577                 ;;
4578         esac
4579         ;;
4580 esac
4581
4582 case "$cppstdin" in
4583 "$wrapper"|'cppstdin') ;;
4584 *) $rm -f $wrapper;;
4585 esac
4586 $rm -f testcpp.c testcpp.out
4587
4588 : Set private lib path
4589 case "$plibpth" in
4590 '') if ./mips; then
4591                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4592         fi;;
4593 esac
4594 case "$libpth" in
4595 ' ') dlist='';;
4596 '') dlist="$loclibpth $plibpth $glibpth";;
4597 *) dlist="$libpth";;
4598 esac
4599
4600 : Now check and see which directories actually exist, avoiding duplicates
4601 libpth=''
4602 for xxx in $dlist
4603 do
4604     if $test -d $xxx; then
4605                 case " $libpth " in
4606                 *" $xxx "*) ;;
4607                 *) libpth="$libpth $xxx";;
4608                 esac
4609     fi
4610 done
4611 $cat <<'EOM'
4612
4613 Some systems have incompatible or broken versions of libraries.  Among
4614 the directories listed in the question below, please remove any you
4615 know not to be holding relevant libraries, and add any that are needed.
4616 Say "none" for none.
4617
4618 EOM
4619 case "$libpth" in
4620 '') dflt='none';;
4621 *)
4622         set X $libpth
4623         shift
4624         dflt=${1+"$@"}
4625         ;;
4626 esac
4627 rp="Directories to use for library searches?"
4628 . ./myread
4629 case "$ans" in
4630 none) libpth=' ';;
4631 *) libpth="$ans";;
4632 esac
4633
4634 : compute shared library extension
4635 case "$so" in
4636 '')
4637         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4638                 dflt='sl'
4639         else
4640                 dflt='so'
4641         fi
4642         ;;
4643 *) dflt="$so";;
4644 esac
4645 $cat <<EOM
4646
4647 On some systems, shared libraries may be available.  Answer 'none' if
4648 you want to suppress searching of shared libraries for the remainder
4649 of this configuration.
4650
4651 EOM
4652 rp='What is the file extension used for shared libraries?'
4653 . ./myread
4654 so="$ans"
4655
4656 : Define several unixisms.
4657 : Hints files or command line option can be used to override them.
4658 : The convoluted testing is in case hints files set either the old
4659 : or the new name.
4660 case "$_exe" in
4661 '')     case "$exe_ext" in
4662         '')     ;;
4663         *)      _exe="$exe_ext" ;;
4664         esac
4665         ;;
4666 esac
4667 case "$_a" in
4668 '')     case "$lib_ext" in
4669     '') _a='.a';;
4670         *)      _a="$lib_ext" ;;
4671         esac
4672         ;;
4673 esac
4674 case "$_o" in
4675 '') case "$obj_ext" in
4676         '')     _o='.o';;
4677         *)      _o="$obj_ext";;
4678         esac
4679         ;;
4680 esac
4681 case "$p_" in
4682 '') case "$path_sep" in
4683         '')     p_=':';;
4684         *)      p_="$path_sep";;
4685         esac
4686         ;;
4687 esac
4688 exe_ext=$_exe
4689 lib_ext=$_a
4690 obj_ext=$_o
4691 path_sep=$p_
4692
4693 : Which makefile gets called first.  This is used by make depend.
4694 case "$firstmakefile" in
4695 '') firstmakefile='makefile';;
4696 esac
4697
4698 case "$ccflags" in
4699 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4700 esac
4701
4702 case "$uselongdouble" in
4703 $define|true|[yY]*)     dflt='y';;
4704 *) dflt='n';;
4705 esac
4706 cat <<EOM
4707
4708 Perl can be built to take advantage of long doubles which
4709 (if available) may give more accuracy and range for floating point numbers.
4710
4711 If this doesn't make any sense to you, just accept the default '$dflt'.
4712 EOM
4713 rp='Try to use long doubles if available?'
4714 . ./myread
4715 case "$ans" in
4716 y|Y)    val="$define"   ;;
4717 *)      val="$undef"    ;;
4718 esac
4719 set uselongdouble
4720 eval $setvar
4721
4722 case "$uselongdouble" in
4723 true|[yY]*) uselongdouble="$define" ;;
4724 esac
4725
4726 : Look for a hint-file generated 'call-back-unit'.  If the
4727 : user has specified that long doubles should be used,
4728 : we may need to set or change some other defaults.
4729 if $test -f uselongdouble.cbu; then
4730     echo "Your platform has some specific hints regarding long doubles, using them..."
4731     . ./uselongdouble.cbu
4732 else
4733     case "$uselongdouble" in
4734         $define)
4735                 $cat <<EOM
4736 (Your platform does not have any specific hints for long doubles.)
4737 EOM
4738         ;;
4739     esac
4740 fi
4741
4742 : Looking for optional libraries
4743 echo " "
4744 echo "Checking for optional libraries..." >&4
4745 case "$libs" in
4746 ' '|'') dflt='';;
4747 *) dflt="$libs";;
4748 esac
4749 case "$libswanted" in
4750 '') libswanted='c_s';;
4751 esac
4752 case "$usesocks" in
4753 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4754 esac
4755 libsfound=''
4756 libsfiles=''
4757 libsdirs=''
4758 libspath=''
4759 for thisdir in $libpth $xlibpth; do
4760   test -d $thisdir && libspath="$libspath $thisdir"
4761 done
4762 for thislib in $libswanted; do
4763         for thisdir in $libspath; do
4764             xxx=''
4765             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4766                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4767                 $test -f "$xxx" && eval $libscheck
4768                 $test -f "$xxx" && libstyle=shared
4769             fi
4770             if test ! -f "$xxx"; then
4771                 xxx=$thisdir/lib$thislib.$so
4772                 $test -f "$xxx" && eval $libscheck
4773                 $test -f "$xxx" && libstyle=shared
4774             fi  
4775             if test ! -f "$xxx"; then
4776                 xxx=$thisdir/lib$thislib$_a
4777                 $test -f "$xxx" && eval $libscheck
4778                 $test -f "$xxx" && libstyle=static
4779             fi
4780             if test ! -f "$xxx"; then
4781                 xxx=$thisdir/$thislib$_a
4782                 $test -f "$xxx" && eval $libscheck
4783                 $test -f "$xxx" && libstyle=static
4784             fi
4785             if test ! -f "$xxx"; then
4786                 xxx=$thisdir/lib${thislib}_s$_a
4787                 $test -f "$xxx" && eval $libscheck
4788                 $test -f "$xxx" && libstyle=static
4789                 $test -f "$xxx" && thislib=${thislib}_s
4790             fi
4791             if test ! -f "$xxx"; then
4792                 xxx=$thisdir/Slib$thislib$_a
4793                 $test -f "$xxx" && eval $libscheck
4794                 $test -f "$xxx" && libstyle=static
4795             fi
4796             if $test -f "$xxx"; then
4797                 case "$libstyle" in
4798                 shared) echo "Found -l$thislib (shared)." ;;
4799                 static) echo "Found -l$thislib." ;;
4800                 *)      echo "Found -l$thislib ($libstyle)." ;;
4801                 esac
4802                 case " $dflt " in
4803                 *"-l$thislib "*);;
4804                 *) dflt="$dflt -l$thislib"
4805                    libsfound="$libsfound $xxx"
4806                    yyy=`basename $xxx`
4807                    libsfiles="$libsfiles $yyy"
4808                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4809                    case " $libsdirs " in
4810                    *" $yyy "*) ;;
4811                    *) libsdirs="$libsdirs $yyy" ;;
4812                    esac
4813                    ;;
4814                 esac
4815                 break
4816             fi  
4817         done
4818         if $test ! -f "$xxx"; then
4819             echo "No -l$thislib."
4820         fi
4821 done
4822 set X $dflt
4823 shift
4824 dflt="$*"
4825 case "$libs" in
4826 '') dflt="$dflt";;
4827 *) dflt="$libs";;
4828 esac
4829 case "$dflt" in
4830 ' '|'') dflt='none';;
4831 esac
4832
4833 $cat <<EOM
4834
4835 In order to compile $package on your machine, a number of libraries
4836 are usually needed.  Include any other special libraries here as well.
4837 Say "none" for none.  The default list is almost always right.
4838 EOM
4839
4840 echo " "
4841 rp="What libraries to use?"
4842 . ./myread
4843 case "$ans" in
4844 none) libs=' ';;
4845 *) libs="$ans";;
4846 esac
4847
4848 : determine optimization, if desired, or use for debug flag also
4849 case "$optimize" in
4850 ' '|$undef) dflt='none';;
4851 '') dflt='-O';;
4852 *) dflt="$optimize";;
4853 esac
4854 $cat <<EOH
4855
4856 By default, $package compiles with the -O flag to use the optimizer.
4857 Alternately, you might want to use the symbolic debugger, which uses
4858 the -g flag (on traditional Unix systems).  Either flag can be
4859 specified here.  To use neither flag, specify the word "none".
4860
4861 EOH
4862 rp="What optimizer/debugger flag should be used?"
4863 . ./myread
4864 optimize="$ans"
4865 case "$optimize" in
4866 'none') optimize=" ";;
4867 esac
4868
4869 : Check what DEBUGGING is required from the command line
4870 : -DEBUGGING      or -DDEBUGGING or
4871 : -DEBUGGING=both                       = -g + -DDEBUGGING
4872 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4873 : -DEBUGGING=none or -UDEBUGGING        =
4874 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4875 case "$EBUGGING" in
4876 '')     ;;
4877 *)      DEBUGGING=$EBUGGING ;;
4878 esac
4879
4880 case "$DEBUGGING" in
4881 -g|$define)
4882     case "$optimize" in
4883         *-g*) ;;
4884         *)    optimize="$optimize -g" ;;
4885     esac ;;
4886 none|$undef)
4887     case "$optimize" in
4888         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4889                 shift
4890                 optimize="$*"
4891                 ;;
4892     esac ;;
4893 esac
4894
4895 dflt=''
4896 case "$DEBUGGING" in
4897 both|$define) dflt='-DDEBUGGING'
4898 esac
4899
4900 : We will not override a previous value, but we might want to
4901 : augment a hint file
4902 case "$hint" in
4903 default|recommended)
4904         case "$gccversion" in
4905         1*) dflt="$dflt -fpcc-struct-return" ;;
4906         esac
4907         case "$optimize:$DEBUGGING" in
4908         *-g*:old) dflt="$dflt -DDEBUGGING";;
4909         esac
4910         case "$gccversion" in
4911         2*) if test -d /etc/conf/kconfig.d &&
4912                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4913                 then
4914                         # Interactive Systems (ISC) POSIX mode.
4915                         dflt="$dflt -posix"
4916                 fi
4917                 ;;
4918         esac
4919         case "$gccversion" in
4920         1*) ;;
4921         2.[0-8]*) ;;
4922         ?*)     echo " "
4923                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4924                 echo 'int main(void) { return 0; }' > gcctest.c
4925                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4926                         echo "Yes, it does." 2>&1
4927                         case "$ccflags" in
4928                         *strict-aliasing*)
4929                                 echo "Leaving current flags $ccflags alone." 2>&1
4930                                 ;;
4931                         *) dflt="$dflt -fno-strict-aliasing" ;;
4932                         esac
4933                 else
4934                         echo "Nope, it doesn't, but that's ok." 2>&1
4935                 fi
4936                 ;;
4937         esac
4938         # For gcc, adding -pipe speeds up compilations for some, but apparently
4939         # some assemblers can't read from stdin.  (It also slows down compilations
4940         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4941         case "$gccversion" in
4942         ?*)     echo " "
4943                 echo "Checking if your compiler accepts -pipe" 2>&1
4944                 echo 'int main(void) { return 0; }' > gcctest.c
4945                 if $cc -pipe -o gcctest gcctest.c; then
4946                         echo "Yes, it does." 2>&1
4947                         case "$ccflags" in
4948                         *-pipe*)
4949                                 echo "Leaving current flags $ccflags alone." 2>&1
4950                                 ;;
4951                         *) dflt="$dflt -pipe" ;;
4952                         esac
4953                 else
4954                         echo "Nope, it doesn't, but that's ok." 2>&1
4955                 fi
4956
4957                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4958                 echo 'int main(void) { return 0; }' > gcctest.c
4959                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4960                         echo "Yes, it does." 2>&1
4961                         case "$ccflags" in
4962                         *-Wdeclaration-after-statement*)
4963                                 echo "Leaving current flags $ccflags alone." 2>&1
4964                                 ;;
4965                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4966                         esac
4967                 else
4968                         echo "Nope, it doesn't, but that's ok." 2>&1
4969                 fi
4970                 ;;
4971         esac
4972         ;;
4973 esac
4974
4975 case "$mips_type" in
4976 *BSD*|'') inclwanted="$locincpth $usrinc";;
4977 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4978 esac
4979 for thisincl in $inclwanted; do
4980         if $test -d $thisincl; then
4981                 if $test x$thisincl != x$usrinc; then
4982                         case "$dflt" in
4983                         *" -I$thisincl "*);;
4984                         *) dflt="$dflt -I$thisincl ";;
4985                         esac
4986                 fi
4987         fi
4988 done
4989
4990 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4991         xxx=true;
4992 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4993         xxx=true;
4994 else
4995         xxx=false;
4996 fi;
4997 if $xxx; then
4998         case "$dflt" in
4999         *$2*);;
5000         *) dflt="$dflt -D$2";;
5001         esac;
5002 fi'
5003
5004 set signal.h LANGUAGE_C; eval $inctest
5005
5006 case "$usesocks" in
5007 $define)
5008         ccflags="$ccflags -DSOCKS"
5009         ;;
5010 esac
5011
5012 case "$hint" in
5013 default|recommended) dflt="$ccflags $dflt" ;;
5014 *) dflt="$ccflags";;
5015 esac
5016
5017 case "$dflt" in
5018 ''|' ') dflt=none;;
5019 esac
5020
5021 $cat <<EOH
5022
5023 Your C compiler may want other flags.  For this question you should include
5024 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5025 but you should NOT include libraries or ld flags like -lwhatever.  If you
5026 want $package to honor its debug switch, you should include -DDEBUGGING here.
5027 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5028
5029 To use no flags, specify the word "none".
5030
5031 EOH
5032 set X $dflt
5033 shift
5034 dflt=${1+"$@"}
5035 rp="Any additional cc flags?"
5036 . ./myread
5037 case "$ans" in
5038 none) ccflags='';;
5039 *) ccflags="$ans";;
5040 esac
5041
5042 : the following weeds options from ccflags that are of no interest to cpp
5043 case "$cppflags" in
5044 '') cppflags="$ccflags" ;;
5045 *)  cppflags="$cppflags $ccflags" ;;
5046 esac
5047 case "$gccversion" in
5048 1*) cppflags="$cppflags -D__GNUC__"
5049 esac
5050 case "$mips_type" in
5051 '');;
5052 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5053 esac
5054 case "$cppflags" in
5055 '');;
5056 *)
5057         echo " "
5058         echo "Let me guess what the preprocessor flags are..." >&4
5059         set X $cppflags
5060         shift
5061         cppflags=''
5062         $cat >cpp.c <<'EOM'
5063 #define BLURFL foo
5064
5065 BLURFL xx LFRULB
5066 EOM
5067         previous=''
5068         for flag in $*
5069         do
5070                 case "$flag" in
5071                 -*) ftry="$flag";;
5072                 *) ftry="$previous $flag";;
5073                 esac
5074                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5075                         >cpp1.out 2>/dev/null && \
5076                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5077                         >cpp2.out 2>/dev/null && \
5078                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5079                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5080                 then
5081                         cppflags="$cppflags $ftry"
5082                         previous=''
5083                 else
5084                         previous="$flag"
5085                 fi
5086         done
5087         set X $cppflags
5088         shift
5089         cppflags=${1+"$@"}
5090         case "$cppflags" in
5091         *-*)  echo "They appear to be: $cppflags";;
5092         esac
5093         $rm -f cpp.c cpp?.out
5094         ;;
5095 esac
5096
5097 : flags used in final linking phase
5098 case "$ldflags" in
5099 '') if ./venix; then
5100                 dflt='-i -z'
5101         else
5102                 dflt=''
5103         fi
5104         case "$ccflags" in
5105         *-posix*) dflt="$dflt -posix" ;;
5106         esac
5107         ;;
5108 *) dflt="$ldflags";;
5109 esac
5110
5111 : Try to guess additional flags to pick up local libraries.
5112 for thislibdir in $libpth; do
5113         case " $loclibpth " in
5114         *" $thislibdir "*)
5115                 case "$dflt " in
5116                 *"-L$thislibdir "*) ;;
5117                 *)  dflt="$dflt -L$thislibdir" ;;
5118                 esac
5119                 ;;
5120         esac
5121 done
5122
5123 case "$dflt" in
5124 '') dflt='none' ;;
5125 esac
5126
5127 $cat <<EOH
5128
5129 Your C linker may need flags.  For this question you should
5130 include -L/whatever and any other flags used by the C linker, but you
5131 should NOT include libraries like -lwhatever.
5132
5133 Make sure you include the appropriate -L/path flags if your C linker
5134 does not normally search all of the directories you specified above,
5135 namely
5136         $libpth
5137 To use no flags, specify the word "none".
5138
5139 EOH
5140
5141 rp="Any additional ld flags (NOT including libraries)?"
5142 . ./myread
5143 case "$ans" in
5144 none) ldflags='';;
5145 *) ldflags="$ans";;
5146 esac
5147 rmlist="$rmlist pdp11"
5148
5149 : coherency check
5150 echo " "
5151 echo "Checking your choice of C compiler and flags for coherency..." >&4
5152 $cat > try.c <<'EOF'
5153 #include <stdio.h>
5154 int main() { printf("Ok\n"); return(0); }
5155 EOF
5156 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5157 shift
5158 $cat >try.msg <<'EOM'
5159 I've tried to compile and run the following simple program:
5160
5161 EOM
5162 $cat try.c >> try.msg
5163
5164 $cat >> try.msg <<EOM
5165
5166 I used the command:
5167
5168         $*
5169         $run ./try
5170
5171 and I got the following output:
5172
5173 EOM
5174 dflt=y
5175 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5176         if $sh -c "$run ./try" >>try.msg 2>&1; then
5177                 xxx=`$run ./try`
5178                 case "$xxx" in
5179                 "Ok") dflt=n ;;
5180                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5181                         case " $libs " in
5182                         *" -lsfio "*)
5183                                 cat >> try.msg <<'EOQS'
5184 If $libs contains -lsfio, and sfio is mis-configured, then it
5185 sometimes (apparently) runs and exits with a 0 status, but with no
5186 output!  It may have to do with sfio's use of _exit vs. exit.
5187
5188 EOQS
5189                                 rp="You have a big problem.  Shall I abort Configure"
5190                                 dflt=y
5191                                 ;;
5192                         esac
5193                         ;;
5194                 esac
5195         else
5196                 echo "The program compiled OK, but exited with status $?." >>try.msg
5197                 rp="You have a problem.  Shall I abort Configure"
5198                 dflt=y
5199         fi
5200 else
5201         echo "I can't compile the test program." >>try.msg
5202         rp="You have a BIG problem.  Shall I abort Configure"
5203         dflt=y
5204 fi
5205 case "$dflt" in
5206 y)
5207         $cat try.msg >&4
5208         case "$knowitall" in
5209         '')
5210                 echo "(The supplied flags or libraries might be incorrect.)"
5211                 ;;
5212         *) dflt=n;;
5213         esac
5214         echo " "
5215         . ./myread
5216         case "$ans" in
5217         n*|N*) ;;
5218         *)      echo "Ok.  Stopping Configure." >&4
5219                 exit 1
5220                 ;;
5221         esac
5222         ;;
5223 n) echo "OK, that should do.";;
5224 esac
5225 $rm -f try try.* core
5226
5227 : define a shorthand compile call
5228 compile='
5229 mc_file=$1;
5230 shift;
5231 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5232 : define a shorthand compile call for compilations that should be ok.
5233 compile_ok='
5234 mc_file=$1;
5235 shift;
5236 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5237
5238 : determine filename position in cpp output
5239 echo " "
5240 echo "Computing filename position in cpp output for #include directives..." >&4
5241 case "$osname" in
5242 vos) testaccess=-e ;;
5243 *)   testaccess=-r ;;
5244 esac
5245 echo '#include <stdio.h>' > foo.c
5246 $cat >fieldn <<EOF
5247 $startsh
5248 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5249 $grep '^[       ]*#.*stdio\.h' | \
5250 while read cline; do
5251         pos=1
5252         set \$cline
5253         while $test \$# -gt 0; do
5254                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5255                         echo "\$pos"
5256                         exit 0
5257                 fi
5258                 shift
5259                 pos=\`expr \$pos + 1\`
5260         done
5261 done
5262 EOF
5263 chmod +x fieldn
5264 fieldn=`./fieldn`
5265 $rm -f foo.c fieldn
5266 case $fieldn in
5267 '') pos='???';;
5268 1) pos=first;;
5269 2) pos=second;;
5270 3) pos=third;;
5271 *) pos="${fieldn}th";;
5272 esac
5273 echo "Your cpp writes the filename in the $pos field of the line."
5274
5275 case "$osname" in
5276 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5277 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5278 *)   cppfilter='' ;;
5279 esac
5280 : locate header file
5281 $cat >findhdr <<EOF
5282 $startsh
5283 wanted=\$1
5284 name=''
5285 for usrincdir in $usrinc
5286 do
5287         if test -f \$usrincdir/\$wanted; then
5288                 echo "\$usrincdir/\$wanted"
5289                 exit 0
5290         fi
5291 done
5292 awkprg='{ print \$$fieldn }'
5293 echo "#include <\$wanted>" > foo\$\$.c
5294 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5295 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5296 while read cline; do
5297         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5298         case "\$name" in
5299         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5300         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5301         *) exit 2;;
5302         esac;
5303 done;
5304 #
5305 # status = 0: grep returned 0 lines, case statement not executed
5306 # status = 1: headerfile found
5307 # status = 2: while loop executed, no headerfile found
5308 #
5309 status=\$?
5310 $rm -f foo\$\$.c;
5311 if test \$status -eq 1; then
5312         exit 0;
5313 fi
5314 exit 1
5315 EOF
5316 chmod +x findhdr
5317
5318 : define an alternate in-header-list? function
5319 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5320 cont=true; xxf="echo \"<\$1> found.\" >&4";
5321 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5322 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5323 esac;
5324 case $# in 4) instead=instead;; *) instead="at last";; esac;
5325 while $test "$cont"; do
5326         xxx=`./findhdr $1`
5327         var=$2; eval "was=\$$2";
5328         if $test "$xxx" && $test -r "$xxx";
5329         then eval $xxf;
5330         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5331                 cont="";
5332         else eval $xxnf;
5333         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5334         set $yyy; shift; shift; yyy=$@;
5335         case $# in 0) cont="";;
5336         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5337                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5338         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5339                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5340         esac;
5341 done;
5342 while $test "$yyy";
5343 do set $yyy; var=$2; eval "was=\$$2";
5344         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5345         set $yyy; shift; shift; yyy=$@;
5346 done'
5347
5348 : see if stdlib is available
5349 set stdlib.h i_stdlib
5350 eval $inhdr
5351
5352 : check for lengths of integral types
5353 echo " "
5354 case "$intsize" in
5355 '')
5356         echo "Checking to see how big your integers are..." >&4
5357         $cat >try.c <<EOCP
5358 #include <stdio.h>
5359 #$i_stdlib I_STDLIB
5360 #ifdef I_STDLIB
5361 #include <stdlib.h>
5362 #endif
5363 int main()
5364 {
5365         printf("intsize=%d;\n", (int)sizeof(int));
5366         printf("longsize=%d;\n", (int)sizeof(long));
5367         printf("shortsize=%d;\n", (int)sizeof(short));
5368         exit(0);
5369 }
5370 EOCP
5371         set try
5372         if eval $compile_ok && $run ./try > /dev/null; then
5373                 eval `$run ./try`
5374                 echo "Your integers are $intsize bytes long."
5375                 echo "Your long integers are $longsize bytes long."
5376                 echo "Your short integers are $shortsize bytes long."
5377         else
5378                 $cat >&4 <<EOM
5379 !
5380 Help! I can't compile and run the intsize test program: please enlighten me!
5381 (This is probably a misconfiguration in your system or libraries, and
5382 you really ought to fix it.  Still, I'll try anyway.)
5383 !
5384 EOM
5385                 dflt=4
5386                 rp="What is the size of an integer (in bytes)?"
5387                 . ./myread
5388                 intsize="$ans"
5389                 dflt=$intsize
5390                 rp="What is the size of a long integer (in bytes)?"
5391                 . ./myread
5392                 longsize="$ans"
5393                 dflt=2
5394                 rp="What is the size of a short integer (in bytes)?"
5395                 . ./myread
5396                 shortsize="$ans"
5397         fi
5398         ;;
5399 esac
5400 $rm -f try try.*
5401
5402 : check for long long
5403 echo " "
5404 echo "Checking to see if you have long long..." >&4
5405 echo 'int main() { long long x = 7; return 0; }' > try.c
5406 set try
5407 if eval $compile; then
5408         val="$define"
5409         echo "You have long long."
5410 else
5411         val="$undef"
5412         echo "You do not have long long."
5413 fi
5414 $rm try.*
5415 set d_longlong
5416 eval $setvar
5417
5418 : check for length of long long
5419 case "${d_longlong}${longlongsize}" in
5420 $define)
5421         echo " "
5422         echo "Checking to see how big your long longs are..." >&4
5423         $cat >try.c <<'EOCP'
5424 #include <stdio.h>
5425 int main()
5426 {
5427     printf("%d\n", (int)sizeof(long long));
5428     return(0);
5429 }
5430 EOCP
5431         set try
5432         if eval $compile_ok; then
5433                 longlongsize=`$run ./try`
5434                 echo "Your long longs are $longlongsize bytes long."
5435         else
5436                 dflt='8'
5437                 echo " "
5438                 echo "(I can't seem to compile the test program.  Guessing...)"
5439                 rp="What is the size of a long long (in bytes)?"
5440                 . ./myread
5441                 longlongsize="$ans"
5442         fi
5443         if $test "X$longsize" = "X$longlongsize"; then
5444                 echo "(That isn't any different from an ordinary long.)"
5445         fi      
5446         ;;
5447 esac
5448 $rm -f try.* try
5449
5450 : see if inttypes.h is available
5451 : we want a real compile instead of Inhdr because some systems
5452 : have an inttypes.h which includes non-existent headers
5453 echo " "
5454 $cat >try.c <<EOCP
5455 #include <inttypes.h>
5456 int main() {
5457         static int32_t foo32 = 0x12345678;
5458 }
5459 EOCP
5460 set try
5461 if eval $compile; then
5462         echo "<inttypes.h> found." >&4
5463         val="$define"
5464 else
5465         echo "<inttypes.h> NOT found." >&4
5466         val="$undef"
5467 fi
5468 $rm -f try.c try
5469 set i_inttypes
5470 eval $setvar
5471
5472 : check for int64_t
5473 echo " "
5474 echo "Checking to see if you have int64_t..." >&4
5475 $cat >try.c <<EOCP
5476 #include <sys/types.h>
5477 #$i_inttypes I_INTTYPES
5478 #ifdef I_INTTYPES
5479 #include <inttypes.h>
5480 #endif
5481 int main() { int64_t x = 7; }
5482 EOCP
5483 set try
5484 if eval $compile; then
5485         val="$define"
5486         echo "You have int64_t."
5487 else
5488         val="$undef"
5489         echo "You do not have int64_t."
5490 fi
5491 $rm -f try try.*
5492 set d_int64_t
5493 eval $setvar
5494
5495
5496 echo " "
5497 echo "Checking which 64-bit integer type we could use..." >&4
5498
5499 case "$intsize" in
5500 8) val=int
5501    set quadtype
5502    eval $setvar
5503    val='"unsigned int"'
5504    set uquadtype
5505    eval $setvar
5506    quadkind=1
5507    ;;
5508 *) case "$longsize" in
5509    8) val=long
5510       set quadtype
5511       eval $setvar
5512       val='"unsigned long"'
5513       set uquadtype
5514       eval $setvar
5515       quadkind=2
5516       ;;
5517    *) case "$d_longlong:$longlongsize" in
5518       define:8)
5519         val='"long long"'
5520         set quadtype
5521         eval $setvar
5522         val='"unsigned long long"'
5523         set uquadtype
5524         eval $setvar
5525         quadkind=3
5526         ;;
5527       *) case "$d_int64_t" in
5528          define)
5529            val=int64_t
5530            set quadtype
5531            eval $setvar
5532            val=uint64_t
5533            set uquadtype
5534            eval $setvar
5535            quadkind=4
5536            ;;
5537          esac
5538          ;;
5539       esac
5540       ;;
5541    esac
5542    ;;
5543 esac
5544
5545 case "$quadtype" in
5546 '')     echo "Alas, no 64-bit integer types in sight." >&4
5547         d_quad="$undef"
5548         ;;
5549 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5550         d_quad="$define"
5551         ;;
5552 esac
5553
5554
5555 case "$uselonglong" in
5556 "$define"|true|[yY]*)
5557         cat <<EOM >&4
5558
5559 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5560 EOM
5561         use64bitint="$define"
5562         ;;
5563 esac                          
5564 case "$use64bits" in
5565 "$define"|true|[yY]*)
5566         cat <<EOM >&4
5567
5568 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5569 EOM
5570         use64bitint="$define"
5571         ;;
5572 esac                          
5573 case "$use64bitints" in
5574 "$define"|true|[yY]*)
5575         cat <<EOM >&4
5576
5577 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5578 EOM
5579         use64bitint="$define"
5580         ;;
5581 esac                          
5582 case "$use64bitsint" in
5583 "$define"|true|[yY]*)
5584         cat <<EOM >&4
5585
5586 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5587 EOM
5588         use64bitint="$define"
5589         ;;
5590 esac                          
5591 case "$uselonglongs" in
5592 "$define"|true|[yY]*)
5593         cat <<EOM >&4
5594
5595 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5596 EOM
5597         use64bitint="$define"
5598         ;;
5599 esac                          
5600 case "$use64bitsall" in
5601 "$define"|true|[yY]*)
5602         cat <<EOM >&4
5603
5604 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5605 EOM
5606         use64bitall="$define"
5607         ;;
5608 esac                          
5609
5610 case "$ccflags" in
5611 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5612 esac
5613 case "$use64bitall" in
5614 "$define"|true|[yY]*) use64bitint="$define" ;;
5615 esac
5616
5617 case "$longsize" in
5618 8) cat <<EOM
5619
5620 You have natively 64-bit long integers.
5621 EOM
5622    val="$define"
5623    ;;
5624 *) case "$use64bitint" in
5625    "$define"|true|[yY]*) dflt='y';;
5626    *) dflt='n';;
5627    esac
5628    case "$d_quad" in
5629    "$define") ;;
5630    *) dflt='n' ;;
5631    esac
5632    cat <<EOM
5633
5634 Perl can be built to take advantage of 64-bit integer types
5635 on some systems.  To do so, Configure can be run with -Duse64bitint.
5636 Choosing this option will most probably introduce binary incompatibilities.
5637
5638 If this doesn't make any sense to you, just accept the default '$dflt'.
5639 (The default has been chosen based on your configuration.)
5640 EOM
5641    rp='Try to use 64-bit integers, if available?'
5642    . ./myread
5643    case "$ans" in
5644    [yY]*) val="$define" ;;
5645    *)     val="$undef"  ;;
5646    esac
5647    ;;
5648 esac
5649 set use64bitint
5650 eval $setvar
5651
5652 case "$use64bitall" in
5653 "$define"|true|[yY]*) dflt='y' ;;
5654 *) case "$longsize" in
5655    8) dflt='y' ;;
5656    *) dflt='n' ;;
5657    esac
5658    ;;
5659 esac    
5660 cat <<EOM
5661
5662 You may also choose to try maximal 64-bitness.  It means using as much
5663 64-bitness as possible on the platform.  This in turn means even more
5664 binary incompatibilities.  On the other hand, your platform may not
5665 have any more 64-bitness available than what you already have chosen.
5666
5667 If this doesn't make any sense to you, just accept the default '$dflt'.
5668 (The default has been chosen based on your configuration.)
5669 EOM
5670 rp='Try to use maximal 64-bit support, if available?'
5671 . ./myread
5672 case "$ans" in
5673 [yY]*) val="$define" ;;
5674 *)     val="$undef"  ;;
5675 esac
5676 set use64bitall
5677 eval $setvar
5678 case "$use64bitall" in
5679 "$define")
5680         case "$use64bitint" in
5681         "$undef")
5682                 cat <<EOM
5683
5684 Since you have chosen a maximally 64-bit build, I'm also turning on
5685 the use of 64-bit integers.
5686 EOM
5687                 use64bitint="$define" ;;
5688         esac
5689         ;;
5690 esac
5691
5692 : Look for a hint-file generated 'call-back-unit'.  If the
5693 : user has specified that a 64-bit perl is to be built,
5694 : we may need to set or change some other defaults.
5695 if $test -f use64bitint.cbu; then
5696         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5697         . ./use64bitint.cbu
5698 fi
5699 case "$use64bitint" in
5700 "$define"|true|[yY]*)
5701         case "$longsize" in
5702         4) case "$archname64" in
5703            '') archname64=64int ;;
5704            esac
5705            ;;
5706         esac
5707         ;;
5708 esac
5709
5710 : Look for a hint-file generated 'call-back-unit'.  If the
5711 : user has specified that a maximally 64-bit perl is to be built,
5712 : we may need to set or change some other defaults.
5713 if $test -f use64bitall.cbu; then
5714         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5715         . ./use64bitall.cbu
5716 fi
5717 case "$use64bitall" in
5718 "$define"|true|[yY]*)
5719         case "$longsize" in
5720         4) case "$archname64" in
5721            ''|64int) archname64=64all ;;
5722            esac
5723            ;;
5724         esac
5725         ;;
5726 esac
5727
5728 case "$d_quad:$use64bitint" in
5729 $undef:$define)
5730         cat >&4 <<EOF
5731
5732 *** You have chosen to use 64-bit integers,
5733 *** but none can be found.
5734 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5735 *** Cannot continue, aborting.
5736
5737 EOF
5738         exit 1
5739         ;;
5740 esac
5741
5742 : check for length of double
5743 echo " "
5744 case "$doublesize" in
5745 '')
5746         echo "Checking to see how big your double precision numbers are..." >&4
5747         $cat >try.c <<EOCP
5748 #include <stdio.h>
5749 #$i_stdlib I_STDLIB
5750 #ifdef I_STDLIB
5751 #include <stdlib.h>
5752 #endif
5753 int main()
5754 {
5755     printf("%d\n", (int)sizeof(double));
5756     exit(0);
5757 }
5758 EOCP
5759         set try
5760         if eval $compile_ok; then
5761                 doublesize=`$run ./try`
5762                 echo "Your double is $doublesize bytes long."
5763         else
5764                 dflt='8'
5765                 echo "(I can't seem to compile the test program.  Guessing...)"
5766                 rp="What is the size of a double precision number (in bytes)?"
5767                 . ./myread
5768                 doublesize="$ans"
5769         fi
5770         ;;
5771 esac
5772 $rm -f try.c try
5773
5774 : check for long doubles
5775 echo " "
5776 echo "Checking to see if you have long double..." >&4
5777 echo 'int main() { long double x = 7.0; }' > try.c
5778 set try
5779 if eval $compile; then
5780         val="$define"
5781         echo "You have long double."
5782 else
5783         val="$undef"
5784         echo "You do not have long double."
5785 fi
5786 $rm try.*
5787 set d_longdbl
5788 eval $setvar
5789
5790 : check for length of long double
5791 case "${d_longdbl}${longdblsize}" in
5792 $define)
5793         echo " "
5794         echo "Checking to see how big your long doubles are..." >&4
5795         $cat >try.c <<'EOCP'
5796 #include <stdio.h>
5797 int main()
5798 {
5799         printf("%d\n", sizeof(long double));
5800 }
5801 EOCP
5802         set try
5803         set try
5804         if eval $compile; then
5805                 longdblsize=`$run ./try`
5806                 echo "Your long doubles are $longdblsize bytes long."
5807         else
5808                 dflt='8'
5809                 echo " "
5810                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5811                 rp="What is the size of a long double (in bytes)?"
5812                 . ./myread
5813                 longdblsize="$ans"
5814         fi
5815         if $test "X$doublesize" = "X$longdblsize"; then
5816                 echo "That isn't any different from an ordinary double."
5817                 echo "I'll keep your setting anyway, but you may see some"
5818                 echo "harmless compilation warnings."
5819         fi      
5820         ;;
5821 esac
5822 $rm -f try.* try
5823
5824 : determine the architecture name
5825 echo " "
5826 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5827         tarch=`arch`"-$osname"
5828 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5829         if uname -m > tmparch 2>&1 ; then
5830                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5831                         -e 's/$/'"-$osname/" tmparch`
5832         else
5833                 tarch="$osname"
5834         fi
5835         $rm -f tmparch
5836 else
5837         tarch="$osname"
5838 fi
5839 case "$myarchname" in
5840 ''|"$tarch") ;;
5841 *)
5842         echo "(Your architecture name used to be $myarchname.)"
5843         archname=''
5844         ;;
5845 esac
5846 case "$targetarch" in
5847 '') ;;
5848 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5849 esac
5850 myarchname="$tarch"
5851 case "$archname" in
5852 '') dflt="$tarch";;
5853 *) dflt="$archname";;
5854 esac
5855 rp='What is your architecture name'
5856 . ./myread
5857 archname="$ans"
5858 case "$usethreads" in
5859 $define)
5860         echo "Threads selected." >&4
5861         case "$archname" in
5862         *-thread*) echo "...and architecture name already has -thread." >&4
5863                 ;;
5864         *)      archname="$archname-thread"
5865                 echo "...setting architecture name to $archname." >&4
5866                 ;;
5867         esac
5868         ;;
5869 esac
5870 case "$usemultiplicity" in
5871 $define)
5872         echo "Multiplicity selected." >&4
5873         case "$archname" in
5874         *-multi*) echo "...and architecture name already has -multi." >&4
5875                 ;;
5876         *)      archname="$archname-multi"
5877                 echo "...setting architecture name to $archname." >&4
5878                 ;;
5879         esac
5880         ;;
5881 esac
5882 case "$use64bitint$use64bitall" in
5883 *"$define"*)
5884         case "$archname64" in
5885         '')
5886                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5887                 ;;
5888         *)
5889                 case "$use64bitint" in
5890                 "$define") echo "64 bit integers selected." >&4 ;;
5891                 esac
5892                 case "$use64bitall" in
5893                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5894                 esac
5895                 case "$archname" in
5896                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5897                         ;;
5898                 *)      archname="$archname-$archname64"
5899                         echo "...setting architecture name to $archname." >&4
5900                         ;;
5901                 esac
5902                 ;;
5903         esac
5904 esac
5905 case "$uselongdouble" in
5906 $define)
5907         echo "Long doubles selected." >&4
5908         case "$longdblsize" in
5909         $doublesize)
5910                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5911                 ;;
5912         *)
5913                 case "$archname" in
5914                 *-ld*) echo "...and architecture name already has -ld." >&4
5915                         ;;
5916                 *)      archname="$archname-ld"
5917                         echo "...setting architecture name to $archname." >&4
5918                         ;;
5919                 esac
5920                 ;;
5921         esac
5922         ;;
5923 esac
5924 case "$useperlio" in
5925 $define)
5926         echo "Perlio selected." >&4
5927         ;;
5928 *)
5929         echo "Perlio not selected, using stdio." >&4
5930         case "$archname" in
5931         *-stdio*) echo "...and architecture name already has -stdio." >&4
5932                 ;;
5933         *)      archname="$archname-stdio"
5934                 echo "...setting architecture name to $archname." >&4
5935                 ;;
5936         esac
5937         ;;
5938 esac
5939 if $test -f archname.cbu; then
5940         echo "Your platform has some specific hints for architecture name, using them..."
5941         . ./archname.cbu
5942 fi
5943
5944 : set the prefixit variable, to compute a suitable default value
5945 prefixit='case "$3" in
5946 ""|none)
5947         case "$oldprefix" in
5948         "") eval "$1=\"\$$2\"";;
5949         *)
5950                 case "$3" in
5951                 "") eval "$1=";;
5952                 none)
5953                         eval "tp=\"\$$2\"";
5954                         case "$tp" in
5955                         ""|" ") eval "$1=\"\$$2\"";;
5956                         *) eval "$1=";;
5957                         esac;;
5958                 esac;;
5959         esac;;
5960 *)
5961         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5962         case "$tp" in
5963         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5964         /*-$oldprefix/*|\~*-$oldprefix/*)
5965                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5966         *) eval "$1=\"\$$2\"";;
5967         esac;;
5968 esac'
5969
5970 : get the patchlevel
5971 echo " "
5972 echo "Getting the current patchlevel..." >&4
5973 if $test -r $rsrc/patchlevel.h;then
5974         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5975         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5976         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5977         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5978         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5979         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5980         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5981 else
5982         revision=0
5983         patchlevel=0
5984         subversion=0
5985         api_revision=0
5986         api_version=0
5987         api_subversion=0
5988         perl_patchlevel=0
5989         $echo "(You do not have patchlevel.h.  Eek.)"
5990 fi
5991 if $test -r $rsrc/.patch ; then
5992         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5993                 perl_patchlevel=`cat $rsrc/.patch`
5994         fi
5995 fi
5996 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5997 version_patchlevel_string="version $patchlevel subversion $subversion"
5998 case "$perl_patchlevel" in
5999 0|'') ;;
6000 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6001 esac
6002
6003 $echo "(You have $package $version_patchlevel_string.)"
6004
6005 case "$osname" in
6006 dos|vms)
6007         : XXX Should be a Configure test for double-dots in filenames.
6008         version=`echo $revision $patchlevel $subversion | \
6009                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6010         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6011                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6012         ;;
6013 *)
6014         version=`echo $revision $patchlevel $subversion | \
6015                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6016         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6017                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6018         ;;
6019 esac
6020 : Special case the 5.005_xx maintenance series, which used 5.005
6021 : without any subversion label as a subdirectory in $sitelib
6022 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6023         api_versionstring='5.005'
6024 fi
6025
6026 : determine installation style
6027 : For now, try to deduce it from prefix unless it is already set.
6028 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6029 case "$installstyle" in
6030 '')     case "$prefix" in
6031                 *perl*) dflt='lib';;
6032                 *) dflt='lib/perl5' ;;
6033         esac
6034         ;;
6035 *)      dflt="$installstyle" ;;
6036 esac
6037 : Probably not worth prompting for this since we prompt for all
6038 : the directories individually, and the prompt would be too long and
6039 : confusing anyway.
6040 installstyle=$dflt
6041
6042 : determine where public executables go
6043 echo " "
6044 set dflt bin bin
6045 eval $prefixit
6046 fn=d~
6047 rp='Pathname where the public executables will reside?'
6048 . ./getfile
6049 if $test "X$ansexp" != "X$binexp"; then
6050         installbin=''
6051 fi
6052 prefixvar=bin
6053 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6054 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6055 :     this via initialinstalllocation
6056 . ./setprefixvar
6057
6058 case "$userelocatableinc" in
6059 $define|true|[yY]*)     dflt='y' ;;
6060 *)                      dflt='n' ;;
6061 esac
6062 cat <<EOM
6063
6064 Would you like to build Perl so that the installation is relocatable, so that
6065 library paths in @INC are determined relative to the path of the perl binary?
6066 This is not advised for system Perl installs, or if you need to run setid
6067 scripts or scripts under taint mode.
6068
6069 If this doesn't make any sense to you, just accept the default '$dflt'.
6070 EOM
6071 rp='Use relocatable @INC?'
6072 . ./myread
6073 case "$ans" in
6074 y|Y)    val="$define" ;;
6075 *)      val="$undef"  ;;
6076 esac
6077 set userelocatableinc
6078 eval $setvar
6079
6080 initialinstalllocation="$binexp"
6081 : Default prefix is now "up one level from where the binaries are"
6082 case "$userelocatableinc" in
6083 $define|true|[yY]*)
6084     bin=".../"
6085     binexp=".../"
6086     prefix=".../.."
6087     prefixexp=".../.."
6088     installprefixexp=".../.."
6089     ;;
6090 esac
6091
6092 : determine where private library files go
6093 : Usual default is /usr/local/lib/perl5/$version.
6094 : Also allow things like /opt/perl/lib/$version, since
6095 : /opt/perl/lib/perl5... would be redundant.
6096 : The default "style" setting is made in installstyle.U
6097 case "$installstyle" in
6098 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6099 *)       set dflt privlib lib/$version ;;
6100 esac
6101 eval $prefixit
6102 $cat <<EOM
6103
6104 There are some auxiliary files for $package that need to be put into a
6105 private library directory that is accessible by everyone.
6106
6107 EOM
6108 fn=$binexp
6109 fn=d~+
6110 rp='Pathname where the private library files will reside?'
6111 . ./getfile
6112 prefixvar=privlib
6113 . ./setprefixvar
6114
6115 : set the prefixup variable, to restore leading tilda escape
6116 prefixup='case "$prefixexp" in
6117 "$prefix") ;;
6118 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6119 esac'
6120
6121 : determine where public architecture dependent libraries go
6122 set archlib archlib
6123 eval $prefixit
6124 : privlib default is /usr/local/lib/$package/$version
6125 : archlib default is /usr/local/lib/$package/$version/$archname
6126 : privlib may have an optional trailing /share.
6127 tdflt=`echo $privlib | $sed 's,/share$,,'`
6128 tdflt=$tdflt/$archname
6129 case "$archlib" in
6130 '')     dflt=$tdflt
6131         ;;
6132 *)      dflt="$archlib"
6133     ;;
6134 esac
6135 $cat <<EOM
6136
6137 $spackage contains architecture-dependent library files.  If you are
6138 sharing libraries in a heterogeneous environment, you might store
6139 these files in a separate location.  Otherwise, you can just include
6140 them with the rest of the public library files.
6141
6142 EOM
6143 fn=$binexp
6144 fn=d+~
6145 rp='Where do you want to put the public architecture-dependent libraries?'
6146 . ./getfile
6147 prefixvar=archlib
6148 . ./setprefixvar
6149 if $test X"$archlib" = X"$privlib"; then
6150         d_archlib="$undef"
6151 else
6152         d_archlib="$define"
6153 fi
6154
6155 : see if setuid scripts can be secure
6156 $cat <<EOM
6157
6158 Some kernels have a bug that prevents setuid #! scripts from being
6159 secure.  Some sites have disabled setuid #! scripts because of this.
6160
6161 First let's decide if your kernel supports secure setuid #! scripts.
6162 (If setuid #! scripts would be secure but have been disabled anyway,
6163 don't say that they are secure if asked.)
6164
6165 EOM
6166
6167 val="$undef"
6168 if $test -d /dev/fd; then
6169         echo "#!$ls" >reflect
6170         chmod +x,u+s reflect
6171         ./reflect >flect 2>&1
6172         if $contains "/dev/fd" flect >/dev/null; then
6173                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6174                 val="$define"
6175         else
6176                 $cat <<EOM
6177 If you are not sure if they are secure, I can check but I'll need a
6178 username and password different from the one you are using right now.
6179 If you don't have such a username or don't want me to test, simply
6180 enter 'none'.
6181
6182 EOM
6183                 rp='Other username to test security of setuid scripts with?'
6184                 dflt='none'
6185                 . ./myread
6186                 case "$ans" in
6187                 n|none)
6188                         case "$d_suidsafe" in
6189                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6190                                 dflt=n;;
6191                         "$undef")
6192                                 echo "Well, the $hint value is *not* secure." >&4
6193                                 dflt=n;;
6194                         *)      echo "Well, the $hint value *is* secure." >&4
6195                                 dflt=y;;
6196                         esac
6197                         ;;
6198                 *)
6199                         $rm -f reflect flect
6200                         echo "#!$ls" >reflect
6201                         chmod +x,u+s reflect
6202                         echo >flect
6203                         chmod a+w flect
6204                         echo '"su" will (probably) prompt you for '"$ans's password."
6205                         su $ans -c './reflect >flect'
6206                         if $contains "/dev/fd" flect >/dev/null; then
6207                                 echo "Okay, it looks like setuid scripts are secure." >&4
6208                                 dflt=y
6209                         else
6210                                 echo "I don't think setuid scripts are secure." >&4
6211                                 dflt=n
6212                         fi
6213                         ;;
6214                 esac
6215                 rp='Does your kernel have *secure* setuid scripts?'
6216                 . ./myread
6217                 case "$ans" in
6218                 [yY]*)  val="$define";;
6219                 *)      val="$undef";;
6220                 esac
6221         fi
6222 else
6223         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6224         echo "(That's for file descriptors, not floppy disks.)"
6225         val="$undef"
6226 fi
6227 set d_suidsafe
6228 eval $setvar
6229
6230 $rm -f reflect flect
6231
6232 : now see if they want to do setuid emulation
6233 echo " "
6234 val="$undef"
6235 case "$d_suidsafe" in
6236 "$define")
6237         val="$undef"
6238         echo "No need to emulate SUID scripts since they are secure here." >&4
6239         ;;
6240 *)
6241         $cat <<EOM
6242 Some systems have disabled setuid scripts, especially systems where
6243 setuid scripts cannot be secure.  On systems where setuid scripts have
6244 been disabled, the setuid/setgid bits on scripts are currently
6245 useless.  It is possible for $package to detect those bits and emulate
6246 setuid/setgid in a secure fashion.  This emulation will only work if
6247 setuid scripts have been disabled in your kernel.
6248
6249 EOM
6250         case "$d_dosuid" in
6251         "$define") dflt=y ;;
6252         *) dflt=n ;;
6253         esac
6254         rp="Do you want to do setuid/setgid emulation?"
6255         . ./myread
6256         case "$ans" in
6257         [yY]*)  val="$define";;
6258         *)      val="$undef";;
6259         esac
6260         ;;
6261 esac
6262 set d_dosuid
6263 eval $setvar
6264
6265 : Find perl5.005 or later.
6266 echo "Looking for a previously installed perl5.005 or later... "
6267 case "$perl5" in
6268 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6269                 : Check if this perl is recent and can load a simple module
6270                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6271                         perl5=$tdir/perl
6272                         break;
6273                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6274                         perl5=$tdir/perl5
6275                         break;
6276                 fi
6277         done
6278         ;;
6279 *)      perl5="$perl5"
6280         ;;
6281 esac
6282 case "$perl5" in
6283 '')     echo "None found.  That's ok.";;
6284 *)      echo "Using $perl5." ;;
6285 esac
6286
6287 $cat <<EOM
6288
6289 After $package is installed, you may wish to install various
6290 add-on modules and utilities.  Typically, these add-ons will
6291 be installed under $prefix with the rest
6292 of this package.  However, you may wish to install such add-ons
6293 elsewhere under a different prefix.
6294
6295 If you do not wish to put everything under a single prefix, that's
6296 ok.  You will be prompted for the individual locations; this siteprefix
6297 is only used to suggest the defaults.
6298
6299 The default should be fine for most people.
6300
6301 EOM
6302 fn=d~+
6303 rp='Installation prefix to use for add-on modules and utilities?'
6304 : XXX Here might be another good place for an installstyle setting.
6305 case "$siteprefix" in
6306 '') dflt=$prefix ;;
6307 *)  dflt=$siteprefix ;;
6308 esac
6309 . ./getfile
6310 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6311 oldsiteprefix=''
6312 case "$siteprefix" in
6313 '') ;;
6314 *)      case "$ans" in
6315         "$prefix") ;;
6316         *) oldsiteprefix="$prefix";;
6317         esac
6318         ;;
6319 esac
6320 siteprefix="$ans"
6321 siteprefixexp="$ansexp"
6322
6323 : determine where site specific libraries go.
6324 : Usual default is /usr/local/lib/perl5/site_perl/$version
6325 : The default "style" setting is made in installstyle.U
6326 : XXX No longer works with Prefixit stuff.
6327 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6328 case "$sitelib" in
6329 '') case "$installstyle" in
6330         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6331         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6332         esac
6333         ;;
6334 *)      dflt="$sitelib"
6335         ;;
6336 esac
6337 $cat <<EOM
6338
6339 The installation process will create a directory for
6340 site-specific extensions and modules.  Most users find it convenient
6341 to place all site-specific files in this directory rather than in the
6342 main distribution directory.
6343
6344 EOM
6345 fn=d~+
6346 rp='Pathname for the site-specific library files?'
6347 . ./getfile
6348 prefixvar=sitelib
6349 . ./setprefixvar
6350 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6351
6352 : Determine list of previous versions to include in @INC
6353 $cat > getverlist <<EOPL
6354 #!$perl5 -w
6355 use File::Basename;
6356 \$api_versionstring = "$api_versionstring";
6357 \$version = "$version";
6358 \$stem = "$sitelib_stem";
6359 \$archname = "$archname";
6360 EOPL
6361         $cat >> getverlist <<'EOPL'
6362 # Can't have leading @ because metaconfig interprets it as a command!
6363 ;@inc_version_list=();
6364 # XXX Redo to do opendir/readdir?
6365 if (-d $stem) {
6366     chdir($stem);
6367     ;@candidates = glob("5.*");
6368 }
6369 else {
6370     ;@candidates = ();
6371 }
6372
6373 # XXX ToDo:  These comparisons must be reworked when two-digit
6374 # subversions come along, so that 5.7.10 compares as greater than
6375 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6376 # widespread that we can use the built-in version vectors rather
6377 # than reinventing them here.  For 5.6.0, however, we must
6378 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6379 foreach $d (@candidates) {
6380     if ($d lt $version) {
6381         if ($d ge $api_versionstring) {
6382             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6383         }
6384         elsif ($d ge "5.005") {
6385             unshift(@inc_version_list, grep { -d } $d);
6386         }
6387     }
6388     else {
6389         # Skip newer version.  I.e. don't look in
6390         # 5.7.0 if we're installing 5.6.1.
6391     }
6392 }
6393
6394 if (@inc_version_list) {
6395     print join(' ', @inc_version_list);
6396 }
6397 else {
6398     # Blank space to preserve value for next Configure run.
6399     print " ";
6400 }
6401 EOPL
6402 chmod +x getverlist
6403 case "$inc_version_list" in
6404 '')     if test -x "$perl5$exe_ext"; then
6405                 dflt=`$perl5 getverlist`
6406         else
6407                 dflt='none'
6408         fi
6409         ;;
6410 $undef) dflt='none' ;;
6411 *)  eval dflt=\"$inc_version_list\" ;;
6412 esac
6413 case "$dflt" in
6414 ''|' ') dflt=none ;;
6415 esac
6416 case "$dflt" in
6417 5.005) dflt=none ;;
6418 esac
6419 $cat <<EOM
6420
6421 In order to ease the process of upgrading, this version of perl
6422 can be configured to use modules built and installed with earlier
6423 versions of perl that were installed under $prefix.  Specify here
6424 the list of earlier versions that this version of perl should check.
6425 If Configure detected no earlier versions of perl installed under
6426 $prefix, then the list will be empty.  Answer 'none' to tell perl
6427 to not search earlier versions.
6428
6429 The default should almost always be sensible, so if you're not sure,
6430 just accept the default.
6431 EOM
6432
6433 rp='List of earlier versions to include in @INC?'
6434 . ./myread
6435 case "$ans" in
6436 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6437 *) inc_version_list="$ans" ;;
6438 esac
6439 case "$inc_version_list" in
6440 ''|' ')
6441         inc_version_list_init='0'
6442         d_inc_version_list="$undef"
6443         ;;
6444 *)      inc_version_list_init=`echo $inc_version_list |
6445                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6446         d_inc_version_list="$define"
6447         ;;
6448 esac
6449 $rm -f getverlist
6450
6451 : see if this is a malloc.h system
6452 : we want a real compile instead of Inhdr because some systems have a
6453 : malloc.h that just gives a compile error saying to use stdlib.h instead
6454 echo " "
6455 $cat >try.c <<EOCP
6456 #include <stdlib.h>
6457 #include <malloc.h>
6458 int main () { return 0; }
6459 EOCP
6460 set try
6461 if eval $compile; then
6462     echo "<malloc.h> found." >&4
6463     val="$define"
6464 else
6465     echo "<malloc.h> NOT found." >&4
6466     val="$undef"
6467 fi
6468 $rm -f try.c try
6469 set i_malloc
6470 eval $setvar
6471
6472 : check for void type
6473 echo " "
6474 echo "Checking to see how well your C compiler groks the void type..." >&4
6475 case "$voidflags" in
6476 '')
6477         $cat >try.c <<EOCP
6478 #$i_stdlib I_STDLIB
6479 #ifdef I_STDLIB
6480 #include <stdlib.h>
6481 #endif
6482 #if TRY & 1
6483 void sub() {
6484 #else
6485 sub() {
6486 #endif
6487         extern void moo();      /* function returning void */
6488         void (*goo)();          /* ptr to func returning void */
6489 #if TRY & 8
6490         void *hue;              /* generic ptr */
6491 #endif
6492 #if TRY & 2
6493         void (*foo[10])();
6494 #endif
6495
6496 #if TRY & 4
6497         if(goo == moo) {
6498                 exit(0);
6499         }
6500 #endif
6501         exit(0);
6502 }
6503 int main() { sub(); }
6504 EOCP
6505         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6506                 voidflags=$defvoidused
6507         echo "Good.  It appears to support void to the level $package wants.">&4
6508                 if $contains warning .out >/dev/null 2>&1; then
6509                         echo "However, you might get some warnings that look like this:"
6510                         $cat .out
6511                 fi
6512         else
6513 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6514                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6515                         echo "It supports 1..."
6516                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6517                                 echo "It also supports 2..."
6518                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6519                                         voidflags=7
6520                                         echo "And it supports 4 but not 8 definitely."
6521                                 else
6522                                         echo "It doesn't support 4..."
6523                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6524                                                 voidflags=11
6525                                                 echo "But it supports 8."
6526                                         else
6527                                                 voidflags=3
6528                                                 echo "Neither does it support 8."
6529                                         fi
6530                                 fi
6531                         else
6532                                 echo "It does not support 2..."
6533                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6534                                         voidflags=13
6535                                         echo "But it supports 4 and 8."
6536                                 else
6537                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6538                                                 voidflags=5
6539                                                 echo "And it supports 4 but has not heard about 8."
6540                                         else
6541                                                 echo "However it supports 8 but not 4."
6542                                         fi
6543                                 fi
6544                         fi
6545                 else
6546                         echo "There is no support at all for void."
6547                         voidflags=0
6548                 fi
6549         fi
6550 esac
6551 case "$voidflags" in
6552 "$defvoidused") ;;
6553 *)      $cat >&4 <<'EOM'
6554   Support flag bits are:
6555     1: basic void declarations.
6556     2: arrays of pointers to functions returning void.
6557     4: operations between pointers to and addresses of void functions.
6558     8: generic void pointers.
6559 EOM
6560         dflt="$voidflags";
6561         rp="Your void support flags add up to what?"
6562         . ./myread
6563         voidflags="$ans"
6564         ;;
6565 esac
6566 $rm -f try.* .out
6567
6568 : check for length of pointer
6569 echo " "
6570 case "$ptrsize" in
6571 '')
6572         echo "Checking to see how big your pointers are..." >&4
6573         if test "$voidflags" -gt 7; then
6574                 echo '#define VOID_PTR char *' > try.c
6575         else
6576                 echo '#define VOID_PTR void *' > try.c
6577         fi
6578         $cat >>try.c <<EOCP
6579 #include <stdio.h>
6580 #$i_stdlib I_STDLIB
6581 #ifdef I_STDLIB
6582 #include <stdlib.h>
6583 #endif
6584 int main()
6585 {
6586     printf("%d\n", (int)sizeof(VOID_PTR));
6587     exit(0);
6588 }
6589 EOCP
6590         set try
6591         if eval $compile_ok; then
6592                 ptrsize=`$run ./try`
6593                 echo "Your pointers are $ptrsize bytes long."
6594         else
6595                 dflt='4'
6596                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6597                 rp="What is the size of a pointer (in bytes)?"
6598                 . ./myread
6599                 ptrsize="$ans"
6600         fi
6601         ;;
6602 esac
6603 $rm -f try.c try
6604 case "$use64bitall" in
6605 "$define"|true|[yY]*)
6606         case "$ptrsize" in
6607         4)      cat <<EOM >&4
6608
6609 *** You have chosen a maximally 64-bit build,
6610 *** but your pointers are only 4 bytes wide.
6611 *** Please rerun Configure without -Duse64bitall.
6612 EOM
6613                 case "$d_quad" in
6614                 define)
6615                         cat <<EOM >&4
6616 *** Since you have quads, you could possibly try with -Duse64bitint.
6617 EOM
6618                         ;;
6619                 esac
6620                 cat <<EOM >&4
6621 *** Cannot continue, aborting.
6622
6623 EOM
6624
6625                 exit 1
6626                 ;;
6627         esac
6628         ;;
6629 esac
6630
6631
6632 : determine whether to use malloc wrapping
6633 echo " "
6634 case "$usemallocwrap" in
6635 [yY]*|true|$define)     dflt='y' ;;
6636 [nN]*|false|$undef)     dflt='n' ;;
6637 *)      case "$usedevel" in
6638         [yY]*|true|$define)     dflt='y' ;;
6639         *) dflt='n' ;;
6640         esac
6641         ;;
6642 esac
6643 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6644 . ./myread
6645 usemallocwrap="$ans"
6646 case "$ans" in
6647 y*|true)
6648         usemallocwrap="$define" ;;
6649 *)
6650         usemallocwrap="$undef" ;;
6651 esac
6652
6653 : determine which malloc to compile in
6654 echo " "
6655 case "$usemymalloc" in
6656 [yY]*|true|$define)     dflt='y' ;;
6657 [nN]*|false|$undef)     dflt='n' ;;
6658 *)      case "$ptrsize" in
6659         4) dflt='y' ;;
6660         *) dflt='n' ;;
6661         esac
6662         ;;
6663 esac
6664 rp="Do you wish to attempt to use the malloc that comes with $package?"
6665 . ./myread
6666 usemymalloc="$ans"
6667 case "$ans" in
6668 y*|true)
6669         usemymalloc='y'
6670         mallocsrc='malloc.c'
6671         mallocobj="malloc$_o"
6672         d_mymalloc="$define"
6673         case "$libs" in
6674         *-lmalloc*)
6675                 : Remove malloc from list of libraries to use
6676                 echo "Removing unneeded -lmalloc from library list" >&4
6677                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6678                 shift
6679                 libs="$*"
6680                 echo "libs = $libs" >&4
6681                 ;;
6682         esac
6683         ;;
6684 *)
6685         usemymalloc='n'
6686         mallocsrc=''
6687         mallocobj=''
6688         d_mymalloc="$undef"
6689         ;;
6690 esac
6691
6692 : compute the return types of malloc and free
6693 echo " "
6694 $cat >malloc.c <<END
6695 #$i_malloc I_MALLOC
6696 #$i_stdlib I_STDLIB
6697 #include <stdio.h>
6698 #include <sys/types.h>
6699 #ifdef I_MALLOC
6700 #include <malloc.h>
6701 #endif
6702 #ifdef I_STDLIB
6703 #include <stdlib.h>
6704 #endif
6705 #ifdef TRY_MALLOC
6706 void *malloc();
6707 #endif
6708 #ifdef TRY_FREE
6709 void free();
6710 #endif
6711 END
6712 case "$malloctype" in
6713 '')
6714         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6715                 malloctype='void *'
6716         else
6717                 malloctype='char *'
6718         fi
6719         ;;
6720 esac
6721 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6722
6723 case "$freetype" in
6724 '')
6725         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6726                 freetype='void'
6727         else
6728                 freetype='int'
6729         fi
6730         ;;
6731 esac
6732 echo "Your system uses $freetype free(), it would seem." >&4
6733 $rm -f malloc.[co]
6734 : determine where site specific architecture-dependent libraries go.
6735 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6736 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6737 : sitelib may have an optional trailing /share.
6738 case "$sitearch" in
6739 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6740         dflt="$dflt/$archname"
6741         ;;
6742 *)      dflt="$sitearch"
6743         ;;
6744 esac
6745 set sitearch sitearch none
6746 eval $prefixit
6747 $cat <<EOM
6748
6749 The installation process will also create a directory for
6750 architecture-dependent site-specific extensions and modules.
6751
6752 EOM
6753 fn=d~+
6754 rp='Pathname for the site-specific architecture-dependent library files?'
6755 . ./getfile
6756 prefixvar=sitearch
6757 . ./setprefixvar
6758 if $test X"$sitearch" = X"$sitelib"; then
6759         d_sitearch="$undef"
6760 else
6761         d_sitearch="$define"
6762 fi
6763
6764 $cat <<EOM
6765
6766 The installation process will also create a directory for
6767 vendor-supplied add-ons.  Vendors who supply perl with their system
6768 may find it convenient to place all vendor-supplied files in this
6769 directory rather than in the main distribution directory.  This will
6770 ease upgrades between binary-compatible maintenance versions of perl.
6771
6772 Of course you may also use these directories in whatever way you see
6773 fit.  For example, you might use them to access modules shared over a
6774 company-wide network.
6775
6776 The default answer should be fine for most people.
6777 This causes further questions about vendor add-ons to be skipped
6778 and no vendor-specific directories will be configured for perl.
6779
6780 EOM
6781 rp='Do you want to configure vendor-specific add-on directories?'
6782 case "$usevendorprefix" in
6783 define|true|[yY]*) dflt=y ;;
6784 *)      : User may have set vendorprefix directly on Configure command line.
6785         case "$vendorprefix" in
6786         ''|' ') dflt=n ;;
6787         *)      dflt=y ;;
6788         esac
6789         ;;
6790 esac
6791 . ./myread
6792 case "$ans" in
6793 [yY]*)  fn=d~+
6794         rp='Installation prefix to use for vendor-supplied add-ons?'
6795         case "$vendorprefix" in
6796         '') dflt='' ;;
6797         *)  dflt=$vendorprefix ;;
6798         esac
6799         . ./getfile
6800         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6801         oldvendorprefix=''
6802         case "$vendorprefix" in
6803         '') ;;
6804         *)      case "$ans" in
6805                 "$prefix") ;;
6806                 *) oldvendorprefix="$prefix";;
6807                 esac
6808                 ;;
6809         esac
6810         usevendorprefix="$define"
6811         vendorprefix="$ans"
6812         vendorprefixexp="$ansexp"
6813         ;;
6814 *)      usevendorprefix="$undef"
6815         vendorprefix=''
6816         vendorprefixexp=''
6817         ;;
6818 esac
6819
6820 case "$vendorprefix" in
6821 '')     d_vendorlib="$undef"
6822         vendorlib=''
6823         vendorlibexp=''
6824         ;;
6825 *)      d_vendorlib="$define"
6826         : determine where vendor-supplied modules go.
6827         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6828         case "$vendorlib" in
6829         '')
6830                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6831                 case "$installstyle" in
6832                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6833                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6834                 esac
6835                 ;;
6836         *)      dflt="$vendorlib"
6837                 ;;
6838         esac
6839         fn=d~+
6840         rp='Pathname for the vendor-supplied library files?'
6841         . ./getfile
6842         vendorlib="$ans"
6843         vendorlibexp="$ansexp"
6844         ;;
6845 esac
6846 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6847 prefixvar=vendorlib
6848 . ./installprefix
6849
6850 case "$vendorprefix" in
6851 '')     d_vendorarch="$undef"
6852         vendorarch=''
6853         vendorarchexp=''
6854         ;;
6855 *)      d_vendorarch="$define"
6856         : determine where vendor-supplied architecture-dependent libraries go.
6857         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6858         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6859         : vendorlib may have an optional trailing /share.
6860         case "$vendorarch" in
6861         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6862                 dflt="$dflt/$archname"
6863                 ;;
6864         *)      dflt="$vendorarch" ;;
6865         esac
6866         fn=d~+
6867         rp='Pathname for vendor-supplied architecture-dependent files?'
6868         . ./getfile
6869         vendorarch="$ans"
6870         vendorarchexp="$ansexp"
6871         ;;
6872 esac
6873 prefixvar=vendorarch
6874 . ./installprefix
6875
6876 : Final catch-all directories to search
6877 $cat <<EOM
6878
6879 Lastly, you can have perl look in other directories for extensions and
6880 modules in addition to those already specified.
6881 These directories will be searched after 
6882         $sitearch 
6883         $sitelib 
6884 EOM
6885 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6886 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6887 echo ' '
6888 case "$otherlibdirs" in
6889 ''|' ') dflt='none' ;;
6890 *)      dflt="$otherlibdirs" ;;
6891 esac
6892 $cat <<EOM
6893 Enter a colon-separated set of extra paths to include in perl's @INC
6894 search path, or enter 'none' for no extra paths.
6895
6896 EOM
6897
6898 rp='Colon-separated list of additional directories for perl to search?'
6899 . ./myread
6900 case "$ans" in
6901 ' '|''|none)    otherlibdirs=' ' ;;     
6902 *)      otherlibdirs="$ans" ;;
6903 esac
6904 case "$otherlibdirs" in
6905 ' ') val=$undef ;;
6906 *)      val=$define ;;
6907 esac
6908 set d_perl_otherlibdirs
6909 eval $setvar
6910
6911 : Cruising for prototypes
6912 echo " "
6913 echo "Checking out function prototypes..." >&4
6914 $cat >prototype.c <<EOCP
6915 #$i_stdlib I_STDLIB
6916 #ifdef I_STDLIB
6917 #include <stdlib.h>
6918 #endif
6919 int main(int argc, char *argv[]) {
6920         exit(0);}
6921 EOCP
6922 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6923         echo "Your C compiler appears to support function prototypes."
6924         val="$define"
6925 else
6926         echo "Your C compiler doesn't seem to understand function prototypes."
6927         val="$undef"
6928 fi
6929 set prototype
6930 eval $setvar
6931 $rm -f prototype*
6932
6933 case "$prototype" in
6934 "$define") ;;
6935 *)      ansi2knr='ansi2knr'
6936         echo " "
6937         cat <<EOM >&4
6938
6939 $me:  FATAL ERROR:
6940 This version of $package can only be compiled by a compiler that 
6941 understands function prototypes.  Unfortunately, your C compiler 
6942         $cc $ccflags
6943 doesn't seem to understand them.  Sorry about that.
6944
6945 If GNU cc is available for your system, perhaps you could try that instead.  
6946
6947 Eventually, we hope to support building Perl with pre-ANSI compilers.
6948 If you would like to help in that effort, please contact <perlbug@perl.org>.
6949
6950 Aborting Configure now.
6951 EOM
6952         exit 2
6953         ;;
6954 esac
6955
6956 echo " "
6957 case "$extras" in
6958 '') dflt='n';;
6959 *) dflt='y';;
6960 esac
6961 cat <<EOM
6962 Perl can be built with extra modules or bundles of modules which
6963 will be fetched from the CPAN and installed alongside Perl.
6964
6965 Notice that you will need access to the CPAN; either via the Internet,
6966 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6967 be asked later to configure the CPAN.pm module which will in turn do
6968 the installation of the rest of the extra modules or bundles.)
6969
6970 Notice also that if the modules require any external software such as
6971 libraries and headers (the libz library and the zlib.h header for the
6972 Compress::Zlib module, for example) you MUST have any such software
6973 already installed, this configuration process will NOT install such
6974 things for you.
6975
6976 If this doesn't make any sense to you, just accept the default '$dflt'.
6977 EOM
6978 rp='Install any extra modules (y or n)?'
6979 . ./myread
6980 case "$ans" in
6981 y|Y)
6982         cat <<EOM
6983
6984 Please list any extra modules or bundles to be installed from CPAN,
6985 with spaces between the names.  The names can be in any format the
6986 'install' command of CPAN.pm will understand.  (Answer 'none',
6987 without the quotes, to install no extra modules or bundles.)
6988 EOM
6989         rp='Extras?'
6990         dflt="$extras"
6991         . ./myread
6992         extras="$ans"
6993 esac
6994 case "$extras" in
6995 ''|'none')
6996         val=''
6997         $rm -f ../extras.lst
6998         ;;
6999 *)      echo "(Saving the list of extras for later...)"
7000         echo "$extras" > ../extras.lst
7001         val="'$extras'"
7002         ;;
7003 esac
7004 set extras
7005 eval $setvar
7006 echo " "
7007
7008 : determine where html pages for programs go
7009 set html1dir html1dir none
7010 eval $prefixit
7011 $cat <<EOM
7012
7013 If you wish to install html files for programs in $spackage, indicate
7014 the appropriate directory here.  To skip installing html files,
7015 answer "none".
7016 EOM
7017 case "$html1dir" in
7018 ''|none|$undef|' ') dflt=none ;;
7019 *) dflt=$html1dir ;;
7020 esac
7021 fn=dn+~
7022 rp="Directory for the main $spackage html pages?"
7023 . ./getfile
7024 prefixvar=html1dir
7025 . ./setprefixvar
7026 : Use ' ' for none so value is preserved next time through Configure
7027 $test X"$html1dir" = "X" && html1dir=' '
7028
7029 : determine where html pages for libraries and modules go
7030 set html3dir html3dir none
7031 eval $prefixit
7032 $cat <<EOM
7033
7034 If you wish to install html files for modules associated with $spackage,
7035 indicate the appropriate directory here.  To skip installing html files,
7036 answer "none".
7037 EOM
7038 : There is no obvious default.  If they have specified html1dir, then
7039 : try to key off that, possibly changing .../html1 into .../html3.
7040 case "$html3dir" in
7041 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7042 *) dflt=$html3dir ;;
7043 esac
7044 fn=dn+~
7045 rp="Directory for the $spackage module html pages?"
7046 . ./getfile
7047 prefixvar=html3dir
7048 . ./setprefixvar
7049 : Use ' ' for none so value is preserved next time through Configure
7050 $test X"$html3dir" = "X" && html3dir=' '
7051
7052 : determine whether to install perl also as /usr/bin/perl
7053
7054 echo " "
7055 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7056         $cat <<EOM
7057 Many scripts expect perl to be installed as /usr/bin/perl.
7058
7059 If you want to, I can install the perl you are about to compile
7060 as /usr/bin/perl (in addition to $bin/perl).
7061 EOM
7062         if test -f /usr/bin/perl; then
7063             $cat <<EOM
7064
7065 However, please note that because you already have a /usr/bin/perl,
7066 overwriting that with a new Perl would very probably cause problems.
7067 Therefore I'm assuming you don't want to do that (unless you insist).
7068
7069 EOM
7070             case "$installusrbinperl" in
7071             "$define"|[yY]*)    dflt='y';;
7072             *)                  dflt='n';;
7073             esac
7074         else
7075             $cat <<EOM
7076
7077 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7078
7079 EOM
7080             case "$installusrbinperl" in
7081             "$undef"|[nN]*)     dflt='n';;
7082             *)                  dflt='y';;
7083             esac
7084         fi
7085         rp="Do you want to install perl as /usr/bin/perl?"
7086         . ./myread
7087         case "$ans" in
7088         [yY]*)  val="$define";;
7089         *)      val="$undef" ;;
7090         esac
7091 else
7092         val="$undef"
7093 fi
7094 set installusrbinperl
7095 eval $setvar
7096
7097 echo " "
7098 echo "Checking for GNU C Library..." >&4
7099 cat >try.c <<'EOCP'
7100 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7101    alone are insufficient to distinguish different versions, such as
7102    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7103    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7104 */
7105 #include <stdio.h>
7106 int main(void)
7107 {
7108 #ifdef __GLIBC__
7109 #   ifdef __GLIBC_MINOR__
7110 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7111 #           include <gnu/libc-version.h>
7112             printf("%s\n",  gnu_get_libc_version());
7113 #       else
7114             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7115 #       endif
7116 #   else
7117         printf("%d\n",  __GLIBC__);
7118 #   endif
7119     return 0;
7120 #else
7121     return 1;
7122 #endif
7123 }
7124 EOCP
7125 set try
7126 if eval $compile_ok && $run ./try > glibc.ver; then
7127         val="$define"
7128         gnulibc_version=`$cat glibc.ver`
7129         echo "You are using the GNU C Library version $gnulibc_version"
7130 else
7131         val="$undef"
7132         gnulibc_version=''
7133         echo "You are not using the GNU C Library"
7134 fi
7135 $rm -f try try.* glibc.ver
7136 set d_gnulibc
7137 eval $setvar
7138
7139 : see if nm is to be used to determine whether a symbol is defined or not
7140 case "$usenm" in
7141 '')
7142         dflt=''
7143         case "$d_gnulibc" in
7144         "$define")
7145                 echo " "
7146                 echo "nm probably won't work on the GNU C Library." >&4
7147                 dflt=n
7148                 ;;
7149         esac
7150         case "$dflt" in
7151         '') 
7152                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7153                         echo " "
7154                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7155                         echo "'nm' won't be sufficient on this sytem." >&4
7156                         dflt=n
7157                 fi
7158                 ;;
7159         esac
7160         case "$dflt" in
7161         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7162                 if $test $dflt -gt 20; then
7163                         dflt=y
7164                 else
7165                         dflt=n
7166                 fi
7167                 ;;
7168         esac
7169         ;;
7170 *)
7171         case "$usenm" in
7172         true|$define) dflt=y;;
7173         *) dflt=n;;
7174         esac
7175         ;;
7176 esac
7177 $cat <<EOM
7178
7179 I can use $nm to extract the symbols from your C libraries. This
7180 is a time consuming task which may generate huge output on the disk (up
7181 to 3 megabytes) but that should make the symbols extraction faster. The
7182 alternative is to skip the 'nm' extraction part and to compile a small
7183 test program instead to determine whether each symbol is present. If
7184 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7185 this may be the best solution.
7186
7187 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7188
7189 EOM
7190 rp="Shall I use $nm to extract C symbols from the libraries?"
7191 . ./myread
7192 case "$ans" in
7193 [Nn]*) usenm=false;;
7194 *) usenm=true;;
7195 esac
7196
7197 runnm=$usenm
7198 case "$reuseval" in
7199 true) runnm=false;;
7200 esac
7201
7202 : nm options which may be necessary
7203 case "$nm_opt" in
7204 '') if $test -f /mach_boot; then
7205                 nm_opt=''       # Mach
7206         elif $test -d /usr/ccs/lib; then
7207                 nm_opt='-p'     # Solaris (and SunOS?)
7208         elif $test -f /dgux; then
7209                 nm_opt='-p'     # DG-UX
7210         elif $test -f /lib64/rld; then
7211                 nm_opt='-p'     # 64-bit Irix
7212         else
7213                 nm_opt=''
7214         fi;;
7215 esac
7216
7217 : nm options which may be necessary for shared libraries but illegal
7218 : for archive libraries.  Thank you, Linux.
7219 case "$nm_so_opt" in
7220 '')     case "$myuname" in
7221         *linux*|gnu*)
7222                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7223                         nm_so_opt='--dynamic'
7224                 fi
7225                 ;;
7226         esac
7227         ;;
7228 esac
7229
7230 case "$runnm" in
7231 true)
7232 : get list of predefined functions in a handy place
7233 echo " "
7234 case "$libc" in
7235 '') libc=unknown
7236         case "$libs" in
7237         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7238         esac
7239         ;;
7240 esac
7241 case "$libs" in
7242 '') ;;
7243 *)  for thislib in $libs; do
7244         case "$thislib" in
7245         -lc|-lc_s)
7246                 : Handle C library specially below.
7247                 ;;
7248         -l*)
7249                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7250                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7251                         :
7252                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7253                         :
7254                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7255                         :
7256                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7257                         :
7258                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7259                         :
7260                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7261                         :
7262                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7263                         :
7264                 else
7265                         try=''
7266                 fi
7267                 libnames="$libnames $try"
7268                 ;;
7269         *) libnames="$libnames $thislib" ;;
7270         esac
7271         done
7272         ;;
7273 esac
7274 xxx=normal
7275 case "$libc" in
7276 unknown)
7277         set /lib/libc.$so
7278         for xxx in $libpth; do
7279                 $test -r $1 || set $xxx/libc.$so
7280                 : The messy sed command sorts on library version numbers.
7281                 $test -r $1 || \
7282                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7283                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7284                                 h
7285                                 s/[0-9][0-9]*/0000&/g
7286                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7287                                 G
7288                                 s/\n/ /' | \
7289                          $sort | $sed -e 's/^.* //'`
7290                 eval set \$$#
7291         done
7292         $test -r $1 || set /usr/ccs/lib/libc.$so
7293         $test -r $1 || set /lib/libsys_s$_a
7294         ;;
7295 *)
7296         set blurfl
7297         ;;
7298 esac
7299 if $test -r "$1"; then
7300         echo "Your (shared) C library seems to be in $1."
7301         libc="$1"
7302 elif $test -r /lib/libc && $test -r /lib/clib; then
7303         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7304         xxx=apollo
7305         libc='/lib/clib /lib/libc'
7306         if $test -r /lib/syslib; then
7307                 echo "(Your math library is in /lib/syslib.)"
7308                 libc="$libc /lib/syslib"
7309         fi
7310 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7311         echo "Your C library seems to be in $libc, as you said before."
7312 elif $test -r $incpath/usr/lib/libc$_a; then
7313         libc=$incpath/usr/lib/libc$_a;
7314         echo "Your C library seems to be in $libc.  That's fine."
7315 elif $test -r /lib/libc$_a; then
7316         libc=/lib/libc$_a;
7317         echo "Your C library seems to be in $libc.  You're normal."
7318 else
7319         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7320                 :
7321         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7322                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7323         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7324                 :
7325         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7326                 :
7327         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7328                 :
7329         else
7330                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7331         fi
7332         if $test -r "$tans"; then
7333                 echo "Your C library seems to be in $tans, of all places."
7334                 libc=$tans
7335         else
7336                 libc='blurfl'
7337         fi
7338 fi
7339 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7340         dflt="$libc"
7341         cat <<EOM
7342
7343 If the guess above is wrong (which it might be if you're using a strange
7344 compiler, or your machine supports multiple models), you can override it here.
7345
7346 EOM
7347 else
7348         dflt=''
7349         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7350         cat >&4 <<EOM
7351 I can't seem to find your C library.  I've looked in the following places:
7352
7353 EOM
7354         $sed 's/^/      /' libpath
7355         cat <<EOM
7356
7357 None of these seems to contain your C library. I need to get its name...
7358
7359 EOM
7360 fi
7361 fn=f
7362 rp='Where is your C library?'
7363 . ./getfile
7364 libc="$ans"
7365
7366 echo " "
7367 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7368 set X `cat libnames`
7369 shift
7370 xxx=files
7371 case $# in 1) xxx=file; esac
7372 echo "Extracting names from the following $xxx for later perusal:" >&4
7373 echo " "
7374 $sed 's/^/      /' libnames >&4
7375 echo " "
7376 $echo $n "This may take a while...$c" >&4
7377
7378 for file in $*; do
7379         case $file in
7380         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7381         *) $nm $nm_opt $file 2>/dev/null;;
7382         esac
7383 done >libc.tmp
7384
7385 $echo $n ".$c"
7386 $grep fprintf libc.tmp > libc.ptf
7387 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7388 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7389 xxx='[ADTSIW]'
7390 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7391         eval $xscan;\
7392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393                 eval $xrun
7394 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7395         eval $xscan;\
7396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397                 eval $xrun
7398 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7399         eval $xscan;\
7400         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401                 eval $xrun
7402 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7403         eval $xscan;\
7404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405                 eval $xrun
7406 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7407         eval $xscan;\
7408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7409                 eval $xrun
7410 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7411         eval $xscan;\
7412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7413                 eval $xrun
7414 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7415                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7416         eval $xscan;\
7417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418                 eval $xrun
7419 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7420         eval $xscan;\
7421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422                 eval $xrun
7423 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7424         eval $xscan;\
7425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426                 eval $xrun
7427 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7428         eval $xscan;\
7429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430                 eval $xrun
7431 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7432         eval $xscan;\
7433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434                 eval $xrun
7435 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7436         eval $xscan;\
7437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438                 eval $xrun
7439 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7440         eval $xscan;\
7441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7442                 eval $xrun
7443 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7444         eval $xscan;\
7445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7446                 eval $xrun
7447 else
7448         $nm -p $* 2>/dev/null >libc.tmp
7449         $grep fprintf libc.tmp > libc.ptf
7450         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7451                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7452         then
7453                 nm_opt='-p'
7454                 eval $xrun
7455         else
7456                 echo " "
7457                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7458                 com=''
7459                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7460                         for thisname in $libnames $libc; do
7461                                 $ar t $thisname >>libc.tmp
7462                         done
7463                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7464                         echo "Ok." >&4
7465                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7466                         # Repeat libc to extract forwarders to DLL entries too
7467                         for thisname in $libnames $libc; do
7468                                 $ar tv $thisname >>libc.tmp
7469                                 # Revision 50 of EMX has bug in $ar.
7470                                 # it will not extract forwarders to DLL entries
7471                                 # Use emximp which will extract exactly them.
7472                                 emximp -o tmp.imp $thisname \
7473                                     2>/dev/null && \
7474                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7475                                     < tmp.imp >>libc.tmp
7476                                 $rm tmp.imp
7477                         done
7478                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7479                         echo "Ok." >&4
7480                 else
7481                         echo "$ar didn't seem to work right." >&4
7482                         echo "Maybe this is a Cray...trying bld instead..." >&4
7483                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7484                         then
7485                                 for thisname in $libnames; do
7486                                         bld t $libnames | \
7487                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7488                                         $ar t $thisname >>libc.tmp
7489                                 done
7490                                 echo "Ok." >&4
7491                         else
7492                                 echo "That didn't work either.  Giving up." >&4
7493                                 exit 1
7494                         fi
7495                 fi
7496         fi
7497 fi
7498 nm_extract="$com"
7499 case "$PASE" in
7500 define)
7501     echo " "
7502     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7503     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7504     ;;
7505 *)  if $test -f /lib/syscalls.exp; then
7506         echo " "
7507         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7508         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7509     fi
7510     ;;
7511 esac
7512 ;;
7513 esac
7514 $rm -f libnames libpath
7515
7516 : see if dld is available
7517 set dld.h i_dld
7518 eval $inhdr
7519
7520 : is a C symbol defined?
7521 csym='tlook=$1;
7522 case "$3" in
7523 -v) tf=libc.tmp; tdc="";;
7524 -a) tf=libc.tmp; tdc="[]";;
7525 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7526 esac;
7527 tx=yes;
7528 case "$reuseval-$4" in
7529 true-) ;;
7530 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7531 esac;
7532 case "$tx" in
7533 yes)
7534         tval=false;
7535         if $test "$runnm" = true; then
7536                 if $contains $tlook $tf >/dev/null 2>&1; then
7537                         tval=true;
7538                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7539                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7540                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7541                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7542                         $rm -f try$_exe try.c core core.* try.core;
7543                 fi;
7544         else
7545                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7546                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7547                 $rm -f try$_exe try.c;
7548         fi;
7549         ;;
7550 *)
7551         case "$tval" in
7552         $define) tval=true;;
7553         *) tval=false;;
7554         esac;
7555         ;;
7556 esac;
7557 eval "$2=$tval"'
7558
7559 : define an is-in-libc? function
7560 inlibc='echo " "; td=$define; tu=$undef;
7561 sym=$1; var=$2; eval "was=\$$2";
7562 tx=yes;
7563 case "$reuseval$was" in
7564 true) ;;
7565 true*) tx=no;;
7566 esac;
7567 case "$tx" in
7568 yes)
7569         set $sym tres -f;
7570         eval $csym;
7571         case "$tres" in
7572         true)
7573                 echo "$sym() found." >&4;
7574                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7575         *)
7576                 echo "$sym() NOT found." >&4;
7577                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7578         esac;;
7579 *)
7580         case "$was" in
7581         $define) echo "$sym() found." >&4;;
7582         *) echo "$sym() NOT found." >&4;;
7583         esac;;
7584 esac'
7585
7586 : see if dlopen exists
7587 xxx_runnm="$runnm"
7588 runnm=false
7589 set dlopen d_dlopen
7590 eval $inlibc
7591 runnm="$xxx_runnm"
7592
7593 : see if this is a unistd.h system
7594 set unistd.h i_unistd
7595 eval $inhdr
7596
7597 : determine which dynamic loading, if any, to compile in
7598 echo " "
7599 dldir="ext/DynaLoader"
7600 case "$usedl" in
7601 $define|y|true)
7602         dflt='y'
7603         usedl="$define"
7604         ;;
7605 $undef|n|false)
7606         dflt='n'
7607         usedl="$undef"
7608         ;;
7609 *) 
7610         dflt='n'
7611         case "$d_dlopen" in
7612             $define) dflt='y' ;;
7613         esac
7614         case "$i_dld" in
7615             $define) dflt='y' ;;
7616         esac
7617         : Does a dl_xxx.xs file exist for this operating system
7618         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7619         ;;
7620 esac
7621 rp="Do you wish to use dynamic loading?"
7622 . ./myread
7623 usedl="$ans"
7624 case "$ans" in
7625 y*) usedl="$define"
7626         case "$dlsrc" in
7627         '')
7628                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7629                         dflt="$dldir/dl_${osname}.xs"
7630                 elif $test "$d_dlopen" = "$define" ; then
7631                         dflt="$dldir/dl_dlopen.xs"
7632                 elif $test "$i_dld" = "$define" ; then
7633                         dflt="$dldir/dl_dld.xs"
7634                 else
7635                         dflt=''
7636                 fi
7637                 ;;
7638         *)      dflt="$dldir/$dlsrc"
7639                 ;;
7640         esac
7641     echo "The following dynamic loading files are available:"
7642         : Can not go over to $dldir because getfile has path hard-coded in.
7643         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7644         rp="Source file to use for dynamic loading"
7645         fn="fne"
7646         gfpth="$src"
7647         . ./getfile
7648         usedl="$define"
7649         : emulate basename
7650         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7651
7652         $cat << EOM
7653
7654 Some systems may require passing special flags to $cc -c to
7655 compile modules that will be used to create a shared library.
7656 To use no flags, say "none".
7657
7658 EOM
7659     case "$cccdlflags" in
7660     '') case "$gccversion" in
7661                 '') case "$osname" in
7662                         hpux)   dflt='+z' ;;
7663                         next)   dflt='none' ;;
7664                         irix*)  dflt='-KPIC' ;;
7665                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7666                         sunos)  dflt='-pic' ;;
7667                         *)      dflt='none' ;;
7668                     esac
7669                         ;;
7670                 *)  case "$osname" in
7671                         darwin) dflt='none' ;;
7672                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7673                         *)      dflt='-fpic' ;;
7674                     esac ;;
7675             esac ;;
7676         ' ') dflt='none' ;;
7677     *)  dflt="$cccdlflags" ;;
7678     esac
7679     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7680     . ./myread
7681     case "$ans" in
7682     none) cccdlflags=' ' ;;
7683     *) cccdlflags="$ans" ;;
7684     esac
7685
7686     cat << EOM
7687
7688 Some systems use ld to create libraries that can be dynamically loaded,
7689 while other systems (such as those using ELF) use $cc.
7690
7691 EOM
7692         case "$ld" in
7693         '')     $cat >try.c <<EOM
7694 /* Test for whether ELF binaries are produced */
7695 #include <fcntl.h>
7696 #$i_stdlib I_STDLIB
7697 #ifdef I_STDLIB
7698 #include <stdlib.h>
7699 #endif
7700 #$i_unistd I_UNISTD
7701 #ifdef I_UNISTD
7702 #include <unistd.h>
7703 #endif
7704 int main() {
7705         char b[4];
7706         int i = open("a.out",O_RDONLY);
7707         if(i == -1) 
7708                 exit(1); /* fail */
7709         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7710                 exit(0); /* succeed (yes, it's ELF) */
7711         else
7712                 exit(1); /* fail */
7713 }
7714 EOM
7715                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7716                         cat <<EOM
7717 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7718 EOM
7719                         dflt="$cc"
7720                 else
7721                         echo "I'll use ld to build dynamic libraries."
7722                         dflt='ld'
7723                 fi
7724                 rm -f try.c a.out
7725                 ;;
7726         *)      dflt="$ld"
7727                 ;;
7728         esac
7729
7730     rp="What command should be used to create dynamic libraries?"
7731     . ./myread
7732         ld="$ans"
7733
7734     cat << EOM
7735
7736 Some systems may require passing special flags to $ld to create a
7737 library that can be dynamically loaded.  If your ld flags include
7738 -L/other/path options to locate libraries outside your loader's normal
7739 search path, you may need to specify those -L options here as well.  To
7740 use no flags, say "none".
7741
7742 EOM
7743     case "$lddlflags" in
7744     '') case "$osname" in
7745                         beos) dflt='-nostart' ;;
7746                         hpux) dflt='-b';
7747                               case "$gccversion" in
7748                               '') dflt="$dflt +vnocompatwarnings" ;;
7749                               esac
7750                               ;;        
7751                         linux|irix*|gnu*)       dflt='-shared' ;;
7752                         next)  dflt='none' ;;
7753                         solaris) dflt='-G' ;;
7754                         sunos) dflt='-assert nodefinitions' ;;
7755                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7756                 *)     dflt='none' ;;
7757                         esac
7758                         ;;
7759     *) dflt="$lddlflags" ;;
7760     esac
7761
7762         : Try to guess additional flags to pick up local libraries.
7763         : Be careful not to append to a plain 'none'
7764         case "$dflt" in
7765         none) dflt='' ;;
7766         esac
7767         for thisflag in $ldflags; do
7768                 case "$thisflag" in
7769                 -L*|-R*|-Wl,-R*)
7770                         case " $dflt " in
7771                         *" $thisflag "*) ;;
7772                         *) dflt="$dflt $thisflag" ;;
7773                         esac
7774                         ;;
7775                 esac
7776         done
7777
7778         case "$dflt" in
7779         ''|' ') dflt='none' ;;
7780         esac
7781
7782     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7783     . ./myread
7784     case "$ans" in
7785     none) lddlflags=' ' ;;
7786     *) lddlflags="$ans" ;;
7787     esac
7788
7789         cat <<EOM
7790
7791 Some systems may require passing special flags to $cc to indicate that
7792 the resulting executable will use dynamic linking.  To use no flags,
7793 say "none".
7794
7795 EOM
7796     case "$ccdlflags" in
7797     '') case "$osname" in
7798             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7799             next|sunos) dflt='none' ;;
7800             *)          dflt='none' ;;
7801             esac ;;
7802     ' ')  dflt='none' ;;
7803     *)  dflt="$ccdlflags" ;;
7804     esac
7805     rp="Any special flags to pass to $cc to use dynamic linking?"
7806     . ./myread
7807     case "$ans" in
7808     none) ccdlflags=' ' ;;
7809     *) ccdlflags="$ans" ;;
7810     esac
7811     ;;
7812 *)  usedl="$undef"
7813         ld='ld'
7814     dlsrc='dl_none.xs'
7815     lddlflags=''
7816     ccdlflags=''
7817     ;;
7818 esac
7819
7820 also=''
7821 case "$usedl" in
7822 $undef)
7823         # No dynamic loading being used, so don't bother even to prompt.
7824         useshrplib='false'
7825         ;;
7826 *)      case "$useshrplib" in
7827         '')     case "$osname" in
7828                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7829                         dflt=y
7830                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7831                         ;;
7832                 next*)
7833                         case "$osvers" in
7834                         4*)     dflt=y
7835                                 also='Building a shared libperl is needed for MAB support.'
7836                                 ;;
7837                         *)      dflt=n
7838                                 ;;
7839                         esac
7840                         ;;
7841                 *)      dflt=n
7842                         ;;
7843                 esac
7844                 ;;
7845         $define|true|[Yy]*)
7846                 dflt=y
7847                 ;;
7848         *)      dflt=n
7849                 ;;
7850         esac
7851         $cat << EOM
7852
7853 The perl executable is normally obtained by linking perlmain.c with
7854 libperl${_a}, any static extensions (usually just DynaLoader), and
7855 any other libraries needed on this system (such as -lm, etc.).  Since
7856 your system supports dynamic loading, it is probably possible to build
7857 a shared libperl.$so.  If you will have more than one executable linked
7858 to libperl.$so, this will significantly reduce the size of each
7859 executable, but it may have a noticeable effect on performance.  The
7860 default is probably sensible for your system.
7861 $also
7862
7863 EOM
7864         rp="Build a shared libperl.$so (y/n)"
7865         . ./myread
7866         case "$ans" in
7867         true|$define|[Yy]*)
7868                 useshrplib='true'  ;;
7869         *)      useshrplib='false' ;;
7870         esac
7871         ;;
7872 esac
7873
7874 case "$useshrplib" in
7875 true)
7876         case "$libperl" in
7877         '')
7878                 # Figure out a good name for libperl.so.  Since it gets stored in
7879                 # a version-specific architecture-dependent library, the version
7880                 # number isn't really that important, except for making cc/ld happy.
7881                 #
7882                 # A name such as libperl.so.3.1
7883                 majmin="libperl.$so.$patchlevel.$subversion"
7884                 # A name such as libperl.so.301
7885                 majonly=`echo $patchlevel $subversion |
7886                         $awk '{printf "%d%02d", $1, $2}'`
7887                 majonly=libperl.$so.$majonly
7888                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7889                 # rely on figuring it out from the naming of libc.
7890                 case "${osname}${osvers}" in
7891                 next4*)
7892                         dflt=libperl.5.$so
7893                         # XXX How handle the --version stuff for MAB?
7894                         ;;
7895                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7896                         dflt=libperl.$so
7897                         ;;
7898                 cygwin*) # ld links against an importlib
7899                         dflt=libperl$lib_ext
7900                         ;;
7901                 *)      # Try to guess based on whether libc has major.minor.
7902                         case "$libc" in
7903                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7904                         *libc.$so.[0-9]*) dflt=$majonly ;;
7905                         *)      dflt=libperl.$so ;;
7906                         esac
7907                         ;;
7908                 esac
7909                 ;;
7910         *)      dflt=$libperl
7911                 ;;
7912         esac
7913         cat << EOM
7914
7915 I need to select a good name for the shared libperl.  If your system uses
7916 library names with major and minor numbers, then you might want something
7917 like $majmin.  Alternatively, if your system uses a single version
7918 number for shared libraries, then you might want to use $majonly.
7919 Or, your system might be quite happy with a simple libperl.$so.
7920
7921 Since the shared libperl will get installed into a version-specific
7922 architecture-dependent directory, the version number of the shared perl
7923 library probably isn't important, so the default should be o.k.
7924
7925 EOM
7926         rp='What name do you want to give to the shared libperl?'
7927         . ./myread
7928         libperl=$ans
7929         echo "Ok, I'll use $libperl"
7930         ;;
7931 *)
7932         libperl="libperl${_a}"
7933         ;;
7934 esac
7935
7936 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7937 case "$shrpdir" in
7938 '') ;;
7939 *)      $cat >&4 <<EOM
7940 WARNING:  Use of the shrpdir variable for the installation location of
7941 the shared $libperl is not supported.  It was never documented and
7942 will not work in this version.  Let me (perlbug@perl.org)
7943 know of any problems this may cause.
7944
7945 EOM
7946         case "$shrpdir" in
7947         "$archlibexp/CORE")
7948                 $cat >&4 <<EOM
7949 But your current setting of $shrpdir is
7950 the default anyway, so it's harmless.
7951 EOM
7952                 ;;
7953         *)
7954                 $cat >&4 <<EOM
7955 Further, your current attempted setting of $shrpdir
7956 conflicts with the value of $archlibexp/CORE
7957 that installperl will use.
7958 EOM
7959                 ;;
7960         esac
7961         ;;
7962 esac
7963
7964 # How will the perl executable find the installed shared $libperl?
7965 # Add $xxx to ccdlflags.
7966 # If we can't figure out a command-line option, use $shrpenv to
7967 # set env LD_RUN_PATH.  The main perl makefile uses this.
7968 shrpdir=$archlibexp/CORE
7969 xxx=''
7970 tmp_shrpenv=''
7971 if "$useshrplib"; then
7972     case "$osname" in 
7973         aix)
7974                 # We'll set it in Makefile.SH...
7975                 ;;
7976         solaris)
7977                 xxx="-R $shrpdir"
7978                 ;;
7979         freebsd|netbsd|openbsd|interix|dragonfly)
7980                 xxx="-Wl,-R$shrpdir"
7981                 ;;
7982         bsdos|linux|irix*|dec_osf|gnu*)
7983                 xxx="-Wl,-rpath,$shrpdir"
7984                 ;;
7985         next)
7986                 # next doesn't like the default...
7987                 ;;
7988         beos)
7989                 # beos doesn't like the default, either.
7990                 ;;
7991         hpux*)
7992                 # hpux doesn't like the default, either.
7993                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7994                 ;;
7995         *)
7996                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7997                 ;;
7998         esac
7999         case "$xxx" in
8000         '') ;;
8001         *)      
8002                 # Only add $xxx if it isn't already in ccdlflags.
8003                 case " $ccdlflags " in
8004                 *" $xxx "*)     ;;
8005                 *)      ccdlflags="$ccdlflags $xxx"
8006                         cat <<EOM >&4
8007
8008 Adding $xxx to the flags
8009 passed to $ld so that the perl executable will find the 
8010 installed shared $libperl.
8011
8012 EOM
8013                         ;;
8014                 esac
8015                 ;;
8016         esac
8017 fi
8018 # Fix ccdlflags in AIX for building external extensions.
8019 # (For building Perl itself bare -bE:perl.exp is needed,
8020 #  Makefile.SH takes care of this.)
8021 case "$osname" in
8022 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8023 esac
8024 # Respect a hint or command-line value.
8025 case "$shrpenv" in
8026 '') shrpenv="$tmp_shrpenv" ;;
8027 esac
8028 case "$ldlibpthname" in
8029 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8030 none)   ldlibpthname='' ;;
8031 esac
8032
8033 : determine where manual pages are on this system
8034 echo " "
8035 case "$sysman" in
8036 '') 
8037         syspath='/usr/share/man/man1 /usr/man/man1'
8038         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8039         syspath="$syspath /usr/man/u_man/man1"
8040         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8041         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8042         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8043         sysman=`./loc . /usr/man/man1 $syspath`
8044         ;;
8045 esac
8046 if $test -d "$sysman"; then
8047         echo "System manual is in $sysman." >&4
8048 else
8049         echo "Could not find manual pages in source form." >&4
8050 fi
8051
8052 : determine where manual pages go
8053 set man1dir man1dir none
8054 eval $prefixit
8055 $cat <<EOM
8056
8057 $spackage has manual pages available in source form.
8058 EOM
8059 case "$nroff" in
8060 nroff)
8061         echo "However, you don't have nroff, so they're probably useless to you."
8062         case "$man1dir" in
8063         '') man1dir="none";;
8064         esac;;
8065 esac
8066 echo "If you don't want the manual sources installed, answer 'none'."
8067 case "$man1dir" in
8068 ' ') dflt=none
8069         ;;
8070 '')
8071         lookpath="$prefixexp/share/man/man1"
8072         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8073         lookpath="$lookpath $prefixexp/man/p_man/man1"
8074         lookpath="$lookpath $prefixexp/man/u_man/man1"
8075         lookpath="$lookpath $prefixexp/man/man.1"
8076         case "$sysman" in
8077         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8078         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8079         esac
8080         set dflt
8081         eval $prefixup
8082         ;;
8083 *)  dflt="$man1dir"
8084         ;;
8085 esac
8086 echo " "
8087 fn=dn+~
8088 rp="Where do the main $spackage manual pages (source) go?"
8089 . ./getfile
8090 if $test "X$man1direxp" != "X$ansexp"; then
8091         installman1dir=''
8092 fi
8093 prefixvar=man1dir
8094 . ./setprefixvar
8095
8096 case "$man1dir" in
8097 '')     man1dir=' '
8098         installman1dir='';;
8099 esac
8100
8101 : What suffix to use on installed man pages
8102
8103 case "$man1dir" in
8104 ' ')
8105         man1ext='0'
8106         ;;
8107 *)
8108         rp="What suffix should be used for the main $spackage man pages?"
8109         case "$man1ext" in
8110         '')     case "$man1dir" in
8111                 *1)  dflt=1 ;;
8112                 *1p) dflt=1p ;;
8113                 *1pm) dflt=1pm ;;
8114                 *l) dflt=l;;
8115                 *n) dflt=n;;
8116                 *o) dflt=o;;
8117                 *p) dflt=p;;
8118                 *C) dflt=C;;
8119                 *L) dflt=L;;
8120                 *L1) dflt=L1;;
8121                 *) dflt=1;;
8122                 esac
8123                 ;;
8124         *)      dflt="$man1ext";;
8125         esac
8126         . ./myread
8127         man1ext="$ans"
8128         ;;
8129 esac
8130
8131 : see if we can have long filenames
8132 echo " "
8133 first=123456789abcdef
8134 $rm -f $first
8135 if (echo hi >$first) 2>/dev/null; then
8136         if $test -f 123456789abcde; then
8137                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8138                 val="$undef"
8139         else
8140                 echo 'You can have filenames longer than 14 characters.'>&4
8141                 val="$define"
8142         fi
8143 else
8144         $cat <<'EOM'
8145 You can't have filenames longer than 14 chars.
8146 You can't even think about them!
8147 EOM
8148         val="$undef"
8149 fi 
8150 set d_flexfnam
8151 eval $setvar
8152 $rm -rf 123456789abcde*
8153
8154 : determine where library module manual pages go
8155 set man3dir man3dir none
8156 eval $prefixit
8157 $cat <<EOM
8158
8159 $spackage has manual pages for many of the library modules.
8160 EOM
8161
8162 case "$nroff" in
8163 nroff)
8164         $cat <<'EOM'
8165 However, you don't have nroff, so they're probably useless to you.
8166 EOM
8167         case "$man3dir" in
8168         '') man3dir="none";;
8169         esac;;
8170 esac
8171
8172 case "$d_flexfnam" in
8173 undef)
8174         $cat <<'EOM'
8175 However, your system can't handle the long file names like File::Basename.3.
8176 EOM
8177         case "$man3dir" in
8178         '') man3dir="none";;
8179         esac;;
8180 esac
8181
8182 echo "If you don't want the manual sources installed, answer 'none'."
8183 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8184 case "$man3dir" in
8185 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8186         if $test -d "$privlib/man/man3"; then
8187                 cat <<EOM >&4
8188
8189 WARNING:  Previous versions of perl installed man3 pages into
8190 $privlib/man/man3.  This version will suggest a
8191 new default of $dflt.
8192 EOM
8193                 tdflt=$dflt
8194                 dflt='n'
8195                 rp='Do you wish to preserve the old behavior?(y/n)'
8196                 . ./myread
8197                 case "$ans" in
8198                 y*) dflt="$privlib/man/man3" ;;
8199                 *)  dflt=$tdflt ;;
8200                 esac
8201     fi
8202         ;;
8203 *)      dflt="$man3dir" ;;
8204 esac
8205 case "$dflt" in
8206 ' ') dflt=none ;;
8207 esac
8208 echo " "
8209 fn=dn+~
8210 rp="Where do the $package library man pages (source) go?"
8211 . ./getfile
8212 prefixvar=man3dir
8213 . ./setprefixvar
8214
8215 case "$man3dir" in
8216 '')     man3dir=' '
8217         installman3dir='';;
8218 esac
8219
8220 : What suffix to use on installed man pages
8221 case "$man3dir" in
8222 ' ')
8223         man3ext='0'
8224         ;;
8225 *)
8226         rp="What suffix should be used for the $package library man pages?"
8227         case "$man3ext" in
8228         '')     case "$man3dir" in
8229                 *3)  dflt=3 ;;
8230                 *3p) dflt=3p ;;
8231                 *3pm) dflt=3pm ;;
8232                 *l) dflt=l;;
8233                 *n) dflt=n;;
8234                 *o) dflt=o;;
8235                 *p) dflt=p;;
8236                 *C) dflt=C;;
8237                 *L) dflt=L;;
8238                 *L3) dflt=L3;;
8239                 *) dflt=3;;
8240                 esac
8241                 ;;
8242         *)      dflt="$man3ext";;
8243         esac
8244         . ./myread
8245         man3ext="$ans"
8246         ;;
8247 esac
8248
8249 : see if we have to deal with yellow pages, now NIS.
8250 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8251         if $test -f /usr/etc/nibindd; then
8252                 echo " "
8253                 echo "I'm fairly confident you're on a NeXT."
8254                 echo " "
8255                 rp='Do you get the hosts file via NetInfo?'
8256                 dflt=y
8257                 case "$hostcat" in
8258                 nidump*) ;;
8259                 '') ;;
8260                 *) dflt=n;;
8261                 esac
8262                 . ./myread
8263                 case "$ans" in
8264                 y*) hostcat='nidump hosts .';;
8265                 *)      case "$hostcat" in
8266                         nidump*) hostcat='';;
8267                         esac
8268                         ;;
8269                 esac
8270         fi
8271         case "$hostcat" in
8272         nidump*) ;;
8273         *)
8274                 case "$hostcat" in
8275                 *ypcat*) dflt=y;;
8276                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8277                                 dflt=y
8278                         else
8279                                 dflt=n
8280                         fi;;
8281                 *) dflt=n;;
8282                 esac
8283                 echo " "
8284                 rp='Are you getting the hosts file via yellow pages?'
8285                 . ./myread
8286                 case "$ans" in
8287                 y*) hostcat='ypcat hosts';;
8288                 *) hostcat='cat /etc/hosts';;
8289                 esac
8290                 ;;
8291         esac
8292 fi
8293 case "$hostcat" in
8294 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8295 esac
8296 case "$groupcat" in
8297 '') test -f /etc/group && groupcat='cat /etc/group';;
8298 esac
8299 case "$passcat" in
8300 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8301 esac
8302
8303 : now get the host name
8304 echo " "
8305 echo "Figuring out host name..." >&4
8306 case "$myhostname" in
8307 '') cont=true
8308         echo 'Maybe "hostname" will work...'
8309         if tans=`sh -c hostname 2>&1` ; then
8310                 myhostname=$tans
8311                 phostname=hostname
8312                 cont=''
8313         fi
8314         ;;
8315 *) cont='';;
8316 esac
8317 if $test "$cont"; then
8318         if ./xenix; then
8319                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8320                 if tans=`cat /etc/systemid 2>&1` ; then
8321                         myhostname=$tans
8322                         phostname='cat /etc/systemid'
8323                         echo "Whadyaknow.  Xenix always was a bit strange..."
8324                         cont=''
8325                 fi
8326         elif $test -r /etc/systemid; then
8327                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8328         fi
8329 fi
8330 if $test "$cont"; then
8331         echo 'No, maybe "uuname -l" will work...'
8332         if tans=`sh -c 'uuname -l' 2>&1` ; then
8333                 myhostname=$tans
8334                 phostname='uuname -l'
8335         else
8336                 echo 'Strange.  Maybe "uname -n" will work...'
8337                 if tans=`sh -c 'uname -n' 2>&1` ; then
8338                         myhostname=$tans
8339                         phostname='uname -n'
8340                 else
8341                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8342                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8343                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8344                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8345                         else
8346                                 case "$myhostname" in
8347                                 '') echo "Does this machine have an identity crisis or something?"
8348                                         phostname='';;
8349                                 *)
8350                                         echo "Well, you said $myhostname before..."
8351                                         phostname='echo $myhostname';;
8352                                 esac
8353                         fi
8354                 fi
8355         fi
8356 fi
8357 case "$myhostname" in
8358 '') myhostname=noname ;;
8359 esac
8360 : you do not want to know about this
8361 set $myhostname
8362 myhostname=$1
8363
8364 : verify guess
8365 if $test "$myhostname" ; then
8366         dflt=y
8367         rp='Your host name appears to be "'$myhostname'".'" Right?"
8368         . ./myread
8369         case "$ans" in
8370         y*) ;;
8371         *) myhostname='';;
8372         esac
8373 fi
8374
8375 : bad guess or no guess
8376 while $test "X$myhostname" = X ; do
8377         dflt=''
8378         rp="Please type the (one word) name of your host:"
8379         . ./myread
8380         myhostname="$ans"
8381 done
8382
8383 : translate upper to lower if necessary
8384 case "$myhostname" in
8385 *[A-Z]*)
8386         echo "(Normalizing case in your host name)"
8387         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8388         ;;
8389 esac
8390
8391 case "$myhostname" in
8392 *.*)
8393         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8394         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8395         echo "(Trimming domain name from host name--host name is now $myhostname)"
8396         ;;
8397 *) case "$mydomain" in
8398         '')
8399                 {
8400                         test "X$hostcat" = "Xypcat hosts" &&
8401                         ypmatch "$myhostname" hosts 2>/dev/null |\
8402                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8403                         $test -s hosts
8404                 } || {
8405                         test "X$hostcat" != "X" &&
8406                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8407                                         /[       ]$myhostname[  . ]/p" > hosts
8408                 }
8409                 tmp_re="[       . ]"
8410                 if $test -f hosts; then
8411                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8412                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8413                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8414                                 hosts | $sort | $uniq | \
8415                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8416                         case `$echo X$dflt` in
8417                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8418                                 dflt=.
8419                                 ;;
8420                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8421                                 ;;
8422                         esac
8423                 else
8424                         echo "(I cannot locate a hosts database anywhere)"
8425                         dflt=.
8426                 fi
8427                 case "$dflt" in
8428                 .)
8429                         tans=`./loc resolv.conf X /etc /usr/etc`
8430                         if $test -f "$tans"; then
8431                                 echo "(Attempting domain name extraction from $tans)"
8432                                 dflt=.`$sed -n -e 's/   / /g' \
8433                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8434                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8435                                 case "$dflt" in
8436                                 .) dflt=.`$sed -n -e 's/        / /g' \
8437                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8438                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8439                                         ;;
8440                                 esac
8441                         fi
8442                         ;;
8443                 esac
8444                 case "$dflt" in
8445                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8446                         dflt=.`sh -c domainname 2>/dev/null`
8447                         case "$dflt" in
8448                         '') dflt='.';;
8449                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8450                         esac
8451                         ;;
8452                 esac
8453                 case "$dflt$osname" in
8454                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8455                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8456                         ;;
8457                 esac
8458                 case "$dflt" in
8459                 .) echo "(Lost all hope -- silly guess then)"
8460                         dflt='.nonet'
8461                         ;;
8462                 esac
8463                 $rm -f hosts
8464                 ;;
8465         *) dflt="$mydomain";;
8466         esac;;
8467 esac
8468 echo " "
8469 rp="What is your domain name?"
8470 . ./myread
8471 tans="$ans"
8472 case "$ans" in
8473 '') ;;
8474 .*) ;;
8475 *) tans=".$tans";;
8476 esac
8477 mydomain="$tans"
8478
8479 : translate upper to lower if necessary
8480 case "$mydomain" in
8481 *[A-Z]*)
8482         echo "(Normalizing case in your domain name)"
8483         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8484         ;;
8485 esac
8486
8487 : a little sanity check here
8488 case "$phostname" in
8489 '') ;;
8490 *)
8491         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8492         $myhostname$mydomain|$myhostname) ;;
8493         *)
8494                 case "$phostname" in
8495                 sed*)
8496                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8497                         ;;
8498                 *)
8499                         echo "(That doesn't agree with your $phostname command, by the way.)"
8500                         ;;
8501                 esac
8502         ;;
8503         esac
8504         ;;
8505 esac
8506
8507 $cat <<EOM
8508
8509 I need to get your e-mail address in Internet format if possible, i.e.
8510 something like user@host.domain. Please answer accurately since I have
8511 no easy means to double check it. The default value provided below
8512 is most probably close to reality but may not be valid from outside
8513 your organization...
8514
8515 EOM
8516 cont=x
8517 while test "$cont"; do
8518         case "$cf_email" in
8519         '') dflt="$cf_by@$myhostname$mydomain";;
8520         *) dflt="$cf_email";;
8521         esac
8522         rp='What is your e-mail address?'
8523         . ./myread
8524         cf_email="$ans"
8525         case "$cf_email" in
8526         *@*.*) cont='' ;;
8527         *)
8528                 rp='Address does not look like an Internet one.  Use it anyway?'
8529                 case "$fastread" in
8530                 yes) dflt=y ;;
8531                 *) dflt=n ;;
8532                 esac
8533                 . ./myread
8534                 case "$ans" in
8535                 y*) cont='' ;;
8536                 *) echo " " ;;
8537                 esac
8538                 ;;
8539         esac
8540 done
8541
8542 $cat <<EOM
8543
8544 If you or somebody else will be maintaining perl at your site, please
8545 fill in the correct e-mail address here so that they may be contacted
8546 if necessary. Currently, the "perlbug" program included with perl
8547 will send mail to this address in addition to perlbug@perl.org. You may
8548 enter "none" for no administrator.
8549
8550 EOM
8551 case "$perladmin" in
8552 '') dflt="$cf_email";;
8553 *) dflt="$perladmin";;
8554 esac
8555 rp='Perl administrator e-mail address'
8556 . ./myread
8557 perladmin="$ans"
8558
8559 : determine whether to only install version-specific parts.
8560 echo " "
8561 $cat <<EOM
8562 Do you want to install only the version-specific parts of the perl
8563 distribution?  Usually you do *not* want to do this.
8564 EOM
8565 case "$versiononly" in
8566 "$define"|[Yy]*|true) dflt='y' ;;
8567 *) dflt='n';
8568 esac
8569 rp="Do you want to install only the version-specific parts of perl?"
8570 . ./myread
8571 case "$ans" in
8572 [yY]*)  val="$define";;
8573 *)      val="$undef" ;;
8574 esac
8575 set versiononly
8576 eval $setvar
8577
8578 case "$versiononly" in
8579 "$define") inc_version_list=''
8580            inc_version_list_init=0
8581            ;;
8582 esac
8583
8584 : figure out how to guarantee perl startup
8585 : XXX Note that this currently takes advantage of the bug that binexp ignores
8586 :     the Configure -Dinstallprefix setting, which in turn means that under
8587 :     relocatable @INC, initialinstalllocation is what binexp started as.
8588 case "$startperl" in
8589 '')
8590         case "$sharpbang" in
8591         *!)
8592                 $cat <<EOH
8593
8594 I can use the #! construct to start perl on your system. This will
8595 make startup of perl scripts faster, but may cause problems if you
8596 want to share those scripts and perl is not in a standard place
8597 ($initialinstalllocation/perl) on all your platforms. The alternative
8598 is to force a shell by starting the script with a single ':' character.
8599
8600 EOH
8601                 case "$versiononly" in
8602                 "$define")      dflt="$initialinstalllocation/perl$version";;
8603                 *)              dflt="$initialinstalllocation/perl";;
8604                 esac
8605                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8606                 . ./myread
8607                 case "$ans" in
8608                 none)   startperl=": # use perl";;
8609                 *)      startperl="#!$ans"
8610                         if $test 30 -lt `echo "$ans" | wc -c`; then
8611                                 $cat >&4 <<EOM
8612
8613 WARNING:  Some systems limit the #! command to 32 characters.
8614 If you experience difficulty running Perl scripts with #!, try
8615 installing Perl in a directory with a shorter pathname.
8616
8617 EOM
8618                         fi ;;
8619                 esac
8620                 ;;
8621         *) startperl=": # use perl"
8622                 ;;
8623         esac
8624         ;;
8625 esac
8626 echo "I'll use $startperl to start perl scripts."
8627
8628 : figure best path for perl in scripts
8629 case "$perlpath" in
8630 '')
8631         case "$versiononly" in
8632         "$define")      perlpath="$initialinstalllocation/perl$version";;
8633         *)              perlpath="$initialinstalllocation/perl";;
8634         esac
8635         case "$startperl" in
8636         *!*) ;;
8637         *)
8638                 $cat <<EOH
8639
8640 I will use the "eval 'exec'" idiom to start Perl on your system.
8641 I can use the full path of your Perl binary for this purpose, but
8642 doing so may cause problems if you want to share those scripts and
8643 Perl is not always in a standard place ($initialinstalllocation/perl).
8644
8645 EOH
8646                 dflt="$initialinstalllocation/perl"
8647                 rp="What path shall I use in \"eval 'exec'\"?"
8648                 . ./myread
8649                 perlpath="$ans"
8650                 ;;
8651         esac
8652         ;;
8653 esac
8654 case "$startperl" in
8655 *!*)    ;;
8656 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8657 esac
8658
8659 : determine where public executable scripts go
8660 set scriptdir scriptdir
8661 eval $prefixit
8662 case "$scriptdir" in
8663 '')
8664         dflt="$bin"
8665         : guess some guesses
8666         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8667         $test -d /usr/share/bin     && dflt=/usr/share/bin
8668         $test -d /usr/local/script  && dflt=/usr/local/script
8669         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8670         $test -d $prefixexp/script  && dflt=$prefixexp/script
8671         set dflt
8672         eval $prefixup
8673         ;;
8674 *)  dflt="$scriptdir"
8675         ;;
8676 esac
8677 $cat <<EOM
8678
8679 Some installations have a separate directory just for executable scripts so
8680 that they can mount it across multiple architectures but keep the scripts in
8681 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8682 Or you might just lump your scripts in with all your other executables.
8683
8684 EOM
8685 fn=d~
8686 rp='Where do you keep publicly executable scripts?'
8687 . ./getfile
8688 if $test "X$ansexp" != "X$scriptdirexp"; then
8689         installscript=''
8690 fi
8691 installscriptdir=''
8692 prefixvar=scriptdir
8693 . ./setprefixvar
8694 : A little fix up for an irregularly named variable.
8695 installscript="$installscriptdir"
8696
8697 : determine where add-on public executables go
8698 case "$sitebin" in
8699 '')     dflt=$siteprefix/bin ;;
8700 *)      dflt=$sitebin ;;
8701 esac
8702 fn=d~
8703 rp='Pathname where the add-on public executables should be installed?'
8704 . ./getfile
8705 prefixvar=sitebin
8706 . ./setprefixvar
8707
8708 : determine where add-on html pages go
8709 : There is no standard location, so try to copy the previously-selected
8710 : directory structure for the core html pages.
8711 case "$sitehtml1dir" in
8712 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8713 *)     dflt=$sitehtml1dir ;;
8714 esac
8715 case "$dflt" in
8716 ''|' ') dflt=none ;;
8717 esac
8718 fn=dn+~
8719 rp='Pathname where the site-specific html pages should be installed?'
8720 . ./getfile
8721 prefixvar=sitehtml1dir
8722 . ./setprefixvar
8723
8724 : determine where add-on library html pages go
8725 : There is no standard location, so try to copy the previously-selected
8726 : directory structure for the core html pages.
8727 case "$sitehtml3dir" in
8728 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8729 *)     dflt=$sitehtml3dir ;;
8730 esac
8731 case "$dflt" in
8732 ''|' ') dflt=none ;;
8733 esac
8734 fn=dn+~
8735 rp='Pathname where the site-specific library html pages should be installed?'
8736 . ./getfile
8737 prefixvar=sitehtml3dir
8738 . ./setprefixvar
8739
8740 : determine where add-on manual pages go
8741 case "$siteman1dir" in
8742 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8743 *)      dflt=$siteman1dir ;;
8744 esac
8745 case "$dflt" in
8746 ''|' ') dflt=none ;;
8747 esac
8748 fn=dn+~
8749 rp='Pathname where the site-specific manual pages should be installed?'
8750 . ./getfile
8751 prefixvar=siteman1dir
8752 . ./setprefixvar
8753
8754 : determine where add-on library man pages go
8755 case "$siteman3dir" in
8756 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8757 *)      dflt=$siteman3dir ;;
8758 esac
8759 case "$dflt" in
8760 ''|' ') dflt=none ;;
8761 esac
8762 fn=dn+~
8763 rp='Pathname where the site-specific library manual pages should be installed?'
8764 . ./getfile
8765 prefixvar=siteman3dir
8766 . ./setprefixvar
8767
8768 : determine where add-on public executable scripts go
8769 case "$sitescript" in
8770 '')     dflt=$siteprefix/script
8771         $test -d $dflt || dflt=$sitebin ;;
8772 *)  dflt="$sitescript" ;;
8773 esac
8774 fn=d~+
8775 rp='Pathname where add-on public executable scripts should be installed?'
8776 . ./getfile
8777 prefixvar=sitescript
8778 . ./setprefixvar
8779
8780 case "$usefaststdio" in
8781 $define|true|[yY]*|'')
8782         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8783         case "$xversion" in
8784         [68])   dflt='y' ;;
8785         *)      dflt='n' ;;
8786         esac
8787         ;;
8788 *) dflt='n';;
8789 esac
8790 cat <<EOM
8791
8792 Perl can be built to use 'fast stdio', which means using the stdio
8793 library but also directly manipulating the stdio buffers to enable
8794 faster I/O.  Using stdio is better for backward compatibility (especially
8795 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8796 interface has been preferred instead of stdio.
8797
8798 If this doesn't make any sense to you, just accept the default '$dflt'.
8799 EOM
8800 rp='Use the "fast stdio" if available?'
8801 . ./myread
8802 case "$ans" in
8803 y|Y)    val="$define" ;;     
8804 *)      val="$undef" ;;
8805 esac
8806 set usefaststdio
8807 eval $setvar
8808
8809
8810 : define an is-a-typedef? function
8811 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8812 case "$inclist" in
8813 "") inclist="sys/types.h";;
8814 esac;
8815 eval "varval=\$$var";
8816 case "$varval" in
8817 "")
8818         $rm -f temp.c;
8819         for inc in $inclist; do
8820                 echo "#include <$inc>" >>temp.c;
8821         done;
8822         echo "#ifdef $type" >> temp.c;
8823         echo "printf(\"We have $type\");" >> temp.c;
8824         echo "#endif" >> temp.c;
8825         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8826         if $contains $type temp.E >/dev/null 2>&1; then
8827                 eval "$var=\$type";
8828         else
8829                 eval "$var=\$def";
8830         fi;
8831         $rm -f temp.?;;
8832 *) eval "$var=\$varval";;
8833 esac'
8834
8835 : define an is-a-typedef? function that prompts if the type is not available.
8836 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8837 case "$inclist" in
8838 "") inclist="sys/types.h";;
8839 esac;
8840 eval "varval=\$$var";
8841 case "$varval" in
8842 "")
8843         $rm -f temp.c;
8844         for inc in $inclist; do
8845                 echo "#include <$inc>" >>temp.c;
8846         done;
8847         echo "#ifdef $type" >> temp.c;
8848         echo "printf(\"We have $type\");" >> temp.c;
8849         echo "#endif" >> temp.c;
8850         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8851         echo " " ;
8852         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8853         if $contains $type temp.E >/dev/null 2>&1; then
8854                 echo "$type found." >&4;
8855                 eval "$var=\$type";
8856         else
8857                 echo "$type NOT found." >&4;
8858                 dflt="$def";
8859                 . ./myread ;
8860                 eval "$var=\$ans";
8861         fi;
8862         $rm -f temp.?;;
8863 *) eval "$var=\$varval";;
8864 esac'
8865
8866 : see what type lseek is declared as in the kernel
8867 rp="What is the type used for lseek's offset on this system?"
8868 set off_t lseektype long stdio.h sys/types.h
8869 eval $typedef_ask
8870
8871 echo " "
8872 echo "Checking to see how big your file offsets are..." >&4
8873 $cat >try.c <<EOCP
8874 #include <sys/types.h>
8875 #include <stdio.h>
8876 int main()
8877 {
8878     printf("%d\n", (int)sizeof($lseektype));
8879     return(0); 
8880 }
8881 EOCP
8882 set try
8883 if eval $compile_ok; then
8884         lseeksize=`$run ./try`
8885         echo "Your file offsets are $lseeksize bytes long."
8886 else
8887         dflt=$longsize
8888         echo " "
8889         echo "(I can't seem to compile the test program.  Guessing...)"
8890         rp="What is the size of your file offsets (in bytes)?"
8891         . ./myread
8892         lseeksize="$ans"
8893 fi
8894 $rm -f try.c try
8895
8896 : see what type file positions are declared as in the library
8897 rp="What is the type for file position used by fsetpos()?"
8898 set fpos_t fpostype long stdio.h sys/types.h
8899 eval $typedef_ask
8900
8901 echo " "
8902 case "$fpostype" in
8903 *_t) zzz="$fpostype"    ;;
8904 *)   zzz="fpos_t"       ;;
8905 esac
8906 echo "Checking the size of $zzz..." >&4 
8907 cat > try.c <<EOCP
8908 #include <sys/types.h>
8909 #include <stdio.h>
8910 #$i_stdlib I_STDLIB
8911 #ifdef I_STDLIB
8912 #include <stdlib.h>
8913 #endif
8914 int main() {
8915     printf("%d\n", (int)sizeof($fpostype));
8916     exit(0);
8917 }
8918 EOCP
8919 set try
8920 if eval $compile_ok; then
8921         yyy=`$run ./try`
8922         case "$yyy" in
8923         '')     fpossize=4
8924                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8925                 ;;
8926         *)      fpossize=$yyy
8927                 echo "Your $zzz is $fpossize bytes long."
8928                 ;;
8929         esac
8930 else
8931         dflt="$longsize"
8932         echo " " >&4
8933         echo "(I can't compile the test program.  Guessing...)" >&4
8934         rp="What is the size of your file positions (in bytes)?"
8935         . ./myread
8936         fpossize="$ans"
8937 fi
8938
8939 # Backward compatibility (uselfs is deprecated).
8940 case "$uselfs" in
8941 "$define"|true|[yY]*)
8942         cat <<EOM >&4
8943
8944 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8945 EOM
8946         uselargefiles="$define"
8947         ;;
8948 esac                          
8949
8950 case "$lseeksize:$fpossize" in
8951 8:8) cat <<EOM
8952
8953 You can have files larger than 2 gigabytes.
8954 EOM
8955    val="$define" ;;
8956 *)    case "$uselargefiles" in
8957    "$undef"|false|[nN]*) dflt='n' ;;
8958    *)   dflt='y' ;;
8959    esac
8960    cat <<EOM
8961
8962 Perl can be built to understand large files (files larger than 2 gigabytes)
8963 on some systems.  To do so, Configure can be run with -Duselargefiles.
8964
8965 If this doesn't make any sense to you, just accept the default '$dflt'.
8966 EOM
8967    rp='Try to understand large files, if available?'
8968    . ./myread
8969    case "$ans" in
8970    y|Y)         val="$define" ;;
8971    *)           val="$undef"  ;;
8972    esac
8973    ;;
8974 esac
8975 set uselargefiles
8976 eval $setvar
8977 : Look for a hint-file generated 'call-back-unit'.  If the
8978 : user has specified that a large files perl is to be built,
8979 : we may need to set or change some other defaults.
8980 if $test -f uselargefiles.cbu; then
8981         echo "Your platform has some specific hints regarding large file builds, using them..."
8982         . ./uselargefiles.cbu
8983 fi
8984 case "$uselargefiles" in
8985 "$define")
8986         if $test -f uselargefiles.cbu; then
8987                 echo " "
8988                 echo "Rechecking to see how big your file offsets are..." >&4
8989                 $cat >try.c <<EOCP
8990 #include <sys/types.h>
8991 #include <stdio.h>
8992 int main()
8993 {
8994     printf("%d\n", (int)sizeof($lseektype));
8995     return(0); 
8996 }
8997 EOCP
8998                 set try
8999                 if eval $compile_ok; then
9000                         lseeksize=`$run ./try`
9001                         $echo "Your file offsets are now $lseeksize bytes long."
9002                 else
9003                         dflt="$lseeksize"
9004                         echo " "
9005                         echo "(I can't seem to compile the test program.  Guessing...)"
9006                         rp="What is the size of your file offsets (in bytes)?"
9007                         . ./myread
9008                         lseeksize="$ans"
9009                 fi
9010                 case "$fpostype" in
9011                 *_t) zzz="$fpostype"    ;;
9012                 *)   zzz="fpos_t"       ;;
9013                 esac
9014                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9015                 $cat > try.c <<EOCP
9016 #include <sys/types.h>
9017 #include <stdio.h>
9018 #$i_stdlib I_STDLIB
9019 #ifdef I_STDLIB
9020 #include <stdlib.h>
9021 #endif
9022 int main() {
9023     printf("%d\n", (int)sizeof($fpostype));
9024     return(0);
9025 }
9026 EOCP
9027                 set try
9028                 if eval $compile_ok; then
9029                         yyy=`$run ./try`
9030                         dflt="$lseeksize"
9031                         case "$yyy" in
9032                         '')     echo " "
9033                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9034                                 ;;
9035                         *)      fpossize=$yyy
9036                                 echo " $fpossize bytes." >&4
9037                                 ;;
9038                         esac
9039                 else
9040                         dflt="$fpossize"
9041                         echo " "
9042                         echo "(I can't compile the test program.  Guessing...)" >&4
9043                         rp="What is the size of your file positions (in bytes)?"
9044                         . ./myread
9045                         fpossize="$ans"
9046                 fi
9047                 $rm -f try.c try
9048         fi
9049         ;;
9050 esac
9051
9052 case "$vendorprefix" in
9053 '')     d_vendorbin="$undef"
9054         vendorbin=''
9055         vendorbinexp=''
9056         ;;
9057 *)      d_vendorbin="$define"
9058         : determine where vendor-supplied executables go.
9059         case "$vendorbin" in
9060         '') dflt=$vendorprefix/bin ;;
9061         *)      dflt="$vendorbin" ;;
9062         esac
9063         fn=d~+
9064         rp='Pathname for the vendor-supplied executables directory?'
9065         . ./getfile
9066         vendorbin="$ans"
9067         vendorbinexp="$ansexp"
9068         ;;
9069 esac
9070 prefixvar=vendorbin
9071 . ./installprefix
9072
9073 case "$vendorprefix" in
9074 '')     vendorhtml1dir=''
9075         vendorhtml1direxp=''
9076         ;;
9077 *)      : determine where vendor-supplied html pages go.
9078         : There is no standard location, so try to copy the previously-selected
9079         : directory structure for the core html pages.
9080         : XXX Better default suggestions would be welcome.
9081         case "$vendorhtml1dir" in
9082         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9083         *)      dflt=$vendorhtml1dir ;;
9084         esac
9085         case "$dflt" in
9086         ''|' ') dflt=none ;;
9087         esac
9088         fn=dn+~
9089         rp='Pathname for the vendor-supplied html pages?'
9090         . ./getfile
9091         vendorhtml1dir="$ans"
9092         vendorhtml1direxp="$ansexp"
9093         ;;
9094 esac
9095 : Use ' ' for none so value is preserved next time through Configure
9096 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9097 prefixvar=vendorhtml1dir
9098 . ./installprefix
9099
9100 case "$vendorprefix" in
9101 '')     vendorhtml3dir=''
9102         vendorhtml3direxp=''
9103         ;;
9104 *)      : determine where vendor-supplied module html pages go.
9105         : There is no standard location, so try to copy the previously-selected
9106         : directory structure for the core html pages.
9107         : XXX Better default suggestions would be welcome.
9108         case "$vendorhtml3dir" in
9109         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9110         *)      dflt=$vendorhtml3dir ;;
9111         esac
9112         case "$dflt" in
9113         ''|' ') dflt=none ;;
9114         esac
9115         fn=dn+~
9116         rp='Pathname for the vendor-supplied html pages?'
9117         . ./getfile
9118         vendorhtml3dir="$ans"
9119         vendorhtml3direxp="$ansexp"
9120         ;;
9121 esac
9122 : Use ' ' for none so value is preserved next time through Configure
9123 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9124 prefixvar=vendorhtml3dir
9125 . ./installprefix
9126
9127 case "$vendorprefix" in
9128 '')     vendorman1dir=''
9129         vendorman1direxp=''
9130         ;;
9131 *)      : determine where vendor-supplied manual pages go.
9132         case "$vendorman1dir" in
9133         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9134         *)      dflt=$vendorman1dir ;;
9135         esac
9136         case "$dflt" in
9137         ''|' ') dflt=none ;;
9138         esac
9139         fn=nd~+
9140         rp='Pathname for the vendor-supplied manual section 1 pages?'
9141         . ./getfile
9142         vendorman1dir="$ans"
9143         vendorman1direxp="$ansexp"
9144         ;;
9145 esac
9146 : Use ' ' for none so value is preserved next time through Configure
9147 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9148 prefixvar=vendorman1dir
9149 . ./installprefix
9150
9151 case "$vendorprefix" in
9152 '')     vendorman3dir=''
9153         vendorman3direxp=''
9154         ;;
9155 *)      : determine where vendor-supplied module manual pages go.
9156         case "$vendorman3dir" in
9157         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9158         *)      dflt=$vendorman3dir ;;
9159         esac
9160         case "$dflt" in
9161         ''|' ') dflt=none ;;
9162         esac
9163         fn=nd~+
9164         rp='Pathname for the vendor-supplied manual section 3 pages?'
9165         . ./getfile
9166         vendorman3dir="$ans"
9167         vendorman3direxp="$ansexp"
9168         ;;
9169 esac
9170 : Use ' ' for none so value is preserved next time through Configure
9171 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9172 prefixvar=vendorman3dir
9173 . ./installprefix
9174
9175 case "$vendorprefix" in
9176 '')     d_vendorscript="$undef"
9177         vendorscript=''
9178         vendorscriptexp=''
9179         ;;
9180 *)      d_vendorscript="$define"
9181         : determine where vendor-supplied scripts go.
9182         case "$vendorscript" in
9183         '')     dflt=$vendorprefix/script
9184                 $test -d $dflt || dflt=$vendorbin ;;
9185         *)  dflt="$vendorscript" ;;
9186         esac
9187         $cat <<EOM
9188
9189 The installation process will create a directory for
9190 vendor-supplied scripts.
9191
9192 EOM
9193         fn=d~+
9194         rp='Pathname for the vendor-supplied scripts directory?'
9195         . ./getfile
9196         vendorscript="$ans"
9197         vendorscriptexp="$ansexp"
9198         ;;
9199 esac
9200 prefixvar=vendorscript
9201 . ./installprefix
9202
9203 : see if qgcvt exists
9204 set qgcvt d_qgcvt
9205 eval $inlibc
9206
9207 echo " "
9208
9209 if $test X"$d_longdbl" = X"$define"; then
9210
9211 echo "Checking how to print long doubles..." >&4
9212
9213 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9214         $cat >try.c <<'EOCP'
9215 #include <sys/types.h>
9216 #include <stdio.h>
9217 int main() {
9218   double d = 123.456;
9219   printf("%.3f\n", d);
9220 }
9221 EOCP
9222         set try
9223         if eval $compile; then
9224                 yyy=`$run ./try`
9225                 case "$yyy" in
9226                 123.456)
9227                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9228                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9229                         echo "We will use %f."
9230                         ;;
9231                 esac
9232         fi
9233 fi
9234
9235 if $test X"$sPRIfldbl" = X; then
9236         $cat >try.c <<'EOCP'
9237 #include <sys/types.h>
9238 #include <stdio.h>
9239 int main() {
9240   long double d = 123.456;
9241   printf("%.3Lf\n", d);
9242 }
9243 EOCP
9244         set try
9245         if eval $compile; then
9246                 yyy=`$run ./try`
9247                 case "$yyy" in
9248                 123.456)
9249                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9250                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9251                         echo "We will use %Lf."
9252                         ;;
9253                 esac
9254         fi
9255 fi
9256
9257 if $test X"$sPRIfldbl" = X; then
9258         $cat >try.c <<'EOCP'
9259 #include <sys/types.h>
9260 #include <stdio.h>
9261 int main() {
9262   long double d = 123.456;
9263   printf("%.3llf\n", d);
9264 }
9265 EOCP
9266         set try
9267         if eval $compile; then
9268                 yyy=`$run ./try`
9269                 case "$yyy" in
9270                 123.456)
9271                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9272                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9273                         echo "We will use %llf."
9274                         ;;
9275                 esac
9276         fi
9277 fi
9278
9279 if $test X"$sPRIfldbl" = X; then
9280         $cat >try.c <<'EOCP'
9281 #include <sys/types.h>
9282 #include <stdio.h>
9283 int main() {
9284   long double d = 123.456;
9285   printf("%.3lf\n", d);
9286 }
9287 EOCP
9288         set try
9289         if eval $compile; then
9290                 yyy=`$run ./try`
9291                 case "$yyy" in
9292                 123.456)
9293                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9294                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9295                         echo "We will use %lf."
9296                         ;;
9297                 esac
9298         fi
9299 fi
9300
9301 if $test X"$sPRIfldbl" = X; then
9302         echo "Cannot figure out how to print long doubles." >&4
9303 else
9304         sSCNfldbl=$sPRIfldbl    # expect consistency
9305 fi
9306
9307 $rm -f try try.*
9308
9309 fi # d_longdbl
9310
9311 case "$sPRIfldbl" in
9312 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9313         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9314         d_SCNfldbl="$undef";
9315         ;;
9316 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9317         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9318         d_SCNfldbl="$define";
9319         ;;
9320 esac
9321
9322 : Check how to convert floats to strings.
9323
9324 if test "X$d_Gconvert" = X; then
9325
9326 echo " "
9327 echo "Checking for an efficient way to convert floats to strings."
9328 echo " " > try.c
9329 case "$uselongdouble" in
9330 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9331 esac
9332 case "$d_longdbl" in
9333 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9334 esac
9335 case "$d_PRIgldbl" in
9336 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9337 esac
9338 $cat >>try.c <<EOP
9339 #ifdef TRY_gconvert
9340 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9341 char *myname = "gconvert";
9342 #endif
9343 #ifdef TRY_gcvt
9344 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9345 char *myname = "gcvt";
9346 #endif
9347 #ifdef TRY_qgcvt
9348 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9349 char *myname = "qgcvt";
9350 #define DOUBLETYPE long double
9351 #endif
9352 #ifdef TRY_sprintf
9353 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9354 #ifdef HAS_PRIgldbl
9355 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9356 #else
9357 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9358 #endif
9359 #else
9360 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9361 #endif
9362 char *myname = "sprintf";
9363 #endif
9364
9365 #ifndef DOUBLETYPE
9366 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9367 #define DOUBLETYPE long double
9368 #else
9369 #define DOUBLETYPE double
9370 #endif
9371 #endif
9372
9373 #include <stdio.h>
9374
9375 #define I_STDLIB $i_stdlib
9376 #ifdef I_STDLIB
9377 #include <stdlib.h>
9378 #endif
9379
9380 int
9381 checkit(expect, got)
9382 char *expect;
9383 char *got;
9384 {
9385     if (strcmp(expect, got)) {
9386                 printf("%s oddity:  Expected %s, got %s\n",
9387                         myname, expect, got);
9388                 exit(1);
9389         }
9390 }
9391
9392 int main()
9393
9394         char buf[64]; 
9395         buf[63] = '\0';
9396
9397         /* This must be 1st test on (which?) platform */
9398         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9399         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9400         checkit("0.1", buf);
9401
9402         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9403         checkit("0.01", buf);
9404
9405         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9406         checkit("0.001", buf);
9407
9408         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9409         checkit("0.0001", buf);
9410
9411         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9412         if (strlen(buf) > 5)
9413             checkit("9e-005", buf); /* for Microsoft ?? */
9414         else
9415             checkit("9e-05", buf);
9416
9417         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9418         checkit("1", buf);
9419
9420         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9421         checkit("1.1", buf);
9422
9423         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9424         checkit("1.01", buf);
9425
9426         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9427         checkit("1.001", buf);
9428
9429         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9430         checkit("1.0001", buf);
9431
9432         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9433         checkit("1.00001", buf);
9434
9435         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9436         checkit("1.000001", buf);
9437
9438         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9439         checkit("0", buf);
9440
9441         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9442         checkit("-1", buf);
9443
9444         /* Some Linux gcvt's give 1.e+5 here. */
9445         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9446         checkit("100000", buf);
9447         
9448         /* Some Linux gcvt's give -1.e+5 here. */
9449         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9450         checkit("-100000", buf);
9451
9452         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9453         checkit("123.456", buf);
9454
9455         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9456         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9457         /* 34 should be enough to scare even long double
9458          * places into using the e notation. */
9459         if (strlen(buf) > 5)
9460             checkit("1e+034", buf); /* for Microsoft */
9461         else
9462             checkit("1e+34", buf);
9463
9464         /* For Perl, if you add additional tests here, also add them to
9465          * t/base/num.t for benefit of platforms not using Configure or
9466          * overriding d_Gconvert */
9467
9468         exit(0);
9469 }
9470 EOP
9471 : first add preferred functions to our list
9472 xxx_list=""
9473 for xxx_convert in $gconvert_preference; do
9474     case $xxx_convert in
9475     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9476     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9477     esac 
9478 done
9479 : then add any others
9480 for xxx_convert in gconvert gcvt sprintf; do
9481     case "$xxx_list" in
9482     *$xxx_convert*) ;;
9483     *) xxx_list="$xxx_list $xxx_convert" ;;
9484     esac 
9485 done
9486
9487 case "$d_longdbl$uselongdouble" in
9488 "$define$define")
9489     : again, add prefered functions to our list first
9490     xxx_ld_list=""
9491     for xxx_convert in $gconvert_ld_preference; do
9492         case $xxx_convert in
9493         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9494         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9495         esac
9496     done
9497     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9498     for xxx_convert in qgcvt sprintf $xxx_list; do
9499         case "$xxx_ld_list" in
9500         $xxx_convert*|*" $xxx_convert"*) ;;
9501         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9502         esac
9503     done
9504     : if sprintf cannot do long doubles, move it to the end
9505     if test "$d_PRIgldbl" != "$define"; then
9506         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9507     fi
9508     : if no qgcvt, remove it
9509     if test "$d_qgcvt" != "$define"; then
9510         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9511     fi
9512     : use the ld_list
9513     xxx_list="$xxx_ld_list"
9514     ;;
9515 esac
9516
9517 for xxx_convert in $xxx_list; do
9518         echo "Trying $xxx_convert..."
9519         $rm -f try try$_o
9520         set try -DTRY_$xxx_convert
9521         if eval $compile; then
9522                 echo "$xxx_convert() found." >&4
9523                 if $run ./try; then
9524                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9525                         break;
9526                 else
9527                         echo "...But $xxx_convert didn't work as I expected."
9528                         xxx_convert=''
9529                 fi
9530         else
9531                 echo "$xxx_convert NOT found." >&4
9532         fi
9533 done
9534
9535 if test X$xxx_convert = X; then
9536     echo "*** WHOA THERE!!! ***" >&4
9537     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9538     xxx_convert=sprintf
9539 fi
9540
9541 case "$xxx_convert" in
9542 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9543 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9544 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9545 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9546    "$define$define$define")
9547       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9548    "$define$define$undef")
9549       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9550    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9551    esac
9552    ;;  
9553 esac
9554
9555 fi
9556
9557 : see if _fwalk exists
9558 set fwalk d__fwalk
9559 eval $inlibc
9560
9561 : Initialize h_fcntl
9562 h_fcntl=false
9563
9564 : Initialize h_sysfile
9565 h_sysfile=false
9566
9567 : access call always available on UNIX
9568 set access d_access
9569 eval $inlibc
9570
9571 : locate the flags for 'access()'
9572 case "$d_access" in
9573 "$define")
9574         echo " "
9575         $cat >access.c <<EOCP
9576 #include <sys/types.h>
9577 #ifdef I_FCNTL
9578 #include <fcntl.h>
9579 #endif
9580 #ifdef I_SYS_FILE
9581 #include <sys/file.h>
9582 #endif
9583 #ifdef I_UNISTD
9584 #include <unistd.h>
9585 #endif
9586 #$i_stdlib I_STDLIB
9587 #ifdef I_STDLIB
9588 #include <stdlib.h>
9589 #endif
9590 int main() {
9591         exit(R_OK);
9592 }
9593 EOCP
9594         : check sys/file.h first, no particular reason here
9595         if $test `./findhdr sys/file.h` && \
9596                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9597                 h_sysfile=true;
9598                 echo "<sys/file.h> defines the *_OK access constants." >&4
9599         elif $test `./findhdr fcntl.h` && \
9600                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9601                 h_fcntl=true;
9602                 echo "<fcntl.h> defines the *_OK access constants." >&4
9603         elif $test `./findhdr unistd.h` && \
9604                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9605                 echo "<unistd.h> defines the *_OK access constants." >&4
9606         else
9607                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9608         fi
9609         ;;
9610 esac
9611 $rm -f access*
9612
9613 : see if accessx exists
9614 set accessx d_accessx
9615 eval $inlibc
9616
9617 : see if aintl exists
9618 set aintl d_aintl
9619 eval $inlibc
9620
9621 : see if alarm exists
9622 set alarm d_alarm
9623 eval $inlibc
9624
9625 : see if POSIX threads are available
9626 set pthread.h i_pthread
9627 eval $inhdr
9628
9629 : define a fucntion to check prototypes
9630 $cat > protochk <<EOSH
9631 $startsh
9632 cc="$cc"
9633 optimize="$optimize"
9634 ccflags="$ccflags"
9635 prototype="$prototype"
9636 define="$define"
9637 rm=$rm
9638 usethreads=$usethreads
9639 i_pthread=$i_pthread
9640 pthread_h_first=$pthread_h_first
9641 EOSH
9642
9643 $cat >> protochk <<'EOSH'
9644
9645 $rm -f try.c
9646 foo="$1"
9647 shift
9648 while test $# -ge 2; do
9649         case "$1" in
9650                 $define) echo "#include <$2>" >> try.c ;;
9651                 literal) echo "$2" >> try.c ;;
9652         esac
9653     # Extra magic for the benefit of systems that need pthread.h
9654     # to be included early to correctly detect threadsafe functions.
9655     # Such functions must guarantee themselves, though, that the usethreads
9656     # and i_pthread have been defined, before calling protochk.
9657     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9658         echo "#include <pthread.h>" >> try.c
9659         pthread_h_done=yes
9660     fi
9661     shift 2
9662 done
9663 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9664 cat >> try.c <<'EOCP'
9665 #ifdef CAN_PROTOTYPE
9666 #define _(args) args
9667 #else
9668 #define _(args) ()
9669 #endif
9670 EOCP
9671 echo "$foo" >> try.c
9672 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9673 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9674 status=$?
9675 $rm -f try.[co]
9676 exit $status
9677 EOSH
9678 chmod +x protochk
9679 $eunicefix protochk
9680
9681 hasproto='varname=$1; func=$2; shift; shift;
9682 while $test $# -ge 2; do
9683         case "$1" in
9684         $define) echo "#include <$2>";;
9685         esac ;
9686     shift 2;
9687 done > try.c;
9688 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9689 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9690         echo "$func() prototype found.";
9691         val="$define";
9692 else
9693         echo "$func() prototype NOT found.";
9694         val="$undef";
9695 fi;
9696 set $varname;
9697 eval $setvar;
9698 $rm -f try.c tryout.c'
9699
9700 : see if sys/types.h has to be included
9701 set sys/types.h i_systypes
9702 eval $inhdr
9703
9704 : see if sys/select.h has to be included
9705 set sys/select.h i_sysselct
9706 eval $inhdr
9707
9708 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9709 while $test $# -ge 2; do
9710         case "$1" in
9711         $define) echo "#include <$2>";;
9712         esac ;
9713     shift 2;
9714 done > try.c;
9715 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9716 set try;
9717 if eval $compile; then
9718         val="$define";
9719 else
9720         val="$undef";
9721 fi;
9722 set $varname;
9723 eval $setvar;
9724 $rm -f try.c try.o'
9725
9726 : see if we should include time.h, sys/time.h, or both
9727 echo " "
9728 if test "X$timeincl" = X; then
9729         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9730         $echo $n "I'm now running the test program...$c"
9731         $cat >try.c <<EOCP
9732 #include <sys/types.h>
9733 #ifdef I_TIME
9734 #include <time.h>
9735 #endif
9736 #ifdef I_SYSTIME
9737 #ifdef SYSTIMEKERNEL
9738 #define KERNEL
9739 #endif
9740 #include <sys/time.h>
9741 #endif
9742 #ifdef I_SYSSELECT
9743 #include <sys/select.h>
9744 #endif
9745 #$i_stdlib I_STDLIB
9746 #ifdef I_STDLIB
9747 #include <stdlib.h>
9748 #endif
9749 int main()
9750 {
9751         struct tm foo;
9752 #ifdef S_TIMEVAL
9753         struct timeval bar;
9754 #endif
9755 #ifdef S_TIMEZONE
9756         struct timezone tzp;
9757 #endif
9758         if (foo.tm_sec == foo.tm_sec)
9759                 exit(0);
9760 #ifdef S_TIMEVAL
9761         if (bar.tv_sec == bar.tv_sec)
9762                 exit(0);
9763 #endif
9764         exit(1);
9765 }
9766 EOCP
9767         flags=''
9768         for s_timezone in '-DS_TIMEZONE' ''; do
9769         sysselect=''
9770         for s_timeval in '-DS_TIMEVAL' ''; do
9771         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9772         for i_time in '' '-DI_TIME'; do
9773         for i_systime in '-DI_SYSTIME' ''; do
9774                 case "$flags" in
9775                 '') $echo $n ".$c"
9776                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9777                         if eval $compile; then
9778                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9779                                 shift
9780                                 flags="$*"
9781                                 echo " "
9782                                 $echo $n "Succeeded with $flags$c"
9783                         fi
9784                         ;;
9785                 esac
9786         done
9787         done
9788         done
9789         done
9790         done
9791         timeincl=''
9792         echo " "
9793         case "$flags" in
9794         *SYSTIMEKERNEL*) i_systimek="$define"
9795                 timeincl=`./findhdr sys/time.h`
9796                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9797         *) i_systimek="$undef";;
9798         esac
9799         case "$flags" in
9800         *I_TIME*) i_time="$define"
9801                 timeincl=`./findhdr time.h`" $timeincl"
9802                 echo "We'll include <time.h>." >&4;;
9803         *) i_time="$undef";;
9804         esac
9805         case "$flags" in
9806         *I_SYSTIME*) i_systime="$define"
9807                 timeincl=`./findhdr sys/time.h`" $timeincl"
9808                 echo "We'll include <sys/time.h>." >&4;;
9809         *) i_systime="$undef";;
9810         esac
9811         $rm -f try.c try
9812 fi
9813 : see if struct tm knows about tm_zone
9814 case "$i_systime$i_time" in
9815 *$define*) 
9816         echo " "
9817         echo "Checking to see if your struct tm has tm_zone field..." >&4
9818         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9819         eval $hasfield
9820         ;;
9821 *)      val="$undef"
9822         set d_tm_tm_zone
9823         eval $setvar
9824         ;;
9825 esac
9826 case "$d_tm_tm_zone" in
9827 "$define")      echo "Yes, it does."   ;;
9828 *)              echo "No, it doesn't." ;;
9829 esac
9830 : see if struct tm knows about tm_gmtoff
9831 case "$i_systime$i_time" in
9832 *$define*) 
9833         echo " "
9834         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9835         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9836         eval $hasfield
9837         ;;
9838 *)      val="$undef"
9839         set d_tm_tm_gmtoff
9840         eval $setvar
9841         ;;
9842 esac
9843 case "$d_tm_tm_gmtoff" in
9844 "$define")      echo "Yes, it does."   ;;
9845 *)              echo "No, it doesn't." ;;
9846 esac
9847
9848 : see if asctime_r exists
9849 set asctime_r d_asctime_r
9850 eval $inlibc
9851 case "$d_asctime_r" in
9852 "$define")
9853         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9854         case "$d_asctime_r_proto:$usethreads" in
9855         ":define")      d_asctime_r_proto=define
9856                 set d_asctime_r_proto asctime_r $hdrs
9857                 eval $hasproto ;;
9858         *)      ;;
9859         esac
9860         case "$d_asctime_r_proto" in
9861         define)
9862         case "$asctime_r_proto" in
9863         ''|0) try='char* asctime_r(const struct tm*, char*);'
9864         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9865         esac
9866         case "$asctime_r_proto" in
9867         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9868         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9869         esac
9870         case "$asctime_r_proto" in
9871         ''|0) try='int asctime_r(const struct tm*, char*);'
9872         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9873         esac
9874         case "$asctime_r_proto" in
9875         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9876         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9877         esac
9878         case "$asctime_r_proto" in
9879         ''|0)   d_asctime_r=undef
9880                 asctime_r_proto=0
9881                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9882         * )     case "$asctime_r_proto" in
9883                 REENTRANT_PROTO*) ;;
9884                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9885                 esac
9886                 echo "Prototype: $try" ;;
9887         esac
9888         ;;
9889         *)      case "$usethreads" in
9890                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9891                 esac
9892                 d_asctime_r=undef
9893                 asctime_r_proto=0
9894                 ;;
9895         esac
9896         ;;
9897 *)      asctime_r_proto=0
9898         ;;
9899 esac
9900
9901 : see if atolf exists
9902 set atolf d_atolf
9903 eval $inlibc
9904
9905 : see if atoll exists
9906 set atoll d_atoll
9907 eval $inlibc
9908
9909 : Look for GCC-style attribute format
9910 case "$d_attribute_format" in
9911 '')
9912 echo " "
9913 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9914 $cat >attrib.c <<'EOCP'
9915 #include <stdio.h>
9916 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9917 EOCP
9918 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9919         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9920                 echo "Your C compiler doesn't support __attribute__((format))."
9921                 val="$undef"
9922         else
9923                 echo "Your C compiler supports __attribute__((format))."
9924                 val="$define"
9925         fi
9926 else
9927         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9928         val="$undef"
9929 fi
9930 ;;
9931 *) val="$d_attribute_format" ;;
9932 esac
9933 set d_attribute_format
9934 eval $setvar
9935 $rm -f attrib*
9936
9937 : Look for GCC-style attribute malloc
9938 case "$d_attribute_malloc" in
9939 '')
9940 echo " "
9941 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9942 $cat >attrib.c <<'EOCP'
9943 #include <stdio.h>
9944 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9945 EOCP
9946 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9947         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9948                 echo "Your C compiler doesn't support __attribute__((malloc))."
9949                 val="$undef"
9950         else
9951                 echo "Your C compiler supports __attribute__((malloc))."
9952                 val="$define"
9953         fi
9954 else
9955         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9956         val="$undef"
9957 fi
9958 ;;
9959 *) val="$d_attribute_malloc" ;;
9960 esac
9961 set d_attribute_malloc
9962 eval $setvar
9963 $rm -f attrib*
9964
9965 : Look for GCC-style attribute nonnull
9966 case "$d_attribute_nonnull" in
9967 '')
9968 echo " "
9969 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9970 $cat >attrib.c <<'EOCP'
9971 #include <stdio.h>
9972 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9973 EOCP
9974 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9975         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9976                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9977                 val="$undef"
9978         else
9979                 echo "Your C compiler supports __attribute__((nonnull))."
9980                 val="$define"
9981         fi
9982 else
9983         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9984         val="$undef"
9985 fi
9986 ;;
9987 *) val="$d_attribute_nonnull" ;;
9988 esac
9989 set d_attribute_nonnull
9990 eval $setvar
9991 $rm -f attrib*
9992
9993 : Look for GCC-style attribute noreturn
9994 case "$d_attribute_noreturn" in
9995 '')
9996 echo " "
9997 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9998 $cat >attrib.c <<'EOCP'
9999 #include <stdio.h>
10000 void fall_over_dead( void ) __attribute__((noreturn));
10001 EOCP
10002 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10003         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10004                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10005                 val="$undef"
10006         else
10007                 echo "Your C compiler supports __attribute__((noreturn))."
10008                 val="$define"
10009         fi
10010 else
10011         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10012         val="$undef"
10013 fi
10014 ;;
10015 *) val="$d_attribute_noreturn" ;;
10016 esac
10017 set d_attribute_noreturn
10018 eval $setvar
10019 $rm -f attrib*
10020
10021 : Look for GCC-style attribute pure
10022 case "$d_attribute_pure" in
10023 '')
10024 echo " "
10025 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10026 $cat >attrib.c <<'EOCP'
10027 #include <stdio.h>
10028 int square( int n ) __attribute__((pure));
10029 EOCP
10030 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10031         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10032                 echo "Your C compiler doesn't support __attribute__((pure))."
10033                 val="$undef"
10034         else
10035                 echo "Your C compiler supports __attribute__((pure))."
10036                 val="$define"
10037         fi
10038 else
10039         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10040         val="$undef"
10041 fi
10042 ;;
10043 *) val="$d_attribute_pure" ;;
10044 esac
10045 set d_attribute_pure
10046 eval $setvar
10047 $rm -f attrib*
10048
10049 : Look for GCC-style attribute unused
10050 case "$d_attribute_unused" in
10051 '')
10052 echo " "
10053 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10054 $cat >attrib.c <<'EOCP'
10055 #include <stdio.h>
10056 int do_something( int dummy __attribute__((unused)), int n );
10057 EOCP
10058 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10059         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10060                 echo "Your C compiler doesn't support __attribute__((unused))."
10061                 val="$undef"
10062         else
10063                 echo "Your C compiler supports __attribute__((unused))."
10064                 val="$define"
10065         fi
10066 else
10067         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10068         val="$undef"
10069 fi
10070 ;;
10071 *) val="$d_attribute_unused" ;;
10072 esac
10073 set d_attribute_unused
10074 eval $setvar
10075 $rm -f attrib*
10076
10077 : Look for GCC-style attribute warn_unused_result
10078 case "$d_attribute_warn_unused_result" in
10079 '')
10080 echo " "
10081 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10082 $cat >attrib.c <<'EOCP'
10083 #include <stdio.h>
10084 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10085 EOCP
10086 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10087         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10088                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10089                 val="$undef"
10090         else
10091                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10092                 val="$define"
10093         fi
10094 else
10095         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10096         val="$undef"
10097 fi
10098 ;;
10099 *) val="$d_attribute_warn_unused_result" ;;
10100 esac
10101 set d_attribute_warn_unused_result
10102 eval $setvar
10103 $rm -f attrib*
10104
10105 : see if bcmp exists
10106 set bcmp d_bcmp
10107 eval $inlibc
10108
10109 : see if bcopy exists
10110 set bcopy d_bcopy
10111 eval $inlibc
10112
10113 : see if getpgrp exists
10114 set getpgrp d_getpgrp
10115 eval $inlibc
10116
10117 case "$d_getpgrp" in
10118 "$define")
10119         echo " "
10120         echo "Checking to see which flavor of getpgrp is in use..."
10121         $cat >try.c <<EOP
10122 #$i_unistd I_UNISTD
10123 #include <sys/types.h>
10124 #ifdef I_UNISTD
10125 #  include <unistd.h>
10126 #endif
10127 #$i_stdlib I_STDLIB
10128 #ifdef I_STDLIB
10129 #include <stdlib.h>
10130 #endif
10131 int main()
10132 {
10133         if (getuid() == 0) {
10134                 printf("(I see you are running Configure as super-user...)\n");
10135                 setuid(1);
10136         }
10137 #ifdef TRY_BSD_PGRP
10138         if (getpgrp(1) == 0)
10139                 exit(0);
10140 #else
10141         if (getpgrp() > 0)
10142                 exit(0);
10143 #endif
10144         exit(1);
10145 }
10146 EOP
10147         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10148                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10149                 val="$define"
10150         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10151                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10152                 val="$undef"
10153         else
10154                 echo "I can't seem to compile and run the test program."
10155                 if ./usg; then
10156                         xxx="a USG one, i.e. you use getpgrp()."
10157                 else
10158                         # SVR4 systems can appear rather BSD-ish.
10159                         case "$i_unistd" in
10160                         $undef)
10161                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10162                                 val="$define"
10163                                 ;;
10164                         $define)
10165                                 xxx="probably a USG one, i.e. you use getpgrp()."
10166                                 val="$undef"
10167                                 ;;
10168                         esac
10169                 fi
10170                 echo "Assuming your getpgrp is $xxx" >&4
10171         fi
10172         ;;
10173 *) val="$undef";;
10174 esac
10175 set d_bsdgetpgrp
10176 eval $setvar
10177 $rm -f try try.*
10178
10179 : see if setpgrp exists
10180 set setpgrp d_setpgrp
10181 eval $inlibc
10182
10183 case "$d_setpgrp" in
10184 "$define")
10185         echo " "
10186         echo "Checking to see which flavor of setpgrp is in use..."
10187         $cat >try.c <<EOP
10188 #$i_unistd I_UNISTD
10189 #include <sys/types.h>
10190 #ifdef I_UNISTD
10191 #  include <unistd.h>
10192 #endif
10193 #$i_stdlib I_STDLIB
10194 #ifdef I_STDLIB
10195 #include <stdlib.h>
10196 #endif
10197 int main()
10198 {
10199         if (getuid() == 0) {
10200                 printf("(I see you are running Configure as super-user...)\n");
10201                 setuid(1);
10202         }
10203 #ifdef TRY_BSD_PGRP
10204         if (-1 == setpgrp(1, 1))
10205                 exit(0);
10206 #else
10207         if (setpgrp() != -1)
10208                 exit(0);
10209 #endif
10210         exit(1);
10211 }
10212 EOP
10213         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10214                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10215                 val="$define"
10216         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10217                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10218                 val="$undef"
10219         else
10220                 echo "(I can't seem to compile and run the test program.)"
10221                 if ./usg; then
10222                         xxx="a USG one, i.e. you use setpgrp()."
10223                 else
10224                         # SVR4 systems can appear rather BSD-ish.
10225                         case "$i_unistd" in
10226                         $undef)
10227                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10228                                 val="$define"
10229                                 ;;
10230                         $define)
10231                                 xxx="probably a USG one, i.e. you use setpgrp()."
10232                                 val="$undef"
10233                                 ;;
10234                         esac
10235                 fi
10236                 echo "Assuming your setpgrp is $xxx" >&4
10237         fi
10238         ;;
10239 *) val="$undef";;
10240 esac
10241 set d_bsdsetpgrp
10242 eval $setvar
10243 $rm -f try try.*
10244 : Look for GCC-style __builtin_choose_expr
10245 case "$d_builtin_choose_expr" in
10246 '')
10247     echo " "
10248     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10249     $cat >try.c <<'EOCP'
10250 #include <assert.h>
10251 #include <stdlib.h>
10252 #include <stdio.h>
10253
10254 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10255
10256 int main(void) {
10257     assert( SYRINX(1) == 2112 );
10258     assert( SYRINX(1) != 5150 );
10259     assert( SYRINX(0) == 5150 );
10260     assert( SYRINX(0) != 2112 );
10261     puts( "All good!" );
10262     exit(0);
10263 }
10264
10265 EOCP
10266     set try
10267     if eval $compile; then
10268         echo "Your C compiler supports __builtin_choose_expr."
10269         val="$define"
10270     else
10271         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10272         val="$undef"
10273     fi
10274 ;;
10275 *) val="$d_builtin_choose_expr" ;;
10276 esac
10277
10278 set d_builtin_choose_expr
10279 eval $setvar
10280 $rm -f try.* try core core.try.*
10281
10282 : Look for GCC-style __builtin_expect
10283 case "$d_builtin_expect" in
10284 '')
10285     echo " "
10286     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10287     $cat >builtin.c <<'EOCP'
10288 int main(void) {
10289     int n = 50;
10290     if ( __builtin_expect(n, 0) ) n = 1;
10291 }
10292 EOCP
10293     set try
10294     if eval $compile; then
10295         echo "Your C compiler supports __builtin_choose_expr."
10296         val="$define"
10297     else
10298         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10299         val="$undef"
10300     fi
10301     ;;
10302 *) val="$d_builtin_expect" ;;
10303 esac
10304
10305 set d_builtin_expect
10306 eval $setvar
10307 $rm -f try.* try core core.try.*
10308
10309 : see if bzero exists
10310 set bzero d_bzero
10311 eval $inlibc
10312
10313 : see if stdarg is available
10314 echo " "
10315 if $test `./findhdr stdarg.h`; then
10316         echo "<stdarg.h> found." >&4
10317         valstd="$define"
10318 else
10319         echo "<stdarg.h> NOT found." >&4
10320         valstd="$undef"
10321 fi
10322
10323 : see if varags is available
10324 echo " "
10325 if $test `./findhdr varargs.h`; then
10326         echo "<varargs.h> found." >&4
10327 else
10328         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10329 fi
10330
10331 : set up the varargs testing programs
10332 $cat > varargs.c <<EOP
10333 #ifdef I_STDARG
10334 #include <stdarg.h>
10335 #endif
10336 #ifdef I_VARARGS
10337 #include <varargs.h>
10338 #endif
10339
10340 #ifdef I_STDARG
10341 int f(char *p, ...)
10342 #else
10343 int f(va_alist)
10344 va_dcl
10345 #endif
10346 {
10347         va_list ap;
10348 #ifndef I_STDARG
10349         char *p;
10350 #endif
10351 #ifdef I_STDARG
10352         va_start(ap,p);
10353 #else
10354         va_start(ap);
10355         p = va_arg(ap, char *);
10356 #endif
10357         va_end(ap);
10358         return 0;
10359 }
10360 EOP
10361 $cat > varargs <<EOP
10362 $startsh
10363 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10364         echo "true"
10365 else
10366         echo "false"
10367 fi
10368 $rm -f varargs$_o
10369 EOP
10370 chmod +x varargs
10371
10372 : now check which varargs header should be included
10373 echo " "
10374 i_varhdr=''
10375 case "$valstd" in
10376 "$define")
10377         if `./varargs I_STDARG`; then
10378                 val='stdarg.h'
10379         elif `./varargs I_VARARGS`; then
10380                 val='varargs.h'
10381         fi
10382         ;;
10383 *)
10384         if `./varargs I_VARARGS`; then
10385                 val='varargs.h'
10386         fi
10387         ;;
10388 esac
10389 case "$val" in
10390 '')
10391 echo "I could not find the definition for va_dcl... You have problems..." >&4
10392         val="$undef"; set i_stdarg; eval $setvar
10393         val="$undef"; set i_varargs; eval $setvar
10394         ;;
10395 *) 
10396         set i_varhdr
10397         eval $setvar
10398         case "$i_varhdr" in
10399         stdarg.h)
10400                 val="$define"; set i_stdarg; eval $setvar
10401                 val="$undef"; set i_varargs; eval $setvar
10402                 ;;
10403         varargs.h)
10404                 val="$undef"; set i_stdarg; eval $setvar
10405                 val="$define"; set i_varargs; eval $setvar
10406                 ;;
10407         esac
10408         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10409 esac
10410 $rm -f varargs*
10411
10412 : see if the Compiler supports C99 variadic macros
10413 case "$i_stdarg$i_stdlib" in
10414     "$define$define")
10415     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10416     $cat >try.c <<EOCP
10417 #include <stdio.h>
10418 #include <stdarg.h>
10419
10420 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10421
10422 int main() {
10423   char buf[20];
10424   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10425   puts(buf);
10426   return 0;
10427 }
10428 EOCP
10429     set try
10430     if eval $compile && $run ./try 2>&1 >/dev/null; then
10431         case "`$run ./try`" in
10432             "123 456 789")
10433             echo "You have C99 variadic macros." >&4
10434             d_c99_variadic_macros="$define"
10435             ;;
10436             *)
10437             echo "You don't have functional C99 variadic macros." >&4
10438             d_c99_variadic_macros="$undef"
10439             ;;
10440         esac
10441     else
10442         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10443         d_c99_variadic_macros="$undef"
10444     fi
10445     $rm -f try.* try core core.try.*
10446     ;;
10447     *)
10448     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10449     d_c99_variadic_macros="$undef"
10450     ;;
10451 esac
10452
10453 : see if signal is declared as pointer to function returning int or void
10454 echo " "
10455 xxx=`./findhdr signal.h`
10456 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10457 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10458         echo "You have int (*signal())() instead of void." >&4
10459         val="$undef"
10460 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10461         echo "You have void (*signal())()." >&4
10462         val="$define"
10463 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10464         echo "You have int (*signal())() instead of void." >&4
10465         val="$undef"
10466 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10467         echo "You have void (*signal())()." >&4
10468         val="$define"
10469 else
10470         case "$d_voidsig" in
10471         '')
10472         echo "I can't determine whether signal handler returns void or int..." >&4
10473                 dflt=void
10474                 rp="What type does your signal handler return?"
10475                 . ./myread
10476                 case "$ans" in
10477                 v*) val="$define";;
10478                 *) val="$undef";;
10479                 esac;;
10480         "$define")
10481                 echo "As you already told me, signal handler returns void." >&4
10482                 val="$define"
10483                 ;;
10484         *)      echo "As you already told me, signal handler returns int." >&4
10485                 val="$undef"
10486                 ;;
10487         esac
10488 fi
10489 set d_voidsig
10490 eval $setvar
10491 case "$d_voidsig" in
10492 "$define") signal_t="void";;
10493 *) signal_t="int";;
10494 esac
10495 $rm -f $$.tmp
10496
10497 : check for ability to cast large floats to 32-bit ints.
10498 echo " "
10499 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10500 if $test "$intsize" -ge 4; then
10501         xxx=int
10502 else
10503         xxx=long
10504 fi
10505 $cat >try.c <<EOCP
10506 #include <stdio.h>
10507 #$i_stdlib I_STDLIB
10508 #ifdef I_STDLIB
10509 #include <stdlib.h>
10510 #endif
10511 #include <sys/types.h>
10512 #include <signal.h>
10513 $signal_t blech(int s) { exit(3); }
10514 int main()
10515 {
10516         $xxx i32;
10517         double f, g;
10518         int result = 0;
10519         char str[16];
10520         signal(SIGFPE, blech);
10521
10522         /* Don't let compiler optimize the test away.  Store the number 
10523            in a writable string for gcc to pass to sscanf under HP/UX.
10524         */
10525         sprintf(str, "2147483647");
10526         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10527         g = 10 * f;
10528         i32  = ($xxx) g;
10529
10530         /* x86 processors will probably give 0x8000 0000, which is a
10531            sign change.  We don't want that.  We want to mimic SPARC
10532            behavior here, which is to preserve the sign and give
10533            back 0x7fff ffff.
10534         */
10535         if (i32 != ($xxx) f)
10536                 result |= 1;
10537         exit(result);
10538 }
10539 EOCP
10540 set try
10541 if eval $compile_ok; then
10542         $run ./try
10543         yyy=$?
10544 else
10545         echo "(I can't seem to compile the test program--assuming it can't)"
10546         yyy=1
10547 fi
10548 case "$yyy" in
10549 0)      val="$define"
10550         echo "Yup, it can."
10551         ;;
10552 *)      val="$undef"
10553         echo "Nope, it can't."
10554         ;;
10555 esac
10556 set d_casti32
10557 eval $setvar
10558 $rm -f try try.*
10559
10560 : check for ability to cast negative floats to unsigned
10561 echo " "
10562 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10563 $cat >try.c <<EOCP
10564 #include <stdio.h>
10565 #$i_stdlib I_STDLIB
10566 #ifdef I_STDLIB
10567 #include <stdlib.h>
10568 #endif
10569 #include <sys/types.h>
10570 #include <signal.h>
10571 $signal_t blech(int s) { exit(7); }
10572 $signal_t blech_in_list(int s) { exit(4); }
10573 unsigned long dummy_long(unsigned long p) { return p; }
10574 unsigned int dummy_int(unsigned int p) { return p; }
10575 unsigned short dummy_short(unsigned short p) { return p; }
10576 int main()
10577 {
10578         double f;
10579         unsigned long along;
10580         unsigned int aint;
10581         unsigned short ashort;
10582         int result = 0;
10583         char str[16];
10584         
10585         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10586            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10587            optimized the whole file away
10588         */
10589         /* Store the number in a writable string for gcc to pass to 
10590            sscanf under HP/UX.
10591         */
10592         sprintf(str, "-123");
10593         sscanf(str, "%lf", &f);  /* f = -123.; */
10594
10595         signal(SIGFPE, blech);
10596         along = (unsigned long)f;
10597         aint = (unsigned int)f;
10598         ashort = (unsigned short)f;
10599         if (along != (unsigned long)-123)
10600                 result |= 1;
10601         if (aint != (unsigned int)-123)
10602                 result |= 1;
10603         if (ashort != (unsigned short)-123)
10604                 result |= 1;
10605         sprintf(str, "1073741824.");
10606         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10607         f = f + f;
10608         along = 0;
10609         along = (unsigned long)f;
10610         if (along != 0x80000000)
10611                 result |= 2;
10612         f -= 1.;
10613         along = 0;
10614         along = (unsigned long)f;
10615         if (along != 0x7fffffff)
10616                 result |= 1;
10617         f += 2.;
10618         along = 0;
10619         along = (unsigned long)f;
10620         if (along != 0x80000001)
10621                 result |= 2;
10622         if (result)
10623                 exit(result);
10624         signal(SIGFPE, blech_in_list);
10625         sprintf(str, "123.");
10626         sscanf(str, "%lf", &f);  /* f = 123.; */
10627         along = dummy_long((unsigned long)f);
10628         aint = dummy_int((unsigned int)f);
10629         ashort = dummy_short((unsigned short)f);
10630         if (along != (unsigned long)123)
10631                 result |= 4;
10632         if (aint != (unsigned int)123)
10633                 result |= 4;
10634         if (ashort != (unsigned short)123)
10635                 result |= 4;
10636         exit(result);
10637
10638 }
10639 EOCP
10640 set try
10641 if eval $compile_ok; then
10642         $run ./try
10643         castflags=$?
10644 else
10645         echo "(I can't seem to compile the test program--assuming it can't)"
10646         castflags=7
10647 fi
10648 case "$castflags" in
10649 0)      val="$define"
10650         echo "Yup, it can."
10651         ;;
10652 *)      val="$undef"
10653         echo "Nope, it can't."
10654         ;;
10655 esac
10656 set d_castneg
10657 eval $setvar
10658 $rm -f try.*
10659
10660 : see if vprintf exists
10661 echo " "
10662 if set vprintf val -f d_vprintf; eval $csym; $val; then
10663         echo 'vprintf() found.' >&4
10664         val="$define"
10665         $cat >try.c <<EOF
10666 #include <varargs.h>
10667 #$i_stdlib I_STDLIB
10668 #ifdef I_STDLIB
10669 #include <stdlib.h>
10670 #endif
10671
10672 int main() { xxx("foo"); }
10673
10674 xxx(va_alist)
10675 va_dcl
10676 {
10677         va_list args;
10678         char buf[10];
10679
10680         va_start(args);
10681         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10682 }
10683 EOF
10684         set try
10685         if eval $compile && $run ./try; then
10686                 echo "Your vsprintf() returns (int)." >&4
10687                 val2="$undef"
10688         else
10689                 echo "Your vsprintf() returns (char*)." >&4
10690                 val2="$define"
10691         fi
10692 else
10693         echo 'vprintf() NOT found.' >&4
10694                 val="$undef"
10695                 val2="$undef"
10696 fi
10697 $rm -f try try.*
10698 set d_vprintf
10699 eval $setvar
10700 val=$val2
10701 set d_charvspr
10702 eval $setvar
10703
10704 : see if chown exists
10705 set chown d_chown
10706 eval $inlibc
10707
10708 : see if chroot exists
10709 set chroot d_chroot
10710 eval $inlibc
10711
10712 : see if chsize exists
10713 set chsize d_chsize
10714 eval $inlibc
10715
10716 : see if class exists
10717 set class d_class
10718 eval $inlibc
10719
10720 : see if clearenv exists
10721 set clearenv d_clearenv
10722 eval $inlibc
10723
10724 hasstruct='varname=$1; struct=$2; shift; shift;
10725 while $test $# -ge 2; do
10726         case "$1" in
10727         $define) echo "#include <$2>";;
10728         esac ;
10729     shift 2;
10730 done > try.c;
10731 echo "int main () { struct $struct foo; }" >> try.c;
10732 set try;
10733 if eval $compile; then
10734         val="$define";
10735 else
10736         val="$undef";
10737 fi;
10738 set $varname;
10739 eval $setvar;
10740 $rm -f try.c try.o'
10741
10742 socketlib=''
10743 sockethdr=''
10744 : see whether socket exists
10745 echo " "
10746 $echo $n "Hmm... $c" >&4
10747 if set socket val -f d_socket; eval $csym; $val; then
10748         echo "Looks like you have Berkeley networking support." >&4
10749         d_socket="$define"
10750         if set setsockopt val -f; eval $csym; $val; then
10751                 d_oldsock="$undef"
10752         else
10753                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10754                 d_oldsock="$define"
10755         fi
10756 else
10757         if $contains socklib libc.list >/dev/null 2>&1; then
10758                 echo "Looks like you have Berkeley networking support." >&4
10759                 d_socket="$define"
10760                 : we will have to assume that it supports the 4.2 BSD interface
10761                 d_oldsock="$undef"
10762         else
10763                 echo "You don't have Berkeley networking in libc$_a..." >&4
10764                 if test "X$d_socket" = "X$define"; then
10765                    echo "...but you seem to believe that you have sockets." >&4
10766                 else
10767                         for net in net socket
10768                         do
10769                                 if test -f /usr/lib/lib$net$_a; then
10770                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10771                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10772                                         if $contains socket libc.list >/dev/null 2>&1; then
10773                                                 d_socket="$define"
10774                                                 socketlib="-l$net"
10775                                                 case "$net" in
10776                                                 net)
10777                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10778                                                         sockethdr="-I/usr/netinclude"
10779                                                         ;;
10780                                                 esac
10781                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10782                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10783                                                         d_oldsock="$undef"
10784                                                 else
10785                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10786                                                         d_oldsock="$define"
10787                                                 fi
10788                                                 break
10789                                         fi
10790                                 fi
10791                         done
10792                         if test "X$d_socket" != "X$define"; then
10793                            echo "or anywhere else I see." >&4
10794                            d_socket="$undef"
10795                            d_oldsock="$undef"
10796                         fi
10797                 fi
10798         fi
10799 fi
10800
10801 : see if socketpair exists
10802 set socketpair d_sockpair
10803 eval $inlibc
10804
10805
10806 echo " "
10807 echo "Checking the availability of certain socket constants..." >&4
10808 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10809         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10810         $cat >try.c <<EOF
10811 #include <sys/types.h>
10812 #include <sys/socket.h>
10813 int main() {
10814     int i = $ENUM;
10815 }
10816 EOF
10817         val="$undef"
10818         set try; if eval $compile; then
10819                 val="$define"
10820         fi
10821         set d_${enum}; eval $setvar
10822         $rm -f try.c try
10823 done
10824
10825 : see if this is a sys/uio.h system
10826 set sys/uio.h i_sysuio
10827 eval $inhdr
10828
10829
10830 echo " "
10831 echo "Checking to see if your system supports struct cmsghdr..." >&4
10832 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10833 eval $hasstruct
10834 case "$d_cmsghdr_s" in
10835 "$define")      echo "Yes, it does."   ;;
10836 *)              echo "No, it doesn't." ;;
10837 esac
10838
10839
10840 : check for const keyword
10841 echo " "
10842 echo 'Checking to see if your C compiler knows about "const"...' >&4
10843 $cat >const.c <<'EOCP'
10844 typedef struct spug { int drokk; } spug;
10845 int main()
10846 {
10847         const char *foo;
10848         const spug y;
10849 }
10850 EOCP
10851 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10852         val="$define"
10853         echo "Yup, it does."
10854 else
10855         val="$undef"
10856         echo "Nope, it doesn't."
10857 fi
10858 set d_const
10859 eval $setvar
10860
10861 : see if copysignl exists
10862 set copysignl d_copysignl
10863 eval $inlibc
10864
10865 : see if crypt exists
10866 echo " "
10867 set crypt d_crypt
10868 eval $inlibc
10869 case "$d_crypt" in
10870 $define) cryptlib='' ;;
10871 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10872                 echo 'crypt() found.' >&4
10873                 val="$define"
10874                 cryptlib=''
10875         else
10876                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10877                 if $test -z "$cryptlib"; then
10878                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10879                 else
10880                         cryptlib=-lcrypt
10881                 fi
10882                 if $test -z "$cryptlib"; then
10883                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10884                 else
10885                         cryptlib=-lcrypt
10886                 fi
10887                 if $test -z "$cryptlib"; then
10888                         cryptlib=`./loc libcrypt$_a "" $libpth`
10889                 else
10890                         cryptlib=-lcrypt
10891                 fi
10892                 if $test -z "$cryptlib"; then
10893                         echo 'crypt() NOT found.' >&4
10894                         val="$undef"
10895                 else
10896                         val="$define"
10897                 fi
10898         fi
10899         set d_crypt
10900         eval $setvar
10901         ;;
10902 esac
10903
10904 : see if this is a crypt.h system
10905 set crypt.h i_crypt
10906 eval $inhdr
10907
10908 : see if crypt_r exists
10909 set crypt_r d_crypt_r
10910 eval $inlibc
10911 case "$d_crypt_r" in
10912 "$define")
10913         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10914         case "$d_crypt_r_proto:$usethreads" in
10915         ":define")      d_crypt_r_proto=define
10916                 set d_crypt_r_proto crypt_r $hdrs
10917                 eval $hasproto ;;
10918         *)      ;;
10919         esac
10920         case "$d_crypt_r_proto" in
10921         define)
10922         case "$crypt_r_proto" in
10923         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10924         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10925         esac
10926         case "$crypt_r_proto" in
10927         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10928         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10929         esac
10930         case "$crypt_r_proto" in
10931         ''|0)   d_crypt_r=undef
10932                 crypt_r_proto=0
10933                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10934         * )     case "$crypt_r_proto" in
10935                 REENTRANT_PROTO*) ;;
10936                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10937                 esac
10938                 echo "Prototype: $try" ;;
10939         esac
10940         ;;
10941         *)      case "$usethreads" in
10942                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10943                 esac
10944                 d_crypt_r=undef
10945                 crypt_r_proto=0
10946                 ;;
10947         esac
10948         ;;
10949 *)      crypt_r_proto=0
10950         ;;
10951 esac
10952
10953 : get csh whereabouts
10954 case "$csh" in
10955 'csh') val="$undef" ;;
10956 *) val="$define" ;;
10957 esac
10958 set d_csh
10959 eval $setvar
10960 : Respect a hint or command line value for full_csh.
10961 case "$full_csh" in
10962 '') full_csh=$csh ;;
10963 esac
10964
10965 : see if ctermid_r exists
10966 set ctermid_r d_ctermid_r
10967 eval $inlibc
10968 case "$d_ctermid_r" in
10969 "$define")
10970         hdrs="$i_systypes sys/types.h define stdio.h "
10971         case "$d_ctermid_r_proto:$usethreads" in
10972         ":define")      d_ctermid_r_proto=define
10973                 set d_ctermid_r_proto ctermid_r $hdrs
10974                 eval $hasproto ;;
10975         *)      ;;
10976         esac
10977         case "$d_ctermid_r_proto" in
10978         define)
10979         case "$ctermid_r_proto" in
10980         ''|0) try='char* ctermid_r(char*);'
10981         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10982         esac
10983         case "$ctermid_r_proto" in
10984         ''|0)   d_ctermid_r=undef
10985                 ctermid_r_proto=0
10986                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10987         * )     case "$ctermid_r_proto" in
10988                 REENTRANT_PROTO*) ;;
10989                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10990                 esac
10991                 echo "Prototype: $try" ;;
10992         esac
10993         ;;
10994         *)      case "$usethreads" in
10995                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10996                 esac
10997                 d_ctermid_r=undef
10998                 ctermid_r_proto=0
10999                 ;;
11000         esac
11001         ;;
11002 *)      ctermid_r_proto=0
11003         ;;
11004 esac
11005
11006 : see if ctime_r exists
11007 set ctime_r d_ctime_r
11008 eval $inlibc
11009 case "$d_ctime_r" in
11010 "$define")
11011         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11012         case "$d_ctime_r_proto:$usethreads" in
11013         ":define")      d_ctime_r_proto=define
11014                 set d_ctime_r_proto ctime_r $hdrs
11015                 eval $hasproto ;;
11016         *)      ;;
11017         esac
11018         case "$d_ctime_r_proto" in
11019         define)
11020         case "$ctime_r_proto" in
11021         ''|0) try='char* ctime_r(const time_t*, char*);'
11022         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11023         esac
11024         case "$ctime_r_proto" in
11025         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11026         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11027         esac
11028         case "$ctime_r_proto" in
11029         ''|0) try='int ctime_r(const time_t*, char*);'
11030         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11031         esac
11032         case "$ctime_r_proto" in
11033         ''|0) try='int ctime_r(const time_t*, char*, int);'
11034         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11035         esac
11036         case "$ctime_r_proto" in
11037         ''|0)   d_ctime_r=undef
11038                 ctime_r_proto=0
11039                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11040         * )     case "$ctime_r_proto" in
11041                 REENTRANT_PROTO*) ;;
11042                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11043                 esac
11044                 echo "Prototype: $try" ;;
11045         esac
11046         ;;
11047         *)      case "$usethreads" in
11048                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11049                 esac
11050                 d_ctime_r=undef
11051                 ctime_r_proto=0
11052                 ;;
11053         esac
11054         ;;
11055 *)      ctime_r_proto=0
11056         ;;
11057 esac
11058
11059 : see if cuserid exists
11060 set cuserid d_cuserid
11061 eval $inlibc
11062
11063 : see if this is a limits.h system
11064 set limits.h i_limits
11065 eval $inhdr
11066
11067 : see if this is a float.h system
11068 set float.h i_float
11069 eval $inhdr
11070
11071 : See if number of significant digits in a double precision number is known
11072 echo " "
11073 $cat >dbl_dig.c <<EOM
11074 #$i_limits I_LIMITS
11075 #$i_float I_FLOAT
11076 #ifdef I_LIMITS
11077 #include <limits.h>
11078 #endif
11079 #ifdef I_FLOAT
11080 #include <float.h>
11081 #endif
11082 #ifdef DBL_DIG
11083 printf("Contains DBL_DIG");
11084 #endif
11085 EOM
11086 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11087 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11088         echo "DBL_DIG found." >&4
11089         val="$define"
11090 else
11091         echo "DBL_DIG NOT found." >&4
11092         val="$undef"
11093 fi
11094 $rm -f dbl_dig.?
11095 set d_dbl_dig
11096 eval $setvar
11097
11098 : see if dbm.h is available
11099 : see if dbmclose exists
11100 set dbmclose d_dbmclose
11101 eval $inlibc
11102
11103 case "$d_dbmclose" in
11104 $define)
11105         set dbm.h i_dbm
11106         eval $inhdr
11107         case "$i_dbm" in
11108         $define)
11109                 val="$undef"
11110                 set i_rpcsvcdbm
11111                 eval $setvar
11112                 ;;
11113         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11114                 eval $inhdr
11115                 ;;
11116         esac
11117         ;;
11118 *)      echo "We won't be including <dbm.h>"
11119         val="$undef"
11120         set i_dbm
11121         eval $setvar
11122         val="$undef"
11123         set i_rpcsvcdbm
11124         eval $setvar
11125         ;;
11126 esac
11127
11128 : see if prototype for dbminit is available
11129 echo " "
11130 set d_dbminitproto dbminit $i_dbm dbm.h
11131 eval $hasproto
11132
11133 : see if difftime exists
11134 set difftime d_difftime
11135 eval $inlibc
11136
11137 : see if this is a dirent system
11138 echo " "
11139 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11140         val="$define"
11141         echo "<dirent.h> found." >&4
11142 else
11143         val="$undef"
11144         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11145                 echo "<sys/dir.h> found." >&4
11146                 echo " "
11147         else
11148                 xinc=`./findhdr sys/ndir.h`
11149         fi
11150         echo "<dirent.h> NOT found." >&4
11151 fi
11152 set i_dirent
11153 eval $setvar
11154
11155 : Look for type of directory structure.
11156 echo " "
11157 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11158
11159 case "$direntrytype" in
11160 ''|' ')
11161         case "$i_dirent" in
11162         $define) guess1='struct dirent' ;;
11163         *) guess1='struct direct'  ;;
11164         esac
11165         ;;
11166 *)      guess1="$direntrytype"
11167         ;;
11168 esac
11169
11170 case "$guess1" in
11171 'struct dirent') guess2='struct direct' ;;
11172 *) guess2='struct dirent' ;;
11173 esac
11174                 
11175 if $contains "$guess1" try.c >/dev/null 2>&1; then
11176         direntrytype="$guess1"
11177         echo "Your directory entries are $direntrytype." >&4
11178 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11179         direntrytype="$guess2"
11180         echo "Your directory entries seem to be $direntrytype." >&4
11181 else
11182         echo "I don't recognize your system's directory entries." >&4
11183         rp="What type is used for directory entries on this system?"
11184         dflt="$guess1"
11185         . ./myread
11186         direntrytype="$ans"
11187 fi
11188 $rm -f try.c
11189
11190
11191 : see if the directory entry stores field length
11192 echo " "
11193 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11194 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11195         echo "Good, your directory entry keeps length information in d_namlen." >&4
11196         val="$define"
11197 else
11198         echo "Your directory entry does not know about the d_namlen field." >&4
11199         val="$undef"
11200 fi
11201 set d_dirnamlen
11202 eval $setvar
11203 $rm -f try.c
11204
11205 : see if this is an sysdir system
11206 set sys/dir.h i_sysdir
11207 eval $inhdr
11208
11209 : see if this is an sysndir system
11210 set sys/ndir.h i_sysndir
11211 eval $inhdr
11212
11213 : Look for dirfd
11214 echo " "
11215 $cat >dirfd.c <<EOM
11216 #include <stdio.h>
11217 #$i_stdlib I_STDLIB
11218 #ifdef I_STDLIB
11219 #include <stdlib.h>
11220 #endif
11221 #$i_dirent I_DIRENT             /**/
11222 #$i_sysdir I_SYS_DIR            /**/
11223 #$i_sysndir I_SYS_NDIR          /**/
11224 #$i_systypes I_SYS_TYPES        /**/
11225 #if defined(I_SYS_TYPES)
11226 #include <sys/types.h>
11227 #endif
11228 #if defined(I_DIRENT)
11229 #include <dirent.h>
11230 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11231 #include <sys/dir.h>
11232 #endif
11233 #else
11234 #ifdef I_SYS_NDIR
11235 #include <sys/ndir.h>
11236 #else
11237 #ifdef I_SYS_DIR
11238 #ifdef hp9000s500
11239 #include <ndir.h>       /* may be wrong in the future */
11240 #else
11241 #include <sys/dir.h>
11242 #endif
11243 #endif
11244 #endif
11245 #endif 
11246 int main() {
11247         DIR *dirp = opendir(".");
11248         if (dirfd(dirp) >= 0)
11249                 exit(0);
11250         else
11251                 exit(1);
11252 }
11253 EOM
11254 val=$undef
11255 set dirfd
11256 if eval $compile; then
11257         val="$define"
11258 fi
11259 case "$val" in
11260 $define)        echo "dirfd() found." >&4       ;;
11261 *)              echo "dirfd() NOT found." >&4   ;;
11262 esac
11263 set d_dirfd
11264 eval $setvar
11265 $rm -f dirfd*
11266
11267 : see if dlerror exists
11268 xxx_runnm="$runnm"
11269 runnm=false
11270 set dlerror d_dlerror
11271 eval $inlibc
11272 runnm="$xxx_runnm"
11273
11274 : see if dlfcn is available
11275 set dlfcn.h i_dlfcn
11276 eval $inhdr
11277
11278 case "$usedl" in
11279 $define|y|true)
11280         $cat << EOM
11281
11282 On a few systems, the dynamically loaded modules that perl generates and uses
11283 will need a different extension than shared libs. The default will probably
11284 be appropriate.
11285
11286 EOM
11287         case "$dlext" in
11288         '')     dflt="$so" ;;
11289         *)      dflt="$dlext" ;;
11290         esac
11291         rp='What is the extension of dynamically loaded modules'
11292         . ./myread
11293         dlext="$ans"
11294         ;;
11295 *)
11296         dlext="none"
11297         ;;
11298 esac
11299
11300 : Check if dlsym need a leading underscore
11301 echo " "
11302 val="$undef"
11303
11304 case "$dlsrc" in
11305 dl_dlopen.xs)
11306         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11307         $cat >dyna.c <<'EOM'
11308 fred () { }
11309 EOM
11310
11311 $cat >fred.c<<EOM
11312
11313 #include <stdio.h>
11314 #$i_stdlib I_STDLIB
11315 #ifdef I_STDLIB
11316 #include <stdlib.h>
11317 #endif
11318 #$i_dlfcn I_DLFCN
11319 #ifdef I_DLFCN
11320 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11321 #else
11322 #include <sys/types.h>
11323 #include <nlist.h>
11324 #include <link.h>
11325 #endif
11326
11327 extern int fred() ;
11328
11329 int main()
11330 {
11331     void * handle ;
11332     void * symbol ;
11333 #ifndef RTLD_LAZY
11334     int mode = 1 ;
11335 #else
11336     int mode = RTLD_LAZY ;
11337 #endif
11338     handle = dlopen("./dyna.$dlext", mode) ;
11339     if (handle == NULL) {
11340         printf ("1\n") ;
11341         fflush (stdout) ;
11342         exit(0);
11343     }
11344     symbol = dlsym(handle, "fred") ;
11345     if (symbol == NULL) {
11346         /* try putting a leading underscore */
11347         symbol = dlsym(handle, "_fred") ;
11348         if (symbol == NULL) {
11349             printf ("2\n") ;
11350             fflush (stdout) ;
11351             exit(0);
11352         }
11353         printf ("3\n") ;
11354     }
11355     else
11356         printf ("4\n") ;
11357     fflush (stdout) ;
11358     exit(0);
11359 }
11360 EOM
11361         : Call the object file tmp-dyna.o in case dlext=o.
11362         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11363                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11364                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11365                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11366                 xxx=`$run ./fred`
11367                 case $xxx in
11368                 1)      echo "Test program failed using dlopen." >&4
11369                         echo "Perhaps you should not use dynamic loading." >&4;;
11370                 2)      echo "Test program failed using dlsym." >&4
11371                         echo "Perhaps you should not use dynamic loading." >&4;;
11372                 3)      echo "dlsym needs a leading underscore" >&4
11373                         val="$define" ;;
11374                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11375                 esac
11376         else
11377                 echo "I can't compile and run the test program." >&4
11378                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11379         fi
11380         ;;
11381 esac
11382                 
11383 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11384
11385 set d_dlsymun
11386 eval $setvar
11387
11388 : see if drand48_r exists
11389 set drand48_r d_drand48_r
11390 eval $inlibc
11391 case "$d_drand48_r" in
11392 "$define")
11393         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11394         case "$d_drand48_r_proto:$usethreads" in
11395         ":define")      d_drand48_r_proto=define
11396                 set d_drand48_r_proto drand48_r $hdrs
11397                 eval $hasproto ;;
11398         *)      ;;
11399         esac
11400         case "$d_drand48_r_proto" in
11401         define)
11402         case "$drand48_r_proto" in
11403         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11404         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11405         esac
11406         case "$drand48_r_proto" in
11407         ''|0)   d_drand48_r=undef
11408                 drand48_r_proto=0
11409                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11410         * )     case "$drand48_r_proto" in
11411                 REENTRANT_PROTO*) ;;
11412                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11413                 esac
11414                 echo "Prototype: $try" ;;
11415         esac
11416         ;;
11417         *)      case "$usethreads" in
11418                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11419                 esac
11420                 d_drand48_r=undef
11421                 drand48_r_proto=0
11422                 ;;
11423         esac
11424         ;;
11425 *)      drand48_r_proto=0
11426         ;;
11427 esac
11428
11429 : see if prototype for drand48 is available
11430 echo " "
11431 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11432 eval $hasproto
11433
11434 : see if dup2 exists
11435 set dup2 d_dup2
11436 eval $inlibc
11437
11438 : see if eaccess exists
11439 set eaccess d_eaccess
11440 eval $inlibc
11441
11442 : see if endgrent exists
11443 set endgrent d_endgrent
11444 eval $inlibc
11445
11446 : see if this is an grp system
11447 set grp.h i_grp
11448 eval $inhdr
11449
11450 case "$i_grp" in
11451 $define)
11452         xxx=`./findhdr grp.h`
11453         $cppstdin $cppflags $cppminus < $xxx >$$.h
11454
11455         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11456                 val="$define"
11457         else
11458                 val="$undef"
11459         fi
11460         set d_grpasswd
11461         eval $setvar
11462
11463         $rm -f $$.h
11464         ;;
11465 *)
11466         val="$undef";
11467         set d_grpasswd; eval $setvar
11468         ;;
11469 esac
11470
11471 : see if endgrent_r exists
11472 set endgrent_r d_endgrent_r
11473 eval $inlibc
11474 case "$d_endgrent_r" in
11475 "$define")
11476         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11477         case "$d_endgrent_r_proto:$usethreads" in
11478         ":define")      d_endgrent_r_proto=define
11479                 set d_endgrent_r_proto endgrent_r $hdrs
11480                 eval $hasproto ;;
11481         *)      ;;
11482         esac
11483         case "$d_endgrent_r_proto" in
11484         define)
11485         case "$endgrent_r_proto" in
11486         ''|0) try='int endgrent_r(FILE**);'
11487         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11488         esac
11489         case "$endgrent_r_proto" in
11490         ''|0) try='void endgrent_r(FILE**);'
11491         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11492         esac
11493         case "$endgrent_r_proto" in
11494         ''|0)   d_endgrent_r=undef
11495                 endgrent_r_proto=0
11496                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11497         * )     case "$endgrent_r_proto" in
11498                 REENTRANT_PROTO*) ;;
11499                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11500                 esac
11501                 echo "Prototype: $try" ;;
11502         esac
11503         ;;
11504         *)      case "$usethreads" in
11505                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11506                 esac
11507                 d_endgrent_r=undef
11508                 endgrent_r_proto=0
11509                 ;;
11510         esac
11511         ;;
11512 *)      endgrent_r_proto=0
11513         ;;
11514 esac
11515
11516 : see if endhostent exists
11517 set endhostent d_endhent
11518 eval $inlibc
11519
11520 : see if this is a netdb.h system
11521 set netdb.h i_netdb
11522 eval $inhdr
11523
11524 : see if endhostent_r exists
11525 set endhostent_r d_endhostent_r
11526 eval $inlibc
11527 case "$d_endhostent_r" in
11528 "$define")
11529         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11530         case "$d_endhostent_r_proto:$usethreads" in
11531         ":define")      d_endhostent_r_proto=define
11532                 set d_endhostent_r_proto endhostent_r $hdrs
11533                 eval $hasproto ;;
11534         *)      ;;
11535         esac
11536         case "$d_endhostent_r_proto" in
11537         define)
11538         case "$endhostent_r_proto" in
11539         ''|0) try='int endhostent_r(struct hostent_data*);'
11540         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11541         esac
11542         case "$endhostent_r_proto" in
11543         ''|0) try='void endhostent_r(struct hostent_data*);'
11544         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11545         esac
11546         case "$endhostent_r_proto" in
11547         ''|0)   d_endhostent_r=undef
11548                 endhostent_r_proto=0
11549                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11550         * )     case "$endhostent_r_proto" in
11551                 REENTRANT_PROTO*) ;;
11552                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11553                 esac
11554                 echo "Prototype: $try" ;;
11555         esac
11556         ;;
11557         *)      case "$usethreads" in
11558                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11559                 esac
11560                 d_endhostent_r=undef
11561                 endhostent_r_proto=0
11562                 ;;
11563         esac
11564         ;;
11565 *)      endhostent_r_proto=0
11566         ;;
11567 esac
11568
11569 : see if endnetent exists
11570 set endnetent d_endnent
11571 eval $inlibc
11572
11573 : see if endnetent_r exists
11574 set endnetent_r d_endnetent_r
11575 eval $inlibc
11576 case "$d_endnetent_r" in
11577 "$define")
11578         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11579         case "$d_endnetent_r_proto:$usethreads" in
11580         ":define")      d_endnetent_r_proto=define
11581                 set d_endnetent_r_proto endnetent_r $hdrs
11582                 eval $hasproto ;;
11583         *)      ;;
11584         esac
11585         case "$d_endnetent_r_proto" in
11586         define)
11587         case "$endnetent_r_proto" in
11588         ''|0) try='int endnetent_r(struct netent_data*);'
11589         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11590         esac
11591         case "$endnetent_r_proto" in
11592         ''|0) try='void endnetent_r(struct netent_data*);'
11593         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11594         esac
11595         case "$endnetent_r_proto" in
11596         ''|0)   d_endnetent_r=undef
11597                 endnetent_r_proto=0
11598                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11599         * )     case "$endnetent_r_proto" in
11600                 REENTRANT_PROTO*) ;;
11601                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11602                 esac
11603                 echo "Prototype: $try" ;;
11604         esac
11605         ;;
11606         *)      case "$usethreads" in
11607                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11608                 esac
11609                 d_endnetent_r=undef
11610                 endnetent_r_proto=0
11611                 ;;
11612         esac
11613         ;;
11614 *)      endnetent_r_proto=0
11615         ;;
11616 esac
11617
11618 : see if endprotoent exists
11619 set endprotoent d_endpent
11620 eval $inlibc
11621
11622 : see if endprotoent_r exists
11623 set endprotoent_r d_endprotoent_r
11624 eval $inlibc
11625 case "$d_endprotoent_r" in
11626 "$define")
11627         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11628         case "$d_endprotoent_r_proto:$usethreads" in
11629         ":define")      d_endprotoent_r_proto=define
11630                 set d_endprotoent_r_proto endprotoent_r $hdrs
11631                 eval $hasproto ;;
11632         *)      ;;
11633         esac
11634         case "$d_endprotoent_r_proto" in
11635         define)
11636         case "$endprotoent_r_proto" in
11637         ''|0) try='int endprotoent_r(struct protoent_data*);'
11638         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11639         esac
11640         case "$endprotoent_r_proto" in
11641         ''|0) try='void endprotoent_r(struct protoent_data*);'
11642         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11643         esac
11644         case "$endprotoent_r_proto" in
11645         ''|0)   d_endprotoent_r=undef
11646                 endprotoent_r_proto=0
11647                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11648         * )     case "$endprotoent_r_proto" in
11649                 REENTRANT_PROTO*) ;;
11650                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11651                 esac
11652                 echo "Prototype: $try" ;;
11653         esac
11654         ;;
11655         *)      case "$usethreads" in
11656                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11657                 esac
11658                 d_endprotoent_r=undef
11659                 endprotoent_r_proto=0
11660                 ;;
11661         esac
11662         ;;
11663 *)      endprotoent_r_proto=0
11664         ;;
11665 esac
11666
11667 : see if endpwent exists
11668 set endpwent d_endpwent
11669 eval $inlibc
11670
11671 : see if this is a pwd.h system
11672 set pwd.h i_pwd
11673 eval $inhdr
11674
11675 case "$i_pwd" in
11676 $define)
11677         xxx=`./findhdr pwd.h`
11678         $cppstdin $cppflags $cppminus < $xxx >$$.h
11679
11680         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11681                 val="$define"
11682         else
11683                 val="$undef"
11684         fi
11685         set d_pwquota
11686         eval $setvar
11687
11688         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11689                 val="$define"
11690         else
11691                 val="$undef"
11692         fi
11693         set d_pwage
11694         eval $setvar
11695
11696         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11697                 val="$define"
11698         else
11699                 val="$undef"
11700         fi
11701         set d_pwchange
11702         eval $setvar
11703
11704         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11705                 val="$define"
11706         else
11707                 val="$undef"
11708         fi
11709         set d_pwclass
11710         eval $setvar
11711
11712         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11713                 val="$define"
11714         else
11715                 val="$undef"
11716         fi
11717         set d_pwexpire
11718         eval $setvar
11719
11720         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11721                 val="$define"
11722         else
11723                 val="$undef"
11724         fi
11725         set d_pwcomment
11726         eval $setvar
11727
11728         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11729                 val="$define"
11730         else
11731                 val="$undef"
11732         fi
11733         set d_pwgecos
11734         eval $setvar
11735
11736         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11737                 val="$define"
11738         else
11739                 val="$undef"
11740         fi
11741         set d_pwpasswd
11742         eval $setvar
11743
11744         $rm -f $$.h
11745         ;;
11746 *)
11747         val="$undef"; 
11748         set d_pwquota; eval $setvar
11749         set d_pwage; eval $setvar
11750         set d_pwchange; eval $setvar
11751         set d_pwclass; eval $setvar
11752         set d_pwexpire; eval $setvar
11753         set d_pwcomment; eval $setvar
11754         set d_pwgecos; eval $setvar
11755         set d_pwpasswd; eval $setvar
11756         ;;
11757 esac
11758
11759 : see if endpwent_r exists
11760 set endpwent_r d_endpwent_r
11761 eval $inlibc
11762 case "$d_endpwent_r" in
11763 "$define")
11764         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11765         case "$d_endpwent_r_proto:$usethreads" in
11766         ":define")      d_endpwent_r_proto=define
11767                 set d_endpwent_r_proto endpwent_r $hdrs
11768                 eval $hasproto ;;
11769         *)      ;;
11770         esac
11771         case "$d_endpwent_r_proto" in
11772         define)
11773         case "$endpwent_r_proto" in
11774         ''|0) try='int endpwent_r(FILE**);'
11775         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11776         esac
11777         case "$endpwent_r_proto" in
11778         ''|0) try='void endpwent_r(FILE**);'
11779         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11780         esac
11781         case "$endpwent_r_proto" in
11782         ''|0)   d_endpwent_r=undef
11783                 endpwent_r_proto=0
11784                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11785         * )     case "$endpwent_r_proto" in
11786                 REENTRANT_PROTO*) ;;
11787                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11788                 esac
11789                 echo "Prototype: $try" ;;
11790         esac
11791         ;;
11792         *)      case "$usethreads" in
11793                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11794                 esac
11795                 d_endpwent_r=undef
11796                 endpwent_r_proto=0
11797                 ;;
11798         esac
11799         ;;
11800 *)      endpwent_r_proto=0
11801         ;;
11802 esac
11803
11804 : see if endservent exists
11805 set endservent d_endsent
11806 eval $inlibc
11807
11808 : see if endservent_r exists
11809 set endservent_r d_endservent_r
11810 eval $inlibc
11811 case "$d_endservent_r" in
11812 "$define")
11813         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11814         case "$d_endservent_r_proto:$usethreads" in
11815         ":define")      d_endservent_r_proto=define
11816                 set d_endservent_r_proto endservent_r $hdrs
11817                 eval $hasproto ;;
11818         *)      ;;
11819         esac
11820         case "$d_endservent_r_proto" in
11821         define)
11822         case "$endservent_r_proto" in
11823         ''|0) try='int endservent_r(struct servent_data*);'
11824         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11825         esac
11826         case "$endservent_r_proto" in
11827         ''|0) try='void endservent_r(struct servent_data*);'
11828         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11829         esac
11830         case "$endservent_r_proto" in
11831         ''|0)   d_endservent_r=undef
11832                 endservent_r_proto=0
11833                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11834         * )     case "$endservent_r_proto" in
11835                 REENTRANT_PROTO*) ;;
11836                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11837                 esac
11838                 echo "Prototype: $try" ;;
11839         esac
11840         ;;
11841         *)      case "$usethreads" in
11842                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11843                 esac
11844                 d_endservent_r=undef
11845                 endservent_r_proto=0
11846                 ;;
11847         esac
11848         ;;
11849 *)      endservent_r_proto=0
11850         ;;
11851 esac
11852
11853 : Locate the flags for 'open()'
11854 echo " "
11855 $cat >try.c <<EOCP
11856 #include <sys/types.h>
11857 #ifdef I_FCNTL
11858 #include <fcntl.h>
11859 #endif
11860 #ifdef I_SYS_FILE
11861 #include <sys/file.h>
11862 #endif
11863 #$i_stdlib I_STDLIB
11864 #ifdef I_STDLIB
11865 #include <stdlib.h>
11866 #endif
11867 int main() {
11868         if(O_RDONLY);
11869 #ifdef O_TRUNC
11870         exit(0);
11871 #else
11872         exit(1);
11873 #endif
11874 }
11875 EOCP
11876 : check sys/file.h first to get FREAD on Sun
11877 if $test `./findhdr sys/file.h` && \
11878                 set try -DI_SYS_FILE && eval $compile; then
11879         h_sysfile=true;
11880         echo "<sys/file.h> defines the O_* constants..." >&4
11881         if $run ./try; then
11882                 echo "and you have the 3 argument form of open()." >&4
11883                 val="$define"
11884         else
11885                 echo "but not the 3 argument form of open().  Oh, well." >&4
11886                 val="$undef"
11887         fi
11888 elif $test `./findhdr fcntl.h` && \
11889                 set try -DI_FCNTL && eval $compile; then
11890         h_fcntl=true;
11891         echo "<fcntl.h> defines the O_* constants..." >&4
11892         if $run ./try; then
11893                 echo "and you have the 3 argument form of open()." >&4
11894                 val="$define"
11895         else
11896                 echo "but not the 3 argument form of open().  Oh, well." >&4
11897                 val="$undef"
11898         fi
11899 else
11900         val="$undef"
11901         echo "I can't find the O_* constant definitions!  You got problems." >&4
11902 fi
11903 set d_open3
11904 eval $setvar
11905 $rm -f try try.*
11906
11907 : see which of string.h or strings.h is needed
11908 echo " "
11909 strings=`./findhdr string.h`
11910 if $test "$strings" && $test -r "$strings"; then
11911         echo "Using <string.h> instead of <strings.h>." >&4
11912         val="$define"
11913 else
11914         val="$undef"
11915         strings=`./findhdr strings.h`
11916         if $test "$strings" && $test -r "$strings"; then
11917                 echo "Using <strings.h> instead of <string.h>." >&4
11918         else
11919                 echo "No string header found -- You'll surely have problems." >&4
11920         fi
11921 fi
11922 set i_string
11923 eval $setvar
11924 case "$i_string" in
11925 "$undef") strings=`./findhdr strings.h`;;
11926 *)        strings=`./findhdr string.h`;;
11927 esac
11928
11929 : see if this is a sys/file.h system
11930 val=''
11931 set sys/file.h val
11932 eval $inhdr
11933
11934 : do we need to include sys/file.h ?
11935 case "$val" in
11936 "$define")
11937         echo " "
11938         if $h_sysfile; then
11939                 val="$define"
11940                 echo "We'll be including <sys/file.h>." >&4
11941         else
11942                 val="$undef"
11943                 echo "We won't be including <sys/file.h>." >&4
11944         fi
11945         ;;
11946 *)
11947         h_sysfile=false
11948         ;;
11949 esac
11950 set i_sysfile
11951 eval $setvar
11952
11953 : see if fcntl.h is there
11954 val=''
11955 set fcntl.h val
11956 eval $inhdr
11957
11958 : see if we can include fcntl.h
11959 case "$val" in
11960 "$define")
11961         echo " "
11962         if $h_fcntl; then
11963                 val="$define"
11964                 echo "We'll be including <fcntl.h>." >&4
11965         else
11966                 val="$undef"
11967                 if $h_sysfile; then
11968         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11969                 else
11970                         echo "We won't be including <fcntl.h>." >&4
11971                 fi
11972         fi
11973         ;;
11974 *)
11975         h_fcntl=false
11976         val="$undef"
11977         ;;
11978 esac
11979 set i_fcntl
11980 eval $setvar
11981
11982 : check for non-blocking I/O stuff
11983 case "$h_sysfile" in
11984 true) echo "#include <sys/file.h>" > head.c;;
11985 *)
11986        case "$h_fcntl" in
11987        true) echo "#include <fcntl.h>" > head.c;;
11988        *) echo "#include <sys/fcntl.h>" > head.c;;
11989        esac
11990        ;;
11991 esac
11992 echo " "
11993 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11994 case "$o_nonblock" in
11995 '')
11996         $cat head.c > try.c
11997         $cat >>try.c <<EOCP
11998 #include <stdio.h>
11999 #$i_stdlib I_STDLIB
12000 #ifdef I_STDLIB
12001 #include <stdlib.h>
12002 #endif
12003 #$i_fcntl I_FCNTL
12004 #ifdef I_FCNTL
12005 #include <fcntl.h>
12006 #endif
12007 int main() {
12008 #ifdef O_NONBLOCK
12009         printf("O_NONBLOCK\n");
12010         exit(0);
12011 #endif
12012 #ifdef O_NDELAY
12013         printf("O_NDELAY\n");
12014         exit(0);
12015 #endif
12016 #ifdef FNDELAY
12017         printf("FNDELAY\n");
12018         exit(0);
12019 #endif
12020         exit(0);
12021 }
12022 EOCP
12023         set try
12024         if eval $compile_ok; then
12025                 o_nonblock=`$run ./try`
12026                 case "$o_nonblock" in
12027                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12028                 *) echo "Seems like we can use $o_nonblock.";;
12029                 esac
12030         else
12031                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12032         fi
12033         ;;
12034 *) echo "Using $hint value $o_nonblock.";;
12035 esac
12036 $rm -f try try.* .out core
12037
12038 echo " "
12039 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12040 case "$eagain" in
12041 '')
12042         $cat head.c > try.c
12043         $cat >>try.c <<EOCP
12044 #include <errno.h>
12045 #include <sys/types.h>
12046 #include <signal.h>
12047 #include <stdio.h> 
12048 #$i_stdlib I_STDLIB
12049 #ifdef I_STDLIB
12050 #include <stdlib.h>
12051 #endif
12052 #$i_fcntl I_FCNTL
12053 #ifdef I_FCNTL
12054 #include <fcntl.h>
12055 #endif
12056 #define MY_O_NONBLOCK $o_nonblock
12057 #ifndef errno  /* XXX need better Configure test */
12058 extern int errno;
12059 #endif
12060 #$i_unistd I_UNISTD
12061 #ifdef I_UNISTD
12062 #include <unistd.h>
12063 #endif
12064 #$i_string I_STRING
12065 #ifdef I_STRING
12066 #include <string.h>
12067 #else
12068 #include <strings.h>
12069 #endif
12070 $signal_t blech(int x) { exit(3); }
12071 EOCP
12072         $cat >> try.c <<'EOCP'
12073 int main()
12074 {
12075         int pd[2];
12076         int pu[2];
12077         char buf[1];
12078         char string[100];
12079
12080         pipe(pd);       /* Down: child -> parent */
12081         pipe(pu);       /* Up: parent -> child */
12082         if (0 != fork()) {
12083                 int ret;
12084                 close(pd[1]);   /* Parent reads from pd[0] */
12085                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12086 #ifdef F_SETFL
12087                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12088                         exit(1);
12089 #else
12090                 exit(4);
12091 #endif
12092                 signal(SIGALRM, blech);
12093                 alarm(5);
12094                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12095                         exit(2);
12096                 sprintf(string, "%d\n", ret);
12097                 write(2, string, strlen(string));
12098                 alarm(0);
12099 #ifdef EAGAIN
12100                 if (errno == EAGAIN) {
12101                         printf("EAGAIN\n");
12102                         goto ok;
12103                 }
12104 #endif
12105 #ifdef EWOULDBLOCK
12106                 if (errno == EWOULDBLOCK)
12107                         printf("EWOULDBLOCK\n");
12108 #endif
12109         ok:
12110                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12111                 sleep(2);                               /* Give it time to close our pipe */
12112                 alarm(5);
12113                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12114                 alarm(0);
12115                 sprintf(string, "%d\n", ret);
12116                 write(4, string, strlen(string));
12117                 exit(0);
12118         }
12119
12120         close(pd[0]);                   /* We write to pd[1] */
12121         close(pu[1]);                   /* We read from pu[0] */
12122         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12123         close(pd[1]);                   /* Pipe pd is now fully closed! */
12124         exit(0);                                /* Bye bye, thank you for playing! */
12125 }
12126 EOCP
12127         set try
12128         if eval $compile_ok; then
12129                 echo "$startsh" >mtry
12130                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12131                 chmod +x mtry
12132                 ./mtry >/dev/null 2>&1
12133                 case $? in
12134                 0) eagain=`$cat try.out`;;
12135                 1) echo "Could not perform non-blocking setting!";;
12136                 2) echo "I did a successful read() for something that was not there!";;
12137                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12138                 4) echo "Could not find F_SETFL!";;
12139                 *) echo "Something terribly wrong happened during testing.";;
12140                 esac
12141                 rd_nodata=`$cat try.ret`
12142                 echo "A read() system call with no data present returns $rd_nodata."
12143                 case "$rd_nodata" in
12144                 0|-1) ;;
12145                 *)
12146                         echo "(That's peculiar, fixing that to be -1.)"
12147                         rd_nodata=-1
12148                         ;;
12149                 esac
12150                 case "$eagain" in
12151                 '')
12152                         echo "Forcing errno EAGAIN on read() with no data available."
12153                         eagain=EAGAIN
12154                         ;;
12155                 *)
12156                         echo "Your read() sets errno to $eagain when no data is available."
12157                         ;;
12158                 esac
12159                 status=`$cat try.err`
12160                 case "$status" in
12161                 0) echo "And it correctly returns 0 to signal EOF.";;
12162                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12163                 *) echo "However, your read() returns '$status' on EOF??";;
12164                 esac
12165                 val="$define"
12166                 if test "$status" = "$rd_nodata"; then
12167                         echo "WARNING: you can't distinguish between EOF and no data!"
12168                         val="$undef"
12169                 fi
12170         else
12171                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12172                 eagain=EAGAIN
12173         fi
12174         set d_eofnblk
12175         eval $setvar
12176         ;;
12177 *)
12178         echo "Using $hint value $eagain."
12179         echo "Your read() returns $rd_nodata when no data is present."
12180         case "$d_eofnblk" in
12181         "$define") echo "And you can see EOF because read() returns 0.";;
12182         "$undef") echo "But you can't see EOF status from read() returned value.";;
12183         *)
12184                 echo "(Assuming you can't see EOF status from read anyway.)"
12185                 d_eofnblk=$undef
12186                 ;;
12187         esac
12188         ;;
12189 esac
12190 $rm -f try try.* .out core head.c mtry
12191
12192 : see if _ptr and _cnt from stdio act std
12193 echo " "
12194
12195 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12196         echo "(Looks like you have stdio.h from BSD.)"
12197         case "$stdio_ptr" in
12198         '') stdio_ptr='((fp)->_p)'
12199                 ptr_lval=$define
12200                 ;;
12201         *)      ptr_lval=$d_stdio_ptr_lval;;
12202         esac
12203         case "$stdio_cnt" in
12204         '') stdio_cnt='((fp)->_r)'
12205                 cnt_lval=$define
12206                 ;;
12207         *)      cnt_lval=$d_stdio_cnt_lval;;
12208         esac
12209         case "$stdio_base" in
12210         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12211         esac
12212         case "$stdio_bufsiz" in
12213         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12214         esac
12215 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12216         echo "(Looks like you have stdio.h from Linux.)"
12217         case "$stdio_ptr" in
12218         '') stdio_ptr='((fp)->_IO_read_ptr)'
12219                 ptr_lval=$define
12220                 ;;
12221         *)      ptr_lval=$d_stdio_ptr_lval;;
12222         esac
12223         case "$stdio_cnt" in
12224         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12225                 cnt_lval=$undef
12226                 ;;
12227         *)      cnt_lval=$d_stdio_cnt_lval;;
12228         esac
12229         case "$stdio_base" in
12230         '') stdio_base='((fp)->_IO_read_base)';;
12231         esac
12232         case "$stdio_bufsiz" in
12233         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12234         esac
12235 else
12236         case "$stdio_ptr" in
12237         '') stdio_ptr='((fp)->_ptr)'
12238                 ptr_lval=$define
12239                 ;;
12240         *)      ptr_lval=$d_stdio_ptr_lval;;
12241         esac
12242         case "$stdio_cnt" in
12243         '') stdio_cnt='((fp)->_cnt)'
12244                 cnt_lval=$define
12245                 ;;
12246         *)      cnt_lval=$d_stdio_cnt_lval;;
12247         esac
12248         case "$stdio_base" in
12249         '') stdio_base='((fp)->_base)';;
12250         esac
12251         case "$stdio_bufsiz" in
12252         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12253         esac
12254 fi
12255
12256 : test whether _ptr and _cnt really work
12257 echo "Checking how std your stdio is..." >&4
12258 $cat >try.c <<EOP
12259 #include <stdio.h>
12260 #$i_stdlib I_STDLIB
12261 #ifdef I_STDLIB
12262 #include <stdlib.h>
12263 #endif
12264 #define FILE_ptr(fp)    $stdio_ptr
12265 #define FILE_cnt(fp)    $stdio_cnt
12266 int main() {
12267         FILE *fp = fopen("try.c", "r");
12268         char c = getc(fp);
12269         if (
12270                 18 <= FILE_cnt(fp) &&
12271                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12272         )
12273                 exit(0);
12274         exit(1);
12275 }
12276 EOP
12277 val="$undef"
12278 set try
12279 if eval $compile && $to try.c; then
12280         if $run ./try; then
12281                 echo "Your stdio acts pretty std."
12282                 val="$define"
12283         else
12284                 echo "Your stdio isn't very std."
12285         fi
12286 else
12287         echo "Your stdio doesn't appear very std."
12288 fi
12289 $rm -f try.c try
12290
12291 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12292 # direct buffer manipulation no longer works.  The Configure tests
12293 # should be changed to correctly detect this, but until then,
12294 # the following check should at least let perl compile and run.
12295 # (This quick fix should be updated before 5.8.1.)
12296 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12297 # A. Dougherty, June 3, 2002.
12298 case "$d_gnulibc" in
12299 $define)
12300         case "$gnulibc_version" in
12301         2.[01]*)  ;;
12302         2.2) ;;
12303         2.2.[0-9]) ;;
12304         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12305                 val="$undef"
12306                 ;;
12307         esac
12308         ;;
12309 esac
12310 set d_stdstdio
12311 eval $setvar
12312
12313 : Can _ptr be used as an lvalue?
12314 case "$d_stdstdio$ptr_lval" in
12315 $define$define) val=$define ;;
12316 *) val=$undef ;;
12317 esac
12318 set d_stdio_ptr_lval
12319 eval $setvar
12320
12321 : Can _cnt be used as an lvalue?
12322 case "$d_stdstdio$cnt_lval" in
12323 $define$define) val=$define ;;
12324 *) val=$undef ;;
12325 esac
12326 set d_stdio_cnt_lval
12327 eval $setvar
12328
12329
12330 : test whether setting _ptr sets _cnt as a side effect
12331 d_stdio_ptr_lval_sets_cnt="$undef"
12332 d_stdio_ptr_lval_nochange_cnt="$undef"
12333 case "$d_stdio_ptr_lval$d_stdstdio" in
12334 $define$define)
12335         echo "Checking to see what happens if we set the stdio ptr..." >&4
12336 $cat >try.c <<EOP
12337 #include <stdio.h>
12338 /* Can we scream? */
12339 /* Eat dust sed :-) */
12340 /* In the buffer space, no one can hear you scream. */
12341 #$i_stdlib I_STDLIB
12342 #ifdef I_STDLIB
12343 #include <stdlib.h>
12344 #endif
12345 #define FILE_ptr(fp)    $stdio_ptr
12346 #define FILE_cnt(fp)    $stdio_cnt
12347 #include <sys/types.h>
12348 int main() {
12349         FILE *fp = fopen("try.c", "r");
12350         int c;
12351         char *ptr;
12352         size_t cnt;
12353         if (!fp) {
12354             puts("Fail even to read");
12355             exit(1);
12356         }
12357         c = getc(fp); /* Read away the first # */
12358         if (c == EOF) {
12359             puts("Fail even to read");
12360             exit(1);
12361         }
12362         if (!(
12363                 18 <= FILE_cnt(fp) &&
12364                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12365         )) {
12366                 puts("Fail even to read");
12367                 exit (1);
12368         }
12369         ptr = (char*) FILE_ptr(fp);
12370         cnt = (size_t)FILE_cnt(fp);
12371
12372         FILE_ptr(fp) += 42;
12373
12374         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12375                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12376                 exit (1);
12377         }
12378         if (FILE_cnt(fp) <= 20) {
12379                 printf ("Fail (<20 chars to test)");
12380                 exit (1);
12381         }
12382         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12383                 puts("Fail compare");
12384                 exit (1);
12385         }
12386         if (cnt == FILE_cnt(fp)) {
12387                 puts("Pass_unchanged");
12388                 exit (0);
12389         }       
12390         if (FILE_cnt(fp) == (cnt - 42)) {
12391                 puts("Pass_changed");
12392                 exit (0);
12393         }
12394         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12395         return 1;
12396
12397 }
12398 EOP
12399         set try
12400         if eval $compile && $to try.c; then
12401                 case `$run ./try` in
12402                 Pass_changed)
12403                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12404                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12405                 Pass_unchanged)
12406                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12407                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12408                 Fail*)
12409                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12410                 *)
12411                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12412         esac
12413         else
12414                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12415         fi
12416         $rm -f try.c try
12417         ;;
12418 esac
12419
12420 : see if _base is also standard
12421 val="$undef"
12422 case "$d_stdstdio" in
12423 $define)
12424         $cat >try.c <<EOP
12425 #include <stdio.h>
12426 #$i_stdlib I_STDLIB
12427 #ifdef I_STDLIB
12428 #include <stdlib.h>
12429 #endif
12430 #define FILE_base(fp)   $stdio_base
12431 #define FILE_bufsiz(fp) $stdio_bufsiz
12432 int main() {
12433         FILE *fp = fopen("try.c", "r");
12434         char c = getc(fp);
12435         if (
12436                 19 <= FILE_bufsiz(fp) &&
12437                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12438         )
12439                 exit(0);
12440         exit(1);
12441 }
12442 EOP
12443         set try
12444         if eval $compile && $to try.c; then
12445                 if $run ./try; then
12446                         echo "And its _base field acts std."
12447                         val="$define"
12448                 else
12449                         echo "But its _base field isn't std."
12450                 fi
12451         else
12452                 echo "However, it seems to be lacking the _base field."
12453         fi
12454         $rm -f try.c try
12455         ;;
12456 esac
12457 set d_stdiobase
12458 eval $setvar
12459
12460 : see if fast_stdio exists
12461 val="$undef"
12462 case "$d_stdstdio:$d_stdio_ptr_lval" in
12463 "$define:$define")
12464         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12465         *$define*)
12466                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12467                 val="$define"
12468                 ;;
12469         esac
12470         ;;
12471 esac
12472 set d_faststdio
12473 eval $setvar
12474
12475
12476
12477 : see if fchdir exists
12478 set fchdir d_fchdir
12479 eval $inlibc
12480
12481 : see if fchmod exists
12482 set fchmod d_fchmod
12483 eval $inlibc
12484
12485 : see if fchown exists
12486 set fchown d_fchown
12487 eval $inlibc
12488
12489 : see if this is an fcntl system
12490 set fcntl d_fcntl
12491 eval $inlibc
12492
12493 echo " "
12494 : See if fcntl-based locking works.
12495 $cat >try.c <<EOCP
12496 #$i_stdlib I_STDLIB
12497 #ifdef I_STDLIB
12498 #include <stdlib.h>
12499 #endif
12500 #include <unistd.h>
12501 #include <fcntl.h>
12502 #include <signal.h>
12503 $signal_t blech(int x) { exit(3); }
12504 int main() {
12505 #if defined(F_SETLK) && defined(F_SETLKW)
12506      struct flock flock;
12507      int retval, fd;
12508      fd = open("try.c", O_RDONLY);
12509      flock.l_type = F_RDLCK;
12510      flock.l_whence = SEEK_SET;
12511      flock.l_start = flock.l_len = 0;
12512      signal(SIGALRM, blech);
12513      alarm(10);
12514      retval = fcntl(fd, F_SETLK, &flock);
12515      close(fd);
12516      (retval < 0 ? exit(2) : exit(0));
12517 #else
12518      exit(2);
12519 #endif
12520 }
12521 EOCP
12522 echo "Checking if fcntl-based file locking works... "
12523 case "$d_fcntl" in
12524 "$define")
12525         set try
12526         if eval $compile_ok; then
12527                 if $run ./try; then
12528                         echo "Yes, it seems to work."
12529                         val="$define"
12530                 else
12531                         echo "Nope, it didn't work."
12532                         val="$undef"
12533                         case "$?" in
12534                         3) $cat >&4 <<EOM
12535 ***
12536 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12537 *** This is (almost) impossible.
12538 *** If your NFS lock daemons are not feeling well, something like
12539 *** this may happen, please investigate.  Cannot continue, aborting.
12540 ***
12541 EOM
12542                                 exit 1
12543                                 ;;
12544                         esac
12545                 fi
12546         else
12547                 echo "I'm unable to compile the test program, so I'll assume not."
12548                 val="$undef"
12549         fi
12550         ;;
12551 *) val="$undef";
12552         echo "Nope, since you don't even have fcntl()."
12553         ;;
12554 esac
12555 set d_fcntl_can_lock
12556 eval $setvar
12557 $rm -f try*
12558
12559
12560 : check for fd_set items
12561 $cat <<EOM
12562
12563 Checking to see how well your C compiler handles fd_set and friends ...
12564 EOM
12565 $cat >try.c <<EOCP
12566 #$i_stdlib I_STDLIB
12567 #ifdef I_STDLIB
12568 #include <stdlib.h>
12569 #endif
12570 #$i_systime I_SYS_TIME
12571 #$i_sysselct I_SYS_SELECT
12572 #$d_socket HAS_SOCKET
12573 #include <sys/types.h>
12574 #ifdef HAS_SOCKET
12575 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12576 #endif
12577 #ifdef I_SYS_TIME
12578 #include <sys/time.h>
12579 #endif
12580 #ifdef I_SYS_SELECT
12581 #include <sys/select.h>
12582 #endif
12583 int main() {
12584         fd_set fds;
12585
12586 #ifdef TRYBITS
12587         if(fds.fds_bits);
12588 #endif
12589
12590 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12591         exit(0);
12592 #else
12593         exit(1);
12594 #endif
12595 }
12596 EOCP
12597 set try -DTRYBITS
12598 if eval $compile; then
12599         d_fds_bits="$define"
12600         d_fd_set="$define"
12601         echo "Well, your system knows about the normal fd_set typedef..." >&4
12602         if $run ./try; then
12603                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12604                 d_fd_macros="$define"
12605         else
12606                 $cat >&4 <<'EOM'
12607 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12608 EOM
12609                 d_fd_macros="$undef"
12610         fi
12611 else
12612         $cat <<'EOM'
12613 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12614 EOM
12615         set try
12616         if eval $compile; then
12617                 d_fds_bits="$undef"
12618                 d_fd_set="$define"
12619                 echo "Well, your system has some sort of fd_set available..." >&4
12620                 if $run ./try; then
12621                         echo "and you have the normal fd_set macros." >&4
12622                         d_fd_macros="$define"
12623                 else
12624                         $cat <<'EOM'
12625 but not the normal fd_set macros!  Gross!  More work for me...
12626 EOM
12627                         d_fd_macros="$undef"
12628                 fi
12629         else
12630         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12631                 d_fd_set="$undef"
12632                 d_fds_bits="$undef"
12633                 d_fd_macros="$undef"
12634         fi
12635 fi
12636 $rm -f try try.*
12637
12638 : see if fgetpos exists
12639 set fgetpos d_fgetpos
12640 eval $inlibc
12641
12642 : see if finite exists
12643 set finite d_finite
12644 eval $inlibc
12645
12646 : see if finitel exists
12647 set finitel d_finitel
12648 eval $inlibc
12649
12650 : see if flock exists
12651 set flock d_flock
12652 eval $inlibc
12653
12654 : see if prototype for flock is available
12655 echo " "
12656 set d_flockproto flock $i_sysfile sys/file.h
12657 eval $hasproto
12658
12659 : see if fork exists
12660 set fork d_fork
12661 eval $inlibc
12662
12663 : see if fp_class exists
12664 set fp_class d_fp_class
12665 eval $inlibc
12666
12667 : see if pathconf exists
12668 set pathconf d_pathconf
12669 eval $inlibc
12670
12671 : see if fpathconf exists
12672 set fpathconf d_fpathconf
12673 eval $inlibc
12674
12675 : see if fpclass exists
12676 set fpclass d_fpclass
12677 eval $inlibc
12678
12679 : see if fpclassify exists
12680 set fpclassify d_fpclassify
12681 eval $inlibc
12682
12683 : see if fpclassl exists
12684 set fpclassl d_fpclassl
12685 eval $inlibc
12686
12687
12688 : check for fpos64_t
12689 echo " "
12690 echo "Checking to see if you have fpos64_t..." >&4
12691 $cat >try.c <<EOCP
12692 #include <stdio.h>
12693 int main() { fpos64_t x = 7; }
12694 EOCP
12695 set try
12696 if eval $compile; then
12697         val="$define"
12698         echo "You have fpos64_t."
12699 else
12700         val="$undef"
12701         echo "You do not have fpos64_t."
12702         case "$fpossize" in
12703         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12704         esac
12705 fi
12706 $rm -f try.* try
12707 set d_fpos64_t
12708 eval $setvar
12709
12710 : see if frexpl exists
12711 set frexpl d_frexpl
12712 eval $inlibc
12713
12714 : see if this is a sys/param system
12715 set sys/param.h i_sysparam
12716 eval $inhdr
12717
12718 : see if this is a sys/mount.h system
12719 set sys/mount.h i_sysmount
12720 eval $inhdr
12721
12722
12723 echo " "
12724 echo "Checking to see if your system supports struct fs_data..." >&4
12725 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12726 eval $hasstruct
12727 case "$d_fs_data_s" in
12728 "$define")      echo "Yes, it does."   ;;
12729 *)              echo "No, it doesn't." ;;
12730 esac
12731
12732 : see if fseeko exists
12733 set fseeko d_fseeko
12734 eval $inlibc
12735 case "$longsize" in
12736 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12737 esac
12738
12739 : see if fsetpos exists
12740 set fsetpos d_fsetpos
12741 eval $inlibc
12742
12743
12744 : see if fstatfs exists
12745 set fstatfs d_fstatfs
12746 eval $inlibc
12747
12748
12749 : see if statvfs exists
12750 set statvfs d_statvfs
12751 eval $inlibc
12752
12753 : see if fstatvfs exists
12754 set fstatvfs d_fstatvfs
12755 eval $inlibc
12756
12757
12758 : see if fsync exists
12759 set fsync d_fsync
12760 eval $inlibc
12761
12762 : see if ftello exists
12763 set ftello d_ftello
12764 eval $inlibc
12765 case "$longsize" in
12766 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12767 esac
12768
12769 d_futimes="$undef"
12770 : check for a working futimes
12771 echo " "
12772 echo "Checking for a working futimes()" >&4
12773 $cat >try.c <<EOCP
12774 #include <stdio.h>
12775 #include <sys/time.h>
12776 #include <errno.h>
12777 #include <fcntl.h>
12778
12779 int main ()
12780 {
12781     int fd, rv;
12782     fd = open ("try.c", O_RDWR);
12783     if (-1 == fd) exit (1);
12784     rv = futimes (fd, NULL);
12785     exit (rv == -1 ? errno : 0);
12786 }
12787 EOCP
12788 set try
12789 if eval $compile; then
12790     `$run ./try`
12791     rc=$?
12792     case "$rc" in
12793         0)  echo "Yes, it does" >&4
12794             d_futimes="$define"
12795             ;;
12796         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12797             ;;
12798     esac
12799 else
12800     echo "No, it does not (probably harmless)\n" >&4
12801 fi
12802 $rm -f try.* try core core.try.*
12803
12804 : see if getcwd exists
12805 set getcwd d_getcwd
12806 eval $inlibc
12807
12808 : see if getespwnam exists
12809 set getespwnam d_getespwnam
12810 eval $inlibc
12811
12812
12813 : see if getfsstat exists
12814 set getfsstat d_getfsstat
12815 eval $inlibc
12816
12817 : see if getgrent exists
12818 set getgrent d_getgrent
12819 eval $inlibc
12820
12821 : see if getgrent_r exists
12822 set getgrent_r d_getgrent_r
12823 eval $inlibc
12824 case "$d_getgrent_r" in
12825 "$define")
12826         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12827         case "$d_getgrent_r_proto:$usethreads" in
12828         ":define")      d_getgrent_r_proto=define
12829                 set d_getgrent_r_proto getgrent_r $hdrs
12830                 eval $hasproto ;;
12831         *)      ;;
12832         esac
12833         case "$d_getgrent_r_proto" in
12834         define)
12835         case "$getgrent_r_proto" in
12836         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12837         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12838         esac
12839         case "$getgrent_r_proto" in
12840         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12841         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12842         esac
12843         case "$getgrent_r_proto" in
12844         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12845         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12846         esac
12847         case "$getgrent_r_proto" in
12848         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12849         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12850         esac
12851         case "$getgrent_r_proto" in
12852         ''|0) try='int getgrent_r(struct group*, char*, int);'
12853         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12854         esac
12855         case "$getgrent_r_proto" in
12856         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12857         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12858         esac
12859         case "$getgrent_r_proto" in
12860         ''|0)   d_getgrent_r=undef
12861                 getgrent_r_proto=0
12862                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12863         * )     case "$getgrent_r_proto" in
12864                 REENTRANT_PROTO*) ;;
12865                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12866                 esac
12867                 echo "Prototype: $try" ;;
12868         esac
12869         ;;
12870         *)      case "$usethreads" in
12871                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12872                 esac
12873                 d_getgrent_r=undef
12874                 getgrent_r_proto=0
12875                 ;;
12876         esac
12877         ;;
12878 *)      getgrent_r_proto=0
12879         ;;
12880 esac
12881
12882 : see if getgrgid_r exists
12883 set getgrgid_r d_getgrgid_r
12884 eval $inlibc
12885 case "$d_getgrgid_r" in
12886 "$define")
12887         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12888         case "$d_getgrgid_r_proto:$usethreads" in
12889         ":define")      d_getgrgid_r_proto=define
12890                 set d_getgrgid_r_proto getgrgid_r $hdrs
12891                 eval $hasproto ;;
12892         *)      ;;
12893         esac
12894         case "$d_getgrgid_r_proto" in
12895         define)
12896         case "$getgrgid_r_proto" in
12897         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12898         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12899         esac
12900         case "$getgrgid_r_proto" in
12901         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12902         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12903         esac
12904         case "$getgrgid_r_proto" in
12905         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12906         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12907         esac
12908         case "$getgrgid_r_proto" in
12909         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12910         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12911         esac
12912         case "$getgrgid_r_proto" in
12913         ''|0)   d_getgrgid_r=undef
12914                 getgrgid_r_proto=0
12915                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12916         * )     case "$getgrgid_r_proto" in
12917                 REENTRANT_PROTO*) ;;
12918                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12919                 esac
12920                 echo "Prototype: $try" ;;
12921         esac
12922         ;;
12923         *)      case "$usethreads" in
12924                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12925                 esac
12926                 d_getgrgid_r=undef
12927                 getgrgid_r_proto=0
12928                 ;;
12929         esac
12930         ;;
12931 *)      getgrgid_r_proto=0
12932         ;;
12933 esac
12934
12935 : see if getgrnam_r exists
12936 set getgrnam_r d_getgrnam_r
12937 eval $inlibc
12938 case "$d_getgrnam_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12941         case "$d_getgrnam_r_proto:$usethreads" in
12942         ":define")      d_getgrnam_r_proto=define
12943                 set d_getgrnam_r_proto getgrnam_r $hdrs
12944                 eval $hasproto ;;
12945         *)      ;;
12946         esac
12947         case "$d_getgrnam_r_proto" in
12948         define)
12949         case "$getgrnam_r_proto" in
12950         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12951         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12952         esac
12953         case "$getgrnam_r_proto" in
12954         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12955         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12956         esac
12957         case "$getgrnam_r_proto" in
12958         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12959         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12960         esac
12961         case "$getgrnam_r_proto" in
12962         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12963         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12964         esac
12965         case "$getgrnam_r_proto" in
12966         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12967         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12968         esac
12969         case "$getgrnam_r_proto" in
12970         ''|0)   d_getgrnam_r=undef
12971                 getgrnam_r_proto=0
12972                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12973         * )     case "$getgrnam_r_proto" in
12974                 REENTRANT_PROTO*) ;;
12975                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12976                 esac
12977                 echo "Prototype: $try" ;;
12978         esac
12979         ;;
12980         *)      case "$usethreads" in
12981                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12982                 esac
12983                 d_getgrnam_r=undef
12984                 getgrnam_r_proto=0
12985                 ;;
12986         esac
12987         ;;
12988 *)      getgrnam_r_proto=0
12989         ;;
12990 esac
12991
12992 : see if gethostbyaddr exists
12993 set gethostbyaddr d_gethbyaddr
12994 eval $inlibc
12995
12996 : see if gethostbyname exists
12997 set gethostbyname d_gethbyname
12998 eval $inlibc
12999
13000 : see if gethostent exists
13001 set gethostent d_gethent
13002 eval $inlibc
13003
13004 : see how we will look up host name
13005 echo " "
13006 call=''
13007 if set gethostname val -f d_gethname; eval $csym; $val; then
13008         echo 'gethostname() found.' >&4
13009         d_gethname="$define"
13010         call=gethostname
13011 fi
13012 if set uname val -f d_uname; eval $csym; $val; then
13013         if ./xenix; then
13014                 $cat <<'EOM'
13015 uname() was found, but you're running xenix, and older versions of xenix
13016 have a broken uname(). If you don't really know whether your xenix is old
13017 enough to have a broken system call, use the default answer.
13018
13019 EOM
13020                 dflt=y
13021                 case "$d_uname" in
13022                 "$define") dflt=n;;
13023                 esac
13024                 rp='Is your uname() broken?'
13025                 . ./myread
13026                 case "$ans" in
13027                 n*) d_uname="$define"; call=uname;;
13028                 esac
13029         else
13030                 echo 'uname() found.' >&4
13031                 d_uname="$define"
13032                 case "$call" in
13033                 '') call=uname ;;
13034                 esac
13035         fi
13036 fi
13037 case "$d_gethname" in
13038 '') d_gethname="$undef";;
13039 esac
13040 case "$d_uname" in
13041 '') d_uname="$undef";;
13042 esac
13043 case "$d_uname$d_gethname" in
13044 *define*)
13045         dflt=n
13046         cat <<EOM
13047  
13048 Every now and then someone has a $call() that lies about the hostname
13049 but can't be fixed for political or economic reasons.  If you wish, I can
13050 pretend $call() isn't there and maybe compute hostname at run-time
13051 thanks to the '$phostname' command.
13052
13053 EOM
13054         rp="Shall I ignore $call() from now on?"
13055         . ./myread
13056         case "$ans" in
13057         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13058         esac;;
13059 esac
13060 case "$phostname" in
13061 '') aphostname='';;
13062 *) case "$aphostname" in
13063         /*) ;;
13064         *) set X $phostname
13065                 shift
13066                 file=$1
13067                 shift
13068                 file=`./loc $file $file $pth`
13069                 aphostname=`echo $file $*`
13070                 ;;
13071         esac
13072         ;;
13073 esac
13074 case "$d_uname$d_gethname" in
13075 *define*) ;;
13076 *)
13077         case "$phostname" in
13078         '')
13079                 echo "There will be no way for $package to get your hostname." >&4;;
13080         *)
13081         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13082                 ;;
13083         esac;;
13084 esac
13085 case "$d_phostname" in
13086 '') d_phostname="$undef";;
13087 esac
13088
13089 : see if gethostbyaddr_r exists
13090 set gethostbyaddr_r d_gethostbyaddr_r
13091 eval $inlibc
13092 case "$d_gethostbyaddr_r" in
13093 "$define")
13094         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13095         case "$d_gethostbyaddr_r_proto:$usethreads" in
13096         ":define")      d_gethostbyaddr_r_proto=define
13097                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13098                 eval $hasproto ;;
13099         *)      ;;
13100         esac
13101         case "$d_gethostbyaddr_r_proto" in
13102         define)
13103         case "$gethostbyaddr_r_proto" in
13104         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13105         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13106         esac
13107         case "$gethostbyaddr_r_proto" in
13108         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13109         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13110         esac
13111         case "$gethostbyaddr_r_proto" in
13112         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13113         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13114         esac
13115         case "$gethostbyaddr_r_proto" in
13116         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13117         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13118         esac
13119         case "$gethostbyaddr_r_proto" in
13120         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13121         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13122         esac
13123         case "$gethostbyaddr_r_proto" in
13124         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13125         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13126         esac
13127         case "$gethostbyaddr_r_proto" in
13128         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13129         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13130         esac
13131         case "$gethostbyaddr_r_proto" in
13132         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13133         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13134         esac
13135         case "$gethostbyaddr_r_proto" in
13136         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13137         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13138         esac
13139         case "$gethostbyaddr_r_proto" in
13140         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13141         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13142         esac
13143         case "$gethostbyaddr_r_proto" in
13144         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13145         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13146         esac
13147         case "$gethostbyaddr_r_proto" in
13148         ''|0)   d_gethostbyaddr_r=undef
13149                 gethostbyaddr_r_proto=0
13150                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13151         * )     case "$gethostbyaddr_r_proto" in
13152                 REENTRANT_PROTO*) ;;
13153                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13154                 esac
13155                 echo "Prototype: $try" ;;
13156         esac
13157         ;;
13158         *)      case "$usethreads" in
13159                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13160                 esac
13161                 d_gethostbyaddr_r=undef
13162                 gethostbyaddr_r_proto=0
13163                 ;;
13164         esac
13165         ;;
13166 *)      gethostbyaddr_r_proto=0
13167         ;;
13168 esac
13169
13170 : see if gethostbyname_r exists
13171 set gethostbyname_r d_gethostbyname_r
13172 eval $inlibc
13173 case "$d_gethostbyname_r" in
13174 "$define")
13175         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13176         case "$d_gethostbyname_r_proto:$usethreads" in
13177         ":define")      d_gethostbyname_r_proto=define
13178                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13179                 eval $hasproto ;;
13180         *)      ;;
13181         esac
13182         case "$d_gethostbyname_r_proto" in
13183         define)
13184         case "$gethostbyname_r_proto" in
13185         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13186         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13187         esac
13188         case "$gethostbyname_r_proto" in
13189         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13190         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13191         esac
13192         case "$gethostbyname_r_proto" in
13193         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13194         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13195         esac
13196         case "$gethostbyname_r_proto" in
13197         ''|0)   d_gethostbyname_r=undef
13198                 gethostbyname_r_proto=0
13199                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13200         * )     case "$gethostbyname_r_proto" in
13201                 REENTRANT_PROTO*) ;;
13202                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13203                 esac
13204                 echo "Prototype: $try" ;;
13205         esac
13206         ;;
13207         *)      case "$usethreads" in
13208                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13209                 esac
13210                 d_gethostbyname_r=undef
13211                 gethostbyname_r_proto=0
13212                 ;;
13213         esac
13214         ;;
13215 *)      gethostbyname_r_proto=0
13216         ;;
13217 esac
13218
13219 : see if gethostent_r exists
13220 set gethostent_r d_gethostent_r
13221 eval $inlibc
13222 case "$d_gethostent_r" in
13223 "$define")
13224         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13225         case "$d_gethostent_r_proto:$usethreads" in
13226         ":define")      d_gethostent_r_proto=define
13227                 set d_gethostent_r_proto gethostent_r $hdrs
13228                 eval $hasproto ;;
13229         *)      ;;
13230         esac
13231         case "$d_gethostent_r_proto" in
13232         define)
13233         case "$gethostent_r_proto" in
13234         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13235         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13236         esac
13237         case "$gethostent_r_proto" in
13238         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13239         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13240         esac
13241         case "$gethostent_r_proto" in
13242         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13243         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13244         esac
13245         case "$gethostent_r_proto" in
13246         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13247         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13248         esac
13249         case "$gethostent_r_proto" in
13250         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13251         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13252         esac
13253         case "$gethostent_r_proto" in
13254         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13255         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13256         esac
13257         case "$gethostent_r_proto" in
13258         ''|0)   d_gethostent_r=undef
13259                 gethostent_r_proto=0
13260                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13261         * )     case "$gethostent_r_proto" in
13262                 REENTRANT_PROTO*) ;;
13263                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13264                 esac
13265                 echo "Prototype: $try" ;;
13266         esac
13267         ;;
13268         *)      case "$usethreads" in
13269                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13270                 esac
13271                 d_gethostent_r=undef
13272                 gethostent_r_proto=0
13273                 ;;
13274         esac
13275         ;;
13276 *)      gethostent_r_proto=0
13277         ;;
13278 esac
13279
13280 : see if prototypes for various gethostxxx netdb.h functions are available
13281 echo " "
13282 set d_gethostprotos gethostent $i_netdb netdb.h
13283 eval $hasproto
13284
13285 : see if getitimer exists
13286 set getitimer d_getitimer
13287 eval $inlibc
13288
13289 : see if getlogin exists
13290 set getlogin d_getlogin
13291 eval $inlibc
13292
13293 : see if getlogin_r exists
13294 set getlogin_r d_getlogin_r
13295 eval $inlibc
13296 case "$d_getlogin_r" in
13297 "$define")
13298         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13299         case "$d_getlogin_r_proto:$usethreads" in
13300         ":define")      d_getlogin_r_proto=define
13301                 set d_getlogin_r_proto getlogin_r $hdrs
13302                 eval $hasproto ;;
13303         *)      ;;
13304         esac
13305         case "$d_getlogin_r_proto" in
13306         define)
13307         case "$getlogin_r_proto" in
13308         ''|0) try='int getlogin_r(char*, size_t);'
13309         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13310         esac
13311         case "$getlogin_r_proto" in
13312         ''|0) try='int getlogin_r(char*, int);'
13313         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13314         esac
13315         case "$getlogin_r_proto" in
13316         ''|0) try='char* getlogin_r(char*, size_t);'
13317         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13318         esac
13319         case "$getlogin_r_proto" in
13320         ''|0) try='char* getlogin_r(char*, int);'
13321         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13322         esac
13323         case "$getlogin_r_proto" in
13324         ''|0)   d_getlogin_r=undef
13325                 getlogin_r_proto=0
13326                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13327         * )     case "$getlogin_r_proto" in
13328                 REENTRANT_PROTO*) ;;
13329                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13330                 esac
13331                 echo "Prototype: $try" ;;
13332         esac
13333         ;;
13334         *)      case "$usethreads" in
13335                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13336                 esac
13337                 d_getlogin_r=undef
13338                 getlogin_r_proto=0
13339                 ;;
13340         esac
13341         ;;
13342 *)      getlogin_r_proto=0
13343         ;;
13344 esac
13345
13346 : see if getmnt exists
13347 set getmnt d_getmnt
13348 eval $inlibc
13349
13350 : see if getmntent exists
13351 set getmntent d_getmntent
13352 eval $inlibc
13353
13354 : see if getnetbyaddr exists
13355 set getnetbyaddr d_getnbyaddr
13356 eval $inlibc
13357
13358 : see if getnetbyname exists
13359 set getnetbyname d_getnbyname
13360 eval $inlibc
13361
13362 : see if getnetent exists
13363 set getnetent d_getnent
13364 eval $inlibc
13365
13366 : see if getnetbyaddr_r exists
13367 set getnetbyaddr_r d_getnetbyaddr_r
13368 eval $inlibc
13369 case "$d_getnetbyaddr_r" in
13370 "$define")
13371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13372         case "$d_getnetbyaddr_r_proto:$usethreads" in
13373         ":define")      d_getnetbyaddr_r_proto=define
13374                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13375                 eval $hasproto ;;
13376         *)      ;;
13377         esac
13378         case "$d_getnetbyaddr_r_proto" in
13379         define)
13380         case "$getnetbyaddr_r_proto" in
13381         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13382         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13383         esac
13384         case "$getnetbyaddr_r_proto" in
13385         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13386         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13387         esac
13388         case "$getnetbyaddr_r_proto" in
13389         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13390         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13391         esac
13392         case "$getnetbyaddr_r_proto" in
13393         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13394         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13395         esac
13396         case "$getnetbyaddr_r_proto" in
13397         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13398         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13399         esac
13400         case "$getnetbyaddr_r_proto" in
13401         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13402         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13403         esac
13404         case "$getnetbyaddr_r_proto" in
13405         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13406         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13407         esac
13408         case "$getnetbyaddr_r_proto" in
13409         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13410         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13411         esac
13412         case "$getnetbyaddr_r_proto" in
13413         ''|0)   d_getnetbyaddr_r=undef
13414                 getnetbyaddr_r_proto=0
13415                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13416         * )     case "$getnetbyaddr_r_proto" in
13417                 REENTRANT_PROTO*) ;;
13418                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13419                 esac
13420                 echo "Prototype: $try" ;;
13421         esac
13422         ;;
13423         *)      case "$usethreads" in
13424                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13425                 esac
13426                 d_getnetbyaddr_r=undef
13427                 getnetbyaddr_r_proto=0
13428                 ;;
13429         esac
13430         ;;
13431 *)      getnetbyaddr_r_proto=0
13432         ;;
13433 esac
13434
13435 : see if getnetbyname_r exists
13436 set getnetbyname_r d_getnetbyname_r
13437 eval $inlibc
13438 case "$d_getnetbyname_r" in
13439 "$define")
13440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13441         case "$d_getnetbyname_r_proto:$usethreads" in
13442         ":define")      d_getnetbyname_r_proto=define
13443                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13444                 eval $hasproto ;;
13445         *)      ;;
13446         esac
13447         case "$d_getnetbyname_r_proto" in
13448         define)
13449         case "$getnetbyname_r_proto" in
13450         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13451         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13452         esac
13453         case "$getnetbyname_r_proto" in
13454         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13455         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13456         esac
13457         case "$getnetbyname_r_proto" in
13458         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13459         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13460         esac
13461         case "$getnetbyname_r_proto" in
13462         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13463         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13464         esac
13465         case "$getnetbyname_r_proto" in
13466         ''|0)   d_getnetbyname_r=undef
13467                 getnetbyname_r_proto=0
13468                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13469         * )     case "$getnetbyname_r_proto" in
13470                 REENTRANT_PROTO*) ;;
13471                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13472                 esac
13473                 echo "Prototype: $try" ;;
13474         esac
13475         ;;
13476         *)      case "$usethreads" in
13477                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13478                 esac
13479                 d_getnetbyname_r=undef
13480                 getnetbyname_r_proto=0
13481                 ;;
13482         esac
13483         ;;
13484 *)      getnetbyname_r_proto=0
13485         ;;
13486 esac
13487
13488 : see if getnetent_r exists
13489 set getnetent_r d_getnetent_r
13490 eval $inlibc
13491 case "$d_getnetent_r" in
13492 "$define")
13493         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13494         case "$d_getnetent_r_proto:$usethreads" in
13495         ":define")      d_getnetent_r_proto=define
13496                 set d_getnetent_r_proto getnetent_r $hdrs
13497                 eval $hasproto ;;
13498         *)      ;;
13499         esac
13500         case "$d_getnetent_r_proto" in
13501         define)
13502         case "$getnetent_r_proto" in
13503         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13504         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13505         esac
13506         case "$getnetent_r_proto" in
13507         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13508         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13509         esac
13510         case "$getnetent_r_proto" in
13511         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13512         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13513         esac
13514         case "$getnetent_r_proto" in
13515         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13516         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13517         esac
13518         case "$getnetent_r_proto" in
13519         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13520         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13521         esac
13522         case "$getnetent_r_proto" in
13523         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13524         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13525         esac
13526         case "$getnetent_r_proto" in
13527         ''|0)   d_getnetent_r=undef
13528                 getnetent_r_proto=0
13529                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13530         * )     case "$getnetent_r_proto" in
13531                 REENTRANT_PROTO*) ;;
13532                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13533                 esac
13534                 echo "Prototype: $try" ;;
13535         esac
13536         ;;
13537         *)      case "$usethreads" in
13538                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13539                 esac
13540                 d_getnetent_r=undef
13541                 getnetent_r_proto=0
13542                 ;;
13543         esac
13544         ;;
13545 *)      getnetent_r_proto=0
13546         ;;
13547 esac
13548
13549 : see if prototypes for various getnetxxx netdb.h functions are available
13550 echo " "
13551 set d_getnetprotos getnetent $i_netdb netdb.h
13552 eval $hasproto
13553
13554 : see if getpagesize exists
13555 set getpagesize d_getpagsz
13556 eval $inlibc
13557
13558
13559 : see if getprotobyname exists
13560 set getprotobyname d_getpbyname
13561 eval $inlibc
13562
13563 : see if getprotobynumber exists
13564 set getprotobynumber d_getpbynumber
13565 eval $inlibc
13566
13567 : see if getprotoent exists
13568 set getprotoent d_getpent
13569 eval $inlibc
13570
13571 : see if getpgid exists
13572 set getpgid d_getpgid
13573 eval $inlibc
13574
13575 : see if getpgrp2 exists
13576 set getpgrp2 d_getpgrp2
13577 eval $inlibc
13578
13579 : see if getppid exists
13580 set getppid d_getppid
13581 eval $inlibc
13582
13583 : see if getpriority exists
13584 set getpriority d_getprior
13585 eval $inlibc
13586
13587 : see if getprotobyname_r exists
13588 set getprotobyname_r d_getprotobyname_r
13589 eval $inlibc
13590 case "$d_getprotobyname_r" in
13591 "$define")
13592         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13593         case "$d_getprotobyname_r_proto:$usethreads" in
13594         ":define")      d_getprotobyname_r_proto=define
13595                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13596                 eval $hasproto ;;
13597         *)      ;;
13598         esac
13599         case "$d_getprotobyname_r_proto" in
13600         define)
13601         case "$getprotobyname_r_proto" in
13602         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13603         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13604         esac
13605         case "$getprotobyname_r_proto" in
13606         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13607         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13608         esac
13609         case "$getprotobyname_r_proto" in
13610         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13611         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13612         esac
13613         case "$getprotobyname_r_proto" in
13614         ''|0)   d_getprotobyname_r=undef
13615                 getprotobyname_r_proto=0
13616                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13617         * )     case "$getprotobyname_r_proto" in
13618                 REENTRANT_PROTO*) ;;
13619                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13620                 esac
13621                 echo "Prototype: $try" ;;
13622         esac
13623         ;;
13624         *)      case "$usethreads" in
13625                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13626                 esac
13627                 d_getprotobyname_r=undef
13628                 getprotobyname_r_proto=0
13629                 ;;
13630         esac
13631         ;;
13632 *)      getprotobyname_r_proto=0
13633         ;;
13634 esac
13635
13636 : see if getprotobynumber_r exists
13637 set getprotobynumber_r d_getprotobynumber_r
13638 eval $inlibc
13639 case "$d_getprotobynumber_r" in
13640 "$define")
13641         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13642         case "$d_getprotobynumber_r_proto:$usethreads" in
13643         ":define")      d_getprotobynumber_r_proto=define
13644                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13645                 eval $hasproto ;;
13646         *)      ;;
13647         esac
13648         case "$d_getprotobynumber_r_proto" in
13649         define)
13650         case "$getprotobynumber_r_proto" in
13651         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13652         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13653         esac
13654         case "$getprotobynumber_r_proto" in
13655         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13656         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13657         esac
13658         case "$getprotobynumber_r_proto" in
13659         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13660         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13661         esac
13662         case "$getprotobynumber_r_proto" in
13663         ''|0)   d_getprotobynumber_r=undef
13664                 getprotobynumber_r_proto=0
13665                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13666         * )     case "$getprotobynumber_r_proto" in
13667                 REENTRANT_PROTO*) ;;
13668                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13669                 esac
13670                 echo "Prototype: $try" ;;
13671         esac
13672         ;;
13673         *)      case "$usethreads" in
13674                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13675                 esac
13676                 d_getprotobynumber_r=undef
13677                 getprotobynumber_r_proto=0
13678                 ;;
13679         esac
13680         ;;
13681 *)      getprotobynumber_r_proto=0
13682         ;;
13683 esac
13684
13685 : see if getprotoent_r exists
13686 set getprotoent_r d_getprotoent_r
13687 eval $inlibc
13688 case "$d_getprotoent_r" in
13689 "$define")
13690         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13691         case "$d_getprotoent_r_proto:$usethreads" in
13692         ":define")      d_getprotoent_r_proto=define
13693                 set d_getprotoent_r_proto getprotoent_r $hdrs
13694                 eval $hasproto ;;
13695         *)      ;;
13696         esac
13697         case "$d_getprotoent_r_proto" in
13698         define)
13699         case "$getprotoent_r_proto" in
13700         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13701         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13702         esac
13703         case "$getprotoent_r_proto" in
13704         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13705         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13706         esac
13707         case "$getprotoent_r_proto" in
13708         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13709         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13710         esac
13711         case "$getprotoent_r_proto" in
13712         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13713         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13714         esac
13715         case "$getprotoent_r_proto" in
13716         ''|0)   d_getprotoent_r=undef
13717                 getprotoent_r_proto=0
13718                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13719         * )     case "$getprotoent_r_proto" in
13720                 REENTRANT_PROTO*) ;;
13721                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13722                 esac
13723                 echo "Prototype: $try" ;;
13724         esac
13725         ;;
13726         *)      case "$usethreads" in
13727                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13728                 esac
13729                 d_getprotoent_r=undef
13730                 getprotoent_r_proto=0
13731                 ;;
13732         esac
13733         ;;
13734 *)      getprotoent_r_proto=0
13735         ;;
13736 esac
13737
13738 : see if prototypes for various getprotoxxx netdb.h functions are available
13739 echo " "
13740 set d_getprotoprotos getprotoent $i_netdb netdb.h
13741 eval $hasproto
13742
13743 : see if getprpwnam exists
13744 set getprpwnam d_getprpwnam
13745 eval $inlibc
13746
13747 : see if getpwent exists
13748 set getpwent d_getpwent
13749 eval $inlibc
13750
13751 : see if getpwent_r exists
13752 set getpwent_r d_getpwent_r
13753 eval $inlibc
13754 case "$d_getpwent_r" in
13755 "$define")
13756         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13757         case "$d_getpwent_r_proto:$usethreads" in
13758         ":define")      d_getpwent_r_proto=define
13759                 set d_getpwent_r_proto getpwent_r $hdrs
13760                 eval $hasproto ;;
13761         *)      ;;
13762         esac
13763         case "$d_getpwent_r_proto" in
13764         define)
13765         case "$getpwent_r_proto" in
13766         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13767         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13768         esac
13769         case "$getpwent_r_proto" in
13770         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13771         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13772         esac
13773         case "$getpwent_r_proto" in
13774         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13775         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13776         esac
13777         case "$getpwent_r_proto" in
13778         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13779         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13780         esac
13781         case "$getpwent_r_proto" in
13782         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13783         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13784         esac
13785         case "$getpwent_r_proto" in
13786         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13787         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13788         esac
13789         case "$getpwent_r_proto" in
13790         ''|0)   d_getpwent_r=undef
13791                 getpwent_r_proto=0
13792                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13793         * )     case "$getpwent_r_proto" in
13794                 REENTRANT_PROTO*) ;;
13795                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13796                 esac
13797                 echo "Prototype: $try" ;;
13798         esac
13799         ;;
13800         *)      case "$usethreads" in
13801                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13802                 esac
13803                 d_getpwent_r=undef
13804                 getpwent_r_proto=0
13805                 ;;
13806         esac
13807         ;;
13808 *)      getpwent_r_proto=0
13809         ;;
13810 esac
13811
13812 : see if getpwnam_r exists
13813 set getpwnam_r d_getpwnam_r
13814 eval $inlibc
13815 case "$d_getpwnam_r" in
13816 "$define")
13817         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13818         case "$d_getpwnam_r_proto:$usethreads" in
13819         ":define")      d_getpwnam_r_proto=define
13820                 set d_getpwnam_r_proto getpwnam_r $hdrs
13821                 eval $hasproto ;;
13822         *)      ;;
13823         esac
13824         case "$d_getpwnam_r_proto" in
13825         define)
13826         case "$getpwnam_r_proto" in
13827         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13828         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13829         esac
13830         case "$getpwnam_r_proto" in
13831         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13832         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13833         esac
13834         case "$getpwnam_r_proto" in
13835         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13836         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13837         esac
13838         case "$getpwnam_r_proto" in
13839         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13840         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13841         esac
13842         case "$getpwnam_r_proto" in
13843         ''|0)   d_getpwnam_r=undef
13844                 getpwnam_r_proto=0
13845                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13846         * )     case "$getpwnam_r_proto" in
13847                 REENTRANT_PROTO*) ;;
13848                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13849                 esac
13850                 echo "Prototype: $try" ;;
13851         esac
13852         ;;
13853         *)      case "$usethreads" in
13854                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13855                 esac
13856                 d_getpwnam_r=undef
13857                 getpwnam_r_proto=0
13858                 ;;
13859         esac
13860         ;;
13861 *)      getpwnam_r_proto=0
13862         ;;
13863 esac
13864
13865 : see if getpwuid_r exists
13866 set getpwuid_r d_getpwuid_r
13867 eval $inlibc
13868 case "$d_getpwuid_r" in
13869 "$define")
13870         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13871         case "$d_getpwuid_r_proto:$usethreads" in
13872         ":define")      d_getpwuid_r_proto=define
13873                 set d_getpwuid_r_proto getpwuid_r $hdrs
13874                 eval $hasproto ;;
13875         *)      ;;
13876         esac
13877         case "$d_getpwuid_r_proto" in
13878         define)
13879         case "$getpwuid_r_proto" in
13880         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13881         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13882         esac
13883         case "$getpwuid_r_proto" in
13884         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13885         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13886         esac
13887         case "$getpwuid_r_proto" in
13888         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13889         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13890         esac
13891         case "$getpwuid_r_proto" in
13892         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13893         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13894         esac
13895         case "$getpwuid_r_proto" in
13896         ''|0)   d_getpwuid_r=undef
13897                 getpwuid_r_proto=0
13898                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13899         * )     case "$getpwuid_r_proto" in
13900                 REENTRANT_PROTO*) ;;
13901                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13902                 esac
13903                 echo "Prototype: $try" ;;
13904         esac
13905         ;;
13906         *)      case "$usethreads" in
13907                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13908                 esac
13909                 d_getpwuid_r=undef
13910                 getpwuid_r_proto=0
13911                 ;;
13912         esac
13913         ;;
13914 *)      getpwuid_r_proto=0
13915         ;;
13916 esac
13917
13918
13919 : see if getservbyname exists
13920 set getservbyname d_getsbyname
13921 eval $inlibc
13922
13923 : see if getservbyport exists
13924 set getservbyport d_getsbyport
13925 eval $inlibc
13926
13927 : see if getservent exists
13928 set getservent d_getsent
13929 eval $inlibc
13930
13931 : see if getservbyname_r exists
13932 set getservbyname_r d_getservbyname_r
13933 eval $inlibc
13934 case "$d_getservbyname_r" in
13935 "$define")
13936         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13937         case "$d_getservbyname_r_proto:$usethreads" in
13938         ":define")      d_getservbyname_r_proto=define
13939                 set d_getservbyname_r_proto getservbyname_r $hdrs
13940                 eval $hasproto ;;
13941         *)      ;;
13942         esac
13943         case "$d_getservbyname_r_proto" in
13944         define)
13945         case "$getservbyname_r_proto" in
13946         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13947         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13948         esac
13949         case "$getservbyname_r_proto" in
13950         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13951         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13952         esac
13953         case "$getservbyname_r_proto" in
13954         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13955         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13956         esac
13957         case "$getservbyname_r_proto" in
13958         ''|0)   d_getservbyname_r=undef
13959                 getservbyname_r_proto=0
13960                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getservbyname_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getservbyname_r=undef
13972                 getservbyname_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getservbyname_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if getservbyport_r exists
13981 set getservbyport_r d_getservbyport_r
13982 eval $inlibc
13983 case "$d_getservbyport_r" in
13984 "$define")
13985         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13986         case "$d_getservbyport_r_proto:$usethreads" in
13987         ":define")      d_getservbyport_r_proto=define
13988                 set d_getservbyport_r_proto getservbyport_r $hdrs
13989                 eval $hasproto ;;
13990         *)      ;;
13991         esac
13992         case "$d_getservbyport_r_proto" in
13993         define)
13994         case "$getservbyport_r_proto" in
13995         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13996         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13997         esac
13998         case "$getservbyport_r_proto" in
13999         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14000         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14001         esac
14002         case "$getservbyport_r_proto" in
14003         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14004         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14005         esac
14006         case "$getservbyport_r_proto" in
14007         ''|0)   d_getservbyport_r=undef
14008                 getservbyport_r_proto=0
14009                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14010         * )     case "$getservbyport_r_proto" in
14011                 REENTRANT_PROTO*) ;;
14012                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14013                 esac
14014                 echo "Prototype: $try" ;;
14015         esac
14016         ;;
14017         *)      case "$usethreads" in
14018                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14019                 esac
14020                 d_getservbyport_r=undef
14021                 getservbyport_r_proto=0
14022                 ;;
14023         esac
14024         ;;
14025 *)      getservbyport_r_proto=0
14026         ;;
14027 esac
14028
14029 : see if getservent_r exists
14030 set getservent_r d_getservent_r
14031 eval $inlibc
14032 case "$d_getservent_r" in
14033 "$define")
14034         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14035         case "$d_getservent_r_proto:$usethreads" in
14036         ":define")      d_getservent_r_proto=define
14037                 set d_getservent_r_proto getservent_r $hdrs
14038                 eval $hasproto ;;
14039         *)      ;;
14040         esac
14041         case "$d_getservent_r_proto" in
14042         define)
14043         case "$getservent_r_proto" in
14044         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14045         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14046         esac
14047         case "$getservent_r_proto" in
14048         ''|0) try='int getservent_r(struct servent*, char*, int);'
14049         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14050         esac
14051         case "$getservent_r_proto" in
14052         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14053         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14054         esac
14055         case "$getservent_r_proto" in
14056         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14057         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14058         esac
14059         case "$getservent_r_proto" in
14060         ''|0)   d_getservent_r=undef
14061                 getservent_r_proto=0
14062                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14063         * )     case "$getservent_r_proto" in
14064                 REENTRANT_PROTO*) ;;
14065                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14066                 esac
14067                 echo "Prototype: $try" ;;
14068         esac
14069         ;;
14070         *)      case "$usethreads" in
14071                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14072                 esac
14073                 d_getservent_r=undef
14074                 getservent_r_proto=0
14075                 ;;
14076         esac
14077         ;;
14078 *)      getservent_r_proto=0
14079         ;;
14080 esac
14081
14082 : see if prototypes for various getservxxx netdb.h functions are available
14083 echo " "
14084 set d_getservprotos getservent $i_netdb netdb.h
14085 eval $hasproto
14086
14087 : see if getspnam exists
14088 set getspnam d_getspnam
14089 eval $inlibc
14090
14091 : see if this is a shadow.h system
14092 set shadow.h i_shadow
14093 eval $inhdr
14094
14095 : see if getspnam_r exists
14096 set getspnam_r d_getspnam_r
14097 eval $inlibc
14098 case "$d_getspnam_r" in
14099 "$define")
14100         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14101         case "$d_getspnam_r_proto:$usethreads" in
14102         ":define")      d_getspnam_r_proto=define
14103                 set d_getspnam_r_proto getspnam_r $hdrs
14104                 eval $hasproto ;;
14105         *)      ;;
14106         esac
14107         case "$d_getspnam_r_proto" in
14108         define)
14109         case "$getspnam_r_proto" in
14110         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14111         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14112         esac
14113         case "$getspnam_r_proto" in
14114         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14115         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14116         esac
14117         case "$getspnam_r_proto" in
14118         ''|0)   d_getspnam_r=undef
14119                 getspnam_r_proto=0
14120                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14121         * )     case "$getspnam_r_proto" in
14122                 REENTRANT_PROTO*) ;;
14123                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14124                 esac
14125                 echo "Prototype: $try" ;;
14126         esac
14127         ;;
14128         *)      case "$usethreads" in
14129                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14130                 esac
14131                 d_getspnam_r=undef
14132                 getspnam_r_proto=0
14133                 ;;
14134         esac
14135         ;;
14136 *)      getspnam_r_proto=0
14137         ;;
14138 esac
14139
14140 : see if gettimeofday or ftime exists
14141 set gettimeofday d_gettimeod
14142 eval $inlibc
14143 case "$d_gettimeod" in
14144 "$undef")
14145         set ftime d_ftime 
14146         eval $inlibc
14147         ;;
14148 *)
14149         val="$undef"; set d_ftime; eval $setvar
14150         ;;
14151 esac
14152 case "$d_gettimeod$d_ftime" in
14153 "$undef$undef")
14154         echo " "
14155         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14156         ;;
14157 esac
14158
14159 : see if gmtime_r exists
14160 set gmtime_r d_gmtime_r
14161 eval $inlibc
14162 case "$d_gmtime_r" in
14163 "$define")
14164         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14165         case "$d_gmtime_r_proto:$usethreads" in
14166         ":define")      d_gmtime_r_proto=define
14167                 set d_gmtime_r_proto gmtime_r $hdrs
14168                 eval $hasproto ;;
14169         *)      ;;
14170         esac
14171         case "$d_gmtime_r_proto" in
14172         define)
14173         case "$gmtime_r_proto" in
14174         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14175         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14176         esac
14177         case "$gmtime_r_proto" in
14178         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14179         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14180         esac
14181         case "$gmtime_r_proto" in
14182         ''|0)   d_gmtime_r=undef
14183                 gmtime_r_proto=0
14184                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14185         * )     case "$gmtime_r_proto" in
14186                 REENTRANT_PROTO*) ;;
14187                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14188                 esac
14189                 echo "Prototype: $try" ;;
14190         esac
14191         ;;
14192         *)      case "$usethreads" in
14193                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14194                 esac
14195                 d_gmtime_r=undef
14196                 gmtime_r_proto=0
14197                 ;;
14198         esac
14199         ;;
14200 *)      gmtime_r_proto=0
14201         ;;
14202 esac
14203
14204 : see if hasmntopt exists
14205 set hasmntopt d_hasmntopt
14206 eval $inlibc
14207
14208 : see if this is a netinet/in.h or sys/in.h system
14209 set netinet/in.h i_niin sys/in.h i_sysin
14210 eval $inhdr
14211
14212 : see if arpa/inet.h has to be included
14213 set arpa/inet.h i_arpainet
14214 eval $inhdr
14215
14216 : see if htonl --and friends-- exists
14217 val=''
14218 set htonl val
14219 eval $inlibc
14220
14221 : Maybe they are macros.
14222 case "$val" in
14223 $undef)
14224         $cat >htonl.c <<EOM
14225 #include <stdio.h>
14226 #include <sys/types.h>
14227 #$i_niin I_NETINET_IN
14228 #$i_sysin I_SYS_IN
14229 #$i_arpainet I_ARPA_INET
14230 #ifdef I_NETINET_IN
14231 #include <netinet/in.h>
14232 #endif
14233 #ifdef I_SYS_IN
14234 #include <sys/in.h>
14235 #endif
14236 #ifdef I_ARPA_INET
14237 #include <arpa/inet.h>
14238 #endif
14239 #ifdef htonl
14240 printf("Defined as a macro.");
14241 #endif
14242 EOM
14243         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14244         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14245                 val="$define"
14246                 echo "But it seems to be defined as a macro." >&4
14247         fi
14248         $rm -f htonl.?
14249         ;;
14250 esac
14251 set d_htonl
14252 eval $setvar
14253
14254 : see if ilogbl exists
14255 set ilogbl d_ilogbl
14256 eval $inlibc
14257
14258 : index or strchr
14259 echo " "
14260 if set index val -f; eval $csym; $val; then
14261         if set strchr val -f d_strchr; eval $csym; $val; then
14262                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14263                         val="$define"
14264                         vali="$undef"
14265                         echo "strchr() found." >&4
14266                 else
14267                         val="$undef"
14268                         vali="$define"
14269                         echo "index() found." >&4
14270                 fi
14271         else
14272                 val="$undef"
14273                 vali="$define"
14274                 echo "index() found." >&4
14275         fi
14276 else
14277         if set strchr val -f d_strchr; eval $csym; $val; then
14278                 val="$define"
14279                 vali="$undef"
14280                 echo "strchr() found." >&4
14281         else
14282                 echo "No index() or strchr() found!" >&4
14283                 val="$undef"
14284                 vali="$undef"
14285         fi
14286 fi
14287 set d_strchr; eval $setvar
14288 val="$vali"
14289 set d_index; eval $setvar
14290
14291 : check whether inet_aton exists
14292 set inet_aton d_inetaton
14293 eval $inlibc
14294
14295 : Look for isascii
14296 echo " "
14297 $cat >isascii.c <<EOCP
14298 #include <stdio.h>
14299 #include <ctype.h>
14300 #$i_stdlib I_STDLIB
14301 #ifdef I_STDLIB
14302 #include <stdlib.h>
14303 #endif
14304 int main() {
14305         int c = 'A';
14306         if (isascii(c))
14307                 exit(0);
14308         else
14309                 exit(1);
14310 }
14311 EOCP
14312 set isascii
14313 if eval $compile; then
14314         echo "isascii() found." >&4
14315         val="$define"
14316 else
14317         echo "isascii() NOT found." >&4
14318         val="$undef"
14319 fi
14320 set d_isascii
14321 eval $setvar
14322 $rm -f isascii*
14323
14324 : see if isfinite exists
14325 set isfinite d_isfinite
14326 eval $inlibc
14327
14328 : see if isinf exists
14329 set isinf d_isinf
14330 eval $inlibc
14331
14332 : see if isnan exists
14333 set isnan d_isnan
14334 eval $inlibc
14335
14336 : see if isnanl exists
14337 set isnanl d_isnanl
14338 eval $inlibc
14339
14340 : see if killpg exists
14341 set killpg d_killpg
14342 eval $inlibc
14343
14344 : see if lchown exists
14345 echo " "
14346 $cat > try.c <<'EOCP'
14347 /* System header to define __stub macros and hopefully few prototypes,
14348     which can conflict with char lchown(); below.  */
14349 #include <assert.h>
14350 /* Override any gcc2 internal prototype to avoid an error.  */
14351 /* We use char because int might match the return type of a gcc2
14352    builtin and then its argument prototype would still apply.  */
14353 char lchown();
14354 int main() {
14355     /*  The GNU C library defines this for functions which it implements
14356         to always fail with ENOSYS.  Some functions are actually named
14357         something starting with __ and the normal name is an alias.  */
14358 #if defined (__stub_lchown) || defined (__stub___lchown)
14359 choke me
14360 #else
14361 lchown();
14362 #endif
14363 ; return 0; }
14364 EOCP
14365 set try
14366 if eval $compile; then
14367     $echo "lchown() found." >&4
14368     val="$define"
14369 else
14370     $echo "lchown() NOT found." >&4
14371     val="$undef"
14372 fi
14373 set d_lchown
14374 eval $setvar
14375
14376 : See if number of significant digits in a double precision number is known
14377 echo " "
14378 $cat >ldbl_dig.c <<EOM
14379 #$i_limits I_LIMITS
14380 #$i_float I_FLOAT
14381 #ifdef I_LIMITS
14382 #include <limits.h>
14383 #endif
14384 #ifdef I_FLOAT
14385 #include <float.h>
14386 #endif
14387 #ifdef LDBL_DIG
14388 printf("Contains LDBL_DIG");
14389 #endif
14390 EOM
14391 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14392 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14393         echo "LDBL_DIG found." >&4
14394         val="$define"
14395 else
14396         echo "LDBL_DIG NOT found." >&4
14397         val="$undef"
14398 fi
14399 $rm -f ldbl_dig.?
14400 set d_ldbl_dig
14401 eval $setvar
14402
14403 : see if this is a math.h system
14404 set math.h i_math
14405 eval $inhdr
14406
14407 d_libm_lib_version="$undef"
14408 case $i_math in
14409     $define)
14410         : check to see if math.h defines _LIB_VERSION
14411         echo " "
14412         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14413         $cat >try.c <<EOCP
14414 #include <unistd.h>
14415 #include <math.h>
14416 int main (int argc, char *argv[])
14417 {
14418     printf ("%d\n", _LIB_VERSION);
14419     return (0);
14420     } /* main */
14421 EOCP
14422         set try
14423         if eval $compile; then
14424             foo=`$run ./try`
14425             echo "Yes, it does ($foo)" >&4
14426             d_libm_lib_version="$define"
14427         else
14428             echo "No, it does not (probably harmless)\n" >&4
14429             fi
14430         $rm -f try.* try core core.try.*
14431         ;;
14432
14433     esac
14434
14435 : see if link exists
14436 set link d_link
14437 eval $inlibc
14438
14439 : see if localtime_r exists
14440 set localtime_r d_localtime_r
14441 eval $inlibc
14442 case "$d_localtime_r" in
14443 "$define")
14444         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14445         case "$d_localtime_r_proto:$usethreads" in
14446         ":define")      d_localtime_r_proto=define
14447                 set d_localtime_r_proto localtime_r $hdrs
14448                 eval $hasproto ;;
14449         *)      ;;
14450         esac
14451         case "$d_localtime_r_proto" in
14452         define)
14453         case "$localtime_r_proto" in
14454         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14455         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14456         esac
14457         case "$localtime_r_proto" in
14458         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14459         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14460         esac
14461         case "$localtime_r_proto" in
14462         ''|0)   d_localtime_r=undef
14463                 localtime_r_proto=0
14464                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14465         * )     case "$localtime_r_proto" in
14466                 REENTRANT_PROTO*) ;;
14467                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14468                 esac
14469                 echo "Prototype: $try" ;;
14470         esac
14471         ;;
14472         *)      case "$usethreads" in
14473                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14474                 esac
14475                 d_localtime_r=undef
14476                 localtime_r_proto=0
14477                 ;;
14478         esac
14479         ;;
14480 *)      localtime_r_proto=0
14481         ;;
14482 esac
14483
14484 : see if localeconv exists
14485 set localeconv d_locconv
14486 eval $inlibc
14487
14488 : see if lockf exists
14489 set lockf d_lockf
14490 eval $inlibc
14491
14492 : see if prototype for lseek is available
14493 echo " "
14494 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14495 eval $hasproto
14496
14497 : see if lstat exists
14498 set lstat d_lstat
14499 eval $inlibc
14500
14501 : see if madvise exists
14502 set madvise d_madvise
14503 eval $inlibc
14504
14505 : see if malloc_size exists
14506 set malloc_size d_malloc_size
14507 eval $inlibc
14508
14509 : see if malloc_size_good exists
14510 set malloc_good_size d_malloc_good_size
14511 eval $inlibc
14512
14513 : see if mblen exists
14514 set mblen d_mblen
14515 eval $inlibc
14516
14517 : see if mbstowcs exists
14518 set mbstowcs d_mbstowcs
14519 eval $inlibc
14520
14521 : see if mbtowc exists
14522 set mbtowc d_mbtowc
14523 eval $inlibc
14524
14525 : see if memchr exists
14526 set memchr d_memchr
14527 eval $inlibc
14528
14529 : see if memcmp exists
14530 set memcmp d_memcmp
14531 eval $inlibc
14532
14533 : see if memcpy exists
14534 set memcpy d_memcpy
14535 eval $inlibc
14536
14537 : see if memmove exists
14538 set memmove d_memmove
14539 eval $inlibc
14540
14541 : see if memset exists
14542 set memset d_memset
14543 eval $inlibc
14544
14545 : see if mkdir exists
14546 set mkdir d_mkdir
14547 eval $inlibc
14548
14549 : see if mkdtemp exists
14550 set mkdtemp d_mkdtemp
14551 eval $inlibc
14552
14553 : see if mkfifo exists
14554 set mkfifo d_mkfifo
14555 eval $inlibc
14556
14557 : see if mkstemp exists
14558 set mkstemp d_mkstemp
14559 eval $inlibc
14560
14561 : see if mkstemps exists
14562 set mkstemps d_mkstemps
14563 eval $inlibc
14564
14565 : see if mktime exists
14566 set mktime d_mktime
14567 eval $inlibc
14568
14569 : see if this is a sys/mman.h system
14570 set sys/mman.h i_sysmman
14571 eval $inhdr
14572
14573 : see if mmap exists
14574 set mmap d_mmap
14575 eval $inlibc
14576 : see what shmat returns
14577 : default to something harmless
14578 mmaptype='void *'
14579 case "$i_sysmman$d_mmap" in
14580 "$define$define")
14581         $cat >mmap.c <<'END'
14582 #include <sys/mman.h>
14583 void *mmap();
14584 END
14585         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14586                 mmaptype='void *'
14587         else
14588                 mmaptype='caddr_t'
14589         fi
14590         echo "and it returns ($mmaptype)." >&4
14591         ;;
14592 esac
14593
14594
14595
14596 : see if sqrtl exists
14597 set sqrtl d_sqrtl
14598 eval $inlibc
14599
14600 : see if scalbnl exists
14601 set scalbnl d_scalbnl
14602 eval $inlibc
14603
14604 : see if modfl exists
14605 set modfl d_modfl
14606 eval $inlibc
14607
14608 : see if prototype for modfl is available
14609 echo " "
14610 set d_modflproto modfl $i_math math.h
14611 eval $hasproto
14612
14613 d_modfl_pow32_bug="$undef"
14614
14615 case "$d_longdbl$d_modfl" in
14616 $define$define)
14617         $cat <<EOM
14618 Checking to see whether your modfl() is okay for large values...
14619 EOM
14620 $cat >try.c <<EOCP
14621 #include <math.h> 
14622 #include <stdio.h>
14623 EOCP
14624 if $test "X$d_modflproto" != "X$define"; then
14625         $cat >>try.c <<EOCP
14626 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14627 long double modfl (long double, long double *);
14628 EOCP
14629 fi
14630 $cat >>try.c <<EOCP
14631 int main() {
14632     long double nv = 4294967303.15;
14633     long double v, w;
14634     v = modfl(nv, &w);         
14635 #ifdef __GLIBC__
14636     printf("glibc");
14637 #endif
14638     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14639     return 0;
14640 }
14641 EOCP
14642         case "$osname:$gccversion" in
14643         aix:)   saveccflags="$ccflags"
14644                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14645         esac
14646         set try
14647         if eval $compile; then
14648                 foo=`$run ./try`
14649                 case "$foo" in
14650                 *" 4294967303.150000 1.150000 4294967302.000000")
14651                         echo >&4 "Your modfl() is broken for large values."
14652                         d_modfl_pow32_bug="$define"
14653                         case "$foo" in
14654                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14655                         ;;
14656                         esac
14657                         ;;
14658                 *" 4294967303.150000 0.150000 4294967303.000000")
14659                         echo >&4 "Your modfl() seems okay for large values."
14660                         ;;
14661                 *)      echo >&4 "I don't understand your modfl() at all."
14662                         d_modfl="$undef"
14663                         ;;
14664                 esac
14665                 $rm -f try.* try core core.try.*
14666         else
14667                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14668                 d_modfl="$undef"
14669         fi
14670         case "$osname:$gccversion" in
14671         aix:)   ccflags="$saveccflags" ;; # restore
14672         esac
14673         ;;
14674 esac
14675
14676 if $test "$uselongdouble" = "$define"; then
14677     message=""
14678     if $test "$d_sqrtl" != "$define"; then
14679         message="$message sqrtl"
14680     fi
14681     if $test "$d_modfl" != "$define"; then
14682         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14683             echo "You have both aintl and copysignl, so I can emulate modfl."
14684         else
14685             message="$message modfl"
14686         fi
14687     fi
14688     if $test "$d_frexpl" != "$define"; then
14689         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14690             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14691         else
14692             message="$message frexpl"
14693         fi
14694     fi
14695
14696     if $test "$message" != ""; then
14697         $cat <<EOM >&4
14698
14699 *** You requested the use of long doubles but you do not seem to have
14700 *** the following mathematical functions needed for long double support:
14701 ***    $message
14702 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14703 *** Cannot continue, aborting.
14704
14705 EOM
14706
14707         exit 1
14708     fi
14709 fi
14710
14711 : see if mprotect exists
14712 set mprotect d_mprotect
14713 eval $inlibc
14714
14715 : see if msgctl exists
14716 set msgctl d_msgctl
14717 eval $inlibc
14718
14719 : see if msgget exists
14720 set msgget d_msgget
14721 eval $inlibc
14722
14723 : see if msgsnd exists
14724 set msgsnd d_msgsnd
14725 eval $inlibc
14726
14727 : see if msgrcv exists
14728 set msgrcv d_msgrcv
14729 eval $inlibc
14730
14731 : see how much of the 'msg*(2)' library is present.
14732 h_msg=true
14733 echo " "
14734 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14735 *"$undef"*) h_msg=false;;
14736 esac
14737 case "$osname" in
14738 freebsd)
14739     case "`ipcs 2>&1`" in
14740     "SVID messages"*"not configured"*)
14741         echo "Your $osname does not have the msg*(2) configured." >&4
14742         h_msg=false
14743         val="$undef"
14744         set msgctl d_msgctl
14745         eval $setvar
14746         set msgget d_msgget
14747         eval $setvar
14748         set msgsnd d_msgsnd
14749         eval $setvar
14750         set msgrcv d_msgrcv
14751         eval $setvar
14752         ;;
14753     esac
14754     ;;
14755 esac
14756 : we could also check for sys/ipc.h ...
14757 if $h_msg && $test `./findhdr sys/msg.h`; then
14758         echo "You have the full msg*(2) library." >&4
14759         val="$define"
14760 else
14761         echo "You don't have the full msg*(2) library." >&4
14762         val="$undef"
14763 fi
14764 set d_msg
14765 eval $setvar
14766
14767
14768 echo " "
14769 echo "Checking to see if your system supports struct msghdr..." >&4
14770 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14771 eval $hasstruct
14772 case "$d_msghdr_s" in
14773 "$define")      echo "Yes, it does."   ;;
14774 *)              echo "No, it doesn't." ;;
14775 esac
14776
14777
14778 : see if msync exists
14779 set msync d_msync
14780 eval $inlibc
14781
14782 : see if munmap exists
14783 set munmap d_munmap
14784 eval $inlibc
14785
14786 : see if nice exists
14787 set nice d_nice
14788 eval $inlibc
14789
14790 : see if this is a langinfo.h system
14791 set langinfo.h i_langinfo
14792 eval $inhdr
14793
14794 : see if nl_langinfo exists
14795 set nl_langinfo d_nl_langinfo
14796 eval $inlibc
14797
14798 : check for length of character
14799 echo " "
14800 case "$charsize" in
14801 '')
14802         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14803         $cat >try.c <<EOCP
14804 #include <stdio.h>
14805 #$i_stdlib I_STDLIB
14806 #ifdef I_STDLIB
14807 #include <stdlib.h>
14808 #endif
14809 int main()
14810 {
14811     printf("%d\n", (int)sizeof(char));
14812     exit(0);
14813 }
14814 EOCP
14815         set try
14816         if eval $compile_ok; then
14817                 dflt=`$run ./try`
14818         else
14819                 dflt='1'
14820                 echo "(I can't seem to compile the test program.  Guessing...)"
14821         fi
14822         ;;
14823 *)
14824         dflt="$charsize"
14825         ;;
14826 esac
14827 rp="What is the size of a character (in bytes)?"
14828 . ./myread
14829 charsize="$ans"
14830 $rm -f try.c try
14831
14832 : check for volatile keyword
14833 echo " "
14834 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14835 $cat >try.c <<'EOCP'
14836 int main()
14837 {
14838         typedef struct _goo_struct goo_struct;
14839         goo_struct * volatile goo = ((goo_struct *)0);
14840         struct _goo_struct {
14841                 long long_int;
14842                 int reg_int;
14843                 char char_var;
14844         };
14845         typedef unsigned short foo_t;
14846         char *volatile foo;
14847         volatile int bar;
14848         volatile foo_t blech;
14849         foo = foo;
14850 }
14851 EOCP
14852 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14853         val="$define"
14854         echo "Yup, it does."
14855 else
14856         val="$undef"
14857         echo "Nope, it doesn't."
14858 fi
14859 set d_volatile
14860 eval $setvar
14861 $rm -f try.*
14862
14863
14864 echo " "
14865 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14866
14867 case "$use64bitint:$d_quad:$quadtype" in
14868 define:define:?*)
14869         ivtype="$quadtype"
14870         uvtype="$uquadtype"
14871         ivsize=8
14872         uvsize=8
14873         ;;
14874 *)      ivtype="long"
14875         uvtype="unsigned long"
14876         ivsize=$longsize
14877         uvsize=$longsize
14878         ;;
14879 esac
14880
14881 case "$uselongdouble:$d_longdbl" in
14882 define:define)
14883         nvtype="long double"
14884         nvsize=$longdblsize
14885         ;;
14886 *)      nvtype=double
14887         nvsize=$doublesize
14888         ;;
14889 esac
14890
14891 $echo "(IV will be "$ivtype", $ivsize bytes)"
14892 $echo "(UV will be "$uvtype", $uvsize bytes)"
14893 $echo "(NV will be "$nvtype", $nvsize bytes)"
14894
14895 $cat >try.c <<EOCP
14896 #$i_inttypes I_INTTYPES
14897 #ifdef I_INTTYPES
14898 #include <inttypes.h>
14899 #endif
14900 #include <stdio.h>
14901 int main() {
14902 #ifdef INT8
14903    int8_t i =  INT8_MAX;
14904   uint8_t u = UINT8_MAX;
14905   printf("int8_t\n");
14906 #endif
14907 #ifdef INT16
14908    int16_t i =  INT16_MAX;
14909   uint16_t i = UINT16_MAX;
14910   printf("int16_t\n");
14911 #endif
14912 #ifdef INT32
14913    int32_t i =  INT32_MAX;
14914   uint32_t u = UINT32_MAX;
14915   printf("int32_t\n");
14916 #endif
14917 }
14918 EOCP
14919
14920 case "$i8type" in
14921 '')     case "$charsize" in
14922         1)      i8type=char
14923                 u8type="unsigned char"
14924                 i8size=$charsize
14925                 u8size=$charsize
14926                 ;;
14927         esac
14928         ;;
14929 esac
14930 case "$i8type" in
14931 '')     set try -DINT8
14932         if eval $compile; then
14933                 case "`$run ./try`" in
14934                 int8_t) i8type=int8_t
14935                         u8type=uint8_t
14936                         i8size=1
14937                         u8size=1
14938                         ;;
14939                 esac
14940         fi
14941         ;;
14942 esac
14943 case "$i8type" in
14944 '')     if $test $charsize -ge 1; then
14945                 i8type=char
14946                 u8type="unsigned char"
14947                 i8size=$charsize
14948                 u8size=$charsize
14949         fi
14950         ;;
14951 esac
14952
14953 case "$i16type" in
14954 '')     case "$shortsize" in
14955         2)      i16type=short
14956                 u16type="unsigned short"
14957                 i16size=$shortsize
14958                 u16size=$shortsize
14959                 ;;
14960         esac
14961         ;;
14962 esac
14963 case "$i16type" in
14964 '')     set try -DINT16
14965         if eval $compile; then
14966                 case "`$run ./try`" in
14967                 int16_t)
14968                         i16type=int16_t
14969                         u16type=uint16_t
14970                         i16size=2
14971                         u16size=2
14972                         ;;
14973                 esac
14974         fi
14975         ;;
14976 esac
14977 case "$i16type" in
14978 '')     if $test $shortsize -ge 2; then
14979                 i16type=short
14980                 u16type="unsigned short"
14981                 i16size=$shortsize
14982                 u16size=$shortsize
14983         fi
14984         ;;
14985 esac
14986
14987 case "$i32type" in
14988 '')     case "$longsize" in
14989         4)      i32type=long
14990                 u32type="unsigned long"
14991                 i32size=$longsize
14992                 u32size=$longsize
14993                 ;;
14994         *)      case "$intsize" in
14995                 4)      i32type=int
14996                         u32type="unsigned int"
14997                         i32size=$intsize
14998                         u32size=$intsize
14999                         ;;
15000                 esac
15001                 ;;
15002         esac
15003         ;;
15004 esac
15005 case "$i32type" in
15006 '')     set try -DINT32
15007         if eval $compile; then
15008                 case "`$run ./try`" in
15009                 int32_t)
15010                         i32type=int32_t
15011                         u32type=uint32_t
15012                         i32size=4
15013                         u32size=4
15014                         ;;
15015                 esac
15016         fi
15017         ;;
15018 esac
15019 case "$i32type" in
15020 '')     if $test $intsize -ge 4; then
15021                 i32type=int
15022                 u32type="unsigned int"
15023                 i32size=$intsize
15024                 u32size=$intsize
15025         fi
15026         ;;
15027 esac
15028
15029 case "$i64type" in
15030 '')     case "$d_quad:$quadtype" in
15031         define:?*)
15032                 i64type="$quadtype"
15033                 u64type="$uquadtype"
15034                 i64size=8
15035                 u64size=8
15036                 ;;
15037         esac
15038         ;;
15039 esac
15040
15041 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15042 : volatile so that the compiler has to store it out to memory.
15043 if test X"$d_volatile" = X"$define"; then
15044         volatile=volatile
15045 fi
15046 $cat <<EOP >try.c
15047 #include <stdio.h>
15048 #$i_stdlib I_STDLIB
15049 #ifdef I_STDLIB
15050 #include <stdlib.h>
15051 #endif
15052 #include <sys/types.h>
15053 #include <signal.h>
15054 #ifdef SIGFPE
15055 $volatile int bletched = 0;
15056 $signal_t blech(int s) { bletched = 1; }
15057 #endif
15058 int main() {
15059     $uvtype u = 0;
15060     $nvtype d;
15061     int     n = 8 * $uvsize;
15062     int     i;
15063 #ifdef SIGFPE
15064     signal(SIGFPE, blech);
15065 #endif
15066
15067     for (i = 0; i < n; i++) {
15068       u = u << 1 | ($uvtype)1;
15069       d = ($nvtype)u;
15070       if (($uvtype)d != u)
15071         break;
15072       if (d <= 0)
15073         break;
15074       d = ($nvtype)(u - 1);
15075       if (($uvtype)d != (u - 1))
15076         break;
15077 #ifdef SIGFPE
15078       if (bletched) {
15079         break;
15080 #endif
15081       } 
15082     }
15083     printf("%d\n", ((i == n) ? -n : i));
15084     exit(0);
15085 }
15086 EOP
15087 set try
15088
15089 d_nv_preserves_uv="$undef"
15090 if eval $compile; then
15091         nv_preserves_uv_bits="`$run ./try`"
15092 fi
15093 case "$nv_preserves_uv_bits" in
15094 \-[1-9]*)       
15095         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15096         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15097         d_nv_preserves_uv="$define"
15098         ;;
15099 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15100         d_nv_preserves_uv="$undef" ;;
15101 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15102         nv_preserves_uv_bits="$undef" ;;
15103 esac
15104
15105 $rm -f try.* try
15106
15107 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15108 : volatile so that the compiler has to store it out to memory.
15109 if test X"$d_volatile" = X"$define"; then
15110         volatile=volatile
15111 fi
15112 $cat <<EOP >try.c
15113 #include <stdio.h>
15114 #$i_stdlib I_STDLIB
15115 #ifdef I_STDLIB
15116 #include <stdlib.h>
15117 #endif
15118 #$i_string I_STRING
15119 #ifdef I_STRING
15120 #  include <string.h>
15121 #else
15122 #  include <strings.h>
15123 #endif
15124 #include <sys/types.h>
15125 #include <signal.h>
15126 #ifdef SIGFPE
15127 $volatile int bletched = 0;
15128 $signal_t blech(int s) { bletched = 1; }
15129 #endif
15130
15131 int checkit($nvtype d, char *where) {
15132     unsigned char *p = (char *)&d;
15133     unsigned char *end = p + sizeof(d);
15134     int fail = 0;
15135
15136     while (p < end)
15137         fail += *p++;
15138
15139     if (!fail)
15140         return 0;
15141
15142     p = (char *)&d;
15143     printf("No - %s: 0x", where);
15144     while (p < end)
15145         printf ("%02X", *p++);
15146     printf("\n");
15147     return 1;
15148 }
15149
15150 int main(int argc, char **argv) {
15151     $nvtype d = 0.0;
15152     int fail = 0;
15153     fail += checkit(d, "0.0");
15154
15155     /* The compiler shouldn't be assuming that bletched is 0  */
15156     d = bletched;
15157
15158     fail += checkit(d, "bleched");
15159
15160 #ifdef SIGFPE
15161     signal(SIGFPE, blech);
15162 #endif
15163
15164     /* Paranoia - the compiler should have no way of knowing that ANSI says
15165        that argv[argc] will always be NULL.  Actually, if it did assume this it
15166        would be buggy, as this is C and main() can be called from elsewhere in
15167        the program.  */
15168     d = argv[argc] ? 1 : 0;
15169
15170     if (d) {
15171         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15172     }
15173
15174     fail += checkit(d, "ternary");
15175
15176     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15177
15178     if (d != 0.0) {
15179         printf("No - memset doesn't give 0.0\n");
15180         /* This might just blow up:  */
15181         printf("(gives %g)\n", d);
15182         return 1;
15183     }
15184     
15185 #ifdef SIGFPE
15186     if (bletched) {
15187         printf("No - something bleched\n");
15188         return 1;
15189     }
15190 #endif
15191     if (fail) {
15192       printf("No - %d fail(s)\n", fail);
15193       return 1;
15194     }
15195     printf("Yes\n");
15196     return 0;
15197 }
15198 EOP
15199 set try
15200
15201 d_nv_zero_is_allbits_zero="$undef"
15202 if eval $compile; then
15203     xxx="`$run ./try`"
15204     case "$?" in
15205         0)
15206             case "$xxx" in
15207                 Yes)  cat >&4 <<EOM
15208 0.0 is represented as all bits zero in memory
15209 EOM
15210                     d_nv_zero_is_allbits_zero="$define"
15211                     ;;
15212                 *)  cat >&4 <<EOM
15213 0.0 is not represented as all bits zero in memory
15214 EOM
15215                     d_nv_zero_is_allbits_zero="$undef"
15216                     ;;
15217             esac
15218             ;;
15219         *)  cat >&4 <<EOM
15220 0.0 is not represented as all bits zero in memory
15221 EOM
15222             d_nv_zero_is_allbits_zero="$undef"
15223             ;;
15224     esac
15225 fi
15226
15227 $rm -f try.* try
15228
15229
15230 : check for off64_t
15231 echo " "
15232 echo "Checking to see if you have off64_t..." >&4
15233 $cat >try.c <<EOCP
15234 #include <sys/types.h>
15235 #include <unistd.h>
15236 int main() { off64_t x = 7; }
15237 EOCP
15238 set try
15239 if eval $compile; then
15240         val="$define"
15241         echo "You have off64_t."
15242 else
15243         val="$undef"
15244         echo "You do not have off64_t."
15245         case "$lseeksize" in
15246         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15247         esac
15248 fi
15249 $rm -f try.* try
15250 set d_off64_t
15251 eval $setvar
15252
15253 : how to create joinable pthreads
15254 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15255         echo " "
15256         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15257         $cat >try.c <<'EOCP'
15258 #include <pthread.h>
15259 int main() {
15260     int detachstate = JOINABLE;
15261 }
15262 EOCP
15263         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15264         if eval $compile; then
15265                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15266                 val="$undef" # Yes, undef.
15267                 set d_old_pthread_create_joinable
15268                 eval $setvar
15269                 val=""
15270                 set old_pthread_create_joinable
15271                 eval $setvar
15272         else
15273                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15274                 if eval $compile; then
15275                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15276                         val="$define"
15277                         set d_old_pthread_create_joinable
15278                         eval $setvar
15279                         val=PTHREAD_CREATE_UNDETACHED
15280                         set old_pthread_create_joinable
15281                         eval $setvar
15282                 else            
15283                         set try -DJOINABLE=__UNDETACHED
15284                         if eval $compile; then
15285                                 echo "You seem to use __UNDETACHED." >&4
15286                                 val="$define"
15287                                 set d_old_pthread_create_joinable
15288                                 eval $setvar
15289                                 val=__UNDETACHED
15290                                 set old_pthread_create_joinable
15291                                 eval $setvar
15292                         else
15293                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15294                                 val="$define"
15295                                 set d_old_pthread_create_joinable
15296                                 eval $setvar
15297                                 val=0
15298                                 set old_pthread_create_joinable
15299                                 eval $setvar
15300                         fi
15301                 fi
15302         fi
15303         $rm -f try try.*
15304 else
15305     d_old_pthread_create_joinable="$undef"
15306     old_pthread_create_joinable=""
15307 fi
15308
15309 : see if pause exists
15310 set pause d_pause
15311 eval $inlibc
15312
15313 : see if pipe exists
15314 set pipe d_pipe
15315 eval $inlibc
15316
15317 : see if poll exists
15318 set poll d_poll
15319 eval $inlibc
15320
15321 : see if readlink exists
15322 set readlink d_readlink
15323 eval $inlibc
15324
15325 echo " "
15326 procselfexe=''
15327 val="$undef"
15328 case "$d_readlink" in
15329 "$define")
15330         if $issymlink /proc/self/exe ; then
15331                 $ls -l /proc/self/exe > reflect
15332                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15333                         echo "You have Linux-like /proc/self/exe."
15334                         procselfexe='"/proc/self/exe"'
15335                         val="$define"
15336                 fi
15337         fi
15338         if $issymlink /proc/curproc/file ; then
15339                 $ls -l /proc/curproc/file > reflect
15340                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15341                         echo "You have BSD-like /proc/curproc/file."
15342                         procselfexe='"/proc/curproc/file"'
15343                         val="$define"
15344                 fi
15345         fi
15346         ;;
15347 esac
15348 $rm -f reflect
15349 set d_procselfexe
15350 eval $setvar
15351
15352 : see whether the pthread_atfork exists
15353 $cat >try.c <<EOP
15354 #include <pthread.h>
15355 #include <stdio.h>
15356 int main() {
15357 #ifdef  PTHREAD_ATFORK
15358         pthread_atfork(NULL,NULL,NULL);
15359 #endif
15360 }
15361 EOP
15362
15363 : see if pthread_atfork exists
15364 set try -DPTHREAD_ATFORK
15365 if eval $compile; then
15366     val="$define"
15367 else
15368     val="$undef"
15369 fi
15370 case "$usethreads" in
15371 $define)
15372         case "$val" in
15373         $define) echo 'pthread_atfork found.' >&4        ;;
15374         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15375         esac
15376 esac
15377 set d_pthread_atfork
15378 eval $setvar
15379
15380 : see if pthread_attr_setscope exists
15381 set pthread_attr_setscope d_pthread_attr_setscope
15382 eval $inlibc
15383
15384
15385 : see whether the various POSIXish _yields exist
15386 $cat >try.c <<EOP
15387 #include <pthread.h>
15388 #include <stdio.h>
15389 int main() {
15390 #ifdef SCHED_YIELD
15391         sched_yield();
15392 #else
15393 #ifdef PTHREAD_YIELD
15394         pthread_yield();
15395 #else
15396 #ifdef PTHREAD_YIELD_NULL
15397         pthread_yield(NULL);
15398 #endif
15399 #endif
15400 #endif
15401 }
15402 EOP
15403 : see if sched_yield exists
15404 set try -DSCHED_YIELD
15405 if eval $compile; then
15406     val="$define"
15407     sched_yield='sched_yield()'
15408 else
15409     val="$undef"
15410 fi
15411 case "$usethreads" in
15412 $define)
15413         case "$val" in
15414         $define) echo 'sched_yield() found.' >&4        ;;
15415         *)       echo 'sched_yield() NOT found.' >&4    ;;
15416         esac
15417 esac
15418 set d_sched_yield
15419 eval $setvar
15420
15421 : see if pthread_yield exists
15422 set try -DPTHREAD_YIELD
15423 if eval $compile; then
15424     val="$define"
15425     case "$sched_yield" in
15426     '') sched_yield='pthread_yield()' ;;
15427     esac
15428 else
15429     set try -DPTHREAD_YIELD_NULL
15430     if eval $compile; then
15431         val="$define"
15432         case "$sched_yield" in
15433         '') sched_yield='pthread_yield(NULL)' ;;
15434         esac
15435     else
15436         val="$undef"
15437     fi
15438 fi
15439 case "$usethreads" in
15440 $define)
15441         case "$val" in
15442         $define) echo 'pthread_yield() found.' >&4      ;;
15443         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15444         esac
15445         ;;
15446 esac
15447 set d_pthread_yield
15448 eval $setvar
15449
15450 case "$sched_yield" in
15451 '') sched_yield=undef ;;
15452 esac
15453
15454 $rm -f try try.*
15455
15456 : see if random_r exists
15457 set random_r d_random_r
15458 eval $inlibc
15459 case "$d_random_r" in
15460 "$define")
15461         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15462         case "$d_random_r_proto:$usethreads" in
15463         ":define")      d_random_r_proto=define
15464                 set d_random_r_proto random_r $hdrs
15465                 eval $hasproto ;;
15466         *)      ;;
15467         esac
15468         case "$d_random_r_proto" in
15469         define)
15470         case "$random_r_proto" in
15471         ''|0) try='int random_r(int*, struct random_data*);'
15472         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15473         esac
15474         case "$random_r_proto" in
15475         ''|0) try='int random_r(long*, struct random_data*);'
15476         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15477         esac
15478         case "$random_r_proto" in
15479         ''|0) try='int random_r(struct random_data*, int32_t*);'
15480         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15481         esac
15482         case "$random_r_proto" in
15483         ''|0)   d_random_r=undef
15484                 random_r_proto=0
15485                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15486         * )     case "$random_r_proto" in
15487                 REENTRANT_PROTO*) ;;
15488                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15489                 esac
15490                 echo "Prototype: $try" ;;
15491         esac
15492         ;;
15493         *)      case "$usethreads" in
15494                 define) echo "random_r has no prototype, not using it." >&4 ;;
15495                 esac
15496                 d_random_r=undef
15497                 random_r_proto=0
15498                 ;;
15499         esac
15500         ;;
15501 *)      random_r_proto=0
15502         ;;
15503 esac
15504
15505 : see if readdir and friends exist
15506 set readdir d_readdir
15507 eval $inlibc
15508 set seekdir d_seekdir
15509 eval $inlibc
15510 set telldir d_telldir
15511 eval $inlibc
15512 set rewinddir d_rewinddir
15513 eval $inlibc
15514
15515 : see if readdir64_r exists
15516 set readdir64_r d_readdir64_r
15517 eval $inlibc
15518 case "$d_readdir64_r" in
15519 "$define")
15520         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15521         case "$d_readdir64_r_proto:$usethreads" in
15522         ":define")      d_readdir64_r_proto=define
15523                 set d_readdir64_r_proto readdir64_r $hdrs
15524                 eval $hasproto ;;
15525         *)      ;;
15526         esac
15527         case "$d_readdir64_r_proto" in
15528         define)
15529         case "$readdir64_r_proto" in
15530         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15531         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15532         esac
15533         case "$readdir64_r_proto" in
15534         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15535         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15536         esac
15537         case "$readdir64_r_proto" in
15538         ''|0)   d_readdir64_r=undef
15539                 readdir64_r_proto=0
15540                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15541         * )     case "$readdir64_r_proto" in
15542                 REENTRANT_PROTO*) ;;
15543                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15544                 esac
15545                 echo "Prototype: $try" ;;
15546         esac
15547         ;;
15548         *)      case "$usethreads" in
15549                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15550                 esac
15551                 d_readdir64_r=undef
15552                 readdir64_r_proto=0
15553                 ;;
15554         esac
15555         ;;
15556 *)      readdir64_r_proto=0
15557         ;;
15558 esac
15559
15560 : see if readdir_r exists
15561 set readdir_r d_readdir_r
15562 eval $inlibc
15563 case "$d_readdir_r" in
15564 "$define")
15565         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15566         case "$d_readdir_r_proto:$usethreads" in
15567         ":define")      d_readdir_r_proto=define
15568                 set d_readdir_r_proto readdir_r $hdrs
15569                 eval $hasproto ;;
15570         *)      ;;
15571         esac
15572         case "$d_readdir_r_proto" in
15573         define)
15574         case "$readdir_r_proto" in
15575         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15576         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15577         esac
15578         case "$readdir_r_proto" in
15579         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15580         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15581         esac
15582         case "$readdir_r_proto" in
15583         ''|0)   d_readdir_r=undef
15584                 readdir_r_proto=0
15585                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15586         * )     case "$readdir_r_proto" in
15587                 REENTRANT_PROTO*) ;;
15588                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15589                 esac
15590                 echo "Prototype: $try" ;;
15591         esac
15592         ;;
15593         *)      case "$usethreads" in
15594                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15595                 esac
15596                 d_readdir_r=undef
15597                 readdir_r_proto=0
15598                 ;;
15599         esac
15600         ;;
15601 *)      readdir_r_proto=0
15602         ;;
15603 esac
15604
15605 : see if readv exists
15606 set readv d_readv
15607 eval $inlibc
15608
15609 : see if recvmsg exists
15610 set recvmsg d_recvmsg
15611 eval $inlibc
15612
15613 : see if rename exists
15614 set rename d_rename
15615 eval $inlibc
15616
15617 : see if rmdir exists
15618 set rmdir d_rmdir
15619 eval $inlibc
15620
15621 : see if memory.h is available.
15622 val=''
15623 set memory.h val
15624 eval $inhdr
15625
15626 : See if it conflicts with string.h
15627 case "$val" in
15628 $define)
15629         case "$strings" in
15630         '') ;;
15631         *)
15632                 $cppstdin $cppflags $cppminus < $strings > mem.h
15633                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15634                         echo " "
15635                         echo "We won't be including <memory.h>."
15636                         val="$undef"
15637                 fi
15638                 $rm -f mem.h
15639                 ;;
15640         esac
15641 esac
15642 set i_memory
15643 eval $setvar
15644
15645 : can bcopy handle overlapping blocks?
15646 echo " "
15647 val="$undef"
15648 case "$d_memmove" in
15649 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15650 *)      case "$d_bcopy" in
15651         "$define")
15652                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15653                 $cat >try.c <<EOCP
15654 #$i_memory I_MEMORY
15655 #$i_stdlib I_STDLIB
15656 #$i_string I_STRING
15657 #$i_unistd I_UNISTD
15658 EOCP
15659         $cat >>try.c <<'EOCP'
15660 #include <stdio.h>
15661 #ifdef I_MEMORY
15662 #  include <memory.h>
15663 #endif
15664 #ifdef I_STDLIB
15665 #  include <stdlib.h>
15666 #endif
15667 #ifdef I_STRING
15668 #  include <string.h>
15669 #else
15670 #  include <strings.h>
15671 #endif
15672 #ifdef I_UNISTD
15673 #  include <unistd.h>  /* Needed for NetBSD */
15674 #endif
15675 int main()
15676 {
15677 char buf[128], abc[128];
15678 char *b;
15679 int len;
15680 int off;
15681 int align;
15682
15683 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15684    try to store the string in read-only memory. */
15685 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15686
15687 for (align = 7; align >= 0; align--) {
15688         for (len = 36; len; len--) {
15689                 b = buf+align;
15690                 bcopy(abc, b, len);
15691                 for (off = 1; off <= len; off++) {
15692                         bcopy(b, b+off, len);
15693                         bcopy(b+off, b, len);
15694                         if (bcmp(b, abc, len))
15695                                 exit(1);
15696                 }
15697         }
15698 }
15699 exit(0);
15700 }
15701 EOCP
15702                 set try
15703                 if eval $compile_ok; then
15704                         if ./try 2>/dev/null; then
15705                                 echo "Yes, it can."
15706                                 val="$define"
15707                         else
15708                                 echo "It can't, sorry."
15709                         fi
15710                 else
15711                         echo "(I can't compile the test program, so we'll assume not...)"
15712                 fi
15713                 ;;
15714         esac
15715         $rm -f try.* try core
15716         ;;
15717 esac
15718 set d_safebcpy
15719 eval $setvar
15720
15721 : can memcpy handle overlapping blocks?
15722 echo " "
15723 val="$undef"
15724 case "$d_memmove" in
15725 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15726 *)      case "$d_memcpy" in
15727         "$define")
15728                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15729                 $cat >try.c <<EOCP
15730 #$i_memory I_MEMORY
15731 #$i_stdlib I_STDLIB
15732 #$i_string I_STRING
15733 #$i_unistd I_UNISTD
15734 EOCP
15735         $cat >>try.c <<'EOCP'
15736 #include <stdio.h>
15737 #ifdef I_MEMORY
15738 #  include <memory.h>
15739 #endif
15740 #ifdef I_STDLIB
15741 #  include <stdlib.h>
15742 #endif
15743 #ifdef I_STRING
15744 #  include <string.h>
15745 #else
15746 #  include <strings.h>
15747 #endif
15748 #ifdef I_UNISTD
15749 #  include <unistd.h>  /* Needed for NetBSD */
15750 #endif
15751 int main()
15752 {
15753 char buf[128], abc[128];
15754 char *b;
15755 int len;
15756 int off;
15757 int align;
15758
15759 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15760    try to store the string in read-only memory. */
15761 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15762
15763 for (align = 7; align >= 0; align--) {
15764         for (len = 36; len; len--) {
15765                 b = buf+align;
15766                 memcpy(b, abc, len);
15767                 for (off = 1; off <= len; off++) {
15768                         memcpy(b+off, b, len);
15769                         memcpy(b, b+off, len);
15770                         if (memcmp(b, abc, len))
15771                                 exit(1);
15772                 }
15773         }
15774 }
15775 exit(0);
15776 }
15777 EOCP
15778                 set try
15779                 if eval $compile_ok; then
15780                         if ./try 2>/dev/null; then
15781                                 echo "Yes, it can."
15782                                 val="$define"
15783                         else
15784                                 echo "It can't, sorry."
15785                         fi
15786                 else
15787                         echo "(I can't compile the test program, so we'll assume not...)"
15788                 fi
15789                 ;;
15790         esac
15791         $rm -f try.* try core
15792         ;;
15793 esac
15794 set d_safemcpy
15795 eval $setvar
15796
15797 : can memcmp be trusted to compare relative magnitude?
15798 val="$undef"
15799 case "$d_memcmp" in
15800 "$define")
15801         echo " "
15802         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15803         $cat >try.c <<EOCP
15804 #$i_memory I_MEMORY
15805 #$i_stdlib I_STDLIB
15806 #$i_string I_STRING
15807 #$i_unistd I_UNISTD
15808 EOCP
15809         $cat >>try.c <<'EOCP'
15810 #include <stdio.h>
15811 #ifdef I_MEMORY
15812 #  include <memory.h>
15813 #endif
15814 #ifdef I_STDLIB
15815 #  include <stdlib.h>
15816 #endif
15817 #ifdef I_STRING
15818 #  include <string.h>
15819 #else
15820 #  include <strings.h>
15821 #endif
15822 #ifdef I_UNISTD
15823 #  include <unistd.h>  /* Needed for NetBSD */
15824 #endif
15825 int main()
15826 {
15827 char a = -1;
15828 char b = 0;
15829 if ((a < b) && memcmp(&a, &b, 1) < 0)
15830         exit(1);
15831 exit(0);
15832 }
15833 EOCP
15834         set try
15835         if eval $compile_ok; then
15836                 if $run ./try 2>/dev/null; then
15837                         echo "Yes, it can."
15838                         val="$define"
15839                 else
15840                         echo "No, it can't (it uses signed chars)."
15841                 fi
15842         else
15843                 echo "(I can't compile the test program, so we'll assume not...)"
15844         fi
15845         ;;
15846 esac
15847 $rm -f try.* try core
15848 set d_sanemcmp
15849 eval $setvar
15850
15851 : see if prototype for sbrk is available
15852 echo " "
15853 set d_sbrkproto sbrk $i_unistd unistd.h
15854 eval $hasproto
15855
15856 : see if select exists
15857 set select d_select
15858 eval $inlibc
15859
15860 : see if semctl exists
15861 set semctl d_semctl
15862 eval $inlibc
15863
15864 : see if semget exists
15865 set semget d_semget
15866 eval $inlibc
15867
15868 : see if semop exists
15869 set semop d_semop
15870 eval $inlibc
15871
15872 : see how much of the 'sem*(2)' library is present.
15873 h_sem=true
15874 echo " "
15875 case "$d_semctl$d_semget$d_semop" in
15876 *"$undef"*) h_sem=false;;
15877 esac
15878 case "$osname" in
15879 freebsd)
15880     case "`ipcs 2>&1`" in
15881     "SVID messages"*"not configured"*)
15882         echo "Your $osname does not have the sem*(2) configured." >&4
15883         h_sem=false
15884         val="$undef"
15885         set semctl d_semctl
15886         eval $setvar
15887         set semget d_semget
15888         eval $setvar
15889         set semop d_semop
15890         eval $setvar
15891         ;;
15892     esac
15893     ;;
15894 esac
15895 : we could also check for sys/ipc.h ...
15896 if $h_sem && $test `./findhdr sys/sem.h`; then
15897         echo "You have the full sem*(2) library." >&4
15898         val="$define"
15899 else
15900         echo "You don't have the full sem*(2) library." >&4
15901         val="$undef"
15902 fi
15903 set d_sem
15904 eval $setvar
15905
15906 : see whether sys/sem.h defines union semun
15907 echo " "
15908 $cat > try.c <<'END'
15909 #include <sys/types.h>
15910 #include <sys/ipc.h>
15911 #include <sys/sem.h>
15912 int main () { union semun semun; semun.buf = 0; }
15913 END
15914 set try
15915 if eval $compile; then
15916     echo "You have union semun in <sys/sem.h>." >&4
15917     val="$define"
15918 else
15919     echo "You do not have union semun in <sys/sem.h>." >&4
15920     val="$undef"
15921 fi
15922 $rm -f try try.c
15923 set d_union_semun
15924 eval $setvar
15925
15926 : see how to do semctl IPC_STAT
15927 case "$d_sem" in
15928 $define)
15929     echo " "
15930     $cat > try.h <<END
15931 #ifndef S_IRUSR
15932 #   ifdef S_IREAD
15933 #       define S_IRUSR S_IREAD
15934 #       define S_IWUSR S_IWRITE
15935 #       define S_IXUSR S_IEXEC
15936 #   else
15937 #       define S_IRUSR 0400
15938 #       define S_IWUSR 0200
15939 #       define S_IXUSR 0100
15940 #   endif
15941 #   define S_IRGRP (S_IRUSR>>3)
15942 #   define S_IWGRP (S_IWUSR>>3)
15943 #   define S_IXGRP (S_IXUSR>>3)
15944 #   define S_IROTH (S_IRUSR>>6)
15945 #   define S_IWOTH (S_IWUSR>>6)
15946 #   define S_IXOTH (S_IXUSR>>6)
15947 #endif
15948 #ifndef S_IRWXU
15949 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15950 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15951 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15952 #endif
15953 END
15954     : see whether semctl IPC_STAT can use union semun
15955     case "$d_semctl_semun" in
15956     '')
15957       val="$undef"
15958       $cat > try.c <<END
15959 #include <sys/types.h>
15960 #include <sys/ipc.h>
15961 #include <sys/sem.h>
15962 #include <sys/stat.h>
15963 #include <stdio.h>
15964 #include <errno.h>
15965 #include "try.h"
15966 #ifndef errno
15967 extern int errno;
15968 #endif
15969 #$d_union_semun HAS_UNION_SEMUN
15970 int main() {
15971     union semun
15972 #ifndef HAS_UNION_SEMUN
15973     {
15974         int val;
15975         struct semid_ds *buf;
15976         unsigned short *array;
15977     }
15978 #endif
15979     arg;
15980     int sem, st;
15981
15982 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15983     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15984     if (sem > -1) {
15985         struct semid_ds argbuf;
15986         arg.buf = &argbuf;
15987 #       ifdef IPC_STAT
15988         st = semctl(sem, 0, IPC_STAT, arg);
15989         if (st == 0)
15990             printf("semun\n");
15991         else
15992 #       endif /* IPC_STAT */
15993             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15994 #       ifdef IPC_RMID
15995         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15996 #       endif /* IPC_RMID */
15997             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15998     } else
15999 #endif /* IPC_PRIVATE && ... */
16000         printf("semget failed: errno = %d\n", errno);
16001   return 0;
16002 }
16003 END
16004       set try
16005       if eval $compile; then
16006           xxx=`$run ./try`
16007           case "$xxx" in
16008           semun) val="$define" ;;
16009           esac
16010       fi
16011       $rm -f try try.c
16012       set d_semctl_semun
16013       eval $setvar
16014       ;;
16015     esac
16016     case "$d_semctl_semun" in
16017     $define)
16018         echo "You can use union semun for semctl IPC_STAT." >&4
16019         also='also'
16020         ;;
16021     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16022         also=''
16023         ;;
16024     esac
16025
16026     : see whether semctl IPC_STAT can use struct semid_ds pointer
16027     case "$d_semctl_semid_ds" in
16028     '')
16029       val="$undef"
16030       $cat > try.c <<'END'
16031 #include <sys/types.h>
16032 #include <sys/ipc.h>
16033 #include <sys/sem.h>
16034 #include <sys/stat.h>
16035 #include "try.h"
16036 #include <stdio.h>
16037 #include <errno.h>
16038 #ifndef errno
16039 extern int errno;
16040 #endif
16041 int main() {
16042     struct semid_ds arg;
16043     int sem, st;
16044
16045 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16046     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16047     if (sem > -1) {
16048 #       ifdef IPC_STAT
16049         st = semctl(sem, 0, IPC_STAT, &arg);
16050         if (st == 0)
16051             printf("semid_ds\n");
16052         else
16053 #       endif /* IPC_STAT */
16054             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16055 #       ifdef IPC_RMID
16056         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16057 #       endif /* IPC_RMID */
16058             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16059     } else
16060 #endif /* IPC_PRIVATE && ... */
16061         printf("semget failed: errno = %d\n", errno);
16062
16063     return 0;
16064 }
16065 END
16066       set try
16067       if eval $compile; then
16068           xxx=`$run ./try`
16069           case "$xxx" in
16070           semid_ds) val="$define" ;;
16071           esac
16072       fi
16073       $rm -f try try.c
16074       set d_semctl_semid_ds
16075       eval $setvar
16076       ;;
16077     esac
16078     case "$d_semctl_semid_ds" in
16079     $define)
16080         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16081         ;;
16082     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16083         ;;
16084     esac
16085     $rm -f try.h
16086     ;;
16087 *)  val="$undef"
16088
16089     # We do not have the full sem*(2) library, so assume we can not
16090     # use either.
16091
16092     set d_semctl_semun
16093     eval $setvar
16094
16095     set d_semctl_semid_ds
16096     eval $setvar
16097     ;;
16098 esac
16099
16100 : see if sendmsg exists
16101 set sendmsg d_sendmsg
16102 eval $inlibc
16103
16104 : see if setegid exists
16105 set setegid d_setegid
16106 eval $inlibc
16107
16108 : see if seteuid exists
16109 set seteuid d_seteuid
16110 eval $inlibc
16111
16112 : see if setgrent exists
16113 set setgrent d_setgrent
16114 eval $inlibc
16115
16116 : see if setgrent_r exists
16117 set setgrent_r d_setgrent_r
16118 eval $inlibc
16119 case "$d_setgrent_r" in
16120 "$define")
16121         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16122         case "$d_setgrent_r_proto:$usethreads" in
16123         ":define")      d_setgrent_r_proto=define
16124                 set d_setgrent_r_proto setgrent_r $hdrs
16125                 eval $hasproto ;;
16126         *)      ;;
16127         esac
16128         case "$d_setgrent_r_proto" in
16129         define)
16130         case "$setgrent_r_proto" in
16131         ''|0) try='int setgrent_r(FILE**);'
16132         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16133         esac
16134         case "$setgrent_r_proto" in
16135         ''|0) try='void setgrent_r(FILE**);'
16136         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16137         esac
16138         case "$setgrent_r_proto" in
16139         ''|0)   d_setgrent_r=undef
16140                 setgrent_r_proto=0
16141                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16142         * )     case "$setgrent_r_proto" in
16143                 REENTRANT_PROTO*) ;;
16144                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16145                 esac
16146                 echo "Prototype: $try" ;;
16147         esac
16148         ;;
16149         *)      case "$usethreads" in
16150                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16151                 esac
16152                 d_setgrent_r=undef
16153                 setgrent_r_proto=0
16154                 ;;
16155         esac
16156         ;;
16157 *)      setgrent_r_proto=0
16158         ;;
16159 esac
16160
16161 : see if sethostent exists
16162 set sethostent d_sethent
16163 eval $inlibc
16164
16165 : see if sethostent_r exists
16166 set sethostent_r d_sethostent_r
16167 eval $inlibc
16168 case "$d_sethostent_r" in
16169 "$define")
16170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16171         case "$d_sethostent_r_proto:$usethreads" in
16172         ":define")      d_sethostent_r_proto=define
16173                 set d_sethostent_r_proto sethostent_r $hdrs
16174                 eval $hasproto ;;
16175         *)      ;;
16176         esac
16177         case "$d_sethostent_r_proto" in
16178         define)
16179         case "$sethostent_r_proto" in
16180         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16181         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16182         esac
16183         case "$sethostent_r_proto" in
16184         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16185         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16186         esac
16187         case "$sethostent_r_proto" in
16188         ''|0)   d_sethostent_r=undef
16189                 sethostent_r_proto=0
16190                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16191         * )     case "$sethostent_r_proto" in
16192                 REENTRANT_PROTO*) ;;
16193                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16194                 esac
16195                 echo "Prototype: $try" ;;
16196         esac
16197         ;;
16198         *)      case "$usethreads" in
16199                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16200                 esac
16201                 d_sethostent_r=undef
16202                 sethostent_r_proto=0
16203                 ;;
16204         esac
16205         ;;
16206 *)      sethostent_r_proto=0
16207         ;;
16208 esac
16209
16210 : see if setitimer exists
16211 set setitimer d_setitimer
16212 eval $inlibc
16213
16214 : see if setlinebuf exists
16215 set setlinebuf d_setlinebuf
16216 eval $inlibc
16217
16218 : see if setlocale exists
16219 set setlocale d_setlocale
16220 eval $inlibc
16221
16222 : see if locale.h is available
16223 set locale.h i_locale
16224 eval $inhdr
16225
16226 : see if setlocale_r exists
16227 set setlocale_r d_setlocale_r
16228 eval $inlibc
16229 case "$d_setlocale_r" in
16230 "$define")
16231         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16232         case "$d_setlocale_r_proto:$usethreads" in
16233         ":define")      d_setlocale_r_proto=define
16234                 set d_setlocale_r_proto setlocale_r $hdrs
16235                 eval $hasproto ;;
16236         *)      ;;
16237         esac
16238         case "$d_setlocale_r_proto" in
16239         define)
16240         case "$setlocale_r_proto" in
16241         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16242         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16243         esac
16244         case "$setlocale_r_proto" in
16245         ''|0)   d_setlocale_r=undef
16246                 setlocale_r_proto=0
16247                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16248         * )     case "$setlocale_r_proto" in
16249                 REENTRANT_PROTO*) ;;
16250                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16251                 esac
16252                 echo "Prototype: $try" ;;
16253         esac
16254         ;;
16255         *)      case "$usethreads" in
16256                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16257                 esac
16258                 d_setlocale_r=undef
16259                 setlocale_r_proto=0
16260                 ;;
16261         esac
16262         ;;
16263 *)      setlocale_r_proto=0
16264         ;;
16265 esac
16266
16267 : see if setnetent exists
16268 set setnetent d_setnent
16269 eval $inlibc
16270
16271 : see if setnetent_r exists
16272 set setnetent_r d_setnetent_r
16273 eval $inlibc
16274 case "$d_setnetent_r" in
16275 "$define")
16276         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16277         case "$d_setnetent_r_proto:$usethreads" in
16278         ":define")      d_setnetent_r_proto=define
16279                 set d_setnetent_r_proto setnetent_r $hdrs
16280                 eval $hasproto ;;
16281         *)      ;;
16282         esac
16283         case "$d_setnetent_r_proto" in
16284         define)
16285         case "$setnetent_r_proto" in
16286         ''|0) try='int setnetent_r(int, struct netent_data*);'
16287         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16288         esac
16289         case "$setnetent_r_proto" in
16290         ''|0) try='void setnetent_r(int, struct netent_data*);'
16291         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16292         esac
16293         case "$setnetent_r_proto" in
16294         ''|0)   d_setnetent_r=undef
16295                 setnetent_r_proto=0
16296                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16297         * )     case "$setnetent_r_proto" in
16298                 REENTRANT_PROTO*) ;;
16299                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16300                 esac
16301                 echo "Prototype: $try" ;;
16302         esac
16303         ;;
16304         *)      case "$usethreads" in
16305                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16306                 esac
16307                 d_setnetent_r=undef
16308                 setnetent_r_proto=0
16309                 ;;
16310         esac
16311         ;;
16312 *)      setnetent_r_proto=0
16313         ;;
16314 esac
16315
16316 : see if setprotoent exists
16317 set setprotoent d_setpent
16318 eval $inlibc
16319
16320 : see if setpgid exists
16321 set setpgid d_setpgid
16322 eval $inlibc
16323
16324 : see if setpgrp2 exists
16325 set setpgrp2 d_setpgrp2
16326 eval $inlibc
16327
16328 : see if setpriority exists
16329 set setpriority d_setprior
16330 eval $inlibc
16331
16332 : see if setproctitle exists
16333 set setproctitle d_setproctitle
16334 eval $inlibc
16335
16336 : see if setprotoent_r exists
16337 set setprotoent_r d_setprotoent_r
16338 eval $inlibc
16339 case "$d_setprotoent_r" in
16340 "$define")
16341         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16342         case "$d_setprotoent_r_proto:$usethreads" in
16343         ":define")      d_setprotoent_r_proto=define
16344                 set d_setprotoent_r_proto setprotoent_r $hdrs
16345                 eval $hasproto ;;
16346         *)      ;;
16347         esac
16348         case "$d_setprotoent_r_proto" in
16349         define)
16350         case "$setprotoent_r_proto" in
16351         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16352         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16353         esac
16354         case "$setprotoent_r_proto" in
16355         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16356         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16357         esac
16358         case "$setprotoent_r_proto" in
16359         ''|0)   d_setprotoent_r=undef
16360                 setprotoent_r_proto=0
16361                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16362         * )     case "$setprotoent_r_proto" in
16363                 REENTRANT_PROTO*) ;;
16364                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16365                 esac
16366                 echo "Prototype: $try" ;;
16367         esac
16368         ;;
16369         *)      case "$usethreads" in
16370                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16371                 esac
16372                 d_setprotoent_r=undef
16373                 setprotoent_r_proto=0
16374                 ;;
16375         esac
16376         ;;
16377 *)      setprotoent_r_proto=0
16378         ;;
16379 esac
16380
16381 : see if setpwent exists
16382 set setpwent d_setpwent
16383 eval $inlibc
16384
16385 : see if setpwent_r exists
16386 set setpwent_r d_setpwent_r
16387 eval $inlibc
16388 case "$d_setpwent_r" in
16389 "$define")
16390         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16391         case "$d_setpwent_r_proto:$usethreads" in
16392         ":define")      d_setpwent_r_proto=define
16393                 set d_setpwent_r_proto setpwent_r $hdrs
16394                 eval $hasproto ;;
16395         *)      ;;
16396         esac
16397         case "$d_setpwent_r_proto" in
16398         define)
16399         case "$setpwent_r_proto" in
16400         ''|0) try='int setpwent_r(FILE**);'
16401         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16402         esac
16403         case "$setpwent_r_proto" in
16404         ''|0) try='void setpwent_r(FILE**);'
16405         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16406         esac
16407         case "$setpwent_r_proto" in
16408         ''|0)   d_setpwent_r=undef
16409                 setpwent_r_proto=0
16410                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16411         * )     case "$setpwent_r_proto" in
16412                 REENTRANT_PROTO*) ;;
16413                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16414                 esac
16415                 echo "Prototype: $try" ;;
16416         esac
16417         ;;
16418         *)      case "$usethreads" in
16419                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16420                 esac
16421                 d_setpwent_r=undef
16422                 setpwent_r_proto=0
16423                 ;;
16424         esac
16425         ;;
16426 *)      setpwent_r_proto=0
16427         ;;
16428 esac
16429
16430 : see if setregid exists
16431 set setregid d_setregid
16432 eval $inlibc
16433 set setresgid d_setresgid
16434 eval $inlibc
16435
16436 : see if setreuid exists
16437 set setreuid d_setreuid
16438 eval $inlibc
16439 set setresuid d_setresuid
16440 eval $inlibc
16441
16442 : see if setrgid exists
16443 set setrgid d_setrgid
16444 eval $inlibc
16445
16446 : see if setruid exists
16447 set setruid d_setruid
16448 eval $inlibc
16449
16450 : see if setservent exists
16451 set setservent d_setsent
16452 eval $inlibc
16453
16454 : see if setservent_r exists
16455 set setservent_r d_setservent_r
16456 eval $inlibc
16457 case "$d_setservent_r" in
16458 "$define")
16459         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16460         case "$d_setservent_r_proto:$usethreads" in
16461         ":define")      d_setservent_r_proto=define
16462                 set d_setservent_r_proto setservent_r $hdrs
16463                 eval $hasproto ;;
16464         *)      ;;
16465         esac
16466         case "$d_setservent_r_proto" in
16467         define)
16468         case "$setservent_r_proto" in
16469         ''|0) try='int setservent_r(int, struct servent_data*);'
16470         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16471         esac
16472         case "$setservent_r_proto" in
16473         ''|0) try='void setservent_r(int, struct servent_data*);'
16474         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16475         esac
16476         case "$setservent_r_proto" in
16477         ''|0)   d_setservent_r=undef
16478                 setservent_r_proto=0
16479                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16480         * )     case "$setservent_r_proto" in
16481                 REENTRANT_PROTO*) ;;
16482                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16483                 esac
16484                 echo "Prototype: $try" ;;
16485         esac
16486         ;;
16487         *)      case "$usethreads" in
16488                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16489                 esac
16490                 d_setservent_r=undef
16491                 setservent_r_proto=0
16492                 ;;
16493         esac
16494         ;;
16495 *)      setservent_r_proto=0
16496         ;;
16497 esac
16498
16499 : see if setsid exists
16500 set setsid d_setsid
16501 eval $inlibc
16502
16503 : see if setvbuf exists
16504 set setvbuf d_setvbuf
16505 eval $inlibc
16506
16507 : see if sfio.h is available
16508 set sfio.h i_sfio
16509 eval $inhdr
16510
16511
16512 : see if sfio library is available
16513 case "$i_sfio" in
16514 $define)
16515         val=''
16516         set sfreserve val
16517         eval $inlibc
16518         ;;
16519 *)
16520         val="$undef"
16521         ;;
16522 esac
16523 : Ok, but do we want to use it.
16524 case "$val" in
16525 $define)
16526         case "$usesfio" in
16527         true|$define|[yY]*) dflt='y';;
16528         *) dflt='n';;
16529         esac
16530         echo "$package can use the sfio library, but it is experimental."
16531         case "$useperlio" in
16532         "$undef")
16533             echo "For sfio also the PerlIO abstraction layer is needed."
16534             echo "Earlier you said you wouldn't want that."
16535             ;;
16536         esac
16537         rp="You seem to have sfio available, do you want to try using it?"
16538         . ./myread
16539         case "$ans" in
16540         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16541                 useperlio="$define"
16542                 val="$define"
16543                 ;;
16544         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16545                 val="$undef"
16546                 ;;
16547         esac
16548         ;;
16549 *)      case "$usesfio" in
16550         true|$define|[yY]*)
16551                 echo "Sorry, cannot find sfio on this machine." >&4
16552                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16553                 val="$undef"
16554                 ;;
16555         esac
16556         ;;
16557 esac
16558 set d_sfio
16559 eval $setvar
16560 case "$d_sfio" in
16561 $define) usesfio='true';;
16562 *) usesfio='false';;
16563 esac
16564 case "$d_sfio" in
16565 $define) ;;
16566 *)      : Remove sfio from list of libraries to use
16567         case "$libs" in
16568         *-lsfio*)
16569                 echo "Removing unneeded -lsfio from library list" >&4
16570                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16571                 shift
16572                 libs="$*"
16573                 echo "libs = $libs" >&4
16574                 ;;
16575         esac
16576 ;;
16577 esac
16578
16579
16580 : see if shmctl exists
16581 set shmctl d_shmctl
16582 eval $inlibc
16583
16584 : see if shmget exists
16585 set shmget d_shmget
16586 eval $inlibc
16587
16588 : see if shmat exists
16589 set shmat d_shmat
16590 eval $inlibc
16591 : see what shmat returns
16592 case "$d_shmat" in
16593 "$define")
16594         $cat >shmat.c <<'END'
16595 #include <sys/shm.h>
16596 void *shmat();
16597 END
16598         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16599                 shmattype='void *'
16600         else
16601                 shmattype='char *'
16602         fi
16603         echo "and it returns ($shmattype)." >&4
16604         : see if a prototype for shmat is available
16605         xxx=`./findhdr sys/shm.h`
16606         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16607         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16608                 val="$define"
16609         else
16610                 val="$undef"
16611         fi
16612         $rm -f shmat.[co]
16613         ;;
16614 *)
16615         val="$undef"
16616         ;;
16617 esac
16618 set d_shmatprototype
16619 eval $setvar
16620
16621 : see if shmdt exists
16622 set shmdt d_shmdt
16623 eval $inlibc
16624
16625 : see how much of the 'shm*(2)' library is present.
16626 h_shm=true
16627 echo " "
16628 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16629 *"$undef"*) h_shm=false;;
16630 esac
16631 case "$osname" in
16632 freebsd)
16633     case "`ipcs 2>&1`" in
16634     "SVID shared memory"*"not configured"*)
16635         echo "Your $osname does not have the shm*(2) configured." >&4
16636         h_shm=false
16637         val="$undef"
16638         set shmctl d_shmctl
16639         evat $setvar
16640         set shmget d_shmget
16641         evat $setvar
16642         set shmat d_shmat
16643         evat $setvar
16644         set shmdt d_shmdt
16645         evat $setvar
16646         ;;
16647     esac
16648     ;;
16649 esac
16650 : we could also check for sys/ipc.h ...
16651 if $h_shm && $test `./findhdr sys/shm.h`; then
16652         echo "You have the full shm*(2) library." >&4
16653         val="$define"
16654 else
16655         echo "You don't have the full shm*(2) library." >&4
16656         val="$undef"
16657 fi
16658 set d_shm
16659 eval $setvar
16660
16661 echo " "
16662 : see if we have sigaction
16663 if set sigaction val -f d_sigaction; eval $csym; $val; then
16664         echo 'sigaction() found.' >&4
16665         $cat > try.c <<EOP
16666 #include <stdio.h>
16667 #include <sys/types.h>
16668 #include <signal.h>
16669 #$i_stdlib I_STDLIB
16670 #ifdef I_STDLIB
16671 #include <stdlib.h>
16672 #endif
16673 int main()
16674 {
16675     struct sigaction act, oact;
16676     act.sa_flags = 0;
16677     oact.sa_handler = 0;
16678     /* so that act and oact are used */
16679     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16680 }
16681 EOP
16682         set try
16683         if eval $compile_ok; then
16684                 val="$define"
16685         else
16686                 echo "But you don't seem to have a useable struct sigaction." >&4
16687                 val="$undef"
16688         fi
16689 else
16690         echo 'sigaction NOT found.' >&4
16691         val="$undef"
16692 fi
16693 set d_sigaction; eval $setvar
16694 $rm -f try try$_o try.c
16695
16696 : see if sigprocmask exists
16697 set sigprocmask d_sigprocmask
16698 eval $inlibc
16699
16700 : see if sigsetjmp exists
16701 echo " "
16702 case "$d_sigsetjmp" in
16703 '')
16704         $cat >try.c <<EOP
16705 #include <setjmp.h>
16706 #$i_stdlib I_STDLIB
16707 #ifdef I_STDLIB
16708 #include <stdlib.h>
16709 #endif
16710 sigjmp_buf env;
16711 int set = 1;
16712 int main()
16713 {
16714         if (sigsetjmp(env,1))
16715                 exit(set);
16716         set = 0;
16717         siglongjmp(env, 1);
16718         exit(1);
16719 }
16720 EOP
16721         set try
16722         if eval $compile; then
16723                 if $run ./try >/dev/null 2>&1; then
16724                         echo "POSIX sigsetjmp found." >&4
16725                         val="$define"
16726                 else
16727                         $cat >&4 <<EOM
16728 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16729 I'll ignore them.
16730 EOM
16731                         val="$undef"
16732                 fi
16733         else
16734                 echo "sigsetjmp not found." >&4
16735                 val="$undef"
16736         fi
16737         ;;
16738 *) val="$d_sigsetjmp"
16739         case "$d_sigsetjmp" in
16740         $define) echo "POSIX sigsetjmp found." >&4;;
16741         $undef) echo "sigsetjmp not found." >&4;;
16742         esac
16743         ;;
16744 esac
16745 set d_sigsetjmp
16746 eval $setvar
16747 $rm -f try.c try
16748
16749 : see if snprintf exists
16750 set snprintf d_snprintf
16751 eval $inlibc
16752
16753 : see if vsnprintf exists
16754 set vsnprintf d_vsnprintf
16755 eval $inlibc
16756
16757 case "$d_snprintf-$d_vsnprintf" in
16758 "$define-$define")
16759     $cat <<EOM
16760 Checking whether your snprintf() and vsnprintf() work okay...
16761 EOM
16762     $cat >try.c <<'EOCP'
16763 /* v?snprintf testing logic courtesy of Russ Allbery.
16764  * According to C99:
16765  * - if the buffer is too short it still must be \0-terminated
16766  * - if the buffer is too short the potentially required length
16767  *   must be returned and not -1
16768  * - if the buffer is NULL the potentially required length
16769  *   must be returned and not -1 or core dump
16770  */
16771 #include <stdio.h>
16772 #include <stdarg.h>
16773
16774 char buf[2];
16775
16776 int test (char *format, ...)
16777 {
16778     va_list args;
16779     int count;
16780
16781     va_start (args, format);
16782     count = vsnprintf (buf, sizeof buf, format, args);
16783     va_end (args);
16784     return count;
16785 }
16786
16787 int main ()
16788 {
16789     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16790              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16791 }
16792 EOCP
16793     set try
16794     if eval $compile; then
16795         `$run ./try`
16796         case "$?" in
16797         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16798         *) cat <<EOM >&4
16799 Your snprintf() and snprintf() don't seem to be working okay.
16800 EOM
16801            d_snprintf="$undef"
16802            d_vsnprintf="$undef"
16803            ;;
16804         esac
16805     else
16806         echo "(I can't seem to compile the test program--assuming they don't)"
16807         d_snprintf="$undef"
16808         d_vsnprintf="$undef"
16809     fi
16810     $rm -f try.* try core core.try.*
16811     ;;
16812 esac
16813
16814 : see if sockatmark exists
16815 set sockatmark d_sockatmark
16816 eval $inlibc
16817
16818 : see if prototype for sockatmark is available
16819 echo " "
16820 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16821 eval $hasproto
16822
16823 : see if socks5_init exists
16824 set socks5_init d_socks5_init
16825 eval $inlibc
16826
16827 : see if sprintf returns the length of the string in the buffer as per ANSI
16828 $echo "Checking whether sprintf returns the length of the string..." >&4
16829 $cat <<EOP >try.c
16830 #include <stdio.h>
16831 #$i_stdlib I_STDLIB
16832 #ifdef I_STDLIB
16833 #include <stdlib.h>
16834 #endif
16835 #$i_string I_STRING
16836 #ifdef I_STRING
16837 #  include <string.h>
16838 #else
16839 #  include <strings.h>
16840 #endif
16841 #$i_math I_MATH
16842 #ifdef I_MATH
16843 #include <math.h>
16844 #endif
16845
16846 char buffer[256];
16847
16848 int check (size_t expect, int test) {
16849   size_t got = strlen(buffer);
16850   if (expect == got)
16851     return 0;
16852
16853   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16854        test, buffer);
16855   exit (test);
16856 }
16857
16858 int main(int argc, char **argv) {
16859   int test = 0;
16860
16861   check(sprintf(buffer, ""), ++test);
16862   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16863   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16864
16865   return 0;
16866 }
16867 EOP
16868 set try
16869
16870 d_sprintf_returns_strlen="$undef"
16871 if eval $compile; then
16872     xxx="`$run ./try`"
16873     case "$?" in
16874         0) cat >&4 <<EOM
16875 sprintf returns the length of the string (as ANSI says it should)
16876 EOM
16877         d_sprintf_returns_strlen="$define"
16878         ;;
16879         *) cat >&4 <<EOM
16880 sprintf does not return the length of the string (how old is this system?)
16881 EOM
16882         d_sprintf_returns_strlen="$undef"
16883         ;;
16884     esac
16885 fi
16886
16887 $rm -f try.* try
16888
16889 : see if srand48_r exists
16890 set srand48_r d_srand48_r
16891 eval $inlibc
16892 case "$d_srand48_r" in
16893 "$define")
16894         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16895         case "$d_srand48_r_proto:$usethreads" in
16896         ":define")      d_srand48_r_proto=define
16897                 set d_srand48_r_proto srand48_r $hdrs
16898                 eval $hasproto ;;
16899         *)      ;;
16900         esac
16901         case "$d_srand48_r_proto" in
16902         define)
16903         case "$srand48_r_proto" in
16904         ''|0) try='int srand48_r(long, struct drand48_data*);'
16905         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16906         esac
16907         case "$srand48_r_proto" in
16908         ''|0)   d_srand48_r=undef
16909                 srand48_r_proto=0
16910                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16911         * )     case "$srand48_r_proto" in
16912                 REENTRANT_PROTO*) ;;
16913                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16914                 esac
16915                 echo "Prototype: $try" ;;
16916         esac
16917         ;;
16918         *)      case "$usethreads" in
16919                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16920                 esac
16921                 d_srand48_r=undef
16922                 srand48_r_proto=0
16923                 ;;
16924         esac
16925         ;;
16926 *)      srand48_r_proto=0
16927         ;;
16928 esac
16929
16930 : see if srandom_r exists
16931 set srandom_r d_srandom_r
16932 eval $inlibc
16933 case "$d_srandom_r" in
16934 "$define")
16935         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16936         case "$d_srandom_r_proto:$usethreads" in
16937         ":define")      d_srandom_r_proto=define
16938                 set d_srandom_r_proto srandom_r $hdrs
16939                 eval $hasproto ;;
16940         *)      ;;
16941         esac
16942         case "$d_srandom_r_proto" in
16943         define)
16944         case "$srandom_r_proto" in
16945         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16946         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16947         esac
16948         case "$srandom_r_proto" in
16949         ''|0)   d_srandom_r=undef
16950                 srandom_r_proto=0
16951                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16952         * )     case "$srandom_r_proto" in
16953                 REENTRANT_PROTO*) ;;
16954                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16955                 esac
16956                 echo "Prototype: $try" ;;
16957         esac
16958         ;;
16959         *)      case "$usethreads" in
16960                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16961                 esac
16962                 d_srandom_r=undef
16963                 srandom_r_proto=0
16964                 ;;
16965         esac
16966         ;;
16967 *)      srandom_r_proto=0
16968         ;;
16969 esac
16970
16971 : see if prototype for setresgid is available
16972 echo " "
16973 set d_sresgproto setresgid $i_unistd unistd.h
16974 eval $hasproto
16975
16976 : see if prototype for setresuid is available
16977 echo " "
16978 set d_sresuproto setresuid $i_unistd unistd.h
16979 eval $hasproto
16980
16981 : see if sys/stat.h is available
16982 set sys/stat.h i_sysstat
16983 eval $inhdr
16984
16985
16986 : see if stat knows about block sizes
16987 echo " "
16988 echo "Checking to see if your struct stat has st_blocks field..." >&4
16989 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16990 eval $hasfield
16991
16992
16993 : see if this is a sys/vfs.h system
16994 set sys/vfs.h i_sysvfs
16995 eval $inhdr
16996
16997
16998 : see if this is a sys/statfs.h system
16999 set sys/statfs.h i_sysstatfs
17000 eval $inhdr
17001
17002
17003 echo " "
17004 echo "Checking to see if your system supports struct statfs..." >&4
17005 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
17006 eval $hasstruct
17007 case "$d_statfs_s" in
17008 "$define")      echo "Yes, it does."   ;;
17009 *)              echo "No, it doesn't." ;;
17010 esac
17011
17012
17013
17014 : see if struct statfs knows about f_flags
17015 case "$d_statfs_s" in
17016 define) 
17017         echo " "
17018         echo "Checking to see if your struct statfs has f_flags field..." >&4
17019         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
17020         eval $hasfield
17021         ;;
17022 *)      val="$undef"
17023         set d_statfs_f_flags
17024         eval $setvar
17025         ;;
17026 esac
17027 case "$d_statfs_f_flags" in
17028 "$define")      echo "Yes, it does."   ;;
17029 *)              echo "No, it doesn't." ;;
17030 esac
17031
17032 $cat >&4 <<EOM
17033 Checking how to access stdio streams by file descriptor number...
17034 EOM
17035 case "$stdio_stream_array" in
17036 '')     $cat >try.c <<EOCP
17037 #include <stdio.h>
17038 int main() {
17039   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17040     printf("yes\n");
17041 }
17042 EOCP
17043         for s in _iob __iob __sF
17044         do
17045                 set try -DSTDIO_STREAM_ARRAY=$s
17046                 if eval $compile; then
17047                         case "`$run ./try`" in
17048                         yes)    stdio_stream_array=$s; break ;;
17049                         esac
17050                 fi
17051         done
17052         $rm -f try.* try$exe_ext
17053 esac
17054 case "$stdio_stream_array" in
17055 '')     $cat >&4 <<EOM
17056 I can't figure out how to access stdio streams by file descriptor number.
17057 EOM
17058         d_stdio_stream_array="$undef"
17059         ;;
17060 *)      $cat >&4 <<EOM
17061 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17062 EOM
17063         d_stdio_stream_array="$define"
17064         ;;
17065 esac
17066
17067 : see if strcoll exists
17068 set strcoll d_strcoll
17069 eval $inlibc
17070
17071 : check for structure copying
17072 echo " "
17073 echo "Checking to see if your C compiler can copy structs..." >&4
17074 $cat >try.c <<'EOCP'
17075 int main()
17076 {
17077         struct blurfl {
17078                 int dyick;
17079         } foo, bar;
17080
17081         foo = bar;
17082 }
17083 EOCP
17084 if $cc -c try.c >/dev/null 2>&1 ; then
17085         val="$define"
17086         echo "Yup, it can."
17087 else
17088         val="$undef"
17089         echo "Nope, it can't."
17090 fi
17091 set d_strctcpy
17092 eval $setvar
17093 $rm -f try.*
17094
17095 : see if strerror and/or sys_errlist[] exist
17096 echo " "
17097 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17098     if set strerror val -f d_strerror; eval $csym; $val; then
17099                 echo 'strerror() found.' >&4
17100                 d_strerror="$define"
17101                 d_strerrm='strerror(e)'
17102                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17103                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17104                         d_syserrlst="$define"
17105                 else
17106                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17107                         d_syserrlst="$undef"
17108                 fi
17109     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17110                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17111                 echo 'strerror() found in string header.' >&4
17112                 d_strerror="$define"
17113                 d_strerrm='strerror(e)'
17114                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17115                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17116                                 d_syserrlst="$define"
17117                 else
17118                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17119                         d_syserrlst="$undef"
17120                 fi
17121     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17122                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17123                 d_strerror="$undef"
17124                 d_syserrlst="$define"
17125                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17126     else
17127                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17128                 d_strerror="$undef"
17129                 d_syserrlst="$undef"
17130                 d_strerrm='"unknown"'
17131     fi
17132 fi
17133
17134 : see if strerror_r exists
17135 set strerror_r d_strerror_r
17136 eval $inlibc
17137 case "$d_strerror_r" in
17138 "$define")
17139         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17140         case "$d_strerror_r_proto:$usethreads" in
17141         ":define")      d_strerror_r_proto=define
17142                 set d_strerror_r_proto strerror_r $hdrs
17143                 eval $hasproto ;;
17144         *)      ;;
17145         esac
17146         case "$d_strerror_r_proto" in
17147         define)
17148         case "$strerror_r_proto" in
17149         ''|0) try='int strerror_r(int, char*, size_t);'
17150         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17151         esac
17152         case "$strerror_r_proto" in
17153         ''|0) try='int strerror_r(int, char*, int);'
17154         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17155         esac
17156         case "$strerror_r_proto" in
17157         ''|0) try='char* strerror_r(int, char*, size_t);'
17158         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17159         esac
17160         case "$strerror_r_proto" in
17161         ''|0)   d_strerror_r=undef
17162                 strerror_r_proto=0
17163                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17164         * )     case "$strerror_r_proto" in
17165                 REENTRANT_PROTO*) ;;
17166                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17167                 esac
17168                 echo "Prototype: $try" ;;
17169         esac
17170         ;;
17171         *)      case "$usethreads" in
17172                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17173                 esac
17174                 d_strerror_r=undef
17175                 strerror_r_proto=0
17176                 ;;
17177         esac
17178         ;;
17179 *)      strerror_r_proto=0
17180         ;;
17181 esac
17182
17183 : see if strftime exists
17184 set strftime d_strftime
17185 eval $inlibc
17186
17187 : see if strlcat exists
17188 set strlcat d_strlcat
17189 eval $inlibc
17190
17191 : see if strlcpy exists
17192 set strlcpy d_strlcpy
17193 eval $inlibc
17194
17195 : see if strtod exists
17196 set strtod d_strtod
17197 eval $inlibc
17198
17199 : see if strtol exists
17200 set strtol d_strtol
17201 eval $inlibc
17202
17203 : see if strtold exists
17204 set strtold d_strtold
17205 eval $inlibc
17206
17207 : see if strtoll exists
17208 set strtoll d_strtoll
17209 eval $inlibc
17210
17211 case "$d_longlong-$d_strtoll" in
17212 "$define-$define")
17213         $cat <<EOM
17214 Checking whether your strtoll() works okay...
17215 EOM
17216         $cat >try.c <<'EOCP'
17217 #include <errno.h>
17218 #ifdef __hpux
17219 #define strtoll __strtoll
17220 #endif
17221 #ifdef __EMX__
17222 #define strtoll _strtoll
17223 #endif
17224 #include <stdio.h>
17225 extern long long int strtoll(char *s, char **, int); 
17226 static int bad = 0;
17227 int check(char *s, long long ell, int een) {
17228         long long gll;
17229         errno = 0;
17230         gll = strtoll(s, 0, 10);
17231         if (!((gll == ell) && (errno == een)))
17232                 bad++;
17233 }
17234 int main() {
17235         check(" 1",                                      1LL, 0);
17236         check(" 0",                                      0LL, 0);
17237         check("-1",                                     -1LL, 0);
17238         check("-9223372036854775808", -9223372036854775808LL, 0);
17239         check("-9223372036854775808", -9223372036854775808LL, 0);
17240         check(" 9223372036854775807",  9223372036854775807LL, 0);
17241         check("-9223372036854775808", -9223372036854775808LL, 0);
17242         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17243         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17244         if (!bad)
17245                 printf("ok\n");
17246 }
17247 EOCP
17248         set try
17249         if eval $compile; then
17250                 yyy=`$run ./try`
17251                 case "$yyy" in
17252                 ok) echo "Your strtoll() seems to be working okay." ;;
17253                 *) cat <<EOM >&4
17254 Your strtoll() doesn't seem to be working okay.
17255 EOM
17256                    d_strtoll="$undef"
17257                    ;;
17258                 esac
17259         else
17260                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17261                 d_strtoll="$undef"
17262         fi
17263         ;;
17264 esac
17265
17266 : see if strtoq exists
17267 set strtoq d_strtoq
17268 eval $inlibc
17269
17270 : see if strtoul exists
17271 set strtoul d_strtoul
17272 eval $inlibc
17273
17274 case "$d_strtoul" in
17275 "$define")
17276         $cat <<EOM
17277 Checking whether your strtoul() works okay...
17278 EOM
17279         $cat >try.c <<'EOCP'
17280 #include <errno.h>
17281 #include <stdio.h>
17282 extern unsigned long int strtoul(char *s, char **, int); 
17283 static int bad = 0;
17284 void check(char *s, unsigned long eul, int een) {
17285         unsigned long gul;
17286         errno = 0;
17287         gul = strtoul(s, 0, 10);
17288         if (!((gul == eul) && (errno == een)))
17289                 bad++;
17290 }
17291 int main() {
17292         check(" 1", 1L, 0);
17293         check(" 0", 0L, 0);
17294 EOCP
17295         case "$longsize" in
17296         8)
17297             $cat >>try.c <<'EOCP'
17298         check("18446744073709551615", 18446744073709551615UL, 0);
17299         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17300 #if 0 /* strtoul() for /^-/ strings is undefined. */
17301         check("-1", 18446744073709551615UL, 0);
17302         check("-18446744073709551614", 2, 0);
17303         check("-18446744073709551615", 1, 0);
17304         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17305         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17306 #endif
17307 EOCP
17308                 ;;
17309         4)
17310                     $cat >>try.c <<'EOCP'
17311         check("4294967295", 4294967295UL, 0);
17312         check("4294967296", 4294967295UL, ERANGE);
17313 #if 0 /* strtoul() for /^-/ strings is undefined. */
17314         check("-1", 4294967295UL, 0);
17315         check("-4294967294", 2, 0);
17316         check("-4294967295", 1, 0);
17317         check("-4294967296", 4294967295UL, ERANGE);
17318         check("-4294967297", 4294967295UL, ERANGE);
17319 #endif
17320 EOCP
17321                 ;;
17322         *)
17323 : Should we write these tests to be more portable by sprintf-ing
17324 : ~0 and then manipulating that char string as input for strtol?
17325                 ;;
17326         esac
17327         $cat >>try.c <<'EOCP'
17328         if (!bad)
17329                 printf("ok\n");
17330         return 0;
17331 }
17332 EOCP
17333         set try
17334         if eval $compile; then
17335                 case "`$run ./try`" in
17336                 ok) echo "Your strtoul() seems to be working okay." ;;
17337                 *) cat <<EOM >&4
17338 Your strtoul() doesn't seem to be working okay.
17339 EOM
17340                    d_strtoul="$undef"
17341                    ;;
17342                 esac
17343         fi
17344         ;;
17345 esac
17346
17347 : see if strtoull exists
17348 set strtoull d_strtoull
17349 eval $inlibc
17350
17351 case "$d_longlong-$d_strtoull" in
17352 "$define-$define")
17353         $cat <<EOM
17354 Checking whether your strtoull() works okay...
17355 EOM
17356         $cat >try.c <<'EOCP'
17357 #include <errno.h>
17358 #ifdef __hpux
17359 #define strtoull __strtoull
17360 #endif
17361 #include <stdio.h>
17362 extern unsigned long long int strtoull(char *s, char **, int); 
17363 static int bad = 0;
17364 int check(char *s, long long eull, int een) {
17365         long long gull;
17366         errno = 0;
17367         gull = strtoull(s, 0, 10);
17368         if (!((gull == eull) && (errno == een)))
17369                 bad++;
17370 }
17371 int main() {
17372         check(" 1",                                        1LL, 0);
17373         check(" 0",                                        0LL, 0);
17374         check("18446744073709551615",  18446744073709551615ULL, 0);
17375         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17376 #if 0 /* strtoull() for /^-/ strings is undefined. */
17377         check("-1",                    18446744073709551615ULL, 0);
17378         check("-18446744073709551614",                     2LL, 0);
17379         check("-18446744073709551615",                     1LL, 0);
17380         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17381         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17382 #endif
17383         if (!bad)
17384                 printf("ok\n");
17385 }
17386 EOCP
17387         set try
17388         if eval $compile; then
17389                 case "`$run ./try`" in
17390                 ok) echo "Your strtoull() seems to be working okay." ;;
17391                 *) cat <<EOM >&4
17392 Your strtoull() doesn't seem to be working okay.
17393 EOM
17394                    d_strtoull="$undef"
17395                    ;;
17396                 esac
17397         fi
17398         ;;
17399 esac
17400
17401 : see if strtouq exists
17402 set strtouq d_strtouq
17403 eval $inlibc
17404
17405 case "$d_strtouq" in
17406 "$define")
17407         $cat <<EOM
17408 Checking whether your strtouq() works okay...
17409 EOM
17410         $cat >try.c <<'EOCP'
17411 #include <errno.h>
17412 #include <stdio.h>
17413 extern unsigned long long int strtouq(char *s, char **, int); 
17414 static int bad = 0;
17415 void check(char *s, unsigned long long eull, int een) {
17416         unsigned long long gull;
17417         errno = 0;
17418         gull = strtouq(s, 0, 10);
17419         if (!((gull == eull) && (errno == een)))
17420                 bad++;
17421 }
17422 int main() {
17423         check(" 1",                                        1LL, 0);
17424         check(" 0",                                        0LL, 0);
17425         check("18446744073709551615",  18446744073709551615ULL, 0);
17426         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17427 #if 0 /* strtouq() for /^-/ strings is undefined. */
17428         check("-1",                    18446744073709551615ULL, 0);
17429         check("-18446744073709551614",                     2LL, 0);
17430         check("-18446744073709551615",                     1LL, 0);
17431         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17432         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17433 #endif
17434         if (!bad)
17435                 printf("ok\n");
17436         return 0;
17437 }
17438 EOCP
17439         set try
17440         if eval $compile; then
17441                 case "`$run ./try`" in
17442                 ok) echo "Your strtouq() seems to be working okay." ;;
17443                 *) cat <<EOM >&4
17444 Your strtouq() doesn't seem to be working okay.
17445 EOM
17446                    d_strtouq="$undef"
17447                    ;;
17448                 esac
17449         fi
17450         ;;
17451 esac
17452
17453 : see if strxfrm exists
17454 set strxfrm d_strxfrm
17455 eval $inlibc
17456
17457 : see if symlink exists
17458 set symlink d_symlink
17459 eval $inlibc
17460
17461 : see if syscall exists
17462 set syscall d_syscall
17463 eval $inlibc
17464
17465 : see if prototype for syscall is available
17466 echo " "
17467 set d_syscallproto syscall $i_unistd unistd.h
17468 eval $hasproto
17469
17470 : see if sysconf exists
17471 set sysconf d_sysconf
17472 eval $inlibc
17473
17474 : see if system exists
17475 set system d_system
17476 eval $inlibc
17477
17478 : see if tcgetpgrp exists
17479 set tcgetpgrp d_tcgetpgrp
17480 eval $inlibc
17481
17482 : see if tcsetpgrp exists
17483 set tcsetpgrp d_tcsetpgrp
17484 eval $inlibc
17485
17486 : see if prototype for telldir is available
17487 echo " "
17488 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17489 eval $hasproto
17490
17491 : see if time exists
17492 echo " "
17493 if test "X$d_time" = X -o X"$timetype" = X; then
17494     if set time val -f d_time; eval $csym; $val; then
17495                 echo 'time() found.' >&4
17496                 val="$define"
17497                 rp="What is the type returned by time() on this system?"
17498                 set time_t timetype long stdio.h sys/types.h
17499                 eval $typedef_ask
17500     else
17501                 echo 'time() not found, hope that will do.' >&4
17502                 val="$undef"
17503                 timetype='int';
17504     fi
17505     set d_time
17506     eval $setvar
17507 fi
17508
17509 : see if this is a sys/times.h system
17510 set sys/times.h i_systimes
17511 eval $inhdr
17512
17513 : see if times exists
17514 echo " "
17515 if set times val -f d_times; eval $csym; $val; then
17516         echo 'times() found.' >&4
17517         d_times="$define"
17518         inc=''
17519         case "$i_systimes" in
17520         "$define") inc='sys/times.h';;
17521         esac
17522         rp="What is the type returned by times() on this system?"
17523         set clock_t clocktype long stdio.h sys/types.h $inc
17524         eval $typedef_ask
17525 else
17526         echo 'times() NOT found, hope that will do.' >&4
17527         d_times="$undef"
17528         clocktype='int'
17529 fi
17530
17531 : see if tmpnam_r exists
17532 set tmpnam_r d_tmpnam_r
17533 eval $inlibc
17534 case "$d_tmpnam_r" in
17535 "$define")
17536         hdrs="$i_systypes sys/types.h define stdio.h "
17537         case "$d_tmpnam_r_proto:$usethreads" in
17538         ":define")      d_tmpnam_r_proto=define
17539                 set d_tmpnam_r_proto tmpnam_r $hdrs
17540                 eval $hasproto ;;
17541         *)      ;;
17542         esac
17543         case "$d_tmpnam_r_proto" in
17544         define)
17545         case "$tmpnam_r_proto" in
17546         ''|0) try='char* tmpnam_r(char*);'
17547         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17548         esac
17549         case "$tmpnam_r_proto" in
17550         ''|0)   d_tmpnam_r=undef
17551                 tmpnam_r_proto=0
17552                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17553         * )     case "$tmpnam_r_proto" in
17554                 REENTRANT_PROTO*) ;;
17555                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17556                 esac
17557                 echo "Prototype: $try" ;;
17558         esac
17559         ;;
17560         *)      case "$usethreads" in
17561                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17562                 esac
17563                 d_tmpnam_r=undef
17564                 tmpnam_r_proto=0
17565                 ;;
17566         esac
17567         ;;
17568 *)      tmpnam_r_proto=0
17569         ;;
17570 esac
17571
17572 : see if truncate exists
17573 set truncate d_truncate
17574 eval $inlibc
17575
17576 : see if ttyname_r exists
17577 set ttyname_r d_ttyname_r
17578 eval $inlibc
17579 case "$d_ttyname_r" in
17580 "$define")
17581         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17582         case "$d_ttyname_r_proto:$usethreads" in
17583         ":define")      d_ttyname_r_proto=define
17584                 set d_ttyname_r_proto ttyname_r $hdrs
17585                 eval $hasproto ;;
17586         *)      ;;
17587         esac
17588         case "$d_ttyname_r_proto" in
17589         define)
17590         case "$ttyname_r_proto" in
17591         ''|0) try='int ttyname_r(int, char*, size_t);'
17592         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17593         esac
17594         case "$ttyname_r_proto" in
17595         ''|0) try='int ttyname_r(int, char*, int);'
17596         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17597         esac
17598         case "$ttyname_r_proto" in
17599         ''|0) try='char* ttyname_r(int, char*, int);'
17600         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17601         esac
17602         case "$ttyname_r_proto" in
17603         ''|0)   d_ttyname_r=undef
17604                 ttyname_r_proto=0
17605                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17606         * )     case "$ttyname_r_proto" in
17607                 REENTRANT_PROTO*) ;;
17608                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17609                 esac
17610                 echo "Prototype: $try" ;;
17611         esac
17612         ;;
17613         *)      case "$usethreads" in
17614                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17615                 esac
17616                 d_ttyname_r=undef
17617                 ttyname_r_proto=0
17618                 ;;
17619         esac
17620         ;;
17621 *)      ttyname_r_proto=0
17622         ;;
17623 esac
17624
17625 : see if tzname[] exists
17626 echo " "
17627 if set tzname val -a d_tzname; eval $csym; $val; then
17628         val="$define"
17629         echo 'tzname[] found.' >&4
17630 else
17631         val="$undef"
17632         echo 'tzname[] NOT found.' >&4
17633 fi
17634 set d_tzname
17635 eval $setvar
17636
17637 case "$osname" in
17638 next|rhapsody|darwin) multiarch="$define" ;;
17639 esac
17640 case "$multiarch" in
17641 ''|[nN]*) multiarch="$undef" ;;
17642 esac
17643
17644 : check for ordering of bytes in a UV
17645 echo " "
17646 case "$usecrosscompile$multiarch" in
17647 *$define*)
17648         $cat <<EOM
17649 You seem to be either cross-compiling or doing a multiarchitecture build,
17650 skipping the byteorder check.
17651
17652 EOM
17653         byteorder='ffff'
17654         ;;
17655 *)
17656         case "$byteorder" in
17657         '')
17658                 $cat <<'EOM'
17659 In the following, larger digits indicate more significance.  A big-endian
17660 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17661 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17662 machines may have weird orders like 3412.  A Cray will report 87654321,
17663 an Alpha will report 12345678. If the test program works the default is
17664 probably right.
17665 I'm now running the test program...
17666 EOM
17667                 $cat >try.c <<EOCP
17668 #include <stdio.h>
17669 #$i_stdlib I_STDLIB
17670 #ifdef I_STDLIB
17671 #include <stdlib.h>
17672 #endif
17673 #include <sys/types.h>
17674 typedef $uvtype UV;
17675 int main()
17676 {
17677         int i;
17678         union {
17679                 UV l;
17680                 char c[$uvsize];
17681         } u;
17682
17683         if ($uvsize > 4)
17684                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17685         else
17686                 u.l = (UV)0x04030201;
17687         for (i = 0; i < $uvsize; i++)
17688                 printf("%c", u.c[i]+'0');
17689         printf("\n");
17690         exit(0);
17691 }
17692 EOCP
17693                 xxx_prompt=y
17694                 set try
17695                 if eval $compile && ./try > /dev/null; then
17696                         dflt=`$run ./try`
17697                         case "$dflt" in
17698                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17699                                 echo "(The test program ran ok.)"
17700                                 echo "byteorder=$dflt"
17701                                 xxx_prompt=n
17702                         ;;
17703                         ????|????????) echo "(The test program ran ok.)" ;;
17704                         *) echo "(The test program didn't run right for some reason.)" ;;
17705                         esac
17706                 else
17707                         dflt='4321'
17708                         cat <<'EOM'
17709 (I can't seem to compile the test program.  Guessing big-endian...)
17710 EOM
17711                 fi
17712                 case "$xxx_prompt" in
17713                 y)
17714                         rp="What is the order of bytes in $uvtype?"
17715                         . ./myread
17716                         byteorder="$ans"
17717                         ;;
17718                 *)      byteorder=$dflt
17719                         ;;
17720                 esac
17721                 ;;
17722         esac
17723         $rm -f try.c try
17724         ;;
17725 esac
17726
17727
17728 $cat <<EOM
17729
17730 Checking to see whether you can access character data unalignedly...
17731 EOM
17732 case "$d_u32align" in
17733 '')   $cat >try.c <<EOCP
17734 #include <stdio.h>
17735 #$i_stdlib I_STDLIB
17736 #ifdef I_STDLIB
17737 #include <stdlib.h>
17738 #endif
17739 #define U32 $u32type
17740 #define BYTEORDER 0x$byteorder
17741 #define U8 $u8type
17742 #include <signal.h>
17743 #ifdef SIGBUS
17744 $signal_t bletch(int s) { exit(4); }
17745 #endif
17746 int main() {
17747 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17748     U8 buf[8];
17749     U32 *up;
17750     int i;
17751
17752     if (sizeof(U32) != 4) {
17753         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17754         exit(1);
17755     }
17756
17757     fflush(stdout);
17758
17759 #ifdef SIGBUS
17760     signal(SIGBUS, bletch);
17761 #endif
17762
17763     buf[0] = 0;
17764     buf[1] = 0;
17765     buf[2] = 0;
17766     buf[3] = 1;
17767     buf[4] = 0;
17768     buf[5] = 0;
17769     buf[6] = 0;
17770     buf[7] = 1;
17771
17772     for (i = 0; i < 4; i++) {
17773         up = (U32*)(buf + i);
17774         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17775                (*up == 1 << (8*(3-i)))  /* little-endian */
17776               )
17777            )
17778         {
17779             printf("read failed (%x)\n", *up);
17780             exit(2);
17781         }
17782     }
17783
17784     /* write test */
17785     for (i = 0; i < 4; i++) {
17786         up = (U32*)(buf + i);
17787         *up = 0xBeef;
17788         if (*up != 0xBeef) {
17789             printf("write failed (%x)\n", *up);
17790             exit(3);
17791         }
17792     }
17793
17794     exit(0);
17795 #else
17796     printf("1\n");
17797     exit(1);
17798 #endif
17799     return 0;
17800 }
17801 EOCP
17802 set try
17803 if eval $compile_ok; then
17804         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17805         $run ./try 2>&1 >/dev/null
17806         case "$?" in
17807         0)      cat >&4 <<EOM
17808 You can access character data pretty unalignedly.
17809 EOM
17810                 d_u32align="$undef"
17811                 ;;
17812         *)      cat >&4 <<EOM
17813 It seems that you must access character data in an aligned manner.
17814 EOM
17815                 d_u32align="$define"
17816                 ;;
17817         esac
17818 else
17819         rp='Can you access character data at unaligned addresses?'
17820         dflt='n'
17821         . ./myread
17822         case "$ans" in
17823         [yY]*)  d_u32align="$undef"  ;;
17824         *)      d_u32align="$define" ;;
17825         esac
17826 fi
17827 $rm -f core core.try.* try.core
17828 ;;
17829 esac
17830
17831 : see if ualarm exists
17832 set ualarm d_ualarm
17833 eval $inlibc
17834
17835 : see if umask exists
17836 set umask d_umask
17837 eval $inlibc
17838
17839 : see if unordered exists
17840 set unordered d_unordered
17841 eval $inlibc
17842
17843 : see if unsetenv exists
17844 set unsetenv d_unsetenv
17845 eval $inlibc
17846
17847 : see if usleep exists
17848 set usleep d_usleep
17849 eval $inlibc
17850
17851 : see if prototype for usleep is available
17852 echo " "
17853 set d_usleepproto usleep $i_unistd unistd.h
17854 eval $hasproto
17855
17856 : see if ustat exists
17857 set ustat d_ustat
17858 eval $inlibc
17859
17860 : backward compatibility for d_hvfork
17861 if test X$d_hvfork != X; then
17862         d_vfork="$d_hvfork"
17863         d_hvfork=''
17864 fi
17865 : see if there is a vfork
17866 val=''
17867 set vfork val
17868 eval $inlibc
17869
17870 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17871 : perl on Solaris 2.x, and probably elsewhere.
17872 case "$val" in
17873 $define)
17874         echo " "
17875         case "$usevfork" in
17876         false) dflt='n';;
17877         *) dflt='y';;
17878         esac
17879         cat <<'EOM'
17880  
17881 Perl can only use a vfork() that doesn't suffer from strict
17882 restrictions on calling functions or modifying global data in
17883 the child.  For example, glibc-2.1 contains such a vfork()
17884 that is unsuitable.  If your system provides a proper fork()
17885 call, chances are that you do NOT want perl to use vfork().
17886
17887 EOM
17888         rp="Do you still want to use vfork()?"
17889         . ./myread
17890         case "$ans" in
17891         y|Y) ;;
17892         *)
17893                 echo "Ok, we won't use vfork()."
17894                 val="$undef"
17895                 ;;
17896         esac
17897         ;;
17898 esac
17899 set d_vfork
17900 eval $setvar
17901 case "$d_vfork" in
17902 $define) usevfork='true';;
17903 *) usevfork='false';;
17904 esac
17905
17906 : see if closedir exists
17907 set closedir d_closedir
17908 eval $inlibc
17909
17910 case "$d_closedir" in
17911 "$define")
17912         echo " "
17913         echo "Checking whether closedir() returns a status..." >&4
17914         cat > try.c <<EOM
17915 #$i_dirent I_DIRENT             /**/
17916 #$i_sysdir I_SYS_DIR            /**/
17917 #$i_sysndir I_SYS_NDIR          /**/
17918 #$i_systypes I_SYS_TYPES        /**/
17919
17920 #if defined(I_SYS_TYPES)
17921 #include <sys/types.h>
17922 #endif
17923 #if defined(I_DIRENT)
17924 #include <dirent.h>
17925 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17926 #include <sys/dir.h>
17927 #endif
17928 #else
17929 #ifdef I_SYS_NDIR
17930 #include <sys/ndir.h>
17931 #else
17932 #ifdef I_SYS_DIR
17933 #ifdef hp9000s500
17934 #include <ndir.h>       /* may be wrong in the future */
17935 #else
17936 #include <sys/dir.h>
17937 #endif
17938 #endif
17939 #endif
17940 #endif 
17941 int main() { return closedir(opendir(".")); }
17942 EOM
17943         set try
17944         if eval $compile_ok; then
17945                 if $run ./try > /dev/null 2>&1 ; then
17946                         echo "Yes, it does."
17947                         val="$undef"
17948                 else
17949                         echo "No, it doesn't."
17950                         val="$define"
17951                 fi
17952         else
17953                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17954                 val="$define"
17955         fi
17956         ;;
17957 *)
17958         val="$undef";
17959         ;;
17960 esac
17961 set d_void_closedir
17962 eval $setvar
17963 $rm -f try try.*
17964 : see if there is a wait4
17965 set wait4 d_wait4
17966 eval $inlibc
17967
17968 : see if waitpid exists
17969 set waitpid d_waitpid
17970 eval $inlibc
17971
17972 : see if wcstombs exists
17973 set wcstombs d_wcstombs
17974 eval $inlibc
17975
17976 : see if wctomb exists
17977 set wctomb d_wctomb
17978 eval $inlibc
17979
17980 : see if writev exists
17981 set writev d_writev
17982 eval $inlibc
17983
17984 : preserve RCS keywords in files with variable substitution, grrr
17985 Date='$Date'
17986 Id='$Id'
17987 Log='$Log'
17988 RCSfile='$RCSfile'
17989 Revision='$Revision'
17990
17991 : check for alignment requirements
17992 echo " "
17993 case "$usecrosscompile$multiarch" in
17994 *$define*)
17995         $cat <<EOM
17996 You seem to be either cross-compiling or doing a multiarchitecture build,
17997 skipping the memory alignment check.
17998
17999 EOM
18000         case "$alignbytes" in
18001         '') alignbytes=8 ;;
18002         esac
18003         ;;
18004 *)
18005         case "$alignbytes" in
18006         '') echo "Checking alignment constraints..." >&4
18007                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18008                         $cat >try.c <<'EOCP'
18009 typedef long double NV;
18010 EOCP
18011                 else
18012                         $cat >try.c <<'EOCP'
18013 typedef double NV;
18014 EOCP
18015                 fi
18016                 $cat >>try.c <<'EOCP'
18017 #include <stdio.h>
18018 struct foobar {
18019         char foo;
18020         NV bar;
18021 } try_algn;
18022 int main()
18023 {
18024     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18025     return(0);
18026 }
18027 EOCP
18028                 set try
18029                 if eval $compile_ok; then
18030                         dflt=`$run ./try`
18031                 else
18032                         dflt='8'
18033                         echo "(I can't seem to compile the test program...)"
18034                 fi
18035                 ;;
18036         *) dflt="$alignbytes"
18037                 ;;
18038         esac
18039         rp="Doubles must be aligned on a how-many-byte boundary?"
18040         . ./myread
18041         alignbytes="$ans"
18042         $rm -f try.c try
18043         ;;
18044 esac
18045
18046
18047 : set the base revision
18048 baserev=5.0
18049
18050 : how do we concatenate cpp tokens here?
18051 echo " "
18052 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18053 $cat >cpp_stuff.c <<'EOCP'
18054 #define RCAT(a,b)a/**/b
18055 #define ACAT(a,b)a ## b
18056 RCAT(Rei,ser)
18057 ACAT(Cir,cus)
18058 EOCP
18059 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18060 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18061         echo "Oh!  Smells like ANSI's been here." >&4
18062         echo "We can catify or stringify, separately or together!"
18063         cpp_stuff=42
18064 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18065         echo "Ah, yes!  The good old days!" >&4
18066         echo "However, in the good old days we don't know how to stringify and"
18067         echo "catify at the same time."
18068         cpp_stuff=1
18069 else
18070         $cat >&4 <<EOM
18071 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18072 You're going to have to edit the values of CAT[2-5] in config.h...
18073 EOM
18074         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18075 fi
18076 $rm -f cpp_stuff.*
18077
18078 : see if this is a db.h system
18079 set db.h i_db
18080 eval $inhdr
18081
18082 case "$i_db" in
18083 $define)
18084         : Check db version.
18085         echo " "
18086         echo "Checking Berkeley DB version ..." >&4
18087         $cat >try.c <<EOCP
18088 #$d_const HASCONST
18089 #ifndef HASCONST
18090 #define const
18091 #endif
18092 #include <sys/types.h>
18093 #include <stdio.h>
18094 #$i_stdlib I_STDLIB
18095 #ifdef I_STDLIB
18096 #include <stdlib.h>
18097 #endif
18098 #include <db.h>
18099 int main(int argc, char *argv[])
18100 {
18101 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18102     int Major, Minor, Patch ;
18103     unsigned long Version ;
18104     (void)db_version(&Major, &Minor, &Patch) ;
18105     if (argc == 2) {
18106         printf("%d %d %d %d %d %d\n",
18107                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18108                Major, Minor, Patch);
18109         exit(0);
18110     }
18111     printf("You have Berkeley DB Version 2 or greater.\n");
18112
18113     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18114                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18115     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18116                 Major, Minor, Patch) ;
18117
18118     /* check that db.h & libdb are compatible */
18119     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18120         printf("db.h and libdb are incompatible.\n") ;
18121         exit(3);        
18122     }
18123
18124     printf("db.h and libdb are compatible.\n") ;
18125
18126     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18127                 + DB_VERSION_PATCH ;
18128
18129     /* needs to be >= 2.3.4 */
18130     if (Version < 2003004) {
18131     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18132         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18133         exit(2);        
18134     }
18135
18136     exit(0);
18137 #else
18138 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18139     if (argc == 2) {
18140         printf("1 0 0\n");
18141         exit(0);
18142     }
18143     printf("You have Berkeley DB Version 1.\n");
18144     exit(0);    /* DB version < 2: the coast is clear. */
18145 #else
18146     exit(1);    /* <db.h> not Berkeley DB? */
18147 #endif
18148 #endif
18149 }
18150 EOCP
18151         set try
18152         if eval $compile_ok && $run ./try; then
18153                 echo 'Looks OK.' >&4
18154                 set `$run ./try 1`
18155                 db_version_major=$1
18156                 db_version_minor=$2
18157                 db_version_patch=$3
18158         else
18159                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18160                 i_db=$undef
18161                 case " $libs " in
18162                 *"-ldb "*)
18163                         : Remove db from list of libraries to use
18164                         echo "Removing unusable -ldb from library list" >&4
18165                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18166                         shift
18167                         libs="$*"
18168                         echo "libs = $libs" >&4
18169                         ;;
18170                 esac
18171         fi
18172         $rm -f try.*
18173         ;;
18174 esac
18175
18176 case "$i_db" in
18177 define)
18178         : Check the return type needed for hash 
18179         echo " "
18180         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18181         $cat >try.c <<EOCP
18182 #$d_const HASCONST
18183 #ifndef HASCONST
18184 #define const
18185 #endif
18186 #include <sys/types.h>
18187 #include <db.h>
18188
18189 #ifndef DB_VERSION_MAJOR
18190 u_int32_t hash_cb (ptr, size)
18191 const void *ptr;
18192 size_t size;
18193 {
18194 }
18195 HASHINFO info;
18196 int main()
18197 {
18198         info.hash = hash_cb;
18199 }
18200 #endif
18201 EOCP
18202         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18203                 if $contains warning try.out >>/dev/null 2>&1 ; then
18204                         db_hashtype='int'
18205                 else
18206                         db_hashtype='u_int32_t'
18207                 fi
18208         else
18209                 : XXX Maybe we should just give up here.
18210                 db_hashtype=u_int32_t
18211                 $cat try.out >&4
18212                 echo "Help:  I can't seem to compile the db test program." >&4
18213                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18214         fi
18215         $rm -f try.*
18216         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18217         ;;
18218 *)      db_hashtype=u_int32_t
18219         ;;
18220 esac
18221 case "$i_db" in
18222 define)
18223         : Check the return type needed for prefix 
18224         echo " "
18225         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18226         cat >try.c <<EOCP
18227 #$d_const HASCONST
18228 #ifndef HASCONST
18229 #define const
18230 #endif
18231 #include <sys/types.h>
18232 #include <db.h>
18233
18234 #ifndef DB_VERSION_MAJOR
18235 size_t prefix_cb (key1, key2)
18236 const DBT *key1;
18237 const DBT *key2;
18238 {
18239 }
18240 BTREEINFO info;
18241 int main()
18242 {
18243         info.prefix = prefix_cb;
18244 }
18245 #endif
18246 EOCP
18247         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18248                 if $contains warning try.out >>/dev/null 2>&1 ; then
18249                         db_prefixtype='int'
18250                 else
18251                         db_prefixtype='size_t'
18252                 fi
18253         else
18254                 db_prefixtype='size_t'
18255                 : XXX Maybe we should just give up here.
18256                 $cat try.out >&4
18257                 echo "Help:  I can't seem to compile the db test program." >&4
18258                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18259         fi
18260         $rm -f try.*
18261         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18262         ;;
18263 *)      db_prefixtype='size_t'
18264         ;;
18265 esac
18266
18267
18268 : How can we generate normalized random numbers ?
18269 echo " "
18270 echo "Looking for a random number function..." >&4
18271 case "$randfunc" in
18272 '')
18273         if set drand48 val -f; eval $csym; $val; then
18274                 dflt="drand48"
18275                 echo "Good, found drand48()." >&4
18276         elif set random val -f; eval $csym; $val; then
18277                 dflt="random"
18278                 echo "OK, found random()." >&4
18279         else
18280                 dflt="rand"
18281                 echo "Yick, looks like I have to use rand()." >&4
18282         fi
18283         echo " "
18284         ;;
18285 *)
18286         dflt="$randfunc"
18287         ;;
18288 esac
18289 cont=true
18290
18291 case "$ccflags" in
18292 *-Dmy_rand=*|*-Dmy_srand=*)
18293         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18294         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18295         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18296         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18297         ;;
18298 esac
18299
18300 while $test "$cont"; do
18301         rp="Use which function to generate random numbers?"
18302         . ./myread
18303         if $test "$ans" = "$dflt"; then
18304                 : null
18305         else
18306                 randbits=''
18307         fi
18308         randfunc="$ans"
18309         if set $ans val -f; eval $csym; $val; then
18310                 cont=''
18311         else
18312                 dflt=y
18313                 rp="I cannot find function $ans. Use that name anyway?"
18314                 . ./myread
18315                 dflt=rand
18316                 case "$ans" in
18317                         [yY]*) cont='';;
18318                 esac
18319         fi
18320         case "$cont" in
18321         '')
18322                 case "$randfunc" in
18323                 drand48)
18324                         drand01="drand48()"
18325                         seedfunc="srand48"
18326                         randbits=48
18327                         randseedtype=long
18328                         ;;
18329                 rand|random)
18330                         case "$randbits" in
18331                         '')
18332 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18333                                 $cat >try.c <<EOCP
18334 #$i_unistd I_UNISTD
18335 #$i_stdlib I_STDLIB
18336 #include <stdio.h>
18337 #ifdef I_UNISTD
18338 #  include <unistd.h>
18339 #endif
18340 #ifdef I_STDLIB
18341 #  include <stdlib.h>
18342 #endif
18343 int main()
18344 {
18345         register int i;
18346         register unsigned long tmp;
18347         register unsigned long max = 0L;
18348
18349         for (i = 1000; i; i--) {
18350                 tmp = (unsigned long) $randfunc();
18351                 if (tmp > max) max = tmp;
18352         }
18353         for (i = 0; max; i++)
18354                 max /= 2;
18355         printf("%d\n",i);
18356 }
18357 EOCP
18358                                 set try
18359                                 if eval $compile_ok; then
18360                                         dflt=`try`
18361                                 else
18362                                         dflt='?'
18363                                         echo "(I can't seem to compile the test program...)"
18364                                 fi
18365                                 ;;
18366                         *)
18367                                 dflt="$randbits"
18368                                 ;;
18369                         esac
18370                         rp="How many bits does your $randfunc() function produce?"
18371                         . ./myread
18372                         randbits="$ans"
18373                         $rm -f try.c try
18374                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18375                         seedfunc="s$randfunc"
18376                         randseedtype=unsigned
18377                         ;;
18378                 *)
18379                         dflt="31"
18380                         rp="How many bits does your $randfunc() function produce?"
18381                         . ./myread
18382                         randbits="$ans"
18383                         seedfunc="s$randfunc"
18384                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18385                         if set $seedfunc val -f; eval $csym; $val; then
18386                                 echo "(Using $seedfunc() to seed random generator)"
18387                         else
18388                                 echo "(Warning: no $seedfunc() to seed random generator)"
18389                                 seedfunc=rand
18390                         fi
18391                         randseedtype=unsigned
18392                         ;;
18393                 esac
18394                 ;;
18395         esac
18396 done
18397
18398 echo " "
18399 echo "Determining whether or not we are on an EBCDIC system..." >&4
18400 $cat >try.c <<'EOM'
18401 int main()
18402 {
18403   if ('M'==0xd4) return 0;
18404   return 1;
18405 }
18406 EOM
18407
18408 val=$undef
18409 set try
18410 if eval $compile_ok; then
18411         if $run ./try; then
18412                 echo "You seem to speak EBCDIC." >&4
18413                 val="$define"
18414         else
18415                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18416         fi
18417 else
18418         echo "I'm unable to compile the test program." >&4
18419         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18420 fi
18421 $rm -f try try.*
18422 set ebcdic
18423 eval $setvar
18424
18425 echo " "
18426 $cat >&4 <<EOM
18427 Checking how to flush all pending stdio output...
18428 EOM
18429 # I only know how to find the first 32 possibly open files on SunOS.
18430 # See also hints/sunos_4_1.sh and util.c  --AD
18431 case "$osname" in
18432 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18433 esac
18434 $cat >>try.c <<EOCP
18435 #include <stdio.h>
18436 #$i_stdlib I_STDLIB
18437 #ifdef I_STDLIB
18438 #include <stdlib.h>
18439 #endif
18440 #$i_unistd I_UNISTD
18441 #ifdef I_UNISTD
18442 # include <unistd.h>
18443 #endif
18444 #$d_sysconf HAS_SYSCONF
18445 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18446 #ifdef HAS_STDIO_STREAM_ARRAY
18447 # define STDIO_STREAM_ARRAY $stdio_stream_array
18448 #endif
18449 int main() {
18450   FILE* p;
18451   unlink("try.out");
18452   p = fopen("try.out", "w");
18453 #ifdef TRY_FPUTC
18454   fputc('x', p);
18455 #else
18456 # ifdef TRY_FPRINTF
18457   fprintf(p, "x");
18458 # endif
18459 #endif
18460 #ifdef TRY_FFLUSH_NULL
18461   fflush(NULL);
18462 #endif
18463 #ifdef TRY_FFLUSH_ALL
18464   {
18465     long open_max = -1;
18466 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18467     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18468 # else
18469 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18470     open_max = sysconf(_SC_OPEN_MAX);
18471 #  else
18472 #   ifdef FOPEN_MAX
18473     open_max = FOPEN_MAX;
18474 #   else
18475 #    ifdef OPEN_MAX
18476     open_max = OPEN_MAX;
18477 #    else
18478 #     ifdef _NFILE
18479     open_max = _NFILE;
18480 #     endif
18481 #    endif
18482 #   endif
18483 #  endif
18484 # endif 
18485 # ifdef HAS_STDIO_STREAM_ARRAY
18486     if (open_max > 0) {
18487       long i;
18488       for (i = 0; i < open_max; i++)
18489             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18490                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18491                 STDIO_STREAM_ARRAY[i]._flag)
18492                 fflush(&STDIO_STREAM_ARRAY[i]);
18493     }   
18494   }
18495 # endif
18496 #endif
18497   _exit(42);
18498 }
18499 EOCP
18500 : first we have to find out how _not_ to flush
18501 $to try.c
18502 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18503     output=''
18504     set try -DTRY_FPUTC
18505     if eval $compile; then
18506             $run ./try 2>/dev/null
18507             code="$?"
18508             $from try.out
18509             if $test ! -s try.out -a "X$code" = X42; then
18510                 output=-DTRY_FPUTC
18511             fi
18512     fi
18513     case "$output" in
18514     '')
18515             set try -DTRY_FPRINTF
18516             if eval $compile; then
18517                     $run ./try 2>/dev/null
18518                     code="$?"
18519                     $from try.out
18520                     if $test ! -s try.out -a "X$code" = X42; then
18521                         output=-DTRY_FPRINTF
18522                     fi
18523             fi
18524         ;;
18525     esac
18526 fi
18527 : check for fflush NULL behaviour
18528 case "$fflushNULL" in
18529 '')     set try -DTRY_FFLUSH_NULL $output
18530         if eval $compile; then
18531                 $run ./try 2>/dev/null
18532                 code="$?"
18533                 $from try.out
18534                 if $test -s try.out -a "X$code" = X42; then
18535                         fflushNULL="`$cat try.out`"
18536                 else
18537                         if $test "X$code" != X42; then
18538                                 $cat >&4 <<EOM
18539 (If this test failed, don't worry, we'll try another method shortly.)
18540 EOM
18541                         fi
18542                 fi
18543         fi
18544         $rm -f core try.core core.try.*
18545         case "$fflushNULL" in
18546         x)      $cat >&4 <<EOM
18547 Your fflush(NULL) works okay for output streams.
18548 Let's see if it clobbers input pipes...
18549 EOM
18550 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18551 # bug that improperly flushes the input end of pipes.  So we avoid the
18552 # autoflush on fork/system/exec support for now. :-(
18553 $cat >tryp.c <<EOCP
18554 #include <stdio.h>
18555 int
18556 main(int argc, char **argv)
18557 {
18558     char buf[1024];
18559     int i;
18560     char *bp = buf;
18561     while (1) {
18562         while ((i = getc(stdin)) != -1
18563                && (*bp++ = i) != '\n'
18564                && bp < &buf[1024])
18565         /* DO NOTHING */ ;
18566         *bp = '\0';
18567         fprintf(stdout, "%s", buf);
18568         fflush(NULL);
18569         if (i == -1)
18570             return 0;
18571         bp = buf;
18572     }
18573 }
18574 EOCP
18575                 fflushNULL="$define"
18576                 set tryp
18577                 if eval $compile; then
18578                     $rm -f tryp.out
18579                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18580                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18581                        $cat >&4 <<EOM
18582 fflush(NULL) seems to behave okay with input streams.
18583 EOM
18584                         fflushNULL="$define"
18585                     else
18586                         $cat >&4 <<EOM
18587 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18588 EOM
18589                         fflushNULL="$undef"
18590                     fi
18591                 fi
18592                 $rm -f core tryp.c tryp.core core.tryp.*
18593                 ;;
18594         '')     $cat >&4 <<EOM
18595 Your fflush(NULL) isn't working (contrary to ANSI C).
18596 EOM
18597                 fflushNULL="$undef"
18598                 ;;
18599         *)      $cat >&4 <<EOM
18600 Cannot figure out whether your fflush(NULL) works or not.
18601 I'm assuming it doesn't (contrary to ANSI C).
18602 EOM
18603                 fflushNULL="$undef"
18604                 ;;
18605         esac
18606         ;;
18607 $define|true|[yY]*)
18608         fflushNULL="$define"
18609         ;;
18610 *)
18611         fflushNULL="$undef"
18612         ;;
18613 esac
18614 : check explicit looping only if NULL did not work, and if the pipe
18615 : bug does not show up on an explicit flush too
18616 case "$fflushNULL" in
18617 "$undef")
18618         $cat >tryp.c <<EOCP
18619 #include <stdio.h>
18620 int
18621 main(int argc, char **argv)
18622 {
18623     char buf[1024];
18624     int i;
18625     char *bp = buf;
18626     while (1) {
18627         while ((i = getc(stdin)) != -1
18628                && (*bp++ = i) != '\n'
18629                && bp < &buf[1024])
18630         /* DO NOTHING */ ;
18631         *bp = '\0';
18632         fprintf(stdout, "%s", buf);
18633         fflush(stdin);
18634         if (i == -1)
18635             return 0;
18636         bp = buf;
18637     }
18638 }
18639 EOCP
18640         set tryp
18641         if eval $compile; then
18642             $rm -f tryp.out
18643             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18644             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18645                $cat >&4 <<EOM
18646 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18647 EOM
18648                 : now check for fflushall behaviour
18649                 case "$fflushall" in
18650                 '')     set try -DTRY_FFLUSH_ALL $output
18651                         if eval $compile; then
18652                                 $cat >&4 <<EOM
18653 (Now testing the other method--but note that this also may fail.)
18654 EOM
18655                                 $run ./try 2>/dev/null
18656                                 code=$?
18657                                 $from try.out
18658                                 if $test -s try.out -a "X$code" = X42; then
18659                                         fflushall="`$cat try.out`"
18660                                 fi
18661                         fi
18662                         $rm -f core try.core core.try.*
18663                         case "$fflushall" in
18664                         x)      $cat >&4 <<EOM
18665 Whew. Flushing explicitly all the stdio streams works.
18666 EOM
18667                                 fflushall="$define"
18668                                 ;;
18669                         '')     $cat >&4 <<EOM
18670 Sigh. Flushing explicitly all the stdio streams doesn't work.
18671 EOM
18672                                 fflushall="$undef"
18673                                 ;;
18674                         *)      $cat >&4 <<EOM
18675 Cannot figure out whether flushing stdio streams explicitly works or not.
18676 I'm assuming it doesn't.
18677 EOM
18678                                 fflushall="$undef"
18679                                 ;;
18680                         esac
18681                         ;;
18682                 "$define"|true|[yY]*)
18683                         fflushall="$define"
18684                         ;;
18685                 *)
18686                         fflushall="$undef"
18687                         ;;
18688                 esac
18689             else
18690                 $cat >&4 <<EOM
18691 All is futile.  Even fflush(stdin) clobbers input pipes!
18692 EOM
18693                 fflushall="$undef"
18694             fi
18695         else
18696             fflushall="$undef"
18697         fi
18698         $rm -f core tryp.c tryp.core core.tryp.*
18699         ;;
18700 *)      fflushall="$undef"
18701         ;;
18702 esac
18703
18704 case "$fflushNULL$fflushall" in
18705 undefundef)
18706         $cat <<EOM
18707 OK, I give up.  I cannot figure out how to flush pending stdio output.
18708 We won't be flushing handles at all before fork/exec/popen.
18709 EOM
18710         ;;
18711 esac
18712 $rm -f try.* try$exe_ext
18713
18714 : Store the full pathname to the ar program for use in the C program
18715 : Respect a hint or command line value for full_ar.
18716 case "$full_ar" in
18717 '') full_ar=$ar ;;
18718 esac
18719
18720 : Store the full pathname to the sed program for use in the C program
18721 full_sed=$sed
18722
18723 : see what type gids are declared as in the kernel
18724 echo " "
18725 echo "Looking for the type for group ids returned by getgid()."
18726 set gid_t gidtype xxx stdio.h sys/types.h
18727 eval $typedef
18728 case "$gidtype" in
18729 xxx)
18730         xxx=`./findhdr sys/user.h`
18731         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18732         case $1 in
18733         unsigned) dflt="$1 $2" ;;
18734         *) dflt="$1" ;;
18735         esac
18736         ;;
18737 *) dflt="$gidtype";;
18738 esac
18739 case "$gidtype" in
18740 gid_t) echo "gid_t found." ;;
18741 *)      rp="What is the type for group ids returned by getgid()?"
18742         . ./myread
18743         gidtype="$ans"
18744         ;;
18745 esac
18746
18747 echo " "
18748 case "$gidtype" in
18749 *_t) zzz="$gidtype"     ;;
18750 *)   zzz="gid"          ;;
18751 esac
18752 echo "Checking the size of $zzz..." >&4 
18753 cat > try.c <<EOCP
18754 #include <sys/types.h>
18755 #include <stdio.h>
18756 #$i_stdlib I_STDLIB
18757 #ifdef I_STDLIB
18758 #include <stdlib.h>
18759 #endif
18760 int main() {
18761     printf("%d\n", (int)sizeof($gidtype));
18762     exit(0);
18763 }
18764 EOCP
18765 set try
18766 if eval $compile_ok; then
18767         yyy=`$run ./try`
18768         case "$yyy" in
18769         '')     gidsize=4
18770                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18771                 ;;
18772         *)      gidsize=$yyy
18773                 echo "Your $zzz is $gidsize bytes long."
18774                 ;;
18775         esac
18776 else
18777         gidsize=4
18778         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18779 fi
18780
18781
18782 echo " "
18783 case "$gidtype" in
18784 *_t) zzz="$gidtype"     ;;
18785 *)   zzz="gid"          ;;
18786 esac
18787 echo "Checking the sign of $zzz..." >&4 
18788 cat > try.c <<EOCP
18789 #include <sys/types.h>
18790 #include <stdio.h>
18791 int main() {
18792         $gidtype foo = -1;
18793         if (foo < 0)
18794                 printf("-1\n");
18795         else
18796                 printf("1\n");
18797 }
18798 EOCP
18799 set try
18800 if eval $compile; then
18801         yyy=`$run ./try`
18802         case "$yyy" in
18803         '')     gidsign=1
18804                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18805                 ;;
18806         *)      gidsign=$yyy
18807                 case "$gidsign" in
18808                  1) echo "Your $zzz is unsigned." ;;
18809                 -1) echo "Your $zzz is signed."   ;;
18810                 esac
18811                 ;;
18812         esac
18813 else
18814         gidsign=1
18815         echo "(I can't compile the test program--guessing unsigned.)" >&4
18816 fi
18817
18818
18819 echo " "
18820
18821 if $test X"$quadtype" != X; then
18822
18823 echo "Checking how to print 64-bit integers..." >&4
18824
18825 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18826         $cat >try.c <<'EOCP'
18827 #include <sys/types.h>
18828 #include <stdio.h>
18829 int main() {
18830   int q = 12345678901;
18831   printf("%ld\n", q);
18832 }
18833 EOCP
18834         set try
18835         if eval $compile; then
18836                 yyy=`$run ./try`
18837                 case "$yyy" in
18838                 12345678901)
18839                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18840                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18841                         echo "We will use %d."
18842                         ;;
18843                 esac
18844         fi
18845 fi
18846
18847 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18848         $cat >try.c <<'EOCP'
18849 #include <sys/types.h>
18850 #include <stdio.h>
18851 int main() {
18852   long q = 12345678901;
18853   printf("%ld\n", q);
18854 }
18855 EOCP
18856         set try
18857         if eval $compile; then
18858                 yyy=`$run ./try`
18859                 case "$yyy" in
18860                 12345678901)
18861                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18862                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18863                         echo "We will use %ld."
18864                         ;;
18865                 esac
18866         fi
18867 fi
18868
18869 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18870         $cat >try.c <<'EOCP'
18871 #include <sys/types.h>
18872 #include <inttypes.h>
18873 #include <stdio.h>
18874 int main() {
18875   int64_t q = 12345678901;
18876   printf("%" PRId64 "\n", q);
18877 }
18878 EOCP
18879         set try
18880         if eval $compile; then
18881                 yyy=`$run ./try`
18882                 case "$yyy" in
18883                 12345678901)
18884                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18885                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18886                         echo "We will use the C9X style."
18887                         ;;
18888                 esac
18889         fi
18890 fi
18891
18892 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18893         $cat >try.c <<EOCP
18894 #include <sys/types.h>
18895 #include <stdio.h>
18896 int main() {
18897   $quadtype q = 12345678901;
18898   printf("%Ld\n", q);
18899 }
18900 EOCP
18901         set try
18902         if eval $compile; then
18903                 yyy=`$run ./try`
18904                 case "$yyy" in
18905                 12345678901)
18906                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18907                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18908                         echo "We will use %Ld."
18909                         ;;
18910                 esac
18911         fi
18912 fi
18913
18914 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18915         $cat >try.c <<'EOCP'
18916 #include <sys/types.h>
18917 #include <stdio.h>
18918 int main() {
18919   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18920   printf("%lld\n", q);
18921 }
18922 EOCP
18923         set try
18924         if eval $compile; then
18925                 yyy=`$run ./try`
18926                 case "$yyy" in
18927                 12345678901)
18928                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18929                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18930                         echo "We will use the %lld style."
18931                         ;;
18932                 esac
18933         fi
18934 fi
18935
18936 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18937         $cat >try.c <<EOCP
18938 #include <sys/types.h>
18939 #include <stdio.h>
18940 int main() {
18941   $quadtype q = 12345678901;
18942   printf("%qd\n", q);
18943 }
18944 EOCP
18945         set try
18946         if eval $compile; then
18947                 yyy=`$run ./try`
18948                 case "$yyy" in
18949                 12345678901)
18950                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18951                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18952                         echo "We will use %qd."
18953                         ;;
18954                 esac
18955         fi
18956 fi
18957
18958 if $test X"$sPRId64" = X; then
18959         echo "Cannot figure out how to print 64-bit integers." >&4
18960 fi
18961
18962 $rm -f try try.*
18963
18964 fi
18965
18966 case "$sPRId64" in
18967 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18968         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18969         ;;
18970 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18971         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18972         ;;
18973 esac
18974
18975
18976 echo " "
18977 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18978
18979 if $test X"$ivsize" = X8; then
18980         ivdformat="$sPRId64"
18981         uvuformat="$sPRIu64"
18982         uvoformat="$sPRIo64"
18983         uvxformat="$sPRIx64"
18984         uvXUformat="$sPRIXU64"
18985 else
18986         if $test X"$ivsize" = X"$longsize"; then
18987                 ivdformat='"ld"'
18988                 uvuformat='"lu"'
18989                 uvoformat='"lo"'
18990                 uvxformat='"lx"'
18991                 uvXUformat='"lX"'
18992         else
18993                 if $test X"$ivsize" = X"$intsize"; then
18994                         ivdformat='"d"'
18995                         uvuformat='"u"'
18996                         uvoformat='"o"'
18997                         uvxformat='"x"'
18998                         uvXUformat='"X"'
18999                 else
19000                         : far out
19001                         if $test X"$ivsize" = X"$shortsize"; then
19002                                 ivdformat='"hd"'
19003                                 uvuformat='"hu"'
19004                                 uvoformat='"ho"'
19005                                 uvxformat='"hx"'
19006                                 uvXUformat='"hX"'
19007                         fi
19008                 fi
19009         fi
19010 fi
19011
19012 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19013         nveformat="$sPRIeldbl"
19014         nvfformat="$sPRIfldbl"
19015         nvgformat="$sPRIgldbl"
19016         nvEUformat="$sPRIEUldbl"
19017         nvFUformat="$sPRIFUldbl"
19018         nvGUformat="$sPRIGUldbl"
19019 else
19020         nveformat='"e"'
19021         nvfformat='"f"'
19022         nvgformat='"g"'
19023         nvEUformat='"E"'
19024         nvFUformat='"F"'
19025         nvGUformat='"G"'
19026 fi
19027
19028 case "$ivdformat" in
19029 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19030     exit 1
19031     ;;
19032 esac
19033
19034
19035 echo " "
19036 $echo "Checking the format string to be used for gids..." >&4
19037
19038 case "$gidsign" in
19039 -1)     if $test X"$gidsize" = X"$ivsize"; then
19040                 gidformat="$ivdformat"
19041         else
19042                 if $test X"$gidsize" = X"$longsize"; then
19043                         gidformat='"ld"'
19044                 else
19045                         if $test X"$gidsize" = X"$intsize"; then
19046                                 gidformat='"d"'
19047                         else
19048                                 if $test X"$gidsize" = X"$shortsize"; then
19049                                         gidformat='"hd"'
19050                                 fi
19051                         fi
19052                 fi
19053         fi
19054         ;;
19055 *)      if $test X"$gidsize" = X"$uvsize"; then
19056                 gidformat="$uvuformat"
19057         else
19058                 if $test X"$gidsize" = X"$longsize"; then
19059                         gidformat='"lu"'
19060                 else
19061                         if $test X"$gidsize" = X"$intsize"; then
19062                                 gidformat='"u"'
19063                         else
19064                                 if $test X"$gidsize" = X"$shortsize"; then
19065                                         gidformat='"hu"'
19066                                 fi
19067                         fi
19068                 fi
19069         fi
19070         ;;
19071 esac
19072
19073 : see if getgroups exists
19074 set getgroups d_getgrps
19075 eval $inlibc
19076
19077 : see if setgroups exists
19078 set setgroups d_setgrps
19079 eval $inlibc
19080
19081
19082 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19083 echo " "
19084 case "$d_getgrps$d_setgrps" in
19085 *define*)
19086         case "$groupstype" in
19087         '') dflt="$gidtype" ;;
19088         *)  dflt="$groupstype" ;;
19089         esac
19090         $cat <<EOM
19091 What type of pointer is the second argument to getgroups() and setgroups()?
19092 Usually this is the same as group ids, $gidtype, but not always.
19093
19094 EOM
19095         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19096         . ./myread
19097         groupstype="$ans"
19098         ;;
19099 *)  groupstype="$gidtype";;
19100 esac
19101
19102
19103 if $test $patchlevel -lt 9; then
19104 : MAD is not available in 5.8.x or earlier.
19105     ans=n;
19106 else
19107     case "$mad" in
19108     $define|true|[yY]*) dflt='y' ;;
19109     *)                  dflt='n' ;;
19110     esac
19111     cat <<EOM
19112
19113 Would you like to build with Misc Attribute Decoration? This is development
19114 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19115 overhead on the interpreter.
19116
19117 If this doesn't make any sense to you, just accept the default '$dflt'.
19118 EOM
19119     rp='Build Perl with MAD?'
19120     . ./myread
19121 fi
19122 case "$ans" in
19123 y|Y)    val="$define"
19124         madlyh='madly.h madly.act madly.tab'
19125         madlysrc='madly.c'
19126         madlyobj="madly$_o" ;;
19127 *)      val="$undef"
19128         madlyh=''
19129         madlysrc=''
19130         madlyobj='' ;;
19131 esac
19132 set mad
19133 eval $setvar
19134
19135 echo " "
19136 echo "Checking if your $make program sets \$(MAKE)..." >&4
19137 case "$make_set_make" in
19138 '')
19139         $sed 's/^X //' > testmake.mak << 'EOF'
19140 Xall:
19141 X       @echo 'maketemp="$(MAKE)"'
19142 EOF
19143         case "`$make -f testmake.mak 2>/dev/null`" in
19144         *maketemp=*) make_set_make='#' ;;
19145         *)      make_set_make="MAKE=$make" ;;
19146         esac
19147         $rm -f testmake.mak
19148         ;;
19149 esac
19150 case "$make_set_make" in
19151 '#') echo "Yup, it does.";;
19152 *) echo "Nope, it doesn't.";;
19153 esac
19154
19155 : see what type is used for mode_t
19156 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19157 set mode_t modetype int stdio.h sys/types.h
19158 eval $typedef_ask
19159
19160 : see if we need va_copy
19161 echo " "
19162 case "$i_stdarg" in
19163 "$define")
19164         $cat >try.c <<EOCP
19165 #include <stdarg.h>
19166 #include <stdio.h>
19167 #$i_stdlib I_STDLIB
19168 #ifdef I_STDLIB
19169 #include <stdlib.h>
19170 #endif
19171 #include <signal.h>
19172
19173 int
19174 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19175 {
19176   return vfprintf(f, fmt, *valp);
19177 }
19178  
19179 int    
19180 myvfprintf(FILE *f, const  char *fmt, va_list val)
19181 {
19182   return ivfprintf(f, fmt, &val);
19183 }
19184       
19185 int
19186 myprintf(char *fmt, ...) 
19187 {
19188   va_list val;
19189   va_start(val, fmt);
19190   return myvfprintf(stdout, fmt, val); 
19191 }         
19192
19193 int
19194 main(int ac, char **av)
19195 {
19196   signal(SIGSEGV, exit);
19197
19198   myprintf("%s%cs all right, then\n", "that", '\'');                            
19199   exit(0);      
19200 }
19201 EOCP
19202         set try
19203         if eval $compile && $run ./try 2>&1 >/dev/null; then
19204                 case "`$run ./try`" in
19205                 "that's all right, then")
19206                         okay=yes
19207                         ;;
19208                 esac
19209         fi
19210         case "$okay" in
19211         yes)    echo "It seems that you don't need va_copy()." >&4
19212                 need_va_copy="$undef"
19213                 ;;
19214         *)      echo "It seems that va_copy() or similar will be needed." >&4
19215                 need_va_copy="$define"
19216                 ;;
19217         esac
19218         $rm -f try.* core core.* *.core *.core.*
19219         ;;
19220 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19221         ;;
19222 esac
19223
19224 : see what type is used for size_t
19225 rp="What is the type used for the length parameter for string functions?"
19226 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19227 eval $typedef_ask
19228
19229 : check for type of arguments to gethostbyaddr. 
19230 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19231         case "$d_gethbyaddr" in
19232         $define)
19233                 $cat <<EOM
19234
19235 Checking to see what type of arguments are accepted by gethostbyaddr().
19236 EOM
19237                 hdrs="$define sys/types.h
19238                         $d_socket sys/socket.h 
19239                         $i_niin netinet/in.h 
19240                         $i_netdb netdb.h
19241                         $i_unistd unistd.h"
19242                 : The first arg can 'char *' or 'void *'
19243                 : The second arg is some of integral type
19244                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19245                         for yyy in size_t long int; do
19246                                 case "$netdb_host_type" in
19247                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19248                                         if ./protochk "$try" $hdrs; then
19249                                                 echo "Your system accepts $xxx for the first arg."
19250                                                 echo "...and $yyy for the second arg."
19251                                                 netdb_host_type="$xxx"
19252                                                 netdb_hlen_type="$yyy"
19253                                         fi
19254                                         ;;
19255                                 esac
19256                         done
19257                 done
19258                 : In case none of those worked, prompt the user.
19259                 case "$netdb_host_type" in
19260                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19261                         dflt='char *'
19262                         . ./myread
19263                         netdb_host_type=$ans
19264                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19265                         dflt="$sizetype"
19266                         . ./myread
19267                         netdb_hlen_type=$ans
19268                         ;;
19269                 esac
19270                 ;;
19271         *)      : no gethostbyaddr, so pick harmless defaults
19272                 netdb_host_type='char *'
19273                 netdb_hlen_type="$sizetype"
19274                 ;;
19275         esac
19276         # Remove the "const" if needed. -- but then we'll have a 
19277         # prototype clash!
19278         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19279 fi
19280
19281 : check for type of argument to gethostbyname. 
19282 if test "X$netdb_name_type" = X ; then
19283         case "$d_gethbyname" in
19284         $define)
19285                 $cat <<EOM
19286
19287 Checking to see what type of argument is accepted by gethostbyname().
19288 EOM
19289                 hdrs="$define sys/types.h
19290                         $d_socket sys/socket.h 
19291                         $i_niin netinet/in.h 
19292                         $i_netdb netdb.h
19293                         $i_unistd unistd.h"
19294                 for xxx in "const char *" "char *"; do
19295                         case "$netdb_name_type" in
19296                         '')     try="extern struct hostent *gethostbyname($xxx);"
19297                                 if ./protochk "$try" $hdrs; then
19298                                         echo "Your system accepts $xxx."
19299                                         netdb_name_type="$xxx"
19300                                 fi
19301                                 ;;
19302                         esac
19303                 done
19304                 : In case none of those worked, prompt the user.
19305                 case "$netdb_name_type" in
19306                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19307                         dflt='char *'
19308                         . ./myread
19309                         netdb_name_type=$ans
19310                         ;;
19311                 esac
19312                 ;;
19313         *)      : no gethostbyname, so pick harmless default
19314                 netdb_name_type='char *'
19315                 ;;
19316         esac
19317 fi
19318
19319 : check for type of 1st argument to getnetbyaddr. 
19320 if test "X$netdb_net_type" = X ; then
19321         case "$d_getnbyaddr" in
19322         $define)
19323                 $cat <<EOM
19324
19325 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19326 EOM
19327                 hdrs="$define sys/types.h
19328                         $d_socket sys/socket.h 
19329                         $i_niin netinet/in.h 
19330                         $i_netdb netdb.h
19331                         $i_unistd unistd.h"
19332                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19333                         case "$netdb_net_type" in
19334                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19335                                 if ./protochk "$try" $hdrs; then
19336                                         echo "Your system accepts $xxx."
19337                                         netdb_net_type="$xxx"
19338                                 fi
19339                                 ;;
19340                         esac
19341                 done
19342                 : In case none of those worked, prompt the user.
19343                 case "$netdb_net_type" in
19344                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19345                         dflt='long'
19346                         . ./myread
19347                         netdb_net_type=$ans
19348                         ;;
19349                 esac
19350                 ;;
19351         *)      : no getnetbyaddr, so pick harmless default
19352                 netdb_net_type='long'
19353                 ;;
19354         esac
19355 fi
19356 : locate the preferred pager for this system
19357 fn=f/
19358 case "$pager" in
19359 '')
19360         dflt=''
19361         case "$pg" in
19362         /*) dflt=$pg;;
19363         [a-zA-Z]:/*) dflt=$pg;;
19364         esac
19365         case "$more" in
19366         /*) dflt=$more;;
19367         [a-zA-Z]:/*) dflt=$more;;
19368         esac
19369         case "$less" in
19370         /*) dflt=$less;;
19371         [a-zA-Z]:/*) dflt=$less;;
19372         esac
19373         case "$dflt" in
19374         '') dflt=/usr/ucb/more;;
19375         esac
19376         ;;
19377 *)      dflt="$pager"
19378         : Instruct ./getfile to trust the hinted or previous pager value,
19379         : even if it does not begin with a slash.  For example, on os2,
19380         : pager might be cmd /c more.  See comments in UU/getfile.
19381         fn="f/($pager)"
19382         ;;
19383 esac
19384 echo " "
19385 rp='What pager is used on your system?'
19386 . ./getfile
19387 pager="$ans"
19388
19389 : see what type pids are declared as in the kernel
19390 rp="What is the type of process ids on this system?"
19391 set pid_t pidtype int stdio.h sys/types.h
19392 eval $typedef_ask
19393
19394 : see if ar generates random libraries by itself
19395 echo " "
19396 echo "Checking how to generate random libraries on your machine..." >&4
19397 echo 'int bar1() { return bar2(); }' > bar1.c
19398 echo 'int bar2() { return 2; }' > bar2.c
19399 $cat > foo.c <<EOP
19400 #$i_stdlib I_STDLIB
19401 #ifdef I_STDLIB
19402 #include <stdlib.h>
19403 #endif
19404 int main() { printf("%d\n", bar1()); exit(0); }
19405 EOP
19406 $cc $ccflags -c bar1.c >/dev/null 2>&1
19407 $cc $ccflags -c bar2.c >/dev/null 2>&1
19408 $cc $ccflags -c foo.c >/dev/null 2>&1
19409 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19410 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19411         $run ./foobar >/dev/null 2>&1; then
19412         echo "$ar appears to generate random libraries itself."
19413         orderlib=false
19414         if [ "X$ranlib" = "X" ]; then
19415             ranlib=":"
19416         fi
19417 elif $ar s bar$_a >/dev/null 2>&1 &&
19418         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19419         $run ./foobar >/dev/null 2>&1; then
19420                 echo "a table of contents needs to be added with '$ar s'."
19421                 orderlib=false
19422                 ranlib="$ar s"
19423 elif $ar ts bar$_a >/dev/null 2>&1 &&
19424         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19425         $run ./foobar >/dev/null 2>&1; then
19426                 echo "a table of contents needs to be added with '$ar ts'."
19427                 orderlib=false
19428                 ranlib="$ar ts"
19429 else
19430         case "$ranlib" in
19431         :) ranlib='';;
19432         '')
19433                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19434                 $test -f $ranlib || ranlib=''
19435                 ;;
19436         esac
19437         if $test -n "$ranlib"; then
19438                 echo "your system has '$ranlib'; we'll use that."
19439                 orderlib=false
19440         else
19441                 echo "your system doesn't seem to support random libraries"
19442                 echo "so we'll use lorder and tsort to order the libraries."
19443                 orderlib=true
19444                 ranlib=":"
19445         fi
19446 fi
19447 $rm -f foo* bar*
19448
19449 : check for type of arguments to select. 
19450 case "$selecttype" in
19451 '') case "$d_select" in
19452         $define)
19453                 echo " "
19454                 $cat <<EOM
19455 Checking to see what type of arguments are accepted by select().
19456 EOM
19457                 hdrs="$define sys/types.h
19458                         $i_systime sys/time.h 
19459                         $i_sysselct sys/select.h
19460                         $d_socket sys/socket.h"
19461                 : The first arg can be int, unsigned, or size_t
19462                 : The last arg may or may not be 'const'
19463                 val=''
19464                 : void pointer has been seen but using that
19465                 : breaks the selectminbits test
19466                 for xxx in 'fd_set *' 'int *'; do
19467                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19468                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19469                                         case "$val" in
19470                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19471                                                 if ./protochk "$try" $hdrs; then
19472                                                         echo "Your system accepts $xxx."
19473                                                         val="$xxx"
19474                                                 fi
19475                                                 ;;
19476                                         esac
19477                                 done
19478                         done
19479                 done
19480                 case "$val" in
19481                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19482                         case "$d_fd_set" in
19483                                 $define) dflt="fd_set *" ;;
19484                                 *)              dflt="int *" ;;
19485                         esac
19486                         . ./myread
19487                         val=$ans
19488                         ;;
19489                 esac
19490                 selecttype="$val"
19491                 ;;
19492         *)      : no select, so pick a harmless default
19493                 selecttype='int *'
19494                 ;;
19495         esac
19496         ;;
19497 esac
19498
19499 : check for the select 'width'
19500 case "$selectminbits" in
19501 '') safebits=`expr $ptrsize \* 8`
19502     case "$d_select" in
19503         $define)
19504                 $cat <<EOM
19505
19506 Checking to see on how many bits at a time your select() operates...
19507 EOM
19508                 $cat >try.c <<EOCP
19509 #include <sys/types.h>
19510 #$i_time I_TIME
19511 #$i_systime I_SYS_TIME
19512 #$i_systimek I_SYS_TIME_KERNEL
19513 #ifdef I_TIME
19514 #   include <time.h>
19515 #endif
19516 #ifdef I_SYS_TIME
19517 #   ifdef I_SYS_TIME_KERNEL
19518 #       define KERNEL
19519 #   endif
19520 #   include <sys/time.h>
19521 #   ifdef I_SYS_TIME_KERNEL
19522 #       undef KERNEL
19523 #   endif
19524 #endif
19525 #$i_sysselct I_SYS_SELECT
19526 #ifdef I_SYS_SELECT
19527 #include <sys/select.h>
19528 #endif
19529 #$d_socket HAS_SOCKET
19530 #ifdef HAS_SOCKET
19531 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19532 #endif
19533 #include <stdio.h>
19534 #$i_stdlib I_STDLIB
19535 #ifdef I_STDLIB
19536 #include <stdlib.h>
19537 #endif
19538 $selecttype b;
19539 #define S sizeof(*(b))
19540 #define MINBITS 64
19541 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19542 #define NBITS  (NBYTES * 8)
19543 int main() {
19544     char *s = (char *)malloc(NBYTES);
19545     struct timeval t;
19546     int i;
19547     FILE* fp;
19548     int fd;
19549
19550     if (!s)
19551         exit(1);
19552     fclose(stdin);
19553     fp = fopen("try.c", "r");
19554     if (fp == 0)
19555       exit(2);
19556     fd = fileno(fp);
19557     if (fd < 0)
19558       exit(3);
19559     b = ($selecttype)s;
19560     for (i = 0; i < NBITS; i++)
19561         FD_SET(i, b);
19562     t.tv_sec  = 0;
19563     t.tv_usec = 0;
19564     select(fd + 1, b, 0, 0, &t);
19565     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19566     free(s);
19567     printf("%d\n", i + 1);
19568     return 0;
19569 }
19570 EOCP
19571                 set try
19572                 if eval $compile_ok; then
19573                         selectminbits=`$run ./try`
19574                         case "$selectminbits" in
19575                         '')     cat >&4 <<EOM
19576 Cannot figure out on how many bits at a time your select() operates.
19577 I'll play safe and guess it is $safebits bits.
19578 EOM
19579                                 selectminbits=$safebits
19580                                 bits="$safebits bits"
19581                                 ;;
19582                         1)      bits="1 bit" ;;
19583                         *)      bits="$selectminbits bits" ;;
19584                         esac
19585                         echo "Your select() operates on $bits at a time." >&4
19586                 else
19587                         rp='What is the minimum number of bits your select() operates on?'
19588                         case "$byteorder" in
19589                         12345678)       dflt=64 ;;
19590                         1234)           dflt=32 ;;
19591                         *)              dflt=1  ;;
19592                         esac
19593                         . ./myread
19594                         val=$ans
19595                         selectminbits="$val"
19596                 fi
19597                 $rm -f try.* try
19598                 ;;
19599         *)      : no select, so pick a harmless default
19600                 selectminbits=$safebits
19601                 ;;
19602         esac
19603         ;;
19604 esac
19605
19606 : Trace out the files included by signal.h, then look for SIGxxx names.
19607 : Remove SIGARRAYSIZE used by HPUX.
19608 : Remove SIGSTKSIZE used by Linux.
19609 : Remove SIGSTKSZ used by Posix.
19610 : Remove SIGTYP void lines used by OS2.
19611 : Some cpps, like os390, dont give the file name anywhere
19612 if [ "X$fieldn" = X ]; then
19613         : Just make some guesses.  We check them later.
19614         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19615 else
19616         xxx=`echo '#include <signal.h>' |
19617         $cppstdin $cppminus $cppflags 2>/dev/null |
19618         $grep '^[       ]*#.*include' | 
19619         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19620 fi
19621 : Check this list of files to be sure we have parsed the cpp output ok.
19622 : This will also avoid potentially non-existent files, such 
19623 : as ../foo/bar.h
19624 xxxfiles=''
19625 for xx in $xxx /dev/null ; do
19626         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19627 done
19628 : If we have found no files, at least try signal.h
19629 case "$xxxfiles" in
19630 '')     xxxfiles=`./findhdr signal.h` ;;
19631 esac
19632 xxx=`awk '
19633 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19634         print substr($2, 4, 20)
19635 }
19636 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19637         print substr($3, 4, 20)
19638 }' $xxxfiles`
19639 : Append some common names just in case the awk scan failed.
19640 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19641 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19642 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19643 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19644 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19645
19646 : generate a few handy files for later
19647 $cat > signal.c <<EOCP
19648 #include <sys/types.h>
19649 #include <signal.h>
19650 #$i_stdlib I_STDLIB
19651 #ifdef I_STDLIB
19652 #include <stdlib.h>
19653 #endif
19654 #include <stdio.h>
19655 int main() {
19656
19657 /* Strange style to avoid deeply-nested #if/#else/#endif */
19658 #ifndef NSIG
19659 #  ifdef _NSIG
19660 #    define NSIG (_NSIG)
19661 #  endif
19662 #endif
19663
19664 #ifndef NSIG
19665 #  ifdef SIGMAX
19666 #    define NSIG (SIGMAX+1)
19667 #  endif
19668 #endif
19669
19670 #ifndef NSIG
19671 #  ifdef SIG_MAX
19672 #    define NSIG (SIG_MAX+1)
19673 #  endif
19674 #endif
19675
19676 #ifndef NSIG
19677 #  ifdef _SIG_MAX
19678 #    define NSIG (_SIG_MAX+1)
19679 #  endif
19680 #endif
19681
19682 #ifndef NSIG
19683 #  ifdef MAXSIG
19684 #    define NSIG (MAXSIG+1)
19685 #  endif
19686 #endif
19687
19688 #ifndef NSIG
19689 #  ifdef MAX_SIG
19690 #    define NSIG (MAX_SIG+1)
19691 #  endif
19692 #endif
19693
19694 #ifndef NSIG
19695 #  ifdef SIGARRAYSIZE
19696 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19697 #  endif
19698 #endif
19699
19700 #ifndef NSIG
19701 #  ifdef _sys_nsig
19702 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19703 #  endif
19704 #endif
19705
19706 /* Default to some arbitrary number that's big enough to get most
19707    of the common signals.
19708 */
19709 #ifndef NSIG
19710 #    define NSIG 50
19711 #endif
19712
19713 printf("NSIG %d\n", NSIG);
19714
19715 #ifndef JUST_NSIG
19716
19717 EOCP
19718
19719 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19720 {
19721         printf "#ifdef SIG"; printf $1; printf "\n"
19722         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19723         printf $1; printf ");\n"
19724         printf "#endif\n"
19725 }
19726 END {
19727         printf "#endif /* JUST_NSIG */\n";
19728         printf "exit(0);\n}\n";
19729 }
19730 ' >>signal.c
19731 $cat >signal.awk <<'EOP'
19732 BEGIN { ndups = 0 }
19733 $1 ~ /^NSIG$/ { nsig = $2 }
19734 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19735     if ($2 > maxsig) { maxsig = $2 }
19736     if (sig_name[$2]) {
19737         dup_name[ndups] = $1
19738         dup_num[ndups] = $2
19739         ndups++ 
19740     }
19741     else {
19742         sig_name[$2] = $1
19743         sig_num[$2] = $2
19744     }
19745 }
19746 END { 
19747     if (nsig == 0) {
19748         nsig = maxsig + 1
19749     }
19750     printf("NSIG %d\n", nsig);
19751     for (n = 1; n < nsig; n++) {
19752         if (sig_name[n]) {
19753             printf("%s %d\n", sig_name[n], sig_num[n])
19754         }
19755         else {
19756             printf("NUM%d %d\n", n, n) 
19757         }
19758     }
19759     for (n = 0; n < ndups; n++) {
19760         printf("%s %d\n", dup_name[n], dup_num[n])
19761     }
19762 }
19763 EOP
19764 $cat >signal_cmd <<EOS
19765 $startsh
19766 if $test -s signal.lst; then
19767     echo "Using your existing signal.lst file"
19768         exit 0
19769 fi
19770 xxx="$xxx"
19771 EOS
19772 $cat >>signal_cmd <<'EOS'
19773
19774 set signal
19775 if eval $compile_ok; then
19776         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19777 else
19778         echo "(I can't seem be able to compile the whole test program)" >&4
19779         echo "(I'll try it in little pieces.)" >&4
19780         set signal -DJUST_NSIG
19781         if eval $compile_ok; then
19782                 $run ./signal$_exe > signal.nsg
19783                 $cat signal.nsg
19784         else
19785                 echo "I can't seem to figure out how many signals you have." >&4
19786                 echo "Guessing 50." >&4
19787                 echo 'NSIG 50' > signal.nsg
19788         fi
19789         : Now look at all the signal names, one at a time.
19790         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19791                 $cat > signal.c <<EOCP
19792 #include <sys/types.h>
19793 #include <signal.h>
19794 #include <stdio.h>
19795 int main() {
19796 printf("$xx %d\n", SIG${xx});
19797 return 0;
19798 }
19799 EOCP
19800                 set signal
19801                 if eval $compile; then
19802                         echo "SIG${xx} found."
19803                         $run ./signal$_exe  >> signal.ls1
19804                 else
19805                         echo "SIG${xx} NOT found."
19806                 fi
19807         done
19808         if $test -s signal.ls1; then
19809                 $cat signal.nsg signal.ls1 |
19810                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19811         fi
19812
19813 fi
19814 if $test -s signal.lst; then
19815         :
19816 else
19817         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19818         echo 'kill -l' >signal
19819         set X `csh -f <signal`
19820         $rm -f signal
19821         shift
19822         case $# in
19823         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19824         esac
19825         echo $@ | $tr ' ' $trnl | \
19826             $awk '{ printf "%s %d\n", $1, ++s; }
19827                   END { printf "NSIG %d\n", ++s }' >signal.lst
19828 fi
19829 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19830 EOS
19831 chmod a+x signal_cmd
19832 $eunicefix signal_cmd
19833
19834 : generate list of signal names
19835 echo " "
19836 case "$sig_name_init" in
19837 '') doinit=yes ;;
19838 *)  case "$sig_num_init" in
19839     ''|*,*) doinit=yes ;;
19840     esac ;;
19841 esac
19842 case "$doinit" in
19843 yes)
19844         echo "Generating a list of signal names and numbers..." >&4
19845         . ./signal_cmd
19846         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19847         sig_name=`$awk 'BEGIN { printf "ZERO " }
19848                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19849         sig_num=`$awk  'BEGIN { printf "0 " }
19850                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19851         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19852                              !/^NSIG/   { printf "\"%s\", ", $1 }
19853                              END        { printf "0\n" }' signal.lst`
19854         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19855                              !/^NSIG/   { printf "%d, ", $2}
19856                              END        { printf "0\n"}' signal.lst`
19857         ;;
19858 esac
19859 echo "The following $sig_count signals are available:"
19860 echo " "
19861 echo $sig_name | $awk \
19862 'BEGIN { linelen = 0 }
19863 {
19864         for (i = 1; i <= NF; i++) {
19865                 name = "SIG" $i " "
19866                 linelen = linelen + length(name)
19867                 if (linelen > 70) {
19868                         printf "\n"
19869                         linelen = length(name)
19870                 }
19871                 printf "%s", name
19872         }
19873         printf "\n"
19874 }'
19875 sig_size=`echo $sig_name | awk '{print NF}'`
19876 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19877
19878 echo " "
19879 case "$sizetype" in
19880 *_t) zzz="$sizetype"    ;;
19881 *)   zzz="filesize"     ;;
19882 esac
19883 echo "Checking the size of $zzz..." >&4 
19884 cat > try.c <<EOCP
19885 #include <sys/types.h>
19886 #include <stdio.h>
19887 #$i_stdlib I_STDLIB
19888 #ifdef I_STDLIB
19889 #include <stdlib.h>
19890 #endif
19891 int main() {
19892     printf("%d\n", (int)sizeof($sizetype));
19893     exit(0);
19894 }
19895 EOCP
19896 set try
19897 if eval $compile_ok; then
19898         yyy=`$run ./try`
19899         case "$yyy" in
19900         '')     sizesize=4
19901                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19902                 ;;
19903         *)      sizesize=$yyy
19904                 echo "Your $zzz size is $sizesize bytes."
19905                 ;;
19906         esac
19907 else
19908         sizesize=4
19909         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19910 fi
19911
19912
19913 : check for socklen_t
19914 echo " "
19915 echo "Checking to see if you have socklen_t..." >&4
19916 $cat >try.c <<EOCP
19917 #include <sys/types.h>
19918 #$d_socket HAS_SOCKET
19919 #ifdef HAS_SOCKET
19920 #include <sys/socket.h>
19921 #endif
19922 int main() { socklen_t x = 16; }
19923 EOCP
19924 set try
19925 if eval $compile; then
19926         val="$define"
19927         echo "You have socklen_t."
19928 else
19929         val="$undef"
19930         echo "You do not have socklen_t."
19931         case "$sizetype" in
19932         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19933         esac
19934 fi
19935 $rm -f try try.*
19936 set d_socklen_t
19937 eval $setvar
19938
19939 : see if this is a socks.h system
19940 set socks.h i_socks
19941 eval $inhdr
19942
19943 : check for type of the size argument to socket calls
19944 case "$d_socket" in
19945 "$define")
19946         $cat <<EOM
19947
19948 Checking to see what type is the last argument of accept().
19949 EOM
19950         yyy=''
19951         case "$d_socklen_t" in
19952         "$define") yyy="$yyy socklen_t"
19953         esac
19954         yyy="$yyy $sizetype int long unsigned"
19955         for xxx in $yyy; do
19956                 case "$socksizetype" in
19957                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19958                         case "$usesocks" in
19959                         "$define")
19960                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19961                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19962                                         socksizetype="$xxx"
19963                                 fi
19964                                 ;;
19965                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19966                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19967                                         socksizetype="$xxx"
19968                                 fi
19969                                 ;;
19970                         esac
19971                         ;;
19972                 esac
19973         done
19974 : In case none of those worked, prompt the user.
19975         case "$socksizetype" in
19976         '')     rp='What is the type for socket address structure sizes?'
19977                 dflt='int'
19978                 . ./myread
19979                 socksizetype=$ans
19980                 ;;
19981         esac
19982         ;;
19983 *)      : no sockets, so pick relatively harmless default
19984         socksizetype='int'
19985         ;;
19986 esac
19987
19988 : see what type is used for signed size_t
19989 set ssize_t ssizetype int stdio.h sys/types.h
19990 eval $typedef
19991 dflt="$ssizetype"
19992 $cat > try.c <<EOM
19993 #include <stdio.h>
19994 #$i_stdlib I_STDLIB
19995 #ifdef I_STDLIB
19996 #include <stdlib.h>
19997 #endif
19998 #include <sys/types.h>
19999 #define Size_t $sizetype
20000 #define SSize_t $dflt
20001 int main()
20002 {
20003         if (sizeof(Size_t) == sizeof(SSize_t))
20004                 printf("$dflt\n");
20005         else if (sizeof(Size_t) == sizeof(int))
20006                 printf("int\n");
20007         else 
20008                 printf("long\n");
20009         exit(0);
20010 }
20011 EOM
20012 echo " "
20013 set try
20014 if eval $compile_ok && $run ./try > /dev/null; then
20015         ssizetype=`$run ./try`
20016         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20017 else
20018         $cat >&4 <<EOM
20019 Help! I can't compile and run the ssize_t test program: please enlighten me!
20020 (This is probably a misconfiguration in your system or libraries, and
20021 you really ought to fix it.  Still, I'll try anyway.)
20022
20023 I need a type that is the same size as $sizetype, but is guaranteed to
20024 be signed.  Common values are ssize_t, int and long.
20025
20026 EOM
20027         rp="What signed type is the same size as $sizetype?"
20028         . ./myread
20029         ssizetype="$ans"
20030 fi
20031 $rm -f try try.*
20032
20033 : see what type of char stdio uses.
20034 echo " "
20035 echo '#include <stdio.h>' > stdio.c
20036 $cppstdin $cppminus < stdio.c > stdioh
20037 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20038         echo "Your stdio uses unsigned chars." >&4
20039         stdchar="unsigned char"
20040 else
20041         echo "Your stdio uses signed chars." >&4
20042         stdchar="char"
20043 fi
20044 $rm -f stdio.* stdioh
20045
20046 : see what type uids are declared as in the kernel
20047 echo " "
20048 echo "Looking for the type for user ids returned by getuid()."
20049 set uid_t uidtype xxx stdio.h sys/types.h
20050 eval $typedef
20051 case "$uidtype" in
20052 xxx)
20053         xxx=`./findhdr sys/user.h`
20054         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20055         case $1 in
20056         unsigned) dflt="$1 $2" ;;
20057         *) dflt="$1" ;;
20058         esac
20059         ;;
20060 *) dflt="$uidtype";;
20061 esac
20062 case "$uidtype" in
20063 uid_t)  echo "uid_t found." ;;
20064 *)      rp="What is the type for user ids returned by getuid()?"
20065         . ./myread
20066         uidtype="$ans"
20067         ;;
20068 esac
20069
20070 echo " "
20071 case "$uidtype" in
20072 *_t) zzz="$uidtype"     ;;
20073 *)   zzz="uid"          ;;
20074 esac
20075 echo "Checking the size of $zzz..." >&4 
20076 cat > try.c <<EOCP
20077 #include <sys/types.h>
20078 #include <stdio.h>
20079 #$i_stdlib I_STDLIB
20080 #ifdef I_STDLIB
20081 #include <stdlib.h>
20082 #endif
20083 int main() {
20084     printf("%d\n", (int)sizeof($uidtype));
20085     exit(0);
20086 }
20087 EOCP
20088 set try
20089 if eval $compile_ok; then
20090         yyy=`$run ./try`
20091         case "$yyy" in
20092         '')     uidsize=4
20093                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20094                 ;;
20095         *)      uidsize=$yyy
20096                 echo "Your $zzz is $uidsize bytes long."
20097                 ;;
20098         esac
20099 else
20100         uidsize=4
20101         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20102 fi
20103
20104 echo " "
20105 case "$uidtype" in
20106 *_t) zzz="$uidtype"     ;;
20107 *)   zzz="uid"          ;;
20108 esac
20109 echo "Checking the sign of $zzz..." >&4
20110 cat > try.c <<EOCP
20111 #include <sys/types.h>
20112 #include <stdio.h>
20113 int main() {
20114         $uidtype foo = -1;
20115         if (foo < 0)
20116                 printf("-1\n");
20117         else
20118                 printf("1\n");
20119 }
20120 EOCP
20121 set try
20122 if eval $compile; then
20123         yyy=`$run ./try`
20124         case "$yyy" in
20125         '')     uidsign=1
20126                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20127                 ;;
20128         *)      uidsign=$yyy
20129                 case "$uidsign" in
20130                  1) echo "Your $zzz is unsigned." ;;
20131                 -1) echo "Your $zzz is signed."   ;;
20132                 esac
20133                 ;;
20134         esac
20135 else
20136         uidsign=1
20137         echo "(I can't compile the test program--guessing unsigned.)" >&4
20138 fi
20139
20140
20141
20142 echo " "
20143 $echo "Checking the format string to be used for uids..." >&4
20144
20145 case "$uidsign" in
20146 -1)     if $test X"$uidsize" = X"$ivsize"; then
20147                 uidformat="$ivdformat"
20148         else
20149                 if $test X"$uidsize" = X"$longsize"; then
20150                         uidformat='"ld"'
20151                 else
20152                         if $test X"$uidsize" = X"$intsize"; then
20153                                 uidformat='"d"'
20154                         else
20155                                 if $test X"$uidsize" = X"$shortsize"; then
20156                                         uidformat='"hd"'
20157                                 fi
20158                         fi
20159                 fi
20160         fi
20161         ;;
20162 *)      if $test X"$uidsize" = X"$uvsize"; then
20163                 uidformat="$uvuformat"
20164         else
20165                 if $test X"$uidsize" = X"$longsize"; then
20166                         uidformat='"lu"'
20167                 else
20168                         if $test X"$uidsize" = X"$intsize"; then
20169                                 uidformat='"u"'
20170                         else
20171                                 if $test X"$uidsize" = X"$shortsize"; then
20172                                         uidformat='"hu"'
20173                                 fi
20174                         fi
20175                 fi
20176         fi
20177         ;;
20178 esac
20179
20180
20181 case "$usesitecustomize" in
20182     $define|true|[Yy]*)
20183         usesitecustomize="$define"
20184         ;;
20185     *)
20186         usesitecustomize="$undef"
20187         ;;
20188     esac
20189
20190 : determine compiler compiler
20191 case "$yacc" in
20192 '')
20193         dflt=yacc;;
20194 *)
20195         dflt="$yacc";;
20196 esac
20197 echo " "
20198 comp='yacc'
20199 if $test -f "$byacc$_exe"; then
20200         dflt="$byacc"
20201         comp="byacc or $comp"
20202 fi
20203 if $test -f "$bison$_exe"; then
20204         comp="$comp or bison -y"
20205 fi
20206 rp="Which compiler compiler ($comp) shall I use?"
20207 . ./myread
20208 yacc="$ans"
20209 case "$yacc" in
20210 *bis*)
20211         case "$yacc" in
20212         *-y*) ;;
20213         *)
20214                 yacc="$yacc -y"
20215                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20216                 ;;
20217         esac
20218         ;;
20219 esac
20220
20221 : see if this is a fp.h system
20222 set fp.h i_fp
20223 eval $inhdr
20224
20225 : see if this is a fp_class.h system
20226 set fp_class.h i_fp_class
20227 eval $inhdr
20228
20229 : see if this is a ieeefp.h system
20230 case "$i_ieeefp" in
20231 '' ) set ieeefp.h i_ieeefp
20232      eval $inhdr
20233      ;;
20234 esac
20235
20236 : see if this is a libutil.h system
20237 set libutil.h i_libutil
20238 eval $inhdr
20239
20240 : see if mach cthreads are available
20241 if test "X$usethreads" = "X$define"; then
20242         set mach/cthreads.h i_machcthr
20243         eval $inhdr
20244 else
20245         i_machcthr="$undef"
20246 fi
20247
20248
20249
20250 : see if this is a mntent.h system
20251 set mntent.h i_mntent
20252 eval $inhdr
20253
20254 : see if ndbm.h is available
20255 set ndbm.h t_ndbm
20256 eval $inhdr
20257
20258 case "$t_ndbm" in
20259 $undef)
20260     # Some Linux distributions such as RedHat 7.1 put the
20261     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20262     if $test -f /usr/include/gdbm/ndbm.h; then
20263         echo '<gdbm/ndbm.h> found.'
20264         ccflags="$ccflags -I/usr/include/gdbm"
20265         cppflags="$cppflags -I/usr/include/gdbm"
20266         t_ndbm=$define
20267     fi
20268     ;;
20269 esac
20270
20271 case "$t_ndbm" in
20272 $define)
20273         : see if dbm_open exists
20274         set dbm_open d_dbm_open
20275         eval $inlibc
20276         case "$d_dbm_open" in
20277         $undef)
20278                 t_ndbm="$undef"
20279                 echo "We won't be including <ndbm.h>"
20280                 ;;
20281         esac
20282         ;;
20283 esac
20284 val="$t_ndbm"
20285 set i_ndbm
20286 eval $setvar
20287
20288 : see if net/errno.h is available
20289 val=''
20290 set net/errno.h val
20291 eval $inhdr
20292
20293 : Unfortunately, it causes problems on some systems.  Arrgh.
20294 case "$val" in
20295 $define)
20296         cat > try.c <<'EOM'
20297 #include <stdio.h>
20298 #include <errno.h>
20299 #include <net/errno.h>
20300 int func()
20301 {
20302         return ENOTSOCK;
20303 }
20304 EOM
20305         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20306                 echo "We'll be including <net/errno.h>." >&4
20307         else
20308                 echo "We won't be including <net/errno.h>." >&4
20309                 val="$undef"
20310         fi
20311         $rm -f try.* try
20312         ;;
20313 esac
20314 set i_neterrno
20315 eval $setvar
20316
20317 : see if netinet/tcp.h is available
20318 set netinet/tcp.h i_netinettcp
20319 eval $inhdr
20320
20321 : see if this is a poll.h system
20322 set poll.h i_poll
20323 eval $inhdr
20324
20325 : see if this is a prot.h system
20326 set prot.h i_prot
20327 eval $inhdr
20328
20329 echo " "
20330 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20331 $cat <<'EOSH' > Cppsym.know
20332 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20333 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20334 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20335 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20336 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20337 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20338 bull c cadmus clipper CMU COFF COMPILER_VERSION
20339 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20340 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20341 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20342 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20343 GLIBC GLIBC_MINOR
20344 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20345 H3050R H3050RX hbullx20 hcx host_mips
20346 hp200 hp300 hp700 HP700 hp800 hp9000
20347 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20348 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20349 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20350 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20351 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20352 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20353 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20354 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20355 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20356 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20357 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20358 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20359 MATH_HAS_NO_SIDE_EFFECTS
20360 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20361 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20362 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20363 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20364 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20365 NetBSD news1500 news1700 news1800 news1900 news3700
20366 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20367 ns32016 ns32332 ns32k nsc32000
20368 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20369 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20370 pc532 pdp11 PGC PIC plexus PORTAR posix
20371 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20372 POSIX_C_SOURCE POSIX_SOURCE POWER
20373 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20374 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20375 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20376 sony sony_news sonyrisc sparc sparclite spectrum
20377 stardent stdc STDC_EXT stratos sun sun3 sun386
20378 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20379 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20380 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20381 sysV68 sysV88 Tek4132 Tek4300 titan
20382 TM3200 TM5400 TM5600
20383 tower tower32 tower32_200 tower32_600 tower32_700
20384 tower32_800 tower32_850 tss
20385 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20386 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20387 unix UNIX95 UNIX99 unixpc unos
20388 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20389 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20390 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20391 USGr4 USGr4_2
20392 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20393 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20394 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20395 z8000
20396 EOSH
20397 # Maybe put other stuff here too.
20398 cat <<EOSH >>Cppsym.know
20399 $osname
20400 EOSH
20401 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20402 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20403 $cat Cppsym.know > Cppsym.c
20404 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20405 $rm -f Cppsym.a Cppsym.b Cppsym.c
20406 cat <<EOSH > Cppsym
20407 $startsh
20408 if $test \$# -gt 0; then
20409     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20410     if $test -s Cppsym.got; then
20411         $rm -f Cppsym.got
20412         exit 0
20413     fi
20414     $rm -f Cppsym.got
20415     exit 1
20416 else
20417     $tr " " "$trnl" | ./Cppsym.try
20418     exit 0
20419 fi
20420 EOSH
20421 chmod +x Cppsym
20422 $eunicefix Cppsym
20423 cat <<EOSH > Cppsym.try
20424 $startsh
20425 cat <<'EOCP' > try.c
20426 #include <stdio.h>
20427 #if cpp_stuff == 1
20428 #define STRINGIFY(a)    "a"
20429 #endif
20430 #if cpp_stuff == 42
20431 #define StGiFy(a)  #a
20432 #define STRINGIFY(a)    StGiFy(a)
20433 #endif
20434 #if $cpp_stuff != 1 && $cpp_stuff != 42
20435 #   include "Bletch: How does this C preprocessor stringify macros?"
20436 #endif
20437 int main() {
20438 EOCP
20439 $awk \\
20440 EOSH
20441 cat <<'EOSH' >> Cppsym.try
20442 'length($1) > 0 {
20443     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20444     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20445     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20446     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20447 }'       >> try.c
20448 echo 'return 0;}' >> try.c
20449 EOSH
20450 cat <<EOSH >> Cppsym.try
20451 ccflags="$ccflags"
20452 case "$osname-$gccversion" in
20453 irix-) ccflags="\$ccflags -woff 1178" ;;
20454 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20455 esac
20456 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20457 EOSH
20458 chmod +x Cppsym.try
20459 $eunicefix Cppsym.try
20460 ./Cppsym < Cppsym.know > Cppsym.true
20461 : Add in any linux cpp "predefined macros":
20462 case "$osname::$gccversion" in
20463   *linux*::*.*)
20464     tHdrH=_tmpHdr
20465     rm -f $tHdrH'.h' $tHdrH
20466     touch $tHdrH'.h'
20467     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20468        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20469        if [ -s $tHdrH'_cppsym.real' ]; then
20470           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20471        fi
20472     fi
20473     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20474   ;;
20475 esac
20476 : now check the C compiler for additional symbols
20477 postprocess_cc_v=''
20478 case "$osname" in
20479 aix) postprocess_cc_v="|$tr , ' '" ;;
20480 esac
20481 $cat >ccsym <<EOS
20482 $startsh
20483 $cat >tmp.c <<EOF
20484 extern int foo;
20485 EOF
20486 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20487 do
20488         case "\$i" in
20489         -D*) echo "\$i" | $sed 's/^-D//';;
20490         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20491         esac
20492 done
20493 $rm -f try.c
20494 EOS
20495 postprocess_cc_v=''
20496 chmod +x ccsym
20497 $eunicefix ccsym
20498 ./ccsym > ccsym1.raw
20499 if $test -s ccsym1.raw; then
20500        $sort ccsym1.raw | $uniq >ccsym.raw
20501 else
20502        mv ccsym1.raw ccsym.raw
20503 fi
20504
20505 $awk '/\=/ { print $0; next }
20506         { print $0"=1" }' ccsym.raw >ccsym.list
20507 $comm -13 Cppsym.true ccsym.list >ccsym.own
20508 $comm -12 Cppsym.true ccsym.list >ccsym.com
20509 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20510 also=''
20511 if $test -z ccsym.raw; then
20512         echo "Your C compiler doesn't seem to define any symbols!" >&4
20513         echo " "
20514         echo "However, your C preprocessor defines the following symbols:"
20515         $cat Cppsym.true
20516         ccsymbols=''
20517         cppsymbols=`$cat Cppsym.true`
20518         cppsymbols=`echo $cppsymbols`
20519         cppccsymbols="$cppsymbols"
20520 else
20521         if $test -s ccsym.com; then
20522                 echo "Your C compiler and pre-processor define these symbols:"
20523                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20524                 also='also '
20525                 symbols='ones'
20526                 cppccsymbols=`$cat ccsym.com`
20527                 cppccsymbols=`echo $cppccsymbols`
20528                 $test "$silent" || sleep 1
20529         fi
20530         if $test -s ccsym.cpp; then
20531                 $test "$also" && echo " "
20532                 echo "Your C pre-processor ${also}defines the following symbols:"
20533                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20534                 also='further '
20535                 cppsymbols=`$cat ccsym.cpp`
20536                 cppsymbols=`echo $cppsymbols`
20537                 $test "$silent" || sleep 1
20538         fi
20539         if $test -s ccsym.own; then
20540                 $test "$also" && echo " "
20541                 echo "Your C compiler ${also}defines the following cpp symbols:"
20542                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20543                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20544                 ccsymbols=`$cat ccsym.own`
20545                 ccsymbols=`echo $ccsymbols`
20546                 $test "$silent" || sleep 1
20547         fi
20548 fi
20549
20550 : see if this is a termio system
20551 val="$undef"
20552 val2="$undef"
20553 val3="$undef"
20554 if $test `./findhdr termios.h`; then
20555         set tcsetattr i_termios
20556         eval $inlibc
20557         val3="$i_termios"
20558 fi
20559 echo " "
20560 case "$val3" in
20561 "$define") echo "You have POSIX termios.h... good!" >&4;;
20562 *) if ./Cppsym pyr; then
20563                 case "`/bin/universe`" in
20564                 ucb) if $test `./findhdr sgtty.h`; then
20565                                 val2="$define"
20566                                 echo "<sgtty.h> found." >&4
20567                         else
20568                                 echo "System is pyramid with BSD universe."
20569                                 echo "<sgtty.h> not found--you could have problems." >&4
20570                         fi;;
20571                 *) if $test `./findhdr termio.h`; then
20572                                 val="$define"
20573                                 echo "<termio.h> found." >&4
20574                         else
20575                                 echo "System is pyramid with USG universe."
20576                                 echo "<termio.h> not found--you could have problems." >&4
20577                         fi;;
20578                 esac
20579         elif ./usg; then
20580                 if $test `./findhdr termio.h`; then
20581                         echo "<termio.h> found." >&4
20582                         val="$define"
20583                 elif $test `./findhdr sgtty.h`; then
20584                         echo "<sgtty.h> found." >&4
20585                         val2="$define"
20586                 else
20587 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20588                 fi
20589         else
20590                 if $test `./findhdr sgtty.h`; then
20591                         echo "<sgtty.h> found." >&4
20592                         val2="$define"
20593                 elif $test `./findhdr termio.h`; then
20594                         echo "<termio.h> found." >&4
20595                         val="$define"
20596                 else
20597 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20598                 fi
20599         fi;;
20600 esac
20601 set i_termio; eval $setvar
20602 val=$val2; set i_sgtty; eval $setvar
20603 val=$val3; set i_termios; eval $setvar
20604
20605 : see if stddef is available
20606 set stddef.h i_stddef
20607 eval $inhdr
20608
20609 : see if this is a sunmath.h system
20610 set sunmath.h i_sunmath
20611 eval $inhdr
20612
20613 : see if sys/access.h is available
20614 set sys/access.h i_sysaccess
20615 eval $inhdr
20616
20617 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20618 set sys/filio.h i_sysfilio
20619 eval $inhdr
20620 echo " "
20621 if $test `./findhdr sys/ioctl.h`; then
20622         val="$define"
20623         echo '<sys/ioctl.h> found.' >&4
20624 else
20625         val="$undef"
20626         if $test $i_sysfilio = "$define"; then
20627             echo '<sys/ioctl.h> NOT found.' >&4
20628         else
20629                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20630                 $test $i_termio = "$define" && xxx="termio.h"
20631                 $test $i_termios = "$define" && xxx="termios.h"
20632 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20633         fi
20634 fi
20635 set i_sysioctl
20636 eval $setvar
20637
20638 : see if socket ioctl defs are in sys/sockio.h
20639 echo " "
20640 xxx=`./findhdr sys/sockio.h`
20641 if $test "$xxx"; then
20642         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20643                 val="$define"
20644                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20645         else
20646                 val="$undef"
20647                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20648         fi
20649 else
20650         val="$undef"
20651         $cat <<EOM
20652 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20653 EOM
20654 fi
20655 set i_syssockio
20656 eval $setvar
20657
20658
20659 : see if this is a syslog.h system
20660 set syslog.h i_syslog
20661 eval $inhdr
20662
20663
20664 : see if this is a sys/mode.h system
20665 set sys/mode.h i_sysmode
20666 eval $inhdr
20667
20668 : see if sys/resource.h has to be included
20669 set sys/resource.h i_sysresrc
20670 eval $inhdr
20671
20672 : see if sys/security.h is available
20673 set sys/security.h i_syssecrt
20674 eval $inhdr
20675
20676 : see if this is a sys/statvfs.h system
20677 set sys/statvfs.h i_sysstatvfs
20678 eval $inhdr
20679
20680 : see if this is a sys/un.h system
20681 set sys/un.h i_sysun
20682 eval $inhdr
20683
20684
20685 : see if this is a sys/utsname.h system
20686 set sys/utsname.h i_sysutsname
20687 eval $inhdr
20688
20689 : see if this is a syswait system
20690 set sys/wait.h i_syswait
20691 eval $inhdr
20692
20693 : see if this is a ustat.h system
20694 set ustat.h i_ustat
20695 eval $inhdr
20696
20697 : see if this is an utime system
20698 set utime.h i_utime
20699 eval $inhdr
20700
20701 : see if this is a values.h system
20702 set values.h i_values
20703 eval $inhdr
20704
20705 : see if this is a vfork system
20706 case "$d_vfork" in
20707 "$define")
20708         set vfork.h i_vfork
20709         eval $inhdr
20710         ;;
20711 *)
20712         i_vfork="$undef"
20713         ;;
20714 esac
20715
20716 : see if gdbm.h is available
20717 set gdbm.h t_gdbm
20718 eval $inhdr
20719 case "$t_gdbm" in
20720 $define)
20721         : see if gdbm_open exists
20722         set gdbm_open d_gdbm_open
20723         eval $inlibc
20724         case "$d_gdbm_open" in
20725         $undef)
20726                 t_gdbm="$undef"
20727                 echo "We won't be including <gdbm.h>"
20728                 ;;
20729         esac
20730         ;;
20731 esac
20732 val="$t_gdbm"
20733 set i_gdbm
20734 eval $setvar
20735
20736 echo " "
20737 echo "Looking for extensions..." >&4
20738 : If we are using the old config.sh, known_extensions may contain
20739 : old or inaccurate or duplicate values.
20740 known_extensions=''
20741 nonxs_extensions=''
20742 : We do not use find because it might not be available.
20743 : We do not just use MANIFEST because the user may have dropped
20744 : some additional extensions into the source tree and expect them
20745 : to be built.
20746
20747 : Function to recursively find available extensions, ignoring DynaLoader
20748 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20749 find_extensions='
20750     for xxx in *; do
20751        case "$xxx" in
20752            DynaLoader|dynaload) ;;
20753            *)
20754            if $test -f $xxx/$xxx.xs; then
20755                known_extensions="$known_extensions $1$xxx";
20756            elif $test -f $xxx/Makefile.PL; then
20757                nonxs_extensions="$nonxs_extensions $1$xxx";
20758            else
20759                if $test -d $xxx -a $# -lt 10; then
20760                    set $1$xxx/ $*;
20761                    cd "$xxx";
20762                    eval $find_extensions;
20763                    cd ..;
20764                    shift;
20765                fi;
20766            fi
20767            ;;
20768        esac;
20769     done'
20770 tdir=`pwd`
20771 cd "$rsrc/ext"
20772 set X
20773 shift
20774 eval $find_extensions
20775 # Special case:  Add in threads/shared since it is not picked up by the
20776 # recursive find above (and adding in general recursive finding breaks
20777 # SDBM_File/sdbm).  A.D.  10/25/2001.
20778 known_extensions="$known_extensions threads/shared"
20779 set X $nonxs_extensions
20780 shift
20781 nonxs_extensions="$*"
20782 set X $known_extensions
20783 shift
20784 known_extensions="$*"
20785 cd "$tdir"
20786
20787 : Now see which are supported on this system.
20788 avail_ext=''
20789 for xxx in $known_extensions ; do
20790         case "$xxx" in
20791         DB_File|db_file)
20792                 case "$i_db" in
20793                 $define) avail_ext="$avail_ext $xxx" ;;
20794                 esac
20795                 ;;
20796         GDBM_File|gdbm_fil)
20797                 case "$i_gdbm" in 
20798                 $define) avail_ext="$avail_ext $xxx" ;;
20799                 esac
20800                 ;;
20801         I18N/Langinfo|i18n_lan)
20802                 case "$i_langinfo$d_nl_langinfo" in 
20803                 $define$define) avail_ext="$avail_ext $xxx" ;;
20804                 esac
20805                 ;;
20806         NDBM_File|ndbm_fil)
20807                 case "$i_ndbm" in
20808                 $define)
20809                     case "$osname-$use64bitint" in
20810                     hpux-define)
20811                         case "$libs" in
20812                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20813                         esac
20814                         ;;
20815                     *) avail_ext="$avail_ext $xxx" ;;
20816                     esac
20817                     ;;
20818                 esac
20819                 ;;
20820         ODBM_File|odbm_fil) 
20821                 case "${i_dbm}${i_rpcsvcdbm}" in
20822                 *"${define}"*)
20823                     case "$osname-$use64bitint" in
20824                     hpux-define)
20825                         case "$libs" in
20826                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20827                         esac
20828                         ;;
20829                     *) avail_ext="$avail_ext $xxx" ;;
20830                     esac
20831                     ;;
20832                 esac
20833                 ;;
20834         POSIX|posix)
20835                 case "$useposix" in
20836                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20837                 esac
20838                 ;;
20839         Opcode|opcode)
20840                 case "$useopcode" in
20841                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20842                 esac
20843                 ;;
20844         Socket|socket)
20845                 case "$d_socket" in 
20846                 true|$define|y)
20847                     case "$osname" in
20848                     beos) ;; # not unless BONE
20849                     *) avail_ext="$avail_ext $xxx" ;;
20850                     esac
20851                     ;;
20852                 esac
20853                 ;;
20854         Sys/Syslog|sys/syslog)
20855                 : XXX syslog requires socket
20856                 case "$d_socket" in 
20857                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20858                 esac
20859                 ;;
20860         Thread|thread)
20861                 case "$usethreads" in
20862                 true|$define|y)
20863                         case "$useithreads" in
20864                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20865                         esac
20866                 esac
20867                 ;;
20868         XS/APItest|xs/apitest)
20869                 # This is just for testing.  Skip it unless we have dynamic loading.
20870
20871                 case "$usedl" in
20872                 $define) avail_ext="$avail_ext $xxx" ;;
20873                 esac
20874                 ;;
20875         XS/Typemap|xs/typemap)
20876                 # This is just for testing.  Skip it unless we have dynamic loading.
20877                 case "$usedl" in
20878                 $define) avail_ext="$avail_ext $xxx" ;;
20879                 esac
20880                 ;;
20881         threads|threads/shared)
20882                 # threads and threads::shared are special cases.
20883                 # To stop people from asking "Perl 5.8.0 was supposed
20884                 # to have this new fancy threads implementation but my
20885                 # perl doesn't have it" and from people trying to
20886                 # (re)install the threads module using CPAN.pm and
20887                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20888                 # the threads.pm and threads/shared.pm will always be
20889                 # there, croaking informatively ("you need to rebuild
20890                 # all of Perl with threads, sorry") when threads haven't
20891                 # been compiled in.
20892                 # --jhi
20893                 avail_ext="$avail_ext $xxx"
20894                 ;;
20895         IPC/SysV|ipc/sysv)
20896                 : XXX Do we need a useipcsysv variable here
20897                 case "${d_msg}${d_sem}${d_shm}" in 
20898                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20899                 esac
20900                 ;;
20901         *)      avail_ext="$avail_ext $xxx"
20902                 ;;
20903         esac
20904 done
20905
20906 set X $avail_ext
20907 shift
20908 avail_ext="$*"
20909
20910 case "$onlyextensions" in
20911 '') ;;
20912 *)  keepextensions=''
20913     echo "You have requested that only certains extensions be included..." >&4
20914     for i in $onlyextensions; do
20915         case " $avail_ext " in
20916         *" $i "*)
20917             echo "Keeping extension $i."
20918             keepextensions="$keepextensions $i"
20919             ;;
20920         *) echo "Ignoring extension $i." ;;
20921         esac
20922     done
20923     avail_ext="$keepextensions"
20924     ;;
20925 esac
20926
20927 case "$noextensions" in
20928 '') ;;
20929 *)  keepextensions=''
20930     echo "You have requested that certain extensions be ignored..." >&4
20931     for i in $avail_ext; do
20932         case " $noextensions " in
20933         *" $i "*) echo "Ignoring extension $i." ;;
20934         *) echo "Keeping extension $i.";
20935            keepextensions="$keepextensions $i"
20936            ;;
20937         esac
20938     done
20939     avail_ext="$keepextensions"
20940     ;;
20941 esac
20942
20943 : Now see which nonxs extensions are supported on this system.
20944 : For now assume all are.
20945 nonxs_ext=''
20946 for xxx in $nonxs_extensions ; do
20947         case "$xxx" in
20948         *)      nonxs_ext="$nonxs_ext $xxx"
20949                 ;;
20950         esac
20951 done
20952
20953 set X $nonxs_ext
20954 shift
20955 nonxs_ext="$*"
20956
20957 case $usedl in
20958 $define)
20959         $cat <<EOM
20960 A number of extensions are supplied with $package.  You may choose to
20961 compile these extensions for dynamic loading (the default), compile
20962 them into the $package executable (static loading), or not include
20963 them at all.  Answer "none" to include no extensions.
20964 Note that DynaLoader is always built and need not be mentioned here.
20965
20966 EOM
20967         case "$dynamic_ext" in
20968         '')
20969                 : Exclude those listed in static_ext
20970                 dflt=''
20971                 for xxx in $avail_ext; do
20972                         case " $static_ext " in
20973                         *" $xxx "*) ;;
20974                         *) dflt="$dflt $xxx" ;;
20975                         esac
20976                 done
20977                 set X $dflt
20978                 shift
20979                 dflt="$*"
20980                 ;;
20981         *)      dflt="$dynamic_ext"
20982                 # Perhaps we are reusing an old out-of-date config.sh.
20983                 case "$hint" in
20984                 previous)
20985                         if test X"$dynamic_ext" != X"$avail_ext"; then
20986                                 $cat <<EOM
20987 NOTICE:  Your previous config.sh list may be incorrect. 
20988 The extensions now available to you are 
20989         ${avail_ext}
20990 but the default list from your previous config.sh is
20991         ${dynamic_ext} 
20992
20993 EOM
20994                         fi
20995                         ;;
20996                 esac
20997                 ;;
20998         esac
20999         case "$dflt" in
21000         '')     dflt=none;;
21001         esac
21002         rp="What extensions do you wish to load dynamically?"
21003         . ./myread
21004         case "$ans" in
21005         none) dynamic_ext=' ' ;;
21006         *) dynamic_ext="$ans" ;;
21007         esac
21008
21009         case "$static_ext" in
21010         '')
21011                 : Exclude those already listed in dynamic linking
21012                 dflt=''
21013                 for xxx in $avail_ext; do
21014                         case " $dynamic_ext " in
21015                         *" $xxx "*) ;;
21016                         *) dflt="$dflt $xxx" ;;
21017                         esac
21018                 done
21019                 set X $dflt
21020                 shift
21021                 dflt="$*"
21022                 ;;
21023         *)  dflt="$static_ext" 
21024                 ;;
21025         esac
21026
21027         case "$dflt" in
21028         '')     dflt=none;;
21029         esac
21030         rp="What extensions do you wish to load statically?"
21031         . ./myread
21032         case "$ans" in
21033         none) static_ext=' ' ;;
21034         *) static_ext="$ans" ;;
21035         esac
21036         ;;
21037 *)
21038         $cat <<EOM
21039 A number of extensions are supplied with $package.  Answer "none" 
21040 to include no extensions. 
21041 Note that DynaLoader is always built and need not be mentioned here.
21042
21043 EOM
21044         case "$static_ext" in
21045         '') dflt="$avail_ext" ;;
21046         *)      dflt="$static_ext"
21047                 # Perhaps we are reusing an old out-of-date config.sh.
21048                 case "$hint" in
21049                 previous)
21050                         if test X"$static_ext" != X"$avail_ext"; then
21051                                 $cat <<EOM
21052 NOTICE:  Your previous config.sh list may be incorrect. 
21053 The extensions now available to you are 
21054         ${avail_ext}
21055 but the default list from your previous config.sh is
21056         ${static_ext} 
21057
21058 EOM
21059                         fi
21060                         ;;
21061                 esac
21062                 ;;
21063         esac
21064         : Exclude those that are not xs extensions
21065         case "$dflt" in
21066         '')     dflt=none;;
21067         esac
21068         rp="What extensions do you wish to include?"
21069         . ./myread
21070         case "$ans" in
21071         none) static_ext=' ' ;;
21072         *) static_ext="$ans" ;;
21073         esac
21074         ;;
21075 esac
21076 #        
21077 # Encode is a special case.  If we are building Encode as a static
21078 # extension, we need to explicitly list its subextensions as well.
21079 # For other nested extensions, this is handled automatically by
21080 # the appropriate Makefile.PL.
21081 case " $static_ext " in
21082         *" Encode "*) # Add the subextensions of Encode
21083         cd "$rsrc/ext"
21084         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21085                 static_ext="$static_ext Encode/$xxx"
21086         done
21087         cd "$tdir"
21088         ;;
21089 esac
21090
21091 set X $dynamic_ext $static_ext $nonxs_ext
21092 shift
21093 extensions="$*"
21094
21095 # Sanity check:  We require an extension suitable for use with
21096 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21097 # should show up as failures in the test suite, but it's helpful to
21098 # catch them now.) The 'extensions' list is normally sorted
21099 # alphabetically, so we need to accept either
21100 #    DB_File ... Fcntl ... IO  ....
21101 # or something like
21102 #    Fcntl ... NDBM_File ... IO  ....
21103 case " $extensions"  in
21104 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21105 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21106 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21107 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21108    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21109    ;;
21110 esac
21111
21112 : Remove libraries needed only for extensions
21113 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21114 : The exception is SunOS 4.x, which needs them.
21115 case "${osname}X${osvers}" in
21116 sunos*X4*)
21117     perllibs="$libs"
21118     ;;
21119 *) case "$usedl" in
21120     $define|true|[yY]*)
21121             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21122             shift
21123             perllibs="$*"
21124             ;;
21125     *)  perllibs="$libs"
21126             ;;
21127     esac
21128     ;;
21129 esac
21130
21131 : Remove build directory name from cppstdin so it can be used from
21132 : either the present location or the final installed location.
21133 echo " "
21134 : Get out of the UU directory to get correct path name.
21135 cd ..
21136 case "$cppstdin" in
21137 `pwd`/cppstdin)
21138         echo "Stripping down cppstdin path name"
21139         cppstdin=cppstdin
21140         ;;
21141 esac
21142 cd UU
21143
21144 : end of configuration questions
21145 echo " "
21146 echo "End of configuration questions."
21147 echo " "
21148
21149 : back to where it started
21150 if test -d ../UU; then
21151         cd ..
21152 fi
21153
21154 : configuration may be patched via a 'config.arch' file
21155 if $test -f config.arch; then
21156         echo "I see a config.arch file, loading it."
21157         . ./config.arch
21158 fi
21159
21160 : configuration may be patched via a 'config.over' file
21161 if $test -f config.over; then
21162         echo " "
21163         dflt=y
21164         rp='I see a config.over file.  Do you wish to load it?'
21165         . UU/myread
21166         case "$ans" in
21167         n*) echo "OK, I'll ignore it.";;
21168         *)      . ./config.over
21169                 echo "Configuration override changes have been loaded."
21170                 ;;
21171         esac
21172 fi
21173
21174 : in case they want portability, strip down executable paths
21175 case "$d_portable" in
21176 "$define")
21177         echo " "
21178         echo "Stripping down executable paths..." >&4
21179         for file in $loclist $trylist; do
21180                 eval temp=\$$file
21181                 eval $file=`basename $temp`
21182         done
21183         ;;
21184 esac
21185
21186 : create config.sh file
21187 echo " "
21188 echo "Creating config.sh..." >&4
21189 $spitshell <<EOT >config.sh
21190 $startsh
21191 #
21192 # This file was produced by running the Configure script. It holds all the
21193 # definitions figured out by Configure. Should you modify one of these values,
21194 # do not forget to propagate your changes by running "Configure -der". You may
21195 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21196 #
21197
21198 # Package name      : $package
21199 # Source directory  : $src
21200 # Configuration time: $cf_time
21201 # Configured by     : $cf_by
21202 # Target system     : $myuname
21203
21204 Author='$Author'
21205 Date='$Date'
21206 Header='$Header'
21207 Id='$Id'
21208 Locker='$Locker'
21209 Log='$Log'
21210 Mcc='$Mcc'
21211 RCSfile='$RCSfile'
21212 Revision='$Revision'
21213 Source='$Source'
21214 State='$State'
21215 _a='$_a'
21216 _exe='$_exe'
21217 _o='$_o'
21218 afs='$afs'
21219 afsroot='$afsroot'
21220 alignbytes='$alignbytes'
21221 ansi2knr='$ansi2knr'
21222 aphostname='$aphostname'
21223 api_revision='$api_revision'
21224 api_subversion='$api_subversion'
21225 api_version='$api_version'
21226 api_versionstring='$api_versionstring'
21227 ar='$ar'
21228 archlib='$archlib'
21229 archlibexp='$archlibexp'
21230 archname64='$archname64'
21231 archname='$archname'
21232 archobjs='$archobjs'
21233 asctime_r_proto='$asctime_r_proto'
21234 awk='$awk'
21235 baserev='$baserev'
21236 bash='$bash'
21237 bin='$bin'
21238 binexp='$binexp'
21239 bison='$bison'
21240 byacc='$byacc'
21241 byteorder='$byteorder'
21242 c='$c'
21243 castflags='$castflags'
21244 cat='$cat'
21245 cc='$cc'
21246 cccdlflags='$cccdlflags'
21247 ccdlflags='$ccdlflags'
21248 ccflags='$ccflags'
21249 ccflags_uselargefiles='$ccflags_uselargefiles'
21250 ccname='$ccname'
21251 ccsymbols='$ccsymbols'
21252 ccversion='$ccversion'
21253 cf_by='$cf_by'
21254 cf_email='$cf_email'
21255 cf_time='$cf_time'
21256 charsize='$charsize'
21257 chgrp='$chgrp'
21258 chmod='$chmod'
21259 chown='$chown'
21260 clocktype='$clocktype'
21261 comm='$comm'
21262 compress='$compress'
21263 contains='$contains'
21264 cp='$cp'
21265 cpio='$cpio'
21266 cpp='$cpp'
21267 cpp_stuff='$cpp_stuff'
21268 cppccsymbols='$cppccsymbols'
21269 cppflags='$cppflags'
21270 cpplast='$cpplast'
21271 cppminus='$cppminus'
21272 cpprun='$cpprun'
21273 cppstdin='$cppstdin'
21274 cppsymbols='$cppsymbols'
21275 crypt_r_proto='$crypt_r_proto'
21276 cryptlib='$cryptlib'
21277 csh='$csh'
21278 ctermid_r_proto='$ctermid_r_proto'
21279 ctime_r_proto='$ctime_r_proto'
21280 d_Gconvert='$d_Gconvert'
21281 d_PRIEUldbl='$d_PRIEUldbl'
21282 d_PRIFUldbl='$d_PRIFUldbl'
21283 d_PRIGUldbl='$d_PRIGUldbl'
21284 d_PRIXU64='$d_PRIXU64'
21285 d_PRId64='$d_PRId64'
21286 d_PRIeldbl='$d_PRIeldbl'
21287 d_PRIfldbl='$d_PRIfldbl'
21288 d_PRIgldbl='$d_PRIgldbl'
21289 d_PRIi64='$d_PRIi64'
21290 d_PRIo64='$d_PRIo64'
21291 d_PRIu64='$d_PRIu64'
21292 d_PRIx64='$d_PRIx64'
21293 d_SCNfldbl='$d_SCNfldbl'
21294 d__fwalk='$d__fwalk'
21295 d_access='$d_access'
21296 d_accessx='$d_accessx'
21297 d_aintl='$d_aintl'
21298 d_alarm='$d_alarm'
21299 d_archlib='$d_archlib'
21300 d_asctime_r='$d_asctime_r'
21301 d_atolf='$d_atolf'
21302 d_atoll='$d_atoll'
21303 d_attribute_format='$d_attribute_format'
21304 d_attribute_malloc='$d_attribute_malloc'
21305 d_attribute_nonnull='$d_attribute_nonnull'
21306 d_attribute_noreturn='$d_attribute_noreturn'
21307 d_attribute_pure='$d_attribute_pure'
21308 d_attribute_unused='$d_attribute_unused'
21309 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21310 d_bcmp='$d_bcmp'
21311 d_bcopy='$d_bcopy'
21312 d_bsd='$d_bsd'
21313 d_bsdgetpgrp='$d_bsdgetpgrp'
21314 d_bsdsetpgrp='$d_bsdsetpgrp'
21315 d_builtin_choose_expr='$d_builtin_choose_expr'
21316 d_builtin_expect='$d_builtin_expect'
21317 d_bzero='$d_bzero'
21318 d_c99_variadic_macros='$d_c99_variadic_macros'
21319 d_casti32='$d_casti32'
21320 d_castneg='$d_castneg'
21321 d_charvspr='$d_charvspr'
21322 d_chown='$d_chown'
21323 d_chroot='$d_chroot'
21324 d_chsize='$d_chsize'
21325 d_class='$d_class'
21326 d_clearenv='$d_clearenv'
21327 d_closedir='$d_closedir'
21328 d_cmsghdr_s='$d_cmsghdr_s'
21329 d_const='$d_const'
21330 d_copysignl='$d_copysignl'
21331 d_crypt='$d_crypt'
21332 d_crypt_r='$d_crypt_r'
21333 d_csh='$d_csh'
21334 d_ctermid_r='$d_ctermid_r'
21335 d_ctime_r='$d_ctime_r'
21336 d_cuserid='$d_cuserid'
21337 d_dbl_dig='$d_dbl_dig'
21338 d_dbminitproto='$d_dbminitproto'
21339 d_difftime='$d_difftime'
21340 d_dirfd='$d_dirfd'
21341 d_dirnamlen='$d_dirnamlen'
21342 d_dlerror='$d_dlerror'
21343 d_dlopen='$d_dlopen'
21344 d_dlsymun='$d_dlsymun'
21345 d_dosuid='$d_dosuid'
21346 d_drand48_r='$d_drand48_r'
21347 d_drand48proto='$d_drand48proto'
21348 d_dup2='$d_dup2'
21349 d_eaccess='$d_eaccess'
21350 d_endgrent='$d_endgrent'
21351 d_endgrent_r='$d_endgrent_r'
21352 d_endhent='$d_endhent'
21353 d_endhostent_r='$d_endhostent_r'
21354 d_endnent='$d_endnent'
21355 d_endnetent_r='$d_endnetent_r'
21356 d_endpent='$d_endpent'
21357 d_endprotoent_r='$d_endprotoent_r'
21358 d_endpwent='$d_endpwent'
21359 d_endpwent_r='$d_endpwent_r'
21360 d_endsent='$d_endsent'
21361 d_endservent_r='$d_endservent_r'
21362 d_eofnblk='$d_eofnblk'
21363 d_eunice='$d_eunice'
21364 d_faststdio='$d_faststdio'
21365 d_fchdir='$d_fchdir'
21366 d_fchmod='$d_fchmod'
21367 d_fchown='$d_fchown'
21368 d_fcntl='$d_fcntl'
21369 d_fcntl_can_lock='$d_fcntl_can_lock'
21370 d_fd_macros='$d_fd_macros'
21371 d_fd_set='$d_fd_set'
21372 d_fds_bits='$d_fds_bits'
21373 d_fgetpos='$d_fgetpos'
21374 d_finite='$d_finite'
21375 d_finitel='$d_finitel'
21376 d_flexfnam='$d_flexfnam'
21377 d_flock='$d_flock'
21378 d_flockproto='$d_flockproto'
21379 d_fork='$d_fork'
21380 d_fp_class='$d_fp_class'
21381 d_fpathconf='$d_fpathconf'
21382 d_fpclass='$d_fpclass'
21383 d_fpclassify='$d_fpclassify'
21384 d_fpclassl='$d_fpclassl'
21385 d_fpos64_t='$d_fpos64_t'
21386 d_frexpl='$d_frexpl'
21387 d_fs_data_s='$d_fs_data_s'
21388 d_fseeko='$d_fseeko'
21389 d_fsetpos='$d_fsetpos'
21390 d_fstatfs='$d_fstatfs'
21391 d_fstatvfs='$d_fstatvfs'
21392 d_fsync='$d_fsync'
21393 d_ftello='$d_ftello'
21394 d_ftime='$d_ftime'
21395 d_futimes='$d_futimes'
21396 d_getcwd='$d_getcwd'
21397 d_getespwnam='$d_getespwnam'
21398 d_getfsstat='$d_getfsstat'
21399 d_getgrent='$d_getgrent'
21400 d_getgrent_r='$d_getgrent_r'
21401 d_getgrgid_r='$d_getgrgid_r'
21402 d_getgrnam_r='$d_getgrnam_r'
21403 d_getgrps='$d_getgrps'
21404 d_gethbyaddr='$d_gethbyaddr'
21405 d_gethbyname='$d_gethbyname'
21406 d_gethent='$d_gethent'
21407 d_gethname='$d_gethname'
21408 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21409 d_gethostbyname_r='$d_gethostbyname_r'
21410 d_gethostent_r='$d_gethostent_r'
21411 d_gethostprotos='$d_gethostprotos'
21412 d_getitimer='$d_getitimer'
21413 d_getlogin='$d_getlogin'
21414 d_getlogin_r='$d_getlogin_r'
21415 d_getmnt='$d_getmnt'
21416 d_getmntent='$d_getmntent'
21417 d_getnbyaddr='$d_getnbyaddr'
21418 d_getnbyname='$d_getnbyname'
21419 d_getnent='$d_getnent'
21420 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21421 d_getnetbyname_r='$d_getnetbyname_r'
21422 d_getnetent_r='$d_getnetent_r'
21423 d_getnetprotos='$d_getnetprotos'
21424 d_getpagsz='$d_getpagsz'
21425 d_getpbyname='$d_getpbyname'
21426 d_getpbynumber='$d_getpbynumber'
21427 d_getpent='$d_getpent'
21428 d_getpgid='$d_getpgid'
21429 d_getpgrp2='$d_getpgrp2'
21430 d_getpgrp='$d_getpgrp'
21431 d_getppid='$d_getppid'
21432 d_getprior='$d_getprior'
21433 d_getprotobyname_r='$d_getprotobyname_r'
21434 d_getprotobynumber_r='$d_getprotobynumber_r'
21435 d_getprotoent_r='$d_getprotoent_r'
21436 d_getprotoprotos='$d_getprotoprotos'
21437 d_getprpwnam='$d_getprpwnam'
21438 d_getpwent='$d_getpwent'
21439 d_getpwent_r='$d_getpwent_r'
21440 d_getpwnam_r='$d_getpwnam_r'
21441 d_getpwuid_r='$d_getpwuid_r'
21442 d_getsbyname='$d_getsbyname'
21443 d_getsbyport='$d_getsbyport'
21444 d_getsent='$d_getsent'
21445 d_getservbyname_r='$d_getservbyname_r'
21446 d_getservbyport_r='$d_getservbyport_r'
21447 d_getservent_r='$d_getservent_r'
21448 d_getservprotos='$d_getservprotos'
21449 d_getspnam='$d_getspnam'
21450 d_getspnam_r='$d_getspnam_r'
21451 d_gettimeod='$d_gettimeod'
21452 d_gmtime_r='$d_gmtime_r'
21453 d_gnulibc='$d_gnulibc'
21454 d_grpasswd='$d_grpasswd'
21455 d_hasmntopt='$d_hasmntopt'
21456 d_htonl='$d_htonl'
21457 d_ilogbl='$d_ilogbl'
21458 d_inc_version_list='$d_inc_version_list'
21459 d_index='$d_index'
21460 d_inetaton='$d_inetaton'
21461 d_int64_t='$d_int64_t'
21462 d_isascii='$d_isascii'
21463 d_isfinite='$d_isfinite'
21464 d_isinf='$d_isinf'
21465 d_isnan='$d_isnan'
21466 d_isnanl='$d_isnanl'
21467 d_killpg='$d_killpg'
21468 d_lchown='$d_lchown'
21469 d_ldbl_dig='$d_ldbl_dig'
21470 d_libm_lib_version='$d_libm_lib_version'
21471 d_link='$d_link'
21472 d_localtime_r='$d_localtime_r'
21473 d_locconv='$d_locconv'
21474 d_lockf='$d_lockf'
21475 d_longdbl='$d_longdbl'
21476 d_longlong='$d_longlong'
21477 d_lseekproto='$d_lseekproto'
21478 d_lstat='$d_lstat'
21479 d_madvise='$d_madvise'
21480 d_malloc_good_size='$d_malloc_good_size'
21481 d_malloc_size='$d_malloc_size'
21482 d_mblen='$d_mblen'
21483 d_mbstowcs='$d_mbstowcs'
21484 d_mbtowc='$d_mbtowc'
21485 d_memchr='$d_memchr'
21486 d_memcmp='$d_memcmp'
21487 d_memcpy='$d_memcpy'
21488 d_memmove='$d_memmove'
21489 d_memset='$d_memset'
21490 d_mkdir='$d_mkdir'
21491 d_mkdtemp='$d_mkdtemp'
21492 d_mkfifo='$d_mkfifo'
21493 d_mkstemp='$d_mkstemp'
21494 d_mkstemps='$d_mkstemps'
21495 d_mktime='$d_mktime'
21496 d_mmap='$d_mmap'
21497 d_modfl='$d_modfl'
21498 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21499 d_modflproto='$d_modflproto'
21500 d_mprotect='$d_mprotect'
21501 d_msg='$d_msg'
21502 d_msg_ctrunc='$d_msg_ctrunc'
21503 d_msg_dontroute='$d_msg_dontroute'
21504 d_msg_oob='$d_msg_oob'
21505 d_msg_peek='$d_msg_peek'
21506 d_msg_proxy='$d_msg_proxy'
21507 d_msgctl='$d_msgctl'
21508 d_msgget='$d_msgget'
21509 d_msghdr_s='$d_msghdr_s'
21510 d_msgrcv='$d_msgrcv'
21511 d_msgsnd='$d_msgsnd'
21512 d_msync='$d_msync'
21513 d_munmap='$d_munmap'
21514 d_mymalloc='$d_mymalloc'
21515 d_nice='$d_nice'
21516 d_nl_langinfo='$d_nl_langinfo'
21517 d_nv_preserves_uv='$d_nv_preserves_uv'
21518 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21519 d_off64_t='$d_off64_t'
21520 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21521 d_oldpthreads='$d_oldpthreads'
21522 d_oldsock='$d_oldsock'
21523 d_open3='$d_open3'
21524 d_pathconf='$d_pathconf'
21525 d_pause='$d_pause'
21526 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21527 d_phostname='$d_phostname'
21528 d_pipe='$d_pipe'
21529 d_poll='$d_poll'
21530 d_portable='$d_portable'
21531 d_procselfexe='$d_procselfexe'
21532 d_pthread_atfork='$d_pthread_atfork'
21533 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21534 d_pthread_yield='$d_pthread_yield'
21535 d_pwage='$d_pwage'
21536 d_pwchange='$d_pwchange'
21537 d_pwclass='$d_pwclass'
21538 d_pwcomment='$d_pwcomment'
21539 d_pwexpire='$d_pwexpire'
21540 d_pwgecos='$d_pwgecos'
21541 d_pwpasswd='$d_pwpasswd'
21542 d_pwquota='$d_pwquota'
21543 d_qgcvt='$d_qgcvt'
21544 d_quad='$d_quad'
21545 d_random_r='$d_random_r'
21546 d_readdir64_r='$d_readdir64_r'
21547 d_readdir='$d_readdir'
21548 d_readdir_r='$d_readdir_r'
21549 d_readlink='$d_readlink'
21550 d_readv='$d_readv'
21551 d_recvmsg='$d_recvmsg'
21552 d_rename='$d_rename'
21553 d_rewinddir='$d_rewinddir'
21554 d_rmdir='$d_rmdir'
21555 d_safebcpy='$d_safebcpy'
21556 d_safemcpy='$d_safemcpy'
21557 d_sanemcmp='$d_sanemcmp'
21558 d_sbrkproto='$d_sbrkproto'
21559 d_scalbnl='$d_scalbnl'
21560 d_sched_yield='$d_sched_yield'
21561 d_scm_rights='$d_scm_rights'
21562 d_seekdir='$d_seekdir'
21563 d_select='$d_select'
21564 d_sem='$d_sem'
21565 d_semctl='$d_semctl'
21566 d_semctl_semid_ds='$d_semctl_semid_ds'
21567 d_semctl_semun='$d_semctl_semun'
21568 d_semget='$d_semget'
21569 d_semop='$d_semop'
21570 d_sendmsg='$d_sendmsg'
21571 d_setegid='$d_setegid'
21572 d_seteuid='$d_seteuid'
21573 d_setgrent='$d_setgrent'
21574 d_setgrent_r='$d_setgrent_r'
21575 d_setgrps='$d_setgrps'
21576 d_sethent='$d_sethent'
21577 d_sethostent_r='$d_sethostent_r'
21578 d_setitimer='$d_setitimer'
21579 d_setlinebuf='$d_setlinebuf'
21580 d_setlocale='$d_setlocale'
21581 d_setlocale_r='$d_setlocale_r'
21582 d_setnent='$d_setnent'
21583 d_setnetent_r='$d_setnetent_r'
21584 d_setpent='$d_setpent'
21585 d_setpgid='$d_setpgid'
21586 d_setpgrp2='$d_setpgrp2'
21587 d_setpgrp='$d_setpgrp'
21588 d_setprior='$d_setprior'
21589 d_setproctitle='$d_setproctitle'
21590 d_setprotoent_r='$d_setprotoent_r'
21591 d_setpwent='$d_setpwent'
21592 d_setpwent_r='$d_setpwent_r'
21593 d_setregid='$d_setregid'
21594 d_setresgid='$d_setresgid'
21595 d_setresuid='$d_setresuid'
21596 d_setreuid='$d_setreuid'
21597 d_setrgid='$d_setrgid'
21598 d_setruid='$d_setruid'
21599 d_setsent='$d_setsent'
21600 d_setservent_r='$d_setservent_r'
21601 d_setsid='$d_setsid'
21602 d_setvbuf='$d_setvbuf'
21603 d_sfio='$d_sfio'
21604 d_shm='$d_shm'
21605 d_shmat='$d_shmat'
21606 d_shmatprototype='$d_shmatprototype'
21607 d_shmctl='$d_shmctl'
21608 d_shmdt='$d_shmdt'
21609 d_shmget='$d_shmget'
21610 d_sigaction='$d_sigaction'
21611 d_sigprocmask='$d_sigprocmask'
21612 d_sigsetjmp='$d_sigsetjmp'
21613 d_sitearch='$d_sitearch'
21614 d_snprintf='$d_snprintf'
21615 d_sockatmark='$d_sockatmark'
21616 d_sockatmarkproto='$d_sockatmarkproto'
21617 d_socket='$d_socket'
21618 d_socklen_t='$d_socklen_t'
21619 d_sockpair='$d_sockpair'
21620 d_socks5_init='$d_socks5_init'
21621 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21622 d_sqrtl='$d_sqrtl'
21623 d_srand48_r='$d_srand48_r'
21624 d_srandom_r='$d_srandom_r'
21625 d_sresgproto='$d_sresgproto'
21626 d_sresuproto='$d_sresuproto'
21627 d_statblks='$d_statblks'
21628 d_statfs_f_flags='$d_statfs_f_flags'
21629 d_statfs_s='$d_statfs_s'
21630 d_statvfs='$d_statvfs'
21631 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21632 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21633 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21634 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21635 d_stdio_stream_array='$d_stdio_stream_array'
21636 d_stdiobase='$d_stdiobase'
21637 d_stdstdio='$d_stdstdio'
21638 d_strchr='$d_strchr'
21639 d_strcoll='$d_strcoll'
21640 d_strctcpy='$d_strctcpy'
21641 d_strerrm='$d_strerrm'
21642 d_strerror='$d_strerror'
21643 d_strerror_r='$d_strerror_r'
21644 d_strftime='$d_strftime'
21645 d_strlcat='$d_strlcat'
21646 d_strlcpy='$d_strlcpy'
21647 d_strtod='$d_strtod'
21648 d_strtol='$d_strtol'
21649 d_strtold='$d_strtold'
21650 d_strtoll='$d_strtoll'
21651 d_strtoq='$d_strtoq'
21652 d_strtoul='$d_strtoul'
21653 d_strtoull='$d_strtoull'
21654 d_strtouq='$d_strtouq'
21655 d_strxfrm='$d_strxfrm'
21656 d_suidsafe='$d_suidsafe'
21657 d_symlink='$d_symlink'
21658 d_syscall='$d_syscall'
21659 d_syscallproto='$d_syscallproto'
21660 d_sysconf='$d_sysconf'
21661 d_sysernlst='$d_sysernlst'
21662 d_syserrlst='$d_syserrlst'
21663 d_system='$d_system'
21664 d_tcgetpgrp='$d_tcgetpgrp'
21665 d_tcsetpgrp='$d_tcsetpgrp'
21666 d_telldir='$d_telldir'
21667 d_telldirproto='$d_telldirproto'
21668 d_time='$d_time'
21669 d_times='$d_times'
21670 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21671 d_tm_tm_zone='$d_tm_tm_zone'
21672 d_tmpnam_r='$d_tmpnam_r'
21673 d_truncate='$d_truncate'
21674 d_ttyname_r='$d_ttyname_r'
21675 d_tzname='$d_tzname'
21676 d_u32align='$d_u32align'
21677 d_ualarm='$d_ualarm'
21678 d_umask='$d_umask'
21679 d_uname='$d_uname'
21680 d_union_semun='$d_union_semun'
21681 d_unordered='$d_unordered'
21682 d_unsetenv='$d_unsetenv'
21683 d_usleep='$d_usleep'
21684 d_usleepproto='$d_usleepproto'
21685 d_ustat='$d_ustat'
21686 d_vendorarch='$d_vendorarch'
21687 d_vendorbin='$d_vendorbin'
21688 d_vendorlib='$d_vendorlib'
21689 d_vendorscript='$d_vendorscript'
21690 d_vfork='$d_vfork'
21691 d_void_closedir='$d_void_closedir'
21692 d_voidsig='$d_voidsig'
21693 d_voidtty='$d_voidtty'
21694 d_volatile='$d_volatile'
21695 d_vprintf='$d_vprintf'
21696 d_vsnprintf='$d_vsnprintf'
21697 d_wait4='$d_wait4'
21698 d_waitpid='$d_waitpid'
21699 d_wcstombs='$d_wcstombs'
21700 d_wctomb='$d_wctomb'
21701 d_writev='$d_writev'
21702 d_xenix='$d_xenix'
21703 date='$date'
21704 db_hashtype='$db_hashtype'
21705 db_prefixtype='$db_prefixtype'
21706 db_version_major='$db_version_major'
21707 db_version_minor='$db_version_minor'
21708 db_version_patch='$db_version_patch'
21709 defvoidused='$defvoidused'
21710 direntrytype='$direntrytype'
21711 dlext='$dlext'
21712 dlsrc='$dlsrc'
21713 doublesize='$doublesize'
21714 drand01='$drand01'
21715 drand48_r_proto='$drand48_r_proto'
21716 dynamic_ext='$dynamic_ext'
21717 eagain='$eagain'
21718 ebcdic='$ebcdic'
21719 echo='$echo'
21720 egrep='$egrep'
21721 emacs='$emacs'
21722 endgrent_r_proto='$endgrent_r_proto'
21723 endhostent_r_proto='$endhostent_r_proto'
21724 endnetent_r_proto='$endnetent_r_proto'
21725 endprotoent_r_proto='$endprotoent_r_proto'
21726 endpwent_r_proto='$endpwent_r_proto'
21727 endservent_r_proto='$endservent_r_proto'
21728 eunicefix='$eunicefix'
21729 exe_ext='$exe_ext'
21730 expr='$expr'
21731 extensions='$extensions'
21732 extras='$extras'
21733 fflushNULL='$fflushNULL'
21734 fflushall='$fflushall'
21735 find='$find'
21736 firstmakefile='$firstmakefile'
21737 flex='$flex'
21738 fpossize='$fpossize'
21739 fpostype='$fpostype'
21740 freetype='$freetype'
21741 from='$from'
21742 full_ar='$full_ar'
21743 full_csh='$full_csh'
21744 full_sed='$full_sed'
21745 gccansipedantic='$gccansipedantic'
21746 gccosandvers='$gccosandvers'
21747 gccversion='$gccversion'
21748 getgrent_r_proto='$getgrent_r_proto'
21749 getgrgid_r_proto='$getgrgid_r_proto'
21750 getgrnam_r_proto='$getgrnam_r_proto'
21751 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21752 gethostbyname_r_proto='$gethostbyname_r_proto'
21753 gethostent_r_proto='$gethostent_r_proto'
21754 getlogin_r_proto='$getlogin_r_proto'
21755 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21756 getnetbyname_r_proto='$getnetbyname_r_proto'
21757 getnetent_r_proto='$getnetent_r_proto'
21758 getprotobyname_r_proto='$getprotobyname_r_proto'
21759 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21760 getprotoent_r_proto='$getprotoent_r_proto'
21761 getpwent_r_proto='$getpwent_r_proto'
21762 getpwnam_r_proto='$getpwnam_r_proto'
21763 getpwuid_r_proto='$getpwuid_r_proto'
21764 getservbyname_r_proto='$getservbyname_r_proto'
21765 getservbyport_r_proto='$getservbyport_r_proto'
21766 getservent_r_proto='$getservent_r_proto'
21767 getspnam_r_proto='$getspnam_r_proto'
21768 gidformat='$gidformat'
21769 gidsign='$gidsign'
21770 gidsize='$gidsize'
21771 gidtype='$gidtype'
21772 glibpth='$glibpth'
21773 gmake='$gmake'
21774 gmtime_r_proto='$gmtime_r_proto'
21775 gnulibc_version='$gnulibc_version'
21776 grep='$grep'
21777 groupcat='$groupcat'
21778 groupstype='$groupstype'
21779 gzip='$gzip'
21780 h_fcntl='$h_fcntl'
21781 h_sysfile='$h_sysfile'
21782 hint='$hint'
21783 hostcat='$hostcat'
21784 html1dir='$html1dir'
21785 html1direxp='$html1direxp'
21786 html3dir='$html3dir'
21787 html3direxp='$html3direxp'
21788 i16size='$i16size'
21789 i16type='$i16type'
21790 i32size='$i32size'
21791 i32type='$i32type'
21792 i64size='$i64size'
21793 i64type='$i64type'
21794 i8size='$i8size'
21795 i8type='$i8type'
21796 i_arpainet='$i_arpainet'
21797 i_bsdioctl='$i_bsdioctl'
21798 i_crypt='$i_crypt'
21799 i_db='$i_db'
21800 i_dbm='$i_dbm'
21801 i_dirent='$i_dirent'
21802 i_dld='$i_dld'
21803 i_dlfcn='$i_dlfcn'
21804 i_fcntl='$i_fcntl'
21805 i_float='$i_float'
21806 i_fp='$i_fp'
21807 i_fp_class='$i_fp_class'
21808 i_gdbm='$i_gdbm'
21809 i_grp='$i_grp'
21810 i_ieeefp='$i_ieeefp'
21811 i_inttypes='$i_inttypes'
21812 i_langinfo='$i_langinfo'
21813 i_libutil='$i_libutil'
21814 i_limits='$i_limits'
21815 i_locale='$i_locale'
21816 i_machcthr='$i_machcthr'
21817 i_malloc='$i_malloc'
21818 i_math='$i_math'
21819 i_memory='$i_memory'
21820 i_mntent='$i_mntent'
21821 i_ndbm='$i_ndbm'
21822 i_netdb='$i_netdb'
21823 i_neterrno='$i_neterrno'
21824 i_netinettcp='$i_netinettcp'
21825 i_niin='$i_niin'
21826 i_poll='$i_poll'
21827 i_prot='$i_prot'
21828 i_pthread='$i_pthread'
21829 i_pwd='$i_pwd'
21830 i_rpcsvcdbm='$i_rpcsvcdbm'
21831 i_sfio='$i_sfio'
21832 i_sgtty='$i_sgtty'
21833 i_shadow='$i_shadow'
21834 i_socks='$i_socks'
21835 i_stdarg='$i_stdarg'
21836 i_stddef='$i_stddef'
21837 i_stdlib='$i_stdlib'
21838 i_string='$i_string'
21839 i_sunmath='$i_sunmath'
21840 i_sysaccess='$i_sysaccess'
21841 i_sysdir='$i_sysdir'
21842 i_sysfile='$i_sysfile'
21843 i_sysfilio='$i_sysfilio'
21844 i_sysin='$i_sysin'
21845 i_sysioctl='$i_sysioctl'
21846 i_syslog='$i_syslog'
21847 i_sysmman='$i_sysmman'
21848 i_sysmode='$i_sysmode'
21849 i_sysmount='$i_sysmount'
21850 i_sysndir='$i_sysndir'
21851 i_sysparam='$i_sysparam'
21852 i_sysresrc='$i_sysresrc'
21853 i_syssecrt='$i_syssecrt'
21854 i_sysselct='$i_sysselct'
21855 i_syssockio='$i_syssockio'
21856 i_sysstat='$i_sysstat'
21857 i_sysstatfs='$i_sysstatfs'
21858 i_sysstatvfs='$i_sysstatvfs'
21859 i_systime='$i_systime'
21860 i_systimek='$i_systimek'
21861 i_systimes='$i_systimes'
21862 i_systypes='$i_systypes'
21863 i_sysuio='$i_sysuio'
21864 i_sysun='$i_sysun'
21865 i_sysutsname='$i_sysutsname'
21866 i_sysvfs='$i_sysvfs'
21867 i_syswait='$i_syswait'
21868 i_termio='$i_termio'
21869 i_termios='$i_termios'
21870 i_time='$i_time'
21871 i_unistd='$i_unistd'
21872 i_ustat='$i_ustat'
21873 i_utime='$i_utime'
21874 i_values='$i_values'
21875 i_varargs='$i_varargs'
21876 i_varhdr='$i_varhdr'
21877 i_vfork='$i_vfork'
21878 ignore_versioned_solibs='$ignore_versioned_solibs'
21879 inc_version_list='$inc_version_list'
21880 inc_version_list_init='$inc_version_list_init'
21881 incpath='$incpath'
21882 inews='$inews'
21883 initialinstalllocation='$initialinstalllocation'
21884 installarchlib='$installarchlib'
21885 installbin='$installbin'
21886 installhtml1dir='$installhtml1dir'
21887 installhtml3dir='$installhtml3dir'
21888 installman1dir='$installman1dir'
21889 installman3dir='$installman3dir'
21890 installprefix='$installprefix'
21891 installprefixexp='$installprefixexp'
21892 installprivlib='$installprivlib'
21893 installscript='$installscript'
21894 installsitearch='$installsitearch'
21895 installsitebin='$installsitebin'
21896 installsitehtml1dir='$installsitehtml1dir'
21897 installsitehtml3dir='$installsitehtml3dir'
21898 installsitelib='$installsitelib'
21899 installsiteman1dir='$installsiteman1dir'
21900 installsiteman3dir='$installsiteman3dir'
21901 installsitescript='$installsitescript'
21902 installstyle='$installstyle'
21903 installusrbinperl='$installusrbinperl'
21904 installvendorarch='$installvendorarch'
21905 installvendorbin='$installvendorbin'
21906 installvendorhtml1dir='$installvendorhtml1dir'
21907 installvendorhtml3dir='$installvendorhtml3dir'
21908 installvendorlib='$installvendorlib'
21909 installvendorman1dir='$installvendorman1dir'
21910 installvendorman3dir='$installvendorman3dir'
21911 installvendorscript='$installvendorscript'
21912 intsize='$intsize'
21913 issymlink='$issymlink'
21914 ivdformat='$ivdformat'
21915 ivsize='$ivsize'
21916 ivtype='$ivtype'
21917 known_extensions='$known_extensions'
21918 ksh='$ksh'
21919 ld='$ld'
21920 lddlflags='$lddlflags'
21921 ldflags='$ldflags'
21922 ldflags_uselargefiles='$ldflags_uselargefiles'
21923 ldlibpthname='$ldlibpthname'
21924 less='$less'
21925 lib_ext='$lib_ext'
21926 libc='$libc'
21927 libperl='$libperl'
21928 libpth='$libpth'
21929 libs='$libs'
21930 libsdirs='$libsdirs'
21931 libsfiles='$libsfiles'
21932 libsfound='$libsfound'
21933 libspath='$libspath'
21934 libswanted='$libswanted'
21935 libswanted_uselargefiles='$libswanted_uselargefiles'
21936 line='$line'
21937 lint='$lint'
21938 lkflags='$lkflags'
21939 ln='$ln'
21940 lns='$lns'
21941 localtime_r_proto='$localtime_r_proto'
21942 locincpth='$locincpth'
21943 loclibpth='$loclibpth'
21944 longdblsize='$longdblsize'
21945 longlongsize='$longlongsize'
21946 longsize='$longsize'
21947 lp='$lp'
21948 lpr='$lpr'
21949 ls='$ls'
21950 lseeksize='$lseeksize'
21951 lseektype='$lseektype'
21952 mad='$mad'
21953 madlyh='$madlyh'
21954 madlyobj='$madlyobj'
21955 madlysrc='$madlysrc'
21956 mail='$mail'
21957 mailx='$mailx'
21958 make='$make'
21959 make_set_make='$make_set_make'
21960 mallocobj='$mallocobj'
21961 mallocsrc='$mallocsrc'
21962 malloctype='$malloctype'
21963 man1dir='$man1dir'
21964 man1direxp='$man1direxp'
21965 man1ext='$man1ext'
21966 man3dir='$man3dir'
21967 man3direxp='$man3direxp'
21968 man3ext='$man3ext'
21969 mips_type='$mips_type'
21970 mistrustnm='$mistrustnm'
21971 mkdir='$mkdir'
21972 mmaptype='$mmaptype'
21973 modetype='$modetype'
21974 more='$more'
21975 multiarch='$multiarch'
21976 mv='$mv'
21977 myarchname='$myarchname'
21978 mydomain='$mydomain'
21979 myhostname='$myhostname'
21980 myuname='$myuname'
21981 n='$n'
21982 need_va_copy='$need_va_copy'
21983 netdb_hlen_type='$netdb_hlen_type'
21984 netdb_host_type='$netdb_host_type'
21985 netdb_name_type='$netdb_name_type'
21986 netdb_net_type='$netdb_net_type'
21987 nm='$nm'
21988 nm_opt='$nm_opt'
21989 nm_so_opt='$nm_so_opt'
21990 nonxs_ext='$nonxs_ext'
21991 nroff='$nroff'
21992 nvEUformat='$nvEUformat'
21993 nvFUformat='$nvFUformat'
21994 nvGUformat='$nvGUformat'
21995 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21996 nveformat='$nveformat'
21997 nvfformat='$nvfformat'
21998 nvgformat='$nvgformat'
21999 nvsize='$nvsize'
22000 nvtype='$nvtype'
22001 o_nonblock='$o_nonblock'
22002 obj_ext='$obj_ext'
22003 old_pthread_create_joinable='$old_pthread_create_joinable'
22004 optimize='$optimize'
22005 orderlib='$orderlib'
22006 osname='$osname'
22007 osvers='$osvers'
22008 otherlibdirs='$otherlibdirs'
22009 package='$package'
22010 pager='$pager'
22011 passcat='$passcat'
22012 patchlevel='$patchlevel'
22013 path_sep='$path_sep'
22014 perl5='$perl5'
22015 perl='$perl'
22016 perl_patchlevel='$perl_patchlevel'
22017 perladmin='$perladmin'
22018 perllibs='$perllibs'
22019 perlpath='$perlpath'
22020 pg='$pg'
22021 phostname='$phostname'
22022 pidtype='$pidtype'
22023 plibpth='$plibpth'
22024 pmake='$pmake'
22025 pr='$pr'
22026 prefix='$prefix'
22027 prefixexp='$prefixexp'
22028 privlib='$privlib'
22029 privlibexp='$privlibexp'
22030 procselfexe='$procselfexe'
22031 prototype='$prototype'
22032 ptrsize='$ptrsize'
22033 quadkind='$quadkind'
22034 quadtype='$quadtype'
22035 randbits='$randbits'
22036 randfunc='$randfunc'
22037 random_r_proto='$random_r_proto'
22038 randseedtype='$randseedtype'
22039 ranlib='$ranlib'
22040 rd_nodata='$rd_nodata'
22041 readdir64_r_proto='$readdir64_r_proto'
22042 readdir_r_proto='$readdir_r_proto'
22043 revision='$revision'
22044 rm='$rm'
22045 rmail='$rmail'
22046 run='$run'
22047 runnm='$runnm'
22048 sPRIEUldbl='$sPRIEUldbl'
22049 sPRIFUldbl='$sPRIFUldbl'
22050 sPRIGUldbl='$sPRIGUldbl'
22051 sPRIXU64='$sPRIXU64'
22052 sPRId64='$sPRId64'
22053 sPRIeldbl='$sPRIeldbl'
22054 sPRIfldbl='$sPRIfldbl'
22055 sPRIgldbl='$sPRIgldbl'
22056 sPRIi64='$sPRIi64'
22057 sPRIo64='$sPRIo64'
22058 sPRIu64='$sPRIu64'
22059 sPRIx64='$sPRIx64'
22060 sSCNfldbl='$sSCNfldbl'
22061 sched_yield='$sched_yield'
22062 scriptdir='$scriptdir'
22063 scriptdirexp='$scriptdirexp'
22064 sed='$sed'
22065 seedfunc='$seedfunc'
22066 selectminbits='$selectminbits'
22067 selecttype='$selecttype'
22068 sendmail='$sendmail'
22069 setgrent_r_proto='$setgrent_r_proto'
22070 sethostent_r_proto='$sethostent_r_proto'
22071 setlocale_r_proto='$setlocale_r_proto'
22072 setnetent_r_proto='$setnetent_r_proto'
22073 setprotoent_r_proto='$setprotoent_r_proto'
22074 setpwent_r_proto='$setpwent_r_proto'
22075 setservent_r_proto='$setservent_r_proto'
22076 sh='$sh'
22077 shar='$shar'
22078 sharpbang='$sharpbang'
22079 shmattype='$shmattype'
22080 shortsize='$shortsize'
22081 shrpenv='$shrpenv'
22082 shsharp='$shsharp'
22083 sig_count='$sig_count'
22084 sig_name='$sig_name'
22085 sig_name_init='$sig_name_init'
22086 sig_num='$sig_num'
22087 sig_num_init='$sig_num_init'
22088 sig_size='$sig_size'
22089 signal_t='$signal_t'
22090 sitearch='$sitearch'
22091 sitearchexp='$sitearchexp'
22092 sitebin='$sitebin'
22093 sitebinexp='$sitebinexp'
22094 sitehtml1dir='$sitehtml1dir'
22095 sitehtml1direxp='$sitehtml1direxp'
22096 sitehtml3dir='$sitehtml3dir'
22097 sitehtml3direxp='$sitehtml3direxp'
22098 sitelib='$sitelib'
22099 sitelib_stem='$sitelib_stem'
22100 sitelibexp='$sitelibexp'
22101 siteman1dir='$siteman1dir'
22102 siteman1direxp='$siteman1direxp'
22103 siteman3dir='$siteman3dir'
22104 siteman3direxp='$siteman3direxp'
22105 siteprefix='$siteprefix'
22106 siteprefixexp='$siteprefixexp'
22107 sitescript='$sitescript'
22108 sitescriptexp='$sitescriptexp'
22109 sizesize='$sizesize'
22110 sizetype='$sizetype'
22111 sleep='$sleep'
22112 smail='$smail'
22113 so='$so'
22114 sockethdr='$sockethdr'
22115 socketlib='$socketlib'
22116 socksizetype='$socksizetype'
22117 sort='$sort'
22118 spackage='$spackage'
22119 spitshell='$spitshell'
22120 srand48_r_proto='$srand48_r_proto'
22121 srandom_r_proto='$srandom_r_proto'
22122 src='$src'
22123 ssizetype='$ssizetype'
22124 startperl='$startperl'
22125 startsh='$startsh'
22126 static_ext='$static_ext'
22127 stdchar='$stdchar'
22128 stdio_base='$stdio_base'
22129 stdio_bufsiz='$stdio_bufsiz'
22130 stdio_cnt='$stdio_cnt'
22131 stdio_filbuf='$stdio_filbuf'
22132 stdio_ptr='$stdio_ptr'
22133 stdio_stream_array='$stdio_stream_array'
22134 strerror_r_proto='$strerror_r_proto'
22135 strings='$strings'
22136 submit='$submit'
22137 subversion='$subversion'
22138 sysman='$sysman'
22139 tail='$tail'
22140 tar='$tar'
22141 targetarch='$targetarch'
22142 tbl='$tbl'
22143 tee='$tee'
22144 test='$test'
22145 timeincl='$timeincl'
22146 timetype='$timetype'
22147 tmpnam_r_proto='$tmpnam_r_proto'
22148 to='$to'
22149 touch='$touch'
22150 tr='$tr'
22151 trnl='$trnl'
22152 troff='$troff'
22153 ttyname_r_proto='$ttyname_r_proto'
22154 u16size='$u16size'
22155 u16type='$u16type'
22156 u32size='$u32size'
22157 u32type='$u32type'
22158 u64size='$u64size'
22159 u64type='$u64type'
22160 u8size='$u8size'
22161 u8type='$u8type'
22162 uidformat='$uidformat'
22163 uidsign='$uidsign'
22164 uidsize='$uidsize'
22165 uidtype='$uidtype'
22166 uname='$uname'
22167 uniq='$uniq'
22168 uquadtype='$uquadtype'
22169 use5005threads='$use5005threads'
22170 use64bitall='$use64bitall'
22171 use64bitint='$use64bitint'
22172 usecrosscompile='$usecrosscompile'
22173 usedl='$usedl'
22174 usefaststdio='$usefaststdio'
22175 useithreads='$useithreads'
22176 uselargefiles='$uselargefiles'
22177 uselongdouble='$uselongdouble'
22178 usemallocwrap='$usemallocwrap'
22179 usemorebits='$usemorebits'
22180 usemultiplicity='$usemultiplicity'
22181 usemymalloc='$usemymalloc'
22182 usenm='$usenm'
22183 useopcode='$useopcode'
22184 useperlio='$useperlio'
22185 useposix='$useposix'
22186 usereentrant='$usereentrant'
22187 userelocatableinc='$userelocatableinc'
22188 usesfio='$usesfio'
22189 useshrplib='$useshrplib'
22190 usesitecustomize='$usesitecustomize'
22191 usesocks='$usesocks'
22192 usethreads='$usethreads'
22193 usevendorprefix='$usevendorprefix'
22194 usevfork='$usevfork'
22195 usrinc='$usrinc'
22196 uuname='$uuname'
22197 uvXUformat='$uvXUformat'
22198 uvoformat='$uvoformat'
22199 uvsize='$uvsize'
22200 uvtype='$uvtype'
22201 uvuformat='$uvuformat'
22202 uvxformat='$uvxformat'
22203 vendorarch='$vendorarch'
22204 vendorarchexp='$vendorarchexp'
22205 vendorbin='$vendorbin'
22206 vendorbinexp='$vendorbinexp'
22207 vendorhtml1dir='$vendorhtml1dir'
22208 vendorhtml1direxp='$vendorhtml1direxp'
22209 vendorhtml3dir='$vendorhtml3dir'
22210 vendorhtml3direxp='$vendorhtml3direxp'
22211 vendorlib='$vendorlib'
22212 vendorlib_stem='$vendorlib_stem'
22213 vendorlibexp='$vendorlibexp'
22214 vendorman1dir='$vendorman1dir'
22215 vendorman1direxp='$vendorman1direxp'
22216 vendorman3dir='$vendorman3dir'
22217 vendorman3direxp='$vendorman3direxp'
22218 vendorprefix='$vendorprefix'
22219 vendorprefixexp='$vendorprefixexp'
22220 vendorscript='$vendorscript'
22221 vendorscriptexp='$vendorscriptexp'
22222 version='$version'
22223 version_patchlevel_string='$version_patchlevel_string'
22224 versiononly='$versiononly'
22225 vi='$vi'
22226 voidflags='$voidflags'
22227 xlibpth='$xlibpth'
22228 yacc='$yacc'
22229 yaccflags='$yaccflags'
22230 zcat='$zcat'
22231 zip='$zip'
22232 EOT
22233
22234 : Add in command line options if available
22235 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22236
22237 : add special variables
22238 $test -f $src/patchlevel.h && \
22239 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22240 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22241 echo "PERL_CONFIG_SH=true" >>config.sh
22242
22243 : propagate old symbols
22244 if $test -f UU/config.sh; then
22245         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22246         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22247         $sort | $uniq -u >UU/oldsyms
22248         set X `cat UU/oldsyms`
22249         shift
22250         case $# in
22251         0) ;;
22252         *)
22253                 cat <<EOM
22254 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22255 EOM
22256                 echo "# Variables propagated from previous config.sh file." >>config.sh
22257                 for sym in `cat UU/oldsyms`; do
22258                         echo "    Propagating $hint variable "'$'"$sym..."
22259                         eval 'tmp="$'"${sym}"'"'
22260                         echo "$tmp" | \
22261                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22262                 done
22263                 ;;
22264         esac
22265 fi
22266
22267 : Finish up by extracting the .SH files
22268 case "$alldone" in
22269 exit)
22270         $rm -rf UU
22271         echo "Extraction done."
22272         exit 0
22273         ;;
22274 cont)
22275         ;;
22276 '')
22277         dflt=''
22278         nostick=true
22279         $cat <<EOM
22280
22281 If you'd like to make any changes to the config.sh file before I begin
22282 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22283
22284 EOM
22285         rp="Press return or use a shell escape to edit config.sh:"
22286         . UU/myread
22287         nostick=''
22288         case "$ans" in
22289         '') ;;
22290         *) : in case they cannot read
22291                 sh 1>&4 -c "$ans";;
22292         esac
22293         ;;
22294 esac
22295
22296 : if this fails, just run all the .SH files by hand
22297 . ./config.sh
22298
22299 echo " "
22300 exec 1>&4
22301 pwd=`pwd`
22302 . ./UU/extract
22303 cd "$pwd"
22304
22305 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22306         dflt=y
22307         case "$silent" in
22308         true) ;;
22309         *)
22310                 $cat <<EOM
22311
22312 Now you need to generate make dependencies by running "$make depend".
22313 You might prefer to run it in background: "$make depend > makedepend.out &"
22314 It can take a while, so you might not want to run it right now.
22315
22316 EOM
22317                 ;;
22318         esac
22319         rp="Run $make depend now?"
22320         . UU/myread
22321         case "$ans" in
22322         y*)
22323                 $make depend && echo "Now you must run '$make'."
22324                 ;;
22325         *)
22326                 echo "You must run '$make depend' then '$make'."
22327                 ;;
22328         esac
22329 elif test -f [Mm]akefile; then
22330         echo " "
22331         echo "Now you must run a $make."
22332 else
22333         echo "Configure done."
22334 fi
22335
22336 if $test -f Policy.sh; then
22337     $cat <<EOM
22338
22339 If you compile $package on a different machine or from a different object
22340 directory, copy the Policy.sh file from this object directory to the
22341 new one before you run Configure -- this will help you with most of
22342 the policy defaults.
22343
22344 EOM
22345 fi
22346 if $test -f config.msg; then
22347     echo "Hmm.  I also noted the following information while running:"
22348     echo " "
22349     $cat config.msg >&4
22350     $rm -f config.msg
22351 fi
22352 $rm -f kit*isdone ark*isdone
22353 $rm -rf UU
22354
22355 : End of Configure
22356