Get rid of a few more hardcoded string lengths.
[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 Tue Jan  3 16:44:36 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 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_snprintf=''
685 d_vsnprintf=''
686 d_sockatmark=''
687 d_sockatmarkproto=''
688 d_msg_ctrunc=''
689 d_msg_dontroute=''
690 d_msg_oob=''
691 d_msg_peek=''
692 d_msg_proxy=''
693 d_oldsock=''
694 d_scm_rights=''
695 d_socket=''
696 d_sockpair=''
697 sockethdr=''
698 socketlib=''
699 d_socklen_t=''
700 d_socks5_init=''
701 d_sprintf_returns_strlen=''
702 d_sqrtl=''
703 d_srand48_r=''
704 srand48_r_proto=''
705 d_srandom_r=''
706 srandom_r_proto=''
707 d_sresgproto=''
708 d_sresuproto=''
709 d_statblks=''
710 d_statfs_f_flags=''
711 d_statfs_s=''
712 d_fstatvfs=''
713 d_statvfs=''
714 d_stdio_cnt_lval=''
715 d_stdio_ptr_lval=''
716 d_stdio_ptr_lval_nochange_cnt=''
717 d_stdio_ptr_lval_sets_cnt=''
718 d_stdiobase=''
719 d_stdstdio=''
720 stdio_base=''
721 stdio_bufsiz=''
722 stdio_cnt=''
723 stdio_filbuf=''
724 stdio_ptr=''
725 d_index=''
726 d_strchr=''
727 d_strcoll=''
728 d_strctcpy=''
729 d_strerrm=''
730 d_strerror=''
731 d_sysernlst=''
732 d_syserrlst=''
733 d_strerror_r=''
734 strerror_r_proto=''
735 d_strftime=''
736 d_strlcat=''
737 d_strlcpy=''
738 d_strtod=''
739 d_strtol=''
740 d_strtold=''
741 d_strtoll=''
742 d_strtoq=''
743 d_strtoul=''
744 d_strtoull=''
745 d_strtouq=''
746 d_strxfrm=''
747 d_symlink=''
748 d_syscall=''
749 d_syscallproto=''
750 d_sysconf=''
751 d_system=''
752 d_tcgetpgrp=''
753 d_tcsetpgrp=''
754 d_telldirproto=''
755 d_time=''
756 timetype=''
757 clocktype=''
758 d_times=''
759 d_tmpnam_r=''
760 tmpnam_r_proto=''
761 d_truncate=''
762 d_ttyname_r=''
763 ttyname_r_proto=''
764 d_tzname=''
765 d_u32align=''
766 d_ualarm=''
767 d_umask=''
768 d_semctl_semid_ds=''
769 d_semctl_semun=''
770 d_union_semun=''
771 d_unordered=''
772 d_unsetenv=''
773 d_usleep=''
774 d_usleepproto=''
775 d_ustat=''
776 d_vfork=''
777 usevfork=''
778 d_voidsig=''
779 signal_t=''
780 d_volatile=''
781 d_charvspr=''
782 d_vprintf=''
783 d_wait4=''
784 d_waitpid=''
785 d_wcstombs=''
786 d_wctomb=''
787 d_writev=''
788 dlext=''
789 cccdlflags=''
790 ccdlflags=''
791 dlsrc=''
792 ld=''
793 lddlflags=''
794 usedl=''
795 doublesize=''
796 ebcdic=''
797 fflushNULL=''
798 fflushall=''
799 fpossize=''
800 fpostype=''
801 gccansipedantic=''
802 gccosandvers=''
803 gccversion=''
804 gidformat=''
805 gidsign=''
806 gidsize=''
807 gidtype=''
808 groupstype=''
809 h_fcntl=''
810 h_sysfile=''
811 html1dir=''
812 html1direxp=''
813 installhtml1dir=''
814 html3dir=''
815 html3direxp=''
816 installhtml3dir=''
817 i_arpainet=''
818 i_crypt=''
819 db_hashtype=''
820 db_prefixtype=''
821 db_version_major=''
822 db_version_minor=''
823 db_version_patch=''
824 i_db=''
825 i_dbm=''
826 i_rpcsvcdbm=''
827 d_dirnamlen=''
828 direntrytype=''
829 i_dirent=''
830 i_dld=''
831 i_dlfcn=''
832 i_fcntl=''
833 i_float=''
834 i_fp=''
835 i_fp_class=''
836 i_gdbm=''
837 d_grpasswd=''
838 i_grp=''
839 i_ieeefp=''
840 i_inttypes=''
841 i_langinfo=''
842 i_libutil=''
843 i_limits=''
844 i_locale=''
845 i_machcthr=''
846 i_malloc=''
847 i_math=''
848 i_memory=''
849 i_mntent=''
850 i_ndbm=''
851 i_netdb=''
852 i_neterrno=''
853 i_netinettcp=''
854 i_niin=''
855 i_sysin=''
856 i_poll=''
857 i_prot=''
858 i_pthread=''
859 d_pwage=''
860 d_pwchange=''
861 d_pwclass=''
862 d_pwcomment=''
863 d_pwexpire=''
864 d_pwgecos=''
865 d_pwpasswd=''
866 d_pwquota=''
867 i_pwd=''
868 i_sfio=''
869 i_shadow=''
870 i_socks=''
871 i_stddef=''
872 i_stdlib=''
873 i_string=''
874 strings=''
875 i_sunmath=''
876 i_sysaccess=''
877 i_sysdir=''
878 i_sysfile=''
879 d_voidtty=''
880 i_bsdioctl=''
881 i_sysfilio=''
882 i_sysioctl=''
883 i_syssockio=''
884 i_syslog=''
885 i_sysmman=''
886 i_sysmode=''
887 i_sysmount=''
888 i_sysndir=''
889 i_sysparam=''
890 i_sysresrc=''
891 i_syssecrt=''
892 i_sysselct=''
893 i_sysstat=''
894 i_sysstatfs=''
895 i_sysstatvfs=''
896 i_systimes=''
897 i_systypes=''
898 i_sysuio=''
899 i_sysun=''
900 i_sysutsname=''
901 i_sysvfs=''
902 i_syswait=''
903 i_sgtty=''
904 i_termio=''
905 i_termios=''
906 d_tm_tm_gmtoff=''
907 d_tm_tm_zone=''
908 i_systime=''
909 i_systimek=''
910 i_time=''
911 timeincl=''
912 i_unistd=''
913 i_ustat=''
914 i_utime=''
915 i_values=''
916 i_stdarg=''
917 i_varargs=''
918 i_varhdr=''
919 i_vfork=''
920 inc_version_list=''
921 inc_version_list_init=''
922 installprefix=''
923 installprefixexp=''
924 installstyle=''
925 installusrbinperl=''
926 intsize=''
927 longsize=''
928 shortsize=''
929 issymlink=''
930 libc=''
931 ldlibpthname=''
932 libperl=''
933 shrpenv=''
934 useshrplib=''
935 glibpth=''
936 libpth=''
937 loclibpth=''
938 plibpth=''
939 xlibpth=''
940 ignore_versioned_solibs=''
941 libs=''
942 libsdirs=''
943 libsfiles=''
944 libsfound=''
945 libspath=''
946 lns=''
947 d_PRIEUldbl=''
948 d_PRIFUldbl=''
949 d_PRIGUldbl=''
950 d_PRIeldbl=''
951 d_PRIfldbl=''
952 d_PRIgldbl=''
953 d_SCNfldbl=''
954 sPRIEUldbl=''
955 sPRIFUldbl=''
956 sPRIGUldbl=''
957 sPRIeldbl=''
958 sPRIfldbl=''
959 sPRIgldbl=''
960 sSCNfldbl=''
961 lseeksize=''
962 lseektype=''
963 make_set_make=''
964 d_mymalloc=''
965 freetype=''
966 mallocobj=''
967 mallocsrc=''
968 malloctype=''
969 usemallocwrap=''
970 usemymalloc=''
971 installman1dir=''
972 man1dir=''
973 man1direxp=''
974 man1ext=''
975 installman3dir=''
976 man3dir=''
977 man3direxp=''
978 man3ext=''
979 modetype=''
980 multiarch=''
981 mydomain=''
982 myhostname=''
983 phostname=''
984 c=''
985 n=''
986 d_eofnblk=''
987 eagain=''
988 o_nonblock=''
989 rd_nodata=''
990 need_va_copy=''
991 netdb_hlen_type=''
992 netdb_host_type=''
993 netdb_name_type=''
994 netdb_net_type=''
995 groupcat=''
996 hostcat=''
997 passcat=''
998 orderlib=''
999 ranlib=''
1000 d_perl_otherlibdirs=''
1001 otherlibdirs=''
1002 package=''
1003 spackage=''
1004 pager=''
1005 api_revision=''
1006 api_subversion=''
1007 api_version=''
1008 api_versionstring=''
1009 patchlevel=''
1010 perl_patchlevel=''
1011 revision=''
1012 subversion=''
1013 version=''
1014 version_patchlevel_string=''
1015 perl5=''
1016 perladmin=''
1017 perlpath=''
1018 d_nv_preserves_uv=''
1019 d_nv_zero_is_allbits_zero=''
1020 i16size=''
1021 i16type=''
1022 i32size=''
1023 i32type=''
1024 i64size=''
1025 i64type=''
1026 i8size=''
1027 i8type=''
1028 ivsize=''
1029 ivtype=''
1030 nv_preserves_uv_bits=''
1031 nvsize=''
1032 nvtype=''
1033 u16size=''
1034 u16type=''
1035 u32size=''
1036 u32type=''
1037 u64size=''
1038 u64type=''
1039 u8size=''
1040 u8type=''
1041 uvsize=''
1042 uvtype=''
1043 ivdformat=''
1044 nvEUformat=''
1045 nvFUformat=''
1046 nvGUformat=''
1047 nveformat=''
1048 nvfformat=''
1049 nvgformat=''
1050 uvXUformat=''
1051 uvoformat=''
1052 uvuformat=''
1053 uvxformat=''
1054 pidtype=''
1055 prefix=''
1056 prefixexp=''
1057 installprivlib=''
1058 privlib=''
1059 privlibexp=''
1060 prototype=''
1061 ptrsize=''
1062 d_PRIXU64=''
1063 d_PRId64=''
1064 d_PRIi64=''
1065 d_PRIo64=''
1066 d_PRIu64=''
1067 d_PRIx64=''
1068 sPRIXU64=''
1069 sPRId64=''
1070 sPRIi64=''
1071 sPRIo64=''
1072 sPRIu64=''
1073 sPRIx64=''
1074 d_quad=''
1075 quadkind=''
1076 quadtype=''
1077 uquadtype=''
1078 drand01=''
1079 randbits=''
1080 randfunc=''
1081 randseedtype=''
1082 seedfunc=''
1083 installscript=''
1084 scriptdir=''
1085 scriptdirexp=''
1086 selectminbits=''
1087 selecttype=''
1088 sh=''
1089 sig_count=''
1090 sig_name=''
1091 sig_name_init=''
1092 sig_num=''
1093 sig_num_init=''
1094 sig_size=''
1095 installsitearch=''
1096 sitearch=''
1097 sitearchexp=''
1098 installsitebin=''
1099 sitebin=''
1100 sitebinexp=''
1101 installsitehtml1dir=''
1102 sitehtml1dir=''
1103 sitehtml1direxp=''
1104 installsitehtml3dir=''
1105 sitehtml3dir=''
1106 sitehtml3direxp=''
1107 installsitelib=''
1108 sitelib=''
1109 sitelib_stem=''
1110 sitelibexp=''
1111 installsiteman1dir=''
1112 siteman1dir=''
1113 siteman1direxp=''
1114 installsiteman3dir=''
1115 siteman3dir=''
1116 siteman3direxp=''
1117 siteprefix=''
1118 siteprefixexp=''
1119 installsitescript=''
1120 sitescript=''
1121 sitescriptexp=''
1122 sizesize=''
1123 sizetype=''
1124 so=''
1125 socksizetype=''
1126 sharpbang=''
1127 shsharp=''
1128 spitshell=''
1129 src=''
1130 ssizetype=''
1131 startperl=''
1132 startsh=''
1133 stdchar=''
1134 d_stdio_stream_array=''
1135 stdio_stream_array=''
1136 sysman=''
1137 trnl=''
1138 uidformat=''
1139 uidsign=''
1140 uidsize=''
1141 uidtype=''
1142 archname64=''
1143 use64bitall=''
1144 use64bitint=''
1145 usefaststdio=''
1146 ccflags_uselargefiles=''
1147 ldflags_uselargefiles=''
1148 libswanted_uselargefiles=''
1149 uselargefiles=''
1150 uselongdouble=''
1151 usemorebits=''
1152 usemultiplicity=''
1153 nm_opt=''
1154 nm_so_opt=''
1155 runnm=''
1156 usenm=''
1157 useperlio=''
1158 userelocatableinc=''
1159 usesocks=''
1160 d_oldpthreads=''
1161 use5005threads=''
1162 useithreads=''
1163 usereentrant=''
1164 usethreads=''
1165 incpath=''
1166 mips_type=''
1167 usrinc=''
1168 d_vendorarch=''
1169 installvendorarch=''
1170 vendorarch=''
1171 vendorarchexp=''
1172 d_vendorbin=''
1173 installvendorbin=''
1174 vendorbin=''
1175 vendorbinexp=''
1176 installvendorhtml1dir=''
1177 vendorhtml1dir=''
1178 vendorhtml1direxp=''
1179 installvendorhtml3dir=''
1180 vendorhtml3dir=''
1181 vendorhtml3direxp=''
1182 d_vendorlib=''
1183 installvendorlib=''
1184 vendorlib=''
1185 vendorlib_stem=''
1186 vendorlibexp=''
1187 installvendorman1dir=''
1188 vendorman1dir=''
1189 vendorman1direxp=''
1190 installvendorman3dir=''
1191 vendorman3dir=''
1192 vendorman3direxp=''
1193 usevendorprefix=''
1194 vendorprefix=''
1195 vendorprefixexp=''
1196 d_vendorscript=''
1197 installvendorscript=''
1198 vendorscript=''
1199 vendorscriptexp=''
1200 versiononly=''
1201 defvoidused=''
1202 voidflags=''
1203 yacc=''
1204 yaccflags=''
1205 CONFIG=''
1206
1207 define='define'
1208 undef='undef'
1209 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1210 rmlist=''
1211
1212 : We must find out about Eunice early
1213 eunicefix=':'
1214 if test -f /etc/unixtovms; then
1215         eunicefix=/etc/unixtovms
1216 fi
1217 if test -f /etc/unixtovms.exe; then
1218         eunicefix=/etc/unixtovms.exe
1219 fi
1220
1221 : Set executable suffix now -- needed before hints available
1222 if test -f "/libs/version.library"; then
1223 : Amiga OS
1224     _exe=""
1225 elif test -f "/system/gnu_library/bin/ar.pm"; then
1226 : Stratus VOS
1227     _exe=".pm"
1228 elif test -n "$DJGPP"; then
1229 : DOS DJGPP
1230     _exe=".exe"
1231 elif test -d c:/. -o -n "$is_os2" ; then
1232 : OS/2 or cygwin
1233     _exe=".exe"
1234 fi
1235
1236 i_whoami=''
1237 ccname=''
1238 ccversion=''
1239 perllibs=''
1240 : set useposix=false in your hint file to disable the POSIX extension.
1241 useposix=true
1242 : set useopcode=false in your hint file to disable the Opcode extension.
1243 useopcode=true
1244 : Trailing extension.  Override this in a hint file, if needed.
1245 : Extra object files, if any, needed on this platform.
1246 archobjs=''
1247 archname=''
1248 : Possible local include directories to search.
1249 : Set locincpth to "" in a hint file to defeat local include searches.
1250 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1251 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1252 :
1253 : no include file wanted by default
1254 inclwanted=''
1255
1256 groupstype=''
1257 libnames=''
1258 : change the next line if compiling for Xenix/286 on Xenix/386
1259 xlibpth='/usr/lib/386 /lib/386'
1260 : Possible local library directories to search.
1261 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1262 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1263
1264 : general looking path for locating libraries
1265 glibpth="/lib /usr/lib $xlibpth"
1266 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1267 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1268 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1269
1270 : Private path used by Configure to find libraries.  Its value
1271 : is prepended to libpth. This variable takes care of special
1272 : machines, like the mips.  Usually, it should be empty.
1273 plibpth=''
1274
1275 : default library list
1276 libswanted=''
1277 : some systems want to use only the non-versioned libso:s
1278 ignore_versioned_solibs=''
1279 siteman1dir=''
1280 siteman3dir=''
1281 sitescript=''
1282 archname64=''
1283 ccflags_uselargefiles=''
1284 ldflags_uselargefiles=''
1285 libswanted_uselargefiles=''
1286 : set usemultiplicity on the Configure command line to enable multiplicity.
1287 : set usesocks on the Configure command line to enable socks.
1288 : set usethreads on the Configure command line to enable threads.
1289 usereentrant='undef'
1290 : full support for void wanted by default
1291 defvoidused=15
1292
1293 : List of libraries we want.
1294 : If anyone needs extra -lxxx, put those in a hint file.
1295 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1296 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1297 : We probably want to search /usr/shlib before most other libraries.
1298 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1299 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1300 glibpth="/usr/shlib $glibpth"
1301 : Do not use vfork unless overridden by a hint file.
1302 usevfork=false
1303
1304 : Find the basic shell for Bourne shell scripts
1305 case "$sh" in
1306 '')
1307         case "$SYSTYPE" in
1308         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1309         *) xxx='/bin/sh';;
1310         esac
1311         if test -f "$xxx"; then
1312                 sh="$xxx"
1313         else
1314                 : Build up a list and do a single loop so we can 'break' out.
1315                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1316                 for xxx in sh bash ksh pdksh ash; do
1317                         for p in $pth; do
1318                                 try="$try ${p}/${xxx}"
1319                         done
1320                 done
1321                 for xxx in $try; do
1322                         if test -f "$xxx"; then
1323                                 sh="$xxx";
1324                                 break
1325                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1326                                 sh="$xxx";
1327                                 break
1328                         elif test -f "$xxx.exe"; then
1329                                 sh="$xxx";
1330                                 break
1331                         fi
1332                 done
1333         fi
1334         ;;
1335 esac
1336
1337 case "$sh" in
1338 '')     cat >&2 <<EOM
1339 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1340
1341 Usually it's in /bin/sh.  How did you even get this far?
1342 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1343 we'll try to straighten this all out.
1344 EOM
1345         exit 1
1346         ;;
1347 esac
1348
1349 : see if sh knows # comments
1350 if `$sh -c '#' >/dev/null 2>&1`; then
1351         shsharp=true
1352         spitshell=cat
1353         xcat=/bin/cat
1354         test -f $xcat$_exe || xcat=/usr/bin/cat
1355         if test ! -f $xcat$_exe; then
1356                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1357                         if test -f $p/cat$_exe; then
1358                                 xcat=$p/cat
1359                                 break
1360                         fi
1361                 done
1362                 if test ! -f $xcat$_exe; then
1363                         echo "Can't find cat anywhere!"
1364                         exit 1
1365                 fi
1366         fi
1367         echo "#!$xcat" >sharp
1368         $eunicefix sharp
1369         chmod +x sharp
1370         ./sharp > today
1371         if test -s today; then
1372                 sharpbang='#!'
1373         else
1374                 echo "#! $xcat" > sharp
1375                 $eunicefix sharp
1376                 chmod +x sharp
1377                 ./sharp > today
1378                 if test -s today; then
1379                         sharpbang='#! '
1380                 else
1381                         sharpbang=': use '
1382                 fi
1383         fi
1384 else
1385         echo " "
1386         echo "Your $sh doesn't grok # comments--I will strip them later on."
1387         shsharp=false
1388         cd ..
1389         echo "exec grep -v '^[  ]*#'" >spitshell
1390         chmod +x spitshell
1391         $eunicefix spitshell
1392         spitshell=`pwd`/spitshell
1393         cd UU
1394         echo "I presume that if # doesn't work, #! won't work either!"
1395         sharpbang=': use '
1396 fi
1397 rm -f sharp today
1398
1399 : figure out how to guarantee sh startup
1400 case "$startsh" in
1401 '') startsh=${sharpbang}${sh} ;;
1402 *)
1403 esac
1404 cat >sharp <<EOSS
1405 $startsh
1406 set abc
1407 test "$?abc" != 1
1408 EOSS
1409
1410 chmod +x sharp
1411 $eunicefix sharp
1412 if ./sharp; then
1413         : echo "Yup, it does."
1414 else
1415         echo "Hmm... '$startsh' does not guarantee sh startup..."
1416         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1417 fi
1418 rm -f sharp
1419
1420
1421 : Save command line options in file UU/cmdline.opt for later use in
1422 : generating config.sh.
1423 cat > cmdline.opt <<EOSH
1424 # Configure command line arguments.
1425 config_arg0='$0'
1426 config_args='$*'
1427 config_argc=$#
1428 EOSH
1429 argn=1
1430 args_exp=''
1431 args_sep=''
1432 for arg in "$@"; do
1433         cat >>cmdline.opt <<EOSH
1434 config_arg$argn='$arg'
1435 EOSH
1436         # Extreme backslashitis: replace each ' by '"'"'
1437         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1438 $arg
1439 EOC
1440         arg_exp=`cat cmdl.opt`
1441         args_exp="$args_exp$args_sep'$arg_exp'"
1442         argn=`expr $argn + 1`
1443         args_sep=' '
1444 done
1445 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1446 # used by ./hints/os2.sh
1447 rm -f cmdl.opt
1448
1449 : produce awk script to parse command line options
1450 cat >options.awk <<'EOF'
1451 BEGIN {
1452         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1453
1454         len = length(optstr);
1455         for (i = 1; i <= len; i++) {
1456                 c = substr(optstr, i, 1);
1457                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1458                 if (a == ":") {
1459                         arg[c] = 1;
1460                         i++;
1461                 }
1462                 opt[c] = 1;
1463         }
1464 }
1465 {
1466         expect = 0;
1467         str = $0;
1468         if (substr(str, 1, 1) != "-") {
1469                 printf("'%s'\n", str);
1470                 next;
1471         }
1472         len = length($0);
1473         for (i = 2; i <= len; i++) {
1474                 c = substr(str, i, 1);
1475                 if (!opt[c]) {
1476                         printf("-%s\n", substr(str, i));
1477                         next;
1478                 }
1479                 printf("-%s\n", c);
1480                 if (arg[c]) {
1481                         if (i < len)
1482                                 printf("'%s'\n", substr(str, i + 1));
1483                         else
1484                                 expect = 1;
1485                         next;
1486                 }
1487         }
1488 }
1489 END {
1490         if (expect)
1491                 print "?";
1492 }
1493 EOF
1494
1495 : process the command line options
1496 set X `for arg in "$@"; do echo "X$arg"; done |
1497         sed -e s/X// | awk -f options.awk`
1498 eval "set $*"
1499 shift
1500 rm -f options.awk
1501
1502 : set up default values
1503 fastread=''
1504 reuseval=false
1505 config_sh=''
1506 alldone=''
1507 error=''
1508 silent=''
1509 extractsh=''
1510 override=''
1511 knowitall=''
1512 rm -f optdef.sh posthint.sh
1513 cat >optdef.sh <<EOS
1514 $startsh
1515 EOS
1516
1517
1518 : option parsing
1519 while test $# -gt 0; do
1520         case "$1" in
1521         -d) shift; fastread=yes;;
1522         -e) shift; alldone=cont;;
1523         -f)
1524                 shift
1525                 cd ..
1526                 if test -r "$1"; then
1527                         config_sh="$1"
1528                 else
1529                         echo "$me: cannot read config file $1." >&2
1530                         error=true
1531                 fi
1532                 cd UU
1533                 shift;;
1534         -h) shift; error=true;;
1535         -r) shift; reuseval=true;;
1536         -s) shift; silent=true; realsilent=true;;
1537         -E) shift; alldone=exit;;
1538         -K) shift; knowitall=true;;
1539         -O) shift; override=true;;
1540         -S) shift; silent=true; extractsh=true;;
1541         -D)
1542                 shift
1543                 case "$1" in
1544                 *=)
1545                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1546                         echo "$me: ignoring -D $1" >&2
1547                         ;;
1548                 *=*) echo "$1" | \
1549                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1550                 *) echo "$1='define'" >> optdef.sh;;
1551                 esac
1552                 shift
1553                 ;;
1554         -U)
1555                 shift
1556                 case "$1" in
1557                 *=) echo "$1" >> optdef.sh;;
1558                 *=*)
1559                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1560                         echo "$me: ignoring -U $1" >&2
1561                         ;;
1562                 *) echo "$1='undef'" >> optdef.sh;;
1563                 esac
1564                 shift
1565                 ;;
1566         -A)
1567             shift
1568             xxx=''
1569             yyy="$1"
1570             zzz=''
1571             uuu=undef
1572             case "$yyy" in
1573             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1574                  case "$zzz" in
1575                  *:*) zzz='' ;;
1576                  *)   xxx=append
1577                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1578                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1579                  esac
1580                  ;;
1581             esac
1582             case "$xxx" in
1583             '')  case "$yyy" in
1584                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1585                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1586                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1587                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1588                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1589                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1590                  esac
1591                  ;;       
1592             esac
1593             case "$xxx" in
1594             append)
1595                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1596             clear)
1597                 echo "$yyy=''"                  >> posthint.sh ;;
1598             define)
1599                 case "$zzz" in
1600                 '') zzz=define ;;
1601                 esac
1602                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1603             eval)
1604                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1605             prepend)
1606                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1607             undef)
1608                 case "$zzz" in
1609                 '') zzz="$uuu" ;;
1610                 esac
1611                 echo "$yyy=$zzz"                >> posthint.sh ;;
1612             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1613             esac
1614             shift
1615             ;;
1616         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1617             exit 0;;
1618         --) break;;
1619         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1620         *) break;;
1621         esac
1622 done
1623
1624 case "$error" in
1625 true)
1626         cat >&2 <<EOM
1627 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1628                  [-U symbol] [-U symbol=] [-A command:symbol...]
1629   -d : use defaults for all answers.
1630   -e : go on without questioning past the production of config.sh.
1631   -f : specify an alternate default configuration file.
1632   -h : print this help message and exit (with an error status).
1633   -r : reuse C symbols value if possible (skips costly nm extraction).
1634   -s : silent mode, only echoes questions and essential information.
1635   -D : define symbol to have some value:
1636          -D symbol         symbol gets the value 'define'
1637          -D symbol=value   symbol gets the value 'value'
1638   -E : stop at the end of questions, after having produced config.sh.
1639   -K : do not use unless you know what you are doing.
1640   -O : let -D and -U override definitions from loaded configuration file.
1641   -S : perform variable substitutions on all .SH files (can mix with -f)
1642   -U : undefine symbol:
1643          -U symbol    symbol gets the value 'undef'
1644          -U symbol=   symbol gets completely empty
1645   -A : manipulate symbol after the platform specific hints have been applied:
1646          -A symbol=value                append " "value to symbol
1647          -A append:symbol=value         append value to symbol
1648          -A define:symbol=value         define symbol to have value
1649          -A clear:symbol                define symbol to be ''
1650          -A define:symbol               define symbol to be 'define'
1651          -A eval:symbol=value           define symbol to be eval of value
1652          -A prepend:symbol=value        prepend value to symbol
1653          -A undef:symbol                define symbol to be 'undef'
1654          -A undef:symbol=               define symbol to be ''
1655   -V : print version number and exit (with a zero status).
1656 EOM
1657         exit 1
1658         ;;
1659 esac
1660
1661 : Sanity checks
1662 case "$fastread$alldone" in
1663 yescont|yesexit) ;;
1664 *)
1665         case "$extractsh" in
1666         true) ;;
1667         *)
1668                 if test ! -t 0; then
1669                         echo "Say 'sh Configure', not 'sh <Configure'"
1670                         exit 1
1671                 fi
1672                 ;;
1673         esac
1674         ;;
1675 esac
1676
1677 exec 4>&1
1678 case "$silent" in
1679 true) exec 1>/dev/null;;
1680 esac
1681
1682 : run the defines and the undefines, if any, but leave the file out there...
1683 touch optdef.sh
1684 . ./optdef.sh
1685 : create the posthint manipulation script and leave the file out there...
1686 touch posthint.sh
1687
1688 : set package name
1689 package=perl5
1690 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1691 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1692 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1693 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1694 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1695 esac
1696
1697 : Some greps do not return status, grrr.
1698 echo "grimblepritz" >grimble
1699 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1700         contains=contains
1701 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1702         contains=grep
1703 else
1704         contains=contains
1705 fi
1706 rm -f grimble
1707 : the following should work in any shell
1708 case "$contains" in
1709 contains*)
1710         echo " "
1711         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1712         cat >contains <<'EOSS'
1713 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1714 EOSS
1715 chmod +x contains
1716 esac
1717
1718 : Find the path to the source tree
1719 case "$src" in
1720 '') case "$0" in
1721     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1722          case "$src" in
1723          /*)    ;;
1724          .)     ;;
1725          *)     src=`cd ../$src && pwd` ;;
1726          esac
1727          ;;
1728     *)   src='.';;
1729     esac;;
1730 esac
1731 case "$src" in
1732 '')     src=/
1733         rsrc=/
1734         ;;
1735 /*) rsrc="$src";;
1736 *) rsrc="../$src";;
1737 esac
1738 if test -f $rsrc/Configure && \
1739         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1740 then
1741    : found it, so we are ok.
1742 else
1743         rsrc=''
1744         for src in . .. ../.. ../../.. ../../../..; do
1745                 if test -f ../$src/Configure && \
1746                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1747                 then
1748                         rsrc=../$src
1749                         break
1750                 fi
1751         done
1752 fi
1753 case "$rsrc" in
1754 '')
1755         cat <<EOM >&4
1756
1757 Sorry, I can't seem to locate the source dir for $package.  Please start
1758 Configure with an explicit path -- i.e. /some/path/Configure.
1759
1760 EOM
1761         exit 1
1762         ;;
1763 ../.)   rsrc='..';;
1764 *)
1765         echo " "
1766         echo "Sources for $package found in \"$src\"." >&4
1767         ;;
1768 esac
1769
1770 : script used to extract .SH files with variable substitutions
1771 cat >extract <<'EOS'
1772 PERL_CONFIG_SH=true
1773 echo "Doing variable substitutions on .SH files..."
1774 if test -f MANIFEST; then
1775         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1776 else
1777         echo "(Looking for .SH files under the source directory.)"
1778         set x `(cd "$src"; find . -name "*.SH" -print)`
1779 fi
1780 shift
1781 case $# in
1782 0) set x `(cd "$src"; echo *.SH)`; shift;;
1783 esac
1784 if test ! -f "$src/$1"; then
1785         shift
1786 fi
1787 mkdir_p='
1788 name=$1;
1789 create="";
1790 while test $name; do
1791         if test ! -d "$name"; then
1792                 create="$name $create";
1793                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1794                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1795         else
1796                 name="";
1797         fi;
1798 done;
1799 for file in $create; do
1800         mkdir $file;
1801 done
1802 '
1803 for file in $*; do
1804         case "$src" in
1805         ".")
1806                 case "$file" in
1807                 */*)
1808                         dir=`expr X$file : 'X\(.*\)/'`
1809                         file=`expr X$file : 'X.*/\(.*\)'`
1810                         (cd "$dir" && . ./$file)
1811                         ;;
1812                 *)
1813                         . ./$file
1814                         ;;
1815                 esac
1816                 ;;
1817         *)
1818                 case "$file" in
1819                 */*)
1820                         dir=`expr X$file : 'X\(.*\)/'`
1821                         file=`expr X$file : 'X.*/\(.*\)'`
1822                         (set x $dir; shift; eval $mkdir_p)
1823                         sh <"$src/$dir/$file"
1824                         ;;
1825                 *)
1826                         sh <"$src/$file"
1827                         ;;
1828                 esac
1829                 ;;
1830         esac
1831 done
1832 if test -f "$src/config_h.SH"; then
1833         if test ! -f config.h; then
1834         : oops, they left it out of MANIFEST, probably, so do it anyway.
1835         . "$src/config_h.SH"
1836         fi
1837 fi
1838 EOS
1839
1840 : extract files and exit if asked to do so
1841 case "$extractsh" in
1842 true)
1843         case "$realsilent" in
1844         true) ;;
1845         *) exec 1>&4;;
1846         esac
1847         case "$config_sh" in
1848         '') config_sh='config.sh';;
1849         esac
1850         echo " "
1851         echo "Fetching answers from $config_sh..."
1852         cd ..
1853         . $config_sh
1854         test "$override" && . ./optdef.sh
1855         echo " "
1856         . UU/extract
1857         rm -rf UU
1858         echo "Extraction done."
1859         exit 0
1860         ;;
1861 esac
1862
1863 : Eunice requires " " instead of "", can you believe it
1864 echo " "
1865 : Here we go...
1866 echo "Beginning of configuration questions for $package."
1867
1868 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1869
1870 : first determine how to suppress newline on echo command
1871 echo " "
1872 echo "Checking echo to see how to suppress newlines..."
1873 (echo "hi there\c" ; echo " ") >.echotmp
1874 if $contains c .echotmp >/dev/null 2>&1 ; then
1875         echo "...using -n."
1876         n='-n'
1877         c=''
1878 else
1879         cat <<'EOM'
1880 ...using \c
1881 EOM
1882         n=''
1883         c='\c'
1884 fi
1885 echo $n "The star should be here-->$c"
1886 echo '*'
1887 rm -f .echotmp
1888
1889 : Now test for existence of everything in MANIFEST
1890 echo " "
1891 if test -f "$rsrc/MANIFEST"; then
1892         echo "First let's make sure your kit is complete.  Checking..." >&4
1893         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1894         rm -f missing
1895         tmppwd=`pwd`
1896         for filelist in x??; do
1897                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1898         done
1899         if test -s missing; then
1900                 cat missing >&4
1901                 cat >&4 <<'EOM'
1902
1903 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1904
1905 You have the option of continuing the configuration process, despite the
1906 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1907 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1908 and contact the author (perlbug@perl.org).
1909
1910 EOM
1911                 echo $n "Continue? [n] $c" >&4
1912                 read ans
1913                 case "$ans" in
1914                 y*)
1915                         echo "Continuing..." >&4
1916                         rm -f missing
1917                         ;;
1918                 *)
1919                         echo "ABORTING..." >&4
1920                         kill $$
1921                         ;;
1922                 esac
1923         else
1924                 echo "Looks good..."
1925         fi
1926 else
1927         echo "There is no MANIFEST file.  I hope your kit is complete !"
1928 fi
1929 rm -f missing x??
1930
1931 echo " "
1932 : Find the appropriate value for a newline for tr
1933 if test -n "$DJGPP"; then
1934        trnl='\012'
1935 fi
1936 if test X"$trnl" = X; then
1937         case "`echo foo|tr '\n' x 2>/dev/null`" in
1938         foox) trnl='\n' ;;
1939         esac
1940 fi
1941 if test X"$trnl" = X; then
1942         case "`echo foo|tr '\012' x 2>/dev/null`" in
1943         foox) trnl='\012' ;;
1944         esac
1945 fi
1946 if test X"$trnl" = X; then
1947        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1948        fooxy) trnl='\n\r' ;;
1949        esac
1950 fi
1951 if test X"$trnl" = X; then
1952         cat <<EOM >&2
1953
1954 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1955
1956 EOM
1957         exit 1
1958 fi
1959
1960 : compute the number of columns on the terminal for proper question formatting
1961 case "$COLUMNS" in
1962 '') COLUMNS='80';;
1963 esac
1964
1965 : set up the echo used in my read
1966 myecho="case \"\$xxxm\" in
1967 '') echo $n \"\$rp $c\" >&4;;
1968 *) case \"\$rp\" in
1969         '') echo $n \"[\$xxxm] $c\";;
1970         *)
1971                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1972                         echo \"\$rp\" >&4
1973                         echo $n \"[\$xxxm] $c\" >&4
1974                 else
1975                         echo $n \"\$rp [\$xxxm] $c\" >&4
1976                 fi
1977                 ;;
1978         esac;;
1979 esac"
1980
1981 : now set up to do reads with possible shell escape and default assignment
1982 cat <<EOSC >myread
1983 $startsh
1984 xxxm=\$dflt
1985 $myecho
1986 ans='!'
1987 case "\$fastread" in
1988 yes) case "\$dflt" in
1989         '') ;;
1990         *) ans='';
1991                 case "\$silent-\$rp" in
1992                 true-) ;;
1993                 *) echo " " >&4;;
1994                 esac;;
1995         esac;;
1996 *) case "\$silent" in
1997         true) case "\$rp" in
1998                 '') ans='';;
1999                 esac;;
2000         esac;;
2001 esac
2002 while expr "X\$ans" : "X!" >/dev/null; do
2003         read answ
2004         set x \$xxxm
2005         shift
2006         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2007         case  "\$answ" in
2008         "!")
2009                 sh 1>&4
2010                 echo " "
2011                 $myecho
2012                 ;;
2013         !*)
2014                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2015                 shift
2016                 sh 1>&4 -c "\$*"
2017                 echo " "
2018                 $myecho
2019                 ;;
2020         "\$ans")
2021                 case "\$ans" in
2022                 \\&*)
2023                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2024                         shift
2025                         case "\$1" in
2026                         -d)
2027                                 fastread=yes
2028                                 echo "(OK, I'll run with -d after this question.)" >&4
2029                                 ;;
2030                         -*)
2031                                 echo "*** Sorry, \$1 not supported yet." >&4
2032                                 ;;
2033                         esac
2034                         $myecho
2035                         ans=!
2036                         ;;
2037                 esac;;
2038         *)
2039                 case "\$aok" in
2040                 y)
2041                         echo "*** Substitution done -- please confirm."
2042                         xxxm="\$ans"
2043                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2044                         xxxm="\$ans"
2045                         ans=!
2046                         ;;
2047                 *)
2048                         echo "*** Error -- try again."
2049                         ans=!
2050                         ;;
2051                 esac
2052                 $myecho
2053                 ;;
2054         esac
2055         case "\$ans\$xxxm\$nostick" in
2056         '')
2057                 ans=!
2058                 $myecho
2059                 ;;
2060         esac
2061 done
2062 case "\$ans" in
2063 '') ans="\$xxxm";;
2064 esac
2065 EOSC
2066
2067 : create .config dir to save info across Configure sessions
2068 test -d ../.config || mkdir ../.config
2069 cat >../.config/README <<EOF
2070 This directory created by Configure to save information that should
2071 persist across sessions for $package.
2072
2073 You may safely delete it if you wish.
2074 EOF
2075
2076 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2077 case "$usedevel" in
2078 $define|true|[yY]*) ;;
2079 *) case "$xversion" in
2080    *[13579])
2081         cat >&4 <<EOH
2082 *** WHOA THERE!!! ***
2083
2084     This is an UNSTABLE DEVELOPMENT release.
2085     The version of this $package distribution is $xversion, that is, odd,
2086     (as opposed to even) and that signifies a development release.
2087     If you want a maintenance release, you want an even-numbered version.
2088
2089     Do ***NOT*** install this into production use.
2090     Data corruption and crashes are possible.
2091
2092     It is most seriously suggested that you do not continue any further
2093     unless you want to help in developing and debugging Perl.
2094
2095     If you *still* want to build perl, you can answer 'y' now,
2096     or pass -Dusedevel to Configure.
2097
2098 EOH
2099         rp='Do you really want to continue?'
2100         dflt='n'
2101         . ./myread
2102         case "$ans" in
2103         [yY]) echo >&4 "Okay, continuing."
2104               usedevel="$define" ;;
2105         *) echo >&4 "Okay, bye."
2106            exit 1
2107            ;;
2108         esac
2109         ;;
2110     esac
2111     ;;
2112 esac
2113 case "$usedevel" in
2114 $define|true|[yY]*)
2115         case "$versiononly" in
2116         '') versiononly="$define" ;;
2117         esac
2118         case "$installusrbinperl" in
2119         '') installusrbinperl="$undef" ;;
2120         esac
2121         ;;
2122 esac
2123
2124 : general instructions
2125 needman=true
2126 firsttime=true
2127 user=`(logname) 2>/dev/null`
2128 case "$user" in
2129 '') user=`whoami 2>&1`;;
2130 esac
2131 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2132         firsttime=false
2133         echo " "
2134         rp='Would you like to see the instructions?'
2135         dflt=n
2136         . ./myread
2137         case "$ans" in
2138         [yY]*) ;;
2139         *) needman=false;;
2140         esac
2141 fi
2142 if $needman; then
2143         cat <<EOH
2144
2145 This installation shell script will examine your system and ask you questions
2146 to determine how the perl5 package should be installed. If you get
2147 stuck on a question, you may use a ! shell escape to start a subshell or
2148 execute a command.  Many of the questions will have default answers in square
2149 brackets; typing carriage return will give you the default.
2150
2151 On some of the questions which ask for file or directory names you are allowed
2152 to use the ~name construct to specify the login directory belonging to "name",
2153 even if you don't have a shell which knows about that.  Questions where this is
2154 allowed will be marked "(~name ok)".
2155
2156 EOH
2157         rp=''
2158         dflt='Type carriage return to continue'
2159         . ./myread
2160         cat <<'EOH'
2161
2162 The prompter used in this script allows you to use shell variables and
2163 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2164 in the default answer, as if the default line was a set of arguments given to a
2165 script shell.  This means you may also use $* to repeat the whole default line,
2166 so you do not have to re-type everything to add something to the default.
2167
2168 Everytime there is a substitution, you will have to confirm.  If there is an
2169 error (e.g. an unmatched backtick), the default answer will remain unchanged
2170 and you will be prompted again.
2171
2172 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2173 the questions and use the computed defaults (or the previous answers if there
2174 was already a config.sh file). Type 'Configure -h' for a list of options.
2175 You may also start interactively and then answer '& -d' at any prompt to turn
2176 on the non-interactive behaviour for the remainder of the execution.
2177
2178 EOH
2179         . ./myread
2180         cat <<EOH
2181
2182 Much effort has been expended to ensure that this shell script will run on any
2183 Unix system.  If despite that it blows up on yours, your best bet is to edit
2184 Configure and run it again.  If you can't run Configure for some reason,
2185 you'll have to generate a config.sh file by hand.  Whatever problems you
2186 have, let me (perlbug@perl.org) know how I blew it.
2187
2188 This installation script affects things in two ways:
2189
2190 1) it may do direct variable substitutions on some of the files included
2191    in this kit.
2192 2) it builds a config.h file for inclusion in C programs.  You may edit
2193    any of these files as the need arises after running this script.
2194
2195 If you make a mistake on a question, there is no easy way to back up to it
2196 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2197 files.  Configure will offer to let you do this before it runs the SH files.
2198
2199 EOH
2200         dflt='Type carriage return to continue'
2201         . ./myread
2202         case "$firsttime" in
2203         true) echo $user >>../.config/instruct;;
2204         esac
2205 fi
2206
2207 : find out where common programs are
2208 echo " "
2209 echo "Locating common programs..." >&4
2210 cat <<EOSC >loc
2211 $startsh
2212 case \$# in
2213 0) exit 1;;
2214 esac
2215 thing=\$1
2216 shift
2217 dflt=\$1
2218 shift
2219 for dir in \$*; do
2220         case "\$thing" in
2221         .)
2222         if test -d \$dir/\$thing; then
2223                 echo \$dir
2224                 exit 0
2225         fi
2226         ;;
2227         *)
2228         for thisthing in \$dir/\$thing; do
2229                 : just loop through to pick last item
2230         done
2231         if test -f \$thisthing; then
2232                 echo \$thisthing
2233                 exit 0
2234         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2235                 echo \$thisthing
2236                 exit 0
2237         elif test -f \$dir/\$thing.exe; then
2238                 if test -n "$DJGPP"; then
2239                         echo \$dir/\$thing.exe
2240                 elif test "$eunicefix" != ":"; then
2241                         : on Eunice apparently
2242                         echo \$dir/\$thing
2243                         exit 0
2244                 fi
2245                 exit 0
2246         fi
2247         ;;
2248         esac
2249 done
2250 echo \$dflt
2251 exit 1
2252 EOSC
2253 chmod +x loc
2254 $eunicefix loc
2255 loclist="
2256 awk
2257 cat
2258 chmod
2259 comm
2260 cp
2261 echo
2262 expr
2263 grep
2264 ls
2265 mkdir
2266 rm
2267 sed
2268 sort
2269 touch
2270 tr
2271 uniq
2272 "
2273 trylist="
2274 Mcc
2275 ar
2276 bison
2277 byacc
2278 cpp
2279 csh
2280 date
2281 egrep
2282 gmake
2283 gzip
2284 less
2285 ln
2286 make
2287 more
2288 nm
2289 nroff
2290 pg
2291 test
2292 uname
2293 zip
2294 "
2295 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2296 pth="$pth /lib /usr/lib"
2297 for file in $loclist; do
2298         eval xxx=\$$file
2299         case "$xxx" in
2300         /*|?:[\\/]*)
2301                 if test -f "$xxx"; then
2302                         : ok
2303                 else
2304                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2305                         xxx=`./loc $file $file $pth`
2306                 fi
2307                 ;;
2308         '') xxx=`./loc $file $file $pth`;;
2309         *) xxx=`./loc $xxx $xxx $pth`;;
2310         esac
2311         eval $file=$xxx$_exe
2312         eval _$file=$xxx
2313         case "$xxx" in
2314         /*)
2315                 echo $file is in $xxx.
2316                 ;;
2317         ?:[\\/]*)
2318                 echo $file is in $xxx.
2319                 ;;
2320         *)
2321                 echo "I don't know where '$file' is, and my life depends on it." >&4
2322                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2323                 exit 1
2324                 ;;
2325         esac
2326 done
2327 echo " "
2328 echo "Don't worry if any of the following aren't found..."
2329 say=offhand
2330 for file in $trylist; do
2331         eval xxx=\$$file
2332         case "$xxx" in
2333         /*|?:[\\/]*)
2334                 if test -f "$xxx"; then
2335                         : ok
2336                 else
2337                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2338                         xxx=`./loc $file $file $pth`
2339                 fi
2340                 ;;
2341         '') xxx=`./loc $file $file $pth`;;
2342         *) xxx=`./loc $xxx $xxx $pth`;;
2343         esac
2344         eval $file=$xxx$_exe
2345         eval _$file=$xxx
2346         case "$xxx" in
2347         /*)
2348                 echo $file is in $xxx.
2349                 ;;
2350         ?:[\\/]*)
2351                 echo $file is in $xxx.
2352                 ;;
2353         *)
2354                 echo "I don't see $file out there, $say."
2355                 say=either
2356                 ;;
2357         esac
2358 done
2359 case "$egrep" in
2360 egrep)
2361         echo "Substituting grep for egrep."
2362         egrep=$grep
2363         _egrep=$grep
2364         ;;
2365 esac
2366 case "$ln" in
2367 ln)
2368         echo "Substituting cp for ln."
2369         ln=$cp
2370         _ln=$cp
2371         ;;
2372 esac
2373 case "$make" in
2374 make)   
2375         case "$gmake" in
2376         gmake)
2377         echo "I can't find make or gmake, and my life depends on it." >&4
2378         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2379         exit 1
2380         ;;
2381         esac
2382         ;;
2383 esac    
2384 case "$gmake" in
2385 gmake)  ;;
2386 *)      # We can't have osname yet.
2387         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2388                 # Assume that gmake, if found, is definitely GNU make
2389                 # and prefer it over the system make.
2390                 echo "Substituting gmake for make."
2391                 make=$gmake
2392                 _make=$gmake
2393         fi
2394         ;;
2395 esac
2396 case "$test" in
2397 test)
2398         echo "Hopefully test is built into your sh."
2399         ;;
2400 *)
2401         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2402                 echo "Using the test built into your sh."
2403                 test=test
2404                 _test=test
2405         fi
2406         ;;
2407 esac
2408 case "$echo" in
2409 echo)
2410         echo "Hopefully echo is built into your sh."
2411         ;;
2412 '') ;;
2413 *)
2414         echo " "
2415 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2416         $echo $n "hi there$c" >foo1
2417         echo $n "hi there$c" >foo2
2418         if cmp foo1 foo2 >/dev/null 2>&1; then
2419                 echo "They are compatible.  In fact, they may be identical."
2420         else
2421                 case "$n" in
2422                 '-n') n='' c='\c';;
2423                 *) n='-n' c='';;
2424                 esac
2425                 cat <<FOO
2426 They are not compatible!  You are probably running ksh on a non-USG system.
2427 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2428 have echo built in and we may have to run some Bourne shell scripts.  That
2429 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2430
2431 FOO
2432                 $echo $n "The star should be here-->$c"
2433                 $echo "*"
2434         fi
2435         $rm -f foo1 foo2
2436         ;;
2437 esac
2438
2439 cat <<EOS >trygcc
2440 $startsh
2441 EOS
2442 cat <<'EOSC' >>trygcc
2443 case "$cc" in
2444 '') ;;
2445 *)  $rm -f try try.*
2446     $cat >try.c <<EOM
2447 int main(int argc, char *argv[]) {
2448   return 0;
2449 }
2450 EOM
2451     if $cc -o try $ccflags $ldflags try.c; then
2452        :
2453     else
2454         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2455         despair=yes
2456         trygcc=yes
2457         case "$cc" in
2458         *gcc*) trygcc=no ;;
2459         esac
2460         case "`$cc -v -c try.c 2>&1`" in
2461         *gcc*) trygcc=no ;;
2462         esac
2463         if $test X"$trygcc" = Xyes; then
2464             if gcc -o try -c try.c; then
2465                 echo " "
2466                 echo "You seem to have a working gcc, though." >&4
2467                 rp="Would you like to use it?"
2468                 dflt=y
2469                 if $test -f myread; then
2470                     . ./myread
2471                 else
2472                     if $test -f UU/myread; then
2473                         . ./UU/myread
2474                     else
2475                         echo "Cannot find myread, sorry.  Aborting." >&2
2476                         exit 1
2477                     fi
2478                 fi  
2479                 case "$ans" in
2480                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2481                        if $test -f usethreads.cbu; then
2482                            $cat >&4 <<EOM 
2483
2484 *** However, any setting of the C compiler flags (e.g. for thread support)
2485 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2486 *** (together with e.g. -Dusethreads).
2487
2488 EOM
2489                        fi;;
2490                 esac
2491             fi
2492         fi
2493     fi
2494     $rm -f try try.*
2495     ;;
2496 esac
2497 EOSC
2498
2499 cat <<EOS >checkcc
2500 $startsh
2501 EOS
2502 cat <<'EOSC' >>checkcc
2503 case "$cc" in        
2504 '') ;;
2505 *)  $rm -f try try.*              
2506     $cat >try.c <<EOM
2507 int main(int argc, char *argv[]) {
2508   return 0;
2509 }
2510 EOM
2511     if $cc -o try $ccflags $ldflags try.c; then
2512        :
2513     else
2514         if $test X"$despair" = Xyes; then
2515            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2516         fi
2517         $cat >&4 <<EOM         
2518 You need to find a working C compiler.
2519 Either (purchase and) install the C compiler supplied by your OS vendor,
2520 or for a free C compiler try http://gcc.gnu.org/
2521 I cannot continue any further, aborting.
2522 EOM
2523         exit 1
2524     fi
2525     $rm -f try try.*
2526     ;;
2527 esac
2528 EOSC
2529
2530 : determine whether symbolic links are supported
2531 echo " "
2532 $touch blurfl
2533 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2534         echo "Symbolic links are supported." >&4
2535         lns="$ln -s"
2536 else
2537         echo "Symbolic links are NOT supported." >&4
2538         lns="$ln"
2539 fi
2540 $rm -f blurfl sym
2541
2542 : determine whether symbolic links are supported
2543 echo " "
2544 case "$lns" in
2545 *"ln"*" -s")
2546         echo "Checking how to test for symbolic links..." >&4
2547         $lns blurfl sym
2548         if $test "X$issymlink" = X; then
2549                 case "$newsh" in
2550                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2551                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2552                 esac
2553                 if test $? = 0; then
2554                         issymlink="test -h"
2555                 else
2556                         echo "Your builtin 'test -h' may be broken." >&4
2557                         case "$test" in
2558                         /*)     ;;
2559                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2560                                 for p in $pth
2561                                 do
2562                                         if test -f "$p/$test"; then
2563                                                 test="$p/$test"
2564                                                 break
2565                                         fi
2566                                 done
2567                                 ;;
2568                         esac
2569                         case "$test" in
2570                         /*)
2571                                 echo "Trying external '$test -h'." >&4
2572                                 issymlink="$test -h"
2573                                 if $test ! -h sym >/dev/null 2>&1; then
2574                                         echo "External '$test -h' is broken, too." >&4
2575                                         issymlink=''
2576                                 fi
2577                                 ;;
2578                         *)      issymlink='' ;;
2579                         esac
2580                 fi              
2581         fi
2582         if $test "X$issymlink" = X; then
2583                 if $test -L sym 2>/dev/null; then
2584                         issymlink="$test -L"
2585                         echo "The builtin '$test -L' worked." >&4
2586                 fi
2587         fi
2588         if $test "X$issymlink" != X; then
2589                 echo "You can test for symbolic links with '$issymlink'." >&4
2590         else
2591                 echo "I do not know how you can test for symbolic links." >&4
2592         fi
2593         $rm -f blurfl sym
2594         ;;
2595 *)      echo "No symbolic links, so not testing for their testing..." >&4
2596         ;;
2597 esac
2598 echo " "
2599
2600
2601 case "$mksymlinks" in
2602 $define|true|[yY]*)
2603         case "$src" in
2604         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2605                 exit 1
2606                 ;;
2607         *)      case "$lns:$issymlink" in
2608                 *"ln"*" -s:"*"test -"?)
2609                         echo "Creating the symbolic links..." >&4
2610                         echo "(First creating the subdirectories...)" >&4
2611                         cd ..
2612                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2613                                 read directory
2614                                 test -z "$directory" && break
2615                                 mkdir -p $directory
2616                         done
2617                         # Sanity check 1.
2618                         if test ! -d t/base; then
2619                                 echo "Failed to create the subdirectories.  Aborting." >&4
2620                                 exit 1
2621                         fi
2622                         echo "(Then creating the symlinks...)" >&4
2623                         awk '{print $1}' $src/MANIFEST | while true; do
2624                                 read filename
2625                                 test -z "$filename" && break
2626                                 if test -f $filename; then
2627                                         if $issymlink $filename; then
2628                                                 rm -f $filename
2629                                         fi
2630                                 fi
2631                                 if test -f $filename; then
2632                                         echo "$filename already exists, not symlinking."
2633                                 else
2634                                         ln -s $src/$filename $filename
2635                                 fi
2636                         done
2637                         # Sanity check 2.
2638                         if test ! -f t/base/lex.t; then
2639                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2640                                 exit 1
2641                         fi
2642                         cd UU
2643                         ;;
2644                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2645                         ;;
2646                 esac
2647                 ;;
2648         esac
2649         ;;
2650 esac
2651
2652
2653 case "$usecrosscompile" in
2654 $define|true|[yY]*)
2655         $echo "Cross-compiling..."
2656         croak=''
2657         case "$cc" in
2658         *-*-gcc) # A cross-compiling gcc, probably.
2659             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2660             ar=$targetarch-ar
2661             # leave out ld, choosing it is more complex
2662             nm=$targetarch-nm
2663             ranlib=$targetarch-ranlib
2664             $echo 'extern int foo;' > try.c
2665             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2666             shift
2667             if $test $# -gt 0; then
2668                 incpth="$incpth $*"
2669                 incpth="`$echo $incpth|$sed 's/^ //'`"
2670                 echo "Guessing incpth '$incpth'." >&4
2671                 for i in $*; do
2672                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2673                     if $test -d $j; then
2674                         libpth="$libpth $j"
2675                     fi
2676                 done   
2677                 libpth="`$echo $libpth|$sed 's/^ //'`"
2678                 echo "Guessing libpth '$libpth'." >&4
2679             fi
2680             $rm -f try.c
2681             ;;
2682         esac
2683         case "$targetarch" in
2684         '') echo "Targetarch not defined." >&4; croak=y ;;
2685         *)  echo "Using targetarch $targetarch." >&4 ;;
2686         esac
2687         case "$incpth" in
2688         '') echo "Incpth not defined." >&4; croak=y ;;
2689         *)  echo "Using incpth '$incpth'." >&4 ;;
2690         esac
2691         case "$libpth" in
2692         '') echo "Libpth not defined." >&4; croak=y ;;
2693         *)  echo "Using libpth '$libpth'." >&4 ;;
2694         esac
2695         case "$usrinc" in
2696         '') for i in $incpth; do
2697                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2698                     usrinc=$i
2699                     echo "Guessing usrinc $usrinc." >&4
2700                     break
2701                 fi
2702             done
2703             case "$usrinc" in
2704             '') echo "Usrinc not defined." >&4; croak=y ;;
2705             esac
2706             ;;
2707         *)  echo "Using usrinc $usrinc." >&4 ;;
2708         esac
2709         case "$targethost" in
2710         '') echo "Targethost not defined." >&4; croak=y ;;
2711         *)  echo "Using targethost $targethost." >&4
2712         esac
2713         locincpth=' '
2714         loclibpth=' '
2715         case "$croak" in
2716         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2717         esac
2718         case "$src" in
2719         /*) run=$src/Cross/run
2720             targetmkdir=$src/Cross/mkdir
2721             to=$src/Cross/to
2722             from=$src/Cross/from
2723             ;;
2724         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2725             run=$pwd/Cross/run
2726             targetmkdir=$pwd/Cross/mkdir
2727             to=$pwd/Cross/to
2728             from=$pwd/Cross/from
2729             ;;
2730         esac
2731         case "$targetrun" in
2732         '') targetrun=ssh ;;
2733         esac
2734         case "$targetto" in
2735         '') targetto=scp ;;
2736         esac
2737         case "$targetfrom" in
2738         '') targetfrom=scp ;;
2739         esac
2740         run=$run-$targetrun
2741         to=$to-$targetto
2742         from=$from-$targetfrom
2743         case "$targetdir" in
2744         '')  targetdir=/tmp
2745              echo "Guessing targetdir $targetdir." >&4
2746              ;;
2747         esac
2748         case "$targetuser" in
2749         '')  targetuser=root
2750              echo "Guessing targetuser $targetuser." >&4
2751              ;;
2752         esac
2753         case "$targetfrom" in
2754         scp)    q=-q ;;
2755         *)      q='' ;;
2756         esac
2757         case "$targetrun" in
2758         ssh|rsh)
2759             cat >$run <<EOF
2760 #!/bin/sh
2761 case "\$1" in
2762 -cwd)
2763   shift
2764   cwd=\$1
2765   shift
2766   ;;
2767 esac
2768 case "\$cwd" in
2769 '') cwd=$targetdir ;;
2770 esac
2771 exe=\$1
2772 shift
2773 if $test ! -f \$exe.xok; then
2774   $to \$exe
2775   $touch \$exe.xok
2776 fi
2777 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2778 EOF
2779             ;;
2780         *)  echo "Unknown targetrun '$targetrun'" >&4
2781             exit 1
2782             ;;
2783         esac
2784         case "$targetmkdir" in
2785         */Cross/mkdir)
2786             cat >$targetmkdir <<EOF
2787 #!/bin/sh
2788 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2789 EOF
2790             $chmod a+rx $targetmkdir
2791             ;;
2792         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2793             exit 1
2794             ;;
2795         esac
2796         case "$targetto" in
2797         scp|rcp)
2798             cat >$to <<EOF
2799 #!/bin/sh
2800 for f in \$@
2801 do
2802   case "\$f" in
2803   /*)
2804     $targetmkdir \`dirname \$f\`
2805     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2806     ;;
2807   *)
2808     $targetmkdir $targetdir/\`dirname \$f\`
2809     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2810     ;;
2811   esac
2812 done
2813 exit 0
2814 EOF
2815             ;;
2816         cp) cat >$to <<EOF
2817 #!/bin/sh
2818 for f in \$@
2819 do
2820   case "\$f" in
2821   /*)
2822     $mkdir -p $targetdir/\`dirname \$f\`
2823     $cp \$f $targetdir/\$f || exit 1
2824     ;;
2825   *)
2826     $targetmkdir $targetdir/\`dirname \$f\`
2827     $cp \$f $targetdir/\$f || exit 1
2828     ;;
2829   esac
2830 done
2831 exit 0
2832 EOF
2833             ;;
2834         *)  echo "Unknown targetto '$targetto'" >&4
2835             exit 1
2836             ;;
2837         esac
2838         case "$targetfrom" in
2839         scp|rcp)
2840           cat >$from <<EOF
2841 #!/bin/sh
2842 for f in \$@
2843 do
2844   $rm -f \$f
2845   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2846 done
2847 exit 0
2848 EOF
2849             ;;
2850         cp) cat >$from <<EOF
2851 #!/bin/sh
2852 for f in \$@
2853 do
2854   $rm -f \$f
2855   cp $targetdir/\$f . || exit 1
2856 done
2857 exit 0
2858 EOF
2859             ;;
2860         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2861             exit 1
2862             ;;
2863         esac
2864         if $test ! -f $run; then
2865             echo "Target 'run' script '$run' not found." >&4
2866         else
2867             $chmod a+rx $run
2868         fi
2869         if $test ! -f $to; then
2870             echo "Target 'to' script '$to' not found." >&4
2871         else
2872             $chmod a+rx $to
2873         fi
2874         if $test ! -f $from; then
2875             echo "Target 'from' script '$from' not found." >&4
2876         else
2877             $chmod a+rx $from
2878         fi
2879         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2880             exit 1
2881         fi
2882         cat >&4 <<EOF
2883 Using '$run' for remote execution,
2884 and '$from' and '$to'
2885 for remote file transfer.
2886 EOF
2887         ;;
2888 *)      run=''
2889         to=:
2890         from=:
2891         usecrosscompile='undef'
2892         targetarch=''
2893         ;;
2894 esac
2895
2896 : see whether [:lower:] and [:upper:] are supported character classes
2897 echo " "
2898 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2899 ABYZ)
2900         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2901         up='[:upper:]'
2902         low='[:lower:]'
2903         ;;
2904 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2905         # (0xd9 and 0xe2), therefore that is a nice testing point.
2906         if test "X$up" = X -o "X$low" = X; then
2907             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2908             rs) up='[A-Z]'
2909                 low='[a-z]'
2910                 ;;
2911             esac
2912         fi
2913         if test "X$up" = X -o "X$low" = X; then
2914             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2915             rs) up='A-Z'
2916                 low='a-z'
2917                 ;;
2918             esac
2919         fi
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | od -x 2>/dev/null`" in
2922             *D9E2*|*d9e2*)
2923                 echo "Hey, this might be EBCDIC." >&4
2924                 if test "X$up" = X -o "X$low" = X; then
2925                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2926                     rs) up='[A-IJ-RS-Z]'
2927                         low='[a-ij-rs-z]'
2928                         ;;
2929                     esac
2930                 fi
2931                 if test "X$up" = X -o "X$low" = X; then
2932                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2933                     rs) up='A-IJ-RS-Z'
2934                         low='a-ij-rs-z'
2935                         ;;
2936                     esac
2937                 fi
2938                 ;;
2939             esac
2940         fi
2941 esac
2942 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2943 rs)
2944     echo "Using $up and $low to convert case." >&4
2945     ;;
2946 *)
2947     echo "I don't know how to translate letters from upper to lower case." >&4
2948     echo "Your tr is not acting any way I know of." >&4
2949     exit 1
2950     ;;
2951 esac
2952 : set up the translation script tr, must be called with ./tr of course
2953 cat >tr <<EOSC
2954 $startsh
2955 case "\$1\$2" in
2956 '[A-Z][a-z]') exec $tr '$up' '$low';;
2957 '[a-z][A-Z]') exec $tr '$low' '$up';;
2958 esac
2959 exec $tr "\$@"
2960 EOSC
2961 chmod +x tr
2962 $eunicefix tr
2963
2964 : Try to determine whether config.sh was made on this system
2965 case "$config_sh" in
2966 '')
2967 myuname=`$uname -a 2>/dev/null`
2968 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2969 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2970 # because the A-Z/a-z are not consecutive.
2971 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2972         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2973 newmyuname="$myuname"
2974 dflt=n
2975 case "$knowitall" in
2976 '')
2977         if test -f ../config.sh; then
2978                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2979                         eval "`grep myuname= ../config.sh`"
2980                 fi
2981                 if test "X$myuname" = "X$newmyuname"; then
2982                         dflt=y
2983                 fi
2984         fi
2985         ;;
2986 *) dflt=y;;
2987 esac
2988
2989 : Get old answers from old config file if Configure was run on the
2990 : same system, otherwise use the hints.
2991 hint=default
2992 cd ..
2993 if test -f config.sh; then
2994         echo " "
2995         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2996         . UU/myread
2997         case "$ans" in
2998         n*|N*) echo "OK, I'll ignore it."
2999                 mv config.sh config.sh.old
3000                 myuname="$newmyuname"
3001                 ;;
3002         *)  echo "Fetching default answers from your old config.sh file..." >&4
3003                 tmp_n="$n"
3004                 tmp_c="$c"
3005                 tmp_sh="$sh"
3006                 . ./config.sh
3007                 cp config.sh UU
3008                 n="$tmp_n"
3009                 c="$tmp_c"
3010                 : Older versions did not always set $sh.  Catch re-use of such
3011                 : an old config.sh.
3012                 case "$sh" in
3013                 '') sh="$tmp_sh" ;;
3014                 esac
3015                 hint=previous
3016                 ;;
3017         esac
3018 fi
3019 . ./UU/checkcc
3020 if test ! -f config.sh; then
3021         $cat <<EOM
3022
3023 First time through, eh?  I have some defaults handy for some systems
3024 that need some extra help getting the Configure answers right:
3025
3026 EOM
3027         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3028         dflt=''
3029         : Half the following guesses are probably wrong... If you have better
3030         : tests or hints, please send them to perlbug@perl.org
3031         : The metaconfig authors would also appreciate a copy...
3032         $test -f /irix && osname=irix
3033         $test -f /xenix && osname=sco_xenix
3034         $test -f /dynix && osname=dynix
3035         $test -f /dnix && osname=dnix
3036         $test -f /lynx.os && osname=lynxos
3037         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3038         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3039         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3040         $test -f /bin/mips && /bin/mips && osname=mips
3041         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3042                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3043         $test -d /usr/apollo/bin && osname=apollo
3044         $test -f /etc/saf/_sactab && osname=svr4
3045         $test -d /usr/include/minix && osname=minix
3046         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3047         if $test -d /MachTen -o -d /MachTen_Folder; then
3048                 osname=machten
3049                 if $test -x /sbin/version; then
3050                         osvers=`/sbin/version | $awk '{print $2}' |
3051                         $sed -e 's/[A-Za-z]$//'`
3052                 elif $test -x /usr/etc/version; then
3053                         osvers=`/usr/etc/version | $awk '{print $2}' |
3054                         $sed -e 's/[A-Za-z]$//'`
3055                 else
3056                         osvers="$2.$3"
3057                 fi
3058         fi
3059
3060         $test -f /sys/posix.dll &&
3061                 $test -f /usr/bin/what &&
3062                 set X `/usr/bin/what /sys/posix.dll` &&
3063                 $test "$3" = UWIN &&
3064                 osname=uwin &&
3065                 osvers="$5"
3066
3067         if $test -f $uname; then
3068                 set X $myuname
3069                 shift
3070
3071                 case "$5" in
3072                 fps*) osname=fps ;;
3073                 mips*)
3074                         case "$4" in
3075                         umips) osname=umips ;;
3076                         *) osname=mips ;;
3077                         esac;;
3078                 [23]100) osname=mips ;;
3079                 next*) osname=next ;;
3080                 i386*)
3081                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3082                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3083                                 osname='sco'
3084                                 osvers=$tmp
3085                         elif $test -f /etc/kconfig; then
3086                                 osname=isc
3087                                 if test "$lns" = "$ln -s"; then
3088                                         osvers=4
3089                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3090                                         osvers=3
3091                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3092                                         osvers=2
3093                                 fi
3094                         fi
3095                         tmp=''
3096                         ;;
3097                 pc*)
3098                         if test -n "$DJGPP"; then
3099                                 osname=dos
3100                                 osvers=djgpp
3101                         fi
3102                         ;;
3103                 esac
3104
3105                 case "$1" in
3106                 aix) osname=aix
3107                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3108                         case "$tmp" in
3109                         # oslevel can fail with:
3110                         # oslevel: Unable to acquire lock.
3111                         *not\ found) osvers="$4"."$3" ;;
3112                         '<3240'|'<>3240') osvers=3.2.0 ;;
3113                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3114                         '=3250'|'>3250') osvers=3.2.5 ;;
3115                         *) osvers=$tmp;;
3116                         esac
3117                         ;;
3118                 bsd386) osname=bsd386
3119                         osvers=`$uname -r`
3120                         ;;
3121                 cygwin*) osname=cygwin
3122                         osvers="$3"
3123                         ;;
3124                 *dc.osx) osname=dcosx
3125                         osvers="$3"
3126                         ;;
3127                 dnix) osname=dnix
3128                         osvers="$3"
3129                         ;;
3130                 domainos) osname=apollo
3131                         osvers="$3"
3132                         ;;
3133                 dgux)   osname=dgux 
3134                         osvers="$3"
3135                         ;;
3136                 dynixptx*) osname=dynixptx
3137                         osvers=`echo "$4"|sed 's/^v//'`
3138                         ;;
3139                 freebsd) osname=freebsd 
3140                         osvers="$3" ;;
3141                 genix)  osname=genix ;;
3142                 gnu)    osname=gnu
3143                         osvers="$3" ;;
3144                 hp*)    osname=hpux 
3145                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3146                         ;;
3147                 irix*)  osname=irix
3148                         case "$3" in
3149                         4*) osvers=4 ;;
3150                         5*) osvers=5 ;;
3151                         *)      osvers="$3" ;;
3152                         esac
3153                         ;;
3154                 linux)  osname=linux
3155                         case "$3" in
3156                         *)      osvers="$3" ;;
3157                         esac
3158                         ;;
3159                 MiNT)   osname=mint
3160                         ;;
3161                 netbsd*) osname=netbsd
3162                         osvers="$3"
3163                         ;;
3164                 news-os) osvers="$3"
3165                         case "$3" in
3166                         4*) osname=newsos4 ;;
3167                         *) osname=newsos ;;
3168                         esac
3169                         ;;
3170                 next*) osname=next ;;
3171                 nonstop-ux) osname=nonstopux ;;
3172                 openbsd) osname=openbsd
3173                         osvers="$3"
3174                         ;;
3175                 os2)    osname=os2
3176                         osvers="$4"
3177                         ;;
3178                 POSIX-BC | posix-bc ) osname=posix-bc
3179                         osvers="$3"
3180                         ;;
3181                 powerux | power_ux | powermax_os | powermaxos | \
3182                 powerunix | power_unix) osname=powerux
3183                         osvers="$3"
3184                         ;;
3185                 qnx) osname=qnx
3186                         osvers="$4"
3187                         ;;
3188                 solaris) osname=solaris
3189                         case "$3" in
3190                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3191                         *)      osvers="$3" ;;
3192                         esac
3193                         ;;
3194                 sunos) osname=sunos
3195                         case "$3" in
3196                         5*) osname=solaris
3197                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3198                         *)      osvers="$3" ;;
3199                         esac
3200                         ;;
3201                 titanos) osname=titanos
3202                         case "$3" in
3203                         1*) osvers=1 ;;
3204                         2*) osvers=2 ;;
3205                         3*) osvers=3 ;;
3206                         4*) osvers=4 ;;
3207                         *)      osvers="$3" ;;
3208                         esac
3209                         ;;
3210                 ultrix) osname=ultrix
3211                         osvers="$3"
3212                         ;;
3213                 osf1|mls+)      case "$5" in
3214                                 alpha)
3215                                         osname=dec_osf
3216                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3217                                         case "$osvers" in
3218                                         [1-9].[0-9]*) ;;
3219                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3220                                         esac
3221                                         ;;
3222                         hp*)    osname=hp_osf1  ;;
3223                         mips)   osname=mips_osf1 ;;
3224                         esac
3225                         ;;
3226                 # UnixWare 7.1.2 is known as Open UNIX 8
3227                 openunix|unixware) osname=svr5
3228                         osvers="$4"
3229                         ;;
3230                 uts)    osname=uts
3231                         osvers="$3"
3232                         ;;
3233                 vos) osvers="$3"
3234                         ;;
3235                 $2) case "$osname" in
3236                         *isc*) ;;
3237                         *freebsd*) ;;
3238                         svr*)
3239                                 : svr4.x or possibly later
3240                                 case "svr$3" in 
3241                                 ${osname}*)
3242                                         osname=svr$3
3243                                         osvers=$4
3244                                         ;;
3245                                 esac
3246                                 case "$osname" in
3247                                 svr4.0)
3248                                         : Check for ESIX
3249                                         if test -f /stand/boot ; then
3250                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3251                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3252                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3253                                                         if test -n "$isesix"; then
3254                                                                 osname=esix4
3255                                                         fi
3256                                                 fi
3257                                         fi
3258                                         ;;
3259                                 esac
3260                                 ;;
3261                         *)      if test -f /etc/systemid; then
3262                                         osname=sco
3263                                         set `echo $3 | $sed 's/\./ /g'` $4
3264                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3265                                                 osvers=$1.$2.$3
3266                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3267                                                 osvers=$1.$2
3268                                         elif $test -f $src/hints/sco_$1.sh; then
3269                                                 osvers=$1
3270                                         fi
3271                                 else
3272                                         case "$osname" in
3273                                         '') : Still unknown.  Probably a generic Sys V.
3274                                                 osname="sysv"
3275                                                 osvers="$3"
3276                                                 ;;
3277                                         esac
3278                                 fi
3279                                 ;;
3280                         esac
3281                         ;;
3282                 *)      case "$osname" in
3283                         '') : Still unknown.  Probably a generic BSD.
3284                                 osname="$1"
3285                                 osvers="$3"
3286                                 ;;
3287                         esac
3288                         ;;
3289                 esac
3290         else
3291                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3292                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3293                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3294                                 osname=news_os
3295                         fi
3296                         $rm -f UU/kernel.what
3297                 elif test -d c:/. -o -n "$is_os2" ; then
3298                         set X $myuname
3299                         osname=os2
3300                         osvers="$5"
3301                 fi
3302         fi
3303         
3304         case "$targetarch" in
3305         '') ;;
3306         *)  hostarch=$osname
3307             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3308             osvers=''
3309             ;;
3310         esac
3311
3312         : Now look for a hint file osname_osvers, unless one has been
3313         : specified already.
3314         case "$hintfile" in
3315         ''|' ')
3316                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3317                 : Also try without trailing minor version numbers.
3318                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3319                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3320                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3321                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3322                 case "$file" in
3323                 '') dflt=none ;;
3324                 *)  case "$osvers" in
3325                         '') dflt=$file
3326                                 ;;
3327                         *)  if $test -f $src/hints/$file.sh ; then
3328                                         dflt=$file
3329                                 elif $test -f $src/hints/$xfile.sh ; then
3330                                         dflt=$xfile
3331                                 elif $test -f $src/hints/$xxfile.sh ; then
3332                                         dflt=$xxfile
3333                                 elif $test -f $src/hints/$xxxfile.sh ; then
3334                                         dflt=$xxxfile
3335                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3336                                         dflt=$xxxxfile
3337                                 elif $test -f "$src/hints/${osname}.sh" ; then
3338                                         dflt="${osname}"
3339                                 else
3340                                         dflt=none
3341                                 fi
3342                                 ;;
3343                         esac
3344                         ;;
3345                 esac
3346                 if $test -f Policy.sh ; then
3347                         case "$dflt" in
3348                         *Policy*) ;;
3349                         none) dflt="Policy" ;;
3350                         *) dflt="Policy $dflt" ;;
3351                         esac
3352                 fi
3353                 ;;
3354         *)
3355                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3356                 ;;
3357         esac
3358
3359         if $test -f Policy.sh ; then
3360                 $cat <<EOM
3361
3362 There's also a Policy hint file available, which should make the
3363 site-specific (policy) questions easier to answer.
3364 EOM
3365
3366         fi
3367
3368         $cat <<EOM
3369
3370 You may give one or more space-separated answers, or "none" if appropriate.
3371 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3372 is a good thing.  DO NOT give a wrong version or a wrong OS.
3373
3374 EOM
3375
3376         rp="Which of these apply, if any?"
3377         . UU/myread
3378         tans=$ans
3379         for file in $tans; do
3380                 if $test X$file = XPolicy -a -f Policy.sh; then
3381                         . Policy.sh
3382                         $cat Policy.sh >> UU/config.sh
3383                 elif $test -f $src/hints/$file.sh; then
3384                         . $src/hints/$file.sh
3385                         $cat $src/hints/$file.sh >> UU/config.sh
3386                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3387                         : nothing
3388                 else
3389                         : Give one chance to correct a possible typo.
3390                         echo "$file.sh does not exist"
3391                         dflt=$file
3392                         rp="hint to use instead?"
3393                         . UU/myread
3394                         for file in $ans; do
3395                                 if $test -f "$src/hints/$file.sh"; then
3396                                         . $src/hints/$file.sh
3397                                         $cat $src/hints/$file.sh >> UU/config.sh
3398                                 elif $test X$ans = X -o X$ans = Xnone ; then
3399                                         : nothing
3400                                 else
3401                                         echo "$file.sh does not exist -- ignored."
3402                                 fi
3403                         done
3404                 fi
3405         done
3406
3407         hint=recommended
3408         : Remember our hint file for later.
3409         if $test -f "$src/hints/$file.sh" ; then
3410                 hintfile="$file"
3411         else
3412                 hintfile=''
3413         fi
3414 fi
3415 cd UU
3416 ;;
3417 *)
3418         echo " "
3419         echo "Fetching default answers from $config_sh..." >&4
3420         tmp_n="$n"
3421         tmp_c="$c"
3422         cd ..
3423         cp $config_sh config.sh 2>/dev/null
3424         chmod +w config.sh
3425         . ./config.sh
3426         cd UU
3427         cp ../config.sh .
3428         n="$tmp_n"
3429         c="$tmp_c"
3430         hint=previous
3431         ;;
3432 esac
3433 test "$override" && . ./optdef.sh
3434
3435 : Restore computed paths
3436 for file in $loclist $trylist; do
3437         eval $file="\$_$file"
3438 done
3439
3440 cat << EOM
3441
3442 Configure uses the operating system name and version to set some defaults.
3443 The default value is probably right if the name rings a bell. Otherwise,
3444 since spelling matters for me, either accept the default or answer "none"
3445 to leave it blank.
3446
3447 EOM
3448 case "$osname" in
3449         ''|' ')
3450                 case "$hintfile" in
3451                 ''|' '|none) dflt=none ;;
3452                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3453                 esac
3454                 ;;
3455         *) dflt="$osname" ;;
3456 esac
3457 rp="Operating system name?"
3458 . ./myread
3459 case "$ans" in
3460 none)  osname='' ;;
3461 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3462 esac
3463 echo " "
3464 case "$osvers" in
3465         ''|' ')
3466                 case "$hintfile" in
3467                 ''|' '|none) dflt=none ;;
3468                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3469                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3470                         case "$dflt" in
3471                         ''|' ') dflt=none ;;
3472                         esac
3473                         ;;
3474                 esac
3475                 ;;
3476         *) dflt="$osvers" ;;
3477 esac
3478 rp="Operating system version?"
3479 . ./myread
3480 case "$ans" in
3481 none)  osvers='' ;;
3482 *) osvers="$ans" ;;
3483 esac
3484
3485
3486 . ./posthint.sh
3487
3488 : who configured the system
3489 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3490 case "$cf_by" in
3491 "")
3492         cf_by=`(logname) 2>/dev/null`
3493         case "$cf_by" in
3494         "")
3495                 cf_by=`(whoami) 2>/dev/null`
3496                 case "$cf_by" in
3497                 "") cf_by=unknown ;;
3498                 esac ;;
3499         esac ;;
3500 esac
3501
3502 : set up the script used to warn in case of inconsistency
3503 cat <<EOS >whoa
3504 $startsh
3505 EOS
3506 cat <<'EOSC' >>whoa
3507 dflt=y
3508 echo " "
3509 echo "*** WHOA THERE!!! ***" >&4
3510 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3511 rp="    Keep the $hint value?"
3512 . ./myread
3513 case "$ans" in
3514 y) td=$was; tu=$was;;
3515 esac
3516 EOSC
3517
3518 : function used to set $1 to $val
3519 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3520 case "$val$was" in
3521 $define$undef) . ./whoa; eval "$var=\$td";;
3522 $undef$define) . ./whoa; eval "$var=\$tu";;
3523 *) eval "$var=$val";;
3524 esac'
3525
3526 case "$usesocks" in
3527 $define|true|[yY]*)     dflt='y';;
3528 *) dflt='n';;
3529 esac
3530 cat <<EOM
3531
3532 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3533 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3534 to use the PerlIO abstraction layer, this will be implicitly selected.
3535
3536 If this doesn't make any sense to you, just accept the default '$dflt'.
3537 EOM
3538 rp='Build Perl for SOCKS?'
3539 . ./myread
3540 case "$ans" in
3541 y|Y)    val="$define" ;;     
3542 *)      val="$undef" ;;
3543 esac
3544 set usesocks
3545 eval $setvar
3546
3547 case "$usesocks" in
3548 $define|true|[yY]*) useperlio="$define";;
3549 esac
3550
3551 case "$useperlio" in
3552 $define|true|[yY]*|'')  dflt='y';;
3553 *) dflt='n';;
3554 esac
3555 cat <<EOM
3556
3557 Previous version of $package used the standard IO mechanisms as
3558 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3559 alternate IO mechanisms via the PerlIO abstraction layer, but the
3560 stdio mechanism is still available if needed.  The abstraction layer
3561 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3562 Using PerlIO with sfio may cause problems with some extension modules.
3563
3564 If this doesn't make any sense to you, just accept the default '$dflt'.
3565 EOM
3566 rp='Use the PerlIO abstraction layer?'
3567 . ./myread
3568 case "$ans" in
3569 y|Y) 
3570         val="$define"
3571         ;;
3572 *)      
3573         echo "Ok, doing things the stdio way."
3574         val="$undef"
3575         ;;
3576 esac
3577 set useperlio
3578 eval $setvar 
3579
3580 case "$usesocks" in
3581 $define|true|[yY]*)
3582         case "$useperlio" in
3583         $define|true|[yY]*) ;;
3584         *)      cat >&4 <<EOM
3585
3586 You are using the SOCKS proxy protocol library which means that you
3587 should also use the PerlIO layer.  You may be headed for trouble.
3588
3589 EOM
3590                 ;;
3591         esac
3592         ;;
3593 esac
3594
3595         
3596 case "$usethreads" in
3597 $define|true|[yY]*)     dflt='y';;
3598 *)     # Catch case where user specified ithreads or 5005threads but
3599        # forgot -Dusethreads (A.D. 4/2002)
3600        case "$useithreads$use5005threads" in
3601        *$define*)      
3602                 case "$useperlio" in
3603                 "$define")      dflt='y' ;;
3604                 *)              dflt='n' ;;
3605                 esac
3606                 ;;
3607        *)       dflt='n';;
3608        esac
3609        ;;
3610 esac
3611 cat <<EOM
3612
3613 Perl can be built to take advantage of threads on some systems.
3614 To do so, Configure can be run with -Dusethreads.
3615
3616 Note that Perl built with threading support runs slightly slower
3617 and uses more memory than plain Perl. The current implementation
3618 is believed to be stable, but it is fairly new, and so should be
3619 treated with caution.
3620
3621 If this doesn't make any sense to you, just accept the default '$dflt'.
3622 EOM
3623 rp='Build a threading Perl?'
3624 . ./myread
3625 case "$ans" in
3626 y|Y)    val="$define" ;;
3627 *)      val="$undef" ;;
3628 esac
3629 set usethreads
3630 eval $setvar
3631
3632 case "$usethreads" in
3633 $define)
3634         $cat <<EOM
3635
3636 Since release 5.6, Perl has had two different threading implementations,
3637 the newer interpreter-based version (ithreads) with one interpreter per
3638 thread, and the older 5.005 version (5005threads).
3639 The 5005threads version is effectively unmaintained and will probably be
3640 removed in Perl 5.10, so there should be no need to build a Perl using it
3641 unless needed for backwards compatibility with some existing 5.005threads
3642 code.
3643
3644 EOM
3645         : Default to ithreads unless overridden on command line or with
3646         : old config.sh
3647         dflt='y'
3648         case "$use5005threads" in
3649                 $define|true|[yY]*) dflt='n';;
3650         esac
3651         case "$useithreads" in
3652                 $undef|false|[nN]*) dflt='n';;
3653         esac
3654         rp='Use the newer interpreter-based ithreads?'
3655         . ./myread
3656         case "$ans" in
3657         y|Y)    val="$define" ;;
3658         *)      val="$undef" ;;
3659         esac
3660         set useithreads
3661         eval $setvar
3662         : Now set use5005threads to the opposite value.
3663         case "$useithreads" in
3664         $define) val="$undef" ;;
3665         *) val="$define" ;;
3666         esac
3667         set use5005threads
3668         eval $setvar
3669         ;;
3670 *)
3671         useithreads="$undef"
3672         use5005threads="$undef"
3673         ;;
3674 esac
3675
3676 case "$useithreads$use5005threads" in
3677 "$define$define")
3678         $cat >&4 <<EOM
3679
3680 You cannot have both the ithreads and the 5.005 threads enabled
3681 at the same time.  Disabling the 5.005 threads since they are
3682 much less stable than the ithreads.
3683
3684 EOM
3685         use5005threads="$undef"
3686         ;;
3687 esac
3688
3689 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3690         cat >&4 <<EOF
3691 ***
3692 *** To build with ithreads you must also use the PerlIO layer.
3693 *** Cannot continue, aborting.
3694 ***
3695 EOF
3696         exit 1
3697 fi
3698
3699 case "$d_oldpthreads" in
3700 '')     : Configure tests would be welcome here.  For now, assume undef.
3701         val="$undef" ;;
3702 *)      val="$d_oldpthreads" ;;
3703 esac
3704 set d_oldpthreads
3705 eval $setvar
3706
3707
3708 : Look for a hint-file generated 'call-back-unit'.  If the
3709 : user has specified that a threading perl is to be built,
3710 : we may need to set or change some other defaults.
3711 if $test -f usethreads.cbu; then
3712     echo "Your platform has some specific hints regarding threaded builds, using them..."
3713     . ./usethreads.cbu
3714 else
3715     case "$usethreads" in
3716         "$define"|true|[yY]*)
3717                 $cat <<EOM
3718 (Your platform does not have any specific hints for threaded builds.
3719  Assuming POSIX threads, then.)
3720 EOM
3721         ;;
3722     esac
3723 fi
3724
3725 cat <<EOM
3726
3727 Perl can be built so that multiple Perl interpreters can coexist
3728 within the same Perl executable.
3729 EOM
3730
3731 case "$useithreads" in
3732 $define)
3733         cat <<EOM
3734 This multiple interpreter support is required for interpreter-based threads.
3735 EOM
3736         val="$define"
3737         ;;
3738 *)      case "$usemultiplicity" in
3739         $define|true|[yY]*)     dflt='y';;
3740         *) dflt='n';;
3741         esac
3742         echo " "
3743         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3744         rp='Build Perl for multiplicity?'
3745         . ./myread
3746         case "$ans" in
3747         y|Y)    val="$define" ;;
3748         *)      val="$undef" ;;
3749         esac
3750         ;;
3751 esac
3752 set usemultiplicity
3753 eval $setvar
3754
3755
3756 case "$usemorebits" in
3757 "$define"|true|[yY]*)
3758         use64bitint="$define"
3759         uselongdouble="$define"
3760         usemorebits="$define"
3761         ;;
3762 *)      usemorebits="$undef"
3763         ;;
3764 esac
3765
3766 : make some quick guesses about what we are up against
3767 echo " "
3768 $echo $n "Hmm...  $c"
3769 echo exit 1 >bsd
3770 echo exit 1 >usg
3771 echo exit 1 >v7
3772 echo exit 1 >osf1
3773 echo exit 1 >eunice
3774 echo exit 1 >xenix
3775 echo exit 1 >venix
3776 echo exit 1 >os2
3777 d_bsd="$undef"
3778 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3779 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3780 then
3781         echo "Looks kind of like an OSF/1 system, but we'll see..."
3782         echo exit 0 >osf1
3783 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3784         xxx=`./loc addbib blurfl $pth`
3785         if $test -f $xxx; then
3786         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3787                 echo exit 0 >bsd
3788                 echo exit 0 >usg
3789         else
3790                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3791                         echo "Looks kind of like an extended USG system, but we'll see..."
3792                 else
3793                         echo "Looks kind of like a USG system, but we'll see..."
3794                 fi
3795                 echo exit 0 >usg
3796         fi
3797 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3798         echo "Looks kind of like a BSD system, but we'll see..."
3799         d_bsd="$define"
3800         echo exit 0 >bsd
3801 else
3802         echo "Looks kind of like a Version 7 system, but we'll see..."
3803         echo exit 0 >v7
3804 fi
3805 case "$eunicefix" in
3806 *unixtovms*)
3807         $cat <<'EOI'
3808 There is, however, a strange, musty smell in the air that reminds me of
3809 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3810 EOI
3811         echo exit 0 >eunice
3812         d_eunice="$define"
3813 : it so happens the Eunice I know will not run shell scripts in Unix format
3814         ;;
3815 *)
3816         echo " "
3817         echo "Congratulations.  You aren't running Eunice."
3818         d_eunice="$undef"
3819         ;;
3820 esac
3821 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3822 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3823 : semicolon as a patch separator
3824 case "$p_" in
3825 :) ;;
3826 *)
3827         $cat <<'EOI'
3828 I have the feeling something is not exactly right, however...don't tell me...
3829 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3830 (Or you may be running DOS with DJGPP.)
3831 EOI
3832         echo exit 0 >os2
3833         ;;
3834 esac
3835 if test -f /xenix; then
3836         echo "Actually, this looks more like a XENIX system..."
3837         echo exit 0 >xenix
3838         d_xenix="$define"
3839 else
3840         echo " "
3841         echo "It's not Xenix..."
3842         d_xenix="$undef"
3843 fi
3844 chmod +x xenix
3845 $eunicefix xenix
3846 if test -f /venix; then
3847         echo "Actually, this looks more like a VENIX system..."
3848         echo exit 0 >venix
3849 else
3850         echo " "
3851         if ./xenix; then
3852                 : null
3853         else
3854                 echo "Nor is it Venix..."
3855         fi
3856 fi
3857 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3858 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3859 $rm -f foo
3860
3861 case "$cc" in
3862 '') dflt=cc;;
3863 *) dflt="$cc";;
3864 esac
3865 rp="Use which C compiler?"
3866 . ./myread
3867 cc="$ans"
3868
3869 : See if they have not cc but they do have gcc
3870 . ./trygcc
3871 : Look for a hint-file generated 'call-back-unit'.  Now that the
3872 : user has specified the compiler, we may need to set or change some
3873 : other defaults.
3874 if $test -f cc.cbu; then
3875     . ./cc.cbu
3876 fi
3877 . ./checkcc
3878
3879 echo " "
3880 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3881 $cat >try.c <<EOM
3882 #include <stdio.h>
3883 int main() {
3884 #ifdef __GNUC__
3885 #ifdef __VERSION__
3886         printf("%s\n", __VERSION__);
3887 #else
3888         printf("%s\n", "1");
3889 #endif
3890 #endif
3891         return(0);
3892 }
3893 EOM
3894 if $cc -o try $ccflags $ldflags try.c; then
3895         gccversion=`$run ./try`
3896         case "$gccversion" in
3897         '') echo "You are not using GNU cc." ;;
3898         *)  echo "You are using GNU cc $gccversion."
3899             ccname=gcc
3900             ;;
3901         esac
3902 else
3903         echo " "
3904         echo "*** WHOA THERE!!! ***" >&4
3905         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3906         case "$knowitall" in
3907         '')
3908         echo "    You'd better start hunting for one and let me know about it." >&4
3909                 exit 1
3910                 ;;
3911         esac
3912 fi
3913 $rm -f try try.*
3914 case "$gccversion" in
3915 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3916 esac
3917 case "$gccversion" in
3918 '') gccosandvers='' ;;
3919 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3920    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3921    gccshortvers=''
3922    case "$gccosandvers" in
3923    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3924    $osname$osvers) ;; # looking good
3925    $osname*) cat <<EOM >&4
3926
3927 *** WHOA THERE!!! ***
3928
3929     Your gcc has not been compiled for the exact release of
3930     your operating system ($gccosandvers versus $osname$osvers).
3931
3932     In general it is a good idea to keep gcc synchronized with
3933     the operating system because otherwise serious problems
3934     may ensue when trying to compile software, like Perl.
3935
3936     I'm trying to be optimistic here, though, and will continue.
3937     If later during the configuration and build icky compilation
3938     problems appear (headerfile conflicts being the most common
3939     manifestation), I suggest reinstalling the gcc to match
3940     your operating system release.
3941
3942 EOM
3943       ;;
3944    *) gccosandvers='' ;; # failed to parse, better be silent
3945    esac
3946    ;;
3947 esac
3948 case "$ccname" in
3949 '') ccname="$cc" ;;
3950 esac
3951
3952 # gcc 3.* complain about adding -Idirectories that they already know about,
3953 # so we will take those off from locincpth.
3954 case "$gccversion" in
3955 3*)
3956     echo "main(){}">try.c
3957     for incdir in $locincpth; do
3958        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3959              grep '^c[cp]p*[01]: warning: changing search order '`
3960        if test "X$warn" != X; then
3961            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3962        fi
3963     done
3964     $rm -f try try.*
3965 esac
3966
3967 : decide how portable to be.  Allow command line overrides.
3968 case "$d_portable" in
3969 "$undef") ;;
3970 *)      d_portable="$define" ;;
3971 esac
3972
3973 : set up shell script to do ~ expansion
3974 cat >filexp <<EOSS
3975 $startsh
3976 : expand filename
3977 case "\$1" in
3978  ~/*|~)
3979         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3980         ;;
3981  ~*)
3982         if $test -f /bin/csh; then
3983                 /bin/csh -f -c "glob \$1"
3984                 failed=\$?
3985                 echo ""
3986                 exit \$failed
3987         else
3988                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3989                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3990                 if $test ! -d "\$dir"; then
3991                         me=\`basename \$0\`
3992                         echo "\$me: can't locate home directory for: \$name" >&2
3993                         exit 1
3994                 fi
3995                 case "\$1" in
3996                 */*)
3997                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3998                         ;;
3999                 *)
4000                         echo \$dir
4001                         ;;
4002                 esac
4003         fi
4004         ;;
4005 *)
4006         echo \$1
4007         ;;
4008 esac
4009 EOSS
4010 chmod +x filexp
4011 $eunicefix filexp
4012
4013 : now set up to get a file name
4014 cat <<EOS >getfile
4015 $startsh
4016 EOS
4017 cat <<'EOSC' >>getfile
4018 tilde=''
4019 fullpath=''
4020 already=''
4021 skip=''
4022 none_ok=''
4023 exp_file=''
4024 nopath_ok=''
4025 orig_rp="$rp"
4026 orig_dflt="$dflt"
4027 case "$gfpth" in
4028 '') gfpth='.' ;;
4029 esac
4030
4031 case "$fn" in
4032 *\(*)
4033         : getfile will accept an answer from the comma-separated list
4034         : enclosed in parentheses even if it does not meet other criteria.
4035         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4036         fn=`echo $fn | sed 's/(.*)//'`
4037         ;;
4038 esac
4039
4040 case "$fn" in
4041 *:*)
4042         loc_file=`expr $fn : '.*:\(.*\)'`
4043         fn=`expr $fn : '\(.*\):.*'`
4044         ;;
4045 esac
4046
4047 case "$fn" in
4048 *~*) tilde=true;;
4049 esac
4050 case "$fn" in
4051 */*) fullpath=true;;
4052 esac
4053 case "$fn" in
4054 *+*) skip=true;;
4055 esac
4056 case "$fn" in
4057 *n*) none_ok=true;;
4058 esac
4059 case "$fn" in
4060 *e*) exp_file=true;;
4061 esac
4062 case "$fn" in
4063 *p*) nopath_ok=true;;
4064 esac
4065
4066 case "$fn" in
4067 *f*) type='File';;
4068 *d*) type='Directory';;
4069 *l*) type='Locate';;
4070 esac
4071
4072 what="$type"
4073 case "$what" in
4074 Locate) what='File';;
4075 esac
4076
4077 case "$exp_file" in
4078 '')
4079         case "$d_portable" in
4080         "$define") ;;
4081         *) exp_file=true;;
4082         esac
4083         ;;
4084 esac
4085
4086 cd ..
4087 while test "$type"; do
4088         redo=''
4089         rp="$orig_rp"
4090         dflt="$orig_dflt"
4091         case "$tilde" in
4092         true) rp="$rp (~name ok)";;
4093         esac
4094         . UU/myread
4095         if test -f UU/getfile.ok && \
4096                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4097         then
4098                 value="$ans"
4099                 ansexp="$ans"
4100                 break
4101         fi
4102         case "$ans" in
4103         none)
4104                 value=''
4105                 ansexp=''
4106                 case "$none_ok" in
4107                 true) type='';;
4108                 esac
4109                 ;;
4110         *)
4111                 case "$tilde" in
4112                 '') value="$ans"
4113                         ansexp="$ans";;
4114                 *)
4115                         value=`UU/filexp $ans`
4116                         case $? in
4117                         0)
4118                                 if test "$ans" != "$value"; then
4119                                         echo "(That expands to $value on this system.)"
4120                                 fi
4121                                 ;;
4122                         *) value="$ans";;
4123                         esac
4124                         ansexp="$value"
4125                         case "$exp_file" in
4126                         '') value="$ans";;
4127                         esac
4128                         ;;
4129                 esac
4130                 case "$fullpath" in
4131                 true)
4132                         case "$ansexp" in
4133                         /*) value="$ansexp" ;;
4134                         [a-zA-Z]:/*) value="$ansexp" ;;
4135                         *)
4136                                 redo=true
4137                                 case "$already" in
4138                                 true)
4139                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4140                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4141                                         ;;
4142                                 *)
4143                                 echo "Please give a full path name, starting with slash." >&4
4144                                         case "$tilde" in
4145                                         true)
4146                                 echo "Note that using ~name is ok provided it expands well." >&4
4147                                                 already=true
4148                                                 ;;
4149                                         esac
4150                                 esac
4151                                 ;;
4152                         esac
4153                         ;;
4154                 esac
4155                 case "$redo" in
4156                 '')
4157                         case "$type" in
4158                         File)
4159                                 for fp in $gfpth; do
4160                                         if test "X$fp" = X.; then
4161                                             pf="$ansexp"
4162                                         else    
4163                                             pf="$fp/$ansexp"
4164                                         fi
4165                                         if test -f "$pf"; then
4166                                                 type=''
4167                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4168                                         then
4169                                                 echo "($value is not a plain file, but that's ok.)"
4170                                                 type=''
4171                                         fi
4172                                         if test X"$type" = X; then
4173                                             value="$pf"
4174                                             break
4175                                         fi
4176                                 done
4177                                 ;;
4178                         Directory)
4179                                 for fp in $gfpth; do
4180                                         if test "X$fp" = X.; then
4181                                             dir="$ans"
4182                                             direxp="$ansexp"
4183                                         else    
4184                                             dir="$fp/$ansexp"
4185                                             direxp="$fp/$ansexp"
4186                                         fi
4187                                         if test -d "$direxp"; then
4188                                                 type=''
4189                                                 value="$dir"
4190                                                 break
4191                                         fi
4192                                 done
4193                                 ;;
4194                         Locate)
4195                                 if test -d "$ansexp"; then
4196                                         echo "(Looking for $loc_file in directory $value.)"
4197                                         value="$value/$loc_file"
4198                                         ansexp="$ansexp/$loc_file"
4199                                 fi
4200                                 if test -f "$ansexp"; then
4201                                         type=''
4202                                 fi
4203                                 case "$nopath_ok" in
4204                                 true)   case "$value" in
4205                                         */*) ;;
4206                                         *)      echo "Assuming $value will be in people's path."
4207                                                 type=''
4208                                                 ;;
4209                                         esac
4210                                         ;;
4211                                 esac
4212                                 ;;
4213                         esac
4214
4215                         case "$skip" in
4216                         true) type='';
4217                         esac
4218
4219                         case "$type" in
4220                         '') ;;
4221                         *)
4222                                 if test "$fastread" = yes; then
4223                                         dflt=y
4224                                 else
4225                                         dflt=n
4226                                 fi
4227                                 rp="$what $value doesn't exist.  Use that name anyway?"
4228                                 . UU/myread
4229                                 dflt=''
4230                                 case "$ans" in
4231                                 y*) type='';;
4232                                 *) echo " ";;
4233                                 esac
4234                                 ;;
4235                         esac
4236                         ;;
4237                 esac
4238                 ;;
4239         esac
4240 done
4241 cd UU
4242 ans="$value"
4243 rp="$orig_rp"
4244 dflt="$orig_dflt"
4245 rm -f getfile.ok
4246 test "X$gfpthkeep" != Xy && gfpth=""
4247 EOSC
4248
4249 : What should the include directory be ?
4250 echo " "
4251 $echo $n "Hmm...  $c"
4252 dflt='/usr/include'
4253 incpath=''
4254 mips_type=''
4255 if $test -f /bin/mips && /bin/mips; then
4256         echo "Looks like a MIPS system..."
4257         $cat >usr.c <<'EOCP'
4258 #ifdef SYSTYPE_BSD43
4259 /bsd43
4260 #endif
4261 EOCP
4262         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4263                 dflt='/bsd43/usr/include'
4264                 incpath='/bsd43'
4265                 mips_type='BSD 4.3'
4266         else
4267                 mips_type='System V'
4268         fi
4269         $rm -f usr.c usr.out
4270         echo "and you're compiling with the $mips_type compiler and libraries."
4271         xxx_prompt=y
4272         echo "exit 0" >mips
4273 else
4274         echo "Doesn't look like a MIPS system."
4275         xxx_prompt=n
4276         echo "exit 1" >mips
4277 fi
4278 chmod +x mips
4279 $eunicefix mips
4280 case "$usrinc" in
4281 '') ;;
4282 *) dflt="$usrinc";;
4283 esac
4284 case "$xxx_prompt" in
4285 y)      fn=d/
4286         echo " "
4287         rp='Where are the include files you want to use?'
4288         . ./getfile
4289         usrinc="$ans"
4290         ;;
4291 *)      usrinc="$dflt"
4292         ;;
4293 esac
4294
4295 : see how we invoke the C preprocessor
4296 echo " "
4297 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4298 cat <<'EOT' >testcpp.c
4299 #define ABC abc
4300 #define XYZ xyz
4301 ABC.XYZ
4302 EOT
4303 cd ..
4304 if test ! -f cppstdin; then
4305         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4306                 # AIX cc -E doesn't show the absolute headerfile
4307                 # locations but we'll cheat by using the -M flag.
4308                 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
4309         else
4310                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4311         fi
4312 else
4313         echo "Keeping your $hint cppstdin wrapper."
4314 fi
4315 chmod 755 cppstdin
4316 wrapper=`pwd`/cppstdin
4317 ok='false'
4318 cd UU
4319
4320 if $test "X$cppstdin" != "X" && \
4321         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4323 then
4324         echo "You used to use $cppstdin $cppminus so we'll use that again."
4325         case "$cpprun" in
4326         '') echo "But let's see if we can live without a wrapper..." ;;
4327         *)
4328                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4329                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4330                 then
4331                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4332                         ok='true'
4333                 else
4334                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4335                 fi
4336                 ;;
4337         esac
4338 else
4339         case "$cppstdin" in
4340         '') ;;
4341         *)
4342                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4343                 ;;
4344         esac
4345 fi
4346
4347 if $ok; then
4348         : nothing
4349 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4350         $cc -E <testcpp.c >testcpp.out 2>&1; \
4351         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4352         echo "Yup, it does."
4353         x_cpp="$cc -E"
4354         x_minus='';
4355 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4356         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4357         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4358         echo "Yup, it does."
4359         x_cpp="$cc -E"
4360         x_minus='-';
4361 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4362         $cc -P <testcpp.c >testcpp.out 2>&1; \
4363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4364         echo "Yipee, that works!"
4365         x_cpp="$cc -P"
4366         x_minus='';
4367 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4368         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4369         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4370         echo "At long last!"
4371         x_cpp="$cc -P"
4372         x_minus='-';
4373 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4374         $cpp <testcpp.c >testcpp.out 2>&1; \
4375         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4376         echo "It works!"
4377         x_cpp="$cpp"
4378         x_minus='';
4379 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4380         $cpp - <testcpp.c >testcpp.out 2>&1; \
4381         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4382         echo "Hooray, it works!  I was beginning to wonder."
4383         x_cpp="$cpp"
4384         x_minus='-';
4385 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4386         $wrapper <testcpp.c >testcpp.out 2>&1; \
4387         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4388         x_cpp="$wrapper"
4389         x_minus=''
4390         echo "Eureka!"
4391 else
4392         dflt=''
4393         rp="No dice.  I can't find a C preprocessor.  Name one:"
4394         . ./myread
4395         x_cpp="$ans"
4396         x_minus=''
4397         $x_cpp <testcpp.c >testcpp.out 2>&1
4398         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4399                 echo "OK, that will do." >&4
4400         else
4401 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4402                 exit 1
4403         fi
4404 fi
4405
4406 case "$ok" in
4407 false)
4408         cppstdin="$x_cpp"
4409         cppminus="$x_minus"
4410         cpprun="$x_cpp"
4411         cpplast="$x_minus"
4412         set X $x_cpp
4413         shift
4414         case "$1" in
4415         "$cpp")
4416                 echo "Perhaps can we force $cc -E using a wrapper..."
4417                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4418                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4419                 then
4420                         echo "Yup, we can."
4421                         cppstdin="$wrapper"
4422                         cppminus='';
4423                 else
4424                         echo "Nope, we'll have to live without it..."
4425                 fi
4426                 ;;
4427         esac
4428         case "$cpprun" in
4429         "$wrapper")
4430                 cpprun=''
4431                 cpplast=''
4432                 ;;
4433         esac
4434         ;;
4435 esac
4436
4437 case "$cppstdin" in
4438 "$wrapper"|'cppstdin') ;;
4439 *) $rm -f $wrapper;;
4440 esac
4441 $rm -f testcpp.c testcpp.out
4442
4443 : Set private lib path
4444 case "$plibpth" in
4445 '') if ./mips; then
4446                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4447         fi;;
4448 esac
4449 case "$libpth" in
4450 ' ') dlist='';;
4451 '') dlist="$loclibpth $plibpth $glibpth";;
4452 *) dlist="$libpth";;
4453 esac
4454
4455 : Now check and see which directories actually exist, avoiding duplicates
4456 libpth=''
4457 for xxx in $dlist
4458 do
4459     if $test -d $xxx; then
4460                 case " $libpth " in
4461                 *" $xxx "*) ;;
4462                 *) libpth="$libpth $xxx";;
4463                 esac
4464     fi
4465 done
4466 $cat <<'EOM'
4467
4468 Some systems have incompatible or broken versions of libraries.  Among
4469 the directories listed in the question below, please remove any you
4470 know not to be holding relevant libraries, and add any that are needed.
4471 Say "none" for none.
4472
4473 EOM
4474 case "$libpth" in
4475 '') dflt='none';;
4476 *)
4477         set X $libpth
4478         shift
4479         dflt=${1+"$@"}
4480         ;;
4481 esac
4482 rp="Directories to use for library searches?"
4483 . ./myread
4484 case "$ans" in
4485 none) libpth=' ';;
4486 *) libpth="$ans";;
4487 esac
4488
4489 : compute shared library extension
4490 case "$so" in
4491 '')
4492         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4493                 dflt='sl'
4494         else
4495                 dflt='so'
4496         fi
4497         ;;
4498 *) dflt="$so";;
4499 esac
4500 $cat <<EOM
4501
4502 On some systems, shared libraries may be available.  Answer 'none' if
4503 you want to suppress searching of shared libraries for the remainder
4504 of this configuration.
4505
4506 EOM
4507 rp='What is the file extension used for shared libraries?'
4508 . ./myread
4509 so="$ans"
4510
4511 : Define several unixisms.
4512 : Hints files or command line option can be used to override them.
4513 : The convoluted testing is in case hints files set either the old
4514 : or the new name.
4515 case "$_exe" in
4516 '')     case "$exe_ext" in
4517         '')     ;;
4518         *)      _exe="$exe_ext" ;;
4519         esac
4520         ;;
4521 esac
4522 case "$_a" in
4523 '')     case "$lib_ext" in
4524     '') _a='.a';;
4525         *)      _a="$lib_ext" ;;
4526         esac
4527         ;;
4528 esac
4529 case "$_o" in
4530 '') case "$obj_ext" in
4531         '')     _o='.o';;
4532         *)      _o="$obj_ext";;
4533         esac
4534         ;;
4535 esac
4536 case "$p_" in
4537 '') case "$path_sep" in
4538         '')     p_=':';;
4539         *)      p_="$path_sep";;
4540         esac
4541         ;;
4542 esac
4543 exe_ext=$_exe
4544 lib_ext=$_a
4545 obj_ext=$_o
4546 path_sep=$p_
4547
4548 : Which makefile gets called first.  This is used by make depend.
4549 case "$firstmakefile" in
4550 '') firstmakefile='makefile';;
4551 esac
4552
4553 case "$ccflags" in
4554 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4555 esac
4556
4557 case "$uselongdouble" in
4558 $define|true|[yY]*)     dflt='y';;
4559 *) dflt='n';;
4560 esac
4561 cat <<EOM
4562
4563 Perl can be built to take advantage of long doubles which
4564 (if available) may give more accuracy and range for floating point numbers.
4565
4566 If this doesn't make any sense to you, just accept the default '$dflt'.
4567 EOM
4568 rp='Try to use long doubles if available?'
4569 . ./myread
4570 case "$ans" in
4571 y|Y)    val="$define"   ;;
4572 *)      val="$undef"    ;;
4573 esac
4574 set uselongdouble
4575 eval $setvar
4576
4577 case "$uselongdouble" in
4578 true|[yY]*) uselongdouble="$define" ;;
4579 esac
4580
4581 : Look for a hint-file generated 'call-back-unit'.  If the
4582 : user has specified that long doubles should be used,
4583 : we may need to set or change some other defaults.
4584 if $test -f uselongdouble.cbu; then
4585     echo "Your platform has some specific hints regarding long doubles, using them..."
4586     . ./uselongdouble.cbu
4587 else
4588     case "$uselongdouble" in
4589         $define)
4590                 $cat <<EOM
4591 (Your platform does not have any specific hints for long doubles.)
4592 EOM
4593         ;;
4594     esac
4595 fi
4596
4597 : Looking for optional libraries
4598 echo " "
4599 echo "Checking for optional libraries..." >&4
4600 case "$libs" in
4601 ' '|'') dflt='';;
4602 *) dflt="$libs";;
4603 esac
4604 case "$libswanted" in
4605 '') libswanted='c_s';;
4606 esac
4607 case "$usesocks" in
4608 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4609 esac
4610 libsfound=''
4611 libsfiles=''
4612 libsdirs=''
4613 libspath=''
4614 for thisdir in $libpth $xlibpth; do
4615   test -d $thisdir && libspath="$libspath $thisdir"
4616 done
4617 for thislib in $libswanted; do
4618         for thisdir in $libspath; do
4619             xxx=''
4620             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4621                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4622                 $test -f "$xxx" && eval $libscheck
4623                 $test -f "$xxx" && libstyle=shared
4624             fi
4625             if test ! -f "$xxx"; then
4626                 xxx=$thisdir/lib$thislib.$so
4627                 $test -f "$xxx" && eval $libscheck
4628                 $test -f "$xxx" && libstyle=shared
4629             fi  
4630             if test ! -f "$xxx"; then
4631                 xxx=$thisdir/lib$thislib$_a
4632                 $test -f "$xxx" && eval $libscheck
4633                 $test -f "$xxx" && libstyle=static
4634             fi
4635             if test ! -f "$xxx"; then
4636                 xxx=$thisdir/$thislib$_a
4637                 $test -f "$xxx" && eval $libscheck
4638                 $test -f "$xxx" && libstyle=static
4639             fi
4640             if test ! -f "$xxx"; then
4641                 xxx=$thisdir/lib${thislib}_s$_a
4642                 $test -f "$xxx" && eval $libscheck
4643                 $test -f "$xxx" && libstyle=static
4644                 $test -f "$xxx" && thislib=${thislib}_s
4645             fi
4646             if test ! -f "$xxx"; then
4647                 xxx=$thisdir/Slib$thislib$_a
4648                 $test -f "$xxx" && eval $libscheck
4649                 $test -f "$xxx" && libstyle=static
4650             fi
4651             if $test -f "$xxx"; then
4652                 case "$libstyle" in
4653                 shared) echo "Found -l$thislib (shared)." ;;
4654                 static) echo "Found -l$thislib." ;;
4655                 *)      echo "Found -l$thislib ($libstyle)." ;;
4656                 esac
4657                 case " $dflt " in
4658                 *"-l$thislib "*);;
4659                 *) dflt="$dflt -l$thislib"
4660                    libsfound="$libsfound $xxx"
4661                    yyy=`basename $xxx`
4662                    libsfiles="$libsfiles $yyy"
4663                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4664                    case " $libsdirs " in
4665                    *" $yyy "*) ;;
4666                    *) libsdirs="$libsdirs $yyy" ;;
4667                    esac
4668                    ;;
4669                 esac
4670                 break
4671             fi  
4672         done
4673         if $test ! -f "$xxx"; then
4674             echo "No -l$thislib."
4675         fi
4676 done
4677 set X $dflt
4678 shift
4679 dflt="$*"
4680 case "$libs" in
4681 '') dflt="$dflt";;
4682 *) dflt="$libs";;
4683 esac
4684 case "$dflt" in
4685 ' '|'') dflt='none';;
4686 esac
4687
4688 $cat <<EOM
4689
4690 In order to compile $package on your machine, a number of libraries
4691 are usually needed.  Include any other special libraries here as well.
4692 Say "none" for none.  The default list is almost always right.
4693 EOM
4694
4695 echo " "
4696 rp="What libraries to use?"
4697 . ./myread
4698 case "$ans" in
4699 none) libs=' ';;
4700 *) libs="$ans";;
4701 esac
4702
4703 : determine optimization, if desired, or use for debug flag also
4704 case "$optimize" in
4705 ' '|$undef) dflt='none';;
4706 '') dflt='-O';;
4707 *) dflt="$optimize";;
4708 esac
4709 $cat <<EOH
4710
4711 By default, $package compiles with the -O flag to use the optimizer.
4712 Alternately, you might want to use the symbolic debugger, which uses
4713 the -g flag (on traditional Unix systems).  Either flag can be
4714 specified here.  To use neither flag, specify the word "none".
4715
4716 EOH
4717 rp="What optimizer/debugger flag should be used?"
4718 . ./myread
4719 optimize="$ans"
4720 case "$optimize" in
4721 'none') optimize=" ";;
4722 esac
4723
4724 dflt=''
4725 : We will not override a previous value, but we might want to
4726 : augment a hint file
4727 case "$hint" in
4728 default|recommended)
4729         case "$gccversion" in
4730         1*) dflt='-fpcc-struct-return' ;;
4731         esac
4732         case "$optimize" in
4733         *-g*) dflt="$dflt -DDEBUGGING";;
4734         esac
4735         case "$gccversion" in
4736         2*) if test -d /etc/conf/kconfig.d &&
4737                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4738                 then
4739                         # Interactive Systems (ISC) POSIX mode.
4740                         dflt="$dflt -posix"
4741                 fi
4742                 ;;
4743         esac
4744         case "$gccversion" in
4745         1*) ;;
4746         2.[0-8]*) ;;
4747         ?*)     echo " "
4748                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4749                 echo 'int main(void) { return 0; }' > gcctest.c
4750                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4751                         echo "Yes, it does." 2>&1
4752                         case "$ccflags" in
4753                         *strict-aliasing*)
4754                                 echo "Leaving current flags $ccflags alone." 2>&1
4755                                 ;;
4756                         *) dflt="$dflt -fno-strict-aliasing" ;;
4757                         esac
4758                 else
4759                         echo "Nope, it doesn't, but that's ok." 2>&1
4760                 fi
4761                 ;;
4762         esac
4763         # For gcc, adding -pipe speeds up compilations for some, but apparently
4764         # some assemblers can't read from stdin.  (It also slows down compilations
4765         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4766         case "$gccversion" in
4767         ?*)     echo " "
4768                 echo "Checking if your compiler accepts -pipe" 2>&1
4769                 echo 'int main(void) { return 0; }' > gcctest.c
4770                 if $cc -pipe -o gcctest gcctest.c; then
4771                         echo "Yes, it does." 2>&1
4772                         case "$ccflags" in
4773                         *-pipe*)
4774                                 echo "Leaving current flags $ccflags alone." 2>&1
4775                                 ;;
4776                         *) dflt="$dflt -pipe" ;;
4777                         esac
4778                 else
4779                         echo "Nope, it doesn't, but that's ok." 2>&1
4780                 fi
4781
4782                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4783                 echo 'int main(void) { return 0; }' > gcctest.c
4784                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4785                         echo "Yes, it does." 2>&1
4786                         case "$ccflags" in
4787                         *-Wdeclaration-after-statement*)
4788                                 echo "Leaving current flags $ccflags alone." 2>&1
4789                                 ;;
4790                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4791                         esac
4792                 else
4793                         echo "Nope, it doesn't, but that's ok." 2>&1
4794                 fi
4795                 ;;
4796         esac
4797         ;;
4798 esac
4799
4800 case "$mips_type" in
4801 *BSD*|'') inclwanted="$locincpth $usrinc";;
4802 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4803 esac
4804 for thisincl in $inclwanted; do
4805         if $test -d $thisincl; then
4806                 if $test x$thisincl != x$usrinc; then
4807                         case "$dflt" in
4808                         *" -I$thisincl "*);;
4809                         *) dflt="$dflt -I$thisincl ";;
4810                         esac
4811                 fi
4812         fi
4813 done
4814
4815 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4816         xxx=true;
4817 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4818         xxx=true;
4819 else
4820         xxx=false;
4821 fi;
4822 if $xxx; then
4823         case "$dflt" in
4824         *$2*);;
4825         *) dflt="$dflt -D$2";;
4826         esac;
4827 fi'
4828
4829 set signal.h LANGUAGE_C; eval $inctest
4830
4831 case "$usesocks" in
4832 $define)
4833         ccflags="$ccflags -DSOCKS"
4834         ;;
4835 esac
4836
4837 case "$hint" in
4838 default|recommended) dflt="$ccflags $dflt" ;;
4839 *) dflt="$ccflags";;
4840 esac
4841
4842 case "$dflt" in
4843 ''|' ') dflt=none;;
4844 esac
4845
4846 $cat <<EOH
4847
4848 Your C compiler may want other flags.  For this question you should include
4849 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4850 but you should NOT include libraries or ld flags like -lwhatever.  If you
4851 want $package to honor its debug switch, you should include -DDEBUGGING here.
4852 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4853
4854 To use no flags, specify the word "none".
4855
4856 EOH
4857 set X $dflt
4858 shift
4859 dflt=${1+"$@"}
4860 rp="Any additional cc flags?"
4861 . ./myread
4862 case "$ans" in
4863 none) ccflags='';;
4864 *) ccflags="$ans";;
4865 esac
4866
4867 : the following weeds options from ccflags that are of no interest to cpp
4868 case "$cppflags" in
4869 '') cppflags="$ccflags" ;;
4870 *)  cppflags="$cppflags $ccflags" ;;
4871 esac
4872 case "$gccversion" in
4873 1*) cppflags="$cppflags -D__GNUC__"
4874 esac
4875 case "$mips_type" in
4876 '');;
4877 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4878 esac
4879 case "$cppflags" in
4880 '');;
4881 *)
4882         echo " "
4883         echo "Let me guess what the preprocessor flags are..." >&4
4884         set X $cppflags
4885         shift
4886         cppflags=''
4887         $cat >cpp.c <<'EOM'
4888 #define BLURFL foo
4889
4890 BLURFL xx LFRULB
4891 EOM
4892         previous=''
4893         for flag in $*
4894         do
4895                 case "$flag" in
4896                 -*) ftry="$flag";;
4897                 *) ftry="$previous $flag";;
4898                 esac
4899                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4900                         >cpp1.out 2>/dev/null && \
4901                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4902                         >cpp2.out 2>/dev/null && \
4903                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4904                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4905                 then
4906                         cppflags="$cppflags $ftry"
4907                         previous=''
4908                 else
4909                         previous="$flag"
4910                 fi
4911         done
4912         set X $cppflags
4913         shift
4914         cppflags=${1+"$@"}
4915         case "$cppflags" in
4916         *-*)  echo "They appear to be: $cppflags";;
4917         esac
4918         $rm -f cpp.c cpp?.out
4919         ;;
4920 esac
4921
4922 : flags used in final linking phase
4923 case "$ldflags" in
4924 '') if ./venix; then
4925                 dflt='-i -z'
4926         else
4927                 dflt=''
4928         fi
4929         case "$ccflags" in
4930         *-posix*) dflt="$dflt -posix" ;;
4931         esac
4932         ;;
4933 *) dflt="$ldflags";;
4934 esac
4935
4936 : Try to guess additional flags to pick up local libraries.
4937 for thislibdir in $libpth; do
4938         case " $loclibpth " in
4939         *" $thislibdir "*)
4940                 case "$dflt " in
4941                 *"-L$thislibdir "*) ;;
4942                 *)  dflt="$dflt -L$thislibdir" ;;
4943                 esac
4944                 ;;
4945         esac
4946 done
4947
4948 case "$dflt" in
4949 '') dflt='none' ;;
4950 esac
4951
4952 $cat <<EOH
4953
4954 Your C linker may need flags.  For this question you should
4955 include -L/whatever and any other flags used by the C linker, but you
4956 should NOT include libraries like -lwhatever.
4957
4958 Make sure you include the appropriate -L/path flags if your C linker
4959 does not normally search all of the directories you specified above,
4960 namely
4961         $libpth
4962 To use no flags, specify the word "none".
4963
4964 EOH
4965
4966 rp="Any additional ld flags (NOT including libraries)?"
4967 . ./myread
4968 case "$ans" in
4969 none) ldflags='';;
4970 *) ldflags="$ans";;
4971 esac
4972 rmlist="$rmlist pdp11"
4973
4974 : coherency check
4975 echo " "
4976 echo "Checking your choice of C compiler and flags for coherency..." >&4
4977 $cat > try.c <<'EOF'
4978 #include <stdio.h>
4979 int main() { printf("Ok\n"); return(0); }
4980 EOF
4981 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4982 shift
4983 $cat >try.msg <<'EOM'
4984 I've tried to compile and run the following simple program:
4985
4986 EOM
4987 $cat try.c >> try.msg
4988
4989 $cat >> try.msg <<EOM
4990
4991 I used the command:
4992
4993         $*
4994         $run ./try
4995
4996 and I got the following output:
4997
4998 EOM
4999 dflt=y
5000 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5001         if $sh -c "$run ./try" >>try.msg 2>&1; then
5002                 xxx=`$run ./try`
5003                 case "$xxx" in
5004                 "Ok") dflt=n ;;
5005                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5006                         case " $libs " in
5007                         *" -lsfio "*)
5008                                 cat >> try.msg <<'EOQS'
5009 If $libs contains -lsfio, and sfio is mis-configured, then it
5010 sometimes (apparently) runs and exits with a 0 status, but with no
5011 output!  It may have to do with sfio's use of _exit vs. exit.
5012
5013 EOQS
5014                                 rp="You have a big problem.  Shall I abort Configure"
5015                                 dflt=y
5016                                 ;;
5017                         esac
5018                         ;;
5019                 esac
5020         else
5021                 echo "The program compiled OK, but exited with status $?." >>try.msg
5022                 rp="You have a problem.  Shall I abort Configure"
5023                 dflt=y
5024         fi
5025 else
5026         echo "I can't compile the test program." >>try.msg
5027         rp="You have a BIG problem.  Shall I abort Configure"
5028         dflt=y
5029 fi
5030 case "$dflt" in
5031 y)
5032         $cat try.msg >&4
5033         case "$knowitall" in
5034         '')
5035                 echo "(The supplied flags or libraries might be incorrect.)"
5036                 ;;
5037         *) dflt=n;;
5038         esac
5039         echo " "
5040         . ./myread
5041         case "$ans" in
5042         n*|N*) ;;
5043         *)      echo "Ok.  Stopping Configure." >&4
5044                 exit 1
5045                 ;;
5046         esac
5047         ;;
5048 n) echo "OK, that should do.";;
5049 esac
5050 $rm -f try try.* core
5051
5052 : define a shorthand compile call
5053 compile='
5054 mc_file=$1;
5055 shift;
5056 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5057 : define a shorthand compile call for compilations that should be ok.
5058 compile_ok='
5059 mc_file=$1;
5060 shift;
5061 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5062
5063 : determine filename position in cpp output
5064 echo " "
5065 echo "Computing filename position in cpp output for #include directives..." >&4
5066 case "$osname" in
5067 vos) testaccess=-e ;;
5068 *)   testaccess=-r ;;
5069 esac
5070 echo '#include <stdio.h>' > foo.c
5071 $cat >fieldn <<EOF
5072 $startsh
5073 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5074 $grep '^[       ]*#.*stdio\.h' | \
5075 while read cline; do
5076         pos=1
5077         set \$cline
5078         while $test \$# -gt 0; do
5079                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5080                         echo "\$pos"
5081                         exit 0
5082                 fi
5083                 shift
5084                 pos=\`expr \$pos + 1\`
5085         done
5086 done
5087 EOF
5088 chmod +x fieldn
5089 fieldn=`./fieldn`
5090 $rm -f foo.c fieldn
5091 case $fieldn in
5092 '') pos='???';;
5093 1) pos=first;;
5094 2) pos=second;;
5095 3) pos=third;;
5096 *) pos="${fieldn}th";;
5097 esac
5098 echo "Your cpp writes the filename in the $pos field of the line."
5099
5100 case "$osname" in
5101 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5102 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5103 *)   cppfilter='' ;;
5104 esac
5105 : locate header file
5106 $cat >findhdr <<EOF
5107 $startsh
5108 wanted=\$1
5109 name=''
5110 for usrincdir in $usrinc
5111 do
5112         if test -f \$usrincdir/\$wanted; then
5113                 echo "\$usrincdir/\$wanted"
5114                 exit 0
5115         fi
5116 done
5117 awkprg='{ print \$$fieldn }'
5118 echo "#include <\$wanted>" > foo\$\$.c
5119 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5120 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5121 while read cline; do
5122         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5123         case "\$name" in
5124         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5125         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5126         *) exit 2;;
5127         esac;
5128 done;
5129 #
5130 # status = 0: grep returned 0 lines, case statement not executed
5131 # status = 1: headerfile found
5132 # status = 2: while loop executed, no headerfile found
5133 #
5134 status=\$?
5135 $rm -f foo\$\$.c;
5136 if test \$status -eq 1; then
5137         exit 0;
5138 fi
5139 exit 1
5140 EOF
5141 chmod +x findhdr
5142
5143 : define an alternate in-header-list? function
5144 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5145 cont=true; xxf="echo \"<\$1> found.\" >&4";
5146 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5147 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5148 esac;
5149 case $# in 4) instead=instead;; *) instead="at last";; esac;
5150 while $test "$cont"; do
5151         xxx=`./findhdr $1`
5152         var=$2; eval "was=\$$2";
5153         if $test "$xxx" && $test -r "$xxx";
5154         then eval $xxf;
5155         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5156                 cont="";
5157         else eval $xxnf;
5158         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5159         set $yyy; shift; shift; yyy=$@;
5160         case $# in 0) cont="";;
5161         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5162                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5163         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5164                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5165         esac;
5166 done;
5167 while $test "$yyy";
5168 do set $yyy; var=$2; eval "was=\$$2";
5169         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5170         set $yyy; shift; shift; yyy=$@;
5171 done'
5172
5173 : see if stdlib is available
5174 set stdlib.h i_stdlib
5175 eval $inhdr
5176
5177 : check for lengths of integral types
5178 echo " "
5179 case "$intsize" in
5180 '')
5181         echo "Checking to see how big your integers are..." >&4
5182         $cat >try.c <<EOCP
5183 #include <stdio.h>
5184 #$i_stdlib I_STDLIB
5185 #ifdef I_STDLIB
5186 #include <stdlib.h>
5187 #endif
5188 int main()
5189 {
5190         printf("intsize=%d;\n", (int)sizeof(int));
5191         printf("longsize=%d;\n", (int)sizeof(long));
5192         printf("shortsize=%d;\n", (int)sizeof(short));
5193         exit(0);
5194 }
5195 EOCP
5196         set try
5197         if eval $compile_ok && $run ./try > /dev/null; then
5198                 eval `$run ./try`
5199                 echo "Your integers are $intsize bytes long."
5200                 echo "Your long integers are $longsize bytes long."
5201                 echo "Your short integers are $shortsize bytes long."
5202         else
5203                 $cat >&4 <<EOM
5204 !
5205 Help! I can't compile and run the intsize test program: please enlighten me!
5206 (This is probably a misconfiguration in your system or libraries, and
5207 you really ought to fix it.  Still, I'll try anyway.)
5208 !
5209 EOM
5210                 dflt=4
5211                 rp="What is the size of an integer (in bytes)?"
5212                 . ./myread
5213                 intsize="$ans"
5214                 dflt=$intsize
5215                 rp="What is the size of a long integer (in bytes)?"
5216                 . ./myread
5217                 longsize="$ans"
5218                 dflt=2
5219                 rp="What is the size of a short integer (in bytes)?"
5220                 . ./myread
5221                 shortsize="$ans"
5222         fi
5223         ;;
5224 esac
5225 $rm -f try try.*
5226
5227 : check for long long
5228 echo " "
5229 echo "Checking to see if you have long long..." >&4
5230 echo 'int main() { long long x = 7; return 0; }' > try.c
5231 set try
5232 if eval $compile; then
5233         val="$define"
5234         echo "You have long long."
5235 else
5236         val="$undef"
5237         echo "You do not have long long."
5238 fi
5239 $rm try.*
5240 set d_longlong
5241 eval $setvar
5242
5243 : check for length of long long
5244 case "${d_longlong}${longlongsize}" in
5245 $define)
5246         echo " "
5247         echo "Checking to see how big your long longs are..." >&4
5248         $cat >try.c <<'EOCP'
5249 #include <stdio.h>
5250 int main()
5251 {
5252     printf("%d\n", (int)sizeof(long long));
5253     return(0);
5254 }
5255 EOCP
5256         set try
5257         if eval $compile_ok; then
5258                 longlongsize=`$run ./try`
5259                 echo "Your long longs are $longlongsize bytes long."
5260         else
5261                 dflt='8'
5262                 echo " "
5263                 echo "(I can't seem to compile the test program.  Guessing...)"
5264                 rp="What is the size of a long long (in bytes)?"
5265                 . ./myread
5266                 longlongsize="$ans"
5267         fi
5268         if $test "X$longsize" = "X$longlongsize"; then
5269                 echo "(That isn't any different from an ordinary long.)"
5270         fi      
5271         ;;
5272 esac
5273 $rm -f try.* try
5274
5275 : see if inttypes.h is available
5276 : we want a real compile instead of Inhdr because some systems
5277 : have an inttypes.h which includes non-existent headers
5278 echo " "
5279 $cat >try.c <<EOCP
5280 #include <inttypes.h>
5281 int main() {
5282         static int32_t foo32 = 0x12345678;
5283 }
5284 EOCP
5285 set try
5286 if eval $compile; then
5287         echo "<inttypes.h> found." >&4
5288         val="$define"
5289 else
5290         echo "<inttypes.h> NOT found." >&4
5291         val="$undef"
5292 fi
5293 $rm -f try.c try
5294 set i_inttypes
5295 eval $setvar
5296
5297 : check for int64_t
5298 echo " "
5299 echo "Checking to see if you have int64_t..." >&4
5300 $cat >try.c <<EOCP
5301 #include <sys/types.h>
5302 #$i_inttypes I_INTTYPES
5303 #ifdef I_INTTYPES
5304 #include <inttypes.h>
5305 #endif
5306 int main() { int64_t x = 7; }
5307 EOCP
5308 set try
5309 if eval $compile; then
5310         val="$define"
5311         echo "You have int64_t."
5312 else
5313         val="$undef"
5314         echo "You do not have int64_t."
5315 fi
5316 $rm -f try try.*
5317 set d_int64_t
5318 eval $setvar
5319
5320
5321 echo " "
5322 echo "Checking which 64-bit integer type we could use..." >&4
5323
5324 case "$intsize" in
5325 8) val=int
5326    set quadtype
5327    eval $setvar
5328    val='"unsigned int"'
5329    set uquadtype
5330    eval $setvar
5331    quadkind=1
5332    ;;
5333 *) case "$longsize" in
5334    8) val=long
5335       set quadtype
5336       eval $setvar
5337       val='"unsigned long"'
5338       set uquadtype
5339       eval $setvar
5340       quadkind=2
5341       ;;
5342    *) case "$d_longlong:$longlongsize" in
5343       define:8)
5344         val='"long long"'
5345         set quadtype
5346         eval $setvar
5347         val='"unsigned long long"'
5348         set uquadtype
5349         eval $setvar
5350         quadkind=3
5351         ;;
5352       *) case "$d_int64_t" in
5353          define)
5354            val=int64_t
5355            set quadtype
5356            eval $setvar
5357            val=uint64_t
5358            set uquadtype
5359            eval $setvar
5360            quadkind=4
5361            ;;
5362          esac
5363          ;;
5364       esac
5365       ;;
5366    esac
5367    ;;
5368 esac
5369
5370 case "$quadtype" in
5371 '')     echo "Alas, no 64-bit integer types in sight." >&4
5372         d_quad="$undef"
5373         ;;
5374 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5375         d_quad="$define"
5376         ;;
5377 esac
5378
5379
5380 case "$uselonglong" in
5381 "$define"|true|[yY]*)
5382         cat <<EOM >&4
5383
5384 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5385 EOM
5386         use64bitint="$define"
5387         ;;
5388 esac                          
5389 case "$use64bits" in
5390 "$define"|true|[yY]*)
5391         cat <<EOM >&4
5392
5393 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5394 EOM
5395         use64bitint="$define"
5396         ;;
5397 esac                          
5398 case "$use64bitints" in
5399 "$define"|true|[yY]*)
5400         cat <<EOM >&4
5401
5402 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5403 EOM
5404         use64bitint="$define"
5405         ;;
5406 esac                          
5407 case "$use64bitsint" in
5408 "$define"|true|[yY]*)
5409         cat <<EOM >&4
5410
5411 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5412 EOM
5413         use64bitint="$define"
5414         ;;
5415 esac                          
5416 case "$uselonglongs" in
5417 "$define"|true|[yY]*)
5418         cat <<EOM >&4
5419
5420 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5421 EOM
5422         use64bitint="$define"
5423         ;;
5424 esac                          
5425 case "$use64bitsall" in
5426 "$define"|true|[yY]*)
5427         cat <<EOM >&4
5428
5429 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5430 EOM
5431         use64bitall="$define"
5432         ;;
5433 esac                          
5434
5435 case "$ccflags" in
5436 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5437 esac
5438 case "$use64bitall" in
5439 "$define"|true|[yY]*) use64bitint="$define" ;;
5440 esac
5441
5442 case "$longsize" in
5443 8) cat <<EOM
5444
5445 You have natively 64-bit long integers.
5446 EOM
5447    val="$define"
5448    ;;
5449 *) case "$use64bitint" in
5450    "$define"|true|[yY]*) dflt='y';;
5451    *) dflt='n';;
5452    esac
5453    case "$d_quad" in
5454    "$define") ;;
5455    *) dflt='n' ;;
5456    esac
5457    cat <<EOM
5458
5459 Perl can be built to take advantage of 64-bit integer types
5460 on some systems.  To do so, Configure can be run with -Duse64bitint.
5461 Choosing this option will most probably introduce binary incompatibilities.
5462
5463 If this doesn't make any sense to you, just accept the default '$dflt'.
5464 (The default has been chosen based on your configuration.)
5465 EOM
5466    rp='Try to use 64-bit integers, if available?'
5467    . ./myread
5468    case "$ans" in
5469    [yY]*) val="$define" ;;
5470    *)     val="$undef"  ;;
5471    esac
5472    ;;
5473 esac
5474 set use64bitint
5475 eval $setvar
5476
5477 case "$use64bitall" in
5478 "$define"|true|[yY]*) dflt='y' ;;
5479 *) case "$longsize" in
5480    8) dflt='y' ;;
5481    *) dflt='n' ;;
5482    esac
5483    ;;
5484 esac    
5485 cat <<EOM
5486
5487 You may also choose to try maximal 64-bitness.  It means using as much
5488 64-bitness as possible on the platform.  This in turn means even more
5489 binary incompatibilities.  On the other hand, your platform may not
5490 have any more 64-bitness available than what you already have chosen.
5491
5492 If this doesn't make any sense to you, just accept the default '$dflt'.
5493 (The default has been chosen based on your configuration.)
5494 EOM
5495 rp='Try to use maximal 64-bit support, if available?'
5496 . ./myread
5497 case "$ans" in
5498 [yY]*) val="$define" ;;
5499 *)     val="$undef"  ;;
5500 esac
5501 set use64bitall
5502 eval $setvar
5503 case "$use64bitall" in
5504 "$define")
5505         case "$use64bitint" in
5506         "$undef")
5507                 cat <<EOM
5508
5509 Since you have chosen a maximally 64-bit build, I'm also turning on
5510 the use of 64-bit integers.
5511 EOM
5512                 use64bitint="$define" ;;
5513         esac
5514         ;;
5515 esac
5516
5517 : Look for a hint-file generated 'call-back-unit'.  If the
5518 : user has specified that a 64-bit perl is to be built,
5519 : we may need to set or change some other defaults.
5520 if $test -f use64bitint.cbu; then
5521         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5522         . ./use64bitint.cbu
5523 fi
5524 case "$use64bitint" in
5525 "$define"|true|[yY]*)
5526         case "$longsize" in
5527         4) case "$archname64" in
5528            '') archname64=64int ;;
5529            esac
5530            ;;
5531         esac
5532         ;;
5533 esac
5534
5535 : Look for a hint-file generated 'call-back-unit'.  If the
5536 : user has specified that a maximally 64-bit perl is to be built,
5537 : we may need to set or change some other defaults.
5538 if $test -f use64bitall.cbu; then
5539         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5540         . ./use64bitall.cbu
5541 fi
5542 case "$use64bitall" in
5543 "$define"|true|[yY]*)
5544         case "$longsize" in
5545         4) case "$archname64" in
5546            ''|64int) archname64=64all ;;
5547            esac
5548            ;;
5549         esac
5550         ;;
5551 esac
5552
5553 case "$d_quad:$use64bitint" in
5554 $undef:$define)
5555         cat >&4 <<EOF
5556
5557 *** You have chosen to use 64-bit integers,
5558 *** but none can be found.
5559 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5560 *** Cannot continue, aborting.
5561
5562 EOF
5563         exit 1
5564         ;;
5565 esac
5566
5567 : check for length of double
5568 echo " "
5569 case "$doublesize" in
5570 '')
5571         echo "Checking to see how big your double precision numbers are..." >&4
5572         $cat >try.c <<EOCP
5573 #include <stdio.h>
5574 #$i_stdlib I_STDLIB
5575 #ifdef I_STDLIB
5576 #include <stdlib.h>
5577 #endif
5578 int main()
5579 {
5580     printf("%d\n", (int)sizeof(double));
5581     exit(0);
5582 }
5583 EOCP
5584         set try
5585         if eval $compile_ok; then
5586                 doublesize=`$run ./try`
5587                 echo "Your double is $doublesize bytes long."
5588         else
5589                 dflt='8'
5590                 echo "(I can't seem to compile the test program.  Guessing...)"
5591                 rp="What is the size of a double precision number (in bytes)?"
5592                 . ./myread
5593                 doublesize="$ans"
5594         fi
5595         ;;
5596 esac
5597 $rm -f try.c try
5598
5599 : check for long doubles
5600 echo " "
5601 echo "Checking to see if you have long double..." >&4
5602 echo 'int main() { long double x = 7.0; }' > try.c
5603 set try
5604 if eval $compile; then
5605         val="$define"
5606         echo "You have long double."
5607 else
5608         val="$undef"
5609         echo "You do not have long double."
5610 fi
5611 $rm try.*
5612 set d_longdbl
5613 eval $setvar
5614
5615 : check for length of long double
5616 case "${d_longdbl}${longdblsize}" in
5617 $define)
5618         echo " "
5619         echo "Checking to see how big your long doubles are..." >&4
5620         $cat >try.c <<'EOCP'
5621 #include <stdio.h>
5622 int main()
5623 {
5624         printf("%d\n", sizeof(long double));
5625 }
5626 EOCP
5627         set try
5628         set try
5629         if eval $compile; then
5630                 longdblsize=`$run ./try`
5631                 echo "Your long doubles are $longdblsize bytes long."
5632         else
5633                 dflt='8'
5634                 echo " "
5635                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5636                 rp="What is the size of a long double (in bytes)?"
5637                 . ./myread
5638                 longdblsize="$ans"
5639         fi
5640         if $test "X$doublesize" = "X$longdblsize"; then
5641                 echo "That isn't any different from an ordinary double."
5642                 echo "I'll keep your setting anyway, but you may see some"
5643                 echo "harmless compilation warnings."
5644         fi      
5645         ;;
5646 esac
5647 $rm -f try.* try
5648
5649 : determine the architecture name
5650 echo " "
5651 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5652         tarch=`arch`"-$osname"
5653 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5654         if uname -m > tmparch 2>&1 ; then
5655                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5656                         -e 's/$/'"-$osname/" tmparch`
5657         else
5658                 tarch="$osname"
5659         fi
5660         $rm -f tmparch
5661 else
5662         tarch="$osname"
5663 fi
5664 case "$myarchname" in
5665 ''|"$tarch") ;;
5666 *)
5667         echo "(Your architecture name used to be $myarchname.)"
5668         archname=''
5669         ;;
5670 esac
5671 case "$targetarch" in
5672 '') ;;
5673 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5674 esac
5675 myarchname="$tarch"
5676 case "$archname" in
5677 '') dflt="$tarch";;
5678 *) dflt="$archname";;
5679 esac
5680 rp='What is your architecture name'
5681 . ./myread
5682 archname="$ans"
5683 case "$usethreads" in
5684 $define)
5685         echo "Threads selected." >&4
5686         case "$archname" in
5687         *-thread*) echo "...and architecture name already has -thread." >&4
5688                 ;;
5689         *)      archname="$archname-thread"
5690                 echo "...setting architecture name to $archname." >&4
5691                 ;;
5692         esac
5693         ;;
5694 esac
5695 case "$usemultiplicity" in
5696 $define)
5697         echo "Multiplicity selected." >&4
5698         case "$archname" in
5699         *-multi*) echo "...and architecture name already has -multi." >&4
5700                 ;;
5701         *)      archname="$archname-multi"
5702                 echo "...setting architecture name to $archname." >&4
5703                 ;;
5704         esac
5705         ;;
5706 esac
5707 case "$use64bitint$use64bitall" in
5708 *"$define"*)
5709         case "$archname64" in
5710         '')
5711                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5712                 ;;
5713         *)
5714                 case "$use64bitint" in
5715                 "$define") echo "64 bit integers selected." >&4 ;;
5716                 esac
5717                 case "$use64bitall" in
5718                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5719                 esac
5720                 case "$archname" in
5721                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5722                         ;;
5723                 *)      archname="$archname-$archname64"
5724                         echo "...setting architecture name to $archname." >&4
5725                         ;;
5726                 esac
5727                 ;;
5728         esac
5729 esac
5730 case "$uselongdouble" in
5731 $define)
5732         echo "Long doubles selected." >&4
5733         case "$longdblsize" in
5734         $doublesize)
5735                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5736                 ;;
5737         *)
5738                 case "$archname" in
5739                 *-ld*) echo "...and architecture name already has -ld." >&4
5740                         ;;
5741                 *)      archname="$archname-ld"
5742                         echo "...setting architecture name to $archname." >&4
5743                         ;;
5744                 esac
5745                 ;;
5746         esac
5747         ;;
5748 esac
5749 case "$useperlio" in
5750 $define)
5751         echo "Perlio selected." >&4
5752         ;;
5753 *)
5754         echo "Perlio not selected, using stdio." >&4
5755         case "$archname" in
5756         *-stdio*) echo "...and architecture name already has -stdio." >&4
5757                 ;;
5758         *)      archname="$archname-stdio"
5759                 echo "...setting architecture name to $archname." >&4
5760                 ;;
5761         esac
5762         ;;
5763 esac
5764 if $test -f archname.cbu; then
5765         echo "Your platform has some specific hints for architecture name, using them..."
5766         . ./archname.cbu
5767 fi
5768
5769 : determine root of directory hierarchy where package will be installed.
5770 case "$prefix" in
5771 '')
5772         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5773         ;;
5774 *?/)
5775         dflt=`echo "$prefix" | sed 's/.$//'`
5776         ;;
5777 *)
5778         dflt="$prefix"
5779         ;;
5780 esac
5781 $cat <<EOM
5782
5783 By default, $package will be installed in $dflt/bin, manual pages
5784 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5785 installation directories. Typically this is something like /usr/local.
5786 If you wish to have binaries under /usr/bin but other parts of the
5787 installation under /usr/local, that's ok: you will be prompted
5788 separately for each of the installation directories, the prefix being
5789 only used to set the defaults.
5790
5791 EOM
5792 fn=d~
5793 rp='Installation prefix to use?'
5794 . ./getfile
5795 oldprefix=''
5796 case "$prefix" in
5797 '') ;;
5798 *)
5799         case "$ans" in
5800         "$prefix") ;;
5801         *) oldprefix="$prefix";;
5802         esac
5803         ;;
5804 esac
5805 prefix="$ans"
5806 prefixexp="$ansexp"
5807
5808 case "$afsroot" in
5809 '')     afsroot=/afs ;;
5810 *)      afsroot=$afsroot ;;
5811 esac
5812
5813 : is AFS running?
5814 echo " "
5815 case "$afs" in
5816 $define|true)   afs=true ;;
5817 $undef|false)   afs=false ;;
5818 *)      if test -d $afsroot; then
5819                 afs=true
5820         else
5821                 afs=false
5822         fi
5823         ;;
5824 esac
5825 if $afs; then
5826         echo "AFS may be running... I'll be extra cautious then..." >&4
5827 else
5828         echo "AFS does not seem to be running..." >&4
5829 fi
5830
5831 : determine installation prefix for where package is to be installed.
5832 if $afs; then 
5833 $cat <<EOM
5834
5835 Since you are running AFS, I need to distinguish the directory in which
5836 files will reside from the directory in which they are installed (and from
5837 which they are presumably copied to the former directory by occult means).
5838
5839 EOM
5840         case "$installprefix" in
5841         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5842         *) dflt="$installprefix";;
5843         esac
5844 else
5845 $cat <<EOM
5846
5847 In some special cases, particularly when building $package for distribution,
5848 it is convenient to distinguish the directory in which files should be
5849 installed from the directory ($prefix) in which they will
5850 eventually reside.  For most users, these two directories are the same.
5851
5852 EOM
5853         case "$installprefix" in
5854         '') dflt=$prefix ;;
5855         *) dflt=$installprefix;;
5856         esac
5857 fi
5858 fn=d~
5859 rp='What installation prefix should I use for installing files?'
5860 . ./getfile
5861 installprefix="$ans"
5862 installprefixexp="$ansexp"
5863
5864 : set the prefixit variable, to compute a suitable default value
5865 prefixit='case "$3" in
5866 ""|none)
5867         case "$oldprefix" in
5868         "") eval "$1=\"\$$2\"";;
5869         *)
5870                 case "$3" in
5871                 "") eval "$1=";;
5872                 none)
5873                         eval "tp=\"\$$2\"";
5874                         case "$tp" in
5875                         ""|" ") eval "$1=\"\$$2\"";;
5876                         *) eval "$1=";;
5877                         esac;;
5878                 esac;;
5879         esac;;
5880 *)
5881         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5882         case "$tp" in
5883         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5884         /*-$oldprefix/*|\~*-$oldprefix/*)
5885                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5886         *) eval "$1=\"\$$2\"";;
5887         esac;;
5888 esac'
5889
5890 : get the patchlevel
5891 echo " "
5892 echo "Getting the current patchlevel..." >&4
5893 if $test -r $rsrc/patchlevel.h;then
5894         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5895         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5896         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5897         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5898         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5899         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5900         perl_patchlevel=`grep 'define PERL_PATCHNUM [0-9][0-9]*' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5901 else
5902         revision=0
5903         patchlevel=0
5904         subversion=0
5905         api_revision=0
5906         api_version=0
5907         api_subversion=0
5908         perl_patchlevel=0
5909         $echo "(You do not have patchlevel.h.  Eek.)"
5910 fi
5911 if $test -r $rsrc/.patch ; then  
5912         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5913                 perl_patchlevel=`cat $rsrc/.patch`
5914         fi
5915 fi
5916 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5917 version_patchlevel_string="version $patchlevel subversion $subversion"
5918 case "$perl_patchlevel" in
5919 0|'') ;;
5920 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5921 esac
5922
5923 $echo "(You have $package $version_patchlevel_string.)"
5924
5925 case "$osname" in
5926 dos|vms)
5927         : XXX Should be a Configure test for double-dots in filenames.
5928         version=`echo $revision $patchlevel $subversion | \
5929                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5930         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5931                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5932         ;;
5933 *)
5934         version=`echo $revision $patchlevel $subversion | \
5935                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5936         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5937                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5938         ;;
5939 esac
5940 : Special case the 5.005_xx maintenance series, which used 5.005
5941 : without any subversion label as a subdirectory in $sitelib
5942 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5943         api_versionstring='5.005'
5944 fi
5945
5946 : determine installation style
5947 : For now, try to deduce it from prefix unless it is already set.
5948 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5949 case "$installstyle" in
5950 '')     case "$prefix" in
5951                 *perl*) dflt='lib';;
5952                 *) dflt='lib/perl5' ;;
5953         esac
5954         ;;
5955 *)      dflt="$installstyle" ;;
5956 esac
5957 : Probably not worth prompting for this since we prompt for all
5958 : the directories individually, and the prompt would be too long and
5959 : confusing anyway.
5960 installstyle=$dflt
5961
5962 : determine where private library files go
5963 : Usual default is /usr/local/lib/perl5/$version.
5964 : Also allow things like /opt/perl/lib/$version, since 
5965 : /opt/perl/lib/perl5... would be redundant.
5966 : The default "style" setting is made in installstyle.U
5967 case "$installstyle" in
5968 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5969 *)       set dflt privlib lib/$version ;;
5970 esac
5971 eval $prefixit
5972 $cat <<EOM
5973
5974 There are some auxiliary files for $package that need to be put into a
5975 private library directory that is accessible by everyone.
5976
5977 EOM
5978 fn=d~+
5979 rp='Pathname where the private library files will reside?'
5980 . ./getfile
5981 privlib="$ans"
5982 privlibexp="$ansexp"
5983 : Change installation prefix, if necessary.
5984 if $test X"$prefix" != X"$installprefix"; then
5985         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5986 else
5987         installprivlib="$privlibexp"
5988 fi
5989
5990 : set the prefixup variable, to restore leading tilda escape
5991 prefixup='case "$prefixexp" in
5992 "$prefix") ;;
5993 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5994 esac'
5995
5996 : determine where public architecture dependent libraries go
5997 set archlib archlib
5998 eval $prefixit
5999 : privlib default is /usr/local/lib/$package/$version
6000 : archlib default is /usr/local/lib/$package/$version/$archname
6001 : privlib may have an optional trailing /share.
6002 tdflt=`echo $privlib | $sed 's,/share$,,'`
6003 tdflt=$tdflt/$archname
6004 case "$archlib" in
6005 '')     dflt=$tdflt
6006         ;;
6007 *)      dflt="$archlib"
6008     ;;
6009 esac
6010 $cat <<EOM
6011
6012 $spackage contains architecture-dependent library files.  If you are
6013 sharing libraries in a heterogeneous environment, you might store
6014 these files in a separate location.  Otherwise, you can just include
6015 them with the rest of the public library files.
6016
6017 EOM
6018 fn=d+~
6019 rp='Where do you want to put the public architecture-dependent libraries?'
6020 . ./getfile
6021 archlib="$ans"
6022 archlibexp="$ansexp"
6023 if $test X"$archlib" = X"$privlib"; then
6024         d_archlib="$undef"
6025 else
6026         d_archlib="$define"
6027 fi
6028 : Change installation prefix, if necessary.
6029 if $test X"$prefix" != X"$installprefix"; then
6030         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6031 else
6032         installarchlib="$archlibexp"
6033 fi
6034
6035 : see if setuid scripts can be secure
6036 $cat <<EOM
6037
6038 Some kernels have a bug that prevents setuid #! scripts from being
6039 secure.  Some sites have disabled setuid #! scripts because of this.
6040
6041 First let's decide if your kernel supports secure setuid #! scripts.
6042 (If setuid #! scripts would be secure but have been disabled anyway,
6043 don't say that they are secure if asked.)
6044
6045 EOM
6046
6047 val="$undef"
6048 if $test -d /dev/fd; then
6049         echo "#!$ls" >reflect
6050         chmod +x,u+s reflect
6051         ./reflect >flect 2>&1
6052         if $contains "/dev/fd" flect >/dev/null; then
6053                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6054                 val="$define"
6055         else
6056                 $cat <<EOM
6057 If you are not sure if they are secure, I can check but I'll need a
6058 username and password different from the one you are using right now.
6059 If you don't have such a username or don't want me to test, simply
6060 enter 'none'.
6061
6062 EOM
6063                 rp='Other username to test security of setuid scripts with?'
6064                 dflt='none'
6065                 . ./myread
6066                 case "$ans" in
6067                 n|none)
6068                         case "$d_suidsafe" in
6069                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6070                                 dflt=n;;
6071                         "$undef")
6072                                 echo "Well, the $hint value is *not* secure." >&4
6073                                 dflt=n;;
6074                         *)      echo "Well, the $hint value *is* secure." >&4
6075                                 dflt=y;;
6076                         esac
6077                         ;;
6078                 *)
6079                         $rm -f reflect flect
6080                         echo "#!$ls" >reflect
6081                         chmod +x,u+s reflect
6082                         echo >flect
6083                         chmod a+w flect
6084                         echo '"su" will (probably) prompt you for '"$ans's password."
6085                         su $ans -c './reflect >flect'
6086                         if $contains "/dev/fd" flect >/dev/null; then
6087                                 echo "Okay, it looks like setuid scripts are secure." >&4
6088                                 dflt=y
6089                         else
6090                                 echo "I don't think setuid scripts are secure." >&4
6091                                 dflt=n
6092                         fi
6093                         ;;
6094                 esac
6095                 rp='Does your kernel have *secure* setuid scripts?'
6096                 . ./myread
6097                 case "$ans" in
6098                 [yY]*)  val="$define";;
6099                 *)      val="$undef";;
6100                 esac
6101         fi
6102 else
6103         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6104         echo "(That's for file descriptors, not floppy disks.)"
6105         val="$undef"
6106 fi
6107 set d_suidsafe
6108 eval $setvar
6109
6110 $rm -f reflect flect
6111
6112 : now see if they want to do setuid emulation
6113 echo " "
6114 val="$undef"
6115 case "$d_suidsafe" in
6116 "$define")
6117         val="$undef"
6118         echo "No need to emulate SUID scripts since they are secure here." >&4
6119         ;;
6120 *)
6121         $cat <<EOM
6122 Some systems have disabled setuid scripts, especially systems where
6123 setuid scripts cannot be secure.  On systems where setuid scripts have
6124 been disabled, the setuid/setgid bits on scripts are currently
6125 useless.  It is possible for $package to detect those bits and emulate
6126 setuid/setgid in a secure fashion.  This emulation will only work if
6127 setuid scripts have been disabled in your kernel.
6128
6129 EOM
6130         case "$d_dosuid" in
6131         "$define") dflt=y ;;
6132         *) dflt=n ;;
6133         esac
6134         rp="Do you want to do setuid/setgid emulation?"
6135         . ./myread
6136         case "$ans" in
6137         [yY]*)  val="$define";;
6138         *)      val="$undef";;
6139         esac
6140         ;;
6141 esac
6142 set d_dosuid
6143 eval $setvar
6144
6145 : see if this is a malloc.h system
6146 : we want a real compile instead of Inhdr because some systems have a
6147 : malloc.h that just gives a compile error saying to use stdlib.h instead
6148 echo " "
6149 $cat >try.c <<EOCP
6150 #include <stdlib.h>
6151 #include <malloc.h>
6152 int main () { return 0; }
6153 EOCP
6154 set try
6155 if eval $compile; then
6156     echo "<malloc.h> found." >&4
6157     val="$define"
6158 else
6159     echo "<malloc.h> NOT found." >&4
6160     val="$undef"
6161 fi
6162 $rm -f try.c try
6163 set i_malloc
6164 eval $setvar
6165
6166 : check for void type
6167 echo " "
6168 echo "Checking to see how well your C compiler groks the void type..." >&4
6169 case "$voidflags" in
6170 '')
6171         $cat >try.c <<EOCP
6172 #$i_stdlib I_STDLIB
6173 #ifdef I_STDLIB
6174 #include <stdlib.h>
6175 #endif
6176 #if TRY & 1
6177 void sub() {
6178 #else
6179 sub() {
6180 #endif
6181         extern void moo();      /* function returning void */
6182         void (*goo)();          /* ptr to func returning void */
6183 #if TRY & 8
6184         void *hue;              /* generic ptr */
6185 #endif
6186 #if TRY & 2
6187         void (*foo[10])();
6188 #endif
6189
6190 #if TRY & 4
6191         if(goo == moo) {
6192                 exit(0);
6193         }
6194 #endif
6195         exit(0);
6196 }
6197 int main() { sub(); }
6198 EOCP
6199         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6200                 voidflags=$defvoidused
6201         echo "Good.  It appears to support void to the level $package wants.">&4
6202                 if $contains warning .out >/dev/null 2>&1; then
6203                         echo "However, you might get some warnings that look like this:"
6204                         $cat .out
6205                 fi
6206         else
6207 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6208                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6209                         echo "It supports 1..."
6210                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6211                                 echo "It also supports 2..."
6212                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6213                                         voidflags=7
6214                                         echo "And it supports 4 but not 8 definitely."
6215                                 else
6216                                         echo "It doesn't support 4..."
6217                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6218                                                 voidflags=11
6219                                                 echo "But it supports 8."
6220                                         else
6221                                                 voidflags=3
6222                                                 echo "Neither does it support 8."
6223                                         fi
6224                                 fi
6225                         else
6226                                 echo "It does not support 2..."
6227                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6228                                         voidflags=13
6229                                         echo "But it supports 4 and 8."
6230                                 else
6231                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6232                                                 voidflags=5
6233                                                 echo "And it supports 4 but has not heard about 8."
6234                                         else
6235                                                 echo "However it supports 8 but not 4."
6236                                         fi
6237                                 fi
6238                         fi
6239                 else
6240                         echo "There is no support at all for void."
6241                         voidflags=0
6242                 fi
6243         fi
6244 esac
6245 case "$voidflags" in
6246 "$defvoidused") ;;
6247 *)      $cat >&4 <<'EOM'
6248   Support flag bits are:
6249     1: basic void declarations.
6250     2: arrays of pointers to functions returning void.
6251     4: operations between pointers to and addresses of void functions.
6252     8: generic void pointers.
6253 EOM
6254         dflt="$voidflags";
6255         rp="Your void support flags add up to what?"
6256         . ./myread
6257         voidflags="$ans"
6258         ;;
6259 esac
6260 $rm -f try.* .out
6261
6262 : check for length of pointer
6263 echo " "
6264 case "$ptrsize" in
6265 '')
6266         echo "Checking to see how big your pointers are..." >&4
6267         if test "$voidflags" -gt 7; then
6268                 echo '#define VOID_PTR char *' > try.c
6269         else
6270                 echo '#define VOID_PTR void *' > try.c
6271         fi
6272         $cat >>try.c <<EOCP
6273 #include <stdio.h>
6274 #$i_stdlib I_STDLIB
6275 #ifdef I_STDLIB
6276 #include <stdlib.h>
6277 #endif
6278 int main()
6279 {
6280     printf("%d\n", (int)sizeof(VOID_PTR));
6281     exit(0);
6282 }
6283 EOCP
6284         set try
6285         if eval $compile_ok; then
6286                 ptrsize=`$run ./try`
6287                 echo "Your pointers are $ptrsize bytes long."
6288         else
6289                 dflt='4'
6290                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6291                 rp="What is the size of a pointer (in bytes)?"
6292                 . ./myread
6293                 ptrsize="$ans"
6294         fi
6295         ;;
6296 esac
6297 $rm -f try.c try
6298 case "$use64bitall" in
6299 "$define"|true|[yY]*)
6300         case "$ptrsize" in
6301         4)      cat <<EOM >&4
6302
6303 *** You have chosen a maximally 64-bit build,
6304 *** but your pointers are only 4 bytes wide.
6305 *** Please rerun Configure without -Duse64bitall.
6306 EOM
6307                 case "$d_quad" in
6308                 define)
6309                         cat <<EOM >&4
6310 *** Since you have quads, you could possibly try with -Duse64bitint.
6311 EOM
6312                         ;;
6313                 esac
6314                 cat <<EOM >&4
6315 *** Cannot continue, aborting.
6316
6317 EOM
6318
6319                 exit 1
6320                 ;;
6321         esac
6322         ;;
6323 esac
6324
6325
6326 : determine whether to use malloc wrapping
6327 echo " "
6328 case "$usemallocwrap" in
6329 [yY]*|true|$define)     dflt='y' ;;
6330 [nN]*|false|$undef)     dflt='n' ;;
6331 *)      case "$usedevel" in
6332         [yY]*|true|$define)     dflt='y' ;;
6333         *) dflt='n' ;;
6334         esac
6335         ;;
6336 esac
6337 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6338 . ./myread
6339 usemallocwrap="$ans"
6340 case "$ans" in
6341 y*|true)
6342         usemallocwrap="$define" ;;
6343 *)
6344         usemallocwrap="$undef" ;;
6345 esac
6346
6347 : determine which malloc to compile in
6348 echo " "
6349 case "$usemymalloc" in
6350 [yY]*|true|$define)     dflt='y' ;;
6351 [nN]*|false|$undef)     dflt='n' ;;
6352 *)      case "$ptrsize" in
6353         4) dflt='y' ;;
6354         *) dflt='n' ;;
6355         esac
6356         ;;
6357 esac
6358 rp="Do you wish to attempt to use the malloc that comes with $package?"
6359 . ./myread
6360 usemymalloc="$ans"
6361 case "$ans" in
6362 y*|true)
6363         usemymalloc='y'
6364         mallocsrc='malloc.c'
6365         mallocobj="malloc$_o"
6366         d_mymalloc="$define"
6367         case "$libs" in
6368         *-lmalloc*)
6369                 : Remove malloc from list of libraries to use
6370                 echo "Removing unneeded -lmalloc from library list" >&4
6371                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6372                 shift
6373                 libs="$*"
6374                 echo "libs = $libs" >&4
6375                 ;;
6376         esac
6377         ;;
6378 *)
6379         usemymalloc='n'
6380         mallocsrc=''
6381         mallocobj=''
6382         d_mymalloc="$undef"
6383         ;;
6384 esac
6385
6386 : compute the return types of malloc and free
6387 echo " "
6388 $cat >malloc.c <<END
6389 #$i_malloc I_MALLOC
6390 #$i_stdlib I_STDLIB
6391 #include <stdio.h>
6392 #include <sys/types.h>
6393 #ifdef I_MALLOC
6394 #include <malloc.h>
6395 #endif
6396 #ifdef I_STDLIB
6397 #include <stdlib.h>
6398 #endif
6399 #ifdef TRY_MALLOC
6400 void *malloc();
6401 #endif
6402 #ifdef TRY_FREE
6403 void free();
6404 #endif
6405 END
6406 case "$malloctype" in
6407 '')
6408         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6409                 malloctype='void *'
6410         else
6411                 malloctype='char *'
6412         fi
6413         ;;
6414 esac
6415 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6416
6417 case "$freetype" in
6418 '')
6419         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6420                 freetype='void'
6421         else
6422                 freetype='int'
6423         fi
6424         ;;
6425 esac
6426 echo "Your system uses $freetype free(), it would seem." >&4
6427 $rm -f malloc.[co]
6428 $cat <<EOM
6429
6430 After $package is installed, you may wish to install various
6431 add-on modules and utilities.  Typically, these add-ons will
6432 be installed under $prefix with the rest
6433 of this package.  However, you may wish to install such add-ons
6434 elsewhere under a different prefix.
6435
6436 If you do not wish to put everything under a single prefix, that's
6437 ok.  You will be prompted for the individual locations; this siteprefix
6438 is only used to suggest the defaults.
6439
6440 The default should be fine for most people.
6441
6442 EOM
6443 fn=d~+
6444 rp='Installation prefix to use for add-on modules and utilities?'
6445 : XXX Here might be another good place for an installstyle setting.
6446 case "$siteprefix" in
6447 '') dflt=$prefix ;;
6448 *)  dflt=$siteprefix ;;
6449 esac
6450 . ./getfile
6451 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6452 oldsiteprefix=''
6453 case "$siteprefix" in
6454 '') ;;
6455 *)      case "$ans" in
6456         "$prefix") ;;
6457         *) oldsiteprefix="$prefix";;
6458         esac
6459         ;;
6460 esac
6461 siteprefix="$ans"
6462 siteprefixexp="$ansexp"
6463
6464 : determine where site specific libraries go.
6465 : Usual default is /usr/local/lib/perl5/site_perl/$version
6466 : The default "style" setting is made in installstyle.U
6467 : XXX No longer works with Prefixit stuff.
6468 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6469 case "$sitelib" in
6470 '') case "$installstyle" in
6471         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6472         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6473         esac
6474         ;;
6475 *)      dflt="$sitelib"
6476         ;;
6477 esac
6478 $cat <<EOM
6479
6480 The installation process will create a directory for
6481 site-specific extensions and modules.  Most users find it convenient
6482 to place all site-specific files in this directory rather than in the
6483 main distribution directory.
6484
6485 EOM
6486 fn=d~+
6487 rp='Pathname for the site-specific library files?'
6488 . ./getfile
6489 sitelib="$ans"
6490 sitelibexp="$ansexp"
6491 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6492 : Change installation prefix, if necessary.
6493 if $test X"$prefix" != X"$installprefix"; then
6494         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6495 else
6496         installsitelib="$sitelibexp"
6497 fi
6498
6499 : determine where site specific architecture-dependent libraries go.
6500 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6501 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6502 : sitelib may have an optional trailing /share.
6503 case "$sitearch" in
6504 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6505         dflt="$dflt/$archname"
6506         ;;
6507 *)      dflt="$sitearch"
6508         ;;
6509 esac
6510 set sitearch sitearch none
6511 eval $prefixit
6512 $cat <<EOM
6513
6514 The installation process will also create a directory for
6515 architecture-dependent site-specific extensions and modules.
6516
6517 EOM
6518 fn=d~+
6519 rp='Pathname for the site-specific architecture-dependent library files?'
6520 . ./getfile
6521 sitearch="$ans"
6522 sitearchexp="$ansexp"
6523 : Change installation prefix, if necessary.
6524 if $test X"$prefix" != X"$installprefix"; then
6525         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6526 else
6527         installsitearch="$sitearchexp"
6528 fi
6529
6530 $cat <<EOM
6531
6532 The installation process will also create a directory for
6533 vendor-supplied add-ons.  Vendors who supply perl with their system
6534 may find it convenient to place all vendor-supplied files in this
6535 directory rather than in the main distribution directory.  This will
6536 ease upgrades between binary-compatible maintenance versions of perl.
6537
6538 Of course you may also use these directories in whatever way you see
6539 fit.  For example, you might use them to access modules shared over a
6540 company-wide network.
6541
6542 The default answer should be fine for most people.
6543 This causes further questions about vendor add-ons to be skipped
6544 and no vendor-specific directories will be configured for perl.
6545
6546 EOM
6547 rp='Do you want to configure vendor-specific add-on directories?'
6548 case "$usevendorprefix" in
6549 define|true|[yY]*) dflt=y ;;
6550 *)      : User may have set vendorprefix directly on Configure command line.
6551         case "$vendorprefix" in
6552         ''|' ') dflt=n ;;
6553         *)      dflt=y ;;
6554         esac
6555         ;;
6556 esac
6557 . ./myread
6558 case "$ans" in
6559 [yY]*)  fn=d~+
6560         rp='Installation prefix to use for vendor-supplied add-ons?'
6561         case "$vendorprefix" in
6562         '') dflt='' ;;
6563         *)  dflt=$vendorprefix ;;
6564         esac
6565         . ./getfile
6566         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6567         oldvendorprefix=''
6568         case "$vendorprefix" in
6569         '') ;;
6570         *)      case "$ans" in
6571                 "$prefix") ;;
6572                 *) oldvendorprefix="$prefix";;
6573                 esac
6574                 ;;
6575         esac
6576         usevendorprefix="$define"
6577         vendorprefix="$ans"
6578         vendorprefixexp="$ansexp"
6579         ;;
6580 *)      usevendorprefix="$undef"
6581         vendorprefix=''
6582         vendorprefixexp=''
6583         ;;
6584 esac
6585
6586 case "$vendorprefix" in
6587 '')     d_vendorlib="$undef"
6588         vendorlib=''
6589         vendorlibexp=''
6590         ;;
6591 *)      d_vendorlib="$define"
6592         : determine where vendor-supplied modules go.
6593         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6594         case "$vendorlib" in
6595         '')
6596                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6597                 case "$installstyle" in
6598                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6599                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6600                 esac
6601                 ;;
6602         *)      dflt="$vendorlib"
6603                 ;;
6604         esac
6605         fn=d~+
6606         rp='Pathname for the vendor-supplied library files?'
6607         . ./getfile
6608         vendorlib="$ans"
6609         vendorlibexp="$ansexp"
6610         ;;
6611 esac
6612 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6613 : Change installation prefix, if necessary.
6614 if $test X"$prefix" != X"$installprefix"; then
6615         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6616 else
6617         installvendorlib="$vendorlibexp"
6618 fi
6619
6620 case "$vendorprefix" in
6621 '')     d_vendorarch="$undef"
6622         vendorarch=''
6623         vendorarchexp=''
6624         ;;
6625 *)      d_vendorarch="$define"
6626         : determine where vendor-supplied architecture-dependent libraries go.
6627         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6628         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6629         : vendorlib may have an optional trailing /share.
6630         case "$vendorarch" in
6631         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6632                 dflt="$dflt/$archname"
6633                 ;;
6634         *)      dflt="$vendorarch" ;;
6635         esac
6636         fn=d~+
6637         rp='Pathname for vendor-supplied architecture-dependent files?'
6638         . ./getfile
6639         vendorarch="$ans"
6640         vendorarchexp="$ansexp"
6641         ;;
6642 esac
6643 : Change installation prefix, if necessary.
6644 if $test X"$prefix" != X"$installprefix"; then
6645         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6646 else
6647         installvendorarch="$vendorarchexp"
6648 fi
6649
6650 : Final catch-all directories to search
6651 $cat <<EOM
6652
6653 Lastly, you can have perl look in other directories for extensions and
6654 modules in addition to those already specified.
6655 These directories will be searched after 
6656         $sitearch 
6657         $sitelib 
6658 EOM
6659 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6660 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6661 echo ' '
6662 case "$otherlibdirs" in
6663 ''|' ') dflt='none' ;;
6664 *)      dflt="$otherlibdirs" ;;
6665 esac
6666 $cat <<EOM
6667 Enter a colon-separated set of extra paths to include in perl's @INC
6668 search path, or enter 'none' for no extra paths.
6669
6670 EOM
6671
6672 rp='Colon-separated list of additional directories for perl to search?'
6673 . ./myread
6674 case "$ans" in
6675 ' '|''|none)    otherlibdirs=' ' ;;     
6676 *)      otherlibdirs="$ans" ;;
6677 esac
6678 case "$otherlibdirs" in
6679 ' ') val=$undef ;;
6680 *)      val=$define ;;
6681 esac
6682 set d_perl_otherlibdirs
6683 eval $setvar
6684
6685 : Cruising for prototypes
6686 echo " "
6687 echo "Checking out function prototypes..." >&4
6688 $cat >prototype.c <<EOCP
6689 #$i_stdlib I_STDLIB
6690 #ifdef I_STDLIB
6691 #include <stdlib.h>
6692 #endif
6693 int main(int argc, char *argv[]) {
6694         exit(0);}
6695 EOCP
6696 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6697         echo "Your C compiler appears to support function prototypes."
6698         val="$define"
6699 else
6700         echo "Your C compiler doesn't seem to understand function prototypes."
6701         val="$undef"
6702 fi
6703 set prototype
6704 eval $setvar
6705 $rm -f prototype*
6706
6707 case "$prototype" in
6708 "$define") ;;
6709 *)      ansi2knr='ansi2knr'
6710         echo " "
6711         cat <<EOM >&4
6712
6713 $me:  FATAL ERROR:
6714 This version of $package can only be compiled by a compiler that 
6715 understands function prototypes.  Unfortunately, your C compiler 
6716         $cc $ccflags
6717 doesn't seem to understand them.  Sorry about that.
6718
6719 If GNU cc is available for your system, perhaps you could try that instead.  
6720
6721 Eventually, we hope to support building Perl with pre-ANSI compilers.
6722 If you would like to help in that effort, please contact <perlbug@perl.org>.
6723
6724 Aborting Configure now.
6725 EOM
6726         exit 2
6727         ;;
6728 esac
6729
6730 : determine where public executables go
6731 echo " "
6732 set dflt bin bin
6733 eval $prefixit
6734 fn=d~
6735 rp='Pathname where the public executables will reside?'
6736 . ./getfile
6737 if $test "X$ansexp" != "X$binexp"; then
6738         installbin=''
6739 fi
6740 bin="$ans"
6741 binexp="$ansexp"
6742 : Change installation prefix, if necessary.
6743 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6744 if $test X"$prefix" != X"$installprefix"; then
6745         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6746 else
6747         installbin="$binexp"
6748 fi
6749
6750 echo " "
6751 case "$extras" in
6752 '') dflt='n';;
6753 *) dflt='y';;
6754 esac
6755 cat <<EOM
6756 Perl can be built with extra modules or bundles of modules which
6757 will be fetched from the CPAN and installed alongside Perl.
6758
6759 Notice that you will need access to the CPAN; either via the Internet,
6760 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6761 be asked later to configure the CPAN.pm module which will in turn do
6762 the installation of the rest of the extra modules or bundles.)
6763
6764 Notice also that if the modules require any external software such as
6765 libraries and headers (the libz library and the zlib.h header for the
6766 Compress::Zlib module, for example) you MUST have any such software
6767 already installed, this configuration process will NOT install such
6768 things for you.
6769
6770 If this doesn't make any sense to you, just accept the default '$dflt'.
6771 EOM
6772 rp='Install any extra modules (y or n)?'
6773 . ./myread
6774 case "$ans" in
6775 y|Y)
6776         cat <<EOM
6777
6778 Please list any extra modules or bundles to be installed from CPAN,
6779 with spaces between the names.  The names can be in any format the
6780 'install' command of CPAN.pm will understand.  (Answer 'none',
6781 without the quotes, to install no extra modules or bundles.)
6782 EOM
6783         rp='Extras?'
6784         dflt="$extras"
6785         . ./myread
6786         extras="$ans"
6787 esac
6788 case "$extras" in
6789 ''|'none')
6790         val=''
6791         $rm -f ../extras.lst
6792         ;;
6793 *)      echo "(Saving the list of extras for later...)"
6794         echo "$extras" > ../extras.lst
6795         val="'$extras'"
6796         ;;
6797 esac
6798 set extras
6799 eval $setvar
6800 echo " "
6801
6802 : determine where html pages for programs go
6803 set html1dir html1dir none
6804 eval $prefixit
6805 $cat <<EOM
6806
6807 If you wish to install html files for programs in $spackage, indicate 
6808 the appropriate directory here.  To skip installing html files,
6809 answer "none".
6810 EOM
6811 case "$html1dir" in
6812 ''|none|$undef|' ') dflt=none ;;
6813 *) dflt=$html1dir ;;
6814 esac
6815 fn=dn+~
6816 rp="Directory for the main $spackage html pages?"
6817 . ./getfile
6818 html1dir="$ans"
6819 html1direxp="$ansexp"
6820 : Use ' ' for none so value is preserved next time through Configure
6821 $test X"$html1dir" = "X" && html1dir=' '
6822 : Change installation prefix, if necessary.
6823 if $test X"$prefix" != X"$installprefix"; then
6824         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6825 else
6826         installhtml1dir="$html1direxp"
6827 fi
6828
6829 : determine where html pages for libraries and modules go
6830 set html3dir html3dir none
6831 eval $prefixit
6832 $cat <<EOM
6833
6834 If you wish to install html files for modules associated with $spackage,
6835 indicate the appropriate directory here.  To skip installing html files,
6836 answer "none".
6837 EOM
6838 : There is no obvious default.  If they have specified html1dir, then
6839 : try to key off that, possibly changing .../html1 into .../html3.
6840 case "$html3dir" in
6841 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6842 *) dflt=$html3dir ;;
6843 esac
6844 fn=dn+~
6845 rp="Directory for the $spackage module html pages?"
6846 . ./getfile
6847 html3dir="$ans"
6848 html3direxp="$ansexp"
6849 : Use ' ' for none so value is preserved next time through Configure
6850 $test X"$html3dir" = "X" && html3dir=' '
6851 : Change installation prefix, if necessary.
6852 if $test X"$prefix" != X"$installprefix"; then
6853         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6854 else
6855         installhtml3dir="$html3direxp"
6856 fi
6857
6858 : Find perl5.005 or later.
6859 echo "Looking for a previously installed perl5.005 or later... "
6860 case "$perl5" in
6861 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6862                 : Check if this perl is recent and can load a simple module
6863                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6864                         perl5=$tdir/perl
6865                         break;
6866                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6867                         perl5=$tdir/perl5
6868                         break;
6869                 fi
6870         done
6871         ;;
6872 *)      perl5="$perl5"
6873         ;;
6874 esac
6875 case "$perl5" in
6876 '')     echo "None found.  That's ok.";;
6877 *)      echo "Using $perl5." ;;
6878 esac
6879
6880 : Determine list of previous versions to include in @INC
6881 $cat > getverlist <<EOPL
6882 #!$perl5 -w
6883 use File::Basename;
6884 \$api_versionstring = "$api_versionstring";
6885 \$version = "$version";
6886 \$stem = "$sitelib_stem";
6887 \$archname = "$archname";
6888 EOPL
6889         $cat >> getverlist <<'EOPL'
6890 # Can't have leading @ because metaconfig interprets it as a command!
6891 ;@inc_version_list=();
6892 # XXX Redo to do opendir/readdir? 
6893 if (-d $stem) {
6894     chdir($stem);
6895     ;@candidates = glob("5.*");
6896 }
6897 else {
6898     ;@candidates = ();
6899 }
6900
6901 # XXX ToDo:  These comparisons must be reworked when two-digit
6902 # subversions come along, so that 5.7.10 compares as greater than
6903 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6904 # widespread that we can use the built-in version vectors rather
6905 # than reinventing them here.  For 5.6.0, however, we must
6906 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6907 foreach $d (@candidates) {
6908     if ($d lt $version) {
6909         if ($d ge $api_versionstring) {
6910             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6911         }
6912         elsif ($d ge "5.005") {
6913             unshift(@inc_version_list, grep { -d } $d);
6914         }
6915     }
6916     else {
6917         # Skip newer version.  I.e. don't look in
6918         # 5.7.0 if we're installing 5.6.1.
6919     }
6920 }
6921
6922 if (@inc_version_list) {
6923     print join(' ', @inc_version_list);
6924 }
6925 else {
6926     # Blank space to preserve value for next Configure run.
6927     print " ";
6928 }
6929 EOPL
6930 chmod +x getverlist
6931 case "$inc_version_list" in
6932 '')     if test -x "$perl5$exe_ext"; then
6933                 dflt=`$perl5 getverlist`
6934         else
6935                 dflt='none'
6936         fi
6937         ;;
6938 $undef) dflt='none' ;;
6939 *)  eval dflt=\"$inc_version_list\" ;;
6940 esac
6941 case "$dflt" in
6942 ''|' ') dflt=none ;;
6943 esac
6944 case "$dflt" in
6945 5.005) dflt=none ;;
6946 esac
6947 $cat <<EOM
6948
6949 In order to ease the process of upgrading, this version of perl 
6950 can be configured to use modules built and installed with earlier 
6951 versions of perl that were installed under $prefix.  Specify here
6952 the list of earlier versions that this version of perl should check.
6953 If Configure detected no earlier versions of perl installed under
6954 $prefix, then the list will be empty.  Answer 'none' to tell perl
6955 to not search earlier versions.
6956
6957 The default should almost always be sensible, so if you're not sure,
6958 just accept the default.
6959 EOM
6960
6961 rp='List of earlier versions to include in @INC?'
6962 . ./myread
6963 case "$ans" in
6964 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6965 *) inc_version_list="$ans" ;;
6966 esac
6967 case "$inc_version_list" in
6968 ''|' ') 
6969         inc_version_list_init='0';;
6970 *)      inc_version_list_init=`echo $inc_version_list |
6971                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6972         ;;
6973 esac
6974 $rm -f getverlist
6975
6976 : determine whether to install perl also as /usr/bin/perl
6977
6978 echo " "
6979 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6980         $cat <<EOM
6981 Many scripts expect perl to be installed as /usr/bin/perl.
6982
6983 If you want to, I can install the perl you are about to compile
6984 as /usr/bin/perl (in addition to $bin/perl).
6985 EOM
6986         if test -f /usr/bin/perl; then
6987             $cat <<EOM
6988
6989 However, please note that because you already have a /usr/bin/perl,
6990 overwriting that with a new Perl would very probably cause problems.
6991 Therefore I'm assuming you don't want to do that (unless you insist).
6992
6993 EOM
6994             case "$installusrbinperl" in
6995             "$define"|[yY]*)    dflt='y';;
6996             *)                  dflt='n';;
6997             esac
6998         else
6999             $cat <<EOM
7000
7001 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7002
7003 EOM
7004             case "$installusrbinperl" in
7005             "$undef"|[nN]*)     dflt='n';;
7006             *)                  dflt='y';;
7007             esac
7008         fi
7009         rp="Do you want to install perl as /usr/bin/perl?"
7010         . ./myread
7011         case "$ans" in
7012         [yY]*)  val="$define";;
7013         *)      val="$undef" ;;
7014         esac
7015 else
7016         val="$undef"
7017 fi
7018 set installusrbinperl
7019 eval $setvar
7020
7021 echo " "
7022 echo "Checking for GNU C Library..." >&4
7023 cat >try.c <<'EOCP'
7024 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7025    alone are insufficient to distinguish different versions, such as
7026    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7027    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7028 */
7029 #include <stdio.h>
7030 int main(void)
7031 {
7032 #ifdef __GLIBC__
7033 #   ifdef __GLIBC_MINOR__
7034 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7035 #           include <gnu/libc-version.h>
7036             printf("%s\n",  gnu_get_libc_version());
7037 #       else
7038             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7039 #       endif
7040 #   else
7041         printf("%d\n",  __GLIBC__);
7042 #   endif
7043     return 0;
7044 #else
7045     return 1;
7046 #endif
7047 }
7048 EOCP
7049 set try
7050 if eval $compile_ok && $run ./try > glibc.ver; then
7051         val="$define"
7052         gnulibc_version=`$cat glibc.ver`
7053         echo "You are using the GNU C Library version $gnulibc_version"
7054 else
7055         val="$undef"
7056         gnulibc_version=''
7057         echo "You are not using the GNU C Library"
7058 fi
7059 $rm -f try try.* glibc.ver
7060 set d_gnulibc
7061 eval $setvar
7062
7063 : see if nm is to be used to determine whether a symbol is defined or not
7064 case "$usenm" in
7065 '')
7066         dflt=''
7067         case "$d_gnulibc" in
7068         "$define")
7069                 echo " "
7070                 echo "nm probably won't work on the GNU C Library." >&4
7071                 dflt=n
7072                 ;;
7073         esac
7074         case "$dflt" in
7075         '') 
7076                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7077                         echo " "
7078                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7079                         echo "'nm' won't be sufficient on this sytem." >&4
7080                         dflt=n
7081                 fi
7082                 ;;
7083         esac
7084         case "$dflt" in
7085         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7086                 if $test $dflt -gt 20; then
7087                         dflt=y
7088                 else
7089                         dflt=n
7090                 fi
7091                 ;;
7092         esac
7093         ;;
7094 *)
7095         case "$usenm" in
7096         true|$define) dflt=y;;
7097         *) dflt=n;;
7098         esac
7099         ;;
7100 esac
7101 $cat <<EOM
7102
7103 I can use $nm to extract the symbols from your C libraries. This
7104 is a time consuming task which may generate huge output on the disk (up
7105 to 3 megabytes) but that should make the symbols extraction faster. The
7106 alternative is to skip the 'nm' extraction part and to compile a small
7107 test program instead to determine whether each symbol is present. If
7108 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7109 this may be the best solution.
7110
7111 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7112
7113 EOM
7114 rp="Shall I use $nm to extract C symbols from the libraries?"
7115 . ./myread
7116 case "$ans" in
7117 [Nn]*) usenm=false;;
7118 *) usenm=true;;
7119 esac
7120
7121 runnm=$usenm
7122 case "$reuseval" in
7123 true) runnm=false;;
7124 esac
7125
7126 : nm options which may be necessary
7127 case "$nm_opt" in
7128 '') if $test -f /mach_boot; then
7129                 nm_opt=''       # Mach
7130         elif $test -d /usr/ccs/lib; then
7131                 nm_opt='-p'     # Solaris (and SunOS?)
7132         elif $test -f /dgux; then
7133                 nm_opt='-p'     # DG-UX
7134         elif $test -f /lib64/rld; then
7135                 nm_opt='-p'     # 64-bit Irix
7136         else
7137                 nm_opt=''
7138         fi;;
7139 esac
7140
7141 : nm options which may be necessary for shared libraries but illegal
7142 : for archive libraries.  Thank you, Linux.
7143 case "$nm_so_opt" in
7144 '')     case "$myuname" in
7145         *linux*|gnu*)
7146                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7147                         nm_so_opt='--dynamic'
7148                 fi
7149                 ;;
7150         esac
7151         ;;
7152 esac
7153
7154 case "$runnm" in
7155 true)
7156 : get list of predefined functions in a handy place
7157 echo " "
7158 case "$libc" in
7159 '') libc=unknown
7160         case "$libs" in
7161         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7162         esac
7163         ;;
7164 esac
7165 case "$libs" in
7166 '') ;;
7167 *)  for thislib in $libs; do
7168         case "$thislib" in
7169         -lc|-lc_s)
7170                 : Handle C library specially below.
7171                 ;;
7172         -l*)
7173                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7174                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7175                         :
7176                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7177                         :
7178                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7179                         :
7180                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7181                         :
7182                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7183                         :
7184                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7185                         :
7186                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7187                         :
7188                 else
7189                         try=''
7190                 fi
7191                 libnames="$libnames $try"
7192                 ;;
7193         *) libnames="$libnames $thislib" ;;
7194         esac
7195         done
7196         ;;
7197 esac
7198 xxx=normal
7199 case "$libc" in
7200 unknown)
7201         set /lib/libc.$so
7202         for xxx in $libpth; do
7203                 $test -r $1 || set $xxx/libc.$so
7204                 : The messy sed command sorts on library version numbers.
7205                 $test -r $1 || \
7206                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7207                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7208                                 h
7209                                 s/[0-9][0-9]*/0000&/g
7210                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7211                                 G
7212                                 s/\n/ /' | \
7213                          $sort | $sed -e 's/^.* //'`
7214                 eval set \$$#
7215         done
7216         $test -r $1 || set /usr/ccs/lib/libc.$so
7217         $test -r $1 || set /lib/libsys_s$_a
7218         ;;
7219 *)
7220         set blurfl
7221         ;;
7222 esac
7223 if $test -r "$1"; then
7224         echo "Your (shared) C library seems to be in $1."
7225         libc="$1"
7226 elif $test -r /lib/libc && $test -r /lib/clib; then
7227         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7228         xxx=apollo
7229         libc='/lib/clib /lib/libc'
7230         if $test -r /lib/syslib; then
7231                 echo "(Your math library is in /lib/syslib.)"
7232                 libc="$libc /lib/syslib"
7233         fi
7234 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7235         echo "Your C library seems to be in $libc, as you said before."
7236 elif $test -r $incpath/usr/lib/libc$_a; then
7237         libc=$incpath/usr/lib/libc$_a;
7238         echo "Your C library seems to be in $libc.  That's fine."
7239 elif $test -r /lib/libc$_a; then
7240         libc=/lib/libc$_a;
7241         echo "Your C library seems to be in $libc.  You're normal."
7242 else
7243         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7244                 :
7245         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7246                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7247         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7248                 :
7249         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7250                 :
7251         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7252                 :
7253         else
7254                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7255         fi
7256         if $test -r "$tans"; then
7257                 echo "Your C library seems to be in $tans, of all places."
7258                 libc=$tans
7259         else
7260                 libc='blurfl'
7261         fi
7262 fi
7263 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7264         dflt="$libc"
7265         cat <<EOM
7266
7267 If the guess above is wrong (which it might be if you're using a strange
7268 compiler, or your machine supports multiple models), you can override it here.
7269
7270 EOM
7271 else
7272         dflt=''
7273         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7274         cat >&4 <<EOM
7275 I can't seem to find your C library.  I've looked in the following places:
7276
7277 EOM
7278         $sed 's/^/      /' libpath
7279         cat <<EOM
7280
7281 None of these seems to contain your C library. I need to get its name...
7282
7283 EOM
7284 fi
7285 fn=f
7286 rp='Where is your C library?'
7287 . ./getfile
7288 libc="$ans"
7289
7290 echo " "
7291 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7292 set X `cat libnames`
7293 shift
7294 xxx=files
7295 case $# in 1) xxx=file; esac
7296 echo "Extracting names from the following $xxx for later perusal:" >&4
7297 echo " "
7298 $sed 's/^/      /' libnames >&4
7299 echo " "
7300 $echo $n "This may take a while...$c" >&4
7301
7302 for file in $*; do
7303         case $file in
7304         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7305         *) $nm $nm_opt $file 2>/dev/null;;
7306         esac
7307 done >libc.tmp
7308
7309 $echo $n ".$c"
7310 $grep fprintf libc.tmp > libc.ptf
7311 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7312 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7313 xxx='[ADTSIW]'
7314 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7315         eval $xscan;\
7316         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7317                 eval $xrun
7318 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7319         eval $xscan;\
7320         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7321                 eval $xrun
7322 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7323         eval $xscan;\
7324         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7325                 eval $xrun
7326 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7327         eval $xscan;\
7328         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7329                 eval $xrun
7330 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7331         eval $xscan;\
7332         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7333                 eval $xrun
7334 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7335         eval $xscan;\
7336         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7337                 eval $xrun
7338 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7339                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7348         eval $xscan;\
7349         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7350                 eval $xrun
7351 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7352         eval $xscan;\
7353         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7354                 eval $xrun
7355 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7356         eval $xscan;\
7357         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7358                 eval $xrun
7359 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7360         eval $xscan;\
7361         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7362                 eval $xrun
7363 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7364         eval $xscan;\
7365         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7366                 eval $xrun
7367 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7368         eval $xscan;\
7369         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7370                 eval $xrun
7371 else
7372         $nm -p $* 2>/dev/null >libc.tmp
7373         $grep fprintf libc.tmp > libc.ptf
7374         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7375                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7376         then
7377                 nm_opt='-p'
7378                 eval $xrun
7379         else
7380                 echo " "
7381                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7382                 com=''
7383                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7384                         for thisname in $libnames $libc; do
7385                                 $ar t $thisname >>libc.tmp
7386                         done
7387                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7388                         echo "Ok." >&4
7389                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7390                         # Repeat libc to extract forwarders to DLL entries too
7391                         for thisname in $libnames $libc; do
7392                                 $ar tv $thisname >>libc.tmp
7393                                 # Revision 50 of EMX has bug in $ar.
7394                                 # it will not extract forwarders to DLL entries
7395                                 # Use emximp which will extract exactly them.
7396                                 emximp -o tmp.imp $thisname \
7397                                     2>/dev/null && \
7398                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7399                                     < tmp.imp >>libc.tmp
7400                                 $rm tmp.imp
7401                         done
7402                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7403                         echo "Ok." >&4
7404                 else
7405                         echo "$ar didn't seem to work right." >&4
7406                         echo "Maybe this is a Cray...trying bld instead..." >&4
7407                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7408                         then
7409                                 for thisname in $libnames; do
7410                                         bld t $libnames | \
7411                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7412                                         $ar t $thisname >>libc.tmp
7413                                 done
7414                                 echo "Ok." >&4
7415                         else
7416                                 echo "That didn't work either.  Giving up." >&4
7417                                 exit 1
7418                         fi
7419                 fi
7420         fi
7421 fi
7422 nm_extract="$com"
7423 case "$PASE" in
7424 define)
7425     echo " "
7426     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7427     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7428     ;;
7429 *)  if $test -f /lib/syscalls.exp; then
7430         echo " "
7431         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7432         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7433     fi
7434     ;;
7435 esac
7436 ;;
7437 esac
7438 $rm -f libnames libpath
7439
7440 : see if dld is available
7441 set dld.h i_dld
7442 eval $inhdr
7443
7444 : is a C symbol defined?
7445 csym='tlook=$1;
7446 case "$3" in
7447 -v) tf=libc.tmp; tdc="";;
7448 -a) tf=libc.tmp; tdc="[]";;
7449 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7450 esac;
7451 tx=yes;
7452 case "$reuseval-$4" in
7453 true-) ;;
7454 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7455 esac;
7456 case "$tx" in
7457 yes)
7458         tval=false;
7459         if $test "$runnm" = true; then
7460                 if $contains $tlook $tf >/dev/null 2>&1; then
7461                         tval=true;
7462                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7463                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7464                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7465                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7466                         $rm -f try$_exe try.c core core.* try.core;
7467                 fi;
7468         else
7469                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7470                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7471                 $rm -f try$_exe try.c;
7472         fi;
7473         ;;
7474 *)
7475         case "$tval" in
7476         $define) tval=true;;
7477         *) tval=false;;
7478         esac;
7479         ;;
7480 esac;
7481 eval "$2=$tval"'
7482
7483 : define an is-in-libc? function
7484 inlibc='echo " "; td=$define; tu=$undef;
7485 sym=$1; var=$2; eval "was=\$$2";
7486 tx=yes;
7487 case "$reuseval$was" in
7488 true) ;;
7489 true*) tx=no;;
7490 esac;
7491 case "$tx" in
7492 yes)
7493         set $sym tres -f;
7494         eval $csym;
7495         case "$tres" in
7496         true)
7497                 echo "$sym() found." >&4;
7498                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7499         *)
7500                 echo "$sym() NOT found." >&4;
7501                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7502         esac;;
7503 *)
7504         case "$was" in
7505         $define) echo "$sym() found." >&4;;
7506         *) echo "$sym() NOT found." >&4;;
7507         esac;;
7508 esac'
7509
7510 : see if dlopen exists
7511 xxx_runnm="$runnm"
7512 runnm=false
7513 set dlopen d_dlopen
7514 eval $inlibc
7515 runnm="$xxx_runnm"
7516
7517 : determine which dynamic loading, if any, to compile in
7518 echo " "
7519 dldir="ext/DynaLoader"
7520 case "$usedl" in
7521 $define|y|true)
7522         dflt='y'
7523         usedl="$define"
7524         ;;
7525 $undef|n|false)
7526         dflt='n'
7527         usedl="$undef"
7528         ;;
7529 *) 
7530         dflt='n'
7531         case "$d_dlopen" in
7532             $define) dflt='y' ;;
7533         esac
7534         case "$i_dld" in
7535             $define) dflt='y' ;;
7536         esac
7537         : Does a dl_xxx.xs file exist for this operating system
7538         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7539         ;;
7540 esac
7541 rp="Do you wish to use dynamic loading?"
7542 . ./myread
7543 usedl="$ans"
7544 case "$ans" in
7545 y*) usedl="$define"
7546         case "$dlsrc" in
7547         '')
7548                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7549                         dflt="$dldir/dl_${osname}.xs"
7550                 elif $test "$d_dlopen" = "$define" ; then
7551                         dflt="$dldir/dl_dlopen.xs"
7552                 elif $test "$i_dld" = "$define" ; then
7553                         dflt="$dldir/dl_dld.xs"
7554                 else
7555                         dflt=''
7556                 fi
7557                 ;;
7558         *)      dflt="$dldir/$dlsrc"
7559                 ;;
7560         esac
7561     echo "The following dynamic loading files are available:"
7562         : Can not go over to $dldir because getfile has path hard-coded in.
7563         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7564         rp="Source file to use for dynamic loading"
7565         fn="fne"
7566         gfpth="$src"
7567         . ./getfile
7568         usedl="$define"
7569         : emulate basename
7570         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7571
7572         $cat << EOM
7573
7574 Some systems may require passing special flags to $cc -c to
7575 compile modules that will be used to create a shared library.
7576 To use no flags, say "none".
7577
7578 EOM
7579     case "$cccdlflags" in
7580     '') case "$gccversion" in
7581                 '') case "$osname" in
7582                         hpux)   dflt='+z' ;;
7583                         next)   dflt='none' ;;
7584                         irix*)  dflt='-KPIC' ;;
7585                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7586                         sunos)  dflt='-pic' ;;
7587                         *)      dflt='none' ;;
7588                     esac
7589                         ;;
7590                 *)  case "$osname" in
7591                         darwin) dflt='none' ;;
7592                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7593                         *)      dflt='-fpic' ;;
7594                     esac ;;
7595             esac ;;
7596         ' ') dflt='none' ;;
7597     *)  dflt="$cccdlflags" ;;
7598     esac
7599     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7600     . ./myread
7601     case "$ans" in
7602     none) cccdlflags=' ' ;;
7603     *) cccdlflags="$ans" ;;
7604     esac
7605
7606     cat << EOM
7607
7608 Some systems use ld to create libraries that can be dynamically loaded,
7609 while other systems (such as those using ELF) use $cc.
7610
7611 EOM
7612         case "$ld" in
7613         '')     $cat >try.c <<EOM
7614 /* Test for whether ELF binaries are produced */
7615 #include <fcntl.h>
7616 #$i_stdlib I_STDLIB
7617 #ifdef I_STDLIB
7618 #include <stdlib.h>
7619 #endif
7620 int main() {
7621         char b[4];
7622         int i = open("a.out",O_RDONLY);
7623         if(i == -1) 
7624                 exit(1); /* fail */
7625         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7626                 exit(0); /* succeed (yes, it's ELF) */
7627         else
7628                 exit(1); /* fail */
7629 }
7630 EOM
7631                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7632                         cat <<EOM
7633 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7634 EOM
7635                         dflt="$cc"
7636                 else
7637                         echo "I'll use ld to build dynamic libraries."
7638                         dflt='ld'
7639                 fi
7640                 rm -f try.c a.out
7641                 ;;
7642         *)      dflt="$ld"
7643                 ;;
7644         esac
7645
7646     rp="What command should be used to create dynamic libraries?"
7647     . ./myread
7648         ld="$ans"
7649
7650     cat << EOM
7651
7652 Some systems may require passing special flags to $ld to create a
7653 library that can be dynamically loaded.  If your ld flags include
7654 -L/other/path options to locate libraries outside your loader's normal
7655 search path, you may need to specify those -L options here as well.  To
7656 use no flags, say "none".
7657
7658 EOM
7659     case "$lddlflags" in
7660     '') case "$osname" in
7661                         beos) dflt='-nostart' ;;
7662                         hpux) dflt='-b';
7663                               case "$gccversion" in
7664                               '') dflt="$dflt +vnocompatwarnings" ;;
7665                               esac
7666                               ;;        
7667                         linux|irix*|gnu*)       dflt='-shared' ;;
7668                         next)  dflt='none' ;;
7669                         solaris) dflt='-G' ;;
7670                         sunos) dflt='-assert nodefinitions' ;;
7671                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7672                 *)     dflt='none' ;;
7673                         esac
7674                         ;;
7675     *) dflt="$lddlflags" ;;
7676     esac
7677
7678         : Try to guess additional flags to pick up local libraries.
7679         : Be careful not to append to a plain 'none'
7680         case "$dflt" in
7681         none) dflt='' ;;
7682         esac
7683         for thisflag in $ldflags; do
7684                 case "$thisflag" in
7685                 -L*|-R*|-Wl,-R*)
7686                         case " $dflt " in
7687                         *" $thisflag "*) ;;
7688                         *) dflt="$dflt $thisflag" ;;
7689                         esac
7690                         ;;
7691                 esac
7692         done
7693
7694         case "$dflt" in
7695         ''|' ') dflt='none' ;;
7696         esac
7697
7698     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7699     . ./myread
7700     case "$ans" in
7701     none) lddlflags=' ' ;;
7702     *) lddlflags="$ans" ;;
7703     esac
7704
7705         cat <<EOM
7706
7707 Some systems may require passing special flags to $cc to indicate that
7708 the resulting executable will use dynamic linking.  To use no flags,
7709 say "none".
7710
7711 EOM
7712     case "$ccdlflags" in
7713     '') case "$osname" in
7714             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7715             next|sunos) dflt='none' ;;
7716             *)          dflt='none' ;;
7717             esac ;;
7718     ' ')  dflt='none' ;;
7719     *)  dflt="$ccdlflags" ;;
7720     esac
7721     rp="Any special flags to pass to $cc to use dynamic linking?"
7722     . ./myread
7723     case "$ans" in
7724     none) ccdlflags=' ' ;;
7725     *) ccdlflags="$ans" ;;
7726     esac
7727     ;;
7728 *)  usedl="$undef"
7729         ld='ld'
7730     dlsrc='dl_none.xs'
7731     lddlflags=''
7732     ccdlflags=''
7733     ;;
7734 esac
7735
7736 also=''
7737 case "$usedl" in
7738 $undef)
7739         # No dynamic loading being used, so don't bother even to prompt.
7740         useshrplib='false'
7741         ;;
7742 *)      case "$useshrplib" in
7743         '')     case "$osname" in
7744                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7745                         dflt=y
7746                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7747                         ;;
7748                 next*)
7749                         case "$osvers" in
7750                         4*)     dflt=y
7751                                 also='Building a shared libperl is needed for MAB support.'
7752                                 ;;
7753                         *)      dflt=n
7754                                 ;;
7755                         esac
7756                         ;;
7757                 *)      dflt=n
7758                         ;;
7759                 esac
7760                 ;;
7761         $define|true|[Yy]*)
7762                 dflt=y
7763                 ;;
7764         *)      dflt=n
7765                 ;;
7766         esac
7767         $cat << EOM
7768
7769 The perl executable is normally obtained by linking perlmain.c with
7770 libperl${_a}, any static extensions (usually just DynaLoader), and
7771 any other libraries needed on this system (such as -lm, etc.).  Since
7772 your system supports dynamic loading, it is probably possible to build
7773 a shared libperl.$so.  If you will have more than one executable linked
7774 to libperl.$so, this will significantly reduce the size of each
7775 executable, but it may have a noticeable effect on performance.  The
7776 default is probably sensible for your system.
7777 $also
7778
7779 EOM
7780         rp="Build a shared libperl.$so (y/n)"
7781         . ./myread
7782         case "$ans" in
7783         true|$define|[Yy]*)
7784                 useshrplib='true'  ;;
7785         *)      useshrplib='false' ;;
7786         esac
7787         ;;
7788 esac
7789
7790 case "$useshrplib" in
7791 true)
7792         case "$libperl" in
7793         '')
7794                 # Figure out a good name for libperl.so.  Since it gets stored in
7795                 # a version-specific architecture-dependent library, the version
7796                 # number isn't really that important, except for making cc/ld happy.
7797                 #
7798                 # A name such as libperl.so.3.1
7799                 majmin="libperl.$so.$patchlevel.$subversion"
7800                 # A name such as libperl.so.301
7801                 majonly=`echo $patchlevel $subversion |
7802                         $awk '{printf "%d%02d", $1, $2}'`
7803                 majonly=libperl.$so.$majonly
7804                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7805                 # rely on figuring it out from the naming of libc.
7806                 case "${osname}${osvers}" in
7807                 next4*)
7808                         dflt=libperl.5.$so
7809                         # XXX How handle the --version stuff for MAB?
7810                         ;;
7811                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7812                         dflt=libperl.$so
7813                         ;;
7814                 cygwin*) # ld links against an importlib
7815                         dflt=libperl$lib_ext
7816                         ;;
7817                 *)      # Try to guess based on whether libc has major.minor.
7818                         case "$libc" in
7819                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7820                         *libc.$so.[0-9]*) dflt=$majonly ;;
7821                         *)      dflt=libperl.$so ;;
7822                         esac
7823                         ;;
7824                 esac
7825                 ;;
7826         *)      dflt=$libperl
7827                 ;;
7828         esac
7829         cat << EOM
7830
7831 I need to select a good name for the shared libperl.  If your system uses
7832 library names with major and minor numbers, then you might want something
7833 like $majmin.  Alternatively, if your system uses a single version
7834 number for shared libraries, then you might want to use $majonly.
7835 Or, your system might be quite happy with a simple libperl.$so.
7836
7837 Since the shared libperl will get installed into a version-specific
7838 architecture-dependent directory, the version number of the shared perl
7839 library probably isn't important, so the default should be o.k.
7840
7841 EOM
7842         rp='What name do you want to give to the shared libperl?'
7843         . ./myread
7844         libperl=$ans
7845         echo "Ok, I'll use $libperl"
7846         ;;
7847 *)
7848         libperl="libperl${_a}"
7849         ;;
7850 esac
7851
7852 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7853 case "$shrpdir" in
7854 '') ;;
7855 *)      $cat >&4 <<EOM
7856 WARNING:  Use of the shrpdir variable for the installation location of
7857 the shared $libperl is not supported.  It was never documented and
7858 will not work in this version.  Let me (perlbug@perl.org)
7859 know of any problems this may cause.
7860
7861 EOM
7862         case "$shrpdir" in
7863         "$archlibexp/CORE")
7864                 $cat >&4 <<EOM
7865 But your current setting of $shrpdir is
7866 the default anyway, so it's harmless.
7867 EOM
7868                 ;;
7869         *)
7870                 $cat >&4 <<EOM
7871 Further, your current attempted setting of $shrpdir
7872 conflicts with the value of $archlibexp/CORE
7873 that installperl will use.
7874 EOM
7875                 ;;
7876         esac
7877         ;;
7878 esac
7879
7880 # How will the perl executable find the installed shared $libperl?
7881 # Add $xxx to ccdlflags.
7882 # If we can't figure out a command-line option, use $shrpenv to
7883 # set env LD_RUN_PATH.  The main perl makefile uses this.
7884 shrpdir=$archlibexp/CORE
7885 xxx=''
7886 tmp_shrpenv=''
7887 if "$useshrplib"; then
7888     case "$osname" in 
7889         aix)
7890                 # We'll set it in Makefile.SH...
7891                 ;;
7892         solaris)
7893                 xxx="-R $shrpdir"
7894                 ;;
7895         freebsd|netbsd|openbsd|interix)
7896                 xxx="-Wl,-R$shrpdir"
7897                 ;;
7898         bsdos|linux|irix*|dec_osf|gnu*)
7899                 xxx="-Wl,-rpath,$shrpdir"
7900                 ;;
7901         next)
7902                 # next doesn't like the default...
7903                 ;;
7904         beos)
7905                 # beos doesn't like the default, either.
7906                 ;;
7907         hpux*)
7908                 # hpux doesn't like the default, either.
7909                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7910                 ;;
7911         *)
7912                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7913                 ;;
7914         esac
7915         case "$xxx" in
7916         '') ;;
7917         *)      
7918                 # Only add $xxx if it isn't already in ccdlflags.
7919                 case " $ccdlflags " in
7920                 *" $xxx "*)     ;;
7921                 *)      ccdlflags="$ccdlflags $xxx"
7922                         cat <<EOM >&4
7923
7924 Adding $xxx to the flags
7925 passed to $ld so that the perl executable will find the 
7926 installed shared $libperl.
7927
7928 EOM
7929                         ;;
7930                 esac
7931                 ;;
7932         esac
7933 fi
7934 # Fix ccdlflags in AIX for building external extensions.
7935 # (For building Perl itself bare -bE:perl.exp is needed,
7936 #  Makefile.SH takes care of this.)
7937 case "$osname" in
7938 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7939 esac
7940 # Respect a hint or command-line value.
7941 case "$shrpenv" in
7942 '') shrpenv="$tmp_shrpenv" ;;
7943 esac
7944 case "$ldlibpthname" in
7945 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7946 none)   ldlibpthname='' ;;
7947 esac
7948
7949 : determine where manual pages are on this system
7950 echo " "
7951 case "$sysman" in
7952 '') 
7953         syspath='/usr/share/man/man1 /usr/man/man1'
7954         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7955         syspath="$syspath /usr/man/u_man/man1"
7956         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7957         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7958         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7959         sysman=`./loc . /usr/man/man1 $syspath`
7960         ;;
7961 esac
7962 if $test -d "$sysman"; then
7963         echo "System manual is in $sysman." >&4
7964 else
7965         echo "Could not find manual pages in source form." >&4
7966 fi
7967
7968 : determine where manual pages go
7969 set man1dir man1dir none
7970 eval $prefixit
7971 $cat <<EOM
7972
7973 $spackage has manual pages available in source form.
7974 EOM
7975 case "$nroff" in
7976 nroff)
7977         echo "However, you don't have nroff, so they're probably useless to you."
7978         case "$man1dir" in
7979         '') man1dir="none";;
7980         esac;;
7981 esac
7982 echo "If you don't want the manual sources installed, answer 'none'."
7983 case "$man1dir" in
7984 ' ') dflt=none
7985         ;;
7986 '')
7987         lookpath="$prefixexp/share/man/man1"
7988         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7989         lookpath="$lookpath $prefixexp/man/p_man/man1"
7990         lookpath="$lookpath $prefixexp/man/u_man/man1"
7991         lookpath="$lookpath $prefixexp/man/man.1"
7992         case "$sysman" in
7993         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7994         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7995         esac
7996         set dflt
7997         eval $prefixup
7998         ;;
7999 *)  dflt="$man1dir"
8000         ;;
8001 esac
8002 echo " "
8003 fn=dn+~
8004 rp="Where do the main $spackage manual pages (source) go?"
8005 . ./getfile
8006 if $test "X$man1direxp" != "X$ansexp"; then
8007         installman1dir=''
8008 fi
8009 man1dir="$ans"
8010 man1direxp="$ansexp"
8011 case "$man1dir" in
8012 '')     man1dir=' '
8013         installman1dir='';;
8014 esac
8015
8016 : Change installation prefix, if necessary.
8017 if $test X"$prefix" != X"$installprefix"; then
8018         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8019 else
8020         installman1dir="$man1direxp"
8021 fi
8022
8023 : What suffix to use on installed man pages
8024
8025 case "$man1dir" in
8026 ' ')
8027         man1ext='0'
8028         ;;
8029 *)
8030         rp="What suffix should be used for the main $spackage man pages?"
8031         case "$man1ext" in
8032         '')     case "$man1dir" in
8033                 *1)  dflt=1 ;;
8034                 *1p) dflt=1p ;;
8035                 *1pm) dflt=1pm ;;
8036                 *l) dflt=l;;
8037                 *n) dflt=n;;
8038                 *o) dflt=o;;
8039                 *p) dflt=p;;
8040                 *C) dflt=C;;
8041                 *L) dflt=L;;
8042                 *L1) dflt=L1;;
8043                 *) dflt=1;;
8044                 esac
8045                 ;;
8046         *)      dflt="$man1ext";;
8047         esac
8048         . ./myread
8049         man1ext="$ans"
8050         ;;
8051 esac
8052
8053 : see if we can have long filenames
8054 echo " "
8055 first=123456789abcdef
8056 $rm -f $first
8057 if (echo hi >$first) 2>/dev/null; then
8058         if $test -f 123456789abcde; then
8059                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8060                 val="$undef"
8061         else
8062                 echo 'You can have filenames longer than 14 characters.'>&4
8063                 val="$define"
8064         fi
8065 else
8066         $cat <<'EOM'
8067 You can't have filenames longer than 14 chars.
8068 You can't even think about them!
8069 EOM
8070         val="$undef"
8071 fi 
8072 set d_flexfnam
8073 eval $setvar
8074 $rm -rf 123456789abcde*
8075
8076 : determine where library module manual pages go
8077 set man3dir man3dir none
8078 eval $prefixit
8079 $cat <<EOM
8080
8081 $spackage has manual pages for many of the library modules.
8082 EOM
8083
8084 case "$nroff" in
8085 nroff)
8086         $cat <<'EOM'
8087 However, you don't have nroff, so they're probably useless to you.
8088 EOM
8089         case "$man3dir" in
8090         '') man3dir="none";;
8091         esac;;
8092 esac
8093
8094 case "$d_flexfnam" in
8095 undef)
8096         $cat <<'EOM'
8097 However, your system can't handle the long file names like File::Basename.3. 
8098 EOM
8099         case "$man3dir" in
8100         '') man3dir="none";;
8101         esac;;
8102 esac
8103
8104 echo "If you don't want the manual sources installed, answer 'none'."
8105 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8106 case "$man3dir" in
8107 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8108         if $test -d "$privlib/man/man3"; then
8109                 cat <<EOM >&4
8110
8111 WARNING:  Previous versions of perl installed man3 pages into
8112 $privlib/man/man3.  This version will suggest a 
8113 new default of $dflt.  
8114 EOM
8115                 tdflt=$dflt
8116                 dflt='n'
8117                 rp='Do you wish to preserve the old behavior?(y/n)'
8118                 . ./myread
8119                 case "$ans" in
8120                 y*) dflt="$privlib/man/man3" ;;
8121                 *)  dflt=$tdflt ;;
8122                 esac
8123     fi
8124         ;;
8125 *)      dflt="$man3dir" ;;
8126 esac
8127 case "$dflt" in
8128 ' ') dflt=none ;;
8129 esac
8130 echo " "
8131 fn=dn+~
8132 rp="Where do the $package library man pages (source) go?"
8133 . ./getfile
8134 man3dir="$ans"
8135 man3direxp="$ansexp"
8136 case "$man3dir" in
8137 '')     man3dir=' '
8138         installman3dir='';;
8139 esac
8140
8141 : Change installation prefix, if necessary.
8142 if $test X"$prefix" != X"$installprefix"; then
8143         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8144 else
8145         installman3dir="$man3direxp"
8146 fi
8147
8148 : What suffix to use on installed man pages
8149 case "$man3dir" in
8150 ' ')
8151         man3ext='0'
8152         ;;
8153 *)
8154         rp="What suffix should be used for the $package library man pages?"
8155         case "$man3ext" in
8156         '')     case "$man3dir" in
8157                 *3)  dflt=3 ;;
8158                 *3p) dflt=3p ;;
8159                 *3pm) dflt=3pm ;;
8160                 *l) dflt=l;;
8161                 *n) dflt=n;;
8162                 *o) dflt=o;;
8163                 *p) dflt=p;;
8164                 *C) dflt=C;;
8165                 *L) dflt=L;;
8166                 *L3) dflt=L3;;
8167                 *) dflt=3;;
8168                 esac
8169                 ;;
8170         *)      dflt="$man3ext";;
8171         esac
8172         . ./myread
8173         man3ext="$ans"
8174         ;;
8175 esac
8176
8177 : see if we have to deal with yellow pages, now NIS.
8178 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8179         if $test -f /usr/etc/nibindd; then
8180                 echo " "
8181                 echo "I'm fairly confident you're on a NeXT."
8182                 echo " "
8183                 rp='Do you get the hosts file via NetInfo?'
8184                 dflt=y
8185                 case "$hostcat" in
8186                 nidump*) ;;
8187                 '') ;;
8188                 *) dflt=n;;
8189                 esac
8190                 . ./myread
8191                 case "$ans" in
8192                 y*) hostcat='nidump hosts .';;
8193                 *)      case "$hostcat" in
8194                         nidump*) hostcat='';;
8195                         esac
8196                         ;;
8197                 esac
8198         fi
8199         case "$hostcat" in
8200         nidump*) ;;
8201         *)
8202                 case "$hostcat" in
8203                 *ypcat*) dflt=y;;
8204                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8205                                 dflt=y
8206                         else
8207                                 dflt=n
8208                         fi;;
8209                 *) dflt=n;;
8210                 esac
8211                 echo " "
8212                 rp='Are you getting the hosts file via yellow pages?'
8213                 . ./myread
8214                 case "$ans" in
8215                 y*) hostcat='ypcat hosts';;
8216                 *) hostcat='cat /etc/hosts';;
8217                 esac
8218                 ;;
8219         esac
8220 fi
8221 case "$hostcat" in
8222 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8223 esac
8224 case "$groupcat" in
8225 '') test -f /etc/group && groupcat='cat /etc/group';;
8226 esac
8227 case "$passcat" in
8228 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8229 esac
8230
8231 : now get the host name
8232 echo " "
8233 echo "Figuring out host name..." >&4
8234 case "$myhostname" in
8235 '') cont=true
8236         echo 'Maybe "hostname" will work...'
8237         if tans=`sh -c hostname 2>&1` ; then
8238                 myhostname=$tans
8239                 phostname=hostname
8240                 cont=''
8241         fi
8242         ;;
8243 *) cont='';;
8244 esac
8245 if $test "$cont"; then
8246         if ./xenix; then
8247                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8248                 if tans=`cat /etc/systemid 2>&1` ; then
8249                         myhostname=$tans
8250                         phostname='cat /etc/systemid'
8251                         echo "Whadyaknow.  Xenix always was a bit strange..."
8252                         cont=''
8253                 fi
8254         elif $test -r /etc/systemid; then
8255                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8256         fi
8257 fi
8258 if $test "$cont"; then
8259         echo 'No, maybe "uuname -l" will work...'
8260         if tans=`sh -c 'uuname -l' 2>&1` ; then
8261                 myhostname=$tans
8262                 phostname='uuname -l'
8263         else
8264                 echo 'Strange.  Maybe "uname -n" will work...'
8265                 if tans=`sh -c 'uname -n' 2>&1` ; then
8266                         myhostname=$tans
8267                         phostname='uname -n'
8268                 else
8269                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8270                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8271                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8272                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8273                         else
8274                                 case "$myhostname" in
8275                                 '') echo "Does this machine have an identity crisis or something?"
8276                                         phostname='';;
8277                                 *)
8278                                         echo "Well, you said $myhostname before..."
8279                                         phostname='echo $myhostname';;
8280                                 esac
8281                         fi
8282                 fi
8283         fi
8284 fi
8285 case "$myhostname" in
8286 '') myhostname=noname ;;
8287 esac
8288 : you do not want to know about this
8289 set $myhostname
8290 myhostname=$1
8291
8292 : verify guess
8293 if $test "$myhostname" ; then
8294         dflt=y
8295         rp='Your host name appears to be "'$myhostname'".'" Right?"
8296         . ./myread
8297         case "$ans" in
8298         y*) ;;
8299         *) myhostname='';;
8300         esac
8301 fi
8302
8303 : bad guess or no guess
8304 while $test "X$myhostname" = X ; do
8305         dflt=''
8306         rp="Please type the (one word) name of your host:"
8307         . ./myread
8308         myhostname="$ans"
8309 done
8310
8311 : translate upper to lower if necessary
8312 case "$myhostname" in
8313 *[A-Z]*)
8314         echo "(Normalizing case in your host name)"
8315         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8316         ;;
8317 esac
8318
8319 case "$myhostname" in
8320 *.*)
8321         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8322         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8323         echo "(Trimming domain name from host name--host name is now $myhostname)"
8324         ;;
8325 *) case "$mydomain" in
8326         '')
8327                 {
8328                         test "X$hostcat" = "Xypcat hosts" &&
8329                         ypmatch "$myhostname" hosts 2>/dev/null |\
8330                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8331                         $test -s hosts
8332                 } || {
8333                         test "X$hostcat" != "X" &&
8334                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8335                                         /[       ]$myhostname[  . ]/p" > hosts
8336                 }
8337                 tmp_re="[       . ]"
8338                 if $test -f hosts; then
8339                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8340                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8341                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8342                                 hosts | $sort | $uniq | \
8343                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8344                         case `$echo X$dflt` in
8345                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8346                                 dflt=.
8347                                 ;;
8348                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8349                                 ;;
8350                         esac
8351                 else
8352                         echo "(I cannot locate a hosts database anywhere)"
8353                         dflt=.
8354                 fi
8355                 case "$dflt" in
8356                 .)
8357                         tans=`./loc resolv.conf X /etc /usr/etc`
8358                         if $test -f "$tans"; then
8359                                 echo "(Attempting domain name extraction from $tans)"
8360                                 dflt=.`$sed -n -e 's/   / /g' \
8361                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8362                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8363                                 case "$dflt" in
8364                                 .) dflt=.`$sed -n -e 's/        / /g' \
8365                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8366                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8367                                         ;;
8368                                 esac
8369                         fi
8370                         ;;
8371                 esac
8372                 case "$dflt" in
8373                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8374                         dflt=.`sh -c domainname 2>/dev/null`
8375                         case "$dflt" in
8376                         '') dflt='.';;
8377                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8378                         esac
8379                         ;;
8380                 esac
8381                 case "$dflt$osname" in
8382                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8383                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8384                         ;;
8385                 esac
8386                 case "$dflt" in
8387                 .) echo "(Lost all hope -- silly guess then)"
8388                         dflt='.nonet'
8389                         ;;
8390                 esac
8391                 $rm -f hosts
8392                 ;;
8393         *) dflt="$mydomain";;
8394         esac;;
8395 esac
8396 echo " "
8397 rp="What is your domain name?"
8398 . ./myread
8399 tans="$ans"
8400 case "$ans" in
8401 '') ;;
8402 .*) ;;
8403 *) tans=".$tans";;
8404 esac
8405 mydomain="$tans"
8406
8407 : translate upper to lower if necessary
8408 case "$mydomain" in
8409 *[A-Z]*)
8410         echo "(Normalizing case in your domain name)"
8411         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8412         ;;
8413 esac
8414
8415 : a little sanity check here
8416 case "$phostname" in
8417 '') ;;
8418 *)
8419         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8420         $myhostname$mydomain|$myhostname) ;;
8421         *)
8422                 case "$phostname" in
8423                 sed*)
8424                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8425                         ;;
8426                 *)
8427                         echo "(That doesn't agree with your $phostname command, by the way.)"
8428                         ;;
8429                 esac
8430         ;;
8431         esac
8432         ;;
8433 esac
8434
8435 $cat <<EOM
8436
8437 I need to get your e-mail address in Internet format if possible, i.e.
8438 something like user@host.domain. Please answer accurately since I have
8439 no easy means to double check it. The default value provided below
8440 is most probably close to reality but may not be valid from outside
8441 your organization...
8442
8443 EOM
8444 cont=x
8445 while test "$cont"; do
8446         case "$cf_email" in
8447         '') dflt="$cf_by@$myhostname$mydomain";;
8448         *) dflt="$cf_email";;
8449         esac
8450         rp='What is your e-mail address?'
8451         . ./myread
8452         cf_email="$ans"
8453         case "$cf_email" in
8454         *@*.*) cont='' ;;
8455         *)
8456                 rp='Address does not look like an Internet one.  Use it anyway?'
8457                 case "$fastread" in
8458                 yes) dflt=y ;;
8459                 *) dflt=n ;;
8460                 esac
8461                 . ./myread
8462                 case "$ans" in
8463                 y*) cont='' ;;
8464                 *) echo " " ;;
8465                 esac
8466                 ;;
8467         esac
8468 done
8469
8470 $cat <<EOM
8471
8472 If you or somebody else will be maintaining perl at your site, please
8473 fill in the correct e-mail address here so that they may be contacted
8474 if necessary. Currently, the "perlbug" program included with perl
8475 will send mail to this address in addition to perlbug@perl.org. You may
8476 enter "none" for no administrator.
8477
8478 EOM
8479 case "$perladmin" in
8480 '') dflt="$cf_email";;
8481 *) dflt="$perladmin";;
8482 esac
8483 rp='Perl administrator e-mail address'
8484 . ./myread
8485 perladmin="$ans"
8486
8487 : determine whether to only install version-specific parts.
8488 echo " "
8489 $cat <<EOM
8490 Do you want to install only the version-specific parts of the perl
8491 distribution?  Usually you do *not* want to do this.
8492 EOM
8493 case "$versiononly" in
8494 "$define"|[Yy]*|true) dflt='y' ;;
8495 *) dflt='n';
8496 esac
8497 rp="Do you want to install only the version-specific parts of perl?"
8498 . ./myread
8499 case "$ans" in
8500 [yY]*)  val="$define";;
8501 *)      val="$undef" ;;
8502 esac
8503 set versiononly
8504 eval $setvar
8505
8506 case "$versiononly" in
8507 "$define") inc_version_list=''
8508            inc_version_list_init=0
8509            ;;
8510 esac
8511
8512 : figure out how to guarantee perl startup
8513 case "$startperl" in
8514 '')
8515         case "$sharpbang" in
8516         *!)
8517                 $cat <<EOH
8518
8519 I can use the #! construct to start perl on your system. This will
8520 make startup of perl scripts faster, but may cause problems if you
8521 want to share those scripts and perl is not in a standard place
8522 ($binexp/perl) on all your platforms. The alternative is to force
8523 a shell by starting the script with a single ':' character.
8524
8525 EOH
8526                 case "$versiononly" in
8527                 "$define")      dflt="$binexp/perl$version";;  
8528                 *)              dflt="$binexp/perl";;
8529                 esac
8530                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8531                 . ./myread
8532                 case "$ans" in
8533                 none)   startperl=": # use perl";;
8534                 *)      startperl="#!$ans"
8535                         if $test 30 -lt `echo "$ans" | wc -c`; then
8536                                 $cat >&4 <<EOM
8537
8538 WARNING:  Some systems limit the #! command to 32 characters.
8539 If you experience difficulty running Perl scripts with #!, try
8540 installing Perl in a directory with a shorter pathname.
8541
8542 EOM
8543                         fi ;;
8544                 esac
8545                 ;;
8546         *) startperl=": # use perl"
8547                 ;;
8548         esac
8549         ;;
8550 esac
8551 echo "I'll use $startperl to start perl scripts."
8552
8553 : figure best path for perl in scripts
8554 case "$perlpath" in
8555 '')
8556         case "$versiononly" in
8557         "$define")      perlpath="$binexp/perl$version";;
8558         *)              perlpath="$binexp/perl";;
8559         esac
8560         case "$startperl" in
8561         *!*) ;;
8562         *)
8563                 $cat <<EOH
8564
8565 I will use the "eval 'exec'" idiom to start Perl on your system.
8566 I can use the full path of your Perl binary for this purpose, but
8567 doing so may cause problems if you want to share those scripts and
8568 Perl is not always in a standard place ($binexp/perl).
8569
8570 EOH
8571                 dflt="$binexp/perl"
8572                 rp="What path shall I use in \"eval 'exec'\"?"
8573                 . ./myread
8574                 perlpath="$ans"
8575                 ;;
8576         esac
8577         ;;
8578 esac
8579 case "$startperl" in
8580 *!*)    ;;
8581 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8582 esac
8583
8584 : determine where public executable scripts go
8585 set scriptdir scriptdir
8586 eval $prefixit
8587 case "$scriptdir" in
8588 '')
8589         dflt="$bin"
8590         : guess some guesses
8591         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8592         $test -d /usr/share/bin     && dflt=/usr/share/bin
8593         $test -d /usr/local/script  && dflt=/usr/local/script
8594         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8595         $test -d $prefixexp/script  && dflt=$prefixexp/script
8596         set dflt
8597         eval $prefixup
8598         ;;
8599 *)  dflt="$scriptdir"
8600         ;;
8601 esac
8602 $cat <<EOM
8603  
8604 Some installations have a separate directory just for executable scripts so
8605 that they can mount it across multiple architectures but keep the scripts in
8606 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8607 Or you might just lump your scripts in with all your other executables.
8608  
8609 EOM
8610 fn=d~
8611 rp='Where do you keep publicly executable scripts?'
8612 . ./getfile
8613 if $test "X$ansexp" != "X$scriptdirexp"; then
8614         installscript=''
8615 fi
8616 scriptdir="$ans"
8617 scriptdirexp="$ansexp"
8618 : Change installation prefix, if necessary.
8619 if $test X"$prefix" != X"$installprefix"; then
8620         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8621 else
8622         installscript="$scriptdirexp"
8623 fi
8624
8625 : determine where add-on public executables go
8626 case "$sitebin" in
8627 '')     dflt=$siteprefix/bin ;;
8628 *)      dflt=$sitebin ;;
8629 esac
8630 fn=d~
8631 rp='Pathname where the add-on public executables should be installed?'
8632 . ./getfile
8633 sitebin="$ans"
8634 sitebinexp="$ansexp"
8635 : Change installation prefix, if necessary.
8636 if $test X"$prefix" != X"$installprefix"; then
8637         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8638 else
8639         installsitebin="$sitebinexp"
8640 fi
8641
8642 : determine where add-on html pages go
8643 : There is no standard location, so try to copy the previously-selected
8644 : directory structure for the core html pages.
8645 case "$sitehtml1dir" in
8646 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8647 *)     dflt=$sitehtml1dir ;;
8648 esac
8649 case "$dflt" in
8650 ''|' ') dflt=none ;;
8651 esac
8652 fn=dn+~
8653 rp='Pathname where the site-specific html pages should be installed?'
8654 . ./getfile
8655 sitehtml1dir="$ans"
8656 sitehtml1direxp="$ansexp"
8657 : Change installation prefix, if necessary.
8658 if $test X"$prefix" != X"$installprefix"; then
8659         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8660 else
8661         installsitehtml1dir="$sitehtml1direxp"
8662 fi
8663
8664 : determine where add-on library html pages go
8665 : There is no standard location, so try to copy the previously-selected
8666 : directory structure for the core html pages.
8667 case "$sitehtml3dir" in
8668 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8669 *)     dflt=$sitehtml3dir ;;
8670 esac
8671 case "$dflt" in
8672 ''|' ') dflt=none ;;
8673 esac
8674 fn=dn+~
8675 rp='Pathname where the site-specific library html pages should be installed?'
8676 . ./getfile
8677 sitehtml3dir="$ans"
8678 sitehtml3direxp="$ansexp"
8679 : Change installation prefix, if necessary.
8680 if $test X"$prefix" != X"$installprefix"; then
8681         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8682 else
8683         installsitehtml3dir="$sitehtml3direxp"
8684 fi
8685
8686 : determine where add-on manual pages go
8687 case "$siteman1dir" in
8688 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8689 *)      dflt=$siteman1dir ;;
8690 esac
8691 case "$dflt" in
8692 ''|' ') dflt=none ;;
8693 esac
8694 fn=dn+~
8695 rp='Pathname where the site-specific manual pages should be installed?'
8696 . ./getfile
8697 siteman1dir="$ans"
8698 siteman1direxp="$ansexp"
8699 : Change installation prefix, if necessary.
8700 if $test X"$prefix" != X"$installprefix"; then
8701         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8702 else
8703         installsiteman1dir="$siteman1direxp"
8704 fi
8705
8706 : determine where add-on library man pages go
8707 case "$siteman3dir" in
8708 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8709 *)      dflt=$siteman3dir ;;
8710 esac
8711 case "$dflt" in
8712 ''|' ') dflt=none ;;
8713 esac
8714 fn=dn+~
8715 rp='Pathname where the site-specific library manual pages should be installed?'
8716 . ./getfile
8717 siteman3dir="$ans"
8718 siteman3direxp="$ansexp"
8719 : Change installation prefix, if necessary.
8720 if $test X"$prefix" != X"$installprefix"; then
8721         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8722 else
8723         installsiteman3dir="$siteman3direxp"
8724 fi
8725
8726 : determine where add-on public executable scripts go
8727 case "$sitescript" in
8728 '')     dflt=$siteprefix/script
8729         $test -d $dflt || dflt=$sitebin ;;
8730 *)  dflt="$sitescript" ;;
8731 esac
8732 fn=d~+
8733 rp='Pathname where add-on public executable scripts should be installed?'
8734 . ./getfile
8735 sitescript="$ans"
8736 sitescriptexp="$ansexp"
8737 : Change installation prefix, if necessary.
8738 if $test X"$prefix" != X"$installprefix"; then
8739         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8740 else
8741         installsitescript="$sitescriptexp"
8742 fi
8743
8744 case "$usefaststdio" in
8745 $define|true|[yY]*|'')
8746         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8747         case "$xversion" in
8748         [68])   dflt='y' ;;
8749         *)      dflt='n' ;;
8750         esac
8751         ;;
8752 *) dflt='n';;
8753 esac
8754 cat <<EOM
8755
8756 Perl can be built to use 'fast stdio', which means using the stdio
8757 library but also directly manipulating the stdio buffers to enable
8758 faster I/O.  Using stdio is better for backward compatibility (especially
8759 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8760 interface has been preferred instead of stdio.
8761
8762 If this doesn't make any sense to you, just accept the default '$dflt'.
8763 EOM
8764 rp='Use the "fast stdio" if available?'
8765 . ./myread
8766 case "$ans" in
8767 y|Y)    val="$define" ;;     
8768 *)      val="$undef" ;;
8769 esac
8770 set usefaststdio
8771 eval $setvar
8772
8773
8774 : define an is-a-typedef? function
8775 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8776 case "$inclist" in
8777 "") inclist="sys/types.h";;
8778 esac;
8779 eval "varval=\$$var";
8780 case "$varval" in
8781 "")
8782         $rm -f temp.c;
8783         for inc in $inclist; do
8784                 echo "#include <$inc>" >>temp.c;
8785         done;
8786         echo "#ifdef $type" >> temp.c;
8787         echo "printf(\"We have $type\");" >> temp.c;
8788         echo "#endif" >> temp.c;
8789         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8790         if $contains $type temp.E >/dev/null 2>&1; then
8791                 eval "$var=\$type";
8792         else
8793                 eval "$var=\$def";
8794         fi;
8795         $rm -f temp.?;;
8796 *) eval "$var=\$varval";;
8797 esac'
8798
8799 : define an is-a-typedef? function that prompts if the type is not available.
8800 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8801 case "$inclist" in
8802 "") inclist="sys/types.h";;
8803 esac;
8804 eval "varval=\$$var";
8805 case "$varval" in
8806 "")
8807         $rm -f temp.c;
8808         for inc in $inclist; do
8809                 echo "#include <$inc>" >>temp.c;
8810         done;
8811         echo "#ifdef $type" >> temp.c;
8812         echo "printf(\"We have $type\");" >> temp.c;
8813         echo "#endif" >> temp.c;
8814         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8815         echo " " ;
8816         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8817         if $contains $type temp.E >/dev/null 2>&1; then
8818                 echo "$type found." >&4;
8819                 eval "$var=\$type";
8820         else
8821                 echo "$type NOT found." >&4;
8822                 dflt="$def";
8823                 . ./myread ;
8824                 eval "$var=\$ans";
8825         fi;
8826         $rm -f temp.?;;
8827 *) eval "$var=\$varval";;
8828 esac'
8829
8830 : see what type lseek is declared as in the kernel
8831 rp="What is the type used for lseek's offset on this system?"
8832 set off_t lseektype long stdio.h sys/types.h
8833 eval $typedef_ask
8834
8835 echo " "
8836 echo "Checking to see how big your file offsets are..." >&4
8837 $cat >try.c <<EOCP
8838 #include <sys/types.h>
8839 #include <stdio.h>
8840 int main()
8841 {
8842     printf("%d\n", (int)sizeof($lseektype));
8843     return(0); 
8844 }
8845 EOCP
8846 set try
8847 if eval $compile_ok; then
8848         lseeksize=`$run ./try`
8849         echo "Your file offsets are $lseeksize bytes long."
8850 else
8851         dflt=$longsize
8852         echo " "
8853         echo "(I can't seem to compile the test program.  Guessing...)"
8854         rp="What is the size of your file offsets (in bytes)?"
8855         . ./myread
8856         lseeksize="$ans"
8857 fi
8858 $rm -f try.c try
8859
8860 : see what type file positions are declared as in the library
8861 rp="What is the type for file position used by fsetpos()?"
8862 set fpos_t fpostype long stdio.h sys/types.h
8863 eval $typedef_ask
8864
8865 echo " "
8866 case "$fpostype" in
8867 *_t) zzz="$fpostype"    ;;
8868 *)   zzz="fpos_t"       ;;
8869 esac
8870 echo "Checking the size of $zzz..." >&4 
8871 cat > try.c <<EOCP
8872 #include <sys/types.h>
8873 #include <stdio.h>
8874 #$i_stdlib I_STDLIB
8875 #ifdef I_STDLIB
8876 #include <stdlib.h>
8877 #endif
8878 int main() {
8879     printf("%d\n", (int)sizeof($fpostype));
8880     exit(0);
8881 }
8882 EOCP
8883 set try
8884 if eval $compile_ok; then
8885         yyy=`$run ./try`
8886         case "$yyy" in
8887         '')     fpossize=4
8888                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8889                 ;;
8890         *)      fpossize=$yyy
8891                 echo "Your $zzz is $fpossize bytes long."
8892                 ;;
8893         esac
8894 else
8895         dflt="$longsize"
8896         echo " " >&4
8897         echo "(I can't compile the test program.  Guessing...)" >&4
8898         rp="What is the size of your file positions (in bytes)?"
8899         . ./myread
8900         fpossize="$ans"
8901 fi
8902
8903 # Backward compatibility (uselfs is deprecated).
8904 case "$uselfs" in
8905 "$define"|true|[yY]*)
8906         cat <<EOM >&4
8907
8908 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8909 EOM
8910         uselargefiles="$define"
8911         ;;
8912 esac                          
8913
8914 case "$lseeksize:$fpossize" in
8915 8:8) cat <<EOM
8916
8917 You can have files larger than 2 gigabytes.
8918 EOM
8919    val="$define" ;;
8920 *)    case "$uselargefiles" in
8921    "$undef"|false|[nN]*) dflt='n' ;;
8922    *)   dflt='y' ;;
8923    esac
8924    cat <<EOM
8925
8926 Perl can be built to understand large files (files larger than 2 gigabytes)
8927 on some systems.  To do so, Configure can be run with -Duselargefiles.
8928
8929 If this doesn't make any sense to you, just accept the default '$dflt'.
8930 EOM
8931    rp='Try to understand large files, if available?'
8932    . ./myread
8933    case "$ans" in
8934    y|Y)         val="$define" ;;
8935    *)           val="$undef"  ;;
8936    esac
8937    ;;
8938 esac
8939 set uselargefiles
8940 eval $setvar
8941 : Look for a hint-file generated 'call-back-unit'.  If the
8942 : user has specified that a large files perl is to be built,
8943 : we may need to set or change some other defaults.
8944 if $test -f uselargefiles.cbu; then
8945         echo "Your platform has some specific hints regarding large file builds, using them..."
8946         . ./uselargefiles.cbu
8947 fi
8948 case "$uselargefiles" in
8949 "$define")
8950         if $test -f uselargefiles.cbu; then
8951                 echo " "
8952                 echo "Rechecking to see how big your file offsets are..." >&4
8953                 $cat >try.c <<EOCP
8954 #include <sys/types.h>
8955 #include <stdio.h>
8956 int main()
8957 {
8958     printf("%d\n", (int)sizeof($lseektype));
8959     return(0); 
8960 }
8961 EOCP
8962                 set try
8963                 if eval $compile_ok; then
8964                         lseeksize=`$run ./try`
8965                         $echo "Your file offsets are now $lseeksize bytes long."
8966                 else
8967                         dflt="$lseeksize"
8968                         echo " "
8969                         echo "(I can't seem to compile the test program.  Guessing...)"
8970                         rp="What is the size of your file offsets (in bytes)?"
8971                         . ./myread
8972                         lseeksize="$ans"
8973                 fi
8974                 case "$fpostype" in
8975                 *_t) zzz="$fpostype"    ;;
8976                 *)   zzz="fpos_t"       ;;
8977                 esac
8978                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8979                 $cat > try.c <<EOCP
8980 #include <sys/types.h>
8981 #include <stdio.h>
8982 #$i_stdlib I_STDLIB
8983 #ifdef I_STDLIB
8984 #include <stdlib.h>
8985 #endif
8986 int main() {
8987     printf("%d\n", (int)sizeof($fpostype));
8988     return(0);
8989 }
8990 EOCP
8991                 set try
8992                 if eval $compile_ok; then
8993                         yyy=`$run ./try`
8994                         dflt="$lseeksize"
8995                         case "$yyy" in
8996                         '')     echo " "
8997                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8998                                 ;;
8999                         *)      fpossize=$yyy
9000                                 echo " $fpossize bytes." >&4
9001                                 ;;
9002                         esac
9003                 else
9004                         dflt="$fpossize"
9005                         echo " "
9006                         echo "(I can't compile the test program.  Guessing...)" >&4
9007                         rp="What is the size of your file positions (in bytes)?"
9008                         . ./myread
9009                         fpossize="$ans"
9010                 fi
9011                 $rm -f try.c try
9012         fi
9013         ;;
9014 esac
9015
9016 # probably will refer to
9017 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9018 need_relocation=0
9019 userelocatableinc=undef
9020
9021 case "$vendorprefix" in
9022 '')     d_vendorbin="$undef"
9023         vendorbin=''
9024         vendorbinexp=''
9025         ;;
9026 *)      d_vendorbin="$define"
9027         : determine where vendor-supplied executables go.
9028         case "$vendorbin" in
9029         '') dflt=$vendorprefix/bin ;;
9030         *)      dflt="$vendorbin" ;;
9031         esac
9032         fn=d~+
9033         rp='Pathname for the vendor-supplied executables directory?'
9034         . ./getfile
9035         vendorbin="$ans"
9036         vendorbinexp="$ansexp"
9037         ;;
9038 esac
9039 : Change installation prefix, if necessary.
9040 if $test X"$prefix" != X"$installprefix"; then
9041         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9042 else
9043         installvendorbin="$vendorbinexp"
9044 fi
9045
9046 case "$vendorprefix" in
9047 '')     vendorhtml1dir=''
9048         vendorhtml1direxp=''
9049         ;;
9050 *)      : determine where vendor-supplied html pages go.
9051         : There is no standard location, so try to copy the previously-selected
9052         : directory structure for the core html pages.
9053         : XXX Better default suggestions would be welcome.
9054         case "$vendorhtml1dir" in
9055         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9056         *)      dflt=$vendorhtml1dir ;;
9057         esac
9058         case "$dflt" in
9059         ''|' ') dflt=none ;;
9060         esac
9061         fn=dn+~
9062         rp='Pathname for the vendor-supplied html pages?'
9063         . ./getfile
9064         vendorhtml1dir="$ans"
9065         vendorhtml1direxp="$ansexp"
9066         ;;
9067 esac
9068 : Use ' ' for none so value is preserved next time through Configure
9069 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9070 : Change installation prefix, if necessary.
9071 if $test X"$prefix" != X"$installprefix"; then
9072         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9073 else
9074         installvendorhtml1dir="$vendorhtml1direxp"
9075 fi
9076
9077 case "$vendorprefix" in
9078 '')     vendorhtml3dir=''
9079         vendorhtml3direxp=''
9080         ;;
9081 *)      : determine where vendor-supplied module html pages go.
9082         : There is no standard location, so try to copy the previously-selected
9083         : directory structure for the core html pages.
9084         : XXX Better default suggestions would be welcome.
9085         case "$vendorhtml3dir" in
9086         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9087         *)      dflt=$vendorhtml3dir ;;
9088         esac
9089         case "$dflt" in
9090         ''|' ') dflt=none ;;
9091         esac
9092         fn=dn+~
9093         rp='Pathname for the vendor-supplied html pages?'
9094         . ./getfile
9095         vendorhtml3dir="$ans"
9096         vendorhtml3direxp="$ansexp"
9097         ;;
9098 esac
9099 : Use ' ' for none so value is preserved next time through Configure
9100 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9101 : Change installation prefix, if necessary.
9102 if $test X"$prefix" != X"$installprefix"; then
9103         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9104 else
9105         installvendorhtml3dir="$vendorhtml3direxp"
9106 fi
9107
9108 case "$vendorprefix" in
9109 '')     vendorman1dir=''
9110         vendorman1direxp=''
9111         ;;
9112 *)      : determine where vendor-supplied manual pages go.
9113         case "$vendorman1dir" in
9114         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9115         *)      dflt=$vendorman1dir ;;
9116         esac
9117         case "$dflt" in
9118         ''|' ') dflt=none ;;
9119         esac
9120         fn=nd~+
9121         rp='Pathname for the vendor-supplied manual section 1 pages?'
9122         . ./getfile
9123         vendorman1dir="$ans"
9124         vendorman1direxp="$ansexp"
9125         ;;
9126 esac
9127 : Use ' ' for none so value is preserved next time through Configure
9128 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9129 : Change installation prefix, if necessary.
9130 if $test X"$prefix" != X"$installprefix"; then
9131         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9132 else
9133         installvendorman1dir="$vendorman1direxp"
9134 fi
9135
9136 case "$vendorprefix" in
9137 '')     vendorman3dir=''
9138         vendorman3direxp=''
9139         ;;
9140 *)      : determine where vendor-supplied module manual pages go.
9141         case "$vendorman3dir" in
9142         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9143         *)      dflt=$vendorman3dir ;;
9144         esac
9145         case "$dflt" in
9146         ''|' ') dflt=none ;;
9147         esac
9148         fn=nd~+
9149         rp='Pathname for the vendor-supplied manual section 3 pages?'
9150         . ./getfile
9151         vendorman3dir="$ans"
9152         vendorman3direxp="$ansexp"
9153         ;;
9154 esac
9155 : Use ' ' for none so value is preserved next time through Configure
9156 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9157 : Change installation prefix, if necessary.
9158 if $test X"$prefix" != X"$installprefix"; then
9159         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9160 else
9161         installvendorman3dir="$vendorman3direxp"
9162 fi
9163
9164 case "$vendorprefix" in
9165 '')     d_vendorscript="$undef"
9166         vendorscript=''
9167         vendorscriptexp=''
9168         ;;
9169 *)      d_vendorscript="$define"
9170         : determine where vendor-supplied scripts go.
9171         case "$vendorscript" in
9172         '')     dflt=$vendorprefix/script
9173                 $test -d $dflt || dflt=$vendorbin ;;
9174         *)  dflt="$vendorscript" ;;
9175         esac
9176         $cat <<EOM
9177
9178 The installation process will create a directory for 
9179 vendor-supplied scripts.
9180
9181 EOM
9182         fn=d~+
9183         rp='Pathname for the vendor-supplied scripts directory?'
9184         . ./getfile
9185         vendorscript="$ans"
9186         vendorscriptexp="$ansexp"
9187         ;;
9188 esac
9189 : Change installation prefix, if necessary.
9190 if $test X"$prefix" != X"$installprefix"; then
9191         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9192 else
9193         installvendorscript="$vendorscriptexp"
9194 fi
9195
9196 : see if qgcvt exists
9197 set qgcvt d_qgcvt
9198 eval $inlibc
9199
9200 echo " "
9201
9202 if $test X"$d_longdbl" = X"$define"; then
9203
9204 echo "Checking how to print long doubles..." >&4
9205
9206 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9207         $cat >try.c <<'EOCP'
9208 #include <sys/types.h>
9209 #include <stdio.h>
9210 int main() {
9211   double d = 123.456;
9212   printf("%.3f\n", d);
9213 }
9214 EOCP
9215         set try
9216         if eval $compile; then
9217                 yyy=`$run ./try`
9218                 case "$yyy" in
9219                 123.456)
9220                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9221                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9222                         echo "We will use %f."
9223                         ;;
9224                 esac
9225         fi
9226 fi
9227
9228 if $test X"$sPRIfldbl" = X; then
9229         $cat >try.c <<'EOCP'
9230 #include <sys/types.h>
9231 #include <stdio.h>
9232 int main() {
9233   long double d = 123.456;
9234   printf("%.3Lf\n", d);
9235 }
9236 EOCP
9237         set try
9238         if eval $compile; then
9239                 yyy=`$run ./try`
9240                 case "$yyy" in
9241                 123.456)
9242                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9243                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9244                         echo "We will use %Lf."
9245                         ;;
9246                 esac
9247         fi
9248 fi
9249
9250 if $test X"$sPRIfldbl" = X; then
9251         $cat >try.c <<'EOCP'
9252 #include <sys/types.h>
9253 #include <stdio.h>
9254 int main() {
9255   long double d = 123.456;
9256   printf("%.3llf\n", d);
9257 }
9258 EOCP
9259         set try
9260         if eval $compile; then
9261                 yyy=`$run ./try`
9262                 case "$yyy" in
9263                 123.456)
9264                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9265                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9266                         echo "We will use %llf."
9267                         ;;
9268                 esac
9269         fi
9270 fi
9271
9272 if $test X"$sPRIfldbl" = X; then
9273         $cat >try.c <<'EOCP'
9274 #include <sys/types.h>
9275 #include <stdio.h>
9276 int main() {
9277   long double d = 123.456;
9278   printf("%.3lf\n", d);
9279 }
9280 EOCP
9281         set try
9282         if eval $compile; then
9283                 yyy=`$run ./try`
9284                 case "$yyy" in
9285                 123.456)
9286                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9287                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9288                         echo "We will use %lf."
9289                         ;;
9290                 esac
9291         fi
9292 fi
9293
9294 if $test X"$sPRIfldbl" = X; then
9295         echo "Cannot figure out how to print long doubles." >&4
9296 else
9297         sSCNfldbl=$sPRIfldbl    # expect consistency
9298 fi
9299
9300 $rm -f try try.*
9301
9302 fi # d_longdbl
9303
9304 case "$sPRIfldbl" in
9305 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9306         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9307         d_SCNfldbl="$undef";
9308         ;;
9309 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9310         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9311         d_SCNfldbl="$define";
9312         ;;
9313 esac
9314
9315 : Check how to convert floats to strings.
9316
9317 if test "X$d_Gconvert" = X; then
9318
9319 echo " "
9320 echo "Checking for an efficient way to convert floats to strings."
9321 echo " " > try.c
9322 case "$uselongdouble" in
9323 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9324 esac
9325 case "$d_longdbl" in
9326 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9327 esac
9328 case "$d_PRIgldbl" in
9329 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9330 esac
9331 $cat >>try.c <<EOP
9332 #ifdef TRY_gconvert
9333 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9334 char *myname = "gconvert";
9335 #endif
9336 #ifdef TRY_gcvt
9337 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9338 char *myname = "gcvt";
9339 #endif
9340 #ifdef TRY_qgcvt
9341 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9342 char *myname = "qgcvt";
9343 #define DOUBLETYPE long double
9344 #endif
9345 #ifdef TRY_sprintf
9346 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9347 #ifdef HAS_PRIgldbl
9348 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9349 #else
9350 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9351 #endif
9352 #else
9353 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9354 #endif
9355 char *myname = "sprintf";
9356 #endif
9357
9358 #ifndef DOUBLETYPE
9359 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9360 #define DOUBLETYPE long double
9361 #else
9362 #define DOUBLETYPE double
9363 #endif
9364 #endif
9365
9366 #include <stdio.h>
9367
9368 #define I_STDLIB $i_stdlib
9369 #ifdef I_STDLIB
9370 #include <stdlib.h>
9371 #endif
9372
9373 int
9374 checkit(expect, got)
9375 char *expect;
9376 char *got;
9377 {
9378     if (strcmp(expect, got)) {
9379                 printf("%s oddity:  Expected %s, got %s\n",
9380                         myname, expect, got);
9381                 exit(1);
9382         }
9383 }
9384
9385 int main()
9386
9387         char buf[64]; 
9388         buf[63] = '\0';
9389
9390         /* This must be 1st test on (which?) platform */
9391         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9392         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9393         checkit("0.1", buf);
9394
9395         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9396         checkit("0.01", buf);
9397
9398         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9399         checkit("0.001", buf);
9400
9401         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9402         checkit("0.0001", buf);
9403
9404         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9405         if (strlen(buf) > 5)
9406             checkit("9e-005", buf); /* for Microsoft ?? */
9407         else
9408             checkit("9e-05", buf);
9409
9410         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9411         checkit("1", buf);
9412
9413         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9414         checkit("1.1", buf);
9415
9416         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9417         checkit("1.01", buf);
9418
9419         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9420         checkit("1.001", buf);
9421
9422         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9423         checkit("1.0001", buf);
9424
9425         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9426         checkit("1.00001", buf);
9427
9428         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9429         checkit("1.000001", buf);
9430
9431         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9432         checkit("0", buf);
9433
9434         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9435         checkit("-1", buf);
9436
9437         /* Some Linux gcvt's give 1.e+5 here. */
9438         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9439         checkit("100000", buf);
9440         
9441         /* Some Linux gcvt's give -1.e+5 here. */
9442         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9443         checkit("-100000", buf);
9444
9445         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9446         checkit("123.456", buf);
9447
9448         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9449         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9450         /* 34 should be enough to scare even long double
9451          * places into using the e notation. */
9452         if (strlen(buf) > 5)
9453             checkit("1e+034", buf); /* for Microsoft */
9454         else
9455             checkit("1e+34", buf);
9456
9457         /* For Perl, if you add additional tests here, also add them to
9458          * t/base/num.t for benefit of platforms not using Configure or
9459          * overriding d_Gconvert */
9460
9461         exit(0);
9462 }
9463 EOP
9464 : first add preferred functions to our list
9465 xxx_list=""
9466 for xxx_convert in $gconvert_preference; do
9467     case $xxx_convert in
9468     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9469     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9470     esac 
9471 done
9472 : then add any others
9473 for xxx_convert in gconvert gcvt sprintf; do
9474     case "$xxx_list" in
9475     *$xxx_convert*) ;;
9476     *) xxx_list="$xxx_list $xxx_convert" ;;
9477     esac 
9478 done
9479
9480 case "$d_longdbl$uselongdouble" in
9481 "$define$define")
9482     : again, add prefered functions to our list first
9483     xxx_ld_list=""
9484     for xxx_convert in $gconvert_ld_preference; do
9485         case $xxx_convert in
9486         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9487         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9488         esac
9489     done
9490     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9491     for xxx_convert in qgcvt sprintf $xxx_list; do
9492         case "$xxx_ld_list" in
9493         $xxx_convert*|*" $xxx_convert"*) ;;
9494         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9495         esac
9496     done
9497     : if sprintf cannot do long doubles, move it to the end
9498     if test "$d_PRIgldbl" != "$define"; then
9499         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9500     fi
9501     : if no qgcvt, remove it
9502     if test "$d_qgcvt" != "$define"; then
9503         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9504     fi
9505     : use the ld_list
9506     xxx_list="$xxx_ld_list"
9507     ;;
9508 esac
9509
9510 for xxx_convert in $xxx_list; do
9511         echo "Trying $xxx_convert..."
9512         $rm -f try try$_o
9513         set try -DTRY_$xxx_convert
9514         if eval $compile; then
9515                 echo "$xxx_convert() found." >&4
9516                 if $run ./try; then
9517                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9518                         break;
9519                 else
9520                         echo "...But $xxx_convert didn't work as I expected."
9521                         xxx_convert=''
9522                 fi
9523         else
9524                 echo "$xxx_convert NOT found." >&4
9525         fi
9526 done
9527
9528 if test X$xxx_convert = X; then
9529     echo "*** WHOA THERE!!! ***" >&4
9530     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9531     xxx_convert=sprintf
9532 fi
9533
9534 case "$xxx_convert" in
9535 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9536 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9537 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9538 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9539    "$define$define$define")
9540       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9541    "$define$define$undef")
9542       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9543    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9544    esac
9545    ;;  
9546 esac
9547
9548 fi
9549
9550 : see if _fwalk exists
9551 set fwalk d__fwalk
9552 eval $inlibc
9553
9554 : Initialize h_fcntl
9555 h_fcntl=false
9556
9557 : Initialize h_sysfile
9558 h_sysfile=false
9559
9560 : access call always available on UNIX
9561 set access d_access
9562 eval $inlibc
9563
9564 : locate the flags for 'access()'
9565 case "$d_access" in
9566 "$define")
9567         echo " "
9568         $cat >access.c <<EOCP
9569 #include <sys/types.h>
9570 #ifdef I_FCNTL
9571 #include <fcntl.h>
9572 #endif
9573 #ifdef I_SYS_FILE
9574 #include <sys/file.h>
9575 #endif
9576 #ifdef I_UNISTD
9577 #include <unistd.h>
9578 #endif
9579 #$i_stdlib I_STDLIB
9580 #ifdef I_STDLIB
9581 #include <stdlib.h>
9582 #endif
9583 int main() {
9584         exit(R_OK);
9585 }
9586 EOCP
9587         : check sys/file.h first, no particular reason here
9588         if $test `./findhdr sys/file.h` && \
9589                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9590                 h_sysfile=true;
9591                 echo "<sys/file.h> defines the *_OK access constants." >&4
9592         elif $test `./findhdr fcntl.h` && \
9593                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9594                 h_fcntl=true;
9595                 echo "<fcntl.h> defines the *_OK access constants." >&4
9596         elif $test `./findhdr unistd.h` && \
9597                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9598                 echo "<unistd.h> defines the *_OK access constants." >&4
9599         else
9600                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9601         fi
9602         ;;
9603 esac
9604 $rm -f access*
9605
9606 : see if accessx exists
9607 set accessx d_accessx
9608 eval $inlibc
9609
9610 : see if aintl exists
9611 set aintl d_aintl
9612 eval $inlibc
9613
9614 : see if alarm exists
9615 set alarm d_alarm
9616 eval $inlibc
9617
9618 : see if POSIX threads are available
9619 set pthread.h i_pthread
9620 eval $inhdr
9621
9622 : define a fucntion to check prototypes
9623 $cat > protochk <<EOSH
9624 $startsh
9625 cc="$cc"
9626 optimize="$optimize"
9627 ccflags="$ccflags"
9628 prototype="$prototype"
9629 define="$define"
9630 rm=$rm
9631 usethreads=$usethreads
9632 i_pthread=$i_pthread
9633 pthread_h_first=$pthread_h_first
9634 EOSH
9635
9636 $cat >> protochk <<'EOSH'
9637
9638 $rm -f try.c
9639 foo="$1"
9640 shift
9641 while test $# -ge 2; do
9642         case "$1" in
9643                 $define) echo "#include <$2>" >> try.c ;;
9644                 literal) echo "$2" >> try.c ;;
9645         esac
9646     # Extra magic for the benefit of systems that need pthread.h
9647     # to be included early to correctly detect threadsafe functions.
9648     # Such functions must guarantee themselves, though, that the usethreads
9649     # and i_pthread have been defined, before calling protochk.
9650     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9651         echo "#include <pthread.h>" >> try.c
9652         pthread_h_done=yes
9653     fi
9654     shift 2
9655 done
9656 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9657 cat >> try.c <<'EOCP'
9658 #ifdef CAN_PROTOTYPE
9659 #define _(args) args
9660 #else
9661 #define _(args) ()
9662 #endif
9663 EOCP
9664 echo "$foo" >> try.c
9665 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9666 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9667 status=$?
9668 $rm -f try.[co]
9669 exit $status
9670 EOSH
9671 chmod +x protochk
9672 $eunicefix protochk
9673
9674 hasproto='varname=$1; func=$2; shift; shift;
9675 while $test $# -ge 2; do
9676         case "$1" in
9677         $define) echo "#include <$2>";;
9678         esac ;
9679     shift 2;
9680 done > try.c;
9681 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9682 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9683         echo "$func() prototype found.";
9684         val="$define";
9685 else
9686         echo "$func() prototype NOT found.";
9687         val="$undef";
9688 fi;
9689 set $varname;
9690 eval $setvar;
9691 $rm -f try.c tryout.c'
9692
9693 : see if sys/types.h has to be included
9694 set sys/types.h i_systypes
9695 eval $inhdr
9696
9697 : see if sys/select.h has to be included
9698 set sys/select.h i_sysselct
9699 eval $inhdr
9700
9701 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9702 while $test $# -ge 2; do
9703         case "$1" in
9704         $define) echo "#include <$2>";;
9705         esac ;
9706     shift 2;
9707 done > try.c;
9708 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9709 set try;
9710 if eval $compile; then
9711         val="$define";
9712 else
9713         val="$undef";
9714 fi;
9715 set $varname;
9716 eval $setvar;
9717 $rm -f try.c try.o'
9718
9719 : see if we should include time.h, sys/time.h, or both
9720 echo " "
9721 if test "X$timeincl" = X; then
9722         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9723         $echo $n "I'm now running the test program...$c"
9724         $cat >try.c <<EOCP
9725 #include <sys/types.h>
9726 #ifdef I_TIME
9727 #include <time.h>
9728 #endif
9729 #ifdef I_SYSTIME
9730 #ifdef SYSTIMEKERNEL
9731 #define KERNEL
9732 #endif
9733 #include <sys/time.h>
9734 #endif
9735 #ifdef I_SYSSELECT
9736 #include <sys/select.h>
9737 #endif
9738 #$i_stdlib I_STDLIB
9739 #ifdef I_STDLIB
9740 #include <stdlib.h>
9741 #endif
9742 int main()
9743 {
9744         struct tm foo;
9745 #ifdef S_TIMEVAL
9746         struct timeval bar;
9747 #endif
9748 #ifdef S_TIMEZONE
9749         struct timezone tzp;
9750 #endif
9751         if (foo.tm_sec == foo.tm_sec)
9752                 exit(0);
9753 #ifdef S_TIMEVAL
9754         if (bar.tv_sec == bar.tv_sec)
9755                 exit(0);
9756 #endif
9757         exit(1);
9758 }
9759 EOCP
9760         flags=''
9761         for s_timezone in '-DS_TIMEZONE' ''; do
9762         sysselect=''
9763         for s_timeval in '-DS_TIMEVAL' ''; do
9764         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9765         for i_time in '' '-DI_TIME'; do
9766         for i_systime in '-DI_SYSTIME' ''; do
9767                 case "$flags" in
9768                 '') $echo $n ".$c"
9769                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9770                         if eval $compile; then
9771                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9772                                 shift
9773                                 flags="$*"
9774                                 echo " "
9775                                 $echo $n "Succeeded with $flags$c"
9776                         fi
9777                         ;;
9778                 esac
9779         done
9780         done
9781         done
9782         done
9783         done
9784         timeincl=''
9785         echo " "
9786         case "$flags" in
9787         *SYSTIMEKERNEL*) i_systimek="$define"
9788                 timeincl=`./findhdr sys/time.h`
9789                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9790         *) i_systimek="$undef";;
9791         esac
9792         case "$flags" in
9793         *I_TIME*) i_time="$define"
9794                 timeincl=`./findhdr time.h`" $timeincl"
9795                 echo "We'll include <time.h>." >&4;;
9796         *) i_time="$undef";;
9797         esac
9798         case "$flags" in
9799         *I_SYSTIME*) i_systime="$define"
9800                 timeincl=`./findhdr sys/time.h`" $timeincl"
9801                 echo "We'll include <sys/time.h>." >&4;;
9802         *) i_systime="$undef";;
9803         esac
9804         $rm -f try.c try
9805 fi
9806 : see if struct tm knows about tm_zone
9807 case "$i_systime$i_time" in
9808 *$define*) 
9809         echo " "
9810         echo "Checking to see if your struct tm has tm_zone field..." >&4
9811         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9812         eval $hasfield
9813         ;;
9814 *)      val="$undef"
9815         set d_tm_tm_zone
9816         eval $setvar
9817         ;;
9818 esac
9819 case "$d_tm_tm_zone" in
9820 "$define")      echo "Yes, it does."   ;;
9821 *)              echo "No, it doesn't." ;;
9822 esac
9823 : see if struct tm knows about tm_gmtoff
9824 case "$i_systime$i_time" in
9825 *$define*) 
9826         echo " "
9827         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9828         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9829         eval $hasfield
9830         ;;
9831 *)      val="$undef"
9832         set d_tm_tm_gmtoff
9833         eval $setvar
9834         ;;
9835 esac
9836 case "$d_tm_tm_gmtoff" in
9837 "$define")      echo "Yes, it does."   ;;
9838 *)              echo "No, it doesn't." ;;
9839 esac
9840
9841 : see if asctime_r exists
9842 set asctime_r d_asctime_r
9843 eval $inlibc
9844 case "$d_asctime_r" in
9845 "$define")
9846         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9847         case "$d_asctime_r_proto:$usethreads" in
9848         ":define")      d_asctime_r_proto=define
9849                 set d_asctime_r_proto asctime_r $hdrs
9850                 eval $hasproto ;;
9851         *)      ;;
9852         esac
9853         case "$d_asctime_r_proto" in
9854         define)
9855         case "$asctime_r_proto" in
9856         ''|0) try='char* asctime_r(const struct tm*, char*);'
9857         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9858         esac
9859         case "$asctime_r_proto" in
9860         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9861         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9862         esac
9863         case "$asctime_r_proto" in
9864         ''|0) try='int asctime_r(const struct tm*, char*);'
9865         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9866         esac
9867         case "$asctime_r_proto" in
9868         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9869         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9870         esac
9871         case "$asctime_r_proto" in
9872         ''|0)   d_asctime_r=undef
9873                 asctime_r_proto=0
9874                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9875         * )     case "$asctime_r_proto" in
9876                 REENTRANT_PROTO*) ;;
9877                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9878                 esac
9879                 echo "Prototype: $try" ;;
9880         esac
9881         ;;
9882         *)      case "$usethreads" in
9883                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9884                 esac
9885                 d_asctime_r=undef
9886                 asctime_r_proto=0
9887                 ;;
9888         esac
9889         ;;
9890 *)      asctime_r_proto=0
9891         ;;
9892 esac
9893
9894 : see if atolf exists
9895 set atolf d_atolf
9896 eval $inlibc
9897
9898 : see if atoll exists
9899 set atoll d_atoll
9900 eval $inlibc
9901
9902 : Look for GCC-style attribute format
9903 case "$d_attribute_format" in
9904 '')
9905 echo " "
9906 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9907 $cat >attrib.c <<'EOCP'
9908 #include <stdio.h>
9909 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9910 EOCP
9911 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9912         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9913                 echo "Your C compiler doesn't support __attribute__((format))."
9914                 val="$undef"
9915         else
9916                 echo "Your C compiler supports __attribute__((format))."
9917                 val="$define"
9918         fi
9919 else
9920         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9921         val="$undef"
9922 fi
9923 ;;
9924 *) val="$d_attribute_format" ;;
9925 esac
9926 set d_attribute_format
9927 eval $setvar
9928 $rm -f attrib*
9929
9930 : Look for GCC-style attribute malloc
9931 case "$d_attribute_malloc" in
9932 '')
9933 echo " "
9934 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9935 $cat >attrib.c <<'EOCP'
9936 #include <stdio.h>
9937 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9938 EOCP
9939 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9940         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9941                 echo "Your C compiler doesn't support __attribute__((malloc))."
9942                 val="$undef"
9943         else
9944                 echo "Your C compiler supports __attribute__((malloc))."
9945                 val="$define"
9946         fi
9947 else
9948         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9949         val="$undef"
9950 fi
9951 ;;
9952 *) val="$d_attribute_malloc" ;;
9953 esac
9954 set d_attribute_malloc
9955 eval $setvar
9956 $rm -f attrib*
9957
9958 : Look for GCC-style attribute nonnull
9959 case "$d_attribute_nonnull" in
9960 '')
9961 echo " "
9962 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9963 $cat >attrib.c <<'EOCP'
9964 #include <stdio.h>
9965 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9966 EOCP
9967 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9968         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9969                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9970                 val="$undef"
9971         else
9972                 echo "Your C compiler supports __attribute__((nonnull))."
9973                 val="$define"
9974         fi
9975 else
9976         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9977         val="$undef"
9978 fi
9979 ;;
9980 *) val="$d_attribute_nonnull" ;;
9981 esac
9982 set d_attribute_nonnull
9983 eval $setvar
9984 $rm -f attrib*
9985
9986 : Look for GCC-style attribute noreturn
9987 case "$d_attribute_noreturn" in
9988 '')
9989 echo " "
9990 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9991 $cat >attrib.c <<'EOCP'
9992 #include <stdio.h>
9993 void fall_over_dead( void ) __attribute__((noreturn));
9994 EOCP
9995 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9996         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9997                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9998                 val="$undef"
9999         else
10000                 echo "Your C compiler supports __attribute__((noreturn))."
10001                 val="$define"
10002         fi
10003 else
10004         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10005         val="$undef"
10006 fi
10007 ;;
10008 *) val="$d_attribute_noreturn" ;;
10009 esac
10010 set d_attribute_noreturn
10011 eval $setvar
10012 $rm -f attrib*
10013
10014 : Look for GCC-style attribute pure
10015 case "$d_attribute_pure" in
10016 '')
10017 echo " "
10018 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10019 $cat >attrib.c <<'EOCP'
10020 #include <stdio.h>
10021 int square( int n ) __attribute__((pure));
10022 EOCP
10023 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10024         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10025                 echo "Your C compiler doesn't support __attribute__((pure))."
10026                 val="$undef"
10027         else
10028                 echo "Your C compiler supports __attribute__((pure))."
10029                 val="$define"
10030         fi
10031 else
10032         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10033         val="$undef"
10034 fi
10035 ;;
10036 *) val="$d_attribute_pure" ;;
10037 esac
10038 set d_attribute_pure
10039 eval $setvar
10040 $rm -f attrib*
10041
10042 : Look for GCC-style attribute unused
10043 case "$d_attribute_unused" in
10044 '')
10045 echo " "
10046 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10047 $cat >attrib.c <<'EOCP'
10048 #include <stdio.h>
10049 int do_something( int dummy __attribute__((unused)), int n );
10050 EOCP
10051 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10052         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10053                 echo "Your C compiler doesn't support __attribute__((unused))."
10054                 val="$undef"
10055         else
10056                 echo "Your C compiler supports __attribute__((unused))."
10057                 val="$define"
10058         fi
10059 else
10060         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10061         val="$undef"
10062 fi
10063 ;;
10064 *) val="$d_attribute_unused" ;;
10065 esac
10066 set d_attribute_unused
10067 eval $setvar
10068 $rm -f attrib*
10069
10070 : Look for GCC-style attribute warn_unused_result
10071 case "$d_attribute_warn_unused_result" in
10072 '')
10073 echo " "
10074 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10075 $cat >attrib.c <<'EOCP'
10076 #include <stdio.h>
10077 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10078 EOCP
10079 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10080         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10081                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10082                 val="$undef"
10083         else
10084                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10085                 val="$define"
10086         fi
10087 else
10088         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10089         val="$undef"
10090 fi
10091 ;;
10092 *) val="$d_attribute_warn_unused_result" ;;
10093 esac
10094 set d_attribute_warn_unused_result
10095 eval $setvar
10096 $rm -f attrib*
10097
10098 : see if bcmp exists
10099 set bcmp d_bcmp
10100 eval $inlibc
10101
10102 : see if bcopy exists
10103 set bcopy d_bcopy
10104 eval $inlibc
10105
10106 : see if this is a unistd.h system
10107 set unistd.h i_unistd
10108 eval $inhdr
10109
10110 : see if getpgrp exists
10111 set getpgrp d_getpgrp
10112 eval $inlibc
10113
10114 case "$d_getpgrp" in
10115 "$define")
10116         echo " "
10117         echo "Checking to see which flavor of getpgrp is in use..."
10118         $cat >try.c <<EOP
10119 #$i_unistd I_UNISTD
10120 #include <sys/types.h>
10121 #ifdef I_UNISTD
10122 #  include <unistd.h>
10123 #endif
10124 #$i_stdlib I_STDLIB
10125 #ifdef I_STDLIB
10126 #include <stdlib.h>
10127 #endif
10128 int main()
10129 {
10130         if (getuid() == 0) {
10131                 printf("(I see you are running Configure as super-user...)\n");
10132                 setuid(1);
10133         }
10134 #ifdef TRY_BSD_PGRP
10135         if (getpgrp(1) == 0)
10136                 exit(0);
10137 #else
10138         if (getpgrp() > 0)
10139                 exit(0);
10140 #endif
10141         exit(1);
10142 }
10143 EOP
10144         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10145                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10146                 val="$define"
10147         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10148                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10149                 val="$undef"
10150         else
10151                 echo "I can't seem to compile and run the test program."
10152                 if ./usg; then
10153                         xxx="a USG one, i.e. you use getpgrp()."
10154                 else
10155                         # SVR4 systems can appear rather BSD-ish.
10156                         case "$i_unistd" in
10157                         $undef)
10158                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10159                                 val="$define"
10160                                 ;;
10161                         $define)
10162                                 xxx="probably a USG one, i.e. you use getpgrp()."
10163                                 val="$undef"
10164                                 ;;
10165                         esac
10166                 fi
10167                 echo "Assuming your getpgrp is $xxx" >&4
10168         fi
10169         ;;
10170 *) val="$undef";;
10171 esac
10172 set d_bsdgetpgrp
10173 eval $setvar
10174 $rm -f try try.*
10175
10176 : see if setpgrp exists
10177 set setpgrp d_setpgrp
10178 eval $inlibc
10179
10180 case "$d_setpgrp" in
10181 "$define")
10182         echo " "
10183         echo "Checking to see which flavor of setpgrp is in use..."
10184         $cat >try.c <<EOP
10185 #$i_unistd I_UNISTD
10186 #include <sys/types.h>
10187 #ifdef I_UNISTD
10188 #  include <unistd.h>
10189 #endif
10190 #$i_stdlib I_STDLIB
10191 #ifdef I_STDLIB
10192 #include <stdlib.h>
10193 #endif
10194 int main()
10195 {
10196         if (getuid() == 0) {
10197                 printf("(I see you are running Configure as super-user...)\n");
10198                 setuid(1);
10199         }
10200 #ifdef TRY_BSD_PGRP
10201         if (-1 == setpgrp(1, 1))
10202                 exit(0);
10203 #else
10204         if (setpgrp() != -1)
10205                 exit(0);
10206 #endif
10207         exit(1);
10208 }
10209 EOP
10210         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10211                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10212                 val="$define"
10213         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10214                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10215                 val="$undef"
10216         else
10217                 echo "(I can't seem to compile and run the test program.)"
10218                 if ./usg; then
10219                         xxx="a USG one, i.e. you use setpgrp()."
10220                 else
10221                         # SVR4 systems can appear rather BSD-ish.
10222                         case "$i_unistd" in
10223                         $undef)
10224                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10225                                 val="$define"
10226                                 ;;
10227                         $define)
10228                                 xxx="probably a USG one, i.e. you use setpgrp()."
10229                                 val="$undef"
10230                                 ;;
10231                         esac
10232                 fi
10233                 echo "Assuming your setpgrp is $xxx" >&4
10234         fi
10235         ;;
10236 *) val="$undef";;
10237 esac
10238 set d_bsdsetpgrp
10239 eval $setvar
10240 $rm -f try try.*
10241 : see if bzero exists
10242 set bzero d_bzero
10243 eval $inlibc
10244
10245 : see if signal is declared as pointer to function returning int or void
10246 echo " "
10247 xxx=`./findhdr signal.h`
10248 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10249 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10250         echo "You have int (*signal())() instead of void." >&4
10251         val="$undef"
10252 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10253         echo "You have void (*signal())()." >&4
10254         val="$define"
10255 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10256         echo "You have int (*signal())() instead of void." >&4
10257         val="$undef"
10258 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10259         echo "You have void (*signal())()." >&4
10260         val="$define"
10261 else
10262         case "$d_voidsig" in
10263         '')
10264         echo "I can't determine whether signal handler returns void or int..." >&4
10265                 dflt=void
10266                 rp="What type does your signal handler return?"
10267                 . ./myread
10268                 case "$ans" in
10269                 v*) val="$define";;
10270                 *) val="$undef";;
10271                 esac;;
10272         "$define")
10273                 echo "As you already told me, signal handler returns void." >&4
10274                 val="$define"
10275                 ;;
10276         *)      echo "As you already told me, signal handler returns int." >&4
10277                 val="$undef"
10278                 ;;
10279         esac
10280 fi
10281 set d_voidsig
10282 eval $setvar
10283 case "$d_voidsig" in
10284 "$define") signal_t="void";;
10285 *) signal_t="int";;
10286 esac
10287 $rm -f $$.tmp
10288
10289 : check for ability to cast large floats to 32-bit ints.
10290 echo " "
10291 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10292 if $test "$intsize" -ge 4; then
10293         xxx=int
10294 else
10295         xxx=long
10296 fi
10297 $cat >try.c <<EOCP
10298 #include <stdio.h>
10299 #$i_stdlib I_STDLIB
10300 #ifdef I_STDLIB
10301 #include <stdlib.h>
10302 #endif
10303 #include <sys/types.h>
10304 #include <signal.h>
10305 $signal_t blech(s) int s; { exit(3); }
10306 int main()
10307 {
10308         $xxx i32;
10309         double f, g;
10310         int result = 0;
10311         char str[16];
10312         signal(SIGFPE, blech);
10313
10314         /* Don't let compiler optimize the test away.  Store the number 
10315            in a writable string for gcc to pass to sscanf under HP/UX.
10316         */
10317         sprintf(str, "2147483647");
10318         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10319         g = 10 * f;
10320         i32  = ($xxx) g;
10321
10322         /* x86 processors will probably give 0x8000 0000, which is a
10323            sign change.  We don't want that.  We want to mimic SPARC
10324            behavior here, which is to preserve the sign and give
10325            back 0x7fff ffff.
10326         */
10327         if (i32 != ($xxx) f)
10328                 result |= 1;
10329         exit(result);
10330 }
10331 EOCP
10332 set try
10333 if eval $compile_ok; then
10334         $run ./try
10335         yyy=$?
10336 else
10337         echo "(I can't seem to compile the test program--assuming it can't)"
10338         yyy=1
10339 fi
10340 case "$yyy" in
10341 0)      val="$define"
10342         echo "Yup, it can."
10343         ;;
10344 *)      val="$undef"
10345         echo "Nope, it can't."
10346         ;;
10347 esac
10348 set d_casti32
10349 eval $setvar
10350 $rm -f try try.*
10351
10352 : check for ability to cast negative floats to unsigned
10353 echo " "
10354 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10355 $cat >try.c <<EOCP
10356 #include <stdio.h>
10357 #$i_stdlib I_STDLIB
10358 #ifdef I_STDLIB
10359 #include <stdlib.h>
10360 #endif
10361 #include <sys/types.h>
10362 #include <signal.h>
10363 $signal_t blech(s) int s; { exit(7); }
10364 $signal_t blech_in_list(s) int s; { exit(4); }
10365 unsigned long dummy_long(p) unsigned long p; { return p; }
10366 unsigned int dummy_int(p) unsigned int p; { return p; }
10367 unsigned short dummy_short(p) unsigned short p; { return p; }
10368 int main()
10369 {
10370         double f;
10371         unsigned long along;
10372         unsigned int aint;
10373         unsigned short ashort;
10374         int result = 0;
10375         char str[16];
10376         
10377         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10378            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10379            optimized the whole file away
10380         */
10381         /* Store the number in a writable string for gcc to pass to 
10382            sscanf under HP/UX.
10383         */
10384         sprintf(str, "-123");
10385         sscanf(str, "%lf", &f);  /* f = -123.; */
10386
10387         signal(SIGFPE, blech);
10388         along = (unsigned long)f;
10389         aint = (unsigned int)f;
10390         ashort = (unsigned short)f;
10391         if (along != (unsigned long)-123)
10392                 result |= 1;
10393         if (aint != (unsigned int)-123)
10394                 result |= 1;
10395         if (ashort != (unsigned short)-123)
10396                 result |= 1;
10397         sprintf(str, "1073741824.");
10398         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10399         f = f + f;
10400         along = 0;
10401         along = (unsigned long)f;
10402         if (along != 0x80000000)
10403                 result |= 2;
10404         f -= 1.;
10405         along = 0;
10406         along = (unsigned long)f;
10407         if (along != 0x7fffffff)
10408                 result |= 1;
10409         f += 2.;
10410         along = 0;
10411         along = (unsigned long)f;
10412         if (along != 0x80000001)
10413                 result |= 2;
10414         if (result)
10415                 exit(result);
10416         signal(SIGFPE, blech_in_list);
10417         sprintf(str, "123.");
10418         sscanf(str, "%lf", &f);  /* f = 123.; */
10419         along = dummy_long((unsigned long)f);
10420         aint = dummy_int((unsigned int)f);
10421         ashort = dummy_short((unsigned short)f);
10422         if (along != (unsigned long)123)
10423                 result |= 4;
10424         if (aint != (unsigned int)123)
10425                 result |= 4;
10426         if (ashort != (unsigned short)123)
10427                 result |= 4;
10428         exit(result);
10429
10430 }
10431 EOCP
10432 set try
10433 if eval $compile_ok; then
10434         $run ./try
10435         castflags=$?
10436 else
10437         echo "(I can't seem to compile the test program--assuming it can't)"
10438         castflags=7
10439 fi
10440 case "$castflags" in
10441 0)      val="$define"
10442         echo "Yup, it can."
10443         ;;
10444 *)      val="$undef"
10445         echo "Nope, it can't."
10446         ;;
10447 esac
10448 set d_castneg
10449 eval $setvar
10450 $rm -f try.*
10451
10452 : see if vprintf exists
10453 echo " "
10454 if set vprintf val -f d_vprintf; eval $csym; $val; then
10455         echo 'vprintf() found.' >&4
10456         val="$define"
10457         $cat >try.c <<EOF
10458 #include <varargs.h>
10459 #$i_stdlib I_STDLIB
10460 #ifdef I_STDLIB
10461 #include <stdlib.h>
10462 #endif
10463
10464 int main() { xxx("foo"); }
10465
10466 xxx(va_alist)
10467 va_dcl
10468 {
10469         va_list args;
10470         char buf[10];
10471
10472         va_start(args);
10473         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10474 }
10475 EOF
10476         set try
10477         if eval $compile && $run ./try; then
10478                 echo "Your vsprintf() returns (int)." >&4
10479                 val2="$undef"
10480         else
10481                 echo "Your vsprintf() returns (char*)." >&4
10482                 val2="$define"
10483         fi
10484 else
10485         echo 'vprintf() NOT found.' >&4
10486                 val="$undef"
10487                 val2="$undef"
10488 fi
10489 $rm -f try try.*
10490 set d_vprintf
10491 eval $setvar
10492 val=$val2
10493 set d_charvspr
10494 eval $setvar
10495
10496 : see if chown exists
10497 set chown d_chown
10498 eval $inlibc
10499
10500 : see if chroot exists
10501 set chroot d_chroot
10502 eval $inlibc
10503
10504 : see if chsize exists
10505 set chsize d_chsize
10506 eval $inlibc
10507
10508 : see if class exists
10509 set class d_class
10510 eval $inlibc
10511
10512 : see if clearenv exists
10513 set clearenv d_clearenv
10514 eval $inlibc
10515
10516 hasstruct='varname=$1; struct=$2; shift; shift;
10517 while $test $# -ge 2; do
10518         case "$1" in
10519         $define) echo "#include <$2>";;
10520         esac ;
10521     shift 2;
10522 done > try.c;
10523 echo "int main () { struct $struct foo; }" >> try.c;
10524 set try;
10525 if eval $compile; then
10526         val="$define";
10527 else
10528         val="$undef";
10529 fi;
10530 set $varname;
10531 eval $setvar;
10532 $rm -f try.c try.o'
10533
10534 socketlib=''
10535 sockethdr=''
10536 : see whether socket exists
10537 echo " "
10538 $echo $n "Hmm... $c" >&4
10539 if set socket val -f d_socket; eval $csym; $val; then
10540         echo "Looks like you have Berkeley networking support." >&4
10541         d_socket="$define"
10542         if set setsockopt val -f; eval $csym; $val; then
10543                 d_oldsock="$undef"
10544         else
10545                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10546                 d_oldsock="$define"
10547         fi
10548 else
10549         if $contains socklib libc.list >/dev/null 2>&1; then
10550                 echo "Looks like you have Berkeley networking support." >&4
10551                 d_socket="$define"
10552                 : we will have to assume that it supports the 4.2 BSD interface
10553                 d_oldsock="$undef"
10554         else
10555                 echo "You don't have Berkeley networking in libc$_a..." >&4
10556                 if test "X$d_socket" = "X$define"; then
10557                    echo "...but you seem to believe that you have sockets." >&4
10558                 else
10559                         for net in net socket
10560                         do
10561                                 if test -f /usr/lib/lib$net$_a; then
10562                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10563                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10564                                         if $contains socket libc.list >/dev/null 2>&1; then
10565                                                 d_socket="$define"
10566                                                 socketlib="-l$net"
10567                                                 case "$net" in
10568                                                 net)
10569                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10570                                                         sockethdr="-I/usr/netinclude"
10571                                                         ;;
10572                                                 esac
10573                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10574                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10575                                                         d_oldsock="$undef"
10576                                                 else
10577                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10578                                                         d_oldsock="$define"
10579                                                 fi
10580                                                 break
10581                                         fi
10582                                 fi
10583                         done
10584                         if test "X$d_socket" != "X$define"; then
10585                            echo "or anywhere else I see." >&4
10586                            d_socket="$undef"
10587                            d_oldsock="$undef"
10588                         fi
10589                 fi
10590         fi
10591 fi
10592
10593 : see if socketpair exists
10594 set socketpair d_sockpair
10595 eval $inlibc
10596
10597
10598 echo " "
10599 echo "Checking the availability of certain socket constants..." >&4
10600 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10601         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10602         $cat >try.c <<EOF
10603 #include <sys/types.h>
10604 #include <sys/socket.h>
10605 int main() {
10606     int i = $ENUM;
10607 }
10608 EOF
10609         val="$undef"
10610         set try; if eval $compile; then
10611                 val="$define"
10612         fi
10613         set d_${enum}; eval $setvar
10614         $rm -f try.c try
10615 done
10616
10617 : see if this is a sys/uio.h system
10618 set sys/uio.h i_sysuio
10619 eval $inhdr
10620
10621
10622 echo " "
10623 echo "Checking to see if your system supports struct cmsghdr..." >&4
10624 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10625 eval $hasstruct
10626 case "$d_cmsghdr_s" in
10627 "$define")      echo "Yes, it does."   ;;
10628 *)              echo "No, it doesn't." ;;
10629 esac
10630
10631
10632 : check for const keyword
10633 echo " "
10634 echo 'Checking to see if your C compiler knows about "const"...' >&4
10635 $cat >const.c <<'EOCP'
10636 typedef struct spug { int drokk; } spug;
10637 int main()
10638 {
10639         const char *foo;
10640         const spug y;
10641 }
10642 EOCP
10643 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10644         val="$define"
10645         echo "Yup, it does."
10646 else
10647         val="$undef"
10648         echo "Nope, it doesn't."
10649 fi
10650 set d_const
10651 eval $setvar
10652
10653 : see if copysignl exists
10654 set copysignl d_copysignl
10655 eval $inlibc
10656
10657 : see if crypt exists
10658 echo " "
10659 set crypt d_crypt
10660 eval $inlibc
10661 case "$d_crypt" in
10662 $define) cryptlib='' ;;
10663 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10664                 echo 'crypt() found.' >&4
10665                 val="$define"
10666                 cryptlib=''
10667         else
10668                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10669                 if $test -z "$cryptlib"; then
10670                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10671                 else
10672                         cryptlib=-lcrypt
10673                 fi
10674                 if $test -z "$cryptlib"; then
10675                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10676                 else
10677                         cryptlib=-lcrypt
10678                 fi
10679                 if $test -z "$cryptlib"; then
10680                         cryptlib=`./loc libcrypt$_a "" $libpth`
10681                 else
10682                         cryptlib=-lcrypt
10683                 fi
10684                 if $test -z "$cryptlib"; then
10685                         echo 'crypt() NOT found.' >&4
10686                         val="$undef"
10687                 else
10688                         val="$define"
10689                 fi
10690         fi
10691         set d_crypt
10692         eval $setvar
10693         ;;
10694 esac
10695
10696 : see if this is a crypt.h system
10697 set crypt.h i_crypt
10698 eval $inhdr
10699
10700 : see if crypt_r exists
10701 set crypt_r d_crypt_r
10702 eval $inlibc
10703 case "$d_crypt_r" in
10704 "$define")
10705         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10706         case "$d_crypt_r_proto:$usethreads" in
10707         ":define")      d_crypt_r_proto=define
10708                 set d_crypt_r_proto crypt_r $hdrs
10709                 eval $hasproto ;;
10710         *)      ;;
10711         esac
10712         case "$d_crypt_r_proto" in
10713         define)
10714         case "$crypt_r_proto" in
10715         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10716         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10717         esac
10718         case "$crypt_r_proto" in
10719         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10720         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10721         esac
10722         case "$crypt_r_proto" in
10723         ''|0)   d_crypt_r=undef
10724                 crypt_r_proto=0
10725                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10726         * )     case "$crypt_r_proto" in
10727                 REENTRANT_PROTO*) ;;
10728                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10729                 esac
10730                 echo "Prototype: $try" ;;
10731         esac
10732         ;;
10733         *)      case "$usethreads" in
10734                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10735                 esac
10736                 d_crypt_r=undef
10737                 crypt_r_proto=0
10738                 ;;
10739         esac
10740         ;;
10741 *)      crypt_r_proto=0
10742         ;;
10743 esac
10744
10745 : get csh whereabouts
10746 case "$csh" in
10747 'csh') val="$undef" ;;
10748 *) val="$define" ;;
10749 esac
10750 set d_csh
10751 eval $setvar
10752 : Respect a hint or command line value for full_csh.
10753 case "$full_csh" in
10754 '') full_csh=$csh ;;
10755 esac
10756
10757 : see if ctermid_r exists
10758 set ctermid_r d_ctermid_r
10759 eval $inlibc
10760 case "$d_ctermid_r" in
10761 "$define")
10762         hdrs="$i_systypes sys/types.h define stdio.h "
10763         case "$d_ctermid_r_proto:$usethreads" in
10764         ":define")      d_ctermid_r_proto=define
10765                 set d_ctermid_r_proto ctermid_r $hdrs
10766                 eval $hasproto ;;
10767         *)      ;;
10768         esac
10769         case "$d_ctermid_r_proto" in
10770         define)
10771         case "$ctermid_r_proto" in
10772         ''|0) try='char* ctermid_r(char*);'
10773         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10774         esac
10775         case "$ctermid_r_proto" in
10776         ''|0)   d_ctermid_r=undef
10777                 ctermid_r_proto=0
10778                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10779         * )     case "$ctermid_r_proto" in
10780                 REENTRANT_PROTO*) ;;
10781                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10782                 esac
10783                 echo "Prototype: $try" ;;
10784         esac
10785         ;;
10786         *)      case "$usethreads" in
10787                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10788                 esac
10789                 d_ctermid_r=undef
10790                 ctermid_r_proto=0
10791                 ;;
10792         esac
10793         ;;
10794 *)      ctermid_r_proto=0
10795         ;;
10796 esac
10797
10798 : see if ctime_r exists
10799 set ctime_r d_ctime_r
10800 eval $inlibc
10801 case "$d_ctime_r" in
10802 "$define")
10803         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10804         case "$d_ctime_r_proto:$usethreads" in
10805         ":define")      d_ctime_r_proto=define
10806                 set d_ctime_r_proto ctime_r $hdrs
10807                 eval $hasproto ;;
10808         *)      ;;
10809         esac
10810         case "$d_ctime_r_proto" in
10811         define)
10812         case "$ctime_r_proto" in
10813         ''|0) try='char* ctime_r(const time_t*, char*);'
10814         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10815         esac
10816         case "$ctime_r_proto" in
10817         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10818         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10819         esac
10820         case "$ctime_r_proto" in
10821         ''|0) try='int ctime_r(const time_t*, char*);'
10822         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10823         esac
10824         case "$ctime_r_proto" in
10825         ''|0) try='int ctime_r(const time_t*, char*, int);'
10826         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10827         esac
10828         case "$ctime_r_proto" in
10829         ''|0)   d_ctime_r=undef
10830                 ctime_r_proto=0
10831                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10832         * )     case "$ctime_r_proto" in
10833                 REENTRANT_PROTO*) ;;
10834                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10835                 esac
10836                 echo "Prototype: $try" ;;
10837         esac
10838         ;;
10839         *)      case "$usethreads" in
10840                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10841                 esac
10842                 d_ctime_r=undef
10843                 ctime_r_proto=0
10844                 ;;
10845         esac
10846         ;;
10847 *)      ctime_r_proto=0
10848         ;;
10849 esac
10850
10851 : see if cuserid exists
10852 set cuserid d_cuserid
10853 eval $inlibc
10854
10855 : see if this is a limits.h system
10856 set limits.h i_limits
10857 eval $inhdr
10858
10859 : see if this is a float.h system
10860 set float.h i_float
10861 eval $inhdr
10862
10863 : See if number of significant digits in a double precision number is known
10864 echo " "
10865 $cat >dbl_dig.c <<EOM
10866 #$i_limits I_LIMITS
10867 #$i_float I_FLOAT
10868 #ifdef I_LIMITS
10869 #include <limits.h>
10870 #endif
10871 #ifdef I_FLOAT
10872 #include <float.h>
10873 #endif
10874 #ifdef DBL_DIG
10875 printf("Contains DBL_DIG");
10876 #endif
10877 EOM
10878 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10879 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10880         echo "DBL_DIG found." >&4
10881         val="$define"
10882 else
10883         echo "DBL_DIG NOT found." >&4
10884         val="$undef"
10885 fi
10886 $rm -f dbl_dig.?
10887 set d_dbl_dig
10888 eval $setvar
10889
10890 : see if dbm.h is available
10891 : see if dbmclose exists
10892 set dbmclose d_dbmclose
10893 eval $inlibc
10894
10895 case "$d_dbmclose" in
10896 $define)
10897         set dbm.h i_dbm
10898         eval $inhdr
10899         case "$i_dbm" in
10900         $define)
10901                 val="$undef"
10902                 set i_rpcsvcdbm
10903                 eval $setvar
10904                 ;;
10905         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10906                 eval $inhdr
10907                 ;;
10908         esac
10909         ;;
10910 *)      echo "We won't be including <dbm.h>"
10911         val="$undef"
10912         set i_dbm
10913         eval $setvar
10914         val="$undef"
10915         set i_rpcsvcdbm
10916         eval $setvar
10917         ;;
10918 esac
10919
10920 : see if prototype for dbminit is available
10921 echo " "
10922 set d_dbminitproto dbminit $i_dbm dbm.h
10923 eval $hasproto
10924
10925 : see if difftime exists
10926 set difftime d_difftime
10927 eval $inlibc
10928
10929 : see if this is a dirent system
10930 echo " "
10931 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10932         val="$define"
10933         echo "<dirent.h> found." >&4
10934 else
10935         val="$undef"
10936         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10937                 echo "<sys/dir.h> found." >&4
10938                 echo " "
10939         else
10940                 xinc=`./findhdr sys/ndir.h`
10941         fi
10942         echo "<dirent.h> NOT found." >&4
10943 fi
10944 set i_dirent
10945 eval $setvar
10946
10947 : Look for type of directory structure.
10948 echo " "
10949 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10950
10951 case "$direntrytype" in
10952 ''|' ')
10953         case "$i_dirent" in
10954         $define) guess1='struct dirent' ;;
10955         *) guess1='struct direct'  ;;
10956         esac
10957         ;;
10958 *)      guess1="$direntrytype"
10959         ;;
10960 esac
10961
10962 case "$guess1" in
10963 'struct dirent') guess2='struct direct' ;;
10964 *) guess2='struct dirent' ;;
10965 esac
10966                 
10967 if $contains "$guess1" try.c >/dev/null 2>&1; then
10968         direntrytype="$guess1"
10969         echo "Your directory entries are $direntrytype." >&4
10970 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10971         direntrytype="$guess2"
10972         echo "Your directory entries seem to be $direntrytype." >&4
10973 else
10974         echo "I don't recognize your system's directory entries." >&4
10975         rp="What type is used for directory entries on this system?"
10976         dflt="$guess1"
10977         . ./myread
10978         direntrytype="$ans"
10979 fi
10980 $rm -f try.c
10981
10982
10983 : see if the directory entry stores field length
10984 echo " "
10985 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10986 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10987         echo "Good, your directory entry keeps length information in d_namlen." >&4
10988         val="$define"
10989 else
10990         echo "Your directory entry does not know about the d_namlen field." >&4
10991         val="$undef"
10992 fi
10993 set d_dirnamlen
10994 eval $setvar
10995 $rm -f try.c
10996
10997 : see if this is an sysdir system
10998 set sys/dir.h i_sysdir
10999 eval $inhdr
11000
11001 : see if this is an sysndir system
11002 set sys/ndir.h i_sysndir
11003 eval $inhdr
11004
11005 : Look for dirfd
11006 echo " "
11007 $cat >dirfd.c <<EOM
11008 #include <stdio.h>
11009 #$i_stdlib I_STDLIB
11010 #ifdef I_STDLIB
11011 #include <stdlib.h>
11012 #endif
11013 #$i_dirent I_DIRENT             /**/
11014 #$i_sysdir I_SYS_DIR            /**/
11015 #$i_sysndir I_SYS_NDIR          /**/
11016 #$i_systypes I_SYS_TYPES        /**/
11017 #if defined(I_SYS_TYPES)
11018 #include <sys/types.h>
11019 #endif
11020 #if defined(I_DIRENT)
11021 #include <dirent.h>
11022 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11023 #include <sys/dir.h>
11024 #endif
11025 #else
11026 #ifdef I_SYS_NDIR
11027 #include <sys/ndir.h>
11028 #else
11029 #ifdef I_SYS_DIR
11030 #ifdef hp9000s500
11031 #include <ndir.h>       /* may be wrong in the future */
11032 #else
11033 #include <sys/dir.h>
11034 #endif
11035 #endif
11036 #endif
11037 #endif 
11038 int main() {
11039         DIR *dirp = opendir(".");
11040         if (dirfd(dirp) >= 0)
11041                 exit(0);
11042         else
11043                 exit(1);
11044 }
11045 EOM
11046 val=$undef
11047 set dirfd
11048 if eval $compile; then
11049         val="$define"
11050 fi
11051 case "$val" in
11052 $define)        echo "dirfd() found." >&4       ;;
11053 *)              echo "dirfd() NOT found." >&4   ;;
11054 esac
11055 set d_dirfd
11056 eval $setvar
11057 $rm -f dirfd*
11058
11059 : see if dlerror exists
11060 xxx_runnm="$runnm"
11061 runnm=false
11062 set dlerror d_dlerror
11063 eval $inlibc
11064 runnm="$xxx_runnm"
11065
11066 : see if dlfcn is available
11067 set dlfcn.h i_dlfcn
11068 eval $inhdr
11069
11070 case "$usedl" in
11071 $define|y|true)
11072         $cat << EOM
11073
11074 On a few systems, the dynamically loaded modules that perl generates and uses
11075 will need a different extension than shared libs. The default will probably
11076 be appropriate.
11077
11078 EOM
11079         case "$dlext" in
11080         '')     dflt="$so" ;;
11081         *)      dflt="$dlext" ;;
11082         esac
11083         rp='What is the extension of dynamically loaded modules'
11084         . ./myread
11085         dlext="$ans"
11086         ;;
11087 *)
11088         dlext="none"
11089         ;;
11090 esac
11091
11092 : Check if dlsym need a leading underscore
11093 echo " "
11094 val="$undef"
11095
11096 case "$dlsrc" in
11097 dl_dlopen.xs)
11098         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11099         $cat >dyna.c <<'EOM'
11100 fred () { }
11101 EOM
11102
11103 $cat >fred.c<<EOM
11104
11105 #include <stdio.h>
11106 #$i_stdlib I_STDLIB
11107 #ifdef I_STDLIB
11108 #include <stdlib.h>
11109 #endif
11110 #$i_dlfcn I_DLFCN
11111 #ifdef I_DLFCN
11112 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11113 #else
11114 #include <sys/types.h>
11115 #include <nlist.h>
11116 #include <link.h>
11117 #endif
11118
11119 extern int fred() ;
11120
11121 int main()
11122 {
11123     void * handle ;
11124     void * symbol ;
11125 #ifndef RTLD_LAZY
11126     int mode = 1 ;
11127 #else
11128     int mode = RTLD_LAZY ;
11129 #endif
11130     handle = dlopen("./dyna.$dlext", mode) ;
11131     if (handle == NULL) {
11132         printf ("1\n") ;
11133         fflush (stdout) ;
11134         exit(0);
11135     }
11136     symbol = dlsym(handle, "fred") ;
11137     if (symbol == NULL) {
11138         /* try putting a leading underscore */
11139         symbol = dlsym(handle, "_fred") ;
11140         if (symbol == NULL) {
11141             printf ("2\n") ;
11142             fflush (stdout) ;
11143             exit(0);
11144         }
11145         printf ("3\n") ;
11146     }
11147     else
11148         printf ("4\n") ;
11149     fflush (stdout) ;
11150     exit(0);
11151 }
11152 EOM
11153         : Call the object file tmp-dyna.o in case dlext=o.
11154         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11155                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11156                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11157                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11158                 xxx=`$run ./fred`
11159                 case $xxx in
11160                 1)      echo "Test program failed using dlopen." >&4
11161                         echo "Perhaps you should not use dynamic loading." >&4;;
11162                 2)      echo "Test program failed using dlsym." >&4
11163                         echo "Perhaps you should not use dynamic loading." >&4;;
11164                 3)      echo "dlsym needs a leading underscore" >&4
11165                         val="$define" ;;
11166                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11167                 esac
11168         else
11169                 echo "I can't compile and run the test program." >&4
11170                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11171         fi
11172         ;;
11173 esac
11174                 
11175 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11176
11177 set d_dlsymun
11178 eval $setvar
11179
11180 : see if drand48_r exists
11181 set drand48_r d_drand48_r
11182 eval $inlibc
11183 case "$d_drand48_r" in
11184 "$define")
11185         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11186         case "$d_drand48_r_proto:$usethreads" in
11187         ":define")      d_drand48_r_proto=define
11188                 set d_drand48_r_proto drand48_r $hdrs
11189                 eval $hasproto ;;
11190         *)      ;;
11191         esac
11192         case "$d_drand48_r_proto" in
11193         define)
11194         case "$drand48_r_proto" in
11195         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11196         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11197         esac
11198         case "$drand48_r_proto" in
11199         ''|0)   d_drand48_r=undef
11200                 drand48_r_proto=0
11201                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11202         * )     case "$drand48_r_proto" in
11203                 REENTRANT_PROTO*) ;;
11204                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11205                 esac
11206                 echo "Prototype: $try" ;;
11207         esac
11208         ;;
11209         *)      case "$usethreads" in
11210                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11211                 esac
11212                 d_drand48_r=undef
11213                 drand48_r_proto=0
11214                 ;;
11215         esac
11216         ;;
11217 *)      drand48_r_proto=0
11218         ;;
11219 esac
11220
11221 : see if prototype for drand48 is available
11222 echo " "
11223 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11224 eval $hasproto
11225
11226 : see if dup2 exists
11227 set dup2 d_dup2
11228 eval $inlibc
11229
11230 : see if eaccess exists
11231 set eaccess d_eaccess
11232 eval $inlibc
11233
11234 : see if endgrent exists
11235 set endgrent d_endgrent
11236 eval $inlibc
11237
11238 : see if this is an grp system
11239 set grp.h i_grp
11240 eval $inhdr
11241
11242 case "$i_grp" in
11243 $define)
11244         xxx=`./findhdr grp.h`
11245         $cppstdin $cppflags $cppminus < $xxx >$$.h
11246
11247         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11248                 val="$define"
11249         else
11250                 val="$undef"
11251         fi
11252         set d_grpasswd
11253         eval $setvar
11254
11255         $rm -f $$.h
11256         ;;
11257 *)
11258         val="$undef";
11259         set d_grpasswd; eval $setvar
11260         ;;
11261 esac
11262
11263 : see if endgrent_r exists
11264 set endgrent_r d_endgrent_r
11265 eval $inlibc
11266 case "$d_endgrent_r" in
11267 "$define")
11268         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11269         case "$d_endgrent_r_proto:$usethreads" in
11270         ":define")      d_endgrent_r_proto=define
11271                 set d_endgrent_r_proto endgrent_r $hdrs
11272                 eval $hasproto ;;
11273         *)      ;;
11274         esac
11275         case "$d_endgrent_r_proto" in
11276         define)
11277         case "$endgrent_r_proto" in
11278         ''|0) try='int endgrent_r(FILE**);'
11279         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11280         esac
11281         case "$endgrent_r_proto" in
11282         ''|0) try='void endgrent_r(FILE**);'
11283         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11284         esac
11285         case "$endgrent_r_proto" in
11286         ''|0)   d_endgrent_r=undef
11287                 endgrent_r_proto=0
11288                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11289         * )     case "$endgrent_r_proto" in
11290                 REENTRANT_PROTO*) ;;
11291                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11292                 esac
11293                 echo "Prototype: $try" ;;
11294         esac
11295         ;;
11296         *)      case "$usethreads" in
11297                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11298                 esac
11299                 d_endgrent_r=undef
11300                 endgrent_r_proto=0
11301                 ;;
11302         esac
11303         ;;
11304 *)      endgrent_r_proto=0
11305         ;;
11306 esac
11307
11308 : see if endhostent exists
11309 set endhostent d_endhent
11310 eval $inlibc
11311
11312 : see if this is a netdb.h system
11313 set netdb.h i_netdb
11314 eval $inhdr
11315
11316 : see if endhostent_r exists
11317 set endhostent_r d_endhostent_r
11318 eval $inlibc
11319 case "$d_endhostent_r" in
11320 "$define")
11321         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11322         case "$d_endhostent_r_proto:$usethreads" in
11323         ":define")      d_endhostent_r_proto=define
11324                 set d_endhostent_r_proto endhostent_r $hdrs
11325                 eval $hasproto ;;
11326         *)      ;;
11327         esac
11328         case "$d_endhostent_r_proto" in
11329         define)
11330         case "$endhostent_r_proto" in
11331         ''|0) try='int endhostent_r(struct hostent_data*);'
11332         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11333         esac
11334         case "$endhostent_r_proto" in
11335         ''|0) try='void endhostent_r(struct hostent_data*);'
11336         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11337         esac
11338         case "$endhostent_r_proto" in
11339         ''|0)   d_endhostent_r=undef
11340                 endhostent_r_proto=0
11341                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11342         * )     case "$endhostent_r_proto" in
11343                 REENTRANT_PROTO*) ;;
11344                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11345                 esac
11346                 echo "Prototype: $try" ;;
11347         esac
11348         ;;
11349         *)      case "$usethreads" in
11350                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11351                 esac
11352                 d_endhostent_r=undef
11353                 endhostent_r_proto=0
11354                 ;;
11355         esac
11356         ;;
11357 *)      endhostent_r_proto=0
11358         ;;
11359 esac
11360
11361 : see if endnetent exists
11362 set endnetent d_endnent
11363 eval $inlibc
11364
11365 : see if endnetent_r exists
11366 set endnetent_r d_endnetent_r
11367 eval $inlibc
11368 case "$d_endnetent_r" in
11369 "$define")
11370         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11371         case "$d_endnetent_r_proto:$usethreads" in
11372         ":define")      d_endnetent_r_proto=define
11373                 set d_endnetent_r_proto endnetent_r $hdrs
11374                 eval $hasproto ;;
11375         *)      ;;
11376         esac
11377         case "$d_endnetent_r_proto" in
11378         define)
11379         case "$endnetent_r_proto" in
11380         ''|0) try='int endnetent_r(struct netent_data*);'
11381         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11382         esac
11383         case "$endnetent_r_proto" in
11384         ''|0) try='void endnetent_r(struct netent_data*);'
11385         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11386         esac
11387         case "$endnetent_r_proto" in
11388         ''|0)   d_endnetent_r=undef
11389                 endnetent_r_proto=0
11390                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11391         * )     case "$endnetent_r_proto" in
11392                 REENTRANT_PROTO*) ;;
11393                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11394                 esac
11395                 echo "Prototype: $try" ;;
11396         esac
11397         ;;
11398         *)      case "$usethreads" in
11399                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11400                 esac
11401                 d_endnetent_r=undef
11402                 endnetent_r_proto=0
11403                 ;;
11404         esac
11405         ;;
11406 *)      endnetent_r_proto=0
11407         ;;
11408 esac
11409
11410 : see if endprotoent exists
11411 set endprotoent d_endpent
11412 eval $inlibc
11413
11414 : see if endprotoent_r exists
11415 set endprotoent_r d_endprotoent_r
11416 eval $inlibc
11417 case "$d_endprotoent_r" in
11418 "$define")
11419         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11420         case "$d_endprotoent_r_proto:$usethreads" in
11421         ":define")      d_endprotoent_r_proto=define
11422                 set d_endprotoent_r_proto endprotoent_r $hdrs
11423                 eval $hasproto ;;
11424         *)      ;;
11425         esac
11426         case "$d_endprotoent_r_proto" in
11427         define)
11428         case "$endprotoent_r_proto" in
11429         ''|0) try='int endprotoent_r(struct protoent_data*);'
11430         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11431         esac
11432         case "$endprotoent_r_proto" in
11433         ''|0) try='void endprotoent_r(struct protoent_data*);'
11434         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11435         esac
11436         case "$endprotoent_r_proto" in
11437         ''|0)   d_endprotoent_r=undef
11438                 endprotoent_r_proto=0
11439                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11440         * )     case "$endprotoent_r_proto" in
11441                 REENTRANT_PROTO*) ;;
11442                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11443                 esac
11444                 echo "Prototype: $try" ;;
11445         esac
11446         ;;
11447         *)      case "$usethreads" in
11448                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11449                 esac
11450                 d_endprotoent_r=undef
11451                 endprotoent_r_proto=0
11452                 ;;
11453         esac
11454         ;;
11455 *)      endprotoent_r_proto=0
11456         ;;
11457 esac
11458
11459 : see if endpwent exists
11460 set endpwent d_endpwent
11461 eval $inlibc
11462
11463 : see if this is a pwd.h system
11464 set pwd.h i_pwd
11465 eval $inhdr
11466
11467 case "$i_pwd" in
11468 $define)
11469         xxx=`./findhdr pwd.h`
11470         $cppstdin $cppflags $cppminus < $xxx >$$.h
11471
11472         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11473                 val="$define"
11474         else
11475                 val="$undef"
11476         fi
11477         set d_pwquota
11478         eval $setvar
11479
11480         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11481                 val="$define"
11482         else
11483                 val="$undef"
11484         fi
11485         set d_pwage
11486         eval $setvar
11487
11488         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11489                 val="$define"
11490         else
11491                 val="$undef"
11492         fi
11493         set d_pwchange
11494         eval $setvar
11495
11496         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11497                 val="$define"
11498         else
11499                 val="$undef"
11500         fi
11501         set d_pwclass
11502         eval $setvar
11503
11504         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11505                 val="$define"
11506         else
11507                 val="$undef"
11508         fi
11509         set d_pwexpire
11510         eval $setvar
11511
11512         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11513                 val="$define"
11514         else
11515                 val="$undef"
11516         fi
11517         set d_pwcomment
11518         eval $setvar
11519
11520         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11521                 val="$define"
11522         else
11523                 val="$undef"
11524         fi
11525         set d_pwgecos
11526         eval $setvar
11527
11528         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11529                 val="$define"
11530         else
11531                 val="$undef"
11532         fi
11533         set d_pwpasswd
11534         eval $setvar
11535
11536         $rm -f $$.h
11537         ;;
11538 *)
11539         val="$undef"; 
11540         set d_pwquota; eval $setvar
11541         set d_pwage; eval $setvar
11542         set d_pwchange; eval $setvar
11543         set d_pwclass; eval $setvar
11544         set d_pwexpire; eval $setvar
11545         set d_pwcomment; eval $setvar
11546         set d_pwgecos; eval $setvar
11547         set d_pwpasswd; eval $setvar
11548         ;;
11549 esac
11550
11551 : see if endpwent_r exists
11552 set endpwent_r d_endpwent_r
11553 eval $inlibc
11554 case "$d_endpwent_r" in
11555 "$define")
11556         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11557         case "$d_endpwent_r_proto:$usethreads" in
11558         ":define")      d_endpwent_r_proto=define
11559                 set d_endpwent_r_proto endpwent_r $hdrs
11560                 eval $hasproto ;;
11561         *)      ;;
11562         esac
11563         case "$d_endpwent_r_proto" in
11564         define)
11565         case "$endpwent_r_proto" in
11566         ''|0) try='int endpwent_r(FILE**);'
11567         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11568         esac
11569         case "$endpwent_r_proto" in
11570         ''|0) try='void endpwent_r(FILE**);'
11571         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11572         esac
11573         case "$endpwent_r_proto" in
11574         ''|0)   d_endpwent_r=undef
11575                 endpwent_r_proto=0
11576                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11577         * )     case "$endpwent_r_proto" in
11578                 REENTRANT_PROTO*) ;;
11579                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11580                 esac
11581                 echo "Prototype: $try" ;;
11582         esac
11583         ;;
11584         *)      case "$usethreads" in
11585                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11586                 esac
11587                 d_endpwent_r=undef
11588                 endpwent_r_proto=0
11589                 ;;
11590         esac
11591         ;;
11592 *)      endpwent_r_proto=0
11593         ;;
11594 esac
11595
11596 : see if endservent exists
11597 set endservent d_endsent
11598 eval $inlibc
11599
11600 : see if endservent_r exists
11601 set endservent_r d_endservent_r
11602 eval $inlibc
11603 case "$d_endservent_r" in
11604 "$define")
11605         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11606         case "$d_endservent_r_proto:$usethreads" in
11607         ":define")      d_endservent_r_proto=define
11608                 set d_endservent_r_proto endservent_r $hdrs
11609                 eval $hasproto ;;
11610         *)      ;;
11611         esac
11612         case "$d_endservent_r_proto" in
11613         define)
11614         case "$endservent_r_proto" in
11615         ''|0) try='int endservent_r(struct servent_data*);'
11616         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11617         esac
11618         case "$endservent_r_proto" in
11619         ''|0) try='void endservent_r(struct servent_data*);'
11620         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11621         esac
11622         case "$endservent_r_proto" in
11623         ''|0)   d_endservent_r=undef
11624                 endservent_r_proto=0
11625                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11626         * )     case "$endservent_r_proto" in
11627                 REENTRANT_PROTO*) ;;
11628                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11629                 esac
11630                 echo "Prototype: $try" ;;
11631         esac
11632         ;;
11633         *)      case "$usethreads" in
11634                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11635                 esac
11636                 d_endservent_r=undef
11637                 endservent_r_proto=0
11638                 ;;
11639         esac
11640         ;;
11641 *)      endservent_r_proto=0
11642         ;;
11643 esac
11644
11645 : Locate the flags for 'open()'
11646 echo " "
11647 $cat >try.c <<EOCP
11648 #include <sys/types.h>
11649 #ifdef I_FCNTL
11650 #include <fcntl.h>
11651 #endif
11652 #ifdef I_SYS_FILE
11653 #include <sys/file.h>
11654 #endif
11655 #$i_stdlib I_STDLIB
11656 #ifdef I_STDLIB
11657 #include <stdlib.h>
11658 #endif
11659 int main() {
11660         if(O_RDONLY);
11661 #ifdef O_TRUNC
11662         exit(0);
11663 #else
11664         exit(1);
11665 #endif
11666 }
11667 EOCP
11668 : check sys/file.h first to get FREAD on Sun
11669 if $test `./findhdr sys/file.h` && \
11670                 set try -DI_SYS_FILE && eval $compile; then
11671         h_sysfile=true;
11672         echo "<sys/file.h> defines the O_* constants..." >&4
11673         if $run ./try; then
11674                 echo "and you have the 3 argument form of open()." >&4
11675                 val="$define"
11676         else
11677                 echo "but not the 3 argument form of open().  Oh, well." >&4
11678                 val="$undef"
11679         fi
11680 elif $test `./findhdr fcntl.h` && \
11681                 set try -DI_FCNTL && eval $compile; then
11682         h_fcntl=true;
11683         echo "<fcntl.h> defines the O_* constants..." >&4
11684         if $run ./try; then
11685                 echo "and you have the 3 argument form of open()." >&4
11686                 val="$define"
11687         else
11688                 echo "but not the 3 argument form of open().  Oh, well." >&4
11689                 val="$undef"
11690         fi
11691 else
11692         val="$undef"
11693         echo "I can't find the O_* constant definitions!  You got problems." >&4
11694 fi
11695 set d_open3
11696 eval $setvar
11697 $rm -f try try.*
11698
11699 : see which of string.h or strings.h is needed
11700 echo " "
11701 strings=`./findhdr string.h`
11702 if $test "$strings" && $test -r "$strings"; then
11703         echo "Using <string.h> instead of <strings.h>." >&4
11704         val="$define"
11705 else
11706         val="$undef"
11707         strings=`./findhdr strings.h`
11708         if $test "$strings" && $test -r "$strings"; then
11709                 echo "Using <strings.h> instead of <string.h>." >&4
11710         else
11711                 echo "No string header found -- You'll surely have problems." >&4
11712         fi
11713 fi
11714 set i_string
11715 eval $setvar
11716 case "$i_string" in
11717 "$undef") strings=`./findhdr strings.h`;;
11718 *)        strings=`./findhdr string.h`;;
11719 esac
11720
11721 : see if this is a sys/file.h system
11722 val=''
11723 set sys/file.h val
11724 eval $inhdr
11725
11726 : do we need to include sys/file.h ?
11727 case "$val" in
11728 "$define")
11729         echo " "
11730         if $h_sysfile; then
11731                 val="$define"
11732                 echo "We'll be including <sys/file.h>." >&4
11733         else
11734                 val="$undef"
11735                 echo "We won't be including <sys/file.h>." >&4
11736         fi
11737         ;;
11738 *)
11739         h_sysfile=false
11740         ;;
11741 esac
11742 set i_sysfile
11743 eval $setvar
11744
11745 : see if fcntl.h is there
11746 val=''
11747 set fcntl.h val
11748 eval $inhdr
11749
11750 : see if we can include fcntl.h
11751 case "$val" in
11752 "$define")
11753         echo " "
11754         if $h_fcntl; then
11755                 val="$define"
11756                 echo "We'll be including <fcntl.h>." >&4
11757         else
11758                 val="$undef"
11759                 if $h_sysfile; then
11760         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11761                 else
11762                         echo "We won't be including <fcntl.h>." >&4
11763                 fi
11764         fi
11765         ;;
11766 *)
11767         h_fcntl=false
11768         val="$undef"
11769         ;;
11770 esac
11771 set i_fcntl
11772 eval $setvar
11773
11774 : check for non-blocking I/O stuff
11775 case "$h_sysfile" in
11776 true) echo "#include <sys/file.h>" > head.c;;
11777 *)
11778        case "$h_fcntl" in
11779        true) echo "#include <fcntl.h>" > head.c;;
11780        *) echo "#include <sys/fcntl.h>" > head.c;;
11781        esac
11782        ;;
11783 esac
11784 echo " "
11785 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11786 case "$o_nonblock" in
11787 '')
11788         $cat head.c > try.c
11789         $cat >>try.c <<EOCP
11790 #include <stdio.h>
11791 #$i_stdlib I_STDLIB
11792 #ifdef I_STDLIB
11793 #include <stdlib.h>
11794 #endif
11795 #$i_fcntl I_FCNTL
11796 #ifdef I_FCNTL
11797 #include <fcntl.h>
11798 #endif
11799 int main() {
11800 #ifdef O_NONBLOCK
11801         printf("O_NONBLOCK\n");
11802         exit(0);
11803 #endif
11804 #ifdef O_NDELAY
11805         printf("O_NDELAY\n");
11806         exit(0);
11807 #endif
11808 #ifdef FNDELAY
11809         printf("FNDELAY\n");
11810         exit(0);
11811 #endif
11812         exit(0);
11813 }
11814 EOCP
11815         set try
11816         if eval $compile_ok; then
11817                 o_nonblock=`$run ./try`
11818                 case "$o_nonblock" in
11819                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11820                 *) echo "Seems like we can use $o_nonblock.";;
11821                 esac
11822         else
11823                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11824         fi
11825         ;;
11826 *) echo "Using $hint value $o_nonblock.";;
11827 esac
11828 $rm -f try try.* .out core
11829
11830 echo " "
11831 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11832 case "$eagain" in
11833 '')
11834         $cat head.c > try.c
11835         $cat >>try.c <<EOCP
11836 #include <errno.h>
11837 #include <sys/types.h>
11838 #include <signal.h>
11839 #include <stdio.h> 
11840 #$i_stdlib I_STDLIB
11841 #ifdef I_STDLIB
11842 #include <stdlib.h>
11843 #endif
11844 #$i_fcntl I_FCNTL
11845 #ifdef I_FCNTL
11846 #include <fcntl.h>
11847 #endif
11848 #define MY_O_NONBLOCK $o_nonblock
11849 #ifndef errno  /* XXX need better Configure test */
11850 extern int errno;
11851 #endif
11852 #$i_unistd I_UNISTD
11853 #ifdef I_UNISTD
11854 #include <unistd.h>
11855 #endif
11856 #$i_string I_STRING
11857 #ifdef I_STRING
11858 #include <string.h>
11859 #else
11860 #include <strings.h>
11861 #endif
11862 $signal_t blech(x) int x; { exit(3); }
11863 EOCP
11864         $cat >> try.c <<'EOCP'
11865 int main()
11866 {
11867         int pd[2];
11868         int pu[2];
11869         char buf[1];
11870         char string[100];
11871
11872         pipe(pd);       /* Down: child -> parent */
11873         pipe(pu);       /* Up: parent -> child */
11874         if (0 != fork()) {
11875                 int ret;
11876                 close(pd[1]);   /* Parent reads from pd[0] */
11877                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11878 #ifdef F_SETFL
11879                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11880                         exit(1);
11881 #else
11882                 exit(4);
11883 #endif
11884                 signal(SIGALRM, blech);
11885                 alarm(5);
11886                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11887                         exit(2);
11888                 sprintf(string, "%d\n", ret);
11889                 write(2, string, strlen(string));
11890                 alarm(0);
11891 #ifdef EAGAIN
11892                 if (errno == EAGAIN) {
11893                         printf("EAGAIN\n");
11894                         goto ok;
11895                 }
11896 #endif
11897 #ifdef EWOULDBLOCK
11898                 if (errno == EWOULDBLOCK)
11899                         printf("EWOULDBLOCK\n");
11900 #endif
11901         ok:
11902                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11903                 sleep(2);                               /* Give it time to close our pipe */
11904                 alarm(5);
11905                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11906                 alarm(0);
11907                 sprintf(string, "%d\n", ret);
11908                 write(4, string, strlen(string));
11909                 exit(0);
11910         }
11911
11912         close(pd[0]);                   /* We write to pd[1] */
11913         close(pu[1]);                   /* We read from pu[0] */
11914         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11915         close(pd[1]);                   /* Pipe pd is now fully closed! */
11916         exit(0);                                /* Bye bye, thank you for playing! */
11917 }
11918 EOCP
11919         set try
11920         if eval $compile_ok; then
11921                 echo "$startsh" >mtry
11922                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11923                 chmod +x mtry
11924                 ./mtry >/dev/null 2>&1
11925                 case $? in
11926                 0) eagain=`$cat try.out`;;
11927                 1) echo "Could not perform non-blocking setting!";;
11928                 2) echo "I did a successful read() for something that was not there!";;
11929                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11930                 4) echo "Could not find F_SETFL!";;
11931                 *) echo "Something terribly wrong happened during testing.";;
11932                 esac
11933                 rd_nodata=`$cat try.ret`
11934                 echo "A read() system call with no data present returns $rd_nodata."
11935                 case "$rd_nodata" in
11936                 0|-1) ;;
11937                 *)
11938                         echo "(That's peculiar, fixing that to be -1.)"
11939                         rd_nodata=-1
11940                         ;;
11941                 esac
11942                 case "$eagain" in
11943                 '')
11944                         echo "Forcing errno EAGAIN on read() with no data available."
11945                         eagain=EAGAIN
11946                         ;;
11947                 *)
11948                         echo "Your read() sets errno to $eagain when no data is available."
11949                         ;;
11950                 esac
11951                 status=`$cat try.err`
11952                 case "$status" in
11953                 0) echo "And it correctly returns 0 to signal EOF.";;
11954                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11955                 *) echo "However, your read() returns '$status' on EOF??";;
11956                 esac
11957                 val="$define"
11958                 if test "$status" = "$rd_nodata"; then
11959                         echo "WARNING: you can't distinguish between EOF and no data!"
11960                         val="$undef"
11961                 fi
11962         else
11963                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11964                 eagain=EAGAIN
11965         fi
11966         set d_eofnblk
11967         eval $setvar
11968         ;;
11969 *)
11970         echo "Using $hint value $eagain."
11971         echo "Your read() returns $rd_nodata when no data is present."
11972         case "$d_eofnblk" in
11973         "$define") echo "And you can see EOF because read() returns 0.";;
11974         "$undef") echo "But you can't see EOF status from read() returned value.";;
11975         *)
11976                 echo "(Assuming you can't see EOF status from read anyway.)"
11977                 d_eofnblk=$undef
11978                 ;;
11979         esac
11980         ;;
11981 esac
11982 $rm -f try try.* .out core head.c mtry
11983
11984 : see if _ptr and _cnt from stdio act std
11985 echo " "
11986
11987 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11988         echo "(Looks like you have stdio.h from BSD.)"
11989         case "$stdio_ptr" in
11990         '') stdio_ptr='((fp)->_p)'
11991                 ptr_lval=$define
11992                 ;;
11993         *)      ptr_lval=$d_stdio_ptr_lval;;
11994         esac
11995         case "$stdio_cnt" in
11996         '') stdio_cnt='((fp)->_r)'
11997                 cnt_lval=$define
11998                 ;;
11999         *)      cnt_lval=$d_stdio_cnt_lval;;
12000         esac
12001         case "$stdio_base" in
12002         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12003         esac
12004         case "$stdio_bufsiz" in
12005         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12006         esac
12007 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12008         echo "(Looks like you have stdio.h from Linux.)"
12009         case "$stdio_ptr" in
12010         '') stdio_ptr='((fp)->_IO_read_ptr)'
12011                 ptr_lval=$define
12012                 ;;
12013         *)      ptr_lval=$d_stdio_ptr_lval;;
12014         esac
12015         case "$stdio_cnt" in
12016         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12017                 cnt_lval=$undef
12018                 ;;
12019         *)      cnt_lval=$d_stdio_cnt_lval;;
12020         esac
12021         case "$stdio_base" in
12022         '') stdio_base='((fp)->_IO_read_base)';;
12023         esac
12024         case "$stdio_bufsiz" in
12025         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12026         esac
12027 else
12028         case "$stdio_ptr" in
12029         '') stdio_ptr='((fp)->_ptr)'
12030                 ptr_lval=$define
12031                 ;;
12032         *)      ptr_lval=$d_stdio_ptr_lval;;
12033         esac
12034         case "$stdio_cnt" in
12035         '') stdio_cnt='((fp)->_cnt)'
12036                 cnt_lval=$define
12037                 ;;
12038         *)      cnt_lval=$d_stdio_cnt_lval;;
12039         esac
12040         case "$stdio_base" in
12041         '') stdio_base='((fp)->_base)';;
12042         esac
12043         case "$stdio_bufsiz" in
12044         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12045         esac
12046 fi
12047
12048 : test whether _ptr and _cnt really work
12049 echo "Checking how std your stdio is..." >&4
12050 $cat >try.c <<EOP
12051 #include <stdio.h>
12052 #$i_stdlib I_STDLIB
12053 #ifdef I_STDLIB
12054 #include <stdlib.h>
12055 #endif
12056 #define FILE_ptr(fp)    $stdio_ptr
12057 #define FILE_cnt(fp)    $stdio_cnt
12058 int main() {
12059         FILE *fp = fopen("try.c", "r");
12060         char c = getc(fp);
12061         if (
12062                 18 <= FILE_cnt(fp) &&
12063                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12064         )
12065                 exit(0);
12066         exit(1);
12067 }
12068 EOP
12069 val="$undef"
12070 set try
12071 if eval $compile && $to try.c; then
12072         if $run ./try; then
12073                 echo "Your stdio acts pretty std."
12074                 val="$define"
12075         else
12076                 echo "Your stdio isn't very std."
12077         fi
12078 else
12079         echo "Your stdio doesn't appear very std."
12080 fi
12081 $rm -f try.c try
12082
12083 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12084 # direct buffer manipulation no longer works.  The Configure tests
12085 # should be changed to correctly detect this, but until then,
12086 # the following check should at least let perl compile and run.
12087 # (This quick fix should be updated before 5.8.1.)
12088 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12089 # A. Dougherty, June 3, 2002.
12090 case "$d_gnulibc" in
12091 $define)
12092         case "$gnulibc_version" in
12093         2.[01]*)  ;;
12094         2.2) ;;
12095         2.2.[0-9]) ;;
12096         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12097                 val="$undef"
12098                 ;;
12099         esac
12100         ;;
12101 esac
12102 set d_stdstdio
12103 eval $setvar
12104
12105 : Can _ptr be used as an lvalue?
12106 case "$d_stdstdio$ptr_lval" in
12107 $define$define) val=$define ;;
12108 *) val=$undef ;;
12109 esac
12110 set d_stdio_ptr_lval
12111 eval $setvar
12112
12113 : Can _cnt be used as an lvalue?
12114 case "$d_stdstdio$cnt_lval" in
12115 $define$define) val=$define ;;
12116 *) val=$undef ;;
12117 esac
12118 set d_stdio_cnt_lval
12119 eval $setvar
12120
12121
12122 : test whether setting _ptr sets _cnt as a side effect
12123 d_stdio_ptr_lval_sets_cnt="$undef"
12124 d_stdio_ptr_lval_nochange_cnt="$undef"
12125 case "$d_stdio_ptr_lval$d_stdstdio" in
12126 $define$define)
12127         echo "Checking to see what happens if we set the stdio ptr..." >&4
12128 $cat >try.c <<EOP
12129 #include <stdio.h>
12130 /* Can we scream? */
12131 /* Eat dust sed :-) */
12132 /* In the buffer space, no one can hear you scream. */
12133 #$i_stdlib I_STDLIB
12134 #ifdef I_STDLIB
12135 #include <stdlib.h>
12136 #endif
12137 #define FILE_ptr(fp)    $stdio_ptr
12138 #define FILE_cnt(fp)    $stdio_cnt
12139 #include <sys/types.h>
12140 int main() {
12141         FILE *fp = fopen("try.c", "r");
12142         int c;
12143         char *ptr;
12144         size_t cnt;
12145         if (!fp) {
12146             puts("Fail even to read");
12147             exit(1);
12148         }
12149         c = getc(fp); /* Read away the first # */
12150         if (c == EOF) {
12151             puts("Fail even to read");
12152             exit(1);
12153         }
12154         if (!(
12155                 18 <= FILE_cnt(fp) &&
12156                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12157         )) {
12158                 puts("Fail even to read");
12159                 exit (1);
12160         }
12161         ptr = (char*) FILE_ptr(fp);
12162         cnt = (size_t)FILE_cnt(fp);
12163
12164         FILE_ptr(fp) += 42;
12165
12166         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12167                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12168                 exit (1);
12169         }
12170         if (FILE_cnt(fp) <= 20) {
12171                 printf ("Fail (<20 chars to test)");
12172                 exit (1);
12173         }
12174         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12175                 puts("Fail compare");
12176                 exit (1);
12177         }
12178         if (cnt == FILE_cnt(fp)) {
12179                 puts("Pass_unchanged");
12180                 exit (0);
12181         }       
12182         if (FILE_cnt(fp) == (cnt - 42)) {
12183                 puts("Pass_changed");
12184                 exit (0);
12185         }
12186         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12187         return 1;
12188
12189 }
12190 EOP
12191         set try
12192         if eval $compile && $to try.c; then
12193                 case `$run ./try` in
12194                 Pass_changed)
12195                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12196                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12197                 Pass_unchanged)
12198                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12199                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12200                 Fail*)
12201                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12202                 *)
12203                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12204         esac
12205         else
12206                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12207         fi
12208         $rm -f try.c try
12209         ;;
12210 esac
12211
12212 : see if _base is also standard
12213 val="$undef"
12214 case "$d_stdstdio" in
12215 $define)
12216         $cat >try.c <<EOP
12217 #include <stdio.h>
12218 #$i_stdlib I_STDLIB
12219 #ifdef I_STDLIB
12220 #include <stdlib.h>
12221 #endif
12222 #define FILE_base(fp)   $stdio_base
12223 #define FILE_bufsiz(fp) $stdio_bufsiz
12224 int main() {
12225         FILE *fp = fopen("try.c", "r");
12226         char c = getc(fp);
12227         if (
12228                 19 <= FILE_bufsiz(fp) &&
12229                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12230         )
12231                 exit(0);
12232         exit(1);
12233 }
12234 EOP
12235         set try
12236         if eval $compile && $to try.c; then
12237                 if $run ./try; then
12238                         echo "And its _base field acts std."
12239                         val="$define"
12240                 else
12241                         echo "But its _base field isn't std."
12242                 fi
12243         else
12244                 echo "However, it seems to be lacking the _base field."
12245         fi
12246         $rm -f try.c try
12247         ;;
12248 esac
12249 set d_stdiobase
12250 eval $setvar
12251
12252 : see if fast_stdio exists
12253 val="$undef"
12254 case "$d_stdstdio:$d_stdio_ptr_lval" in
12255 "$define:$define")
12256         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12257         *$define*)
12258                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12259                 val="$define"
12260                 ;;
12261         esac
12262         ;;
12263 esac
12264 set d_faststdio
12265 eval $setvar
12266
12267
12268
12269 : see if fchdir exists
12270 set fchdir d_fchdir
12271 eval $inlibc
12272
12273 : see if fchmod exists
12274 set fchmod d_fchmod
12275 eval $inlibc
12276
12277 : see if fchown exists
12278 set fchown d_fchown
12279 eval $inlibc
12280
12281 : see if this is an fcntl system
12282 set fcntl d_fcntl
12283 eval $inlibc
12284
12285 echo " "
12286 : See if fcntl-based locking works.
12287 $cat >try.c <<EOCP
12288 #$i_stdlib I_STDLIB
12289 #ifdef I_STDLIB
12290 #include <stdlib.h>
12291 #endif
12292 #include <unistd.h>
12293 #include <fcntl.h>
12294 #include <signal.h>
12295 $signal_t blech(x) int x; { exit(3); }
12296 int main() {
12297 #if defined(F_SETLK) && defined(F_SETLKW)
12298      struct flock flock;
12299      int retval, fd;
12300      fd = open("try.c", O_RDONLY);
12301      flock.l_type = F_RDLCK;
12302      flock.l_whence = SEEK_SET;
12303      flock.l_start = flock.l_len = 0;
12304      signal(SIGALRM, blech);
12305      alarm(10);
12306      retval = fcntl(fd, F_SETLK, &flock);
12307      close(fd);
12308      (retval < 0 ? exit(2) : exit(0));
12309 #else
12310      exit(2);
12311 #endif
12312 }
12313 EOCP
12314 echo "Checking if fcntl-based file locking works... "
12315 case "$d_fcntl" in
12316 "$define")
12317         set try
12318         if eval $compile_ok; then
12319                 if $run ./try; then
12320                         echo "Yes, it seems to work."
12321                         val="$define"
12322                 else
12323                         echo "Nope, it didn't work."
12324                         val="$undef"
12325                         case "$?" in
12326                         3) $cat >&4 <<EOM
12327 ***
12328 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12329 *** This is (almost) impossible.
12330 *** If your NFS lock daemons are not feeling well, something like
12331 *** this may happen, please investigate.  Cannot continue, aborting.
12332 ***
12333 EOM
12334                                 exit 1
12335                                 ;;
12336                         esac
12337                 fi
12338         else
12339                 echo "I'm unable to compile the test program, so I'll assume not."
12340                 val="$undef"
12341         fi
12342         ;;
12343 *) val="$undef";
12344         echo "Nope, since you don't even have fcntl()."
12345         ;;
12346 esac
12347 set d_fcntl_can_lock
12348 eval $setvar
12349 $rm -f try*
12350
12351
12352 : check for fd_set items
12353 $cat <<EOM
12354
12355 Checking to see how well your C compiler handles fd_set and friends ...
12356 EOM
12357 $cat >try.c <<EOCP
12358 #$i_stdlib I_STDLIB
12359 #ifdef I_STDLIB
12360 #include <stdlib.h>
12361 #endif
12362 #$i_systime I_SYS_TIME
12363 #$i_sysselct I_SYS_SELECT
12364 #$d_socket HAS_SOCKET
12365 #include <sys/types.h>
12366 #ifdef HAS_SOCKET
12367 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12368 #endif
12369 #ifdef I_SYS_TIME
12370 #include <sys/time.h>
12371 #endif
12372 #ifdef I_SYS_SELECT
12373 #include <sys/select.h>
12374 #endif
12375 int main() {
12376         fd_set fds;
12377
12378 #ifdef TRYBITS
12379         if(fds.fds_bits);
12380 #endif
12381
12382 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12383         exit(0);
12384 #else
12385         exit(1);
12386 #endif
12387 }
12388 EOCP
12389 set try -DTRYBITS
12390 if eval $compile; then
12391         d_fds_bits="$define"
12392         d_fd_set="$define"
12393         echo "Well, your system knows about the normal fd_set typedef..." >&4
12394         if $run ./try; then
12395                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12396                 d_fd_macros="$define"
12397         else
12398                 $cat >&4 <<'EOM'
12399 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12400 EOM
12401                 d_fd_macros="$undef"
12402         fi
12403 else
12404         $cat <<'EOM'
12405 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12406 EOM
12407         set try
12408         if eval $compile; then
12409                 d_fds_bits="$undef"
12410                 d_fd_set="$define"
12411                 echo "Well, your system has some sort of fd_set available..." >&4
12412                 if $run ./try; then
12413                         echo "and you have the normal fd_set macros." >&4
12414                         d_fd_macros="$define"
12415                 else
12416                         $cat <<'EOM'
12417 but not the normal fd_set macros!  Gross!  More work for me...
12418 EOM
12419                         d_fd_macros="$undef"
12420                 fi
12421         else
12422         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12423                 d_fd_set="$undef"
12424                 d_fds_bits="$undef"
12425                 d_fd_macros="$undef"
12426         fi
12427 fi
12428 $rm -f try try.*
12429
12430 : see if fgetpos exists
12431 set fgetpos d_fgetpos
12432 eval $inlibc
12433
12434 : see if finite exists
12435 set finite d_finite
12436 eval $inlibc
12437
12438 : see if finitel exists
12439 set finitel d_finitel
12440 eval $inlibc
12441
12442 : see if flock exists
12443 set flock d_flock
12444 eval $inlibc
12445
12446 : see if prototype for flock is available
12447 echo " "
12448 set d_flockproto flock $i_sysfile sys/file.h
12449 eval $hasproto
12450
12451 : see if fork exists
12452 set fork d_fork
12453 eval $inlibc
12454
12455 : see if fp_class exists
12456 set fp_class d_fp_class
12457 eval $inlibc
12458
12459 : see if pathconf exists
12460 set pathconf d_pathconf
12461 eval $inlibc
12462
12463 : see if fpathconf exists
12464 set fpathconf d_fpathconf
12465 eval $inlibc
12466
12467 : see if fpclass exists
12468 set fpclass d_fpclass
12469 eval $inlibc
12470
12471 : see if fpclassify exists
12472 set fpclassify d_fpclassify
12473 eval $inlibc
12474
12475 : see if fpclassl exists
12476 set fpclassl d_fpclassl
12477 eval $inlibc
12478
12479
12480 : check for fpos64_t
12481 echo " "
12482 echo "Checking to see if you have fpos64_t..." >&4
12483 $cat >try.c <<EOCP
12484 #include <stdio.h>
12485 int main() { fpos64_t x = 7; }
12486 EOCP
12487 set try
12488 if eval $compile; then
12489         val="$define"
12490         echo "You have fpos64_t."
12491 else
12492         val="$undef"
12493         echo "You do not have fpos64_t."
12494         case "$fpossize" in
12495         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12496         esac
12497 fi
12498 $rm -f try.* try
12499 set d_fpos64_t
12500 eval $setvar
12501
12502 : see if frexpl exists
12503 set frexpl d_frexpl
12504 eval $inlibc
12505
12506 : see if this is a sys/param system
12507 set sys/param.h i_sysparam
12508 eval $inhdr
12509
12510 : see if this is a sys/mount.h system
12511 set sys/mount.h i_sysmount
12512 eval $inhdr
12513
12514
12515 echo " "
12516 echo "Checking to see if your system supports struct fs_data..." >&4
12517 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12518 eval $hasstruct
12519 case "$d_fs_data_s" in
12520 "$define")      echo "Yes, it does."   ;;
12521 *)              echo "No, it doesn't." ;;
12522 esac
12523
12524 : see if fseeko exists
12525 set fseeko d_fseeko
12526 eval $inlibc
12527 case "$longsize" in
12528 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12529 esac
12530
12531 : see if fsetpos exists
12532 set fsetpos d_fsetpos
12533 eval $inlibc
12534
12535
12536 : see if fstatfs exists
12537 set fstatfs d_fstatfs
12538 eval $inlibc
12539
12540
12541 : see if statvfs exists
12542 set statvfs d_statvfs
12543 eval $inlibc
12544
12545 : see if fstatvfs exists
12546 set fstatvfs d_fstatvfs
12547 eval $inlibc
12548
12549
12550 : see if fsync exists
12551 set fsync d_fsync
12552 eval $inlibc
12553
12554 : see if ftello exists
12555 set ftello d_ftello
12556 eval $inlibc
12557 case "$longsize" in
12558 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12559 esac
12560
12561 d_futimes="$undef"
12562 : check for a working futimes
12563 echo " "
12564 echo "Checking for a working futimes()" >&4
12565 $cat >try.c <<EOCP
12566 #include <stdio.h>
12567 #include <sys/time.h>
12568 #include <errno.h>
12569 #include <fcntl.h>
12570
12571 int main ()
12572 {
12573     int fd, rv;
12574     fd = open ("try.c", O_RDWR);
12575     if (-1 == fd) exit (1);
12576     rv = futimes (fd, NULL);
12577     exit (rv == -1 ? errno : 0);
12578 }
12579 EOCP
12580 set try
12581 if eval $compile; then
12582     `$run ./try`
12583     rc=$?
12584     case "$rc" in
12585         0)  echo "Yes, it does" >&4
12586             d_futimes="$define"
12587             ;;
12588         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12589             ;;
12590     esac
12591 else
12592     echo "No, it does not (probably harmless)\n" >&4
12593 fi
12594 $rm -f try.* try core core.try.*
12595
12596 : see if getcwd exists
12597 set getcwd d_getcwd
12598 eval $inlibc
12599
12600 : see if getespwnam exists
12601 set getespwnam d_getespwnam
12602 eval $inlibc
12603
12604
12605 : see if getfsstat exists
12606 set getfsstat d_getfsstat
12607 eval $inlibc
12608
12609 : see if getgrent exists
12610 set getgrent d_getgrent
12611 eval $inlibc
12612
12613 : see if getgrent_r exists
12614 set getgrent_r d_getgrent_r
12615 eval $inlibc
12616 case "$d_getgrent_r" in
12617 "$define")
12618         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12619         case "$d_getgrent_r_proto:$usethreads" in
12620         ":define")      d_getgrent_r_proto=define
12621                 set d_getgrent_r_proto getgrent_r $hdrs
12622                 eval $hasproto ;;
12623         *)      ;;
12624         esac
12625         case "$d_getgrent_r_proto" in
12626         define)
12627         case "$getgrent_r_proto" in
12628         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12629         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12630         esac
12631         case "$getgrent_r_proto" in
12632         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12633         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12634         esac
12635         case "$getgrent_r_proto" in
12636         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12637         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12638         esac
12639         case "$getgrent_r_proto" in
12640         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12641         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12642         esac
12643         case "$getgrent_r_proto" in
12644         ''|0) try='int getgrent_r(struct group*, char*, int);'
12645         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12646         esac
12647         case "$getgrent_r_proto" in
12648         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12649         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12650         esac
12651         case "$getgrent_r_proto" in
12652         ''|0)   d_getgrent_r=undef
12653                 getgrent_r_proto=0
12654                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12655         * )     case "$getgrent_r_proto" in
12656                 REENTRANT_PROTO*) ;;
12657                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12658                 esac
12659                 echo "Prototype: $try" ;;
12660         esac
12661         ;;
12662         *)      case "$usethreads" in
12663                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12664                 esac
12665                 d_getgrent_r=undef
12666                 getgrent_r_proto=0
12667                 ;;
12668         esac
12669         ;;
12670 *)      getgrent_r_proto=0
12671         ;;
12672 esac
12673
12674 : see if getgrgid_r exists
12675 set getgrgid_r d_getgrgid_r
12676 eval $inlibc
12677 case "$d_getgrgid_r" in
12678 "$define")
12679         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12680         case "$d_getgrgid_r_proto:$usethreads" in
12681         ":define")      d_getgrgid_r_proto=define
12682                 set d_getgrgid_r_proto getgrgid_r $hdrs
12683                 eval $hasproto ;;
12684         *)      ;;
12685         esac
12686         case "$d_getgrgid_r_proto" in
12687         define)
12688         case "$getgrgid_r_proto" in
12689         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12690         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12691         esac
12692         case "$getgrgid_r_proto" in
12693         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12694         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12695         esac
12696         case "$getgrgid_r_proto" in
12697         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12698         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12699         esac
12700         case "$getgrgid_r_proto" in
12701         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12702         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12703         esac
12704         case "$getgrgid_r_proto" in
12705         ''|0)   d_getgrgid_r=undef
12706                 getgrgid_r_proto=0
12707                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12708         * )     case "$getgrgid_r_proto" in
12709                 REENTRANT_PROTO*) ;;
12710                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12711                 esac
12712                 echo "Prototype: $try" ;;
12713         esac
12714         ;;
12715         *)      case "$usethreads" in
12716                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12717                 esac
12718                 d_getgrgid_r=undef
12719                 getgrgid_r_proto=0
12720                 ;;
12721         esac
12722         ;;
12723 *)      getgrgid_r_proto=0
12724         ;;
12725 esac
12726
12727 : see if getgrnam_r exists
12728 set getgrnam_r d_getgrnam_r
12729 eval $inlibc
12730 case "$d_getgrnam_r" in
12731 "$define")
12732         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12733         case "$d_getgrnam_r_proto:$usethreads" in
12734         ":define")      d_getgrnam_r_proto=define
12735                 set d_getgrnam_r_proto getgrnam_r $hdrs
12736                 eval $hasproto ;;
12737         *)      ;;
12738         esac
12739         case "$d_getgrnam_r_proto" in
12740         define)
12741         case "$getgrnam_r_proto" in
12742         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12743         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12744         esac
12745         case "$getgrnam_r_proto" in
12746         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12747         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12748         esac
12749         case "$getgrnam_r_proto" in
12750         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12751         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12752         esac
12753         case "$getgrnam_r_proto" in
12754         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12755         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12756         esac
12757         case "$getgrnam_r_proto" in
12758         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12759         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12760         esac
12761         case "$getgrnam_r_proto" in
12762         ''|0)   d_getgrnam_r=undef
12763                 getgrnam_r_proto=0
12764                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12765         * )     case "$getgrnam_r_proto" in
12766                 REENTRANT_PROTO*) ;;
12767                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12768                 esac
12769                 echo "Prototype: $try" ;;
12770         esac
12771         ;;
12772         *)      case "$usethreads" in
12773                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12774                 esac
12775                 d_getgrnam_r=undef
12776                 getgrnam_r_proto=0
12777                 ;;
12778         esac
12779         ;;
12780 *)      getgrnam_r_proto=0
12781         ;;
12782 esac
12783
12784 : see if gethostbyaddr exists
12785 set gethostbyaddr d_gethbyaddr
12786 eval $inlibc
12787
12788 : see if gethostbyname exists
12789 set gethostbyname d_gethbyname
12790 eval $inlibc
12791
12792 : see if gethostent exists
12793 set gethostent d_gethent
12794 eval $inlibc
12795
12796 : see how we will look up host name
12797 echo " "
12798 call=''
12799 if set gethostname val -f d_gethname; eval $csym; $val; then
12800         echo 'gethostname() found.' >&4
12801         d_gethname="$define"
12802         call=gethostname
12803 fi
12804 if set uname val -f d_uname; eval $csym; $val; then
12805         if ./xenix; then
12806                 $cat <<'EOM'
12807 uname() was found, but you're running xenix, and older versions of xenix
12808 have a broken uname(). If you don't really know whether your xenix is old
12809 enough to have a broken system call, use the default answer.
12810
12811 EOM
12812                 dflt=y
12813                 case "$d_uname" in
12814                 "$define") dflt=n;;
12815                 esac
12816                 rp='Is your uname() broken?'
12817                 . ./myread
12818                 case "$ans" in
12819                 n*) d_uname="$define"; call=uname;;
12820                 esac
12821         else
12822                 echo 'uname() found.' >&4
12823                 d_uname="$define"
12824                 case "$call" in
12825                 '') call=uname ;;
12826                 esac
12827         fi
12828 fi
12829 case "$d_gethname" in
12830 '') d_gethname="$undef";;
12831 esac
12832 case "$d_uname" in
12833 '') d_uname="$undef";;
12834 esac
12835 case "$d_uname$d_gethname" in
12836 *define*)
12837         dflt=n
12838         cat <<EOM
12839  
12840 Every now and then someone has a $call() that lies about the hostname
12841 but can't be fixed for political or economic reasons.  If you wish, I can
12842 pretend $call() isn't there and maybe compute hostname at run-time
12843 thanks to the '$phostname' command.
12844
12845 EOM
12846         rp="Shall I ignore $call() from now on?"
12847         . ./myread
12848         case "$ans" in
12849         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12850         esac;;
12851 esac
12852 case "$phostname" in
12853 '') aphostname='';;
12854 *) case "$aphostname" in
12855         /*) ;;
12856         *) set X $phostname
12857                 shift
12858                 file=$1
12859                 shift
12860                 file=`./loc $file $file $pth`
12861                 aphostname=`echo $file $*`
12862                 ;;
12863         esac
12864         ;;
12865 esac
12866 case "$d_uname$d_gethname" in
12867 *define*) ;;
12868 *)
12869         case "$phostname" in
12870         '')
12871                 echo "There will be no way for $package to get your hostname." >&4;;
12872         *)
12873         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12874                 ;;
12875         esac;;
12876 esac
12877 case "$d_phostname" in
12878 '') d_phostname="$undef";;
12879 esac
12880
12881 : see if gethostbyaddr_r exists
12882 set gethostbyaddr_r d_gethostbyaddr_r
12883 eval $inlibc
12884 case "$d_gethostbyaddr_r" in
12885 "$define")
12886         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12887         case "$d_gethostbyaddr_r_proto:$usethreads" in
12888         ":define")      d_gethostbyaddr_r_proto=define
12889                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12890                 eval $hasproto ;;
12891         *)      ;;
12892         esac
12893         case "$d_gethostbyaddr_r_proto" in
12894         define)
12895         case "$gethostbyaddr_r_proto" in
12896         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12897         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12898         esac
12899         case "$gethostbyaddr_r_proto" in
12900         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12901         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12902         esac
12903         case "$gethostbyaddr_r_proto" in
12904         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12905         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12906         esac
12907         case "$gethostbyaddr_r_proto" in
12908         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12909         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12910         esac
12911         case "$gethostbyaddr_r_proto" in
12912         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12913         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12914         esac
12915         case "$gethostbyaddr_r_proto" in
12916         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12917         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12918         esac
12919         case "$gethostbyaddr_r_proto" in
12920         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12921         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12922         esac
12923         case "$gethostbyaddr_r_proto" in
12924         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12925         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12926         esac
12927         case "$gethostbyaddr_r_proto" in
12928         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12929         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12930         esac
12931         case "$gethostbyaddr_r_proto" in
12932         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12933         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12934         esac
12935         case "$gethostbyaddr_r_proto" in
12936         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12937         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12938         esac
12939         case "$gethostbyaddr_r_proto" in
12940         ''|0)   d_gethostbyaddr_r=undef
12941                 gethostbyaddr_r_proto=0
12942                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12943         * )     case "$gethostbyaddr_r_proto" in
12944                 REENTRANT_PROTO*) ;;
12945                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12946                 esac
12947                 echo "Prototype: $try" ;;
12948         esac
12949         ;;
12950         *)      case "$usethreads" in
12951                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12952                 esac
12953                 d_gethostbyaddr_r=undef
12954                 gethostbyaddr_r_proto=0
12955                 ;;
12956         esac
12957         ;;
12958 *)      gethostbyaddr_r_proto=0
12959         ;;
12960 esac
12961
12962 : see if gethostbyname_r exists
12963 set gethostbyname_r d_gethostbyname_r
12964 eval $inlibc
12965 case "$d_gethostbyname_r" in
12966 "$define")
12967         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12968         case "$d_gethostbyname_r_proto:$usethreads" in
12969         ":define")      d_gethostbyname_r_proto=define
12970                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12971                 eval $hasproto ;;
12972         *)      ;;
12973         esac
12974         case "$d_gethostbyname_r_proto" in
12975         define)
12976         case "$gethostbyname_r_proto" in
12977         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12978         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12979         esac
12980         case "$gethostbyname_r_proto" in
12981         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12982         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12983         esac
12984         case "$gethostbyname_r_proto" in
12985         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12986         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12987         esac
12988         case "$gethostbyname_r_proto" in
12989         ''|0)   d_gethostbyname_r=undef
12990                 gethostbyname_r_proto=0
12991                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12992         * )     case "$gethostbyname_r_proto" in
12993                 REENTRANT_PROTO*) ;;
12994                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12995                 esac
12996                 echo "Prototype: $try" ;;
12997         esac
12998         ;;
12999         *)      case "$usethreads" in
13000                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13001                 esac
13002                 d_gethostbyname_r=undef
13003                 gethostbyname_r_proto=0
13004                 ;;
13005         esac
13006         ;;
13007 *)      gethostbyname_r_proto=0
13008         ;;
13009 esac
13010
13011 : see if gethostent_r exists
13012 set gethostent_r d_gethostent_r
13013 eval $inlibc
13014 case "$d_gethostent_r" in
13015 "$define")
13016         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13017         case "$d_gethostent_r_proto:$usethreads" in
13018         ":define")      d_gethostent_r_proto=define
13019                 set d_gethostent_r_proto gethostent_r $hdrs
13020                 eval $hasproto ;;
13021         *)      ;;
13022         esac
13023         case "$d_gethostent_r_proto" in
13024         define)
13025         case "$gethostent_r_proto" in
13026         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13027         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13028         esac
13029         case "$gethostent_r_proto" in
13030         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13031         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13032         esac
13033         case "$gethostent_r_proto" in
13034         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13035         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13036         esac
13037         case "$gethostent_r_proto" in
13038         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13039         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13040         esac
13041         case "$gethostent_r_proto" in
13042         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13043         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13044         esac
13045         case "$gethostent_r_proto" in
13046         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13047         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13048         esac
13049         case "$gethostent_r_proto" in
13050         ''|0)   d_gethostent_r=undef
13051                 gethostent_r_proto=0
13052                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13053         * )     case "$gethostent_r_proto" in
13054                 REENTRANT_PROTO*) ;;
13055                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13056                 esac
13057                 echo "Prototype: $try" ;;
13058         esac
13059         ;;
13060         *)      case "$usethreads" in
13061                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13062                 esac
13063                 d_gethostent_r=undef
13064                 gethostent_r_proto=0
13065                 ;;
13066         esac
13067         ;;
13068 *)      gethostent_r_proto=0
13069         ;;
13070 esac
13071
13072 : see if prototypes for various gethostxxx netdb.h functions are available
13073 echo " "
13074 set d_gethostprotos gethostent $i_netdb netdb.h
13075 eval $hasproto
13076
13077 : see if getitimer exists
13078 set getitimer d_getitimer
13079 eval $inlibc
13080
13081 : see if getlogin exists
13082 set getlogin d_getlogin
13083 eval $inlibc
13084
13085 : see if getlogin_r exists
13086 set getlogin_r d_getlogin_r
13087 eval $inlibc
13088 case "$d_getlogin_r" in
13089 "$define")
13090         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13091         case "$d_getlogin_r_proto:$usethreads" in
13092         ":define")      d_getlogin_r_proto=define
13093                 set d_getlogin_r_proto getlogin_r $hdrs
13094                 eval $hasproto ;;
13095         *)      ;;
13096         esac
13097         case "$d_getlogin_r_proto" in
13098         define)
13099         case "$getlogin_r_proto" in
13100         ''|0) try='int getlogin_r(char*, size_t);'
13101         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13102         esac
13103         case "$getlogin_r_proto" in
13104         ''|0) try='int getlogin_r(char*, int);'
13105         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13106         esac
13107         case "$getlogin_r_proto" in
13108         ''|0) try='char* getlogin_r(char*, size_t);'
13109         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13110         esac
13111         case "$getlogin_r_proto" in
13112         ''|0) try='char* getlogin_r(char*, int);'
13113         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13114         esac
13115         case "$getlogin_r_proto" in
13116         ''|0)   d_getlogin_r=undef
13117                 getlogin_r_proto=0
13118                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13119         * )     case "$getlogin_r_proto" in
13120                 REENTRANT_PROTO*) ;;
13121                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13122                 esac
13123                 echo "Prototype: $try" ;;
13124         esac
13125         ;;
13126         *)      case "$usethreads" in
13127                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13128                 esac
13129                 d_getlogin_r=undef
13130                 getlogin_r_proto=0
13131                 ;;
13132         esac
13133         ;;
13134 *)      getlogin_r_proto=0
13135         ;;
13136 esac
13137
13138 : see if getmnt exists
13139 set getmnt d_getmnt
13140 eval $inlibc
13141
13142 : see if getmntent exists
13143 set getmntent d_getmntent
13144 eval $inlibc
13145
13146 : see if getnetbyaddr exists
13147 set getnetbyaddr d_getnbyaddr
13148 eval $inlibc
13149
13150 : see if getnetbyname exists
13151 set getnetbyname d_getnbyname
13152 eval $inlibc
13153
13154 : see if getnetent exists
13155 set getnetent d_getnent
13156 eval $inlibc
13157
13158 : see if getnetbyaddr_r exists
13159 set getnetbyaddr_r d_getnetbyaddr_r
13160 eval $inlibc
13161 case "$d_getnetbyaddr_r" in
13162 "$define")
13163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13164         case "$d_getnetbyaddr_r_proto:$usethreads" in
13165         ":define")      d_getnetbyaddr_r_proto=define
13166                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13167                 eval $hasproto ;;
13168         *)      ;;
13169         esac
13170         case "$d_getnetbyaddr_r_proto" in
13171         define)
13172         case "$getnetbyaddr_r_proto" in
13173         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13174         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13175         esac
13176         case "$getnetbyaddr_r_proto" in
13177         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13178         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13179         esac
13180         case "$getnetbyaddr_r_proto" in
13181         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13182         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13183         esac
13184         case "$getnetbyaddr_r_proto" in
13185         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13186         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13187         esac
13188         case "$getnetbyaddr_r_proto" in
13189         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13190         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13191         esac
13192         case "$getnetbyaddr_r_proto" in
13193         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13194         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13195         esac
13196         case "$getnetbyaddr_r_proto" in
13197         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13198         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13199         esac
13200         case "$getnetbyaddr_r_proto" in
13201         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13202         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13203         esac
13204         case "$getnetbyaddr_r_proto" in
13205         ''|0)   d_getnetbyaddr_r=undef
13206                 getnetbyaddr_r_proto=0
13207                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13208         * )     case "$getnetbyaddr_r_proto" in
13209                 REENTRANT_PROTO*) ;;
13210                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13211                 esac
13212                 echo "Prototype: $try" ;;
13213         esac
13214         ;;
13215         *)      case "$usethreads" in
13216                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13217                 esac
13218                 d_getnetbyaddr_r=undef
13219                 getnetbyaddr_r_proto=0
13220                 ;;
13221         esac
13222         ;;
13223 *)      getnetbyaddr_r_proto=0
13224         ;;
13225 esac
13226
13227 : see if getnetbyname_r exists
13228 set getnetbyname_r d_getnetbyname_r
13229 eval $inlibc
13230 case "$d_getnetbyname_r" in
13231 "$define")
13232         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13233         case "$d_getnetbyname_r_proto:$usethreads" in
13234         ":define")      d_getnetbyname_r_proto=define
13235                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13236                 eval $hasproto ;;
13237         *)      ;;
13238         esac
13239         case "$d_getnetbyname_r_proto" in
13240         define)
13241         case "$getnetbyname_r_proto" in
13242         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13243         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13244         esac
13245         case "$getnetbyname_r_proto" in
13246         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13247         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13248         esac
13249         case "$getnetbyname_r_proto" in
13250         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13251         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13252         esac
13253         case "$getnetbyname_r_proto" in
13254         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13255         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13256         esac
13257         case "$getnetbyname_r_proto" in
13258         ''|0)   d_getnetbyname_r=undef
13259                 getnetbyname_r_proto=0
13260                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13261         * )     case "$getnetbyname_r_proto" in
13262                 REENTRANT_PROTO*) ;;
13263                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13264                 esac
13265                 echo "Prototype: $try" ;;
13266         esac
13267         ;;
13268         *)      case "$usethreads" in
13269                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13270                 esac
13271                 d_getnetbyname_r=undef
13272                 getnetbyname_r_proto=0
13273                 ;;
13274         esac
13275         ;;
13276 *)      getnetbyname_r_proto=0
13277         ;;
13278 esac
13279
13280 : see if getnetent_r exists
13281 set getnetent_r d_getnetent_r
13282 eval $inlibc
13283 case "$d_getnetent_r" in
13284 "$define")
13285         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13286         case "$d_getnetent_r_proto:$usethreads" in
13287         ":define")      d_getnetent_r_proto=define
13288                 set d_getnetent_r_proto getnetent_r $hdrs
13289                 eval $hasproto ;;
13290         *)      ;;
13291         esac
13292         case "$d_getnetent_r_proto" in
13293         define)
13294         case "$getnetent_r_proto" in
13295         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13296         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13297         esac
13298         case "$getnetent_r_proto" in
13299         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13300         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13301         esac
13302         case "$getnetent_r_proto" in
13303         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13304         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13305         esac
13306         case "$getnetent_r_proto" in
13307         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13308         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13309         esac
13310         case "$getnetent_r_proto" in
13311         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13312         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13313         esac
13314         case "$getnetent_r_proto" in
13315         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13316         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13317         esac
13318         case "$getnetent_r_proto" in
13319         ''|0)   d_getnetent_r=undef
13320                 getnetent_r_proto=0
13321                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13322         * )     case "$getnetent_r_proto" in
13323                 REENTRANT_PROTO*) ;;
13324                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13325                 esac
13326                 echo "Prototype: $try" ;;
13327         esac
13328         ;;
13329         *)      case "$usethreads" in
13330                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13331                 esac
13332                 d_getnetent_r=undef
13333                 getnetent_r_proto=0
13334                 ;;
13335         esac
13336         ;;
13337 *)      getnetent_r_proto=0
13338         ;;
13339 esac
13340
13341 : see if prototypes for various getnetxxx netdb.h functions are available
13342 echo " "
13343 set d_getnetprotos getnetent $i_netdb netdb.h
13344 eval $hasproto
13345
13346 : see if getpagesize exists
13347 set getpagesize d_getpagsz
13348 eval $inlibc
13349
13350
13351 : see if getprotobyname exists
13352 set getprotobyname d_getpbyname
13353 eval $inlibc
13354
13355 : see if getprotobynumber exists
13356 set getprotobynumber d_getpbynumber
13357 eval $inlibc
13358
13359 : see if getprotoent exists
13360 set getprotoent d_getpent
13361 eval $inlibc
13362
13363 : see if getpgid exists
13364 set getpgid d_getpgid
13365 eval $inlibc
13366
13367 : see if getpgrp2 exists
13368 set getpgrp2 d_getpgrp2
13369 eval $inlibc
13370
13371 : see if getppid exists
13372 set getppid d_getppid
13373 eval $inlibc
13374
13375 : see if getpriority exists
13376 set getpriority d_getprior
13377 eval $inlibc
13378
13379 : see if getprotobyname_r exists
13380 set getprotobyname_r d_getprotobyname_r
13381 eval $inlibc
13382 case "$d_getprotobyname_r" in
13383 "$define")
13384         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13385         case "$d_getprotobyname_r_proto:$usethreads" in
13386         ":define")      d_getprotobyname_r_proto=define
13387                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13388                 eval $hasproto ;;
13389         *)      ;;
13390         esac
13391         case "$d_getprotobyname_r_proto" in
13392         define)
13393         case "$getprotobyname_r_proto" in
13394         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13395         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13396         esac
13397         case "$getprotobyname_r_proto" in
13398         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13399         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13400         esac
13401         case "$getprotobyname_r_proto" in
13402         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13403         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13404         esac
13405         case "$getprotobyname_r_proto" in
13406         ''|0)   d_getprotobyname_r=undef
13407                 getprotobyname_r_proto=0
13408                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13409         * )     case "$getprotobyname_r_proto" in
13410                 REENTRANT_PROTO*) ;;
13411                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13412                 esac
13413                 echo "Prototype: $try" ;;
13414         esac
13415         ;;
13416         *)      case "$usethreads" in
13417                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13418                 esac
13419                 d_getprotobyname_r=undef
13420                 getprotobyname_r_proto=0
13421                 ;;
13422         esac
13423         ;;
13424 *)      getprotobyname_r_proto=0
13425         ;;
13426 esac
13427
13428 : see if getprotobynumber_r exists
13429 set getprotobynumber_r d_getprotobynumber_r
13430 eval $inlibc
13431 case "$d_getprotobynumber_r" in
13432 "$define")
13433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13434         case "$d_getprotobynumber_r_proto:$usethreads" in
13435         ":define")      d_getprotobynumber_r_proto=define
13436                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13437                 eval $hasproto ;;
13438         *)      ;;
13439         esac
13440         case "$d_getprotobynumber_r_proto" in
13441         define)
13442         case "$getprotobynumber_r_proto" in
13443         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13444         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13445         esac
13446         case "$getprotobynumber_r_proto" in
13447         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13448         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13449         esac
13450         case "$getprotobynumber_r_proto" in
13451         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13452         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13453         esac
13454         case "$getprotobynumber_r_proto" in
13455         ''|0)   d_getprotobynumber_r=undef
13456                 getprotobynumber_r_proto=0
13457                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13458         * )     case "$getprotobynumber_r_proto" in
13459                 REENTRANT_PROTO*) ;;
13460                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13461                 esac
13462                 echo "Prototype: $try" ;;
13463         esac
13464         ;;
13465         *)      case "$usethreads" in
13466                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13467                 esac
13468                 d_getprotobynumber_r=undef
13469                 getprotobynumber_r_proto=0
13470                 ;;
13471         esac
13472         ;;
13473 *)      getprotobynumber_r_proto=0
13474         ;;
13475 esac
13476
13477 : see if getprotoent_r exists
13478 set getprotoent_r d_getprotoent_r
13479 eval $inlibc
13480 case "$d_getprotoent_r" in
13481 "$define")
13482         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13483         case "$d_getprotoent_r_proto:$usethreads" in
13484         ":define")      d_getprotoent_r_proto=define
13485                 set d_getprotoent_r_proto getprotoent_r $hdrs
13486                 eval $hasproto ;;
13487         *)      ;;
13488         esac
13489         case "$d_getprotoent_r_proto" in
13490         define)
13491         case "$getprotoent_r_proto" in
13492         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13493         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13494         esac
13495         case "$getprotoent_r_proto" in
13496         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13497         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13498         esac
13499         case "$getprotoent_r_proto" in
13500         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13501         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13502         esac
13503         case "$getprotoent_r_proto" in
13504         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13505         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13506         esac
13507         case "$getprotoent_r_proto" in
13508         ''|0)   d_getprotoent_r=undef
13509                 getprotoent_r_proto=0
13510                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13511         * )     case "$getprotoent_r_proto" in
13512                 REENTRANT_PROTO*) ;;
13513                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13514                 esac
13515                 echo "Prototype: $try" ;;
13516         esac
13517         ;;
13518         *)      case "$usethreads" in
13519                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13520                 esac
13521                 d_getprotoent_r=undef
13522                 getprotoent_r_proto=0
13523                 ;;
13524         esac
13525         ;;
13526 *)      getprotoent_r_proto=0
13527         ;;
13528 esac
13529
13530 : see if prototypes for various getprotoxxx netdb.h functions are available
13531 echo " "
13532 set d_getprotoprotos getprotoent $i_netdb netdb.h
13533 eval $hasproto
13534
13535 : see if getprpwnam exists
13536 set getprpwnam d_getprpwnam
13537 eval $inlibc
13538
13539 : see if getpwent exists
13540 set getpwent d_getpwent
13541 eval $inlibc
13542
13543 : see if getpwent_r exists
13544 set getpwent_r d_getpwent_r
13545 eval $inlibc
13546 case "$d_getpwent_r" in
13547 "$define")
13548         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13549         case "$d_getpwent_r_proto:$usethreads" in
13550         ":define")      d_getpwent_r_proto=define
13551                 set d_getpwent_r_proto getpwent_r $hdrs
13552                 eval $hasproto ;;
13553         *)      ;;
13554         esac
13555         case "$d_getpwent_r_proto" in
13556         define)
13557         case "$getpwent_r_proto" in
13558         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13559         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13560         esac
13561         case "$getpwent_r_proto" in
13562         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13563         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13564         esac
13565         case "$getpwent_r_proto" in
13566         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13567         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13568         esac
13569         case "$getpwent_r_proto" in
13570         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13571         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13572         esac
13573         case "$getpwent_r_proto" in
13574         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13575         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13576         esac
13577         case "$getpwent_r_proto" in
13578         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13579         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13580         esac
13581         case "$getpwent_r_proto" in
13582         ''|0)   d_getpwent_r=undef
13583                 getpwent_r_proto=0
13584                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13585         * )     case "$getpwent_r_proto" in
13586                 REENTRANT_PROTO*) ;;
13587                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13588                 esac
13589                 echo "Prototype: $try" ;;
13590         esac
13591         ;;
13592         *)      case "$usethreads" in
13593                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13594                 esac
13595                 d_getpwent_r=undef
13596                 getpwent_r_proto=0
13597                 ;;
13598         esac
13599         ;;
13600 *)      getpwent_r_proto=0
13601         ;;
13602 esac
13603
13604 : see if getpwnam_r exists
13605 set getpwnam_r d_getpwnam_r
13606 eval $inlibc
13607 case "$d_getpwnam_r" in
13608 "$define")
13609         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13610         case "$d_getpwnam_r_proto:$usethreads" in
13611         ":define")      d_getpwnam_r_proto=define
13612                 set d_getpwnam_r_proto getpwnam_r $hdrs
13613                 eval $hasproto ;;
13614         *)      ;;
13615         esac
13616         case "$d_getpwnam_r_proto" in
13617         define)
13618         case "$getpwnam_r_proto" in
13619         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13620         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13621         esac
13622         case "$getpwnam_r_proto" in
13623         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13624         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13625         esac
13626         case "$getpwnam_r_proto" in
13627         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13628         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13629         esac
13630         case "$getpwnam_r_proto" in
13631         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13632         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13633         esac
13634         case "$getpwnam_r_proto" in
13635         ''|0)   d_getpwnam_r=undef
13636                 getpwnam_r_proto=0
13637                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13638         * )     case "$getpwnam_r_proto" in
13639                 REENTRANT_PROTO*) ;;
13640                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13641                 esac
13642                 echo "Prototype: $try" ;;
13643         esac
13644         ;;
13645         *)      case "$usethreads" in
13646                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13647                 esac
13648                 d_getpwnam_r=undef
13649                 getpwnam_r_proto=0
13650                 ;;
13651         esac
13652         ;;
13653 *)      getpwnam_r_proto=0
13654         ;;
13655 esac
13656
13657 : see if getpwuid_r exists
13658 set getpwuid_r d_getpwuid_r
13659 eval $inlibc
13660 case "$d_getpwuid_r" in
13661 "$define")
13662         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13663         case "$d_getpwuid_r_proto:$usethreads" in
13664         ":define")      d_getpwuid_r_proto=define
13665                 set d_getpwuid_r_proto getpwuid_r $hdrs
13666                 eval $hasproto ;;
13667         *)      ;;
13668         esac
13669         case "$d_getpwuid_r_proto" in
13670         define)
13671         case "$getpwuid_r_proto" in
13672         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13673         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13674         esac
13675         case "$getpwuid_r_proto" in
13676         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13677         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13678         esac
13679         case "$getpwuid_r_proto" in
13680         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13681         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13682         esac
13683         case "$getpwuid_r_proto" in
13684         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13685         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13686         esac
13687         case "$getpwuid_r_proto" in
13688         ''|0)   d_getpwuid_r=undef
13689                 getpwuid_r_proto=0
13690                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13691         * )     case "$getpwuid_r_proto" in
13692                 REENTRANT_PROTO*) ;;
13693                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13694                 esac
13695                 echo "Prototype: $try" ;;
13696         esac
13697         ;;
13698         *)      case "$usethreads" in
13699                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13700                 esac
13701                 d_getpwuid_r=undef
13702                 getpwuid_r_proto=0
13703                 ;;
13704         esac
13705         ;;
13706 *)      getpwuid_r_proto=0
13707         ;;
13708 esac
13709
13710
13711 : see if getservbyname exists
13712 set getservbyname d_getsbyname
13713 eval $inlibc
13714
13715 : see if getservbyport exists
13716 set getservbyport d_getsbyport
13717 eval $inlibc
13718
13719 : see if getservent exists
13720 set getservent d_getsent
13721 eval $inlibc
13722
13723 : see if getservbyname_r exists
13724 set getservbyname_r d_getservbyname_r
13725 eval $inlibc
13726 case "$d_getservbyname_r" in
13727 "$define")
13728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13729         case "$d_getservbyname_r_proto:$usethreads" in
13730         ":define")      d_getservbyname_r_proto=define
13731                 set d_getservbyname_r_proto getservbyname_r $hdrs
13732                 eval $hasproto ;;
13733         *)      ;;
13734         esac
13735         case "$d_getservbyname_r_proto" in
13736         define)
13737         case "$getservbyname_r_proto" in
13738         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13739         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13740         esac
13741         case "$getservbyname_r_proto" in
13742         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13743         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13744         esac
13745         case "$getservbyname_r_proto" in
13746         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13747         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13748         esac
13749         case "$getservbyname_r_proto" in
13750         ''|0)   d_getservbyname_r=undef
13751                 getservbyname_r_proto=0
13752                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13753         * )     case "$getservbyname_r_proto" in
13754                 REENTRANT_PROTO*) ;;
13755                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13756                 esac
13757                 echo "Prototype: $try" ;;
13758         esac
13759         ;;
13760         *)      case "$usethreads" in
13761                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13762                 esac
13763                 d_getservbyname_r=undef
13764                 getservbyname_r_proto=0
13765                 ;;
13766         esac
13767         ;;
13768 *)      getservbyname_r_proto=0
13769         ;;
13770 esac
13771
13772 : see if getservbyport_r exists
13773 set getservbyport_r d_getservbyport_r
13774 eval $inlibc
13775 case "$d_getservbyport_r" in
13776 "$define")
13777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13778         case "$d_getservbyport_r_proto:$usethreads" in
13779         ":define")      d_getservbyport_r_proto=define
13780                 set d_getservbyport_r_proto getservbyport_r $hdrs
13781                 eval $hasproto ;;
13782         *)      ;;
13783         esac
13784         case "$d_getservbyport_r_proto" in
13785         define)
13786         case "$getservbyport_r_proto" in
13787         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13788         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13789         esac
13790         case "$getservbyport_r_proto" in
13791         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13792         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13793         esac
13794         case "$getservbyport_r_proto" in
13795         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13796         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13797         esac
13798         case "$getservbyport_r_proto" in
13799         ''|0)   d_getservbyport_r=undef
13800                 getservbyport_r_proto=0
13801                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13802         * )     case "$getservbyport_r_proto" in
13803                 REENTRANT_PROTO*) ;;
13804                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13805                 esac
13806                 echo "Prototype: $try" ;;
13807         esac
13808         ;;
13809         *)      case "$usethreads" in
13810                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13811                 esac
13812                 d_getservbyport_r=undef
13813                 getservbyport_r_proto=0
13814                 ;;
13815         esac
13816         ;;
13817 *)      getservbyport_r_proto=0
13818         ;;
13819 esac
13820
13821 : see if getservent_r exists
13822 set getservent_r d_getservent_r
13823 eval $inlibc
13824 case "$d_getservent_r" in
13825 "$define")
13826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13827         case "$d_getservent_r_proto:$usethreads" in
13828         ":define")      d_getservent_r_proto=define
13829                 set d_getservent_r_proto getservent_r $hdrs
13830                 eval $hasproto ;;
13831         *)      ;;
13832         esac
13833         case "$d_getservent_r_proto" in
13834         define)
13835         case "$getservent_r_proto" in
13836         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13837         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13838         esac
13839         case "$getservent_r_proto" in
13840         ''|0) try='int getservent_r(struct servent*, char*, int);'
13841         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13842         esac
13843         case "$getservent_r_proto" in
13844         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13845         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13846         esac
13847         case "$getservent_r_proto" in
13848         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13849         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13850         esac
13851         case "$getservent_r_proto" in
13852         ''|0)   d_getservent_r=undef
13853                 getservent_r_proto=0
13854                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13855         * )     case "$getservent_r_proto" in
13856                 REENTRANT_PROTO*) ;;
13857                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13858                 esac
13859                 echo "Prototype: $try" ;;
13860         esac
13861         ;;
13862         *)      case "$usethreads" in
13863                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13864                 esac
13865                 d_getservent_r=undef
13866                 getservent_r_proto=0
13867                 ;;
13868         esac
13869         ;;
13870 *)      getservent_r_proto=0
13871         ;;
13872 esac
13873
13874 : see if prototypes for various getservxxx netdb.h functions are available
13875 echo " "
13876 set d_getservprotos getservent $i_netdb netdb.h
13877 eval $hasproto
13878
13879 : see if getspnam exists
13880 set getspnam d_getspnam
13881 eval $inlibc
13882
13883 : see if this is a shadow.h system
13884 set shadow.h i_shadow
13885 eval $inhdr
13886
13887 : see if getspnam_r exists
13888 set getspnam_r d_getspnam_r
13889 eval $inlibc
13890 case "$d_getspnam_r" in
13891 "$define")
13892         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13893         case "$d_getspnam_r_proto:$usethreads" in
13894         ":define")      d_getspnam_r_proto=define
13895                 set d_getspnam_r_proto getspnam_r $hdrs
13896                 eval $hasproto ;;
13897         *)      ;;
13898         esac
13899         case "$d_getspnam_r_proto" in
13900         define)
13901         case "$getspnam_r_proto" in
13902         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13903         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13904         esac
13905         case "$getspnam_r_proto" in
13906         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13907         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13908         esac
13909         case "$getspnam_r_proto" in
13910         ''|0)   d_getspnam_r=undef
13911                 getspnam_r_proto=0
13912                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13913         * )     case "$getspnam_r_proto" in
13914                 REENTRANT_PROTO*) ;;
13915                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13916                 esac
13917                 echo "Prototype: $try" ;;
13918         esac
13919         ;;
13920         *)      case "$usethreads" in
13921                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13922                 esac
13923                 d_getspnam_r=undef
13924                 getspnam_r_proto=0
13925                 ;;
13926         esac
13927         ;;
13928 *)      getspnam_r_proto=0
13929         ;;
13930 esac
13931
13932 : see if gettimeofday or ftime exists
13933 set gettimeofday d_gettimeod
13934 eval $inlibc
13935 case "$d_gettimeod" in
13936 "$undef")
13937         set ftime d_ftime 
13938         eval $inlibc
13939         ;;
13940 *)
13941         val="$undef"; set d_ftime; eval $setvar
13942         ;;
13943 esac
13944 case "$d_gettimeod$d_ftime" in
13945 "$undef$undef")
13946         echo " "
13947         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13948         ;;
13949 esac
13950
13951 : see if gmtime_r exists
13952 set gmtime_r d_gmtime_r
13953 eval $inlibc
13954 case "$d_gmtime_r" in
13955 "$define")
13956         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13957         case "$d_gmtime_r_proto:$usethreads" in
13958         ":define")      d_gmtime_r_proto=define
13959                 set d_gmtime_r_proto gmtime_r $hdrs
13960                 eval $hasproto ;;
13961         *)      ;;
13962         esac
13963         case "$d_gmtime_r_proto" in
13964         define)
13965         case "$gmtime_r_proto" in
13966         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13967         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13968         esac
13969         case "$gmtime_r_proto" in
13970         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13971         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13972         esac
13973         case "$gmtime_r_proto" in
13974         ''|0)   d_gmtime_r=undef
13975                 gmtime_r_proto=0
13976                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13977         * )     case "$gmtime_r_proto" in
13978                 REENTRANT_PROTO*) ;;
13979                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13980                 esac
13981                 echo "Prototype: $try" ;;
13982         esac
13983         ;;
13984         *)      case "$usethreads" in
13985                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13986                 esac
13987                 d_gmtime_r=undef
13988                 gmtime_r_proto=0
13989                 ;;
13990         esac
13991         ;;
13992 *)      gmtime_r_proto=0
13993         ;;
13994 esac
13995
13996 : see if hasmntopt exists
13997 set hasmntopt d_hasmntopt
13998 eval $inlibc
13999
14000 : see if this is a netinet/in.h or sys/in.h system
14001 set netinet/in.h i_niin sys/in.h i_sysin
14002 eval $inhdr
14003
14004 : see if arpa/inet.h has to be included
14005 set arpa/inet.h i_arpainet
14006 eval $inhdr
14007
14008 : see if htonl --and friends-- exists
14009 val=''
14010 set htonl val
14011 eval $inlibc
14012
14013 : Maybe they are macros.
14014 case "$val" in
14015 $undef)
14016         $cat >htonl.c <<EOM
14017 #include <stdio.h>
14018 #include <sys/types.h>
14019 #$i_niin I_NETINET_IN
14020 #$i_sysin I_SYS_IN
14021 #$i_arpainet I_ARPA_INET
14022 #ifdef I_NETINET_IN
14023 #include <netinet/in.h>
14024 #endif
14025 #ifdef I_SYS_IN
14026 #include <sys/in.h>
14027 #endif
14028 #ifdef I_ARPA_INET
14029 #include <arpa/inet.h>
14030 #endif
14031 #ifdef htonl
14032 printf("Defined as a macro.");
14033 #endif
14034 EOM
14035         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14036         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14037                 val="$define"
14038                 echo "But it seems to be defined as a macro." >&4
14039         fi
14040         $rm -f htonl.?
14041         ;;
14042 esac
14043 set d_htonl
14044 eval $setvar
14045
14046 : see if ilogbl exists
14047 set ilogbl d_ilogbl
14048 eval $inlibc
14049
14050 : index or strchr
14051 echo " "
14052 if set index val -f; eval $csym; $val; then
14053         if set strchr val -f d_strchr; eval $csym; $val; then
14054                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14055                         val="$define"
14056                         vali="$undef"
14057                         echo "strchr() found." >&4
14058                 else
14059                         val="$undef"
14060                         vali="$define"
14061                         echo "index() found." >&4
14062                 fi
14063         else
14064                 val="$undef"
14065                 vali="$define"
14066                 echo "index() found." >&4
14067         fi
14068 else
14069         if set strchr val -f d_strchr; eval $csym; $val; then
14070                 val="$define"
14071                 vali="$undef"
14072                 echo "strchr() found." >&4
14073         else
14074                 echo "No index() or strchr() found!" >&4
14075                 val="$undef"
14076                 vali="$undef"
14077         fi
14078 fi
14079 set d_strchr; eval $setvar
14080 val="$vali"
14081 set d_index; eval $setvar
14082
14083 : check whether inet_aton exists
14084 set inet_aton d_inetaton
14085 eval $inlibc
14086
14087 : Look for isascii
14088 echo " "
14089 $cat >isascii.c <<EOCP
14090 #include <stdio.h>
14091 #include <ctype.h>
14092 #$i_stdlib I_STDLIB
14093 #ifdef I_STDLIB
14094 #include <stdlib.h>
14095 #endif
14096 int main() {
14097         int c = 'A';
14098         if (isascii(c))
14099                 exit(0);
14100         else
14101                 exit(1);
14102 }
14103 EOCP
14104 set isascii
14105 if eval $compile; then
14106         echo "isascii() found." >&4
14107         val="$define"
14108 else
14109         echo "isascii() NOT found." >&4
14110         val="$undef"
14111 fi
14112 set d_isascii
14113 eval $setvar
14114 $rm -f isascii*
14115
14116 : see if isfinite exists
14117 set isfinite d_isfinite
14118 eval $inlibc
14119
14120 : see if isinf exists
14121 set isinf d_isinf
14122 eval $inlibc
14123
14124 : see if isnan exists
14125 set isnan d_isnan
14126 eval $inlibc
14127
14128 : see if isnanl exists
14129 set isnanl d_isnanl
14130 eval $inlibc
14131
14132 : see if killpg exists
14133 set killpg d_killpg
14134 eval $inlibc
14135
14136 : see if lchown exists
14137 echo " "
14138 $cat > try.c <<'EOCP'
14139 /* System header to define __stub macros and hopefully few prototypes,
14140     which can conflict with char lchown(); below.  */
14141 #include <assert.h>
14142 /* Override any gcc2 internal prototype to avoid an error.  */
14143 /* We use char because int might match the return type of a gcc2
14144    builtin and then its argument prototype would still apply.  */
14145 char lchown();
14146 int main() {
14147     /*  The GNU C library defines this for functions which it implements
14148         to always fail with ENOSYS.  Some functions are actually named
14149         something starting with __ and the normal name is an alias.  */
14150 #if defined (__stub_lchown) || defined (__stub___lchown)
14151 choke me
14152 #else
14153 lchown();
14154 #endif
14155 ; return 0; }
14156 EOCP
14157 set try
14158 if eval $compile; then
14159     $echo "lchown() found." >&4
14160     val="$define"
14161 else
14162     $echo "lchown() NOT found." >&4
14163     val="$undef"
14164 fi
14165 set d_lchown
14166 eval $setvar
14167
14168 : See if number of significant digits in a double precision number is known
14169 echo " "
14170 $cat >ldbl_dig.c <<EOM
14171 #$i_limits I_LIMITS
14172 #$i_float I_FLOAT
14173 #ifdef I_LIMITS
14174 #include <limits.h>
14175 #endif
14176 #ifdef I_FLOAT
14177 #include <float.h>
14178 #endif
14179 #ifdef LDBL_DIG
14180 printf("Contains LDBL_DIG");
14181 #endif
14182 EOM
14183 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14184 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14185         echo "LDBL_DIG found." >&4
14186         val="$define"
14187 else
14188         echo "LDBL_DIG NOT found." >&4
14189         val="$undef"
14190 fi
14191 $rm -f ldbl_dig.?
14192 set d_ldbl_dig
14193 eval $setvar
14194
14195 : see if this is a math.h system
14196 set math.h i_math
14197 eval $inhdr
14198
14199 d_libm_lib_version="$undef"
14200 case $i_math in
14201     $define)
14202         : check to see if math.h defines _LIB_VERSION
14203         echo " "
14204         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14205         $cat >try.c <<EOCP
14206 #include <unistd.h>
14207 #include <math.h>
14208 int main (int argc, char *argv[])
14209 {
14210     printf ("%d\n", _LIB_VERSION);
14211     return (0);
14212     } /* main */
14213 EOCP
14214         set try
14215         if eval $compile; then
14216             foo=`$run ./try`
14217             echo "Yes, it does ($foo)" >&4
14218             d_libm_lib_version="$define"
14219         else
14220             echo "No, it does not (probably harmless)\n" >&4
14221             fi
14222         $rm -f try.* try core core.try.*
14223         ;;
14224
14225     esac
14226
14227 : see if link exists
14228 set link d_link
14229 eval $inlibc
14230
14231 : see if localtime_r exists
14232 set localtime_r d_localtime_r
14233 eval $inlibc
14234 case "$d_localtime_r" in
14235 "$define")
14236         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14237         case "$d_localtime_r_proto:$usethreads" in
14238         ":define")      d_localtime_r_proto=define
14239                 set d_localtime_r_proto localtime_r $hdrs
14240                 eval $hasproto ;;
14241         *)      ;;
14242         esac
14243         case "$d_localtime_r_proto" in
14244         define)
14245         case "$localtime_r_proto" in
14246         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14247         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14248         esac
14249         case "$localtime_r_proto" in
14250         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14251         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14252         esac
14253         case "$localtime_r_proto" in
14254         ''|0)   d_localtime_r=undef
14255                 localtime_r_proto=0
14256                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14257         * )     case "$localtime_r_proto" in
14258                 REENTRANT_PROTO*) ;;
14259                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14260                 esac
14261                 echo "Prototype: $try" ;;
14262         esac
14263         ;;
14264         *)      case "$usethreads" in
14265                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14266                 esac
14267                 d_localtime_r=undef
14268                 localtime_r_proto=0
14269                 ;;
14270         esac
14271         ;;
14272 *)      localtime_r_proto=0
14273         ;;
14274 esac
14275
14276 : see if localeconv exists
14277 set localeconv d_locconv
14278 eval $inlibc
14279
14280 : see if lockf exists
14281 set lockf d_lockf
14282 eval $inlibc
14283
14284 : see if prototype for lseek is available
14285 echo " "
14286 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14287 eval $hasproto
14288
14289 : see if lstat exists
14290 set lstat d_lstat
14291 eval $inlibc
14292
14293 : see if madvise exists
14294 set madvise d_madvise
14295 eval $inlibc
14296
14297 : see if malloc_size exists
14298 set malloc_size d_malloc_size
14299 eval $inlibc
14300
14301 : see if malloc_size_good exists
14302 set malloc_good_size d_malloc_good_size
14303 eval $inlibc
14304
14305 : see if mblen exists
14306 set mblen d_mblen
14307 eval $inlibc
14308
14309 : see if mbstowcs exists
14310 set mbstowcs d_mbstowcs
14311 eval $inlibc
14312
14313 : see if mbtowc exists
14314 set mbtowc d_mbtowc
14315 eval $inlibc
14316
14317 : see if memchr exists
14318 set memchr d_memchr
14319 eval $inlibc
14320
14321 : see if memcmp exists
14322 set memcmp d_memcmp
14323 eval $inlibc
14324
14325 : see if memcpy exists
14326 set memcpy d_memcpy
14327 eval $inlibc
14328
14329 : see if memmove exists
14330 set memmove d_memmove
14331 eval $inlibc
14332
14333 : see if memset exists
14334 set memset d_memset
14335 eval $inlibc
14336
14337 : see if mkdir exists
14338 set mkdir d_mkdir
14339 eval $inlibc
14340
14341 : see if mkdtemp exists
14342 set mkdtemp d_mkdtemp
14343 eval $inlibc
14344
14345 : see if mkfifo exists
14346 set mkfifo d_mkfifo
14347 eval $inlibc
14348
14349 : see if mkstemp exists
14350 set mkstemp d_mkstemp
14351 eval $inlibc
14352
14353 : see if mkstemps exists
14354 set mkstemps d_mkstemps
14355 eval $inlibc
14356
14357 : see if mktime exists
14358 set mktime d_mktime
14359 eval $inlibc
14360
14361 : see if this is a sys/mman.h system
14362 set sys/mman.h i_sysmman
14363 eval $inhdr
14364
14365 : see if mmap exists
14366 set mmap d_mmap
14367 eval $inlibc
14368 : see what shmat returns
14369 : default to something harmless
14370 mmaptype='void *'
14371 case "$i_sysmman$d_mmap" in
14372 "$define$define")
14373         $cat >mmap.c <<'END'
14374 #include <sys/mman.h>
14375 void *mmap();
14376 END
14377         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14378                 mmaptype='void *'
14379         else
14380                 mmaptype='caddr_t'
14381         fi
14382         echo "and it returns ($mmaptype)." >&4
14383         ;;
14384 esac
14385
14386
14387
14388 : see if sqrtl exists
14389 set sqrtl d_sqrtl
14390 eval $inlibc
14391
14392 : see if scalbnl exists
14393 set scalbnl d_scalbnl
14394 eval $inlibc
14395
14396 : see if modfl exists
14397 set modfl d_modfl
14398 eval $inlibc
14399
14400 : see if prototype for modfl is available
14401 echo " "
14402 set d_modflproto modfl $i_math math.h
14403 eval $hasproto
14404
14405 d_modfl_pow32_bug="$undef"
14406
14407 case "$d_longdbl$d_modfl" in
14408 $define$define)
14409         $cat <<EOM
14410 Checking to see whether your modfl() is okay for large values...
14411 EOM
14412 $cat >try.c <<EOCP
14413 #include <math.h> 
14414 #include <stdio.h>
14415 EOCP
14416 if $test "X$d_modflproto" != "X$define"; then
14417         $cat >>try.c <<EOCP
14418 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14419 long double modfl (long double, long double *);
14420 EOCP
14421 fi
14422 $cat >>try.c <<EOCP
14423 int main() {
14424     long double nv = 4294967303.15;
14425     long double v, w;
14426     v = modfl(nv, &w);         
14427 #ifdef __GLIBC__
14428     printf("glibc");
14429 #endif
14430     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14431     return 0;
14432 }
14433 EOCP
14434         case "$osname:$gccversion" in
14435         aix:)   saveccflags="$ccflags"
14436                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14437         esac
14438         set try
14439         if eval $compile; then
14440                 foo=`$run ./try`
14441                 case "$foo" in
14442                 *" 4294967303.150000 1.150000 4294967302.000000")
14443                         echo >&4 "Your modfl() is broken for large values."
14444                         d_modfl_pow32_bug="$define"
14445                         case "$foo" in
14446                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14447                         ;;
14448                         esac
14449                         ;;
14450                 *" 4294967303.150000 0.150000 4294967303.000000")
14451                         echo >&4 "Your modfl() seems okay for large values."
14452                         ;;
14453                 *)      echo >&4 "I don't understand your modfl() at all."
14454                         d_modfl="$undef"
14455                         ;;
14456                 esac
14457                 $rm -f try.* try core core.try.*
14458         else
14459                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14460                 d_modfl="$undef"
14461         fi
14462         case "$osname:$gccversion" in
14463         aix:)   ccflags="$saveccflags" ;; # restore
14464         esac
14465         ;;
14466 esac
14467
14468 if $test "$uselongdouble" = "$define"; then
14469     message=""
14470     if $test "$d_sqrtl" != "$define"; then
14471         message="$message sqrtl"
14472     fi
14473     if $test "$d_modfl" != "$define"; then
14474         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14475             echo "You have both aintl and copysignl, so I can emulate modfl."
14476         else
14477             message="$message modfl"
14478         fi
14479     fi
14480     if $test "$d_frexpl" != "$define"; then
14481         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14482             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14483         else
14484             message="$message frexpl"
14485         fi
14486     fi
14487
14488     if $test "$message" != ""; then
14489         $cat <<EOM >&4
14490
14491 *** You requested the use of long doubles but you do not seem to have
14492 *** the following mathematical functions needed for long double support:
14493 ***    $message
14494 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14495 *** Cannot continue, aborting.
14496
14497 EOM
14498
14499         exit 1
14500     fi
14501 fi
14502
14503 : see if mprotect exists
14504 set mprotect d_mprotect
14505 eval $inlibc
14506
14507 : see if msgctl exists
14508 set msgctl d_msgctl
14509 eval $inlibc
14510
14511 : see if msgget exists
14512 set msgget d_msgget
14513 eval $inlibc
14514
14515 : see if msgsnd exists
14516 set msgsnd d_msgsnd
14517 eval $inlibc
14518
14519 : see if msgrcv exists
14520 set msgrcv d_msgrcv
14521 eval $inlibc
14522
14523 : see how much of the 'msg*(2)' library is present.
14524 h_msg=true
14525 echo " "
14526 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14527 *"$undef"*) h_msg=false;;
14528 esac
14529 case "$osname" in
14530 freebsd)
14531     case "`ipcs 2>&1`" in
14532     "SVID messages"*"not configured"*)
14533         echo "Your $osname does not have the msg*(2) configured." >&4
14534         h_msg=false
14535         val="$undef"
14536         set msgctl d_msgctl
14537         eval $setvar
14538         set msgget d_msgget
14539         eval $setvar
14540         set msgsnd d_msgsnd
14541         eval $setvar
14542         set msgrcv d_msgrcv
14543         eval $setvar
14544         ;;
14545     esac
14546     ;;
14547 esac
14548 : we could also check for sys/ipc.h ...
14549 if $h_msg && $test `./findhdr sys/msg.h`; then
14550         echo "You have the full msg*(2) library." >&4
14551         val="$define"
14552 else
14553         echo "You don't have the full msg*(2) library." >&4
14554         val="$undef"
14555 fi
14556 set d_msg
14557 eval $setvar
14558
14559
14560 echo " "
14561 echo "Checking to see if your system supports struct msghdr..." >&4
14562 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14563 eval $hasstruct
14564 case "$d_msghdr_s" in
14565 "$define")      echo "Yes, it does."   ;;
14566 *)              echo "No, it doesn't." ;;
14567 esac
14568
14569
14570 : see if msync exists
14571 set msync d_msync
14572 eval $inlibc
14573
14574 : see if munmap exists
14575 set munmap d_munmap
14576 eval $inlibc
14577
14578 : see if nice exists
14579 set nice d_nice
14580 eval $inlibc
14581
14582 : see if this is a langinfo.h system
14583 set langinfo.h i_langinfo
14584 eval $inhdr
14585
14586 : see if nl_langinfo exists
14587 set nl_langinfo d_nl_langinfo
14588 eval $inlibc
14589
14590 : check for length of character
14591 echo " "
14592 case "$charsize" in
14593 '')
14594         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14595         $cat >try.c <<EOCP
14596 #include <stdio.h>
14597 #$i_stdlib I_STDLIB
14598 #ifdef I_STDLIB
14599 #include <stdlib.h>
14600 #endif
14601 int main()
14602 {
14603     printf("%d\n", (int)sizeof(char));
14604     exit(0);
14605 }
14606 EOCP
14607         set try
14608         if eval $compile_ok; then
14609                 dflt=`$run ./try`
14610         else
14611                 dflt='1'
14612                 echo "(I can't seem to compile the test program.  Guessing...)"
14613         fi
14614         ;;
14615 *)
14616         dflt="$charsize"
14617         ;;
14618 esac
14619 rp="What is the size of a character (in bytes)?"
14620 . ./myread
14621 charsize="$ans"
14622 $rm -f try.c try
14623
14624 : check for volatile keyword
14625 echo " "
14626 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14627 $cat >try.c <<'EOCP'
14628 int main()
14629 {
14630         typedef struct _goo_struct goo_struct;
14631         goo_struct * volatile goo = ((goo_struct *)0);
14632         struct _goo_struct {
14633                 long long_int;
14634                 int reg_int;
14635                 char char_var;
14636         };
14637         typedef unsigned short foo_t;
14638         char *volatile foo;
14639         volatile int bar;
14640         volatile foo_t blech;
14641         foo = foo;
14642 }
14643 EOCP
14644 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14645         val="$define"
14646         echo "Yup, it does."
14647 else
14648         val="$undef"
14649         echo "Nope, it doesn't."
14650 fi
14651 set d_volatile
14652 eval $setvar
14653 $rm -f try.*
14654
14655
14656 echo " "
14657 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14658
14659 case "$use64bitint:$d_quad:$quadtype" in
14660 define:define:?*)
14661         ivtype="$quadtype"
14662         uvtype="$uquadtype"
14663         ivsize=8
14664         uvsize=8
14665         ;;
14666 *)      ivtype="long"
14667         uvtype="unsigned long"
14668         ivsize=$longsize
14669         uvsize=$longsize
14670         ;;
14671 esac
14672
14673 case "$uselongdouble:$d_longdbl" in
14674 define:define)
14675         nvtype="long double"
14676         nvsize=$longdblsize
14677         ;;
14678 *)      nvtype=double
14679         nvsize=$doublesize
14680         ;;
14681 esac
14682
14683 $echo "(IV will be "$ivtype", $ivsize bytes)"
14684 $echo "(UV will be "$uvtype", $uvsize bytes)"
14685 $echo "(NV will be "$nvtype", $nvsize bytes)"
14686
14687 $cat >try.c <<EOCP
14688 #$i_inttypes I_INTTYPES
14689 #ifdef I_INTTYPES
14690 #include <inttypes.h>
14691 #endif
14692 #include <stdio.h>
14693 int main() {
14694 #ifdef INT8
14695    int8_t i =  INT8_MAX;
14696   uint8_t u = UINT8_MAX;
14697   printf("int8_t\n");
14698 #endif
14699 #ifdef INT16
14700    int16_t i =  INT16_MAX;
14701   uint16_t i = UINT16_MAX;
14702   printf("int16_t\n");
14703 #endif
14704 #ifdef INT32
14705    int32_t i =  INT32_MAX;
14706   uint32_t u = UINT32_MAX;
14707   printf("int32_t\n");
14708 #endif
14709 }
14710 EOCP
14711
14712 case "$i8type" in
14713 '')     case "$charsize" in
14714         1)      i8type=char
14715                 u8type="unsigned char"
14716                 i8size=$charsize
14717                 u8size=$charsize
14718                 ;;
14719         esac
14720         ;;
14721 esac
14722 case "$i8type" in
14723 '')     set try -DINT8
14724         if eval $compile; then
14725                 case "`$run ./try`" in
14726                 int8_t) i8type=int8_t
14727                         u8type=uint8_t
14728                         i8size=1
14729                         u8size=1
14730                         ;;
14731                 esac
14732         fi
14733         ;;
14734 esac
14735 case "$i8type" in
14736 '')     if $test $charsize -ge 1; then
14737                 i8type=char
14738                 u8type="unsigned char"
14739                 i8size=$charsize
14740                 u8size=$charsize
14741         fi
14742         ;;
14743 esac
14744
14745 case "$i16type" in
14746 '')     case "$shortsize" in
14747         2)      i16type=short
14748                 u16type="unsigned short"
14749                 i16size=$shortsize
14750                 u16size=$shortsize
14751                 ;;
14752         esac
14753         ;;
14754 esac
14755 case "$i16type" in
14756 '')     set try -DINT16
14757         if eval $compile; then
14758                 case "`$run ./try`" in
14759                 int16_t)
14760                         i16type=int16_t
14761                         u16type=uint16_t
14762                         i16size=2
14763                         u16size=2
14764                         ;;
14765                 esac
14766         fi
14767         ;;
14768 esac
14769 case "$i16type" in
14770 '')     if $test $shortsize -ge 2; then
14771                 i16type=short
14772                 u16type="unsigned short"
14773                 i16size=$shortsize
14774                 u16size=$shortsize
14775         fi
14776         ;;
14777 esac
14778
14779 case "$i32type" in
14780 '')     case "$longsize" in
14781         4)      i32type=long
14782                 u32type="unsigned long"
14783                 i32size=$longsize
14784                 u32size=$longsize
14785                 ;;
14786         *)      case "$intsize" in
14787                 4)      i32type=int
14788                         u32type="unsigned int"
14789                         i32size=$intsize
14790                         u32size=$intsize
14791                         ;;
14792                 esac
14793                 ;;
14794         esac
14795         ;;
14796 esac
14797 case "$i32type" in
14798 '')     set try -DINT32
14799         if eval $compile; then
14800                 case "`$run ./try`" in
14801                 int32_t)
14802                         i32type=int32_t
14803                         u32type=uint32_t
14804                         i32size=4
14805                         u32size=4
14806                         ;;
14807                 esac
14808         fi
14809         ;;
14810 esac
14811 case "$i32type" in
14812 '')     if $test $intsize -ge 4; then
14813                 i32type=int
14814                 u32type="unsigned int"
14815                 i32size=$intsize
14816                 u32size=$intsize
14817         fi
14818         ;;
14819 esac
14820
14821 case "$i64type" in
14822 '')     case "$d_quad:$quadtype" in
14823         define:?*)
14824                 i64type="$quadtype"
14825                 u64type="$uquadtype"
14826                 i64size=8
14827                 u64size=8
14828                 ;;
14829         esac
14830         ;;
14831 esac
14832
14833 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14834 : volatile so that the compiler has to store it out to memory.
14835 if test X"$d_volatile" = X"$define"; then
14836         volatile=volatile
14837 fi
14838 $cat <<EOP >try.c
14839 #include <stdio.h>
14840 #$i_stdlib I_STDLIB
14841 #ifdef I_STDLIB
14842 #include <stdlib.h>
14843 #endif
14844 #include <sys/types.h>
14845 #include <signal.h>
14846 #ifdef SIGFPE
14847 $volatile int bletched = 0;
14848 $signal_t blech(s) int s; { bletched = 1; }
14849 #endif
14850 int main() {
14851     $uvtype u = 0;
14852     $nvtype d;
14853     int     n = 8 * $uvsize;
14854     int     i;
14855 #ifdef SIGFPE
14856     signal(SIGFPE, blech);
14857 #endif
14858
14859     for (i = 0; i < n; i++) {
14860       u = u << 1 | ($uvtype)1;
14861       d = ($nvtype)u;
14862       if (($uvtype)d != u)
14863         break;
14864       if (d <= 0)
14865         break;
14866       d = ($nvtype)(u - 1);
14867       if (($uvtype)d != (u - 1))
14868         break;
14869 #ifdef SIGFPE
14870       if (bletched) {
14871         break;
14872 #endif
14873       } 
14874     }
14875     printf("%d\n", ((i == n) ? -n : i));
14876     exit(0);
14877 }
14878 EOP
14879 set try
14880
14881 d_nv_preserves_uv="$undef"
14882 if eval $compile; then
14883         nv_preserves_uv_bits="`$run ./try`"
14884 fi
14885 case "$nv_preserves_uv_bits" in
14886 \-[1-9]*)       
14887         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14888         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14889         d_nv_preserves_uv="$define"
14890         ;;
14891 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14892         d_nv_preserves_uv="$undef" ;;
14893 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14894         nv_preserves_uv_bits="$undef" ;;
14895 esac
14896
14897 $rm -f try.* try
14898
14899 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14900 : volatile so that the compiler has to store it out to memory.
14901 if test X"$d_volatile" = X"$define"; then
14902         volatile=volatile
14903 fi
14904 $cat <<EOP >try.c
14905 #include <stdio.h>
14906 #$i_stdlib I_STDLIB
14907 #ifdef I_STDLIB
14908 #include <stdlib.h>
14909 #endif
14910 #$i_string I_STRING
14911 #ifdef I_STRING
14912 #  include <string.h>
14913 #else
14914 #  include <strings.h>
14915 #endif
14916 #include <sys/types.h>
14917 #include <signal.h>
14918 #ifdef SIGFPE
14919 $volatile int bletched = 0;
14920 $signal_t blech(s) int s; { bletched = 1; }
14921 #endif
14922
14923 int checkit($nvtype d, char *where) {
14924     unsigned char *p = (char *)&d;
14925     unsigned char *end = p + sizeof(d);
14926     int fail = 0;
14927
14928     while (p < end)
14929         fail += *p++;
14930
14931     if (!fail)
14932         return 0;
14933
14934     p = (char *)&d;
14935     printf("No - %s: 0x", where);
14936     while (p < end)
14937         printf ("%02X", *p++);
14938     printf("\n");
14939     return 1;
14940 }
14941
14942 int main(int argc, char **argv) {
14943     $nvtype d = 0.0;
14944     int fail = 0;
14945     fail += checkit(d, "0.0");
14946
14947     /* The compiler shouldn't be assuming that bletched is 0  */
14948     d = bletched;
14949
14950     fail += checkit(d, "bleched");
14951
14952 #ifdef SIGFPE
14953     signal(SIGFPE, blech);
14954 #endif
14955
14956     /* Paranoia - the compiler should have no way of knowing that ANSI says
14957        that argv[argc] will always be NULL.  Actually, if it did assume this it
14958        would be buggy, as this is C and main() can be called from elsewhere in
14959        the program.  */
14960     d = argv[argc] ? 1 : 0;
14961
14962     if (d) {
14963         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14964     }
14965
14966     fail += checkit(d, "ternary");
14967
14968     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14969
14970     if (d != 0.0) {
14971         printf("No - memset doesn't give 0.0\n");
14972         /* This might just blow up:  */
14973         printf("(gives %g)\n", d);
14974         return 1;
14975     }
14976     
14977 #ifdef SIGFPE
14978     if (bletched) {
14979         printf("No - something bleched\n");
14980         return 1;
14981     }
14982 #endif
14983     if (fail) {
14984       printf("No - %d fail(s)\n", fail);
14985       return 1;
14986     }
14987     printf("Yes\n");
14988     return 0;
14989 }
14990 EOP
14991 set try
14992
14993 d_nv_zero_is_allbits_zero="$undef"
14994 if eval $compile; then
14995     xxx="`$run ./try`"
14996     case "$?" in
14997         0)
14998             case "$xxx" in
14999                 Yes)  cat >&4 <<EOM
15000 0.0 is represented as all bits zero in memory
15001 EOM
15002                     d_nv_zero_is_allbits_zero="$define"
15003                     ;;
15004                 *)  cat >&4 <<EOM
15005 0.0 is not represented as all bits zero in memory
15006 EOM
15007                     d_nv_zero_is_allbits_zero="$undef"
15008                     ;;
15009             esac
15010             ;;
15011         *)  cat >&4 <<EOM
15012 0.0 is not represented as all bits zero in memory
15013 EOM
15014             d_nv_zero_is_allbits_zero="$undef"
15015             ;;
15016     esac
15017 fi
15018
15019 $rm -f try.* try
15020
15021
15022 : check for off64_t
15023 echo " "
15024 echo "Checking to see if you have off64_t..." >&4
15025 $cat >try.c <<EOCP
15026 #include <sys/types.h>
15027 #include <unistd.h>
15028 int main() { off64_t x = 7; }
15029 EOCP
15030 set try
15031 if eval $compile; then
15032         val="$define"
15033         echo "You have off64_t."
15034 else
15035         val="$undef"
15036         echo "You do not have off64_t."
15037         case "$lseeksize" in
15038         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15039         esac
15040 fi
15041 $rm -f try.* try
15042 set d_off64_t
15043 eval $setvar
15044
15045 : how to create joinable pthreads
15046 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15047         echo " "
15048         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15049         $cat >try.c <<'EOCP'
15050 #include <pthread.h>
15051 int main() {
15052     int detachstate = JOINABLE;
15053 }
15054 EOCP
15055         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15056         if eval $compile; then
15057                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15058                 val="$undef" # Yes, undef.
15059                 set d_old_pthread_create_joinable
15060                 eval $setvar
15061                 val=""
15062                 set old_pthread_create_joinable
15063                 eval $setvar
15064         else
15065                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15066                 if eval $compile; then
15067                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15068                         val="$define"
15069                         set d_old_pthread_create_joinable
15070                         eval $setvar
15071                         val=PTHREAD_CREATE_UNDETACHED
15072                         set old_pthread_create_joinable
15073                         eval $setvar
15074                 else            
15075                         set try -DJOINABLE=__UNDETACHED
15076                         if eval $compile; then
15077                                 echo "You seem to use __UNDETACHED." >&4
15078                                 val="$define"
15079                                 set d_old_pthread_create_joinable
15080                                 eval $setvar
15081                                 val=__UNDETACHED
15082                                 set old_pthread_create_joinable
15083                                 eval $setvar
15084                         else
15085                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15086                                 val="$define"
15087                                 set d_old_pthread_create_joinable
15088                                 eval $setvar
15089                                 val=0
15090                                 set old_pthread_create_joinable
15091                                 eval $setvar
15092                         fi
15093                 fi
15094         fi
15095         $rm -f try try.*
15096 else
15097     d_old_pthread_create_joinable="$undef"
15098     old_pthread_create_joinable=""
15099 fi
15100
15101 : see if pause exists
15102 set pause d_pause
15103 eval $inlibc
15104
15105 : see if pipe exists
15106 set pipe d_pipe
15107 eval $inlibc
15108
15109 : see if poll exists
15110 set poll d_poll
15111 eval $inlibc
15112
15113 : see if readlink exists
15114 set readlink d_readlink
15115 eval $inlibc
15116
15117 echo " "
15118 procselfexe=''
15119 val="$undef"
15120 case "$d_readlink" in
15121 "$define")
15122         if $issymlink /proc/self/exe ; then
15123                 $ls -l /proc/self/exe > reflect
15124                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15125                         echo "You have Linux-like /proc/self/exe."
15126                         procselfexe='"/proc/self/exe"'
15127                         val="$define"
15128                 fi
15129         fi
15130         if $issymlink /proc/curproc/file ; then
15131                 $ls -l /proc/curproc/file > reflect
15132                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15133                         echo "You have BSD-like /proc/curproc/file."
15134                         procselfexe='"/proc/curproc/file"'
15135                         val="$define"
15136                 fi
15137         fi
15138         ;;
15139 esac
15140 $rm -f reflect
15141 set d_procselfexe
15142 eval $setvar
15143
15144 : see whether the pthread_atfork exists
15145 $cat >try.c <<EOP
15146 #include <pthread.h>
15147 #include <stdio.h>
15148 int main() {
15149 #ifdef  PTHREAD_ATFORK
15150         pthread_atfork(NULL,NULL,NULL);
15151 #endif
15152 }
15153 EOP
15154
15155 : see if pthread_atfork exists
15156 set try -DPTHREAD_ATFORK
15157 if eval $compile; then
15158     val="$define"
15159 else
15160     val="$undef"
15161 fi
15162 case "$usethreads" in
15163 $define)
15164         case "$val" in
15165         $define) echo 'pthread_atfork found.' >&4        ;;
15166         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15167         esac
15168 esac
15169 set d_pthread_atfork
15170 eval $setvar
15171
15172 : see if pthread_attr_setscope exists
15173 set pthread_attr_setscope d_pthread_attr_setscope
15174 eval $inlibc
15175
15176
15177 : see whether the various POSIXish _yields exist
15178 $cat >try.c <<EOP
15179 #include <pthread.h>
15180 #include <stdio.h>
15181 int main() {
15182 #ifdef SCHED_YIELD
15183         sched_yield();
15184 #else
15185 #ifdef PTHREAD_YIELD
15186         pthread_yield();
15187 #else
15188 #ifdef PTHREAD_YIELD_NULL
15189         pthread_yield(NULL);
15190 #endif
15191 #endif
15192 #endif
15193 }
15194 EOP
15195 : see if sched_yield exists
15196 set try -DSCHED_YIELD
15197 if eval $compile; then
15198     val="$define"
15199     sched_yield='sched_yield()'
15200 else
15201     val="$undef"
15202 fi
15203 case "$usethreads" in
15204 $define)
15205         case "$val" in
15206         $define) echo 'sched_yield() found.' >&4        ;;
15207         *)       echo 'sched_yield() NOT found.' >&4    ;;
15208         esac
15209 esac
15210 set d_sched_yield
15211 eval $setvar
15212
15213 : see if pthread_yield exists
15214 set try -DPTHREAD_YIELD
15215 if eval $compile; then
15216     val="$define"
15217     case "$sched_yield" in
15218     '') sched_yield='pthread_yield()' ;;
15219     esac
15220 else
15221     set try -DPTHREAD_YIELD_NULL
15222     if eval $compile; then
15223         val="$define"
15224         case "$sched_yield" in
15225         '') sched_yield='pthread_yield(NULL)' ;;
15226         esac
15227     else
15228         val="$undef"
15229     fi
15230 fi
15231 case "$usethreads" in
15232 $define)
15233         case "$val" in
15234         $define) echo 'pthread_yield() found.' >&4      ;;
15235         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15236         esac
15237         ;;
15238 esac
15239 set d_pthread_yield
15240 eval $setvar
15241
15242 case "$sched_yield" in
15243 '') sched_yield=undef ;;
15244 esac
15245
15246 $rm -f try try.*
15247
15248 : see if random_r exists
15249 set random_r d_random_r
15250 eval $inlibc
15251 case "$d_random_r" in
15252 "$define")
15253         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15254         case "$d_random_r_proto:$usethreads" in
15255         ":define")      d_random_r_proto=define
15256                 set d_random_r_proto random_r $hdrs
15257                 eval $hasproto ;;
15258         *)      ;;
15259         esac
15260         case "$d_random_r_proto" in
15261         define)
15262         case "$random_r_proto" in
15263         ''|0) try='int random_r(int*, struct random_data*);'
15264         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15265         esac
15266         case "$random_r_proto" in
15267         ''|0) try='int random_r(long*, struct random_data*);'
15268         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15269         esac
15270         case "$random_r_proto" in
15271         ''|0) try='int random_r(struct random_data*, int32_t*);'
15272         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15273         esac
15274         case "$random_r_proto" in
15275         ''|0)   d_random_r=undef
15276                 random_r_proto=0
15277                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15278         * )     case "$random_r_proto" in
15279                 REENTRANT_PROTO*) ;;
15280                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15281                 esac
15282                 echo "Prototype: $try" ;;
15283         esac
15284         ;;
15285         *)      case "$usethreads" in
15286                 define) echo "random_r has no prototype, not using it." >&4 ;;
15287                 esac
15288                 d_random_r=undef
15289                 random_r_proto=0
15290                 ;;
15291         esac
15292         ;;
15293 *)      random_r_proto=0
15294         ;;
15295 esac
15296
15297 : see if readdir and friends exist
15298 set readdir d_readdir
15299 eval $inlibc
15300 set seekdir d_seekdir
15301 eval $inlibc
15302 set telldir d_telldir
15303 eval $inlibc
15304 set rewinddir d_rewinddir
15305 eval $inlibc
15306
15307 : see if readdir64_r exists
15308 set readdir64_r d_readdir64_r
15309 eval $inlibc
15310 case "$d_readdir64_r" in
15311 "$define")
15312         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15313         case "$d_readdir64_r_proto:$usethreads" in
15314         ":define")      d_readdir64_r_proto=define
15315                 set d_readdir64_r_proto readdir64_r $hdrs
15316                 eval $hasproto ;;
15317         *)      ;;
15318         esac
15319         case "$d_readdir64_r_proto" in
15320         define)
15321         case "$readdir64_r_proto" in
15322         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15323         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15324         esac
15325         case "$readdir64_r_proto" in
15326         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15327         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15328         esac
15329         case "$readdir64_r_proto" in
15330         ''|0)   d_readdir64_r=undef
15331                 readdir64_r_proto=0
15332                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15333         * )     case "$readdir64_r_proto" in
15334                 REENTRANT_PROTO*) ;;
15335                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15336                 esac
15337                 echo "Prototype: $try" ;;
15338         esac
15339         ;;
15340         *)      case "$usethreads" in
15341                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15342                 esac
15343                 d_readdir64_r=undef
15344                 readdir64_r_proto=0
15345                 ;;
15346         esac
15347         ;;
15348 *)      readdir64_r_proto=0
15349         ;;
15350 esac
15351
15352 : see if readdir_r exists
15353 set readdir_r d_readdir_r
15354 eval $inlibc
15355 case "$d_readdir_r" in
15356 "$define")
15357         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15358         case "$d_readdir_r_proto:$usethreads" in
15359         ":define")      d_readdir_r_proto=define
15360                 set d_readdir_r_proto readdir_r $hdrs
15361                 eval $hasproto ;;
15362         *)      ;;
15363         esac
15364         case "$d_readdir_r_proto" in
15365         define)
15366         case "$readdir_r_proto" in
15367         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15368         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15369         esac
15370         case "$readdir_r_proto" in
15371         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15372         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15373         esac
15374         case "$readdir_r_proto" in
15375         ''|0)   d_readdir_r=undef
15376                 readdir_r_proto=0
15377                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15378         * )     case "$readdir_r_proto" in
15379                 REENTRANT_PROTO*) ;;
15380                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15381                 esac
15382                 echo "Prototype: $try" ;;
15383         esac
15384         ;;
15385         *)      case "$usethreads" in
15386                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15387                 esac
15388                 d_readdir_r=undef
15389                 readdir_r_proto=0
15390                 ;;
15391         esac
15392         ;;
15393 *)      readdir_r_proto=0
15394         ;;
15395 esac
15396
15397 : see if readv exists
15398 set readv d_readv
15399 eval $inlibc
15400
15401 : see if recvmsg exists
15402 set recvmsg d_recvmsg
15403 eval $inlibc
15404
15405 : see if rename exists
15406 set rename d_rename
15407 eval $inlibc
15408
15409 : see if rmdir exists
15410 set rmdir d_rmdir
15411 eval $inlibc
15412
15413 : see if memory.h is available.
15414 val=''
15415 set memory.h val
15416 eval $inhdr
15417
15418 : See if it conflicts with string.h
15419 case "$val" in
15420 $define)
15421         case "$strings" in
15422         '') ;;
15423         *)
15424                 $cppstdin $cppflags $cppminus < $strings > mem.h
15425                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15426                         echo " "
15427                         echo "We won't be including <memory.h>."
15428                         val="$undef"
15429                 fi
15430                 $rm -f mem.h
15431                 ;;
15432         esac
15433 esac
15434 set i_memory
15435 eval $setvar
15436
15437 : can bcopy handle overlapping blocks?
15438 echo " "
15439 val="$undef"
15440 case "$d_memmove" in
15441 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15442 *)      case "$d_bcopy" in
15443         "$define")
15444                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15445                 $cat >try.c <<EOCP
15446 #$i_memory I_MEMORY
15447 #$i_stdlib I_STDLIB
15448 #$i_string I_STRING
15449 #$i_unistd I_UNISTD
15450 EOCP
15451         $cat >>try.c <<'EOCP'
15452 #include <stdio.h>
15453 #ifdef I_MEMORY
15454 #  include <memory.h>
15455 #endif
15456 #ifdef I_STDLIB
15457 #  include <stdlib.h>
15458 #endif
15459 #ifdef I_STRING
15460 #  include <string.h>
15461 #else
15462 #  include <strings.h>
15463 #endif
15464 #ifdef I_UNISTD
15465 #  include <unistd.h>  /* Needed for NetBSD */
15466 #endif
15467 int main()
15468 {
15469 char buf[128], abc[128];
15470 char *b;
15471 int len;
15472 int off;
15473 int align;
15474
15475 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15476    try to store the string in read-only memory. */
15477 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15478
15479 for (align = 7; align >= 0; align--) {
15480         for (len = 36; len; len--) {
15481                 b = buf+align;
15482                 bcopy(abc, b, len);
15483                 for (off = 1; off <= len; off++) {
15484                         bcopy(b, b+off, len);
15485                         bcopy(b+off, b, len);
15486                         if (bcmp(b, abc, len))
15487                                 exit(1);
15488                 }
15489         }
15490 }
15491 exit(0);
15492 }
15493 EOCP
15494                 set try
15495                 if eval $compile_ok; then
15496                         if ./try 2>/dev/null; then
15497                                 echo "Yes, it can."
15498                                 val="$define"
15499                         else
15500                                 echo "It can't, sorry."
15501                         fi
15502                 else
15503                         echo "(I can't compile the test program, so we'll assume not...)"
15504                 fi
15505                 ;;
15506         esac
15507         $rm -f try.* try core
15508         ;;
15509 esac
15510 set d_safebcpy
15511 eval $setvar
15512
15513 : can memcpy handle overlapping blocks?
15514 echo " "
15515 val="$undef"
15516 case "$d_memmove" in
15517 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15518 *)      case "$d_memcpy" in
15519         "$define")
15520                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15521                 $cat >try.c <<EOCP
15522 #$i_memory I_MEMORY
15523 #$i_stdlib I_STDLIB
15524 #$i_string I_STRING
15525 #$i_unistd I_UNISTD
15526 EOCP
15527         $cat >>try.c <<'EOCP'
15528 #include <stdio.h>
15529 #ifdef I_MEMORY
15530 #  include <memory.h>
15531 #endif
15532 #ifdef I_STDLIB
15533 #  include <stdlib.h>
15534 #endif
15535 #ifdef I_STRING
15536 #  include <string.h>
15537 #else
15538 #  include <strings.h>
15539 #endif
15540 #ifdef I_UNISTD
15541 #  include <unistd.h>  /* Needed for NetBSD */
15542 #endif
15543 int main()
15544 {
15545 char buf[128], abc[128];
15546 char *b;
15547 int len;
15548 int off;
15549 int align;
15550
15551 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15552    try to store the string in read-only memory. */
15553 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15554
15555 for (align = 7; align >= 0; align--) {
15556         for (len = 36; len; len--) {
15557                 b = buf+align;
15558                 memcpy(b, abc, len);
15559                 for (off = 1; off <= len; off++) {
15560                         memcpy(b+off, b, len);
15561                         memcpy(b, b+off, len);
15562                         if (memcmp(b, abc, len))
15563                                 exit(1);
15564                 }
15565         }
15566 }
15567 exit(0);
15568 }
15569 EOCP
15570                 set try
15571                 if eval $compile_ok; then
15572                         if ./try 2>/dev/null; then
15573                                 echo "Yes, it can."
15574                                 val="$define"
15575                         else
15576                                 echo "It can't, sorry."
15577                         fi
15578                 else
15579                         echo "(I can't compile the test program, so we'll assume not...)"
15580                 fi
15581                 ;;
15582         esac
15583         $rm -f try.* try core
15584         ;;
15585 esac
15586 set d_safemcpy
15587 eval $setvar
15588
15589 : can memcmp be trusted to compare relative magnitude?
15590 val="$undef"
15591 case "$d_memcmp" in
15592 "$define")
15593         echo " "
15594         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15595         $cat >try.c <<EOCP
15596 #$i_memory I_MEMORY
15597 #$i_stdlib I_STDLIB
15598 #$i_string I_STRING
15599 #$i_unistd I_UNISTD
15600 EOCP
15601         $cat >>try.c <<'EOCP'
15602 #include <stdio.h>
15603 #ifdef I_MEMORY
15604 #  include <memory.h>
15605 #endif
15606 #ifdef I_STDLIB
15607 #  include <stdlib.h>
15608 #endif
15609 #ifdef I_STRING
15610 #  include <string.h>
15611 #else
15612 #  include <strings.h>
15613 #endif
15614 #ifdef I_UNISTD
15615 #  include <unistd.h>  /* Needed for NetBSD */
15616 #endif
15617 int main()
15618 {
15619 char a = -1;
15620 char b = 0;
15621 if ((a < b) && memcmp(&a, &b, 1) < 0)
15622         exit(1);
15623 exit(0);
15624 }
15625 EOCP
15626         set try
15627         if eval $compile_ok; then
15628                 if $run ./try 2>/dev/null; then
15629                         echo "Yes, it can."
15630                         val="$define"
15631                 else
15632                         echo "No, it can't (it uses signed chars)."
15633                 fi
15634         else
15635                 echo "(I can't compile the test program, so we'll assume not...)"
15636         fi
15637         ;;
15638 esac
15639 $rm -f try.* try core
15640 set d_sanemcmp
15641 eval $setvar
15642
15643 : see if prototype for sbrk is available
15644 echo " "
15645 set d_sbrkproto sbrk $i_unistd unistd.h
15646 eval $hasproto
15647
15648 : see if select exists
15649 set select d_select
15650 eval $inlibc
15651
15652 : see if semctl exists
15653 set semctl d_semctl
15654 eval $inlibc
15655
15656 : see if semget exists
15657 set semget d_semget
15658 eval $inlibc
15659
15660 : see if semop exists
15661 set semop d_semop
15662 eval $inlibc
15663
15664 : see how much of the 'sem*(2)' library is present.
15665 h_sem=true
15666 echo " "
15667 case "$d_semctl$d_semget$d_semop" in
15668 *"$undef"*) h_sem=false;;
15669 esac
15670 case "$osname" in
15671 freebsd)
15672     case "`ipcs 2>&1`" in
15673     "SVID messages"*"not configured"*)
15674         echo "Your $osname does not have the sem*(2) configured." >&4
15675         h_sem=false
15676         val="$undef"
15677         set semctl d_semctl
15678         eval $setvar
15679         set semget d_semget
15680         eval $setvar
15681         set semop d_semop
15682         eval $setvar
15683         ;;
15684     esac
15685     ;;
15686 esac
15687 : we could also check for sys/ipc.h ...
15688 if $h_sem && $test `./findhdr sys/sem.h`; then
15689         echo "You have the full sem*(2) library." >&4
15690         val="$define"
15691 else
15692         echo "You don't have the full sem*(2) library." >&4
15693         val="$undef"
15694 fi
15695 set d_sem
15696 eval $setvar
15697
15698 : see whether sys/sem.h defines union semun
15699 echo " "
15700 $cat > try.c <<'END'
15701 #include <sys/types.h>
15702 #include <sys/ipc.h>
15703 #include <sys/sem.h>
15704 int main () { union semun semun; semun.buf = 0; }
15705 END
15706 set try
15707 if eval $compile; then
15708     echo "You have union semun in <sys/sem.h>." >&4
15709     val="$define"
15710 else
15711     echo "You do not have union semun in <sys/sem.h>." >&4
15712     val="$undef"
15713 fi
15714 $rm -f try try.c
15715 set d_union_semun
15716 eval $setvar
15717
15718 : see how to do semctl IPC_STAT
15719 case "$d_sem" in
15720 $define)
15721     echo " "
15722     $cat > try.h <<END
15723 #ifndef S_IRUSR
15724 #   ifdef S_IREAD
15725 #       define S_IRUSR S_IREAD
15726 #       define S_IWUSR S_IWRITE
15727 #       define S_IXUSR S_IEXEC
15728 #   else
15729 #       define S_IRUSR 0400
15730 #       define S_IWUSR 0200
15731 #       define S_IXUSR 0100
15732 #   endif
15733 #   define S_IRGRP (S_IRUSR>>3)
15734 #   define S_IWGRP (S_IWUSR>>3)
15735 #   define S_IXGRP (S_IXUSR>>3)
15736 #   define S_IROTH (S_IRUSR>>6)
15737 #   define S_IWOTH (S_IWUSR>>6)
15738 #   define S_IXOTH (S_IXUSR>>6)
15739 #endif
15740 #ifndef S_IRWXU
15741 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15742 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15743 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15744 #endif
15745 END
15746     : see whether semctl IPC_STAT can use union semun
15747     val="$undef"
15748     case "$d_semctl_semun" in
15749     '')
15750       $cat > try.c <<END
15751 #include <sys/types.h>
15752 #include <sys/ipc.h>
15753 #include <sys/sem.h>
15754 #include <sys/stat.h>
15755 #include <stdio.h>
15756 #include <errno.h>
15757 #include "try.h"
15758 #ifndef errno
15759 extern int errno;
15760 #endif
15761 #$d_union_semun HAS_UNION_SEMUN
15762 int main() {
15763     union semun
15764 #ifndef HAS_UNION_SEMUN
15765     {
15766         int val;
15767         struct semid_ds *buf;
15768         unsigned short *array;
15769     }
15770 #endif
15771     arg;
15772     int sem, st;
15773
15774 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15775     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15776     if (sem > -1) {
15777         struct semid_ds argbuf;
15778         arg.buf = &argbuf;
15779 #       ifdef IPC_STAT
15780         st = semctl(sem, 0, IPC_STAT, arg);
15781         if (st == 0)
15782             printf("semun\n");
15783         else
15784 #       endif /* IPC_STAT */
15785             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15786 #       ifdef IPC_RMID
15787         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15788 #       endif /* IPC_RMID */
15789             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15790     } else
15791 #endif /* IPC_PRIVATE && ... */
15792         printf("semget failed: errno = %d\n", errno);
15793   return 0;
15794 }
15795 END
15796       set try
15797       if eval $compile; then
15798           xxx=`$run ./try`
15799           case "$xxx" in
15800           semun) val="$define" ;;
15801           esac
15802       fi
15803       $rm -f try try.c
15804       ;;
15805     esac
15806     set d_semctl_semun
15807     eval $setvar
15808     case "$d_semctl_semun" in
15809     $define)
15810         echo "You can use union semun for semctl IPC_STAT." >&4
15811         also='also'
15812         ;;
15813     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15814         also=''
15815         ;;
15816     esac
15817
15818     : see whether semctl IPC_STAT can use struct semid_ds pointer
15819     val="$undef"
15820     case "$d_semctl_semid_ds" in
15821     '')
15822       $cat > try.c <<'END'
15823 #include <sys/types.h>
15824 #include <sys/ipc.h>
15825 #include <sys/sem.h>
15826 #include <sys/stat.h>
15827 #include "try.h"
15828 #include <stdio.h>
15829 #include <errno.h>
15830 #ifndef errno
15831 extern int errno;
15832 #endif
15833 int main() {
15834     struct semid_ds arg;
15835     int sem, st;
15836
15837 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15838     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15839     if (sem > -1) {
15840 #       ifdef IPC_STAT
15841         st = semctl(sem, 0, IPC_STAT, &arg);
15842         if (st == 0)
15843             printf("semid_ds\n");
15844         else
15845 #       endif /* IPC_STAT */
15846             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15847 #       ifdef IPC_RMID
15848         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15849 #       endif /* IPC_RMID */
15850             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15851     } else
15852 #endif /* IPC_PRIVATE && ... */
15853         printf("semget failed: errno = %d\n", errno);
15854
15855     return 0;
15856 }
15857 END
15858       set try
15859       if eval $compile; then
15860           xxx=`$run ./try`
15861           case "$xxx" in
15862           semid_ds) val="$define" ;;
15863           esac
15864       fi
15865       $rm -f try try.c
15866       ;;
15867     esac
15868     set d_semctl_semid_ds
15869     eval $setvar
15870     case "$d_semctl_semid_ds" in
15871     $define)
15872         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15873         ;;
15874     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15875         ;;
15876     esac
15877     $rm -f try.h
15878     ;;
15879 *)  val="$undef"
15880
15881     # We do not have the full sem*(2) library, so assume we can not
15882     # use either.
15883
15884     set d_semctl_semun
15885     eval $setvar
15886
15887     set d_semctl_semid_ds
15888     eval $setvar
15889     ;;
15890 esac
15891
15892 : see if sendmsg exists
15893 set sendmsg d_sendmsg
15894 eval $inlibc
15895
15896 : see if setegid exists
15897 set setegid d_setegid
15898 eval $inlibc
15899
15900 : see if seteuid exists
15901 set seteuid d_seteuid
15902 eval $inlibc
15903
15904 : see if setgrent exists
15905 set setgrent d_setgrent
15906 eval $inlibc
15907
15908 : see if setgrent_r exists
15909 set setgrent_r d_setgrent_r
15910 eval $inlibc
15911 case "$d_setgrent_r" in
15912 "$define")
15913         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15914         case "$d_setgrent_r_proto:$usethreads" in
15915         ":define")      d_setgrent_r_proto=define
15916                 set d_setgrent_r_proto setgrent_r $hdrs
15917                 eval $hasproto ;;
15918         *)      ;;
15919         esac
15920         case "$d_setgrent_r_proto" in
15921         define)
15922         case "$setgrent_r_proto" in
15923         ''|0) try='int setgrent_r(FILE**);'
15924         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15925         esac
15926         case "$setgrent_r_proto" in
15927         ''|0) try='void setgrent_r(FILE**);'
15928         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15929         esac
15930         case "$setgrent_r_proto" in
15931         ''|0)   d_setgrent_r=undef
15932                 setgrent_r_proto=0
15933                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15934         * )     case "$setgrent_r_proto" in
15935                 REENTRANT_PROTO*) ;;
15936                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15937                 esac
15938                 echo "Prototype: $try" ;;
15939         esac
15940         ;;
15941         *)      case "$usethreads" in
15942                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15943                 esac
15944                 d_setgrent_r=undef
15945                 setgrent_r_proto=0
15946                 ;;
15947         esac
15948         ;;
15949 *)      setgrent_r_proto=0
15950         ;;
15951 esac
15952
15953 : see if sethostent exists
15954 set sethostent d_sethent
15955 eval $inlibc
15956
15957 : see if sethostent_r exists
15958 set sethostent_r d_sethostent_r
15959 eval $inlibc
15960 case "$d_sethostent_r" in
15961 "$define")
15962         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15963         case "$d_sethostent_r_proto:$usethreads" in
15964         ":define")      d_sethostent_r_proto=define
15965                 set d_sethostent_r_proto sethostent_r $hdrs
15966                 eval $hasproto ;;
15967         *)      ;;
15968         esac
15969         case "$d_sethostent_r_proto" in
15970         define)
15971         case "$sethostent_r_proto" in
15972         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15973         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15974         esac
15975         case "$sethostent_r_proto" in
15976         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15977         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15978         esac
15979         case "$sethostent_r_proto" in
15980         ''|0)   d_sethostent_r=undef
15981                 sethostent_r_proto=0
15982                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15983         * )     case "$sethostent_r_proto" in
15984                 REENTRANT_PROTO*) ;;
15985                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15986                 esac
15987                 echo "Prototype: $try" ;;
15988         esac
15989         ;;
15990         *)      case "$usethreads" in
15991                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15992                 esac
15993                 d_sethostent_r=undef
15994                 sethostent_r_proto=0
15995                 ;;
15996         esac
15997         ;;
15998 *)      sethostent_r_proto=0
15999         ;;
16000 esac
16001
16002 : see if setitimer exists
16003 set setitimer d_setitimer
16004 eval $inlibc
16005
16006 : see if setlinebuf exists
16007 set setlinebuf d_setlinebuf
16008 eval $inlibc
16009
16010 : see if setlocale exists
16011 set setlocale d_setlocale
16012 eval $inlibc
16013
16014 : see if locale.h is available
16015 set locale.h i_locale
16016 eval $inhdr
16017
16018 : see if setlocale_r exists
16019 set setlocale_r d_setlocale_r
16020 eval $inlibc
16021 case "$d_setlocale_r" in
16022 "$define")
16023         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16024         case "$d_setlocale_r_proto:$usethreads" in
16025         ":define")      d_setlocale_r_proto=define
16026                 set d_setlocale_r_proto setlocale_r $hdrs
16027                 eval $hasproto ;;
16028         *)      ;;
16029         esac
16030         case "$d_setlocale_r_proto" in
16031         define)
16032         case "$setlocale_r_proto" in
16033         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16034         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16035         esac
16036         case "$setlocale_r_proto" in
16037         ''|0)   d_setlocale_r=undef
16038                 setlocale_r_proto=0
16039                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16040         * )     case "$setlocale_r_proto" in
16041                 REENTRANT_PROTO*) ;;
16042                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16043                 esac
16044                 echo "Prototype: $try" ;;
16045         esac
16046         ;;
16047         *)      case "$usethreads" in
16048                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16049                 esac
16050                 d_setlocale_r=undef
16051                 setlocale_r_proto=0
16052                 ;;
16053         esac
16054         ;;
16055 *)      setlocale_r_proto=0
16056         ;;
16057 esac
16058
16059 : see if setnetent exists
16060 set setnetent d_setnent
16061 eval $inlibc
16062
16063 : see if setnetent_r exists
16064 set setnetent_r d_setnetent_r
16065 eval $inlibc
16066 case "$d_setnetent_r" in
16067 "$define")
16068         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16069         case "$d_setnetent_r_proto:$usethreads" in
16070         ":define")      d_setnetent_r_proto=define
16071                 set d_setnetent_r_proto setnetent_r $hdrs
16072                 eval $hasproto ;;
16073         *)      ;;
16074         esac
16075         case "$d_setnetent_r_proto" in
16076         define)
16077         case "$setnetent_r_proto" in
16078         ''|0) try='int setnetent_r(int, struct netent_data*);'
16079         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16080         esac
16081         case "$setnetent_r_proto" in
16082         ''|0) try='void setnetent_r(int, struct netent_data*);'
16083         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16084         esac
16085         case "$setnetent_r_proto" in
16086         ''|0)   d_setnetent_r=undef
16087                 setnetent_r_proto=0
16088                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16089         * )     case "$setnetent_r_proto" in
16090                 REENTRANT_PROTO*) ;;
16091                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16092                 esac
16093                 echo "Prototype: $try" ;;
16094         esac
16095         ;;
16096         *)      case "$usethreads" in
16097                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16098                 esac
16099                 d_setnetent_r=undef
16100                 setnetent_r_proto=0
16101                 ;;
16102         esac
16103         ;;
16104 *)      setnetent_r_proto=0
16105         ;;
16106 esac
16107
16108 : see if setprotoent exists
16109 set setprotoent d_setpent
16110 eval $inlibc
16111
16112 : see if setpgid exists
16113 set setpgid d_setpgid
16114 eval $inlibc
16115
16116 : see if setpgrp2 exists
16117 set setpgrp2 d_setpgrp2
16118 eval $inlibc
16119
16120 : see if setpriority exists
16121 set setpriority d_setprior
16122 eval $inlibc
16123
16124 : see if setproctitle exists
16125 set setproctitle d_setproctitle
16126 eval $inlibc
16127
16128 : see if setprotoent_r exists
16129 set setprotoent_r d_setprotoent_r
16130 eval $inlibc
16131 case "$d_setprotoent_r" in
16132 "$define")
16133         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16134         case "$d_setprotoent_r_proto:$usethreads" in
16135         ":define")      d_setprotoent_r_proto=define
16136                 set d_setprotoent_r_proto setprotoent_r $hdrs
16137                 eval $hasproto ;;
16138         *)      ;;
16139         esac
16140         case "$d_setprotoent_r_proto" in
16141         define)
16142         case "$setprotoent_r_proto" in
16143         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16144         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16145         esac
16146         case "$setprotoent_r_proto" in
16147         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16148         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16149         esac
16150         case "$setprotoent_r_proto" in
16151         ''|0)   d_setprotoent_r=undef
16152                 setprotoent_r_proto=0
16153                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16154         * )     case "$setprotoent_r_proto" in
16155                 REENTRANT_PROTO*) ;;
16156                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16157                 esac
16158                 echo "Prototype: $try" ;;
16159         esac
16160         ;;
16161         *)      case "$usethreads" in
16162                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16163                 esac
16164                 d_setprotoent_r=undef
16165                 setprotoent_r_proto=0
16166                 ;;
16167         esac
16168         ;;
16169 *)      setprotoent_r_proto=0
16170         ;;
16171 esac
16172
16173 : see if setpwent exists
16174 set setpwent d_setpwent
16175 eval $inlibc
16176
16177 : see if setpwent_r exists
16178 set setpwent_r d_setpwent_r
16179 eval $inlibc
16180 case "$d_setpwent_r" in
16181 "$define")
16182         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16183         case "$d_setpwent_r_proto:$usethreads" in
16184         ":define")      d_setpwent_r_proto=define
16185                 set d_setpwent_r_proto setpwent_r $hdrs
16186                 eval $hasproto ;;
16187         *)      ;;
16188         esac
16189         case "$d_setpwent_r_proto" in
16190         define)
16191         case "$setpwent_r_proto" in
16192         ''|0) try='int setpwent_r(FILE**);'
16193         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16194         esac
16195         case "$setpwent_r_proto" in
16196         ''|0) try='void setpwent_r(FILE**);'
16197         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16198         esac
16199         case "$setpwent_r_proto" in
16200         ''|0)   d_setpwent_r=undef
16201                 setpwent_r_proto=0
16202                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16203         * )     case "$setpwent_r_proto" in
16204                 REENTRANT_PROTO*) ;;
16205                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16206                 esac
16207                 echo "Prototype: $try" ;;
16208         esac
16209         ;;
16210         *)      case "$usethreads" in
16211                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16212                 esac
16213                 d_setpwent_r=undef
16214                 setpwent_r_proto=0
16215                 ;;
16216         esac
16217         ;;
16218 *)      setpwent_r_proto=0
16219         ;;
16220 esac
16221
16222 : see if setregid exists
16223 set setregid d_setregid
16224 eval $inlibc
16225 set setresgid d_setresgid
16226 eval $inlibc
16227
16228 : see if setreuid exists
16229 set setreuid d_setreuid
16230 eval $inlibc
16231 set setresuid d_setresuid
16232 eval $inlibc
16233
16234 : see if setrgid exists
16235 set setrgid d_setrgid
16236 eval $inlibc
16237
16238 : see if setruid exists
16239 set setruid d_setruid
16240 eval $inlibc
16241
16242 : see if setservent exists
16243 set setservent d_setsent
16244 eval $inlibc
16245
16246 : see if setservent_r exists
16247 set setservent_r d_setservent_r
16248 eval $inlibc
16249 case "$d_setservent_r" in
16250 "$define")
16251         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16252         case "$d_setservent_r_proto:$usethreads" in
16253         ":define")      d_setservent_r_proto=define
16254                 set d_setservent_r_proto setservent_r $hdrs
16255                 eval $hasproto ;;
16256         *)      ;;
16257         esac
16258         case "$d_setservent_r_proto" in
16259         define)
16260         case "$setservent_r_proto" in
16261         ''|0) try='int setservent_r(int, struct servent_data*);'
16262         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16263         esac
16264         case "$setservent_r_proto" in
16265         ''|0) try='void setservent_r(int, struct servent_data*);'
16266         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16267         esac
16268         case "$setservent_r_proto" in
16269         ''|0)   d_setservent_r=undef
16270                 setservent_r_proto=0
16271                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16272         * )     case "$setservent_r_proto" in
16273                 REENTRANT_PROTO*) ;;
16274                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16275                 esac
16276                 echo "Prototype: $try" ;;
16277         esac
16278         ;;
16279         *)      case "$usethreads" in
16280                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16281                 esac
16282                 d_setservent_r=undef
16283                 setservent_r_proto=0
16284                 ;;
16285         esac
16286         ;;
16287 *)      setservent_r_proto=0
16288         ;;
16289 esac
16290
16291 : see if setsid exists
16292 set setsid d_setsid
16293 eval $inlibc
16294
16295 : see if setvbuf exists
16296 set setvbuf d_setvbuf
16297 eval $inlibc
16298
16299 : see if sfio.h is available
16300 set sfio.h i_sfio
16301 eval $inhdr
16302
16303
16304 : see if sfio library is available
16305 case "$i_sfio" in
16306 $define)
16307         val=''
16308         set sfreserve val
16309         eval $inlibc
16310         ;;
16311 *)
16312         val="$undef"
16313         ;;
16314 esac
16315 : Ok, but do we want to use it.
16316 case "$val" in
16317 $define)
16318         case "$usesfio" in
16319         true|$define|[yY]*) dflt='y';;
16320         *) dflt='n';;
16321         esac
16322         echo "$package can use the sfio library, but it is experimental."
16323         case "$useperlio" in
16324         "$undef")
16325             echo "For sfio also the PerlIO abstraction layer is needed."
16326             echo "Earlier you said you wouldn't want that."
16327             ;;
16328         esac
16329         rp="You seem to have sfio available, do you want to try using it?"
16330         . ./myread
16331         case "$ans" in
16332         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16333                 useperlio="$define"
16334                 val="$define"
16335                 ;;
16336         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16337                 val="$undef"
16338                 ;;
16339         esac
16340         ;;
16341 *)      case "$usesfio" in
16342         true|$define|[yY]*)
16343                 echo "Sorry, cannot find sfio on this machine." >&4
16344                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16345                 val="$undef"
16346                 ;;
16347         esac
16348         ;;
16349 esac
16350 set d_sfio
16351 eval $setvar
16352 case "$d_sfio" in
16353 $define) usesfio='true';;
16354 *) usesfio='false';;
16355 esac
16356 case "$d_sfio" in
16357 $define) ;;
16358 *)      : Remove sfio from list of libraries to use
16359         case "$libs" in
16360         *-lsfio*)
16361                 echo "Removing unneeded -lsfio from library list" >&4
16362                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16363                 shift
16364                 libs="$*"
16365                 echo "libs = $libs" >&4
16366                 ;;
16367         esac
16368 ;;
16369 esac
16370
16371
16372 : see if shmctl exists
16373 set shmctl d_shmctl
16374 eval $inlibc
16375
16376 : see if shmget exists
16377 set shmget d_shmget
16378 eval $inlibc
16379
16380 : see if shmat exists
16381 set shmat d_shmat
16382 eval $inlibc
16383 : see what shmat returns
16384 case "$d_shmat" in
16385 "$define")
16386         $cat >shmat.c <<'END'
16387 #include <sys/shm.h>
16388 void *shmat();
16389 END
16390         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16391                 shmattype='void *'
16392         else
16393                 shmattype='char *'
16394         fi
16395         echo "and it returns ($shmattype)." >&4
16396         : see if a prototype for shmat is available
16397         xxx=`./findhdr sys/shm.h`
16398         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16399         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16400                 val="$define"
16401         else
16402                 val="$undef"
16403         fi
16404         $rm -f shmat.[co]
16405         ;;
16406 *)
16407         val="$undef"
16408         ;;
16409 esac
16410 set d_shmatprototype
16411 eval $setvar
16412
16413 : see if shmdt exists
16414 set shmdt d_shmdt
16415 eval $inlibc
16416
16417 : see how much of the 'shm*(2)' library is present.
16418 h_shm=true
16419 echo " "
16420 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16421 *"$undef"*) h_shm=false;;
16422 esac
16423 case "$osname" in
16424 freebsd)
16425     case "`ipcs 2>&1`" in
16426     "SVID shared memory"*"not configured"*)
16427         echo "Your $osname does not have the shm*(2) configured." >&4
16428         h_shm=false
16429         val="$undef"
16430         set shmctl d_shmctl
16431         evat $setvar
16432         set shmget d_shmget
16433         evat $setvar
16434         set shmat d_shmat
16435         evat $setvar
16436         set shmdt d_shmdt
16437         evat $setvar
16438         ;;
16439     esac
16440     ;;
16441 esac
16442 : we could also check for sys/ipc.h ...
16443 if $h_shm && $test `./findhdr sys/shm.h`; then
16444         echo "You have the full shm*(2) library." >&4
16445         val="$define"
16446 else
16447         echo "You don't have the full shm*(2) library." >&4
16448         val="$undef"
16449 fi
16450 set d_shm
16451 eval $setvar
16452
16453 echo " "
16454 : see if we have sigaction
16455 if set sigaction val -f d_sigaction; eval $csym; $val; then
16456         echo 'sigaction() found.' >&4
16457         $cat > try.c <<EOP
16458 #include <stdio.h>
16459 #include <sys/types.h>
16460 #include <signal.h>
16461 #$i_stdlib I_STDLIB
16462 #ifdef I_STDLIB
16463 #include <stdlib.h>
16464 #endif
16465 int main()
16466 {
16467     struct sigaction act, oact;
16468     act.sa_flags = 0;
16469     oact.sa_handler = 0;
16470     /* so that act and oact are used */
16471     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16472 }
16473 EOP
16474         set try
16475         if eval $compile_ok; then
16476                 val="$define"
16477         else
16478                 echo "But you don't seem to have a useable struct sigaction." >&4
16479                 val="$undef"
16480         fi
16481 else
16482         echo 'sigaction NOT found.' >&4
16483         val="$undef"
16484 fi
16485 set d_sigaction; eval $setvar
16486 $rm -f try try$_o try.c
16487
16488 : see if sigprocmask exists
16489 set sigprocmask d_sigprocmask
16490 eval $inlibc
16491
16492 : see if sigsetjmp exists
16493 echo " "
16494 case "$d_sigsetjmp" in
16495 '')
16496         $cat >try.c <<EOP
16497 #include <setjmp.h>
16498 #$i_stdlib I_STDLIB
16499 #ifdef I_STDLIB
16500 #include <stdlib.h>
16501 #endif
16502 sigjmp_buf env;
16503 int set = 1;
16504 int main()
16505 {
16506         if (sigsetjmp(env,1))
16507                 exit(set);
16508         set = 0;
16509         siglongjmp(env, 1);
16510         exit(1);
16511 }
16512 EOP
16513         set try
16514         if eval $compile; then
16515                 if $run ./try >/dev/null 2>&1; then
16516                         echo "POSIX sigsetjmp found." >&4
16517                         val="$define"
16518                 else
16519                         $cat >&4 <<EOM
16520 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16521 I'll ignore them.
16522 EOM
16523                         val="$undef"
16524                 fi
16525         else
16526                 echo "sigsetjmp not found." >&4
16527                 val="$undef"
16528         fi
16529         ;;
16530 *) val="$d_sigsetjmp"
16531         case "$d_sigsetjmp" in
16532         $define) echo "POSIX sigsetjmp found." >&4;;
16533         $undef) echo "sigsetjmp not found." >&4;;
16534         esac
16535         ;;
16536 esac
16537 set d_sigsetjmp
16538 eval $setvar
16539 $rm -f try.c try
16540
16541 : see if snprintf exists
16542 set snprintf d_snprintf
16543 eval $inlibc
16544
16545 : see if vsnprintf exists
16546 set vsnprintf d_vsnprintf
16547 eval $inlibc
16548
16549 : see if sockatmark exists
16550 set sockatmark d_sockatmark
16551 eval $inlibc
16552
16553 : see if prototype for sockatmark is available
16554 echo " "
16555 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16556 eval $hasproto
16557
16558 : see if socks5_init exists
16559 set socks5_init d_socks5_init
16560 eval $inlibc
16561
16562 : see if sprintf returns the length of the string in the buffer as per ANSI
16563 $echo "Checking whether sprintf returns the length of the string..." >&4
16564 $cat <<EOP >try.c
16565 #include <stdio.h>
16566 #$i_stdlib I_STDLIB
16567 #ifdef I_STDLIB
16568 #include <stdlib.h>
16569 #endif
16570 #$i_string I_STRING
16571 #ifdef I_STRING
16572 #  include <string.h>
16573 #else
16574 #  include <strings.h>
16575 #endif
16576 #$i_math I_MATH
16577 #ifdef I_MATH
16578 #include <math.h>
16579 #endif
16580
16581 char buffer[256];
16582
16583 int check (size_t expect, int test) {
16584   size_t got = strlen(buffer);
16585   if (expect == got)
16586     return 0;
16587
16588   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16589        test, buffer);
16590   exit (test);
16591 }
16592
16593 int main(int argc, char **argv) {
16594   int test = 0;
16595
16596   check(sprintf(buffer, ""), ++test);
16597   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16598   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16599
16600   return 0;
16601 }
16602 EOP
16603 set try
16604
16605 d_sprintf_returns_strlen="$undef"
16606 if eval $compile; then
16607     xxx="`$run ./try`"
16608     case "$?" in
16609         0) cat >&4 <<EOM
16610 sprintf returns the length of the string (as ANSI says it should)
16611 EOM
16612         d_sprintf_returns_strlen="$define"
16613         ;;
16614         *) cat >&4 <<EOM
16615 sprintf does not return the length of the string (how old is this system?)
16616 EOM
16617         d_sprintf_returns_strlen="$undef"
16618         ;;
16619     esac
16620 fi
16621
16622 $rm -f try.* try
16623
16624 : see if srand48_r exists
16625 set srand48_r d_srand48_r
16626 eval $inlibc
16627 case "$d_srand48_r" in
16628 "$define")
16629         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16630         case "$d_srand48_r_proto:$usethreads" in
16631         ":define")      d_srand48_r_proto=define
16632                 set d_srand48_r_proto srand48_r $hdrs
16633                 eval $hasproto ;;
16634         *)      ;;
16635         esac
16636         case "$d_srand48_r_proto" in
16637         define)
16638         case "$srand48_r_proto" in
16639         ''|0) try='int srand48_r(long, struct drand48_data*);'
16640         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16641         esac
16642         case "$srand48_r_proto" in
16643         ''|0)   d_srand48_r=undef
16644                 srand48_r_proto=0
16645                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16646         * )     case "$srand48_r_proto" in
16647                 REENTRANT_PROTO*) ;;
16648                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16649                 esac
16650                 echo "Prototype: $try" ;;
16651         esac
16652         ;;
16653         *)      case "$usethreads" in
16654                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16655                 esac
16656                 d_srand48_r=undef
16657                 srand48_r_proto=0
16658                 ;;
16659         esac
16660         ;;
16661 *)      srand48_r_proto=0
16662         ;;
16663 esac
16664
16665 : see if srandom_r exists
16666 set srandom_r d_srandom_r
16667 eval $inlibc
16668 case "$d_srandom_r" in
16669 "$define")
16670         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16671         case "$d_srandom_r_proto:$usethreads" in
16672         ":define")      d_srandom_r_proto=define
16673                 set d_srandom_r_proto srandom_r $hdrs
16674                 eval $hasproto ;;
16675         *)      ;;
16676         esac
16677         case "$d_srandom_r_proto" in
16678         define)
16679         case "$srandom_r_proto" in
16680         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16681         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16682         esac
16683         case "$srandom_r_proto" in
16684         ''|0)   d_srandom_r=undef
16685                 srandom_r_proto=0
16686                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16687         * )     case "$srandom_r_proto" in
16688                 REENTRANT_PROTO*) ;;
16689                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16690                 esac
16691                 echo "Prototype: $try" ;;
16692         esac
16693         ;;
16694         *)      case "$usethreads" in
16695                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16696                 esac
16697                 d_srandom_r=undef
16698                 srandom_r_proto=0
16699                 ;;
16700         esac
16701         ;;
16702 *)      srandom_r_proto=0
16703         ;;
16704 esac
16705
16706 : see if prototype for setresgid is available
16707 echo " "
16708 set d_sresgproto setresgid $i_unistd unistd.h
16709 eval $hasproto
16710
16711 : see if prototype for setresuid is available
16712 echo " "
16713 set d_sresuproto setresuid $i_unistd unistd.h
16714 eval $hasproto
16715
16716 : see if sys/stat.h is available
16717 set sys/stat.h i_sysstat
16718 eval $inhdr
16719
16720
16721 : see if stat knows about block sizes
16722 echo " "
16723 echo "Checking to see if your struct stat has st_blocks field..." >&4
16724 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16725 eval $hasfield
16726
16727
16728 : see if this is a sys/vfs.h system
16729 set sys/vfs.h i_sysvfs
16730 eval $inhdr
16731
16732
16733 : see if this is a sys/statfs.h system
16734 set sys/statfs.h i_sysstatfs
16735 eval $inhdr
16736
16737
16738 echo " "
16739 echo "Checking to see if your system supports struct statfs..." >&4
16740 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
16741 eval $hasstruct
16742 case "$d_statfs_s" in
16743 "$define")      echo "Yes, it does."   ;;
16744 *)              echo "No, it doesn't." ;;
16745 esac
16746
16747
16748
16749 : see if struct statfs knows about f_flags
16750 case "$d_statfs_s" in
16751 define) 
16752         echo " "
16753         echo "Checking to see if your struct statfs has f_flags field..." >&4
16754         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
16755         eval $hasfield
16756         ;;
16757 *)      val="$undef"
16758         set d_statfs_f_flags
16759         eval $setvar
16760         ;;
16761 esac
16762 case "$d_statfs_f_flags" in
16763 "$define")      echo "Yes, it does."   ;;
16764 *)              echo "No, it doesn't." ;;
16765 esac
16766
16767 $cat >&4 <<EOM
16768 Checking how to access stdio streams by file descriptor number...
16769 EOM
16770 case "$stdio_stream_array" in
16771 '')     $cat >try.c <<EOCP
16772 #include <stdio.h>
16773 int main() {
16774   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16775     printf("yes\n");
16776 }
16777 EOCP
16778         for s in _iob __iob __sF
16779         do
16780                 set try -DSTDIO_STREAM_ARRAY=$s
16781                 if eval $compile; then
16782                         case "`$run ./try`" in
16783                         yes)    stdio_stream_array=$s; break ;;
16784                         esac
16785                 fi
16786         done
16787         $rm -f try.* try$exe_ext
16788 esac
16789 case "$stdio_stream_array" in
16790 '')     $cat >&4 <<EOM
16791 I can't figure out how to access stdio streams by file descriptor number.
16792 EOM
16793         d_stdio_stream_array="$undef"
16794         ;;
16795 *)      $cat >&4 <<EOM
16796 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16797 EOM
16798         d_stdio_stream_array="$define"
16799         ;;
16800 esac
16801
16802 : see if strcoll exists
16803 set strcoll d_strcoll
16804 eval $inlibc
16805
16806 : check for structure copying
16807 echo " "
16808 echo "Checking to see if your C compiler can copy structs..." >&4
16809 $cat >try.c <<'EOCP'
16810 int main()
16811 {
16812         struct blurfl {
16813                 int dyick;
16814         } foo, bar;
16815
16816         foo = bar;
16817 }
16818 EOCP
16819 if $cc -c try.c >/dev/null 2>&1 ; then
16820         val="$define"
16821         echo "Yup, it can."
16822 else
16823         val="$undef"
16824         echo "Nope, it can't."
16825 fi
16826 set d_strctcpy
16827 eval $setvar
16828 $rm -f try.*
16829
16830 : see if strerror and/or sys_errlist[] exist
16831 echo " "
16832 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16833     if set strerror val -f d_strerror; eval $csym; $val; then
16834                 echo 'strerror() found.' >&4
16835                 d_strerror="$define"
16836                 d_strerrm='strerror(e)'
16837                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16838                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16839                         d_syserrlst="$define"
16840                 else
16841                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16842                         d_syserrlst="$undef"
16843                 fi
16844     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16845                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16846                 echo 'strerror() found in string header.' >&4
16847                 d_strerror="$define"
16848                 d_strerrm='strerror(e)'
16849                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16850                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16851                                 d_syserrlst="$define"
16852                 else
16853                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16854                         d_syserrlst="$undef"
16855                 fi
16856     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16857                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16858                 d_strerror="$undef"
16859                 d_syserrlst="$define"
16860                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16861     else
16862                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16863                 d_strerror="$undef"
16864                 d_syserrlst="$undef"
16865                 d_strerrm='"unknown"'
16866     fi
16867 fi
16868
16869 : see if strerror_r exists
16870 set strerror_r d_strerror_r
16871 eval $inlibc
16872 case "$d_strerror_r" in
16873 "$define")
16874         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16875         case "$d_strerror_r_proto:$usethreads" in
16876         ":define")      d_strerror_r_proto=define
16877                 set d_strerror_r_proto strerror_r $hdrs
16878                 eval $hasproto ;;
16879         *)      ;;
16880         esac
16881         case "$d_strerror_r_proto" in
16882         define)
16883         case "$strerror_r_proto" in
16884         ''|0) try='int strerror_r(int, char*, size_t);'
16885         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16886         esac
16887         case "$strerror_r_proto" in
16888         ''|0) try='int strerror_r(int, char*, int);'
16889         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16890         esac
16891         case "$strerror_r_proto" in
16892         ''|0) try='char* strerror_r(int, char*, size_t);'
16893         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16894         esac
16895         case "$strerror_r_proto" in
16896         ''|0)   d_strerror_r=undef
16897                 strerror_r_proto=0
16898                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16899         * )     case "$strerror_r_proto" in
16900                 REENTRANT_PROTO*) ;;
16901                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16902                 esac
16903                 echo "Prototype: $try" ;;
16904         esac
16905         ;;
16906         *)      case "$usethreads" in
16907                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16908                 esac
16909                 d_strerror_r=undef
16910                 strerror_r_proto=0
16911                 ;;
16912         esac
16913         ;;
16914 *)      strerror_r_proto=0
16915         ;;
16916 esac
16917
16918 : see if strftime exists
16919 set strftime d_strftime
16920 eval $inlibc
16921
16922 : see if strlcat exists
16923 set strlcat d_strlcat
16924 eval $inlibc
16925
16926 : see if strlcpy exists
16927 set strlcpy d_strlcpy
16928 eval $inlibc
16929
16930 : see if strtod exists
16931 set strtod d_strtod
16932 eval $inlibc
16933
16934 : see if strtol exists
16935 set strtol d_strtol
16936 eval $inlibc
16937
16938 : see if strtold exists
16939 set strtold d_strtold
16940 eval $inlibc
16941
16942 : see if strtoll exists
16943 set strtoll d_strtoll
16944 eval $inlibc
16945
16946 case "$d_longlong-$d_strtoll" in
16947 "$define-$define")
16948         $cat <<EOM
16949 Checking whether your strtoll() works okay...
16950 EOM
16951         $cat >try.c <<'EOCP'
16952 #include <errno.h>
16953 #ifdef __hpux
16954 #define strtoll __strtoll
16955 #endif
16956 #ifdef __EMX__
16957 #define strtoll _strtoll
16958 #endif
16959 #include <stdio.h>
16960 extern long long int strtoll(char *s, char **, int); 
16961 static int bad = 0;
16962 int check(char *s, long long ell, int een) {
16963         long long gll;
16964         errno = 0;
16965         gll = strtoll(s, 0, 10);
16966         if (!((gll == ell) && (errno == een)))
16967                 bad++;
16968 }
16969 int main() {
16970         check(" 1",                                      1LL, 0);
16971         check(" 0",                                      0LL, 0);
16972         check("-1",                                     -1LL, 0);
16973         check("-9223372036854775808", -9223372036854775808LL, 0);
16974         check("-9223372036854775808", -9223372036854775808LL, 0);
16975         check(" 9223372036854775807",  9223372036854775807LL, 0);
16976         check("-9223372036854775808", -9223372036854775808LL, 0);
16977         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16978         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16979         if (!bad)
16980                 printf("ok\n");
16981 }
16982 EOCP
16983         set try
16984         if eval $compile; then
16985                 yyy=`$run ./try`
16986                 case "$yyy" in
16987                 ok) echo "Your strtoll() seems to be working okay." ;;
16988                 *) cat <<EOM >&4
16989 Your strtoll() doesn't seem to be working okay.
16990 EOM
16991                    d_strtoll="$undef"
16992                    ;;
16993                 esac
16994         else
16995                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16996                 d_strtoll="$undef"
16997         fi
16998         ;;
16999 esac
17000
17001 : see if strtoq exists
17002 set strtoq d_strtoq
17003 eval $inlibc
17004
17005 : see if strtoul exists
17006 set strtoul d_strtoul
17007 eval $inlibc
17008
17009 case "$d_strtoul" in
17010 "$define")
17011         $cat <<EOM
17012 Checking whether your strtoul() works okay...
17013 EOM
17014         $cat >try.c <<'EOCP'
17015 #include <errno.h>
17016 #include <stdio.h>
17017 extern unsigned long int strtoul(char *s, char **, int); 
17018 static int bad = 0;
17019 void check(char *s, unsigned long eul, int een) {
17020         unsigned long gul;
17021         errno = 0;
17022         gul = strtoul(s, 0, 10);
17023         if (!((gul == eul) && (errno == een)))
17024                 bad++;
17025 }
17026 int main() {
17027         check(" 1", 1L, 0);
17028         check(" 0", 0L, 0);
17029 EOCP
17030         case "$longsize" in
17031         8)
17032             $cat >>try.c <<'EOCP'
17033         check("18446744073709551615", 18446744073709551615UL, 0);
17034         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17035 #if 0 /* strtoul() for /^-/ strings is undefined. */
17036         check("-1", 18446744073709551615UL, 0);
17037         check("-18446744073709551614", 2, 0);
17038         check("-18446744073709551615", 1, 0);
17039         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17040         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17041 #endif
17042 EOCP
17043                 ;;
17044         4)
17045                     $cat >>try.c <<'EOCP'
17046         check("4294967295", 4294967295UL, 0);
17047         check("4294967296", 4294967295UL, ERANGE);
17048 #if 0 /* strtoul() for /^-/ strings is undefined. */
17049         check("-1", 4294967295UL, 0);
17050         check("-4294967294", 2, 0);
17051         check("-4294967295", 1, 0);
17052         check("-4294967296", 4294967295UL, ERANGE);
17053         check("-4294967297", 4294967295UL, ERANGE);
17054 #endif
17055 EOCP
17056                 ;;
17057         *)
17058 : Should we write these tests to be more portable by sprintf-ing
17059 : ~0 and then manipulating that char string as input for strtol?
17060                 ;;
17061         esac
17062         $cat >>try.c <<'EOCP'
17063         if (!bad)
17064                 printf("ok\n");
17065         return 0;
17066 }
17067 EOCP
17068         set try
17069         if eval $compile; then
17070                 case "`$run ./try`" in
17071                 ok) echo "Your strtoul() seems to be working okay." ;;
17072                 *) cat <<EOM >&4
17073 Your strtoul() doesn't seem to be working okay.
17074 EOM
17075                    d_strtoul="$undef"
17076                    ;;
17077                 esac
17078         fi
17079         ;;
17080 esac
17081
17082 : see if strtoull exists
17083 set strtoull d_strtoull
17084 eval $inlibc
17085
17086 case "$d_longlong-$d_strtoull" in
17087 "$define-$define")
17088         $cat <<EOM
17089 Checking whether your strtoull() works okay...
17090 EOM
17091         $cat >try.c <<'EOCP'
17092 #include <errno.h>
17093 #ifdef __hpux
17094 #define strtoull __strtoull
17095 #endif
17096 #include <stdio.h>
17097 extern unsigned long long int strtoull(char *s, char **, int); 
17098 static int bad = 0;
17099 int check(char *s, long long eull, int een) {
17100         long long gull;
17101         errno = 0;
17102         gull = strtoull(s, 0, 10);
17103         if (!((gull == eull) && (errno == een)))
17104                 bad++;
17105 }
17106 int main() {
17107         check(" 1",                                        1LL, 0);
17108         check(" 0",                                        0LL, 0);
17109         check("18446744073709551615",  18446744073709551615ULL, 0);
17110         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17111 #if 0 /* strtoull() for /^-/ strings is undefined. */
17112         check("-1",                    18446744073709551615ULL, 0);
17113         check("-18446744073709551614",                     2LL, 0);
17114         check("-18446744073709551615",                     1LL, 0);
17115         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17116         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17117 #endif
17118         if (!bad)
17119                 printf("ok\n");
17120 }
17121 EOCP
17122         set try
17123         if eval $compile; then
17124                 case "`$run ./try`" in
17125                 ok) echo "Your strtoull() seems to be working okay." ;;
17126                 *) cat <<EOM >&4
17127 Your strtoull() doesn't seem to be working okay.
17128 EOM
17129                    d_strtoull="$undef"
17130                    ;;
17131                 esac
17132         fi
17133         ;;
17134 esac
17135
17136 : see if strtouq exists
17137 set strtouq d_strtouq
17138 eval $inlibc
17139
17140 case "$d_strtouq" in
17141 "$define")
17142         $cat <<EOM
17143 Checking whether your strtouq() works okay...
17144 EOM
17145         $cat >try.c <<'EOCP'
17146 #include <errno.h>
17147 #include <stdio.h>
17148 extern unsigned long long int strtouq(char *s, char **, int); 
17149 static int bad = 0;
17150 void check(char *s, unsigned long long eull, int een) {
17151         unsigned long long gull;
17152         errno = 0;
17153         gull = strtouq(s, 0, 10);
17154         if (!((gull == eull) && (errno == een)))
17155                 bad++;
17156 }
17157 int main() {
17158         check(" 1",                                        1LL, 0);
17159         check(" 0",                                        0LL, 0);
17160         check("18446744073709551615",  18446744073709551615ULL, 0);
17161         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17162 #if 0 /* strtouq() for /^-/ strings is undefined. */
17163         check("-1",                    18446744073709551615ULL, 0);
17164         check("-18446744073709551614",                     2LL, 0);
17165         check("-18446744073709551615",                     1LL, 0);
17166         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17167         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17168 #endif
17169         if (!bad)
17170                 printf("ok\n");
17171         return 0;
17172 }
17173 EOCP
17174         set try
17175         if eval $compile; then
17176                 case "`$run ./try`" in
17177                 ok) echo "Your strtouq() seems to be working okay." ;;
17178                 *) cat <<EOM >&4
17179 Your strtouq() doesn't seem to be working okay.
17180 EOM
17181                    d_strtouq="$undef"
17182                    ;;
17183                 esac
17184         fi
17185         ;;
17186 esac
17187
17188 : see if strxfrm exists
17189 set strxfrm d_strxfrm
17190 eval $inlibc
17191
17192 : see if symlink exists
17193 set symlink d_symlink
17194 eval $inlibc
17195
17196 : see if syscall exists
17197 set syscall d_syscall
17198 eval $inlibc
17199
17200 : see if prototype for syscall is available
17201 echo " "
17202 set d_syscallproto syscall $i_unistd unistd.h
17203 eval $hasproto
17204
17205 : see if sysconf exists
17206 set sysconf d_sysconf
17207 eval $inlibc
17208
17209 : see if system exists
17210 set system d_system
17211 eval $inlibc
17212
17213 : see if tcgetpgrp exists
17214 set tcgetpgrp d_tcgetpgrp
17215 eval $inlibc
17216
17217 : see if tcsetpgrp exists
17218 set tcsetpgrp d_tcsetpgrp
17219 eval $inlibc
17220
17221 : see if prototype for telldir is available
17222 echo " "
17223 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17224 eval $hasproto
17225
17226 : see if time exists
17227 echo " "
17228 if test "X$d_time" = X -o X"$timetype" = X; then
17229     if set time val -f d_time; eval $csym; $val; then
17230                 echo 'time() found.' >&4
17231                 val="$define"
17232                 rp="What is the type returned by time() on this system?"
17233                 set time_t timetype long stdio.h sys/types.h
17234                 eval $typedef_ask
17235     else
17236                 echo 'time() not found, hope that will do.' >&4
17237                 val="$undef"
17238                 timetype='int';
17239     fi
17240     set d_time
17241     eval $setvar
17242 fi
17243
17244 : see if this is a sys/times.h system
17245 set sys/times.h i_systimes
17246 eval $inhdr
17247
17248 : see if times exists
17249 echo " "
17250 if set times val -f d_times; eval $csym; $val; then
17251         echo 'times() found.' >&4
17252         d_times="$define"
17253         inc=''
17254         case "$i_systimes" in
17255         "$define") inc='sys/times.h';;
17256         esac
17257         rp="What is the type returned by times() on this system?"
17258         set clock_t clocktype long stdio.h sys/types.h $inc
17259         eval $typedef_ask
17260 else
17261         echo 'times() NOT found, hope that will do.' >&4
17262         d_times="$undef"
17263         clocktype='int'
17264 fi
17265
17266 : see if tmpnam_r exists
17267 set tmpnam_r d_tmpnam_r
17268 eval $inlibc
17269 case "$d_tmpnam_r" in
17270 "$define")
17271         hdrs="$i_systypes sys/types.h define stdio.h "
17272         case "$d_tmpnam_r_proto:$usethreads" in
17273         ":define")      d_tmpnam_r_proto=define
17274                 set d_tmpnam_r_proto tmpnam_r $hdrs
17275                 eval $hasproto ;;
17276         *)      ;;
17277         esac
17278         case "$d_tmpnam_r_proto" in
17279         define)
17280         case "$tmpnam_r_proto" in
17281         ''|0) try='char* tmpnam_r(char*);'
17282         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17283         esac
17284         case "$tmpnam_r_proto" in
17285         ''|0)   d_tmpnam_r=undef
17286                 tmpnam_r_proto=0
17287                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17288         * )     case "$tmpnam_r_proto" in
17289                 REENTRANT_PROTO*) ;;
17290                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17291                 esac
17292                 echo "Prototype: $try" ;;
17293         esac
17294         ;;
17295         *)      case "$usethreads" in
17296                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17297                 esac
17298                 d_tmpnam_r=undef
17299                 tmpnam_r_proto=0
17300                 ;;
17301         esac
17302         ;;
17303 *)      tmpnam_r_proto=0
17304         ;;
17305 esac
17306
17307 : see if truncate exists
17308 set truncate d_truncate
17309 eval $inlibc
17310
17311 : see if ttyname_r exists
17312 set ttyname_r d_ttyname_r
17313 eval $inlibc
17314 case "$d_ttyname_r" in
17315 "$define")
17316         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17317         case "$d_ttyname_r_proto:$usethreads" in
17318         ":define")      d_ttyname_r_proto=define
17319                 set d_ttyname_r_proto ttyname_r $hdrs
17320                 eval $hasproto ;;
17321         *)      ;;
17322         esac
17323         case "$d_ttyname_r_proto" in
17324         define)
17325         case "$ttyname_r_proto" in
17326         ''|0) try='int ttyname_r(int, char*, size_t);'
17327         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17328         esac
17329         case "$ttyname_r_proto" in
17330         ''|0) try='int ttyname_r(int, char*, int);'
17331         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17332         esac
17333         case "$ttyname_r_proto" in
17334         ''|0) try='char* ttyname_r(int, char*, int);'
17335         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17336         esac
17337         case "$ttyname_r_proto" in
17338         ''|0)   d_ttyname_r=undef
17339                 ttyname_r_proto=0
17340                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17341         * )     case "$ttyname_r_proto" in
17342                 REENTRANT_PROTO*) ;;
17343                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17344                 esac
17345                 echo "Prototype: $try" ;;
17346         esac
17347         ;;
17348         *)      case "$usethreads" in
17349                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17350                 esac
17351                 d_ttyname_r=undef
17352                 ttyname_r_proto=0
17353                 ;;
17354         esac
17355         ;;
17356 *)      ttyname_r_proto=0
17357         ;;
17358 esac
17359
17360 : see if tzname[] exists
17361 echo " "
17362 if set tzname val -a d_tzname; eval $csym; $val; then
17363         val="$define"
17364         echo 'tzname[] found.' >&4
17365 else
17366         val="$undef"
17367         echo 'tzname[] NOT found.' >&4
17368 fi
17369 set d_tzname
17370 eval $setvar
17371
17372 case "$osname" in
17373 next|rhapsody|darwin) multiarch="$define" ;;
17374 esac
17375 case "$multiarch" in
17376 ''|[nN]*) multiarch="$undef" ;;
17377 esac
17378
17379 : check for ordering of bytes in a UV
17380 echo " "
17381 case "$usecrosscompile$multiarch" in
17382 *$define*)
17383         $cat <<EOM
17384 You seem to be either cross-compiling or doing a multiarchitecture build,
17385 skipping the byteorder check.
17386
17387 EOM
17388         byteorder='ffff'
17389         ;;
17390 *)
17391         case "$byteorder" in
17392         '')
17393                 $cat <<'EOM'
17394 In the following, larger digits indicate more significance.  A big-endian
17395 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17396 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17397 machines may have weird orders like 3412.  A Cray will report 87654321,
17398 an Alpha will report 12345678. If the test program works the default is
17399 probably right.
17400 I'm now running the test program...
17401 EOM
17402                 $cat >try.c <<EOCP
17403 #include <stdio.h>
17404 #$i_stdlib I_STDLIB
17405 #ifdef I_STDLIB
17406 #include <stdlib.h>
17407 #endif
17408 #include <sys/types.h>
17409 typedef $uvtype UV;
17410 int main()
17411 {
17412         int i;
17413         union {
17414                 UV l;
17415                 char c[$uvsize];
17416         } u;
17417
17418         if ($uvsize > 4)
17419                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17420         else
17421                 u.l = (UV)0x04030201;
17422         for (i = 0; i < $uvsize; i++)
17423                 printf("%c", u.c[i]+'0');
17424         printf("\n");
17425         exit(0);
17426 }
17427 EOCP
17428                 xxx_prompt=y
17429                 set try
17430                 if eval $compile && ./try > /dev/null; then
17431                         dflt=`$run ./try`
17432                         case "$dflt" in
17433                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17434                                 echo "(The test program ran ok.)"
17435                                 echo "byteorder=$dflt"
17436                                 xxx_prompt=n
17437                         ;;
17438                         ????|????????) echo "(The test program ran ok.)" ;;
17439                         *) echo "(The test program didn't run right for some reason.)" ;;
17440                         esac
17441                 else
17442                         dflt='4321'
17443                         cat <<'EOM'
17444 (I can't seem to compile the test program.  Guessing big-endian...)
17445 EOM
17446                 fi
17447                 case "$xxx_prompt" in
17448                 y)
17449                         rp="What is the order of bytes in $uvtype?"
17450                         . ./myread
17451                         byteorder="$ans"
17452                         ;;
17453                 *)      byteorder=$dflt
17454                         ;;
17455                 esac
17456                 ;;
17457         esac
17458         $rm -f try.c try
17459         ;;
17460 esac
17461
17462
17463 $cat <<EOM
17464
17465 Checking to see whether you can access character data unalignedly...
17466 EOM
17467 case "$d_u32align" in
17468 '')   $cat >try.c <<EOCP
17469 #include <stdio.h>
17470 #$i_stdlib I_STDLIB
17471 #ifdef I_STDLIB
17472 #include <stdlib.h>
17473 #endif
17474 #define U32 $u32type
17475 #define BYTEORDER 0x$byteorder
17476 #define U8 $u8type
17477 #include <signal.h>
17478 #ifdef SIGBUS
17479 $signal_t bletch(s) int s; { exit(4); }
17480 #endif
17481 int main() {
17482 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17483     U8 buf[8];
17484     U32 *up;
17485     int i;
17486
17487     if (sizeof(U32) != 4) {
17488         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17489         exit(1);
17490     }
17491
17492     fflush(stdout);
17493
17494 #ifdef SIGBUS
17495     signal(SIGBUS, bletch);
17496 #endif
17497
17498     buf[0] = 0;
17499     buf[1] = 0;
17500     buf[2] = 0;
17501     buf[3] = 1;
17502     buf[4] = 0;
17503     buf[5] = 0;
17504     buf[6] = 0;
17505     buf[7] = 1;
17506
17507     for (i = 0; i < 4; i++) {
17508         up = (U32*)(buf + i);
17509         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17510                (*up == 1 << (8*(3-i)))  /* little-endian */
17511               )
17512            )
17513         {
17514             printf("read failed (%x)\n", *up);
17515             exit(2);
17516         }
17517     }
17518
17519     /* write test */
17520     for (i = 0; i < 4; i++) {
17521         up = (U32*)(buf + i);
17522         *up = 0xBeef;
17523         if (*up != 0xBeef) {
17524             printf("write failed (%x)\n", *up);
17525             exit(3);
17526         }
17527     }
17528
17529     exit(0);
17530 #else
17531     printf("1\n");
17532     exit(1);
17533 #endif
17534     return 0;
17535 }
17536 EOCP
17537 set try
17538 if eval $compile_ok; then
17539         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17540         $run ./try 2>&1 >/dev/null
17541         case "$?" in
17542         0)      cat >&4 <<EOM
17543 You can access character data pretty unalignedly.
17544 EOM
17545                 d_u32align="$undef"
17546                 ;;
17547         *)      cat >&4 <<EOM
17548 It seems that you must access character data in an aligned manner.
17549 EOM
17550                 d_u32align="$define"
17551                 ;;
17552         esac
17553 else
17554         rp='Can you access character data at unaligned addresses?'
17555         dflt='n'
17556         . ./myread
17557         case "$ans" in
17558         [yY]*)  d_u32align="$undef"  ;;
17559         *)      d_u32align="$define" ;;
17560         esac
17561 fi
17562 $rm -f core core.try.* try.core
17563 ;;
17564 esac
17565
17566 : see if ualarm exists
17567 set ualarm d_ualarm
17568 eval $inlibc
17569
17570 : see if umask exists
17571 set umask d_umask
17572 eval $inlibc
17573
17574 : see if unordered exists
17575 set unordered d_unordered
17576 eval $inlibc
17577
17578 : see if unsetenv exists
17579 set unsetenv d_unsetenv
17580 eval $inlibc
17581
17582 : see if usleep exists
17583 set usleep d_usleep
17584 eval $inlibc
17585
17586 : see if prototype for usleep is available
17587 echo " "
17588 set d_usleepproto usleep $i_unistd unistd.h
17589 eval $hasproto
17590
17591 : see if ustat exists
17592 set ustat d_ustat
17593 eval $inlibc
17594
17595 : backward compatibility for d_hvfork
17596 if test X$d_hvfork != X; then
17597         d_vfork="$d_hvfork"
17598         d_hvfork=''
17599 fi
17600 : see if there is a vfork
17601 val=''
17602 set vfork val
17603 eval $inlibc
17604
17605 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17606 : perl on Solaris 2.x, and probably elsewhere.
17607 case "$val" in
17608 $define)
17609         echo " "
17610         case "$usevfork" in
17611         false) dflt='n';;
17612         *) dflt='y';;
17613         esac
17614         cat <<'EOM'
17615  
17616 Perl can only use a vfork() that doesn't suffer from strict
17617 restrictions on calling functions or modifying global data in
17618 the child.  For example, glibc-2.1 contains such a vfork()
17619 that is unsuitable.  If your system provides a proper fork()
17620 call, chances are that you do NOT want perl to use vfork().
17621
17622 EOM
17623         rp="Do you still want to use vfork()?"
17624         . ./myread
17625         case "$ans" in
17626         y|Y) ;;
17627         *)
17628                 echo "Ok, we won't use vfork()."
17629                 val="$undef"
17630                 ;;
17631         esac
17632         ;;
17633 esac
17634 set d_vfork
17635 eval $setvar
17636 case "$d_vfork" in
17637 $define) usevfork='true';;
17638 *) usevfork='false';;
17639 esac
17640
17641 : see if closedir exists
17642 set closedir d_closedir
17643 eval $inlibc
17644
17645 case "$d_closedir" in
17646 "$define")
17647         echo " "
17648         echo "Checking whether closedir() returns a status..." >&4
17649         cat > try.c <<EOM
17650 #$i_dirent I_DIRENT             /**/
17651 #$i_sysdir I_SYS_DIR            /**/
17652 #$i_sysndir I_SYS_NDIR          /**/
17653 #$i_systypes I_SYS_TYPES        /**/
17654
17655 #if defined(I_SYS_TYPES)
17656 #include <sys/types.h>
17657 #endif
17658 #if defined(I_DIRENT)
17659 #include <dirent.h>
17660 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17661 #include <sys/dir.h>
17662 #endif
17663 #else
17664 #ifdef I_SYS_NDIR
17665 #include <sys/ndir.h>
17666 #else
17667 #ifdef I_SYS_DIR
17668 #ifdef hp9000s500
17669 #include <ndir.h>       /* may be wrong in the future */
17670 #else
17671 #include <sys/dir.h>
17672 #endif
17673 #endif
17674 #endif
17675 #endif 
17676 int main() { return closedir(opendir(".")); }
17677 EOM
17678         set try
17679         if eval $compile_ok; then
17680                 if $run ./try > /dev/null 2>&1 ; then
17681                         echo "Yes, it does."
17682                         val="$undef"
17683                 else
17684                         echo "No, it doesn't."
17685                         val="$define"
17686                 fi
17687         else
17688                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17689                 val="$define"
17690         fi
17691         ;;
17692 *)
17693         val="$undef";
17694         ;;
17695 esac
17696 set d_void_closedir
17697 eval $setvar
17698 $rm -f try try.*
17699 : see if there is a wait4
17700 set wait4 d_wait4
17701 eval $inlibc
17702
17703 : see if waitpid exists
17704 set waitpid d_waitpid
17705 eval $inlibc
17706
17707 : see if wcstombs exists
17708 set wcstombs d_wcstombs
17709 eval $inlibc
17710
17711 : see if wctomb exists
17712 set wctomb d_wctomb
17713 eval $inlibc
17714
17715 : see if writev exists
17716 set writev d_writev
17717 eval $inlibc
17718
17719 : preserve RCS keywords in files with variable substitution, grrr
17720 Date='$Date'
17721 Id='$Id'
17722 Log='$Log'
17723 RCSfile='$RCSfile'
17724 Revision='$Revision'
17725
17726 : check for alignment requirements
17727 echo " "
17728 case "$usecrosscompile$multiarch" in
17729 *$define*)
17730         $cat <<EOM
17731 You seem to be either cross-compiling or doing a multiarchitecture build,
17732 skipping the memory alignment check.
17733
17734 EOM
17735         case "$alignbytes" in
17736         '') alignbytes=8 ;;
17737         esac
17738         ;;
17739 *)
17740         case "$alignbytes" in
17741         '') echo "Checking alignment constraints..." >&4
17742                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17743                         $cat >try.c <<'EOCP'
17744 typedef long double NV;
17745 EOCP
17746                 else
17747                         $cat >try.c <<'EOCP'
17748 typedef double NV;
17749 EOCP
17750                 fi
17751                 $cat >>try.c <<'EOCP'
17752 #include <stdio.h>
17753 struct foobar {
17754         char foo;
17755         NV bar;
17756 } try_algn;
17757 int main()
17758 {
17759     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17760     return(0);
17761 }
17762 EOCP
17763                 set try
17764                 if eval $compile_ok; then
17765                         dflt=`$run ./try`
17766                 else
17767                         dflt='8'
17768                         echo "(I can't seem to compile the test program...)"
17769                 fi
17770                 ;;
17771         *) dflt="$alignbytes"
17772                 ;;
17773         esac
17774         rp="Doubles must be aligned on a how-many-byte boundary?"
17775         . ./myread
17776         alignbytes="$ans"
17777         $rm -f try.c try
17778         ;;
17779 esac
17780
17781
17782 : set the base revision
17783 baserev=5.0
17784
17785 : how do we concatenate cpp tokens here?
17786 echo " "
17787 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17788 $cat >cpp_stuff.c <<'EOCP'
17789 #define RCAT(a,b)a/**/b
17790 #define ACAT(a,b)a ## b
17791 RCAT(Rei,ser)
17792 ACAT(Cir,cus)
17793 EOCP
17794 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17795 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17796         echo "Oh!  Smells like ANSI's been here." >&4
17797         echo "We can catify or stringify, separately or together!"
17798         cpp_stuff=42
17799 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17800         echo "Ah, yes!  The good old days!" >&4
17801         echo "However, in the good old days we don't know how to stringify and"
17802         echo "catify at the same time."
17803         cpp_stuff=1
17804 else
17805         $cat >&4 <<EOM
17806 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17807 You're going to have to edit the values of CAT[2-5] in config.h...
17808 EOM
17809         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17810 fi
17811 $rm -f cpp_stuff.*
17812
17813 : see if this is a db.h system
17814 set db.h i_db
17815 eval $inhdr
17816
17817 case "$i_db" in
17818 $define)
17819         : Check db version.
17820         echo " "
17821         echo "Checking Berkeley DB version ..." >&4
17822         $cat >try.c <<EOCP
17823 #$d_const HASCONST
17824 #ifndef HASCONST
17825 #define const
17826 #endif
17827 #include <sys/types.h>
17828 #include <stdio.h>
17829 #$i_stdlib I_STDLIB
17830 #ifdef I_STDLIB
17831 #include <stdlib.h>
17832 #endif
17833 #include <db.h>
17834 int main(int argc, char *argv[])
17835 {
17836 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17837     int Major, Minor, Patch ;
17838     unsigned long Version ;
17839     (void)db_version(&Major, &Minor, &Patch) ;
17840     if (argc == 2) {
17841         printf("%d %d %d %d %d %d\n",
17842                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17843                Major, Minor, Patch);
17844         exit(0);
17845     }
17846     printf("You have Berkeley DB Version 2 or greater.\n");
17847
17848     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17849                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17850     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17851                 Major, Minor, Patch) ;
17852
17853     /* check that db.h & libdb are compatible */
17854     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17855         printf("db.h and libdb are incompatible.\n") ;
17856         exit(3);        
17857     }
17858
17859     printf("db.h and libdb are compatible.\n") ;
17860
17861     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17862                 + DB_VERSION_PATCH ;
17863
17864     /* needs to be >= 2.3.4 */
17865     if (Version < 2003004) {
17866     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17867         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17868         exit(2);        
17869     }
17870
17871     exit(0);
17872 #else
17873 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17874     if (argc == 2) {
17875         printf("1 0 0\n");
17876         exit(0);
17877     }
17878     printf("You have Berkeley DB Version 1.\n");
17879     exit(0);    /* DB version < 2: the coast is clear. */
17880 #else
17881     exit(1);    /* <db.h> not Berkeley DB? */
17882 #endif
17883 #endif
17884 }
17885 EOCP
17886         set try
17887         if eval $compile_ok && $run ./try; then
17888                 echo 'Looks OK.' >&4
17889                 set `$run ./try 1`
17890                 db_version_major=$1
17891                 db_version_minor=$2
17892                 db_version_patch=$3
17893         else
17894                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17895                 i_db=$undef
17896                 case " $libs " in
17897                 *"-ldb "*)
17898                         : Remove db from list of libraries to use
17899                         echo "Removing unusable -ldb from library list" >&4
17900                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17901                         shift
17902                         libs="$*"
17903                         echo "libs = $libs" >&4
17904                         ;;
17905                 esac
17906         fi
17907         $rm -f try.*
17908         ;;
17909 esac
17910
17911 case "$i_db" in
17912 define)
17913         : Check the return type needed for hash 
17914         echo " "
17915         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17916         $cat >try.c <<EOCP
17917 #$d_const HASCONST
17918 #ifndef HASCONST
17919 #define const
17920 #endif
17921 #include <sys/types.h>
17922 #include <db.h>
17923
17924 #ifndef DB_VERSION_MAJOR
17925 u_int32_t hash_cb (ptr, size)
17926 const void *ptr;
17927 size_t size;
17928 {
17929 }
17930 HASHINFO info;
17931 int main()
17932 {
17933         info.hash = hash_cb;
17934 }
17935 #endif
17936 EOCP
17937         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17938                 if $contains warning try.out >>/dev/null 2>&1 ; then
17939                         db_hashtype='int'
17940                 else
17941                         db_hashtype='u_int32_t'
17942                 fi
17943         else
17944                 : XXX Maybe we should just give up here.
17945                 db_hashtype=u_int32_t
17946                 $cat try.out >&4
17947                 echo "Help:  I can't seem to compile the db test program." >&4
17948                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17949         fi
17950         $rm -f try.*
17951         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17952         ;;
17953 *)      db_hashtype=u_int32_t
17954         ;;
17955 esac
17956 case "$i_db" in
17957 define)
17958         : Check the return type needed for prefix 
17959         echo " "
17960         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17961         cat >try.c <<EOCP
17962 #$d_const HASCONST
17963 #ifndef HASCONST
17964 #define const
17965 #endif
17966 #include <sys/types.h>
17967 #include <db.h>
17968
17969 #ifndef DB_VERSION_MAJOR
17970 size_t prefix_cb (key1, key2)
17971 const DBT *key1;
17972 const DBT *key2;
17973 {
17974 }
17975 BTREEINFO info;
17976 int main()
17977 {
17978         info.prefix = prefix_cb;
17979 }
17980 #endif
17981 EOCP
17982         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17983                 if $contains warning try.out >>/dev/null 2>&1 ; then
17984                         db_prefixtype='int'
17985                 else
17986                         db_prefixtype='size_t'
17987                 fi
17988         else
17989                 db_prefixtype='size_t'
17990                 : XXX Maybe we should just give up here.
17991                 $cat try.out >&4
17992                 echo "Help:  I can't seem to compile the db test program." >&4
17993                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17994         fi
17995         $rm -f try.*
17996         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17997         ;;
17998 *)      db_prefixtype='size_t'
17999         ;;
18000 esac
18001
18002
18003 : How can we generate normalized random numbers ?
18004 echo " "
18005 echo "Looking for a random number function..." >&4
18006 case "$randfunc" in
18007 '')
18008         if set drand48 val -f; eval $csym; $val; then
18009                 dflt="drand48"
18010                 echo "Good, found drand48()." >&4
18011         elif set random val -f; eval $csym; $val; then
18012                 dflt="random"
18013                 echo "OK, found random()." >&4
18014         else
18015                 dflt="rand"
18016                 echo "Yick, looks like I have to use rand()." >&4
18017         fi
18018         echo " "
18019         ;;
18020 *)
18021         dflt="$randfunc"
18022         ;;
18023 esac
18024 cont=true
18025
18026 case "$ccflags" in
18027 *-Dmy_rand=*|*-Dmy_srand=*)
18028         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18029         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18030         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18031         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18032         ;;
18033 esac
18034
18035 while $test "$cont"; do
18036         rp="Use which function to generate random numbers?"
18037         . ./myread
18038         if $test "$ans" = "$dflt"; then
18039                 : null
18040         else
18041                 randbits=''
18042         fi
18043         randfunc="$ans"
18044         if set $ans val -f; eval $csym; $val; then
18045                 cont=''
18046         else
18047                 dflt=y
18048                 rp="I cannot find function $ans. Use that name anyway?"
18049                 . ./myread
18050                 dflt=rand
18051                 case "$ans" in
18052                         [yY]*) cont='';;
18053                 esac
18054         fi
18055         case "$cont" in
18056         '')
18057                 case "$randfunc" in
18058                 drand48)
18059                         drand01="drand48()"
18060                         seedfunc="srand48"
18061                         randbits=48
18062                         randseedtype=long
18063                         ;;
18064                 rand|random)
18065                         case "$randbits" in
18066                         '')
18067 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18068                                 $cat >try.c <<EOCP
18069 #$i_unistd I_UNISTD
18070 #$i_stdlib I_STDLIB
18071 #include <stdio.h>
18072 #ifdef I_UNISTD
18073 #  include <unistd.h>
18074 #endif
18075 #ifdef I_STDLIB
18076 #  include <stdlib.h>
18077 #endif
18078 int main()
18079 {
18080         register int i;
18081         register unsigned long tmp;
18082         register unsigned long max = 0L;
18083
18084         for (i = 1000; i; i--) {
18085                 tmp = (unsigned long) $randfunc();
18086                 if (tmp > max) max = tmp;
18087         }
18088         for (i = 0; max; i++)
18089                 max /= 2;
18090         printf("%d\n",i);
18091 }
18092 EOCP
18093                                 set try
18094                                 if eval $compile_ok; then
18095                                         dflt=`try`
18096                                 else
18097                                         dflt='?'
18098                                         echo "(I can't seem to compile the test program...)"
18099                                 fi
18100                                 ;;
18101                         *)
18102                                 dflt="$randbits"
18103                                 ;;
18104                         esac
18105                         rp="How many bits does your $randfunc() function produce?"
18106                         . ./myread
18107                         randbits="$ans"
18108                         $rm -f try.c try
18109                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18110                         seedfunc="s$randfunc"
18111                         randseedtype=unsigned
18112                         ;;
18113                 *)
18114                         dflt="31"
18115                         rp="How many bits does your $randfunc() function produce?"
18116                         . ./myread
18117                         randbits="$ans"
18118                         seedfunc="s$randfunc"
18119                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18120                         if set $seedfunc val -f; eval $csym; $val; then
18121                                 echo "(Using $seedfunc() to seed random generator)"
18122                         else
18123                                 echo "(Warning: no $seedfunc() to seed random generator)"
18124                                 seedfunc=rand
18125                         fi
18126                         randseedtype=unsigned
18127                         ;;
18128                 esac
18129                 ;;
18130         esac
18131 done
18132
18133 echo " "
18134 echo "Determining whether or not we are on an EBCDIC system..." >&4
18135 $cat >try.c <<'EOM'
18136 int main()
18137 {
18138   if ('M'==0xd4) return 0;
18139   return 1;
18140 }
18141 EOM
18142
18143 val=$undef
18144 set try
18145 if eval $compile_ok; then
18146         if $run ./try; then
18147                 echo "You seem to speak EBCDIC." >&4
18148                 val="$define"
18149         else
18150                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18151         fi
18152 else
18153         echo "I'm unable to compile the test program." >&4
18154         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18155 fi
18156 $rm -f try try.*
18157 set ebcdic
18158 eval $setvar
18159
18160 echo " "
18161 $cat >&4 <<EOM
18162 Checking how to flush all pending stdio output...
18163 EOM
18164 # I only know how to find the first 32 possibly open files on SunOS.
18165 # See also hints/sunos_4_1.sh and util.c  --AD
18166 case "$osname" in
18167 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18168 esac
18169 $cat >>try.c <<EOCP
18170 #include <stdio.h>
18171 #$i_stdlib I_STDLIB
18172 #ifdef I_STDLIB
18173 #include <stdlib.h>
18174 #endif
18175 #$i_unistd I_UNISTD
18176 #ifdef I_UNISTD
18177 # include <unistd.h>
18178 #endif
18179 #$d_sysconf HAS_SYSCONF
18180 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18181 #ifdef HAS_STDIO_STREAM_ARRAY
18182 # define STDIO_STREAM_ARRAY $stdio_stream_array
18183 #endif
18184 int main() {
18185   FILE* p;
18186   unlink("try.out");
18187   p = fopen("try.out", "w");
18188 #ifdef TRY_FPUTC
18189   fputc('x', p);
18190 #else
18191 # ifdef TRY_FPRINTF
18192   fprintf(p, "x");
18193 # endif
18194 #endif
18195 #ifdef TRY_FFLUSH_NULL
18196   fflush(NULL);
18197 #endif
18198 #ifdef TRY_FFLUSH_ALL
18199   {
18200     long open_max = -1;
18201 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18202     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18203 # else
18204 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18205     open_max = sysconf(_SC_OPEN_MAX);
18206 #  else
18207 #   ifdef FOPEN_MAX
18208     open_max = FOPEN_MAX;
18209 #   else
18210 #    ifdef OPEN_MAX
18211     open_max = OPEN_MAX;
18212 #    else
18213 #     ifdef _NFILE
18214     open_max = _NFILE;
18215 #     endif
18216 #    endif
18217 #   endif
18218 #  endif
18219 # endif 
18220 # ifdef HAS_STDIO_STREAM_ARRAY
18221     if (open_max > 0) {
18222       long i;
18223       for (i = 0; i < open_max; i++)
18224             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18225                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18226                 STDIO_STREAM_ARRAY[i]._flag)
18227                 fflush(&STDIO_STREAM_ARRAY[i]);
18228     }   
18229   }
18230 # endif
18231 #endif
18232   _exit(42);
18233 }
18234 EOCP
18235 : first we have to find out how _not_ to flush
18236 $to try.c
18237 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18238     output=''
18239     set try -DTRY_FPUTC
18240     if eval $compile; then
18241             $run ./try 2>/dev/null
18242             code="$?"
18243             $from try.out
18244             if $test ! -s try.out -a "X$code" = X42; then
18245                 output=-DTRY_FPUTC
18246             fi
18247     fi
18248     case "$output" in
18249     '')
18250             set try -DTRY_FPRINTF
18251             if eval $compile; then
18252                     $run ./try 2>/dev/null
18253                     code="$?"
18254                     $from try.out
18255                     if $test ! -s try.out -a "X$code" = X42; then
18256                         output=-DTRY_FPRINTF
18257                     fi
18258             fi
18259         ;;
18260     esac
18261 fi
18262 : check for fflush NULL behaviour
18263 case "$fflushNULL" in
18264 '')     set try -DTRY_FFLUSH_NULL $output
18265         if eval $compile; then
18266                 $run ./try 2>/dev/null
18267                 code="$?"
18268                 $from try.out
18269                 if $test -s try.out -a "X$code" = X42; then
18270                         fflushNULL="`$cat try.out`"
18271                 else
18272                         if $test "X$code" != X42; then
18273                                 $cat >&4 <<EOM
18274 (If this test failed, don't worry, we'll try another method shortly.)
18275 EOM
18276                         fi
18277                 fi
18278         fi
18279         $rm -f core try.core core.try.*
18280         case "$fflushNULL" in
18281         x)      $cat >&4 <<EOM
18282 Your fflush(NULL) works okay for output streams.
18283 Let's see if it clobbers input pipes...
18284 EOM
18285 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18286 # bug that improperly flushes the input end of pipes.  So we avoid the
18287 # autoflush on fork/system/exec support for now. :-(
18288 $cat >tryp.c <<EOCP
18289 #include <stdio.h>
18290 int
18291 main(int argc, char **argv)
18292 {
18293     char buf[1024];
18294     int i;
18295     char *bp = buf;
18296     while (1) {
18297         while ((i = getc(stdin)) != -1
18298                && (*bp++ = i) != '\n'
18299                && bp < &buf[1024])
18300         /* DO NOTHING */ ;
18301         *bp = '\0';
18302         fprintf(stdout, "%s", buf);
18303         fflush(NULL);
18304         if (i == -1)
18305             return 0;
18306         bp = buf;
18307     }
18308 }
18309 EOCP
18310                 fflushNULL="$define"
18311                 set tryp
18312                 if eval $compile; then
18313                     $rm -f tryp.out
18314                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18315                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18316                        $cat >&4 <<EOM
18317 fflush(NULL) seems to behave okay with input streams.
18318 EOM
18319                         fflushNULL="$define"
18320                     else
18321                         $cat >&4 <<EOM
18322 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18323 EOM
18324                         fflushNULL="$undef"
18325                     fi
18326                 fi
18327                 $rm -f core tryp.c tryp.core core.tryp.*
18328                 ;;
18329         '')     $cat >&4 <<EOM
18330 Your fflush(NULL) isn't working (contrary to ANSI C).
18331 EOM
18332                 fflushNULL="$undef"
18333                 ;;
18334         *)      $cat >&4 <<EOM
18335 Cannot figure out whether your fflush(NULL) works or not.
18336 I'm assuming it doesn't (contrary to ANSI C).
18337 EOM
18338                 fflushNULL="$undef"
18339                 ;;
18340         esac
18341         ;;
18342 $define|true|[yY]*)
18343         fflushNULL="$define"
18344         ;;
18345 *)
18346         fflushNULL="$undef"
18347         ;;
18348 esac
18349 : check explicit looping only if NULL did not work, and if the pipe
18350 : bug does not show up on an explicit flush too
18351 case "$fflushNULL" in
18352 "$undef")
18353         $cat >tryp.c <<EOCP
18354 #include <stdio.h>
18355 int
18356 main(int argc, char **argv)
18357 {
18358     char buf[1024];
18359     int i;
18360     char *bp = buf;
18361     while (1) {
18362         while ((i = getc(stdin)) != -1
18363                && (*bp++ = i) != '\n'
18364                && bp < &buf[1024])
18365         /* DO NOTHING */ ;
18366         *bp = '\0';
18367         fprintf(stdout, "%s", buf);
18368         fflush(stdin);
18369         if (i == -1)
18370             return 0;
18371         bp = buf;
18372     }
18373 }
18374 EOCP
18375         set tryp
18376         if eval $compile; then
18377             $rm -f tryp.out
18378             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18379             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18380                $cat >&4 <<EOM
18381 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18382 EOM
18383                 : now check for fflushall behaviour
18384                 case "$fflushall" in
18385                 '')     set try -DTRY_FFLUSH_ALL $output
18386                         if eval $compile; then
18387                                 $cat >&4 <<EOM
18388 (Now testing the other method--but note that this also may fail.)
18389 EOM
18390                                 $run ./try 2>/dev/null
18391                                 code=$?
18392                                 $from try.out
18393                                 if $test -s try.out -a "X$code" = X42; then
18394                                         fflushall="`$cat try.out`"
18395                                 fi
18396                         fi
18397                         $rm -f core try.core core.try.*
18398                         case "$fflushall" in
18399                         x)      $cat >&4 <<EOM
18400 Whew. Flushing explicitly all the stdio streams works.
18401 EOM
18402                                 fflushall="$define"
18403                                 ;;
18404                         '')     $cat >&4 <<EOM
18405 Sigh. Flushing explicitly all the stdio streams doesn't work.
18406 EOM
18407                                 fflushall="$undef"
18408                                 ;;
18409                         *)      $cat >&4 <<EOM
18410 Cannot figure out whether flushing stdio streams explicitly works or not.
18411 I'm assuming it doesn't.
18412 EOM
18413                                 fflushall="$undef"
18414                                 ;;
18415                         esac
18416                         ;;
18417                 "$define"|true|[yY]*)
18418                         fflushall="$define"
18419                         ;;
18420                 *)
18421                         fflushall="$undef"
18422                         ;;
18423                 esac
18424             else
18425                 $cat >&4 <<EOM
18426 All is futile.  Even fflush(stdin) clobbers input pipes!
18427 EOM
18428                 fflushall="$undef"
18429             fi
18430         else
18431             fflushall="$undef"
18432         fi
18433         $rm -f core tryp.c tryp.core core.tryp.*
18434         ;;
18435 *)      fflushall="$undef"
18436         ;;
18437 esac
18438
18439 case "$fflushNULL$fflushall" in
18440 undefundef)
18441         $cat <<EOM
18442 OK, I give up.  I cannot figure out how to flush pending stdio output.
18443 We won't be flushing handles at all before fork/exec/popen.
18444 EOM
18445         ;;
18446 esac
18447 $rm -f try.* try$exe_ext
18448
18449 : Store the full pathname to the ar program for use in the C program
18450 : Respect a hint or command line value for full_ar.
18451 case "$full_ar" in
18452 '') full_ar=$ar ;;
18453 esac
18454
18455 : Store the full pathname to the sed program for use in the C program
18456 full_sed=$sed
18457
18458 : see what type gids are declared as in the kernel
18459 echo " "
18460 echo "Looking for the type for group ids returned by getgid()."
18461 set gid_t gidtype xxx stdio.h sys/types.h
18462 eval $typedef
18463 case "$gidtype" in
18464 xxx)
18465         xxx=`./findhdr sys/user.h`
18466         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18467         case $1 in
18468         unsigned) dflt="$1 $2" ;;
18469         *) dflt="$1" ;;
18470         esac
18471         ;;
18472 *) dflt="$gidtype";;
18473 esac
18474 case "$gidtype" in
18475 gid_t) echo "gid_t found." ;;
18476 *)      rp="What is the type for group ids returned by getgid()?"
18477         . ./myread
18478         gidtype="$ans"
18479         ;;
18480 esac
18481
18482 echo " "
18483 case "$gidtype" in
18484 *_t) zzz="$gidtype"     ;;
18485 *)   zzz="gid"          ;;
18486 esac
18487 echo "Checking the size of $zzz..." >&4 
18488 cat > try.c <<EOCP
18489 #include <sys/types.h>
18490 #include <stdio.h>
18491 #$i_stdlib I_STDLIB
18492 #ifdef I_STDLIB
18493 #include <stdlib.h>
18494 #endif
18495 int main() {
18496     printf("%d\n", (int)sizeof($gidtype));
18497     exit(0);
18498 }
18499 EOCP
18500 set try
18501 if eval $compile_ok; then
18502         yyy=`$run ./try`
18503         case "$yyy" in
18504         '')     gidsize=4
18505                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18506                 ;;
18507         *)      gidsize=$yyy
18508                 echo "Your $zzz is $gidsize bytes long."
18509                 ;;
18510         esac
18511 else
18512         gidsize=4
18513         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18514 fi
18515
18516
18517 echo " "
18518 case "$gidtype" in
18519 *_t) zzz="$gidtype"     ;;
18520 *)   zzz="gid"          ;;
18521 esac
18522 echo "Checking the sign of $zzz..." >&4 
18523 cat > try.c <<EOCP
18524 #include <sys/types.h>
18525 #include <stdio.h>
18526 int main() {
18527         $gidtype foo = -1;
18528         if (foo < 0)
18529                 printf("-1\n");
18530         else
18531                 printf("1\n");
18532 }
18533 EOCP
18534 set try
18535 if eval $compile; then
18536         yyy=`$run ./try`
18537         case "$yyy" in
18538         '')     gidsign=1
18539                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18540                 ;;
18541         *)      gidsign=$yyy
18542                 case "$gidsign" in
18543                  1) echo "Your $zzz is unsigned." ;;
18544                 -1) echo "Your $zzz is signed."   ;;
18545                 esac
18546                 ;;
18547         esac
18548 else
18549         gidsign=1
18550         echo "(I can't compile the test program--guessing unsigned.)" >&4
18551 fi
18552
18553
18554 echo " "
18555
18556 if $test X"$quadtype" != X; then
18557
18558 echo "Checking how to print 64-bit integers..." >&4
18559
18560 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18561         $cat >try.c <<'EOCP'
18562 #include <sys/types.h>
18563 #include <stdio.h>
18564 int main() {
18565   int q = 12345678901;
18566   printf("%ld\n", q);
18567 }
18568 EOCP
18569         set try
18570         if eval $compile; then
18571                 yyy=`$run ./try`
18572                 case "$yyy" in
18573                 12345678901)
18574                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18575                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18576                         echo "We will use %d."
18577                         ;;
18578                 esac
18579         fi
18580 fi
18581
18582 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18583         $cat >try.c <<'EOCP'
18584 #include <sys/types.h>
18585 #include <stdio.h>
18586 int main() {
18587   long q = 12345678901;
18588   printf("%ld\n", q);
18589 }
18590 EOCP
18591         set try
18592         if eval $compile; then
18593                 yyy=`$run ./try`
18594                 case "$yyy" in
18595                 12345678901)
18596                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18597                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18598                         echo "We will use %ld."
18599                         ;;
18600                 esac
18601         fi
18602 fi
18603
18604 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18605         $cat >try.c <<'EOCP'
18606 #include <sys/types.h>
18607 #include <inttypes.h>
18608 #include <stdio.h>
18609 int main() {
18610   int64_t q = 12345678901;
18611   printf("%" PRId64 "\n", q);
18612 }
18613 EOCP
18614         set try
18615         if eval $compile; then
18616                 yyy=`$run ./try`
18617                 case "$yyy" in
18618                 12345678901)
18619                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18620                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18621                         echo "We will use the C9X style."
18622                         ;;
18623                 esac
18624         fi
18625 fi
18626
18627 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18628         $cat >try.c <<EOCP
18629 #include <sys/types.h>
18630 #include <stdio.h>
18631 int main() {
18632   $quadtype q = 12345678901;
18633   printf("%Ld\n", q);
18634 }
18635 EOCP
18636         set try
18637         if eval $compile; then
18638                 yyy=`$run ./try`
18639                 case "$yyy" in
18640                 12345678901)
18641                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18642                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18643                         echo "We will use %Ld."
18644                         ;;
18645                 esac
18646         fi
18647 fi
18648
18649 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18650         $cat >try.c <<'EOCP'
18651 #include <sys/types.h>
18652 #include <stdio.h>
18653 int main() {
18654   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18655   printf("%lld\n", q);
18656 }
18657 EOCP
18658         set try
18659         if eval $compile; then
18660                 yyy=`$run ./try`
18661                 case "$yyy" in
18662                 12345678901)
18663                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18664                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18665                         echo "We will use the %lld style."
18666                         ;;
18667                 esac
18668         fi
18669 fi
18670
18671 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18672         $cat >try.c <<EOCP
18673 #include <sys/types.h>
18674 #include <stdio.h>
18675 int main() {
18676   $quadtype q = 12345678901;
18677   printf("%qd\n", q);
18678 }
18679 EOCP
18680         set try
18681         if eval $compile; then
18682                 yyy=`$run ./try`
18683                 case "$yyy" in
18684                 12345678901)
18685                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18686                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18687                         echo "We will use %qd."
18688                         ;;
18689                 esac
18690         fi
18691 fi
18692
18693 if $test X"$sPRId64" = X; then
18694         echo "Cannot figure out how to print 64-bit integers." >&4
18695 fi
18696
18697 $rm -f try try.*
18698
18699 fi
18700
18701 case "$sPRId64" in
18702 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18703         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18704         ;;
18705 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18706         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18707         ;;
18708 esac
18709
18710
18711 echo " "
18712 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18713
18714 if $test X"$ivsize" = X8; then
18715         ivdformat="$sPRId64"
18716         uvuformat="$sPRIu64"
18717         uvoformat="$sPRIo64"
18718         uvxformat="$sPRIx64"
18719         uvXUformat="$sPRIXU64"
18720 else
18721         if $test X"$ivsize" = X"$longsize"; then
18722                 ivdformat='"ld"'
18723                 uvuformat='"lu"'
18724                 uvoformat='"lo"'
18725                 uvxformat='"lx"'
18726                 uvXUformat='"lX"'
18727         else
18728                 if $test X"$ivsize" = X"$intsize"; then
18729                         ivdformat='"d"'
18730                         uvuformat='"u"'
18731                         uvoformat='"o"'
18732                         uvxformat='"x"'
18733                         uvXUformat='"X"'
18734                 else
18735                         : far out
18736                         if $test X"$ivsize" = X"$shortsize"; then
18737                                 ivdformat='"hd"'
18738                                 uvuformat='"hu"'
18739                                 uvoformat='"ho"'
18740                                 uvxformat='"hx"'
18741                                 uvXUformat='"hX"'
18742                         fi
18743                 fi
18744         fi
18745 fi
18746
18747 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18748         nveformat="$sPRIeldbl"
18749         nvfformat="$sPRIfldbl"
18750         nvgformat="$sPRIgldbl"
18751         nvEUformat="$sPRIEUldbl"
18752         nvFUformat="$sPRIFUldbl"
18753         nvGUformat="$sPRIGUldbl"
18754 else
18755         nveformat='"e"'
18756         nvfformat='"f"'
18757         nvgformat='"g"'
18758         nvEUformat='"E"'
18759         nvFUformat='"F"'
18760         nvGUformat='"G"'
18761 fi
18762
18763 case "$ivdformat" in
18764 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18765     exit 1
18766     ;;
18767 esac
18768
18769
18770 echo " "
18771 $echo "Checking the format string to be used for gids..." >&4
18772
18773 case "$gidsign" in
18774 -1)     if $test X"$gidsize" = X"$ivsize"; then
18775                 gidformat="$ivdformat"
18776         else
18777                 if $test X"$gidsize" = X"$longsize"; then
18778                         gidformat='"ld"'
18779                 else
18780                         if $test X"$gidsize" = X"$intsize"; then
18781                                 gidformat='"d"'
18782                         else
18783                                 if $test X"$gidsize" = X"$shortsize"; then
18784                                         gidformat='"hd"'
18785                                 fi
18786                         fi
18787                 fi
18788         fi
18789         ;;
18790 *)      if $test X"$gidsize" = X"$uvsize"; then
18791                 gidformat="$uvuformat"
18792         else
18793                 if $test X"$gidsize" = X"$longsize"; then
18794                         gidformat='"lu"'
18795                 else
18796                         if $test X"$gidsize" = X"$intsize"; then
18797                                 gidformat='"u"'
18798                         else
18799                                 if $test X"$gidsize" = X"$shortsize"; then
18800                                         gidformat='"hu"'
18801                                 fi
18802                         fi
18803                 fi
18804         fi
18805         ;;
18806 esac
18807
18808 : see if getgroups exists
18809 set getgroups d_getgrps
18810 eval $inlibc
18811
18812 : see if setgroups exists
18813 set setgroups d_setgrps
18814 eval $inlibc
18815
18816
18817 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18818 echo " "
18819 case "$d_getgrps$d_setgrps" in
18820 *define*)
18821         case "$groupstype" in
18822         '') dflt="$gidtype" ;;
18823         *)  dflt="$groupstype" ;;
18824         esac
18825         $cat <<EOM
18826 What type of pointer is the second argument to getgroups() and setgroups()?
18827 Usually this is the same as group ids, $gidtype, but not always.
18828
18829 EOM
18830         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18831         . ./myread
18832         groupstype="$ans"
18833         ;;
18834 *)  groupstype="$gidtype";;
18835 esac
18836
18837 echo " "
18838 echo "Checking if your $make program sets \$(MAKE)..." >&4
18839 case "$make_set_make" in
18840 '')
18841         $sed 's/^X //' > testmake.mak << 'EOF'
18842 Xall:
18843 X       @echo 'maketemp="$(MAKE)"'
18844 EOF
18845         case "`$make -f testmake.mak 2>/dev/null`" in
18846         *maketemp=*) make_set_make='#' ;;
18847         *)      make_set_make="MAKE=$make" ;;
18848         esac
18849         $rm -f testmake.mak
18850         ;;
18851 esac
18852 case "$make_set_make" in
18853 '#') echo "Yup, it does.";;
18854 *) echo "Nope, it doesn't.";;
18855 esac
18856
18857 : see what type is used for mode_t
18858 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18859 set mode_t modetype int stdio.h sys/types.h
18860 eval $typedef_ask
18861
18862 : see if stdarg is available
18863 echo " "
18864 if $test `./findhdr stdarg.h`; then
18865         echo "<stdarg.h> found." >&4
18866         valstd="$define"
18867 else
18868         echo "<stdarg.h> NOT found." >&4
18869         valstd="$undef"
18870 fi
18871
18872 : see if varags is available
18873 echo " "
18874 if $test `./findhdr varargs.h`; then
18875         echo "<varargs.h> found." >&4
18876 else
18877         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18878 fi
18879
18880 : set up the varargs testing programs
18881 $cat > varargs.c <<EOP
18882 #ifdef I_STDARG
18883 #include <stdarg.h>
18884 #endif
18885 #ifdef I_VARARGS
18886 #include <varargs.h>
18887 #endif
18888
18889 #ifdef I_STDARG
18890 int f(char *p, ...)
18891 #else
18892 int f(va_alist)
18893 va_dcl
18894 #endif
18895 {
18896         va_list ap;
18897 #ifndef I_STDARG
18898         char *p;
18899 #endif
18900 #ifdef I_STDARG
18901         va_start(ap,p);
18902 #else
18903         va_start(ap);
18904         p = va_arg(ap, char *);
18905 #endif
18906         va_end(ap);
18907 }
18908 EOP
18909 $cat > varargs <<EOP
18910 $startsh
18911 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18912         echo "true"
18913 else
18914         echo "false"
18915 fi
18916 $rm -f varargs$_o
18917 EOP
18918 chmod +x varargs
18919
18920 : now check which varargs header should be included
18921 echo " "
18922 i_varhdr=''
18923 case "$valstd" in
18924 "$define")
18925         if `./varargs I_STDARG`; then
18926                 val='stdarg.h'
18927         elif `./varargs I_VARARGS`; then
18928                 val='varargs.h'
18929         fi
18930         ;;
18931 *)
18932         if `./varargs I_VARARGS`; then
18933                 val='varargs.h'
18934         fi
18935         ;;
18936 esac
18937 case "$val" in
18938 '')
18939 echo "I could not find the definition for va_dcl... You have problems..." >&4
18940         val="$undef"; set i_stdarg; eval $setvar
18941         val="$undef"; set i_varargs; eval $setvar
18942         ;;
18943 *) 
18944         set i_varhdr
18945         eval $setvar
18946         case "$i_varhdr" in
18947         stdarg.h)
18948                 val="$define"; set i_stdarg; eval $setvar
18949                 val="$undef"; set i_varargs; eval $setvar
18950                 ;;
18951         varargs.h)
18952                 val="$undef"; set i_stdarg; eval $setvar
18953                 val="$define"; set i_varargs; eval $setvar
18954                 ;;
18955         esac
18956         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18957 esac
18958 $rm -f varargs*
18959
18960 : see if we need va_copy
18961 echo " "
18962 case "$i_stdarg" in
18963 "$define")
18964         $cat >try.c <<EOCP
18965 #include <stdarg.h>
18966 #include <stdio.h>
18967 #$i_stdlib I_STDLIB
18968 #ifdef I_STDLIB
18969 #include <stdlib.h>
18970 #endif
18971 #include <signal.h>
18972
18973 int
18974 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18975 {
18976   return vfprintf(f, fmt, *valp);
18977 }
18978  
18979 int    
18980 myvfprintf(FILE *f, const  char *fmt, va_list val)
18981 {
18982   return ivfprintf(f, fmt, &val);
18983 }
18984       
18985 int
18986 myprintf(char *fmt, ...) 
18987 {
18988   va_list val;
18989   va_start(val, fmt);
18990   return myvfprintf(stdout, fmt, val); 
18991 }         
18992
18993 int
18994 main(int ac, char **av)
18995 {
18996   signal(SIGSEGV, exit);
18997
18998   myprintf("%s%cs all right, then\n", "that", '\'');                            
18999   exit(0);      
19000 }
19001 EOCP
19002         set try
19003         if eval $compile && $run ./try 2>&1 >/dev/null; then
19004                 case "`$run ./try`" in
19005                 "that's all right, then")
19006                         okay=yes
19007                         ;;
19008                 esac
19009         fi
19010         case "$okay" in
19011         yes)    echo "It seems that you don't need va_copy()." >&4
19012                 need_va_copy="$undef"
19013                 ;;
19014         *)      echo "It seems that va_copy() or similar will be needed." >&4
19015                 need_va_copy="$define"
19016                 ;;
19017         esac
19018         $rm -f try.* core core.* *.core *.core.*
19019         ;;
19020 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19021         ;;
19022 esac
19023
19024 : see what type is used for size_t
19025 rp="What is the type used for the length parameter for string functions?"
19026 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19027 eval $typedef_ask
19028
19029 : check for type of arguments to gethostbyaddr. 
19030 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19031         case "$d_gethbyaddr" in
19032         $define)
19033                 $cat <<EOM
19034
19035 Checking to see what type of arguments are accepted by gethostbyaddr().
19036 EOM
19037                 hdrs="$define sys/types.h
19038                         $d_socket sys/socket.h 
19039                         $i_niin netinet/in.h 
19040                         $i_netdb netdb.h
19041                         $i_unistd unistd.h"
19042                 : The first arg can 'char *' or 'void *'
19043                 : The second arg is some of integral type
19044                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19045                         for yyy in size_t long int; do
19046                                 case "$netdb_host_type" in
19047                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19048                                         if ./protochk "$try" $hdrs; then
19049                                                 echo "Your system accepts $xxx for the first arg."
19050                                                 echo "...and $yyy for the second arg."
19051                                                 netdb_host_type="$xxx"
19052                                                 netdb_hlen_type="$yyy"
19053                                         fi
19054                                         ;;
19055                                 esac
19056                         done
19057                 done
19058                 : In case none of those worked, prompt the user.
19059                 case "$netdb_host_type" in
19060                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19061                         dflt='char *'
19062                         . ./myread
19063                         netdb_host_type=$ans
19064                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19065                         dflt="$sizetype"
19066                         . ./myread
19067                         netdb_hlen_type=$ans
19068                         ;;
19069                 esac
19070                 ;;
19071         *)      : no gethostbyaddr, so pick harmless defaults
19072                 netdb_host_type='char *'
19073                 netdb_hlen_type="$sizetype"
19074                 ;;
19075         esac
19076         # Remove the "const" if needed. -- but then we'll have a 
19077         # prototype clash!
19078         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19079 fi
19080
19081 : check for type of argument to gethostbyname. 
19082 if test "X$netdb_name_type" = X ; then
19083         case "$d_gethbyname" in
19084         $define)
19085                 $cat <<EOM
19086
19087 Checking to see what type of argument is accepted by gethostbyname().
19088 EOM
19089                 hdrs="$define sys/types.h
19090                         $d_socket sys/socket.h 
19091                         $i_niin netinet/in.h 
19092                         $i_netdb netdb.h
19093                         $i_unistd unistd.h"
19094                 for xxx in "const char *" "char *"; do
19095                         case "$netdb_name_type" in
19096                         '')     try="extern struct hostent *gethostbyname($xxx);"
19097                                 if ./protochk "$try" $hdrs; then
19098                                         echo "Your system accepts $xxx."
19099                                         netdb_name_type="$xxx"
19100                                 fi
19101                                 ;;
19102                         esac
19103                 done
19104                 : In case none of those worked, prompt the user.
19105                 case "$netdb_name_type" in
19106                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19107                         dflt='char *'
19108                         . ./myread
19109                         netdb_name_type=$ans
19110                         ;;
19111                 esac
19112                 ;;
19113         *)      : no gethostbyname, so pick harmless default
19114                 netdb_name_type='char *'
19115                 ;;
19116         esac
19117 fi
19118
19119 : check for type of 1st argument to getnetbyaddr. 
19120 if test "X$netdb_net_type" = X ; then
19121         case "$d_getnbyaddr" in
19122         $define)
19123                 $cat <<EOM
19124
19125 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19126 EOM
19127                 hdrs="$define sys/types.h
19128                         $d_socket sys/socket.h 
19129                         $i_niin netinet/in.h 
19130                         $i_netdb netdb.h
19131                         $i_unistd unistd.h"
19132                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19133                         case "$netdb_net_type" in
19134                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19135                                 if ./protochk "$try" $hdrs; then
19136                                         echo "Your system accepts $xxx."
19137                                         netdb_net_type="$xxx"
19138                                 fi
19139                                 ;;
19140                         esac
19141                 done
19142                 : In case none of those worked, prompt the user.
19143                 case "$netdb_net_type" in
19144                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19145                         dflt='long'
19146                         . ./myread
19147                         netdb_net_type=$ans
19148                         ;;
19149                 esac
19150                 ;;
19151         *)      : no getnetbyaddr, so pick harmless default
19152                 netdb_net_type='long'
19153                 ;;
19154         esac
19155 fi
19156 : locate the preferred pager for this system
19157 fn=f/
19158 case "$pager" in
19159 '')
19160         dflt=''
19161         case "$pg" in
19162         /*) dflt=$pg;;
19163         [a-zA-Z]:/*) dflt=$pg;;
19164         esac
19165         case "$more" in
19166         /*) dflt=$more;;
19167         [a-zA-Z]:/*) dflt=$more;;
19168         esac
19169         case "$less" in
19170         /*) dflt=$less;;
19171         [a-zA-Z]:/*) dflt=$less;;
19172         esac
19173         case "$dflt" in
19174         '') dflt=/usr/ucb/more;;
19175         esac
19176         ;;
19177 *)      dflt="$pager"
19178         : Instruct ./getfile to trust the hinted or previous pager value,
19179         : even if it does not begin with a slash.  For example, on os2,
19180         : pager might be cmd /c more.  See comments in UU/getfile.
19181         fn="f/($pager)"
19182         ;;
19183 esac
19184 echo " "
19185 rp='What pager is used on your system?'
19186 . ./getfile
19187 pager="$ans"
19188
19189 : see what type pids are declared as in the kernel
19190 rp="What is the type of process ids on this system?"
19191 set pid_t pidtype int stdio.h sys/types.h
19192 eval $typedef_ask
19193
19194 : see if ar generates random libraries by itself
19195 echo " "
19196 echo "Checking how to generate random libraries on your machine..." >&4
19197 echo 'int bar1() { return bar2(); }' > bar1.c
19198 echo 'int bar2() { return 2; }' > bar2.c
19199 $cat > foo.c <<EOP
19200 #$i_stdlib I_STDLIB
19201 #ifdef I_STDLIB
19202 #include <stdlib.h>
19203 #endif
19204 int main() { printf("%d\n", bar1()); exit(0); }
19205 EOP
19206 $cc $ccflags -c bar1.c >/dev/null 2>&1
19207 $cc $ccflags -c bar2.c >/dev/null 2>&1
19208 $cc $ccflags -c foo.c >/dev/null 2>&1
19209 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19210 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19211         $run ./foobar >/dev/null 2>&1; then
19212         echo "$ar appears to generate random libraries itself."
19213         orderlib=false
19214         if [ "X$ranlib" = "X" ]; then
19215             ranlib=":"
19216         fi
19217 elif $ar ts bar$_a >/dev/null 2>&1 &&
19218         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19219         $run ./foobar >/dev/null 2>&1; then
19220                 echo "a table of contents needs to be added with '$ar ts'."
19221                 orderlib=false
19222                 ranlib="$ar ts"
19223 else
19224         case "$ranlib" in
19225         :) ranlib='';;
19226         '')
19227                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19228                 $test -f $ranlib || ranlib=''
19229                 ;;
19230         esac
19231         if $test -n "$ranlib"; then
19232                 echo "your system has '$ranlib'; we'll use that."
19233                 orderlib=false
19234         else
19235                 echo "your system doesn't seem to support random libraries"
19236                 echo "so we'll use lorder and tsort to order the libraries."
19237                 orderlib=true
19238                 ranlib=":"
19239         fi
19240 fi
19241 $rm -f foo* bar* 
19242
19243 : check for type of arguments to select. 
19244 case "$selecttype" in
19245 '') case "$d_select" in
19246         $define)
19247                 echo " "
19248                 $cat <<EOM
19249 Checking to see what type of arguments are accepted by select().
19250 EOM
19251                 hdrs="$define sys/types.h
19252                         $i_systime sys/time.h 
19253                         $i_sysselct sys/select.h
19254                         $d_socket sys/socket.h"
19255                 : The first arg can be int, unsigned, or size_t
19256                 : The last arg may or may not be 'const'
19257                 val=''
19258                 : void pointer has been seen but using that
19259                 : breaks the selectminbits test
19260                 for xxx in 'fd_set *' 'int *'; do
19261                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19262                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19263                                         case "$val" in
19264                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19265                                                 if ./protochk "$try" $hdrs; then
19266                                                         echo "Your system accepts $xxx."
19267                                                         val="$xxx"
19268                                                 fi
19269                                                 ;;
19270                                         esac
19271                                 done
19272                         done
19273                 done
19274                 case "$val" in
19275                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19276                         case "$d_fd_set" in
19277                                 $define) dflt="fd_set *" ;;
19278                                 *)              dflt="int *" ;;
19279                         esac
19280                         . ./myread
19281                         val=$ans
19282                         ;;
19283                 esac
19284                 selecttype="$val"
19285                 ;;
19286         *)      : no select, so pick a harmless default
19287                 selecttype='int *'
19288                 ;;
19289         esac
19290         ;;
19291 esac
19292
19293 : check for the select 'width'
19294 case "$selectminbits" in
19295 '') safebits=`expr $ptrsize \* 8`
19296     case "$d_select" in
19297         $define)
19298                 $cat <<EOM
19299
19300 Checking to see on how many bits at a time your select() operates...
19301 EOM
19302                 $cat >try.c <<EOCP
19303 #include <sys/types.h>
19304 #$i_time I_TIME
19305 #$i_systime I_SYS_TIME
19306 #$i_systimek I_SYS_TIME_KERNEL
19307 #ifdef I_TIME
19308 #   include <time.h>
19309 #endif
19310 #ifdef I_SYS_TIME
19311 #   ifdef I_SYS_TIME_KERNEL
19312 #       define KERNEL
19313 #   endif
19314 #   include <sys/time.h>
19315 #   ifdef I_SYS_TIME_KERNEL
19316 #       undef KERNEL
19317 #   endif
19318 #endif
19319 #$i_sysselct I_SYS_SELECT
19320 #ifdef I_SYS_SELECT
19321 #include <sys/select.h>
19322 #endif
19323 #$d_socket HAS_SOCKET
19324 #ifdef HAS_SOCKET
19325 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19326 #endif
19327 #include <stdio.h>
19328 #$i_stdlib I_STDLIB
19329 #ifdef I_STDLIB
19330 #include <stdlib.h>
19331 #endif
19332 $selecttype b;
19333 #define S sizeof(*(b))
19334 #define MINBITS 64
19335 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19336 #define NBITS  (NBYTES * 8)
19337 int main() {
19338     char *s = malloc(NBYTES);
19339     struct timeval t;
19340     int i;
19341     FILE* fp;
19342     int fd;
19343
19344     if (!s)
19345         exit(1);
19346     fclose(stdin);
19347     fp = fopen("try.c", "r");
19348     if (fp == 0)
19349       exit(2);
19350     fd = fileno(fp);
19351     if (fd < 0)
19352       exit(3);
19353     b = ($selecttype)s;
19354     for (i = 0; i < NBITS; i++)
19355         FD_SET(i, b);
19356     t.tv_sec  = 0;
19357     t.tv_usec = 0;
19358     select(fd + 1, b, 0, 0, &t);
19359     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19360     free(s);
19361     printf("%d\n", i + 1);
19362     return 0;
19363 }
19364 EOCP
19365                 set try
19366                 if eval $compile_ok; then
19367                         selectminbits=`$run ./try`
19368                         case "$selectminbits" in
19369                         '')     cat >&4 <<EOM
19370 Cannot figure out on how many bits at a time your select() operates.
19371 I'll play safe and guess it is $safebits bits.
19372 EOM
19373                                 selectminbits=$safebits
19374                                 bits="$safebits bits"
19375                                 ;;
19376                         1)      bits="1 bit" ;;
19377                         *)      bits="$selectminbits bits" ;;
19378                         esac
19379                         echo "Your select() operates on $bits at a time." >&4
19380                 else
19381                         rp='What is the minimum number of bits your select() operates on?'
19382                         case "$byteorder" in
19383                         12345678)       dflt=64 ;;
19384                         1234)           dflt=32 ;;
19385                         *)              dflt=1  ;;
19386                         esac
19387                         . ./myread
19388                         val=$ans
19389                         selectminbits="$val"
19390                 fi
19391                 $rm -f try.* try
19392                 ;;
19393         *)      : no select, so pick a harmless default
19394                 selectminbits=$safebits
19395                 ;;
19396         esac
19397         ;;
19398 esac
19399
19400 : Trace out the files included by signal.h, then look for SIGxxx names.
19401 : Remove SIGARRAYSIZE used by HPUX.
19402 : Remove SIGSTKSIZE used by Linux.
19403 : Remove SIGSTKSZ used by Posix.
19404 : Remove SIGTYP void lines used by OS2.
19405 : Some cpps, like os390, dont give the file name anywhere
19406 if [ "X$fieldn" = X ]; then
19407         : Just make some guesses.  We check them later.
19408         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19409 else
19410         xxx=`echo '#include <signal.h>' |
19411         $cppstdin $cppminus $cppflags 2>/dev/null |
19412         $grep '^[       ]*#.*include' | 
19413         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19414 fi
19415 : Check this list of files to be sure we have parsed the cpp output ok.
19416 : This will also avoid potentially non-existent files, such 
19417 : as ../foo/bar.h
19418 xxxfiles=''
19419 for xx in $xxx /dev/null ; do
19420         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19421 done
19422 : If we have found no files, at least try signal.h
19423 case "$xxxfiles" in
19424 '')     xxxfiles=`./findhdr signal.h` ;;
19425 esac
19426 xxx=`awk '
19427 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19428         print substr($2, 4, 20)
19429 }
19430 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19431         print substr($3, 4, 20)
19432 }' $xxxfiles`
19433 : Append some common names just in case the awk scan failed.
19434 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19435 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19436 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19437 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19438 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19439
19440 : generate a few handy files for later
19441 $cat > signal.c <<EOCP
19442 #include <sys/types.h>
19443 #include <signal.h>
19444 #$i_stdlib I_STDLIB
19445 #ifdef I_STDLIB
19446 #include <stdlib.h>
19447 #endif
19448 #include <stdio.h>
19449 int main() {
19450
19451 /* Strange style to avoid deeply-nested #if/#else/#endif */
19452 #ifndef NSIG
19453 #  ifdef _NSIG
19454 #    define NSIG (_NSIG)
19455 #  endif
19456 #endif
19457
19458 #ifndef NSIG
19459 #  ifdef SIGMAX
19460 #    define NSIG (SIGMAX+1)
19461 #  endif
19462 #endif
19463
19464 #ifndef NSIG
19465 #  ifdef SIG_MAX
19466 #    define NSIG (SIG_MAX+1)
19467 #  endif
19468 #endif
19469
19470 #ifndef NSIG
19471 #  ifdef _SIG_MAX
19472 #    define NSIG (_SIG_MAX+1)
19473 #  endif
19474 #endif
19475
19476 #ifndef NSIG
19477 #  ifdef MAXSIG
19478 #    define NSIG (MAXSIG+1)
19479 #  endif
19480 #endif
19481
19482 #ifndef NSIG
19483 #  ifdef MAX_SIG
19484 #    define NSIG (MAX_SIG+1)
19485 #  endif
19486 #endif
19487
19488 #ifndef NSIG
19489 #  ifdef SIGARRAYSIZE
19490 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19491 #  endif
19492 #endif
19493
19494 #ifndef NSIG
19495 #  ifdef _sys_nsig
19496 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19497 #  endif
19498 #endif
19499
19500 /* Default to some arbitrary number that's big enough to get most
19501    of the common signals.
19502 */
19503 #ifndef NSIG
19504 #    define NSIG 50
19505 #endif
19506
19507 printf("NSIG %d\n", NSIG);
19508
19509 #ifndef JUST_NSIG
19510
19511 EOCP
19512
19513 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19514 {
19515         printf "#ifdef SIG"; printf $1; printf "\n"
19516         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19517         printf $1; printf ");\n"
19518         printf "#endif\n"
19519 }
19520 END {
19521         printf "#endif /* JUST_NSIG */\n";
19522         printf "exit(0);\n}\n";
19523 }
19524 ' >>signal.c
19525 $cat >signal.awk <<'EOP'
19526 BEGIN { ndups = 0 }
19527 $1 ~ /^NSIG$/ { nsig = $2 }
19528 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19529     if ($2 > maxsig) { maxsig = $2 }
19530     if (sig_name[$2]) {
19531         dup_name[ndups] = $1
19532         dup_num[ndups] = $2
19533         ndups++ 
19534     }
19535     else {
19536         sig_name[$2] = $1
19537         sig_num[$2] = $2
19538     }
19539 }
19540 END { 
19541     if (nsig == 0) {
19542         nsig = maxsig + 1
19543     }
19544     printf("NSIG %d\n", nsig);
19545     for (n = 1; n < nsig; n++) {
19546         if (sig_name[n]) {
19547             printf("%s %d\n", sig_name[n], sig_num[n])
19548         }
19549         else {
19550             printf("NUM%d %d\n", n, n) 
19551         }
19552     }
19553     for (n = 0; n < ndups; n++) {
19554         printf("%s %d\n", dup_name[n], dup_num[n])
19555     }
19556 }
19557 EOP
19558 $cat >signal_cmd <<EOS
19559 $startsh
19560 if $test -s signal.lst; then
19561     echo "Using your existing signal.lst file"
19562         exit 0
19563 fi
19564 xxx="$xxx"
19565 EOS
19566 $cat >>signal_cmd <<'EOS'
19567
19568 set signal
19569 if eval $compile_ok; then
19570         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19571 else
19572         echo "(I can't seem be able to compile the whole test program)" >&4
19573         echo "(I'll try it in little pieces.)" >&4
19574         set signal -DJUST_NSIG
19575         if eval $compile_ok; then
19576                 $run ./signal$_exe > signal.nsg
19577                 $cat signal.nsg
19578         else
19579                 echo "I can't seem to figure out how many signals you have." >&4
19580                 echo "Guessing 50." >&4
19581                 echo 'NSIG 50' > signal.nsg
19582         fi
19583         : Now look at all the signal names, one at a time.
19584         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19585                 $cat > signal.c <<EOCP
19586 #include <sys/types.h>
19587 #include <signal.h>
19588 #include <stdio.h>
19589 int main() {
19590 printf("$xx %d\n", SIG${xx});
19591 return 0;
19592 }
19593 EOCP
19594                 set signal
19595                 if eval $compile; then
19596                         echo "SIG${xx} found."
19597                         $run ./signal$_exe  >> signal.ls1
19598                 else
19599                         echo "SIG${xx} NOT found."
19600                 fi
19601         done
19602         if $test -s signal.ls1; then
19603                 $cat signal.nsg signal.ls1 |
19604                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19605         fi
19606
19607 fi
19608 if $test -s signal.lst; then
19609         :
19610 else
19611         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19612         echo 'kill -l' >signal
19613         set X `csh -f <signal`
19614         $rm -f signal
19615         shift
19616         case $# in
19617         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19618         esac
19619         echo $@ | $tr ' ' $trnl | \
19620             $awk '{ printf "%s %d\n", $1, ++s; }
19621                   END { printf "NSIG %d\n", ++s }' >signal.lst
19622 fi
19623 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19624 EOS
19625 chmod a+x signal_cmd
19626 $eunicefix signal_cmd
19627
19628 : generate list of signal names
19629 echo " "
19630 case "$sig_name_init" in
19631 '') doinit=yes ;;
19632 *)  case "$sig_num_init" in
19633     ''|*,*) doinit=yes ;;
19634     esac ;;
19635 esac
19636 case "$doinit" in
19637 yes)
19638         echo "Generating a list of signal names and numbers..." >&4
19639         . ./signal_cmd
19640         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19641         sig_name=`$awk 'BEGIN { printf "ZERO " }
19642                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19643         sig_num=`$awk  'BEGIN { printf "0 " }
19644                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19645         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19646                              !/^NSIG/   { printf "\"%s\", ", $1 }
19647                              END        { printf "0\n" }' signal.lst`
19648         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19649                              !/^NSIG/   { printf "%d, ", $2}
19650                              END        { printf "0\n"}' signal.lst`
19651         ;;
19652 esac
19653 echo "The following $sig_count signals are available:"
19654 echo " "
19655 echo $sig_name | $awk \
19656 'BEGIN { linelen = 0 }
19657 {
19658         for (i = 1; i <= NF; i++) {
19659                 name = "SIG" $i " "
19660                 linelen = linelen + length(name)
19661                 if (linelen > 70) {
19662                         printf "\n"
19663                         linelen = length(name)
19664                 }
19665                 printf "%s", name
19666         }
19667         printf "\n"
19668 }'
19669 sig_size=`echo $sig_name | awk '{print NF}'`
19670 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19671
19672 echo " "
19673 case "$sizetype" in
19674 *_t) zzz="$sizetype"    ;;
19675 *)   zzz="filesize"     ;;
19676 esac
19677 echo "Checking the size of $zzz..." >&4 
19678 cat > try.c <<EOCP
19679 #include <sys/types.h>
19680 #include <stdio.h>
19681 #$i_stdlib I_STDLIB
19682 #ifdef I_STDLIB
19683 #include <stdlib.h>
19684 #endif
19685 int main() {
19686     printf("%d\n", (int)sizeof($sizetype));
19687     exit(0);
19688 }
19689 EOCP
19690 set try
19691 if eval $compile_ok; then
19692         yyy=`$run ./try`
19693         case "$yyy" in
19694         '')     sizesize=4
19695                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19696                 ;;
19697         *)      sizesize=$yyy
19698                 echo "Your $zzz size is $sizesize bytes."
19699                 ;;
19700         esac
19701 else
19702         sizesize=4
19703         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19704 fi
19705
19706
19707 : check for socklen_t
19708 echo " "
19709 echo "Checking to see if you have socklen_t..." >&4
19710 $cat >try.c <<EOCP
19711 #include <sys/types.h>
19712 #$d_socket HAS_SOCKET
19713 #ifdef HAS_SOCKET
19714 #include <sys/socket.h>
19715 #endif
19716 int main() { socklen_t x = 16; }
19717 EOCP
19718 set try
19719 if eval $compile; then
19720         val="$define"
19721         echo "You have socklen_t."
19722 else
19723         val="$undef"
19724         echo "You do not have socklen_t."
19725         case "$sizetype" in
19726         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19727         esac
19728 fi
19729 $rm -f try try.*
19730 set d_socklen_t
19731 eval $setvar
19732
19733 : see if this is a socks.h system
19734 set socks.h i_socks
19735 eval $inhdr
19736
19737 : check for type of the size argument to socket calls
19738 case "$d_socket" in
19739 "$define")
19740         $cat <<EOM
19741
19742 Checking to see what type is the last argument of accept().
19743 EOM
19744         yyy=''
19745         case "$d_socklen_t" in
19746         "$define") yyy="$yyy socklen_t"
19747         esac
19748         yyy="$yyy $sizetype int long unsigned"
19749         for xxx in $yyy; do
19750                 case "$socksizetype" in
19751                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19752                         case "$usesocks" in
19753                         "$define")
19754                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19755                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19756                                         socksizetype="$xxx"
19757                                 fi
19758                                 ;;
19759                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19760                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19761                                         socksizetype="$xxx"
19762                                 fi
19763                                 ;;
19764                         esac
19765                         ;;
19766                 esac
19767         done
19768 : In case none of those worked, prompt the user.
19769         case "$socksizetype" in
19770         '')     rp='What is the type for socket address structure sizes?'
19771                 dflt='int'
19772                 . ./myread
19773                 socksizetype=$ans
19774                 ;;
19775         esac
19776         ;;
19777 *)      : no sockets, so pick relatively harmless default
19778         socksizetype='int'
19779         ;;
19780 esac
19781
19782 : see what type is used for signed size_t
19783 set ssize_t ssizetype int stdio.h sys/types.h
19784 eval $typedef
19785 dflt="$ssizetype"
19786 $cat > try.c <<EOM
19787 #include <stdio.h>
19788 #$i_stdlib I_STDLIB
19789 #ifdef I_STDLIB
19790 #include <stdlib.h>
19791 #endif
19792 #include <sys/types.h>
19793 #define Size_t $sizetype
19794 #define SSize_t $dflt
19795 int main()
19796 {
19797         if (sizeof(Size_t) == sizeof(SSize_t))
19798                 printf("$dflt\n");
19799         else if (sizeof(Size_t) == sizeof(int))
19800                 printf("int\n");
19801         else 
19802                 printf("long\n");
19803         exit(0);
19804 }
19805 EOM
19806 echo " "
19807 set try
19808 if eval $compile_ok && $run ./try > /dev/null; then
19809         ssizetype=`$run ./try`
19810         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19811 else
19812         $cat >&4 <<EOM
19813 Help! I can't compile and run the ssize_t test program: please enlighten me!
19814 (This is probably a misconfiguration in your system or libraries, and
19815 you really ought to fix it.  Still, I'll try anyway.)
19816
19817 I need a type that is the same size as $sizetype, but is guaranteed to
19818 be signed.  Common values are ssize_t, int and long.
19819
19820 EOM
19821         rp="What signed type is the same size as $sizetype?"
19822         . ./myread
19823         ssizetype="$ans"
19824 fi
19825 $rm -f try try.*
19826
19827 : see what type of char stdio uses.
19828 echo " "
19829 echo '#include <stdio.h>' > stdio.c
19830 $cppstdin $cppminus < stdio.c > stdioh
19831 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19832         echo "Your stdio uses unsigned chars." >&4
19833         stdchar="unsigned char"
19834 else
19835         echo "Your stdio uses signed chars." >&4
19836         stdchar="char"
19837 fi
19838 $rm -f stdio.* stdioh
19839
19840 : see what type uids are declared as in the kernel
19841 echo " "
19842 echo "Looking for the type for user ids returned by getuid()."
19843 set uid_t uidtype xxx stdio.h sys/types.h
19844 eval $typedef
19845 case "$uidtype" in
19846 xxx)
19847         xxx=`./findhdr sys/user.h`
19848         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19849         case $1 in
19850         unsigned) dflt="$1 $2" ;;
19851         *) dflt="$1" ;;
19852         esac
19853         ;;
19854 *) dflt="$uidtype";;
19855 esac
19856 case "$uidtype" in
19857 uid_t)  echo "uid_t found." ;;
19858 *)      rp="What is the type for user ids returned by getuid()?"
19859         . ./myread
19860         uidtype="$ans"
19861         ;;
19862 esac
19863
19864 echo " "
19865 case "$uidtype" in
19866 *_t) zzz="$uidtype"     ;;
19867 *)   zzz="uid"          ;;
19868 esac
19869 echo "Checking the size of $zzz..." >&4 
19870 cat > try.c <<EOCP
19871 #include <sys/types.h>
19872 #include <stdio.h>
19873 #$i_stdlib I_STDLIB
19874 #ifdef I_STDLIB
19875 #include <stdlib.h>
19876 #endif
19877 int main() {
19878     printf("%d\n", (int)sizeof($uidtype));
19879     exit(0);
19880 }
19881 EOCP
19882 set try
19883 if eval $compile_ok; then
19884         yyy=`$run ./try`
19885         case "$yyy" in
19886         '')     uidsize=4
19887                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19888                 ;;
19889         *)      uidsize=$yyy
19890                 echo "Your $zzz is $uidsize bytes long."
19891                 ;;
19892         esac
19893 else
19894         uidsize=4
19895         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19896 fi
19897
19898 echo " "
19899 case "$uidtype" in
19900 *_t) zzz="$uidtype"     ;;
19901 *)   zzz="uid"          ;;
19902 esac
19903 echo "Checking the sign of $zzz..." >&4
19904 cat > try.c <<EOCP
19905 #include <sys/types.h>
19906 #include <stdio.h>
19907 int main() {
19908         $uidtype foo = -1;
19909         if (foo < 0)
19910                 printf("-1\n");
19911         else
19912                 printf("1\n");
19913 }
19914 EOCP
19915 set try
19916 if eval $compile; then
19917         yyy=`$run ./try`
19918         case "$yyy" in
19919         '')     uidsign=1
19920                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19921                 ;;
19922         *)      uidsign=$yyy
19923                 case "$uidsign" in
19924                  1) echo "Your $zzz is unsigned." ;;
19925                 -1) echo "Your $zzz is signed."   ;;
19926                 esac
19927                 ;;
19928         esac
19929 else
19930         uidsign=1
19931         echo "(I can't compile the test program--guessing unsigned.)" >&4
19932 fi
19933
19934
19935
19936 echo " "
19937 $echo "Checking the format string to be used for uids..." >&4
19938
19939 case "$uidsign" in
19940 -1)     if $test X"$uidsize" = X"$ivsize"; then
19941                 uidformat="$ivdformat"
19942         else
19943                 if $test X"$uidsize" = X"$longsize"; then
19944                         uidformat='"ld"'
19945                 else
19946                         if $test X"$uidsize" = X"$intsize"; then
19947                                 uidformat='"d"'
19948                         else
19949                                 if $test X"$uidsize" = X"$shortsize"; then
19950                                         uidformat='"hd"'
19951                                 fi
19952                         fi
19953                 fi
19954         fi
19955         ;;
19956 *)      if $test X"$uidsize" = X"$uvsize"; then
19957                 uidformat="$uvuformat"
19958         else
19959                 if $test X"$uidsize" = X"$longsize"; then
19960                         uidformat='"lu"'
19961                 else
19962                         if $test X"$uidsize" = X"$intsize"; then
19963                                 uidformat='"u"'
19964                         else
19965                                 if $test X"$uidsize" = X"$shortsize"; then
19966                                         uidformat='"hu"'
19967                                 fi
19968                         fi
19969                 fi
19970         fi
19971         ;;
19972 esac
19973
19974
19975 case "$usesitecustomize" in
19976     $define|true|[Yy]*)
19977         usesitecustomize="$define"
19978         ;;
19979     *)
19980         usesitecustomize="$undef"
19981         ;;
19982     esac
19983
19984 : determine compiler compiler
19985 case "$yacc" in
19986 '')
19987         dflt=yacc;;
19988 *)
19989         dflt="$yacc";;
19990 esac
19991 echo " "
19992 comp='yacc'
19993 if $test -f "$byacc$_exe"; then
19994         dflt="$byacc"
19995         comp="byacc or $comp"
19996 fi
19997 if $test -f "$bison$_exe"; then
19998         comp="$comp or bison -y"
19999 fi
20000 rp="Which compiler compiler ($comp) shall I use?"
20001 . ./myread
20002 yacc="$ans"
20003 case "$yacc" in
20004 *bis*)
20005         case "$yacc" in
20006         *-y*) ;;
20007         *)
20008                 yacc="$yacc -y"
20009                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20010                 ;;
20011         esac
20012         ;;
20013 esac
20014
20015 : see if this is a fp.h system
20016 set fp.h i_fp
20017 eval $inhdr
20018
20019 : see if this is a fp_class.h system
20020 set fp_class.h i_fp_class
20021 eval $inhdr
20022
20023 : see if this is a ieeefp.h system
20024 case "$i_ieeefp" in
20025 '' ) set ieeefp.h i_ieeefp
20026      eval $inhdr
20027      ;;
20028 esac
20029
20030 : see if this is a libutil.h system
20031 set libutil.h i_libutil
20032 eval $inhdr
20033
20034 : see if mach cthreads are available
20035 if test "X$usethreads" = "X$define"; then
20036         set mach/cthreads.h i_machcthr
20037         eval $inhdr
20038 else
20039         i_machcthr="$undef"
20040 fi
20041
20042
20043
20044 : see if this is a mntent.h system
20045 set mntent.h i_mntent
20046 eval $inhdr
20047
20048 : see if ndbm.h is available
20049 set ndbm.h t_ndbm
20050 eval $inhdr
20051
20052 case "$t_ndbm" in
20053 $undef)
20054     # Some Linux distributions such as RedHat 7.1 put the
20055     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20056     if $test -f /usr/include/gdbm/ndbm.h; then
20057         echo '<gdbm/ndbm.h> found.'
20058         ccflags="$ccflags -I/usr/include/gdbm"
20059         cppflags="$cppflags -I/usr/include/gdbm"
20060         t_ndbm=$define
20061     fi
20062     ;;
20063 esac
20064
20065 case "$t_ndbm" in
20066 $define)
20067         : see if dbm_open exists
20068         set dbm_open d_dbm_open
20069         eval $inlibc
20070         case "$d_dbm_open" in
20071         $undef)
20072                 t_ndbm="$undef"
20073                 echo "We won't be including <ndbm.h>"
20074                 ;;
20075         esac
20076         ;;
20077 esac
20078 val="$t_ndbm"
20079 set i_ndbm
20080 eval $setvar
20081
20082 : see if net/errno.h is available
20083 val=''
20084 set net/errno.h val
20085 eval $inhdr
20086
20087 : Unfortunately, it causes problems on some systems.  Arrgh.
20088 case "$val" in
20089 $define)
20090         cat > try.c <<'EOM'
20091 #include <stdio.h>
20092 #include <errno.h>
20093 #include <net/errno.h>
20094 int func()
20095 {
20096         return ENOTSOCK;
20097 }
20098 EOM
20099         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20100                 echo "We'll be including <net/errno.h>." >&4
20101         else
20102                 echo "We won't be including <net/errno.h>." >&4
20103                 val="$undef"
20104         fi
20105         $rm -f try.* try
20106         ;;
20107 esac
20108 set i_neterrno
20109 eval $setvar
20110
20111 : see if netinet/tcp.h is available
20112 set netinet/tcp.h i_netinettcp
20113 eval $inhdr
20114
20115 : see if this is a poll.h system
20116 set poll.h i_poll
20117 eval $inhdr
20118
20119 : see if this is a prot.h system
20120 set prot.h i_prot
20121 eval $inhdr
20122
20123 echo " "
20124 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
20125 $cat <<'EOSH' > Cppsym.know
20126 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20127 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20128 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20129 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20130 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20131 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20132 bull c cadmus clipper CMU COFF COMPILER_VERSION
20133 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20134 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20135 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20136 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20137 GLIBC GLIBC_MINOR
20138 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20139 H3050R H3050RX hbullx20 hcx host_mips
20140 hp200 hp300 hp700 HP700 hp800 hp9000
20141 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20142 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20143 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20144 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20145 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20146 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20147 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20148 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20149 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20150 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20151 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20152 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20153 MATH_HAS_NO_SIDE_EFFECTS
20154 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20155 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20156 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20157 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20158 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20159 NetBSD news1500 news1700 news1800 news1900 news3700
20160 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20161 ns32016 ns32332 ns32k nsc32000
20162 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20163 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20164 pc532 pdp11 PGC PIC plexus PORTAR posix
20165 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20166 POSIX_C_SOURCE POSIX_SOURCE POWER
20167 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20168 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20169 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20170 sony sony_news sonyrisc sparc sparclite spectrum
20171 stardent stdc STDC_EXT stratos sun sun3 sun386
20172 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20173 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20174 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20175 sysV68 sysV88 Tek4132 Tek4300 titan
20176 TM3200 TM5400 TM5600
20177 tower tower32 tower32_200 tower32_600 tower32_700
20178 tower32_800 tower32_850 tss
20179 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20180 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20181 unix UNIX95 UNIX99 unixpc unos
20182 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20183 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20184 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20185 USGr4 USGr4_2
20186 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20187 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20188 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20189 z8000
20190 EOSH
20191 # Maybe put other stuff here too.
20192 cat <<EOSH >>Cppsym.know
20193 $osname
20194 EOSH
20195 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20196 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20197 $cat Cppsym.know > Cppsym.c
20198 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20199 $rm -f Cppsym.a Cppsym.b Cppsym.c
20200 cat <<EOSH > Cppsym
20201 $startsh
20202 if $test \$# -gt 0; then
20203     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20204     if $test -s Cppsym.got; then
20205         $rm -f Cppsym.got
20206         exit 0
20207     fi
20208     $rm -f Cppsym.got
20209     exit 1
20210 else
20211     $tr " " "$trnl" | ./Cppsym.try
20212     exit 0
20213 fi
20214 EOSH
20215 chmod +x Cppsym
20216 $eunicefix Cppsym
20217 cat <<EOSH > Cppsym.try
20218 $startsh
20219 cat <<'EOCP' > try.c
20220 #include <stdio.h>
20221 #if cpp_stuff == 1
20222 #define STRINGIFY(a)    "a"
20223 #endif
20224 #if cpp_stuff == 42
20225 #define StGiFy(a)  #a
20226 #define STRINGIFY(a)    StGiFy(a)
20227 #endif
20228 #if $cpp_stuff != 1 && $cpp_stuff != 42
20229 #   include "Bletch: How does this C preprocessor stringify macros?"
20230 #endif
20231 int main() {
20232 EOCP
20233 $awk \\
20234 EOSH
20235 cat <<'EOSH' >> Cppsym.try
20236 'length($1) > 0 {
20237     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20238     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20239     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20240     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20241 }'       >> try.c
20242 echo 'return 0;}' >> try.c
20243 EOSH
20244 cat <<EOSH >> Cppsym.try
20245 ccflags="$ccflags"
20246 case "$osname-$gccversion" in
20247 irix-) ccflags="\$ccflags -woff 1178" ;;
20248 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20249 esac
20250 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20251 EOSH
20252 chmod +x Cppsym.try
20253 $eunicefix Cppsym.try
20254 ./Cppsym < Cppsym.know > Cppsym.true
20255 : now check the C compiler for additional symbols
20256 postprocess_cc_v=''
20257 case "$osname" in
20258 aix) postprocess_cc_v="|$tr , ' '" ;;
20259 esac
20260 $cat >ccsym <<EOS
20261 $startsh
20262 $cat >tmp.c <<EOF
20263 extern int foo;
20264 EOF
20265 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20266 do
20267         case "\$i" in
20268         -D*) echo "\$i" | $sed 's/^-D//';;
20269         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20270         esac
20271 done
20272 $rm -f try.c
20273 EOS
20274 postprocess_cc_v=''
20275 chmod +x ccsym
20276 $eunicefix ccsym
20277 ./ccsym > ccsym1.raw
20278 if $test -s ccsym1.raw; then
20279        $sort ccsym1.raw | $uniq >ccsym.raw
20280 else
20281        mv ccsym1.raw ccsym.raw
20282 fi
20283
20284 $awk '/\=/ { print $0; next }
20285         { print $0"=1" }' ccsym.raw >ccsym.list
20286 $comm -13 Cppsym.true ccsym.list >ccsym.own
20287 $comm -12 Cppsym.true ccsym.list >ccsym.com
20288 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20289 also=''
20290 if $test -z ccsym.raw; then
20291         echo "Your C compiler doesn't seem to define any symbols!" >&4
20292         echo " "
20293         echo "However, your C preprocessor defines the following symbols:"
20294         $cat Cppsym.true
20295         ccsymbols=''
20296         cppsymbols=`$cat Cppsym.true`
20297         cppsymbols=`echo $cppsymbols`
20298         cppccsymbols="$cppsymbols"
20299 else
20300         if $test -s ccsym.com; then
20301                 echo "Your C compiler and pre-processor define these symbols:"
20302                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20303                 also='also '
20304                 symbols='ones'
20305                 cppccsymbols=`$cat ccsym.com`
20306                 cppccsymbols=`echo $cppccsymbols`
20307                 $test "$silent" || sleep 1
20308         fi
20309         if $test -s ccsym.cpp; then
20310                 $test "$also" && echo " "
20311                 echo "Your C pre-processor ${also}defines the following symbols:"
20312                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20313                 also='further '
20314                 cppsymbols=`$cat ccsym.cpp`
20315                 cppsymbols=`echo $cppsymbols`
20316                 $test "$silent" || sleep 1
20317         fi
20318         if $test -s ccsym.own; then
20319                 $test "$also" && echo " "
20320                 echo "Your C compiler ${also}defines the following cpp symbols:"
20321                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20322                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20323                 ccsymbols=`$cat ccsym.own`
20324                 ccsymbols=`echo $ccsymbols`
20325                 $test "$silent" || sleep 1
20326         fi
20327 fi
20328
20329 : see if this is a termio system
20330 val="$undef"
20331 val2="$undef"
20332 val3="$undef"
20333 if $test `./findhdr termios.h`; then
20334         set tcsetattr i_termios
20335         eval $inlibc
20336         val3="$i_termios"
20337 fi
20338 echo " "
20339 case "$val3" in
20340 "$define") echo "You have POSIX termios.h... good!" >&4;;
20341 *) if ./Cppsym pyr; then
20342                 case "`/bin/universe`" in
20343                 ucb) if $test `./findhdr sgtty.h`; then
20344                                 val2="$define"
20345                                 echo "<sgtty.h> found." >&4
20346                         else
20347                                 echo "System is pyramid with BSD universe."
20348                                 echo "<sgtty.h> not found--you could have problems." >&4
20349                         fi;;
20350                 *) if $test `./findhdr termio.h`; then
20351                                 val="$define"
20352                                 echo "<termio.h> found." >&4
20353                         else
20354                                 echo "System is pyramid with USG universe."
20355                                 echo "<termio.h> not found--you could have problems." >&4
20356                         fi;;
20357                 esac
20358         elif ./usg; then
20359                 if $test `./findhdr termio.h`; then
20360                         echo "<termio.h> found." >&4
20361                         val="$define"
20362                 elif $test `./findhdr sgtty.h`; then
20363                         echo "<sgtty.h> found." >&4
20364                         val2="$define"
20365                 else
20366 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20367                 fi
20368         else
20369                 if $test `./findhdr sgtty.h`; then
20370                         echo "<sgtty.h> found." >&4
20371                         val2="$define"
20372                 elif $test `./findhdr termio.h`; then
20373                         echo "<termio.h> found." >&4
20374                         val="$define"
20375                 else
20376 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20377                 fi
20378         fi;;
20379 esac
20380 set i_termio; eval $setvar
20381 val=$val2; set i_sgtty; eval $setvar
20382 val=$val3; set i_termios; eval $setvar
20383
20384 : see if stddef is available
20385 set stddef.h i_stddef
20386 eval $inhdr
20387
20388 : see if this is a sunmath.h system
20389 set sunmath.h i_sunmath
20390 eval $inhdr
20391
20392 : see if sys/access.h is available
20393 set sys/access.h i_sysaccess
20394 eval $inhdr
20395
20396 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20397 set sys/filio.h i_sysfilio
20398 eval $inhdr
20399 echo " "
20400 if $test `./findhdr sys/ioctl.h`; then
20401         val="$define"
20402         echo '<sys/ioctl.h> found.' >&4
20403 else
20404         val="$undef"
20405         if $test $i_sysfilio = "$define"; then
20406             echo '<sys/ioctl.h> NOT found.' >&4
20407         else
20408                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20409                 $test $i_termio = "$define" && xxx="termio.h"
20410                 $test $i_termios = "$define" && xxx="termios.h"
20411 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20412         fi
20413 fi
20414 set i_sysioctl
20415 eval $setvar
20416
20417 : see if socket ioctl defs are in sys/sockio.h
20418 echo " "
20419 xxx=`./findhdr sys/sockio.h`
20420 if $test "$xxx"; then
20421         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20422                 val="$define"
20423                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20424         else
20425                 val="$undef"
20426                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20427         fi
20428 else
20429         val="$undef"
20430         $cat <<EOM
20431 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20432 EOM
20433 fi
20434 set i_syssockio
20435 eval $setvar
20436
20437
20438 : see if this is a syslog.h system
20439 set syslog.h i_syslog
20440 eval $inhdr
20441
20442
20443 : see if this is a sys/mode.h system
20444 set sys/mode.h i_sysmode
20445 eval $inhdr
20446
20447 : see if sys/resource.h has to be included
20448 set sys/resource.h i_sysresrc
20449 eval $inhdr
20450
20451 : see if sys/security.h is available
20452 set sys/security.h i_syssecrt
20453 eval $inhdr
20454
20455 : see if this is a sys/statvfs.h system
20456 set sys/statvfs.h i_sysstatvfs
20457 eval $inhdr
20458
20459 : see if this is a sys/un.h system
20460 set sys/un.h i_sysun
20461 eval $inhdr
20462
20463
20464 : see if this is a sys/utsname.h system
20465 set sys/utsname.h i_sysutsname
20466 eval $inhdr
20467
20468 : see if this is a syswait system
20469 set sys/wait.h i_syswait
20470 eval $inhdr
20471
20472 : see if this is a ustat.h system
20473 set ustat.h i_ustat
20474 eval $inhdr
20475
20476 : see if this is an utime system
20477 set utime.h i_utime
20478 eval $inhdr
20479
20480 : see if this is a values.h system
20481 set values.h i_values
20482 eval $inhdr
20483
20484 : see if this is a vfork system
20485 case "$d_vfork" in
20486 "$define")
20487         set vfork.h i_vfork
20488         eval $inhdr
20489         ;;
20490 *)
20491         i_vfork="$undef"
20492         ;;
20493 esac
20494
20495 : see if gdbm.h is available
20496 set gdbm.h t_gdbm
20497 eval $inhdr
20498 case "$t_gdbm" in
20499 $define)
20500         : see if gdbm_open exists
20501         set gdbm_open d_gdbm_open
20502         eval $inlibc
20503         case "$d_gdbm_open" in
20504         $undef)
20505                 t_gdbm="$undef"
20506                 echo "We won't be including <gdbm.h>"
20507                 ;;
20508         esac
20509         ;;
20510 esac
20511 val="$t_gdbm"
20512 set i_gdbm
20513 eval $setvar
20514
20515 echo " "
20516 echo "Looking for extensions..." >&4
20517 : If we are using the old config.sh, known_extensions may contain
20518 : old or inaccurate or duplicate values.
20519 known_extensions=''
20520 nonxs_extensions=''
20521 : We do not use find because it might not be available.
20522 : We do not just use MANIFEST because the user may have dropped
20523 : some additional extensions into the source tree and expect them
20524 : to be built.
20525
20526 : Function to recursively find available extensions, ignoring DynaLoader
20527 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20528 find_extensions='
20529     for xxx in *; do
20530        case "$xxx" in
20531            DynaLoader|dynaload) ;;
20532            *)
20533            if $test -f $xxx/$xxx.xs; then
20534                known_extensions="$known_extensions $1$xxx";
20535            elif $test -f $xxx/Makefile.PL; then
20536                nonxs_extensions="$nonxs_extensions $1$xxx";
20537            else
20538                if $test -d $xxx -a $# -lt 10; then
20539                    set $1$xxx/ $*;
20540                    cd "$xxx";
20541                    eval $find_extensions;
20542                    cd ..;
20543                    shift;
20544                fi;
20545            fi
20546            ;;
20547        esac;
20548     done'
20549 tdir=`pwd`
20550 cd "$rsrc/ext"
20551 set X
20552 shift
20553 eval $find_extensions
20554 # Special case:  Add in threads/shared since it is not picked up by the
20555 # recursive find above (and adding in general recursive finding breaks
20556 # SDBM_File/sdbm).  A.D.  10/25/2001.
20557 known_extensions="$known_extensions threads/shared"
20558 set X $nonxs_extensions
20559 shift
20560 nonxs_extensions="$*"
20561 set X $known_extensions
20562 shift
20563 known_extensions="$*"
20564 cd "$tdir"
20565
20566 : Now see which are supported on this system.
20567 avail_ext=''
20568 for xxx in $known_extensions ; do
20569         case "$xxx" in
20570         DB_File|db_file)
20571                 case "$i_db" in
20572                 $define) avail_ext="$avail_ext $xxx" ;;
20573                 esac
20574                 ;;
20575         GDBM_File|gdbm_fil)
20576                 case "$i_gdbm" in 
20577                 $define) avail_ext="$avail_ext $xxx" ;;
20578                 esac
20579                 ;;
20580         I18N/Langinfo|i18n_lan)
20581                 case "$i_langinfo$d_nl_langinfo" in 
20582                 $define$define) avail_ext="$avail_ext $xxx" ;;
20583                 esac
20584                 ;;
20585         NDBM_File|ndbm_fil)
20586                 case "$i_ndbm" in
20587                 $define)
20588                     case "$osname-$use64bitint" in
20589                     hpux-define)
20590                         case "$libs" in
20591                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20592                         esac
20593                         ;;
20594                     *) avail_ext="$avail_ext $xxx" ;;
20595                     esac
20596                     ;;
20597                 esac
20598                 ;;
20599         ODBM_File|odbm_fil) 
20600                 case "${i_dbm}${i_rpcsvcdbm}" in
20601                 *"${define}"*)
20602                     case "$osname-$use64bitint" in
20603                     hpux-define)
20604                         case "$libs" in
20605                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20606                         esac
20607                         ;;
20608                     *) avail_ext="$avail_ext $xxx" ;;
20609                     esac
20610                     ;;
20611                 esac
20612                 ;;
20613         POSIX|posix)
20614                 case "$useposix" in
20615                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20616                 esac
20617                 ;;
20618         Opcode|opcode)
20619                 case "$useopcode" in
20620                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20621                 esac
20622                 ;;
20623         Socket|socket)
20624                 case "$d_socket" in 
20625                 true|$define|y)
20626                     case "$osname" in
20627                     beos) ;; # not unless BONE
20628                     *) avail_ext="$avail_ext $xxx" ;;
20629                     esac
20630                     ;;
20631                 esac
20632                 ;;
20633         Sys/Syslog|sys/syslog)
20634                 : XXX syslog requires socket
20635                 case "$d_socket" in 
20636                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20637                 esac
20638                 ;;
20639         Thread|thread)
20640                 case "$usethreads" in
20641                 true|$define|y)
20642                         case "$useithreads" in
20643                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20644                         esac
20645                 esac
20646                 ;;
20647         XS/APItest|xs/apitest)
20648                 # This is just for testing.  Skip it unless we have dynamic loading.
20649
20650                 case "$usedl" in
20651                 $define) avail_ext="$avail_ext $xxx" ;;
20652                 esac
20653                 ;;
20654         XS/Typemap|xs/typemap)
20655                 # This is just for testing.  Skip it unless we have dynamic loading.
20656                 case "$usedl" in
20657                 $define) avail_ext="$avail_ext $xxx" ;;
20658                 esac
20659                 ;;
20660         threads|threads/shared)
20661                 # threads and threads::shared are special cases.
20662                 # To stop people from asking "Perl 5.8.0 was supposed
20663                 # to have this new fancy threads implementation but my
20664                 # perl doesn't have it" and from people trying to
20665                 # (re)install the threads module using CPAN.pm and
20666                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20667                 # the threads.pm and threads/shared.pm will always be
20668                 # there, croaking informatively ("you need to rebuild
20669                 # all of Perl with threads, sorry") when threads haven't
20670                 # been compiled in.
20671                 # --jhi
20672                 avail_ext="$avail_ext $xxx"
20673                 ;;
20674         IPC/SysV|ipc/sysv)
20675                 : XXX Do we need a useipcsysv variable here
20676                 case "${d_msg}${d_sem}${d_shm}" in 
20677                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20678                 esac
20679                 ;;
20680         *)      avail_ext="$avail_ext $xxx"
20681                 ;;
20682         esac
20683 done
20684
20685 set X $avail_ext
20686 shift
20687 avail_ext="$*"
20688
20689 case "$onlyextensions" in
20690 '') ;;
20691 *)  keepextensions=''
20692     echo "You have requested that only certains extensions be included..." >&4
20693     for i in $onlyextensions; do
20694         case " $avail_ext " in
20695         *" $i "*)
20696             echo "Keeping extension $i."
20697             keepextensions="$keepextensions $i"
20698             ;;
20699         *) echo "Ignoring extension $i." ;;
20700         esac
20701     done
20702     avail_ext="$keepextensions"
20703     ;;
20704 esac
20705
20706 case "$noextensions" in
20707 '') ;;
20708 *)  keepextensions=''
20709     echo "You have requested that certain extensions be ignored..." >&4
20710     for i in $avail_ext; do
20711         case " $noextensions " in
20712         *" $i "*) echo "Ignoring extension $i." ;;
20713         *) echo "Keeping extension $i.";
20714            keepextensions="$keepextensions $i"
20715            ;;
20716         esac
20717     done
20718     avail_ext="$keepextensions"
20719     ;;
20720 esac
20721
20722 : Now see which nonxs extensions are supported on this system.
20723 : For now assume all are.
20724 nonxs_ext=''
20725 for xxx in $nonxs_extensions ; do
20726         case "$xxx" in
20727         *)      nonxs_ext="$nonxs_ext $xxx"
20728                 ;;
20729         esac
20730 done
20731
20732 set X $nonxs_ext
20733 shift
20734 nonxs_ext="$*"
20735
20736 case $usedl in
20737 $define)
20738         $cat <<EOM
20739 A number of extensions are supplied with $package.  You may choose to
20740 compile these extensions for dynamic loading (the default), compile
20741 them into the $package executable (static loading), or not include
20742 them at all.  Answer "none" to include no extensions.
20743 Note that DynaLoader is always built and need not be mentioned here.
20744
20745 EOM
20746         case "$dynamic_ext" in
20747         '')
20748                 : Exclude those listed in static_ext
20749                 dflt=''
20750                 for xxx in $avail_ext; do
20751                         case " $static_ext " in
20752                         *" $xxx "*) ;;
20753                         *) dflt="$dflt $xxx" ;;
20754                         esac
20755                 done
20756                 set X $dflt
20757                 shift
20758                 dflt="$*"
20759                 ;;
20760         *)      dflt="$dynamic_ext"
20761                 # Perhaps we are reusing an old out-of-date config.sh.
20762                 case "$hint" in
20763                 previous)
20764                         if test X"$dynamic_ext" != X"$avail_ext"; then
20765                                 $cat <<EOM
20766 NOTICE:  Your previous config.sh list may be incorrect. 
20767 The extensions now available to you are 
20768         ${avail_ext}
20769 but the default list from your previous config.sh is
20770         ${dynamic_ext} 
20771
20772 EOM
20773                         fi
20774                         ;;
20775                 esac
20776                 ;;
20777         esac
20778         case "$dflt" in
20779         '')     dflt=none;;
20780         esac
20781         rp="What extensions do you wish to load dynamically?"
20782         . ./myread
20783         case "$ans" in
20784         none) dynamic_ext=' ' ;;
20785         *) dynamic_ext="$ans" ;;
20786         esac
20787
20788         case "$static_ext" in
20789         '')
20790                 : Exclude those already listed in dynamic linking
20791                 dflt=''
20792                 for xxx in $avail_ext; do
20793                         case " $dynamic_ext " in
20794                         *" $xxx "*) ;;
20795                         *) dflt="$dflt $xxx" ;;
20796                         esac
20797                 done
20798                 set X $dflt
20799                 shift
20800                 dflt="$*"
20801                 ;;
20802         *)  dflt="$static_ext" 
20803                 ;;
20804         esac
20805
20806         case "$dflt" in
20807         '')     dflt=none;;
20808         esac
20809         rp="What extensions do you wish to load statically?"
20810         . ./myread
20811         case "$ans" in
20812         none) static_ext=' ' ;;
20813         *) static_ext="$ans" ;;
20814         esac
20815         ;;
20816 *)
20817         $cat <<EOM
20818 A number of extensions are supplied with $package.  Answer "none" 
20819 to include no extensions. 
20820 Note that DynaLoader is always built and need not be mentioned here.
20821
20822 EOM
20823         case "$static_ext" in
20824         '') dflt="$avail_ext" ;;
20825         *)      dflt="$static_ext"
20826                 # Perhaps we are reusing an old out-of-date config.sh.
20827                 case "$hint" in
20828                 previous)
20829                         if test X"$static_ext" != X"$avail_ext"; then
20830                                 $cat <<EOM
20831 NOTICE:  Your previous config.sh list may be incorrect. 
20832 The extensions now available to you are 
20833         ${avail_ext}
20834 but the default list from your previous config.sh is
20835         ${static_ext} 
20836
20837 EOM
20838                         fi
20839                         ;;
20840                 esac
20841                 ;;
20842         esac
20843         : Exclude those that are not xs extensions
20844         case "$dflt" in
20845         '')     dflt=none;;
20846         esac
20847         rp="What extensions do you wish to include?"
20848         . ./myread
20849         case "$ans" in
20850         none) static_ext=' ' ;;
20851         *) static_ext="$ans" ;;
20852         esac
20853         ;;
20854 esac
20855 #        
20856 # Encode is a special case.  If we are building Encode as a static
20857 # extension, we need to explicitly list its subextensions as well.
20858 # For other nested extensions, this is handled automatically by
20859 # the appropriate Makefile.PL.
20860 case " $static_ext " in
20861         *" Encode "*) # Add the subextensions of Encode
20862         cd "$rsrc/ext"
20863         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20864                 static_ext="$static_ext Encode/$xxx"
20865         done
20866         cd "$tdir"
20867         ;;
20868 esac
20869
20870 set X $dynamic_ext $static_ext $nonxs_ext
20871 shift
20872 extensions="$*"
20873
20874 # Sanity check:  We require an extension suitable for use with
20875 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20876 # should show up as failures in the test suite, but it's helpful to
20877 # catch them now.) The 'extensions' list is normally sorted
20878 # alphabetically, so we need to accept either
20879 #    DB_File ... Fcntl ... IO  ....
20880 # or something like
20881 #    Fcntl ... NDBM_File ... IO  ....
20882 case " $extensions"  in
20883 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20884 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20885 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20886 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20887    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20888    ;;
20889 esac
20890
20891 : Remove libraries needed only for extensions
20892 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20893 : The exception is SunOS 4.x, which needs them.
20894 case "${osname}X${osvers}" in
20895 sunos*X4*)
20896     perllibs="$libs"
20897     ;;
20898 *) case "$usedl" in
20899     $define|true|[yY]*)
20900             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20901             shift
20902             perllibs="$*"
20903             ;;
20904     *)  perllibs="$libs"
20905             ;;
20906     esac
20907     ;;
20908 esac
20909
20910 : Remove build directory name from cppstdin so it can be used from
20911 : either the present location or the final installed location.
20912 echo " "
20913 : Get out of the UU directory to get correct path name.
20914 cd ..
20915 case "$cppstdin" in
20916 `pwd`/cppstdin)
20917         echo "Stripping down cppstdin path name"
20918         cppstdin=cppstdin
20919         ;;
20920 esac
20921 cd UU
20922
20923 : end of configuration questions
20924 echo " "
20925 echo "End of configuration questions."
20926 echo " "
20927
20928 : back to where it started
20929 if test -d ../UU; then
20930         cd ..
20931 fi
20932
20933 : configuration may be patched via a 'config.arch' file
20934 if $test -f config.arch; then
20935         echo "I see a config.arch file, loading it."
20936         . ./config.arch
20937 fi
20938
20939 : configuration may be patched via a 'config.over' file
20940 if $test -f config.over; then
20941         echo " "
20942         dflt=y
20943         rp='I see a config.over file.  Do you wish to load it?'
20944         . UU/myread
20945         case "$ans" in
20946         n*) echo "OK, I'll ignore it.";;
20947         *)      . ./config.over
20948                 echo "Configuration override changes have been loaded."
20949                 ;;
20950         esac
20951 fi
20952
20953 : in case they want portability, strip down executable paths
20954 case "$d_portable" in
20955 "$define")
20956         echo " "
20957         echo "Stripping down executable paths..." >&4
20958         for file in $loclist $trylist; do
20959                 eval temp=\$$file
20960                 eval $file=`basename $temp`
20961         done
20962         ;;
20963 esac
20964
20965 : create config.sh file
20966 echo " "
20967 echo "Creating config.sh..." >&4
20968 $spitshell <<EOT >config.sh
20969 $startsh
20970 #
20971 # This file was produced by running the Configure script. It holds all the
20972 # definitions figured out by Configure. Should you modify one of these values,
20973 # do not forget to propagate your changes by running "Configure -der". You may
20974 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20975 #
20976
20977 # Package name      : $package
20978 # Source directory  : $src
20979 # Configuration time: $cf_time
20980 # Configured by     : $cf_by
20981 # Target system     : $myuname
20982
20983 Author='$Author'
20984 Date='$Date'
20985 Header='$Header'
20986 Id='$Id'
20987 Locker='$Locker'
20988 Log='$Log'
20989 Mcc='$Mcc'
20990 RCSfile='$RCSfile'
20991 Revision='$Revision'
20992 Source='$Source'
20993 State='$State'
20994 _a='$_a'
20995 _exe='$_exe'
20996 _o='$_o'
20997 afs='$afs'
20998 afsroot='$afsroot'
20999 alignbytes='$alignbytes'
21000 ansi2knr='$ansi2knr'
21001 aphostname='$aphostname'
21002 api_revision='$api_revision'
21003 api_subversion='$api_subversion'
21004 api_version='$api_version'
21005 api_versionstring='$api_versionstring'
21006 ar='$ar'
21007 archlib='$archlib'
21008 archlibexp='$archlibexp'
21009 archname64='$archname64'
21010 archname='$archname'
21011 archobjs='$archobjs'
21012 asctime_r_proto='$asctime_r_proto'
21013 awk='$awk'
21014 baserev='$baserev'
21015 bash='$bash'
21016 bin='$bin'
21017 binexp='$binexp'
21018 bison='$bison'
21019 byacc='$byacc'
21020 byteorder='$byteorder'
21021 c='$c'
21022 castflags='$castflags'
21023 cat='$cat'
21024 cc='$cc'
21025 cccdlflags='$cccdlflags'
21026 ccdlflags='$ccdlflags'
21027 ccflags='$ccflags'
21028 ccflags_uselargefiles='$ccflags_uselargefiles'
21029 ccname='$ccname'
21030 ccsymbols='$ccsymbols'
21031 ccversion='$ccversion'
21032 cf_by='$cf_by'
21033 cf_email='$cf_email'
21034 cf_time='$cf_time'
21035 charsize='$charsize'
21036 chgrp='$chgrp'
21037 chmod='$chmod'
21038 chown='$chown'
21039 clocktype='$clocktype'
21040 comm='$comm'
21041 compress='$compress'
21042 contains='$contains'
21043 cp='$cp'
21044 cpio='$cpio'
21045 cpp='$cpp'
21046 cpp_stuff='$cpp_stuff'
21047 cppccsymbols='$cppccsymbols'
21048 cppflags='$cppflags'
21049 cpplast='$cpplast'
21050 cppminus='$cppminus'
21051 cpprun='$cpprun'
21052 cppstdin='$cppstdin'
21053 cppsymbols='$cppsymbols'
21054 crypt_r_proto='$crypt_r_proto'
21055 cryptlib='$cryptlib'
21056 csh='$csh'
21057 ctermid_r_proto='$ctermid_r_proto'
21058 ctime_r_proto='$ctime_r_proto'
21059 d_Gconvert='$d_Gconvert'
21060 d_PRIEUldbl='$d_PRIEUldbl'
21061 d_PRIFUldbl='$d_PRIFUldbl'
21062 d_PRIGUldbl='$d_PRIGUldbl'
21063 d_PRIXU64='$d_PRIXU64'
21064 d_PRId64='$d_PRId64'
21065 d_PRIeldbl='$d_PRIeldbl'
21066 d_PRIfldbl='$d_PRIfldbl'
21067 d_PRIgldbl='$d_PRIgldbl'
21068 d_PRIi64='$d_PRIi64'
21069 d_PRIo64='$d_PRIo64'
21070 d_PRIu64='$d_PRIu64'
21071 d_PRIx64='$d_PRIx64'
21072 d_SCNfldbl='$d_SCNfldbl'
21073 d__fwalk='$d__fwalk'
21074 d_access='$d_access'
21075 d_accessx='$d_accessx'
21076 d_aintl='$d_aintl'
21077 d_alarm='$d_alarm'
21078 d_archlib='$d_archlib'
21079 d_asctime_r='$d_asctime_r'
21080 d_atolf='$d_atolf'
21081 d_atoll='$d_atoll'
21082 d_attribute_format='$d_attribute_format'
21083 d_attribute_malloc='$d_attribute_malloc'
21084 d_attribute_nonnull='$d_attribute_nonnull'
21085 d_attribute_noreturn='$d_attribute_noreturn'
21086 d_attribute_pure='$d_attribute_pure'
21087 d_attribute_unused='$d_attribute_unused'
21088 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21089 d_bcmp='$d_bcmp'
21090 d_bcopy='$d_bcopy'
21091 d_bsd='$d_bsd'
21092 d_bsdgetpgrp='$d_bsdgetpgrp'
21093 d_bsdsetpgrp='$d_bsdsetpgrp'
21094 d_bzero='$d_bzero'
21095 d_casti32='$d_casti32'
21096 d_castneg='$d_castneg'
21097 d_charvspr='$d_charvspr'
21098 d_chown='$d_chown'
21099 d_chroot='$d_chroot'
21100 d_chsize='$d_chsize'
21101 d_class='$d_class'
21102 d_clearenv='$d_clearenv'
21103 d_closedir='$d_closedir'
21104 d_cmsghdr_s='$d_cmsghdr_s'
21105 d_const='$d_const'
21106 d_copysignl='$d_copysignl'
21107 d_crypt='$d_crypt'
21108 d_crypt_r='$d_crypt_r'
21109 d_csh='$d_csh'
21110 d_ctermid_r='$d_ctermid_r'
21111 d_ctime_r='$d_ctime_r'
21112 d_cuserid='$d_cuserid'
21113 d_dbl_dig='$d_dbl_dig'
21114 d_dbminitproto='$d_dbminitproto'
21115 d_difftime='$d_difftime'
21116 d_dirfd='$d_dirfd'
21117 d_dirnamlen='$d_dirnamlen'
21118 d_dlerror='$d_dlerror'
21119 d_dlopen='$d_dlopen'
21120 d_dlsymun='$d_dlsymun'
21121 d_dosuid='$d_dosuid'
21122 d_drand48_r='$d_drand48_r'
21123 d_drand48proto='$d_drand48proto'
21124 d_dup2='$d_dup2'
21125 d_eaccess='$d_eaccess'
21126 d_endgrent='$d_endgrent'
21127 d_endgrent_r='$d_endgrent_r'
21128 d_endhent='$d_endhent'
21129 d_endhostent_r='$d_endhostent_r'
21130 d_endnent='$d_endnent'
21131 d_endnetent_r='$d_endnetent_r'
21132 d_endpent='$d_endpent'
21133 d_endprotoent_r='$d_endprotoent_r'
21134 d_endpwent='$d_endpwent'
21135 d_endpwent_r='$d_endpwent_r'
21136 d_endsent='$d_endsent'
21137 d_endservent_r='$d_endservent_r'
21138 d_eofnblk='$d_eofnblk'
21139 d_eunice='$d_eunice'
21140 d_faststdio='$d_faststdio'
21141 d_fchdir='$d_fchdir'
21142 d_fchmod='$d_fchmod'
21143 d_fchown='$d_fchown'
21144 d_fcntl='$d_fcntl'
21145 d_fcntl_can_lock='$d_fcntl_can_lock'
21146 d_fd_macros='$d_fd_macros'
21147 d_fd_set='$d_fd_set'
21148 d_fds_bits='$d_fds_bits'
21149 d_fgetpos='$d_fgetpos'
21150 d_finite='$d_finite'
21151 d_finitel='$d_finitel'
21152 d_flexfnam='$d_flexfnam'
21153 d_flock='$d_flock'
21154 d_flockproto='$d_flockproto'
21155 d_fork='$d_fork'
21156 d_fp_class='$d_fp_class'
21157 d_fpathconf='$d_fpathconf'
21158 d_fpclass='$d_fpclass'
21159 d_fpclassify='$d_fpclassify'
21160 d_fpclassl='$d_fpclassl'
21161 d_fpos64_t='$d_fpos64_t'
21162 d_frexpl='$d_frexpl'
21163 d_fs_data_s='$d_fs_data_s'
21164 d_fseeko='$d_fseeko'
21165 d_fsetpos='$d_fsetpos'
21166 d_fstatfs='$d_fstatfs'
21167 d_fstatvfs='$d_fstatvfs'
21168 d_fsync='$d_fsync'
21169 d_ftello='$d_ftello'
21170 d_ftime='$d_ftime'
21171 d_futimes='$d_futimes'
21172 d_getcwd='$d_getcwd'
21173 d_getespwnam='$d_getespwnam'
21174 d_getfsstat='$d_getfsstat'
21175 d_getgrent='$d_getgrent'
21176 d_getgrent_r='$d_getgrent_r'
21177 d_getgrgid_r='$d_getgrgid_r'
21178 d_getgrnam_r='$d_getgrnam_r'
21179 d_getgrps='$d_getgrps'
21180 d_gethbyaddr='$d_gethbyaddr'
21181 d_gethbyname='$d_gethbyname'
21182 d_gethent='$d_gethent'
21183 d_gethname='$d_gethname'
21184 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21185 d_gethostbyname_r='$d_gethostbyname_r'
21186 d_gethostent_r='$d_gethostent_r'
21187 d_gethostprotos='$d_gethostprotos'
21188 d_getitimer='$d_getitimer'
21189 d_getlogin='$d_getlogin'
21190 d_getlogin_r='$d_getlogin_r'
21191 d_getmnt='$d_getmnt'
21192 d_getmntent='$d_getmntent'
21193 d_getnbyaddr='$d_getnbyaddr'
21194 d_getnbyname='$d_getnbyname'
21195 d_getnent='$d_getnent'
21196 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21197 d_getnetbyname_r='$d_getnetbyname_r'
21198 d_getnetent_r='$d_getnetent_r'
21199 d_getnetprotos='$d_getnetprotos'
21200 d_getpagsz='$d_getpagsz'
21201 d_getpbyname='$d_getpbyname'
21202 d_getpbynumber='$d_getpbynumber'
21203 d_getpent='$d_getpent'
21204 d_getpgid='$d_getpgid'
21205 d_getpgrp2='$d_getpgrp2'
21206 d_getpgrp='$d_getpgrp'
21207 d_getppid='$d_getppid'
21208 d_getprior='$d_getprior'
21209 d_getprotobyname_r='$d_getprotobyname_r'
21210 d_getprotobynumber_r='$d_getprotobynumber_r'
21211 d_getprotoent_r='$d_getprotoent_r'
21212 d_getprotoprotos='$d_getprotoprotos'
21213 d_getprpwnam='$d_getprpwnam'
21214 d_getpwent='$d_getpwent'
21215 d_getpwent_r='$d_getpwent_r'
21216 d_getpwnam_r='$d_getpwnam_r'
21217 d_getpwuid_r='$d_getpwuid_r'
21218 d_getsbyname='$d_getsbyname'
21219 d_getsbyport='$d_getsbyport'
21220 d_getsent='$d_getsent'
21221 d_getservbyname_r='$d_getservbyname_r'
21222 d_getservbyport_r='$d_getservbyport_r'
21223 d_getservent_r='$d_getservent_r'
21224 d_getservprotos='$d_getservprotos'
21225 d_getspnam='$d_getspnam'
21226 d_getspnam_r='$d_getspnam_r'
21227 d_gettimeod='$d_gettimeod'
21228 d_gmtime_r='$d_gmtime_r'
21229 d_gnulibc='$d_gnulibc'
21230 d_grpasswd='$d_grpasswd'
21231 d_hasmntopt='$d_hasmntopt'
21232 d_htonl='$d_htonl'
21233 d_ilogbl='$d_ilogbl'
21234 d_index='$d_index'
21235 d_inetaton='$d_inetaton'
21236 d_int64_t='$d_int64_t'
21237 d_isascii='$d_isascii'
21238 d_isfinite='$d_isfinite'
21239 d_isinf='$d_isinf'
21240 d_isnan='$d_isnan'
21241 d_isnanl='$d_isnanl'
21242 d_killpg='$d_killpg'
21243 d_lchown='$d_lchown'
21244 d_ldbl_dig='$d_ldbl_dig'
21245 d_libm_lib_version='$d_libm_lib_version'
21246 d_link='$d_link'
21247 d_localtime_r='$d_localtime_r'
21248 d_locconv='$d_locconv'
21249 d_lockf='$d_lockf'
21250 d_longdbl='$d_longdbl'
21251 d_longlong='$d_longlong'
21252 d_lseekproto='$d_lseekproto'
21253 d_lstat='$d_lstat'
21254 d_madvise='$d_madvise'
21255 d_malloc_good_size='$d_malloc_good_size'
21256 d_malloc_size='$d_malloc_size'
21257 d_mblen='$d_mblen'
21258 d_mbstowcs='$d_mbstowcs'
21259 d_mbtowc='$d_mbtowc'
21260 d_memchr='$d_memchr'
21261 d_memcmp='$d_memcmp'
21262 d_memcpy='$d_memcpy'
21263 d_memmove='$d_memmove'
21264 d_memset='$d_memset'
21265 d_mkdir='$d_mkdir'
21266 d_mkdtemp='$d_mkdtemp'
21267 d_mkfifo='$d_mkfifo'
21268 d_mkstemp='$d_mkstemp'
21269 d_mkstemps='$d_mkstemps'
21270 d_mktime='$d_mktime'
21271 d_mmap='$d_mmap'
21272 d_modfl='$d_modfl'
21273 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21274 d_modflproto='$d_modflproto'
21275 d_mprotect='$d_mprotect'
21276 d_msg='$d_msg'
21277 d_msg_ctrunc='$d_msg_ctrunc'
21278 d_msg_dontroute='$d_msg_dontroute'
21279 d_msg_oob='$d_msg_oob'
21280 d_msg_peek='$d_msg_peek'
21281 d_msg_proxy='$d_msg_proxy'
21282 d_msgctl='$d_msgctl'
21283 d_msgget='$d_msgget'
21284 d_msghdr_s='$d_msghdr_s'
21285 d_msgrcv='$d_msgrcv'
21286 d_msgsnd='$d_msgsnd'
21287 d_msync='$d_msync'
21288 d_munmap='$d_munmap'
21289 d_mymalloc='$d_mymalloc'
21290 d_nice='$d_nice'
21291 d_nl_langinfo='$d_nl_langinfo'
21292 d_nv_preserves_uv='$d_nv_preserves_uv'
21293 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21294 d_off64_t='$d_off64_t'
21295 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21296 d_oldpthreads='$d_oldpthreads'
21297 d_oldsock='$d_oldsock'
21298 d_open3='$d_open3'
21299 d_pathconf='$d_pathconf'
21300 d_pause='$d_pause'
21301 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21302 d_phostname='$d_phostname'
21303 d_pipe='$d_pipe'
21304 d_poll='$d_poll'
21305 d_portable='$d_portable'
21306 d_procselfexe='$d_procselfexe'
21307 d_pthread_atfork='$d_pthread_atfork'
21308 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21309 d_pthread_yield='$d_pthread_yield'
21310 d_pwage='$d_pwage'
21311 d_pwchange='$d_pwchange'
21312 d_pwclass='$d_pwclass'
21313 d_pwcomment='$d_pwcomment'
21314 d_pwexpire='$d_pwexpire'
21315 d_pwgecos='$d_pwgecos'
21316 d_pwpasswd='$d_pwpasswd'
21317 d_pwquota='$d_pwquota'
21318 d_qgcvt='$d_qgcvt'
21319 d_quad='$d_quad'
21320 d_random_r='$d_random_r'
21321 d_readdir64_r='$d_readdir64_r'
21322 d_readdir='$d_readdir'
21323 d_readdir_r='$d_readdir_r'
21324 d_readlink='$d_readlink'
21325 d_readv='$d_readv'
21326 d_recvmsg='$d_recvmsg'
21327 d_rename='$d_rename'
21328 d_rewinddir='$d_rewinddir'
21329 d_rmdir='$d_rmdir'
21330 d_safebcpy='$d_safebcpy'
21331 d_safemcpy='$d_safemcpy'
21332 d_sanemcmp='$d_sanemcmp'
21333 d_sbrkproto='$d_sbrkproto'
21334 d_scalbnl='$d_scalbnl'
21335 d_sched_yield='$d_sched_yield'
21336 d_scm_rights='$d_scm_rights'
21337 d_seekdir='$d_seekdir'
21338 d_select='$d_select'
21339 d_sem='$d_sem'
21340 d_semctl='$d_semctl'
21341 d_semctl_semid_ds='$d_semctl_semid_ds'
21342 d_semctl_semun='$d_semctl_semun'
21343 d_semget='$d_semget'
21344 d_semop='$d_semop'
21345 d_sendmsg='$d_sendmsg'
21346 d_setegid='$d_setegid'
21347 d_seteuid='$d_seteuid'
21348 d_setgrent='$d_setgrent'
21349 d_setgrent_r='$d_setgrent_r'
21350 d_setgrps='$d_setgrps'
21351 d_sethent='$d_sethent'
21352 d_sethostent_r='$d_sethostent_r'
21353 d_setitimer='$d_setitimer'
21354 d_setlinebuf='$d_setlinebuf'
21355 d_setlocale='$d_setlocale'
21356 d_setlocale_r='$d_setlocale_r'
21357 d_setnent='$d_setnent'
21358 d_setnetent_r='$d_setnetent_r'
21359 d_setpent='$d_setpent'
21360 d_setpgid='$d_setpgid'
21361 d_setpgrp2='$d_setpgrp2'
21362 d_setpgrp='$d_setpgrp'
21363 d_setprior='$d_setprior'
21364 d_setproctitle='$d_setproctitle'
21365 d_setprotoent_r='$d_setprotoent_r'
21366 d_setpwent='$d_setpwent'
21367 d_setpwent_r='$d_setpwent_r'
21368 d_setregid='$d_setregid'
21369 d_setresgid='$d_setresgid'
21370 d_setresuid='$d_setresuid'
21371 d_setreuid='$d_setreuid'
21372 d_setrgid='$d_setrgid'
21373 d_setruid='$d_setruid'
21374 d_setsent='$d_setsent'
21375 d_setservent_r='$d_setservent_r'
21376 d_setsid='$d_setsid'
21377 d_setvbuf='$d_setvbuf'
21378 d_sfio='$d_sfio'
21379 d_shm='$d_shm'
21380 d_shmat='$d_shmat'
21381 d_shmatprototype='$d_shmatprototype'
21382 d_shmctl='$d_shmctl'
21383 d_shmdt='$d_shmdt'
21384 d_shmget='$d_shmget'
21385 d_sigaction='$d_sigaction'
21386 d_sigprocmask='$d_sigprocmask'
21387 d_sigsetjmp='$d_sigsetjmp'
21388 d_snprintf='$d_snprintf'
21389 d_sockatmark='$d_sockatmark'
21390 d_sockatmarkproto='$d_sockatmarkproto'
21391 d_socket='$d_socket'
21392 d_socklen_t='$d_socklen_t'
21393 d_sockpair='$d_sockpair'
21394 d_socks5_init='$d_socks5_init'
21395 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21396 d_sqrtl='$d_sqrtl'
21397 d_srand48_r='$d_srand48_r'
21398 d_srandom_r='$d_srandom_r'
21399 d_sresgproto='$d_sresgproto'
21400 d_sresuproto='$d_sresuproto'
21401 d_statblks='$d_statblks'
21402 d_statfs_f_flags='$d_statfs_f_flags'
21403 d_statfs_s='$d_statfs_s'
21404 d_statvfs='$d_statvfs'
21405 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21406 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21407 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21408 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21409 d_stdio_stream_array='$d_stdio_stream_array'
21410 d_stdiobase='$d_stdiobase'
21411 d_stdstdio='$d_stdstdio'
21412 d_strchr='$d_strchr'
21413 d_strcoll='$d_strcoll'
21414 d_strctcpy='$d_strctcpy'
21415 d_strerrm='$d_strerrm'
21416 d_strerror='$d_strerror'
21417 d_strerror_r='$d_strerror_r'
21418 d_strftime='$d_strftime'
21419 d_strlcat='$d_strlcat'
21420 d_strlcpy='$d_strlcpy'
21421 d_strtod='$d_strtod'
21422 d_strtol='$d_strtol'
21423 d_strtold='$d_strtold'
21424 d_strtoll='$d_strtoll'
21425 d_strtoq='$d_strtoq'
21426 d_strtoul='$d_strtoul'
21427 d_strtoull='$d_strtoull'
21428 d_strtouq='$d_strtouq'
21429 d_strxfrm='$d_strxfrm'
21430 d_suidsafe='$d_suidsafe'
21431 d_symlink='$d_symlink'
21432 d_syscall='$d_syscall'
21433 d_syscallproto='$d_syscallproto'
21434 d_sysconf='$d_sysconf'
21435 d_sysernlst='$d_sysernlst'
21436 d_syserrlst='$d_syserrlst'
21437 d_system='$d_system'
21438 d_tcgetpgrp='$d_tcgetpgrp'
21439 d_tcsetpgrp='$d_tcsetpgrp'
21440 d_telldir='$d_telldir'
21441 d_telldirproto='$d_telldirproto'
21442 d_time='$d_time'
21443 d_times='$d_times'
21444 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21445 d_tm_tm_zone='$d_tm_tm_zone'
21446 d_tmpnam_r='$d_tmpnam_r'
21447 d_truncate='$d_truncate'
21448 d_ttyname_r='$d_ttyname_r'
21449 d_tzname='$d_tzname'
21450 d_u32align='$d_u32align'
21451 d_ualarm='$d_ualarm'
21452 d_umask='$d_umask'
21453 d_uname='$d_uname'
21454 d_union_semun='$d_union_semun'
21455 d_unordered='$d_unordered'
21456 d_unsetenv='$d_unsetenv'
21457 d_usleep='$d_usleep'
21458 d_usleepproto='$d_usleepproto'
21459 d_ustat='$d_ustat'
21460 d_vendorarch='$d_vendorarch'
21461 d_vendorbin='$d_vendorbin'
21462 d_vendorlib='$d_vendorlib'
21463 d_vendorscript='$d_vendorscript'
21464 d_vfork='$d_vfork'
21465 d_void_closedir='$d_void_closedir'
21466 d_voidsig='$d_voidsig'
21467 d_voidtty='$d_voidtty'
21468 d_volatile='$d_volatile'
21469 d_vprintf='$d_vprintf'
21470 d_vsnprintf='$d_vsnprintf'
21471 d_wait4='$d_wait4'
21472 d_waitpid='$d_waitpid'
21473 d_wcstombs='$d_wcstombs'
21474 d_wctomb='$d_wctomb'
21475 d_writev='$d_writev'
21476 d_xenix='$d_xenix'
21477 date='$date'
21478 db_hashtype='$db_hashtype'
21479 db_prefixtype='$db_prefixtype'
21480 db_version_major='$db_version_major'
21481 db_version_minor='$db_version_minor'
21482 db_version_patch='$db_version_patch'
21483 defvoidused='$defvoidused'
21484 direntrytype='$direntrytype'
21485 dlext='$dlext'
21486 dlsrc='$dlsrc'
21487 doublesize='$doublesize'
21488 drand01='$drand01'
21489 drand48_r_proto='$drand48_r_proto'
21490 dynamic_ext='$dynamic_ext'
21491 eagain='$eagain'
21492 ebcdic='$ebcdic'
21493 echo='$echo'
21494 egrep='$egrep'
21495 emacs='$emacs'
21496 endgrent_r_proto='$endgrent_r_proto'
21497 endhostent_r_proto='$endhostent_r_proto'
21498 endnetent_r_proto='$endnetent_r_proto'
21499 endprotoent_r_proto='$endprotoent_r_proto'
21500 endpwent_r_proto='$endpwent_r_proto'
21501 endservent_r_proto='$endservent_r_proto'
21502 eunicefix='$eunicefix'
21503 exe_ext='$exe_ext'
21504 expr='$expr'
21505 extensions='$extensions'
21506 extras='$extras'
21507 fflushNULL='$fflushNULL'
21508 fflushall='$fflushall'
21509 find='$find'
21510 firstmakefile='$firstmakefile'
21511 flex='$flex'
21512 fpossize='$fpossize'
21513 fpostype='$fpostype'
21514 freetype='$freetype'
21515 from='$from'
21516 full_ar='$full_ar'
21517 full_csh='$full_csh'
21518 full_sed='$full_sed'
21519 gccansipedantic='$gccansipedantic'
21520 gccosandvers='$gccosandvers'
21521 gccversion='$gccversion'
21522 getgrent_r_proto='$getgrent_r_proto'
21523 getgrgid_r_proto='$getgrgid_r_proto'
21524 getgrnam_r_proto='$getgrnam_r_proto'
21525 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21526 gethostbyname_r_proto='$gethostbyname_r_proto'
21527 gethostent_r_proto='$gethostent_r_proto'
21528 getlogin_r_proto='$getlogin_r_proto'
21529 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21530 getnetbyname_r_proto='$getnetbyname_r_proto'
21531 getnetent_r_proto='$getnetent_r_proto'
21532 getprotobyname_r_proto='$getprotobyname_r_proto'
21533 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21534 getprotoent_r_proto='$getprotoent_r_proto'
21535 getpwent_r_proto='$getpwent_r_proto'
21536 getpwnam_r_proto='$getpwnam_r_proto'
21537 getpwuid_r_proto='$getpwuid_r_proto'
21538 getservbyname_r_proto='$getservbyname_r_proto'
21539 getservbyport_r_proto='$getservbyport_r_proto'
21540 getservent_r_proto='$getservent_r_proto'
21541 getspnam_r_proto='$getspnam_r_proto'
21542 gidformat='$gidformat'
21543 gidsign='$gidsign'
21544 gidsize='$gidsize'
21545 gidtype='$gidtype'
21546 glibpth='$glibpth'
21547 gmake='$gmake'
21548 gmtime_r_proto='$gmtime_r_proto'
21549 gnulibc_version='$gnulibc_version'
21550 grep='$grep'
21551 groupcat='$groupcat'
21552 groupstype='$groupstype'
21553 gzip='$gzip'
21554 h_fcntl='$h_fcntl'
21555 h_sysfile='$h_sysfile'
21556 hint='$hint'
21557 hostcat='$hostcat'
21558 html1dir='$html1dir'
21559 html1direxp='$html1direxp'
21560 html3dir='$html3dir'
21561 html3direxp='$html3direxp'
21562 i16size='$i16size'
21563 i16type='$i16type'
21564 i32size='$i32size'
21565 i32type='$i32type'
21566 i64size='$i64size'
21567 i64type='$i64type'
21568 i8size='$i8size'
21569 i8type='$i8type'
21570 i_arpainet='$i_arpainet'
21571 i_bsdioctl='$i_bsdioctl'
21572 i_crypt='$i_crypt'
21573 i_db='$i_db'
21574 i_dbm='$i_dbm'
21575 i_dirent='$i_dirent'
21576 i_dld='$i_dld'
21577 i_dlfcn='$i_dlfcn'
21578 i_fcntl='$i_fcntl'
21579 i_float='$i_float'
21580 i_fp='$i_fp'
21581 i_fp_class='$i_fp_class'
21582 i_gdbm='$i_gdbm'
21583 i_grp='$i_grp'
21584 i_ieeefp='$i_ieeefp'
21585 i_inttypes='$i_inttypes'
21586 i_langinfo='$i_langinfo'
21587 i_libutil='$i_libutil'
21588 i_limits='$i_limits'
21589 i_locale='$i_locale'
21590 i_machcthr='$i_machcthr'
21591 i_malloc='$i_malloc'
21592 i_math='$i_math'
21593 i_memory='$i_memory'
21594 i_mntent='$i_mntent'
21595 i_ndbm='$i_ndbm'
21596 i_netdb='$i_netdb'
21597 i_neterrno='$i_neterrno'
21598 i_netinettcp='$i_netinettcp'
21599 i_niin='$i_niin'
21600 i_poll='$i_poll'
21601 i_prot='$i_prot'
21602 i_pthread='$i_pthread'
21603 i_pwd='$i_pwd'
21604 i_rpcsvcdbm='$i_rpcsvcdbm'
21605 i_sfio='$i_sfio'
21606 i_sgtty='$i_sgtty'
21607 i_shadow='$i_shadow'
21608 i_socks='$i_socks'
21609 i_stdarg='$i_stdarg'
21610 i_stddef='$i_stddef'
21611 i_stdlib='$i_stdlib'
21612 i_string='$i_string'
21613 i_sunmath='$i_sunmath'
21614 i_sysaccess='$i_sysaccess'
21615 i_sysdir='$i_sysdir'
21616 i_sysfile='$i_sysfile'
21617 i_sysfilio='$i_sysfilio'
21618 i_sysin='$i_sysin'
21619 i_sysioctl='$i_sysioctl'
21620 i_syslog='$i_syslog'
21621 i_sysmman='$i_sysmman'
21622 i_sysmode='$i_sysmode'
21623 i_sysmount='$i_sysmount'
21624 i_sysndir='$i_sysndir'
21625 i_sysparam='$i_sysparam'
21626 i_sysresrc='$i_sysresrc'
21627 i_syssecrt='$i_syssecrt'
21628 i_sysselct='$i_sysselct'
21629 i_syssockio='$i_syssockio'
21630 i_sysstat='$i_sysstat'
21631 i_sysstatfs='$i_sysstatfs'
21632 i_sysstatvfs='$i_sysstatvfs'
21633 i_systime='$i_systime'
21634 i_systimek='$i_systimek'
21635 i_systimes='$i_systimes'
21636 i_systypes='$i_systypes'
21637 i_sysuio='$i_sysuio'
21638 i_sysun='$i_sysun'
21639 i_sysutsname='$i_sysutsname'
21640 i_sysvfs='$i_sysvfs'
21641 i_syswait='$i_syswait'
21642 i_termio='$i_termio'
21643 i_termios='$i_termios'
21644 i_time='$i_time'
21645 i_unistd='$i_unistd'
21646 i_ustat='$i_ustat'
21647 i_utime='$i_utime'
21648 i_values='$i_values'
21649 i_varargs='$i_varargs'
21650 i_varhdr='$i_varhdr'
21651 i_vfork='$i_vfork'
21652 ignore_versioned_solibs='$ignore_versioned_solibs'
21653 inc_version_list='$inc_version_list'
21654 inc_version_list_init='$inc_version_list_init'
21655 incpath='$incpath'
21656 inews='$inews'
21657 installarchlib='$installarchlib'
21658 installbin='$installbin'
21659 installhtml1dir='$installhtml1dir'
21660 installhtml3dir='$installhtml3dir'
21661 installman1dir='$installman1dir'
21662 installman3dir='$installman3dir'
21663 installprefix='$installprefix'
21664 installprefixexp='$installprefixexp'
21665 installprivlib='$installprivlib'
21666 installscript='$installscript'
21667 installsitearch='$installsitearch'
21668 installsitebin='$installsitebin'
21669 installsitehtml1dir='$installsitehtml1dir'
21670 installsitehtml3dir='$installsitehtml3dir'
21671 installsitelib='$installsitelib'
21672 installsiteman1dir='$installsiteman1dir'
21673 installsiteman3dir='$installsiteman3dir'
21674 installsitescript='$installsitescript'
21675 installstyle='$installstyle'
21676 installusrbinperl='$installusrbinperl'
21677 installvendorarch='$installvendorarch'
21678 installvendorbin='$installvendorbin'
21679 installvendorhtml1dir='$installvendorhtml1dir'
21680 installvendorhtml3dir='$installvendorhtml3dir'
21681 installvendorlib='$installvendorlib'
21682 installvendorman1dir='$installvendorman1dir'
21683 installvendorman3dir='$installvendorman3dir'
21684 installvendorscript='$installvendorscript'
21685 intsize='$intsize'
21686 issymlink='$issymlink'
21687 ivdformat='$ivdformat'
21688 ivsize='$ivsize'
21689 ivtype='$ivtype'
21690 known_extensions='$known_extensions'
21691 ksh='$ksh'
21692 ld='$ld'
21693 lddlflags='$lddlflags'
21694 ldflags='$ldflags'
21695 ldflags_uselargefiles='$ldflags_uselargefiles'
21696 ldlibpthname='$ldlibpthname'
21697 less='$less'
21698 lib_ext='$lib_ext'
21699 libc='$libc'
21700 libperl='$libperl'
21701 libpth='$libpth'
21702 libs='$libs'
21703 libsdirs='$libsdirs'
21704 libsfiles='$libsfiles'
21705 libsfound='$libsfound'
21706 libspath='$libspath'
21707 libswanted='$libswanted'
21708 libswanted_uselargefiles='$libswanted_uselargefiles'
21709 line='$line'
21710 lint='$lint'
21711 lkflags='$lkflags'
21712 ln='$ln'
21713 lns='$lns'
21714 localtime_r_proto='$localtime_r_proto'
21715 locincpth='$locincpth'
21716 loclibpth='$loclibpth'
21717 longdblsize='$longdblsize'
21718 longlongsize='$longlongsize'
21719 longsize='$longsize'
21720 lp='$lp'
21721 lpr='$lpr'
21722 ls='$ls'
21723 lseeksize='$lseeksize'
21724 lseektype='$lseektype'
21725 mail='$mail'
21726 mailx='$mailx'
21727 make='$make'
21728 make_set_make='$make_set_make'
21729 mallocobj='$mallocobj'
21730 mallocsrc='$mallocsrc'
21731 malloctype='$malloctype'
21732 man1dir='$man1dir'
21733 man1direxp='$man1direxp'
21734 man1ext='$man1ext'
21735 man3dir='$man3dir'
21736 man3direxp='$man3direxp'
21737 man3ext='$man3ext'
21738 mips_type='$mips_type'
21739 mistrustnm='$mistrustnm'
21740 mkdir='$mkdir'
21741 mmaptype='$mmaptype'
21742 modetype='$modetype'
21743 more='$more'
21744 multiarch='$multiarch'
21745 mv='$mv'
21746 myarchname='$myarchname'
21747 mydomain='$mydomain'
21748 myhostname='$myhostname'
21749 myuname='$myuname'
21750 n='$n'
21751 need_va_copy='$need_va_copy'
21752 netdb_hlen_type='$netdb_hlen_type'
21753 netdb_host_type='$netdb_host_type'
21754 netdb_name_type='$netdb_name_type'
21755 netdb_net_type='$netdb_net_type'
21756 nm='$nm'
21757 nm_opt='$nm_opt'
21758 nm_so_opt='$nm_so_opt'
21759 nonxs_ext='$nonxs_ext'
21760 nroff='$nroff'
21761 nvEUformat='$nvEUformat'
21762 nvFUformat='$nvFUformat'
21763 nvGUformat='$nvGUformat'
21764 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21765 nveformat='$nveformat'
21766 nvfformat='$nvfformat'
21767 nvgformat='$nvgformat'
21768 nvsize='$nvsize'
21769 nvtype='$nvtype'
21770 o_nonblock='$o_nonblock'
21771 obj_ext='$obj_ext'
21772 old_pthread_create_joinable='$old_pthread_create_joinable'
21773 optimize='$optimize'
21774 orderlib='$orderlib'
21775 osname='$osname'
21776 osvers='$osvers'
21777 otherlibdirs='$otherlibdirs'
21778 package='$package'
21779 pager='$pager'
21780 passcat='$passcat'
21781 patchlevel='$patchlevel'
21782 path_sep='$path_sep'
21783 perl5='$perl5'
21784 perl='$perl'
21785 perl_patchlevel='$perl_patchlevel'
21786 perladmin='$perladmin'
21787 perllibs='$perllibs'
21788 perlpath='$perlpath'
21789 pg='$pg'
21790 phostname='$phostname'
21791 pidtype='$pidtype'
21792 plibpth='$plibpth'
21793 pmake='$pmake'
21794 pr='$pr'
21795 prefix='$prefix'
21796 prefixexp='$prefixexp'
21797 privlib='$privlib'
21798 privlibexp='$privlibexp'
21799 procselfexe='$procselfexe'
21800 prototype='$prototype'
21801 ptrsize='$ptrsize'
21802 quadkind='$quadkind'
21803 quadtype='$quadtype'
21804 randbits='$randbits'
21805 randfunc='$randfunc'
21806 random_r_proto='$random_r_proto'
21807 randseedtype='$randseedtype'
21808 ranlib='$ranlib'
21809 rd_nodata='$rd_nodata'
21810 readdir64_r_proto='$readdir64_r_proto'
21811 readdir_r_proto='$readdir_r_proto'
21812 revision='$revision'
21813 rm='$rm'
21814 rmail='$rmail'
21815 run='$run'
21816 runnm='$runnm'
21817 sPRIEUldbl='$sPRIEUldbl'
21818 sPRIFUldbl='$sPRIFUldbl'
21819 sPRIGUldbl='$sPRIGUldbl'
21820 sPRIXU64='$sPRIXU64'
21821 sPRId64='$sPRId64'
21822 sPRIeldbl='$sPRIeldbl'
21823 sPRIfldbl='$sPRIfldbl'
21824 sPRIgldbl='$sPRIgldbl'
21825 sPRIi64='$sPRIi64'
21826 sPRIo64='$sPRIo64'
21827 sPRIu64='$sPRIu64'
21828 sPRIx64='$sPRIx64'
21829 sSCNfldbl='$sSCNfldbl'
21830 sched_yield='$sched_yield'
21831 scriptdir='$scriptdir'
21832 scriptdirexp='$scriptdirexp'
21833 sed='$sed'
21834 seedfunc='$seedfunc'
21835 selectminbits='$selectminbits'
21836 selecttype='$selecttype'
21837 sendmail='$sendmail'
21838 setgrent_r_proto='$setgrent_r_proto'
21839 sethostent_r_proto='$sethostent_r_proto'
21840 setlocale_r_proto='$setlocale_r_proto'
21841 setnetent_r_proto='$setnetent_r_proto'
21842 setprotoent_r_proto='$setprotoent_r_proto'
21843 setpwent_r_proto='$setpwent_r_proto'
21844 setservent_r_proto='$setservent_r_proto'
21845 sh='$sh'
21846 shar='$shar'
21847 sharpbang='$sharpbang'
21848 shmattype='$shmattype'
21849 shortsize='$shortsize'
21850 shrpenv='$shrpenv'
21851 shsharp='$shsharp'
21852 sig_count='$sig_count'
21853 sig_name='$sig_name'
21854 sig_name_init='$sig_name_init'
21855 sig_num='$sig_num'
21856 sig_num_init='$sig_num_init'
21857 sig_size='$sig_size'
21858 signal_t='$signal_t'
21859 sitearch='$sitearch'
21860 sitearchexp='$sitearchexp'
21861 sitebin='$sitebin'
21862 sitebinexp='$sitebinexp'
21863 sitehtml1dir='$sitehtml1dir'
21864 sitehtml1direxp='$sitehtml1direxp'
21865 sitehtml3dir='$sitehtml3dir'
21866 sitehtml3direxp='$sitehtml3direxp'
21867 sitelib='$sitelib'
21868 sitelib_stem='$sitelib_stem'
21869 sitelibexp='$sitelibexp'
21870 siteman1dir='$siteman1dir'
21871 siteman1direxp='$siteman1direxp'
21872 siteman3dir='$siteman3dir'
21873 siteman3direxp='$siteman3direxp'
21874 siteprefix='$siteprefix'
21875 siteprefixexp='$siteprefixexp'
21876 sitescript='$sitescript'
21877 sitescriptexp='$sitescriptexp'
21878 sizesize='$sizesize'
21879 sizetype='$sizetype'
21880 sleep='$sleep'
21881 smail='$smail'
21882 so='$so'
21883 sockethdr='$sockethdr'
21884 socketlib='$socketlib'
21885 socksizetype='$socksizetype'
21886 sort='$sort'
21887 spackage='$spackage'
21888 spitshell='$spitshell'
21889 srand48_r_proto='$srand48_r_proto'
21890 srandom_r_proto='$srandom_r_proto'
21891 src='$src'
21892 ssizetype='$ssizetype'
21893 startperl='$startperl'
21894 startsh='$startsh'
21895 static_ext='$static_ext'
21896 stdchar='$stdchar'
21897 stdio_base='$stdio_base'
21898 stdio_bufsiz='$stdio_bufsiz'
21899 stdio_cnt='$stdio_cnt'
21900 stdio_filbuf='$stdio_filbuf'
21901 stdio_ptr='$stdio_ptr'
21902 stdio_stream_array='$stdio_stream_array'
21903 strerror_r_proto='$strerror_r_proto'
21904 strings='$strings'
21905 submit='$submit'
21906 subversion='$subversion'
21907 sysman='$sysman'
21908 tail='$tail'
21909 tar='$tar'
21910 targetarch='$targetarch'
21911 tbl='$tbl'
21912 tee='$tee'
21913 test='$test'
21914 timeincl='$timeincl'
21915 timetype='$timetype'
21916 tmpnam_r_proto='$tmpnam_r_proto'
21917 to='$to'
21918 touch='$touch'
21919 tr='$tr'
21920 trnl='$trnl'
21921 troff='$troff'
21922 ttyname_r_proto='$ttyname_r_proto'
21923 u16size='$u16size'
21924 u16type='$u16type'
21925 u32size='$u32size'
21926 u32type='$u32type'
21927 u64size='$u64size'
21928 u64type='$u64type'
21929 u8size='$u8size'
21930 u8type='$u8type'
21931 uidformat='$uidformat'
21932 uidsign='$uidsign'
21933 uidsize='$uidsize'
21934 uidtype='$uidtype'
21935 uname='$uname'
21936 uniq='$uniq'
21937 uquadtype='$uquadtype'
21938 use5005threads='$use5005threads'
21939 use64bitall='$use64bitall'
21940 use64bitint='$use64bitint'
21941 usecrosscompile='$usecrosscompile'
21942 usedl='$usedl'
21943 usefaststdio='$usefaststdio'
21944 useithreads='$useithreads'
21945 uselargefiles='$uselargefiles'
21946 uselongdouble='$uselongdouble'
21947 usemallocwrap='$usemallocwrap'
21948 usemorebits='$usemorebits'
21949 usemultiplicity='$usemultiplicity'
21950 usemymalloc='$usemymalloc'
21951 usenm='$usenm'
21952 useopcode='$useopcode'
21953 useperlio='$useperlio'
21954 useposix='$useposix'
21955 usereentrant='$usereentrant'
21956 userelocatableinc='$userelocatableinc'
21957 usesfio='$usesfio'
21958 useshrplib='$useshrplib'
21959 usesitecustomize='$usesitecustomize'
21960 usesocks='$usesocks'
21961 usethreads='$usethreads'
21962 usevendorprefix='$usevendorprefix'
21963 usevfork='$usevfork'
21964 usrinc='$usrinc'
21965 uuname='$uuname'
21966 uvXUformat='$uvXUformat'
21967 uvoformat='$uvoformat'
21968 uvsize='$uvsize'
21969 uvtype='$uvtype'
21970 uvuformat='$uvuformat'
21971 uvxformat='$uvxformat'
21972 vendorarch='$vendorarch'
21973 vendorarchexp='$vendorarchexp'
21974 vendorbin='$vendorbin'
21975 vendorbinexp='$vendorbinexp'
21976 vendorhtml1dir='$vendorhtml1dir'
21977 vendorhtml1direxp='$vendorhtml1direxp'
21978 vendorhtml3dir='$vendorhtml3dir'
21979 vendorhtml3direxp='$vendorhtml3direxp'
21980 vendorlib='$vendorlib'
21981 vendorlib_stem='$vendorlib_stem'
21982 vendorlibexp='$vendorlibexp'
21983 vendorman1dir='$vendorman1dir'
21984 vendorman1direxp='$vendorman1direxp'
21985 vendorman3dir='$vendorman3dir'
21986 vendorman3direxp='$vendorman3direxp'
21987 vendorprefix='$vendorprefix'
21988 vendorprefixexp='$vendorprefixexp'
21989 vendorscript='$vendorscript'
21990 vendorscriptexp='$vendorscriptexp'
21991 version='$version'
21992 version_patchlevel_string='$version_patchlevel_string'
21993 versiononly='$versiononly'
21994 vi='$vi'
21995 voidflags='$voidflags'
21996 xlibpth='$xlibpth'
21997 yacc='$yacc'
21998 yaccflags='$yaccflags'
21999 zcat='$zcat'
22000 zip='$zip'
22001 EOT
22002
22003 : Add in command line options if available
22004 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22005
22006 : add special variables
22007 $test -f $src/patchlevel.h && \
22008 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22009 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22010 echo "PERL_CONFIG_SH=true" >>config.sh
22011
22012 : propagate old symbols
22013 if $test -f UU/config.sh; then
22014         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22015         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22016         $sort | $uniq -u >UU/oldsyms
22017         set X `cat UU/oldsyms`
22018         shift
22019         case $# in
22020         0) ;;
22021         *)
22022                 cat <<EOM
22023 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22024 EOM
22025                 echo "# Variables propagated from previous config.sh file." >>config.sh
22026                 for sym in `cat UU/oldsyms`; do
22027                         echo "    Propagating $hint variable "'$'"$sym..."
22028                         eval 'tmp="$'"${sym}"'"'
22029                         echo "$tmp" | \
22030                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22031                 done
22032                 ;;
22033         esac
22034 fi
22035
22036 : Finish up by extracting the .SH files
22037 case "$alldone" in
22038 exit)
22039         $rm -rf UU
22040         echo "Extraction done."
22041         exit 0
22042         ;;
22043 cont)
22044         ;;
22045 '')
22046         dflt=''
22047         nostick=true
22048         $cat <<EOM
22049
22050 If you'd like to make any changes to the config.sh file before I begin
22051 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22052
22053 EOM
22054         rp="Press return or use a shell escape to edit config.sh:"
22055         . UU/myread
22056         nostick=''
22057         case "$ans" in
22058         '') ;;
22059         *) : in case they cannot read
22060                 sh 1>&4 -c "$ans";;
22061         esac
22062         ;;
22063 esac
22064
22065 : if this fails, just run all the .SH files by hand
22066 . ./config.sh
22067
22068 echo " "
22069 exec 1>&4
22070 pwd=`pwd`
22071 . ./UU/extract
22072 cd "$pwd"
22073
22074 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22075         dflt=y
22076         case "$silent" in
22077         true) ;;
22078         *)
22079                 $cat <<EOM
22080
22081 Now you need to generate make dependencies by running "$make depend".
22082 You might prefer to run it in background: "$make depend > makedepend.out &"
22083 It can take a while, so you might not want to run it right now.
22084
22085 EOM
22086                 ;;
22087         esac
22088         rp="Run $make depend now?"
22089         . UU/myread
22090         case "$ans" in
22091         y*)
22092                 $make depend && echo "Now you must run '$make'."
22093                 ;;
22094         *)
22095                 echo "You must run '$make depend' then '$make'."
22096                 ;;
22097         esac
22098 elif test -f [Mm]akefile; then
22099         echo " "
22100         echo "Now you must run a $make."
22101 else
22102         echo "Configure done."
22103 fi
22104
22105 if $test -f Policy.sh; then
22106     $cat <<EOM
22107
22108 If you compile $package on a different machine or from a different object
22109 directory, copy the Policy.sh file from this object directory to the
22110 new one before you run Configure -- this will help you with most of
22111 the policy defaults.
22112
22113 EOM
22114 fi
22115 if $test -f config.msg; then
22116     echo "Hmm.  I also noted the following information while running:"
22117     echo " "
22118     $cat config.msg >&4
22119     $rm -f config.msg
22120 fi
22121 $rm -f kit*isdone ark*isdone
22122 $rm -rf UU
22123
22124 : End of Configure
22125