Make harness warning-free when running with -Mdiagnostics
[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 Mon Oct 31 19:12:32 CET 2005 [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 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_bzero=''
358 d_casti32=''
359 castflags=''
360 d_castneg=''
361 d_chown=''
362 d_chroot=''
363 d_chsize=''
364 d_class=''
365 d_clearenv=''
366 d_closedir=''
367 d_void_closedir=''
368 d_cmsghdr_s=''
369 d_const=''
370 d_copysignl=''
371 cryptlib=''
372 d_crypt=''
373 crypt_r_proto=''
374 d_crypt_r=''
375 d_csh=''
376 full_csh=''
377 ctermid_r_proto=''
378 d_ctermid_r=''
379 ctime_r_proto=''
380 d_ctime_r=''
381 d_cuserid=''
382 d_dbl_dig=''
383 d_dbminitproto=''
384 d_difftime=''
385 d_dirfd=''
386 d_dlerror=''
387 d_dlopen=''
388 d_dlsymun=''
389 d_dosuid=''
390 d_suidsafe=''
391 d_drand48_r=''
392 drand48_r_proto=''
393 d_drand48proto=''
394 d_dup2=''
395 d_eaccess=''
396 d_endgrent=''
397 d_endgrent_r=''
398 endgrent_r_proto=''
399 d_endhent=''
400 d_endhostent_r=''
401 endhostent_r_proto=''
402 d_endnent=''
403 d_endnetent_r=''
404 endnetent_r_proto=''
405 d_endpent=''
406 d_endprotoent_r=''
407 endprotoent_r_proto=''
408 d_endpwent=''
409 d_endpwent_r=''
410 endpwent_r_proto=''
411 d_endsent=''
412 d_endservent_r=''
413 endservent_r_proto=''
414 d_faststdio=''
415 d_fchdir=''
416 d_fchmod=''
417 d_fchown=''
418 d_fcntl=''
419 d_fcntl_can_lock=''
420 d_fd_macros=''
421 d_fd_set=''
422 d_fds_bits=''
423 d_fgetpos=''
424 d_finite=''
425 d_finitel=''
426 d_flexfnam=''
427 d_flock=''
428 d_flockproto=''
429 d_fork=''
430 d_fp_class=''
431 d_fpclass=''
432 d_fpclassify=''
433 d_fpclassl=''
434 d_fpos64_t=''
435 d_frexpl=''
436 d_fs_data_s=''
437 d_fseeko=''
438 d_fsetpos=''
439 d_fstatfs=''
440 d_fsync=''
441 d_ftello=''
442 d_ftime=''
443 d_gettimeod=''
444 d_futimes=''
445 d_Gconvert=''
446 d_getcwd=''
447 d_getespwnam=''
448 d_getfsstat=''
449 d_getgrent=''
450 d_getgrent_r=''
451 getgrent_r_proto=''
452 d_getgrgid_r=''
453 getgrgid_r_proto=''
454 d_getgrnam_r=''
455 getgrnam_r_proto=''
456 d_getgrps=''
457 d_gethbyaddr=''
458 d_gethbyname=''
459 d_gethent=''
460 aphostname=''
461 d_gethname=''
462 d_phostname=''
463 d_uname=''
464 d_gethostbyaddr_r=''
465 gethostbyaddr_r_proto=''
466 d_gethostbyname_r=''
467 gethostbyname_r_proto=''
468 d_gethostent_r=''
469 gethostent_r_proto=''
470 d_gethostprotos=''
471 d_getitimer=''
472 d_getlogin=''
473 d_getlogin_r=''
474 getlogin_r_proto=''
475 d_getmnt=''
476 d_getmntent=''
477 d_getnbyaddr=''
478 d_getnbyname=''
479 d_getnent=''
480 d_getnetbyaddr_r=''
481 getnetbyaddr_r_proto=''
482 d_getnetbyname_r=''
483 getnetbyname_r_proto=''
484 d_getnetent_r=''
485 getnetent_r_proto=''
486 d_getnetprotos=''
487 d_getpagsz=''
488 d_getpent=''
489 d_getpgid=''
490 d_getpgrp2=''
491 d_bsdgetpgrp=''
492 d_getpgrp=''
493 d_getppid=''
494 d_getprior=''
495 d_getpbyname=''
496 d_getpbynumber=''
497 d_getprotobyname_r=''
498 getprotobyname_r_proto=''
499 d_getprotobynumber_r=''
500 getprotobynumber_r_proto=''
501 d_getprotoent_r=''
502 getprotoent_r_proto=''
503 d_getprotoprotos=''
504 d_getprpwnam=''
505 d_getpwent=''
506 d_getpwent_r=''
507 getpwent_r_proto=''
508 d_getpwnam_r=''
509 getpwnam_r_proto=''
510 d_getpwuid_r=''
511 getpwuid_r_proto=''
512 d_getsent=''
513 d_getservbyname_r=''
514 getservbyname_r_proto=''
515 d_getservbyport_r=''
516 getservbyport_r_proto=''
517 d_getservent_r=''
518 getservent_r_proto=''
519 d_getservprotos=''
520 d_getspnam=''
521 d_getspnam_r=''
522 getspnam_r_proto=''
523 d_getsbyname=''
524 d_getsbyport=''
525 d_gmtime_r=''
526 gmtime_r_proto=''
527 d_gnulibc=''
528 gnulibc_version=''
529 d_hasmntopt=''
530 d_htonl=''
531 d_ilogbl=''
532 d_inetaton=''
533 d_int64_t=''
534 d_isascii=''
535 d_isfinite=''
536 d_isinf=''
537 d_isnan=''
538 d_isnanl=''
539 d_killpg=''
540 d_lchown=''
541 d_ldbl_dig=''
542 d_libm_lib_version=''
543 d_link=''
544 d_localtime_r=''
545 localtime_r_proto=''
546 d_locconv=''
547 d_lockf=''
548 d_longdbl=''
549 longdblsize=''
550 d_longlong=''
551 longlongsize=''
552 d_lseekproto=''
553 d_lstat=''
554 d_madvise=''
555 d_malloc_good_size=''
556 d_malloc_size=''
557 d_mblen=''
558 d_mbstowcs=''
559 d_mbtowc=''
560 d_memchr=''
561 d_memcmp=''
562 d_memcpy=''
563 d_memmove=''
564 d_memset=''
565 d_mkdir=''
566 d_mkdtemp=''
567 d_mkfifo=''
568 d_mkstemp=''
569 d_mkstemps=''
570 d_mktime=''
571 d_mmap=''
572 mmaptype=''
573 d_modfl=''
574 d_modfl_pow32_bug=''
575 d_modflproto=''
576 d_mprotect=''
577 d_msg=''
578 d_msgctl=''
579 d_msgget=''
580 d_msghdr_s=''
581 d_msgrcv=''
582 d_msgsnd=''
583 d_msync=''
584 d_munmap=''
585 d_nice=''
586 d_nl_langinfo=''
587 d_off64_t=''
588 d_open3=''
589 d_fpathconf=''
590 d_pathconf=''
591 d_pause=''
592 d_pipe=''
593 d_poll=''
594 d_portable=''
595 d_procselfexe=''
596 procselfexe=''
597 d_old_pthread_create_joinable=''
598 old_pthread_create_joinable=''
599 d_pthread_atfork=''
600 d_pthread_attr_setscope=''
601 d_pthread_yield=''
602 d_sched_yield=''
603 sched_yield=''
604 d_qgcvt=''
605 d_random_r=''
606 random_r_proto=''
607 d_readdir64_r=''
608 readdir64_r_proto=''
609 d_readdir=''
610 d_rewinddir=''
611 d_seekdir=''
612 d_telldir=''
613 d_readdir_r=''
614 readdir_r_proto=''
615 d_readlink=''
616 d_readv=''
617 d_recvmsg=''
618 d_rename=''
619 d_rmdir=''
620 d_safebcpy=''
621 d_safemcpy=''
622 d_sanemcmp=''
623 d_sbrkproto=''
624 d_scalbnl=''
625 d_select=''
626 d_sem=''
627 d_semctl=''
628 d_semget=''
629 d_semop=''
630 d_sendmsg=''
631 d_setegid=''
632 d_seteuid=''
633 d_setgrent=''
634 d_setgrent_r=''
635 setgrent_r_proto=''
636 d_setgrps=''
637 d_sethent=''
638 d_sethostent_r=''
639 sethostent_r_proto=''
640 d_setitimer=''
641 d_setlinebuf=''
642 d_setlocale=''
643 d_setlocale_r=''
644 setlocale_r_proto=''
645 d_setnent=''
646 d_setnetent_r=''
647 setnetent_r_proto=''
648 d_setpent=''
649 d_setpgid=''
650 d_setpgrp2=''
651 d_bsdsetpgrp=''
652 d_setpgrp=''
653 d_setprior=''
654 d_setproctitle=''
655 d_setprotoent_r=''
656 setprotoent_r_proto=''
657 d_setpwent=''
658 d_setpwent_r=''
659 setpwent_r_proto=''
660 d_setregid=''
661 d_setresgid=''
662 d_setresuid=''
663 d_setreuid=''
664 d_setrgid=''
665 d_setruid=''
666 d_setsent=''
667 d_setservent_r=''
668 setservent_r_proto=''
669 d_setsid=''
670 d_setvbuf=''
671 d_sfio=''
672 usesfio=''
673 d_shm=''
674 d_shmat=''
675 d_shmatprototype=''
676 shmattype=''
677 d_shmctl=''
678 d_shmdt=''
679 d_shmget=''
680 d_sigaction=''
681 d_sigprocmask=''
682 d_sigsetjmp=''
683 usesitecustomize=''
684 d_sockatmark=''
685 d_sockatmarkproto=''
686 d_msg_ctrunc=''
687 d_msg_dontroute=''
688 d_msg_oob=''
689 d_msg_peek=''
690 d_msg_proxy=''
691 d_oldsock=''
692 d_scm_rights=''
693 d_socket=''
694 d_sockpair=''
695 sockethdr=''
696 socketlib=''
697 d_socklen_t=''
698 d_socks5_init=''
699 d_sprintf_returns_strlen=''
700 d_sqrtl=''
701 d_srand48_r=''
702 srand48_r_proto=''
703 d_srandom_r=''
704 srandom_r_proto=''
705 d_sresgproto=''
706 d_sresuproto=''
707 d_statblks=''
708 d_statfs_f_flags=''
709 d_statfs_s=''
710 d_fstatvfs=''
711 d_statvfs=''
712 d_stdio_cnt_lval=''
713 d_stdio_ptr_lval=''
714 d_stdio_ptr_lval_nochange_cnt=''
715 d_stdio_ptr_lval_sets_cnt=''
716 d_stdiobase=''
717 d_stdstdio=''
718 stdio_base=''
719 stdio_bufsiz=''
720 stdio_cnt=''
721 stdio_filbuf=''
722 stdio_ptr=''
723 d_index=''
724 d_strchr=''
725 d_strcoll=''
726 d_strctcpy=''
727 d_strerrm=''
728 d_strerror=''
729 d_sysernlst=''
730 d_syserrlst=''
731 d_strerror_r=''
732 strerror_r_proto=''
733 d_strftime=''
734 d_strlcat=''
735 d_strlcpy=''
736 d_strtod=''
737 d_strtol=''
738 d_strtold=''
739 d_strtoll=''
740 d_strtoq=''
741 d_strtoul=''
742 d_strtoull=''
743 d_strtouq=''
744 d_strxfrm=''
745 d_symlink=''
746 d_syscall=''
747 d_syscallproto=''
748 d_sysconf=''
749 d_system=''
750 d_tcgetpgrp=''
751 d_tcsetpgrp=''
752 d_telldirproto=''
753 d_time=''
754 timetype=''
755 clocktype=''
756 d_times=''
757 d_tmpnam_r=''
758 tmpnam_r_proto=''
759 d_truncate=''
760 d_ttyname_r=''
761 ttyname_r_proto=''
762 d_tzname=''
763 d_u32align=''
764 d_ualarm=''
765 d_umask=''
766 d_semctl_semid_ds=''
767 d_semctl_semun=''
768 d_union_semun=''
769 d_unordered=''
770 d_unsetenv=''
771 d_usleep=''
772 d_usleepproto=''
773 d_ustat=''
774 d_vfork=''
775 usevfork=''
776 d_voidsig=''
777 signal_t=''
778 d_volatile=''
779 d_charvspr=''
780 d_vprintf=''
781 d_wait4=''
782 d_waitpid=''
783 d_wcstombs=''
784 d_wctomb=''
785 d_writev=''
786 dlext=''
787 cccdlflags=''
788 ccdlflags=''
789 dlsrc=''
790 ld=''
791 lddlflags=''
792 usedl=''
793 doublesize=''
794 ebcdic=''
795 fflushNULL=''
796 fflushall=''
797 fpossize=''
798 fpostype=''
799 gccansipedantic=''
800 gccosandvers=''
801 gccversion=''
802 gidformat=''
803 gidsign=''
804 gidsize=''
805 gidtype=''
806 groupstype=''
807 h_fcntl=''
808 h_sysfile=''
809 html1dir=''
810 html1direxp=''
811 installhtml1dir=''
812 html3dir=''
813 html3direxp=''
814 installhtml3dir=''
815 i_arpainet=''
816 i_crypt=''
817 db_hashtype=''
818 db_prefixtype=''
819 db_version_major=''
820 db_version_minor=''
821 db_version_patch=''
822 i_db=''
823 i_dbm=''
824 i_rpcsvcdbm=''
825 d_dirnamlen=''
826 direntrytype=''
827 i_dirent=''
828 i_dld=''
829 i_dlfcn=''
830 i_fcntl=''
831 i_float=''
832 i_fp=''
833 i_fp_class=''
834 i_gdbm=''
835 d_grpasswd=''
836 i_grp=''
837 i_ieeefp=''
838 i_inttypes=''
839 i_langinfo=''
840 i_libutil=''
841 i_limits=''
842 i_locale=''
843 i_machcthr=''
844 i_malloc=''
845 i_math=''
846 i_memory=''
847 i_mntent=''
848 i_ndbm=''
849 i_netdb=''
850 i_neterrno=''
851 i_netinettcp=''
852 i_niin=''
853 i_sysin=''
854 i_poll=''
855 i_prot=''
856 i_pthread=''
857 d_pwage=''
858 d_pwchange=''
859 d_pwclass=''
860 d_pwcomment=''
861 d_pwexpire=''
862 d_pwgecos=''
863 d_pwpasswd=''
864 d_pwquota=''
865 i_pwd=''
866 i_sfio=''
867 i_shadow=''
868 i_socks=''
869 i_stddef=''
870 i_stdlib=''
871 i_string=''
872 strings=''
873 i_sunmath=''
874 i_sysaccess=''
875 i_sysdir=''
876 i_sysfile=''
877 d_voidtty=''
878 i_bsdioctl=''
879 i_sysfilio=''
880 i_sysioctl=''
881 i_syssockio=''
882 i_syslog=''
883 i_sysmman=''
884 i_sysmode=''
885 i_sysmount=''
886 i_sysndir=''
887 i_sysparam=''
888 i_sysresrc=''
889 i_syssecrt=''
890 i_sysselct=''
891 i_sysstat=''
892 i_sysstatfs=''
893 i_sysstatvfs=''
894 i_systimes=''
895 i_systypes=''
896 i_sysuio=''
897 i_sysun=''
898 i_sysutsname=''
899 i_sysvfs=''
900 i_syswait=''
901 i_sgtty=''
902 i_termio=''
903 i_termios=''
904 d_tm_tm_gmtoff=''
905 d_tm_tm_zone=''
906 i_systime=''
907 i_systimek=''
908 i_time=''
909 timeincl=''
910 i_unistd=''
911 i_ustat=''
912 i_utime=''
913 i_values=''
914 i_stdarg=''
915 i_varargs=''
916 i_varhdr=''
917 i_vfork=''
918 inc_version_list=''
919 inc_version_list_init=''
920 installprefix=''
921 installprefixexp=''
922 installstyle=''
923 installusrbinperl=''
924 intsize=''
925 longsize=''
926 shortsize=''
927 issymlink=''
928 libc=''
929 ldlibpthname=''
930 libperl=''
931 shrpenv=''
932 useshrplib=''
933 glibpth=''
934 libpth=''
935 loclibpth=''
936 plibpth=''
937 xlibpth=''
938 ignore_versioned_solibs=''
939 libs=''
940 libsdirs=''
941 libsfiles=''
942 libsfound=''
943 libspath=''
944 lns=''
945 d_PRIEUldbl=''
946 d_PRIFUldbl=''
947 d_PRIGUldbl=''
948 d_PRIeldbl=''
949 d_PRIfldbl=''
950 d_PRIgldbl=''
951 d_SCNfldbl=''
952 sPRIEUldbl=''
953 sPRIFUldbl=''
954 sPRIGUldbl=''
955 sPRIeldbl=''
956 sPRIfldbl=''
957 sPRIgldbl=''
958 sSCNfldbl=''
959 lseeksize=''
960 lseektype=''
961 make_set_make=''
962 d_mymalloc=''
963 freetype=''
964 mallocobj=''
965 mallocsrc=''
966 malloctype=''
967 usemallocwrap=''
968 usemymalloc=''
969 installman1dir=''
970 man1dir=''
971 man1direxp=''
972 man1ext=''
973 installman3dir=''
974 man3dir=''
975 man3direxp=''
976 man3ext=''
977 modetype=''
978 multiarch=''
979 mydomain=''
980 myhostname=''
981 phostname=''
982 c=''
983 n=''
984 d_eofnblk=''
985 eagain=''
986 o_nonblock=''
987 rd_nodata=''
988 need_va_copy=''
989 netdb_hlen_type=''
990 netdb_host_type=''
991 netdb_name_type=''
992 netdb_net_type=''
993 groupcat=''
994 hostcat=''
995 passcat=''
996 orderlib=''
997 ranlib=''
998 d_perl_otherlibdirs=''
999 otherlibdirs=''
1000 package=''
1001 spackage=''
1002 pager=''
1003 api_revision=''
1004 api_subversion=''
1005 api_version=''
1006 api_versionstring=''
1007 patchlevel=''
1008 perl_patchlevel=''
1009 revision=''
1010 subversion=''
1011 version=''
1012 version_patchlevel_string=''
1013 perl5=''
1014 perladmin=''
1015 perlpath=''
1016 d_nv_preserves_uv=''
1017 d_nv_zero_is_allbits_zero=''
1018 i16size=''
1019 i16type=''
1020 i32size=''
1021 i32type=''
1022 i64size=''
1023 i64type=''
1024 i8size=''
1025 i8type=''
1026 ivsize=''
1027 ivtype=''
1028 nv_preserves_uv_bits=''
1029 nvsize=''
1030 nvtype=''
1031 u16size=''
1032 u16type=''
1033 u32size=''
1034 u32type=''
1035 u64size=''
1036 u64type=''
1037 u8size=''
1038 u8type=''
1039 uvsize=''
1040 uvtype=''
1041 ivdformat=''
1042 nvEUformat=''
1043 nvFUformat=''
1044 nvGUformat=''
1045 nveformat=''
1046 nvfformat=''
1047 nvgformat=''
1048 uvXUformat=''
1049 uvoformat=''
1050 uvuformat=''
1051 uvxformat=''
1052 pidtype=''
1053 prefix=''
1054 prefixexp=''
1055 installprivlib=''
1056 privlib=''
1057 privlibexp=''
1058 prototype=''
1059 ptrsize=''
1060 d_PRIXU64=''
1061 d_PRId64=''
1062 d_PRIi64=''
1063 d_PRIo64=''
1064 d_PRIu64=''
1065 d_PRIx64=''
1066 sPRIXU64=''
1067 sPRId64=''
1068 sPRIi64=''
1069 sPRIo64=''
1070 sPRIu64=''
1071 sPRIx64=''
1072 d_quad=''
1073 quadkind=''
1074 quadtype=''
1075 uquadtype=''
1076 drand01=''
1077 randbits=''
1078 randfunc=''
1079 randseedtype=''
1080 seedfunc=''
1081 installscript=''
1082 scriptdir=''
1083 scriptdirexp=''
1084 selectminbits=''
1085 selecttype=''
1086 sh=''
1087 sig_count=''
1088 sig_name=''
1089 sig_name_init=''
1090 sig_num=''
1091 sig_num_init=''
1092 sig_size=''
1093 installsitearch=''
1094 sitearch=''
1095 sitearchexp=''
1096 installsitebin=''
1097 sitebin=''
1098 sitebinexp=''
1099 installsitehtml1dir=''
1100 sitehtml1dir=''
1101 sitehtml1direxp=''
1102 installsitehtml3dir=''
1103 sitehtml3dir=''
1104 sitehtml3direxp=''
1105 installsitelib=''
1106 sitelib=''
1107 sitelib_stem=''
1108 sitelibexp=''
1109 installsiteman1dir=''
1110 siteman1dir=''
1111 siteman1direxp=''
1112 installsiteman3dir=''
1113 siteman3dir=''
1114 siteman3direxp=''
1115 siteprefix=''
1116 siteprefixexp=''
1117 installsitescript=''
1118 sitescript=''
1119 sitescriptexp=''
1120 sizesize=''
1121 sizetype=''
1122 so=''
1123 socksizetype=''
1124 sharpbang=''
1125 shsharp=''
1126 spitshell=''
1127 src=''
1128 ssizetype=''
1129 startperl=''
1130 startsh=''
1131 stdchar=''
1132 d_stdio_stream_array=''
1133 stdio_stream_array=''
1134 sysman=''
1135 trnl=''
1136 uidformat=''
1137 uidsign=''
1138 uidsize=''
1139 uidtype=''
1140 archname64=''
1141 use64bitall=''
1142 use64bitint=''
1143 usefaststdio=''
1144 ccflags_uselargefiles=''
1145 ldflags_uselargefiles=''
1146 libswanted_uselargefiles=''
1147 uselargefiles=''
1148 uselongdouble=''
1149 usemorebits=''
1150 usemultiplicity=''
1151 nm_opt=''
1152 nm_so_opt=''
1153 runnm=''
1154 usenm=''
1155 useperlio=''
1156 userelocatableinc=''
1157 usesocks=''
1158 d_oldpthreads=''
1159 use5005threads=''
1160 useithreads=''
1161 usereentrant=''
1162 usethreads=''
1163 incpath=''
1164 mips_type=''
1165 usrinc=''
1166 d_vendorarch=''
1167 installvendorarch=''
1168 vendorarch=''
1169 vendorarchexp=''
1170 d_vendorbin=''
1171 installvendorbin=''
1172 vendorbin=''
1173 vendorbinexp=''
1174 installvendorhtml1dir=''
1175 vendorhtml1dir=''
1176 vendorhtml1direxp=''
1177 installvendorhtml3dir=''
1178 vendorhtml3dir=''
1179 vendorhtml3direxp=''
1180 d_vendorlib=''
1181 installvendorlib=''
1182 vendorlib=''
1183 vendorlib_stem=''
1184 vendorlibexp=''
1185 installvendorman1dir=''
1186 vendorman1dir=''
1187 vendorman1direxp=''
1188 installvendorman3dir=''
1189 vendorman3dir=''
1190 vendorman3direxp=''
1191 usevendorprefix=''
1192 vendorprefix=''
1193 vendorprefixexp=''
1194 d_vendorscript=''
1195 installvendorscript=''
1196 vendorscript=''
1197 vendorscriptexp=''
1198 versiononly=''
1199 defvoidused=''
1200 voidflags=''
1201 yacc=''
1202 yaccflags=''
1203 CONFIG=''
1204
1205 define='define'
1206 undef='undef'
1207 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1208 rmlist=''
1209
1210 : We must find out about Eunice early
1211 eunicefix=':'
1212 if test -f /etc/unixtovms; then
1213         eunicefix=/etc/unixtovms
1214 fi
1215 if test -f /etc/unixtovms.exe; then
1216         eunicefix=/etc/unixtovms.exe
1217 fi
1218
1219 : Set executable suffix now -- needed before hints available
1220 if test -f "/libs/version.library"; then
1221 : Amiga OS
1222     _exe=""
1223 elif test -f "/system/gnu_library/bin/ar.pm"; then
1224 : Stratus VOS
1225     _exe=".pm"
1226 elif test -n "$DJGPP"; then
1227 : DOS DJGPP
1228     _exe=".exe"
1229 elif test -d c:/. -o -n "$is_os2" ; then
1230 : OS/2 or cygwin
1231     _exe=".exe"
1232 fi
1233
1234 i_whoami=''
1235 ccname=''
1236 ccversion=''
1237 perllibs=''
1238 : set useposix=false in your hint file to disable the POSIX extension.
1239 useposix=true
1240 : set useopcode=false in your hint file to disable the Opcode extension.
1241 useopcode=true
1242 : Trailing extension.  Override this in a hint file, if needed.
1243 : Extra object files, if any, needed on this platform.
1244 archobjs=''
1245 archname=''
1246 : Possible local include directories to search.
1247 : Set locincpth to "" in a hint file to defeat local include searches.
1248 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1249 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1250 :
1251 : no include file wanted by default
1252 inclwanted=''
1253
1254 groupstype=''
1255 libnames=''
1256 : change the next line if compiling for Xenix/286 on Xenix/386
1257 xlibpth='/usr/lib/386 /lib/386'
1258 : Possible local library directories to search.
1259 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1260 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1261
1262 : general looking path for locating libraries
1263 glibpth="/lib /usr/lib $xlibpth"
1264 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1265 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1266 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1267
1268 : Private path used by Configure to find libraries.  Its value
1269 : is prepended to libpth. This variable takes care of special
1270 : machines, like the mips.  Usually, it should be empty.
1271 plibpth=''
1272
1273 : default library list
1274 libswanted=''
1275 : some systems want to use only the non-versioned libso:s
1276 ignore_versioned_solibs=''
1277 siteman1dir=''
1278 siteman3dir=''
1279 sitescript=''
1280 archname64=''
1281 ccflags_uselargefiles=''
1282 ldflags_uselargefiles=''
1283 libswanted_uselargefiles=''
1284 : set usemultiplicity on the Configure command line to enable multiplicity.
1285 : set usesocks on the Configure command line to enable socks.
1286 : set usethreads on the Configure command line to enable threads.
1287 usereentrant='undef'
1288 : full support for void wanted by default
1289 defvoidused=15
1290
1291 : List of libraries we want.
1292 : If anyone needs extra -lxxx, put those in a hint file.
1293 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1294 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1295 : We probably want to search /usr/shlib before most other libraries.
1296 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1297 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1298 glibpth="/usr/shlib $glibpth"
1299 : Do not use vfork unless overridden by a hint file.
1300 usevfork=false
1301
1302 : Find the basic shell for Bourne shell scripts
1303 case "$sh" in
1304 '')
1305         case "$SYSTYPE" in
1306         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1307         *) xxx='/bin/sh';;
1308         esac
1309         if test -f "$xxx"; then
1310                 sh="$xxx"
1311         else
1312                 : Build up a list and do a single loop so we can 'break' out.
1313                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1314                 for xxx in sh bash ksh pdksh ash; do
1315                         for p in $pth; do
1316                                 try="$try ${p}/${xxx}"
1317                         done
1318                 done
1319                 for xxx in $try; do
1320                         if test -f "$xxx"; then
1321                                 sh="$xxx";
1322                                 break
1323                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1324                                 sh="$xxx";
1325                                 break
1326                         elif test -f "$xxx.exe"; then
1327                                 sh="$xxx";
1328                                 break
1329                         fi
1330                 done
1331         fi
1332         ;;
1333 esac
1334
1335 case "$sh" in
1336 '')     cat >&2 <<EOM
1337 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1338
1339 Usually it's in /bin/sh.  How did you even get this far?
1340 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1341 we'll try to straighten this all out.
1342 EOM
1343         exit 1
1344         ;;
1345 esac
1346
1347 : see if sh knows # comments
1348 if `$sh -c '#' >/dev/null 2>&1`; then
1349         shsharp=true
1350         spitshell=cat
1351         xcat=/bin/cat
1352         test -f $xcat$_exe || xcat=/usr/bin/cat
1353         if test ! -f $xcat$_exe; then
1354                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1355                         if test -f $p/cat$_exe; then
1356                                 xcat=$p/cat
1357                                 break
1358                         fi
1359                 done
1360                 if test ! -f $xcat$_exe; then
1361                         echo "Can't find cat anywhere!"
1362                         exit 1
1363                 fi
1364         fi
1365         echo "#!$xcat" >sharp
1366         $eunicefix sharp
1367         chmod +x sharp
1368         ./sharp > today
1369         if test -s today; then
1370                 sharpbang='#!'
1371         else
1372                 echo "#! $xcat" > sharp
1373                 $eunicefix sharp
1374                 chmod +x sharp
1375                 ./sharp > today
1376                 if test -s today; then
1377                         sharpbang='#! '
1378                 else
1379                         sharpbang=': use '
1380                 fi
1381         fi
1382 else
1383         echo " "
1384         echo "Your $sh doesn't grok # comments--I will strip them later on."
1385         shsharp=false
1386         cd ..
1387         echo "exec grep -v '^[  ]*#'" >spitshell
1388         chmod +x spitshell
1389         $eunicefix spitshell
1390         spitshell=`pwd`/spitshell
1391         cd UU
1392         echo "I presume that if # doesn't work, #! won't work either!"
1393         sharpbang=': use '
1394 fi
1395 rm -f sharp today
1396
1397 : figure out how to guarantee sh startup
1398 case "$startsh" in
1399 '') startsh=${sharpbang}${sh} ;;
1400 *)
1401 esac
1402 cat >sharp <<EOSS
1403 $startsh
1404 set abc
1405 test "$?abc" != 1
1406 EOSS
1407
1408 chmod +x sharp
1409 $eunicefix sharp
1410 if ./sharp; then
1411         : echo "Yup, it does."
1412 else
1413         echo "Hmm... '$startsh' does not guarantee sh startup..."
1414         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1415 fi
1416 rm -f sharp
1417
1418
1419 : Save command line options in file UU/cmdline.opt for later use in
1420 : generating config.sh.
1421 cat > cmdline.opt <<EOSH
1422 # Configure command line arguments.
1423 config_arg0='$0'
1424 config_args='$*'
1425 config_argc=$#
1426 EOSH
1427 argn=1
1428 args_exp=''
1429 args_sep=''
1430 for arg in "$@"; do
1431         cat >>cmdline.opt <<EOSH
1432 config_arg$argn='$arg'
1433 EOSH
1434         # Extreme backslashitis: replace each ' by '"'"'
1435         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1436 $arg
1437 EOC
1438         arg_exp=`cat cmdl.opt`
1439         args_exp="$args_exp$args_sep'$arg_exp'"
1440         argn=`expr $argn + 1`
1441         args_sep=' '
1442 done
1443 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1444 # used by ./hints/os2.sh
1445 rm -f cmdl.opt
1446
1447 : produce awk script to parse command line options
1448 cat >options.awk <<'EOF'
1449 BEGIN {
1450         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1451
1452         len = length(optstr);
1453         for (i = 1; i <= len; i++) {
1454                 c = substr(optstr, i, 1);
1455                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1456                 if (a == ":") {
1457                         arg[c] = 1;
1458                         i++;
1459                 }
1460                 opt[c] = 1;
1461         }
1462 }
1463 {
1464         expect = 0;
1465         str = $0;
1466         if (substr(str, 1, 1) != "-") {
1467                 printf("'%s'\n", str);
1468                 next;
1469         }
1470         len = length($0);
1471         for (i = 2; i <= len; i++) {
1472                 c = substr(str, i, 1);
1473                 if (!opt[c]) {
1474                         printf("-%s\n", substr(str, i));
1475                         next;
1476                 }
1477                 printf("-%s\n", c);
1478                 if (arg[c]) {
1479                         if (i < len)
1480                                 printf("'%s'\n", substr(str, i + 1));
1481                         else
1482                                 expect = 1;
1483                         next;
1484                 }
1485         }
1486 }
1487 END {
1488         if (expect)
1489                 print "?";
1490 }
1491 EOF
1492
1493 : process the command line options
1494 set X `for arg in "$@"; do echo "X$arg"; done |
1495         sed -e s/X// | awk -f options.awk`
1496 eval "set $*"
1497 shift
1498 rm -f options.awk
1499
1500 : set up default values
1501 fastread=''
1502 reuseval=false
1503 config_sh=''
1504 alldone=''
1505 error=''
1506 silent=''
1507 extractsh=''
1508 override=''
1509 knowitall=''
1510 rm -f optdef.sh posthint.sh
1511 cat >optdef.sh <<EOS
1512 $startsh
1513 EOS
1514
1515
1516 : option parsing
1517 while test $# -gt 0; do
1518         case "$1" in
1519         -d) shift; fastread=yes;;
1520         -e) shift; alldone=cont;;
1521         -f)
1522                 shift
1523                 cd ..
1524                 if test -r "$1"; then
1525                         config_sh="$1"
1526                 else
1527                         echo "$me: cannot read config file $1." >&2
1528                         error=true
1529                 fi
1530                 cd UU
1531                 shift;;
1532         -h) shift; error=true;;
1533         -r) shift; reuseval=true;;
1534         -s) shift; silent=true; realsilent=true;;
1535         -E) shift; alldone=exit;;
1536         -K) shift; knowitall=true;;
1537         -O) shift; override=true;;
1538         -S) shift; silent=true; extractsh=true;;
1539         -D)
1540                 shift
1541                 case "$1" in
1542                 *=)
1543                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1544                         echo "$me: ignoring -D $1" >&2
1545                         ;;
1546                 *=*) echo "$1" | \
1547                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1548                 *) echo "$1='define'" >> optdef.sh;;
1549                 esac
1550                 shift
1551                 ;;
1552         -U)
1553                 shift
1554                 case "$1" in
1555                 *=) echo "$1" >> optdef.sh;;
1556                 *=*)
1557                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1558                         echo "$me: ignoring -U $1" >&2
1559                         ;;
1560                 *) echo "$1='undef'" >> optdef.sh;;
1561                 esac
1562                 shift
1563                 ;;
1564         -A)
1565             shift
1566             xxx=''
1567             yyy="$1"
1568             zzz=''
1569             uuu=undef
1570             case "$yyy" in
1571             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1572                  case "$zzz" in
1573                  *:*) zzz='' ;;
1574                  *)   xxx=append
1575                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1576                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1577                  esac
1578                  ;;
1579             esac
1580             case "$xxx" in
1581             '')  case "$yyy" in
1582                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1583                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1584                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1585                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1586                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1587                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1588                  esac
1589                  ;;       
1590             esac
1591             case "$xxx" in
1592             append)
1593                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1594             clear)
1595                 echo "$yyy=''"                  >> posthint.sh ;;
1596             define)
1597                 case "$zzz" in
1598                 '') zzz=define ;;
1599                 esac
1600                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1601             eval)
1602                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1603             prepend)
1604                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1605             undef)
1606                 case "$zzz" in
1607                 '') zzz="$uuu" ;;
1608                 esac
1609                 echo "$yyy=$zzz"                >> posthint.sh ;;
1610             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1611             esac
1612             shift
1613             ;;
1614         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1615             exit 0;;
1616         --) break;;
1617         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1618         *) break;;
1619         esac
1620 done
1621
1622 case "$error" in
1623 true)
1624         cat >&2 <<EOM
1625 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1626                  [-U symbol] [-U symbol=] [-A command:symbol...]
1627   -d : use defaults for all answers.
1628   -e : go on without questioning past the production of config.sh.
1629   -f : specify an alternate default configuration file.
1630   -h : print this help message and exit (with an error status).
1631   -r : reuse C symbols value if possible (skips costly nm extraction).
1632   -s : silent mode, only echoes questions and essential information.
1633   -D : define symbol to have some value:
1634          -D symbol         symbol gets the value 'define'
1635          -D symbol=value   symbol gets the value 'value'
1636   -E : stop at the end of questions, after having produced config.sh.
1637   -K : do not use unless you know what you are doing.
1638   -O : let -D and -U override definitions from loaded configuration file.
1639   -S : perform variable substitutions on all .SH files (can mix with -f)
1640   -U : undefine symbol:
1641          -U symbol    symbol gets the value 'undef'
1642          -U symbol=   symbol gets completely empty
1643   -A : manipulate symbol after the platform specific hints have been applied:
1644          -A symbol=value                append " "value to symbol
1645          -A append:symbol=value         append value to symbol
1646          -A define:symbol=value         define symbol to have value
1647          -A clear:symbol                define symbol to be ''
1648          -A define:symbol               define symbol to be 'define'
1649          -A eval:symbol=value           define symbol to be eval of value
1650          -A prepend:symbol=value        prepend value to symbol
1651          -A undef:symbol                define symbol to be 'undef'
1652          -A undef:symbol=               define symbol to be ''
1653   -V : print version number and exit (with a zero status).
1654 EOM
1655         exit 1
1656         ;;
1657 esac
1658
1659 : Sanity checks
1660 case "$fastread$alldone" in
1661 yescont|yesexit) ;;
1662 *)
1663         case "$extractsh" in
1664         true) ;;
1665         *)
1666                 if test ! -t 0; then
1667                         echo "Say 'sh Configure', not 'sh <Configure'"
1668                         exit 1
1669                 fi
1670                 ;;
1671         esac
1672         ;;
1673 esac
1674
1675 exec 4>&1
1676 case "$silent" in
1677 true) exec 1>/dev/null;;
1678 esac
1679
1680 : run the defines and the undefines, if any, but leave the file out there...
1681 touch optdef.sh
1682 . ./optdef.sh
1683 : create the posthint manipulation script and leave the file out there...
1684 touch posthint.sh
1685
1686 : set package name
1687 package=perl5
1688 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1689 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1690 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1691 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1692 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1693 esac
1694
1695 : Some greps do not return status, grrr.
1696 echo "grimblepritz" >grimble
1697 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1698         contains=contains
1699 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1700         contains=grep
1701 else
1702         contains=contains
1703 fi
1704 rm -f grimble
1705 : the following should work in any shell
1706 case "$contains" in
1707 contains*)
1708         echo " "
1709         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1710         cat >contains <<'EOSS'
1711 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1712 EOSS
1713 chmod +x contains
1714 esac
1715
1716 : Find the path to the source tree
1717 case "$src" in
1718 '') case "$0" in
1719     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1720          case "$src" in
1721          /*)    ;;
1722          .)     ;;
1723          *)     src=`cd ../$src && pwd` ;;
1724          esac
1725          ;;
1726     *)   src='.';;
1727     esac;;
1728 esac
1729 case "$src" in
1730 '')     src=/
1731         rsrc=/
1732         ;;
1733 /*) rsrc="$src";;
1734 *) rsrc="../$src";;
1735 esac
1736 if test -f $rsrc/Configure && \
1737         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1738 then
1739    : found it, so we are ok.
1740 else
1741         rsrc=''
1742         for src in . .. ../.. ../../.. ../../../..; do
1743                 if test -f ../$src/Configure && \
1744                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1745                 then
1746                         rsrc=../$src
1747                         break
1748                 fi
1749         done
1750 fi
1751 case "$rsrc" in
1752 '')
1753         cat <<EOM >&4
1754
1755 Sorry, I can't seem to locate the source dir for $package.  Please start
1756 Configure with an explicit path -- i.e. /some/path/Configure.
1757
1758 EOM
1759         exit 1
1760         ;;
1761 ../.)   rsrc='..';;
1762 *)
1763         echo " "
1764         echo "Sources for $package found in \"$src\"." >&4
1765         ;;
1766 esac
1767
1768 : script used to extract .SH files with variable substitutions
1769 cat >extract <<'EOS'
1770 PERL_CONFIG_SH=true
1771 echo "Doing variable substitutions on .SH files..."
1772 if test -f MANIFEST; then
1773         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1774 else
1775         echo "(Looking for .SH files under the source directory.)"
1776         set x `(cd "$src"; find . -name "*.SH" -print)`
1777 fi
1778 shift
1779 case $# in
1780 0) set x `(cd "$src"; echo *.SH)`; shift;;
1781 esac
1782 if test ! -f "$src/$1"; then
1783         shift
1784 fi
1785 mkdir_p='
1786 name=$1;
1787 create="";
1788 while test $name; do
1789         if test ! -d "$name"; then
1790                 create="$name $create";
1791                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1792                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1793         else
1794                 name="";
1795         fi;
1796 done;
1797 for file in $create; do
1798         mkdir $file;
1799 done
1800 '
1801 for file in $*; do
1802         case "$src" in
1803         ".")
1804                 case "$file" in
1805                 */*)
1806                         dir=`expr X$file : 'X\(.*\)/'`
1807                         file=`expr X$file : 'X.*/\(.*\)'`
1808                         (cd "$dir" && . ./$file)
1809                         ;;
1810                 *)
1811                         . ./$file
1812                         ;;
1813                 esac
1814                 ;;
1815         *)
1816                 case "$file" in
1817                 */*)
1818                         dir=`expr X$file : 'X\(.*\)/'`
1819                         file=`expr X$file : 'X.*/\(.*\)'`
1820                         (set x $dir; shift; eval $mkdir_p)
1821                         sh <"$src/$dir/$file"
1822                         ;;
1823                 *)
1824                         sh <"$src/$file"
1825                         ;;
1826                 esac
1827                 ;;
1828         esac
1829 done
1830 if test -f "$src/config_h.SH"; then
1831         if test ! -f config.h; then
1832         : oops, they left it out of MANIFEST, probably, so do it anyway.
1833         . "$src/config_h.SH"
1834         fi
1835 fi
1836 EOS
1837
1838 : extract files and exit if asked to do so
1839 case "$extractsh" in
1840 true)
1841         case "$realsilent" in
1842         true) ;;
1843         *) exec 1>&4;;
1844         esac
1845         case "$config_sh" in
1846         '') config_sh='config.sh';;
1847         esac
1848         echo " "
1849         echo "Fetching answers from $config_sh..."
1850         cd ..
1851         . $config_sh
1852         test "$override" && . ./optdef.sh
1853         echo " "
1854         . UU/extract
1855         rm -rf UU
1856         echo "Extraction done."
1857         exit 0
1858         ;;
1859 esac
1860
1861 : Eunice requires " " instead of "", can you believe it
1862 echo " "
1863 : Here we go...
1864 echo "Beginning of configuration questions for $package."
1865
1866 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1867
1868 : first determine how to suppress newline on echo command
1869 echo " "
1870 echo "Checking echo to see how to suppress newlines..."
1871 (echo "hi there\c" ; echo " ") >.echotmp
1872 if $contains c .echotmp >/dev/null 2>&1 ; then
1873         echo "...using -n."
1874         n='-n'
1875         c=''
1876 else
1877         cat <<'EOM'
1878 ...using \c
1879 EOM
1880         n=''
1881         c='\c'
1882 fi
1883 echo $n "The star should be here-->$c"
1884 echo '*'
1885 rm -f .echotmp
1886
1887 : Now test for existence of everything in MANIFEST
1888 echo " "
1889 if test -f "$rsrc/MANIFEST"; then
1890         echo "First let's make sure your kit is complete.  Checking..." >&4
1891         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1892         rm -f missing
1893         tmppwd=`pwd`
1894         for filelist in x??; do
1895                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1896         done
1897         if test -s missing; then
1898                 cat missing >&4
1899                 cat >&4 <<'EOM'
1900
1901 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1902
1903 You have the option of continuing the configuration process, despite the
1904 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1905 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1906 and contact the author (perlbug@perl.org).
1907
1908 EOM
1909                 echo $n "Continue? [n] $c" >&4
1910                 read ans
1911                 case "$ans" in
1912                 y*)
1913                         echo "Continuing..." >&4
1914                         rm -f missing
1915                         ;;
1916                 *)
1917                         echo "ABORTING..." >&4
1918                         kill $$
1919                         ;;
1920                 esac
1921         else
1922                 echo "Looks good..."
1923         fi
1924 else
1925         echo "There is no MANIFEST file.  I hope your kit is complete !"
1926 fi
1927 rm -f missing x??
1928
1929 echo " "
1930 : Find the appropriate value for a newline for tr
1931 if test -n "$DJGPP"; then
1932        trnl='\012'
1933 fi
1934 if test X"$trnl" = X; then
1935         case "`echo foo|tr '\n' x 2>/dev/null`" in
1936         foox) trnl='\n' ;;
1937         esac
1938 fi
1939 if test X"$trnl" = X; then
1940         case "`echo foo|tr '\012' x 2>/dev/null`" in
1941         foox) trnl='\012' ;;
1942         esac
1943 fi
1944 if test X"$trnl" = X; then
1945        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1946        fooxy) trnl='\n\r' ;;
1947        esac
1948 fi
1949 if test X"$trnl" = X; then
1950         cat <<EOM >&2
1951
1952 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1953
1954 EOM
1955         exit 1
1956 fi
1957
1958 : compute the number of columns on the terminal for proper question formatting
1959 case "$COLUMNS" in
1960 '') COLUMNS='80';;
1961 esac
1962
1963 : set up the echo used in my read
1964 myecho="case \"\$xxxm\" in
1965 '') echo $n \"\$rp $c\" >&4;;
1966 *) case \"\$rp\" in
1967         '') echo $n \"[\$xxxm] $c\";;
1968         *)
1969                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1970                         echo \"\$rp\" >&4
1971                         echo $n \"[\$xxxm] $c\" >&4
1972                 else
1973                         echo $n \"\$rp [\$xxxm] $c\" >&4
1974                 fi
1975                 ;;
1976         esac;;
1977 esac"
1978
1979 : now set up to do reads with possible shell escape and default assignment
1980 cat <<EOSC >myread
1981 $startsh
1982 xxxm=\$dflt
1983 $myecho
1984 ans='!'
1985 case "\$fastread" in
1986 yes) case "\$dflt" in
1987         '') ;;
1988         *) ans='';
1989                 case "\$silent-\$rp" in
1990                 true-) ;;
1991                 *) echo " " >&4;;
1992                 esac;;
1993         esac;;
1994 *) case "\$silent" in
1995         true) case "\$rp" in
1996                 '') ans='';;
1997                 esac;;
1998         esac;;
1999 esac
2000 while expr "X\$ans" : "X!" >/dev/null; do
2001         read answ
2002         set x \$xxxm
2003         shift
2004         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2005         case  "\$answ" in
2006         "!")
2007                 sh 1>&4
2008                 echo " "
2009                 $myecho
2010                 ;;
2011         !*)
2012                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2013                 shift
2014                 sh 1>&4 -c "\$*"
2015                 echo " "
2016                 $myecho
2017                 ;;
2018         "\$ans")
2019                 case "\$ans" in
2020                 \\&*)
2021                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2022                         shift
2023                         case "\$1" in
2024                         -d)
2025                                 fastread=yes
2026                                 echo "(OK, I'll run with -d after this question.)" >&4
2027                                 ;;
2028                         -*)
2029                                 echo "*** Sorry, \$1 not supported yet." >&4
2030                                 ;;
2031                         esac
2032                         $myecho
2033                         ans=!
2034                         ;;
2035                 esac;;
2036         *)
2037                 case "\$aok" in
2038                 y)
2039                         echo "*** Substitution done -- please confirm."
2040                         xxxm="\$ans"
2041                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2042                         xxxm="\$ans"
2043                         ans=!
2044                         ;;
2045                 *)
2046                         echo "*** Error -- try again."
2047                         ans=!
2048                         ;;
2049                 esac
2050                 $myecho
2051                 ;;
2052         esac
2053         case "\$ans\$xxxm\$nostick" in
2054         '')
2055                 ans=!
2056                 $myecho
2057                 ;;
2058         esac
2059 done
2060 case "\$ans" in
2061 '') ans="\$xxxm";;
2062 esac
2063 EOSC
2064
2065 : create .config dir to save info across Configure sessions
2066 test -d ../.config || mkdir ../.config
2067 cat >../.config/README <<EOF
2068 This directory created by Configure to save information that should
2069 persist across sessions for $package.
2070
2071 You may safely delete it if you wish.
2072 EOF
2073
2074 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2075 case "$usedevel" in
2076 $define|true|[yY]*) ;;
2077 *) case "$xversion" in
2078    *[13579])
2079         cat >&4 <<EOH
2080 *** WHOA THERE!!! ***
2081
2082     This is an UNSTABLE DEVELOPMENT release.
2083     The version of this $package distribution is $xversion, that is, odd,
2084     (as opposed to even) and that signifies a development release.
2085     If you want a maintenance release, you want an even-numbered version.
2086
2087     Do ***NOT*** install this into production use.
2088     Data corruption and crashes are possible.
2089
2090     It is most seriously suggested that you do not continue any further
2091     unless you want to help in developing and debugging Perl.
2092
2093     If you *still* want to build perl, you can answer 'y' now,
2094     or pass -Dusedevel to Configure.
2095
2096 EOH
2097         rp='Do you really want to continue?'
2098         dflt='n'
2099         . ./myread
2100         case "$ans" in
2101         [yY]) echo >&4 "Okay, continuing."
2102               usedevel="$define" ;;
2103         *) echo >&4 "Okay, bye."
2104            exit 1
2105            ;;
2106         esac
2107         ;;
2108     esac
2109     ;;
2110 esac
2111 case "$usedevel" in
2112 $define|true|[yY]*)
2113         case "$versiononly" in
2114         '') versiononly="$define" ;;
2115         esac
2116         case "$installusrbinperl" in
2117         '') installusrbinperl="$undef" ;;
2118         esac
2119         ;;
2120 esac
2121
2122 : general instructions
2123 needman=true
2124 firsttime=true
2125 user=`(logname) 2>/dev/null`
2126 case "$user" in
2127 '') user=`whoami 2>&1`;;
2128 esac
2129 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2130         firsttime=false
2131         echo " "
2132         rp='Would you like to see the instructions?'
2133         dflt=n
2134         . ./myread
2135         case "$ans" in
2136         [yY]*) ;;
2137         *) needman=false;;
2138         esac
2139 fi
2140 if $needman; then
2141         cat <<EOH
2142
2143 This installation shell script will examine your system and ask you questions
2144 to determine how the perl5 package should be installed. If you get
2145 stuck on a question, you may use a ! shell escape to start a subshell or
2146 execute a command.  Many of the questions will have default answers in square
2147 brackets; typing carriage return will give you the default.
2148
2149 On some of the questions which ask for file or directory names you are allowed
2150 to use the ~name construct to specify the login directory belonging to "name",
2151 even if you don't have a shell which knows about that.  Questions where this is
2152 allowed will be marked "(~name ok)".
2153
2154 EOH
2155         rp=''
2156         dflt='Type carriage return to continue'
2157         . ./myread
2158         cat <<'EOH'
2159
2160 The prompter used in this script allows you to use shell variables and
2161 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2162 in the default answer, as if the default line was a set of arguments given to a
2163 script shell.  This means you may also use $* to repeat the whole default line,
2164 so you do not have to re-type everything to add something to the default.
2165
2166 Everytime there is a substitution, you will have to confirm.  If there is an
2167 error (e.g. an unmatched backtick), the default answer will remain unchanged
2168 and you will be prompted again.
2169
2170 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2171 the questions and use the computed defaults (or the previous answers if there
2172 was already a config.sh file). Type 'Configure -h' for a list of options.
2173 You may also start interactively and then answer '& -d' at any prompt to turn
2174 on the non-interactive behaviour for the remainder of the execution.
2175
2176 EOH
2177         . ./myread
2178         cat <<EOH
2179
2180 Much effort has been expended to ensure that this shell script will run on any
2181 Unix system.  If despite that it blows up on yours, your best bet is to edit
2182 Configure and run it again.  If you can't run Configure for some reason,
2183 you'll have to generate a config.sh file by hand.  Whatever problems you
2184 have, let me (perlbug@perl.org) know how I blew it.
2185
2186 This installation script affects things in two ways:
2187
2188 1) it may do direct variable substitutions on some of the files included
2189    in this kit.
2190 2) it builds a config.h file for inclusion in C programs.  You may edit
2191    any of these files as the need arises after running this script.
2192
2193 If you make a mistake on a question, there is no easy way to back up to it
2194 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2195 files.  Configure will offer to let you do this before it runs the SH files.
2196
2197 EOH
2198         dflt='Type carriage return to continue'
2199         . ./myread
2200         case "$firsttime" in
2201         true) echo $user >>../.config/instruct;;
2202         esac
2203 fi
2204
2205 : find out where common programs are
2206 echo " "
2207 echo "Locating common programs..." >&4
2208 cat <<EOSC >loc
2209 $startsh
2210 case \$# in
2211 0) exit 1;;
2212 esac
2213 thing=\$1
2214 shift
2215 dflt=\$1
2216 shift
2217 for dir in \$*; do
2218         case "\$thing" in
2219         .)
2220         if test -d \$dir/\$thing; then
2221                 echo \$dir
2222                 exit 0
2223         fi
2224         ;;
2225         *)
2226         for thisthing in \$dir/\$thing; do
2227                 : just loop through to pick last item
2228         done
2229         if test -f \$thisthing; then
2230                 echo \$thisthing
2231                 exit 0
2232         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2233                 echo \$thisthing
2234                 exit 0
2235         elif test -f \$dir/\$thing.exe; then
2236                 if test -n "$DJGPP"; then
2237                         echo \$dir/\$thing.exe
2238                 elif test "$eunicefix" != ":"; then
2239                         : on Eunice apparently
2240                         echo \$dir/\$thing
2241                         exit 0
2242                 fi
2243                 exit 0
2244         fi
2245         ;;
2246         esac
2247 done
2248 echo \$dflt
2249 exit 1
2250 EOSC
2251 chmod +x loc
2252 $eunicefix loc
2253 loclist="
2254 awk
2255 cat
2256 chmod
2257 comm
2258 cp
2259 echo
2260 expr
2261 grep
2262 ls
2263 mkdir
2264 rm
2265 sed
2266 sort
2267 touch
2268 tr
2269 uniq
2270 "
2271 trylist="
2272 Mcc
2273 ar
2274 bison
2275 byacc
2276 cpp
2277 csh
2278 date
2279 egrep
2280 gmake
2281 gzip
2282 less
2283 ln
2284 make
2285 more
2286 nm
2287 nroff
2288 pg
2289 test
2290 uname
2291 zip
2292 "
2293 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2294 pth="$pth /lib /usr/lib"
2295 for file in $loclist; do
2296         eval xxx=\$$file
2297         case "$xxx" in
2298         /*|?:[\\/]*)
2299                 if test -f "$xxx"; then
2300                         : ok
2301                 else
2302                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2303                         xxx=`./loc $file $file $pth`
2304                 fi
2305                 ;;
2306         '') xxx=`./loc $file $file $pth`;;
2307         *) xxx=`./loc $xxx $xxx $pth`;;
2308         esac
2309         eval $file=$xxx$_exe
2310         eval _$file=$xxx
2311         case "$xxx" in
2312         /*)
2313                 echo $file is in $xxx.
2314                 ;;
2315         ?:[\\/]*)
2316                 echo $file is in $xxx.
2317                 ;;
2318         *)
2319                 echo "I don't know where '$file' is, and my life depends on it." >&4
2320                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2321                 exit 1
2322                 ;;
2323         esac
2324 done
2325 echo " "
2326 echo "Don't worry if any of the following aren't found..."
2327 say=offhand
2328 for file in $trylist; do
2329         eval xxx=\$$file
2330         case "$xxx" in
2331         /*|?:[\\/]*)
2332                 if test -f "$xxx"; then
2333                         : ok
2334                 else
2335                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2336                         xxx=`./loc $file $file $pth`
2337                 fi
2338                 ;;
2339         '') xxx=`./loc $file $file $pth`;;
2340         *) xxx=`./loc $xxx $xxx $pth`;;
2341         esac
2342         eval $file=$xxx$_exe
2343         eval _$file=$xxx
2344         case "$xxx" in
2345         /*)
2346                 echo $file is in $xxx.
2347                 ;;
2348         ?:[\\/]*)
2349                 echo $file is in $xxx.
2350                 ;;
2351         *)
2352                 echo "I don't see $file out there, $say."
2353                 say=either
2354                 ;;
2355         esac
2356 done
2357 case "$egrep" in
2358 egrep)
2359         echo "Substituting grep for egrep."
2360         egrep=$grep
2361         _egrep=$grep
2362         ;;
2363 esac
2364 case "$ln" in
2365 ln)
2366         echo "Substituting cp for ln."
2367         ln=$cp
2368         _ln=$cp
2369         ;;
2370 esac
2371 case "$make" in
2372 make)   
2373         case "$gmake" in
2374         gmake)
2375         echo "I can't find make or gmake, and my life depends on it." >&4
2376         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2377         exit 1
2378         ;;
2379         esac
2380         ;;
2381 esac    
2382 case "$gmake" in
2383 gmake)  ;;
2384 *)      # We can't have osname yet.
2385         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2386                 # Assume that gmake, if found, is definitely GNU make
2387                 # and prefer it over the system make.
2388                 echo "Substituting gmake for make."
2389                 make=$gmake
2390                 _make=$gmake
2391         fi
2392         ;;
2393 esac
2394 case "$test" in
2395 test)
2396         echo "Hopefully test is built into your sh."
2397         ;;
2398 *)
2399         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2400                 echo "Using the test built into your sh."
2401                 test=test
2402                 _test=test
2403         fi
2404         ;;
2405 esac
2406 case "$echo" in
2407 echo)
2408         echo "Hopefully echo is built into your sh."
2409         ;;
2410 '') ;;
2411 *)
2412         echo " "
2413 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2414         $echo $n "hi there$c" >foo1
2415         echo $n "hi there$c" >foo2
2416         if cmp foo1 foo2 >/dev/null 2>&1; then
2417                 echo "They are compatible.  In fact, they may be identical."
2418         else
2419                 case "$n" in
2420                 '-n') n='' c='\c';;
2421                 *) n='-n' c='';;
2422                 esac
2423                 cat <<FOO
2424 They are not compatible!  You are probably running ksh on a non-USG system.
2425 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2426 have echo built in and we may have to run some Bourne shell scripts.  That
2427 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2428
2429 FOO
2430                 $echo $n "The star should be here-->$c"
2431                 $echo "*"
2432         fi
2433         $rm -f foo1 foo2
2434         ;;
2435 esac
2436
2437 cat <<EOS >trygcc
2438 $startsh
2439 EOS
2440 cat <<'EOSC' >>trygcc
2441 case "$cc" in
2442 '') ;;
2443 *)  $rm -f try try.*
2444     $cat >try.c <<EOM
2445 int main(int argc, char *argv[]) {
2446   return 0;
2447 }
2448 EOM
2449     if $cc -o try $ccflags $ldflags try.c; then
2450        :
2451     else
2452         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2453         despair=yes
2454         trygcc=yes
2455         case "$cc" in
2456         *gcc*) trygcc=no ;;
2457         esac
2458         case "`$cc -v -c try.c 2>&1`" in
2459         *gcc*) trygcc=no ;;
2460         esac
2461         if $test X"$trygcc" = Xyes; then
2462             if gcc -o try -c try.c; then
2463                 echo " "
2464                 echo "You seem to have a working gcc, though." >&4
2465                 rp="Would you like to use it?"
2466                 dflt=y
2467                 if $test -f myread; then
2468                     . ./myread
2469                 else
2470                     if $test -f UU/myread; then
2471                         . ./UU/myread
2472                     else
2473                         echo "Cannot find myread, sorry.  Aborting." >&2
2474                         exit 1
2475                     fi
2476                 fi  
2477                 case "$ans" in
2478                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2479                        if $test -f usethreads.cbu; then
2480                            $cat >&4 <<EOM 
2481
2482 *** However, any setting of the C compiler flags (e.g. for thread support)
2483 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2484 *** (together with e.g. -Dusethreads).
2485
2486 EOM
2487                        fi;;
2488                 esac
2489             fi
2490         fi
2491     fi
2492     $rm -f try try.*
2493     ;;
2494 esac
2495 EOSC
2496
2497 cat <<EOS >checkcc
2498 $startsh
2499 EOS
2500 cat <<'EOSC' >>checkcc
2501 case "$cc" in        
2502 '') ;;
2503 *)  $rm -f try try.*              
2504     $cat >try.c <<EOM
2505 int main(int argc, char *argv[]) {
2506   return 0;
2507 }
2508 EOM
2509     if $cc -o try $ccflags $ldflags try.c; then
2510        :
2511     else
2512         if $test X"$despair" = Xyes; then
2513            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2514         fi
2515         $cat >&4 <<EOM         
2516 You need to find a working C compiler.
2517 Either (purchase and) install the C compiler supplied by your OS vendor,
2518 or for a free C compiler try http://gcc.gnu.org/
2519 I cannot continue any further, aborting.
2520 EOM
2521         exit 1
2522     fi
2523     $rm -f try try.*
2524     ;;
2525 esac
2526 EOSC
2527
2528 : determine whether symbolic links are supported
2529 echo " "
2530 $touch blurfl
2531 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2532         echo "Symbolic links are supported." >&4
2533         lns="$ln -s"
2534 else
2535         echo "Symbolic links are NOT supported." >&4
2536         lns="$ln"
2537 fi
2538 $rm -f blurfl sym
2539
2540 : determine whether symbolic links are supported
2541 echo " "
2542 case "$lns" in
2543 *"ln"*" -s")
2544         echo "Checking how to test for symbolic links..." >&4
2545         $lns blurfl sym
2546         if $test "X$issymlink" = X; then
2547                 case "$newsh" in
2548                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2549                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2550                 esac
2551                 if test $? = 0; then
2552                         issymlink="test -h"
2553                 else
2554                         echo "Your builtin 'test -h' may be broken." >&4
2555                         case "$test" in
2556                         /*)     ;;
2557                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2558                                 for p in $pth
2559                                 do
2560                                         if test -f "$p/$test"; then
2561                                                 test="$p/$test"
2562                                                 break
2563                                         fi
2564                                 done
2565                                 ;;
2566                         esac
2567                         case "$test" in
2568                         /*)
2569                                 echo "Trying external '$test -h'." >&4
2570                                 issymlink="$test -h"
2571                                 if $test ! -h sym >/dev/null 2>&1; then
2572                                         echo "External '$test -h' is broken, too." >&4
2573                                         issymlink=''
2574                                 fi
2575                                 ;;
2576                         *)      issymlink='' ;;
2577                         esac
2578                 fi              
2579         fi
2580         if $test "X$issymlink" = X; then
2581                 if $test -L sym 2>/dev/null; then
2582                         issymlink="$test -L"
2583                         echo "The builtin '$test -L' worked." >&4
2584                 fi
2585         fi
2586         if $test "X$issymlink" != X; then
2587                 echo "You can test for symbolic links with '$issymlink'." >&4
2588         else
2589                 echo "I do not know how you can test for symbolic links." >&4
2590         fi
2591         $rm -f blurfl sym
2592         ;;
2593 *)      echo "No symbolic links, so not testing for their testing..." >&4
2594         ;;
2595 esac
2596 echo " "
2597
2598
2599 case "$mksymlinks" in
2600 $define|true|[yY]*)
2601         case "$src" in
2602         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2603                 exit 1
2604                 ;;
2605         *)      case "$lns:$issymlink" in
2606                 *"ln"*" -s:"*"test -"?)
2607                         echo "Creating the symbolic links..." >&4
2608                         echo "(First creating the subdirectories...)" >&4
2609                         cd ..
2610                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2611                                 read directory
2612                                 test -z "$directory" && break
2613                                 mkdir -p $directory
2614                         done
2615                         # Sanity check 1.
2616                         if test ! -d t/base; then
2617                                 echo "Failed to create the subdirectories.  Aborting." >&4
2618                                 exit 1
2619                         fi
2620                         echo "(Then creating the symlinks...)" >&4
2621                         awk '{print $1}' $src/MANIFEST | while true; do
2622                                 read filename
2623                                 test -z "$filename" && break
2624                                 if test -f $filename; then
2625                                         if $issymlink $filename; then
2626                                                 rm -f $filename
2627                                         fi
2628                                 fi
2629                                 if test -f $filename; then
2630                                         echo "$filename already exists, not symlinking."
2631                                 else
2632                                         ln -s $src/$filename $filename
2633                                 fi
2634                         done
2635                         # Sanity check 2.
2636                         if test ! -f t/base/lex.t; then
2637                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2638                                 exit 1
2639                         fi
2640                         cd UU
2641                         ;;
2642                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2643                         ;;
2644                 esac
2645                 ;;
2646         esac
2647         ;;
2648 esac
2649
2650
2651 case "$usecrosscompile" in
2652 $define|true|[yY]*)
2653         $echo "Cross-compiling..."
2654         croak=''
2655         case "$cc" in
2656         *-*-gcc) # A cross-compiling gcc, probably.
2657             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2658             ar=$targetarch-ar
2659             # leave out ld, choosing it is more complex
2660             nm=$targetarch-nm
2661             ranlib=$targetarch-ranlib
2662             $echo 'extern int foo;' > try.c
2663             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2664             shift
2665             if $test $# -gt 0; then
2666                 incpth="$incpth $*"
2667                 incpth="`$echo $incpth|$sed 's/^ //'`"
2668                 echo "Guessing incpth '$incpth'." >&4
2669                 for i in $*; do
2670                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2671                     if $test -d $j; then
2672                         libpth="$libpth $j"
2673                     fi
2674                 done   
2675                 libpth="`$echo $libpth|$sed 's/^ //'`"
2676                 echo "Guessing libpth '$libpth'." >&4
2677             fi
2678             $rm -f try.c
2679             ;;
2680         esac
2681         case "$targetarch" in
2682         '') echo "Targetarch not defined." >&4; croak=y ;;
2683         *)  echo "Using targetarch $targetarch." >&4 ;;
2684         esac
2685         case "$incpth" in
2686         '') echo "Incpth not defined." >&4; croak=y ;;
2687         *)  echo "Using incpth '$incpth'." >&4 ;;
2688         esac
2689         case "$libpth" in
2690         '') echo "Libpth not defined." >&4; croak=y ;;
2691         *)  echo "Using libpth '$libpth'." >&4 ;;
2692         esac
2693         case "$usrinc" in
2694         '') for i in $incpth; do
2695                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2696                     usrinc=$i
2697                     echo "Guessing usrinc $usrinc." >&4
2698                     break
2699                 fi
2700             done
2701             case "$usrinc" in
2702             '') echo "Usrinc not defined." >&4; croak=y ;;
2703             esac
2704             ;;
2705         *)  echo "Using usrinc $usrinc." >&4 ;;
2706         esac
2707         case "$targethost" in
2708         '') echo "Targethost not defined." >&4; croak=y ;;
2709         *)  echo "Using targethost $targethost." >&4
2710         esac
2711         locincpth=' '
2712         loclibpth=' '
2713         case "$croak" in
2714         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2715         esac
2716         case "$src" in
2717         /*) run=$src/Cross/run
2718             targetmkdir=$src/Cross/mkdir
2719             to=$src/Cross/to
2720             from=$src/Cross/from
2721             ;;
2722         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2723             run=$pwd/Cross/run
2724             targetmkdir=$pwd/Cross/mkdir
2725             to=$pwd/Cross/to
2726             from=$pwd/Cross/from
2727             ;;
2728         esac
2729         case "$targetrun" in
2730         '') targetrun=ssh ;;
2731         esac
2732         case "$targetto" in
2733         '') targetto=scp ;;
2734         esac
2735         case "$targetfrom" in
2736         '') targetfrom=scp ;;
2737         esac
2738         run=$run-$targetrun
2739         to=$to-$targetto
2740         from=$from-$targetfrom
2741         case "$targetdir" in
2742         '')  targetdir=/tmp
2743              echo "Guessing targetdir $targetdir." >&4
2744              ;;
2745         esac
2746         case "$targetuser" in
2747         '')  targetuser=root
2748              echo "Guessing targetuser $targetuser." >&4
2749              ;;
2750         esac
2751         case "$targetfrom" in
2752         scp)    q=-q ;;
2753         *)      q='' ;;
2754         esac
2755         case "$targetrun" in
2756         ssh|rsh)
2757             cat >$run <<EOF
2758 #!/bin/sh
2759 case "\$1" in
2760 -cwd)
2761   shift
2762   cwd=\$1
2763   shift
2764   ;;
2765 esac
2766 case "\$cwd" in
2767 '') cwd=$targetdir ;;
2768 esac
2769 exe=\$1
2770 shift
2771 if $test ! -f \$exe.xok; then
2772   $to \$exe
2773   $touch \$exe.xok
2774 fi
2775 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2776 EOF
2777             ;;
2778         *)  echo "Unknown targetrun '$targetrun'" >&4
2779             exit 1
2780             ;;
2781         esac
2782         case "$targetmkdir" in
2783         */Cross/mkdir)
2784             cat >$targetmkdir <<EOF
2785 #!/bin/sh
2786 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2787 EOF
2788             $chmod a+rx $targetmkdir
2789             ;;
2790         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2791             exit 1
2792             ;;
2793         esac
2794         case "$targetto" in
2795         scp|rcp)
2796             cat >$to <<EOF
2797 #!/bin/sh
2798 for f in \$@
2799 do
2800   case "\$f" in
2801   /*)
2802     $targetmkdir \`dirname \$f\`
2803     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2804     ;;
2805   *)
2806     $targetmkdir $targetdir/\`dirname \$f\`
2807     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2808     ;;
2809   esac
2810 done
2811 exit 0
2812 EOF
2813             ;;
2814         cp) cat >$to <<EOF
2815 #!/bin/sh
2816 for f in \$@
2817 do
2818   case "\$f" in
2819   /*)
2820     $mkdir -p $targetdir/\`dirname \$f\`
2821     $cp \$f $targetdir/\$f || exit 1
2822     ;;
2823   *)
2824     $targetmkdir $targetdir/\`dirname \$f\`
2825     $cp \$f $targetdir/\$f || exit 1
2826     ;;
2827   esac
2828 done
2829 exit 0
2830 EOF
2831             ;;
2832         *)  echo "Unknown targetto '$targetto'" >&4
2833             exit 1
2834             ;;
2835         esac
2836         case "$targetfrom" in
2837         scp|rcp)
2838           cat >$from <<EOF
2839 #!/bin/sh
2840 for f in \$@
2841 do
2842   $rm -f \$f
2843   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         cp) cat >$from <<EOF
2849 #!/bin/sh
2850 for f in \$@
2851 do
2852   $rm -f \$f
2853   cp $targetdir/\$f . || exit 1
2854 done
2855 exit 0
2856 EOF
2857             ;;
2858         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2859             exit 1
2860             ;;
2861         esac
2862         if $test ! -f $run; then
2863             echo "Target 'run' script '$run' not found." >&4
2864         else
2865             $chmod a+rx $run
2866         fi
2867         if $test ! -f $to; then
2868             echo "Target 'to' script '$to' not found." >&4
2869         else
2870             $chmod a+rx $to
2871         fi
2872         if $test ! -f $from; then
2873             echo "Target 'from' script '$from' not found." >&4
2874         else
2875             $chmod a+rx $from
2876         fi
2877         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2878             exit 1
2879         fi
2880         cat >&4 <<EOF
2881 Using '$run' for remote execution,
2882 and '$from' and '$to'
2883 for remote file transfer.
2884 EOF
2885         ;;
2886 *)      run=''
2887         to=:
2888         from=:
2889         usecrosscompile='undef'
2890         targetarch=''
2891         ;;
2892 esac
2893
2894 : see whether [:lower:] and [:upper:] are supported character classes
2895 echo " "
2896 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2897 ABYZ)
2898         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2899         up='[:upper:]'
2900         low='[:lower:]'
2901         ;;
2902 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2903         # (0xd9 and 0xe2), therefore that is a nice testing point.
2904         if test "X$up" = X -o "X$low" = X; then
2905             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2906             rs) up='[A-Z]'
2907                 low='[a-z]'
2908                 ;;
2909             esac
2910         fi
2911         if test "X$up" = X -o "X$low" = X; then
2912             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2913             rs) up='A-Z'
2914                 low='a-z'
2915                 ;;
2916             esac
2917         fi
2918         if test "X$up" = X -o "X$low" = X; then
2919             case "`echo RS | od -x 2>/dev/null`" in
2920             *D9E2*|*d9e2*)
2921                 echo "Hey, this might be EBCDIC." >&4
2922                 if test "X$up" = X -o "X$low" = X; then
2923                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2924                     rs) up='[A-IJ-RS-Z]'
2925                         low='[a-ij-rs-z]'
2926                         ;;
2927                     esac
2928                 fi
2929                 if test "X$up" = X -o "X$low" = X; then
2930                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2931                     rs) up='A-IJ-RS-Z'
2932                         low='a-ij-rs-z'
2933                         ;;
2934                     esac
2935                 fi
2936                 ;;
2937             esac
2938         fi
2939 esac
2940 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2941 rs)
2942     echo "Using $up and $low to convert case." >&4
2943     ;;
2944 *)
2945     echo "I don't know how to translate letters from upper to lower case." >&4
2946     echo "Your tr is not acting any way I know of." >&4
2947     exit 1
2948     ;;
2949 esac
2950 : set up the translation script tr, must be called with ./tr of course
2951 cat >tr <<EOSC
2952 $startsh
2953 case "\$1\$2" in
2954 '[A-Z][a-z]') exec $tr '$up' '$low';;
2955 '[a-z][A-Z]') exec $tr '$low' '$up';;
2956 esac
2957 exec $tr "\$@"
2958 EOSC
2959 chmod +x tr
2960 $eunicefix tr
2961
2962 : Try to determine whether config.sh was made on this system
2963 case "$config_sh" in
2964 '')
2965 myuname=`$uname -a 2>/dev/null`
2966 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2967 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2968 # because the A-Z/a-z are not consecutive.
2969 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2970         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2971 newmyuname="$myuname"
2972 dflt=n
2973 case "$knowitall" in
2974 '')
2975         if test -f ../config.sh; then
2976                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2977                         eval "`grep myuname= ../config.sh`"
2978                 fi
2979                 if test "X$myuname" = "X$newmyuname"; then
2980                         dflt=y
2981                 fi
2982         fi
2983         ;;
2984 *) dflt=y;;
2985 esac
2986
2987 : Get old answers from old config file if Configure was run on the
2988 : same system, otherwise use the hints.
2989 hint=default
2990 cd ..
2991 if test -f config.sh; then
2992         echo " "
2993         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2994         . UU/myread
2995         case "$ans" in
2996         n*|N*) echo "OK, I'll ignore it."
2997                 mv config.sh config.sh.old
2998                 myuname="$newmyuname"
2999                 ;;
3000         *)  echo "Fetching default answers from your old config.sh file..." >&4
3001                 tmp_n="$n"
3002                 tmp_c="$c"
3003                 tmp_sh="$sh"
3004                 . ./config.sh
3005                 cp config.sh UU
3006                 n="$tmp_n"
3007                 c="$tmp_c"
3008                 : Older versions did not always set $sh.  Catch re-use of such
3009                 : an old config.sh.
3010                 case "$sh" in
3011                 '') sh="$tmp_sh" ;;
3012                 esac
3013                 hint=previous
3014                 ;;
3015         esac
3016 fi
3017 . ./UU/checkcc
3018 if test ! -f config.sh; then
3019         $cat <<EOM
3020
3021 First time through, eh?  I have some defaults handy for some systems
3022 that need some extra help getting the Configure answers right:
3023
3024 EOM
3025         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3026         dflt=''
3027         : Half the following guesses are probably wrong... If you have better
3028         : tests or hints, please send them to perlbug@perl.org
3029         : The metaconfig authors would also appreciate a copy...
3030         $test -f /irix && osname=irix
3031         $test -f /xenix && osname=sco_xenix
3032         $test -f /dynix && osname=dynix
3033         $test -f /dnix && osname=dnix
3034         $test -f /lynx.os && osname=lynxos
3035         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3036         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3037         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3038         $test -f /bin/mips && /bin/mips && osname=mips
3039         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3040                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3041         $test -d /usr/apollo/bin && osname=apollo
3042         $test -f /etc/saf/_sactab && osname=svr4
3043         $test -d /usr/include/minix && osname=minix
3044         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3045         if $test -d /MachTen -o -d /MachTen_Folder; then
3046                 osname=machten
3047                 if $test -x /sbin/version; then
3048                         osvers=`/sbin/version | $awk '{print $2}' |
3049                         $sed -e 's/[A-Za-z]$//'`
3050                 elif $test -x /usr/etc/version; then
3051                         osvers=`/usr/etc/version | $awk '{print $2}' |
3052                         $sed -e 's/[A-Za-z]$//'`
3053                 else
3054                         osvers="$2.$3"
3055                 fi
3056         fi
3057
3058         $test -f /sys/posix.dll &&
3059                 $test -f /usr/bin/what &&
3060                 set X `/usr/bin/what /sys/posix.dll` &&
3061                 $test "$3" = UWIN &&
3062                 osname=uwin &&
3063                 osvers="$5"
3064
3065         if $test -f $uname; then
3066                 set X $myuname
3067                 shift
3068
3069                 case "$5" in
3070                 fps*) osname=fps ;;
3071                 mips*)
3072                         case "$4" in
3073                         umips) osname=umips ;;
3074                         *) osname=mips ;;
3075                         esac;;
3076                 [23]100) osname=mips ;;
3077                 next*) osname=next ;;
3078                 i386*)
3079                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3080                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3081                                 osname='sco'
3082                                 osvers=$tmp
3083                         elif $test -f /etc/kconfig; then
3084                                 osname=isc
3085                                 if test "$lns" = "$ln -s"; then
3086                                         osvers=4
3087                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3088                                         osvers=3
3089                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3090                                         osvers=2
3091                                 fi
3092                         fi
3093                         tmp=''
3094                         ;;
3095                 pc*)
3096                         if test -n "$DJGPP"; then
3097                                 osname=dos
3098                                 osvers=djgpp
3099                         fi
3100                         ;;
3101                 esac
3102
3103                 case "$1" in
3104                 aix) osname=aix
3105                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3106                         case "$tmp" in
3107                         # oslevel can fail with:
3108                         # oslevel: Unable to acquire lock.
3109                         *not\ found) osvers="$4"."$3" ;;
3110                         '<3240'|'<>3240') osvers=3.2.0 ;;
3111                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3112                         '=3250'|'>3250') osvers=3.2.5 ;;
3113                         *) osvers=$tmp;;
3114                         esac
3115                         ;;
3116                 bsd386) osname=bsd386
3117                         osvers=`$uname -r`
3118                         ;;
3119                 cygwin*) osname=cygwin
3120                         osvers="$3"
3121                         ;;
3122                 *dc.osx) osname=dcosx
3123                         osvers="$3"
3124                         ;;
3125                 dnix) osname=dnix
3126                         osvers="$3"
3127                         ;;
3128                 domainos) osname=apollo
3129                         osvers="$3"
3130                         ;;
3131                 dgux)   osname=dgux 
3132                         osvers="$3"
3133                         ;;
3134                 dynixptx*) osname=dynixptx
3135                         osvers=`echo "$4"|sed 's/^v//'`
3136                         ;;
3137                 freebsd) osname=freebsd 
3138                         osvers="$3" ;;
3139                 genix)  osname=genix ;;
3140                 gnu)    osname=gnu
3141                         osvers="$3" ;;
3142                 hp*)    osname=hpux 
3143                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3144                         ;;
3145                 irix*)  osname=irix
3146                         case "$3" in
3147                         4*) osvers=4 ;;
3148                         5*) osvers=5 ;;
3149                         *)      osvers="$3" ;;
3150                         esac
3151                         ;;
3152                 linux)  osname=linux
3153                         case "$3" in
3154                         *)      osvers="$3" ;;
3155                         esac
3156                         ;;
3157                 MiNT)   osname=mint
3158                         ;;
3159                 netbsd*) osname=netbsd
3160                         osvers="$3"
3161                         ;;
3162                 news-os) osvers="$3"
3163                         case "$3" in
3164                         4*) osname=newsos4 ;;
3165                         *) osname=newsos ;;
3166                         esac
3167                         ;;
3168                 next*) osname=next ;;
3169                 nonstop-ux) osname=nonstopux ;;
3170                 openbsd) osname=openbsd
3171                         osvers="$3"
3172                         ;;
3173                 os2)    osname=os2
3174                         osvers="$4"
3175                         ;;
3176                 POSIX-BC | posix-bc ) osname=posix-bc
3177                         osvers="$3"
3178                         ;;
3179                 powerux | power_ux | powermax_os | powermaxos | \
3180                 powerunix | power_unix) osname=powerux
3181                         osvers="$3"
3182                         ;;
3183                 qnx) osname=qnx
3184                         osvers="$4"
3185                         ;;
3186                 solaris) osname=solaris
3187                         case "$3" in
3188                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3189                         *)      osvers="$3" ;;
3190                         esac
3191                         ;;
3192                 sunos) osname=sunos
3193                         case "$3" in
3194                         5*) osname=solaris
3195                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3196                         *)      osvers="$3" ;;
3197                         esac
3198                         ;;
3199                 titanos) osname=titanos
3200                         case "$3" in
3201                         1*) osvers=1 ;;
3202                         2*) osvers=2 ;;
3203                         3*) osvers=3 ;;
3204                         4*) osvers=4 ;;
3205                         *)      osvers="$3" ;;
3206                         esac
3207                         ;;
3208                 ultrix) osname=ultrix
3209                         osvers="$3"
3210                         ;;
3211                 osf1|mls+)      case "$5" in
3212                                 alpha)
3213                                         osname=dec_osf
3214                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3215                                         case "$osvers" in
3216                                         [1-9].[0-9]*) ;;
3217                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3218                                         esac
3219                                         ;;
3220                         hp*)    osname=hp_osf1  ;;
3221                         mips)   osname=mips_osf1 ;;
3222                         esac
3223                         ;;
3224                 # UnixWare 7.1.2 is known as Open UNIX 8
3225                 openunix|unixware) osname=svr5
3226                         osvers="$4"
3227                         ;;
3228                 uts)    osname=uts
3229                         osvers="$3"
3230                         ;;
3231                 vos) osvers="$3"
3232                         ;;
3233                 $2) case "$osname" in
3234                         *isc*) ;;
3235                         *freebsd*) ;;
3236                         svr*)
3237                                 : svr4.x or possibly later
3238                                 case "svr$3" in 
3239                                 ${osname}*)
3240                                         osname=svr$3
3241                                         osvers=$4
3242                                         ;;
3243                                 esac
3244                                 case "$osname" in
3245                                 svr4.0)
3246                                         : Check for ESIX
3247                                         if test -f /stand/boot ; then
3248                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3249                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3250                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3251                                                         if test -n "$isesix"; then
3252                                                                 osname=esix4
3253                                                         fi
3254                                                 fi
3255                                         fi
3256                                         ;;
3257                                 esac
3258                                 ;;
3259                         *)      if test -f /etc/systemid; then
3260                                         osname=sco
3261                                         set `echo $3 | $sed 's/\./ /g'` $4
3262                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3263                                                 osvers=$1.$2.$3
3264                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3265                                                 osvers=$1.$2
3266                                         elif $test -f $src/hints/sco_$1.sh; then
3267                                                 osvers=$1
3268                                         fi
3269                                 else
3270                                         case "$osname" in
3271                                         '') : Still unknown.  Probably a generic Sys V.
3272                                                 osname="sysv"
3273                                                 osvers="$3"
3274                                                 ;;
3275                                         esac
3276                                 fi
3277                                 ;;
3278                         esac
3279                         ;;
3280                 *)      case "$osname" in
3281                         '') : Still unknown.  Probably a generic BSD.
3282                                 osname="$1"
3283                                 osvers="$3"
3284                                 ;;
3285                         esac
3286                         ;;
3287                 esac
3288         else
3289                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3290                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3291                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3292                                 osname=news_os
3293                         fi
3294                         $rm -f UU/kernel.what
3295                 elif test -d c:/. -o -n "$is_os2" ; then
3296                         set X $myuname
3297                         osname=os2
3298                         osvers="$5"
3299                 fi
3300         fi
3301         
3302         case "$targetarch" in
3303         '') ;;
3304         *)  hostarch=$osname
3305             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3306             osvers=''
3307             ;;
3308         esac
3309
3310         : Now look for a hint file osname_osvers, unless one has been
3311         : specified already.
3312         case "$hintfile" in
3313         ''|' ')
3314                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3315                 : Also try without trailing minor version numbers.
3316                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3317                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3318                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3319                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3320                 case "$file" in
3321                 '') dflt=none ;;
3322                 *)  case "$osvers" in
3323                         '') dflt=$file
3324                                 ;;
3325                         *)  if $test -f $src/hints/$file.sh ; then
3326                                         dflt=$file
3327                                 elif $test -f $src/hints/$xfile.sh ; then
3328                                         dflt=$xfile
3329                                 elif $test -f $src/hints/$xxfile.sh ; then
3330                                         dflt=$xxfile
3331                                 elif $test -f $src/hints/$xxxfile.sh ; then
3332                                         dflt=$xxxfile
3333                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3334                                         dflt=$xxxxfile
3335                                 elif $test -f "$src/hints/${osname}.sh" ; then
3336                                         dflt="${osname}"
3337                                 else
3338                                         dflt=none
3339                                 fi
3340                                 ;;
3341                         esac
3342                         ;;
3343                 esac
3344                 if $test -f Policy.sh ; then
3345                         case "$dflt" in
3346                         *Policy*) ;;
3347                         none) dflt="Policy" ;;
3348                         *) dflt="Policy $dflt" ;;
3349                         esac
3350                 fi
3351                 ;;
3352         *)
3353                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3354                 ;;
3355         esac
3356
3357         if $test -f Policy.sh ; then
3358                 $cat <<EOM
3359
3360 There's also a Policy hint file available, which should make the
3361 site-specific (policy) questions easier to answer.
3362 EOM
3363
3364         fi
3365
3366         $cat <<EOM
3367
3368 You may give one or more space-separated answers, or "none" if appropriate.
3369 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3370 is a good thing.  DO NOT give a wrong version or a wrong OS.
3371
3372 EOM
3373
3374         rp="Which of these apply, if any?"
3375         . UU/myread
3376         tans=$ans
3377         for file in $tans; do
3378                 if $test X$file = XPolicy -a -f Policy.sh; then
3379                         . Policy.sh
3380                         $cat Policy.sh >> UU/config.sh
3381                 elif $test -f $src/hints/$file.sh; then
3382                         . $src/hints/$file.sh
3383                         $cat $src/hints/$file.sh >> UU/config.sh
3384                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3385                         : nothing
3386                 else
3387                         : Give one chance to correct a possible typo.
3388                         echo "$file.sh does not exist"
3389                         dflt=$file
3390                         rp="hint to use instead?"
3391                         . UU/myread
3392                         for file in $ans; do
3393                                 if $test -f "$src/hints/$file.sh"; then
3394                                         . $src/hints/$file.sh
3395                                         $cat $src/hints/$file.sh >> UU/config.sh
3396                                 elif $test X$ans = X -o X$ans = Xnone ; then
3397                                         : nothing
3398                                 else
3399                                         echo "$file.sh does not exist -- ignored."
3400                                 fi
3401                         done
3402                 fi
3403         done
3404
3405         hint=recommended
3406         : Remember our hint file for later.
3407         if $test -f "$src/hints/$file.sh" ; then
3408                 hintfile="$file"
3409         else
3410                 hintfile=''
3411         fi
3412 fi
3413 cd UU
3414 ;;
3415 *)
3416         echo " "
3417         echo "Fetching default answers from $config_sh..." >&4
3418         tmp_n="$n"
3419         tmp_c="$c"
3420         cd ..
3421         cp $config_sh config.sh 2>/dev/null
3422         chmod +w config.sh
3423         . ./config.sh
3424         cd UU
3425         cp ../config.sh .
3426         n="$tmp_n"
3427         c="$tmp_c"
3428         hint=previous
3429         ;;
3430 esac
3431 test "$override" && . ./optdef.sh
3432
3433 : Restore computed paths
3434 for file in $loclist $trylist; do
3435         eval $file="\$_$file"
3436 done
3437
3438 cat << EOM
3439
3440 Configure uses the operating system name and version to set some defaults.
3441 The default value is probably right if the name rings a bell. Otherwise,
3442 since spelling matters for me, either accept the default or answer "none"
3443 to leave it blank.
3444
3445 EOM
3446 case "$osname" in
3447         ''|' ')
3448                 case "$hintfile" in
3449                 ''|' '|none) dflt=none ;;
3450                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3451                 esac
3452                 ;;
3453         *) dflt="$osname" ;;
3454 esac
3455 rp="Operating system name?"
3456 . ./myread
3457 case "$ans" in
3458 none)  osname='' ;;
3459 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3460 esac
3461 echo " "
3462 case "$osvers" in
3463         ''|' ')
3464                 case "$hintfile" in
3465                 ''|' '|none) dflt=none ;;
3466                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3467                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3468                         case "$dflt" in
3469                         ''|' ') dflt=none ;;
3470                         esac
3471                         ;;
3472                 esac
3473                 ;;
3474         *) dflt="$osvers" ;;
3475 esac
3476 rp="Operating system version?"
3477 . ./myread
3478 case "$ans" in
3479 none)  osvers='' ;;
3480 *) osvers="$ans" ;;
3481 esac
3482
3483
3484 . ./posthint.sh
3485
3486 : who configured the system
3487 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3488 case "$cf_by" in
3489 "")
3490         cf_by=`(logname) 2>/dev/null`
3491         case "$cf_by" in
3492         "")
3493                 cf_by=`(whoami) 2>/dev/null`
3494                 case "$cf_by" in
3495                 "") cf_by=unknown ;;
3496                 esac ;;
3497         esac ;;
3498 esac
3499
3500 : set up the script used to warn in case of inconsistency
3501 cat <<EOS >whoa
3502 $startsh
3503 EOS
3504 cat <<'EOSC' >>whoa
3505 dflt=y
3506 echo " "
3507 echo "*** WHOA THERE!!! ***" >&4
3508 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3509 rp="    Keep the $hint value?"
3510 . ./myread
3511 case "$ans" in
3512 y) td=$was; tu=$was;;
3513 esac
3514 EOSC
3515
3516 : function used to set $1 to $val
3517 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3518 case "$val$was" in
3519 $define$undef) . ./whoa; eval "$var=\$td";;
3520 $undef$define) . ./whoa; eval "$var=\$tu";;
3521 *) eval "$var=$val";;
3522 esac'
3523
3524 case "$usesocks" in
3525 $define|true|[yY]*)     dflt='y';;
3526 *) dflt='n';;
3527 esac
3528 cat <<EOM
3529
3530 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3531 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3532 to use the PerlIO abstraction layer, this will be implicitly selected.
3533
3534 If this doesn't make any sense to you, just accept the default '$dflt'.
3535 EOM
3536 rp='Build Perl for SOCKS?'
3537 . ./myread
3538 case "$ans" in
3539 y|Y)    val="$define" ;;     
3540 *)      val="$undef" ;;
3541 esac
3542 set usesocks
3543 eval $setvar
3544
3545 case "$usesocks" in
3546 $define|true|[yY]*) useperlio="$define";;
3547 esac
3548
3549 case "$useperlio" in
3550 $define|true|[yY]*|'')  dflt='y';;
3551 *) dflt='n';;
3552 esac
3553 cat <<EOM
3554
3555 Previous version of $package used the standard IO mechanisms as
3556 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3557 alternate IO mechanisms via the PerlIO abstraction layer, but the
3558 stdio mechanism is still available if needed.  The abstraction layer
3559 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3560 Using PerlIO with sfio may cause problems with some extension modules.
3561
3562 If this doesn't make any sense to you, just accept the default '$dflt'.
3563 EOM
3564 rp='Use the PerlIO abstraction layer?'
3565 . ./myread
3566 case "$ans" in
3567 y|Y) 
3568         val="$define"
3569         ;;
3570 *)      
3571         echo "Ok, doing things the stdio way."
3572         val="$undef"
3573         ;;
3574 esac
3575 set useperlio
3576 eval $setvar 
3577
3578 case "$usesocks" in
3579 $define|true|[yY]*)
3580         case "$useperlio" in
3581         $define|true|[yY]*) ;;
3582         *)      cat >&4 <<EOM
3583
3584 You are using the SOCKS proxy protocol library which means that you
3585 should also use the PerlIO layer.  You may be headed for trouble.
3586
3587 EOM
3588                 ;;
3589         esac
3590         ;;
3591 esac
3592
3593         
3594 case "$usethreads" in
3595 $define|true|[yY]*)     dflt='y';;
3596 *)     # Catch case where user specified ithreads or 5005threads but
3597        # forgot -Dusethreads (A.D. 4/2002)
3598        case "$useithreads$use5005threads" in
3599        *$define*)      
3600                 case "$useperlio" in
3601                 "$define")      dflt='y' ;;
3602                 *)              dflt='n' ;;
3603                 esac
3604                 ;;
3605        *)       dflt='n';;
3606        esac
3607        ;;
3608 esac
3609 cat <<EOM
3610
3611 Perl can be built to take advantage of threads on some systems.
3612 To do so, Configure can be run with -Dusethreads.
3613
3614 Note that Perl built with threading support runs slightly slower
3615 and uses more memory than plain Perl. The current implementation
3616 is believed to be stable, but it is fairly new, and so should be
3617 treated with caution.
3618
3619 If this doesn't make any sense to you, just accept the default '$dflt'.
3620 EOM
3621 rp='Build a threading Perl?'
3622 . ./myread
3623 case "$ans" in
3624 y|Y)    val="$define" ;;
3625 *)      val="$undef" ;;
3626 esac
3627 set usethreads
3628 eval $setvar
3629
3630 case "$usethreads" in
3631 $define)
3632         $cat <<EOM
3633
3634 Since release 5.6, Perl has had two different threading implementations,
3635 the newer interpreter-based version (ithreads) with one interpreter per
3636 thread, and the older 5.005 version (5005threads).
3637 The 5005threads version is effectively unmaintained and will probably be
3638 removed in Perl 5.10, so there should be no need to build a Perl using it
3639 unless needed for backwards compatibility with some existing 5.005threads
3640 code.
3641
3642 EOM
3643         : Default to ithreads unless overridden on command line or with
3644         : old config.sh
3645         dflt='y'
3646         case "$use5005threads" in
3647                 $define|true|[yY]*) dflt='n';;
3648         esac
3649         case "$useithreads" in
3650                 $undef|false|[nN]*) dflt='n';;
3651         esac
3652         rp='Use the newer interpreter-based ithreads?'
3653         . ./myread
3654         case "$ans" in
3655         y|Y)    val="$define" ;;
3656         *)      val="$undef" ;;
3657         esac
3658         set useithreads
3659         eval $setvar
3660         : Now set use5005threads to the opposite value.
3661         case "$useithreads" in
3662         $define) val="$undef" ;;
3663         *) val="$define" ;;
3664         esac
3665         set use5005threads
3666         eval $setvar
3667         ;;
3668 *)
3669         useithreads="$undef"
3670         use5005threads="$undef"
3671         ;;
3672 esac
3673
3674 case "$useithreads$use5005threads" in
3675 "$define$define")
3676         $cat >&4 <<EOM
3677
3678 You cannot have both the ithreads and the 5.005 threads enabled
3679 at the same time.  Disabling the 5.005 threads since they are
3680 much less stable than the ithreads.
3681
3682 EOM
3683         use5005threads="$undef"
3684         ;;
3685 esac
3686
3687 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3688         cat >&4 <<EOF
3689 ***
3690 *** To build with ithreads you must also use the PerlIO layer.
3691 *** Cannot continue, aborting.
3692 ***
3693 EOF
3694         exit 1
3695 fi
3696
3697 case "$d_oldpthreads" in
3698 '')     : Configure tests would be welcome here.  For now, assume undef.
3699         val="$undef" ;;
3700 *)      val="$d_oldpthreads" ;;
3701 esac
3702 set d_oldpthreads
3703 eval $setvar
3704
3705
3706 : Look for a hint-file generated 'call-back-unit'.  If the
3707 : user has specified that a threading perl is to be built,
3708 : we may need to set or change some other defaults.
3709 if $test -f usethreads.cbu; then
3710     echo "Your platform has some specific hints regarding threaded builds, using them..."
3711     . ./usethreads.cbu
3712 else
3713     case "$usethreads" in
3714         "$define"|true|[yY]*)
3715                 $cat <<EOM
3716 (Your platform does not have any specific hints for threaded builds.
3717  Assuming POSIX threads, then.)
3718 EOM
3719         ;;
3720     esac
3721 fi
3722
3723 cat <<EOM
3724
3725 Perl can be built so that multiple Perl interpreters can coexist
3726 within the same Perl executable.
3727 EOM
3728
3729 case "$useithreads" in
3730 $define)
3731         cat <<EOM
3732 This multiple interpreter support is required for interpreter-based threads.
3733 EOM
3734         val="$define"
3735         ;;
3736 *)      case "$usemultiplicity" in
3737         $define|true|[yY]*)     dflt='y';;
3738         *) dflt='n';;
3739         esac
3740         echo " "
3741         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3742         rp='Build Perl for multiplicity?'
3743         . ./myread
3744         case "$ans" in
3745         y|Y)    val="$define" ;;
3746         *)      val="$undef" ;;
3747         esac
3748         ;;
3749 esac
3750 set usemultiplicity
3751 eval $setvar
3752
3753
3754 case "$usemorebits" in
3755 "$define"|true|[yY]*)
3756         use64bitint="$define"
3757         uselongdouble="$define"
3758         usemorebits="$define"
3759         ;;
3760 *)      usemorebits="$undef"
3761         ;;
3762 esac
3763
3764 : make some quick guesses about what we are up against
3765 echo " "
3766 $echo $n "Hmm...  $c"
3767 echo exit 1 >bsd
3768 echo exit 1 >usg
3769 echo exit 1 >v7
3770 echo exit 1 >osf1
3771 echo exit 1 >eunice
3772 echo exit 1 >xenix
3773 echo exit 1 >venix
3774 echo exit 1 >os2
3775 d_bsd="$undef"
3776 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3777 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3778 then
3779         echo "Looks kind of like an OSF/1 system, but we'll see..."
3780         echo exit 0 >osf1
3781 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3782         xxx=`./loc addbib blurfl $pth`
3783         if $test -f $xxx; then
3784         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3785                 echo exit 0 >bsd
3786                 echo exit 0 >usg
3787         else
3788                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3789                         echo "Looks kind of like an extended USG system, but we'll see..."
3790                 else
3791                         echo "Looks kind of like a USG system, but we'll see..."
3792                 fi
3793                 echo exit 0 >usg
3794         fi
3795 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3796         echo "Looks kind of like a BSD system, but we'll see..."
3797         d_bsd="$define"
3798         echo exit 0 >bsd
3799 else
3800         echo "Looks kind of like a Version 7 system, but we'll see..."
3801         echo exit 0 >v7
3802 fi
3803 case "$eunicefix" in
3804 *unixtovms*)
3805         $cat <<'EOI'
3806 There is, however, a strange, musty smell in the air that reminds me of
3807 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3808 EOI
3809         echo exit 0 >eunice
3810         d_eunice="$define"
3811 : it so happens the Eunice I know will not run shell scripts in Unix format
3812         ;;
3813 *)
3814         echo " "
3815         echo "Congratulations.  You aren't running Eunice."
3816         d_eunice="$undef"
3817         ;;
3818 esac
3819 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3820 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3821 : semicolon as a patch separator
3822 case "$p_" in
3823 :) ;;
3824 *)
3825         $cat <<'EOI'
3826 I have the feeling something is not exactly right, however...don't tell me...
3827 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3828 (Or you may be running DOS with DJGPP.)
3829 EOI
3830         echo exit 0 >os2
3831         ;;
3832 esac
3833 if test -f /xenix; then
3834         echo "Actually, this looks more like a XENIX system..."
3835         echo exit 0 >xenix
3836         d_xenix="$define"
3837 else
3838         echo " "
3839         echo "It's not Xenix..."
3840         d_xenix="$undef"
3841 fi
3842 chmod +x xenix
3843 $eunicefix xenix
3844 if test -f /venix; then
3845         echo "Actually, this looks more like a VENIX system..."
3846         echo exit 0 >venix
3847 else
3848         echo " "
3849         if ./xenix; then
3850                 : null
3851         else
3852                 echo "Nor is it Venix..."
3853         fi
3854 fi
3855 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3856 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3857 $rm -f foo
3858
3859 case "$cc" in
3860 '') dflt=cc;;
3861 *) dflt="$cc";;
3862 esac
3863 rp="Use which C compiler?"
3864 . ./myread
3865 cc="$ans"
3866
3867 : See if they have not cc but they do have gcc
3868 . ./trygcc
3869 : Look for a hint-file generated 'call-back-unit'.  Now that the
3870 : user has specified the compiler, we may need to set or change some
3871 : other defaults.
3872 if $test -f cc.cbu; then
3873     . ./cc.cbu
3874 fi
3875 . ./checkcc
3876
3877 echo " "
3878 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3879 $cat >try.c <<EOM
3880 #include <stdio.h>
3881 int main() {
3882 #ifdef __GNUC__
3883 #ifdef __VERSION__
3884         printf("%s\n", __VERSION__);
3885 #else
3886         printf("%s\n", "1");
3887 #endif
3888 #endif
3889         return(0);
3890 }
3891 EOM
3892 if $cc -o try $ccflags $ldflags try.c; then
3893         gccversion=`$run ./try`
3894         case "$gccversion" in
3895         '') echo "You are not using GNU cc." ;;
3896         *)  echo "You are using GNU cc $gccversion."
3897             ccname=gcc
3898             ;;
3899         esac
3900 else
3901         echo " "
3902         echo "*** WHOA THERE!!! ***" >&4
3903         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3904         case "$knowitall" in
3905         '')
3906         echo "    You'd better start hunting for one and let me know about it." >&4
3907                 exit 1
3908                 ;;
3909         esac
3910 fi
3911 $rm -f try try.*
3912 case "$gccversion" in
3913 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3914 esac
3915 case "$gccversion" in
3916 '') gccosandvers='' ;;
3917 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3918    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3919    gccshortvers=''
3920    case "$gccosandvers" in
3921    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3922    $osname$osvers) ;; # looking good
3923    $osname*) cat <<EOM >&4
3924
3925 *** WHOA THERE!!! ***
3926
3927     Your gcc has not been compiled for the exact release of
3928     your operating system ($gccosandvers versus $osname$osvers).
3929
3930     In general it is a good idea to keep gcc synchronized with
3931     the operating system because otherwise serious problems
3932     may ensue when trying to compile software, like Perl.
3933
3934     I'm trying to be optimistic here, though, and will continue.
3935     If later during the configuration and build icky compilation
3936     problems appear (headerfile conflicts being the most common
3937     manifestation), I suggest reinstalling the gcc to match
3938     your operating system release.
3939
3940 EOM
3941       ;;
3942    *) gccosandvers='' ;; # failed to parse, better be silent
3943    esac
3944    ;;
3945 esac
3946 case "$ccname" in
3947 '') ccname="$cc" ;;
3948 esac
3949
3950 # gcc 3.* complain about adding -Idirectories that they already know about,
3951 # so we will take those off from locincpth.
3952 case "$gccversion" in
3953 3*)
3954     echo "main(){}">try.c
3955     for incdir in $locincpth; do
3956        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3957              grep '^c[cp]p*[01]: warning: changing search order '`
3958        if test "X$warn" != X; then
3959            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3960        fi
3961     done
3962     $rm -f try try.*
3963 esac
3964
3965 : decide how portable to be.  Allow command line overrides.
3966 case "$d_portable" in
3967 "$undef") ;;
3968 *)      d_portable="$define" ;;
3969 esac
3970
3971 : set up shell script to do ~ expansion
3972 cat >filexp <<EOSS
3973 $startsh
3974 : expand filename
3975 case "\$1" in
3976  ~/*|~)
3977         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3978         ;;
3979  ~*)
3980         if $test -f /bin/csh; then
3981                 /bin/csh -f -c "glob \$1"
3982                 failed=\$?
3983                 echo ""
3984                 exit \$failed
3985         else
3986                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3987                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3988                 if $test ! -d "\$dir"; then
3989                         me=\`basename \$0\`
3990                         echo "\$me: can't locate home directory for: \$name" >&2
3991                         exit 1
3992                 fi
3993                 case "\$1" in
3994                 */*)
3995                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3996                         ;;
3997                 *)
3998                         echo \$dir
3999                         ;;
4000                 esac
4001         fi
4002         ;;
4003 *)
4004         echo \$1
4005         ;;
4006 esac
4007 EOSS
4008 chmod +x filexp
4009 $eunicefix filexp
4010
4011 : now set up to get a file name
4012 cat <<EOS >getfile
4013 $startsh
4014 EOS
4015 cat <<'EOSC' >>getfile
4016 tilde=''
4017 fullpath=''
4018 already=''
4019 skip=''
4020 none_ok=''
4021 exp_file=''
4022 nopath_ok=''
4023 orig_rp="$rp"
4024 orig_dflt="$dflt"
4025 case "$gfpth" in
4026 '') gfpth='.' ;;
4027 esac
4028
4029 case "$fn" in
4030 *\(*)
4031         : getfile will accept an answer from the comma-separated list
4032         : enclosed in parentheses even if it does not meet other criteria.
4033         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4034         fn=`echo $fn | sed 's/(.*)//'`
4035         ;;
4036 esac
4037
4038 case "$fn" in
4039 *:*)
4040         loc_file=`expr $fn : '.*:\(.*\)'`
4041         fn=`expr $fn : '\(.*\):.*'`
4042         ;;
4043 esac
4044
4045 case "$fn" in
4046 *~*) tilde=true;;
4047 esac
4048 case "$fn" in
4049 */*) fullpath=true;;
4050 esac
4051 case "$fn" in
4052 *+*) skip=true;;
4053 esac
4054 case "$fn" in
4055 *n*) none_ok=true;;
4056 esac
4057 case "$fn" in
4058 *e*) exp_file=true;;
4059 esac
4060 case "$fn" in
4061 *p*) nopath_ok=true;;
4062 esac
4063
4064 case "$fn" in
4065 *f*) type='File';;
4066 *d*) type='Directory';;
4067 *l*) type='Locate';;
4068 esac
4069
4070 what="$type"
4071 case "$what" in
4072 Locate) what='File';;
4073 esac
4074
4075 case "$exp_file" in
4076 '')
4077         case "$d_portable" in
4078         "$define") ;;
4079         *) exp_file=true;;
4080         esac
4081         ;;
4082 esac
4083
4084 cd ..
4085 while test "$type"; do
4086         redo=''
4087         rp="$orig_rp"
4088         dflt="$orig_dflt"
4089         case "$tilde" in
4090         true) rp="$rp (~name ok)";;
4091         esac
4092         . UU/myread
4093         if test -f UU/getfile.ok && \
4094                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4095         then
4096                 value="$ans"
4097                 ansexp="$ans"
4098                 break
4099         fi
4100         case "$ans" in
4101         none)
4102                 value=''
4103                 ansexp=''
4104                 case "$none_ok" in
4105                 true) type='';;
4106                 esac
4107                 ;;
4108         *)
4109                 case "$tilde" in
4110                 '') value="$ans"
4111                         ansexp="$ans";;
4112                 *)
4113                         value=`UU/filexp $ans`
4114                         case $? in
4115                         0)
4116                                 if test "$ans" != "$value"; then
4117                                         echo "(That expands to $value on this system.)"
4118                                 fi
4119                                 ;;
4120                         *) value="$ans";;
4121                         esac
4122                         ansexp="$value"
4123                         case "$exp_file" in
4124                         '') value="$ans";;
4125                         esac
4126                         ;;
4127                 esac
4128                 case "$fullpath" in
4129                 true)
4130                         case "$ansexp" in
4131                         /*) value="$ansexp" ;;
4132                         [a-zA-Z]:/*) value="$ansexp" ;;
4133                         *)
4134                                 redo=true
4135                                 case "$already" in
4136                                 true)
4137                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4138                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4139                                         ;;
4140                                 *)
4141                                 echo "Please give a full path name, starting with slash." >&4
4142                                         case "$tilde" in
4143                                         true)
4144                                 echo "Note that using ~name is ok provided it expands well." >&4
4145                                                 already=true
4146                                                 ;;
4147                                         esac
4148                                 esac
4149                                 ;;
4150                         esac
4151                         ;;
4152                 esac
4153                 case "$redo" in
4154                 '')
4155                         case "$type" in
4156                         File)
4157                                 for fp in $gfpth; do
4158                                         if test "X$fp" = X.; then
4159                                             pf="$ansexp"
4160                                         else    
4161                                             pf="$fp/$ansexp"
4162                                         fi
4163                                         if test -f "$pf"; then
4164                                                 type=''
4165                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4166                                         then
4167                                                 echo "($value is not a plain file, but that's ok.)"
4168                                                 type=''
4169                                         fi
4170                                         if test X"$type" = X; then
4171                                             value="$pf"
4172                                             break
4173                                         fi
4174                                 done
4175                                 ;;
4176                         Directory)
4177                                 for fp in $gfpth; do
4178                                         if test "X$fp" = X.; then
4179                                             dir="$ans"
4180                                             direxp="$ansexp"
4181                                         else    
4182                                             dir="$fp/$ansexp"
4183                                             direxp="$fp/$ansexp"
4184                                         fi
4185                                         if test -d "$direxp"; then
4186                                                 type=''
4187                                                 value="$dir"
4188                                                 break
4189                                         fi
4190                                 done
4191                                 ;;
4192                         Locate)
4193                                 if test -d "$ansexp"; then
4194                                         echo "(Looking for $loc_file in directory $value.)"
4195                                         value="$value/$loc_file"
4196                                         ansexp="$ansexp/$loc_file"
4197                                 fi
4198                                 if test -f "$ansexp"; then
4199                                         type=''
4200                                 fi
4201                                 case "$nopath_ok" in
4202                                 true)   case "$value" in
4203                                         */*) ;;
4204                                         *)      echo "Assuming $value will be in people's path."
4205                                                 type=''
4206                                                 ;;
4207                                         esac
4208                                         ;;
4209                                 esac
4210                                 ;;
4211                         esac
4212
4213                         case "$skip" in
4214                         true) type='';
4215                         esac
4216
4217                         case "$type" in
4218                         '') ;;
4219                         *)
4220                                 if test "$fastread" = yes; then
4221                                         dflt=y
4222                                 else
4223                                         dflt=n
4224                                 fi
4225                                 rp="$what $value doesn't exist.  Use that name anyway?"
4226                                 . UU/myread
4227                                 dflt=''
4228                                 case "$ans" in
4229                                 y*) type='';;
4230                                 *) echo " ";;
4231                                 esac
4232                                 ;;
4233                         esac
4234                         ;;
4235                 esac
4236                 ;;
4237         esac
4238 done
4239 cd UU
4240 ans="$value"
4241 rp="$orig_rp"
4242 dflt="$orig_dflt"
4243 rm -f getfile.ok
4244 test "X$gfpthkeep" != Xy && gfpth=""
4245 EOSC
4246
4247 : What should the include directory be ?
4248 echo " "
4249 $echo $n "Hmm...  $c"
4250 dflt='/usr/include'
4251 incpath=''
4252 mips_type=''
4253 if $test -f /bin/mips && /bin/mips; then
4254         echo "Looks like a MIPS system..."
4255         $cat >usr.c <<'EOCP'
4256 #ifdef SYSTYPE_BSD43
4257 /bsd43
4258 #endif
4259 EOCP
4260         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4261                 dflt='/bsd43/usr/include'
4262                 incpath='/bsd43'
4263                 mips_type='BSD 4.3'
4264         else
4265                 mips_type='System V'
4266         fi
4267         $rm -f usr.c usr.out
4268         echo "and you're compiling with the $mips_type compiler and libraries."
4269         xxx_prompt=y
4270         echo "exit 0" >mips
4271 else
4272         echo "Doesn't look like a MIPS system."
4273         xxx_prompt=n
4274         echo "exit 1" >mips
4275 fi
4276 chmod +x mips
4277 $eunicefix mips
4278 case "$usrinc" in
4279 '') ;;
4280 *) dflt="$usrinc";;
4281 esac
4282 case "$xxx_prompt" in
4283 y)      fn=d/
4284         echo " "
4285         rp='Where are the include files you want to use?'
4286         . ./getfile
4287         usrinc="$ans"
4288         ;;
4289 *)      usrinc="$dflt"
4290         ;;
4291 esac
4292
4293 : see how we invoke the C preprocessor
4294 echo " "
4295 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4296 cat <<'EOT' >testcpp.c
4297 #define ABC abc
4298 #define XYZ xyz
4299 ABC.XYZ
4300 EOT
4301 cd ..
4302 if test ! -f cppstdin; then
4303         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4304                 # AIX cc -E doesn't show the absolute headerfile
4305                 # locations but we'll cheat by using the -M flag.
4306                 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
4307         else
4308                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4309         fi
4310 else
4311         echo "Keeping your $hint cppstdin wrapper."
4312 fi
4313 chmod 755 cppstdin
4314 wrapper=`pwd`/cppstdin
4315 ok='false'
4316 cd UU
4317
4318 if $test "X$cppstdin" != "X" && \
4319         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4320         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4321 then
4322         echo "You used to use $cppstdin $cppminus so we'll use that again."
4323         case "$cpprun" in
4324         '') echo "But let's see if we can live without a wrapper..." ;;
4325         *)
4326                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4327                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4328                 then
4329                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4330                         ok='true'
4331                 else
4332                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4333                 fi
4334                 ;;
4335         esac
4336 else
4337         case "$cppstdin" in
4338         '') ;;
4339         *)
4340                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4341                 ;;
4342         esac
4343 fi
4344
4345 if $ok; then
4346         : nothing
4347 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4348         $cc -E <testcpp.c >testcpp.out 2>&1; \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4350         echo "Yup, it does."
4351         x_cpp="$cc -E"
4352         x_minus='';
4353 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4354         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4355         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4356         echo "Yup, it does."
4357         x_cpp="$cc -E"
4358         x_minus='-';
4359 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4360         $cc -P <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         echo "Yipee, that works!"
4363         x_cpp="$cc -P"
4364         x_minus='';
4365 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4366         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4367         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368         echo "At long last!"
4369         x_cpp="$cc -P"
4370         x_minus='-';
4371 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4372         $cpp <testcpp.c >testcpp.out 2>&1; \
4373         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374         echo "It works!"
4375         x_cpp="$cpp"
4376         x_minus='';
4377 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4378         $cpp - <testcpp.c >testcpp.out 2>&1; \
4379         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4380         echo "Hooray, it works!  I was beginning to wonder."
4381         x_cpp="$cpp"
4382         x_minus='-';
4383 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4384         $wrapper <testcpp.c >testcpp.out 2>&1; \
4385         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4386         x_cpp="$wrapper"
4387         x_minus=''
4388         echo "Eureka!"
4389 else
4390         dflt=''
4391         rp="No dice.  I can't find a C preprocessor.  Name one:"
4392         . ./myread
4393         x_cpp="$ans"
4394         x_minus=''
4395         $x_cpp <testcpp.c >testcpp.out 2>&1
4396         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397                 echo "OK, that will do." >&4
4398         else
4399 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4400                 exit 1
4401         fi
4402 fi
4403
4404 case "$ok" in
4405 false)
4406         cppstdin="$x_cpp"
4407         cppminus="$x_minus"
4408         cpprun="$x_cpp"
4409         cpplast="$x_minus"
4410         set X $x_cpp
4411         shift
4412         case "$1" in
4413         "$cpp")
4414                 echo "Perhaps can we force $cc -E using a wrapper..."
4415                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4416                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4417                 then
4418                         echo "Yup, we can."
4419                         cppstdin="$wrapper"
4420                         cppminus='';
4421                 else
4422                         echo "Nope, we'll have to live without it..."
4423                 fi
4424                 ;;
4425         esac
4426         case "$cpprun" in
4427         "$wrapper")
4428                 cpprun=''
4429                 cpplast=''
4430                 ;;
4431         esac
4432         ;;
4433 esac
4434
4435 case "$cppstdin" in
4436 "$wrapper"|'cppstdin') ;;
4437 *) $rm -f $wrapper;;
4438 esac
4439 $rm -f testcpp.c testcpp.out
4440
4441 : Set private lib path
4442 case "$plibpth" in
4443 '') if ./mips; then
4444                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4445         fi;;
4446 esac
4447 case "$libpth" in
4448 ' ') dlist='';;
4449 '') dlist="$loclibpth $plibpth $glibpth";;
4450 *) dlist="$libpth";;
4451 esac
4452
4453 : Now check and see which directories actually exist, avoiding duplicates
4454 libpth=''
4455 for xxx in $dlist
4456 do
4457     if $test -d $xxx; then
4458                 case " $libpth " in
4459                 *" $xxx "*) ;;
4460                 *) libpth="$libpth $xxx";;
4461                 esac
4462     fi
4463 done
4464 $cat <<'EOM'
4465
4466 Some systems have incompatible or broken versions of libraries.  Among
4467 the directories listed in the question below, please remove any you
4468 know not to be holding relevant libraries, and add any that are needed.
4469 Say "none" for none.
4470
4471 EOM
4472 case "$libpth" in
4473 '') dflt='none';;
4474 *)
4475         set X $libpth
4476         shift
4477         dflt=${1+"$@"}
4478         ;;
4479 esac
4480 rp="Directories to use for library searches?"
4481 . ./myread
4482 case "$ans" in
4483 none) libpth=' ';;
4484 *) libpth="$ans";;
4485 esac
4486
4487 : compute shared library extension
4488 case "$so" in
4489 '')
4490         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4491                 dflt='sl'
4492         else
4493                 dflt='so'
4494         fi
4495         ;;
4496 *) dflt="$so";;
4497 esac
4498 $cat <<EOM
4499
4500 On some systems, shared libraries may be available.  Answer 'none' if
4501 you want to suppress searching of shared libraries for the remainder
4502 of this configuration.
4503
4504 EOM
4505 rp='What is the file extension used for shared libraries?'
4506 . ./myread
4507 so="$ans"
4508
4509 : Define several unixisms.
4510 : Hints files or command line option can be used to override them.
4511 : The convoluted testing is in case hints files set either the old
4512 : or the new name.
4513 case "$_exe" in
4514 '')     case "$exe_ext" in
4515         '')     ;;
4516         *)      _exe="$exe_ext" ;;
4517         esac
4518         ;;
4519 esac
4520 case "$_a" in
4521 '')     case "$lib_ext" in
4522     '') _a='.a';;
4523         *)      _a="$lib_ext" ;;
4524         esac
4525         ;;
4526 esac
4527 case "$_o" in
4528 '') case "$obj_ext" in
4529         '')     _o='.o';;
4530         *)      _o="$obj_ext";;
4531         esac
4532         ;;
4533 esac
4534 case "$p_" in
4535 '') case "$path_sep" in
4536         '')     p_=':';;
4537         *)      p_="$path_sep";;
4538         esac
4539         ;;
4540 esac
4541 exe_ext=$_exe
4542 lib_ext=$_a
4543 obj_ext=$_o
4544 path_sep=$p_
4545
4546 : Which makefile gets called first.  This is used by make depend.
4547 case "$firstmakefile" in
4548 '') firstmakefile='makefile';;
4549 esac
4550
4551 case "$ccflags" in
4552 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4553 esac
4554
4555 case "$uselongdouble" in
4556 $define|true|[yY]*)     dflt='y';;
4557 *) dflt='n';;
4558 esac
4559 cat <<EOM
4560
4561 Perl can be built to take advantage of long doubles which
4562 (if available) may give more accuracy and range for floating point numbers.
4563
4564 If this doesn't make any sense to you, just accept the default '$dflt'.
4565 EOM
4566 rp='Try to use long doubles if available?'
4567 . ./myread
4568 case "$ans" in
4569 y|Y)    val="$define"   ;;
4570 *)      val="$undef"    ;;
4571 esac
4572 set uselongdouble
4573 eval $setvar
4574
4575 case "$uselongdouble" in
4576 true|[yY]*) uselongdouble="$define" ;;
4577 esac
4578
4579 : Look for a hint-file generated 'call-back-unit'.  If the
4580 : user has specified that long doubles should be used,
4581 : we may need to set or change some other defaults.
4582 if $test -f uselongdouble.cbu; then
4583     echo "Your platform has some specific hints regarding long doubles, using them..."
4584     . ./uselongdouble.cbu
4585 else
4586     case "$uselongdouble" in
4587         $define)
4588                 $cat <<EOM
4589 (Your platform does not have any specific hints for long doubles.)
4590 EOM
4591         ;;
4592     esac
4593 fi
4594
4595 : Looking for optional libraries
4596 echo " "
4597 echo "Checking for optional libraries..." >&4
4598 case "$libs" in
4599 ' '|'') dflt='';;
4600 *) dflt="$libs";;
4601 esac
4602 case "$libswanted" in
4603 '') libswanted='c_s';;
4604 esac
4605 case "$usesocks" in
4606 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4607 esac
4608 libsfound=''
4609 libsfiles=''
4610 libsdirs=''
4611 libspath=''
4612 for thisdir in $libpth $xlibpth; do
4613   test -d $thisdir && libspath="$libspath $thisdir"
4614 done
4615 for thislib in $libswanted; do
4616         for thisdir in $libspath; do
4617             xxx=''
4618             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4619                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4620                 $test -f "$xxx" && eval $libscheck
4621                 $test -f "$xxx" && libstyle=shared
4622             fi
4623             if test ! -f "$xxx"; then
4624                 xxx=$thisdir/lib$thislib.$so
4625                 $test -f "$xxx" && eval $libscheck
4626                 $test -f "$xxx" && libstyle=shared
4627             fi  
4628             if test ! -f "$xxx"; then
4629                 xxx=$thisdir/lib$thislib$_a
4630                 $test -f "$xxx" && eval $libscheck
4631                 $test -f "$xxx" && libstyle=static
4632             fi
4633             if test ! -f "$xxx"; then
4634                 xxx=$thisdir/$thislib$_a
4635                 $test -f "$xxx" && eval $libscheck
4636                 $test -f "$xxx" && libstyle=static
4637             fi
4638             if test ! -f "$xxx"; then
4639                 xxx=$thisdir/lib${thislib}_s$_a
4640                 $test -f "$xxx" && eval $libscheck
4641                 $test -f "$xxx" && libstyle=static
4642                 $test -f "$xxx" && thislib=${thislib}_s
4643             fi
4644             if test ! -f "$xxx"; then
4645                 xxx=$thisdir/Slib$thislib$_a
4646                 $test -f "$xxx" && eval $libscheck
4647                 $test -f "$xxx" && libstyle=static
4648             fi
4649             if $test -f "$xxx"; then
4650                 case "$libstyle" in
4651                 shared) echo "Found -l$thislib (shared)." ;;
4652                 static) echo "Found -l$thislib." ;;
4653                 *)      echo "Found -l$thislib ($libstyle)." ;;
4654                 esac
4655                 case " $dflt " in
4656                 *"-l$thislib "*);;
4657                 *) dflt="$dflt -l$thislib"
4658                    libsfound="$libsfound $xxx"
4659                    yyy=`basename $xxx`
4660                    libsfiles="$libsfiles $yyy"
4661                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4662                    case " $libsdirs " in
4663                    *" $yyy "*) ;;
4664                    *) libsdirs="$libsdirs $yyy" ;;
4665                    esac
4666                    ;;
4667                 esac
4668                 break
4669             fi  
4670         done
4671         if $test ! -f "$xxx"; then
4672             echo "No -l$thislib."
4673         fi
4674 done
4675 set X $dflt
4676 shift
4677 dflt="$*"
4678 case "$libs" in
4679 '') dflt="$dflt";;
4680 *) dflt="$libs";;
4681 esac
4682 case "$dflt" in
4683 ' '|'') dflt='none';;
4684 esac
4685
4686 $cat <<EOM
4687
4688 In order to compile $package on your machine, a number of libraries
4689 are usually needed.  Include any other special libraries here as well.
4690 Say "none" for none.  The default list is almost always right.
4691 EOM
4692
4693 echo " "
4694 rp="What libraries to use?"
4695 . ./myread
4696 case "$ans" in
4697 none) libs=' ';;
4698 *) libs="$ans";;
4699 esac
4700
4701 : determine optimization, if desired, or use for debug flag also
4702 case "$optimize" in
4703 ' '|$undef) dflt='none';;
4704 '') dflt='-O';;
4705 *) dflt="$optimize";;
4706 esac
4707 $cat <<EOH
4708
4709 By default, $package compiles with the -O flag to use the optimizer.
4710 Alternately, you might want to use the symbolic debugger, which uses
4711 the -g flag (on traditional Unix systems).  Either flag can be
4712 specified here.  To use neither flag, specify the word "none".
4713
4714 EOH
4715 rp="What optimizer/debugger flag should be used?"
4716 . ./myread
4717 optimize="$ans"
4718 case "$optimize" in
4719 'none') optimize=" ";;
4720 esac
4721
4722 dflt=''
4723 : We will not override a previous value, but we might want to
4724 : augment a hint file
4725 case "$hint" in
4726 default|recommended)
4727         case "$gccversion" in
4728         1*) dflt='-fpcc-struct-return' ;;
4729         esac
4730         case "$optimize" in
4731         *-g*) dflt="$dflt -DDEBUGGING";;
4732         esac
4733         case "$gccversion" in
4734         2*) if test -d /etc/conf/kconfig.d &&
4735                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4736                 then
4737                         # Interactive Systems (ISC) POSIX mode.
4738                         dflt="$dflt -posix"
4739                 fi
4740                 ;;
4741         esac
4742         case "$gccversion" in
4743         1*) ;;
4744         2.[0-8]*) ;;
4745         ?*)     echo " "
4746                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4747                 echo 'int main(void) { return 0; }' > gcctest.c
4748                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4749                         echo "Yes, it does." 2>&1
4750                         case "$ccflags" in
4751                         *strict-aliasing*)
4752                                 echo "Leaving current flags $ccflags alone." 2>&1
4753                                 ;;
4754                         *) dflt="$dflt -fno-strict-aliasing" ;;
4755                         esac
4756                 else
4757                         echo "Nope, it doesn't, but that's ok." 2>&1
4758                 fi
4759                 ;;
4760         esac
4761         # For gcc, adding -pipe speeds up compilations for some, but apparently
4762         # some assemblers can't read from stdin.  (It also slows down compilations
4763         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4764         case "$gccversion" in
4765         ?*)     echo " "
4766                 echo "Checking if your compiler accepts -pipe" 2>&1
4767                 echo 'int main(void) { return 0; }' > gcctest.c
4768                 if $cc -pipe -o gcctest gcctest.c; then
4769                         echo "Yes, it does." 2>&1
4770                         case "$ccflags" in
4771                         *-pipe*)
4772                                 echo "Leaving current flags $ccflags alone." 2>&1
4773                                 ;;
4774                         *) dflt="$dflt -pipe" ;;
4775                         esac
4776                 else
4777                         echo "Nope, it doesn't, but that's ok." 2>&1
4778                 fi
4779
4780                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4781                 echo 'int main(void) { return 0; }' > gcctest.c
4782                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4783                         echo "Yes, it does." 2>&1
4784                         case "$ccflags" in
4785                         *-Wdeclaration-after-statement*)
4786                                 echo "Leaving current flags $ccflags alone." 2>&1
4787                                 ;;
4788                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4789                         esac
4790                 else
4791                         echo "Nope, it doesn't, but that's ok." 2>&1
4792                 fi
4793                 ;;
4794         esac
4795         ;;
4796 esac
4797
4798 case "$mips_type" in
4799 *BSD*|'') inclwanted="$locincpth $usrinc";;
4800 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4801 esac
4802 for thisincl in $inclwanted; do
4803         if $test -d $thisincl; then
4804                 if $test x$thisincl != x$usrinc; then
4805                         case "$dflt" in
4806                         *" -I$thisincl "*);;
4807                         *) dflt="$dflt -I$thisincl ";;
4808                         esac
4809                 fi
4810         fi
4811 done
4812
4813 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4814         xxx=true;
4815 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4816         xxx=true;
4817 else
4818         xxx=false;
4819 fi;
4820 if $xxx; then
4821         case "$dflt" in
4822         *$2*);;
4823         *) dflt="$dflt -D$2";;
4824         esac;
4825 fi'
4826
4827 set signal.h LANGUAGE_C; eval $inctest
4828
4829 case "$usesocks" in
4830 $define)
4831         ccflags="$ccflags -DSOCKS"
4832         ;;
4833 esac
4834
4835 case "$hint" in
4836 default|recommended) dflt="$ccflags $dflt" ;;
4837 *) dflt="$ccflags";;
4838 esac
4839
4840 case "$dflt" in
4841 ''|' ') dflt=none;;
4842 esac
4843
4844 $cat <<EOH
4845
4846 Your C compiler may want other flags.  For this question you should include
4847 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4848 but you should NOT include libraries or ld flags like -lwhatever.  If you
4849 want $package to honor its debug switch, you should include -DDEBUGGING here.
4850 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4851
4852 To use no flags, specify the word "none".
4853
4854 EOH
4855 set X $dflt
4856 shift
4857 dflt=${1+"$@"}
4858 rp="Any additional cc flags?"
4859 . ./myread
4860 case "$ans" in
4861 none) ccflags='';;
4862 *) ccflags="$ans";;
4863 esac
4864
4865 : the following weeds options from ccflags that are of no interest to cpp
4866 case "$cppflags" in
4867 '') cppflags="$ccflags" ;;
4868 *)  cppflags="$cppflags $ccflags" ;;
4869 esac
4870 case "$gccversion" in
4871 1*) cppflags="$cppflags -D__GNUC__"
4872 esac
4873 case "$mips_type" in
4874 '');;
4875 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4876 esac
4877 case "$cppflags" in
4878 '');;
4879 *)
4880         echo " "
4881         echo "Let me guess what the preprocessor flags are..." >&4
4882         set X $cppflags
4883         shift
4884         cppflags=''
4885         $cat >cpp.c <<'EOM'
4886 #define BLURFL foo
4887
4888 BLURFL xx LFRULB
4889 EOM
4890         previous=''
4891         for flag in $*
4892         do
4893                 case "$flag" in
4894                 -*) ftry="$flag";;
4895                 *) ftry="$previous $flag";;
4896                 esac
4897                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4898                         >cpp1.out 2>/dev/null && \
4899                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4900                         >cpp2.out 2>/dev/null && \
4901                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4902                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4903                 then
4904                         cppflags="$cppflags $ftry"
4905                         previous=''
4906                 else
4907                         previous="$flag"
4908                 fi
4909         done
4910         set X $cppflags
4911         shift
4912         cppflags=${1+"$@"}
4913         case "$cppflags" in
4914         *-*)  echo "They appear to be: $cppflags";;
4915         esac
4916         $rm -f cpp.c cpp?.out
4917         ;;
4918 esac
4919
4920 : flags used in final linking phase
4921 case "$ldflags" in
4922 '') if ./venix; then
4923                 dflt='-i -z'
4924         else
4925                 dflt=''
4926         fi
4927         case "$ccflags" in
4928         *-posix*) dflt="$dflt -posix" ;;
4929         esac
4930         ;;
4931 *) dflt="$ldflags";;
4932 esac
4933
4934 : Try to guess additional flags to pick up local libraries.
4935 for thislibdir in $libpth; do
4936         case " $loclibpth " in
4937         *" $thislibdir "*)
4938                 case "$dflt " in
4939                 *"-L$thislibdir "*) ;;
4940                 *)  dflt="$dflt -L$thislibdir" ;;
4941                 esac
4942                 ;;
4943         esac
4944 done
4945
4946 case "$dflt" in
4947 '') dflt='none' ;;
4948 esac
4949
4950 $cat <<EOH
4951
4952 Your C linker may need flags.  For this question you should
4953 include -L/whatever and any other flags used by the C linker, but you
4954 should NOT include libraries like -lwhatever.
4955
4956 Make sure you include the appropriate -L/path flags if your C linker
4957 does not normally search all of the directories you specified above,
4958 namely
4959         $libpth
4960 To use no flags, specify the word "none".
4961
4962 EOH
4963
4964 rp="Any additional ld flags (NOT including libraries)?"
4965 . ./myread
4966 case "$ans" in
4967 none) ldflags='';;
4968 *) ldflags="$ans";;
4969 esac
4970 rmlist="$rmlist pdp11"
4971
4972 : coherency check
4973 echo " "
4974 echo "Checking your choice of C compiler and flags for coherency..." >&4
4975 $cat > try.c <<'EOF'
4976 #include <stdio.h>
4977 int main() { printf("Ok\n"); return(0); }
4978 EOF
4979 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4980 shift
4981 $cat >try.msg <<'EOM'
4982 I've tried to compile and run the following simple program:
4983
4984 EOM
4985 $cat try.c >> try.msg
4986
4987 $cat >> try.msg <<EOM
4988
4989 I used the command:
4990
4991         $*
4992         $run ./try
4993
4994 and I got the following output:
4995
4996 EOM
4997 dflt=y
4998 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4999         if $sh -c "$run ./try" >>try.msg 2>&1; then
5000                 xxx=`$run ./try`
5001                 case "$xxx" in
5002                 "Ok") dflt=n ;;
5003                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5004                         case " $libs " in
5005                         *" -lsfio "*)
5006                                 cat >> try.msg <<'EOQS'
5007 If $libs contains -lsfio, and sfio is mis-configured, then it
5008 sometimes (apparently) runs and exits with a 0 status, but with no
5009 output!  It may have to do with sfio's use of _exit vs. exit.
5010
5011 EOQS
5012                                 rp="You have a big problem.  Shall I abort Configure"
5013                                 dflt=y
5014                                 ;;
5015                         esac
5016                         ;;
5017                 esac
5018         else
5019                 echo "The program compiled OK, but exited with status $?." >>try.msg
5020                 rp="You have a problem.  Shall I abort Configure"
5021                 dflt=y
5022         fi
5023 else
5024         echo "I can't compile the test program." >>try.msg
5025         rp="You have a BIG problem.  Shall I abort Configure"
5026         dflt=y
5027 fi
5028 case "$dflt" in
5029 y)
5030         $cat try.msg >&4
5031         case "$knowitall" in
5032         '')
5033                 echo "(The supplied flags or libraries might be incorrect.)"
5034                 ;;
5035         *) dflt=n;;
5036         esac
5037         echo " "
5038         . ./myread
5039         case "$ans" in
5040         n*|N*) ;;
5041         *)      echo "Ok.  Stopping Configure." >&4
5042                 exit 1
5043                 ;;
5044         esac
5045         ;;
5046 n) echo "OK, that should do.";;
5047 esac
5048 $rm -f try try.* core
5049
5050 : define a shorthand compile call
5051 compile='
5052 mc_file=$1;
5053 shift;
5054 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5055 : define a shorthand compile call for compilations that should be ok.
5056 compile_ok='
5057 mc_file=$1;
5058 shift;
5059 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5060
5061 : determine filename position in cpp output
5062 echo " "
5063 echo "Computing filename position in cpp output for #include directives..." >&4
5064 case "$osname" in
5065 vos) testaccess=-e ;;
5066 *)   testaccess=-r ;;
5067 esac
5068 echo '#include <stdio.h>' > foo.c
5069 $cat >fieldn <<EOF
5070 $startsh
5071 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5072 $grep '^[       ]*#.*stdio\.h' | \
5073 while read cline; do
5074         pos=1
5075         set \$cline
5076         while $test \$# -gt 0; do
5077                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5078                         echo "\$pos"
5079                         exit 0
5080                 fi
5081                 shift
5082                 pos=\`expr \$pos + 1\`
5083         done
5084 done
5085 EOF
5086 chmod +x fieldn
5087 fieldn=`./fieldn`
5088 $rm -f foo.c fieldn
5089 case $fieldn in
5090 '') pos='???';;
5091 1) pos=first;;
5092 2) pos=second;;
5093 3) pos=third;;
5094 *) pos="${fieldn}th";;
5095 esac
5096 echo "Your cpp writes the filename in the $pos field of the line."
5097
5098 case "$osname" in
5099 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5100 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5101 *)   cppfilter='' ;;
5102 esac
5103 : locate header file
5104 $cat >findhdr <<EOF
5105 $startsh
5106 wanted=\$1
5107 name=''
5108 for usrincdir in $usrinc
5109 do
5110         if test -f \$usrincdir/\$wanted; then
5111                 echo "\$usrincdir/\$wanted"
5112                 exit 0
5113         fi
5114 done
5115 awkprg='{ print \$$fieldn }'
5116 echo "#include <\$wanted>" > foo\$\$.c
5117 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5118 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5119 while read cline; do
5120         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5121         case "\$name" in
5122         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5123         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5124         *) exit 2;;
5125         esac;
5126 done;
5127 #
5128 # status = 0: grep returned 0 lines, case statement not executed
5129 # status = 1: headerfile found
5130 # status = 2: while loop executed, no headerfile found
5131 #
5132 status=\$?
5133 $rm -f foo\$\$.c;
5134 if test \$status -eq 1; then
5135         exit 0;
5136 fi
5137 exit 1
5138 EOF
5139 chmod +x findhdr
5140
5141 : define an alternate in-header-list? function
5142 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5143 cont=true; xxf="echo \"<\$1> found.\" >&4";
5144 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5145 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5146 esac;
5147 case $# in 4) instead=instead;; *) instead="at last";; esac;
5148 while $test "$cont"; do
5149         xxx=`./findhdr $1`
5150         var=$2; eval "was=\$$2";
5151         if $test "$xxx" && $test -r "$xxx";
5152         then eval $xxf;
5153         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5154                 cont="";
5155         else eval $xxnf;
5156         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5157         set $yyy; shift; shift; yyy=$@;
5158         case $# in 0) cont="";;
5159         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5160                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5161         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5162                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5163         esac;
5164 done;
5165 while $test "$yyy";
5166 do set $yyy; var=$2; eval "was=\$$2";
5167         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5168         set $yyy; shift; shift; yyy=$@;
5169 done'
5170
5171 : see if stdlib is available
5172 set stdlib.h i_stdlib
5173 eval $inhdr
5174
5175 : check for lengths of integral types
5176 echo " "
5177 case "$intsize" in
5178 '')
5179         echo "Checking to see how big your integers are..." >&4
5180         $cat >try.c <<EOCP
5181 #include <stdio.h>
5182 #$i_stdlib I_STDLIB
5183 #ifdef I_STDLIB
5184 #include <stdlib.h>
5185 #endif
5186 int main()
5187 {
5188         printf("intsize=%d;\n", (int)sizeof(int));
5189         printf("longsize=%d;\n", (int)sizeof(long));
5190         printf("shortsize=%d;\n", (int)sizeof(short));
5191         exit(0);
5192 }
5193 EOCP
5194         set try
5195         if eval $compile_ok && $run ./try > /dev/null; then
5196                 eval `$run ./try`
5197                 echo "Your integers are $intsize bytes long."
5198                 echo "Your long integers are $longsize bytes long."
5199                 echo "Your short integers are $shortsize bytes long."
5200         else
5201                 $cat >&4 <<EOM
5202 !
5203 Help! I can't compile and run the intsize test program: please enlighten me!
5204 (This is probably a misconfiguration in your system or libraries, and
5205 you really ought to fix it.  Still, I'll try anyway.)
5206 !
5207 EOM
5208                 dflt=4
5209                 rp="What is the size of an integer (in bytes)?"
5210                 . ./myread
5211                 intsize="$ans"
5212                 dflt=$intsize
5213                 rp="What is the size of a long integer (in bytes)?"
5214                 . ./myread
5215                 longsize="$ans"
5216                 dflt=2
5217                 rp="What is the size of a short integer (in bytes)?"
5218                 . ./myread
5219                 shortsize="$ans"
5220         fi
5221         ;;
5222 esac
5223 $rm -f try try.*
5224
5225 : check for long long
5226 echo " "
5227 echo "Checking to see if you have long long..." >&4
5228 echo 'int main() { long long x = 7; return 0; }' > try.c
5229 set try
5230 if eval $compile; then
5231         val="$define"
5232         echo "You have long long."
5233 else
5234         val="$undef"
5235         echo "You do not have long long."
5236 fi
5237 $rm try.*
5238 set d_longlong
5239 eval $setvar
5240
5241 : check for length of long long
5242 case "${d_longlong}${longlongsize}" in
5243 $define)
5244         echo " "
5245         echo "Checking to see how big your long longs are..." >&4
5246         $cat >try.c <<'EOCP'
5247 #include <stdio.h>
5248 int main()
5249 {
5250     printf("%d\n", (int)sizeof(long long));
5251     return(0);
5252 }
5253 EOCP
5254         set try
5255         if eval $compile_ok; then
5256                 longlongsize=`$run ./try`
5257                 echo "Your long longs are $longlongsize bytes long."
5258         else
5259                 dflt='8'
5260                 echo " "
5261                 echo "(I can't seem to compile the test program.  Guessing...)"
5262                 rp="What is the size of a long long (in bytes)?"
5263                 . ./myread
5264                 longlongsize="$ans"
5265         fi
5266         if $test "X$longsize" = "X$longlongsize"; then
5267                 echo "(That isn't any different from an ordinary long.)"
5268         fi      
5269         ;;
5270 esac
5271 $rm -f try.* try
5272
5273 : see if inttypes.h is available
5274 : we want a real compile instead of Inhdr because some systems
5275 : have an inttypes.h which includes non-existent headers
5276 echo " "
5277 $cat >try.c <<EOCP
5278 #include <inttypes.h>
5279 int main() {
5280         static int32_t foo32 = 0x12345678;
5281 }
5282 EOCP
5283 set try
5284 if eval $compile; then
5285         echo "<inttypes.h> found." >&4
5286         val="$define"
5287 else
5288         echo "<inttypes.h> NOT found." >&4
5289         val="$undef"
5290 fi
5291 $rm -f try.c try
5292 set i_inttypes
5293 eval $setvar
5294
5295 : check for int64_t
5296 echo " "
5297 echo "Checking to see if you have int64_t..." >&4
5298 $cat >try.c <<EOCP
5299 #include <sys/types.h>
5300 #$i_inttypes I_INTTYPES
5301 #ifdef I_INTTYPES
5302 #include <inttypes.h>
5303 #endif
5304 int main() { int64_t x = 7; }
5305 EOCP
5306 set try
5307 if eval $compile; then
5308         val="$define"
5309         echo "You have int64_t."
5310 else
5311         val="$undef"
5312         echo "You do not have int64_t."
5313 fi
5314 $rm -f try try.*
5315 set d_int64_t
5316 eval $setvar
5317
5318
5319 echo " "
5320 echo "Checking which 64-bit integer type we could use..." >&4
5321
5322 case "$intsize" in
5323 8) val=int
5324    set quadtype
5325    eval $setvar
5326    val='"unsigned int"'
5327    set uquadtype
5328    eval $setvar
5329    quadkind=1
5330    ;;
5331 *) case "$longsize" in
5332    8) val=long
5333       set quadtype
5334       eval $setvar
5335       val='"unsigned long"'
5336       set uquadtype
5337       eval $setvar
5338       quadkind=2
5339       ;;
5340    *) case "$d_longlong:$longlongsize" in
5341       define:8)
5342         val='"long long"'
5343         set quadtype
5344         eval $setvar
5345         val='"unsigned long long"'
5346         set uquadtype
5347         eval $setvar
5348         quadkind=3
5349         ;;
5350       *) case "$d_int64_t" in
5351          define)
5352            val=int64_t
5353            set quadtype
5354            eval $setvar
5355            val=uint64_t
5356            set uquadtype
5357            eval $setvar
5358            quadkind=4
5359            ;;
5360          esac
5361          ;;
5362       esac
5363       ;;
5364    esac
5365    ;;
5366 esac
5367
5368 case "$quadtype" in
5369 '')     echo "Alas, no 64-bit integer types in sight." >&4
5370         d_quad="$undef"
5371         ;;
5372 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5373         d_quad="$define"
5374         ;;
5375 esac
5376
5377
5378 case "$uselonglong" in
5379 "$define"|true|[yY]*)
5380         cat <<EOM >&4
5381
5382 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5383 EOM
5384         use64bitint="$define"
5385         ;;
5386 esac                          
5387 case "$use64bits" in
5388 "$define"|true|[yY]*)
5389         cat <<EOM >&4
5390
5391 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5392 EOM
5393         use64bitint="$define"
5394         ;;
5395 esac                          
5396 case "$use64bitints" in
5397 "$define"|true|[yY]*)
5398         cat <<EOM >&4
5399
5400 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5401 EOM
5402         use64bitint="$define"
5403         ;;
5404 esac                          
5405 case "$use64bitsint" in
5406 "$define"|true|[yY]*)
5407         cat <<EOM >&4
5408
5409 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5410 EOM
5411         use64bitint="$define"
5412         ;;
5413 esac                          
5414 case "$uselonglongs" in
5415 "$define"|true|[yY]*)
5416         cat <<EOM >&4
5417
5418 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5419 EOM
5420         use64bitint="$define"
5421         ;;
5422 esac                          
5423 case "$use64bitsall" in
5424 "$define"|true|[yY]*)
5425         cat <<EOM >&4
5426
5427 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5428 EOM
5429         use64bitall="$define"
5430         ;;
5431 esac                          
5432
5433 case "$ccflags" in
5434 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5435 esac
5436 case "$use64bitall" in
5437 "$define"|true|[yY]*) use64bitint="$define" ;;
5438 esac
5439
5440 case "$longsize" in
5441 8) cat <<EOM
5442
5443 You have natively 64-bit long integers.
5444 EOM
5445    val="$define"
5446    ;;
5447 *) case "$use64bitint" in
5448    "$define"|true|[yY]*) dflt='y';;
5449    *) dflt='n';;
5450    esac
5451    case "$d_quad" in
5452    "$define") ;;
5453    *) dflt='n' ;;
5454    esac
5455    cat <<EOM
5456
5457 Perl can be built to take advantage of 64-bit integer types
5458 on some systems.  To do so, Configure can be run with -Duse64bitint.
5459 Choosing this option will most probably introduce binary incompatibilities.
5460
5461 If this doesn't make any sense to you, just accept the default '$dflt'.
5462 (The default has been chosen based on your configuration.)
5463 EOM
5464    rp='Try to use 64-bit integers, if available?'
5465    . ./myread
5466    case "$ans" in
5467    [yY]*) val="$define" ;;
5468    *)     val="$undef"  ;;
5469    esac
5470    ;;
5471 esac
5472 set use64bitint
5473 eval $setvar
5474
5475 case "$use64bitall" in
5476 "$define"|true|[yY]*) dflt='y' ;;
5477 *) case "$longsize" in
5478    8) dflt='y' ;;
5479    *) dflt='n' ;;
5480    esac
5481    ;;
5482 esac    
5483 cat <<EOM
5484
5485 You may also choose to try maximal 64-bitness.  It means using as much
5486 64-bitness as possible on the platform.  This in turn means even more
5487 binary incompatibilities.  On the other hand, your platform may not
5488 have any more 64-bitness available than what you already have chosen.
5489
5490 If this doesn't make any sense to you, just accept the default '$dflt'.
5491 (The default has been chosen based on your configuration.)
5492 EOM
5493 rp='Try to use maximal 64-bit support, if available?'
5494 . ./myread
5495 case "$ans" in
5496 [yY]*) val="$define" ;;
5497 *)     val="$undef"  ;;
5498 esac
5499 set use64bitall
5500 eval $setvar
5501 case "$use64bitall" in
5502 "$define")
5503         case "$use64bitint" in
5504         "$undef")
5505                 cat <<EOM
5506
5507 Since you have chosen a maximally 64-bit build, I'm also turning on
5508 the use of 64-bit integers.
5509 EOM
5510                 use64bitint="$define" ;;
5511         esac
5512         ;;
5513 esac
5514
5515 : Look for a hint-file generated 'call-back-unit'.  If the
5516 : user has specified that a 64-bit perl is to be built,
5517 : we may need to set or change some other defaults.
5518 if $test -f use64bitint.cbu; then
5519         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5520         . ./use64bitint.cbu
5521 fi
5522 case "$use64bitint" in
5523 "$define"|true|[yY]*)
5524         case "$longsize" in
5525         4) case "$archname64" in
5526            '') archname64=64int ;;
5527            esac
5528            ;;
5529         esac
5530         ;;
5531 esac
5532
5533 : Look for a hint-file generated 'call-back-unit'.  If the
5534 : user has specified that a maximally 64-bit perl is to be built,
5535 : we may need to set or change some other defaults.
5536 if $test -f use64bitall.cbu; then
5537         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5538         . ./use64bitall.cbu
5539 fi
5540 case "$use64bitall" in
5541 "$define"|true|[yY]*)
5542         case "$longsize" in
5543         4) case "$archname64" in
5544            ''|64int) archname64=64all ;;
5545            esac
5546            ;;
5547         esac
5548         ;;
5549 esac
5550
5551 case "$d_quad:$use64bitint" in
5552 $undef:$define)
5553         cat >&4 <<EOF
5554
5555 *** You have chosen to use 64-bit integers,
5556 *** but none can be found.
5557 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5558 *** Cannot continue, aborting.
5559
5560 EOF
5561         exit 1
5562         ;;
5563 esac
5564
5565 : check for length of double
5566 echo " "
5567 case "$doublesize" in
5568 '')
5569         echo "Checking to see how big your double precision numbers are..." >&4
5570         $cat >try.c <<EOCP
5571 #include <stdio.h>
5572 #$i_stdlib I_STDLIB
5573 #ifdef I_STDLIB
5574 #include <stdlib.h>
5575 #endif
5576 int main()
5577 {
5578     printf("%d\n", (int)sizeof(double));
5579     exit(0);
5580 }
5581 EOCP
5582         set try
5583         if eval $compile_ok; then
5584                 doublesize=`$run ./try`
5585                 echo "Your double is $doublesize bytes long."
5586         else
5587                 dflt='8'
5588                 echo "(I can't seem to compile the test program.  Guessing...)"
5589                 rp="What is the size of a double precision number (in bytes)?"
5590                 . ./myread
5591                 doublesize="$ans"
5592         fi
5593         ;;
5594 esac
5595 $rm -f try.c try
5596
5597 : check for long doubles
5598 echo " "
5599 echo "Checking to see if you have long double..." >&4
5600 echo 'int main() { long double x = 7.0; }' > try.c
5601 set try
5602 if eval $compile; then
5603         val="$define"
5604         echo "You have long double."
5605 else
5606         val="$undef"
5607         echo "You do not have long double."
5608 fi
5609 $rm try.*
5610 set d_longdbl
5611 eval $setvar
5612
5613 : check for length of long double
5614 case "${d_longdbl}${longdblsize}" in
5615 $define)
5616         echo " "
5617         echo "Checking to see how big your long doubles are..." >&4
5618         $cat >try.c <<'EOCP'
5619 #include <stdio.h>
5620 int main()
5621 {
5622         printf("%d\n", sizeof(long double));
5623 }
5624 EOCP
5625         set try
5626         set try
5627         if eval $compile; then
5628                 longdblsize=`$run ./try`
5629                 echo "Your long doubles are $longdblsize bytes long."
5630         else
5631                 dflt='8'
5632                 echo " "
5633                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5634                 rp="What is the size of a long double (in bytes)?"
5635                 . ./myread
5636                 longdblsize="$ans"
5637         fi
5638         if $test "X$doublesize" = "X$longdblsize"; then
5639                 echo "That isn't any different from an ordinary double."
5640                 echo "I'll keep your setting anyway, but you may see some"
5641                 echo "harmless compilation warnings."
5642         fi      
5643         ;;
5644 esac
5645 $rm -f try.* try
5646
5647 : determine the architecture name
5648 echo " "
5649 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5650         tarch=`arch`"-$osname"
5651 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5652         if uname -m > tmparch 2>&1 ; then
5653                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5654                         -e 's/$/'"-$osname/" tmparch`
5655         else
5656                 tarch="$osname"
5657         fi
5658         $rm -f tmparch
5659 else
5660         tarch="$osname"
5661 fi
5662 case "$myarchname" in
5663 ''|"$tarch") ;;
5664 *)
5665         echo "(Your architecture name used to be $myarchname.)"
5666         archname=''
5667         ;;
5668 esac
5669 case "$targetarch" in
5670 '') ;;
5671 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5672 esac
5673 myarchname="$tarch"
5674 case "$archname" in
5675 '') dflt="$tarch";;
5676 *) dflt="$archname";;
5677 esac
5678 rp='What is your architecture name'
5679 . ./myread
5680 archname="$ans"
5681 case "$usethreads" in
5682 $define)
5683         echo "Threads selected." >&4
5684         case "$archname" in
5685         *-thread*) echo "...and architecture name already has -thread." >&4
5686                 ;;
5687         *)      archname="$archname-thread"
5688                 echo "...setting architecture name to $archname." >&4
5689                 ;;
5690         esac
5691         ;;
5692 esac
5693 case "$usemultiplicity" in
5694 $define)
5695         echo "Multiplicity selected." >&4
5696         case "$archname" in
5697         *-multi*) echo "...and architecture name already has -multi." >&4
5698                 ;;
5699         *)      archname="$archname-multi"
5700                 echo "...setting architecture name to $archname." >&4
5701                 ;;
5702         esac
5703         ;;
5704 esac
5705 case "$use64bitint$use64bitall" in
5706 *"$define"*)
5707         case "$archname64" in
5708         '')
5709                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5710                 ;;
5711         *)
5712                 case "$use64bitint" in
5713                 "$define") echo "64 bit integers selected." >&4 ;;
5714                 esac
5715                 case "$use64bitall" in
5716                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5717                 esac
5718                 case "$archname" in
5719                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5720                         ;;
5721                 *)      archname="$archname-$archname64"
5722                         echo "...setting architecture name to $archname." >&4
5723                         ;;
5724                 esac
5725                 ;;
5726         esac
5727 esac
5728 case "$uselongdouble" in
5729 $define)
5730         echo "Long doubles selected." >&4
5731         case "$longdblsize" in
5732         $doublesize)
5733                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5734                 ;;
5735         *)
5736                 case "$archname" in
5737                 *-ld*) echo "...and architecture name already has -ld." >&4
5738                         ;;
5739                 *)      archname="$archname-ld"
5740                         echo "...setting architecture name to $archname." >&4
5741                         ;;
5742                 esac
5743                 ;;
5744         esac
5745         ;;
5746 esac
5747 case "$useperlio" in
5748 $define)
5749         echo "Perlio selected." >&4
5750         ;;
5751 *)
5752         echo "Perlio not selected, using stdio." >&4
5753         case "$archname" in
5754         *-stdio*) echo "...and architecture name already has -stdio." >&4
5755                 ;;
5756         *)      archname="$archname-stdio"
5757                 echo "...setting architecture name to $archname." >&4
5758                 ;;
5759         esac
5760         ;;
5761 esac
5762 if $test -f archname.cbu; then
5763         echo "Your platform has some specific hints for architecture name, using them..."
5764         . ./archname.cbu
5765 fi
5766
5767 : determine root of directory hierarchy where package will be installed.
5768 case "$prefix" in
5769 '')
5770         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5771         ;;
5772 *?/)
5773         dflt=`echo "$prefix" | sed 's/.$//'`
5774         ;;
5775 *)
5776         dflt="$prefix"
5777         ;;
5778 esac
5779 $cat <<EOM
5780
5781 By default, $package will be installed in $dflt/bin, manual pages
5782 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5783 installation directories. Typically this is something like /usr/local.
5784 If you wish to have binaries under /usr/bin but other parts of the
5785 installation under /usr/local, that's ok: you will be prompted
5786 separately for each of the installation directories, the prefix being
5787 only used to set the defaults.
5788
5789 EOM
5790 fn=d~
5791 rp='Installation prefix to use?'
5792 . ./getfile
5793 oldprefix=''
5794 case "$prefix" in
5795 '') ;;
5796 *)
5797         case "$ans" in
5798         "$prefix") ;;
5799         *) oldprefix="$prefix";;
5800         esac
5801         ;;
5802 esac
5803 prefix="$ans"
5804 prefixexp="$ansexp"
5805
5806 case "$afsroot" in
5807 '')     afsroot=/afs ;;
5808 *)      afsroot=$afsroot ;;
5809 esac
5810
5811 : is AFS running?
5812 echo " "
5813 case "$afs" in
5814 $define|true)   afs=true ;;
5815 $undef|false)   afs=false ;;
5816 *)      if test -d $afsroot; then
5817                 afs=true
5818         else
5819                 afs=false
5820         fi
5821         ;;
5822 esac
5823 if $afs; then
5824         echo "AFS may be running... I'll be extra cautious then..." >&4
5825 else
5826         echo "AFS does not seem to be running..." >&4
5827 fi
5828
5829 : determine installation prefix for where package is to be installed.
5830 if $afs; then 
5831 $cat <<EOM
5832
5833 Since you are running AFS, I need to distinguish the directory in which
5834 files will reside from the directory in which they are installed (and from
5835 which they are presumably copied to the former directory by occult means).
5836
5837 EOM
5838         case "$installprefix" in
5839         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5840         *) dflt="$installprefix";;
5841         esac
5842 else
5843 $cat <<EOM
5844
5845 In some special cases, particularly when building $package for distribution,
5846 it is convenient to distinguish the directory in which files should be
5847 installed from the directory ($prefix) in which they will
5848 eventually reside.  For most users, these two directories are the same.
5849
5850 EOM
5851         case "$installprefix" in
5852         '') dflt=$prefix ;;
5853         *) dflt=$installprefix;;
5854         esac
5855 fi
5856 fn=d~
5857 rp='What installation prefix should I use for installing files?'
5858 . ./getfile
5859 installprefix="$ans"
5860 installprefixexp="$ansexp"
5861
5862 : set the prefixit variable, to compute a suitable default value
5863 prefixit='case "$3" in
5864 ""|none)
5865         case "$oldprefix" in
5866         "") eval "$1=\"\$$2\"";;
5867         *)
5868                 case "$3" in
5869                 "") eval "$1=";;
5870                 none)
5871                         eval "tp=\"\$$2\"";
5872                         case "$tp" in
5873                         ""|" ") eval "$1=\"\$$2\"";;
5874                         *) eval "$1=";;
5875                         esac;;
5876                 esac;;
5877         esac;;
5878 *)
5879         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5880         case "$tp" in
5881         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5882         /*-$oldprefix/*|\~*-$oldprefix/*)
5883                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5884         *) eval "$1=\"\$$2\"";;
5885         esac;;
5886 esac'
5887
5888 : get the patchlevel
5889 echo " "
5890 echo "Getting the current patchlevel..." >&4
5891 if $test -r $rsrc/patchlevel.h;then
5892         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5893         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5894         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5895         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5896         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5897         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5898        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5899 else
5900         revision=0
5901         patchlevel=0
5902         subversion=0
5903         api_revision=0
5904         api_version=0
5905         api_subversion=0
5906         perl_patchlevel=0
5907         $echo "(You do not have patchlevel.h.  Eek.)"
5908 fi
5909 if $test -r $rsrc/.patch ; then  
5910         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5911                 perl_patchlevel=`cat $rsrc/.patch`
5912         fi
5913 fi
5914 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5915 version_patchlevel_string="version $patchlevel subversion $subversion"
5916 case "$perl_patchlevel" in
5917 0|'') ;;
5918 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5919 esac
5920
5921 $echo "(You have $package $version_patchlevel_string.)"
5922
5923 case "$osname" in
5924 dos|vms)
5925         : XXX Should be a Configure test for double-dots in filenames.
5926         version=`echo $revision $patchlevel $subversion | \
5927                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5928         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5929                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5930         ;;
5931 *)
5932         version=`echo $revision $patchlevel $subversion | \
5933                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5934         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5935                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5936         ;;
5937 esac
5938 : Special case the 5.005_xx maintenance series, which used 5.005
5939 : without any subversion label as a subdirectory in $sitelib
5940 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5941         api_versionstring='5.005'
5942 fi
5943
5944 : determine installation style
5945 : For now, try to deduce it from prefix unless it is already set.
5946 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5947 case "$installstyle" in
5948 '')     case "$prefix" in
5949                 *perl*) dflt='lib';;
5950                 *) dflt='lib/perl5' ;;
5951         esac
5952         ;;
5953 *)      dflt="$installstyle" ;;
5954 esac
5955 : Probably not worth prompting for this since we prompt for all
5956 : the directories individually, and the prompt would be too long and
5957 : confusing anyway.
5958 installstyle=$dflt
5959
5960 : determine where private library files go
5961 : Usual default is /usr/local/lib/perl5/$version.
5962 : Also allow things like /opt/perl/lib/$version, since 
5963 : /opt/perl/lib/perl5... would be redundant.
5964 : The default "style" setting is made in installstyle.U
5965 case "$installstyle" in
5966 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5967 *)       set dflt privlib lib/$version ;;
5968 esac
5969 eval $prefixit
5970 $cat <<EOM
5971
5972 There are some auxiliary files for $package that need to be put into a
5973 private library directory that is accessible by everyone.
5974
5975 EOM
5976 fn=d~+
5977 rp='Pathname where the private library files will reside?'
5978 . ./getfile
5979 privlib="$ans"
5980 privlibexp="$ansexp"
5981 : Change installation prefix, if necessary.
5982 if $test X"$prefix" != X"$installprefix"; then
5983         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5984 else
5985         installprivlib="$privlibexp"
5986 fi
5987
5988 : set the prefixup variable, to restore leading tilda escape
5989 prefixup='case "$prefixexp" in
5990 "$prefix") ;;
5991 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5992 esac'
5993
5994 : determine where public architecture dependent libraries go
5995 set archlib archlib
5996 eval $prefixit
5997 : privlib default is /usr/local/lib/$package/$version
5998 : archlib default is /usr/local/lib/$package/$version/$archname
5999 : privlib may have an optional trailing /share.
6000 tdflt=`echo $privlib | $sed 's,/share$,,'`
6001 tdflt=$tdflt/$archname
6002 case "$archlib" in
6003 '')     dflt=$tdflt
6004         ;;
6005 *)      dflt="$archlib"
6006     ;;
6007 esac
6008 $cat <<EOM
6009
6010 $spackage contains architecture-dependent library files.  If you are
6011 sharing libraries in a heterogeneous environment, you might store
6012 these files in a separate location.  Otherwise, you can just include
6013 them with the rest of the public library files.
6014
6015 EOM
6016 fn=d+~
6017 rp='Where do you want to put the public architecture-dependent libraries?'
6018 . ./getfile
6019 archlib="$ans"
6020 archlibexp="$ansexp"
6021 if $test X"$archlib" = X"$privlib"; then
6022         d_archlib="$undef"
6023 else
6024         d_archlib="$define"
6025 fi
6026 : Change installation prefix, if necessary.
6027 if $test X"$prefix" != X"$installprefix"; then
6028         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6029 else
6030         installarchlib="$archlibexp"
6031 fi
6032
6033 : see if setuid scripts can be secure
6034 $cat <<EOM
6035
6036 Some kernels have a bug that prevents setuid #! scripts from being
6037 secure.  Some sites have disabled setuid #! scripts because of this.
6038
6039 First let's decide if your kernel supports secure setuid #! scripts.
6040 (If setuid #! scripts would be secure but have been disabled anyway,
6041 don't say that they are secure if asked.)
6042
6043 EOM
6044
6045 val="$undef"
6046 if $test -d /dev/fd; then
6047         echo "#!$ls" >reflect
6048         chmod +x,u+s reflect
6049         ./reflect >flect 2>&1
6050         if $contains "/dev/fd" flect >/dev/null; then
6051                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6052                 val="$define"
6053         else
6054                 $cat <<EOM
6055 If you are not sure if they are secure, I can check but I'll need a
6056 username and password different from the one you are using right now.
6057 If you don't have such a username or don't want me to test, simply
6058 enter 'none'.
6059
6060 EOM
6061                 rp='Other username to test security of setuid scripts with?'
6062                 dflt='none'
6063                 . ./myread
6064                 case "$ans" in
6065                 n|none)
6066                         case "$d_suidsafe" in
6067                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6068                                 dflt=n;;
6069                         "$undef")
6070                                 echo "Well, the $hint value is *not* secure." >&4
6071                                 dflt=n;;
6072                         *)      echo "Well, the $hint value *is* secure." >&4
6073                                 dflt=y;;
6074                         esac
6075                         ;;
6076                 *)
6077                         $rm -f reflect flect
6078                         echo "#!$ls" >reflect
6079                         chmod +x,u+s reflect
6080                         echo >flect
6081                         chmod a+w flect
6082                         echo '"su" will (probably) prompt you for '"$ans's password."
6083                         su $ans -c './reflect >flect'
6084                         if $contains "/dev/fd" flect >/dev/null; then
6085                                 echo "Okay, it looks like setuid scripts are secure." >&4
6086                                 dflt=y
6087                         else
6088                                 echo "I don't think setuid scripts are secure." >&4
6089                                 dflt=n
6090                         fi
6091                         ;;
6092                 esac
6093                 rp='Does your kernel have *secure* setuid scripts?'
6094                 . ./myread
6095                 case "$ans" in
6096                 [yY]*)  val="$define";;
6097                 *)      val="$undef";;
6098                 esac
6099         fi
6100 else
6101         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6102         echo "(That's for file descriptors, not floppy disks.)"
6103         val="$undef"
6104 fi
6105 set d_suidsafe
6106 eval $setvar
6107
6108 $rm -f reflect flect
6109
6110 : now see if they want to do setuid emulation
6111 echo " "
6112 val="$undef"
6113 case "$d_suidsafe" in
6114 "$define")
6115         val="$undef"
6116         echo "No need to emulate SUID scripts since they are secure here." >&4
6117         ;;
6118 *)
6119         $cat <<EOM
6120 Some systems have disabled setuid scripts, especially systems where
6121 setuid scripts cannot be secure.  On systems where setuid scripts have
6122 been disabled, the setuid/setgid bits on scripts are currently
6123 useless.  It is possible for $package to detect those bits and emulate
6124 setuid/setgid in a secure fashion.  This emulation will only work if
6125 setuid scripts have been disabled in your kernel.
6126
6127 EOM
6128         case "$d_dosuid" in
6129         "$define") dflt=y ;;
6130         *) dflt=n ;;
6131         esac
6132         rp="Do you want to do setuid/setgid emulation?"
6133         . ./myread
6134         case "$ans" in
6135         [yY]*)  val="$define";;
6136         *)      val="$undef";;
6137         esac
6138         ;;
6139 esac
6140 set d_dosuid
6141 eval $setvar
6142
6143 : see if this is a malloc.h system
6144 : we want a real compile instead of Inhdr because some systems have a
6145 : malloc.h that just gives a compile error saying to use stdlib.h instead
6146 echo " "
6147 $cat >try.c <<EOCP
6148 #include <stdlib.h>
6149 #include <malloc.h>
6150 int main () { return 0; }
6151 EOCP
6152 set try
6153 if eval $compile; then
6154     echo "<malloc.h> found." >&4
6155     val="$define"
6156 else
6157     echo "<malloc.h> NOT found." >&4
6158     val="$undef"
6159 fi
6160 $rm -f try.c try
6161 set i_malloc
6162 eval $setvar
6163
6164 : check for void type
6165 echo " "
6166 echo "Checking to see how well your C compiler groks the void type..." >&4
6167 case "$voidflags" in
6168 '')
6169         $cat >try.c <<EOCP
6170 #$i_stdlib I_STDLIB
6171 #ifdef I_STDLIB
6172 #include <stdlib.h>
6173 #endif
6174 #if TRY & 1
6175 void sub() {
6176 #else
6177 sub() {
6178 #endif
6179         extern void moo();      /* function returning void */
6180         void (*goo)();          /* ptr to func returning void */
6181 #if TRY & 8
6182         void *hue;              /* generic ptr */
6183 #endif
6184 #if TRY & 2
6185         void (*foo[10])();
6186 #endif
6187
6188 #if TRY & 4
6189         if(goo == moo) {
6190                 exit(0);
6191         }
6192 #endif
6193         exit(0);
6194 }
6195 int main() { sub(); }
6196 EOCP
6197         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6198                 voidflags=$defvoidused
6199         echo "Good.  It appears to support void to the level $package wants.">&4
6200                 if $contains warning .out >/dev/null 2>&1; then
6201                         echo "However, you might get some warnings that look like this:"
6202                         $cat .out
6203                 fi
6204         else
6205 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6206                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6207                         echo "It supports 1..."
6208                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6209                                 echo "It also supports 2..."
6210                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6211                                         voidflags=7
6212                                         echo "And it supports 4 but not 8 definitely."
6213                                 else
6214                                         echo "It doesn't support 4..."
6215                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6216                                                 voidflags=11
6217                                                 echo "But it supports 8."
6218                                         else
6219                                                 voidflags=3
6220                                                 echo "Neither does it support 8."
6221                                         fi
6222                                 fi
6223                         else
6224                                 echo "It does not support 2..."
6225                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6226                                         voidflags=13
6227                                         echo "But it supports 4 and 8."
6228                                 else
6229                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6230                                                 voidflags=5
6231                                                 echo "And it supports 4 but has not heard about 8."
6232                                         else
6233                                                 echo "However it supports 8 but not 4."
6234                                         fi
6235                                 fi
6236                         fi
6237                 else
6238                         echo "There is no support at all for void."
6239                         voidflags=0
6240                 fi
6241         fi
6242 esac
6243 case "$voidflags" in
6244 "$defvoidused") ;;
6245 *)      $cat >&4 <<'EOM'
6246   Support flag bits are:
6247     1: basic void declarations.
6248     2: arrays of pointers to functions returning void.
6249     4: operations between pointers to and addresses of void functions.
6250     8: generic void pointers.
6251 EOM
6252         dflt="$voidflags";
6253         rp="Your void support flags add up to what?"
6254         . ./myread
6255         voidflags="$ans"
6256         ;;
6257 esac
6258 $rm -f try.* .out
6259
6260 : check for length of pointer
6261 echo " "
6262 case "$ptrsize" in
6263 '')
6264         echo "Checking to see how big your pointers are..." >&4
6265         if test "$voidflags" -gt 7; then
6266                 echo '#define VOID_PTR char *' > try.c
6267         else
6268                 echo '#define VOID_PTR void *' > try.c
6269         fi
6270         $cat >>try.c <<EOCP
6271 #include <stdio.h>
6272 #$i_stdlib I_STDLIB
6273 #ifdef I_STDLIB
6274 #include <stdlib.h>
6275 #endif
6276 int main()
6277 {
6278     printf("%d\n", (int)sizeof(VOID_PTR));
6279     exit(0);
6280 }
6281 EOCP
6282         set try
6283         if eval $compile_ok; then
6284                 ptrsize=`$run ./try`
6285                 echo "Your pointers are $ptrsize bytes long."
6286         else
6287                 dflt='4'
6288                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6289                 rp="What is the size of a pointer (in bytes)?"
6290                 . ./myread
6291                 ptrsize="$ans"
6292         fi
6293         ;;
6294 esac
6295 $rm -f try.c try
6296 case "$use64bitall" in
6297 "$define"|true|[yY]*)
6298         case "$ptrsize" in
6299         4)      cat <<EOM >&4
6300
6301 *** You have chosen a maximally 64-bit build,
6302 *** but your pointers are only 4 bytes wide.
6303 *** Please rerun Configure without -Duse64bitall.
6304 EOM
6305                 case "$d_quad" in
6306                 define)
6307                         cat <<EOM >&4
6308 *** Since you have quads, you could possibly try with -Duse64bitint.
6309 EOM
6310                         ;;
6311                 esac
6312                 cat <<EOM >&4
6313 *** Cannot continue, aborting.
6314
6315 EOM
6316
6317                 exit 1
6318                 ;;
6319         esac
6320         ;;
6321 esac
6322
6323
6324 : determine whether to use malloc wrapping
6325 echo " "
6326 case "$usemallocwrap" in
6327 [yY]*|true|$define)     dflt='y' ;;
6328 [nN]*|false|$undef)     dflt='n' ;;
6329 *)      case "$usedevel" in
6330         [yY]*|true|$define)     dflt='y' ;;
6331         *) dflt='n' ;;
6332         esac
6333         ;;
6334 esac
6335 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6336 . ./myread
6337 usemallocwrap="$ans"
6338 case "$ans" in
6339 y*|true)
6340         usemallocwrap="$define" ;;
6341 *)
6342         usemallocwrap="$undef" ;;
6343 esac
6344
6345 : determine which malloc to compile in
6346 echo " "
6347 case "$usemymalloc" in
6348 [yY]*|true|$define)     dflt='y' ;;
6349 [nN]*|false|$undef)     dflt='n' ;;
6350 *)      case "$ptrsize" in
6351         4) dflt='y' ;;
6352         *) dflt='n' ;;
6353         esac
6354         ;;
6355 esac
6356 rp="Do you wish to attempt to use the malloc that comes with $package?"
6357 . ./myread
6358 usemymalloc="$ans"
6359 case "$ans" in
6360 y*|true)
6361         usemymalloc='y'
6362         mallocsrc='malloc.c'
6363         mallocobj="malloc$_o"
6364         d_mymalloc="$define"
6365         case "$libs" in
6366         *-lmalloc*)
6367                 : Remove malloc from list of libraries to use
6368                 echo "Removing unneeded -lmalloc from library list" >&4
6369                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6370                 shift
6371                 libs="$*"
6372                 echo "libs = $libs" >&4
6373                 ;;
6374         esac
6375         ;;
6376 *)
6377         usemymalloc='n'
6378         mallocsrc=''
6379         mallocobj=''
6380         d_mymalloc="$undef"
6381         ;;
6382 esac
6383
6384 : compute the return types of malloc and free
6385 echo " "
6386 $cat >malloc.c <<END
6387 #$i_malloc I_MALLOC
6388 #$i_stdlib I_STDLIB
6389 #include <stdio.h>
6390 #include <sys/types.h>
6391 #ifdef I_MALLOC
6392 #include <malloc.h>
6393 #endif
6394 #ifdef I_STDLIB
6395 #include <stdlib.h>
6396 #endif
6397 #ifdef TRY_MALLOC
6398 void *malloc();
6399 #endif
6400 #ifdef TRY_FREE
6401 void free();
6402 #endif
6403 END
6404 case "$malloctype" in
6405 '')
6406         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6407                 malloctype='void *'
6408         else
6409                 malloctype='char *'
6410         fi
6411         ;;
6412 esac
6413 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6414
6415 case "$freetype" in
6416 '')
6417         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6418                 freetype='void'
6419         else
6420                 freetype='int'
6421         fi
6422         ;;
6423 esac
6424 echo "Your system uses $freetype free(), it would seem." >&4
6425 $rm -f malloc.[co]
6426 $cat <<EOM
6427
6428 After $package is installed, you may wish to install various
6429 add-on modules and utilities.  Typically, these add-ons will
6430 be installed under $prefix with the rest
6431 of this package.  However, you may wish to install such add-ons
6432 elsewhere under a different prefix.
6433
6434 If you do not wish to put everything under a single prefix, that's
6435 ok.  You will be prompted for the individual locations; this siteprefix
6436 is only used to suggest the defaults.
6437
6438 The default should be fine for most people.
6439
6440 EOM
6441 fn=d~+
6442 rp='Installation prefix to use for add-on modules and utilities?'
6443 : XXX Here might be another good place for an installstyle setting.
6444 case "$siteprefix" in
6445 '') dflt=$prefix ;;
6446 *)  dflt=$siteprefix ;;
6447 esac
6448 . ./getfile
6449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450 oldsiteprefix=''
6451 case "$siteprefix" in
6452 '') ;;
6453 *)      case "$ans" in
6454         "$prefix") ;;
6455         *) oldsiteprefix="$prefix";;
6456         esac
6457         ;;
6458 esac
6459 siteprefix="$ans"
6460 siteprefixexp="$ansexp"
6461
6462 : determine where site specific libraries go.
6463 : Usual default is /usr/local/lib/perl5/site_perl/$version
6464 : The default "style" setting is made in installstyle.U
6465 : XXX No longer works with Prefixit stuff.
6466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467 case "$sitelib" in
6468 '') case "$installstyle" in
6469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6471         esac
6472         ;;
6473 *)      dflt="$sitelib"
6474         ;;
6475 esac
6476 $cat <<EOM
6477
6478 The installation process will create a directory for
6479 site-specific extensions and modules.  Most users find it convenient
6480 to place all site-specific files in this directory rather than in the
6481 main distribution directory.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific library files?'
6486 . ./getfile
6487 sitelib="$ans"
6488 sitelibexp="$ansexp"
6489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490 : Change installation prefix, if necessary.
6491 if $test X"$prefix" != X"$installprefix"; then
6492         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6493 else
6494         installsitelib="$sitelibexp"
6495 fi
6496
6497 : determine where site specific architecture-dependent libraries go.
6498 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6499 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6500 : sitelib may have an optional trailing /share.
6501 case "$sitearch" in
6502 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6503         dflt="$dflt/$archname"
6504         ;;
6505 *)      dflt="$sitearch"
6506         ;;
6507 esac
6508 set sitearch sitearch none
6509 eval $prefixit
6510 $cat <<EOM
6511
6512 The installation process will also create a directory for
6513 architecture-dependent site-specific extensions and modules.
6514
6515 EOM
6516 fn=d~+
6517 rp='Pathname for the site-specific architecture-dependent library files?'
6518 . ./getfile
6519 sitearch="$ans"
6520 sitearchexp="$ansexp"
6521 : Change installation prefix, if necessary.
6522 if $test X"$prefix" != X"$installprefix"; then
6523         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6524 else
6525         installsitearch="$sitearchexp"
6526 fi
6527
6528 $cat <<EOM
6529
6530 The installation process will also create a directory for
6531 vendor-supplied add-ons.  Vendors who supply perl with their system
6532 may find it convenient to place all vendor-supplied files in this
6533 directory rather than in the main distribution directory.  This will
6534 ease upgrades between binary-compatible maintenance versions of perl.
6535
6536 Of course you may also use these directories in whatever way you see
6537 fit.  For example, you might use them to access modules shared over a
6538 company-wide network.
6539
6540 The default answer should be fine for most people.
6541 This causes further questions about vendor add-ons to be skipped
6542 and no vendor-specific directories will be configured for perl.
6543
6544 EOM
6545 rp='Do you want to configure vendor-specific add-on directories?'
6546 case "$usevendorprefix" in
6547 define|true|[yY]*) dflt=y ;;
6548 *)      : User may have set vendorprefix directly on Configure command line.
6549         case "$vendorprefix" in
6550         ''|' ') dflt=n ;;
6551         *)      dflt=y ;;
6552         esac
6553         ;;
6554 esac
6555 . ./myread
6556 case "$ans" in
6557 [yY]*)  fn=d~+
6558         rp='Installation prefix to use for vendor-supplied add-ons?'
6559         case "$vendorprefix" in
6560         '') dflt='' ;;
6561         *)  dflt=$vendorprefix ;;
6562         esac
6563         . ./getfile
6564         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6565         oldvendorprefix=''
6566         case "$vendorprefix" in
6567         '') ;;
6568         *)      case "$ans" in
6569                 "$prefix") ;;
6570                 *) oldvendorprefix="$prefix";;
6571                 esac
6572                 ;;
6573         esac
6574         usevendorprefix="$define"
6575         vendorprefix="$ans"
6576         vendorprefixexp="$ansexp"
6577         ;;
6578 *)      usevendorprefix="$undef"
6579         vendorprefix=''
6580         vendorprefixexp=''
6581         ;;
6582 esac
6583
6584 case "$vendorprefix" in
6585 '')     d_vendorlib="$undef"
6586         vendorlib=''
6587         vendorlibexp=''
6588         ;;
6589 *)      d_vendorlib="$define"
6590         : determine where vendor-supplied modules go.
6591         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6592         case "$vendorlib" in
6593         '')
6594                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6595                 case "$installstyle" in
6596                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6597                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6598                 esac
6599                 ;;
6600         *)      dflt="$vendorlib"
6601                 ;;
6602         esac
6603         fn=d~+
6604         rp='Pathname for the vendor-supplied library files?'
6605         . ./getfile
6606         vendorlib="$ans"
6607         vendorlibexp="$ansexp"
6608         ;;
6609 esac
6610 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6611 : Change installation prefix, if necessary.
6612 if $test X"$prefix" != X"$installprefix"; then
6613         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6614 else
6615         installvendorlib="$vendorlibexp"
6616 fi
6617
6618 case "$vendorprefix" in
6619 '')     d_vendorarch="$undef"
6620         vendorarch=''
6621         vendorarchexp=''
6622         ;;
6623 *)      d_vendorarch="$define"
6624         : determine where vendor-supplied architecture-dependent libraries go.
6625         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6626         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6627         : vendorlib may have an optional trailing /share.
6628         case "$vendorarch" in
6629         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6630                 dflt="$dflt/$archname"
6631                 ;;
6632         *)      dflt="$vendorarch" ;;
6633         esac
6634         fn=d~+
6635         rp='Pathname for vendor-supplied architecture-dependent files?'
6636         . ./getfile
6637         vendorarch="$ans"
6638         vendorarchexp="$ansexp"
6639         ;;
6640 esac
6641 : Change installation prefix, if necessary.
6642 if $test X"$prefix" != X"$installprefix"; then
6643         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6644 else
6645         installvendorarch="$vendorarchexp"
6646 fi
6647
6648 : Final catch-all directories to search
6649 $cat <<EOM
6650
6651 Lastly, you can have perl look in other directories for extensions and
6652 modules in addition to those already specified.
6653 These directories will be searched after 
6654         $sitearch 
6655         $sitelib 
6656 EOM
6657 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6658 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6659 echo ' '
6660 case "$otherlibdirs" in
6661 ''|' ') dflt='none' ;;
6662 *)      dflt="$otherlibdirs" ;;
6663 esac
6664 $cat <<EOM
6665 Enter a colon-separated set of extra paths to include in perl's @INC
6666 search path, or enter 'none' for no extra paths.
6667
6668 EOM
6669
6670 rp='Colon-separated list of additional directories for perl to search?'
6671 . ./myread
6672 case "$ans" in
6673 ' '|''|none)    otherlibdirs=' ' ;;     
6674 *)      otherlibdirs="$ans" ;;
6675 esac
6676 case "$otherlibdirs" in
6677 ' ') val=$undef ;;
6678 *)      val=$define ;;
6679 esac
6680 set d_perl_otherlibdirs
6681 eval $setvar
6682
6683 : Cruising for prototypes
6684 echo " "
6685 echo "Checking out function prototypes..." >&4
6686 $cat >prototype.c <<EOCP
6687 #$i_stdlib I_STDLIB
6688 #ifdef I_STDLIB
6689 #include <stdlib.h>
6690 #endif
6691 int main(int argc, char *argv[]) {
6692         exit(0);}
6693 EOCP
6694 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6695         echo "Your C compiler appears to support function prototypes."
6696         val="$define"
6697 else
6698         echo "Your C compiler doesn't seem to understand function prototypes."
6699         val="$undef"
6700 fi
6701 set prototype
6702 eval $setvar
6703 $rm -f prototype*
6704
6705 case "$prototype" in
6706 "$define") ;;
6707 *)      ansi2knr='ansi2knr'
6708         echo " "
6709         cat <<EOM >&4
6710
6711 $me:  FATAL ERROR:
6712 This version of $package can only be compiled by a compiler that 
6713 understands function prototypes.  Unfortunately, your C compiler 
6714         $cc $ccflags
6715 doesn't seem to understand them.  Sorry about that.
6716
6717 If GNU cc is available for your system, perhaps you could try that instead.  
6718
6719 Eventually, we hope to support building Perl with pre-ANSI compilers.
6720 If you would like to help in that effort, please contact <perlbug@perl.org>.
6721
6722 Aborting Configure now.
6723 EOM
6724         exit 2
6725         ;;
6726 esac
6727
6728 : determine where public executables go
6729 echo " "
6730 set dflt bin bin
6731 eval $prefixit
6732 fn=d~
6733 rp='Pathname where the public executables will reside?'
6734 . ./getfile
6735 if $test "X$ansexp" != "X$binexp"; then
6736         installbin=''
6737 fi
6738 bin="$ans"
6739 binexp="$ansexp"
6740 : Change installation prefix, if necessary.
6741 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6742 if $test X"$prefix" != X"$installprefix"; then
6743         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6744 else
6745         installbin="$binexp"
6746 fi
6747
6748 echo " "
6749 case "$extras" in
6750 '') dflt='n';;
6751 *) dflt='y';;
6752 esac
6753 cat <<EOM
6754 Perl can be built with extra modules or bundles of modules which
6755 will be fetched from the CPAN and installed alongside Perl.
6756
6757 Notice that you will need access to the CPAN; either via the Internet,
6758 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6759 be asked later to configure the CPAN.pm module which will in turn do
6760 the installation of the rest of the extra modules or bundles.)
6761
6762 Notice also that if the modules require any external software such as
6763 libraries and headers (the libz library and the zlib.h header for the
6764 Compress::Zlib module, for example) you MUST have any such software
6765 already installed, this configuration process will NOT install such
6766 things for you.
6767
6768 If this doesn't make any sense to you, just accept the default '$dflt'.
6769 EOM
6770 rp='Install any extra modules (y or n)?'
6771 . ./myread
6772 case "$ans" in
6773 y|Y)
6774         cat <<EOM
6775
6776 Please list any extra modules or bundles to be installed from CPAN,
6777 with spaces between the names.  The names can be in any format the
6778 'install' command of CPAN.pm will understand.  (Answer 'none',
6779 without the quotes, to install no extra modules or bundles.)
6780 EOM
6781         rp='Extras?'
6782         dflt="$extras"
6783         . ./myread
6784         extras="$ans"
6785 esac
6786 case "$extras" in
6787 ''|'none')
6788         val=''
6789         $rm -f ../extras.lst
6790         ;;
6791 *)      echo "(Saving the list of extras for later...)"
6792         echo "$extras" > ../extras.lst
6793         val="'$extras'"
6794         ;;
6795 esac
6796 set extras
6797 eval $setvar
6798 echo " "
6799
6800 : determine where html pages for programs go
6801 set html1dir html1dir none
6802 eval $prefixit
6803 $cat <<EOM
6804
6805 If you wish to install html files for programs in $spackage, indicate 
6806 the appropriate directory here.  To skip installing html files,
6807 answer "none".
6808 EOM
6809 case "$html1dir" in
6810 ''|none|$undef|' ') dflt=none ;;
6811 *) dflt=$html1dir ;;
6812 esac
6813 fn=dn+~
6814 rp="Directory for the main $spackage html pages?"
6815 . ./getfile
6816 html1dir="$ans"
6817 html1direxp="$ansexp"
6818 : Use ' ' for none so value is preserved next time through Configure
6819 $test X"$html1dir" = "X" && html1dir=' '
6820 : Change installation prefix, if necessary.
6821 if $test X"$prefix" != X"$installprefix"; then
6822         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6823 else
6824         installhtml1dir="$html1direxp"
6825 fi
6826
6827 : determine where html pages for libraries and modules go
6828 set html3dir html3dir none
6829 eval $prefixit
6830 $cat <<EOM
6831
6832 If you wish to install html files for modules associated with $spackage,
6833 indicate the appropriate directory here.  To skip installing html files,
6834 answer "none".
6835 EOM
6836 : There is no obvious default.  If they have specified html1dir, then
6837 : try to key off that, possibly changing .../html1 into .../html3.
6838 case "$html3dir" in
6839 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6840 *) dflt=$html3dir ;;
6841 esac
6842 fn=dn+~
6843 rp="Directory for the $spackage module html pages?"
6844 . ./getfile
6845 html3dir="$ans"
6846 html3direxp="$ansexp"
6847 : Use ' ' for none so value is preserved next time through Configure
6848 $test X"$html3dir" = "X" && html3dir=' '
6849 : Change installation prefix, if necessary.
6850 if $test X"$prefix" != X"$installprefix"; then
6851         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6852 else
6853         installhtml3dir="$html3direxp"
6854 fi
6855
6856 : Find perl5.005 or later.
6857 echo "Looking for a previously installed perl5.005 or later... "
6858 case "$perl5" in
6859 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6860                 : Check if this perl is recent and can load a simple module
6861                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6862                         perl5=$tdir/perl
6863                         break;
6864                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6865                         perl5=$tdir/perl5
6866                         break;
6867                 fi
6868         done
6869         ;;
6870 *)      perl5="$perl5"
6871         ;;
6872 esac
6873 case "$perl5" in
6874 '')     echo "None found.  That's ok.";;
6875 *)      echo "Using $perl5." ;;
6876 esac
6877
6878 : Determine list of previous versions to include in @INC
6879 $cat > getverlist <<EOPL
6880 #!$perl5 -w
6881 use File::Basename;
6882 \$api_versionstring = "$api_versionstring";
6883 \$version = "$version";
6884 \$stem = "$sitelib_stem";
6885 \$archname = "$archname";
6886 EOPL
6887         $cat >> getverlist <<'EOPL'
6888 # Can't have leading @ because metaconfig interprets it as a command!
6889 ;@inc_version_list=();
6890 # XXX Redo to do opendir/readdir? 
6891 if (-d $stem) {
6892     chdir($stem);
6893     ;@candidates = glob("5.*");
6894 }
6895 else {
6896     ;@candidates = ();
6897 }
6898
6899 # XXX ToDo:  These comparisons must be reworked when two-digit
6900 # subversions come along, so that 5.7.10 compares as greater than
6901 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6902 # widespread that we can use the built-in version vectors rather
6903 # than reinventing them here.  For 5.6.0, however, we must
6904 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6905 foreach $d (@candidates) {
6906     if ($d lt $version) {
6907         if ($d ge $api_versionstring) {
6908             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6909         }
6910         elsif ($d ge "5.005") {
6911             unshift(@inc_version_list, grep { -d } $d);
6912         }
6913     }
6914     else {
6915         # Skip newer version.  I.e. don't look in
6916         # 5.7.0 if we're installing 5.6.1.
6917     }
6918 }
6919
6920 if (@inc_version_list) {
6921     print join(' ', @inc_version_list);
6922 }
6923 else {
6924     # Blank space to preserve value for next Configure run.
6925     print " ";
6926 }
6927 EOPL
6928 chmod +x getverlist
6929 case "$inc_version_list" in
6930 '')     if test -x "$perl5$exe_ext"; then
6931                 dflt=`$perl5 getverlist`
6932         else
6933                 dflt='none'
6934         fi
6935         ;;
6936 $undef) dflt='none' ;;
6937 *)  eval dflt=\"$inc_version_list\" ;;
6938 esac
6939 case "$dflt" in
6940 ''|' ') dflt=none ;;
6941 esac
6942 case "$dflt" in
6943 5.005) dflt=none ;;
6944 esac
6945 $cat <<EOM
6946
6947 In order to ease the process of upgrading, this version of perl 
6948 can be configured to use modules built and installed with earlier 
6949 versions of perl that were installed under $prefix.  Specify here
6950 the list of earlier versions that this version of perl should check.
6951 If Configure detected no earlier versions of perl installed under
6952 $prefix, then the list will be empty.  Answer 'none' to tell perl
6953 to not search earlier versions.
6954
6955 The default should almost always be sensible, so if you're not sure,
6956 just accept the default.
6957 EOM
6958
6959 rp='List of earlier versions to include in @INC?'
6960 . ./myread
6961 case "$ans" in
6962 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6963 *) inc_version_list="$ans" ;;
6964 esac
6965 case "$inc_version_list" in
6966 ''|' ') 
6967         inc_version_list_init='0';;
6968 *)      inc_version_list_init=`echo $inc_version_list |
6969                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6970         ;;
6971 esac
6972 $rm -f getverlist
6973
6974 : determine whether to install perl also as /usr/bin/perl
6975
6976 echo " "
6977 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6978         $cat <<EOM
6979 Many scripts expect perl to be installed as /usr/bin/perl.
6980
6981 If you want to, I can install the perl you are about to compile
6982 as /usr/bin/perl (in addition to $bin/perl).
6983 EOM
6984         if test -f /usr/bin/perl; then
6985             $cat <<EOM
6986
6987 However, please note that because you already have a /usr/bin/perl,
6988 overwriting that with a new Perl would very probably cause problems.
6989 Therefore I'm assuming you don't want to do that (unless you insist).
6990
6991 EOM
6992             case "$installusrbinperl" in
6993             "$define"|[yY]*)    dflt='y';;
6994             *)                  dflt='n';;
6995             esac
6996         else
6997             $cat <<EOM
6998
6999 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7000
7001 EOM
7002             case "$installusrbinperl" in
7003             "$undef"|[nN]*)     dflt='n';;
7004             *)                  dflt='y';;
7005             esac
7006         fi
7007         rp="Do you want to install perl as /usr/bin/perl?"
7008         . ./myread
7009         case "$ans" in
7010         [yY]*)  val="$define";;
7011         *)      val="$undef" ;;
7012         esac
7013 else
7014         val="$undef"
7015 fi
7016 set installusrbinperl
7017 eval $setvar
7018
7019 echo " "
7020 echo "Checking for GNU C Library..." >&4
7021 cat >try.c <<'EOCP'
7022 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7023    alone are insufficient to distinguish different versions, such as
7024    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7025    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7026 */
7027 #include <stdio.h>
7028 int main(void)
7029 {
7030 #ifdef __GLIBC__
7031 #   ifdef __GLIBC_MINOR__
7032 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7033 #           include <gnu/libc-version.h>
7034             printf("%s\n",  gnu_get_libc_version());
7035 #       else
7036             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7037 #       endif
7038 #   else
7039         printf("%d\n",  __GLIBC__);
7040 #   endif
7041     return 0;
7042 #else
7043     return 1;
7044 #endif
7045 }
7046 EOCP
7047 set try
7048 if eval $compile_ok && $run ./try > glibc.ver; then
7049         val="$define"
7050         gnulibc_version=`$cat glibc.ver`
7051         echo "You are using the GNU C Library version $gnulibc_version"
7052 else
7053         val="$undef"
7054         gnulibc_version=''
7055         echo "You are not using the GNU C Library"
7056 fi
7057 $rm -f try try.* glibc.ver
7058 set d_gnulibc
7059 eval $setvar
7060
7061 : see if nm is to be used to determine whether a symbol is defined or not
7062 case "$usenm" in
7063 '')
7064         dflt=''
7065         case "$d_gnulibc" in
7066         "$define")
7067                 echo " "
7068                 echo "nm probably won't work on the GNU C Library." >&4
7069                 dflt=n
7070                 ;;
7071         esac
7072         case "$dflt" in
7073         '') 
7074                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7075                         echo " "
7076                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7077                         echo "'nm' won't be sufficient on this sytem." >&4
7078                         dflt=n
7079                 fi
7080                 ;;
7081         esac
7082         case "$dflt" in
7083         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7084                 if $test $dflt -gt 20; then
7085                         dflt=y
7086                 else
7087                         dflt=n
7088                 fi
7089                 ;;
7090         esac
7091         ;;
7092 *)
7093         case "$usenm" in
7094         true|$define) dflt=y;;
7095         *) dflt=n;;
7096         esac
7097         ;;
7098 esac
7099 $cat <<EOM
7100
7101 I can use $nm to extract the symbols from your C libraries. This
7102 is a time consuming task which may generate huge output on the disk (up
7103 to 3 megabytes) but that should make the symbols extraction faster. The
7104 alternative is to skip the 'nm' extraction part and to compile a small
7105 test program instead to determine whether each symbol is present. If
7106 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7107 this may be the best solution.
7108
7109 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7110
7111 EOM
7112 rp="Shall I use $nm to extract C symbols from the libraries?"
7113 . ./myread
7114 case "$ans" in
7115 [Nn]*) usenm=false;;
7116 *) usenm=true;;
7117 esac
7118
7119 runnm=$usenm
7120 case "$reuseval" in
7121 true) runnm=false;;
7122 esac
7123
7124 : nm options which may be necessary
7125 case "$nm_opt" in
7126 '') if $test -f /mach_boot; then
7127                 nm_opt=''       # Mach
7128         elif $test -d /usr/ccs/lib; then
7129                 nm_opt='-p'     # Solaris (and SunOS?)
7130         elif $test -f /dgux; then
7131                 nm_opt='-p'     # DG-UX
7132         elif $test -f /lib64/rld; then
7133                 nm_opt='-p'     # 64-bit Irix
7134         else
7135                 nm_opt=''
7136         fi;;
7137 esac
7138
7139 : nm options which may be necessary for shared libraries but illegal
7140 : for archive libraries.  Thank you, Linux.
7141 case "$nm_so_opt" in
7142 '')     case "$myuname" in
7143         *linux*|gnu*)
7144                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7145                         nm_so_opt='--dynamic'
7146                 fi
7147                 ;;
7148         esac
7149         ;;
7150 esac
7151
7152 case "$runnm" in
7153 true)
7154 : get list of predefined functions in a handy place
7155 echo " "
7156 case "$libc" in
7157 '') libc=unknown
7158         case "$libs" in
7159         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7160         esac
7161         ;;
7162 esac
7163 case "$libs" in
7164 '') ;;
7165 *)  for thislib in $libs; do
7166         case "$thislib" in
7167         -lc|-lc_s)
7168                 : Handle C library specially below.
7169                 ;;
7170         -l*)
7171                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7172                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7173                         :
7174                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7175                         :
7176                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7177                         :
7178                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7179                         :
7180                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7181                         :
7182                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7183                         :
7184                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7185                         :
7186                 else
7187                         try=''
7188                 fi
7189                 libnames="$libnames $try"
7190                 ;;
7191         *) libnames="$libnames $thislib" ;;
7192         esac
7193         done
7194         ;;
7195 esac
7196 xxx=normal
7197 case "$libc" in
7198 unknown)
7199         set /lib/libc.$so
7200         for xxx in $libpth; do
7201                 $test -r $1 || set $xxx/libc.$so
7202                 : The messy sed command sorts on library version numbers.
7203                 $test -r $1 || \
7204                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7205                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7206                                 h
7207                                 s/[0-9][0-9]*/0000&/g
7208                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7209                                 G
7210                                 s/\n/ /' | \
7211                          $sort | $sed -e 's/^.* //'`
7212                 eval set \$$#
7213         done
7214         $test -r $1 || set /usr/ccs/lib/libc.$so
7215         $test -r $1 || set /lib/libsys_s$_a
7216         ;;
7217 *)
7218         set blurfl
7219         ;;
7220 esac
7221 if $test -r "$1"; then
7222         echo "Your (shared) C library seems to be in $1."
7223         libc="$1"
7224 elif $test -r /lib/libc && $test -r /lib/clib; then
7225         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7226         xxx=apollo
7227         libc='/lib/clib /lib/libc'
7228         if $test -r /lib/syslib; then
7229                 echo "(Your math library is in /lib/syslib.)"
7230                 libc="$libc /lib/syslib"
7231         fi
7232 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7233         echo "Your C library seems to be in $libc, as you said before."
7234 elif $test -r $incpath/usr/lib/libc$_a; then
7235         libc=$incpath/usr/lib/libc$_a;
7236         echo "Your C library seems to be in $libc.  That's fine."
7237 elif $test -r /lib/libc$_a; then
7238         libc=/lib/libc$_a;
7239         echo "Your C library seems to be in $libc.  You're normal."
7240 else
7241         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7242                 :
7243         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7244                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7245         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7246                 :
7247         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7248                 :
7249         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7250                 :
7251         else
7252                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7253         fi
7254         if $test -r "$tans"; then
7255                 echo "Your C library seems to be in $tans, of all places."
7256                 libc=$tans
7257         else
7258                 libc='blurfl'
7259         fi
7260 fi
7261 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7262         dflt="$libc"
7263         cat <<EOM
7264
7265 If the guess above is wrong (which it might be if you're using a strange
7266 compiler, or your machine supports multiple models), you can override it here.
7267
7268 EOM
7269 else
7270         dflt=''
7271         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7272         cat >&4 <<EOM
7273 I can't seem to find your C library.  I've looked in the following places:
7274
7275 EOM
7276         $sed 's/^/      /' libpath
7277         cat <<EOM
7278
7279 None of these seems to contain your C library. I need to get its name...
7280
7281 EOM
7282 fi
7283 fn=f
7284 rp='Where is your C library?'
7285 . ./getfile
7286 libc="$ans"
7287
7288 echo " "
7289 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7290 set X `cat libnames`
7291 shift
7292 xxx=files
7293 case $# in 1) xxx=file; esac
7294 echo "Extracting names from the following $xxx for later perusal:" >&4
7295 echo " "
7296 $sed 's/^/      /' libnames >&4
7297 echo " "
7298 $echo $n "This may take a while...$c" >&4
7299
7300 for file in $*; do
7301         case $file in
7302         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7303         *) $nm $nm_opt $file 2>/dev/null;;
7304         esac
7305 done >libc.tmp
7306
7307 $echo $n ".$c"
7308 $grep fprintf libc.tmp > libc.ptf
7309 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7310 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7311 xxx='[ADTSIW]'
7312 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7313         eval $xscan;\
7314         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7315                 eval $xrun
7316 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7317         eval $xscan;\
7318         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7319                 eval $xrun
7320 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7321         eval $xscan;\
7322         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7323                 eval $xrun
7324 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7325         eval $xscan;\
7326         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7327                 eval $xrun
7328 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7329         eval $xscan;\
7330         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7331                 eval $xrun
7332 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7333         eval $xscan;\
7334         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335                 eval $xrun
7336 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7337                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7338         eval $xscan;\
7339         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7340                 eval $xrun
7341 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7342         eval $xscan;\
7343         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344                 eval $xrun
7345 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7346         eval $xscan;\
7347         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348                 eval $xrun
7349 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7350         eval $xscan;\
7351         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352                 eval $xrun
7353 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7354         eval $xscan;\
7355         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356                 eval $xrun
7357 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7358         eval $xscan;\
7359         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360                 eval $xrun
7361 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7362         eval $xscan;\
7363         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364                 eval $xrun
7365 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7366         eval $xscan;\
7367         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7368                 eval $xrun
7369 else
7370         $nm -p $* 2>/dev/null >libc.tmp
7371         $grep fprintf libc.tmp > libc.ptf
7372         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7373                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7374         then
7375                 nm_opt='-p'
7376                 eval $xrun
7377         else
7378                 echo " "
7379                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7380                 com=''
7381                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7382                         for thisname in $libnames $libc; do
7383                                 $ar t $thisname >>libc.tmp
7384                         done
7385                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7386                         echo "Ok." >&4
7387                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7388                         # Repeat libc to extract forwarders to DLL entries too
7389                         for thisname in $libnames $libc; do
7390                                 $ar tv $thisname >>libc.tmp
7391                                 # Revision 50 of EMX has bug in $ar.
7392                                 # it will not extract forwarders to DLL entries
7393                                 # Use emximp which will extract exactly them.
7394                                 emximp -o tmp.imp $thisname \
7395                                     2>/dev/null && \
7396                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7397                                     < tmp.imp >>libc.tmp
7398                                 $rm tmp.imp
7399                         done
7400                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7401                         echo "Ok." >&4
7402                 else
7403                         echo "$ar didn't seem to work right." >&4
7404                         echo "Maybe this is a Cray...trying bld instead..." >&4
7405                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7406                         then
7407                                 for thisname in $libnames; do
7408                                         bld t $libnames | \
7409                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7410                                         $ar t $thisname >>libc.tmp
7411                                 done
7412                                 echo "Ok." >&4
7413                         else
7414                                 echo "That didn't work either.  Giving up." >&4
7415                                 exit 1
7416                         fi
7417                 fi
7418         fi
7419 fi
7420 nm_extract="$com"
7421 case "$PASE" in
7422 define)
7423     echo " "
7424     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7425     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7426     ;;
7427 *)  if $test -f /lib/syscalls.exp; then
7428         echo " "
7429         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7430         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7431     fi
7432     ;;
7433 esac
7434 ;;
7435 esac
7436 $rm -f libnames libpath
7437
7438 : see if dld is available
7439 set dld.h i_dld
7440 eval $inhdr
7441
7442 : is a C symbol defined?
7443 csym='tlook=$1;
7444 case "$3" in
7445 -v) tf=libc.tmp; tdc="";;
7446 -a) tf=libc.tmp; tdc="[]";;
7447 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7448 esac;
7449 tx=yes;
7450 case "$reuseval-$4" in
7451 true-) ;;
7452 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7453 esac;
7454 case "$tx" in
7455 yes)
7456         tval=false;
7457         if $test "$runnm" = true; then
7458                 if $contains $tlook $tf >/dev/null 2>&1; then
7459                         tval=true;
7460                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7461                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7462                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7463                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7464                         $rm -f try$_exe try.c core core.* try.core;
7465                 fi;
7466         else
7467                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7468                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7469                 $rm -f try$_exe try.c;
7470         fi;
7471         ;;
7472 *)
7473         case "$tval" in
7474         $define) tval=true;;
7475         *) tval=false;;
7476         esac;
7477         ;;
7478 esac;
7479 eval "$2=$tval"'
7480
7481 : define an is-in-libc? function
7482 inlibc='echo " "; td=$define; tu=$undef;
7483 sym=$1; var=$2; eval "was=\$$2";
7484 tx=yes;
7485 case "$reuseval$was" in
7486 true) ;;
7487 true*) tx=no;;
7488 esac;
7489 case "$tx" in
7490 yes)
7491         set $sym tres -f;
7492         eval $csym;
7493         case "$tres" in
7494         true)
7495                 echo "$sym() found." >&4;
7496                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7497         *)
7498                 echo "$sym() NOT found." >&4;
7499                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7500         esac;;
7501 *)
7502         case "$was" in
7503         $define) echo "$sym() found." >&4;;
7504         *) echo "$sym() NOT found." >&4;;
7505         esac;;
7506 esac'
7507
7508 : see if dlopen exists
7509 xxx_runnm="$runnm"
7510 runnm=false
7511 set dlopen d_dlopen
7512 eval $inlibc
7513 runnm="$xxx_runnm"
7514
7515 : determine which dynamic loading, if any, to compile in
7516 echo " "
7517 dldir="ext/DynaLoader"
7518 case "$usedl" in
7519 $define|y|true)
7520         dflt='y'
7521         usedl="$define"
7522         ;;
7523 $undef|n|false)
7524         dflt='n'
7525         usedl="$undef"
7526         ;;
7527 *) 
7528         dflt='n'
7529         case "$d_dlopen" in
7530             $define) dflt='y' ;;
7531         esac
7532         case "$i_dld" in
7533             $define) dflt='y' ;;
7534         esac
7535         : Does a dl_xxx.xs file exist for this operating system
7536         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7537         ;;
7538 esac
7539 rp="Do you wish to use dynamic loading?"
7540 . ./myread
7541 usedl="$ans"
7542 case "$ans" in
7543 y*) usedl="$define"
7544         case "$dlsrc" in
7545         '')
7546                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7547                         dflt="$dldir/dl_${osname}.xs"
7548                 elif $test "$d_dlopen" = "$define" ; then
7549                         dflt="$dldir/dl_dlopen.xs"
7550                 elif $test "$i_dld" = "$define" ; then
7551                         dflt="$dldir/dl_dld.xs"
7552                 else
7553                         dflt=''
7554                 fi
7555                 ;;
7556         *)      dflt="$dldir/$dlsrc"
7557                 ;;
7558         esac
7559     echo "The following dynamic loading files are available:"
7560         : Can not go over to $dldir because getfile has path hard-coded in.
7561         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7562         rp="Source file to use for dynamic loading"
7563         fn="fne"
7564         gfpth="$src"
7565         . ./getfile
7566         usedl="$define"
7567         : emulate basename
7568         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7569
7570         $cat << EOM
7571
7572 Some systems may require passing special flags to $cc -c to
7573 compile modules that will be used to create a shared library.
7574 To use no flags, say "none".
7575
7576 EOM
7577     case "$cccdlflags" in
7578     '') case "$gccversion" in
7579                 '') case "$osname" in
7580                         hpux)   dflt='+z' ;;
7581                         next)   dflt='none' ;;
7582                         irix*)  dflt='-KPIC' ;;
7583                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7584                         sunos)  dflt='-pic' ;;
7585                         *)      dflt='none' ;;
7586                     esac
7587                         ;;
7588                 *)  case "$osname" in
7589                         darwin) dflt='none' ;;
7590                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7591                         *)      dflt='-fpic' ;;
7592                     esac ;;
7593             esac ;;
7594         ' ') dflt='none' ;;
7595     *)  dflt="$cccdlflags" ;;
7596     esac
7597     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7598     . ./myread
7599     case "$ans" in
7600     none) cccdlflags=' ' ;;
7601     *) cccdlflags="$ans" ;;
7602     esac
7603
7604     cat << EOM
7605
7606 Some systems use ld to create libraries that can be dynamically loaded,
7607 while other systems (such as those using ELF) use $cc.
7608
7609 EOM
7610         case "$ld" in
7611         '')     $cat >try.c <<EOM
7612 /* Test for whether ELF binaries are produced */
7613 #include <fcntl.h>
7614 #$i_stdlib I_STDLIB
7615 #ifdef I_STDLIB
7616 #include <stdlib.h>
7617 #endif
7618 int main() {
7619         char b[4];
7620         int i = open("a.out",O_RDONLY);
7621         if(i == -1) 
7622                 exit(1); /* fail */
7623         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7624                 exit(0); /* succeed (yes, it's ELF) */
7625         else
7626                 exit(1); /* fail */
7627 }
7628 EOM
7629                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7630                         cat <<EOM
7631 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7632 EOM
7633                         dflt="$cc"
7634                 else
7635                         echo "I'll use ld to build dynamic libraries."
7636                         dflt='ld'
7637                 fi
7638                 rm -f try.c a.out
7639                 ;;
7640         *)      dflt="$ld"
7641                 ;;
7642         esac
7643
7644     rp="What command should be used to create dynamic libraries?"
7645     . ./myread
7646         ld="$ans"
7647
7648     cat << EOM
7649
7650 Some systems may require passing special flags to $ld to create a
7651 library that can be dynamically loaded.  If your ld flags include
7652 -L/other/path options to locate libraries outside your loader's normal
7653 search path, you may need to specify those -L options here as well.  To
7654 use no flags, say "none".
7655
7656 EOM
7657     case "$lddlflags" in
7658     '') case "$osname" in
7659                         beos) dflt='-nostart' ;;
7660                         hpux) dflt='-b';
7661                               case "$gccversion" in
7662                               '') dflt="$dflt +vnocompatwarnings" ;;
7663                               esac
7664                               ;;        
7665                         linux|irix*|gnu*)       dflt='-shared' ;;
7666                         next)  dflt='none' ;;
7667                         solaris) dflt='-G' ;;
7668                         sunos) dflt='-assert nodefinitions' ;;
7669                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7670                 *)     dflt='none' ;;
7671                         esac
7672                         ;;
7673     *) dflt="$lddlflags" ;;
7674     esac
7675
7676         : Try to guess additional flags to pick up local libraries.
7677         : Be careful not to append to a plain 'none'
7678         case "$dflt" in
7679         none) dflt='' ;;
7680         esac
7681         for thisflag in $ldflags; do
7682                 case "$thisflag" in
7683                 -L*|-R*|-Wl,-R*)
7684                         case " $dflt " in
7685                         *" $thisflag "*) ;;
7686                         *) dflt="$dflt $thisflag" ;;
7687                         esac
7688                         ;;
7689                 esac
7690         done
7691
7692         case "$dflt" in
7693         ''|' ') dflt='none' ;;
7694         esac
7695
7696     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7697     . ./myread
7698     case "$ans" in
7699     none) lddlflags=' ' ;;
7700     *) lddlflags="$ans" ;;
7701     esac
7702
7703         cat <<EOM
7704
7705 Some systems may require passing special flags to $cc to indicate that
7706 the resulting executable will use dynamic linking.  To use no flags,
7707 say "none".
7708
7709 EOM
7710     case "$ccdlflags" in
7711     '') case "$osname" in
7712             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7713             next|sunos) dflt='none' ;;
7714             *)          dflt='none' ;;
7715             esac ;;
7716     ' ')  dflt='none' ;;
7717     *)  dflt="$ccdlflags" ;;
7718     esac
7719     rp="Any special flags to pass to $cc to use dynamic linking?"
7720     . ./myread
7721     case "$ans" in
7722     none) ccdlflags=' ' ;;
7723     *) ccdlflags="$ans" ;;
7724     esac
7725     ;;
7726 *)  usedl="$undef"
7727         ld='ld'
7728     dlsrc='dl_none.xs'
7729     lddlflags=''
7730     ccdlflags=''
7731     ;;
7732 esac
7733
7734 also=''
7735 case "$usedl" in
7736 $undef)
7737         # No dynamic loading being used, so don't bother even to prompt.
7738         useshrplib='false'
7739         ;;
7740 *)      case "$useshrplib" in
7741         '')     case "$osname" in
7742                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7743                         dflt=y
7744                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7745                         ;;
7746                 next*)
7747                         case "$osvers" in
7748                         4*)     dflt=y
7749                                 also='Building a shared libperl is needed for MAB support.'
7750                                 ;;
7751                         *)      dflt=n
7752                                 ;;
7753                         esac
7754                         ;;
7755                 *)      dflt=n
7756                         ;;
7757                 esac
7758                 ;;
7759         $define|true|[Yy]*)
7760                 dflt=y
7761                 ;;
7762         *)      dflt=n
7763                 ;;
7764         esac
7765         $cat << EOM
7766
7767 The perl executable is normally obtained by linking perlmain.c with
7768 libperl${_a}, any static extensions (usually just DynaLoader), and
7769 any other libraries needed on this system (such as -lm, etc.).  Since
7770 your system supports dynamic loading, it is probably possible to build
7771 a shared libperl.$so.  If you will have more than one executable linked
7772 to libperl.$so, this will significantly reduce the size of each
7773 executable, but it may have a noticeable effect on performance.  The
7774 default is probably sensible for your system.
7775 $also
7776
7777 EOM
7778         rp="Build a shared libperl.$so (y/n)"
7779         . ./myread
7780         case "$ans" in
7781         true|$define|[Yy]*)
7782                 useshrplib='true'  ;;
7783         *)      useshrplib='false' ;;
7784         esac
7785         ;;
7786 esac
7787
7788 case "$useshrplib" in
7789 true)
7790         case "$libperl" in
7791         '')
7792                 # Figure out a good name for libperl.so.  Since it gets stored in
7793                 # a version-specific architecture-dependent library, the version
7794                 # number isn't really that important, except for making cc/ld happy.
7795                 #
7796                 # A name such as libperl.so.3.1
7797                 majmin="libperl.$so.$patchlevel.$subversion"
7798                 # A name such as libperl.so.301
7799                 majonly=`echo $patchlevel $subversion |
7800                         $awk '{printf "%d%02d", $1, $2}'`
7801                 majonly=libperl.$so.$majonly
7802                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7803                 # rely on figuring it out from the naming of libc.
7804                 case "${osname}${osvers}" in
7805                 next4*)
7806                         dflt=libperl.5.$so
7807                         # XXX How handle the --version stuff for MAB?
7808                         ;;
7809                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7810                         dflt=libperl.$so
7811                         ;;
7812                 cygwin*) # ld links against an importlib
7813                         dflt=libperl$lib_ext
7814                         ;;
7815                 *)      # Try to guess based on whether libc has major.minor.
7816                         case "$libc" in
7817                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7818                         *libc.$so.[0-9]*) dflt=$majonly ;;
7819                         *)      dflt=libperl.$so ;;
7820                         esac
7821                         ;;
7822                 esac
7823                 ;;
7824         *)      dflt=$libperl
7825                 ;;
7826         esac
7827         cat << EOM
7828
7829 I need to select a good name for the shared libperl.  If your system uses
7830 library names with major and minor numbers, then you might want something
7831 like $majmin.  Alternatively, if your system uses a single version
7832 number for shared libraries, then you might want to use $majonly.
7833 Or, your system might be quite happy with a simple libperl.$so.
7834
7835 Since the shared libperl will get installed into a version-specific
7836 architecture-dependent directory, the version number of the shared perl
7837 library probably isn't important, so the default should be o.k.
7838
7839 EOM
7840         rp='What name do you want to give to the shared libperl?'
7841         . ./myread
7842         libperl=$ans
7843         echo "Ok, I'll use $libperl"
7844         ;;
7845 *)
7846         libperl="libperl${_a}"
7847         ;;
7848 esac
7849
7850 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7851 case "$shrpdir" in
7852 '') ;;
7853 *)      $cat >&4 <<EOM
7854 WARNING:  Use of the shrpdir variable for the installation location of
7855 the shared $libperl is not supported.  It was never documented and
7856 will not work in this version.  Let me (perlbug@perl.org)
7857 know of any problems this may cause.
7858
7859 EOM
7860         case "$shrpdir" in
7861         "$archlibexp/CORE")
7862                 $cat >&4 <<EOM
7863 But your current setting of $shrpdir is
7864 the default anyway, so it's harmless.
7865 EOM
7866                 ;;
7867         *)
7868                 $cat >&4 <<EOM
7869 Further, your current attempted setting of $shrpdir
7870 conflicts with the value of $archlibexp/CORE
7871 that installperl will use.
7872 EOM
7873                 ;;
7874         esac
7875         ;;
7876 esac
7877
7878 # How will the perl executable find the installed shared $libperl?
7879 # Add $xxx to ccdlflags.
7880 # If we can't figure out a command-line option, use $shrpenv to
7881 # set env LD_RUN_PATH.  The main perl makefile uses this.
7882 shrpdir=$archlibexp/CORE
7883 xxx=''
7884 tmp_shrpenv=''
7885 if "$useshrplib"; then
7886     case "$osname" in 
7887         aix)
7888                 # We'll set it in Makefile.SH...
7889                 ;;
7890         solaris)
7891                 xxx="-R $shrpdir"
7892                 ;;
7893         freebsd|netbsd|openbsd|interix)
7894                 xxx="-Wl,-R$shrpdir"
7895                 ;;
7896         bsdos|linux|irix*|dec_osf|gnu*)
7897                 xxx="-Wl,-rpath,$shrpdir"
7898                 ;;
7899         next)
7900                 # next doesn't like the default...
7901                 ;;
7902         beos)
7903                 # beos doesn't like the default, either.
7904                 ;;
7905         hpux*)
7906                 # hpux doesn't like the default, either.
7907                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7908                 ;;
7909         *)
7910                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7911                 ;;
7912         esac
7913         case "$xxx" in
7914         '') ;;
7915         *)      
7916                 # Only add $xxx if it isn't already in ccdlflags.
7917                 case " $ccdlflags " in
7918                 *" $xxx "*)     ;;
7919                 *)      ccdlflags="$ccdlflags $xxx"
7920                         cat <<EOM >&4
7921
7922 Adding $xxx to the flags
7923 passed to $ld so that the perl executable will find the 
7924 installed shared $libperl.
7925
7926 EOM
7927                         ;;
7928                 esac
7929                 ;;
7930         esac
7931 fi
7932 # Fix ccdlflags in AIX for building external extensions.
7933 # (For building Perl itself bare -bE:perl.exp is needed,
7934 #  Makefile.SH takes care of this.)
7935 case "$osname" in
7936 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7937 esac
7938 # Respect a hint or command-line value.
7939 case "$shrpenv" in
7940 '') shrpenv="$tmp_shrpenv" ;;
7941 esac
7942 case "$ldlibpthname" in
7943 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7944 none)   ldlibpthname='' ;;
7945 esac
7946
7947 : determine where manual pages are on this system
7948 echo " "
7949 case "$sysman" in
7950 '') 
7951         syspath='/usr/share/man/man1 /usr/man/man1'
7952         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7953         syspath="$syspath /usr/man/u_man/man1"
7954         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7955         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7956         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7957         sysman=`./loc . /usr/man/man1 $syspath`
7958         ;;
7959 esac
7960 if $test -d "$sysman"; then
7961         echo "System manual is in $sysman." >&4
7962 else
7963         echo "Could not find manual pages in source form." >&4
7964 fi
7965
7966 : determine where manual pages go
7967 set man1dir man1dir none
7968 eval $prefixit
7969 $cat <<EOM
7970
7971 $spackage has manual pages available in source form.
7972 EOM
7973 case "$nroff" in
7974 nroff)
7975         echo "However, you don't have nroff, so they're probably useless to you."
7976         case "$man1dir" in
7977         '') man1dir="none";;
7978         esac;;
7979 esac
7980 echo "If you don't want the manual sources installed, answer 'none'."
7981 case "$man1dir" in
7982 ' ') dflt=none
7983         ;;
7984 '')
7985         lookpath="$prefixexp/share/man/man1"
7986         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7987         lookpath="$lookpath $prefixexp/man/p_man/man1"
7988         lookpath="$lookpath $prefixexp/man/u_man/man1"
7989         lookpath="$lookpath $prefixexp/man/man.1"
7990         case "$sysman" in
7991         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7992         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7993         esac
7994         set dflt
7995         eval $prefixup
7996         ;;
7997 *)  dflt="$man1dir"
7998         ;;
7999 esac
8000 echo " "
8001 fn=dn+~
8002 rp="Where do the main $spackage manual pages (source) go?"
8003 . ./getfile
8004 if $test "X$man1direxp" != "X$ansexp"; then
8005         installman1dir=''
8006 fi
8007 man1dir="$ans"
8008 man1direxp="$ansexp"
8009 case "$man1dir" in
8010 '')     man1dir=' '
8011         installman1dir='';;
8012 esac
8013
8014 : Change installation prefix, if necessary.
8015 if $test X"$prefix" != X"$installprefix"; then
8016         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8017 else
8018         installman1dir="$man1direxp"
8019 fi
8020
8021 : What suffix to use on installed man pages
8022
8023 case "$man1dir" in
8024 ' ')
8025         man1ext='0'
8026         ;;
8027 *)
8028         rp="What suffix should be used for the main $spackage man pages?"
8029         case "$man1ext" in
8030         '')     case "$man1dir" in
8031                 *1)  dflt=1 ;;
8032                 *1p) dflt=1p ;;
8033                 *1pm) dflt=1pm ;;
8034                 *l) dflt=l;;
8035                 *n) dflt=n;;
8036                 *o) dflt=o;;
8037                 *p) dflt=p;;
8038                 *C) dflt=C;;
8039                 *L) dflt=L;;
8040                 *L1) dflt=L1;;
8041                 *) dflt=1;;
8042                 esac
8043                 ;;
8044         *)      dflt="$man1ext";;
8045         esac
8046         . ./myread
8047         man1ext="$ans"
8048         ;;
8049 esac
8050
8051 : see if we can have long filenames
8052 echo " "
8053 first=123456789abcdef
8054 $rm -f $first
8055 if (echo hi >$first) 2>/dev/null; then
8056         if $test -f 123456789abcde; then
8057                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8058                 val="$undef"
8059         else
8060                 echo 'You can have filenames longer than 14 characters.'>&4
8061                 val="$define"
8062         fi
8063 else
8064         $cat <<'EOM'
8065 You can't have filenames longer than 14 chars.
8066 You can't even think about them!
8067 EOM
8068         val="$undef"
8069 fi 
8070 set d_flexfnam
8071 eval $setvar
8072 $rm -rf 123456789abcde*
8073
8074 : determine where library module manual pages go
8075 set man3dir man3dir none
8076 eval $prefixit
8077 $cat <<EOM
8078
8079 $spackage has manual pages for many of the library modules.
8080 EOM
8081
8082 case "$nroff" in
8083 nroff)
8084         $cat <<'EOM'
8085 However, you don't have nroff, so they're probably useless to you.
8086 EOM
8087         case "$man3dir" in
8088         '') man3dir="none";;
8089         esac;;
8090 esac
8091
8092 case "$d_flexfnam" in
8093 undef)
8094         $cat <<'EOM'
8095 However, your system can't handle the long file names like File::Basename.3. 
8096 EOM
8097         case "$man3dir" in
8098         '') man3dir="none";;
8099         esac;;
8100 esac
8101
8102 echo "If you don't want the manual sources installed, answer 'none'."
8103 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8104 case "$man3dir" in
8105 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8106         if $test -d "$privlib/man/man3"; then
8107                 cat <<EOM >&4
8108
8109 WARNING:  Previous versions of perl installed man3 pages into
8110 $privlib/man/man3.  This version will suggest a 
8111 new default of $dflt.  
8112 EOM
8113                 tdflt=$dflt
8114                 dflt='n'
8115                 rp='Do you wish to preserve the old behavior?(y/n)'
8116                 . ./myread
8117                 case "$ans" in
8118                 y*) dflt="$privlib/man/man3" ;;
8119                 *)  dflt=$tdflt ;;
8120                 esac
8121     fi
8122         ;;
8123 *)      dflt="$man3dir" ;;
8124 esac
8125 case "$dflt" in
8126 ' ') dflt=none ;;
8127 esac
8128 echo " "
8129 fn=dn+~
8130 rp="Where do the $package library man pages (source) go?"
8131 . ./getfile
8132 man3dir="$ans"
8133 man3direxp="$ansexp"
8134 case "$man3dir" in
8135 '')     man3dir=' '
8136         installman3dir='';;
8137 esac
8138
8139 : Change installation prefix, if necessary.
8140 if $test X"$prefix" != X"$installprefix"; then
8141         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8142 else
8143         installman3dir="$man3direxp"
8144 fi
8145
8146 : What suffix to use on installed man pages
8147 case "$man3dir" in
8148 ' ')
8149         man3ext='0'
8150         ;;
8151 *)
8152         rp="What suffix should be used for the $package library man pages?"
8153         case "$man3ext" in
8154         '')     case "$man3dir" in
8155                 *3)  dflt=3 ;;
8156                 *3p) dflt=3p ;;
8157                 *3pm) dflt=3pm ;;
8158                 *l) dflt=l;;
8159                 *n) dflt=n;;
8160                 *o) dflt=o;;
8161                 *p) dflt=p;;
8162                 *C) dflt=C;;
8163                 *L) dflt=L;;
8164                 *L3) dflt=L3;;
8165                 *) dflt=3;;
8166                 esac
8167                 ;;
8168         *)      dflt="$man3ext";;
8169         esac
8170         . ./myread
8171         man3ext="$ans"
8172         ;;
8173 esac
8174
8175 : see if we have to deal with yellow pages, now NIS.
8176 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8177         if $test -f /usr/etc/nibindd; then
8178                 echo " "
8179                 echo "I'm fairly confident you're on a NeXT."
8180                 echo " "
8181                 rp='Do you get the hosts file via NetInfo?'
8182                 dflt=y
8183                 case "$hostcat" in
8184                 nidump*) ;;
8185                 '') ;;
8186                 *) dflt=n;;
8187                 esac
8188                 . ./myread
8189                 case "$ans" in
8190                 y*) hostcat='nidump hosts .';;
8191                 *)      case "$hostcat" in
8192                         nidump*) hostcat='';;
8193                         esac
8194                         ;;
8195                 esac
8196         fi
8197         case "$hostcat" in
8198         nidump*) ;;
8199         *)
8200                 case "$hostcat" in
8201                 *ypcat*) dflt=y;;
8202                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8203                                 dflt=y
8204                         else
8205                                 dflt=n
8206                         fi;;
8207                 *) dflt=n;;
8208                 esac
8209                 echo " "
8210                 rp='Are you getting the hosts file via yellow pages?'
8211                 . ./myread
8212                 case "$ans" in
8213                 y*) hostcat='ypcat hosts';;
8214                 *) hostcat='cat /etc/hosts';;
8215                 esac
8216                 ;;
8217         esac
8218 fi
8219 case "$hostcat" in
8220 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8221 esac
8222 case "$groupcat" in
8223 '') test -f /etc/group && groupcat='cat /etc/group';;
8224 esac
8225 case "$passcat" in
8226 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8227 esac
8228
8229 : now get the host name
8230 echo " "
8231 echo "Figuring out host name..." >&4
8232 case "$myhostname" in
8233 '') cont=true
8234         echo 'Maybe "hostname" will work...'
8235         if tans=`sh -c hostname 2>&1` ; then
8236                 myhostname=$tans
8237                 phostname=hostname
8238                 cont=''
8239         fi
8240         ;;
8241 *) cont='';;
8242 esac
8243 if $test "$cont"; then
8244         if ./xenix; then
8245                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8246                 if tans=`cat /etc/systemid 2>&1` ; then
8247                         myhostname=$tans
8248                         phostname='cat /etc/systemid'
8249                         echo "Whadyaknow.  Xenix always was a bit strange..."
8250                         cont=''
8251                 fi
8252         elif $test -r /etc/systemid; then
8253                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8254         fi
8255 fi
8256 if $test "$cont"; then
8257         echo 'No, maybe "uuname -l" will work...'
8258         if tans=`sh -c 'uuname -l' 2>&1` ; then
8259                 myhostname=$tans
8260                 phostname='uuname -l'
8261         else
8262                 echo 'Strange.  Maybe "uname -n" will work...'
8263                 if tans=`sh -c 'uname -n' 2>&1` ; then
8264                         myhostname=$tans
8265                         phostname='uname -n'
8266                 else
8267                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8268                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8269                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8270                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8271                         else
8272                                 case "$myhostname" in
8273                                 '') echo "Does this machine have an identity crisis or something?"
8274                                         phostname='';;
8275                                 *)
8276                                         echo "Well, you said $myhostname before..."
8277                                         phostname='echo $myhostname';;
8278                                 esac
8279                         fi
8280                 fi
8281         fi
8282 fi
8283 case "$myhostname" in
8284 '') myhostname=noname ;;
8285 esac
8286 : you do not want to know about this
8287 set $myhostname
8288 myhostname=$1
8289
8290 : verify guess
8291 if $test "$myhostname" ; then
8292         dflt=y
8293         rp='Your host name appears to be "'$myhostname'".'" Right?"
8294         . ./myread
8295         case "$ans" in
8296         y*) ;;
8297         *) myhostname='';;
8298         esac
8299 fi
8300
8301 : bad guess or no guess
8302 while $test "X$myhostname" = X ; do
8303         dflt=''
8304         rp="Please type the (one word) name of your host:"
8305         . ./myread
8306         myhostname="$ans"
8307 done
8308
8309 : translate upper to lower if necessary
8310 case "$myhostname" in
8311 *[A-Z]*)
8312         echo "(Normalizing case in your host name)"
8313         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8314         ;;
8315 esac
8316
8317 case "$myhostname" in
8318 *.*)
8319         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8320         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8321         echo "(Trimming domain name from host name--host name is now $myhostname)"
8322         ;;
8323 *) case "$mydomain" in
8324         '')
8325                 {
8326                         test "X$hostcat" = "Xypcat hosts" &&
8327                         ypmatch "$myhostname" hosts 2>/dev/null |\
8328                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8329                         $test -s hosts
8330                 } || {
8331                         test "X$hostcat" != "X" &&
8332                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8333                                         /[       ]$myhostname[  . ]/p" > hosts
8334                 }
8335                 tmp_re="[       . ]"
8336                 if $test -f hosts; then
8337                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8338                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8339                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8340                                 hosts | $sort | $uniq | \
8341                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8342                         case `$echo X$dflt` in
8343                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8344                                 dflt=.
8345                                 ;;
8346                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8347                                 ;;
8348                         esac
8349                 else
8350                         echo "(I cannot locate a hosts database anywhere)"
8351                         dflt=.
8352                 fi
8353                 case "$dflt" in
8354                 .)
8355                         tans=`./loc resolv.conf X /etc /usr/etc`
8356                         if $test -f "$tans"; then
8357                                 echo "(Attempting domain name extraction from $tans)"
8358                                 dflt=.`$sed -n -e 's/   / /g' \
8359                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8360                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8361                                 case "$dflt" in
8362                                 .) dflt=.`$sed -n -e 's/        / /g' \
8363                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8364                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8365                                         ;;
8366                                 esac
8367                         fi
8368                         ;;
8369                 esac
8370                 case "$dflt" in
8371                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8372                         dflt=.`sh -c domainname 2>/dev/null`
8373                         case "$dflt" in
8374                         '') dflt='.';;
8375                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8376                         esac
8377                         ;;
8378                 esac
8379                 case "$dflt$osname" in
8380                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8381                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8382                         ;;
8383                 esac
8384                 case "$dflt" in
8385                 .) echo "(Lost all hope -- silly guess then)"
8386                         dflt='.nonet'
8387                         ;;
8388                 esac
8389                 $rm -f hosts
8390                 ;;
8391         *) dflt="$mydomain";;
8392         esac;;
8393 esac
8394 echo " "
8395 rp="What is your domain name?"
8396 . ./myread
8397 tans="$ans"
8398 case "$ans" in
8399 '') ;;
8400 .*) ;;
8401 *) tans=".$tans";;
8402 esac
8403 mydomain="$tans"
8404
8405 : translate upper to lower if necessary
8406 case "$mydomain" in
8407 *[A-Z]*)
8408         echo "(Normalizing case in your domain name)"
8409         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8410         ;;
8411 esac
8412
8413 : a little sanity check here
8414 case "$phostname" in
8415 '') ;;
8416 *)
8417         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8418         $myhostname$mydomain|$myhostname) ;;
8419         *)
8420                 case "$phostname" in
8421                 sed*)
8422                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8423                         ;;
8424                 *)
8425                         echo "(That doesn't agree with your $phostname command, by the way.)"
8426                         ;;
8427                 esac
8428         ;;
8429         esac
8430         ;;
8431 esac
8432
8433 $cat <<EOM
8434
8435 I need to get your e-mail address in Internet format if possible, i.e.
8436 something like user@host.domain. Please answer accurately since I have
8437 no easy means to double check it. The default value provided below
8438 is most probably close to reality but may not be valid from outside
8439 your organization...
8440
8441 EOM
8442 cont=x
8443 while test "$cont"; do
8444         case "$cf_email" in
8445         '') dflt="$cf_by@$myhostname$mydomain";;
8446         *) dflt="$cf_email";;
8447         esac
8448         rp='What is your e-mail address?'
8449         . ./myread
8450         cf_email="$ans"
8451         case "$cf_email" in
8452         *@*.*) cont='' ;;
8453         *)
8454                 rp='Address does not look like an Internet one.  Use it anyway?'
8455                 case "$fastread" in
8456                 yes) dflt=y ;;
8457                 *) dflt=n ;;
8458                 esac
8459                 . ./myread
8460                 case "$ans" in
8461                 y*) cont='' ;;
8462                 *) echo " " ;;
8463                 esac
8464                 ;;
8465         esac
8466 done
8467
8468 $cat <<EOM
8469
8470 If you or somebody else will be maintaining perl at your site, please
8471 fill in the correct e-mail address here so that they may be contacted
8472 if necessary. Currently, the "perlbug" program included with perl
8473 will send mail to this address in addition to perlbug@perl.org. You may
8474 enter "none" for no administrator.
8475
8476 EOM
8477 case "$perladmin" in
8478 '') dflt="$cf_email";;
8479 *) dflt="$perladmin";;
8480 esac
8481 rp='Perl administrator e-mail address'
8482 . ./myread
8483 perladmin="$ans"
8484
8485 : determine whether to only install version-specific parts.
8486 echo " "
8487 $cat <<EOM
8488 Do you want to install only the version-specific parts of the perl
8489 distribution?  Usually you do *not* want to do this.
8490 EOM
8491 case "$versiononly" in
8492 "$define"|[Yy]*|true) dflt='y' ;;
8493 *) dflt='n';
8494 esac
8495 rp="Do you want to install only the version-specific parts of perl?"
8496 . ./myread
8497 case "$ans" in
8498 [yY]*)  val="$define";;
8499 *)      val="$undef" ;;
8500 esac
8501 set versiononly
8502 eval $setvar
8503
8504 case "$versiononly" in
8505 "$define") inc_version_list=''
8506            inc_version_list_init=0
8507            ;;
8508 esac
8509
8510 : figure out how to guarantee perl startup
8511 case "$startperl" in
8512 '')
8513         case "$sharpbang" in
8514         *!)
8515                 $cat <<EOH
8516
8517 I can use the #! construct to start perl on your system. This will
8518 make startup of perl scripts faster, but may cause problems if you
8519 want to share those scripts and perl is not in a standard place
8520 ($binexp/perl) on all your platforms. The alternative is to force
8521 a shell by starting the script with a single ':' character.
8522
8523 EOH
8524                 case "$versiononly" in
8525                 "$define")      dflt="$binexp/perl$version";;  
8526                 *)              dflt="$binexp/perl";;
8527                 esac
8528                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8529                 . ./myread
8530                 case "$ans" in
8531                 none)   startperl=": # use perl";;
8532                 *)      startperl="#!$ans"
8533                         if $test 30 -lt `echo "$ans" | wc -c`; then
8534                                 $cat >&4 <<EOM
8535
8536 WARNING:  Some systems limit the #! command to 32 characters.
8537 If you experience difficulty running Perl scripts with #!, try
8538 installing Perl in a directory with a shorter pathname.
8539
8540 EOM
8541                         fi ;;
8542                 esac
8543                 ;;
8544         *) startperl=": # use perl"
8545                 ;;
8546         esac
8547         ;;
8548 esac
8549 echo "I'll use $startperl to start perl scripts."
8550
8551 : figure best path for perl in scripts
8552 case "$perlpath" in
8553 '')
8554         case "$versiononly" in
8555         "$define")      perlpath="$binexp/perl$version";;
8556         *)              perlpath="$binexp/perl";;
8557         esac
8558         case "$startperl" in
8559         *!*) ;;
8560         *)
8561                 $cat <<EOH
8562
8563 I will use the "eval 'exec'" idiom to start Perl on your system.
8564 I can use the full path of your Perl binary for this purpose, but
8565 doing so may cause problems if you want to share those scripts and
8566 Perl is not always in a standard place ($binexp/perl).
8567
8568 EOH
8569                 dflt="$binexp/perl"
8570                 rp="What path shall I use in \"eval 'exec'\"?"
8571                 . ./myread
8572                 perlpath="$ans"
8573                 ;;
8574         esac
8575         ;;
8576 esac
8577 case "$startperl" in
8578 *!*)    ;;
8579 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8580 esac
8581
8582 : determine where public executable scripts go
8583 set scriptdir scriptdir
8584 eval $prefixit
8585 case "$scriptdir" in
8586 '')
8587         dflt="$bin"
8588         : guess some guesses
8589         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8590         $test -d /usr/share/bin     && dflt=/usr/share/bin
8591         $test -d /usr/local/script  && dflt=/usr/local/script
8592         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8593         $test -d $prefixexp/script  && dflt=$prefixexp/script
8594         set dflt
8595         eval $prefixup
8596         ;;
8597 *)  dflt="$scriptdir"
8598         ;;
8599 esac
8600 $cat <<EOM
8601  
8602 Some installations have a separate directory just for executable scripts so
8603 that they can mount it across multiple architectures but keep the scripts in
8604 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8605 Or you might just lump your scripts in with all your other executables.
8606  
8607 EOM
8608 fn=d~
8609 rp='Where do you keep publicly executable scripts?'
8610 . ./getfile
8611 if $test "X$ansexp" != "X$scriptdirexp"; then
8612         installscript=''
8613 fi
8614 scriptdir="$ans"
8615 scriptdirexp="$ansexp"
8616 : Change installation prefix, if necessary.
8617 if $test X"$prefix" != X"$installprefix"; then
8618         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8619 else
8620         installscript="$scriptdirexp"
8621 fi
8622
8623 : determine where add-on public executables go
8624 case "$sitebin" in
8625 '')     dflt=$siteprefix/bin ;;
8626 *)      dflt=$sitebin ;;
8627 esac
8628 fn=d~
8629 rp='Pathname where the add-on public executables should be installed?'
8630 . ./getfile
8631 sitebin="$ans"
8632 sitebinexp="$ansexp"
8633 : Change installation prefix, if necessary.
8634 if $test X"$prefix" != X"$installprefix"; then
8635         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8636 else
8637         installsitebin="$sitebinexp"
8638 fi
8639
8640 : determine where add-on html pages go
8641 : There is no standard location, so try to copy the previously-selected
8642 : directory structure for the core html pages.
8643 case "$sitehtml1dir" in
8644 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8645 *)     dflt=$sitehtml1dir ;;
8646 esac
8647 case "$dflt" in
8648 ''|' ') dflt=none ;;
8649 esac
8650 fn=dn+~
8651 rp='Pathname where the site-specific html pages should be installed?'
8652 . ./getfile
8653 sitehtml1dir="$ans"
8654 sitehtml1direxp="$ansexp"
8655 : Change installation prefix, if necessary.
8656 if $test X"$prefix" != X"$installprefix"; then
8657         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8658 else
8659         installsitehtml1dir="$sitehtml1direxp"
8660 fi
8661
8662 : determine where add-on library html pages go
8663 : There is no standard location, so try to copy the previously-selected
8664 : directory structure for the core html pages.
8665 case "$sitehtml3dir" in
8666 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8667 *)     dflt=$sitehtml3dir ;;
8668 esac
8669 case "$dflt" in
8670 ''|' ') dflt=none ;;
8671 esac
8672 fn=dn+~
8673 rp='Pathname where the site-specific library html pages should be installed?'
8674 . ./getfile
8675 sitehtml3dir="$ans"
8676 sitehtml3direxp="$ansexp"
8677 : Change installation prefix, if necessary.
8678 if $test X"$prefix" != X"$installprefix"; then
8679         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8680 else
8681         installsitehtml3dir="$sitehtml3direxp"
8682 fi
8683
8684 : determine where add-on manual pages go
8685 case "$siteman1dir" in
8686 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8687 *)      dflt=$siteman1dir ;;
8688 esac
8689 case "$dflt" in
8690 ''|' ') dflt=none ;;
8691 esac
8692 fn=dn+~
8693 rp='Pathname where the site-specific manual pages should be installed?'
8694 . ./getfile
8695 siteman1dir="$ans"
8696 siteman1direxp="$ansexp"
8697 : Change installation prefix, if necessary.
8698 if $test X"$prefix" != X"$installprefix"; then
8699         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8700 else
8701         installsiteman1dir="$siteman1direxp"
8702 fi
8703
8704 : determine where add-on library man pages go
8705 case "$siteman3dir" in
8706 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8707 *)      dflt=$siteman3dir ;;
8708 esac
8709 case "$dflt" in
8710 ''|' ') dflt=none ;;
8711 esac
8712 fn=dn+~
8713 rp='Pathname where the site-specific library manual pages should be installed?'
8714 . ./getfile
8715 siteman3dir="$ans"
8716 siteman3direxp="$ansexp"
8717 : Change installation prefix, if necessary.
8718 if $test X"$prefix" != X"$installprefix"; then
8719         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8720 else
8721         installsiteman3dir="$siteman3direxp"
8722 fi
8723
8724 : determine where add-on public executable scripts go
8725 case "$sitescript" in
8726 '')     dflt=$siteprefix/script
8727         $test -d $dflt || dflt=$sitebin ;;
8728 *)  dflt="$sitescript" ;;
8729 esac
8730 fn=d~+
8731 rp='Pathname where add-on public executable scripts should be installed?'
8732 . ./getfile
8733 sitescript="$ans"
8734 sitescriptexp="$ansexp"
8735 : Change installation prefix, if necessary.
8736 if $test X"$prefix" != X"$installprefix"; then
8737         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8738 else
8739         installsitescript="$sitescriptexp"
8740 fi
8741
8742 case "$usefaststdio" in
8743 $define|true|[yY]*|'')
8744         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8745         case "$xversion" in
8746         [68])   dflt='y' ;;
8747         *)      dflt='n' ;;
8748         esac
8749         ;;
8750 *) dflt='n';;
8751 esac
8752 cat <<EOM
8753
8754 Perl can be built to use 'fast stdio', which means using the stdio
8755 library but also directly manipulating the stdio buffers to enable
8756 faster I/O.  Using stdio is better for backward compatibility (especially
8757 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8758 interface has been preferred instead of stdio.
8759
8760 If this doesn't make any sense to you, just accept the default '$dflt'.
8761 EOM
8762 rp='Use the "fast stdio" if available?'
8763 . ./myread
8764 case "$ans" in
8765 y|Y)    val="$define" ;;     
8766 *)      val="$undef" ;;
8767 esac
8768 set usefaststdio
8769 eval $setvar
8770
8771
8772 : define an is-a-typedef? function
8773 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8774 case "$inclist" in
8775 "") inclist="sys/types.h";;
8776 esac;
8777 eval "varval=\$$var";
8778 case "$varval" in
8779 "")
8780         $rm -f temp.c;
8781         for inc in $inclist; do
8782                 echo "#include <$inc>" >>temp.c;
8783         done;
8784         echo "#ifdef $type" >> temp.c;
8785         echo "printf(\"We have $type\");" >> temp.c;
8786         echo "#endif" >> temp.c;
8787         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8788         if $contains $type temp.E >/dev/null 2>&1; then
8789                 eval "$var=\$type";
8790         else
8791                 eval "$var=\$def";
8792         fi;
8793         $rm -f temp.?;;
8794 *) eval "$var=\$varval";;
8795 esac'
8796
8797 : define an is-a-typedef? function that prompts if the type is not available.
8798 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8799 case "$inclist" in
8800 "") inclist="sys/types.h";;
8801 esac;
8802 eval "varval=\$$var";
8803 case "$varval" in
8804 "")
8805         $rm -f temp.c;
8806         for inc in $inclist; do
8807                 echo "#include <$inc>" >>temp.c;
8808         done;
8809         echo "#ifdef $type" >> temp.c;
8810         echo "printf(\"We have $type\");" >> temp.c;
8811         echo "#endif" >> temp.c;
8812         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8813         echo " " ;
8814         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8815         if $contains $type temp.E >/dev/null 2>&1; then
8816                 echo "$type found." >&4;
8817                 eval "$var=\$type";
8818         else
8819                 echo "$type NOT found." >&4;
8820                 dflt="$def";
8821                 . ./myread ;
8822                 eval "$var=\$ans";
8823         fi;
8824         $rm -f temp.?;;
8825 *) eval "$var=\$varval";;
8826 esac'
8827
8828 : see what type lseek is declared as in the kernel
8829 rp="What is the type used for lseek's offset on this system?"
8830 set off_t lseektype long stdio.h sys/types.h
8831 eval $typedef_ask
8832
8833 echo " "
8834 echo "Checking to see how big your file offsets are..." >&4
8835 $cat >try.c <<EOCP
8836 #include <sys/types.h>
8837 #include <stdio.h>
8838 int main()
8839 {
8840     printf("%d\n", (int)sizeof($lseektype));
8841     return(0); 
8842 }
8843 EOCP
8844 set try
8845 if eval $compile_ok; then
8846         lseeksize=`$run ./try`
8847         echo "Your file offsets are $lseeksize bytes long."
8848 else
8849         dflt=$longsize
8850         echo " "
8851         echo "(I can't seem to compile the test program.  Guessing...)"
8852         rp="What is the size of your file offsets (in bytes)?"
8853         . ./myread
8854         lseeksize="$ans"
8855 fi
8856 $rm -f try.c try
8857
8858 : see what type file positions are declared as in the library
8859 rp="What is the type for file position used by fsetpos()?"
8860 set fpos_t fpostype long stdio.h sys/types.h
8861 eval $typedef_ask
8862
8863 echo " "
8864 case "$fpostype" in
8865 *_t) zzz="$fpostype"    ;;
8866 *)   zzz="fpos_t"       ;;
8867 esac
8868 echo "Checking the size of $zzz..." >&4 
8869 cat > try.c <<EOCP
8870 #include <sys/types.h>
8871 #include <stdio.h>
8872 #$i_stdlib I_STDLIB
8873 #ifdef I_STDLIB
8874 #include <stdlib.h>
8875 #endif
8876 int main() {
8877     printf("%d\n", (int)sizeof($fpostype));
8878     exit(0);
8879 }
8880 EOCP
8881 set try
8882 if eval $compile_ok; then
8883         yyy=`$run ./try`
8884         case "$yyy" in
8885         '')     fpossize=4
8886                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8887                 ;;
8888         *)      fpossize=$yyy
8889                 echo "Your $zzz is $fpossize bytes long."
8890                 ;;
8891         esac
8892 else
8893         dflt="$longsize"
8894         echo " " >&4
8895         echo "(I can't compile the test program.  Guessing...)" >&4
8896         rp="What is the size of your file positions (in bytes)?"
8897         . ./myread
8898         fpossize="$ans"
8899 fi
8900
8901 # Backward compatibility (uselfs is deprecated).
8902 case "$uselfs" in
8903 "$define"|true|[yY]*)
8904         cat <<EOM >&4
8905
8906 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8907 EOM
8908         uselargefiles="$define"
8909         ;;
8910 esac                          
8911
8912 case "$lseeksize:$fpossize" in
8913 8:8) cat <<EOM
8914
8915 You can have files larger than 2 gigabytes.
8916 EOM
8917    val="$define" ;;
8918 *)    case "$uselargefiles" in
8919    "$undef"|false|[nN]*) dflt='n' ;;
8920    *)   dflt='y' ;;
8921    esac
8922    cat <<EOM
8923
8924 Perl can be built to understand large files (files larger than 2 gigabytes)
8925 on some systems.  To do so, Configure can be run with -Duselargefiles.
8926
8927 If this doesn't make any sense to you, just accept the default '$dflt'.
8928 EOM
8929    rp='Try to understand large files, if available?'
8930    . ./myread
8931    case "$ans" in
8932    y|Y)         val="$define" ;;
8933    *)           val="$undef"  ;;
8934    esac
8935    ;;
8936 esac
8937 set uselargefiles
8938 eval $setvar
8939 : Look for a hint-file generated 'call-back-unit'.  If the
8940 : user has specified that a large files perl is to be built,
8941 : we may need to set or change some other defaults.
8942 if $test -f uselargefiles.cbu; then
8943         echo "Your platform has some specific hints regarding large file builds, using them..."
8944         . ./uselargefiles.cbu
8945 fi
8946 case "$uselargefiles" in
8947 "$define")
8948         if $test -f uselargefiles.cbu; then
8949                 echo " "
8950                 echo "Rechecking to see how big your file offsets are..." >&4
8951                 $cat >try.c <<EOCP
8952 #include <sys/types.h>
8953 #include <stdio.h>
8954 int main()
8955 {
8956     printf("%d\n", (int)sizeof($lseektype));
8957     return(0); 
8958 }
8959 EOCP
8960                 set try
8961                 if eval $compile_ok; then
8962                         lseeksize=`$run ./try`
8963                         $echo "Your file offsets are now $lseeksize bytes long."
8964                 else
8965                         dflt="$lseeksize"
8966                         echo " "
8967                         echo "(I can't seem to compile the test program.  Guessing...)"
8968                         rp="What is the size of your file offsets (in bytes)?"
8969                         . ./myread
8970                         lseeksize="$ans"
8971                 fi
8972                 case "$fpostype" in
8973                 *_t) zzz="$fpostype"    ;;
8974                 *)   zzz="fpos_t"       ;;
8975                 esac
8976                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8977                 $cat > try.c <<EOCP
8978 #include <sys/types.h>
8979 #include <stdio.h>
8980 #$i_stdlib I_STDLIB
8981 #ifdef I_STDLIB
8982 #include <stdlib.h>
8983 #endif
8984 int main() {
8985     printf("%d\n", (int)sizeof($fpostype));
8986     return(0);
8987 }
8988 EOCP
8989                 set try
8990                 if eval $compile_ok; then
8991                         yyy=`$run ./try`
8992                         dflt="$lseeksize"
8993                         case "$yyy" in
8994                         '')     echo " "
8995                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8996                                 ;;
8997                         *)      fpossize=$yyy
8998                                 echo " $fpossize bytes." >&4
8999                                 ;;
9000                         esac
9001                 else
9002                         dflt="$fpossize"
9003                         echo " "
9004                         echo "(I can't compile the test program.  Guessing...)" >&4
9005                         rp="What is the size of your file positions (in bytes)?"
9006                         . ./myread
9007                         fpossize="$ans"
9008                 fi
9009                 $rm -f try.c try
9010         fi
9011         ;;
9012 esac
9013
9014 # probably will refer to
9015 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9016 need_relocation=0
9017 userelocatableinc=undef
9018
9019 case "$vendorprefix" in
9020 '')     d_vendorbin="$undef"
9021         vendorbin=''
9022         vendorbinexp=''
9023         ;;
9024 *)      d_vendorbin="$define"
9025         : determine where vendor-supplied executables go.
9026         case "$vendorbin" in
9027         '') dflt=$vendorprefix/bin ;;
9028         *)      dflt="$vendorbin" ;;
9029         esac
9030         fn=d~+
9031         rp='Pathname for the vendor-supplied executables directory?'
9032         . ./getfile
9033         vendorbin="$ans"
9034         vendorbinexp="$ansexp"
9035         ;;
9036 esac
9037 : Change installation prefix, if necessary.
9038 if $test X"$prefix" != X"$installprefix"; then
9039         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9040 else
9041         installvendorbin="$vendorbinexp"
9042 fi
9043
9044 case "$vendorprefix" in
9045 '')     vendorhtml1dir=''
9046         vendorhtml1direxp=''
9047         ;;
9048 *)      : determine where vendor-supplied html pages go.
9049         : There is no standard location, so try to copy the previously-selected
9050         : directory structure for the core html pages.
9051         : XXX Better default suggestions would be welcome.
9052         case "$vendorhtml1dir" in
9053         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9054         *)      dflt=$vendorhtml1dir ;;
9055         esac
9056         case "$dflt" in
9057         ''|' ') dflt=none ;;
9058         esac
9059         fn=dn+~
9060         rp='Pathname for the vendor-supplied html pages?'
9061         . ./getfile
9062         vendorhtml1dir="$ans"
9063         vendorhtml1direxp="$ansexp"
9064         ;;
9065 esac
9066 : Use ' ' for none so value is preserved next time through Configure
9067 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9068 : Change installation prefix, if necessary.
9069 if $test X"$prefix" != X"$installprefix"; then
9070         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9071 else
9072         installvendorhtml1dir="$vendorhtml1direxp"
9073 fi
9074
9075 case "$vendorprefix" in
9076 '')     vendorhtml3dir=''
9077         vendorhtml3direxp=''
9078         ;;
9079 *)      : determine where vendor-supplied module html pages go.
9080         : There is no standard location, so try to copy the previously-selected
9081         : directory structure for the core html pages.
9082         : XXX Better default suggestions would be welcome.
9083         case "$vendorhtml3dir" in
9084         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9085         *)      dflt=$vendorhtml3dir ;;
9086         esac
9087         case "$dflt" in
9088         ''|' ') dflt=none ;;
9089         esac
9090         fn=dn+~
9091         rp='Pathname for the vendor-supplied html pages?'
9092         . ./getfile
9093         vendorhtml3dir="$ans"
9094         vendorhtml3direxp="$ansexp"
9095         ;;
9096 esac
9097 : Use ' ' for none so value is preserved next time through Configure
9098 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9099 : Change installation prefix, if necessary.
9100 if $test X"$prefix" != X"$installprefix"; then
9101         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9102 else
9103         installvendorhtml3dir="$vendorhtml3direxp"
9104 fi
9105
9106 case "$vendorprefix" in
9107 '')     vendorman1dir=''
9108         vendorman1direxp=''
9109         ;;
9110 *)      : determine where vendor-supplied manual pages go.
9111         case "$vendorman1dir" in
9112         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9113         *)      dflt=$vendorman1dir ;;
9114         esac
9115         case "$dflt" in
9116         ''|' ') dflt=none ;;
9117         esac
9118         fn=nd~+
9119         rp='Pathname for the vendor-supplied manual section 1 pages?'
9120         . ./getfile
9121         vendorman1dir="$ans"
9122         vendorman1direxp="$ansexp"
9123         ;;
9124 esac
9125 : Use ' ' for none so value is preserved next time through Configure
9126 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9127 : Change installation prefix, if necessary.
9128 if $test X"$prefix" != X"$installprefix"; then
9129         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9130 else
9131         installvendorman1dir="$vendorman1direxp"
9132 fi
9133
9134 case "$vendorprefix" in
9135 '')     vendorman3dir=''
9136         vendorman3direxp=''
9137         ;;
9138 *)      : determine where vendor-supplied module manual pages go.
9139         case "$vendorman3dir" in
9140         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9141         *)      dflt=$vendorman3dir ;;
9142         esac
9143         case "$dflt" in
9144         ''|' ') dflt=none ;;
9145         esac
9146         fn=nd~+
9147         rp='Pathname for the vendor-supplied manual section 3 pages?'
9148         . ./getfile
9149         vendorman3dir="$ans"
9150         vendorman3direxp="$ansexp"
9151         ;;
9152 esac
9153 : Use ' ' for none so value is preserved next time through Configure
9154 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9155 : Change installation prefix, if necessary.
9156 if $test X"$prefix" != X"$installprefix"; then
9157         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9158 else
9159         installvendorman3dir="$vendorman3direxp"
9160 fi
9161
9162 case "$vendorprefix" in
9163 '')     d_vendorscript="$undef"
9164         vendorscript=''
9165         vendorscriptexp=''
9166         ;;
9167 *)      d_vendorscript="$define"
9168         : determine where vendor-supplied scripts go.
9169         case "$vendorscript" in
9170         '')     dflt=$vendorprefix/script
9171                 $test -d $dflt || dflt=$vendorbin ;;
9172         *)  dflt="$vendorscript" ;;
9173         esac
9174         $cat <<EOM
9175
9176 The installation process will create a directory for 
9177 vendor-supplied scripts.
9178
9179 EOM
9180         fn=d~+
9181         rp='Pathname for the vendor-supplied scripts directory?'
9182         . ./getfile
9183         vendorscript="$ans"
9184         vendorscriptexp="$ansexp"
9185         ;;
9186 esac
9187 : Change installation prefix, if necessary.
9188 if $test X"$prefix" != X"$installprefix"; then
9189         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9190 else
9191         installvendorscript="$vendorscriptexp"
9192 fi
9193
9194 : see if qgcvt exists
9195 set qgcvt d_qgcvt
9196 eval $inlibc
9197
9198 echo " "
9199
9200 if $test X"$d_longdbl" = X"$define"; then
9201
9202 echo "Checking how to print long doubles..." >&4
9203
9204 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9205         $cat >try.c <<'EOCP'
9206 #include <sys/types.h>
9207 #include <stdio.h>
9208 int main() {
9209   double d = 123.456;
9210   printf("%.3f\n", d);
9211 }
9212 EOCP
9213         set try
9214         if eval $compile; then
9215                 yyy=`$run ./try`
9216                 case "$yyy" in
9217                 123.456)
9218                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9219                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9220                         echo "We will use %f."
9221                         ;;
9222                 esac
9223         fi
9224 fi
9225
9226 if $test X"$sPRIfldbl" = X; then
9227         $cat >try.c <<'EOCP'
9228 #include <sys/types.h>
9229 #include <stdio.h>
9230 int main() {
9231   long double d = 123.456;
9232   printf("%.3Lf\n", d);
9233 }
9234 EOCP
9235         set try
9236         if eval $compile; then
9237                 yyy=`$run ./try`
9238                 case "$yyy" in
9239                 123.456)
9240                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9241                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9242                         echo "We will use %Lf."
9243                         ;;
9244                 esac
9245         fi
9246 fi
9247
9248 if $test X"$sPRIfldbl" = X; then
9249         $cat >try.c <<'EOCP'
9250 #include <sys/types.h>
9251 #include <stdio.h>
9252 int main() {
9253   long double d = 123.456;
9254   printf("%.3llf\n", d);
9255 }
9256 EOCP
9257         set try
9258         if eval $compile; then
9259                 yyy=`$run ./try`
9260                 case "$yyy" in
9261                 123.456)
9262                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9263                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9264                         echo "We will use %llf."
9265                         ;;
9266                 esac
9267         fi
9268 fi
9269
9270 if $test X"$sPRIfldbl" = X; then
9271         $cat >try.c <<'EOCP'
9272 #include <sys/types.h>
9273 #include <stdio.h>
9274 int main() {
9275   long double d = 123.456;
9276   printf("%.3lf\n", d);
9277 }
9278 EOCP
9279         set try
9280         if eval $compile; then
9281                 yyy=`$run ./try`
9282                 case "$yyy" in
9283                 123.456)
9284                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9285                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9286                         echo "We will use %lf."
9287                         ;;
9288                 esac
9289         fi
9290 fi
9291
9292 if $test X"$sPRIfldbl" = X; then
9293         echo "Cannot figure out how to print long doubles." >&4
9294 else
9295         sSCNfldbl=$sPRIfldbl    # expect consistency
9296 fi
9297
9298 $rm -f try try.*
9299
9300 fi # d_longdbl
9301
9302 case "$sPRIfldbl" in
9303 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9304         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9305         d_SCNfldbl="$undef";
9306         ;;
9307 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9308         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9309         d_SCNfldbl="$define";
9310         ;;
9311 esac
9312
9313 : Check how to convert floats to strings.
9314
9315 if test "X$d_Gconvert" = X; then
9316
9317 echo " "
9318 echo "Checking for an efficient way to convert floats to strings."
9319 echo " " > try.c
9320 case "$uselongdouble" in
9321 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9322 esac
9323 case "$d_longdbl" in
9324 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9325 esac
9326 case "$d_PRIgldbl" in
9327 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9328 esac
9329 $cat >>try.c <<EOP
9330 #ifdef TRY_gconvert
9331 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9332 char *myname = "gconvert";
9333 #endif
9334 #ifdef TRY_gcvt
9335 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9336 char *myname = "gcvt";
9337 #endif
9338 #ifdef TRY_qgcvt
9339 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9340 char *myname = "qgcvt";
9341 #define DOUBLETYPE long double
9342 #endif
9343 #ifdef TRY_sprintf
9344 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9345 #ifdef HAS_PRIgldbl
9346 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9347 #else
9348 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9349 #endif
9350 #else
9351 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9352 #endif
9353 char *myname = "sprintf";
9354 #endif
9355
9356 #ifndef DOUBLETYPE
9357 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9358 #define DOUBLETYPE long double
9359 #else
9360 #define DOUBLETYPE double
9361 #endif
9362 #endif
9363
9364 #include <stdio.h>
9365
9366 #define I_STDLIB $i_stdlib
9367 #ifdef I_STDLIB
9368 #include <stdlib.h>
9369 #endif
9370
9371 int
9372 checkit(expect, got)
9373 char *expect;
9374 char *got;
9375 {
9376     if (strcmp(expect, got)) {
9377                 printf("%s oddity:  Expected %s, got %s\n",
9378                         myname, expect, got);
9379                 exit(1);
9380         }
9381 }
9382
9383 int main()
9384
9385         char buf[64]; 
9386         buf[63] = '\0';
9387
9388         /* This must be 1st test on (which?) platform */
9389         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9390         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9391         checkit("0.1", buf);
9392
9393         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9394         checkit("0.01", buf);
9395
9396         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9397         checkit("0.001", buf);
9398
9399         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9400         checkit("0.0001", buf);
9401
9402         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9403         if (strlen(buf) > 5)
9404             checkit("9e-005", buf); /* for Microsoft ?? */
9405         else
9406             checkit("9e-05", buf);
9407
9408         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9409         checkit("1", buf);
9410
9411         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9412         checkit("1.1", buf);
9413
9414         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9415         checkit("1.01", buf);
9416
9417         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9418         checkit("1.001", buf);
9419
9420         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9421         checkit("1.0001", buf);
9422
9423         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9424         checkit("1.00001", buf);
9425
9426         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9427         checkit("1.000001", buf);
9428
9429         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9430         checkit("0", buf);
9431
9432         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9433         checkit("-1", buf);
9434
9435         /* Some Linux gcvt's give 1.e+5 here. */
9436         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9437         checkit("100000", buf);
9438         
9439         /* Some Linux gcvt's give -1.e+5 here. */
9440         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9441         checkit("-100000", buf);
9442
9443         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9444         checkit("123.456", buf);
9445
9446         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9447         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9448         /* 34 should be enough to scare even long double
9449          * places into using the e notation. */
9450         if (strlen(buf) > 5)
9451             checkit("1e+034", buf); /* for Microsoft */
9452         else
9453             checkit("1e+34", buf);
9454
9455         /* For Perl, if you add additional tests here, also add them to
9456          * t/base/num.t for benefit of platforms not using Configure or
9457          * overriding d_Gconvert */
9458
9459         exit(0);
9460 }
9461 EOP
9462 : first add preferred functions to our list
9463 xxx_list=""
9464 for xxx_convert in $gconvert_preference; do
9465     case $xxx_convert in
9466     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9467     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9468     esac 
9469 done
9470 : then add any others
9471 for xxx_convert in gconvert gcvt sprintf; do
9472     case "$xxx_list" in
9473     *$xxx_convert*) ;;
9474     *) xxx_list="$xxx_list $xxx_convert" ;;
9475     esac 
9476 done
9477
9478 case "$d_longdbl$uselongdouble" in
9479 "$define$define")
9480     : again, add prefered functions to our list first
9481     xxx_ld_list=""
9482     for xxx_convert in $gconvert_ld_preference; do
9483         case $xxx_convert in
9484         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9485         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9486         esac
9487     done
9488     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9489     for xxx_convert in qgcvt sprintf $xxx_list; do
9490         case "$xxx_ld_list" in
9491         $xxx_convert*|*" $xxx_convert"*) ;;
9492         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9493         esac
9494     done
9495     : if sprintf cannot do long doubles, move it to the end
9496     if test "$d_PRIgldbl" != "$define"; then
9497         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9498     fi
9499     : if no qgcvt, remove it
9500     if test "$d_qgcvt" != "$define"; then
9501         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9502     fi
9503     : use the ld_list
9504     xxx_list="$xxx_ld_list"
9505     ;;
9506 esac
9507
9508 for xxx_convert in $xxx_list; do
9509         echo "Trying $xxx_convert..."
9510         $rm -f try try$_o
9511         set try -DTRY_$xxx_convert
9512         if eval $compile; then
9513                 echo "$xxx_convert() found." >&4
9514                 if $run ./try; then
9515                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9516                         break;
9517                 else
9518                         echo "...But $xxx_convert didn't work as I expected."
9519                         xxx_convert=''
9520                 fi
9521         else
9522                 echo "$xxx_convert NOT found." >&4
9523         fi
9524 done
9525
9526 if test X$xxx_convert = X; then
9527     echo "*** WHOA THERE!!! ***" >&4
9528     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9529     xxx_convert=sprintf
9530 fi
9531
9532 case "$xxx_convert" in
9533 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9534 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9535 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9536 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9537    "$define$define$define")
9538       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9539    "$define$define$undef")
9540       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9541    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9542    esac
9543    ;;  
9544 esac
9545
9546 fi
9547
9548 : see if _fwalk exists
9549 set fwalk d__fwalk
9550 eval $inlibc
9551
9552 : Initialize h_fcntl
9553 h_fcntl=false
9554
9555 : Initialize h_sysfile
9556 h_sysfile=false
9557
9558 : access call always available on UNIX
9559 set access d_access
9560 eval $inlibc
9561
9562 : locate the flags for 'access()'
9563 case "$d_access" in
9564 "$define")
9565         echo " "
9566         $cat >access.c <<EOCP
9567 #include <sys/types.h>
9568 #ifdef I_FCNTL
9569 #include <fcntl.h>
9570 #endif
9571 #ifdef I_SYS_FILE
9572 #include <sys/file.h>
9573 #endif
9574 #ifdef I_UNISTD
9575 #include <unistd.h>
9576 #endif
9577 #$i_stdlib I_STDLIB
9578 #ifdef I_STDLIB
9579 #include <stdlib.h>
9580 #endif
9581 int main() {
9582         exit(R_OK);
9583 }
9584 EOCP
9585         : check sys/file.h first, no particular reason here
9586         if $test `./findhdr sys/file.h` && \
9587                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9588                 h_sysfile=true;
9589                 echo "<sys/file.h> defines the *_OK access constants." >&4
9590         elif $test `./findhdr fcntl.h` && \
9591                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9592                 h_fcntl=true;
9593                 echo "<fcntl.h> defines the *_OK access constants." >&4
9594         elif $test `./findhdr unistd.h` && \
9595                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9596                 echo "<unistd.h> defines the *_OK access constants." >&4
9597         else
9598                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9599         fi
9600         ;;
9601 esac
9602 $rm -f access*
9603
9604 : see if accessx exists
9605 set accessx d_accessx
9606 eval $inlibc
9607
9608 : see if aintl exists
9609 set aintl d_aintl
9610 eval $inlibc
9611
9612 : see if alarm exists
9613 set alarm d_alarm
9614 eval $inlibc
9615
9616 : see if POSIX threads are available
9617 set pthread.h i_pthread
9618 eval $inhdr
9619
9620 : define a fucntion to check prototypes
9621 $cat > protochk <<EOSH
9622 $startsh
9623 cc="$cc"
9624 optimize="$optimize"
9625 ccflags="$ccflags"
9626 prototype="$prototype"
9627 define="$define"
9628 rm=$rm
9629 usethreads=$usethreads
9630 i_pthread=$i_pthread
9631 pthread_h_first=$pthread_h_first
9632 EOSH
9633
9634 $cat >> protochk <<'EOSH'
9635
9636 $rm -f try.c
9637 foo="$1"
9638 shift
9639 while test $# -ge 2; do
9640         case "$1" in
9641                 $define) echo "#include <$2>" >> try.c ;;
9642                 literal) echo "$2" >> try.c ;;
9643         esac
9644     # Extra magic for the benefit of systems that need pthread.h
9645     # to be included early to correctly detect threadsafe functions.
9646     # Such functions must guarantee themselves, though, that the usethreads
9647     # and i_pthread have been defined, before calling protochk.
9648     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9649         echo "#include <pthread.h>" >> try.c
9650         pthread_h_done=yes
9651     fi
9652     shift 2
9653 done
9654 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9655 cat >> try.c <<'EOCP'
9656 #ifdef CAN_PROTOTYPE
9657 #define _(args) args
9658 #else
9659 #define _(args) ()
9660 #endif
9661 EOCP
9662 echo "$foo" >> try.c
9663 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9664 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9665 status=$?
9666 $rm -f try.[co]
9667 exit $status
9668 EOSH
9669 chmod +x protochk
9670 $eunicefix protochk
9671
9672 hasproto='varname=$1; func=$2; shift; shift;
9673 while $test $# -ge 2; do
9674         case "$1" in
9675         $define) echo "#include <$2>";;
9676         esac ;
9677     shift 2;
9678 done > try.c;
9679 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9680 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9681         echo "$func() prototype found.";
9682         val="$define";
9683 else
9684         echo "$func() prototype NOT found.";
9685         val="$undef";
9686 fi;
9687 set $varname;
9688 eval $setvar;
9689 $rm -f try.c tryout.c'
9690
9691 : see if sys/types.h has to be included
9692 set sys/types.h i_systypes
9693 eval $inhdr
9694
9695 : see if sys/select.h has to be included
9696 set sys/select.h i_sysselct
9697 eval $inhdr
9698
9699 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9700 while $test $# -ge 2; do
9701         case "$1" in
9702         $define) echo "#include <$2>";;
9703         esac ;
9704     shift 2;
9705 done > try.c;
9706 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9707 set try;
9708 if eval $compile; then
9709         val="$define";
9710 else
9711         val="$undef";
9712 fi;
9713 set $varname;
9714 eval $setvar;
9715 $rm -f try.c try.o'
9716
9717 : see if we should include time.h, sys/time.h, or both
9718 echo " "
9719 if test "X$timeincl" = X; then
9720         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9721         $echo $n "I'm now running the test program...$c"
9722         $cat >try.c <<EOCP
9723 #include <sys/types.h>
9724 #ifdef I_TIME
9725 #include <time.h>
9726 #endif
9727 #ifdef I_SYSTIME
9728 #ifdef SYSTIMEKERNEL
9729 #define KERNEL
9730 #endif
9731 #include <sys/time.h>
9732 #endif
9733 #ifdef I_SYSSELECT
9734 #include <sys/select.h>
9735 #endif
9736 #$i_stdlib I_STDLIB
9737 #ifdef I_STDLIB
9738 #include <stdlib.h>
9739 #endif
9740 int main()
9741 {
9742         struct tm foo;
9743 #ifdef S_TIMEVAL
9744         struct timeval bar;
9745 #endif
9746 #ifdef S_TIMEZONE
9747         struct timezone tzp;
9748 #endif
9749         if (foo.tm_sec == foo.tm_sec)
9750                 exit(0);
9751 #ifdef S_TIMEVAL
9752         if (bar.tv_sec == bar.tv_sec)
9753                 exit(0);
9754 #endif
9755         exit(1);
9756 }
9757 EOCP
9758         flags=''
9759         for s_timezone in '-DS_TIMEZONE' ''; do
9760         sysselect=''
9761         for s_timeval in '-DS_TIMEVAL' ''; do
9762         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9763         for i_time in '' '-DI_TIME'; do
9764         for i_systime in '-DI_SYSTIME' ''; do
9765                 case "$flags" in
9766                 '') $echo $n ".$c"
9767                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9768                         if eval $compile; then
9769                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9770                                 shift
9771                                 flags="$*"
9772                                 echo " "
9773                                 $echo $n "Succeeded with $flags$c"
9774                         fi
9775                         ;;
9776                 esac
9777         done
9778         done
9779         done
9780         done
9781         done
9782         timeincl=''
9783         echo " "
9784         case "$flags" in
9785         *SYSTIMEKERNEL*) i_systimek="$define"
9786                 timeincl=`./findhdr sys/time.h`
9787                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9788         *) i_systimek="$undef";;
9789         esac
9790         case "$flags" in
9791         *I_TIME*) i_time="$define"
9792                 timeincl=`./findhdr time.h`" $timeincl"
9793                 echo "We'll include <time.h>." >&4;;
9794         *) i_time="$undef";;
9795         esac
9796         case "$flags" in
9797         *I_SYSTIME*) i_systime="$define"
9798                 timeincl=`./findhdr sys/time.h`" $timeincl"
9799                 echo "We'll include <sys/time.h>." >&4;;
9800         *) i_systime="$undef";;
9801         esac
9802         $rm -f try.c try
9803 fi
9804 : see if struct tm knows about tm_zone
9805 case "$i_systime$i_time" in
9806 *$define*) 
9807         echo " "
9808         echo "Checking to see if your struct tm has tm_zone field..." >&4
9809         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9810         eval $hasfield
9811         ;;
9812 *)      val="$undef"
9813         set d_tm_tm_zone
9814         eval $setvar
9815         ;;
9816 esac
9817 case "$d_tm_tm_zone" in
9818 "$define")      echo "Yes, it does."   ;;
9819 *)              echo "No, it doesn't." ;;
9820 esac
9821 : see if struct tm knows about tm_gmtoff
9822 case "$i_systime$i_time" in
9823 *$define*) 
9824         echo " "
9825         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9826         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9827         eval $hasfield
9828         ;;
9829 *)      val="$undef"
9830         set d_tm_tm_gmtoff
9831         eval $setvar
9832         ;;
9833 esac
9834 case "$d_tm_tm_gmtoff" in
9835 "$define")      echo "Yes, it does."   ;;
9836 *)              echo "No, it doesn't." ;;
9837 esac
9838
9839 : see if asctime_r exists
9840 set asctime_r d_asctime_r
9841 eval $inlibc
9842 case "$d_asctime_r" in
9843 "$define")
9844         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9845         case "$d_asctime_r_proto:$usethreads" in
9846         ":define")      d_asctime_r_proto=define
9847                 set d_asctime_r_proto asctime_r $hdrs
9848                 eval $hasproto ;;
9849         *)      ;;
9850         esac
9851         case "$d_asctime_r_proto" in
9852         define)
9853         case "$asctime_r_proto" in
9854         ''|0) try='char* asctime_r(const struct tm*, char*);'
9855         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9856         esac
9857         case "$asctime_r_proto" in
9858         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9859         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9860         esac
9861         case "$asctime_r_proto" in
9862         ''|0) try='int asctime_r(const struct tm*, char*);'
9863         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9864         esac
9865         case "$asctime_r_proto" in
9866         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9867         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9868         esac
9869         case "$asctime_r_proto" in
9870         ''|0)   d_asctime_r=undef
9871                 asctime_r_proto=0
9872                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9873         * )     case "$asctime_r_proto" in
9874                 REENTRANT_PROTO*) ;;
9875                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9876                 esac
9877                 echo "Prototype: $try" ;;
9878         esac
9879         ;;
9880         *)      case "$usethreads" in
9881                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9882                 esac
9883                 d_asctime_r=undef
9884                 asctime_r_proto=0
9885                 ;;
9886         esac
9887         ;;
9888 *)      asctime_r_proto=0
9889         ;;
9890 esac
9891
9892 : see if atolf exists
9893 set atolf d_atolf
9894 eval $inlibc
9895
9896 : see if atoll exists
9897 set atoll d_atoll
9898 eval $inlibc
9899
9900 : Look for GCC-style attribute format
9901 case "$d_attribute_format" in
9902 '')
9903 echo " "
9904 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9905 $cat >attrib.c <<'EOCP'
9906 #include <stdio.h>
9907 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9908 EOCP
9909 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9910         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9911                 echo "Your C compiler doesn't support __attribute__((format))."
9912                 val="$undef"
9913         else
9914                 echo "Your C compiler supports __attribute__((format))."
9915                 val="$define"
9916         fi
9917 else
9918         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9919         val="$undef"
9920 fi
9921 ;;
9922 *) val="$d_attribute_format" ;;
9923 esac
9924 set d_attribute_format
9925 eval $setvar
9926 $rm -f attrib*
9927
9928 : Look for GCC-style attribute malloc
9929 case "$d_attribute_malloc" in
9930 '')
9931 echo " "
9932 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9933 $cat >attrib.c <<'EOCP'
9934 #include <stdio.h>
9935 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9936 EOCP
9937 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9938         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9939                 echo "Your C compiler doesn't support __attribute__((malloc))."
9940                 val="$undef"
9941         else
9942                 echo "Your C compiler supports __attribute__((malloc))."
9943                 val="$define"
9944         fi
9945 else
9946         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9947         val="$undef"
9948 fi
9949 ;;
9950 *) val="$d_attribute_malloc" ;;
9951 esac
9952 set d_attribute_malloc
9953 eval $setvar
9954 $rm -f attrib*
9955
9956 : Look for GCC-style attribute nonnull
9957 case "$d_attribute_nonnull" in
9958 '')
9959 echo " "
9960 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9961 $cat >attrib.c <<'EOCP'
9962 #include <stdio.h>
9963 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9964 EOCP
9965 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9966         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9967                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9968                 val="$undef"
9969         else
9970                 echo "Your C compiler supports __attribute__((nonnull))."
9971                 val="$define"
9972         fi
9973 else
9974         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9975         val="$undef"
9976 fi
9977 ;;
9978 *) val="$d_attribute_nonnull" ;;
9979 esac
9980 set d_attribute_nonnull
9981 eval $setvar
9982 $rm -f attrib*
9983
9984 : Look for GCC-style attribute noreturn
9985 case "$d_attribute_noreturn" in
9986 '')
9987 echo " "
9988 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9989 $cat >attrib.c <<'EOCP'
9990 #include <stdio.h>
9991 void fall_over_dead( void ) __attribute__((noreturn));
9992 EOCP
9993 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9994         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9995                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9996                 val="$undef"
9997         else
9998                 echo "Your C compiler supports __attribute__((noreturn))."
9999                 val="$define"
10000         fi
10001 else
10002         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10003         val="$undef"
10004 fi
10005 ;;
10006 *) val="$d_attribute_noreturn" ;;
10007 esac
10008 set d_attribute_noreturn
10009 eval $setvar
10010 $rm -f attrib*
10011
10012 : Look for GCC-style attribute pure
10013 case "$d_attribute_pure" in
10014 '')
10015 echo " "
10016 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10017 $cat >attrib.c <<'EOCP'
10018 #include <stdio.h>
10019 int square( int n ) __attribute__((pure));
10020 EOCP
10021 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10022         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10023                 echo "Your C compiler doesn't support __attribute__((pure))."
10024                 val="$undef"
10025         else
10026                 echo "Your C compiler supports __attribute__((pure))."
10027                 val="$define"
10028         fi
10029 else
10030         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10031         val="$undef"
10032 fi
10033 ;;
10034 *) val="$d_attribute_pure" ;;
10035 esac
10036 set d_attribute_pure
10037 eval $setvar
10038 $rm -f attrib*
10039
10040 : Look for GCC-style attribute unused
10041 case "$d_attribute_unused" in
10042 '')
10043 echo " "
10044 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10045 $cat >attrib.c <<'EOCP'
10046 #include <stdio.h>
10047 int do_something( int dummy __attribute__((unused)), int n );
10048 EOCP
10049 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10050         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10051                 echo "Your C compiler doesn't support __attribute__((unused))."
10052                 val="$undef"
10053         else
10054                 echo "Your C compiler supports __attribute__((unused))."
10055                 val="$define"
10056         fi
10057 else
10058         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10059         val="$undef"
10060 fi
10061 ;;
10062 *) val="$d_attribute_unused" ;;
10063 esac
10064 set d_attribute_unused
10065 eval $setvar
10066 $rm -f attrib*
10067
10068 : Look for GCC-style attribute warn_unused_result
10069 case "$d_attribute_warn_unused_result" in
10070 '')
10071 echo " "
10072 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10073 $cat >attrib.c <<'EOCP'
10074 #include <stdio.h>
10075 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10076 EOCP
10077 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10078         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10079                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10080                 val="$undef"
10081         else
10082                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10083                 val="$define"
10084         fi
10085 else
10086         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10087         val="$undef"
10088 fi
10089 ;;
10090 *) val="$d_attribute_warn_unused_result" ;;
10091 esac
10092 set d_attribute_warn_unused_result
10093 eval $setvar
10094 $rm -f attrib*
10095
10096 : see if bcmp exists
10097 set bcmp d_bcmp
10098 eval $inlibc
10099
10100 : see if bcopy exists
10101 set bcopy d_bcopy
10102 eval $inlibc
10103
10104 : see if this is a unistd.h system
10105 set unistd.h i_unistd
10106 eval $inhdr
10107
10108 : see if getpgrp exists
10109 set getpgrp d_getpgrp
10110 eval $inlibc
10111
10112 case "$d_getpgrp" in
10113 "$define")
10114         echo " "
10115         echo "Checking to see which flavor of getpgrp is in use..."
10116         $cat >try.c <<EOP
10117 #$i_unistd I_UNISTD
10118 #include <sys/types.h>
10119 #ifdef I_UNISTD
10120 #  include <unistd.h>
10121 #endif
10122 #$i_stdlib I_STDLIB
10123 #ifdef I_STDLIB
10124 #include <stdlib.h>
10125 #endif
10126 int main()
10127 {
10128         if (getuid() == 0) {
10129                 printf("(I see you are running Configure as super-user...)\n");
10130                 setuid(1);
10131         }
10132 #ifdef TRY_BSD_PGRP
10133         if (getpgrp(1) == 0)
10134                 exit(0);
10135 #else
10136         if (getpgrp() > 0)
10137                 exit(0);
10138 #endif
10139         exit(1);
10140 }
10141 EOP
10142         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10143                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10144                 val="$define"
10145         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10146                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10147                 val="$undef"
10148         else
10149                 echo "I can't seem to compile and run the test program."
10150                 if ./usg; then
10151                         xxx="a USG one, i.e. you use getpgrp()."
10152                 else
10153                         # SVR4 systems can appear rather BSD-ish.
10154                         case "$i_unistd" in
10155                         $undef)
10156                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10157                                 val="$define"
10158                                 ;;
10159                         $define)
10160                                 xxx="probably a USG one, i.e. you use getpgrp()."
10161                                 val="$undef"
10162                                 ;;
10163                         esac
10164                 fi
10165                 echo "Assuming your getpgrp is $xxx" >&4
10166         fi
10167         ;;
10168 *) val="$undef";;
10169 esac
10170 set d_bsdgetpgrp
10171 eval $setvar
10172 $rm -f try try.*
10173
10174 : see if setpgrp exists
10175 set setpgrp d_setpgrp
10176 eval $inlibc
10177
10178 case "$d_setpgrp" in
10179 "$define")
10180         echo " "
10181         echo "Checking to see which flavor of setpgrp is in use..."
10182         $cat >try.c <<EOP
10183 #$i_unistd I_UNISTD
10184 #include <sys/types.h>
10185 #ifdef I_UNISTD
10186 #  include <unistd.h>
10187 #endif
10188 #$i_stdlib I_STDLIB
10189 #ifdef I_STDLIB
10190 #include <stdlib.h>
10191 #endif
10192 int main()
10193 {
10194         if (getuid() == 0) {
10195                 printf("(I see you are running Configure as super-user...)\n");
10196                 setuid(1);
10197         }
10198 #ifdef TRY_BSD_PGRP
10199         if (-1 == setpgrp(1, 1))
10200                 exit(0);
10201 #else
10202         if (setpgrp() != -1)
10203                 exit(0);
10204 #endif
10205         exit(1);
10206 }
10207 EOP
10208         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10209                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10210                 val="$define"
10211         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10212                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10213                 val="$undef"
10214         else
10215                 echo "(I can't seem to compile and run the test program.)"
10216                 if ./usg; then
10217                         xxx="a USG one, i.e. you use setpgrp()."
10218                 else
10219                         # SVR4 systems can appear rather BSD-ish.
10220                         case "$i_unistd" in
10221                         $undef)
10222                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10223                                 val="$define"
10224                                 ;;
10225                         $define)
10226                                 xxx="probably a USG one, i.e. you use setpgrp()."
10227                                 val="$undef"
10228                                 ;;
10229                         esac
10230                 fi
10231                 echo "Assuming your setpgrp is $xxx" >&4
10232         fi
10233         ;;
10234 *) val="$undef";;
10235 esac
10236 set d_bsdsetpgrp
10237 eval $setvar
10238 $rm -f try try.*
10239 : see if bzero exists
10240 set bzero d_bzero
10241 eval $inlibc
10242
10243 : see if signal is declared as pointer to function returning int or void
10244 echo " "
10245 xxx=`./findhdr signal.h`
10246 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10247 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10248         echo "You have int (*signal())() instead of void." >&4
10249         val="$undef"
10250 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10251         echo "You have void (*signal())()." >&4
10252         val="$define"
10253 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10254         echo "You have int (*signal())() instead of void." >&4
10255         val="$undef"
10256 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10257         echo "You have void (*signal())()." >&4
10258         val="$define"
10259 else
10260         case "$d_voidsig" in
10261         '')
10262         echo "I can't determine whether signal handler returns void or int..." >&4
10263                 dflt=void
10264                 rp="What type does your signal handler return?"
10265                 . ./myread
10266                 case "$ans" in
10267                 v*) val="$define";;
10268                 *) val="$undef";;
10269                 esac;;
10270         "$define")
10271                 echo "As you already told me, signal handler returns void." >&4
10272                 val="$define"
10273                 ;;
10274         *)      echo "As you already told me, signal handler returns int." >&4
10275                 val="$undef"
10276                 ;;
10277         esac
10278 fi
10279 set d_voidsig
10280 eval $setvar
10281 case "$d_voidsig" in
10282 "$define") signal_t="void";;
10283 *) signal_t="int";;
10284 esac
10285 $rm -f $$.tmp
10286
10287 : check for ability to cast large floats to 32-bit ints.
10288 echo " "
10289 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10290 if $test "$intsize" -ge 4; then
10291         xxx=int
10292 else
10293         xxx=long
10294 fi
10295 $cat >try.c <<EOCP
10296 #include <stdio.h>
10297 #$i_stdlib I_STDLIB
10298 #ifdef I_STDLIB
10299 #include <stdlib.h>
10300 #endif
10301 #include <sys/types.h>
10302 #include <signal.h>
10303 $signal_t blech(s) int s; { exit(3); }
10304 int main()
10305 {
10306         $xxx i32;
10307         double f, g;
10308         int result = 0;
10309         char str[16];
10310         signal(SIGFPE, blech);
10311
10312         /* Don't let compiler optimize the test away.  Store the number 
10313            in a writable string for gcc to pass to sscanf under HP/UX.
10314         */
10315         sprintf(str, "2147483647");
10316         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10317         g = 10 * f;
10318         i32  = ($xxx) g;
10319
10320         /* x86 processors will probably give 0x8000 0000, which is a
10321            sign change.  We don't want that.  We want to mimic SPARC
10322            behavior here, which is to preserve the sign and give
10323            back 0x7fff ffff.
10324         */
10325         if (i32 != ($xxx) f)
10326                 result |= 1;
10327         exit(result);
10328 }
10329 EOCP
10330 set try
10331 if eval $compile_ok; then
10332         $run ./try
10333         yyy=$?
10334 else
10335         echo "(I can't seem to compile the test program--assuming it can't)"
10336         yyy=1
10337 fi
10338 case "$yyy" in
10339 0)      val="$define"
10340         echo "Yup, it can."
10341         ;;
10342 *)      val="$undef"
10343         echo "Nope, it can't."
10344         ;;
10345 esac
10346 set d_casti32
10347 eval $setvar
10348 $rm -f try try.*
10349
10350 : check for ability to cast negative floats to unsigned
10351 echo " "
10352 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10353 $cat >try.c <<EOCP
10354 #include <stdio.h>
10355 #$i_stdlib I_STDLIB
10356 #ifdef I_STDLIB
10357 #include <stdlib.h>
10358 #endif
10359 #include <sys/types.h>
10360 #include <signal.h>
10361 $signal_t blech(s) int s; { exit(7); }
10362 $signal_t blech_in_list(s) int s; { exit(4); }
10363 unsigned long dummy_long(p) unsigned long p; { return p; }
10364 unsigned int dummy_int(p) unsigned int p; { return p; }
10365 unsigned short dummy_short(p) unsigned short p; { return p; }
10366 int main()
10367 {
10368         double f;
10369         unsigned long along;
10370         unsigned int aint;
10371         unsigned short ashort;
10372         int result = 0;
10373         char str[16];
10374         
10375         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10376            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10377            optimized the whole file away
10378         */
10379         /* Store the number in a writable string for gcc to pass to 
10380            sscanf under HP/UX.
10381         */
10382         sprintf(str, "-123");
10383         sscanf(str, "%lf", &f);  /* f = -123.; */
10384
10385         signal(SIGFPE, blech);
10386         along = (unsigned long)f;
10387         aint = (unsigned int)f;
10388         ashort = (unsigned short)f;
10389         if (along != (unsigned long)-123)
10390                 result |= 1;
10391         if (aint != (unsigned int)-123)
10392                 result |= 1;
10393         if (ashort != (unsigned short)-123)
10394                 result |= 1;
10395         sprintf(str, "1073741824.");
10396         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10397         f = f + f;
10398         along = 0;
10399         along = (unsigned long)f;
10400         if (along != 0x80000000)
10401                 result |= 2;
10402         f -= 1.;
10403         along = 0;
10404         along = (unsigned long)f;
10405         if (along != 0x7fffffff)
10406                 result |= 1;
10407         f += 2.;
10408         along = 0;
10409         along = (unsigned long)f;
10410         if (along != 0x80000001)
10411                 result |= 2;
10412         if (result)
10413                 exit(result);
10414         signal(SIGFPE, blech_in_list);
10415         sprintf(str, "123.");
10416         sscanf(str, "%lf", &f);  /* f = 123.; */
10417         along = dummy_long((unsigned long)f);
10418         aint = dummy_int((unsigned int)f);
10419         ashort = dummy_short((unsigned short)f);
10420         if (along != (unsigned long)123)
10421                 result |= 4;
10422         if (aint != (unsigned int)123)
10423                 result |= 4;
10424         if (ashort != (unsigned short)123)
10425                 result |= 4;
10426         exit(result);
10427
10428 }
10429 EOCP
10430 set try
10431 if eval $compile_ok; then
10432         $run ./try
10433         castflags=$?
10434 else
10435         echo "(I can't seem to compile the test program--assuming it can't)"
10436         castflags=7
10437 fi
10438 case "$castflags" in
10439 0)      val="$define"
10440         echo "Yup, it can."
10441         ;;
10442 *)      val="$undef"
10443         echo "Nope, it can't."
10444         ;;
10445 esac
10446 set d_castneg
10447 eval $setvar
10448 $rm -f try.*
10449
10450 : see if vprintf exists
10451 echo " "
10452 if set vprintf val -f d_vprintf; eval $csym; $val; then
10453         echo 'vprintf() found.' >&4
10454         val="$define"
10455         $cat >try.c <<EOF
10456 #include <varargs.h>
10457 #$i_stdlib I_STDLIB
10458 #ifdef I_STDLIB
10459 #include <stdlib.h>
10460 #endif
10461
10462 int main() { xxx("foo"); }
10463
10464 xxx(va_alist)
10465 va_dcl
10466 {
10467         va_list args;
10468         char buf[10];
10469
10470         va_start(args);
10471         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10472 }
10473 EOF
10474         set try
10475         if eval $compile && $run ./try; then
10476                 echo "Your vsprintf() returns (int)." >&4
10477                 val2="$undef"
10478         else
10479                 echo "Your vsprintf() returns (char*)." >&4
10480                 val2="$define"
10481         fi
10482 else
10483         echo 'vprintf() NOT found.' >&4
10484                 val="$undef"
10485                 val2="$undef"
10486 fi
10487 $rm -f try try.*
10488 set d_vprintf
10489 eval $setvar
10490 val=$val2
10491 set d_charvspr
10492 eval $setvar
10493
10494 : see if chown exists
10495 set chown d_chown
10496 eval $inlibc
10497
10498 : see if chroot exists
10499 set chroot d_chroot
10500 eval $inlibc
10501
10502 : see if chsize exists
10503 set chsize d_chsize
10504 eval $inlibc
10505
10506 : see if class exists
10507 set class d_class
10508 eval $inlibc
10509
10510 : see if clearenv exists
10511 set clearenv d_clearenv
10512 eval $inlibc
10513
10514 hasstruct='varname=$1; struct=$2; shift; shift;
10515 while $test $# -ge 2; do
10516         case "$1" in
10517         $define) echo "#include <$2>";;
10518         esac ;
10519     shift 2;
10520 done > try.c;
10521 echo "int main () { struct $struct foo; }" >> try.c;
10522 set try;
10523 if eval $compile; then
10524         val="$define";
10525 else
10526         val="$undef";
10527 fi;
10528 set $varname;
10529 eval $setvar;
10530 $rm -f try.c try.o'
10531
10532 socketlib=''
10533 sockethdr=''
10534 : see whether socket exists
10535 echo " "
10536 $echo $n "Hmm... $c" >&4
10537 if set socket val -f d_socket; eval $csym; $val; then
10538         echo "Looks like you have Berkeley networking support." >&4
10539         d_socket="$define"
10540         if set setsockopt val -f; eval $csym; $val; then
10541                 d_oldsock="$undef"
10542         else
10543                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10544                 d_oldsock="$define"
10545         fi
10546 else
10547         if $contains socklib libc.list >/dev/null 2>&1; then
10548                 echo "Looks like you have Berkeley networking support." >&4
10549                 d_socket="$define"
10550                 : we will have to assume that it supports the 4.2 BSD interface
10551                 d_oldsock="$undef"
10552         else
10553                 echo "You don't have Berkeley networking in libc$_a..." >&4
10554                 if test "X$d_socket" = "X$define"; then
10555                    echo "...but you seem to believe that you have sockets." >&4
10556                 else
10557                         for net in net socket
10558                         do
10559                                 if test -f /usr/lib/lib$net$_a; then
10560                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10561                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10562                                         if $contains socket libc.list >/dev/null 2>&1; then
10563                                                 d_socket="$define"
10564                                                 socketlib="-l$net"
10565                                                 case "$net" in
10566                                                 net)
10567                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10568                                                         sockethdr="-I/usr/netinclude"
10569                                                         ;;
10570                                                 esac
10571                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10572                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10573                                                         d_oldsock="$undef"
10574                                                 else
10575                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10576                                                         d_oldsock="$define"
10577                                                 fi
10578                                                 break
10579                                         fi
10580                                 fi
10581                         done
10582                         if test "X$d_socket" != "X$define"; then
10583                            echo "or anywhere else I see." >&4
10584                            d_socket="$undef"
10585                            d_oldsock="$undef"
10586                         fi
10587                 fi
10588         fi
10589 fi
10590
10591 : see if socketpair exists
10592 set socketpair d_sockpair
10593 eval $inlibc
10594
10595
10596 echo " "
10597 echo "Checking the availability of certain socket constants..." >&4
10598 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10599         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10600         $cat >try.c <<EOF
10601 #include <sys/types.h>
10602 #include <sys/socket.h>
10603 int main() {
10604     int i = $ENUM;
10605 }
10606 EOF
10607         val="$undef"
10608         set try; if eval $compile; then
10609                 val="$define"
10610         fi
10611         set d_${enum}; eval $setvar
10612         $rm -f try.c try
10613 done
10614
10615 : see if this is a sys/uio.h system
10616 set sys/uio.h i_sysuio
10617 eval $inhdr
10618
10619
10620 echo " "
10621 echo "Checking to see if your system supports struct cmsghdr..." >&4
10622 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10623 eval $hasstruct
10624 case "$d_cmsghdr_s" in
10625 "$define")      echo "Yes, it does."   ;;
10626 *)              echo "No, it doesn't." ;;
10627 esac
10628
10629
10630 : check for const keyword
10631 echo " "
10632 echo 'Checking to see if your C compiler knows about "const"...' >&4
10633 $cat >const.c <<'EOCP'
10634 typedef struct spug { int drokk; } spug;
10635 int main()
10636 {
10637         const char *foo;
10638         const spug y;
10639 }
10640 EOCP
10641 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10642         val="$define"
10643         echo "Yup, it does."
10644 else
10645         val="$undef"
10646         echo "Nope, it doesn't."
10647 fi
10648 set d_const
10649 eval $setvar
10650
10651 : see if copysignl exists
10652 set copysignl d_copysignl
10653 eval $inlibc
10654
10655 : see if crypt exists
10656 echo " "
10657 set crypt d_crypt
10658 eval $inlibc
10659 case "$d_crypt" in
10660 $define) cryptlib='' ;;
10661 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10662                 echo 'crypt() found.' >&4
10663                 val="$define"
10664                 cryptlib=''
10665         else
10666                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10667                 if $test -z "$cryptlib"; then
10668                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10669                 else
10670                         cryptlib=-lcrypt
10671                 fi
10672                 if $test -z "$cryptlib"; then
10673                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10674                 else
10675                         cryptlib=-lcrypt
10676                 fi
10677                 if $test -z "$cryptlib"; then
10678                         cryptlib=`./loc libcrypt$_a "" $libpth`
10679                 else
10680                         cryptlib=-lcrypt
10681                 fi
10682                 if $test -z "$cryptlib"; then
10683                         echo 'crypt() NOT found.' >&4
10684                         val="$undef"
10685                 else
10686                         val="$define"
10687                 fi
10688         fi
10689         set d_crypt
10690         eval $setvar
10691         ;;
10692 esac
10693
10694 : see if this is a crypt.h system
10695 set crypt.h i_crypt
10696 eval $inhdr
10697
10698 : see if crypt_r exists
10699 set crypt_r d_crypt_r
10700 eval $inlibc
10701 case "$d_crypt_r" in
10702 "$define")
10703         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10704         case "$d_crypt_r_proto:$usethreads" in
10705         ":define")      d_crypt_r_proto=define
10706                 set d_crypt_r_proto crypt_r $hdrs
10707                 eval $hasproto ;;
10708         *)      ;;
10709         esac
10710         case "$d_crypt_r_proto" in
10711         define)
10712         case "$crypt_r_proto" in
10713         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10714         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10715         esac
10716         case "$crypt_r_proto" in
10717         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10718         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10719         esac
10720         case "$crypt_r_proto" in
10721         ''|0)   d_crypt_r=undef
10722                 crypt_r_proto=0
10723                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10724         * )     case "$crypt_r_proto" in
10725                 REENTRANT_PROTO*) ;;
10726                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10727                 esac
10728                 echo "Prototype: $try" ;;
10729         esac
10730         ;;
10731         *)      case "$usethreads" in
10732                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10733                 esac
10734                 d_crypt_r=undef
10735                 crypt_r_proto=0
10736                 ;;
10737         esac
10738         ;;
10739 *)      crypt_r_proto=0
10740         ;;
10741 esac
10742
10743 : get csh whereabouts
10744 case "$csh" in
10745 'csh') val="$undef" ;;
10746 *) val="$define" ;;
10747 esac
10748 set d_csh
10749 eval $setvar
10750 : Respect a hint or command line value for full_csh.
10751 case "$full_csh" in
10752 '') full_csh=$csh ;;
10753 esac
10754
10755 : see if ctermid_r exists
10756 set ctermid_r d_ctermid_r
10757 eval $inlibc
10758 case "$d_ctermid_r" in
10759 "$define")
10760         hdrs="$i_systypes sys/types.h define stdio.h "
10761         case "$d_ctermid_r_proto:$usethreads" in
10762         ":define")      d_ctermid_r_proto=define
10763                 set d_ctermid_r_proto ctermid_r $hdrs
10764                 eval $hasproto ;;
10765         *)      ;;
10766         esac
10767         case "$d_ctermid_r_proto" in
10768         define)
10769         case "$ctermid_r_proto" in
10770         ''|0) try='char* ctermid_r(char*);'
10771         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10772         esac
10773         case "$ctermid_r_proto" in
10774         ''|0)   d_ctermid_r=undef
10775                 ctermid_r_proto=0
10776                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10777         * )     case "$ctermid_r_proto" in
10778                 REENTRANT_PROTO*) ;;
10779                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10780                 esac
10781                 echo "Prototype: $try" ;;
10782         esac
10783         ;;
10784         *)      case "$usethreads" in
10785                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10786                 esac
10787                 d_ctermid_r=undef
10788                 ctermid_r_proto=0
10789                 ;;
10790         esac
10791         ;;
10792 *)      ctermid_r_proto=0
10793         ;;
10794 esac
10795
10796 : see if ctime_r exists
10797 set ctime_r d_ctime_r
10798 eval $inlibc
10799 case "$d_ctime_r" in
10800 "$define")
10801         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10802         case "$d_ctime_r_proto:$usethreads" in
10803         ":define")      d_ctime_r_proto=define
10804                 set d_ctime_r_proto ctime_r $hdrs
10805                 eval $hasproto ;;
10806         *)      ;;
10807         esac
10808         case "$d_ctime_r_proto" in
10809         define)
10810         case "$ctime_r_proto" in
10811         ''|0) try='char* ctime_r(const time_t*, char*);'
10812         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10813         esac
10814         case "$ctime_r_proto" in
10815         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10816         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10817         esac
10818         case "$ctime_r_proto" in
10819         ''|0) try='int ctime_r(const time_t*, char*);'
10820         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10821         esac
10822         case "$ctime_r_proto" in
10823         ''|0) try='int ctime_r(const time_t*, char*, int);'
10824         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10825         esac
10826         case "$ctime_r_proto" in
10827         ''|0)   d_ctime_r=undef
10828                 ctime_r_proto=0
10829                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10830         * )     case "$ctime_r_proto" in
10831                 REENTRANT_PROTO*) ;;
10832                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10833                 esac
10834                 echo "Prototype: $try" ;;
10835         esac
10836         ;;
10837         *)      case "$usethreads" in
10838                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10839                 esac
10840                 d_ctime_r=undef
10841                 ctime_r_proto=0
10842                 ;;
10843         esac
10844         ;;
10845 *)      ctime_r_proto=0
10846         ;;
10847 esac
10848
10849 : see if cuserid exists
10850 set cuserid d_cuserid
10851 eval $inlibc
10852
10853 : see if this is a limits.h system
10854 set limits.h i_limits
10855 eval $inhdr
10856
10857 : see if this is a float.h system
10858 set float.h i_float
10859 eval $inhdr
10860
10861 : See if number of significant digits in a double precision number is known
10862 echo " "
10863 $cat >dbl_dig.c <<EOM
10864 #$i_limits I_LIMITS
10865 #$i_float I_FLOAT
10866 #ifdef I_LIMITS
10867 #include <limits.h>
10868 #endif
10869 #ifdef I_FLOAT
10870 #include <float.h>
10871 #endif
10872 #ifdef DBL_DIG
10873 printf("Contains DBL_DIG");
10874 #endif
10875 EOM
10876 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10877 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10878         echo "DBL_DIG found." >&4
10879         val="$define"
10880 else
10881         echo "DBL_DIG NOT found." >&4
10882         val="$undef"
10883 fi
10884 $rm -f dbl_dig.?
10885 set d_dbl_dig
10886 eval $setvar
10887
10888 : see if dbm.h is available
10889 : see if dbmclose exists
10890 set dbmclose d_dbmclose
10891 eval $inlibc
10892
10893 case "$d_dbmclose" in
10894 $define)
10895         set dbm.h i_dbm
10896         eval $inhdr
10897         case "$i_dbm" in
10898         $define)
10899                 val="$undef"
10900                 set i_rpcsvcdbm
10901                 eval $setvar
10902                 ;;
10903         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10904                 eval $inhdr
10905                 ;;
10906         esac
10907         ;;
10908 *)      echo "We won't be including <dbm.h>"
10909         val="$undef"
10910         set i_dbm
10911         eval $setvar
10912         val="$undef"
10913         set i_rpcsvcdbm
10914         eval $setvar
10915         ;;
10916 esac
10917
10918 : see if prototype for dbminit is available
10919 echo " "
10920 set d_dbminitproto dbminit $i_dbm dbm.h
10921 eval $hasproto
10922
10923 : see if difftime exists
10924 set difftime d_difftime
10925 eval $inlibc
10926
10927 : see if this is a dirent system
10928 echo " "
10929 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10930         val="$define"
10931         echo "<dirent.h> found." >&4
10932 else
10933         val="$undef"
10934         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10935                 echo "<sys/dir.h> found." >&4
10936                 echo " "
10937         else
10938                 xinc=`./findhdr sys/ndir.h`
10939         fi
10940         echo "<dirent.h> NOT found." >&4
10941 fi
10942 set i_dirent
10943 eval $setvar
10944
10945 : Look for type of directory structure.
10946 echo " "
10947 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10948
10949 case "$direntrytype" in
10950 ''|' ')
10951         case "$i_dirent" in
10952         $define) guess1='struct dirent' ;;
10953         *) guess1='struct direct'  ;;
10954         esac
10955         ;;
10956 *)      guess1="$direntrytype"
10957         ;;
10958 esac
10959
10960 case "$guess1" in
10961 'struct dirent') guess2='struct direct' ;;
10962 *) guess2='struct dirent' ;;
10963 esac
10964                 
10965 if $contains "$guess1" try.c >/dev/null 2>&1; then
10966         direntrytype="$guess1"
10967         echo "Your directory entries are $direntrytype." >&4
10968 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10969         direntrytype="$guess2"
10970         echo "Your directory entries seem to be $direntrytype." >&4
10971 else
10972         echo "I don't recognize your system's directory entries." >&4
10973         rp="What type is used for directory entries on this system?"
10974         dflt="$guess1"
10975         . ./myread
10976         direntrytype="$ans"
10977 fi
10978 $rm -f try.c
10979
10980
10981 : see if the directory entry stores field length
10982 echo " "
10983 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10984 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10985         echo "Good, your directory entry keeps length information in d_namlen." >&4
10986         val="$define"
10987 else
10988         echo "Your directory entry does not know about the d_namlen field." >&4
10989         val="$undef"
10990 fi
10991 set d_dirnamlen
10992 eval $setvar
10993 $rm -f try.c
10994
10995 : see if this is an sysdir system
10996 set sys/dir.h i_sysdir
10997 eval $inhdr
10998
10999 : see if this is an sysndir system
11000 set sys/ndir.h i_sysndir
11001 eval $inhdr
11002
11003 : Look for dirfd
11004 echo " "
11005 $cat >dirfd.c <<EOM
11006 #include <stdio.h>
11007 #$i_stdlib I_STDLIB
11008 #ifdef I_STDLIB
11009 #include <stdlib.h>
11010 #endif
11011 #$i_dirent I_DIRENT             /**/
11012 #$i_sysdir I_SYS_DIR            /**/
11013 #$i_sysndir I_SYS_NDIR          /**/
11014 #$i_systypes I_SYS_TYPES        /**/
11015 #if defined(I_SYS_TYPES)
11016 #include <sys/types.h>
11017 #endif
11018 #if defined(I_DIRENT)
11019 #include <dirent.h>
11020 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11021 #include <sys/dir.h>
11022 #endif
11023 #else
11024 #ifdef I_SYS_NDIR
11025 #include <sys/ndir.h>
11026 #else
11027 #ifdef I_SYS_DIR
11028 #ifdef hp9000s500
11029 #include <ndir.h>       /* may be wrong in the future */
11030 #else
11031 #include <sys/dir.h>
11032 #endif
11033 #endif
11034 #endif
11035 #endif 
11036 int main() {
11037         DIR *dirp = opendir(".");
11038         if (dirfd(dirp) >= 0)
11039                 exit(0);
11040         else
11041                 exit(1);
11042 }
11043 EOM
11044 val=$undef
11045 set dirfd
11046 if eval $compile; then
11047         val="$define"
11048 fi
11049 case "$val" in
11050 $define)        echo "dirfd() found." >&4       ;;
11051 *)              echo "dirfd() NOT found." >&4   ;;
11052 esac
11053 set d_dirfd
11054 eval $setvar
11055 $rm -f dirfd*
11056
11057 : see if dlerror exists
11058 xxx_runnm="$runnm"
11059 runnm=false
11060 set dlerror d_dlerror
11061 eval $inlibc
11062 runnm="$xxx_runnm"
11063
11064 : see if dlfcn is available
11065 set dlfcn.h i_dlfcn
11066 eval $inhdr
11067
11068 case "$usedl" in
11069 $define|y|true)
11070         $cat << EOM
11071
11072 On a few systems, the dynamically loaded modules that perl generates and uses
11073 will need a different extension than shared libs. The default will probably
11074 be appropriate.
11075
11076 EOM
11077         case "$dlext" in
11078         '')     dflt="$so" ;;
11079         *)      dflt="$dlext" ;;
11080         esac
11081         rp='What is the extension of dynamically loaded modules'
11082         . ./myread
11083         dlext="$ans"
11084         ;;
11085 *)
11086         dlext="none"
11087         ;;
11088 esac
11089
11090 : Check if dlsym need a leading underscore
11091 echo " "
11092 val="$undef"
11093
11094 case "$dlsrc" in
11095 dl_dlopen.xs)
11096         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11097         $cat >dyna.c <<'EOM'
11098 fred () { }
11099 EOM
11100
11101 $cat >fred.c<<EOM
11102
11103 #include <stdio.h>
11104 #$i_stdlib I_STDLIB
11105 #ifdef I_STDLIB
11106 #include <stdlib.h>
11107 #endif
11108 #$i_dlfcn I_DLFCN
11109 #ifdef I_DLFCN
11110 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11111 #else
11112 #include <sys/types.h>
11113 #include <nlist.h>
11114 #include <link.h>
11115 #endif
11116
11117 extern int fred() ;
11118
11119 int main()
11120 {
11121     void * handle ;
11122     void * symbol ;
11123 #ifndef RTLD_LAZY
11124     int mode = 1 ;
11125 #else
11126     int mode = RTLD_LAZY ;
11127 #endif
11128     handle = dlopen("./dyna.$dlext", mode) ;
11129     if (handle == NULL) {
11130         printf ("1\n") ;
11131         fflush (stdout) ;
11132         exit(0);
11133     }
11134     symbol = dlsym(handle, "fred") ;
11135     if (symbol == NULL) {
11136         /* try putting a leading underscore */
11137         symbol = dlsym(handle, "_fred") ;
11138         if (symbol == NULL) {
11139             printf ("2\n") ;
11140             fflush (stdout) ;
11141             exit(0);
11142         }
11143         printf ("3\n") ;
11144     }
11145     else
11146         printf ("4\n") ;
11147     fflush (stdout) ;
11148     exit(0);
11149 }
11150 EOM
11151         : Call the object file tmp-dyna.o in case dlext=o.
11152         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11153                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11154                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11155                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11156                 xxx=`$run ./fred`
11157                 case $xxx in
11158                 1)      echo "Test program failed using dlopen." >&4
11159                         echo "Perhaps you should not use dynamic loading." >&4;;
11160                 2)      echo "Test program failed using dlsym." >&4
11161                         echo "Perhaps you should not use dynamic loading." >&4;;
11162                 3)      echo "dlsym needs a leading underscore" >&4
11163                         val="$define" ;;
11164                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11165                 esac
11166         else
11167                 echo "I can't compile and run the test program." >&4
11168                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11169         fi
11170         ;;
11171 esac
11172                 
11173 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11174
11175 set d_dlsymun
11176 eval $setvar
11177
11178 : see if drand48_r exists
11179 set drand48_r d_drand48_r
11180 eval $inlibc
11181 case "$d_drand48_r" in
11182 "$define")
11183         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11184         case "$d_drand48_r_proto:$usethreads" in
11185         ":define")      d_drand48_r_proto=define
11186                 set d_drand48_r_proto drand48_r $hdrs
11187                 eval $hasproto ;;
11188         *)      ;;
11189         esac
11190         case "$d_drand48_r_proto" in
11191         define)
11192         case "$drand48_r_proto" in
11193         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11194         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11195         esac
11196         case "$drand48_r_proto" in
11197         ''|0)   d_drand48_r=undef
11198                 drand48_r_proto=0
11199                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11200         * )     case "$drand48_r_proto" in
11201                 REENTRANT_PROTO*) ;;
11202                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11203                 esac
11204                 echo "Prototype: $try" ;;
11205         esac
11206         ;;
11207         *)      case "$usethreads" in
11208                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11209                 esac
11210                 d_drand48_r=undef
11211                 drand48_r_proto=0
11212                 ;;
11213         esac
11214         ;;
11215 *)      drand48_r_proto=0
11216         ;;
11217 esac
11218
11219 : see if prototype for drand48 is available
11220 echo " "
11221 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11222 eval $hasproto
11223
11224 : see if dup2 exists
11225 set dup2 d_dup2
11226 eval $inlibc
11227
11228 : see if eaccess exists
11229 set eaccess d_eaccess
11230 eval $inlibc
11231
11232 : see if endgrent exists
11233 set endgrent d_endgrent
11234 eval $inlibc
11235
11236 : see if this is an grp system
11237 set grp.h i_grp
11238 eval $inhdr
11239
11240 case "$i_grp" in
11241 $define)
11242         xxx=`./findhdr grp.h`
11243         $cppstdin $cppflags $cppminus < $xxx >$$.h
11244
11245         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11246                 val="$define"
11247         else
11248                 val="$undef"
11249         fi
11250         set d_grpasswd
11251         eval $setvar
11252
11253         $rm -f $$.h
11254         ;;
11255 *)
11256         val="$undef";
11257         set d_grpasswd; eval $setvar
11258         ;;
11259 esac
11260
11261 : see if endgrent_r exists
11262 set endgrent_r d_endgrent_r
11263 eval $inlibc
11264 case "$d_endgrent_r" in
11265 "$define")
11266         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11267         case "$d_endgrent_r_proto:$usethreads" in
11268         ":define")      d_endgrent_r_proto=define
11269                 set d_endgrent_r_proto endgrent_r $hdrs
11270                 eval $hasproto ;;
11271         *)      ;;
11272         esac
11273         case "$d_endgrent_r_proto" in
11274         define)
11275         case "$endgrent_r_proto" in
11276         ''|0) try='int endgrent_r(FILE**);'
11277         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11278         esac
11279         case "$endgrent_r_proto" in
11280         ''|0) try='void endgrent_r(FILE**);'
11281         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11282         esac
11283         case "$endgrent_r_proto" in
11284         ''|0)   d_endgrent_r=undef
11285                 endgrent_r_proto=0
11286                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11287         * )     case "$endgrent_r_proto" in
11288                 REENTRANT_PROTO*) ;;
11289                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11290                 esac
11291                 echo "Prototype: $try" ;;
11292         esac
11293         ;;
11294         *)      case "$usethreads" in
11295                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11296                 esac
11297                 d_endgrent_r=undef
11298                 endgrent_r_proto=0
11299                 ;;
11300         esac
11301         ;;
11302 *)      endgrent_r_proto=0
11303         ;;
11304 esac
11305
11306 : see if endhostent exists
11307 set endhostent d_endhent
11308 eval $inlibc
11309
11310 : see if this is a netdb.h system
11311 set netdb.h i_netdb
11312 eval $inhdr
11313
11314 : see if endhostent_r exists
11315 set endhostent_r d_endhostent_r
11316 eval $inlibc
11317 case "$d_endhostent_r" in
11318 "$define")
11319         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11320         case "$d_endhostent_r_proto:$usethreads" in
11321         ":define")      d_endhostent_r_proto=define
11322                 set d_endhostent_r_proto endhostent_r $hdrs
11323                 eval $hasproto ;;
11324         *)      ;;
11325         esac
11326         case "$d_endhostent_r_proto" in
11327         define)
11328         case "$endhostent_r_proto" in
11329         ''|0) try='int endhostent_r(struct hostent_data*);'
11330         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11331         esac
11332         case "$endhostent_r_proto" in
11333         ''|0) try='void endhostent_r(struct hostent_data*);'
11334         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11335         esac
11336         case "$endhostent_r_proto" in
11337         ''|0)   d_endhostent_r=undef
11338                 endhostent_r_proto=0
11339                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11340         * )     case "$endhostent_r_proto" in
11341                 REENTRANT_PROTO*) ;;
11342                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11343                 esac
11344                 echo "Prototype: $try" ;;
11345         esac
11346         ;;
11347         *)      case "$usethreads" in
11348                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11349                 esac
11350                 d_endhostent_r=undef
11351                 endhostent_r_proto=0
11352                 ;;
11353         esac
11354         ;;
11355 *)      endhostent_r_proto=0
11356         ;;
11357 esac
11358
11359 : see if endnetent exists
11360 set endnetent d_endnent
11361 eval $inlibc
11362
11363 : see if endnetent_r exists
11364 set endnetent_r d_endnetent_r
11365 eval $inlibc
11366 case "$d_endnetent_r" in
11367 "$define")
11368         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11369         case "$d_endnetent_r_proto:$usethreads" in
11370         ":define")      d_endnetent_r_proto=define
11371                 set d_endnetent_r_proto endnetent_r $hdrs
11372                 eval $hasproto ;;
11373         *)      ;;
11374         esac
11375         case "$d_endnetent_r_proto" in
11376         define)
11377         case "$endnetent_r_proto" in
11378         ''|0) try='int endnetent_r(struct netent_data*);'
11379         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11380         esac
11381         case "$endnetent_r_proto" in
11382         ''|0) try='void endnetent_r(struct netent_data*);'
11383         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11384         esac
11385         case "$endnetent_r_proto" in
11386         ''|0)   d_endnetent_r=undef
11387                 endnetent_r_proto=0
11388                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11389         * )     case "$endnetent_r_proto" in
11390                 REENTRANT_PROTO*) ;;
11391                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11392                 esac
11393                 echo "Prototype: $try" ;;
11394         esac
11395         ;;
11396         *)      case "$usethreads" in
11397                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11398                 esac
11399                 d_endnetent_r=undef
11400                 endnetent_r_proto=0
11401                 ;;
11402         esac
11403         ;;
11404 *)      endnetent_r_proto=0
11405         ;;
11406 esac
11407
11408 : see if endprotoent exists
11409 set endprotoent d_endpent
11410 eval $inlibc
11411
11412 : see if endprotoent_r exists
11413 set endprotoent_r d_endprotoent_r
11414 eval $inlibc
11415 case "$d_endprotoent_r" in
11416 "$define")
11417         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11418         case "$d_endprotoent_r_proto:$usethreads" in
11419         ":define")      d_endprotoent_r_proto=define
11420                 set d_endprotoent_r_proto endprotoent_r $hdrs
11421                 eval $hasproto ;;
11422         *)      ;;
11423         esac
11424         case "$d_endprotoent_r_proto" in
11425         define)
11426         case "$endprotoent_r_proto" in
11427         ''|0) try='int endprotoent_r(struct protoent_data*);'
11428         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11429         esac
11430         case "$endprotoent_r_proto" in
11431         ''|0) try='void endprotoent_r(struct protoent_data*);'
11432         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11433         esac
11434         case "$endprotoent_r_proto" in
11435         ''|0)   d_endprotoent_r=undef
11436                 endprotoent_r_proto=0
11437                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11438         * )     case "$endprotoent_r_proto" in
11439                 REENTRANT_PROTO*) ;;
11440                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11441                 esac
11442                 echo "Prototype: $try" ;;
11443         esac
11444         ;;
11445         *)      case "$usethreads" in
11446                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11447                 esac
11448                 d_endprotoent_r=undef
11449                 endprotoent_r_proto=0
11450                 ;;
11451         esac
11452         ;;
11453 *)      endprotoent_r_proto=0
11454         ;;
11455 esac
11456
11457 : see if endpwent exists
11458 set endpwent d_endpwent
11459 eval $inlibc
11460
11461 : see if this is a pwd.h system
11462 set pwd.h i_pwd
11463 eval $inhdr
11464
11465 case "$i_pwd" in
11466 $define)
11467         xxx=`./findhdr pwd.h`
11468         $cppstdin $cppflags $cppminus < $xxx >$$.h
11469
11470         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11471                 val="$define"
11472         else
11473                 val="$undef"
11474         fi
11475         set d_pwquota
11476         eval $setvar
11477
11478         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11479                 val="$define"
11480         else
11481                 val="$undef"
11482         fi
11483         set d_pwage
11484         eval $setvar
11485
11486         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11487                 val="$define"
11488         else
11489                 val="$undef"
11490         fi
11491         set d_pwchange
11492         eval $setvar
11493
11494         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11495                 val="$define"
11496         else
11497                 val="$undef"
11498         fi
11499         set d_pwclass
11500         eval $setvar
11501
11502         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11503                 val="$define"
11504         else
11505                 val="$undef"
11506         fi
11507         set d_pwexpire
11508         eval $setvar
11509
11510         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11511                 val="$define"
11512         else
11513                 val="$undef"
11514         fi
11515         set d_pwcomment
11516         eval $setvar
11517
11518         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11519                 val="$define"
11520         else
11521                 val="$undef"
11522         fi
11523         set d_pwgecos
11524         eval $setvar
11525
11526         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11527                 val="$define"
11528         else
11529                 val="$undef"
11530         fi
11531         set d_pwpasswd
11532         eval $setvar
11533
11534         $rm -f $$.h
11535         ;;
11536 *)
11537         val="$undef"; 
11538         set d_pwquota; eval $setvar
11539         set d_pwage; eval $setvar
11540         set d_pwchange; eval $setvar
11541         set d_pwclass; eval $setvar
11542         set d_pwexpire; eval $setvar
11543         set d_pwcomment; eval $setvar
11544         set d_pwgecos; eval $setvar
11545         set d_pwpasswd; eval $setvar
11546         ;;
11547 esac
11548
11549 : see if endpwent_r exists
11550 set endpwent_r d_endpwent_r
11551 eval $inlibc
11552 case "$d_endpwent_r" in
11553 "$define")
11554         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11555         case "$d_endpwent_r_proto:$usethreads" in
11556         ":define")      d_endpwent_r_proto=define
11557                 set d_endpwent_r_proto endpwent_r $hdrs
11558                 eval $hasproto ;;
11559         *)      ;;
11560         esac
11561         case "$d_endpwent_r_proto" in
11562         define)
11563         case "$endpwent_r_proto" in
11564         ''|0) try='int endpwent_r(FILE**);'
11565         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11566         esac
11567         case "$endpwent_r_proto" in
11568         ''|0) try='void endpwent_r(FILE**);'
11569         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11570         esac
11571         case "$endpwent_r_proto" in
11572         ''|0)   d_endpwent_r=undef
11573                 endpwent_r_proto=0
11574                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11575         * )     case "$endpwent_r_proto" in
11576                 REENTRANT_PROTO*) ;;
11577                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11578                 esac
11579                 echo "Prototype: $try" ;;
11580         esac
11581         ;;
11582         *)      case "$usethreads" in
11583                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11584                 esac
11585                 d_endpwent_r=undef
11586                 endpwent_r_proto=0
11587                 ;;
11588         esac
11589         ;;
11590 *)      endpwent_r_proto=0
11591         ;;
11592 esac
11593
11594 : see if endservent exists
11595 set endservent d_endsent
11596 eval $inlibc
11597
11598 : see if endservent_r exists
11599 set endservent_r d_endservent_r
11600 eval $inlibc
11601 case "$d_endservent_r" in
11602 "$define")
11603         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11604         case "$d_endservent_r_proto:$usethreads" in
11605         ":define")      d_endservent_r_proto=define
11606                 set d_endservent_r_proto endservent_r $hdrs
11607                 eval $hasproto ;;
11608         *)      ;;
11609         esac
11610         case "$d_endservent_r_proto" in
11611         define)
11612         case "$endservent_r_proto" in
11613         ''|0) try='int endservent_r(struct servent_data*);'
11614         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11615         esac
11616         case "$endservent_r_proto" in
11617         ''|0) try='void endservent_r(struct servent_data*);'
11618         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11619         esac
11620         case "$endservent_r_proto" in
11621         ''|0)   d_endservent_r=undef
11622                 endservent_r_proto=0
11623                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11624         * )     case "$endservent_r_proto" in
11625                 REENTRANT_PROTO*) ;;
11626                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11627                 esac
11628                 echo "Prototype: $try" ;;
11629         esac
11630         ;;
11631         *)      case "$usethreads" in
11632                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11633                 esac
11634                 d_endservent_r=undef
11635                 endservent_r_proto=0
11636                 ;;
11637         esac
11638         ;;
11639 *)      endservent_r_proto=0
11640         ;;
11641 esac
11642
11643 : Locate the flags for 'open()'
11644 echo " "
11645 $cat >try.c <<EOCP
11646 #include <sys/types.h>
11647 #ifdef I_FCNTL
11648 #include <fcntl.h>
11649 #endif
11650 #ifdef I_SYS_FILE
11651 #include <sys/file.h>
11652 #endif
11653 #$i_stdlib I_STDLIB
11654 #ifdef I_STDLIB
11655 #include <stdlib.h>
11656 #endif
11657 int main() {
11658         if(O_RDONLY);
11659 #ifdef O_TRUNC
11660         exit(0);
11661 #else
11662         exit(1);
11663 #endif
11664 }
11665 EOCP
11666 : check sys/file.h first to get FREAD on Sun
11667 if $test `./findhdr sys/file.h` && \
11668                 set try -DI_SYS_FILE && eval $compile; then
11669         h_sysfile=true;
11670         echo "<sys/file.h> defines the O_* constants..." >&4
11671         if $run ./try; then
11672                 echo "and you have the 3 argument form of open()." >&4
11673                 val="$define"
11674         else
11675                 echo "but not the 3 argument form of open().  Oh, well." >&4
11676                 val="$undef"
11677         fi
11678 elif $test `./findhdr fcntl.h` && \
11679                 set try -DI_FCNTL && eval $compile; then
11680         h_fcntl=true;
11681         echo "<fcntl.h> defines the O_* constants..." >&4
11682         if $run ./try; then
11683                 echo "and you have the 3 argument form of open()." >&4
11684                 val="$define"
11685         else
11686                 echo "but not the 3 argument form of open().  Oh, well." >&4
11687                 val="$undef"
11688         fi
11689 else
11690         val="$undef"
11691         echo "I can't find the O_* constant definitions!  You got problems." >&4
11692 fi
11693 set d_open3
11694 eval $setvar
11695 $rm -f try try.*
11696
11697 : see which of string.h or strings.h is needed
11698 echo " "
11699 strings=`./findhdr string.h`
11700 if $test "$strings" && $test -r "$strings"; then
11701         echo "Using <string.h> instead of <strings.h>." >&4
11702         val="$define"
11703 else
11704         val="$undef"
11705         strings=`./findhdr strings.h`
11706         if $test "$strings" && $test -r "$strings"; then
11707                 echo "Using <strings.h> instead of <string.h>." >&4
11708         else
11709                 echo "No string header found -- You'll surely have problems." >&4
11710         fi
11711 fi
11712 set i_string
11713 eval $setvar
11714 case "$i_string" in
11715 "$undef") strings=`./findhdr strings.h`;;
11716 *)        strings=`./findhdr string.h`;;
11717 esac
11718
11719 : see if this is a sys/file.h system
11720 val=''
11721 set sys/file.h val
11722 eval $inhdr
11723
11724 : do we need to include sys/file.h ?
11725 case "$val" in
11726 "$define")
11727         echo " "
11728         if $h_sysfile; then
11729                 val="$define"
11730                 echo "We'll be including <sys/file.h>." >&4
11731         else
11732                 val="$undef"
11733                 echo "We won't be including <sys/file.h>." >&4
11734         fi
11735         ;;
11736 *)
11737         h_sysfile=false
11738         ;;
11739 esac
11740 set i_sysfile
11741 eval $setvar
11742
11743 : see if fcntl.h is there
11744 val=''
11745 set fcntl.h val
11746 eval $inhdr
11747
11748 : see if we can include fcntl.h
11749 case "$val" in
11750 "$define")
11751         echo " "
11752         if $h_fcntl; then
11753                 val="$define"
11754                 echo "We'll be including <fcntl.h>." >&4
11755         else
11756                 val="$undef"
11757                 if $h_sysfile; then
11758         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11759                 else
11760                         echo "We won't be including <fcntl.h>." >&4
11761                 fi
11762         fi
11763         ;;
11764 *)
11765         h_fcntl=false
11766         val="$undef"
11767         ;;
11768 esac
11769 set i_fcntl
11770 eval $setvar
11771
11772 : check for non-blocking I/O stuff
11773 case "$h_sysfile" in
11774 true) echo "#include <sys/file.h>" > head.c;;
11775 *)
11776        case "$h_fcntl" in
11777        true) echo "#include <fcntl.h>" > head.c;;
11778        *) echo "#include <sys/fcntl.h>" > head.c;;
11779        esac
11780        ;;
11781 esac
11782 echo " "
11783 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11784 case "$o_nonblock" in
11785 '')
11786         $cat head.c > try.c
11787         $cat >>try.c <<EOCP
11788 #include <stdio.h>
11789 #$i_stdlib I_STDLIB
11790 #ifdef I_STDLIB
11791 #include <stdlib.h>
11792 #endif
11793 #$i_fcntl I_FCNTL
11794 #ifdef I_FCNTL
11795 #include <fcntl.h>
11796 #endif
11797 int main() {
11798 #ifdef O_NONBLOCK
11799         printf("O_NONBLOCK\n");
11800         exit(0);
11801 #endif
11802 #ifdef O_NDELAY
11803         printf("O_NDELAY\n");
11804         exit(0);
11805 #endif
11806 #ifdef FNDELAY
11807         printf("FNDELAY\n");
11808         exit(0);
11809 #endif
11810         exit(0);
11811 }
11812 EOCP
11813         set try
11814         if eval $compile_ok; then
11815                 o_nonblock=`$run ./try`
11816                 case "$o_nonblock" in
11817                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11818                 *) echo "Seems like we can use $o_nonblock.";;
11819                 esac
11820         else
11821                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11822         fi
11823         ;;
11824 *) echo "Using $hint value $o_nonblock.";;
11825 esac
11826 $rm -f try try.* .out core
11827
11828 echo " "
11829 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11830 case "$eagain" in
11831 '')
11832         $cat head.c > try.c
11833         $cat >>try.c <<EOCP
11834 #include <errno.h>
11835 #include <sys/types.h>
11836 #include <signal.h>
11837 #include <stdio.h> 
11838 #$i_stdlib I_STDLIB
11839 #ifdef I_STDLIB
11840 #include <stdlib.h>
11841 #endif
11842 #$i_fcntl I_FCNTL
11843 #ifdef I_FCNTL
11844 #include <fcntl.h>
11845 #endif
11846 #define MY_O_NONBLOCK $o_nonblock
11847 #ifndef errno  /* XXX need better Configure test */
11848 extern int errno;
11849 #endif
11850 #$i_unistd I_UNISTD
11851 #ifdef I_UNISTD
11852 #include <unistd.h>
11853 #endif
11854 #$i_string I_STRING
11855 #ifdef I_STRING
11856 #include <string.h>
11857 #else
11858 #include <strings.h>
11859 #endif
11860 $signal_t blech(x) int x; { exit(3); }
11861 EOCP
11862         $cat >> try.c <<'EOCP'
11863 int main()
11864 {
11865         int pd[2];
11866         int pu[2];
11867         char buf[1];
11868         char string[100];
11869
11870         pipe(pd);       /* Down: child -> parent */
11871         pipe(pu);       /* Up: parent -> child */
11872         if (0 != fork()) {
11873                 int ret;
11874                 close(pd[1]);   /* Parent reads from pd[0] */
11875                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11876 #ifdef F_SETFL
11877                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11878                         exit(1);
11879 #else
11880                 exit(4);
11881 #endif
11882                 signal(SIGALRM, blech);
11883                 alarm(5);
11884                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11885                         exit(2);
11886                 sprintf(string, "%d\n", ret);
11887                 write(2, string, strlen(string));
11888                 alarm(0);
11889 #ifdef EAGAIN
11890                 if (errno == EAGAIN) {
11891                         printf("EAGAIN\n");
11892                         goto ok;
11893                 }
11894 #endif
11895 #ifdef EWOULDBLOCK
11896                 if (errno == EWOULDBLOCK)
11897                         printf("EWOULDBLOCK\n");
11898 #endif
11899         ok:
11900                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11901                 sleep(2);                               /* Give it time to close our pipe */
11902                 alarm(5);
11903                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11904                 alarm(0);
11905                 sprintf(string, "%d\n", ret);
11906                 write(4, string, strlen(string));
11907                 exit(0);
11908         }
11909
11910         close(pd[0]);                   /* We write to pd[1] */
11911         close(pu[1]);                   /* We read from pu[0] */
11912         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11913         close(pd[1]);                   /* Pipe pd is now fully closed! */
11914         exit(0);                                /* Bye bye, thank you for playing! */
11915 }
11916 EOCP
11917         set try
11918         if eval $compile_ok; then
11919                 echo "$startsh" >mtry
11920                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11921                 chmod +x mtry
11922                 ./mtry >/dev/null 2>&1
11923                 case $? in
11924                 0) eagain=`$cat try.out`;;
11925                 1) echo "Could not perform non-blocking setting!";;
11926                 2) echo "I did a successful read() for something that was not there!";;
11927                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11928                 4) echo "Could not find F_SETFL!";;
11929                 *) echo "Something terribly wrong happened during testing.";;
11930                 esac
11931                 rd_nodata=`$cat try.ret`
11932                 echo "A read() system call with no data present returns $rd_nodata."
11933                 case "$rd_nodata" in
11934                 0|-1) ;;
11935                 *)
11936                         echo "(That's peculiar, fixing that to be -1.)"
11937                         rd_nodata=-1
11938                         ;;
11939                 esac
11940                 case "$eagain" in
11941                 '')
11942                         echo "Forcing errno EAGAIN on read() with no data available."
11943                         eagain=EAGAIN
11944                         ;;
11945                 *)
11946                         echo "Your read() sets errno to $eagain when no data is available."
11947                         ;;
11948                 esac
11949                 status=`$cat try.err`
11950                 case "$status" in
11951                 0) echo "And it correctly returns 0 to signal EOF.";;
11952                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11953                 *) echo "However, your read() returns '$status' on EOF??";;
11954                 esac
11955                 val="$define"
11956                 if test "$status" = "$rd_nodata"; then
11957                         echo "WARNING: you can't distinguish between EOF and no data!"
11958                         val="$undef"
11959                 fi
11960         else
11961                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11962                 eagain=EAGAIN
11963         fi
11964         set d_eofnblk
11965         eval $setvar
11966         ;;
11967 *)
11968         echo "Using $hint value $eagain."
11969         echo "Your read() returns $rd_nodata when no data is present."
11970         case "$d_eofnblk" in
11971         "$define") echo "And you can see EOF because read() returns 0.";;
11972         "$undef") echo "But you can't see EOF status from read() returned value.";;
11973         *)
11974                 echo "(Assuming you can't see EOF status from read anyway.)"
11975                 d_eofnblk=$undef
11976                 ;;
11977         esac
11978         ;;
11979 esac
11980 $rm -f try try.* .out core head.c mtry
11981
11982 : see if _ptr and _cnt from stdio act std
11983 echo " "
11984
11985 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11986         echo "(Looks like you have stdio.h from BSD.)"
11987         case "$stdio_ptr" in
11988         '') stdio_ptr='((fp)->_p)'
11989                 ptr_lval=$define
11990                 ;;
11991         *)      ptr_lval=$d_stdio_ptr_lval;;
11992         esac
11993         case "$stdio_cnt" in
11994         '') stdio_cnt='((fp)->_r)'
11995                 cnt_lval=$define
11996                 ;;
11997         *)      cnt_lval=$d_stdio_cnt_lval;;
11998         esac
11999         case "$stdio_base" in
12000         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12001         esac
12002         case "$stdio_bufsiz" in
12003         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12004         esac
12005 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12006         echo "(Looks like you have stdio.h from Linux.)"
12007         case "$stdio_ptr" in
12008         '') stdio_ptr='((fp)->_IO_read_ptr)'
12009                 ptr_lval=$define
12010                 ;;
12011         *)      ptr_lval=$d_stdio_ptr_lval;;
12012         esac
12013         case "$stdio_cnt" in
12014         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12015                 cnt_lval=$undef
12016                 ;;
12017         *)      cnt_lval=$d_stdio_cnt_lval;;
12018         esac
12019         case "$stdio_base" in
12020         '') stdio_base='((fp)->_IO_read_base)';;
12021         esac
12022         case "$stdio_bufsiz" in
12023         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12024         esac
12025 else
12026         case "$stdio_ptr" in
12027         '') stdio_ptr='((fp)->_ptr)'
12028                 ptr_lval=$define
12029                 ;;
12030         *)      ptr_lval=$d_stdio_ptr_lval;;
12031         esac
12032         case "$stdio_cnt" in
12033         '') stdio_cnt='((fp)->_cnt)'
12034                 cnt_lval=$define
12035                 ;;
12036         *)      cnt_lval=$d_stdio_cnt_lval;;
12037         esac
12038         case "$stdio_base" in
12039         '') stdio_base='((fp)->_base)';;
12040         esac
12041         case "$stdio_bufsiz" in
12042         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12043         esac
12044 fi
12045
12046 : test whether _ptr and _cnt really work
12047 echo "Checking how std your stdio is..." >&4
12048 $cat >try.c <<EOP
12049 #include <stdio.h>
12050 #$i_stdlib I_STDLIB
12051 #ifdef I_STDLIB
12052 #include <stdlib.h>
12053 #endif
12054 #define FILE_ptr(fp)    $stdio_ptr
12055 #define FILE_cnt(fp)    $stdio_cnt
12056 int main() {
12057         FILE *fp = fopen("try.c", "r");
12058         char c = getc(fp);
12059         if (
12060                 18 <= FILE_cnt(fp) &&
12061                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12062         )
12063                 exit(0);
12064         exit(1);
12065 }
12066 EOP
12067 val="$undef"
12068 set try
12069 if eval $compile && $to try.c; then
12070         if $run ./try; then
12071                 echo "Your stdio acts pretty std."
12072                 val="$define"
12073         else
12074                 echo "Your stdio isn't very std."
12075         fi
12076 else
12077         echo "Your stdio doesn't appear very std."
12078 fi
12079 $rm -f try.c try
12080
12081 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12082 # direct buffer manipulation no longer works.  The Configure tests
12083 # should be changed to correctly detect this, but until then,
12084 # the following check should at least let perl compile and run.
12085 # (This quick fix should be updated before 5.8.1.)
12086 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12087 # A. Dougherty, June 3, 2002.
12088 case "$d_gnulibc" in
12089 $define)
12090         case "$gnulibc_version" in
12091         2.[01]*)  ;;
12092         2.2) ;;
12093         2.2.[0-9]) ;;
12094         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12095                 val="$undef"
12096                 ;;
12097         esac
12098         ;;
12099 esac
12100 set d_stdstdio
12101 eval $setvar
12102
12103 : Can _ptr be used as an lvalue?
12104 case "$d_stdstdio$ptr_lval" in
12105 $define$define) val=$define ;;
12106 *) val=$undef ;;
12107 esac
12108 set d_stdio_ptr_lval
12109 eval $setvar
12110
12111 : Can _cnt be used as an lvalue?
12112 case "$d_stdstdio$cnt_lval" in
12113 $define$define) val=$define ;;
12114 *) val=$undef ;;
12115 esac
12116 set d_stdio_cnt_lval
12117 eval $setvar
12118
12119
12120 : test whether setting _ptr sets _cnt as a side effect
12121 d_stdio_ptr_lval_sets_cnt="$undef"
12122 d_stdio_ptr_lval_nochange_cnt="$undef"
12123 case "$d_stdio_ptr_lval$d_stdstdio" in
12124 $define$define)
12125         echo "Checking to see what happens if we set the stdio ptr..." >&4
12126 $cat >try.c <<EOP
12127 #include <stdio.h>
12128 /* Can we scream? */
12129 /* Eat dust sed :-) */
12130 /* In the buffer space, no one can hear you scream. */
12131 #$i_stdlib I_STDLIB
12132 #ifdef I_STDLIB
12133 #include <stdlib.h>
12134 #endif
12135 #define FILE_ptr(fp)    $stdio_ptr
12136 #define FILE_cnt(fp)    $stdio_cnt
12137 #include <sys/types.h>
12138 int main() {
12139         FILE *fp = fopen("try.c", "r");
12140         int c;
12141         char *ptr;
12142         size_t cnt;
12143         if (!fp) {
12144             puts("Fail even to read");
12145             exit(1);
12146         }
12147         c = getc(fp); /* Read away the first # */
12148         if (c == EOF) {
12149             puts("Fail even to read");
12150             exit(1);
12151         }
12152         if (!(
12153                 18 <= FILE_cnt(fp) &&
12154                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12155         )) {
12156                 puts("Fail even to read");
12157                 exit (1);
12158         }
12159         ptr = (char*) FILE_ptr(fp);
12160         cnt = (size_t)FILE_cnt(fp);
12161
12162         FILE_ptr(fp) += 42;
12163
12164         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12165                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12166                 exit (1);
12167         }
12168         if (FILE_cnt(fp) <= 20) {
12169                 printf ("Fail (<20 chars to test)");
12170                 exit (1);
12171         }
12172         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12173                 puts("Fail compare");
12174                 exit (1);
12175         }
12176         if (cnt == FILE_cnt(fp)) {
12177                 puts("Pass_unchanged");
12178                 exit (0);
12179         }       
12180         if (FILE_cnt(fp) == (cnt - 42)) {
12181                 puts("Pass_changed");
12182                 exit (0);
12183         }
12184         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12185         return 1;
12186
12187 }
12188 EOP
12189         set try
12190         if eval $compile && $to try.c; then
12191                 case `$run ./try` in
12192                 Pass_changed)
12193                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12194                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12195                 Pass_unchanged)
12196                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12197                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12198                 Fail*)
12199                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12200                 *)
12201                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12202         esac
12203         else
12204                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12205         fi
12206         $rm -f try.c try
12207         ;;
12208 esac
12209
12210 : see if _base is also standard
12211 val="$undef"
12212 case "$d_stdstdio" in
12213 $define)
12214         $cat >try.c <<EOP
12215 #include <stdio.h>
12216 #$i_stdlib I_STDLIB
12217 #ifdef I_STDLIB
12218 #include <stdlib.h>
12219 #endif
12220 #define FILE_base(fp)   $stdio_base
12221 #define FILE_bufsiz(fp) $stdio_bufsiz
12222 int main() {
12223         FILE *fp = fopen("try.c", "r");
12224         char c = getc(fp);
12225         if (
12226                 19 <= FILE_bufsiz(fp) &&
12227                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12228         )
12229                 exit(0);
12230         exit(1);
12231 }
12232 EOP
12233         set try
12234         if eval $compile && $to try.c; then
12235                 if $run ./try; then
12236                         echo "And its _base field acts std."
12237                         val="$define"
12238                 else
12239                         echo "But its _base field isn't std."
12240                 fi
12241         else
12242                 echo "However, it seems to be lacking the _base field."
12243         fi
12244         $rm -f try.c try
12245         ;;
12246 esac
12247 set d_stdiobase
12248 eval $setvar
12249
12250 : see if fast_stdio exists
12251 val="$undef"
12252 case "$d_stdstdio:$d_stdio_ptr_lval" in
12253 "$define:$define")
12254         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12255         *$define*)
12256                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12257                 val="$define"
12258                 ;;
12259         esac
12260         ;;
12261 esac
12262 set d_faststdio
12263 eval $setvar
12264
12265
12266
12267 : see if fchdir exists
12268 set fchdir d_fchdir
12269 eval $inlibc
12270
12271 : see if fchmod exists
12272 set fchmod d_fchmod
12273 eval $inlibc
12274
12275 : see if fchown exists
12276 set fchown d_fchown
12277 eval $inlibc
12278
12279 : see if this is an fcntl system
12280 set fcntl d_fcntl
12281 eval $inlibc
12282
12283 echo " "
12284 : See if fcntl-based locking works.
12285 $cat >try.c <<EOCP
12286 #$i_stdlib I_STDLIB
12287 #ifdef I_STDLIB
12288 #include <stdlib.h>
12289 #endif
12290 #include <unistd.h>
12291 #include <fcntl.h>
12292 #include <signal.h>
12293 $signal_t blech(x) int x; { exit(3); }
12294 int main() {
12295 #if defined(F_SETLK) && defined(F_SETLKW)
12296      struct flock flock;
12297      int retval, fd;
12298      fd = open("try.c", O_RDONLY);
12299      flock.l_type = F_RDLCK;
12300      flock.l_whence = SEEK_SET;
12301      flock.l_start = flock.l_len = 0;
12302      signal(SIGALRM, blech);
12303      alarm(10);
12304      retval = fcntl(fd, F_SETLK, &flock);
12305      close(fd);
12306      (retval < 0 ? exit(2) : exit(0));
12307 #else
12308      exit(2);
12309 #endif
12310 }
12311 EOCP
12312 echo "Checking if fcntl-based file locking works... "
12313 case "$d_fcntl" in
12314 "$define")
12315         set try
12316         if eval $compile_ok; then
12317                 if $run ./try; then
12318                         echo "Yes, it seems to work."
12319                         val="$define"
12320                 else
12321                         echo "Nope, it didn't work."
12322                         val="$undef"
12323                         case "$?" in
12324                         3) $cat >&4 <<EOM
12325 ***
12326 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12327 *** This is (almost) impossible.
12328 *** If your NFS lock daemons are not feeling well, something like
12329 *** this may happen, please investigate.  Cannot continue, aborting.
12330 ***
12331 EOM
12332                                 exit 1
12333                                 ;;
12334                         esac
12335                 fi
12336         else
12337                 echo "I'm unable to compile the test program, so I'll assume not."
12338                 val="$undef"
12339         fi
12340         ;;
12341 *) val="$undef";
12342         echo "Nope, since you don't even have fcntl()."
12343         ;;
12344 esac
12345 set d_fcntl_can_lock
12346 eval $setvar
12347 $rm -f try*
12348
12349
12350 : check for fd_set items
12351 $cat <<EOM
12352
12353 Checking to see how well your C compiler handles fd_set and friends ...
12354 EOM
12355 $cat >try.c <<EOCP
12356 #$i_stdlib I_STDLIB
12357 #ifdef I_STDLIB
12358 #include <stdlib.h>
12359 #endif
12360 #$i_systime I_SYS_TIME
12361 #$i_sysselct I_SYS_SELECT
12362 #$d_socket HAS_SOCKET
12363 #include <sys/types.h>
12364 #ifdef HAS_SOCKET
12365 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12366 #endif
12367 #ifdef I_SYS_TIME
12368 #include <sys/time.h>
12369 #endif
12370 #ifdef I_SYS_SELECT
12371 #include <sys/select.h>
12372 #endif
12373 int main() {
12374         fd_set fds;
12375
12376 #ifdef TRYBITS
12377         if(fds.fds_bits);
12378 #endif
12379
12380 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12381         exit(0);
12382 #else
12383         exit(1);
12384 #endif
12385 }
12386 EOCP
12387 set try -DTRYBITS
12388 if eval $compile; then
12389         d_fds_bits="$define"
12390         d_fd_set="$define"
12391         echo "Well, your system knows about the normal fd_set typedef..." >&4
12392         if $run ./try; then
12393                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12394                 d_fd_macros="$define"
12395         else
12396                 $cat >&4 <<'EOM'
12397 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12398 EOM
12399                 d_fd_macros="$undef"
12400         fi
12401 else
12402         $cat <<'EOM'
12403 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12404 EOM
12405         set try
12406         if eval $compile; then
12407                 d_fds_bits="$undef"
12408                 d_fd_set="$define"
12409                 echo "Well, your system has some sort of fd_set available..." >&4
12410                 if $run ./try; then
12411                         echo "and you have the normal fd_set macros." >&4
12412                         d_fd_macros="$define"
12413                 else
12414                         $cat <<'EOM'
12415 but not the normal fd_set macros!  Gross!  More work for me...
12416 EOM
12417                         d_fd_macros="$undef"
12418                 fi
12419         else
12420         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12421                 d_fd_set="$undef"
12422                 d_fds_bits="$undef"
12423                 d_fd_macros="$undef"
12424         fi
12425 fi
12426 $rm -f try try.*
12427
12428 : see if fgetpos exists
12429 set fgetpos d_fgetpos
12430 eval $inlibc
12431
12432 : see if finite exists
12433 set finite d_finite
12434 eval $inlibc
12435
12436 : see if finitel exists
12437 set finitel d_finitel
12438 eval $inlibc
12439
12440 : see if flock exists
12441 set flock d_flock
12442 eval $inlibc
12443
12444 : see if prototype for flock is available
12445 echo " "
12446 set d_flockproto flock $i_sysfile sys/file.h
12447 eval $hasproto
12448
12449 : see if fork exists
12450 set fork d_fork
12451 eval $inlibc
12452
12453 : see if fp_class exists
12454 set fp_class d_fp_class
12455 eval $inlibc
12456
12457 : see if pathconf exists
12458 set pathconf d_pathconf
12459 eval $inlibc
12460
12461 : see if fpathconf exists
12462 set fpathconf d_fpathconf
12463 eval $inlibc
12464
12465 : see if fpclass exists
12466 set fpclass d_fpclass
12467 eval $inlibc
12468
12469 : see if fpclassify exists
12470 set fpclassify d_fpclassify
12471 eval $inlibc
12472
12473 : see if fpclassl exists
12474 set fpclassl d_fpclassl
12475 eval $inlibc
12476
12477
12478 : check for fpos64_t
12479 echo " "
12480 echo "Checking to see if you have fpos64_t..." >&4
12481 $cat >try.c <<EOCP
12482 #include <stdio.h>
12483 int main() { fpos64_t x = 7; }
12484 EOCP
12485 set try
12486 if eval $compile; then
12487         val="$define"
12488         echo "You have fpos64_t."
12489 else
12490         val="$undef"
12491         echo "You do not have fpos64_t."
12492         case "$fpossize" in
12493         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12494         esac
12495 fi
12496 $rm -f try.* try
12497 set d_fpos64_t
12498 eval $setvar
12499
12500 : see if frexpl exists
12501 set frexpl d_frexpl
12502 eval $inlibc
12503
12504 : see if this is a sys/param system
12505 set sys/param.h i_sysparam
12506 eval $inhdr
12507
12508 : see if this is a sys/mount.h system
12509 set sys/mount.h i_sysmount
12510 eval $inhdr
12511
12512
12513 echo " "
12514 echo "Checking to see if your system supports struct fs_data..." >&4
12515 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12516 eval $hasstruct
12517 case "$d_fs_data_s" in
12518 "$define")      echo "Yes, it does."   ;;
12519 *)              echo "No, it doesn't." ;;
12520 esac
12521
12522 : see if fseeko exists
12523 set fseeko d_fseeko
12524 eval $inlibc
12525 case "$longsize" in
12526 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12527 esac
12528
12529 : see if fsetpos exists
12530 set fsetpos d_fsetpos
12531 eval $inlibc
12532
12533
12534 : see if fstatfs exists
12535 set fstatfs d_fstatfs
12536 eval $inlibc
12537
12538
12539 : see if statvfs exists
12540 set statvfs d_statvfs
12541 eval $inlibc
12542
12543 : see if fstatvfs exists
12544 set fstatvfs d_fstatvfs
12545 eval $inlibc
12546
12547
12548 : see if fsync exists
12549 set fsync d_fsync
12550 eval $inlibc
12551
12552 : see if ftello exists
12553 set ftello d_ftello
12554 eval $inlibc
12555 case "$longsize" in
12556 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12557 esac
12558
12559 : see if futimes exists
12560 set futimes d_futimes
12561 eval $inlibc
12562
12563 : see if getcwd exists
12564 set getcwd d_getcwd
12565 eval $inlibc
12566
12567 : see if getespwnam exists
12568 set getespwnam d_getespwnam
12569 eval $inlibc
12570
12571
12572 : see if getfsstat exists
12573 set getfsstat d_getfsstat
12574 eval $inlibc
12575
12576 : see if getgrent exists
12577 set getgrent d_getgrent
12578 eval $inlibc
12579
12580 : see if getgrent_r exists
12581 set getgrent_r d_getgrent_r
12582 eval $inlibc
12583 case "$d_getgrent_r" in
12584 "$define")
12585         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12586         case "$d_getgrent_r_proto:$usethreads" in
12587         ":define")      d_getgrent_r_proto=define
12588                 set d_getgrent_r_proto getgrent_r $hdrs
12589                 eval $hasproto ;;
12590         *)      ;;
12591         esac
12592         case "$d_getgrent_r_proto" in
12593         define)
12594         case "$getgrent_r_proto" in
12595         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12596         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12597         esac
12598         case "$getgrent_r_proto" in
12599         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12600         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12601         esac
12602         case "$getgrent_r_proto" in
12603         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12604         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12605         esac
12606         case "$getgrent_r_proto" in
12607         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12608         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12609         esac
12610         case "$getgrent_r_proto" in
12611         ''|0) try='int getgrent_r(struct group*, char*, int);'
12612         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12613         esac
12614         case "$getgrent_r_proto" in
12615         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12616         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12617         esac
12618         case "$getgrent_r_proto" in
12619         ''|0)   d_getgrent_r=undef
12620                 getgrent_r_proto=0
12621                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12622         * )     case "$getgrent_r_proto" in
12623                 REENTRANT_PROTO*) ;;
12624                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12625                 esac
12626                 echo "Prototype: $try" ;;
12627         esac
12628         ;;
12629         *)      case "$usethreads" in
12630                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12631                 esac
12632                 d_getgrent_r=undef
12633                 getgrent_r_proto=0
12634                 ;;
12635         esac
12636         ;;
12637 *)      getgrent_r_proto=0
12638         ;;
12639 esac
12640
12641 : see if getgrgid_r exists
12642 set getgrgid_r d_getgrgid_r
12643 eval $inlibc
12644 case "$d_getgrgid_r" in
12645 "$define")
12646         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12647         case "$d_getgrgid_r_proto:$usethreads" in
12648         ":define")      d_getgrgid_r_proto=define
12649                 set d_getgrgid_r_proto getgrgid_r $hdrs
12650                 eval $hasproto ;;
12651         *)      ;;
12652         esac
12653         case "$d_getgrgid_r_proto" in
12654         define)
12655         case "$getgrgid_r_proto" in
12656         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12657         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12658         esac
12659         case "$getgrgid_r_proto" in
12660         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12661         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12662         esac
12663         case "$getgrgid_r_proto" in
12664         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12665         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12666         esac
12667         case "$getgrgid_r_proto" in
12668         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12669         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12670         esac
12671         case "$getgrgid_r_proto" in
12672         ''|0)   d_getgrgid_r=undef
12673                 getgrgid_r_proto=0
12674                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12675         * )     case "$getgrgid_r_proto" in
12676                 REENTRANT_PROTO*) ;;
12677                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12678                 esac
12679                 echo "Prototype: $try" ;;
12680         esac
12681         ;;
12682         *)      case "$usethreads" in
12683                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12684                 esac
12685                 d_getgrgid_r=undef
12686                 getgrgid_r_proto=0
12687                 ;;
12688         esac
12689         ;;
12690 *)      getgrgid_r_proto=0
12691         ;;
12692 esac
12693
12694 : see if getgrnam_r exists
12695 set getgrnam_r d_getgrnam_r
12696 eval $inlibc
12697 case "$d_getgrnam_r" in
12698 "$define")
12699         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12700         case "$d_getgrnam_r_proto:$usethreads" in
12701         ":define")      d_getgrnam_r_proto=define
12702                 set d_getgrnam_r_proto getgrnam_r $hdrs
12703                 eval $hasproto ;;
12704         *)      ;;
12705         esac
12706         case "$d_getgrnam_r_proto" in
12707         define)
12708         case "$getgrnam_r_proto" in
12709         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12710         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12711         esac
12712         case "$getgrnam_r_proto" in
12713         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12714         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12715         esac
12716         case "$getgrnam_r_proto" in
12717         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12718         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12719         esac
12720         case "$getgrnam_r_proto" in
12721         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12722         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12723         esac
12724         case "$getgrnam_r_proto" in
12725         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12726         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12727         esac
12728         case "$getgrnam_r_proto" in
12729         ''|0)   d_getgrnam_r=undef
12730                 getgrnam_r_proto=0
12731                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12732         * )     case "$getgrnam_r_proto" in
12733                 REENTRANT_PROTO*) ;;
12734                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12735                 esac
12736                 echo "Prototype: $try" ;;
12737         esac
12738         ;;
12739         *)      case "$usethreads" in
12740                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12741                 esac
12742                 d_getgrnam_r=undef
12743                 getgrnam_r_proto=0
12744                 ;;
12745         esac
12746         ;;
12747 *)      getgrnam_r_proto=0
12748         ;;
12749 esac
12750
12751 : see if gethostbyaddr exists
12752 set gethostbyaddr d_gethbyaddr
12753 eval $inlibc
12754
12755 : see if gethostbyname exists
12756 set gethostbyname d_gethbyname
12757 eval $inlibc
12758
12759 : see if gethostent exists
12760 set gethostent d_gethent
12761 eval $inlibc
12762
12763 : see how we will look up host name
12764 echo " "
12765 call=''
12766 if set gethostname val -f d_gethname; eval $csym; $val; then
12767         echo 'gethostname() found.' >&4
12768         d_gethname="$define"
12769         call=gethostname
12770 fi
12771 if set uname val -f d_uname; eval $csym; $val; then
12772         if ./xenix; then
12773                 $cat <<'EOM'
12774 uname() was found, but you're running xenix, and older versions of xenix
12775 have a broken uname(). If you don't really know whether your xenix is old
12776 enough to have a broken system call, use the default answer.
12777
12778 EOM
12779                 dflt=y
12780                 case "$d_uname" in
12781                 "$define") dflt=n;;
12782                 esac
12783                 rp='Is your uname() broken?'
12784                 . ./myread
12785                 case "$ans" in
12786                 n*) d_uname="$define"; call=uname;;
12787                 esac
12788         else
12789                 echo 'uname() found.' >&4
12790                 d_uname="$define"
12791                 case "$call" in
12792                 '') call=uname ;;
12793                 esac
12794         fi
12795 fi
12796 case "$d_gethname" in
12797 '') d_gethname="$undef";;
12798 esac
12799 case "$d_uname" in
12800 '') d_uname="$undef";;
12801 esac
12802 case "$d_uname$d_gethname" in
12803 *define*)
12804         dflt=n
12805         cat <<EOM
12806  
12807 Every now and then someone has a $call() that lies about the hostname
12808 but can't be fixed for political or economic reasons.  If you wish, I can
12809 pretend $call() isn't there and maybe compute hostname at run-time
12810 thanks to the '$phostname' command.
12811
12812 EOM
12813         rp="Shall I ignore $call() from now on?"
12814         . ./myread
12815         case "$ans" in
12816         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12817         esac;;
12818 esac
12819 case "$phostname" in
12820 '') aphostname='';;
12821 *) case "$aphostname" in
12822         /*) ;;
12823         *) set X $phostname
12824                 shift
12825                 file=$1
12826                 shift
12827                 file=`./loc $file $file $pth`
12828                 aphostname=`echo $file $*`
12829                 ;;
12830         esac
12831         ;;
12832 esac
12833 case "$d_uname$d_gethname" in
12834 *define*) ;;
12835 *)
12836         case "$phostname" in
12837         '')
12838                 echo "There will be no way for $package to get your hostname." >&4;;
12839         *)
12840         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12841                 ;;
12842         esac;;
12843 esac
12844 case "$d_phostname" in
12845 '') d_phostname="$undef";;
12846 esac
12847
12848 : see if gethostbyaddr_r exists
12849 set gethostbyaddr_r d_gethostbyaddr_r
12850 eval $inlibc
12851 case "$d_gethostbyaddr_r" in
12852 "$define")
12853         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12854         case "$d_gethostbyaddr_r_proto:$usethreads" in
12855         ":define")      d_gethostbyaddr_r_proto=define
12856                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12857                 eval $hasproto ;;
12858         *)      ;;
12859         esac
12860         case "$d_gethostbyaddr_r_proto" in
12861         define)
12862         case "$gethostbyaddr_r_proto" in
12863         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12864         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12865         esac
12866         case "$gethostbyaddr_r_proto" in
12867         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12868         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12869         esac
12870         case "$gethostbyaddr_r_proto" in
12871         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12872         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12873         esac
12874         case "$gethostbyaddr_r_proto" in
12875         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12876         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12877         esac
12878         case "$gethostbyaddr_r_proto" in
12879         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12880         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12881         esac
12882         case "$gethostbyaddr_r_proto" in
12883         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12884         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12885         esac
12886         case "$gethostbyaddr_r_proto" in
12887         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12888         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12889         esac
12890         case "$gethostbyaddr_r_proto" in
12891         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12892         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12893         esac
12894         case "$gethostbyaddr_r_proto" in
12895         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12896         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12897         esac
12898         case "$gethostbyaddr_r_proto" in
12899         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12900         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12901         esac
12902         case "$gethostbyaddr_r_proto" in
12903         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12904         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12905         esac
12906         case "$gethostbyaddr_r_proto" in
12907         ''|0)   d_gethostbyaddr_r=undef
12908                 gethostbyaddr_r_proto=0
12909                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12910         * )     case "$gethostbyaddr_r_proto" in
12911                 REENTRANT_PROTO*) ;;
12912                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12913                 esac
12914                 echo "Prototype: $try" ;;
12915         esac
12916         ;;
12917         *)      case "$usethreads" in
12918                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12919                 esac
12920                 d_gethostbyaddr_r=undef
12921                 gethostbyaddr_r_proto=0
12922                 ;;
12923         esac
12924         ;;
12925 *)      gethostbyaddr_r_proto=0
12926         ;;
12927 esac
12928
12929 : see if gethostbyname_r exists
12930 set gethostbyname_r d_gethostbyname_r
12931 eval $inlibc
12932 case "$d_gethostbyname_r" in
12933 "$define")
12934         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12935         case "$d_gethostbyname_r_proto:$usethreads" in
12936         ":define")      d_gethostbyname_r_proto=define
12937                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12938                 eval $hasproto ;;
12939         *)      ;;
12940         esac
12941         case "$d_gethostbyname_r_proto" in
12942         define)
12943         case "$gethostbyname_r_proto" in
12944         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12945         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12946         esac
12947         case "$gethostbyname_r_proto" in
12948         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12949         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12950         esac
12951         case "$gethostbyname_r_proto" in
12952         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12953         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12954         esac
12955         case "$gethostbyname_r_proto" in
12956         ''|0)   d_gethostbyname_r=undef
12957                 gethostbyname_r_proto=0
12958                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12959         * )     case "$gethostbyname_r_proto" in
12960                 REENTRANT_PROTO*) ;;
12961                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12962                 esac
12963                 echo "Prototype: $try" ;;
12964         esac
12965         ;;
12966         *)      case "$usethreads" in
12967                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12968                 esac
12969                 d_gethostbyname_r=undef
12970                 gethostbyname_r_proto=0
12971                 ;;
12972         esac
12973         ;;
12974 *)      gethostbyname_r_proto=0
12975         ;;
12976 esac
12977
12978 : see if gethostent_r exists
12979 set gethostent_r d_gethostent_r
12980 eval $inlibc
12981 case "$d_gethostent_r" in
12982 "$define")
12983         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12984         case "$d_gethostent_r_proto:$usethreads" in
12985         ":define")      d_gethostent_r_proto=define
12986                 set d_gethostent_r_proto gethostent_r $hdrs
12987                 eval $hasproto ;;
12988         *)      ;;
12989         esac
12990         case "$d_gethostent_r_proto" in
12991         define)
12992         case "$gethostent_r_proto" in
12993         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12994         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12995         esac
12996         case "$gethostent_r_proto" in
12997         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12998         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12999         esac
13000         case "$gethostent_r_proto" in
13001         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13002         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13003         esac
13004         case "$gethostent_r_proto" in
13005         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13006         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13007         esac
13008         case "$gethostent_r_proto" in
13009         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13010         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13011         esac
13012         case "$gethostent_r_proto" in
13013         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13014         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13015         esac
13016         case "$gethostent_r_proto" in
13017         ''|0)   d_gethostent_r=undef
13018                 gethostent_r_proto=0
13019                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13020         * )     case "$gethostent_r_proto" in
13021                 REENTRANT_PROTO*) ;;
13022                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13023                 esac
13024                 echo "Prototype: $try" ;;
13025         esac
13026         ;;
13027         *)      case "$usethreads" in
13028                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13029                 esac
13030                 d_gethostent_r=undef
13031                 gethostent_r_proto=0
13032                 ;;
13033         esac
13034         ;;
13035 *)      gethostent_r_proto=0
13036         ;;
13037 esac
13038
13039 : see if prototypes for various gethostxxx netdb.h functions are available
13040 echo " "
13041 set d_gethostprotos gethostent $i_netdb netdb.h
13042 eval $hasproto
13043
13044 : see if getitimer exists
13045 set getitimer d_getitimer
13046 eval $inlibc
13047
13048 : see if getlogin exists
13049 set getlogin d_getlogin
13050 eval $inlibc
13051
13052 : see if getlogin_r exists
13053 set getlogin_r d_getlogin_r
13054 eval $inlibc
13055 case "$d_getlogin_r" in
13056 "$define")
13057         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13058         case "$d_getlogin_r_proto:$usethreads" in
13059         ":define")      d_getlogin_r_proto=define
13060                 set d_getlogin_r_proto getlogin_r $hdrs
13061                 eval $hasproto ;;
13062         *)      ;;
13063         esac
13064         case "$d_getlogin_r_proto" in
13065         define)
13066         case "$getlogin_r_proto" in
13067         ''|0) try='int getlogin_r(char*, size_t);'
13068         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13069         esac
13070         case "$getlogin_r_proto" in
13071         ''|0) try='int getlogin_r(char*, int);'
13072         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13073         esac
13074         case "$getlogin_r_proto" in
13075         ''|0) try='char* getlogin_r(char*, size_t);'
13076         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13077         esac
13078         case "$getlogin_r_proto" in
13079         ''|0) try='char* getlogin_r(char*, int);'
13080         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13081         esac
13082         case "$getlogin_r_proto" in
13083         ''|0)   d_getlogin_r=undef
13084                 getlogin_r_proto=0
13085                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13086         * )     case "$getlogin_r_proto" in
13087                 REENTRANT_PROTO*) ;;
13088                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13089                 esac
13090                 echo "Prototype: $try" ;;
13091         esac
13092         ;;
13093         *)      case "$usethreads" in
13094                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13095                 esac
13096                 d_getlogin_r=undef
13097                 getlogin_r_proto=0
13098                 ;;
13099         esac
13100         ;;
13101 *)      getlogin_r_proto=0
13102         ;;
13103 esac
13104
13105 : see if getmnt exists
13106 set getmnt d_getmnt
13107 eval $inlibc
13108
13109 : see if getmntent exists
13110 set getmntent d_getmntent
13111 eval $inlibc
13112
13113 : see if getnetbyaddr exists
13114 set getnetbyaddr d_getnbyaddr
13115 eval $inlibc
13116
13117 : see if getnetbyname exists
13118 set getnetbyname d_getnbyname
13119 eval $inlibc
13120
13121 : see if getnetent exists
13122 set getnetent d_getnent
13123 eval $inlibc
13124
13125 : see if getnetbyaddr_r exists
13126 set getnetbyaddr_r d_getnetbyaddr_r
13127 eval $inlibc
13128 case "$d_getnetbyaddr_r" in
13129 "$define")
13130         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13131         case "$d_getnetbyaddr_r_proto:$usethreads" in
13132         ":define")      d_getnetbyaddr_r_proto=define
13133                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13134                 eval $hasproto ;;
13135         *)      ;;
13136         esac
13137         case "$d_getnetbyaddr_r_proto" in
13138         define)
13139         case "$getnetbyaddr_r_proto" in
13140         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13141         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13142         esac
13143         case "$getnetbyaddr_r_proto" in
13144         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13145         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13146         esac
13147         case "$getnetbyaddr_r_proto" in
13148         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13149         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13150         esac
13151         case "$getnetbyaddr_r_proto" in
13152         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13153         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13154         esac
13155         case "$getnetbyaddr_r_proto" in
13156         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13157         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13158         esac
13159         case "$getnetbyaddr_r_proto" in
13160         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13161         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13162         esac
13163         case "$getnetbyaddr_r_proto" in
13164         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13165         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13166         esac
13167         case "$getnetbyaddr_r_proto" in
13168         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13169         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13170         esac
13171         case "$getnetbyaddr_r_proto" in
13172         ''|0)   d_getnetbyaddr_r=undef
13173                 getnetbyaddr_r_proto=0
13174                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13175         * )     case "$getnetbyaddr_r_proto" in
13176                 REENTRANT_PROTO*) ;;
13177                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13178                 esac
13179                 echo "Prototype: $try" ;;
13180         esac
13181         ;;
13182         *)      case "$usethreads" in
13183                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13184                 esac
13185                 d_getnetbyaddr_r=undef
13186                 getnetbyaddr_r_proto=0
13187                 ;;
13188         esac
13189         ;;
13190 *)      getnetbyaddr_r_proto=0
13191         ;;
13192 esac
13193
13194 : see if getnetbyname_r exists
13195 set getnetbyname_r d_getnetbyname_r
13196 eval $inlibc
13197 case "$d_getnetbyname_r" in
13198 "$define")
13199         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13200         case "$d_getnetbyname_r_proto:$usethreads" in
13201         ":define")      d_getnetbyname_r_proto=define
13202                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13203                 eval $hasproto ;;
13204         *)      ;;
13205         esac
13206         case "$d_getnetbyname_r_proto" in
13207         define)
13208         case "$getnetbyname_r_proto" in
13209         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13210         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13211         esac
13212         case "$getnetbyname_r_proto" in
13213         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13214         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13215         esac
13216         case "$getnetbyname_r_proto" in
13217         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13218         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13219         esac
13220         case "$getnetbyname_r_proto" in
13221         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13222         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13223         esac
13224         case "$getnetbyname_r_proto" in
13225         ''|0)   d_getnetbyname_r=undef
13226                 getnetbyname_r_proto=0
13227                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13228         * )     case "$getnetbyname_r_proto" in
13229                 REENTRANT_PROTO*) ;;
13230                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13231                 esac
13232                 echo "Prototype: $try" ;;
13233         esac
13234         ;;
13235         *)      case "$usethreads" in
13236                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13237                 esac
13238                 d_getnetbyname_r=undef
13239                 getnetbyname_r_proto=0
13240                 ;;
13241         esac
13242         ;;
13243 *)      getnetbyname_r_proto=0
13244         ;;
13245 esac
13246
13247 : see if getnetent_r exists
13248 set getnetent_r d_getnetent_r
13249 eval $inlibc
13250 case "$d_getnetent_r" in
13251 "$define")
13252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13253         case "$d_getnetent_r_proto:$usethreads" in
13254         ":define")      d_getnetent_r_proto=define
13255                 set d_getnetent_r_proto getnetent_r $hdrs
13256                 eval $hasproto ;;
13257         *)      ;;
13258         esac
13259         case "$d_getnetent_r_proto" in
13260         define)
13261         case "$getnetent_r_proto" in
13262         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13263         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13264         esac
13265         case "$getnetent_r_proto" in
13266         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13267         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13268         esac
13269         case "$getnetent_r_proto" in
13270         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13271         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13272         esac
13273         case "$getnetent_r_proto" in
13274         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13275         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13276         esac
13277         case "$getnetent_r_proto" in
13278         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13279         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13280         esac
13281         case "$getnetent_r_proto" in
13282         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13283         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13284         esac
13285         case "$getnetent_r_proto" in
13286         ''|0)   d_getnetent_r=undef
13287                 getnetent_r_proto=0
13288                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13289         * )     case "$getnetent_r_proto" in
13290                 REENTRANT_PROTO*) ;;
13291                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13292                 esac
13293                 echo "Prototype: $try" ;;
13294         esac
13295         ;;
13296         *)      case "$usethreads" in
13297                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13298                 esac
13299                 d_getnetent_r=undef
13300                 getnetent_r_proto=0
13301                 ;;
13302         esac
13303         ;;
13304 *)      getnetent_r_proto=0
13305         ;;
13306 esac
13307
13308 : see if prototypes for various getnetxxx netdb.h functions are available
13309 echo " "
13310 set d_getnetprotos getnetent $i_netdb netdb.h
13311 eval $hasproto
13312
13313 : see if getpagesize exists
13314 set getpagesize d_getpagsz
13315 eval $inlibc
13316
13317
13318 : see if getprotobyname exists
13319 set getprotobyname d_getpbyname
13320 eval $inlibc
13321
13322 : see if getprotobynumber exists
13323 set getprotobynumber d_getpbynumber
13324 eval $inlibc
13325
13326 : see if getprotoent exists
13327 set getprotoent d_getpent
13328 eval $inlibc
13329
13330 : see if getpgid exists
13331 set getpgid d_getpgid
13332 eval $inlibc
13333
13334 : see if getpgrp2 exists
13335 set getpgrp2 d_getpgrp2
13336 eval $inlibc
13337
13338 : see if getppid exists
13339 set getppid d_getppid
13340 eval $inlibc
13341
13342 : see if getpriority exists
13343 set getpriority d_getprior
13344 eval $inlibc
13345
13346 : see if getprotobyname_r exists
13347 set getprotobyname_r d_getprotobyname_r
13348 eval $inlibc
13349 case "$d_getprotobyname_r" in
13350 "$define")
13351         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13352         case "$d_getprotobyname_r_proto:$usethreads" in
13353         ":define")      d_getprotobyname_r_proto=define
13354                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13355                 eval $hasproto ;;
13356         *)      ;;
13357         esac
13358         case "$d_getprotobyname_r_proto" in
13359         define)
13360         case "$getprotobyname_r_proto" in
13361         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13362         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13363         esac
13364         case "$getprotobyname_r_proto" in
13365         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13366         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13367         esac
13368         case "$getprotobyname_r_proto" in
13369         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13370         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13371         esac
13372         case "$getprotobyname_r_proto" in
13373         ''|0)   d_getprotobyname_r=undef
13374                 getprotobyname_r_proto=0
13375                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13376         * )     case "$getprotobyname_r_proto" in
13377                 REENTRANT_PROTO*) ;;
13378                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13379                 esac
13380                 echo "Prototype: $try" ;;
13381         esac
13382         ;;
13383         *)      case "$usethreads" in
13384                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13385                 esac
13386                 d_getprotobyname_r=undef
13387                 getprotobyname_r_proto=0
13388                 ;;
13389         esac
13390         ;;
13391 *)      getprotobyname_r_proto=0
13392         ;;
13393 esac
13394
13395 : see if getprotobynumber_r exists
13396 set getprotobynumber_r d_getprotobynumber_r
13397 eval $inlibc
13398 case "$d_getprotobynumber_r" in
13399 "$define")
13400         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13401         case "$d_getprotobynumber_r_proto:$usethreads" in
13402         ":define")      d_getprotobynumber_r_proto=define
13403                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13404                 eval $hasproto ;;
13405         *)      ;;
13406         esac
13407         case "$d_getprotobynumber_r_proto" in
13408         define)
13409         case "$getprotobynumber_r_proto" in
13410         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13411         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13412         esac
13413         case "$getprotobynumber_r_proto" in
13414         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13415         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13416         esac
13417         case "$getprotobynumber_r_proto" in
13418         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13419         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13420         esac
13421         case "$getprotobynumber_r_proto" in
13422         ''|0)   d_getprotobynumber_r=undef
13423                 getprotobynumber_r_proto=0
13424                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13425         * )     case "$getprotobynumber_r_proto" in
13426                 REENTRANT_PROTO*) ;;
13427                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13428                 esac
13429                 echo "Prototype: $try" ;;
13430         esac
13431         ;;
13432         *)      case "$usethreads" in
13433                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13434                 esac
13435                 d_getprotobynumber_r=undef
13436                 getprotobynumber_r_proto=0
13437                 ;;
13438         esac
13439         ;;
13440 *)      getprotobynumber_r_proto=0
13441         ;;
13442 esac
13443
13444 : see if getprotoent_r exists
13445 set getprotoent_r d_getprotoent_r
13446 eval $inlibc
13447 case "$d_getprotoent_r" in
13448 "$define")
13449         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13450         case "$d_getprotoent_r_proto:$usethreads" in
13451         ":define")      d_getprotoent_r_proto=define
13452                 set d_getprotoent_r_proto getprotoent_r $hdrs
13453                 eval $hasproto ;;
13454         *)      ;;
13455         esac
13456         case "$d_getprotoent_r_proto" in
13457         define)
13458         case "$getprotoent_r_proto" in
13459         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13460         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13461         esac
13462         case "$getprotoent_r_proto" in
13463         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13464         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13465         esac
13466         case "$getprotoent_r_proto" in
13467         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13468         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13469         esac
13470         case "$getprotoent_r_proto" in
13471         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13472         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13473         esac
13474         case "$getprotoent_r_proto" in
13475         ''|0)   d_getprotoent_r=undef
13476                 getprotoent_r_proto=0
13477                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13478         * )     case "$getprotoent_r_proto" in
13479                 REENTRANT_PROTO*) ;;
13480                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13481                 esac
13482                 echo "Prototype: $try" ;;
13483         esac
13484         ;;
13485         *)      case "$usethreads" in
13486                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13487                 esac
13488                 d_getprotoent_r=undef
13489                 getprotoent_r_proto=0
13490                 ;;
13491         esac
13492         ;;
13493 *)      getprotoent_r_proto=0
13494         ;;
13495 esac
13496
13497 : see if prototypes for various getprotoxxx netdb.h functions are available
13498 echo " "
13499 set d_getprotoprotos getprotoent $i_netdb netdb.h
13500 eval $hasproto
13501
13502 : see if getprpwnam exists
13503 set getprpwnam d_getprpwnam
13504 eval $inlibc
13505
13506 : see if getpwent exists
13507 set getpwent d_getpwent
13508 eval $inlibc
13509
13510 : see if getpwent_r exists
13511 set getpwent_r d_getpwent_r
13512 eval $inlibc
13513 case "$d_getpwent_r" in
13514 "$define")
13515         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13516         case "$d_getpwent_r_proto:$usethreads" in
13517         ":define")      d_getpwent_r_proto=define
13518                 set d_getpwent_r_proto getpwent_r $hdrs
13519                 eval $hasproto ;;
13520         *)      ;;
13521         esac
13522         case "$d_getpwent_r_proto" in
13523         define)
13524         case "$getpwent_r_proto" in
13525         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13526         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13527         esac
13528         case "$getpwent_r_proto" in
13529         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13530         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13531         esac
13532         case "$getpwent_r_proto" in
13533         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13534         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13535         esac
13536         case "$getpwent_r_proto" in
13537         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13538         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13539         esac
13540         case "$getpwent_r_proto" in
13541         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13542         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13543         esac
13544         case "$getpwent_r_proto" in
13545         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13546         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13547         esac
13548         case "$getpwent_r_proto" in
13549         ''|0)   d_getpwent_r=undef
13550                 getpwent_r_proto=0
13551                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13552         * )     case "$getpwent_r_proto" in
13553                 REENTRANT_PROTO*) ;;
13554                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13555                 esac
13556                 echo "Prototype: $try" ;;
13557         esac
13558         ;;
13559         *)      case "$usethreads" in
13560                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13561                 esac
13562                 d_getpwent_r=undef
13563                 getpwent_r_proto=0
13564                 ;;
13565         esac
13566         ;;
13567 *)      getpwent_r_proto=0
13568         ;;
13569 esac
13570
13571 : see if getpwnam_r exists
13572 set getpwnam_r d_getpwnam_r
13573 eval $inlibc
13574 case "$d_getpwnam_r" in
13575 "$define")
13576         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13577         case "$d_getpwnam_r_proto:$usethreads" in
13578         ":define")      d_getpwnam_r_proto=define
13579                 set d_getpwnam_r_proto getpwnam_r $hdrs
13580                 eval $hasproto ;;
13581         *)      ;;
13582         esac
13583         case "$d_getpwnam_r_proto" in
13584         define)
13585         case "$getpwnam_r_proto" in
13586         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13587         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13588         esac
13589         case "$getpwnam_r_proto" in
13590         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13591         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13592         esac
13593         case "$getpwnam_r_proto" in
13594         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13595         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13596         esac
13597         case "$getpwnam_r_proto" in
13598         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13599         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13600         esac
13601         case "$getpwnam_r_proto" in
13602         ''|0)   d_getpwnam_r=undef
13603                 getpwnam_r_proto=0
13604                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13605         * )     case "$getpwnam_r_proto" in
13606                 REENTRANT_PROTO*) ;;
13607                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13608                 esac
13609                 echo "Prototype: $try" ;;
13610         esac
13611         ;;
13612         *)      case "$usethreads" in
13613                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13614                 esac
13615                 d_getpwnam_r=undef
13616                 getpwnam_r_proto=0
13617                 ;;
13618         esac
13619         ;;
13620 *)      getpwnam_r_proto=0
13621         ;;
13622 esac
13623
13624 : see if getpwuid_r exists
13625 set getpwuid_r d_getpwuid_r
13626 eval $inlibc
13627 case "$d_getpwuid_r" in
13628 "$define")
13629         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13630         case "$d_getpwuid_r_proto:$usethreads" in
13631         ":define")      d_getpwuid_r_proto=define
13632                 set d_getpwuid_r_proto getpwuid_r $hdrs
13633                 eval $hasproto ;;
13634         *)      ;;
13635         esac
13636         case "$d_getpwuid_r_proto" in
13637         define)
13638         case "$getpwuid_r_proto" in
13639         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13640         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13641         esac
13642         case "$getpwuid_r_proto" in
13643         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13644         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13645         esac
13646         case "$getpwuid_r_proto" in
13647         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13648         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13649         esac
13650         case "$getpwuid_r_proto" in
13651         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13652         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13653         esac
13654         case "$getpwuid_r_proto" in
13655         ''|0)   d_getpwuid_r=undef
13656                 getpwuid_r_proto=0
13657                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13658         * )     case "$getpwuid_r_proto" in
13659                 REENTRANT_PROTO*) ;;
13660                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13661                 esac
13662                 echo "Prototype: $try" ;;
13663         esac
13664         ;;
13665         *)      case "$usethreads" in
13666                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13667                 esac
13668                 d_getpwuid_r=undef
13669                 getpwuid_r_proto=0
13670                 ;;
13671         esac
13672         ;;
13673 *)      getpwuid_r_proto=0
13674         ;;
13675 esac
13676
13677
13678 : see if getservbyname exists
13679 set getservbyname d_getsbyname
13680 eval $inlibc
13681
13682 : see if getservbyport exists
13683 set getservbyport d_getsbyport
13684 eval $inlibc
13685
13686 : see if getservent exists
13687 set getservent d_getsent
13688 eval $inlibc
13689
13690 : see if getservbyname_r exists
13691 set getservbyname_r d_getservbyname_r
13692 eval $inlibc
13693 case "$d_getservbyname_r" in
13694 "$define")
13695         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13696         case "$d_getservbyname_r_proto:$usethreads" in
13697         ":define")      d_getservbyname_r_proto=define
13698                 set d_getservbyname_r_proto getservbyname_r $hdrs
13699                 eval $hasproto ;;
13700         *)      ;;
13701         esac
13702         case "$d_getservbyname_r_proto" in
13703         define)
13704         case "$getservbyname_r_proto" in
13705         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13706         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13707         esac
13708         case "$getservbyname_r_proto" in
13709         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13710         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13711         esac
13712         case "$getservbyname_r_proto" in
13713         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13714         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13715         esac
13716         case "$getservbyname_r_proto" in
13717         ''|0)   d_getservbyname_r=undef
13718                 getservbyname_r_proto=0
13719                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13720         * )     case "$getservbyname_r_proto" in
13721                 REENTRANT_PROTO*) ;;
13722                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13723                 esac
13724                 echo "Prototype: $try" ;;
13725         esac
13726         ;;
13727         *)      case "$usethreads" in
13728                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13729                 esac
13730                 d_getservbyname_r=undef
13731                 getservbyname_r_proto=0
13732                 ;;
13733         esac
13734         ;;
13735 *)      getservbyname_r_proto=0
13736         ;;
13737 esac
13738
13739 : see if getservbyport_r exists
13740 set getservbyport_r d_getservbyport_r
13741 eval $inlibc
13742 case "$d_getservbyport_r" in
13743 "$define")
13744         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13745         case "$d_getservbyport_r_proto:$usethreads" in
13746         ":define")      d_getservbyport_r_proto=define
13747                 set d_getservbyport_r_proto getservbyport_r $hdrs
13748                 eval $hasproto ;;
13749         *)      ;;
13750         esac
13751         case "$d_getservbyport_r_proto" in
13752         define)
13753         case "$getservbyport_r_proto" in
13754         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13755         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13756         esac
13757         case "$getservbyport_r_proto" in
13758         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13759         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13760         esac
13761         case "$getservbyport_r_proto" in
13762         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13763         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13764         esac
13765         case "$getservbyport_r_proto" in
13766         ''|0)   d_getservbyport_r=undef
13767                 getservbyport_r_proto=0
13768                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13769         * )     case "$getservbyport_r_proto" in
13770                 REENTRANT_PROTO*) ;;
13771                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13772                 esac
13773                 echo "Prototype: $try" ;;
13774         esac
13775         ;;
13776         *)      case "$usethreads" in
13777                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13778                 esac
13779                 d_getservbyport_r=undef
13780                 getservbyport_r_proto=0
13781                 ;;
13782         esac
13783         ;;
13784 *)      getservbyport_r_proto=0
13785         ;;
13786 esac
13787
13788 : see if getservent_r exists
13789 set getservent_r d_getservent_r
13790 eval $inlibc
13791 case "$d_getservent_r" in
13792 "$define")
13793         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13794         case "$d_getservent_r_proto:$usethreads" in
13795         ":define")      d_getservent_r_proto=define
13796                 set d_getservent_r_proto getservent_r $hdrs
13797                 eval $hasproto ;;
13798         *)      ;;
13799         esac
13800         case "$d_getservent_r_proto" in
13801         define)
13802         case "$getservent_r_proto" in
13803         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13804         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13805         esac
13806         case "$getservent_r_proto" in
13807         ''|0) try='int getservent_r(struct servent*, char*, int);'
13808         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13809         esac
13810         case "$getservent_r_proto" in
13811         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13812         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13813         esac
13814         case "$getservent_r_proto" in
13815         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13816         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13817         esac
13818         case "$getservent_r_proto" in
13819         ''|0)   d_getservent_r=undef
13820                 getservent_r_proto=0
13821                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13822         * )     case "$getservent_r_proto" in
13823                 REENTRANT_PROTO*) ;;
13824                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13825                 esac
13826                 echo "Prototype: $try" ;;
13827         esac
13828         ;;
13829         *)      case "$usethreads" in
13830                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13831                 esac
13832                 d_getservent_r=undef
13833                 getservent_r_proto=0
13834                 ;;
13835         esac
13836         ;;
13837 *)      getservent_r_proto=0
13838         ;;
13839 esac
13840
13841 : see if prototypes for various getservxxx netdb.h functions are available
13842 echo " "
13843 set d_getservprotos getservent $i_netdb netdb.h
13844 eval $hasproto
13845
13846 : see if getspnam exists
13847 set getspnam d_getspnam
13848 eval $inlibc
13849
13850 : see if this is a shadow.h system
13851 set shadow.h i_shadow
13852 eval $inhdr
13853
13854 : see if getspnam_r exists
13855 set getspnam_r d_getspnam_r
13856 eval $inlibc
13857 case "$d_getspnam_r" in
13858 "$define")
13859         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13860         case "$d_getspnam_r_proto:$usethreads" in
13861         ":define")      d_getspnam_r_proto=define
13862                 set d_getspnam_r_proto getspnam_r $hdrs
13863                 eval $hasproto ;;
13864         *)      ;;
13865         esac
13866         case "$d_getspnam_r_proto" in
13867         define)
13868         case "$getspnam_r_proto" in
13869         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13870         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13871         esac
13872         case "$getspnam_r_proto" in
13873         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13874         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13875         esac
13876         case "$getspnam_r_proto" in
13877         ''|0)   d_getspnam_r=undef
13878                 getspnam_r_proto=0
13879                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13880         * )     case "$getspnam_r_proto" in
13881                 REENTRANT_PROTO*) ;;
13882                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13883                 esac
13884                 echo "Prototype: $try" ;;
13885         esac
13886         ;;
13887         *)      case "$usethreads" in
13888                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13889                 esac
13890                 d_getspnam_r=undef
13891                 getspnam_r_proto=0
13892                 ;;
13893         esac
13894         ;;
13895 *)      getspnam_r_proto=0
13896         ;;
13897 esac
13898
13899 : see if gettimeofday or ftime exists
13900 set gettimeofday d_gettimeod
13901 eval $inlibc
13902 case "$d_gettimeod" in
13903 "$undef")
13904         set ftime d_ftime 
13905         eval $inlibc
13906         ;;
13907 *)
13908         val="$undef"; set d_ftime; eval $setvar
13909         ;;
13910 esac
13911 case "$d_gettimeod$d_ftime" in
13912 "$undef$undef")
13913         echo " "
13914         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13915         ;;
13916 esac
13917
13918 : see if gmtime_r exists
13919 set gmtime_r d_gmtime_r
13920 eval $inlibc
13921 case "$d_gmtime_r" in
13922 "$define")
13923         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13924         case "$d_gmtime_r_proto:$usethreads" in
13925         ":define")      d_gmtime_r_proto=define
13926                 set d_gmtime_r_proto gmtime_r $hdrs
13927                 eval $hasproto ;;
13928         *)      ;;
13929         esac
13930         case "$d_gmtime_r_proto" in
13931         define)
13932         case "$gmtime_r_proto" in
13933         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13934         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13935         esac
13936         case "$gmtime_r_proto" in
13937         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13938         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13939         esac
13940         case "$gmtime_r_proto" in
13941         ''|0)   d_gmtime_r=undef
13942                 gmtime_r_proto=0
13943                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13944         * )     case "$gmtime_r_proto" in
13945                 REENTRANT_PROTO*) ;;
13946                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13947                 esac
13948                 echo "Prototype: $try" ;;
13949         esac
13950         ;;
13951         *)      case "$usethreads" in
13952                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13953                 esac
13954                 d_gmtime_r=undef
13955                 gmtime_r_proto=0
13956                 ;;
13957         esac
13958         ;;
13959 *)      gmtime_r_proto=0
13960         ;;
13961 esac
13962
13963 : see if hasmntopt exists
13964 set hasmntopt d_hasmntopt
13965 eval $inlibc
13966
13967 : see if this is a netinet/in.h or sys/in.h system
13968 set netinet/in.h i_niin sys/in.h i_sysin
13969 eval $inhdr
13970
13971 : see if arpa/inet.h has to be included
13972 set arpa/inet.h i_arpainet
13973 eval $inhdr
13974
13975 : see if htonl --and friends-- exists
13976 val=''
13977 set htonl val
13978 eval $inlibc
13979
13980 : Maybe they are macros.
13981 case "$val" in
13982 $undef)
13983         $cat >htonl.c <<EOM
13984 #include <stdio.h>
13985 #include <sys/types.h>
13986 #$i_niin I_NETINET_IN
13987 #$i_sysin I_SYS_IN
13988 #$i_arpainet I_ARPA_INET
13989 #ifdef I_NETINET_IN
13990 #include <netinet/in.h>
13991 #endif
13992 #ifdef I_SYS_IN
13993 #include <sys/in.h>
13994 #endif
13995 #ifdef I_ARPA_INET
13996 #include <arpa/inet.h>
13997 #endif
13998 #ifdef htonl
13999 printf("Defined as a macro.");
14000 #endif
14001 EOM
14002         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14003         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14004                 val="$define"
14005                 echo "But it seems to be defined as a macro." >&4
14006         fi
14007         $rm -f htonl.?
14008         ;;
14009 esac
14010 set d_htonl
14011 eval $setvar
14012
14013 : see if ilogbl exists
14014 set ilogbl d_ilogbl
14015 eval $inlibc
14016
14017 : index or strchr
14018 echo " "
14019 if set index val -f; eval $csym; $val; then
14020         if set strchr val -f d_strchr; eval $csym; $val; then
14021                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14022                         val="$define"
14023                         vali="$undef"
14024                         echo "strchr() found." >&4
14025                 else
14026                         val="$undef"
14027                         vali="$define"
14028                         echo "index() found." >&4
14029                 fi
14030         else
14031                 val="$undef"
14032                 vali="$define"
14033                 echo "index() found." >&4
14034         fi
14035 else
14036         if set strchr val -f d_strchr; eval $csym; $val; then
14037                 val="$define"
14038                 vali="$undef"
14039                 echo "strchr() found." >&4
14040         else
14041                 echo "No index() or strchr() found!" >&4
14042                 val="$undef"
14043                 vali="$undef"
14044         fi
14045 fi
14046 set d_strchr; eval $setvar
14047 val="$vali"
14048 set d_index; eval $setvar
14049
14050 : check whether inet_aton exists
14051 set inet_aton d_inetaton
14052 eval $inlibc
14053
14054 : Look for isascii
14055 echo " "
14056 $cat >isascii.c <<EOCP
14057 #include <stdio.h>
14058 #include <ctype.h>
14059 #$i_stdlib I_STDLIB
14060 #ifdef I_STDLIB
14061 #include <stdlib.h>
14062 #endif
14063 int main() {
14064         int c = 'A';
14065         if (isascii(c))
14066                 exit(0);
14067         else
14068                 exit(1);
14069 }
14070 EOCP
14071 set isascii
14072 if eval $compile; then
14073         echo "isascii() found." >&4
14074         val="$define"
14075 else
14076         echo "isascii() NOT found." >&4
14077         val="$undef"
14078 fi
14079 set d_isascii
14080 eval $setvar
14081 $rm -f isascii*
14082
14083 : see if isfinite exists
14084 set isfinite d_isfinite
14085 eval $inlibc
14086
14087 : see if isinf exists
14088 set isinf d_isinf
14089 eval $inlibc
14090
14091 : see if isnan exists
14092 set isnan d_isnan
14093 eval $inlibc
14094
14095 : see if isnanl exists
14096 set isnanl d_isnanl
14097 eval $inlibc
14098
14099 : see if killpg exists
14100 set killpg d_killpg
14101 eval $inlibc
14102
14103 : see if lchown exists
14104 echo " "
14105 $cat > try.c <<'EOCP'
14106 /* System header to define __stub macros and hopefully few prototypes,
14107     which can conflict with char lchown(); below.  */
14108 #include <assert.h>
14109 /* Override any gcc2 internal prototype to avoid an error.  */
14110 /* We use char because int might match the return type of a gcc2
14111    builtin and then its argument prototype would still apply.  */
14112 char lchown();
14113 int main() {
14114     /*  The GNU C library defines this for functions which it implements
14115         to always fail with ENOSYS.  Some functions are actually named
14116         something starting with __ and the normal name is an alias.  */
14117 #if defined (__stub_lchown) || defined (__stub___lchown)
14118 choke me
14119 #else
14120 lchown();
14121 #endif
14122 ; return 0; }
14123 EOCP
14124 set try
14125 if eval $compile; then
14126     $echo "lchown() found." >&4
14127     val="$define"
14128 else
14129     $echo "lchown() NOT found." >&4
14130     val="$undef"
14131 fi
14132 set d_lchown
14133 eval $setvar
14134
14135 : See if number of significant digits in a double precision number is known
14136 echo " "
14137 $cat >ldbl_dig.c <<EOM
14138 #$i_limits I_LIMITS
14139 #$i_float I_FLOAT
14140 #ifdef I_LIMITS
14141 #include <limits.h>
14142 #endif
14143 #ifdef I_FLOAT
14144 #include <float.h>
14145 #endif
14146 #ifdef LDBL_DIG
14147 printf("Contains LDBL_DIG");
14148 #endif
14149 EOM
14150 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14151 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14152         echo "LDBL_DIG found." >&4
14153         val="$define"
14154 else
14155         echo "LDBL_DIG NOT found." >&4
14156         val="$undef"
14157 fi
14158 $rm -f ldbl_dig.?
14159 set d_ldbl_dig
14160 eval $setvar
14161
14162 : see if this is a math.h system
14163 set math.h i_math
14164 eval $inhdr
14165
14166 d_libm_lib_version="$undef"
14167 case $i_math in
14168     $define)
14169         : check to see if math.h defines _LIB_VERSION
14170         echo " "
14171         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14172         $cat >try.c <<EOCP
14173 #include <unistd.h>
14174 #include <math.h>
14175 int main (int argc, char *argv[])
14176 {
14177     printf ("%d\n", _LIB_VERSION);
14178     return (0);
14179     } /* main */
14180 EOCP
14181         set try
14182         if eval $compile; then
14183             foo=`$run ./try`
14184             echo "Yes, it does ($foo)" >&4
14185             d_libm_lib_version="$define"
14186         else
14187             echo "No, it does not (probably harmless)\n" >&4
14188             fi
14189         $rm -f try.* try core core.try.*
14190         ;;
14191
14192     esac
14193
14194 : see if link exists
14195 set link d_link
14196 eval $inlibc
14197
14198 : see if localtime_r exists
14199 set localtime_r d_localtime_r
14200 eval $inlibc
14201 case "$d_localtime_r" in
14202 "$define")
14203         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14204         case "$d_localtime_r_proto:$usethreads" in
14205         ":define")      d_localtime_r_proto=define
14206                 set d_localtime_r_proto localtime_r $hdrs
14207                 eval $hasproto ;;
14208         *)      ;;
14209         esac
14210         case "$d_localtime_r_proto" in
14211         define)
14212         case "$localtime_r_proto" in
14213         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14214         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14215         esac
14216         case "$localtime_r_proto" in
14217         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14218         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14219         esac
14220         case "$localtime_r_proto" in
14221         ''|0)   d_localtime_r=undef
14222                 localtime_r_proto=0
14223                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14224         * )     case "$localtime_r_proto" in
14225                 REENTRANT_PROTO*) ;;
14226                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14227                 esac
14228                 echo "Prototype: $try" ;;
14229         esac
14230         ;;
14231         *)      case "$usethreads" in
14232                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14233                 esac
14234                 d_localtime_r=undef
14235                 localtime_r_proto=0
14236                 ;;
14237         esac
14238         ;;
14239 *)      localtime_r_proto=0
14240         ;;
14241 esac
14242
14243 : see if localeconv exists
14244 set localeconv d_locconv
14245 eval $inlibc
14246
14247 : see if lockf exists
14248 set lockf d_lockf
14249 eval $inlibc
14250
14251 : see if prototype for lseek is available
14252 echo " "
14253 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14254 eval $hasproto
14255
14256 : see if lstat exists
14257 set lstat d_lstat
14258 eval $inlibc
14259
14260 : see if madvise exists
14261 set madvise d_madvise
14262 eval $inlibc
14263
14264 : see if malloc_size exists
14265 set malloc_size d_malloc_size
14266 eval $inlibc
14267
14268 : see if malloc_size_good exists
14269 set malloc_good_size d_malloc_good_size
14270 eval $inlibc
14271
14272 : see if mblen exists
14273 set mblen d_mblen
14274 eval $inlibc
14275
14276 : see if mbstowcs exists
14277 set mbstowcs d_mbstowcs
14278 eval $inlibc
14279
14280 : see if mbtowc exists
14281 set mbtowc d_mbtowc
14282 eval $inlibc
14283
14284 : see if memchr exists
14285 set memchr d_memchr
14286 eval $inlibc
14287
14288 : see if memcmp exists
14289 set memcmp d_memcmp
14290 eval $inlibc
14291
14292 : see if memcpy exists
14293 set memcpy d_memcpy
14294 eval $inlibc
14295
14296 : see if memmove exists
14297 set memmove d_memmove
14298 eval $inlibc
14299
14300 : see if memset exists
14301 set memset d_memset
14302 eval $inlibc
14303
14304 : see if mkdir exists
14305 set mkdir d_mkdir
14306 eval $inlibc
14307
14308 : see if mkdtemp exists
14309 set mkdtemp d_mkdtemp
14310 eval $inlibc
14311
14312 : see if mkfifo exists
14313 set mkfifo d_mkfifo
14314 eval $inlibc
14315
14316 : see if mkstemp exists
14317 set mkstemp d_mkstemp
14318 eval $inlibc
14319
14320 : see if mkstemps exists
14321 set mkstemps d_mkstemps
14322 eval $inlibc
14323
14324 : see if mktime exists
14325 set mktime d_mktime
14326 eval $inlibc
14327
14328 : see if this is a sys/mman.h system
14329 set sys/mman.h i_sysmman
14330 eval $inhdr
14331
14332 : see if mmap exists
14333 set mmap d_mmap
14334 eval $inlibc
14335 : see what shmat returns
14336 : default to something harmless
14337 mmaptype='void *'
14338 case "$i_sysmman$d_mmap" in
14339 "$define$define")
14340         $cat >mmap.c <<'END'
14341 #include <sys/mman.h>
14342 void *mmap();
14343 END
14344         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14345                 mmaptype='void *'
14346         else
14347                 mmaptype='caddr_t'
14348         fi
14349         echo "and it returns ($mmaptype)." >&4
14350         ;;
14351 esac
14352
14353
14354
14355 : see if sqrtl exists
14356 set sqrtl d_sqrtl
14357 eval $inlibc
14358
14359 : see if scalbnl exists
14360 set scalbnl d_scalbnl
14361 eval $inlibc
14362
14363 : see if modfl exists
14364 set modfl d_modfl
14365 eval $inlibc
14366
14367 : see if prototype for modfl is available
14368 echo " "
14369 set d_modflproto modfl $i_math math.h
14370 eval $hasproto
14371
14372 d_modfl_pow32_bug="$undef"
14373
14374 case "$d_longdbl$d_modfl" in
14375 $define$define)
14376         $cat <<EOM
14377 Checking to see whether your modfl() is okay for large values...
14378 EOM
14379 $cat >try.c <<EOCP
14380 #include <math.h> 
14381 #include <stdio.h>
14382 EOCP
14383 if $test "X$d_modflproto" != "X$define"; then
14384         $cat >>try.c <<EOCP
14385 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14386 long double modfl (long double, long double *);
14387 EOCP
14388 fi
14389 $cat >>try.c <<EOCP
14390 int main() {
14391     long double nv = 4294967303.15;
14392     long double v, w;
14393     v = modfl(nv, &w);         
14394 #ifdef __GLIBC__
14395     printf("glibc");
14396 #endif
14397     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14398     return 0;
14399 }
14400 EOCP
14401         case "$osname:$gccversion" in
14402         aix:)   saveccflags="$ccflags"
14403                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14404         esac
14405         set try
14406         if eval $compile; then
14407                 foo=`$run ./try`
14408                 case "$foo" in
14409                 *" 4294967303.150000 1.150000 4294967302.000000")
14410                         echo >&4 "Your modfl() is broken for large values."
14411                         d_modfl_pow32_bug="$define"
14412                         case "$foo" in
14413                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14414                         ;;
14415                         esac
14416                         ;;
14417                 *" 4294967303.150000 0.150000 4294967303.000000")
14418                         echo >&4 "Your modfl() seems okay for large values."
14419                         ;;
14420                 *)      echo >&4 "I don't understand your modfl() at all."
14421                         d_modfl="$undef"
14422                         ;;
14423                 esac
14424                 $rm -f try.* try core core.try.*
14425         else
14426                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14427                 d_modfl="$undef"
14428         fi
14429         case "$osname:$gccversion" in
14430         aix:)   ccflags="$saveccflags" ;; # restore
14431         esac
14432         ;;
14433 esac
14434
14435 if $test "$uselongdouble" = "$define"; then
14436     message=""
14437     if $test "$d_sqrtl" != "$define"; then
14438         message="$message sqrtl"
14439     fi
14440     if $test "$d_modfl" != "$define"; then
14441         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14442             echo "You have both aintl and copysignl, so I can emulate modfl."
14443         else
14444             message="$message modfl"
14445         fi
14446     fi
14447     if $test "$d_frexpl" != "$define"; then
14448         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14449             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14450         else
14451             message="$message frexpl"
14452         fi
14453     fi
14454
14455     if $test "$message" != ""; then
14456         $cat <<EOM >&4
14457
14458 *** You requested the use of long doubles but you do not seem to have
14459 *** the following mathematical functions needed for long double support:
14460 ***    $message
14461 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14462 *** Cannot continue, aborting.
14463
14464 EOM
14465
14466         exit 1
14467     fi
14468 fi
14469
14470 : see if mprotect exists
14471 set mprotect d_mprotect
14472 eval $inlibc
14473
14474 : see if msgctl exists
14475 set msgctl d_msgctl
14476 eval $inlibc
14477
14478 : see if msgget exists
14479 set msgget d_msgget
14480 eval $inlibc
14481
14482 : see if msgsnd exists
14483 set msgsnd d_msgsnd
14484 eval $inlibc
14485
14486 : see if msgrcv exists
14487 set msgrcv d_msgrcv
14488 eval $inlibc
14489
14490 : see how much of the 'msg*(2)' library is present.
14491 h_msg=true
14492 echo " "
14493 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14494 *"$undef"*) h_msg=false;;
14495 esac
14496 case "$osname" in
14497 freebsd)
14498     case "`ipcs 2>&1`" in
14499     "SVID messages"*"not configured"*)
14500         echo "Your $osname does not have the msg*(2) configured." >&4
14501         h_msg=false
14502         val="$undef"
14503         set msgctl d_msgctl
14504         eval $setvar
14505         set msgget d_msgget
14506         eval $setvar
14507         set msgsnd d_msgsnd
14508         eval $setvar
14509         set msgrcv d_msgrcv
14510         eval $setvar
14511         ;;
14512     esac
14513     ;;
14514 esac
14515 : we could also check for sys/ipc.h ...
14516 if $h_msg && $test `./findhdr sys/msg.h`; then
14517         echo "You have the full msg*(2) library." >&4
14518         val="$define"
14519 else
14520         echo "You don't have the full msg*(2) library." >&4
14521         val="$undef"
14522 fi
14523 set d_msg
14524 eval $setvar
14525
14526
14527 echo " "
14528 echo "Checking to see if your system supports struct msghdr..." >&4
14529 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14530 eval $hasstruct
14531 case "$d_msghdr_s" in
14532 "$define")      echo "Yes, it does."   ;;
14533 *)              echo "No, it doesn't." ;;
14534 esac
14535
14536
14537 : see if msync exists
14538 set msync d_msync
14539 eval $inlibc
14540
14541 : see if munmap exists
14542 set munmap d_munmap
14543 eval $inlibc
14544
14545 : see if nice exists
14546 set nice d_nice
14547 eval $inlibc
14548
14549 : see if this is a langinfo.h system
14550 set langinfo.h i_langinfo
14551 eval $inhdr
14552
14553 : see if nl_langinfo exists
14554 set nl_langinfo d_nl_langinfo
14555 eval $inlibc
14556
14557 : check for length of character
14558 echo " "
14559 case "$charsize" in
14560 '')
14561         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14562         $cat >try.c <<EOCP
14563 #include <stdio.h>
14564 #$i_stdlib I_STDLIB
14565 #ifdef I_STDLIB
14566 #include <stdlib.h>
14567 #endif
14568 int main()
14569 {
14570     printf("%d\n", (int)sizeof(char));
14571     exit(0);
14572 }
14573 EOCP
14574         set try
14575         if eval $compile_ok; then
14576                 dflt=`$run ./try`
14577         else
14578                 dflt='1'
14579                 echo "(I can't seem to compile the test program.  Guessing...)"
14580         fi
14581         ;;
14582 *)
14583         dflt="$charsize"
14584         ;;
14585 esac
14586 rp="What is the size of a character (in bytes)?"
14587 . ./myread
14588 charsize="$ans"
14589 $rm -f try.c try
14590
14591 : check for volatile keyword
14592 echo " "
14593 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14594 $cat >try.c <<'EOCP'
14595 int main()
14596 {
14597         typedef struct _goo_struct goo_struct;
14598         goo_struct * volatile goo = ((goo_struct *)0);
14599         struct _goo_struct {
14600                 long long_int;
14601                 int reg_int;
14602                 char char_var;
14603         };
14604         typedef unsigned short foo_t;
14605         char *volatile foo;
14606         volatile int bar;
14607         volatile foo_t blech;
14608         foo = foo;
14609 }
14610 EOCP
14611 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14612         val="$define"
14613         echo "Yup, it does."
14614 else
14615         val="$undef"
14616         echo "Nope, it doesn't."
14617 fi
14618 set d_volatile
14619 eval $setvar
14620 $rm -f try.*
14621
14622
14623 echo " "
14624 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14625
14626 case "$use64bitint:$d_quad:$quadtype" in
14627 define:define:?*)
14628         ivtype="$quadtype"
14629         uvtype="$uquadtype"
14630         ivsize=8
14631         uvsize=8
14632         ;;
14633 *)      ivtype="long"
14634         uvtype="unsigned long"
14635         ivsize=$longsize
14636         uvsize=$longsize
14637         ;;
14638 esac
14639
14640 case "$uselongdouble:$d_longdbl" in
14641 define:define)
14642         nvtype="long double"
14643         nvsize=$longdblsize
14644         ;;
14645 *)      nvtype=double
14646         nvsize=$doublesize
14647         ;;
14648 esac
14649
14650 $echo "(IV will be "$ivtype", $ivsize bytes)"
14651 $echo "(UV will be "$uvtype", $uvsize bytes)"
14652 $echo "(NV will be "$nvtype", $nvsize bytes)"
14653
14654 $cat >try.c <<EOCP
14655 #$i_inttypes I_INTTYPES
14656 #ifdef I_INTTYPES
14657 #include <inttypes.h>
14658 #endif
14659 #include <stdio.h>
14660 int main() {
14661 #ifdef INT8
14662    int8_t i =  INT8_MAX;
14663   uint8_t u = UINT8_MAX;
14664   printf("int8_t\n");
14665 #endif
14666 #ifdef INT16
14667    int16_t i =  INT16_MAX;
14668   uint16_t i = UINT16_MAX;
14669   printf("int16_t\n");
14670 #endif
14671 #ifdef INT32
14672    int32_t i =  INT32_MAX;
14673   uint32_t u = UINT32_MAX;
14674   printf("int32_t\n");
14675 #endif
14676 }
14677 EOCP
14678
14679 case "$i8type" in
14680 '')     case "$charsize" in
14681         1)      i8type=char
14682                 u8type="unsigned char"
14683                 i8size=$charsize
14684                 u8size=$charsize
14685                 ;;
14686         esac
14687         ;;
14688 esac
14689 case "$i8type" in
14690 '')     set try -DINT8
14691         if eval $compile; then
14692                 case "`$run ./try`" in
14693                 int8_t) i8type=int8_t
14694                         u8type=uint8_t
14695                         i8size=1
14696                         u8size=1
14697                         ;;
14698                 esac
14699         fi
14700         ;;
14701 esac
14702 case "$i8type" in
14703 '')     if $test $charsize -ge 1; then
14704                 i8type=char
14705                 u8type="unsigned char"
14706                 i8size=$charsize
14707                 u8size=$charsize
14708         fi
14709         ;;
14710 esac
14711
14712 case "$i16type" in
14713 '')     case "$shortsize" in
14714         2)      i16type=short
14715                 u16type="unsigned short"
14716                 i16size=$shortsize
14717                 u16size=$shortsize
14718                 ;;
14719         esac
14720         ;;
14721 esac
14722 case "$i16type" in
14723 '')     set try -DINT16
14724         if eval $compile; then
14725                 case "`$run ./try`" in
14726                 int16_t)
14727                         i16type=int16_t
14728                         u16type=uint16_t
14729                         i16size=2
14730                         u16size=2
14731                         ;;
14732                 esac
14733         fi
14734         ;;
14735 esac
14736 case "$i16type" in
14737 '')     if $test $shortsize -ge 2; then
14738                 i16type=short
14739                 u16type="unsigned short"
14740                 i16size=$shortsize
14741                 u16size=$shortsize
14742         fi
14743         ;;
14744 esac
14745
14746 case "$i32type" in
14747 '')     case "$longsize" in
14748         4)      i32type=long
14749                 u32type="unsigned long"
14750                 i32size=$longsize
14751                 u32size=$longsize
14752                 ;;
14753         *)      case "$intsize" in
14754                 4)      i32type=int
14755                         u32type="unsigned int"
14756                         i32size=$intsize
14757                         u32size=$intsize
14758                         ;;
14759                 esac
14760                 ;;
14761         esac
14762         ;;
14763 esac
14764 case "$i32type" in
14765 '')     set try -DINT32
14766         if eval $compile; then
14767                 case "`$run ./try`" in
14768                 int32_t)
14769                         i32type=int32_t
14770                         u32type=uint32_t
14771                         i32size=4
14772                         u32size=4
14773                         ;;
14774                 esac
14775         fi
14776         ;;
14777 esac
14778 case "$i32type" in
14779 '')     if $test $intsize -ge 4; then
14780                 i32type=int
14781                 u32type="unsigned int"
14782                 i32size=$intsize
14783                 u32size=$intsize
14784         fi
14785         ;;
14786 esac
14787
14788 case "$i64type" in
14789 '')     case "$d_quad:$quadtype" in
14790         define:?*)
14791                 i64type="$quadtype"
14792                 u64type="$uquadtype"
14793                 i64size=8
14794                 u64size=8
14795                 ;;
14796         esac
14797         ;;
14798 esac
14799
14800 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14801 : volatile so that the compiler has to store it out to memory.
14802 if test X"$d_volatile" = X"$define"; then
14803         volatile=volatile
14804 fi
14805 $cat <<EOP >try.c
14806 #include <stdio.h>
14807 #$i_stdlib I_STDLIB
14808 #ifdef I_STDLIB
14809 #include <stdlib.h>
14810 #endif
14811 #include <sys/types.h>
14812 #include <signal.h>
14813 #ifdef SIGFPE
14814 $volatile int bletched = 0;
14815 $signal_t blech(s) int s; { bletched = 1; }
14816 #endif
14817 int main() {
14818     $uvtype u = 0;
14819     $nvtype d;
14820     int     n = 8 * $uvsize;
14821     int     i;
14822 #ifdef SIGFPE
14823     signal(SIGFPE, blech);
14824 #endif
14825
14826     for (i = 0; i < n; i++) {
14827       u = u << 1 | ($uvtype)1;
14828       d = ($nvtype)u;
14829       if (($uvtype)d != u)
14830         break;
14831       if (d <= 0)
14832         break;
14833       d = ($nvtype)(u - 1);
14834       if (($uvtype)d != (u - 1))
14835         break;
14836 #ifdef SIGFPE
14837       if (bletched) {
14838         break;
14839 #endif
14840       } 
14841     }
14842     printf("%d\n", ((i == n) ? -n : i));
14843     exit(0);
14844 }
14845 EOP
14846 set try
14847
14848 d_nv_preserves_uv="$undef"
14849 if eval $compile; then
14850         nv_preserves_uv_bits="`$run ./try`"
14851 fi
14852 case "$nv_preserves_uv_bits" in
14853 \-[1-9]*)       
14854         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14855         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14856         d_nv_preserves_uv="$define"
14857         ;;
14858 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14859         d_nv_preserves_uv="$undef" ;;
14860 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14861         nv_preserves_uv_bits="$undef" ;;
14862 esac
14863
14864 $rm -f try.* try
14865
14866 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14867 : volatile so that the compiler has to store it out to memory.
14868 if test X"$d_volatile" = X"$define"; then
14869         volatile=volatile
14870 fi
14871 $cat <<EOP >try.c
14872 #include <stdio.h>
14873 #$i_stdlib I_STDLIB
14874 #ifdef I_STDLIB
14875 #include <stdlib.h>
14876 #endif
14877 #$i_string I_STRING
14878 #ifdef I_STRING
14879 #  include <string.h>
14880 #else
14881 #  include <strings.h>
14882 #endif
14883 #include <sys/types.h>
14884 #include <signal.h>
14885 #ifdef SIGFPE
14886 $volatile int bletched = 0;
14887 $signal_t blech(s) int s; { bletched = 1; }
14888 #endif
14889
14890 int checkit($nvtype d, char *where) {
14891     unsigned char *p = (char *)&d;
14892     unsigned char *end = p + sizeof(d);
14893     int fail = 0;
14894
14895     while (p < end)
14896         fail += *p++;
14897
14898     if (!fail)
14899         return 0;
14900
14901     p = (char *)&d;
14902     printf("No - %s: 0x", where);
14903     while (p < end)
14904         printf ("%02X", *p++);
14905     printf("\n");
14906     return 1;
14907 }
14908
14909 int main(int argc, char **argv) {
14910     $nvtype d = 0.0;
14911     int fail = 0;
14912     fail += checkit(d, "0.0");
14913
14914     /* The compiler shouldn't be assuming that bletched is 0  */
14915     d = bletched;
14916
14917     fail += checkit(d, "bleched");
14918
14919 #ifdef SIGFPE
14920     signal(SIGFPE, blech);
14921 #endif
14922
14923     /* Paranoia - the compiler should have no way of knowing that ANSI says
14924        that argv[argc] will always be NULL.  Actually, if it did assume this it
14925        would be buggy, as this is C and main() can be called from elsewhere in
14926        the program.  */
14927     d = argv[argc] ? 1 : 0;
14928
14929     if (d) {
14930         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14931     }
14932
14933     fail += checkit(d, "ternary");
14934
14935     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14936
14937     if (d != 0.0) {
14938         printf("No - memset doesn't give 0.0\n");
14939         /* This might just blow up:  */
14940         printf("(gives %g)\n", d);
14941         return 1;
14942     }
14943     
14944 #ifdef SIGFPE
14945     if (bletched) {
14946         printf("No - something bleched\n");
14947         return 1;
14948     }
14949 #endif
14950     if (fail) {
14951       printf("No - %d fail(s)\n", fail);
14952       return 1;
14953     }
14954     printf("Yes\n");
14955     return 0;
14956 }
14957 EOP
14958 set try
14959
14960 d_nv_zero_is_allbits_zero="$undef"
14961 if eval $compile; then
14962     xxx="`$run ./try`"
14963     case "$?" in
14964         0)
14965             case "$xxx" in
14966                 Yes)  cat >&4 <<EOM
14967 0.0 is represented as all bits zero in memory
14968 EOM
14969                     d_nv_zero_is_allbits_zero="$define"
14970                     ;;
14971                 *)  cat >&4 <<EOM
14972 0.0 is not represented as all bits zero in memory
14973 EOM
14974                     d_nv_zero_is_allbits_zero="$undef"
14975                     ;;
14976             esac
14977             ;;
14978         *)  cat >&4 <<EOM
14979 0.0 is not represented as all bits zero in memory
14980 EOM
14981             d_nv_zero_is_allbits_zero="$undef"
14982             ;;
14983     esac
14984 fi
14985
14986 $rm -f try.* try
14987
14988
14989 : check for off64_t
14990 echo " "
14991 echo "Checking to see if you have off64_t..." >&4
14992 $cat >try.c <<EOCP
14993 #include <sys/types.h>
14994 #include <unistd.h>
14995 int main() { off64_t x = 7; }
14996 EOCP
14997 set try
14998 if eval $compile; then
14999         val="$define"
15000         echo "You have off64_t."
15001 else
15002         val="$undef"
15003         echo "You do not have off64_t."
15004         case "$lseeksize" in
15005         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15006         esac
15007 fi
15008 $rm -f try.* try
15009 set d_off64_t
15010 eval $setvar
15011
15012 : how to create joinable pthreads
15013 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15014         echo " "
15015         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15016         $cat >try.c <<'EOCP'
15017 #include <pthread.h>
15018 int main() {
15019     int detachstate = JOINABLE;
15020 }
15021 EOCP
15022         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15023         if eval $compile; then
15024                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15025                 val="$undef" # Yes, undef.
15026                 set d_old_pthread_create_joinable
15027                 eval $setvar
15028                 val=""
15029                 set old_pthread_create_joinable
15030                 eval $setvar
15031         else
15032                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15033                 if eval $compile; then
15034                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15035                         val="$define"
15036                         set d_old_pthread_create_joinable
15037                         eval $setvar
15038                         val=PTHREAD_CREATE_UNDETACHED
15039                         set old_pthread_create_joinable
15040                         eval $setvar
15041                 else            
15042                         set try -DJOINABLE=__UNDETACHED
15043                         if eval $compile; then
15044                                 echo "You seem to use __UNDETACHED." >&4
15045                                 val="$define"
15046                                 set d_old_pthread_create_joinable
15047                                 eval $setvar
15048                                 val=__UNDETACHED
15049                                 set old_pthread_create_joinable
15050                                 eval $setvar
15051                         else
15052                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15053                                 val="$define"
15054                                 set d_old_pthread_create_joinable
15055                                 eval $setvar
15056                                 val=0
15057                                 set old_pthread_create_joinable
15058                                 eval $setvar
15059                         fi
15060                 fi
15061         fi
15062         $rm -f try try.*
15063 else
15064     d_old_pthread_create_joinable="$undef"
15065     old_pthread_create_joinable=""
15066 fi
15067
15068 : see if pause exists
15069 set pause d_pause
15070 eval $inlibc
15071
15072 : see if pipe exists
15073 set pipe d_pipe
15074 eval $inlibc
15075
15076 : see if poll exists
15077 set poll d_poll
15078 eval $inlibc
15079
15080 : see if readlink exists
15081 set readlink d_readlink
15082 eval $inlibc
15083
15084 echo " "
15085 procselfexe=''
15086 val="$undef"
15087 case "$d_readlink" in
15088 "$define")
15089         if $issymlink /proc/self/exe ; then
15090                 $ls -l /proc/self/exe > reflect
15091                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15092                         echo "You have Linux-like /proc/self/exe."
15093                         procselfexe='"/proc/self/exe"'
15094                         val="$define"
15095                 fi
15096         fi
15097         if $issymlink /proc/curproc/file ; then
15098                 $ls -l /proc/curproc/file > reflect
15099                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15100                         echo "You have BSD-like /proc/curproc/file."
15101                         procselfexe='"/proc/curproc/file"'
15102                         val="$define"
15103                 fi
15104         fi
15105         ;;
15106 esac
15107 $rm -f reflect
15108 set d_procselfexe
15109 eval $setvar
15110
15111 : see whether the pthread_atfork exists
15112 $cat >try.c <<EOP
15113 #include <pthread.h>
15114 #include <stdio.h>
15115 int main() {
15116 #ifdef  PTHREAD_ATFORK
15117         pthread_atfork(NULL,NULL,NULL);
15118 #endif
15119 }
15120 EOP
15121
15122 : see if pthread_atfork exists
15123 set try -DPTHREAD_ATFORK
15124 if eval $compile; then
15125     val="$define"
15126 else
15127     val="$undef"
15128 fi
15129 case "$usethreads" in
15130 $define)
15131         case "$val" in
15132         $define) echo 'pthread_atfork found.' >&4        ;;
15133         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15134         esac
15135 esac
15136 set d_pthread_atfork
15137 eval $setvar
15138
15139 : see if pthread_attr_setscope exists
15140 set pthread_attr_setscope d_pthread_attr_setscope
15141 eval $inlibc
15142
15143
15144 : see whether the various POSIXish _yields exist
15145 $cat >try.c <<EOP
15146 #include <pthread.h>
15147 #include <stdio.h>
15148 int main() {
15149 #ifdef SCHED_YIELD
15150         sched_yield();
15151 #else
15152 #ifdef PTHREAD_YIELD
15153         pthread_yield();
15154 #else
15155 #ifdef PTHREAD_YIELD_NULL
15156         pthread_yield(NULL);
15157 #endif
15158 #endif
15159 #endif
15160 }
15161 EOP
15162 : see if sched_yield exists
15163 set try -DSCHED_YIELD
15164 if eval $compile; then
15165     val="$define"
15166     sched_yield='sched_yield()'
15167 else
15168     val="$undef"
15169 fi
15170 case "$usethreads" in
15171 $define)
15172         case "$val" in
15173         $define) echo 'sched_yield() found.' >&4        ;;
15174         *)       echo 'sched_yield() NOT found.' >&4    ;;
15175         esac
15176 esac
15177 set d_sched_yield
15178 eval $setvar
15179
15180 : see if pthread_yield exists
15181 set try -DPTHREAD_YIELD
15182 if eval $compile; then
15183     val="$define"
15184     case "$sched_yield" in
15185     '') sched_yield='pthread_yield()' ;;
15186     esac
15187 else
15188     set try -DPTHREAD_YIELD_NULL
15189     if eval $compile; then
15190         val="$define"
15191         case "$sched_yield" in
15192         '') sched_yield='pthread_yield(NULL)' ;;
15193         esac
15194     else
15195         val="$undef"
15196     fi
15197 fi
15198 case "$usethreads" in
15199 $define)
15200         case "$val" in
15201         $define) echo 'pthread_yield() found.' >&4      ;;
15202         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15203         esac
15204         ;;
15205 esac
15206 set d_pthread_yield
15207 eval $setvar
15208
15209 case "$sched_yield" in
15210 '') sched_yield=undef ;;
15211 esac
15212
15213 $rm -f try try.*
15214
15215 : see if random_r exists
15216 set random_r d_random_r
15217 eval $inlibc
15218 case "$d_random_r" in
15219 "$define")
15220         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15221         case "$d_random_r_proto:$usethreads" in
15222         ":define")      d_random_r_proto=define
15223                 set d_random_r_proto random_r $hdrs
15224                 eval $hasproto ;;
15225         *)      ;;
15226         esac
15227         case "$d_random_r_proto" in
15228         define)
15229         case "$random_r_proto" in
15230         ''|0) try='int random_r(int*, struct random_data*);'
15231         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15232         esac
15233         case "$random_r_proto" in
15234         ''|0) try='int random_r(long*, struct random_data*);'
15235         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15236         esac
15237         case "$random_r_proto" in
15238         ''|0) try='int random_r(struct random_data*, int32_t*);'
15239         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15240         esac
15241         case "$random_r_proto" in
15242         ''|0)   d_random_r=undef
15243                 random_r_proto=0
15244                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15245         * )     case "$random_r_proto" in
15246                 REENTRANT_PROTO*) ;;
15247                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15248                 esac
15249                 echo "Prototype: $try" ;;
15250         esac
15251         ;;
15252         *)      case "$usethreads" in
15253                 define) echo "random_r has no prototype, not using it." >&4 ;;
15254                 esac
15255                 d_random_r=undef
15256                 random_r_proto=0
15257                 ;;
15258         esac
15259         ;;
15260 *)      random_r_proto=0
15261         ;;
15262 esac
15263
15264 : see if readdir and friends exist
15265 set readdir d_readdir
15266 eval $inlibc
15267 set seekdir d_seekdir
15268 eval $inlibc
15269 set telldir d_telldir
15270 eval $inlibc
15271 set rewinddir d_rewinddir
15272 eval $inlibc
15273
15274 : see if readdir64_r exists
15275 set readdir64_r d_readdir64_r
15276 eval $inlibc
15277 case "$d_readdir64_r" in
15278 "$define")
15279         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15280         case "$d_readdir64_r_proto:$usethreads" in
15281         ":define")      d_readdir64_r_proto=define
15282                 set d_readdir64_r_proto readdir64_r $hdrs
15283                 eval $hasproto ;;
15284         *)      ;;
15285         esac
15286         case "$d_readdir64_r_proto" in
15287         define)
15288         case "$readdir64_r_proto" in
15289         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15290         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15291         esac
15292         case "$readdir64_r_proto" in
15293         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15294         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15295         esac
15296         case "$readdir64_r_proto" in
15297         ''|0)   d_readdir64_r=undef
15298                 readdir64_r_proto=0
15299                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15300         * )     case "$readdir64_r_proto" in
15301                 REENTRANT_PROTO*) ;;
15302                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15303                 esac
15304                 echo "Prototype: $try" ;;
15305         esac
15306         ;;
15307         *)      case "$usethreads" in
15308                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15309                 esac
15310                 d_readdir64_r=undef
15311                 readdir64_r_proto=0
15312                 ;;
15313         esac
15314         ;;
15315 *)      readdir64_r_proto=0
15316         ;;
15317 esac
15318
15319 : see if readdir_r exists
15320 set readdir_r d_readdir_r
15321 eval $inlibc
15322 case "$d_readdir_r" in
15323 "$define")
15324         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15325         case "$d_readdir_r_proto:$usethreads" in
15326         ":define")      d_readdir_r_proto=define
15327                 set d_readdir_r_proto readdir_r $hdrs
15328                 eval $hasproto ;;
15329         *)      ;;
15330         esac
15331         case "$d_readdir_r_proto" in
15332         define)
15333         case "$readdir_r_proto" in
15334         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15335         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15336         esac
15337         case "$readdir_r_proto" in
15338         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15339         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15340         esac
15341         case "$readdir_r_proto" in
15342         ''|0)   d_readdir_r=undef
15343                 readdir_r_proto=0
15344                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15345         * )     case "$readdir_r_proto" in
15346                 REENTRANT_PROTO*) ;;
15347                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15348                 esac
15349                 echo "Prototype: $try" ;;
15350         esac
15351         ;;
15352         *)      case "$usethreads" in
15353                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15354                 esac
15355                 d_readdir_r=undef
15356                 readdir_r_proto=0
15357                 ;;
15358         esac
15359         ;;
15360 *)      readdir_r_proto=0
15361         ;;
15362 esac
15363
15364 : see if readv exists
15365 set readv d_readv
15366 eval $inlibc
15367
15368 : see if recvmsg exists
15369 set recvmsg d_recvmsg
15370 eval $inlibc
15371
15372 : see if rename exists
15373 set rename d_rename
15374 eval $inlibc
15375
15376 : see if rmdir exists
15377 set rmdir d_rmdir
15378 eval $inlibc
15379
15380 : see if memory.h is available.
15381 val=''
15382 set memory.h val
15383 eval $inhdr
15384
15385 : See if it conflicts with string.h
15386 case "$val" in
15387 $define)
15388         case "$strings" in
15389         '') ;;
15390         *)
15391                 $cppstdin $cppflags $cppminus < $strings > mem.h
15392                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15393                         echo " "
15394                         echo "We won't be including <memory.h>."
15395                         val="$undef"
15396                 fi
15397                 $rm -f mem.h
15398                 ;;
15399         esac
15400 esac
15401 set i_memory
15402 eval $setvar
15403
15404 : can bcopy handle overlapping blocks?
15405 echo " "
15406 val="$undef"
15407 case "$d_memmove" in
15408 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15409 *)      case "$d_bcopy" in
15410         "$define")
15411                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15412                 $cat >try.c <<EOCP
15413 #$i_memory I_MEMORY
15414 #$i_stdlib I_STDLIB
15415 #$i_string I_STRING
15416 #$i_unistd I_UNISTD
15417 EOCP
15418         $cat >>try.c <<'EOCP'
15419 #include <stdio.h>
15420 #ifdef I_MEMORY
15421 #  include <memory.h>
15422 #endif
15423 #ifdef I_STDLIB
15424 #  include <stdlib.h>
15425 #endif
15426 #ifdef I_STRING
15427 #  include <string.h>
15428 #else
15429 #  include <strings.h>
15430 #endif
15431 #ifdef I_UNISTD
15432 #  include <unistd.h>  /* Needed for NetBSD */
15433 #endif
15434 int main()
15435 {
15436 char buf[128], abc[128];
15437 char *b;
15438 int len;
15439 int off;
15440 int align;
15441
15442 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15443    try to store the string in read-only memory. */
15444 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15445
15446 for (align = 7; align >= 0; align--) {
15447         for (len = 36; len; len--) {
15448                 b = buf+align;
15449                 bcopy(abc, b, len);
15450                 for (off = 1; off <= len; off++) {
15451                         bcopy(b, b+off, len);
15452                         bcopy(b+off, b, len);
15453                         if (bcmp(b, abc, len))
15454                                 exit(1);
15455                 }
15456         }
15457 }
15458 exit(0);
15459 }
15460 EOCP
15461                 set try
15462                 if eval $compile_ok; then
15463                         if ./try 2>/dev/null; then
15464                                 echo "Yes, it can."
15465                                 val="$define"
15466                         else
15467                                 echo "It can't, sorry."
15468                         fi
15469                 else
15470                         echo "(I can't compile the test program, so we'll assume not...)"
15471                 fi
15472                 ;;
15473         esac
15474         $rm -f try.* try core
15475         ;;
15476 esac
15477 set d_safebcpy
15478 eval $setvar
15479
15480 : can memcpy handle overlapping blocks?
15481 echo " "
15482 val="$undef"
15483 case "$d_memmove" in
15484 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15485 *)      case "$d_memcpy" in
15486         "$define")
15487                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15488                 $cat >try.c <<EOCP
15489 #$i_memory I_MEMORY
15490 #$i_stdlib I_STDLIB
15491 #$i_string I_STRING
15492 #$i_unistd I_UNISTD
15493 EOCP
15494         $cat >>try.c <<'EOCP'
15495 #include <stdio.h>
15496 #ifdef I_MEMORY
15497 #  include <memory.h>
15498 #endif
15499 #ifdef I_STDLIB
15500 #  include <stdlib.h>
15501 #endif
15502 #ifdef I_STRING
15503 #  include <string.h>
15504 #else
15505 #  include <strings.h>
15506 #endif
15507 #ifdef I_UNISTD
15508 #  include <unistd.h>  /* Needed for NetBSD */
15509 #endif
15510 int main()
15511 {
15512 char buf[128], abc[128];
15513 char *b;
15514 int len;
15515 int off;
15516 int align;
15517
15518 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15519    try to store the string in read-only memory. */
15520 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15521
15522 for (align = 7; align >= 0; align--) {
15523         for (len = 36; len; len--) {
15524                 b = buf+align;
15525                 memcpy(b, abc, len);
15526                 for (off = 1; off <= len; off++) {
15527                         memcpy(b+off, b, len);
15528                         memcpy(b, b+off, len);
15529                         if (memcmp(b, abc, len))
15530                                 exit(1);
15531                 }
15532         }
15533 }
15534 exit(0);
15535 }
15536 EOCP
15537                 set try
15538                 if eval $compile_ok; then
15539                         if ./try 2>/dev/null; then
15540                                 echo "Yes, it can."
15541                                 val="$define"
15542                         else
15543                                 echo "It can't, sorry."
15544                         fi
15545                 else
15546                         echo "(I can't compile the test program, so we'll assume not...)"
15547                 fi
15548                 ;;
15549         esac
15550         $rm -f try.* try core
15551         ;;
15552 esac
15553 set d_safemcpy
15554 eval $setvar
15555
15556 : can memcmp be trusted to compare relative magnitude?
15557 val="$undef"
15558 case "$d_memcmp" in
15559 "$define")
15560         echo " "
15561         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15562         $cat >try.c <<EOCP
15563 #$i_memory I_MEMORY
15564 #$i_stdlib I_STDLIB
15565 #$i_string I_STRING
15566 #$i_unistd I_UNISTD
15567 EOCP
15568         $cat >>try.c <<'EOCP'
15569 #include <stdio.h>
15570 #ifdef I_MEMORY
15571 #  include <memory.h>
15572 #endif
15573 #ifdef I_STDLIB
15574 #  include <stdlib.h>
15575 #endif
15576 #ifdef I_STRING
15577 #  include <string.h>
15578 #else
15579 #  include <strings.h>
15580 #endif
15581 #ifdef I_UNISTD
15582 #  include <unistd.h>  /* Needed for NetBSD */
15583 #endif
15584 int main()
15585 {
15586 char a = -1;
15587 char b = 0;
15588 if ((a < b) && memcmp(&a, &b, 1) < 0)
15589         exit(1);
15590 exit(0);
15591 }
15592 EOCP
15593         set try
15594         if eval $compile_ok; then
15595                 if $run ./try 2>/dev/null; then
15596                         echo "Yes, it can."
15597                         val="$define"
15598                 else
15599                         echo "No, it can't (it uses signed chars)."
15600                 fi
15601         else
15602                 echo "(I can't compile the test program, so we'll assume not...)"
15603         fi
15604         ;;
15605 esac
15606 $rm -f try.* try core
15607 set d_sanemcmp
15608 eval $setvar
15609
15610 : see if prototype for sbrk is available
15611 echo " "
15612 set d_sbrkproto sbrk $i_unistd unistd.h
15613 eval $hasproto
15614
15615 : see if select exists
15616 set select d_select
15617 eval $inlibc
15618
15619 : see if semctl exists
15620 set semctl d_semctl
15621 eval $inlibc
15622
15623 : see if semget exists
15624 set semget d_semget
15625 eval $inlibc
15626
15627 : see if semop exists
15628 set semop d_semop
15629 eval $inlibc
15630
15631 : see how much of the 'sem*(2)' library is present.
15632 h_sem=true
15633 echo " "
15634 case "$d_semctl$d_semget$d_semop" in
15635 *"$undef"*) h_sem=false;;
15636 esac
15637 case "$osname" in
15638 freebsd)
15639     case "`ipcs 2>&1`" in
15640     "SVID messages"*"not configured"*)
15641         echo "Your $osname does not have the sem*(2) configured." >&4
15642         h_sem=false
15643         val="$undef"
15644         set semctl d_semctl
15645         eval $setvar
15646         set semget d_semget
15647         eval $setvar
15648         set semop d_semop
15649         eval $setvar
15650         ;;
15651     esac
15652     ;;
15653 esac
15654 : we could also check for sys/ipc.h ...
15655 if $h_sem && $test `./findhdr sys/sem.h`; then
15656         echo "You have the full sem*(2) library." >&4
15657         val="$define"
15658 else
15659         echo "You don't have the full sem*(2) library." >&4
15660         val="$undef"
15661 fi
15662 set d_sem
15663 eval $setvar
15664
15665 : see whether sys/sem.h defines union semun
15666 echo " "
15667 $cat > try.c <<'END'
15668 #include <sys/types.h>
15669 #include <sys/ipc.h>
15670 #include <sys/sem.h>
15671 int main () { union semun semun; semun.buf = 0; }
15672 END
15673 set try
15674 if eval $compile; then
15675     echo "You have union semun in <sys/sem.h>." >&4
15676     val="$define"
15677 else
15678     echo "You do not have union semun in <sys/sem.h>." >&4
15679     val="$undef"
15680 fi
15681 $rm -f try try.c
15682 set d_union_semun
15683 eval $setvar
15684
15685 : see how to do semctl IPC_STAT
15686 case "$d_sem" in
15687 $define)
15688     echo " "
15689     $cat > try.h <<END
15690 #ifndef S_IRUSR
15691 #   ifdef S_IREAD
15692 #       define S_IRUSR S_IREAD
15693 #       define S_IWUSR S_IWRITE
15694 #       define S_IXUSR S_IEXEC
15695 #   else
15696 #       define S_IRUSR 0400
15697 #       define S_IWUSR 0200
15698 #       define S_IXUSR 0100
15699 #   endif
15700 #   define S_IRGRP (S_IRUSR>>3)
15701 #   define S_IWGRP (S_IWUSR>>3)
15702 #   define S_IXGRP (S_IXUSR>>3)
15703 #   define S_IROTH (S_IRUSR>>6)
15704 #   define S_IWOTH (S_IWUSR>>6)
15705 #   define S_IXOTH (S_IXUSR>>6)
15706 #endif
15707 #ifndef S_IRWXU
15708 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15709 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15710 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15711 #endif
15712 END
15713     : see whether semctl IPC_STAT can use union semun
15714     val="$undef"
15715     case "$d_semctl_semun" in
15716     '')
15717       $cat > try.c <<END
15718 #include <sys/types.h>
15719 #include <sys/ipc.h>
15720 #include <sys/sem.h>
15721 #include <sys/stat.h>
15722 #include <stdio.h>
15723 #include <errno.h>
15724 #include "try.h"
15725 #ifndef errno
15726 extern int errno;
15727 #endif
15728 #$d_union_semun HAS_UNION_SEMUN
15729 int main() {
15730     union semun
15731 #ifndef HAS_UNION_SEMUN
15732     {
15733         int val;
15734         struct semid_ds *buf;
15735         unsigned short *array;
15736     }
15737 #endif
15738     arg;
15739     int sem, st;
15740
15741 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15742     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15743     if (sem > -1) {
15744         struct semid_ds argbuf;
15745         arg.buf = &argbuf;
15746 #       ifdef IPC_STAT
15747         st = semctl(sem, 0, IPC_STAT, arg);
15748         if (st == 0)
15749             printf("semun\n");
15750         else
15751 #       endif /* IPC_STAT */
15752             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15753 #       ifdef IPC_RMID
15754         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15755 #       endif /* IPC_RMID */
15756             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15757     } else
15758 #endif /* IPC_PRIVATE && ... */
15759         printf("semget failed: errno = %d\n", errno);
15760   return 0;
15761 }
15762 END
15763       set try
15764       if eval $compile; then
15765           xxx=`$run ./try`
15766           case "$xxx" in
15767           semun) val="$define" ;;
15768           esac
15769       fi
15770       $rm -f try try.c
15771       ;;
15772     esac
15773     set d_semctl_semun
15774     eval $setvar
15775     case "$d_semctl_semun" in
15776     $define)
15777         echo "You can use union semun for semctl IPC_STAT." >&4
15778         also='also'
15779         ;;
15780     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15781         also=''
15782         ;;
15783     esac
15784
15785     : see whether semctl IPC_STAT can use struct semid_ds pointer
15786     val="$undef"
15787     case "$d_semctl_semid_ds" in
15788     '')
15789       $cat > try.c <<'END'
15790 #include <sys/types.h>
15791 #include <sys/ipc.h>
15792 #include <sys/sem.h>
15793 #include <sys/stat.h>
15794 #include "try.h"
15795 #include <stdio.h>
15796 #include <errno.h>
15797 #ifndef errno
15798 extern int errno;
15799 #endif
15800 int main() {
15801     struct semid_ds arg;
15802     int sem, st;
15803
15804 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15805     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15806     if (sem > -1) {
15807 #       ifdef IPC_STAT
15808         st = semctl(sem, 0, IPC_STAT, &arg);
15809         if (st == 0)
15810             printf("semid_ds\n");
15811         else
15812 #       endif /* IPC_STAT */
15813             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15814 #       ifdef IPC_RMID
15815         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15816 #       endif /* IPC_RMID */
15817             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15818     } else
15819 #endif /* IPC_PRIVATE && ... */
15820         printf("semget failed: errno = %d\n", errno);
15821
15822     return 0;
15823 }
15824 END
15825       set try
15826       if eval $compile; then
15827           xxx=`$run ./try`
15828           case "$xxx" in
15829           semid_ds) val="$define" ;;
15830           esac
15831       fi
15832       $rm -f try try.c
15833       ;;
15834     esac
15835     set d_semctl_semid_ds
15836     eval $setvar
15837     case "$d_semctl_semid_ds" in
15838     $define)
15839         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15840         ;;
15841     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15842         ;;
15843     esac
15844     $rm -f try.h
15845     ;;
15846 *)  val="$undef"
15847
15848     # We do not have the full sem*(2) library, so assume we can not
15849     # use either.
15850
15851     set d_semctl_semun
15852     eval $setvar
15853
15854     set d_semctl_semid_ds
15855     eval $setvar
15856     ;;
15857 esac
15858
15859 : see if sendmsg exists
15860 set sendmsg d_sendmsg
15861 eval $inlibc
15862
15863 : see if setegid exists
15864 set setegid d_setegid
15865 eval $inlibc
15866
15867 : see if seteuid exists
15868 set seteuid d_seteuid
15869 eval $inlibc
15870
15871 : see if setgrent exists
15872 set setgrent d_setgrent
15873 eval $inlibc
15874
15875 : see if setgrent_r exists
15876 set setgrent_r d_setgrent_r
15877 eval $inlibc
15878 case "$d_setgrent_r" in
15879 "$define")
15880         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15881         case "$d_setgrent_r_proto:$usethreads" in
15882         ":define")      d_setgrent_r_proto=define
15883                 set d_setgrent_r_proto setgrent_r $hdrs
15884                 eval $hasproto ;;
15885         *)      ;;
15886         esac
15887         case "$d_setgrent_r_proto" in
15888         define)
15889         case "$setgrent_r_proto" in
15890         ''|0) try='int setgrent_r(FILE**);'
15891         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15892         esac
15893         case "$setgrent_r_proto" in
15894         ''|0) try='void setgrent_r(FILE**);'
15895         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15896         esac
15897         case "$setgrent_r_proto" in
15898         ''|0)   d_setgrent_r=undef
15899                 setgrent_r_proto=0
15900                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15901         * )     case "$setgrent_r_proto" in
15902                 REENTRANT_PROTO*) ;;
15903                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15904                 esac
15905                 echo "Prototype: $try" ;;
15906         esac
15907         ;;
15908         *)      case "$usethreads" in
15909                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15910                 esac
15911                 d_setgrent_r=undef
15912                 setgrent_r_proto=0
15913                 ;;
15914         esac
15915         ;;
15916 *)      setgrent_r_proto=0
15917         ;;
15918 esac
15919
15920 : see if sethostent exists
15921 set sethostent d_sethent
15922 eval $inlibc
15923
15924 : see if sethostent_r exists
15925 set sethostent_r d_sethostent_r
15926 eval $inlibc
15927 case "$d_sethostent_r" in
15928 "$define")
15929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15930         case "$d_sethostent_r_proto:$usethreads" in
15931         ":define")      d_sethostent_r_proto=define
15932                 set d_sethostent_r_proto sethostent_r $hdrs
15933                 eval $hasproto ;;
15934         *)      ;;
15935         esac
15936         case "$d_sethostent_r_proto" in
15937         define)
15938         case "$sethostent_r_proto" in
15939         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15940         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15941         esac
15942         case "$sethostent_r_proto" in
15943         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15944         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15945         esac
15946         case "$sethostent_r_proto" in
15947         ''|0)   d_sethostent_r=undef
15948                 sethostent_r_proto=0
15949                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15950         * )     case "$sethostent_r_proto" in
15951                 REENTRANT_PROTO*) ;;
15952                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15953                 esac
15954                 echo "Prototype: $try" ;;
15955         esac
15956         ;;
15957         *)      case "$usethreads" in
15958                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15959                 esac
15960                 d_sethostent_r=undef
15961                 sethostent_r_proto=0
15962                 ;;
15963         esac
15964         ;;
15965 *)      sethostent_r_proto=0
15966         ;;
15967 esac
15968
15969 : see if setitimer exists
15970 set setitimer d_setitimer
15971 eval $inlibc
15972
15973 : see if setlinebuf exists
15974 set setlinebuf d_setlinebuf
15975 eval $inlibc
15976
15977 : see if setlocale exists
15978 set setlocale d_setlocale
15979 eval $inlibc
15980
15981 : see if locale.h is available
15982 set locale.h i_locale
15983 eval $inhdr
15984
15985 : see if setlocale_r exists
15986 set setlocale_r d_setlocale_r
15987 eval $inlibc
15988 case "$d_setlocale_r" in
15989 "$define")
15990         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15991         case "$d_setlocale_r_proto:$usethreads" in
15992         ":define")      d_setlocale_r_proto=define
15993                 set d_setlocale_r_proto setlocale_r $hdrs
15994                 eval $hasproto ;;
15995         *)      ;;
15996         esac
15997         case "$d_setlocale_r_proto" in
15998         define)
15999         case "$setlocale_r_proto" in
16000         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16001         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16002         esac
16003         case "$setlocale_r_proto" in
16004         ''|0)   d_setlocale_r=undef
16005                 setlocale_r_proto=0
16006                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16007         * )     case "$setlocale_r_proto" in
16008                 REENTRANT_PROTO*) ;;
16009                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16010                 esac
16011                 echo "Prototype: $try" ;;
16012         esac
16013         ;;
16014         *)      case "$usethreads" in
16015                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16016                 esac
16017                 d_setlocale_r=undef
16018                 setlocale_r_proto=0
16019                 ;;
16020         esac
16021         ;;
16022 *)      setlocale_r_proto=0
16023         ;;
16024 esac
16025
16026 : see if setnetent exists
16027 set setnetent d_setnent
16028 eval $inlibc
16029
16030 : see if setnetent_r exists
16031 set setnetent_r d_setnetent_r
16032 eval $inlibc
16033 case "$d_setnetent_r" in
16034 "$define")
16035         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16036         case "$d_setnetent_r_proto:$usethreads" in
16037         ":define")      d_setnetent_r_proto=define
16038                 set d_setnetent_r_proto setnetent_r $hdrs
16039                 eval $hasproto ;;
16040         *)      ;;
16041         esac
16042         case "$d_setnetent_r_proto" in
16043         define)
16044         case "$setnetent_r_proto" in
16045         ''|0) try='int setnetent_r(int, struct netent_data*);'
16046         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16047         esac
16048         case "$setnetent_r_proto" in
16049         ''|0) try='void setnetent_r(int, struct netent_data*);'
16050         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16051         esac
16052         case "$setnetent_r_proto" in
16053         ''|0)   d_setnetent_r=undef
16054                 setnetent_r_proto=0
16055                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16056         * )     case "$setnetent_r_proto" in
16057                 REENTRANT_PROTO*) ;;
16058                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16059                 esac
16060                 echo "Prototype: $try" ;;
16061         esac
16062         ;;
16063         *)      case "$usethreads" in
16064                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16065                 esac
16066                 d_setnetent_r=undef
16067                 setnetent_r_proto=0
16068                 ;;
16069         esac
16070         ;;
16071 *)      setnetent_r_proto=0
16072         ;;
16073 esac
16074
16075 : see if setprotoent exists
16076 set setprotoent d_setpent
16077 eval $inlibc
16078
16079 : see if setpgid exists
16080 set setpgid d_setpgid
16081 eval $inlibc
16082
16083 : see if setpgrp2 exists
16084 set setpgrp2 d_setpgrp2
16085 eval $inlibc
16086
16087 : see if setpriority exists
16088 set setpriority d_setprior
16089 eval $inlibc
16090
16091 : see if setproctitle exists
16092 set setproctitle d_setproctitle
16093 eval $inlibc
16094
16095 : see if setprotoent_r exists
16096 set setprotoent_r d_setprotoent_r
16097 eval $inlibc
16098 case "$d_setprotoent_r" in
16099 "$define")
16100         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16101         case "$d_setprotoent_r_proto:$usethreads" in
16102         ":define")      d_setprotoent_r_proto=define
16103                 set d_setprotoent_r_proto setprotoent_r $hdrs
16104                 eval $hasproto ;;
16105         *)      ;;
16106         esac
16107         case "$d_setprotoent_r_proto" in
16108         define)
16109         case "$setprotoent_r_proto" in
16110         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16111         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16112         esac
16113         case "$setprotoent_r_proto" in
16114         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16115         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16116         esac
16117         case "$setprotoent_r_proto" in
16118         ''|0)   d_setprotoent_r=undef
16119                 setprotoent_r_proto=0
16120                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16121         * )     case "$setprotoent_r_proto" in
16122                 REENTRANT_PROTO*) ;;
16123                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16124                 esac
16125                 echo "Prototype: $try" ;;
16126         esac
16127         ;;
16128         *)      case "$usethreads" in
16129                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16130                 esac
16131                 d_setprotoent_r=undef
16132                 setprotoent_r_proto=0
16133                 ;;
16134         esac
16135         ;;
16136 *)      setprotoent_r_proto=0
16137         ;;
16138 esac
16139
16140 : see if setpwent exists
16141 set setpwent d_setpwent
16142 eval $inlibc
16143
16144 : see if setpwent_r exists
16145 set setpwent_r d_setpwent_r
16146 eval $inlibc
16147 case "$d_setpwent_r" in
16148 "$define")
16149         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16150         case "$d_setpwent_r_proto:$usethreads" in
16151         ":define")      d_setpwent_r_proto=define
16152                 set d_setpwent_r_proto setpwent_r $hdrs
16153                 eval $hasproto ;;
16154         *)      ;;
16155         esac
16156         case "$d_setpwent_r_proto" in
16157         define)
16158         case "$setpwent_r_proto" in
16159         ''|0) try='int setpwent_r(FILE**);'
16160         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16161         esac
16162         case "$setpwent_r_proto" in
16163         ''|0) try='void setpwent_r(FILE**);'
16164         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16165         esac
16166         case "$setpwent_r_proto" in
16167         ''|0)   d_setpwent_r=undef
16168                 setpwent_r_proto=0
16169                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16170         * )     case "$setpwent_r_proto" in
16171                 REENTRANT_PROTO*) ;;
16172                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16173                 esac
16174                 echo "Prototype: $try" ;;
16175         esac
16176         ;;
16177         *)      case "$usethreads" in
16178                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16179                 esac
16180                 d_setpwent_r=undef
16181                 setpwent_r_proto=0
16182                 ;;
16183         esac
16184         ;;
16185 *)      setpwent_r_proto=0
16186         ;;
16187 esac
16188
16189 : see if setregid exists
16190 set setregid d_setregid
16191 eval $inlibc
16192 set setresgid d_setresgid
16193 eval $inlibc
16194
16195 : see if setreuid exists
16196 set setreuid d_setreuid
16197 eval $inlibc
16198 set setresuid d_setresuid
16199 eval $inlibc
16200
16201 : see if setrgid exists
16202 set setrgid d_setrgid
16203 eval $inlibc
16204
16205 : see if setruid exists
16206 set setruid d_setruid
16207 eval $inlibc
16208
16209 : see if setservent exists
16210 set setservent d_setsent
16211 eval $inlibc
16212
16213 : see if setservent_r exists
16214 set setservent_r d_setservent_r
16215 eval $inlibc
16216 case "$d_setservent_r" in
16217 "$define")
16218         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16219         case "$d_setservent_r_proto:$usethreads" in
16220         ":define")      d_setservent_r_proto=define
16221                 set d_setservent_r_proto setservent_r $hdrs
16222                 eval $hasproto ;;
16223         *)      ;;
16224         esac
16225         case "$d_setservent_r_proto" in
16226         define)
16227         case "$setservent_r_proto" in
16228         ''|0) try='int setservent_r(int, struct servent_data*);'
16229         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16230         esac
16231         case "$setservent_r_proto" in
16232         ''|0) try='void setservent_r(int, struct servent_data*);'
16233         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16234         esac
16235         case "$setservent_r_proto" in
16236         ''|0)   d_setservent_r=undef
16237                 setservent_r_proto=0
16238                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16239         * )     case "$setservent_r_proto" in
16240                 REENTRANT_PROTO*) ;;
16241                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16242                 esac
16243                 echo "Prototype: $try" ;;
16244         esac
16245         ;;
16246         *)      case "$usethreads" in
16247                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16248                 esac
16249                 d_setservent_r=undef
16250                 setservent_r_proto=0
16251                 ;;
16252         esac
16253         ;;
16254 *)      setservent_r_proto=0
16255         ;;
16256 esac
16257
16258 : see if setsid exists
16259 set setsid d_setsid
16260 eval $inlibc
16261
16262 : see if setvbuf exists
16263 set setvbuf d_setvbuf
16264 eval $inlibc
16265
16266 : see if sfio.h is available
16267 set sfio.h i_sfio
16268 eval $inhdr
16269
16270
16271 : see if sfio library is available
16272 case "$i_sfio" in
16273 $define)
16274         val=''
16275         set sfreserve val
16276         eval $inlibc
16277         ;;
16278 *)
16279         val="$undef"
16280         ;;
16281 esac
16282 : Ok, but do we want to use it.
16283 case "$val" in
16284 $define)
16285         case "$usesfio" in
16286         true|$define|[yY]*) dflt='y';;
16287         *) dflt='n';;
16288         esac
16289         echo "$package can use the sfio library, but it is experimental."
16290         case "$useperlio" in
16291         "$undef")
16292             echo "For sfio also the PerlIO abstraction layer is needed."
16293             echo "Earlier you said you wouldn't want that."
16294             ;;
16295         esac
16296         rp="You seem to have sfio available, do you want to try using it?"
16297         . ./myread
16298         case "$ans" in
16299         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16300                 useperlio="$define"
16301                 val="$define"
16302                 ;;
16303         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16304                 val="$undef"
16305                 ;;
16306         esac
16307         ;;
16308 *)      case "$usesfio" in
16309         true|$define|[yY]*)
16310                 echo "Sorry, cannot find sfio on this machine." >&4
16311                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16312                 val="$undef"
16313                 ;;
16314         esac
16315         ;;
16316 esac
16317 set d_sfio
16318 eval $setvar
16319 case "$d_sfio" in
16320 $define) usesfio='true';;
16321 *) usesfio='false';;
16322 esac
16323 case "$d_sfio" in
16324 $define) ;;
16325 *)      : Remove sfio from list of libraries to use
16326         case "$libs" in
16327         *-lsfio*)
16328                 echo "Removing unneeded -lsfio from library list" >&4
16329                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16330                 shift
16331                 libs="$*"
16332                 echo "libs = $libs" >&4
16333                 ;;
16334         esac
16335 ;;
16336 esac
16337
16338
16339 : see if shmctl exists
16340 set shmctl d_shmctl
16341 eval $inlibc
16342
16343 : see if shmget exists
16344 set shmget d_shmget
16345 eval $inlibc
16346
16347 : see if shmat exists
16348 set shmat d_shmat
16349 eval $inlibc
16350 : see what shmat returns
16351 case "$d_shmat" in
16352 "$define")
16353         $cat >shmat.c <<'END'
16354 #include <sys/shm.h>
16355 void *shmat();
16356 END
16357         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16358                 shmattype='void *'
16359         else
16360                 shmattype='char *'
16361         fi
16362         echo "and it returns ($shmattype)." >&4
16363         : see if a prototype for shmat is available
16364         xxx=`./findhdr sys/shm.h`
16365         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16366         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16367                 val="$define"
16368         else
16369                 val="$undef"
16370         fi
16371         $rm -f shmat.[co]
16372         ;;
16373 *)
16374         val="$undef"
16375         ;;
16376 esac
16377 set d_shmatprototype
16378 eval $setvar
16379
16380 : see if shmdt exists
16381 set shmdt d_shmdt
16382 eval $inlibc
16383
16384 : see how much of the 'shm*(2)' library is present.
16385 h_shm=true
16386 echo " "
16387 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16388 *"$undef"*) h_shm=false;;
16389 esac
16390 case "$osname" in
16391 freebsd)
16392     case "`ipcs 2>&1`" in
16393     "SVID shared memory"*"not configured"*)
16394         echo "Your $osname does not have the shm*(2) configured." >&4
16395         h_shm=false
16396         val="$undef"
16397         set shmctl d_shmctl
16398         evat $setvar
16399         set shmget d_shmget
16400         evat $setvar
16401         set shmat d_shmat
16402         evat $setvar
16403         set shmdt d_shmdt
16404         evat $setvar
16405         ;;
16406     esac
16407     ;;
16408 esac
16409 : we could also check for sys/ipc.h ...
16410 if $h_shm && $test `./findhdr sys/shm.h`; then
16411         echo "You have the full shm*(2) library." >&4
16412         val="$define"
16413 else
16414         echo "You don't have the full shm*(2) library." >&4
16415         val="$undef"
16416 fi
16417 set d_shm
16418 eval $setvar
16419
16420 echo " "
16421 : see if we have sigaction
16422 if set sigaction val -f d_sigaction; eval $csym; $val; then
16423         echo 'sigaction() found.' >&4
16424         $cat > try.c <<EOP
16425 #include <stdio.h>
16426 #include <sys/types.h>
16427 #include <signal.h>
16428 #$i_stdlib I_STDLIB
16429 #ifdef I_STDLIB
16430 #include <stdlib.h>
16431 #endif
16432 int main()
16433 {
16434     struct sigaction act, oact;
16435     act.sa_flags = 0;
16436     oact.sa_handler = 0;
16437     /* so that act and oact are used */
16438     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16439 }
16440 EOP
16441         set try
16442         if eval $compile_ok; then
16443                 val="$define"
16444         else
16445                 echo "But you don't seem to have a useable struct sigaction." >&4
16446                 val="$undef"
16447         fi
16448 else
16449         echo 'sigaction NOT found.' >&4
16450         val="$undef"
16451 fi
16452 set d_sigaction; eval $setvar
16453 $rm -f try try$_o try.c
16454
16455 : see if sigprocmask exists
16456 set sigprocmask d_sigprocmask
16457 eval $inlibc
16458
16459 : see if sigsetjmp exists
16460 echo " "
16461 case "$d_sigsetjmp" in
16462 '')
16463         $cat >try.c <<EOP
16464 #include <setjmp.h>
16465 #$i_stdlib I_STDLIB
16466 #ifdef I_STDLIB
16467 #include <stdlib.h>
16468 #endif
16469 sigjmp_buf env;
16470 int set = 1;
16471 int main()
16472 {
16473         if (sigsetjmp(env,1))
16474                 exit(set);
16475         set = 0;
16476         siglongjmp(env, 1);
16477         exit(1);
16478 }
16479 EOP
16480         set try
16481         if eval $compile; then
16482                 if $run ./try >/dev/null 2>&1; then
16483                         echo "POSIX sigsetjmp found." >&4
16484                         val="$define"
16485                 else
16486                         $cat >&4 <<EOM
16487 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16488 I'll ignore them.
16489 EOM
16490                         val="$undef"
16491                 fi
16492         else
16493                 echo "sigsetjmp not found." >&4
16494                 val="$undef"
16495         fi
16496         ;;
16497 *) val="$d_sigsetjmp"
16498         case "$d_sigsetjmp" in
16499         $define) echo "POSIX sigsetjmp found." >&4;;
16500         $undef) echo "sigsetjmp not found." >&4;;
16501         esac
16502         ;;
16503 esac
16504 set d_sigsetjmp
16505 eval $setvar
16506 $rm -f try.c try
16507
16508 : see if sockatmark exists
16509 set sockatmark d_sockatmark
16510 eval $inlibc
16511
16512 : see if prototype for sockatmark is available
16513 echo " "
16514 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16515 eval $hasproto
16516
16517 : see if socks5_init exists
16518 set socks5_init d_socks5_init
16519 eval $inlibc
16520
16521 : see if sprintf returns the length of the string in the buffer as per ANSI
16522 $echo "Checking whether sprintf returns the length of the string..." >&4
16523 $cat <<EOP >try.c
16524 #include <stdio.h>
16525 #$i_stdlib I_STDLIB
16526 #ifdef I_STDLIB
16527 #include <stdlib.h>
16528 #endif
16529 #$i_string I_STRING
16530 #ifdef I_STRING
16531 #  include <string.h>
16532 #else
16533 #  include <strings.h>
16534 #endif
16535 #$i_math I_MATH
16536 #ifdef I_MATH
16537 #include <math.h>
16538 #endif
16539
16540 char buffer[256];
16541
16542 int check (size_t expect, int test) {
16543   size_t got = strlen(buffer);
16544   if (expect == got)
16545     return 0;
16546
16547   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16548        test, buffer);
16549   exit (test);
16550 }
16551
16552 int main(int argc, char **argv) {
16553   int test = 0;
16554
16555   check(sprintf(buffer, ""), ++test);
16556   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16557   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16558
16559   return 0;
16560 }
16561 EOP
16562 set try
16563
16564 d_sprintf_returns_strlen="$undef"
16565 if eval $compile; then
16566     xxx="`$run ./try`"
16567     case "$?" in
16568         0) cat >&4 <<EOM
16569 sprintf returns the length of the string (as ANSI says it should)
16570 EOM
16571         d_sprintf_returns_strlen="$define"
16572         ;;
16573         *) cat >&4 <<EOM
16574 sprintf does not return the length of the string (how old is this system?)
16575 EOM
16576         d_sprintf_returns_strlen="$undef"
16577         ;;
16578     esac
16579 fi
16580
16581 $rm -f try.* try
16582
16583 : see if srand48_r exists
16584 set srand48_r d_srand48_r
16585 eval $inlibc
16586 case "$d_srand48_r" in
16587 "$define")
16588         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16589         case "$d_srand48_r_proto:$usethreads" in
16590         ":define")      d_srand48_r_proto=define
16591                 set d_srand48_r_proto srand48_r $hdrs
16592                 eval $hasproto ;;
16593         *)      ;;
16594         esac
16595         case "$d_srand48_r_proto" in
16596         define)
16597         case "$srand48_r_proto" in
16598         ''|0) try='int srand48_r(long, struct drand48_data*);'
16599         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16600         esac
16601         case "$srand48_r_proto" in
16602         ''|0)   d_srand48_r=undef
16603                 srand48_r_proto=0
16604                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16605         * )     case "$srand48_r_proto" in
16606                 REENTRANT_PROTO*) ;;
16607                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16608                 esac
16609                 echo "Prototype: $try" ;;
16610         esac
16611         ;;
16612         *)      case "$usethreads" in
16613                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16614                 esac
16615                 d_srand48_r=undef
16616                 srand48_r_proto=0
16617                 ;;
16618         esac
16619         ;;
16620 *)      srand48_r_proto=0
16621         ;;
16622 esac
16623
16624 : see if srandom_r exists
16625 set srandom_r d_srandom_r
16626 eval $inlibc
16627 case "$d_srandom_r" in
16628 "$define")
16629         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16630         case "$d_srandom_r_proto:$usethreads" in
16631         ":define")      d_srandom_r_proto=define
16632                 set d_srandom_r_proto srandom_r $hdrs
16633                 eval $hasproto ;;
16634         *)      ;;
16635         esac
16636         case "$d_srandom_r_proto" in
16637         define)
16638         case "$srandom_r_proto" in
16639         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16640         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16641         esac
16642         case "$srandom_r_proto" in
16643         ''|0)   d_srandom_r=undef
16644                 srandom_r_proto=0
16645                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16646         * )     case "$srandom_r_proto" in
16647                 REENTRANT_PROTO*) ;;
16648                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16649                 esac
16650                 echo "Prototype: $try" ;;
16651         esac
16652         ;;
16653         *)      case "$usethreads" in
16654                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16655                 esac
16656                 d_srandom_r=undef
16657                 srandom_r_proto=0
16658                 ;;
16659         esac
16660         ;;
16661 *)      srandom_r_proto=0
16662         ;;
16663 esac
16664
16665 : see if prototype for setresgid is available
16666 echo " "
16667 set d_sresgproto setresgid $i_unistd unistd.h
16668 eval $hasproto
16669
16670 : see if prototype for setresuid is available
16671 echo " "
16672 set d_sresuproto setresuid $i_unistd unistd.h
16673 eval $hasproto
16674
16675 : see if sys/stat.h is available
16676 set sys/stat.h i_sysstat
16677 eval $inhdr
16678
16679
16680 : see if stat knows about block sizes
16681 echo " "
16682 echo "Checking to see if your struct stat has st_blocks field..." >&4
16683 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16684 eval $hasfield
16685
16686
16687 : see if this is a sys/vfs.h system
16688 set sys/vfs.h i_sysvfs
16689 eval $inhdr
16690
16691
16692 : see if this is a sys/statfs.h system
16693 set sys/statfs.h i_sysstatfs
16694 eval $inhdr
16695
16696
16697 echo " "
16698 echo "Checking to see if your system supports struct statfs..." >&4
16699 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
16700 eval $hasstruct
16701 case "$d_statfs_s" in
16702 "$define")      echo "Yes, it does."   ;;
16703 *)              echo "No, it doesn't." ;;
16704 esac
16705
16706
16707
16708 : see if struct statfs knows about f_flags
16709 case "$d_statfs_s" in
16710 define) 
16711         echo " "
16712         echo "Checking to see if your struct statfs has f_flags field..." >&4
16713         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
16714         eval $hasfield
16715         ;;
16716 *)      val="$undef"
16717         set d_statfs_f_flags
16718         eval $setvar
16719         ;;
16720 esac
16721 case "$d_statfs_f_flags" in
16722 "$define")      echo "Yes, it does."   ;;
16723 *)              echo "No, it doesn't." ;;
16724 esac
16725
16726 $cat >&4 <<EOM
16727 Checking how to access stdio streams by file descriptor number...
16728 EOM
16729 case "$stdio_stream_array" in
16730 '')     $cat >try.c <<EOCP
16731 #include <stdio.h>
16732 int main() {
16733   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16734     printf("yes\n");
16735 }
16736 EOCP
16737         for s in _iob __iob __sF
16738         do
16739                 set try -DSTDIO_STREAM_ARRAY=$s
16740                 if eval $compile; then
16741                         case "`$run ./try`" in
16742                         yes)    stdio_stream_array=$s; break ;;
16743                         esac
16744                 fi
16745         done
16746         $rm -f try.* try$exe_ext
16747 esac
16748 case "$stdio_stream_array" in
16749 '')     $cat >&4 <<EOM
16750 I can't figure out how to access stdio streams by file descriptor number.
16751 EOM
16752         d_stdio_stream_array="$undef"
16753         ;;
16754 *)      $cat >&4 <<EOM
16755 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16756 EOM
16757         d_stdio_stream_array="$define"
16758         ;;
16759 esac
16760
16761 : see if strcoll exists
16762 set strcoll d_strcoll
16763 eval $inlibc
16764
16765 : check for structure copying
16766 echo " "
16767 echo "Checking to see if your C compiler can copy structs..." >&4
16768 $cat >try.c <<'EOCP'
16769 int main()
16770 {
16771         struct blurfl {
16772                 int dyick;
16773         } foo, bar;
16774
16775         foo = bar;
16776 }
16777 EOCP
16778 if $cc -c try.c >/dev/null 2>&1 ; then
16779         val="$define"
16780         echo "Yup, it can."
16781 else
16782         val="$undef"
16783         echo "Nope, it can't."
16784 fi
16785 set d_strctcpy
16786 eval $setvar
16787 $rm -f try.*
16788
16789 : see if strerror and/or sys_errlist[] exist
16790 echo " "
16791 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16792     if set strerror val -f d_strerror; eval $csym; $val; then
16793                 echo 'strerror() found.' >&4
16794                 d_strerror="$define"
16795                 d_strerrm='strerror(e)'
16796                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16797                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16798                         d_syserrlst="$define"
16799                 else
16800                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16801                         d_syserrlst="$undef"
16802                 fi
16803     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16804                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16805                 echo 'strerror() found in string header.' >&4
16806                 d_strerror="$define"
16807                 d_strerrm='strerror(e)'
16808                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16809                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16810                                 d_syserrlst="$define"
16811                 else
16812                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16813                         d_syserrlst="$undef"
16814                 fi
16815     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16816                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16817                 d_strerror="$undef"
16818                 d_syserrlst="$define"
16819                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16820     else
16821                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16822                 d_strerror="$undef"
16823                 d_syserrlst="$undef"
16824                 d_strerrm='"unknown"'
16825     fi
16826 fi
16827
16828 : see if strerror_r exists
16829 set strerror_r d_strerror_r
16830 eval $inlibc
16831 case "$d_strerror_r" in
16832 "$define")
16833         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16834         case "$d_strerror_r_proto:$usethreads" in
16835         ":define")      d_strerror_r_proto=define
16836                 set d_strerror_r_proto strerror_r $hdrs
16837                 eval $hasproto ;;
16838         *)      ;;
16839         esac
16840         case "$d_strerror_r_proto" in
16841         define)
16842         case "$strerror_r_proto" in
16843         ''|0) try='int strerror_r(int, char*, size_t);'
16844         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16845         esac
16846         case "$strerror_r_proto" in
16847         ''|0) try='int strerror_r(int, char*, int);'
16848         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16849         esac
16850         case "$strerror_r_proto" in
16851         ''|0) try='char* strerror_r(int, char*, size_t);'
16852         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16853         esac
16854         case "$strerror_r_proto" in
16855         ''|0)   d_strerror_r=undef
16856                 strerror_r_proto=0
16857                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16858         * )     case "$strerror_r_proto" in
16859                 REENTRANT_PROTO*) ;;
16860                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16861                 esac
16862                 echo "Prototype: $try" ;;
16863         esac
16864         ;;
16865         *)      case "$usethreads" in
16866                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16867                 esac
16868                 d_strerror_r=undef
16869                 strerror_r_proto=0
16870                 ;;
16871         esac
16872         ;;
16873 *)      strerror_r_proto=0
16874         ;;
16875 esac
16876
16877 : see if strftime exists
16878 set strftime d_strftime
16879 eval $inlibc
16880
16881 : see if strlcat exists
16882 set strlcat d_strlcat
16883 eval $inlibc
16884
16885 : see if strlcpy exists
16886 set strlcpy d_strlcpy
16887 eval $inlibc
16888
16889 : see if strtod exists
16890 set strtod d_strtod
16891 eval $inlibc
16892
16893 : see if strtol exists
16894 set strtol d_strtol
16895 eval $inlibc
16896
16897 : see if strtold exists
16898 set strtold d_strtold
16899 eval $inlibc
16900
16901 : see if strtoll exists
16902 set strtoll d_strtoll
16903 eval $inlibc
16904
16905 case "$d_longlong-$d_strtoll" in
16906 "$define-$define")
16907         $cat <<EOM
16908 Checking whether your strtoll() works okay...
16909 EOM
16910         $cat >try.c <<'EOCP'
16911 #include <errno.h>
16912 #ifdef __hpux
16913 #define strtoll __strtoll
16914 #endif
16915 #ifdef __EMX__
16916 #define strtoll _strtoll
16917 #endif
16918 #include <stdio.h>
16919 extern long long int strtoll(char *s, char **, int); 
16920 static int bad = 0;
16921 int check(char *s, long long ell, int een) {
16922         long long gll;
16923         errno = 0;
16924         gll = strtoll(s, 0, 10);
16925         if (!((gll == ell) && (errno == een)))
16926                 bad++;
16927 }
16928 int main() {
16929         check(" 1",                                      1LL, 0);
16930         check(" 0",                                      0LL, 0);
16931         check("-1",                                     -1LL, 0);
16932         check("-9223372036854775808", -9223372036854775808LL, 0);
16933         check("-9223372036854775808", -9223372036854775808LL, 0);
16934         check(" 9223372036854775807",  9223372036854775807LL, 0);
16935         check("-9223372036854775808", -9223372036854775808LL, 0);
16936         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16937         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16938         if (!bad)
16939                 printf("ok\n");
16940 }
16941 EOCP
16942         set try
16943         if eval $compile; then
16944                 yyy=`$run ./try`
16945                 case "$yyy" in
16946                 ok) echo "Your strtoll() seems to be working okay." ;;
16947                 *) cat <<EOM >&4
16948 Your strtoll() doesn't seem to be working okay.
16949 EOM
16950                    d_strtoll="$undef"
16951                    ;;
16952                 esac
16953         else
16954                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16955                 d_strtoll="$undef"
16956         fi
16957         ;;
16958 esac
16959
16960 : see if strtoq exists
16961 set strtoq d_strtoq
16962 eval $inlibc
16963
16964 : see if strtoul exists
16965 set strtoul d_strtoul
16966 eval $inlibc
16967
16968 case "$d_strtoul" in
16969 "$define")
16970         $cat <<EOM
16971 Checking whether your strtoul() works okay...
16972 EOM
16973         $cat >try.c <<'EOCP'
16974 #include <errno.h>
16975 #include <stdio.h>
16976 extern unsigned long int strtoul(char *s, char **, int); 
16977 static int bad = 0;
16978 void check(char *s, unsigned long eul, int een) {
16979         unsigned long gul;
16980         errno = 0;
16981         gul = strtoul(s, 0, 10);
16982         if (!((gul == eul) && (errno == een)))
16983                 bad++;
16984 }
16985 int main() {
16986         check(" 1", 1L, 0);
16987         check(" 0", 0L, 0);
16988 EOCP
16989         case "$longsize" in
16990         8)
16991             $cat >>try.c <<'EOCP'
16992         check("18446744073709551615", 18446744073709551615UL, 0);
16993         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16994 #if 0 /* strtoul() for /^-/ strings is undefined. */
16995         check("-1", 18446744073709551615UL, 0);
16996         check("-18446744073709551614", 2, 0);
16997         check("-18446744073709551615", 1, 0);
16998         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16999         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17000 #endif
17001 EOCP
17002                 ;;
17003         4)
17004                     $cat >>try.c <<'EOCP'
17005         check("4294967295", 4294967295UL, 0);
17006         check("4294967296", 4294967295UL, ERANGE);
17007 #if 0 /* strtoul() for /^-/ strings is undefined. */
17008         check("-1", 4294967295UL, 0);
17009         check("-4294967294", 2, 0);
17010         check("-4294967295", 1, 0);
17011         check("-4294967296", 4294967295UL, ERANGE);
17012         check("-4294967297", 4294967295UL, ERANGE);
17013 #endif
17014 EOCP
17015                 ;;
17016         *)
17017 : Should we write these tests to be more portable by sprintf-ing
17018 : ~0 and then manipulating that char string as input for strtol?
17019                 ;;
17020         esac
17021         $cat >>try.c <<'EOCP'
17022         if (!bad)
17023                 printf("ok\n");
17024         return 0;
17025 }
17026 EOCP
17027         set try
17028         if eval $compile; then
17029                 case "`$run ./try`" in
17030                 ok) echo "Your strtoul() seems to be working okay." ;;
17031                 *) cat <<EOM >&4
17032 Your strtoul() doesn't seem to be working okay.
17033 EOM
17034                    d_strtoul="$undef"
17035                    ;;
17036                 esac
17037         fi
17038         ;;
17039 esac
17040
17041 : see if strtoull exists
17042 set strtoull d_strtoull
17043 eval $inlibc
17044
17045 case "$d_longlong-$d_strtoull" in
17046 "$define-$define")
17047         $cat <<EOM
17048 Checking whether your strtoull() works okay...
17049 EOM
17050         $cat >try.c <<'EOCP'
17051 #include <errno.h>
17052 #ifdef __hpux
17053 #define strtoull __strtoull
17054 #endif
17055 #include <stdio.h>
17056 extern unsigned long long int strtoull(char *s, char **, int); 
17057 static int bad = 0;
17058 int check(char *s, long long eull, int een) {
17059         long long gull;
17060         errno = 0;
17061         gull = strtoull(s, 0, 10);
17062         if (!((gull == eull) && (errno == een)))
17063                 bad++;
17064 }
17065 int main() {
17066         check(" 1",                                        1LL, 0);
17067         check(" 0",                                        0LL, 0);
17068         check("18446744073709551615",  18446744073709551615ULL, 0);
17069         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17070 #if 0 /* strtoull() for /^-/ strings is undefined. */
17071         check("-1",                    18446744073709551615ULL, 0);
17072         check("-18446744073709551614",                     2LL, 0);
17073         check("-18446744073709551615",                     1LL, 0);
17074         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17075         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17076 #endif
17077         if (!bad)
17078                 printf("ok\n");
17079 }
17080 EOCP
17081         set try
17082         if eval $compile; then
17083                 case "`$run ./try`" in
17084                 ok) echo "Your strtoull() seems to be working okay." ;;
17085                 *) cat <<EOM >&4
17086 Your strtoull() doesn't seem to be working okay.
17087 EOM
17088                    d_strtoull="$undef"
17089                    ;;
17090                 esac
17091         fi
17092         ;;
17093 esac
17094
17095 : see if strtouq exists
17096 set strtouq d_strtouq
17097 eval $inlibc
17098
17099 case "$d_strtouq" in
17100 "$define")
17101         $cat <<EOM
17102 Checking whether your strtouq() works okay...
17103 EOM
17104         $cat >try.c <<'EOCP'
17105 #include <errno.h>
17106 #include <stdio.h>
17107 extern unsigned long long int strtouq(char *s, char **, int); 
17108 static int bad = 0;
17109 void check(char *s, unsigned long long eull, int een) {
17110         unsigned long long gull;
17111         errno = 0;
17112         gull = strtouq(s, 0, 10);
17113         if (!((gull == eull) && (errno == een)))
17114                 bad++;
17115 }
17116 int main() {
17117         check(" 1",                                        1LL, 0);
17118         check(" 0",                                        0LL, 0);
17119         check("18446744073709551615",  18446744073709551615ULL, 0);
17120         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17121 #if 0 /* strtouq() for /^-/ strings is undefined. */
17122         check("-1",                    18446744073709551615ULL, 0);
17123         check("-18446744073709551614",                     2LL, 0);
17124         check("-18446744073709551615",                     1LL, 0);
17125         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17126         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17127 #endif
17128         if (!bad)
17129                 printf("ok\n");
17130         return 0;
17131 }
17132 EOCP
17133         set try
17134         if eval $compile; then
17135                 case "`$run ./try`" in
17136                 ok) echo "Your strtouq() seems to be working okay." ;;
17137                 *) cat <<EOM >&4
17138 Your strtouq() doesn't seem to be working okay.
17139 EOM
17140                    d_strtouq="$undef"
17141                    ;;
17142                 esac
17143         fi
17144         ;;
17145 esac
17146
17147 : see if strxfrm exists
17148 set strxfrm d_strxfrm
17149 eval $inlibc
17150
17151 : see if symlink exists
17152 set symlink d_symlink
17153 eval $inlibc
17154
17155 : see if syscall exists
17156 set syscall d_syscall
17157 eval $inlibc
17158
17159 : see if prototype for syscall is available
17160 echo " "
17161 set d_syscallproto syscall $i_unistd unistd.h
17162 eval $hasproto
17163
17164 : see if sysconf exists
17165 set sysconf d_sysconf
17166 eval $inlibc
17167
17168 : see if system exists
17169 set system d_system
17170 eval $inlibc
17171
17172 : see if tcgetpgrp exists
17173 set tcgetpgrp d_tcgetpgrp
17174 eval $inlibc
17175
17176 : see if tcsetpgrp exists
17177 set tcsetpgrp d_tcsetpgrp
17178 eval $inlibc
17179
17180 : see if prototype for telldir is available
17181 echo " "
17182 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17183 eval $hasproto
17184
17185 : see if time exists
17186 echo " "
17187 if test "X$d_time" = X -o X"$timetype" = X; then
17188     if set time val -f d_time; eval $csym; $val; then
17189                 echo 'time() found.' >&4
17190                 val="$define"
17191                 rp="What is the type returned by time() on this system?"
17192                 set time_t timetype long stdio.h sys/types.h
17193                 eval $typedef_ask
17194     else
17195                 echo 'time() not found, hope that will do.' >&4
17196                 val="$undef"
17197                 timetype='int';
17198     fi
17199     set d_time
17200     eval $setvar
17201 fi
17202
17203 : see if this is a sys/times.h system
17204 set sys/times.h i_systimes
17205 eval $inhdr
17206
17207 : see if times exists
17208 echo " "
17209 if set times val -f d_times; eval $csym; $val; then
17210         echo 'times() found.' >&4
17211         d_times="$define"
17212         inc=''
17213         case "$i_systimes" in
17214         "$define") inc='sys/times.h';;
17215         esac
17216         rp="What is the type returned by times() on this system?"
17217         set clock_t clocktype long stdio.h sys/types.h $inc
17218         eval $typedef_ask
17219 else
17220         echo 'times() NOT found, hope that will do.' >&4
17221         d_times="$undef"
17222         clocktype='int'
17223 fi
17224
17225 : see if tmpnam_r exists
17226 set tmpnam_r d_tmpnam_r
17227 eval $inlibc
17228 case "$d_tmpnam_r" in
17229 "$define")
17230         hdrs="$i_systypes sys/types.h define stdio.h "
17231         case "$d_tmpnam_r_proto:$usethreads" in
17232         ":define")      d_tmpnam_r_proto=define
17233                 set d_tmpnam_r_proto tmpnam_r $hdrs
17234                 eval $hasproto ;;
17235         *)      ;;
17236         esac
17237         case "$d_tmpnam_r_proto" in
17238         define)
17239         case "$tmpnam_r_proto" in
17240         ''|0) try='char* tmpnam_r(char*);'
17241         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17242         esac
17243         case "$tmpnam_r_proto" in
17244         ''|0)   d_tmpnam_r=undef
17245                 tmpnam_r_proto=0
17246                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17247         * )     case "$tmpnam_r_proto" in
17248                 REENTRANT_PROTO*) ;;
17249                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17250                 esac
17251                 echo "Prototype: $try" ;;
17252         esac
17253         ;;
17254         *)      case "$usethreads" in
17255                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17256                 esac
17257                 d_tmpnam_r=undef
17258                 tmpnam_r_proto=0
17259                 ;;
17260         esac
17261         ;;
17262 *)      tmpnam_r_proto=0
17263         ;;
17264 esac
17265
17266 : see if truncate exists
17267 set truncate d_truncate
17268 eval $inlibc
17269
17270 : see if ttyname_r exists
17271 set ttyname_r d_ttyname_r
17272 eval $inlibc
17273 case "$d_ttyname_r" in
17274 "$define")
17275         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17276         case "$d_ttyname_r_proto:$usethreads" in
17277         ":define")      d_ttyname_r_proto=define
17278                 set d_ttyname_r_proto ttyname_r $hdrs
17279                 eval $hasproto ;;
17280         *)      ;;
17281         esac
17282         case "$d_ttyname_r_proto" in
17283         define)
17284         case "$ttyname_r_proto" in
17285         ''|0) try='int ttyname_r(int, char*, size_t);'
17286         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17287         esac
17288         case "$ttyname_r_proto" in
17289         ''|0) try='int ttyname_r(int, char*, int);'
17290         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17291         esac
17292         case "$ttyname_r_proto" in
17293         ''|0) try='char* ttyname_r(int, char*, int);'
17294         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17295         esac
17296         case "$ttyname_r_proto" in
17297         ''|0)   d_ttyname_r=undef
17298                 ttyname_r_proto=0
17299                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17300         * )     case "$ttyname_r_proto" in
17301                 REENTRANT_PROTO*) ;;
17302                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17303                 esac
17304                 echo "Prototype: $try" ;;
17305         esac
17306         ;;
17307         *)      case "$usethreads" in
17308                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17309                 esac
17310                 d_ttyname_r=undef
17311                 ttyname_r_proto=0
17312                 ;;
17313         esac
17314         ;;
17315 *)      ttyname_r_proto=0
17316         ;;
17317 esac
17318
17319 : see if tzname[] exists
17320 echo " "
17321 if set tzname val -a d_tzname; eval $csym; $val; then
17322         val="$define"
17323         echo 'tzname[] found.' >&4
17324 else
17325         val="$undef"
17326         echo 'tzname[] NOT found.' >&4
17327 fi
17328 set d_tzname
17329 eval $setvar
17330
17331 case "$osname" in
17332 next|rhapsody|darwin) multiarch="$define" ;;
17333 esac
17334 case "$multiarch" in
17335 ''|[nN]*) multiarch="$undef" ;;
17336 esac
17337
17338 : check for ordering of bytes in a UV
17339 echo " "
17340 case "$usecrosscompile$multiarch" in
17341 *$define*)
17342         $cat <<EOM
17343 You seem to be either cross-compiling or doing a multiarchitecture build,
17344 skipping the byteorder check.
17345
17346 EOM
17347         byteorder='ffff'
17348         ;;
17349 *)
17350         case "$byteorder" in
17351         '')
17352                 $cat <<'EOM'
17353 In the following, larger digits indicate more significance.  A big-endian
17354 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17355 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17356 machines may have weird orders like 3412.  A Cray will report 87654321,
17357 an Alpha will report 12345678. If the test program works the default is
17358 probably right.
17359 I'm now running the test program...
17360 EOM
17361                 $cat >try.c <<EOCP
17362 #include <stdio.h>
17363 #$i_stdlib I_STDLIB
17364 #ifdef I_STDLIB
17365 #include <stdlib.h>
17366 #endif
17367 #include <sys/types.h>
17368 typedef $uvtype UV;
17369 int main()
17370 {
17371         int i;
17372         union {
17373                 UV l;
17374                 char c[$uvsize];
17375         } u;
17376
17377         if ($uvsize > 4)
17378                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17379         else
17380                 u.l = (UV)0x04030201;
17381         for (i = 0; i < $uvsize; i++)
17382                 printf("%c", u.c[i]+'0');
17383         printf("\n");
17384         exit(0);
17385 }
17386 EOCP
17387                 xxx_prompt=y
17388                 set try
17389                 if eval $compile && ./try > /dev/null; then
17390                         dflt=`$run ./try`
17391                         case "$dflt" in
17392                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17393                                 echo "(The test program ran ok.)"
17394                                 echo "byteorder=$dflt"
17395                                 xxx_prompt=n
17396                         ;;
17397                         ????|????????) echo "(The test program ran ok.)" ;;
17398                         *) echo "(The test program didn't run right for some reason.)" ;;
17399                         esac
17400                 else
17401                         dflt='4321'
17402                         cat <<'EOM'
17403 (I can't seem to compile the test program.  Guessing big-endian...)
17404 EOM
17405                 fi
17406                 case "$xxx_prompt" in
17407                 y)
17408                         rp="What is the order of bytes in $uvtype?"
17409                         . ./myread
17410                         byteorder="$ans"
17411                         ;;
17412                 *)      byteorder=$dflt
17413                         ;;
17414                 esac
17415                 ;;
17416         esac
17417         $rm -f try.c try
17418         ;;
17419 esac
17420
17421
17422 $cat <<EOM
17423
17424 Checking to see whether you can access character data unalignedly...
17425 EOM
17426 case "$d_u32align" in
17427 '')   $cat >try.c <<EOCP
17428 #include <stdio.h>
17429 #$i_stdlib I_STDLIB
17430 #ifdef I_STDLIB
17431 #include <stdlib.h>
17432 #endif
17433 #define U32 $u32type
17434 #define BYTEORDER 0x$byteorder
17435 #define U8 $u8type
17436 #include <signal.h>
17437 #ifdef SIGBUS
17438 $signal_t bletch(s) int s; { exit(4); }
17439 #endif
17440 int main() {
17441 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17442     U8 buf[8];
17443     U32 *up;
17444     int i;
17445
17446     if (sizeof(U32) != 4) {
17447         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17448         exit(1);
17449     }
17450
17451     fflush(stdout);
17452
17453 #ifdef SIGBUS
17454     signal(SIGBUS, bletch);
17455 #endif
17456
17457     buf[0] = 0;
17458     buf[1] = 0;
17459     buf[2] = 0;
17460     buf[3] = 1;
17461     buf[4] = 0;
17462     buf[5] = 0;
17463     buf[6] = 0;
17464     buf[7] = 1;
17465
17466     for (i = 0; i < 4; i++) {
17467         up = (U32*)(buf + i);
17468         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17469                (*up == 1 << (8*(3-i)))  /* little-endian */
17470               )
17471            )
17472         {
17473             printf("read failed (%x)\n", *up);
17474             exit(2);
17475         }
17476     }
17477
17478     /* write test */
17479     for (i = 0; i < 4; i++) {
17480         up = (U32*)(buf + i);
17481         *up = 0xBeef;
17482         if (*up != 0xBeef) {
17483             printf("write failed (%x)\n", *up);
17484             exit(3);
17485         }
17486     }
17487
17488     exit(0);
17489 #else
17490     printf("1\n");
17491     exit(1);
17492 #endif
17493     return 0;
17494 }
17495 EOCP
17496 set try
17497 if eval $compile_ok; then
17498         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17499         $run ./try 2>&1 >/dev/null
17500         case "$?" in
17501         0)      cat >&4 <<EOM
17502 You can access character data pretty unalignedly.
17503 EOM
17504                 d_u32align="$undef"
17505                 ;;
17506         *)      cat >&4 <<EOM
17507 It seems that you must access character data in an aligned manner.
17508 EOM
17509                 d_u32align="$define"
17510                 ;;
17511         esac
17512 else
17513         rp='Can you access character data at unaligned addresses?'
17514         dflt='n'
17515         . ./myread
17516         case "$ans" in
17517         [yY]*)  d_u32align="$undef"  ;;
17518         *)      d_u32align="$define" ;;
17519         esac
17520 fi
17521 $rm -f core core.try.* try.core
17522 ;;
17523 esac
17524
17525 : see if ualarm exists
17526 set ualarm d_ualarm
17527 eval $inlibc
17528
17529 : see if umask exists
17530 set umask d_umask
17531 eval $inlibc
17532
17533 : see if unordered exists
17534 set unordered d_unordered
17535 eval $inlibc
17536
17537 : see if unsetenv exists
17538 set unsetenv d_unsetenv
17539 eval $inlibc
17540
17541 : see if usleep exists
17542 set usleep d_usleep
17543 eval $inlibc
17544
17545 : see if prototype for usleep is available
17546 echo " "
17547 set d_usleepproto usleep $i_unistd unistd.h
17548 eval $hasproto
17549
17550 : see if ustat exists
17551 set ustat d_ustat
17552 eval $inlibc
17553
17554 : backward compatibility for d_hvfork
17555 if test X$d_hvfork != X; then
17556         d_vfork="$d_hvfork"
17557         d_hvfork=''
17558 fi
17559 : see if there is a vfork
17560 val=''
17561 set vfork val
17562 eval $inlibc
17563
17564 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17565 : perl on Solaris 2.x, and probably elsewhere.
17566 case "$val" in
17567 $define)
17568         echo " "
17569         case "$usevfork" in
17570         false) dflt='n';;
17571         *) dflt='y';;
17572         esac
17573         cat <<'EOM'
17574  
17575 Perl can only use a vfork() that doesn't suffer from strict
17576 restrictions on calling functions or modifying global data in
17577 the child.  For example, glibc-2.1 contains such a vfork()
17578 that is unsuitable.  If your system provides a proper fork()
17579 call, chances are that you do NOT want perl to use vfork().
17580
17581 EOM
17582         rp="Do you still want to use vfork()?"
17583         . ./myread
17584         case "$ans" in
17585         y|Y) ;;
17586         *)
17587                 echo "Ok, we won't use vfork()."
17588                 val="$undef"
17589                 ;;
17590         esac
17591         ;;
17592 esac
17593 set d_vfork
17594 eval $setvar
17595 case "$d_vfork" in
17596 $define) usevfork='true';;
17597 *) usevfork='false';;
17598 esac
17599
17600 : see if closedir exists
17601 set closedir d_closedir
17602 eval $inlibc
17603
17604 case "$d_closedir" in
17605 "$define")
17606         echo " "
17607         echo "Checking whether closedir() returns a status..." >&4
17608         cat > try.c <<EOM
17609 #$i_dirent I_DIRENT             /**/
17610 #$i_sysdir I_SYS_DIR            /**/
17611 #$i_sysndir I_SYS_NDIR          /**/
17612 #$i_systypes I_SYS_TYPES        /**/
17613
17614 #if defined(I_SYS_TYPES)
17615 #include <sys/types.h>
17616 #endif
17617 #if defined(I_DIRENT)
17618 #include <dirent.h>
17619 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17620 #include <sys/dir.h>
17621 #endif
17622 #else
17623 #ifdef I_SYS_NDIR
17624 #include <sys/ndir.h>
17625 #else
17626 #ifdef I_SYS_DIR
17627 #ifdef hp9000s500
17628 #include <ndir.h>       /* may be wrong in the future */
17629 #else
17630 #include <sys/dir.h>
17631 #endif
17632 #endif
17633 #endif
17634 #endif 
17635 int main() { return closedir(opendir(".")); }
17636 EOM
17637         set try
17638         if eval $compile_ok; then
17639                 if $run ./try > /dev/null 2>&1 ; then
17640                         echo "Yes, it does."
17641                         val="$undef"
17642                 else
17643                         echo "No, it doesn't."
17644                         val="$define"
17645                 fi
17646         else
17647                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17648                 val="$define"
17649         fi
17650         ;;
17651 *)
17652         val="$undef";
17653         ;;
17654 esac
17655 set d_void_closedir
17656 eval $setvar
17657 $rm -f try try.*
17658 : see if there is a wait4
17659 set wait4 d_wait4
17660 eval $inlibc
17661
17662 : see if waitpid exists
17663 set waitpid d_waitpid
17664 eval $inlibc
17665
17666 : see if wcstombs exists
17667 set wcstombs d_wcstombs
17668 eval $inlibc
17669
17670 : see if wctomb exists
17671 set wctomb d_wctomb
17672 eval $inlibc
17673
17674 : see if writev exists
17675 set writev d_writev
17676 eval $inlibc
17677
17678 : preserve RCS keywords in files with variable substitution, grrr
17679 Date='$Date'
17680 Id='$Id'
17681 Log='$Log'
17682 RCSfile='$RCSfile'
17683 Revision='$Revision'
17684
17685 : check for alignment requirements
17686 echo " "
17687 case "$usecrosscompile$multiarch" in
17688 *$define*)
17689         $cat <<EOM
17690 You seem to be either cross-compiling or doing a multiarchitecture build,
17691 skipping the memory alignment check.
17692
17693 EOM
17694         case "$alignbytes" in
17695         '') alignbytes=8 ;;
17696         esac
17697         ;;
17698 *)
17699         case "$alignbytes" in
17700         '') echo "Checking alignment constraints..." >&4
17701                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17702                         $cat >try.c <<'EOCP'
17703 typedef long double NV;
17704 EOCP
17705                 else
17706                         $cat >try.c <<'EOCP'
17707 typedef double NV;
17708 EOCP
17709                 fi
17710                 $cat >>try.c <<'EOCP'
17711 #include <stdio.h>
17712 struct foobar {
17713         char foo;
17714         NV bar;
17715 } try_algn;
17716 int main()
17717 {
17718     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17719     return(0);
17720 }
17721 EOCP
17722                 set try
17723                 if eval $compile_ok; then
17724                         dflt=`$run ./try`
17725                 else
17726                         dflt='8'
17727                         echo "(I can't seem to compile the test program...)"
17728                 fi
17729                 ;;
17730         *) dflt="$alignbytes"
17731                 ;;
17732         esac
17733         rp="Doubles must be aligned on a how-many-byte boundary?"
17734         . ./myread
17735         alignbytes="$ans"
17736         $rm -f try.c try
17737         ;;
17738 esac
17739
17740
17741 : set the base revision
17742 baserev=5.0
17743
17744 : how do we concatenate cpp tokens here?
17745 echo " "
17746 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17747 $cat >cpp_stuff.c <<'EOCP'
17748 #define RCAT(a,b)a/**/b
17749 #define ACAT(a,b)a ## b
17750 RCAT(Rei,ser)
17751 ACAT(Cir,cus)
17752 EOCP
17753 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17754 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17755         echo "Oh!  Smells like ANSI's been here." >&4
17756         echo "We can catify or stringify, separately or together!"
17757         cpp_stuff=42
17758 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17759         echo "Ah, yes!  The good old days!" >&4
17760         echo "However, in the good old days we don't know how to stringify and"
17761         echo "catify at the same time."
17762         cpp_stuff=1
17763 else
17764         $cat >&4 <<EOM
17765 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17766 You're going to have to edit the values of CAT[2-5] in config.h...
17767 EOM
17768         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17769 fi
17770 $rm -f cpp_stuff.*
17771
17772 : see if this is a db.h system
17773 set db.h i_db
17774 eval $inhdr
17775
17776 case "$i_db" in
17777 $define)
17778         : Check db version.
17779         echo " "
17780         echo "Checking Berkeley DB version ..." >&4
17781         $cat >try.c <<EOCP
17782 #$d_const HASCONST
17783 #ifndef HASCONST
17784 #define const
17785 #endif
17786 #include <sys/types.h>
17787 #include <stdio.h>
17788 #$i_stdlib I_STDLIB
17789 #ifdef I_STDLIB
17790 #include <stdlib.h>
17791 #endif
17792 #include <db.h>
17793 int main(int argc, char *argv[])
17794 {
17795 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17796     int Major, Minor, Patch ;
17797     unsigned long Version ;
17798     (void)db_version(&Major, &Minor, &Patch) ;
17799     if (argc == 2) {
17800         printf("%d %d %d %d %d %d\n",
17801                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17802                Major, Minor, Patch);
17803         exit(0);
17804     }
17805     printf("You have Berkeley DB Version 2 or greater.\n");
17806
17807     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17808                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17809     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17810                 Major, Minor, Patch) ;
17811
17812     /* check that db.h & libdb are compatible */
17813     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17814         printf("db.h and libdb are incompatible.\n") ;
17815         exit(3);        
17816     }
17817
17818     printf("db.h and libdb are compatible.\n") ;
17819
17820     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17821                 + DB_VERSION_PATCH ;
17822
17823     /* needs to be >= 2.3.4 */
17824     if (Version < 2003004) {
17825     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17826         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17827         exit(2);        
17828     }
17829
17830     exit(0);
17831 #else
17832 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17833     if (argc == 2) {
17834         printf("1 0 0\n");
17835         exit(0);
17836     }
17837     printf("You have Berkeley DB Version 1.\n");
17838     exit(0);    /* DB version < 2: the coast is clear. */
17839 #else
17840     exit(1);    /* <db.h> not Berkeley DB? */
17841 #endif
17842 #endif
17843 }
17844 EOCP
17845         set try
17846         if eval $compile_ok && $run ./try; then
17847                 echo 'Looks OK.' >&4
17848                 set `$run ./try 1`
17849                 db_version_major=$1
17850                 db_version_minor=$2
17851                 db_version_patch=$3
17852         else
17853                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17854                 i_db=$undef
17855                 case " $libs " in
17856                 *"-ldb "*)
17857                         : Remove db from list of libraries to use
17858                         echo "Removing unusable -ldb from library list" >&4
17859                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17860                         shift
17861                         libs="$*"
17862                         echo "libs = $libs" >&4
17863                         ;;
17864                 esac
17865         fi
17866         $rm -f try.*
17867         ;;
17868 esac
17869
17870 case "$i_db" in
17871 define)
17872         : Check the return type needed for hash 
17873         echo " "
17874         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17875         $cat >try.c <<EOCP
17876 #$d_const HASCONST
17877 #ifndef HASCONST
17878 #define const
17879 #endif
17880 #include <sys/types.h>
17881 #include <db.h>
17882
17883 #ifndef DB_VERSION_MAJOR
17884 u_int32_t hash_cb (ptr, size)
17885 const void *ptr;
17886 size_t size;
17887 {
17888 }
17889 HASHINFO info;
17890 int main()
17891 {
17892         info.hash = hash_cb;
17893 }
17894 #endif
17895 EOCP
17896         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17897                 if $contains warning try.out >>/dev/null 2>&1 ; then
17898                         db_hashtype='int'
17899                 else
17900                         db_hashtype='u_int32_t'
17901                 fi
17902         else
17903                 : XXX Maybe we should just give up here.
17904                 db_hashtype=u_int32_t
17905                 $cat try.out >&4
17906                 echo "Help:  I can't seem to compile the db test program." >&4
17907                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17908         fi
17909         $rm -f try.*
17910         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17911         ;;
17912 *)      db_hashtype=u_int32_t
17913         ;;
17914 esac
17915 case "$i_db" in
17916 define)
17917         : Check the return type needed for prefix 
17918         echo " "
17919         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17920         cat >try.c <<EOCP
17921 #$d_const HASCONST
17922 #ifndef HASCONST
17923 #define const
17924 #endif
17925 #include <sys/types.h>
17926 #include <db.h>
17927
17928 #ifndef DB_VERSION_MAJOR
17929 size_t prefix_cb (key1, key2)
17930 const DBT *key1;
17931 const DBT *key2;
17932 {
17933 }
17934 BTREEINFO info;
17935 int main()
17936 {
17937         info.prefix = prefix_cb;
17938 }
17939 #endif
17940 EOCP
17941         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17942                 if $contains warning try.out >>/dev/null 2>&1 ; then
17943                         db_prefixtype='int'
17944                 else
17945                         db_prefixtype='size_t'
17946                 fi
17947         else
17948                 db_prefixtype='size_t'
17949                 : XXX Maybe we should just give up here.
17950                 $cat try.out >&4
17951                 echo "Help:  I can't seem to compile the db test program." >&4
17952                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17953         fi
17954         $rm -f try.*
17955         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17956         ;;
17957 *)      db_prefixtype='size_t'
17958         ;;
17959 esac
17960
17961
17962 : How can we generate normalized random numbers ?
17963 echo " "
17964 echo "Looking for a random number function..." >&4
17965 case "$randfunc" in
17966 '')
17967         if set drand48 val -f; eval $csym; $val; then
17968                 dflt="drand48"
17969                 echo "Good, found drand48()." >&4
17970         elif set random val -f; eval $csym; $val; then
17971                 dflt="random"
17972                 echo "OK, found random()." >&4
17973         else
17974                 dflt="rand"
17975                 echo "Yick, looks like I have to use rand()." >&4
17976         fi
17977         echo " "
17978         ;;
17979 *)
17980         dflt="$randfunc"
17981         ;;
17982 esac
17983 cont=true
17984
17985 case "$ccflags" in
17986 *-Dmy_rand=*|*-Dmy_srand=*)
17987         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17988         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17989         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17990         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17991         ;;
17992 esac
17993
17994 while $test "$cont"; do
17995         rp="Use which function to generate random numbers?"
17996         . ./myread
17997         if $test "$ans" = "$dflt"; then
17998                 : null
17999         else
18000                 randbits=''
18001         fi
18002         randfunc="$ans"
18003         if set $ans val -f; eval $csym; $val; then
18004                 cont=''
18005         else
18006                 dflt=y
18007                 rp="I cannot find function $ans. Use that name anyway?"
18008                 . ./myread
18009                 dflt=rand
18010                 case "$ans" in
18011                         [yY]*) cont='';;
18012                 esac
18013         fi
18014         case "$cont" in
18015         '')
18016                 case "$randfunc" in
18017                 drand48)
18018                         drand01="drand48()"
18019                         seedfunc="srand48"
18020                         randbits=48
18021                         randseedtype=long
18022                         ;;
18023                 rand|random)
18024                         case "$randbits" in
18025                         '')
18026 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18027                                 $cat >try.c <<EOCP
18028 #$i_unistd I_UNISTD
18029 #$i_stdlib I_STDLIB
18030 #include <stdio.h>
18031 #ifdef I_UNISTD
18032 #  include <unistd.h>
18033 #endif
18034 #ifdef I_STDLIB
18035 #  include <stdlib.h>
18036 #endif
18037 int main()
18038 {
18039         register int i;
18040         register unsigned long tmp;
18041         register unsigned long max = 0L;
18042
18043         for (i = 1000; i; i--) {
18044                 tmp = (unsigned long) $randfunc();
18045                 if (tmp > max) max = tmp;
18046         }
18047         for (i = 0; max; i++)
18048                 max /= 2;
18049         printf("%d\n",i);
18050 }
18051 EOCP
18052                                 set try
18053                                 if eval $compile_ok; then
18054                                         dflt=`try`
18055                                 else
18056                                         dflt='?'
18057                                         echo "(I can't seem to compile the test program...)"
18058                                 fi
18059                                 ;;
18060                         *)
18061                                 dflt="$randbits"
18062                                 ;;
18063                         esac
18064                         rp="How many bits does your $randfunc() function produce?"
18065                         . ./myread
18066                         randbits="$ans"
18067                         $rm -f try.c try
18068                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18069                         seedfunc="s$randfunc"
18070                         randseedtype=unsigned
18071                         ;;
18072                 *)
18073                         dflt="31"
18074                         rp="How many bits does your $randfunc() function produce?"
18075                         . ./myread
18076                         randbits="$ans"
18077                         seedfunc="s$randfunc"
18078                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18079                         if set $seedfunc val -f; eval $csym; $val; then
18080                                 echo "(Using $seedfunc() to seed random generator)"
18081                         else
18082                                 echo "(Warning: no $seedfunc() to seed random generator)"
18083                                 seedfunc=rand
18084                         fi
18085                         randseedtype=unsigned
18086                         ;;
18087                 esac
18088                 ;;
18089         esac
18090 done
18091
18092 echo " "
18093 echo "Determining whether or not we are on an EBCDIC system..." >&4
18094 $cat >try.c <<'EOM'
18095 int main()
18096 {
18097   if ('M'==0xd4) return 0;
18098   return 1;
18099 }
18100 EOM
18101
18102 val=$undef
18103 set try
18104 if eval $compile_ok; then
18105         if $run ./try; then
18106                 echo "You seem to speak EBCDIC." >&4
18107                 val="$define"
18108         else
18109                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18110         fi
18111 else
18112         echo "I'm unable to compile the test program." >&4
18113         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18114 fi
18115 $rm -f try try.*
18116 set ebcdic
18117 eval $setvar
18118
18119 echo " "
18120 $cat >&4 <<EOM
18121 Checking how to flush all pending stdio output...
18122 EOM
18123 # I only know how to find the first 32 possibly open files on SunOS.
18124 # See also hints/sunos_4_1.sh and util.c  --AD
18125 case "$osname" in
18126 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18127 esac
18128 $cat >>try.c <<EOCP
18129 #include <stdio.h>
18130 #$i_stdlib I_STDLIB
18131 #ifdef I_STDLIB
18132 #include <stdlib.h>
18133 #endif
18134 #$i_unistd I_UNISTD
18135 #ifdef I_UNISTD
18136 # include <unistd.h>
18137 #endif
18138 #$d_sysconf HAS_SYSCONF
18139 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18140 #ifdef HAS_STDIO_STREAM_ARRAY
18141 # define STDIO_STREAM_ARRAY $stdio_stream_array
18142 #endif
18143 int main() {
18144   FILE* p;
18145   unlink("try.out");
18146   p = fopen("try.out", "w");
18147 #ifdef TRY_FPUTC
18148   fputc('x', p);
18149 #else
18150 # ifdef TRY_FPRINTF
18151   fprintf(p, "x");
18152 # endif
18153 #endif
18154 #ifdef TRY_FFLUSH_NULL
18155   fflush(NULL);
18156 #endif
18157 #ifdef TRY_FFLUSH_ALL
18158   {
18159     long open_max = -1;
18160 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18161     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18162 # else
18163 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18164     open_max = sysconf(_SC_OPEN_MAX);
18165 #  else
18166 #   ifdef FOPEN_MAX
18167     open_max = FOPEN_MAX;
18168 #   else
18169 #    ifdef OPEN_MAX
18170     open_max = OPEN_MAX;
18171 #    else
18172 #     ifdef _NFILE
18173     open_max = _NFILE;
18174 #     endif
18175 #    endif
18176 #   endif
18177 #  endif
18178 # endif 
18179 # ifdef HAS_STDIO_STREAM_ARRAY
18180     if (open_max > 0) {
18181       long i;
18182       for (i = 0; i < open_max; i++)
18183             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18184                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18185                 STDIO_STREAM_ARRAY[i]._flag)
18186                 fflush(&STDIO_STREAM_ARRAY[i]);
18187     }   
18188   }
18189 # endif
18190 #endif
18191   _exit(42);
18192 }
18193 EOCP
18194 : first we have to find out how _not_ to flush
18195 $to try.c
18196 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18197     output=''
18198     set try -DTRY_FPUTC
18199     if eval $compile; then
18200             $run ./try 2>/dev/null
18201             code="$?"
18202             $from try.out
18203             if $test ! -s try.out -a "X$code" = X42; then
18204                 output=-DTRY_FPUTC
18205             fi
18206     fi
18207     case "$output" in
18208     '')
18209             set try -DTRY_FPRINTF
18210             if eval $compile; then
18211                     $run ./try 2>/dev/null
18212                     code="$?"
18213                     $from try.out
18214                     if $test ! -s try.out -a "X$code" = X42; then
18215                         output=-DTRY_FPRINTF
18216                     fi
18217             fi
18218         ;;
18219     esac
18220 fi
18221 : check for fflush NULL behaviour
18222 case "$fflushNULL" in
18223 '')     set try -DTRY_FFLUSH_NULL $output
18224         if eval $compile; then
18225                 $run ./try 2>/dev/null
18226                 code="$?"
18227                 $from try.out
18228                 if $test -s try.out -a "X$code" = X42; then
18229                         fflushNULL="`$cat try.out`"
18230                 else
18231                         if $test "X$code" != X42; then
18232                                 $cat >&4 <<EOM
18233 (If this test failed, don't worry, we'll try another method shortly.)
18234 EOM
18235                         fi
18236                 fi
18237         fi
18238         $rm -f core try.core core.try.*
18239         case "$fflushNULL" in
18240         x)      $cat >&4 <<EOM
18241 Your fflush(NULL) works okay for output streams.
18242 Let's see if it clobbers input pipes...
18243 EOM
18244 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18245 # bug that improperly flushes the input end of pipes.  So we avoid the
18246 # autoflush on fork/system/exec support for now. :-(
18247 $cat >tryp.c <<EOCP
18248 #include <stdio.h>
18249 int
18250 main(int argc, char **argv)
18251 {
18252     char buf[1024];
18253     int i;
18254     char *bp = buf;
18255     while (1) {
18256         while ((i = getc(stdin)) != -1
18257                && (*bp++ = i) != '\n'
18258                && bp < &buf[1024])
18259         /* DO NOTHING */ ;
18260         *bp = '\0';
18261         fprintf(stdout, "%s", buf);
18262         fflush(NULL);
18263         if (i == -1)
18264             return 0;
18265         bp = buf;
18266     }
18267 }
18268 EOCP
18269                 fflushNULL="$define"
18270                 set tryp
18271                 if eval $compile; then
18272                     $rm -f tryp.out
18273                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18274                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18275                        $cat >&4 <<EOM
18276 fflush(NULL) seems to behave okay with input streams.
18277 EOM
18278                         fflushNULL="$define"
18279                     else
18280                         $cat >&4 <<EOM
18281 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18282 EOM
18283                         fflushNULL="$undef"
18284                     fi
18285                 fi
18286                 $rm -f core tryp.c tryp.core core.tryp.*
18287                 ;;
18288         '')     $cat >&4 <<EOM
18289 Your fflush(NULL) isn't working (contrary to ANSI C).
18290 EOM
18291                 fflushNULL="$undef"
18292                 ;;
18293         *)      $cat >&4 <<EOM
18294 Cannot figure out whether your fflush(NULL) works or not.
18295 I'm assuming it doesn't (contrary to ANSI C).
18296 EOM
18297                 fflushNULL="$undef"
18298                 ;;
18299         esac
18300         ;;
18301 $define|true|[yY]*)
18302         fflushNULL="$define"
18303         ;;
18304 *)
18305         fflushNULL="$undef"
18306         ;;
18307 esac
18308 : check explicit looping only if NULL did not work, and if the pipe
18309 : bug does not show up on an explicit flush too
18310 case "$fflushNULL" in
18311 "$undef")
18312         $cat >tryp.c <<EOCP
18313 #include <stdio.h>
18314 int
18315 main(int argc, char **argv)
18316 {
18317     char buf[1024];
18318     int i;
18319     char *bp = buf;
18320     while (1) {
18321         while ((i = getc(stdin)) != -1
18322                && (*bp++ = i) != '\n'
18323                && bp < &buf[1024])
18324         /* DO NOTHING */ ;
18325         *bp = '\0';
18326         fprintf(stdout, "%s", buf);
18327         fflush(stdin);
18328         if (i == -1)
18329             return 0;
18330         bp = buf;
18331     }
18332 }
18333 EOCP
18334         set tryp
18335         if eval $compile; then
18336             $rm -f tryp.out
18337             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18338             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18339                $cat >&4 <<EOM
18340 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18341 EOM
18342                 : now check for fflushall behaviour
18343                 case "$fflushall" in
18344                 '')     set try -DTRY_FFLUSH_ALL $output
18345                         if eval $compile; then
18346                                 $cat >&4 <<EOM
18347 (Now testing the other method--but note that this also may fail.)
18348 EOM
18349                                 $run ./try 2>/dev/null
18350                                 code=$?
18351                                 $from try.out
18352                                 if $test -s try.out -a "X$code" = X42; then
18353                                         fflushall="`$cat try.out`"
18354                                 fi
18355                         fi
18356                         $rm -f core try.core core.try.*
18357                         case "$fflushall" in
18358                         x)      $cat >&4 <<EOM
18359 Whew. Flushing explicitly all the stdio streams works.
18360 EOM
18361                                 fflushall="$define"
18362                                 ;;
18363                         '')     $cat >&4 <<EOM
18364 Sigh. Flushing explicitly all the stdio streams doesn't work.
18365 EOM
18366                                 fflushall="$undef"
18367                                 ;;
18368                         *)      $cat >&4 <<EOM
18369 Cannot figure out whether flushing stdio streams explicitly works or not.
18370 I'm assuming it doesn't.
18371 EOM
18372                                 fflushall="$undef"
18373                                 ;;
18374                         esac
18375                         ;;
18376                 "$define"|true|[yY]*)
18377                         fflushall="$define"
18378                         ;;
18379                 *)
18380                         fflushall="$undef"
18381                         ;;
18382                 esac
18383             else
18384                 $cat >&4 <<EOM
18385 All is futile.  Even fflush(stdin) clobbers input pipes!
18386 EOM
18387                 fflushall="$undef"
18388             fi
18389         else
18390             fflushall="$undef"
18391         fi
18392         $rm -f core tryp.c tryp.core core.tryp.*
18393         ;;
18394 *)      fflushall="$undef"
18395         ;;
18396 esac
18397
18398 case "$fflushNULL$fflushall" in
18399 undefundef)
18400         $cat <<EOM
18401 OK, I give up.  I cannot figure out how to flush pending stdio output.
18402 We won't be flushing handles at all before fork/exec/popen.
18403 EOM
18404         ;;
18405 esac
18406 $rm -f try.* try$exe_ext
18407
18408 : Store the full pathname to the ar program for use in the C program
18409 : Respect a hint or command line value for full_ar.
18410 case "$full_ar" in
18411 '') full_ar=$ar ;;
18412 esac
18413
18414 : Store the full pathname to the sed program for use in the C program
18415 full_sed=$sed
18416
18417 : see what type gids are declared as in the kernel
18418 echo " "
18419 echo "Looking for the type for group ids returned by getgid()."
18420 set gid_t gidtype xxx stdio.h sys/types.h
18421 eval $typedef
18422 case "$gidtype" in
18423 xxx)
18424         xxx=`./findhdr sys/user.h`
18425         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18426         case $1 in
18427         unsigned) dflt="$1 $2" ;;
18428         *) dflt="$1" ;;
18429         esac
18430         ;;
18431 *) dflt="$gidtype";;
18432 esac
18433 case "$gidtype" in
18434 gid_t) echo "gid_t found." ;;
18435 *)      rp="What is the type for group ids returned by getgid()?"
18436         . ./myread
18437         gidtype="$ans"
18438         ;;
18439 esac
18440
18441 echo " "
18442 case "$gidtype" in
18443 *_t) zzz="$gidtype"     ;;
18444 *)   zzz="gid"          ;;
18445 esac
18446 echo "Checking the size of $zzz..." >&4 
18447 cat > try.c <<EOCP
18448 #include <sys/types.h>
18449 #include <stdio.h>
18450 #$i_stdlib I_STDLIB
18451 #ifdef I_STDLIB
18452 #include <stdlib.h>
18453 #endif
18454 int main() {
18455     printf("%d\n", (int)sizeof($gidtype));
18456     exit(0);
18457 }
18458 EOCP
18459 set try
18460 if eval $compile_ok; then
18461         yyy=`$run ./try`
18462         case "$yyy" in
18463         '')     gidsize=4
18464                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18465                 ;;
18466         *)      gidsize=$yyy
18467                 echo "Your $zzz is $gidsize bytes long."
18468                 ;;
18469         esac
18470 else
18471         gidsize=4
18472         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18473 fi
18474
18475
18476 echo " "
18477 case "$gidtype" in
18478 *_t) zzz="$gidtype"     ;;
18479 *)   zzz="gid"          ;;
18480 esac
18481 echo "Checking the sign of $zzz..." >&4 
18482 cat > try.c <<EOCP
18483 #include <sys/types.h>
18484 #include <stdio.h>
18485 int main() {
18486         $gidtype foo = -1;
18487         if (foo < 0)
18488                 printf("-1\n");
18489         else
18490                 printf("1\n");
18491 }
18492 EOCP
18493 set try
18494 if eval $compile; then
18495         yyy=`$run ./try`
18496         case "$yyy" in
18497         '')     gidsign=1
18498                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18499                 ;;
18500         *)      gidsign=$yyy
18501                 case "$gidsign" in
18502                  1) echo "Your $zzz is unsigned." ;;
18503                 -1) echo "Your $zzz is signed."   ;;
18504                 esac
18505                 ;;
18506         esac
18507 else
18508         gidsign=1
18509         echo "(I can't compile the test program--guessing unsigned.)" >&4
18510 fi
18511
18512
18513 echo " "
18514
18515 if $test X"$quadtype" != X; then
18516
18517 echo "Checking how to print 64-bit integers..." >&4
18518
18519 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18520         $cat >try.c <<'EOCP'
18521 #include <sys/types.h>
18522 #include <stdio.h>
18523 int main() {
18524   int q = 12345678901;
18525   printf("%ld\n", q);
18526 }
18527 EOCP
18528         set try
18529         if eval $compile; then
18530                 yyy=`$run ./try`
18531                 case "$yyy" in
18532                 12345678901)
18533                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18534                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18535                         echo "We will use %d."
18536                         ;;
18537                 esac
18538         fi
18539 fi
18540
18541 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18542         $cat >try.c <<'EOCP'
18543 #include <sys/types.h>
18544 #include <stdio.h>
18545 int main() {
18546   long q = 12345678901;
18547   printf("%ld\n", q);
18548 }
18549 EOCP
18550         set try
18551         if eval $compile; then
18552                 yyy=`$run ./try`
18553                 case "$yyy" in
18554                 12345678901)
18555                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18556                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18557                         echo "We will use %ld."
18558                         ;;
18559                 esac
18560         fi
18561 fi
18562
18563 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18564         $cat >try.c <<'EOCP'
18565 #include <sys/types.h>
18566 #include <inttypes.h>
18567 #include <stdio.h>
18568 int main() {
18569   int64_t q = 12345678901;
18570   printf("%" PRId64 "\n", q);
18571 }
18572 EOCP
18573         set try
18574         if eval $compile; then
18575                 yyy=`$run ./try`
18576                 case "$yyy" in
18577                 12345678901)
18578                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18579                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18580                         echo "We will use the C9X style."
18581                         ;;
18582                 esac
18583         fi
18584 fi
18585
18586 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18587         $cat >try.c <<EOCP
18588 #include <sys/types.h>
18589 #include <stdio.h>
18590 int main() {
18591   $quadtype q = 12345678901;
18592   printf("%Ld\n", q);
18593 }
18594 EOCP
18595         set try
18596         if eval $compile; then
18597                 yyy=`$run ./try`
18598                 case "$yyy" in
18599                 12345678901)
18600                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18601                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18602                         echo "We will use %Ld."
18603                         ;;
18604                 esac
18605         fi
18606 fi
18607
18608 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18609         $cat >try.c <<'EOCP'
18610 #include <sys/types.h>
18611 #include <stdio.h>
18612 int main() {
18613   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18614   printf("%lld\n", q);
18615 }
18616 EOCP
18617         set try
18618         if eval $compile; then
18619                 yyy=`$run ./try`
18620                 case "$yyy" in
18621                 12345678901)
18622                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18623                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18624                         echo "We will use the %lld style."
18625                         ;;
18626                 esac
18627         fi
18628 fi
18629
18630 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18631         $cat >try.c <<EOCP
18632 #include <sys/types.h>
18633 #include <stdio.h>
18634 int main() {
18635   $quadtype q = 12345678901;
18636   printf("%qd\n", q);
18637 }
18638 EOCP
18639         set try
18640         if eval $compile; then
18641                 yyy=`$run ./try`
18642                 case "$yyy" in
18643                 12345678901)
18644                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18645                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18646                         echo "We will use %qd."
18647                         ;;
18648                 esac
18649         fi
18650 fi
18651
18652 if $test X"$sPRId64" = X; then
18653         echo "Cannot figure out how to print 64-bit integers." >&4
18654 fi
18655
18656 $rm -f try try.*
18657
18658 fi
18659
18660 case "$sPRId64" in
18661 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18662         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18663         ;;
18664 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18665         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18666         ;;
18667 esac
18668
18669
18670 echo " "
18671 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18672
18673 if $test X"$ivsize" = X8; then
18674         ivdformat="$sPRId64"
18675         uvuformat="$sPRIu64"
18676         uvoformat="$sPRIo64"
18677         uvxformat="$sPRIx64"
18678         uvXUformat="$sPRIXU64"
18679 else
18680         if $test X"$ivsize" = X"$longsize"; then
18681                 ivdformat='"ld"'
18682                 uvuformat='"lu"'
18683                 uvoformat='"lo"'
18684                 uvxformat='"lx"'
18685                 uvXUformat='"lX"'
18686         else
18687                 if $test X"$ivsize" = X"$intsize"; then
18688                         ivdformat='"d"'
18689                         uvuformat='"u"'
18690                         uvoformat='"o"'
18691                         uvxformat='"x"'
18692                         uvXUformat='"X"'
18693                 else
18694                         : far out
18695                         if $test X"$ivsize" = X"$shortsize"; then
18696                                 ivdformat='"hd"'
18697                                 uvuformat='"hu"'
18698                                 uvoformat='"ho"'
18699                                 uvxformat='"hx"'
18700                                 uvXUformat='"hX"'
18701                         fi
18702                 fi
18703         fi
18704 fi
18705
18706 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18707         nveformat="$sPRIeldbl"
18708         nvfformat="$sPRIfldbl"
18709         nvgformat="$sPRIgldbl"
18710         nvEUformat="$sPRIEUldbl"
18711         nvFUformat="$sPRIFUldbl"
18712         nvGUformat="$sPRIGUldbl"
18713 else
18714         nveformat='"e"'
18715         nvfformat='"f"'
18716         nvgformat='"g"'
18717         nvEUformat='"E"'
18718         nvFUformat='"F"'
18719         nvGUformat='"G"'
18720 fi
18721
18722 case "$ivdformat" in
18723 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18724     exit 1
18725     ;;
18726 esac
18727
18728
18729 echo " "
18730 $echo "Checking the format string to be used for gids..." >&4
18731
18732 case "$gidsign" in
18733 -1)     if $test X"$gidsize" = X"$ivsize"; then
18734                 gidformat="$ivdformat"
18735         else
18736                 if $test X"$gidsize" = X"$longsize"; then
18737                         gidformat='"ld"'
18738                 else
18739                         if $test X"$gidsize" = X"$intsize"; then
18740                                 gidformat='"d"'
18741                         else
18742                                 if $test X"$gidsize" = X"$shortsize"; then
18743                                         gidformat='"hd"'
18744                                 fi
18745                         fi
18746                 fi
18747         fi
18748         ;;
18749 *)      if $test X"$gidsize" = X"$uvsize"; then
18750                 gidformat="$uvuformat"
18751         else
18752                 if $test X"$gidsize" = X"$longsize"; then
18753                         gidformat='"lu"'
18754                 else
18755                         if $test X"$gidsize" = X"$intsize"; then
18756                                 gidformat='"u"'
18757                         else
18758                                 if $test X"$gidsize" = X"$shortsize"; then
18759                                         gidformat='"hu"'
18760                                 fi
18761                         fi
18762                 fi
18763         fi
18764         ;;
18765 esac
18766
18767 : see if getgroups exists
18768 set getgroups d_getgrps
18769 eval $inlibc
18770
18771 : see if setgroups exists
18772 set setgroups d_setgrps
18773 eval $inlibc
18774
18775
18776 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18777 echo " "
18778 case "$d_getgrps$d_setgrps" in
18779 *define*)
18780         case "$groupstype" in
18781         '') dflt="$gidtype" ;;
18782         *)  dflt="$groupstype" ;;
18783         esac
18784         $cat <<EOM
18785 What type of pointer is the second argument to getgroups() and setgroups()?
18786 Usually this is the same as group ids, $gidtype, but not always.
18787
18788 EOM
18789         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18790         . ./myread
18791         groupstype="$ans"
18792         ;;
18793 *)  groupstype="$gidtype";;
18794 esac
18795
18796 echo " "
18797 echo "Checking if your $make program sets \$(MAKE)..." >&4
18798 case "$make_set_make" in
18799 '')
18800         $sed 's/^X //' > testmake.mak << 'EOF'
18801 Xall:
18802 X       @echo 'maketemp="$(MAKE)"'
18803 EOF
18804         case "`$make -f testmake.mak 2>/dev/null`" in
18805         *maketemp=*) make_set_make='#' ;;
18806         *)      make_set_make="MAKE=$make" ;;
18807         esac
18808         $rm -f testmake.mak
18809         ;;
18810 esac
18811 case "$make_set_make" in
18812 '#') echo "Yup, it does.";;
18813 *) echo "Nope, it doesn't.";;
18814 esac
18815
18816 : see what type is used for mode_t
18817 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18818 set mode_t modetype int stdio.h sys/types.h
18819 eval $typedef_ask
18820
18821 : see if stdarg is available
18822 echo " "
18823 if $test `./findhdr stdarg.h`; then
18824         echo "<stdarg.h> found." >&4
18825         valstd="$define"
18826 else
18827         echo "<stdarg.h> NOT found." >&4
18828         valstd="$undef"
18829 fi
18830
18831 : see if varags is available
18832 echo " "
18833 if $test `./findhdr varargs.h`; then
18834         echo "<varargs.h> found." >&4
18835 else
18836         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18837 fi
18838
18839 : set up the varargs testing programs
18840 $cat > varargs.c <<EOP
18841 #ifdef I_STDARG
18842 #include <stdarg.h>
18843 #endif
18844 #ifdef I_VARARGS
18845 #include <varargs.h>
18846 #endif
18847
18848 #ifdef I_STDARG
18849 int f(char *p, ...)
18850 #else
18851 int f(va_alist)
18852 va_dcl
18853 #endif
18854 {
18855         va_list ap;
18856 #ifndef I_STDARG
18857         char *p;
18858 #endif
18859 #ifdef I_STDARG
18860         va_start(ap,p);
18861 #else
18862         va_start(ap);
18863         p = va_arg(ap, char *);
18864 #endif
18865         va_end(ap);
18866 }
18867 EOP
18868 $cat > varargs <<EOP
18869 $startsh
18870 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18871         echo "true"
18872 else
18873         echo "false"
18874 fi
18875 $rm -f varargs$_o
18876 EOP
18877 chmod +x varargs
18878
18879 : now check which varargs header should be included
18880 echo " "
18881 i_varhdr=''
18882 case "$valstd" in
18883 "$define")
18884         if `./varargs I_STDARG`; then
18885                 val='stdarg.h'
18886         elif `./varargs I_VARARGS`; then
18887                 val='varargs.h'
18888         fi
18889         ;;
18890 *)
18891         if `./varargs I_VARARGS`; then
18892                 val='varargs.h'
18893         fi
18894         ;;
18895 esac
18896 case "$val" in
18897 '')
18898 echo "I could not find the definition for va_dcl... You have problems..." >&4
18899         val="$undef"; set i_stdarg; eval $setvar
18900         val="$undef"; set i_varargs; eval $setvar
18901         ;;
18902 *) 
18903         set i_varhdr
18904         eval $setvar
18905         case "$i_varhdr" in
18906         stdarg.h)
18907                 val="$define"; set i_stdarg; eval $setvar
18908                 val="$undef"; set i_varargs; eval $setvar
18909                 ;;
18910         varargs.h)
18911                 val="$undef"; set i_stdarg; eval $setvar
18912                 val="$define"; set i_varargs; eval $setvar
18913                 ;;
18914         esac
18915         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18916 esac
18917 $rm -f varargs*
18918
18919 : see if we need va_copy
18920 echo " "
18921 case "$i_stdarg" in
18922 "$define")
18923         $cat >try.c <<EOCP
18924 #include <stdarg.h>
18925 #include <stdio.h>
18926 #$i_stdlib I_STDLIB
18927 #ifdef I_STDLIB
18928 #include <stdlib.h>
18929 #endif
18930 #include <signal.h>
18931
18932 int
18933 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18934 {
18935   return vfprintf(f, fmt, *valp);
18936 }
18937  
18938 int    
18939 myvfprintf(FILE *f, const  char *fmt, va_list val)
18940 {
18941   return ivfprintf(f, fmt, &val);
18942 }
18943       
18944 int
18945 myprintf(char *fmt, ...) 
18946 {
18947   va_list val;
18948   va_start(val, fmt);
18949   return myvfprintf(stdout, fmt, val); 
18950 }         
18951
18952 int
18953 main(int ac, char **av)
18954 {
18955   signal(SIGSEGV, exit);
18956
18957   myprintf("%s%cs all right, then\n", "that", '\'');                            
18958   exit(0);      
18959 }
18960 EOCP
18961         set try
18962         if eval $compile && $run ./try 2>&1 >/dev/null; then
18963                 case "`$run ./try`" in
18964                 "that's all right, then")
18965                         okay=yes
18966                         ;;
18967                 esac
18968         fi
18969         case "$okay" in
18970         yes)    echo "It seems that you don't need va_copy()." >&4
18971                 need_va_copy="$undef"
18972                 ;;
18973         *)      echo "It seems that va_copy() or similar will be needed." >&4
18974                 need_va_copy="$define"
18975                 ;;
18976         esac
18977         $rm -f try.* core core.* *.core *.core.*
18978         ;;
18979 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18980         ;;
18981 esac
18982
18983 : see what type is used for size_t
18984 rp="What is the type used for the length parameter for string functions?"
18985 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18986 eval $typedef_ask
18987
18988 : check for type of arguments to gethostbyaddr. 
18989 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18990         case "$d_gethbyaddr" in
18991         $define)
18992                 $cat <<EOM
18993
18994 Checking to see what type of arguments are accepted by gethostbyaddr().
18995 EOM
18996                 hdrs="$define sys/types.h
18997                         $d_socket sys/socket.h 
18998                         $i_niin netinet/in.h 
18999                         $i_netdb netdb.h
19000                         $i_unistd unistd.h"
19001                 : The first arg can 'char *' or 'void *'
19002                 : The second arg is some of integral type
19003                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19004                         for yyy in size_t long int; do
19005                                 case "$netdb_host_type" in
19006                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19007                                         if ./protochk "$try" $hdrs; then
19008                                                 echo "Your system accepts $xxx for the first arg."
19009                                                 echo "...and $yyy for the second arg."
19010                                                 netdb_host_type="$xxx"
19011                                                 netdb_hlen_type="$yyy"
19012                                         fi
19013                                         ;;
19014                                 esac
19015                         done
19016                 done
19017                 : In case none of those worked, prompt the user.
19018                 case "$netdb_host_type" in
19019                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19020                         dflt='char *'
19021                         . ./myread
19022                         netdb_host_type=$ans
19023                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19024                         dflt="$sizetype"
19025                         . ./myread
19026                         netdb_hlen_type=$ans
19027                         ;;
19028                 esac
19029                 ;;
19030         *)      : no gethostbyaddr, so pick harmless defaults
19031                 netdb_host_type='char *'
19032                 netdb_hlen_type="$sizetype"
19033                 ;;
19034         esac
19035         # Remove the "const" if needed. -- but then we'll have a 
19036         # prototype clash!
19037         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19038 fi
19039
19040 : check for type of argument to gethostbyname. 
19041 if test "X$netdb_name_type" = X ; then
19042         case "$d_gethbyname" in
19043         $define)
19044                 $cat <<EOM
19045
19046 Checking to see what type of argument is accepted by gethostbyname().
19047 EOM
19048                 hdrs="$define sys/types.h
19049                         $d_socket sys/socket.h 
19050                         $i_niin netinet/in.h 
19051                         $i_netdb netdb.h
19052                         $i_unistd unistd.h"
19053                 for xxx in "const char *" "char *"; do
19054                         case "$netdb_name_type" in
19055                         '')     try="extern struct hostent *gethostbyname($xxx);"
19056                                 if ./protochk "$try" $hdrs; then
19057                                         echo "Your system accepts $xxx."
19058                                         netdb_name_type="$xxx"
19059                                 fi
19060                                 ;;
19061                         esac
19062                 done
19063                 : In case none of those worked, prompt the user.
19064                 case "$netdb_name_type" in
19065                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19066                         dflt='char *'
19067                         . ./myread
19068                         netdb_name_type=$ans
19069                         ;;
19070                 esac
19071                 ;;
19072         *)      : no gethostbyname, so pick harmless default
19073                 netdb_name_type='char *'
19074                 ;;
19075         esac
19076 fi
19077
19078 : check for type of 1st argument to getnetbyaddr. 
19079 if test "X$netdb_net_type" = X ; then
19080         case "$d_getnbyaddr" in
19081         $define)
19082                 $cat <<EOM
19083
19084 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19085 EOM
19086                 hdrs="$define sys/types.h
19087                         $d_socket sys/socket.h 
19088                         $i_niin netinet/in.h 
19089                         $i_netdb netdb.h
19090                         $i_unistd unistd.h"
19091                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19092                         case "$netdb_net_type" in
19093                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19094                                 if ./protochk "$try" $hdrs; then
19095                                         echo "Your system accepts $xxx."
19096                                         netdb_net_type="$xxx"
19097                                 fi
19098                                 ;;
19099                         esac
19100                 done
19101                 : In case none of those worked, prompt the user.
19102                 case "$netdb_net_type" in
19103                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19104                         dflt='long'
19105                         . ./myread
19106                         netdb_net_type=$ans
19107                         ;;
19108                 esac
19109                 ;;
19110         *)      : no getnetbyaddr, so pick harmless default
19111                 netdb_net_type='long'
19112                 ;;
19113         esac
19114 fi
19115 : locate the preferred pager for this system
19116 fn=f/
19117 case "$pager" in
19118 '')
19119         dflt=''
19120         case "$pg" in
19121         /*) dflt=$pg;;
19122         [a-zA-Z]:/*) dflt=$pg;;
19123         esac
19124         case "$more" in
19125         /*) dflt=$more;;
19126         [a-zA-Z]:/*) dflt=$more;;
19127         esac
19128         case "$less" in
19129         /*) dflt=$less;;
19130         [a-zA-Z]:/*) dflt=$less;;
19131         esac
19132         case "$dflt" in
19133         '') dflt=/usr/ucb/more;;
19134         esac
19135         ;;
19136 *)      dflt="$pager"
19137         : Instruct ./getfile to trust the hinted or previous pager value,
19138         : even if it does not begin with a slash.  For example, on os2,
19139         : pager might be cmd /c more.  See comments in UU/getfile.
19140         fn="f/($pager)"
19141         ;;
19142 esac
19143 echo " "
19144 rp='What pager is used on your system?'
19145 . ./getfile
19146 pager="$ans"
19147
19148 : see what type pids are declared as in the kernel
19149 rp="What is the type of process ids on this system?"
19150 set pid_t pidtype int stdio.h sys/types.h
19151 eval $typedef_ask
19152
19153 : see if ar generates random libraries by itself
19154 echo " "
19155 echo "Checking how to generate random libraries on your machine..." >&4
19156 echo 'int bar1() { return bar2(); }' > bar1.c
19157 echo 'int bar2() { return 2; }' > bar2.c
19158 $cat > foo.c <<EOP
19159 #$i_stdlib I_STDLIB
19160 #ifdef I_STDLIB
19161 #include <stdlib.h>
19162 #endif
19163 int main() { printf("%d\n", bar1()); exit(0); }
19164 EOP
19165 $cc $ccflags -c bar1.c >/dev/null 2>&1
19166 $cc $ccflags -c bar2.c >/dev/null 2>&1
19167 $cc $ccflags -c foo.c >/dev/null 2>&1
19168 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19169 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19170         $run ./foobar >/dev/null 2>&1; then
19171         echo "$ar appears to generate random libraries itself."
19172         orderlib=false
19173         if [ "X$ranlib" = "X" ]; then
19174             ranlib=":"
19175         fi
19176 elif $ar ts bar$_a >/dev/null 2>&1 &&
19177         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19178         $run ./foobar >/dev/null 2>&1; then
19179                 echo "a table of contents needs to be added with '$ar ts'."
19180                 orderlib=false
19181                 ranlib="$ar ts"
19182 else
19183         case "$ranlib" in
19184         :) ranlib='';;
19185         '')
19186                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19187                 $test -f $ranlib || ranlib=''
19188                 ;;
19189         esac
19190         if $test -n "$ranlib"; then
19191                 echo "your system has '$ranlib'; we'll use that."
19192                 orderlib=false
19193         else
19194                 echo "your system doesn't seem to support random libraries"
19195                 echo "so we'll use lorder and tsort to order the libraries."
19196                 orderlib=true
19197                 ranlib=":"
19198         fi
19199 fi
19200 $rm -f foo* bar* 
19201
19202 : check for type of arguments to select. 
19203 case "$selecttype" in
19204 '') case "$d_select" in
19205         $define)
19206                 echo " "
19207                 $cat <<EOM
19208 Checking to see what type of arguments are accepted by select().
19209 EOM
19210                 hdrs="$define sys/types.h
19211                         $i_systime sys/time.h 
19212                         $i_sysselct sys/select.h
19213                         $d_socket sys/socket.h"
19214                 : The first arg can be int, unsigned, or size_t
19215                 : The last arg may or may not be 'const'
19216                 val=''
19217                 : void pointer has been seen but using that
19218                 : breaks the selectminbits test
19219                 for xxx in 'fd_set *' 'int *'; do
19220                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19221                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19222                                         case "$val" in
19223                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19224                                                 if ./protochk "$try" $hdrs; then
19225                                                         echo "Your system accepts $xxx."
19226                                                         val="$xxx"
19227                                                 fi
19228                                                 ;;
19229                                         esac
19230                                 done
19231                         done
19232                 done
19233                 case "$val" in
19234                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19235                         case "$d_fd_set" in
19236                                 $define) dflt="fd_set *" ;;
19237                                 *)              dflt="int *" ;;
19238                         esac
19239                         . ./myread
19240                         val=$ans
19241                         ;;
19242                 esac
19243                 selecttype="$val"
19244                 ;;
19245         *)      : no select, so pick a harmless default
19246                 selecttype='int *'
19247                 ;;
19248         esac
19249         ;;
19250 esac
19251
19252 : check for the select 'width'
19253 case "$selectminbits" in
19254 '') safebits=`expr $ptrsize \* 8`
19255     case "$d_select" in
19256         $define)
19257                 $cat <<EOM
19258
19259 Checking to see on how many bits at a time your select() operates...
19260 EOM
19261                 $cat >try.c <<EOCP
19262 #include <sys/types.h>
19263 #$i_time I_TIME
19264 #$i_systime I_SYS_TIME
19265 #$i_systimek I_SYS_TIME_KERNEL
19266 #ifdef I_TIME
19267 #   include <time.h>
19268 #endif
19269 #ifdef I_SYS_TIME
19270 #   ifdef I_SYS_TIME_KERNEL
19271 #       define KERNEL
19272 #   endif
19273 #   include <sys/time.h>
19274 #   ifdef I_SYS_TIME_KERNEL
19275 #       undef KERNEL
19276 #   endif
19277 #endif
19278 #$i_sysselct I_SYS_SELECT
19279 #ifdef I_SYS_SELECT
19280 #include <sys/select.h>
19281 #endif
19282 #$d_socket HAS_SOCKET
19283 #ifdef HAS_SOCKET
19284 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19285 #endif
19286 #include <stdio.h>
19287 #$i_stdlib I_STDLIB
19288 #ifdef I_STDLIB
19289 #include <stdlib.h>
19290 #endif
19291 $selecttype b;
19292 #define S sizeof(*(b))
19293 #define MINBITS 64
19294 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19295 #define NBITS  (NBYTES * 8)
19296 int main() {
19297     char *s = malloc(NBYTES);
19298     struct timeval t;
19299     int i;
19300     FILE* fp;
19301     int fd;
19302
19303     if (!s)
19304         exit(1);
19305     fclose(stdin);
19306     fp = fopen("try.c", "r");
19307     if (fp == 0)
19308       exit(2);
19309     fd = fileno(fp);
19310     if (fd < 0)
19311       exit(3);
19312     b = ($selecttype)s;
19313     for (i = 0; i < NBITS; i++)
19314         FD_SET(i, b);
19315     t.tv_sec  = 0;
19316     t.tv_usec = 0;
19317     select(fd + 1, b, 0, 0, &t);
19318     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19319     free(s);
19320     printf("%d\n", i + 1);
19321     return 0;
19322 }
19323 EOCP
19324                 set try
19325                 if eval $compile_ok; then
19326                         selectminbits=`$run ./try`
19327                         case "$selectminbits" in
19328                         '')     cat >&4 <<EOM
19329 Cannot figure out on how many bits at a time your select() operates.
19330 I'll play safe and guess it is $safebits bits.
19331 EOM
19332                                 selectminbits=$safebits
19333                                 bits="$safebits bits"
19334                                 ;;
19335                         1)      bits="1 bit" ;;
19336                         *)      bits="$selectminbits bits" ;;
19337                         esac
19338                         echo "Your select() operates on $bits at a time." >&4
19339                 else
19340                         rp='What is the minimum number of bits your select() operates on?'
19341                         case "$byteorder" in
19342                         12345678)       dflt=64 ;;
19343                         1234)           dflt=32 ;;
19344                         *)              dflt=1  ;;
19345                         esac
19346                         . ./myread
19347                         val=$ans
19348                         selectminbits="$val"
19349                 fi
19350                 $rm -f try.* try
19351                 ;;
19352         *)      : no select, so pick a harmless default
19353                 selectminbits=$safebits
19354                 ;;
19355         esac
19356         ;;
19357 esac
19358
19359 : Trace out the files included by signal.h, then look for SIGxxx names.
19360 : Remove SIGARRAYSIZE used by HPUX.
19361 : Remove SIGSTKSIZE used by Linux.
19362 : Remove SIGSTKSZ used by Posix.
19363 : Remove SIGTYP void lines used by OS2.
19364 : Some cpps, like os390, dont give the file name anywhere
19365 if [ "X$fieldn" = X ]; then
19366         : Just make some guesses.  We check them later.
19367         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19368 else
19369         xxx=`echo '#include <signal.h>' |
19370         $cppstdin $cppminus $cppflags 2>/dev/null |
19371         $grep '^[       ]*#.*include' | 
19372         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19373 fi
19374 : Check this list of files to be sure we have parsed the cpp output ok.
19375 : This will also avoid potentially non-existent files, such 
19376 : as ../foo/bar.h
19377 xxxfiles=''
19378 for xx in $xxx /dev/null ; do
19379         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19380 done
19381 : If we have found no files, at least try signal.h
19382 case "$xxxfiles" in
19383 '')     xxxfiles=`./findhdr signal.h` ;;
19384 esac
19385 xxx=`awk '
19386 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19387         print substr($2, 4, 20)
19388 }
19389 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19390         print substr($3, 4, 20)
19391 }' $xxxfiles`
19392 : Append some common names just in case the awk scan failed.
19393 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19394 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19395 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19396 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19397 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19398
19399 : generate a few handy files for later
19400 $cat > signal.c <<EOCP
19401 #include <sys/types.h>
19402 #include <signal.h>
19403 #$i_stdlib I_STDLIB
19404 #ifdef I_STDLIB
19405 #include <stdlib.h>
19406 #endif
19407 #include <stdio.h>
19408 int main() {
19409
19410 /* Strange style to avoid deeply-nested #if/#else/#endif */
19411 #ifndef NSIG
19412 #  ifdef _NSIG
19413 #    define NSIG (_NSIG)
19414 #  endif
19415 #endif
19416
19417 #ifndef NSIG
19418 #  ifdef SIGMAX
19419 #    define NSIG (SIGMAX+1)
19420 #  endif
19421 #endif
19422
19423 #ifndef NSIG
19424 #  ifdef SIG_MAX
19425 #    define NSIG (SIG_MAX+1)
19426 #  endif
19427 #endif
19428
19429 #ifndef NSIG
19430 #  ifdef _SIG_MAX
19431 #    define NSIG (_SIG_MAX+1)
19432 #  endif
19433 #endif
19434
19435 #ifndef NSIG
19436 #  ifdef MAXSIG
19437 #    define NSIG (MAXSIG+1)
19438 #  endif
19439 #endif
19440
19441 #ifndef NSIG
19442 #  ifdef MAX_SIG
19443 #    define NSIG (MAX_SIG+1)
19444 #  endif
19445 #endif
19446
19447 #ifndef NSIG
19448 #  ifdef SIGARRAYSIZE
19449 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19450 #  endif
19451 #endif
19452
19453 #ifndef NSIG
19454 #  ifdef _sys_nsig
19455 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19456 #  endif
19457 #endif
19458
19459 /* Default to some arbitrary number that's big enough to get most
19460    of the common signals.
19461 */
19462 #ifndef NSIG
19463 #    define NSIG 50
19464 #endif
19465
19466 printf("NSIG %d\n", NSIG);
19467
19468 #ifndef JUST_NSIG
19469
19470 EOCP
19471
19472 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19473 {
19474         printf "#ifdef SIG"; printf $1; printf "\n"
19475         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19476         printf $1; printf ");\n"
19477         printf "#endif\n"
19478 }
19479 END {
19480         printf "#endif /* JUST_NSIG */\n";
19481         printf "exit(0);\n}\n";
19482 }
19483 ' >>signal.c
19484 $cat >signal.awk <<'EOP'
19485 BEGIN { ndups = 0 }
19486 $1 ~ /^NSIG$/ { nsig = $2 }
19487 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19488     if ($2 > maxsig) { maxsig = $2 }
19489     if (sig_name[$2]) {
19490         dup_name[ndups] = $1
19491         dup_num[ndups] = $2
19492         ndups++ 
19493     }
19494     else {
19495         sig_name[$2] = $1
19496         sig_num[$2] = $2
19497     }
19498 }
19499 END { 
19500     if (nsig == 0) {
19501         nsig = maxsig + 1
19502     }
19503     printf("NSIG %d\n", nsig);
19504     for (n = 1; n < nsig; n++) {
19505         if (sig_name[n]) {
19506             printf("%s %d\n", sig_name[n], sig_num[n])
19507         }
19508         else {
19509             printf("NUM%d %d\n", n, n) 
19510         }
19511     }
19512     for (n = 0; n < ndups; n++) {
19513         printf("%s %d\n", dup_name[n], dup_num[n])
19514     }
19515 }
19516 EOP
19517 $cat >signal_cmd <<EOS
19518 $startsh
19519 if $test -s signal.lst; then
19520     echo "Using your existing signal.lst file"
19521         exit 0
19522 fi
19523 xxx="$xxx"
19524 EOS
19525 $cat >>signal_cmd <<'EOS'
19526
19527 set signal
19528 if eval $compile_ok; then
19529         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19530 else
19531         echo "(I can't seem be able to compile the whole test program)" >&4
19532         echo "(I'll try it in little pieces.)" >&4
19533         set signal -DJUST_NSIG
19534         if eval $compile_ok; then
19535                 $run ./signal$_exe > signal.nsg
19536                 $cat signal.nsg
19537         else
19538                 echo "I can't seem to figure out how many signals you have." >&4
19539                 echo "Guessing 50." >&4
19540                 echo 'NSIG 50' > signal.nsg
19541         fi
19542         : Now look at all the signal names, one at a time.
19543         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19544                 $cat > signal.c <<EOCP
19545 #include <sys/types.h>
19546 #include <signal.h>
19547 #include <stdio.h>
19548 int main() {
19549 printf("$xx %d\n", SIG${xx});
19550 return 0;
19551 }
19552 EOCP
19553                 set signal
19554                 if eval $compile; then
19555                         echo "SIG${xx} found."
19556                         $run ./signal$_exe  >> signal.ls1
19557                 else
19558                         echo "SIG${xx} NOT found."
19559                 fi
19560         done
19561         if $test -s signal.ls1; then
19562                 $cat signal.nsg signal.ls1 |
19563                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19564         fi
19565
19566 fi
19567 if $test -s signal.lst; then
19568         :
19569 else
19570         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19571         echo 'kill -l' >signal
19572         set X `csh -f <signal`
19573         $rm -f signal
19574         shift
19575         case $# in
19576         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19577         esac
19578         echo $@ | $tr ' ' $trnl | \
19579             $awk '{ printf "%s %d\n", $1, ++s; }
19580                   END { printf "NSIG %d\n", ++s }' >signal.lst
19581 fi
19582 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19583 EOS
19584 chmod a+x signal_cmd
19585 $eunicefix signal_cmd
19586
19587 : generate list of signal names
19588 echo " "
19589 case "$sig_name_init" in
19590 '') doinit=yes ;;
19591 *)  case "$sig_num_init" in
19592     ''|*,*) doinit=yes ;;
19593     esac ;;
19594 esac
19595 case "$doinit" in
19596 yes)
19597         echo "Generating a list of signal names and numbers..." >&4
19598         . ./signal_cmd
19599         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19600         sig_name=`$awk 'BEGIN { printf "ZERO " }
19601                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19602         sig_num=`$awk  'BEGIN { printf "0 " }
19603                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19604         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19605                              !/^NSIG/   { printf "\"%s\", ", $1 }
19606                              END        { printf "0\n" }' signal.lst`
19607         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19608                              !/^NSIG/   { printf "%d, ", $2}
19609                              END        { printf "0\n"}' signal.lst`
19610         ;;
19611 esac
19612 echo "The following $sig_count signals are available:"
19613 echo " "
19614 echo $sig_name | $awk \
19615 'BEGIN { linelen = 0 }
19616 {
19617         for (i = 1; i <= NF; i++) {
19618                 name = "SIG" $i " "
19619                 linelen = linelen + length(name)
19620                 if (linelen > 70) {
19621                         printf "\n"
19622                         linelen = length(name)
19623                 }
19624                 printf "%s", name
19625         }
19626         printf "\n"
19627 }'
19628 sig_size=`echo $sig_name | awk '{print NF}'`
19629 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19630
19631 echo " "
19632 case "$sizetype" in
19633 *_t) zzz="$sizetype"    ;;
19634 *)   zzz="filesize"     ;;
19635 esac
19636 echo "Checking the size of $zzz..." >&4 
19637 cat > try.c <<EOCP
19638 #include <sys/types.h>
19639 #include <stdio.h>
19640 #$i_stdlib I_STDLIB
19641 #ifdef I_STDLIB
19642 #include <stdlib.h>
19643 #endif
19644 int main() {
19645     printf("%d\n", (int)sizeof($sizetype));
19646     exit(0);
19647 }
19648 EOCP
19649 set try
19650 if eval $compile_ok; then
19651         yyy=`$run ./try`
19652         case "$yyy" in
19653         '')     sizesize=4
19654                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19655                 ;;
19656         *)      sizesize=$yyy
19657                 echo "Your $zzz size is $sizesize bytes."
19658                 ;;
19659         esac
19660 else
19661         sizesize=4
19662         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19663 fi
19664
19665
19666 : check for socklen_t
19667 echo " "
19668 echo "Checking to see if you have socklen_t..." >&4
19669 $cat >try.c <<EOCP
19670 #include <sys/types.h>
19671 #$d_socket HAS_SOCKET
19672 #ifdef HAS_SOCKET
19673 #include <sys/socket.h>
19674 #endif
19675 int main() { socklen_t x = 16; }
19676 EOCP
19677 set try
19678 if eval $compile; then
19679         val="$define"
19680         echo "You have socklen_t."
19681 else
19682         val="$undef"
19683         echo "You do not have socklen_t."
19684         case "$sizetype" in
19685         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19686         esac
19687 fi
19688 $rm -f try try.*
19689 set d_socklen_t
19690 eval $setvar
19691
19692 : see if this is a socks.h system
19693 set socks.h i_socks
19694 eval $inhdr
19695
19696 : check for type of the size argument to socket calls
19697 case "$d_socket" in
19698 "$define")
19699         $cat <<EOM
19700
19701 Checking to see what type is the last argument of accept().
19702 EOM
19703         yyy=''
19704         case "$d_socklen_t" in
19705         "$define") yyy="$yyy socklen_t"
19706         esac
19707         yyy="$yyy $sizetype int long unsigned"
19708         for xxx in $yyy; do
19709                 case "$socksizetype" in
19710                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19711                         case "$usesocks" in
19712                         "$define")
19713                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19714                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19715                                         socksizetype="$xxx"
19716                                 fi
19717                                 ;;
19718                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19719                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19720                                         socksizetype="$xxx"
19721                                 fi
19722                                 ;;
19723                         esac
19724                         ;;
19725                 esac
19726         done
19727 : In case none of those worked, prompt the user.
19728         case "$socksizetype" in
19729         '')     rp='What is the type for socket address structure sizes?'
19730                 dflt='int'
19731                 . ./myread
19732                 socksizetype=$ans
19733                 ;;
19734         esac
19735         ;;
19736 *)      : no sockets, so pick relatively harmless default
19737         socksizetype='int'
19738         ;;
19739 esac
19740
19741 : see what type is used for signed size_t
19742 set ssize_t ssizetype int stdio.h sys/types.h
19743 eval $typedef
19744 dflt="$ssizetype"
19745 $cat > try.c <<EOM
19746 #include <stdio.h>
19747 #$i_stdlib I_STDLIB
19748 #ifdef I_STDLIB
19749 #include <stdlib.h>
19750 #endif
19751 #include <sys/types.h>
19752 #define Size_t $sizetype
19753 #define SSize_t $dflt
19754 int main()
19755 {
19756         if (sizeof(Size_t) == sizeof(SSize_t))
19757                 printf("$dflt\n");
19758         else if (sizeof(Size_t) == sizeof(int))
19759                 printf("int\n");
19760         else 
19761                 printf("long\n");
19762         exit(0);
19763 }
19764 EOM
19765 echo " "
19766 set try
19767 if eval $compile_ok && $run ./try > /dev/null; then
19768         ssizetype=`$run ./try`
19769         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19770 else
19771         $cat >&4 <<EOM
19772 Help! I can't compile and run the ssize_t test program: please enlighten me!
19773 (This is probably a misconfiguration in your system or libraries, and
19774 you really ought to fix it.  Still, I'll try anyway.)
19775
19776 I need a type that is the same size as $sizetype, but is guaranteed to
19777 be signed.  Common values are ssize_t, int and long.
19778
19779 EOM
19780         rp="What signed type is the same size as $sizetype?"
19781         . ./myread
19782         ssizetype="$ans"
19783 fi
19784 $rm -f try try.*
19785
19786 : see what type of char stdio uses.
19787 echo " "
19788 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19789 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19790         echo "Your stdio uses unsigned chars." >&4
19791         stdchar="unsigned char"
19792 else
19793         echo "Your stdio uses signed chars." >&4
19794         stdchar="char"
19795 fi
19796 $rm -f stdioh
19797
19798
19799
19800 : see what type uids are declared as in the kernel
19801 echo " "
19802 echo "Looking for the type for user ids returned by getuid()."
19803 set uid_t uidtype xxx stdio.h sys/types.h
19804 eval $typedef
19805 case "$uidtype" in
19806 xxx)
19807         xxx=`./findhdr sys/user.h`
19808         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19809         case $1 in
19810         unsigned) dflt="$1 $2" ;;
19811         *) dflt="$1" ;;
19812         esac
19813         ;;
19814 *) dflt="$uidtype";;
19815 esac
19816 case "$uidtype" in
19817 uid_t)  echo "uid_t found." ;;
19818 *)      rp="What is the type for user ids returned by getuid()?"
19819         . ./myread
19820         uidtype="$ans"
19821         ;;
19822 esac
19823
19824 echo " "
19825 case "$uidtype" in
19826 *_t) zzz="$uidtype"     ;;
19827 *)   zzz="uid"          ;;
19828 esac
19829 echo "Checking the size of $zzz..." >&4 
19830 cat > try.c <<EOCP
19831 #include <sys/types.h>
19832 #include <stdio.h>
19833 #$i_stdlib I_STDLIB
19834 #ifdef I_STDLIB
19835 #include <stdlib.h>
19836 #endif
19837 int main() {
19838     printf("%d\n", (int)sizeof($uidtype));
19839     exit(0);
19840 }
19841 EOCP
19842 set try
19843 if eval $compile_ok; then
19844         yyy=`$run ./try`
19845         case "$yyy" in
19846         '')     uidsize=4
19847                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19848                 ;;
19849         *)      uidsize=$yyy
19850                 echo "Your $zzz is $uidsize bytes long."
19851                 ;;
19852         esac
19853 else
19854         uidsize=4
19855         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19856 fi
19857
19858 echo " "
19859 case "$uidtype" in
19860 *_t) zzz="$uidtype"     ;;
19861 *)   zzz="uid"          ;;
19862 esac
19863 echo "Checking the sign of $zzz..." >&4
19864 cat > try.c <<EOCP
19865 #include <sys/types.h>
19866 #include <stdio.h>
19867 int main() {
19868         $uidtype foo = -1;
19869         if (foo < 0)
19870                 printf("-1\n");
19871         else
19872                 printf("1\n");
19873 }
19874 EOCP
19875 set try
19876 if eval $compile; then
19877         yyy=`$run ./try`
19878         case "$yyy" in
19879         '')     uidsign=1
19880                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19881                 ;;
19882         *)      uidsign=$yyy
19883                 case "$uidsign" in
19884                  1) echo "Your $zzz is unsigned." ;;
19885                 -1) echo "Your $zzz is signed."   ;;
19886                 esac
19887                 ;;
19888         esac
19889 else
19890         uidsign=1
19891         echo "(I can't compile the test program--guessing unsigned.)" >&4
19892 fi
19893
19894
19895
19896 echo " "
19897 $echo "Checking the format string to be used for uids..." >&4
19898
19899 case "$uidsign" in
19900 -1)     if $test X"$uidsize" = X"$ivsize"; then
19901                 uidformat="$ivdformat"
19902         else
19903                 if $test X"$uidsize" = X"$longsize"; then
19904                         uidformat='"ld"'
19905                 else
19906                         if $test X"$uidsize" = X"$intsize"; then
19907                                 uidformat='"d"'
19908                         else
19909                                 if $test X"$uidsize" = X"$shortsize"; then
19910                                         uidformat='"hd"'
19911                                 fi
19912                         fi
19913                 fi
19914         fi
19915         ;;
19916 *)      if $test X"$uidsize" = X"$uvsize"; then
19917                 uidformat="$uvuformat"
19918         else
19919                 if $test X"$uidsize" = X"$longsize"; then
19920                         uidformat='"lu"'
19921                 else
19922                         if $test X"$uidsize" = X"$intsize"; then
19923                                 uidformat='"u"'
19924                         else
19925                                 if $test X"$uidsize" = X"$shortsize"; then
19926                                         uidformat='"hu"'
19927                                 fi
19928                         fi
19929                 fi
19930         fi
19931         ;;
19932 esac
19933
19934
19935 case "$usesitecustomize" in
19936     $define|true|[Yy]*)
19937         usesitecustomize="$define"
19938         ;;
19939     *)
19940         usesitecustomize="$undef"
19941         ;;
19942     esac
19943
19944 : determine compiler compiler
19945 case "$yacc" in
19946 '')
19947         dflt=yacc;;
19948 *)
19949         dflt="$yacc";;
19950 esac
19951 echo " "
19952 comp='yacc'
19953 if $test -f "$byacc$_exe"; then
19954         dflt="$byacc"
19955         comp="byacc or $comp"
19956 fi
19957 if $test -f "$bison$_exe"; then
19958         comp="$comp or bison -y"
19959 fi
19960 rp="Which compiler compiler ($comp) shall I use?"
19961 . ./myread
19962 yacc="$ans"
19963 case "$yacc" in
19964 *bis*)
19965         case "$yacc" in
19966         *-y*) ;;
19967         *)
19968                 yacc="$yacc -y"
19969                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19970                 ;;
19971         esac
19972         ;;
19973 esac
19974
19975 : see if this is a fp.h system
19976 set fp.h i_fp
19977 eval $inhdr
19978
19979 : see if this is a fp_class.h system
19980 set fp_class.h i_fp_class
19981 eval $inhdr
19982
19983 : see if this is a ieeefp.h system
19984 case "$i_ieeefp" in
19985 '' ) set ieeefp.h i_ieeefp
19986      eval $inhdr
19987      ;;
19988 esac
19989
19990 : see if this is a libutil.h system
19991 set libutil.h i_libutil
19992 eval $inhdr
19993
19994 : see if mach cthreads are available
19995 if test "X$usethreads" = "X$define"; then
19996         set mach/cthreads.h i_machcthr
19997         eval $inhdr
19998 else
19999         i_machcthr="$undef"
20000 fi
20001
20002
20003
20004 : see if this is a mntent.h system
20005 set mntent.h i_mntent
20006 eval $inhdr
20007
20008 : see if ndbm.h is available
20009 set ndbm.h t_ndbm
20010 eval $inhdr
20011
20012 case "$t_ndbm" in
20013 $undef)
20014     # Some Linux distributions such as RedHat 7.1 put the
20015     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20016     if $test -f /usr/include/gdbm/ndbm.h; then
20017         echo '<gdbm/ndbm.h> found.'
20018         ccflags="$ccflags -I/usr/include/gdbm"
20019         cppflags="$cppflags -I/usr/include/gdbm"
20020         t_ndbm=$define
20021     fi
20022     ;;
20023 esac
20024
20025 case "$t_ndbm" in
20026 $define)
20027         : see if dbm_open exists
20028         set dbm_open d_dbm_open
20029         eval $inlibc
20030         case "$d_dbm_open" in
20031         $undef)
20032                 t_ndbm="$undef"
20033                 echo "We won't be including <ndbm.h>"
20034                 ;;
20035         esac
20036         ;;
20037 esac
20038 val="$t_ndbm"
20039 set i_ndbm
20040 eval $setvar
20041
20042 : see if net/errno.h is available
20043 val=''
20044 set net/errno.h val
20045 eval $inhdr
20046
20047 : Unfortunately, it causes problems on some systems.  Arrgh.
20048 case "$val" in
20049 $define)
20050         cat > try.c <<'EOM'
20051 #include <stdio.h>
20052 #include <errno.h>
20053 #include <net/errno.h>
20054 int func()
20055 {
20056         return ENOTSOCK;
20057 }
20058 EOM
20059         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20060                 echo "We'll be including <net/errno.h>." >&4
20061         else
20062                 echo "We won't be including <net/errno.h>." >&4
20063                 val="$undef"
20064         fi
20065         $rm -f try.* try
20066         ;;
20067 esac
20068 set i_neterrno
20069 eval $setvar
20070
20071 : see if netinet/tcp.h is available
20072 set netinet/tcp.h i_netinettcp
20073 eval $inhdr
20074
20075 : see if this is a poll.h system
20076 set poll.h i_poll
20077 eval $inhdr
20078
20079 : see if this is a prot.h system
20080 set prot.h i_prot
20081 eval $inhdr
20082
20083 echo " "
20084 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20085 $cat <<'EOSH' > Cppsym.know
20086 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20087 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20088 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20089 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20090 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20091 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20092 bull c cadmus clipper CMU COFF COMPILER_VERSION
20093 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20094 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20095 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20096 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20097 GLIBC GLIBC_MINOR
20098 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20099 H3050R H3050RX hbullx20 hcx host_mips
20100 hp200 hp300 hp700 HP700 hp800 hp9000
20101 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20102 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20103 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20104 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20105 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20106 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20107 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20108 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20109 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20110 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20111 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20112 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20113 MATH_HAS_NO_SIDE_EFFECTS
20114 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20115 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20116 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20117 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20118 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20119 NetBSD news1500 news1700 news1800 news1900 news3700
20120 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20121 ns32016 ns32332 ns32k nsc32000
20122 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20123 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20124 pc532 pdp11 PGC PIC plexus PORTAR posix
20125 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20126 POSIX_C_SOURCE POSIX_SOURCE POWER
20127 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20128 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20129 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20130 sony sony_news sonyrisc sparc sparclite spectrum
20131 stardent stdc STDC_EXT stratos sun sun3 sun386
20132 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20133 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20134 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20135 sysV68 sysV88 Tek4132 Tek4300 titan
20136 TM3200 TM5400 TM5600
20137 tower tower32 tower32_200 tower32_600 tower32_700
20138 tower32_800 tower32_850 tss
20139 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20140 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20141 unix UNIX95 UNIX99 unixpc unos
20142 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20143 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20144 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20145 USGr4 USGr4_2
20146 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20147 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20148 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20149 z8000
20150 EOSH
20151 # Maybe put other stuff here too.
20152 cat <<EOSH >>Cppsym.know
20153 $osname
20154 EOSH
20155 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20156 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20157 $cat Cppsym.know > Cppsym.c
20158 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20159 $rm -f Cppsym.a Cppsym.b Cppsym.c
20160 cat <<EOSH > Cppsym
20161 $startsh
20162 if $test \$# -gt 0; then
20163     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20164     if $test -s Cppsym.got; then
20165         $rm -f Cppsym.got
20166         exit 0
20167     fi
20168     $rm -f Cppsym.got
20169     exit 1
20170 else
20171     $tr " " "$trnl" | ./Cppsym.try
20172     exit 0
20173 fi
20174 EOSH
20175 chmod +x Cppsym
20176 $eunicefix Cppsym
20177 cat <<EOSH > Cppsym.try
20178 $startsh
20179 cat <<'EOCP' > try.c
20180 #include <stdio.h>
20181 #if cpp_stuff == 1
20182 #define STRINGIFY(a)    "a"
20183 #endif
20184 #if cpp_stuff == 42
20185 #define StGiFy(a)  #a
20186 #define STRINGIFY(a)    StGiFy(a)
20187 #endif
20188 #if $cpp_stuff != 1 && $cpp_stuff != 42
20189 #   include "Bletch: How does this C preprocessor stringify macros?"
20190 #endif
20191 int main() {
20192 EOCP
20193 $awk \\
20194 EOSH
20195 cat <<'EOSH' >> Cppsym.try
20196 'length($1) > 0 {
20197     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20198     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20199     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20200     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20201 }'       >> try.c
20202 echo 'return 0;}' >> try.c
20203 EOSH
20204 cat <<EOSH >> Cppsym.try
20205 ccflags="$ccflags"
20206 case "$osname-$gccversion" in
20207 irix-) ccflags="\$ccflags -woff 1178" ;;
20208 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20209 esac
20210 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20211 EOSH
20212 chmod +x Cppsym.try
20213 $eunicefix Cppsym.try
20214 ./Cppsym < Cppsym.know > Cppsym.true
20215 : now check the C compiler for additional symbols
20216 postprocess_cc_v=''
20217 case "$osname" in
20218 aix) postprocess_cc_v="|$tr , ' '" ;;
20219 esac
20220 $cat >ccsym <<EOS
20221 $startsh
20222 $cat >tmp.c <<EOF
20223 extern int foo;
20224 EOF
20225 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20226 do
20227         case "\$i" in
20228         -D*) echo "\$i" | $sed 's/^-D//';;
20229         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20230         esac
20231 done
20232 $rm -f try.c
20233 EOS
20234 postprocess_cc_v=''
20235 chmod +x ccsym
20236 $eunicefix ccsym
20237 ./ccsym > ccsym1.raw
20238 if $test -s ccsym1.raw; then
20239        $sort ccsym1.raw | $uniq >ccsym.raw
20240 else
20241        mv ccsym1.raw ccsym.raw
20242 fi
20243
20244 $awk '/\=/ { print $0; next }
20245         { print $0"=1" }' ccsym.raw >ccsym.list
20246 $comm -13 Cppsym.true ccsym.list >ccsym.own
20247 $comm -12 Cppsym.true ccsym.list >ccsym.com
20248 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20249 also=''
20250 if $test -z ccsym.raw; then
20251         echo "Your C compiler doesn't seem to define any symbols!" >&4
20252         echo " "
20253         echo "However, your C preprocessor defines the following symbols:"
20254         $cat Cppsym.true
20255         ccsymbols=''
20256         cppsymbols=`$cat Cppsym.true`
20257         cppsymbols=`echo $cppsymbols`
20258         cppccsymbols="$cppsymbols"
20259 else
20260         if $test -s ccsym.com; then
20261                 echo "Your C compiler and pre-processor define these symbols:"
20262                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20263                 also='also '
20264                 symbols='ones'
20265                 cppccsymbols=`$cat ccsym.com`
20266                 cppccsymbols=`echo $cppccsymbols`
20267                 $test "$silent" || sleep 1
20268         fi
20269         if $test -s ccsym.cpp; then
20270                 $test "$also" && echo " "
20271                 echo "Your C pre-processor ${also}defines the following symbols:"
20272                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20273                 also='further '
20274                 cppsymbols=`$cat ccsym.cpp`
20275                 cppsymbols=`echo $cppsymbols`
20276                 $test "$silent" || sleep 1
20277         fi
20278         if $test -s ccsym.own; then
20279                 $test "$also" && echo " "
20280                 echo "Your C compiler ${also}defines the following cpp symbols:"
20281                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20282                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20283                 ccsymbols=`$cat ccsym.own`
20284                 ccsymbols=`echo $ccsymbols`
20285                 $test "$silent" || sleep 1
20286         fi
20287 fi
20288
20289 : see if this is a termio system
20290 val="$undef"
20291 val2="$undef"
20292 val3="$undef"
20293 if $test `./findhdr termios.h`; then
20294         set tcsetattr i_termios
20295         eval $inlibc
20296         val3="$i_termios"
20297 fi
20298 echo " "
20299 case "$val3" in
20300 "$define") echo "You have POSIX termios.h... good!" >&4;;
20301 *) if ./Cppsym pyr; then
20302                 case "`/bin/universe`" in
20303                 ucb) if $test `./findhdr sgtty.h`; then
20304                                 val2="$define"
20305                                 echo "<sgtty.h> found." >&4
20306                         else
20307                                 echo "System is pyramid with BSD universe."
20308                                 echo "<sgtty.h> not found--you could have problems." >&4
20309                         fi;;
20310                 *) if $test `./findhdr termio.h`; then
20311                                 val="$define"
20312                                 echo "<termio.h> found." >&4
20313                         else
20314                                 echo "System is pyramid with USG universe."
20315                                 echo "<termio.h> not found--you could have problems." >&4
20316                         fi;;
20317                 esac
20318         elif ./usg; then
20319                 if $test `./findhdr termio.h`; then
20320                         echo "<termio.h> found." >&4
20321                         val="$define"
20322                 elif $test `./findhdr sgtty.h`; then
20323                         echo "<sgtty.h> found." >&4
20324                         val2="$define"
20325                 else
20326 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20327                 fi
20328         else
20329                 if $test `./findhdr sgtty.h`; then
20330                         echo "<sgtty.h> found." >&4
20331                         val2="$define"
20332                 elif $test `./findhdr termio.h`; then
20333                         echo "<termio.h> found." >&4
20334                         val="$define"
20335                 else
20336 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20337                 fi
20338         fi;;
20339 esac
20340 set i_termio; eval $setvar
20341 val=$val2; set i_sgtty; eval $setvar
20342 val=$val3; set i_termios; eval $setvar
20343
20344 : see if stddef is available
20345 set stddef.h i_stddef
20346 eval $inhdr
20347
20348 : see if this is a sunmath.h system
20349 set sunmath.h i_sunmath
20350 eval $inhdr
20351
20352 : see if sys/access.h is available
20353 set sys/access.h i_sysaccess
20354 eval $inhdr
20355
20356 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20357 set sys/filio.h i_sysfilio
20358 eval $inhdr
20359 echo " "
20360 if $test `./findhdr sys/ioctl.h`; then
20361         val="$define"
20362         echo '<sys/ioctl.h> found.' >&4
20363 else
20364         val="$undef"
20365         if $test $i_sysfilio = "$define"; then
20366             echo '<sys/ioctl.h> NOT found.' >&4
20367         else
20368                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20369                 $test $i_termio = "$define" && xxx="termio.h"
20370                 $test $i_termios = "$define" && xxx="termios.h"
20371 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20372         fi
20373 fi
20374 set i_sysioctl
20375 eval $setvar
20376
20377 : see if socket ioctl defs are in sys/sockio.h
20378 echo " "
20379 xxx=`./findhdr sys/sockio.h`
20380 if $test "$xxx"; then
20381         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20382                 val="$define"
20383                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20384         else
20385                 val="$undef"
20386                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20387         fi
20388 else
20389         val="$undef"
20390         $cat <<EOM
20391 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20392 EOM
20393 fi
20394 set i_syssockio
20395 eval $setvar
20396
20397
20398 : see if this is a syslog.h system
20399 set syslog.h i_syslog
20400 eval $inhdr
20401
20402
20403 : see if this is a sys/mode.h system
20404 set sys/mode.h i_sysmode
20405 eval $inhdr
20406
20407 : see if sys/resource.h has to be included
20408 set sys/resource.h i_sysresrc
20409 eval $inhdr
20410
20411 : see if sys/security.h is available
20412 set sys/security.h i_syssecrt
20413 eval $inhdr
20414
20415 : see if this is a sys/statvfs.h system
20416 set sys/statvfs.h i_sysstatvfs
20417 eval $inhdr
20418
20419 : see if this is a sys/un.h system
20420 set sys/un.h i_sysun
20421 eval $inhdr
20422
20423
20424 : see if this is a sys/utsname.h system
20425 set sys/utsname.h i_sysutsname
20426 eval $inhdr
20427
20428 : see if this is a syswait system
20429 set sys/wait.h i_syswait
20430 eval $inhdr
20431
20432 : see if this is a ustat.h system
20433 set ustat.h i_ustat
20434 eval $inhdr
20435
20436 : see if this is an utime system
20437 set utime.h i_utime
20438 eval $inhdr
20439
20440 : see if this is a values.h system
20441 set values.h i_values
20442 eval $inhdr
20443
20444 : see if this is a vfork system
20445 case "$d_vfork" in
20446 "$define")
20447         set vfork.h i_vfork
20448         eval $inhdr
20449         ;;
20450 *)
20451         i_vfork="$undef"
20452         ;;
20453 esac
20454
20455 : see if gdbm.h is available
20456 set gdbm.h t_gdbm
20457 eval $inhdr
20458 case "$t_gdbm" in
20459 $define)
20460         : see if gdbm_open exists
20461         set gdbm_open d_gdbm_open
20462         eval $inlibc
20463         case "$d_gdbm_open" in
20464         $undef)
20465                 t_gdbm="$undef"
20466                 echo "We won't be including <gdbm.h>"
20467                 ;;
20468         esac
20469         ;;
20470 esac
20471 val="$t_gdbm"
20472 set i_gdbm
20473 eval $setvar
20474
20475 echo " "
20476 echo "Looking for extensions..." >&4
20477 : If we are using the old config.sh, known_extensions may contain
20478 : old or inaccurate or duplicate values.
20479 known_extensions=''
20480 nonxs_extensions=''
20481 : We do not use find because it might not be available.
20482 : We do not just use MANIFEST because the user may have dropped
20483 : some additional extensions into the source tree and expect them
20484 : to be built.
20485
20486 : Function to recursively find available extensions, ignoring DynaLoader
20487 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20488 find_extensions='
20489     for xxx in *; do
20490        case "$xxx" in
20491            DynaLoader|dynaload) ;;
20492            *)
20493            if $test -f $xxx/$xxx.xs; then
20494                known_extensions="$known_extensions $1$xxx";
20495            elif $test -f $xxx/Makefile.PL; then
20496                nonxs_extensions="$nonxs_extensions $1$xxx";
20497            else
20498                if $test -d $xxx -a $# -lt 10; then
20499                    set $1$xxx/ $*;
20500                    cd "$xxx";
20501                    eval $find_extensions;
20502                    cd ..;
20503                    shift;
20504                fi;
20505            fi
20506            ;;
20507        esac;
20508     done'
20509 tdir=`pwd`
20510 cd "$rsrc/ext"
20511 set X
20512 shift
20513 eval $find_extensions
20514 # Special case:  Add in threads/shared since it is not picked up by the
20515 # recursive find above (and adding in general recursive finding breaks
20516 # SDBM_File/sdbm).  A.D.  10/25/2001.
20517 known_extensions="$known_extensions threads/shared"
20518 set X $nonxs_extensions
20519 shift
20520 nonxs_extensions="$*"
20521 set X $known_extensions
20522 shift
20523 known_extensions="$*"
20524 cd "$tdir"
20525
20526 : Now see which are supported on this system.
20527 avail_ext=''
20528 for xxx in $known_extensions ; do
20529         case "$xxx" in
20530         DB_File|db_file)
20531                 case "$i_db" in
20532                 $define) avail_ext="$avail_ext $xxx" ;;
20533                 esac
20534                 ;;
20535         GDBM_File|gdbm_fil)
20536                 case "$i_gdbm" in 
20537                 $define) avail_ext="$avail_ext $xxx" ;;
20538                 esac
20539                 ;;
20540         I18N/Langinfo|i18n_lan)
20541                 case "$i_langinfo$d_nl_langinfo" in 
20542                 $define$define) avail_ext="$avail_ext $xxx" ;;
20543                 esac
20544                 ;;
20545         NDBM_File|ndbm_fil)
20546                 case "$i_ndbm" in
20547                 $define)
20548                     case "$osname-$use64bitint" in
20549                     hpux-define)
20550                         case "$libs" in
20551                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20552                         esac
20553                         ;;
20554                     *) avail_ext="$avail_ext $xxx" ;;
20555                     esac
20556                     ;;
20557                 esac
20558                 ;;
20559         ODBM_File|odbm_fil) 
20560                 case "${i_dbm}${i_rpcsvcdbm}" in
20561                 *"${define}"*)
20562                     case "$osname-$use64bitint" in
20563                     hpux-define)
20564                         case "$libs" in
20565                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20566                         esac
20567                         ;;
20568                     *) avail_ext="$avail_ext $xxx" ;;
20569                     esac
20570                     ;;
20571                 esac
20572                 ;;
20573         POSIX|posix)
20574                 case "$useposix" in
20575                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20576                 esac
20577                 ;;
20578         Opcode|opcode)
20579                 case "$useopcode" in
20580                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20581                 esac
20582                 ;;
20583         Socket|socket)
20584                 case "$d_socket" in 
20585                 true|$define|y)
20586                     case "$osname" in
20587                     beos) ;; # not unless BONE
20588                     *) avail_ext="$avail_ext $xxx" ;;
20589                     esac
20590                     ;;
20591                 esac
20592                 ;;
20593         Sys/Syslog|sys/syslog)
20594                 : XXX syslog requires socket
20595                 case "$d_socket" in 
20596                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20597                 esac
20598                 ;;
20599         Thread|thread)
20600                 case "$usethreads" in
20601                 true|$define|y)
20602                         case "$useithreads" in
20603                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20604                         esac
20605                 esac
20606                 ;;
20607         XS/APItest|xs/apitest)
20608                 # This is just for testing.  Skip it unless we have dynamic loading.
20609
20610                 case "$usedl" in
20611                 $define) avail_ext="$avail_ext $xxx" ;;
20612                 esac
20613                 ;;
20614         XS/Typemap|xs/typemap)
20615                 # This is just for testing.  Skip it unless we have dynamic loading.
20616                 case "$usedl" in
20617                 $define) avail_ext="$avail_ext $xxx" ;;
20618                 esac
20619                 ;;
20620         threads|threads/shared)
20621                 # threads and threads::shared are special cases.
20622                 # To stop people from asking "Perl 5.8.0 was supposed
20623                 # to have this new fancy threads implementation but my
20624                 # perl doesn't have it" and from people trying to
20625                 # (re)install the threads module using CPAN.pm and
20626                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20627                 # the threads.pm and threads/shared.pm will always be
20628                 # there, croaking informatively ("you need to rebuild
20629                 # all of Perl with threads, sorry") when threads haven't
20630                 # been compiled in.
20631                 # --jhi
20632                 avail_ext="$avail_ext $xxx"
20633                 ;;
20634         IPC/SysV|ipc/sysv)
20635                 : XXX Do we need a useipcsysv variable here
20636                 case "${d_msg}${d_sem}${d_shm}" in 
20637                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20638                 esac
20639                 ;;
20640         *)      avail_ext="$avail_ext $xxx"
20641                 ;;
20642         esac
20643 done
20644
20645 set X $avail_ext
20646 shift
20647 avail_ext="$*"
20648
20649 case "$onlyextensions" in
20650 '') ;;
20651 *)  keepextensions=''
20652     echo "You have requested that only certains extensions be included..." >&4
20653     for i in $onlyextensions; do
20654         case " $avail_ext " in
20655         *" $i "*)
20656             echo "Keeping extension $i."
20657             keepextensions="$keepextensions $i"
20658             ;;
20659         *) echo "Ignoring extension $i." ;;
20660         esac
20661     done
20662     avail_ext="$keepextensions"
20663     ;;
20664 esac
20665
20666 case "$noextensions" in
20667 '') ;;
20668 *)  keepextensions=''
20669     echo "You have requested that certain extensions be ignored..." >&4
20670     for i in $avail_ext; do
20671         case " $noextensions " in
20672         *" $i "*) echo "Ignoring extension $i." ;;
20673         *) echo "Keeping extension $i.";
20674            keepextensions="$keepextensions $i"
20675            ;;
20676         esac
20677     done
20678     avail_ext="$keepextensions"
20679     ;;
20680 esac
20681
20682 : Now see which nonxs extensions are supported on this system.
20683 : For now assume all are.
20684 nonxs_ext=''
20685 for xxx in $nonxs_extensions ; do
20686         case "$xxx" in
20687         *)      nonxs_ext="$nonxs_ext $xxx"
20688                 ;;
20689         esac
20690 done
20691
20692 set X $nonxs_ext
20693 shift
20694 nonxs_ext="$*"
20695
20696 case $usedl in
20697 $define)
20698         $cat <<EOM
20699 A number of extensions are supplied with $package.  You may choose to
20700 compile these extensions for dynamic loading (the default), compile
20701 them into the $package executable (static loading), or not include
20702 them at all.  Answer "none" to include no extensions.
20703 Note that DynaLoader is always built and need not be mentioned here.
20704
20705 EOM
20706         case "$dynamic_ext" in
20707         '')
20708                 : Exclude those listed in static_ext
20709                 dflt=''
20710                 for xxx in $avail_ext; do
20711                         case " $static_ext " in
20712                         *" $xxx "*) ;;
20713                         *) dflt="$dflt $xxx" ;;
20714                         esac
20715                 done
20716                 set X $dflt
20717                 shift
20718                 dflt="$*"
20719                 ;;
20720         *)      dflt="$dynamic_ext"
20721                 # Perhaps we are reusing an old out-of-date config.sh.
20722                 case "$hint" in
20723                 previous)
20724                         if test X"$dynamic_ext" != X"$avail_ext"; then
20725                                 $cat <<EOM
20726 NOTICE:  Your previous config.sh list may be incorrect. 
20727 The extensions now available to you are 
20728         ${avail_ext}
20729 but the default list from your previous config.sh is
20730         ${dynamic_ext} 
20731
20732 EOM
20733                         fi
20734                         ;;
20735                 esac
20736                 ;;
20737         esac
20738         case "$dflt" in
20739         '')     dflt=none;;
20740         esac
20741         rp="What extensions do you wish to load dynamically?"
20742         . ./myread
20743         case "$ans" in
20744         none) dynamic_ext=' ' ;;
20745         *) dynamic_ext="$ans" ;;
20746         esac
20747
20748         case "$static_ext" in
20749         '')
20750                 : Exclude those already listed in dynamic linking
20751                 dflt=''
20752                 for xxx in $avail_ext; do
20753                         case " $dynamic_ext " in
20754                         *" $xxx "*) ;;
20755                         *) dflt="$dflt $xxx" ;;
20756                         esac
20757                 done
20758                 set X $dflt
20759                 shift
20760                 dflt="$*"
20761                 ;;
20762         *)  dflt="$static_ext" 
20763                 ;;
20764         esac
20765
20766         case "$dflt" in
20767         '')     dflt=none;;
20768         esac
20769         rp="What extensions do you wish to load statically?"
20770         . ./myread
20771         case "$ans" in
20772         none) static_ext=' ' ;;
20773         *) static_ext="$ans" ;;
20774         esac
20775         ;;
20776 *)
20777         $cat <<EOM
20778 A number of extensions are supplied with $package.  Answer "none" 
20779 to include no extensions. 
20780 Note that DynaLoader is always built and need not be mentioned here.
20781
20782 EOM
20783         case "$static_ext" in
20784         '') dflt="$avail_ext" ;;
20785         *)      dflt="$static_ext"
20786                 # Perhaps we are reusing an old out-of-date config.sh.
20787                 case "$hint" in
20788                 previous)
20789                         if test X"$static_ext" != X"$avail_ext"; then
20790                                 $cat <<EOM
20791 NOTICE:  Your previous config.sh list may be incorrect. 
20792 The extensions now available to you are 
20793         ${avail_ext}
20794 but the default list from your previous config.sh is
20795         ${static_ext} 
20796
20797 EOM
20798                         fi
20799                         ;;
20800                 esac
20801                 ;;
20802         esac
20803         : Exclude those that are not xs extensions
20804         case "$dflt" in
20805         '')     dflt=none;;
20806         esac
20807         rp="What extensions do you wish to include?"
20808         . ./myread
20809         case "$ans" in
20810         none) static_ext=' ' ;;
20811         *) static_ext="$ans" ;;
20812         esac
20813         ;;
20814 esac
20815 #        
20816 # Encode is a special case.  If we are building Encode as a static
20817 # extension, we need to explicitly list its subextensions as well.
20818 # For other nested extensions, this is handled automatically by
20819 # the appropriate Makefile.PL.
20820 case " $static_ext " in
20821         *" Encode "*) # Add the subextensions of Encode
20822         cd "$rsrc/ext"
20823         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20824                 static_ext="$static_ext Encode/$xxx"
20825         done
20826         cd "$tdir"
20827         ;;
20828 esac
20829
20830 set X $dynamic_ext $static_ext $nonxs_ext
20831 shift
20832 extensions="$*"
20833
20834 # Sanity check:  We require an extension suitable for use with
20835 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20836 # should show up as failures in the test suite, but it's helpful to
20837 # catch them now.) The 'extensions' list is normally sorted
20838 # alphabetically, so we need to accept either
20839 #    DB_File ... Fcntl ... IO  ....
20840 # or something like
20841 #    Fcntl ... NDBM_File ... IO  ....
20842 case " $extensions"  in
20843 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20844 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20845 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20846 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20847    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20848    ;;
20849 esac
20850
20851 : Remove libraries needed only for extensions
20852 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20853 : The exception is SunOS 4.x, which needs them.
20854 case "${osname}X${osvers}" in
20855 sunos*X4*)
20856     perllibs="$libs"
20857     ;;
20858 *) case "$usedl" in
20859     $define|true|[yY]*)
20860             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20861             shift
20862             perllibs="$*"
20863             ;;
20864     *)  perllibs="$libs"
20865             ;;
20866     esac
20867     ;;
20868 esac
20869
20870 : Remove build directory name from cppstdin so it can be used from
20871 : either the present location or the final installed location.
20872 echo " "
20873 : Get out of the UU directory to get correct path name.
20874 cd ..
20875 case "$cppstdin" in
20876 `pwd`/cppstdin)
20877         echo "Stripping down cppstdin path name"
20878         cppstdin=cppstdin
20879         ;;
20880 esac
20881 cd UU
20882
20883 : end of configuration questions
20884 echo " "
20885 echo "End of configuration questions."
20886 echo " "
20887
20888 : back to where it started
20889 if test -d ../UU; then
20890         cd ..
20891 fi
20892
20893 : configuration may be patched via a 'config.arch' file
20894 if $test -f config.arch; then
20895         echo "I see a config.arch file, loading it."
20896         . ./config.arch
20897 fi
20898
20899 : configuration may be patched via a 'config.over' file
20900 if $test -f config.over; then
20901         echo " "
20902         dflt=y
20903         rp='I see a config.over file.  Do you wish to load it?'
20904         . UU/myread
20905         case "$ans" in
20906         n*) echo "OK, I'll ignore it.";;
20907         *)      . ./config.over
20908                 echo "Configuration override changes have been loaded."
20909                 ;;
20910         esac
20911 fi
20912
20913 : in case they want portability, strip down executable paths
20914 case "$d_portable" in
20915 "$define")
20916         echo " "
20917         echo "Stripping down executable paths..." >&4
20918         for file in $loclist $trylist; do
20919                 eval temp=\$$file
20920                 eval $file=`basename $temp`
20921         done
20922         ;;
20923 esac
20924
20925 : create config.sh file
20926 echo " "
20927 echo "Creating config.sh..." >&4
20928 $spitshell <<EOT >config.sh
20929 $startsh
20930 #
20931 # This file was produced by running the Configure script. It holds all the
20932 # definitions figured out by Configure. Should you modify one of these values,
20933 # do not forget to propagate your changes by running "Configure -der". You may
20934 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20935 #
20936
20937 # Package name      : $package
20938 # Source directory  : $src
20939 # Configuration time: $cf_time
20940 # Configured by     : $cf_by
20941 # Target system     : $myuname
20942
20943 Author='$Author'
20944 Date='$Date'
20945 Header='$Header'
20946 Id='$Id'
20947 Locker='$Locker'
20948 Log='$Log'
20949 Mcc='$Mcc'
20950 RCSfile='$RCSfile'
20951 Revision='$Revision'
20952 Source='$Source'
20953 State='$State'
20954 _a='$_a'
20955 _exe='$_exe'
20956 _o='$_o'
20957 afs='$afs'
20958 afsroot='$afsroot'
20959 alignbytes='$alignbytes'
20960 ansi2knr='$ansi2knr'
20961 aphostname='$aphostname'
20962 api_revision='$api_revision'
20963 api_subversion='$api_subversion'
20964 api_version='$api_version'
20965 api_versionstring='$api_versionstring'
20966 ar='$ar'
20967 archlib='$archlib'
20968 archlibexp='$archlibexp'
20969 archname64='$archname64'
20970 archname='$archname'
20971 archobjs='$archobjs'
20972 asctime_r_proto='$asctime_r_proto'
20973 awk='$awk'
20974 baserev='$baserev'
20975 bash='$bash'
20976 bin='$bin'
20977 binexp='$binexp'
20978 bison='$bison'
20979 byacc='$byacc'
20980 byteorder='$byteorder'
20981 c='$c'
20982 castflags='$castflags'
20983 cat='$cat'
20984 cc='$cc'
20985 cccdlflags='$cccdlflags'
20986 ccdlflags='$ccdlflags'
20987 ccflags='$ccflags'
20988 ccflags_uselargefiles='$ccflags_uselargefiles'
20989 ccname='$ccname'
20990 ccsymbols='$ccsymbols'
20991 ccversion='$ccversion'
20992 cf_by='$cf_by'
20993 cf_email='$cf_email'
20994 cf_time='$cf_time'
20995 charsize='$charsize'
20996 chgrp='$chgrp'
20997 chmod='$chmod'
20998 chown='$chown'
20999 clocktype='$clocktype'
21000 comm='$comm'
21001 compress='$compress'
21002 contains='$contains'
21003 cp='$cp'
21004 cpio='$cpio'
21005 cpp='$cpp'
21006 cpp_stuff='$cpp_stuff'
21007 cppccsymbols='$cppccsymbols'
21008 cppflags='$cppflags'
21009 cpplast='$cpplast'
21010 cppminus='$cppminus'
21011 cpprun='$cpprun'
21012 cppstdin='$cppstdin'
21013 cppsymbols='$cppsymbols'
21014 crypt_r_proto='$crypt_r_proto'
21015 cryptlib='$cryptlib'
21016 csh='$csh'
21017 ctermid_r_proto='$ctermid_r_proto'
21018 ctime_r_proto='$ctime_r_proto'
21019 d_Gconvert='$d_Gconvert'
21020 d_PRIEUldbl='$d_PRIEUldbl'
21021 d_PRIFUldbl='$d_PRIFUldbl'
21022 d_PRIGUldbl='$d_PRIGUldbl'
21023 d_PRIXU64='$d_PRIXU64'
21024 d_PRId64='$d_PRId64'
21025 d_PRIeldbl='$d_PRIeldbl'
21026 d_PRIfldbl='$d_PRIfldbl'
21027 d_PRIgldbl='$d_PRIgldbl'
21028 d_PRIi64='$d_PRIi64'
21029 d_PRIo64='$d_PRIo64'
21030 d_PRIu64='$d_PRIu64'
21031 d_PRIx64='$d_PRIx64'
21032 d_SCNfldbl='$d_SCNfldbl'
21033 d__fwalk='$d__fwalk'
21034 d_access='$d_access'
21035 d_accessx='$d_accessx'
21036 d_aintl='$d_aintl'
21037 d_alarm='$d_alarm'
21038 d_archlib='$d_archlib'
21039 d_asctime_r='$d_asctime_r'
21040 d_atolf='$d_atolf'
21041 d_atoll='$d_atoll'
21042 d_attribute_format='$d_attribute_format'
21043 d_attribute_malloc='$d_attribute_malloc'
21044 d_attribute_nonnull='$d_attribute_nonnull'
21045 d_attribute_noreturn='$d_attribute_noreturn'
21046 d_attribute_pure='$d_attribute_pure'
21047 d_attribute_unused='$d_attribute_unused'
21048 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21049 d_bcmp='$d_bcmp'
21050 d_bcopy='$d_bcopy'
21051 d_bsd='$d_bsd'
21052 d_bsdgetpgrp='$d_bsdgetpgrp'
21053 d_bsdsetpgrp='$d_bsdsetpgrp'
21054 d_bzero='$d_bzero'
21055 d_casti32='$d_casti32'
21056 d_castneg='$d_castneg'
21057 d_charvspr='$d_charvspr'
21058 d_chown='$d_chown'
21059 d_chroot='$d_chroot'
21060 d_chsize='$d_chsize'
21061 d_class='$d_class'
21062 d_clearenv='$d_clearenv'
21063 d_closedir='$d_closedir'
21064 d_cmsghdr_s='$d_cmsghdr_s'
21065 d_const='$d_const'
21066 d_copysignl='$d_copysignl'
21067 d_crypt='$d_crypt'
21068 d_crypt_r='$d_crypt_r'
21069 d_csh='$d_csh'
21070 d_ctermid_r='$d_ctermid_r'
21071 d_ctime_r='$d_ctime_r'
21072 d_cuserid='$d_cuserid'
21073 d_dbl_dig='$d_dbl_dig'
21074 d_dbminitproto='$d_dbminitproto'
21075 d_difftime='$d_difftime'
21076 d_dirfd='$d_dirfd'
21077 d_dirnamlen='$d_dirnamlen'
21078 d_dlerror='$d_dlerror'
21079 d_dlopen='$d_dlopen'
21080 d_dlsymun='$d_dlsymun'
21081 d_dosuid='$d_dosuid'
21082 d_drand48_r='$d_drand48_r'
21083 d_drand48proto='$d_drand48proto'
21084 d_dup2='$d_dup2'
21085 d_eaccess='$d_eaccess'
21086 d_endgrent='$d_endgrent'
21087 d_endgrent_r='$d_endgrent_r'
21088 d_endhent='$d_endhent'
21089 d_endhostent_r='$d_endhostent_r'
21090 d_endnent='$d_endnent'
21091 d_endnetent_r='$d_endnetent_r'
21092 d_endpent='$d_endpent'
21093 d_endprotoent_r='$d_endprotoent_r'
21094 d_endpwent='$d_endpwent'
21095 d_endpwent_r='$d_endpwent_r'
21096 d_endsent='$d_endsent'
21097 d_endservent_r='$d_endservent_r'
21098 d_eofnblk='$d_eofnblk'
21099 d_eunice='$d_eunice'
21100 d_faststdio='$d_faststdio'
21101 d_fchdir='$d_fchdir'
21102 d_fchmod='$d_fchmod'
21103 d_fchown='$d_fchown'
21104 d_fcntl='$d_fcntl'
21105 d_fcntl_can_lock='$d_fcntl_can_lock'
21106 d_fd_macros='$d_fd_macros'
21107 d_fd_set='$d_fd_set'
21108 d_fds_bits='$d_fds_bits'
21109 d_fgetpos='$d_fgetpos'
21110 d_finite='$d_finite'
21111 d_finitel='$d_finitel'
21112 d_flexfnam='$d_flexfnam'
21113 d_flock='$d_flock'
21114 d_flockproto='$d_flockproto'
21115 d_fork='$d_fork'
21116 d_fp_class='$d_fp_class'
21117 d_fpathconf='$d_fpathconf'
21118 d_fpclass='$d_fpclass'
21119 d_fpclassify='$d_fpclassify'
21120 d_fpclassl='$d_fpclassl'
21121 d_fpos64_t='$d_fpos64_t'
21122 d_frexpl='$d_frexpl'
21123 d_fs_data_s='$d_fs_data_s'
21124 d_fseeko='$d_fseeko'
21125 d_fsetpos='$d_fsetpos'
21126 d_fstatfs='$d_fstatfs'
21127 d_fstatvfs='$d_fstatvfs'
21128 d_fsync='$d_fsync'
21129 d_ftello='$d_ftello'
21130 d_ftime='$d_ftime'
21131 d_futimes='$d_futimes'
21132 d_getcwd='$d_getcwd'
21133 d_getespwnam='$d_getespwnam'
21134 d_getfsstat='$d_getfsstat'
21135 d_getgrent='$d_getgrent'
21136 d_getgrent_r='$d_getgrent_r'
21137 d_getgrgid_r='$d_getgrgid_r'
21138 d_getgrnam_r='$d_getgrnam_r'
21139 d_getgrps='$d_getgrps'
21140 d_gethbyaddr='$d_gethbyaddr'
21141 d_gethbyname='$d_gethbyname'
21142 d_gethent='$d_gethent'
21143 d_gethname='$d_gethname'
21144 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21145 d_gethostbyname_r='$d_gethostbyname_r'
21146 d_gethostent_r='$d_gethostent_r'
21147 d_gethostprotos='$d_gethostprotos'
21148 d_getitimer='$d_getitimer'
21149 d_getlogin='$d_getlogin'
21150 d_getlogin_r='$d_getlogin_r'
21151 d_getmnt='$d_getmnt'
21152 d_getmntent='$d_getmntent'
21153 d_getnbyaddr='$d_getnbyaddr'
21154 d_getnbyname='$d_getnbyname'
21155 d_getnent='$d_getnent'
21156 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21157 d_getnetbyname_r='$d_getnetbyname_r'
21158 d_getnetent_r='$d_getnetent_r'
21159 d_getnetprotos='$d_getnetprotos'
21160 d_getpagsz='$d_getpagsz'
21161 d_getpbyname='$d_getpbyname'
21162 d_getpbynumber='$d_getpbynumber'
21163 d_getpent='$d_getpent'
21164 d_getpgid='$d_getpgid'
21165 d_getpgrp2='$d_getpgrp2'
21166 d_getpgrp='$d_getpgrp'
21167 d_getppid='$d_getppid'
21168 d_getprior='$d_getprior'
21169 d_getprotobyname_r='$d_getprotobyname_r'
21170 d_getprotobynumber_r='$d_getprotobynumber_r'
21171 d_getprotoent_r='$d_getprotoent_r'
21172 d_getprotoprotos='$d_getprotoprotos'
21173 d_getprpwnam='$d_getprpwnam'
21174 d_getpwent='$d_getpwent'
21175 d_getpwent_r='$d_getpwent_r'
21176 d_getpwnam_r='$d_getpwnam_r'
21177 d_getpwuid_r='$d_getpwuid_r'
21178 d_getsbyname='$d_getsbyname'
21179 d_getsbyport='$d_getsbyport'
21180 d_getsent='$d_getsent'
21181 d_getservbyname_r='$d_getservbyname_r'
21182 d_getservbyport_r='$d_getservbyport_r'
21183 d_getservent_r='$d_getservent_r'
21184 d_getservprotos='$d_getservprotos'
21185 d_getspnam='$d_getspnam'
21186 d_getspnam_r='$d_getspnam_r'
21187 d_gettimeod='$d_gettimeod'
21188 d_gmtime_r='$d_gmtime_r'
21189 d_gnulibc='$d_gnulibc'
21190 d_grpasswd='$d_grpasswd'
21191 d_hasmntopt='$d_hasmntopt'
21192 d_htonl='$d_htonl'
21193 d_ilogbl='$d_ilogbl'
21194 d_index='$d_index'
21195 d_inetaton='$d_inetaton'
21196 d_int64_t='$d_int64_t'
21197 d_isascii='$d_isascii'
21198 d_isfinite='$d_isfinite'
21199 d_isinf='$d_isinf'
21200 d_isnan='$d_isnan'
21201 d_isnanl='$d_isnanl'
21202 d_killpg='$d_killpg'
21203 d_lchown='$d_lchown'
21204 d_ldbl_dig='$d_ldbl_dig'
21205 d_libm_lib_version='$d_libm_lib_version'
21206 d_link='$d_link'
21207 d_localtime_r='$d_localtime_r'
21208 d_locconv='$d_locconv'
21209 d_lockf='$d_lockf'
21210 d_longdbl='$d_longdbl'
21211 d_longlong='$d_longlong'
21212 d_lseekproto='$d_lseekproto'
21213 d_lstat='$d_lstat'
21214 d_madvise='$d_madvise'
21215 d_malloc_good_size='$d_malloc_good_size'
21216 d_malloc_size='$d_malloc_size'
21217 d_mblen='$d_mblen'
21218 d_mbstowcs='$d_mbstowcs'
21219 d_mbtowc='$d_mbtowc'
21220 d_memchr='$d_memchr'
21221 d_memcmp='$d_memcmp'
21222 d_memcpy='$d_memcpy'
21223 d_memmove='$d_memmove'
21224 d_memset='$d_memset'
21225 d_mkdir='$d_mkdir'
21226 d_mkdtemp='$d_mkdtemp'
21227 d_mkfifo='$d_mkfifo'
21228 d_mkstemp='$d_mkstemp'
21229 d_mkstemps='$d_mkstemps'
21230 d_mktime='$d_mktime'
21231 d_mmap='$d_mmap'
21232 d_modfl='$d_modfl'
21233 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21234 d_modflproto='$d_modflproto'
21235 d_mprotect='$d_mprotect'
21236 d_msg='$d_msg'
21237 d_msg_ctrunc='$d_msg_ctrunc'
21238 d_msg_dontroute='$d_msg_dontroute'
21239 d_msg_oob='$d_msg_oob'
21240 d_msg_peek='$d_msg_peek'
21241 d_msg_proxy='$d_msg_proxy'
21242 d_msgctl='$d_msgctl'
21243 d_msgget='$d_msgget'
21244 d_msghdr_s='$d_msghdr_s'
21245 d_msgrcv='$d_msgrcv'
21246 d_msgsnd='$d_msgsnd'
21247 d_msync='$d_msync'
21248 d_munmap='$d_munmap'
21249 d_mymalloc='$d_mymalloc'
21250 d_nice='$d_nice'
21251 d_nl_langinfo='$d_nl_langinfo'
21252 d_nv_preserves_uv='$d_nv_preserves_uv'
21253 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21254 d_off64_t='$d_off64_t'
21255 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21256 d_oldpthreads='$d_oldpthreads'
21257 d_oldsock='$d_oldsock'
21258 d_open3='$d_open3'
21259 d_pathconf='$d_pathconf'
21260 d_pause='$d_pause'
21261 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21262 d_phostname='$d_phostname'
21263 d_pipe='$d_pipe'
21264 d_poll='$d_poll'
21265 d_portable='$d_portable'
21266 d_procselfexe='$d_procselfexe'
21267 d_pthread_atfork='$d_pthread_atfork'
21268 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21269 d_pthread_yield='$d_pthread_yield'
21270 d_pwage='$d_pwage'
21271 d_pwchange='$d_pwchange'
21272 d_pwclass='$d_pwclass'
21273 d_pwcomment='$d_pwcomment'
21274 d_pwexpire='$d_pwexpire'
21275 d_pwgecos='$d_pwgecos'
21276 d_pwpasswd='$d_pwpasswd'
21277 d_pwquota='$d_pwquota'
21278 d_qgcvt='$d_qgcvt'
21279 d_quad='$d_quad'
21280 d_random_r='$d_random_r'
21281 d_readdir64_r='$d_readdir64_r'
21282 d_readdir='$d_readdir'
21283 d_readdir_r='$d_readdir_r'
21284 d_readlink='$d_readlink'
21285 d_readv='$d_readv'
21286 d_recvmsg='$d_recvmsg'
21287 d_rename='$d_rename'
21288 d_rewinddir='$d_rewinddir'
21289 d_rmdir='$d_rmdir'
21290 d_safebcpy='$d_safebcpy'
21291 d_safemcpy='$d_safemcpy'
21292 d_sanemcmp='$d_sanemcmp'
21293 d_sbrkproto='$d_sbrkproto'
21294 d_scalbnl='$d_scalbnl'
21295 d_sched_yield='$d_sched_yield'
21296 d_scm_rights='$d_scm_rights'
21297 d_seekdir='$d_seekdir'
21298 d_select='$d_select'
21299 d_sem='$d_sem'
21300 d_semctl='$d_semctl'
21301 d_semctl_semid_ds='$d_semctl_semid_ds'
21302 d_semctl_semun='$d_semctl_semun'
21303 d_semget='$d_semget'
21304 d_semop='$d_semop'
21305 d_sendmsg='$d_sendmsg'
21306 d_setegid='$d_setegid'
21307 d_seteuid='$d_seteuid'
21308 d_setgrent='$d_setgrent'
21309 d_setgrent_r='$d_setgrent_r'
21310 d_setgrps='$d_setgrps'
21311 d_sethent='$d_sethent'
21312 d_sethostent_r='$d_sethostent_r'
21313 d_setitimer='$d_setitimer'
21314 d_setlinebuf='$d_setlinebuf'
21315 d_setlocale='$d_setlocale'
21316 d_setlocale_r='$d_setlocale_r'
21317 d_setnent='$d_setnent'
21318 d_setnetent_r='$d_setnetent_r'
21319 d_setpent='$d_setpent'
21320 d_setpgid='$d_setpgid'
21321 d_setpgrp2='$d_setpgrp2'
21322 d_setpgrp='$d_setpgrp'
21323 d_setprior='$d_setprior'
21324 d_setproctitle='$d_setproctitle'
21325 d_setprotoent_r='$d_setprotoent_r'
21326 d_setpwent='$d_setpwent'
21327 d_setpwent_r='$d_setpwent_r'
21328 d_setregid='$d_setregid'
21329 d_setresgid='$d_setresgid'
21330 d_setresuid='$d_setresuid'
21331 d_setreuid='$d_setreuid'
21332 d_setrgid='$d_setrgid'
21333 d_setruid='$d_setruid'
21334 d_setsent='$d_setsent'
21335 d_setservent_r='$d_setservent_r'
21336 d_setsid='$d_setsid'
21337 d_setvbuf='$d_setvbuf'
21338 d_sfio='$d_sfio'
21339 d_shm='$d_shm'
21340 d_shmat='$d_shmat'
21341 d_shmatprototype='$d_shmatprototype'
21342 d_shmctl='$d_shmctl'
21343 d_shmdt='$d_shmdt'
21344 d_shmget='$d_shmget'
21345 d_sigaction='$d_sigaction'
21346 d_sigprocmask='$d_sigprocmask'
21347 d_sigsetjmp='$d_sigsetjmp'
21348 d_sockatmark='$d_sockatmark'
21349 d_sockatmarkproto='$d_sockatmarkproto'
21350 d_socket='$d_socket'
21351 d_socklen_t='$d_socklen_t'
21352 d_sockpair='$d_sockpair'
21353 d_socks5_init='$d_socks5_init'
21354 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21355 d_sqrtl='$d_sqrtl'
21356 d_srand48_r='$d_srand48_r'
21357 d_srandom_r='$d_srandom_r'
21358 d_sresgproto='$d_sresgproto'
21359 d_sresuproto='$d_sresuproto'
21360 d_statblks='$d_statblks'
21361 d_statfs_f_flags='$d_statfs_f_flags'
21362 d_statfs_s='$d_statfs_s'
21363 d_statvfs='$d_statvfs'
21364 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21365 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21366 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21367 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21368 d_stdio_stream_array='$d_stdio_stream_array'
21369 d_stdiobase='$d_stdiobase'
21370 d_stdstdio='$d_stdstdio'
21371 d_strchr='$d_strchr'
21372 d_strcoll='$d_strcoll'
21373 d_strctcpy='$d_strctcpy'
21374 d_strerrm='$d_strerrm'
21375 d_strerror='$d_strerror'
21376 d_strerror_r='$d_strerror_r'
21377 d_strftime='$d_strftime'
21378 d_strlcat='$d_strlcat'
21379 d_strlcpy='$d_strlcpy'
21380 d_strtod='$d_strtod'
21381 d_strtol='$d_strtol'
21382 d_strtold='$d_strtold'
21383 d_strtoll='$d_strtoll'
21384 d_strtoq='$d_strtoq'
21385 d_strtoul='$d_strtoul'
21386 d_strtoull='$d_strtoull'
21387 d_strtouq='$d_strtouq'
21388 d_strxfrm='$d_strxfrm'
21389 d_suidsafe='$d_suidsafe'
21390 d_symlink='$d_symlink'
21391 d_syscall='$d_syscall'
21392 d_syscallproto='$d_syscallproto'
21393 d_sysconf='$d_sysconf'
21394 d_sysernlst='$d_sysernlst'
21395 d_syserrlst='$d_syserrlst'
21396 d_system='$d_system'
21397 d_tcgetpgrp='$d_tcgetpgrp'
21398 d_tcsetpgrp='$d_tcsetpgrp'
21399 d_telldir='$d_telldir'
21400 d_telldirproto='$d_telldirproto'
21401 d_time='$d_time'
21402 d_times='$d_times'
21403 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21404 d_tm_tm_zone='$d_tm_tm_zone'
21405 d_tmpnam_r='$d_tmpnam_r'
21406 d_truncate='$d_truncate'
21407 d_ttyname_r='$d_ttyname_r'
21408 d_tzname='$d_tzname'
21409 d_u32align='$d_u32align'
21410 d_ualarm='$d_ualarm'
21411 d_umask='$d_umask'
21412 d_uname='$d_uname'
21413 d_union_semun='$d_union_semun'
21414 d_unordered='$d_unordered'
21415 d_unsetenv='$d_unsetenv'
21416 d_usleep='$d_usleep'
21417 d_usleepproto='$d_usleepproto'
21418 d_ustat='$d_ustat'
21419 d_vendorarch='$d_vendorarch'
21420 d_vendorbin='$d_vendorbin'
21421 d_vendorlib='$d_vendorlib'
21422 d_vendorscript='$d_vendorscript'
21423 d_vfork='$d_vfork'
21424 d_void_closedir='$d_void_closedir'
21425 d_voidsig='$d_voidsig'
21426 d_voidtty='$d_voidtty'
21427 d_volatile='$d_volatile'
21428 d_vprintf='$d_vprintf'
21429 d_wait4='$d_wait4'
21430 d_waitpid='$d_waitpid'
21431 d_wcstombs='$d_wcstombs'
21432 d_wctomb='$d_wctomb'
21433 d_writev='$d_writev'
21434 d_xenix='$d_xenix'
21435 date='$date'
21436 db_hashtype='$db_hashtype'
21437 db_prefixtype='$db_prefixtype'
21438 db_version_major='$db_version_major'
21439 db_version_minor='$db_version_minor'
21440 db_version_patch='$db_version_patch'
21441 defvoidused='$defvoidused'
21442 direntrytype='$direntrytype'
21443 dlext='$dlext'
21444 dlsrc='$dlsrc'
21445 doublesize='$doublesize'
21446 drand01='$drand01'
21447 drand48_r_proto='$drand48_r_proto'
21448 dynamic_ext='$dynamic_ext'
21449 eagain='$eagain'
21450 ebcdic='$ebcdic'
21451 echo='$echo'
21452 egrep='$egrep'
21453 emacs='$emacs'
21454 endgrent_r_proto='$endgrent_r_proto'
21455 endhostent_r_proto='$endhostent_r_proto'
21456 endnetent_r_proto='$endnetent_r_proto'
21457 endprotoent_r_proto='$endprotoent_r_proto'
21458 endpwent_r_proto='$endpwent_r_proto'
21459 endservent_r_proto='$endservent_r_proto'
21460 eunicefix='$eunicefix'
21461 exe_ext='$exe_ext'
21462 expr='$expr'
21463 extensions='$extensions'
21464 extras='$extras'
21465 fflushNULL='$fflushNULL'
21466 fflushall='$fflushall'
21467 find='$find'
21468 firstmakefile='$firstmakefile'
21469 flex='$flex'
21470 fpossize='$fpossize'
21471 fpostype='$fpostype'
21472 freetype='$freetype'
21473 from='$from'
21474 full_ar='$full_ar'
21475 full_csh='$full_csh'
21476 full_sed='$full_sed'
21477 gccansipedantic='$gccansipedantic'
21478 gccosandvers='$gccosandvers'
21479 gccversion='$gccversion'
21480 getgrent_r_proto='$getgrent_r_proto'
21481 getgrgid_r_proto='$getgrgid_r_proto'
21482 getgrnam_r_proto='$getgrnam_r_proto'
21483 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21484 gethostbyname_r_proto='$gethostbyname_r_proto'
21485 gethostent_r_proto='$gethostent_r_proto'
21486 getlogin_r_proto='$getlogin_r_proto'
21487 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21488 getnetbyname_r_proto='$getnetbyname_r_proto'
21489 getnetent_r_proto='$getnetent_r_proto'
21490 getprotobyname_r_proto='$getprotobyname_r_proto'
21491 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21492 getprotoent_r_proto='$getprotoent_r_proto'
21493 getpwent_r_proto='$getpwent_r_proto'
21494 getpwnam_r_proto='$getpwnam_r_proto'
21495 getpwuid_r_proto='$getpwuid_r_proto'
21496 getservbyname_r_proto='$getservbyname_r_proto'
21497 getservbyport_r_proto='$getservbyport_r_proto'
21498 getservent_r_proto='$getservent_r_proto'
21499 getspnam_r_proto='$getspnam_r_proto'
21500 gidformat='$gidformat'
21501 gidsign='$gidsign'
21502 gidsize='$gidsize'
21503 gidtype='$gidtype'
21504 glibpth='$glibpth'
21505 gmake='$gmake'
21506 gmtime_r_proto='$gmtime_r_proto'
21507 gnulibc_version='$gnulibc_version'
21508 grep='$grep'
21509 groupcat='$groupcat'
21510 groupstype='$groupstype'
21511 gzip='$gzip'
21512 h_fcntl='$h_fcntl'
21513 h_sysfile='$h_sysfile'
21514 hint='$hint'
21515 hostcat='$hostcat'
21516 html1dir='$html1dir'
21517 html1direxp='$html1direxp'
21518 html3dir='$html3dir'
21519 html3direxp='$html3direxp'
21520 i16size='$i16size'
21521 i16type='$i16type'
21522 i32size='$i32size'
21523 i32type='$i32type'
21524 i64size='$i64size'
21525 i64type='$i64type'
21526 i8size='$i8size'
21527 i8type='$i8type'
21528 i_arpainet='$i_arpainet'
21529 i_bsdioctl='$i_bsdioctl'
21530 i_crypt='$i_crypt'
21531 i_db='$i_db'
21532 i_dbm='$i_dbm'
21533 i_dirent='$i_dirent'
21534 i_dld='$i_dld'
21535 i_dlfcn='$i_dlfcn'
21536 i_fcntl='$i_fcntl'
21537 i_float='$i_float'
21538 i_fp='$i_fp'
21539 i_fp_class='$i_fp_class'
21540 i_gdbm='$i_gdbm'
21541 i_grp='$i_grp'
21542 i_ieeefp='$i_ieeefp'
21543 i_inttypes='$i_inttypes'
21544 i_langinfo='$i_langinfo'
21545 i_libutil='$i_libutil'
21546 i_limits='$i_limits'
21547 i_locale='$i_locale'
21548 i_machcthr='$i_machcthr'
21549 i_malloc='$i_malloc'
21550 i_math='$i_math'
21551 i_memory='$i_memory'
21552 i_mntent='$i_mntent'
21553 i_ndbm='$i_ndbm'
21554 i_netdb='$i_netdb'
21555 i_neterrno='$i_neterrno'
21556 i_netinettcp='$i_netinettcp'
21557 i_niin='$i_niin'
21558 i_poll='$i_poll'
21559 i_prot='$i_prot'
21560 i_pthread='$i_pthread'
21561 i_pwd='$i_pwd'
21562 i_rpcsvcdbm='$i_rpcsvcdbm'
21563 i_sfio='$i_sfio'
21564 i_sgtty='$i_sgtty'
21565 i_shadow='$i_shadow'
21566 i_socks='$i_socks'
21567 i_stdarg='$i_stdarg'
21568 i_stddef='$i_stddef'
21569 i_stdlib='$i_stdlib'
21570 i_string='$i_string'
21571 i_sunmath='$i_sunmath'
21572 i_sysaccess='$i_sysaccess'
21573 i_sysdir='$i_sysdir'
21574 i_sysfile='$i_sysfile'
21575 i_sysfilio='$i_sysfilio'
21576 i_sysin='$i_sysin'
21577 i_sysioctl='$i_sysioctl'
21578 i_syslog='$i_syslog'
21579 i_sysmman='$i_sysmman'
21580 i_sysmode='$i_sysmode'
21581 i_sysmount='$i_sysmount'
21582 i_sysndir='$i_sysndir'
21583 i_sysparam='$i_sysparam'
21584 i_sysresrc='$i_sysresrc'
21585 i_syssecrt='$i_syssecrt'
21586 i_sysselct='$i_sysselct'
21587 i_syssockio='$i_syssockio'
21588 i_sysstat='$i_sysstat'
21589 i_sysstatfs='$i_sysstatfs'
21590 i_sysstatvfs='$i_sysstatvfs'
21591 i_systime='$i_systime'
21592 i_systimek='$i_systimek'
21593 i_systimes='$i_systimes'
21594 i_systypes='$i_systypes'
21595 i_sysuio='$i_sysuio'
21596 i_sysun='$i_sysun'
21597 i_sysutsname='$i_sysutsname'
21598 i_sysvfs='$i_sysvfs'
21599 i_syswait='$i_syswait'
21600 i_termio='$i_termio'
21601 i_termios='$i_termios'
21602 i_time='$i_time'
21603 i_unistd='$i_unistd'
21604 i_ustat='$i_ustat'
21605 i_utime='$i_utime'
21606 i_values='$i_values'
21607 i_varargs='$i_varargs'
21608 i_varhdr='$i_varhdr'
21609 i_vfork='$i_vfork'
21610 ignore_versioned_solibs='$ignore_versioned_solibs'
21611 inc_version_list='$inc_version_list'
21612 inc_version_list_init='$inc_version_list_init'
21613 incpath='$incpath'
21614 inews='$inews'
21615 installarchlib='$installarchlib'
21616 installbin='$installbin'
21617 installhtml1dir='$installhtml1dir'
21618 installhtml3dir='$installhtml3dir'
21619 installman1dir='$installman1dir'
21620 installman3dir='$installman3dir'
21621 installprefix='$installprefix'
21622 installprefixexp='$installprefixexp'
21623 installprivlib='$installprivlib'
21624 installscript='$installscript'
21625 installsitearch='$installsitearch'
21626 installsitebin='$installsitebin'
21627 installsitehtml1dir='$installsitehtml1dir'
21628 installsitehtml3dir='$installsitehtml3dir'
21629 installsitelib='$installsitelib'
21630 installsiteman1dir='$installsiteman1dir'
21631 installsiteman3dir='$installsiteman3dir'
21632 installsitescript='$installsitescript'
21633 installstyle='$installstyle'
21634 installusrbinperl='$installusrbinperl'
21635 installvendorarch='$installvendorarch'
21636 installvendorbin='$installvendorbin'
21637 installvendorhtml1dir='$installvendorhtml1dir'
21638 installvendorhtml3dir='$installvendorhtml3dir'
21639 installvendorlib='$installvendorlib'
21640 installvendorman1dir='$installvendorman1dir'
21641 installvendorman3dir='$installvendorman3dir'
21642 installvendorscript='$installvendorscript'
21643 intsize='$intsize'
21644 issymlink='$issymlink'
21645 ivdformat='$ivdformat'
21646 ivsize='$ivsize'
21647 ivtype='$ivtype'
21648 known_extensions='$known_extensions'
21649 ksh='$ksh'
21650 ld='$ld'
21651 lddlflags='$lddlflags'
21652 ldflags='$ldflags'
21653 ldflags_uselargefiles='$ldflags_uselargefiles'
21654 ldlibpthname='$ldlibpthname'
21655 less='$less'
21656 lib_ext='$lib_ext'
21657 libc='$libc'
21658 libperl='$libperl'
21659 libpth='$libpth'
21660 libs='$libs'
21661 libsdirs='$libsdirs'
21662 libsfiles='$libsfiles'
21663 libsfound='$libsfound'
21664 libspath='$libspath'
21665 libswanted='$libswanted'
21666 libswanted_uselargefiles='$libswanted_uselargefiles'
21667 line='$line'
21668 lint='$lint'
21669 lkflags='$lkflags'
21670 ln='$ln'
21671 lns='$lns'
21672 localtime_r_proto='$localtime_r_proto'
21673 locincpth='$locincpth'
21674 loclibpth='$loclibpth'
21675 longdblsize='$longdblsize'
21676 longlongsize='$longlongsize'
21677 longsize='$longsize'
21678 lp='$lp'
21679 lpr='$lpr'
21680 ls='$ls'
21681 lseeksize='$lseeksize'
21682 lseektype='$lseektype'
21683 mail='$mail'
21684 mailx='$mailx'
21685 make='$make'
21686 make_set_make='$make_set_make'
21687 mallocobj='$mallocobj'
21688 mallocsrc='$mallocsrc'
21689 malloctype='$malloctype'
21690 man1dir='$man1dir'
21691 man1direxp='$man1direxp'
21692 man1ext='$man1ext'
21693 man3dir='$man3dir'
21694 man3direxp='$man3direxp'
21695 man3ext='$man3ext'
21696 mips_type='$mips_type'
21697 mistrustnm='$mistrustnm'
21698 mkdir='$mkdir'
21699 mmaptype='$mmaptype'
21700 modetype='$modetype'
21701 more='$more'
21702 multiarch='$multiarch'
21703 mv='$mv'
21704 myarchname='$myarchname'
21705 mydomain='$mydomain'
21706 myhostname='$myhostname'
21707 myuname='$myuname'
21708 n='$n'
21709 need_va_copy='$need_va_copy'
21710 netdb_hlen_type='$netdb_hlen_type'
21711 netdb_host_type='$netdb_host_type'
21712 netdb_name_type='$netdb_name_type'
21713 netdb_net_type='$netdb_net_type'
21714 nm='$nm'
21715 nm_opt='$nm_opt'
21716 nm_so_opt='$nm_so_opt'
21717 nonxs_ext='$nonxs_ext'
21718 nroff='$nroff'
21719 nvEUformat='$nvEUformat'
21720 nvFUformat='$nvFUformat'
21721 nvGUformat='$nvGUformat'
21722 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21723 nveformat='$nveformat'
21724 nvfformat='$nvfformat'
21725 nvgformat='$nvgformat'
21726 nvsize='$nvsize'
21727 nvtype='$nvtype'
21728 o_nonblock='$o_nonblock'
21729 obj_ext='$obj_ext'
21730 old_pthread_create_joinable='$old_pthread_create_joinable'
21731 optimize='$optimize'
21732 orderlib='$orderlib'
21733 osname='$osname'
21734 osvers='$osvers'
21735 otherlibdirs='$otherlibdirs'
21736 package='$package'
21737 pager='$pager'
21738 passcat='$passcat'
21739 patchlevel='$patchlevel'
21740 path_sep='$path_sep'
21741 perl5='$perl5'
21742 perl='$perl'
21743 perl_patchlevel='$perl_patchlevel'
21744 perladmin='$perladmin'
21745 perllibs='$perllibs'
21746 perlpath='$perlpath'
21747 pg='$pg'
21748 phostname='$phostname'
21749 pidtype='$pidtype'
21750 plibpth='$plibpth'
21751 pmake='$pmake'
21752 pr='$pr'
21753 prefix='$prefix'
21754 prefixexp='$prefixexp'
21755 privlib='$privlib'
21756 privlibexp='$privlibexp'
21757 procselfexe='$procselfexe'
21758 prototype='$prototype'
21759 ptrsize='$ptrsize'
21760 quadkind='$quadkind'
21761 quadtype='$quadtype'
21762 randbits='$randbits'
21763 randfunc='$randfunc'
21764 random_r_proto='$random_r_proto'
21765 randseedtype='$randseedtype'
21766 ranlib='$ranlib'
21767 rd_nodata='$rd_nodata'
21768 readdir64_r_proto='$readdir64_r_proto'
21769 readdir_r_proto='$readdir_r_proto'
21770 revision='$revision'
21771 rm='$rm'
21772 rmail='$rmail'
21773 run='$run'
21774 runnm='$runnm'
21775 sPRIEUldbl='$sPRIEUldbl'
21776 sPRIFUldbl='$sPRIFUldbl'
21777 sPRIGUldbl='$sPRIGUldbl'
21778 sPRIXU64='$sPRIXU64'
21779 sPRId64='$sPRId64'
21780 sPRIeldbl='$sPRIeldbl'
21781 sPRIfldbl='$sPRIfldbl'
21782 sPRIgldbl='$sPRIgldbl'
21783 sPRIi64='$sPRIi64'
21784 sPRIo64='$sPRIo64'
21785 sPRIu64='$sPRIu64'
21786 sPRIx64='$sPRIx64'
21787 sSCNfldbl='$sSCNfldbl'
21788 sched_yield='$sched_yield'
21789 scriptdir='$scriptdir'
21790 scriptdirexp='$scriptdirexp'
21791 sed='$sed'
21792 seedfunc='$seedfunc'
21793 selectminbits='$selectminbits'
21794 selecttype='$selecttype'
21795 sendmail='$sendmail'
21796 setgrent_r_proto='$setgrent_r_proto'
21797 sethostent_r_proto='$sethostent_r_proto'
21798 setlocale_r_proto='$setlocale_r_proto'
21799 setnetent_r_proto='$setnetent_r_proto'
21800 setprotoent_r_proto='$setprotoent_r_proto'
21801 setpwent_r_proto='$setpwent_r_proto'
21802 setservent_r_proto='$setservent_r_proto'
21803 sh='$sh'
21804 shar='$shar'
21805 sharpbang='$sharpbang'
21806 shmattype='$shmattype'
21807 shortsize='$shortsize'
21808 shrpenv='$shrpenv'
21809 shsharp='$shsharp'
21810 sig_count='$sig_count'
21811 sig_name='$sig_name'
21812 sig_name_init='$sig_name_init'
21813 sig_num='$sig_num'
21814 sig_num_init='$sig_num_init'
21815 sig_size='$sig_size'
21816 signal_t='$signal_t'
21817 sitearch='$sitearch'
21818 sitearchexp='$sitearchexp'
21819 sitebin='$sitebin'
21820 sitebinexp='$sitebinexp'
21821 sitehtml1dir='$sitehtml1dir'
21822 sitehtml1direxp='$sitehtml1direxp'
21823 sitehtml3dir='$sitehtml3dir'
21824 sitehtml3direxp='$sitehtml3direxp'
21825 sitelib='$sitelib'
21826 sitelib_stem='$sitelib_stem'
21827 sitelibexp='$sitelibexp'
21828 siteman1dir='$siteman1dir'
21829 siteman1direxp='$siteman1direxp'
21830 siteman3dir='$siteman3dir'
21831 siteman3direxp='$siteman3direxp'
21832 siteprefix='$siteprefix'
21833 siteprefixexp='$siteprefixexp'
21834 sitescript='$sitescript'
21835 sitescriptexp='$sitescriptexp'
21836 sizesize='$sizesize'
21837 sizetype='$sizetype'
21838 sleep='$sleep'
21839 smail='$smail'
21840 so='$so'
21841 sockethdr='$sockethdr'
21842 socketlib='$socketlib'
21843 socksizetype='$socksizetype'
21844 sort='$sort'
21845 spackage='$spackage'
21846 spitshell='$spitshell'
21847 srand48_r_proto='$srand48_r_proto'
21848 srandom_r_proto='$srandom_r_proto'
21849 src='$src'
21850 ssizetype='$ssizetype'
21851 startperl='$startperl'
21852 startsh='$startsh'
21853 static_ext='$static_ext'
21854 stdchar='$stdchar'
21855 stdio_base='$stdio_base'
21856 stdio_bufsiz='$stdio_bufsiz'
21857 stdio_cnt='$stdio_cnt'
21858 stdio_filbuf='$stdio_filbuf'
21859 stdio_ptr='$stdio_ptr'
21860 stdio_stream_array='$stdio_stream_array'
21861 strerror_r_proto='$strerror_r_proto'
21862 strings='$strings'
21863 submit='$submit'
21864 subversion='$subversion'
21865 sysman='$sysman'
21866 tail='$tail'
21867 tar='$tar'
21868 targetarch='$targetarch'
21869 tbl='$tbl'
21870 tee='$tee'
21871 test='$test'
21872 timeincl='$timeincl'
21873 timetype='$timetype'
21874 tmpnam_r_proto='$tmpnam_r_proto'
21875 to='$to'
21876 touch='$touch'
21877 tr='$tr'
21878 trnl='$trnl'
21879 troff='$troff'
21880 ttyname_r_proto='$ttyname_r_proto'
21881 u16size='$u16size'
21882 u16type='$u16type'
21883 u32size='$u32size'
21884 u32type='$u32type'
21885 u64size='$u64size'
21886 u64type='$u64type'
21887 u8size='$u8size'
21888 u8type='$u8type'
21889 uidformat='$uidformat'
21890 uidsign='$uidsign'
21891 uidsize='$uidsize'
21892 uidtype='$uidtype'
21893 uname='$uname'
21894 uniq='$uniq'
21895 uquadtype='$uquadtype'
21896 use5005threads='$use5005threads'
21897 use64bitall='$use64bitall'
21898 use64bitint='$use64bitint'
21899 usecrosscompile='$usecrosscompile'
21900 usedl='$usedl'
21901 usefaststdio='$usefaststdio'
21902 useithreads='$useithreads'
21903 uselargefiles='$uselargefiles'
21904 uselongdouble='$uselongdouble'
21905 usemallocwrap='$usemallocwrap'
21906 usemorebits='$usemorebits'
21907 usemultiplicity='$usemultiplicity'
21908 usemymalloc='$usemymalloc'
21909 usenm='$usenm'
21910 useopcode='$useopcode'
21911 useperlio='$useperlio'
21912 useposix='$useposix'
21913 usereentrant='$usereentrant'
21914 userelocatableinc='$userelocatableinc'
21915 usesfio='$usesfio'
21916 useshrplib='$useshrplib'
21917 usesitecustomize='$usesitecustomize'
21918 usesocks='$usesocks'
21919 usethreads='$usethreads'
21920 usevendorprefix='$usevendorprefix'
21921 usevfork='$usevfork'
21922 usrinc='$usrinc'
21923 uuname='$uuname'
21924 uvXUformat='$uvXUformat'
21925 uvoformat='$uvoformat'
21926 uvsize='$uvsize'
21927 uvtype='$uvtype'
21928 uvuformat='$uvuformat'
21929 uvxformat='$uvxformat'
21930 vendorarch='$vendorarch'
21931 vendorarchexp='$vendorarchexp'
21932 vendorbin='$vendorbin'
21933 vendorbinexp='$vendorbinexp'
21934 vendorhtml1dir='$vendorhtml1dir'
21935 vendorhtml1direxp='$vendorhtml1direxp'
21936 vendorhtml3dir='$vendorhtml3dir'
21937 vendorhtml3direxp='$vendorhtml3direxp'
21938 vendorlib='$vendorlib'
21939 vendorlib_stem='$vendorlib_stem'
21940 vendorlibexp='$vendorlibexp'
21941 vendorman1dir='$vendorman1dir'
21942 vendorman1direxp='$vendorman1direxp'
21943 vendorman3dir='$vendorman3dir'
21944 vendorman3direxp='$vendorman3direxp'
21945 vendorprefix='$vendorprefix'
21946 vendorprefixexp='$vendorprefixexp'
21947 vendorscript='$vendorscript'
21948 vendorscriptexp='$vendorscriptexp'
21949 version='$version'
21950 version_patchlevel_string='$version_patchlevel_string'
21951 versiononly='$versiononly'
21952 vi='$vi'
21953 voidflags='$voidflags'
21954 xlibpth='$xlibpth'
21955 yacc='$yacc'
21956 yaccflags='$yaccflags'
21957 zcat='$zcat'
21958 zip='$zip'
21959 EOT
21960
21961 : Add in command line options if available
21962 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21963
21964 : add special variables
21965 $test -f $src/patchlevel.h && \
21966 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21967 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21968 echo "PERL_CONFIG_SH=true" >>config.sh
21969
21970 : propagate old symbols
21971 if $test -f UU/config.sh; then
21972         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21973         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21974         $sort | $uniq -u >UU/oldsyms
21975         set X `cat UU/oldsyms`
21976         shift
21977         case $# in
21978         0) ;;
21979         *)
21980                 cat <<EOM
21981 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21982 EOM
21983                 echo "# Variables propagated from previous config.sh file." >>config.sh
21984                 for sym in `cat UU/oldsyms`; do
21985                         echo "    Propagating $hint variable "'$'"$sym..."
21986                         eval 'tmp="$'"${sym}"'"'
21987                         echo "$tmp" | \
21988                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21989                 done
21990                 ;;
21991         esac
21992 fi
21993
21994 : Finish up by extracting the .SH files
21995 case "$alldone" in
21996 exit)
21997         $rm -rf UU
21998         echo "Extraction done."
21999         exit 0
22000         ;;
22001 cont)
22002         ;;
22003 '')
22004         dflt=''
22005         nostick=true
22006         $cat <<EOM
22007
22008 If you'd like to make any changes to the config.sh file before I begin
22009 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22010
22011 EOM
22012         rp="Press return or use a shell escape to edit config.sh:"
22013         . UU/myread
22014         nostick=''
22015         case "$ans" in
22016         '') ;;
22017         *) : in case they cannot read
22018                 sh 1>&4 -c "$ans";;
22019         esac
22020         ;;
22021 esac
22022
22023 : if this fails, just run all the .SH files by hand
22024 . ./config.sh
22025
22026 echo " "
22027 exec 1>&4
22028 pwd=`pwd`
22029 . ./UU/extract
22030 cd "$pwd"
22031
22032 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22033         dflt=y
22034         case "$silent" in
22035         true) ;;
22036         *)
22037                 $cat <<EOM
22038
22039 Now you need to generate make dependencies by running "$make depend".
22040 You might prefer to run it in background: "$make depend > makedepend.out &"
22041 It can take a while, so you might not want to run it right now.
22042
22043 EOM
22044                 ;;
22045         esac
22046         rp="Run $make depend now?"
22047         . UU/myread
22048         case "$ans" in
22049         y*)
22050                 $make depend && echo "Now you must run '$make'."
22051                 ;;
22052         *)
22053                 echo "You must run '$make depend' then '$make'."
22054                 ;;
22055         esac
22056 elif test -f [Mm]akefile; then
22057         echo " "
22058         echo "Now you must run a $make."
22059 else
22060         echo "Configure done."
22061 fi
22062
22063 if $test -f Policy.sh; then
22064     $cat <<EOM
22065
22066 If you compile $package on a different machine or from a different object
22067 directory, copy the Policy.sh file from this object directory to the
22068 new one before you run Configure -- this will help you with most of
22069 the policy defaults.
22070
22071 EOM
22072 fi
22073 if $test -f config.msg; then
22074     echo "Hmm.  I also noted the following information while running:"
22075     echo " "
22076     $cat config.msg >&4
22077     $rm -f config.msg
22078 fi
22079 $rm -f kit*isdone ark*isdone
22080 $rm -rf UU
22081
22082 : End of Configure
22083