Add a Configure question for mad (Misc Attribute Decoration - Larry's
[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 Fri Mar  3 17:34:44 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_builtin_choose_expr=''
358 d_builtin_expect=''
359 d_bzero=''
360 d_casti32=''
361 castflags=''
362 d_castneg=''
363 d_chown=''
364 d_chroot=''
365 d_chsize=''
366 d_class=''
367 d_clearenv=''
368 d_closedir=''
369 d_void_closedir=''
370 d_cmsghdr_s=''
371 d_const=''
372 d_copysignl=''
373 cryptlib=''
374 d_crypt=''
375 crypt_r_proto=''
376 d_crypt_r=''
377 d_csh=''
378 full_csh=''
379 ctermid_r_proto=''
380 d_ctermid_r=''
381 ctime_r_proto=''
382 d_ctime_r=''
383 d_cuserid=''
384 d_dbl_dig=''
385 d_dbminitproto=''
386 d_difftime=''
387 d_dirfd=''
388 d_dlerror=''
389 d_dlopen=''
390 d_dlsymun=''
391 d_dosuid=''
392 d_suidsafe=''
393 d_drand48_r=''
394 drand48_r_proto=''
395 d_drand48proto=''
396 d_dup2=''
397 d_eaccess=''
398 d_endgrent=''
399 d_endgrent_r=''
400 endgrent_r_proto=''
401 d_endhent=''
402 d_endhostent_r=''
403 endhostent_r_proto=''
404 d_endnent=''
405 d_endnetent_r=''
406 endnetent_r_proto=''
407 d_endpent=''
408 d_endprotoent_r=''
409 endprotoent_r_proto=''
410 d_endpwent=''
411 d_endpwent_r=''
412 endpwent_r_proto=''
413 d_endsent=''
414 d_endservent_r=''
415 endservent_r_proto=''
416 d_faststdio=''
417 d_fchdir=''
418 d_fchmod=''
419 d_fchown=''
420 d_fcntl=''
421 d_fcntl_can_lock=''
422 d_fd_macros=''
423 d_fd_set=''
424 d_fds_bits=''
425 d_fgetpos=''
426 d_finite=''
427 d_finitel=''
428 d_flexfnam=''
429 d_flock=''
430 d_flockproto=''
431 d_fork=''
432 d_fp_class=''
433 d_fpclass=''
434 d_fpclassify=''
435 d_fpclassl=''
436 d_fpos64_t=''
437 d_frexpl=''
438 d_fs_data_s=''
439 d_fseeko=''
440 d_fsetpos=''
441 d_fstatfs=''
442 d_fsync=''
443 d_ftello=''
444 d_ftime=''
445 d_gettimeod=''
446 d_futimes=''
447 d_Gconvert=''
448 d_getcwd=''
449 d_getespwnam=''
450 d_getfsstat=''
451 d_getgrent=''
452 d_getgrent_r=''
453 getgrent_r_proto=''
454 d_getgrgid_r=''
455 getgrgid_r_proto=''
456 d_getgrnam_r=''
457 getgrnam_r_proto=''
458 d_getgrps=''
459 d_gethbyaddr=''
460 d_gethbyname=''
461 d_gethent=''
462 aphostname=''
463 d_gethname=''
464 d_phostname=''
465 d_uname=''
466 d_gethostbyaddr_r=''
467 gethostbyaddr_r_proto=''
468 d_gethostbyname_r=''
469 gethostbyname_r_proto=''
470 d_gethostent_r=''
471 gethostent_r_proto=''
472 d_gethostprotos=''
473 d_getitimer=''
474 d_getlogin=''
475 d_getlogin_r=''
476 getlogin_r_proto=''
477 d_getmnt=''
478 d_getmntent=''
479 d_getnbyaddr=''
480 d_getnbyname=''
481 d_getnent=''
482 d_getnetbyaddr_r=''
483 getnetbyaddr_r_proto=''
484 d_getnetbyname_r=''
485 getnetbyname_r_proto=''
486 d_getnetent_r=''
487 getnetent_r_proto=''
488 d_getnetprotos=''
489 d_getpagsz=''
490 d_getpent=''
491 d_getpgid=''
492 d_getpgrp2=''
493 d_bsdgetpgrp=''
494 d_getpgrp=''
495 d_getppid=''
496 d_getprior=''
497 d_getpbyname=''
498 d_getpbynumber=''
499 d_getprotobyname_r=''
500 getprotobyname_r_proto=''
501 d_getprotobynumber_r=''
502 getprotobynumber_r_proto=''
503 d_getprotoent_r=''
504 getprotoent_r_proto=''
505 d_getprotoprotos=''
506 d_getprpwnam=''
507 d_getpwent=''
508 d_getpwent_r=''
509 getpwent_r_proto=''
510 d_getpwnam_r=''
511 getpwnam_r_proto=''
512 d_getpwuid_r=''
513 getpwuid_r_proto=''
514 d_getsent=''
515 d_getservbyname_r=''
516 getservbyname_r_proto=''
517 d_getservbyport_r=''
518 getservbyport_r_proto=''
519 d_getservent_r=''
520 getservent_r_proto=''
521 d_getservprotos=''
522 d_getspnam=''
523 d_getspnam_r=''
524 getspnam_r_proto=''
525 d_getsbyname=''
526 d_getsbyport=''
527 d_gmtime_r=''
528 gmtime_r_proto=''
529 d_gnulibc=''
530 gnulibc_version=''
531 d_hasmntopt=''
532 d_htonl=''
533 d_ilogbl=''
534 d_inetaton=''
535 d_int64_t=''
536 d_isascii=''
537 d_isfinite=''
538 d_isinf=''
539 d_isnan=''
540 d_isnanl=''
541 d_killpg=''
542 d_lchown=''
543 d_ldbl_dig=''
544 d_libm_lib_version=''
545 d_link=''
546 d_localtime_r=''
547 localtime_r_proto=''
548 d_locconv=''
549 d_lockf=''
550 d_longdbl=''
551 longdblsize=''
552 d_longlong=''
553 longlongsize=''
554 d_lseekproto=''
555 d_lstat=''
556 d_madvise=''
557 d_malloc_good_size=''
558 d_malloc_size=''
559 d_mblen=''
560 d_mbstowcs=''
561 d_mbtowc=''
562 d_memchr=''
563 d_memcmp=''
564 d_memcpy=''
565 d_memmove=''
566 d_memset=''
567 d_mkdir=''
568 d_mkdtemp=''
569 d_mkfifo=''
570 d_mkstemp=''
571 d_mkstemps=''
572 d_mktime=''
573 d_mmap=''
574 mmaptype=''
575 d_modfl=''
576 d_modfl_pow32_bug=''
577 d_modflproto=''
578 d_mprotect=''
579 d_msg=''
580 d_msgctl=''
581 d_msgget=''
582 d_msghdr_s=''
583 d_msgrcv=''
584 d_msgsnd=''
585 d_msync=''
586 d_munmap=''
587 d_nice=''
588 d_nl_langinfo=''
589 d_off64_t=''
590 d_open3=''
591 d_fpathconf=''
592 d_pathconf=''
593 d_pause=''
594 d_pipe=''
595 d_poll=''
596 d_portable=''
597 d_procselfexe=''
598 procselfexe=''
599 d_old_pthread_create_joinable=''
600 old_pthread_create_joinable=''
601 d_pthread_atfork=''
602 d_pthread_attr_setscope=''
603 d_pthread_yield=''
604 d_sched_yield=''
605 sched_yield=''
606 d_qgcvt=''
607 d_random_r=''
608 random_r_proto=''
609 d_readdir64_r=''
610 readdir64_r_proto=''
611 d_readdir=''
612 d_rewinddir=''
613 d_seekdir=''
614 d_telldir=''
615 d_readdir_r=''
616 readdir_r_proto=''
617 d_readlink=''
618 d_readv=''
619 d_recvmsg=''
620 d_rename=''
621 d_rmdir=''
622 d_safebcpy=''
623 d_safemcpy=''
624 d_sanemcmp=''
625 d_sbrkproto=''
626 d_scalbnl=''
627 d_select=''
628 d_sem=''
629 d_semctl=''
630 d_semget=''
631 d_semop=''
632 d_sendmsg=''
633 d_setegid=''
634 d_seteuid=''
635 d_setgrent=''
636 d_setgrent_r=''
637 setgrent_r_proto=''
638 d_setgrps=''
639 d_sethent=''
640 d_sethostent_r=''
641 sethostent_r_proto=''
642 d_setitimer=''
643 d_setlinebuf=''
644 d_setlocale=''
645 d_setlocale_r=''
646 setlocale_r_proto=''
647 d_setnent=''
648 d_setnetent_r=''
649 setnetent_r_proto=''
650 d_setpent=''
651 d_setpgid=''
652 d_setpgrp2=''
653 d_bsdsetpgrp=''
654 d_setpgrp=''
655 d_setprior=''
656 d_setproctitle=''
657 d_setprotoent_r=''
658 setprotoent_r_proto=''
659 d_setpwent=''
660 d_setpwent_r=''
661 setpwent_r_proto=''
662 d_setregid=''
663 d_setresgid=''
664 d_setresuid=''
665 d_setreuid=''
666 d_setrgid=''
667 d_setruid=''
668 d_setsent=''
669 d_setservent_r=''
670 setservent_r_proto=''
671 d_setsid=''
672 d_setvbuf=''
673 d_sfio=''
674 usesfio=''
675 d_shm=''
676 d_shmat=''
677 d_shmatprototype=''
678 shmattype=''
679 d_shmctl=''
680 d_shmdt=''
681 d_shmget=''
682 d_sigaction=''
683 d_sigprocmask=''
684 d_sigsetjmp=''
685 usesitecustomize=''
686 d_snprintf=''
687 d_vsnprintf=''
688 d_sockatmark=''
689 d_sockatmarkproto=''
690 d_msg_ctrunc=''
691 d_msg_dontroute=''
692 d_msg_oob=''
693 d_msg_peek=''
694 d_msg_proxy=''
695 d_oldsock=''
696 d_scm_rights=''
697 d_socket=''
698 d_sockpair=''
699 sockethdr=''
700 socketlib=''
701 d_socklen_t=''
702 d_socks5_init=''
703 d_sprintf_returns_strlen=''
704 d_sqrtl=''
705 d_srand48_r=''
706 srand48_r_proto=''
707 d_srandom_r=''
708 srandom_r_proto=''
709 d_sresgproto=''
710 d_sresuproto=''
711 d_statblks=''
712 d_statfs_f_flags=''
713 d_statfs_s=''
714 d_fstatvfs=''
715 d_statvfs=''
716 d_stdio_cnt_lval=''
717 d_stdio_ptr_lval=''
718 d_stdio_ptr_lval_nochange_cnt=''
719 d_stdio_ptr_lval_sets_cnt=''
720 d_stdiobase=''
721 d_stdstdio=''
722 stdio_base=''
723 stdio_bufsiz=''
724 stdio_cnt=''
725 stdio_filbuf=''
726 stdio_ptr=''
727 d_index=''
728 d_strchr=''
729 d_strcoll=''
730 d_strctcpy=''
731 d_strerrm=''
732 d_strerror=''
733 d_sysernlst=''
734 d_syserrlst=''
735 d_strerror_r=''
736 strerror_r_proto=''
737 d_strftime=''
738 d_strlcat=''
739 d_strlcpy=''
740 d_strtod=''
741 d_strtol=''
742 d_strtold=''
743 d_strtoll=''
744 d_strtoq=''
745 d_strtoul=''
746 d_strtoull=''
747 d_strtouq=''
748 d_strxfrm=''
749 d_symlink=''
750 d_syscall=''
751 d_syscallproto=''
752 d_sysconf=''
753 d_system=''
754 d_tcgetpgrp=''
755 d_tcsetpgrp=''
756 d_telldirproto=''
757 d_time=''
758 timetype=''
759 clocktype=''
760 d_times=''
761 d_tmpnam_r=''
762 tmpnam_r_proto=''
763 d_truncate=''
764 d_ttyname_r=''
765 ttyname_r_proto=''
766 d_tzname=''
767 d_u32align=''
768 d_ualarm=''
769 d_umask=''
770 d_semctl_semid_ds=''
771 d_semctl_semun=''
772 d_union_semun=''
773 d_unordered=''
774 d_unsetenv=''
775 d_usleep=''
776 d_usleepproto=''
777 d_ustat=''
778 d_vfork=''
779 usevfork=''
780 d_voidsig=''
781 signal_t=''
782 d_volatile=''
783 d_charvspr=''
784 d_vprintf=''
785 d_wait4=''
786 d_waitpid=''
787 d_wcstombs=''
788 d_wctomb=''
789 d_writev=''
790 dlext=''
791 cccdlflags=''
792 ccdlflags=''
793 dlsrc=''
794 ld=''
795 lddlflags=''
796 usedl=''
797 doublesize=''
798 ebcdic=''
799 fflushNULL=''
800 fflushall=''
801 fpossize=''
802 fpostype=''
803 gccansipedantic=''
804 gccosandvers=''
805 gccversion=''
806 gidformat=''
807 gidsign=''
808 gidsize=''
809 gidtype=''
810 groupstype=''
811 h_fcntl=''
812 h_sysfile=''
813 html1dir=''
814 html1direxp=''
815 installhtml1dir=''
816 html3dir=''
817 html3direxp=''
818 installhtml3dir=''
819 i_arpainet=''
820 i_crypt=''
821 db_hashtype=''
822 db_prefixtype=''
823 db_version_major=''
824 db_version_minor=''
825 db_version_patch=''
826 i_db=''
827 i_dbm=''
828 i_rpcsvcdbm=''
829 d_dirnamlen=''
830 direntrytype=''
831 i_dirent=''
832 i_dld=''
833 i_dlfcn=''
834 i_fcntl=''
835 i_float=''
836 i_fp=''
837 i_fp_class=''
838 i_gdbm=''
839 d_grpasswd=''
840 i_grp=''
841 i_ieeefp=''
842 i_inttypes=''
843 i_langinfo=''
844 i_libutil=''
845 i_limits=''
846 i_locale=''
847 i_machcthr=''
848 i_malloc=''
849 i_math=''
850 i_memory=''
851 i_mntent=''
852 i_ndbm=''
853 i_netdb=''
854 i_neterrno=''
855 i_netinettcp=''
856 i_niin=''
857 i_sysin=''
858 i_poll=''
859 i_prot=''
860 i_pthread=''
861 d_pwage=''
862 d_pwchange=''
863 d_pwclass=''
864 d_pwcomment=''
865 d_pwexpire=''
866 d_pwgecos=''
867 d_pwpasswd=''
868 d_pwquota=''
869 i_pwd=''
870 i_sfio=''
871 i_shadow=''
872 i_socks=''
873 i_stddef=''
874 i_stdlib=''
875 i_string=''
876 strings=''
877 i_sunmath=''
878 i_sysaccess=''
879 i_sysdir=''
880 i_sysfile=''
881 d_voidtty=''
882 i_bsdioctl=''
883 i_sysfilio=''
884 i_sysioctl=''
885 i_syssockio=''
886 i_syslog=''
887 i_sysmman=''
888 i_sysmode=''
889 i_sysmount=''
890 i_sysndir=''
891 i_sysparam=''
892 i_sysresrc=''
893 i_syssecrt=''
894 i_sysselct=''
895 i_sysstat=''
896 i_sysstatfs=''
897 i_sysstatvfs=''
898 i_systimes=''
899 i_systypes=''
900 i_sysuio=''
901 i_sysun=''
902 i_sysutsname=''
903 i_sysvfs=''
904 i_syswait=''
905 i_sgtty=''
906 i_termio=''
907 i_termios=''
908 d_tm_tm_gmtoff=''
909 d_tm_tm_zone=''
910 i_systime=''
911 i_systimek=''
912 i_time=''
913 timeincl=''
914 i_unistd=''
915 i_ustat=''
916 i_utime=''
917 i_values=''
918 i_stdarg=''
919 i_varargs=''
920 i_varhdr=''
921 i_vfork=''
922 inc_version_list=''
923 inc_version_list_init=''
924 installprefix=''
925 installprefixexp=''
926 installstyle=''
927 installusrbinperl=''
928 intsize=''
929 longsize=''
930 shortsize=''
931 issymlink=''
932 libc=''
933 ldlibpthname=''
934 libperl=''
935 shrpenv=''
936 useshrplib=''
937 glibpth=''
938 libpth=''
939 loclibpth=''
940 plibpth=''
941 xlibpth=''
942 ignore_versioned_solibs=''
943 libs=''
944 libsdirs=''
945 libsfiles=''
946 libsfound=''
947 libspath=''
948 lns=''
949 d_PRIEUldbl=''
950 d_PRIFUldbl=''
951 d_PRIGUldbl=''
952 d_PRIeldbl=''
953 d_PRIfldbl=''
954 d_PRIgldbl=''
955 d_SCNfldbl=''
956 sPRIEUldbl=''
957 sPRIFUldbl=''
958 sPRIGUldbl=''
959 sPRIeldbl=''
960 sPRIfldbl=''
961 sPRIgldbl=''
962 sSCNfldbl=''
963 lseeksize=''
964 lseektype=''
965 make_set_make=''
966 d_mymalloc=''
967 freetype=''
968 mallocobj=''
969 mallocsrc=''
970 malloctype=''
971 usemallocwrap=''
972 usemymalloc=''
973 installman1dir=''
974 man1dir=''
975 man1direxp=''
976 man1ext=''
977 installman3dir=''
978 man3dir=''
979 man3direxp=''
980 man3ext=''
981 modetype=''
982 multiarch=''
983 mydomain=''
984 myhostname=''
985 phostname=''
986 c=''
987 n=''
988 d_eofnblk=''
989 eagain=''
990 o_nonblock=''
991 rd_nodata=''
992 need_va_copy=''
993 netdb_hlen_type=''
994 netdb_host_type=''
995 netdb_name_type=''
996 netdb_net_type=''
997 groupcat=''
998 hostcat=''
999 passcat=''
1000 orderlib=''
1001 ranlib=''
1002 d_perl_otherlibdirs=''
1003 otherlibdirs=''
1004 package=''
1005 spackage=''
1006 pager=''
1007 api_revision=''
1008 api_subversion=''
1009 api_version=''
1010 api_versionstring=''
1011 patchlevel=''
1012 perl_patchlevel=''
1013 revision=''
1014 subversion=''
1015 version=''
1016 version_patchlevel_string=''
1017 perl5=''
1018 perladmin=''
1019 perlpath=''
1020 d_nv_preserves_uv=''
1021 d_nv_zero_is_allbits_zero=''
1022 i16size=''
1023 i16type=''
1024 i32size=''
1025 i32type=''
1026 i64size=''
1027 i64type=''
1028 i8size=''
1029 i8type=''
1030 ivsize=''
1031 ivtype=''
1032 nv_preserves_uv_bits=''
1033 nvsize=''
1034 nvtype=''
1035 u16size=''
1036 u16type=''
1037 u32size=''
1038 u32type=''
1039 u64size=''
1040 u64type=''
1041 u8size=''
1042 u8type=''
1043 uvsize=''
1044 uvtype=''
1045 ivdformat=''
1046 nvEUformat=''
1047 nvFUformat=''
1048 nvGUformat=''
1049 nveformat=''
1050 nvfformat=''
1051 nvgformat=''
1052 uvXUformat=''
1053 uvoformat=''
1054 uvuformat=''
1055 uvxformat=''
1056 pidtype=''
1057 prefix=''
1058 prefixexp=''
1059 installprivlib=''
1060 privlib=''
1061 privlibexp=''
1062 prototype=''
1063 ptrsize=''
1064 d_PRIXU64=''
1065 d_PRId64=''
1066 d_PRIi64=''
1067 d_PRIo64=''
1068 d_PRIu64=''
1069 d_PRIx64=''
1070 sPRIXU64=''
1071 sPRId64=''
1072 sPRIi64=''
1073 sPRIo64=''
1074 sPRIu64=''
1075 sPRIx64=''
1076 d_quad=''
1077 quadkind=''
1078 quadtype=''
1079 uquadtype=''
1080 drand01=''
1081 randbits=''
1082 randfunc=''
1083 randseedtype=''
1084 seedfunc=''
1085 installscript=''
1086 scriptdir=''
1087 scriptdirexp=''
1088 selectminbits=''
1089 selecttype=''
1090 sh=''
1091 sig_count=''
1092 sig_name=''
1093 sig_name_init=''
1094 sig_num=''
1095 sig_num_init=''
1096 sig_size=''
1097 installsitearch=''
1098 sitearch=''
1099 sitearchexp=''
1100 installsitebin=''
1101 sitebin=''
1102 sitebinexp=''
1103 installsitehtml1dir=''
1104 sitehtml1dir=''
1105 sitehtml1direxp=''
1106 installsitehtml3dir=''
1107 sitehtml3dir=''
1108 sitehtml3direxp=''
1109 installsitelib=''
1110 sitelib=''
1111 sitelib_stem=''
1112 sitelibexp=''
1113 installsiteman1dir=''
1114 siteman1dir=''
1115 siteman1direxp=''
1116 installsiteman3dir=''
1117 siteman3dir=''
1118 siteman3direxp=''
1119 siteprefix=''
1120 siteprefixexp=''
1121 installsitescript=''
1122 sitescript=''
1123 sitescriptexp=''
1124 sizesize=''
1125 sizetype=''
1126 so=''
1127 socksizetype=''
1128 sharpbang=''
1129 shsharp=''
1130 spitshell=''
1131 src=''
1132 ssizetype=''
1133 startperl=''
1134 startsh=''
1135 stdchar=''
1136 d_stdio_stream_array=''
1137 stdio_stream_array=''
1138 sysman=''
1139 trnl=''
1140 uidformat=''
1141 uidsign=''
1142 uidsize=''
1143 uidtype=''
1144 archname64=''
1145 use64bitall=''
1146 use64bitint=''
1147 usefaststdio=''
1148 ccflags_uselargefiles=''
1149 ldflags_uselargefiles=''
1150 libswanted_uselargefiles=''
1151 uselargefiles=''
1152 uselongdouble=''
1153 usemorebits=''
1154 usemultiplicity=''
1155 nm_opt=''
1156 nm_so_opt=''
1157 runnm=''
1158 usenm=''
1159 useperlio=''
1160 userelocatableinc=''
1161 usesocks=''
1162 mad=''
1163 d_oldpthreads=''
1164 use5005threads=''
1165 useithreads=''
1166 usereentrant=''
1167 usethreads=''
1168 incpath=''
1169 mips_type=''
1170 usrinc=''
1171 d_vendorarch=''
1172 installvendorarch=''
1173 vendorarch=''
1174 vendorarchexp=''
1175 d_vendorbin=''
1176 installvendorbin=''
1177 vendorbin=''
1178 vendorbinexp=''
1179 installvendorhtml1dir=''
1180 vendorhtml1dir=''
1181 vendorhtml1direxp=''
1182 installvendorhtml3dir=''
1183 vendorhtml3dir=''
1184 vendorhtml3direxp=''
1185 d_vendorlib=''
1186 installvendorlib=''
1187 vendorlib=''
1188 vendorlib_stem=''
1189 vendorlibexp=''
1190 installvendorman1dir=''
1191 vendorman1dir=''
1192 vendorman1direxp=''
1193 installvendorman3dir=''
1194 vendorman3dir=''
1195 vendorman3direxp=''
1196 usevendorprefix=''
1197 vendorprefix=''
1198 vendorprefixexp=''
1199 d_vendorscript=''
1200 installvendorscript=''
1201 vendorscript=''
1202 vendorscriptexp=''
1203 versiononly=''
1204 defvoidused=''
1205 voidflags=''
1206 yacc=''
1207 yaccflags=''
1208 CONFIG=''
1209
1210 define='define'
1211 undef='undef'
1212 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1213 rmlist=''
1214
1215 : We must find out about Eunice early
1216 eunicefix=':'
1217 if test -f /etc/unixtovms; then
1218         eunicefix=/etc/unixtovms
1219 fi
1220 if test -f /etc/unixtovms.exe; then
1221         eunicefix=/etc/unixtovms.exe
1222 fi
1223
1224 : Set executable suffix now -- needed before hints available
1225 if test -f "/libs/version.library"; then
1226 : Amiga OS
1227     _exe=""
1228 elif test -f "/system/gnu_library/bin/ar.pm"; then
1229 : Stratus VOS
1230     _exe=".pm"
1231 elif test -n "$DJGPP"; then
1232 : DOS DJGPP
1233     _exe=".exe"
1234 elif test -d c:/. -o -n "$is_os2" ; then
1235 : OS/2 or cygwin
1236     _exe=".exe"
1237 fi
1238
1239 i_whoami=''
1240 ccname=''
1241 ccversion=''
1242 perllibs=''
1243 : set useposix=false in your hint file to disable the POSIX extension.
1244 useposix=true
1245 : set useopcode=false in your hint file to disable the Opcode extension.
1246 useopcode=true
1247 : Trailing extension.  Override this in a hint file, if needed.
1248 : Extra object files, if any, needed on this platform.
1249 archobjs=''
1250 archname=''
1251 : Possible local include directories to search.
1252 : Set locincpth to "" in a hint file to defeat local include searches.
1253 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1254 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1255 :
1256 : no include file wanted by default
1257 inclwanted=''
1258
1259 groupstype=''
1260 libnames=''
1261 : change the next line if compiling for Xenix/286 on Xenix/386
1262 xlibpth='/usr/lib/386 /lib/386'
1263 : Possible local library directories to search.
1264 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1265 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1266
1267 : general looking path for locating libraries
1268 glibpth="/lib /usr/lib $xlibpth"
1269 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1270 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1271 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1272
1273 : Private path used by Configure to find libraries.  Its value
1274 : is prepended to libpth. This variable takes care of special
1275 : machines, like the mips.  Usually, it should be empty.
1276 plibpth=''
1277
1278 : default library list
1279 libswanted=''
1280 : some systems want to use only the non-versioned libso:s
1281 ignore_versioned_solibs=''
1282 siteman1dir=''
1283 siteman3dir=''
1284 sitescript=''
1285 archname64=''
1286 ccflags_uselargefiles=''
1287 ldflags_uselargefiles=''
1288 libswanted_uselargefiles=''
1289 : set usemultiplicity on the Configure command line to enable multiplicity.
1290 : set usesocks on the Configure command line to enable socks.
1291 : set usethreads on the Configure command line to enable threads.
1292 usereentrant='undef'
1293 : full support for void wanted by default
1294 defvoidused=15
1295
1296 : List of libraries we want.
1297 : If anyone needs extra -lxxx, put those in a hint file.
1298 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1299 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1300 : We probably want to search /usr/shlib before most other libraries.
1301 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1302 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1303 glibpth="/usr/shlib $glibpth"
1304 : Do not use vfork unless overridden by a hint file.
1305 usevfork=false
1306
1307 : Find the basic shell for Bourne shell scripts
1308 case "$sh" in
1309 '')
1310         case "$SYSTYPE" in
1311         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1312         *) xxx='/bin/sh';;
1313         esac
1314         if test -f "$xxx"; then
1315                 sh="$xxx"
1316         else
1317                 : Build up a list and do a single loop so we can 'break' out.
1318                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1319                 for xxx in sh bash ksh pdksh ash; do
1320                         for p in $pth; do
1321                                 try="$try ${p}/${xxx}"
1322                         done
1323                 done
1324                 for xxx in $try; do
1325                         if test -f "$xxx"; then
1326                                 sh="$xxx";
1327                                 break
1328                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1329                                 sh="$xxx";
1330                                 break
1331                         elif test -f "$xxx.exe"; then
1332                                 sh="$xxx";
1333                                 break
1334                         fi
1335                 done
1336         fi
1337         ;;
1338 esac
1339
1340 case "$sh" in
1341 '')     cat >&2 <<EOM
1342 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1343
1344 Usually it's in /bin/sh.  How did you even get this far?
1345 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1346 we'll try to straighten this all out.
1347 EOM
1348         exit 1
1349         ;;
1350 esac
1351
1352 : see if sh knows # comments
1353 if `$sh -c '#' >/dev/null 2>&1`; then
1354         shsharp=true
1355         spitshell=cat
1356         xcat=/bin/cat
1357         test -f $xcat$_exe || xcat=/usr/bin/cat
1358         if test ! -f $xcat$_exe; then
1359                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1360                         if test -f $p/cat$_exe; then
1361                                 xcat=$p/cat
1362                                 break
1363                         fi
1364                 done
1365                 if test ! -f $xcat$_exe; then
1366                         echo "Can't find cat anywhere!"
1367                         exit 1
1368                 fi
1369         fi
1370         echo "#!$xcat" >sharp
1371         $eunicefix sharp
1372         chmod +x sharp
1373         ./sharp > today
1374         if test -s today; then
1375                 sharpbang='#!'
1376         else
1377                 echo "#! $xcat" > sharp
1378                 $eunicefix sharp
1379                 chmod +x sharp
1380                 ./sharp > today
1381                 if test -s today; then
1382                         sharpbang='#! '
1383                 else
1384                         sharpbang=': use '
1385                 fi
1386         fi
1387 else
1388         echo " "
1389         echo "Your $sh doesn't grok # comments--I will strip them later on."
1390         shsharp=false
1391         cd ..
1392         echo "exec grep -v '^[  ]*#'" >spitshell
1393         chmod +x spitshell
1394         $eunicefix spitshell
1395         spitshell=`pwd`/spitshell
1396         cd UU
1397         echo "I presume that if # doesn't work, #! won't work either!"
1398         sharpbang=': use '
1399 fi
1400 rm -f sharp today
1401
1402 : figure out how to guarantee sh startup
1403 case "$startsh" in
1404 '') startsh=${sharpbang}${sh} ;;
1405 *)
1406 esac
1407 cat >sharp <<EOSS
1408 $startsh
1409 set abc
1410 test "$?abc" != 1
1411 EOSS
1412
1413 chmod +x sharp
1414 $eunicefix sharp
1415 if ./sharp; then
1416         : echo "Yup, it does."
1417 else
1418         echo "Hmm... '$startsh' does not guarantee sh startup..."
1419         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1420 fi
1421 rm -f sharp
1422
1423
1424 : Save command line options in file UU/cmdline.opt for later use in
1425 : generating config.sh.
1426 cat > cmdline.opt <<EOSH
1427 # Configure command line arguments.
1428 config_arg0='$0'
1429 config_args='$*'
1430 config_argc=$#
1431 EOSH
1432 argn=1
1433 args_exp=''
1434 args_sep=''
1435 for arg in "$@"; do
1436         cat >>cmdline.opt <<EOSH
1437 config_arg$argn='$arg'
1438 EOSH
1439         # Extreme backslashitis: replace each ' by '"'"'
1440         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1441 $arg
1442 EOC
1443         arg_exp=`cat cmdl.opt`
1444         args_exp="$args_exp$args_sep'$arg_exp'"
1445         argn=`expr $argn + 1`
1446         args_sep=' '
1447 done
1448 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1449 # used by ./hints/os2.sh
1450 rm -f cmdl.opt
1451
1452 : produce awk script to parse command line options
1453 cat >options.awk <<'EOF'
1454 BEGIN {
1455         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1456
1457         len = length(optstr);
1458         for (i = 1; i <= len; i++) {
1459                 c = substr(optstr, i, 1);
1460                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1461                 if (a == ":") {
1462                         arg[c] = 1;
1463                         i++;
1464                 }
1465                 opt[c] = 1;
1466         }
1467 }
1468 {
1469         expect = 0;
1470         str = $0;
1471         if (substr(str, 1, 1) != "-") {
1472                 printf("'%s'\n", str);
1473                 next;
1474         }
1475         len = length($0);
1476         for (i = 2; i <= len; i++) {
1477                 c = substr(str, i, 1);
1478                 if (!opt[c]) {
1479                         printf("-%s\n", substr(str, i));
1480                         next;
1481                 }
1482                 printf("-%s\n", c);
1483                 if (arg[c]) {
1484                         if (i < len)
1485                                 printf("'%s'\n", substr(str, i + 1));
1486                         else
1487                                 expect = 1;
1488                         next;
1489                 }
1490         }
1491 }
1492 END {
1493         if (expect)
1494                 print "?";
1495 }
1496 EOF
1497
1498 : process the command line options
1499 set X `for arg in "$@"; do echo "X$arg"; done |
1500         sed -e s/X// | awk -f options.awk`
1501 eval "set $*"
1502 shift
1503 rm -f options.awk
1504
1505 : set up default values
1506 fastread=''
1507 reuseval=false
1508 config_sh=''
1509 alldone=''
1510 error=''
1511 silent=''
1512 extractsh=''
1513 override=''
1514 knowitall=''
1515 rm -f optdef.sh posthint.sh
1516 cat >optdef.sh <<EOS
1517 $startsh
1518 EOS
1519
1520
1521 : option parsing
1522 while test $# -gt 0; do
1523         case "$1" in
1524         -d) shift; fastread=yes;;
1525         -e) shift; alldone=cont;;
1526         -f)
1527                 shift
1528                 cd ..
1529                 if test -r "$1"; then
1530                         config_sh="$1"
1531                 else
1532                         echo "$me: cannot read config file $1." >&2
1533                         error=true
1534                 fi
1535                 cd UU
1536                 shift;;
1537         -h) shift; error=true;;
1538         -r) shift; reuseval=true;;
1539         -s) shift; silent=true; realsilent=true;;
1540         -E) shift; alldone=exit;;
1541         -K) shift; knowitall=true;;
1542         -O) shift; override=true;;
1543         -S) shift; silent=true; extractsh=true;;
1544         -D)
1545                 shift
1546                 case "$1" in
1547                 *=)
1548                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1549                         echo "$me: ignoring -D $1" >&2
1550                         ;;
1551                 *=*) echo "$1" | \
1552                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1553                 *) echo "$1='define'" >> optdef.sh;;
1554                 esac
1555                 shift
1556                 ;;
1557         -U)
1558                 shift
1559                 case "$1" in
1560                 *=) echo "$1" >> optdef.sh;;
1561                 *=*)
1562                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1563                         echo "$me: ignoring -U $1" >&2
1564                         ;;
1565                 *) echo "$1='undef'" >> optdef.sh;;
1566                 esac
1567                 shift
1568                 ;;
1569         -A)
1570             shift
1571             xxx=''
1572             yyy="$1"
1573             zzz=''
1574             uuu=undef
1575             case "$yyy" in
1576             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1577                  case "$zzz" in
1578                  *:*) zzz='' ;;
1579                  *)   xxx=append
1580                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1581                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1582                  esac
1583                  ;;
1584             esac
1585             case "$xxx" in
1586             '')  case "$yyy" in
1587                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1588                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1589                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1590                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1591                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1592                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1593                  esac
1594                  ;;       
1595             esac
1596             case "$xxx" in
1597             append)
1598                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1599             clear)
1600                 echo "$yyy=''"                  >> posthint.sh ;;
1601             define)
1602                 case "$zzz" in
1603                 '') zzz=define ;;
1604                 esac
1605                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1606             eval)
1607                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1608             prepend)
1609                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1610             undef)
1611                 case "$zzz" in
1612                 '') zzz="$uuu" ;;
1613                 esac
1614                 echo "$yyy=$zzz"                >> posthint.sh ;;
1615             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1616             esac
1617             shift
1618             ;;
1619         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1620             exit 0;;
1621         --) break;;
1622         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1623         *) break;;
1624         esac
1625 done
1626
1627 case "$error" in
1628 true)
1629         cat >&2 <<EOM
1630 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1631                  [-U symbol] [-U symbol=] [-A command:symbol...]
1632   -d : use defaults for all answers.
1633   -e : go on without questioning past the production of config.sh.
1634   -f : specify an alternate default configuration file.
1635   -h : print this help message and exit (with an error status).
1636   -r : reuse C symbols value if possible (skips costly nm extraction).
1637   -s : silent mode, only echoes questions and essential information.
1638   -D : define symbol to have some value:
1639          -D symbol         symbol gets the value 'define'
1640          -D symbol=value   symbol gets the value 'value'
1641   -E : stop at the end of questions, after having produced config.sh.
1642   -K : do not use unless you know what you are doing.
1643   -O : let -D and -U override definitions from loaded configuration file.
1644   -S : perform variable substitutions on all .SH files (can mix with -f)
1645   -U : undefine symbol:
1646          -U symbol    symbol gets the value 'undef'
1647          -U symbol=   symbol gets completely empty
1648   -A : manipulate symbol after the platform specific hints have been applied:
1649          -A symbol=value                append " "value to symbol
1650          -A append:symbol=value         append value to symbol
1651          -A define:symbol=value         define symbol to have value
1652          -A clear:symbol                define symbol to be ''
1653          -A define:symbol               define symbol to be 'define'
1654          -A eval:symbol=value           define symbol to be eval of value
1655          -A prepend:symbol=value        prepend value to symbol
1656          -A undef:symbol                define symbol to be 'undef'
1657          -A undef:symbol=               define symbol to be ''
1658   -V : print version number and exit (with a zero status).
1659 EOM
1660         exit 1
1661         ;;
1662 esac
1663
1664 : Sanity checks
1665 case "$fastread$alldone" in
1666 yescont|yesexit) ;;
1667 *)
1668         case "$extractsh" in
1669         true) ;;
1670         *)
1671                 if test ! -t 0; then
1672                         echo "Say 'sh Configure', not 'sh <Configure'"
1673                         exit 1
1674                 fi
1675                 ;;
1676         esac
1677         ;;
1678 esac
1679
1680 exec 4>&1
1681 case "$silent" in
1682 true) exec 1>/dev/null;;
1683 esac
1684
1685 : run the defines and the undefines, if any, but leave the file out there...
1686 touch optdef.sh
1687 . ./optdef.sh
1688 : create the posthint manipulation script and leave the file out there...
1689 touch posthint.sh
1690
1691 : set package name
1692 package=perl5
1693 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1694 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1695 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1696 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1697 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1698 esac
1699
1700 : Some greps do not return status, grrr.
1701 echo "grimblepritz" >grimble
1702 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1703         contains=contains
1704 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1705         contains=grep
1706 else
1707         contains=contains
1708 fi
1709 rm -f grimble
1710 : the following should work in any shell
1711 case "$contains" in
1712 contains*)
1713         echo " "
1714         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1715         cat >contains <<'EOSS'
1716 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1717 EOSS
1718 chmod +x contains
1719 esac
1720
1721 : Find the path to the source tree
1722 case "$src" in
1723 '') case "$0" in
1724     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1725          case "$src" in
1726          /*)    ;;
1727          .)     ;;
1728          *)     src=`cd ../$src && pwd` ;;
1729          esac
1730          ;;
1731     *)   src='.';;
1732     esac;;
1733 esac
1734 case "$src" in
1735 '')     src=/
1736         rsrc=/
1737         ;;
1738 /*) rsrc="$src";;
1739 *) rsrc="../$src";;
1740 esac
1741 if test -f $rsrc/Configure && \
1742         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1743 then
1744    : found it, so we are ok.
1745 else
1746         rsrc=''
1747         for src in . .. ../.. ../../.. ../../../..; do
1748                 if test -f ../$src/Configure && \
1749                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1750                 then
1751                         rsrc=../$src
1752                         break
1753                 fi
1754         done
1755 fi
1756 case "$rsrc" in
1757 '')
1758         cat <<EOM >&4
1759
1760 Sorry, I can't seem to locate the source dir for $package.  Please start
1761 Configure with an explicit path -- i.e. /some/path/Configure.
1762
1763 EOM
1764         exit 1
1765         ;;
1766 ../.)   rsrc='..';;
1767 *)
1768         echo " "
1769         echo "Sources for $package found in \"$src\"." >&4
1770         ;;
1771 esac
1772
1773 : script used to extract .SH files with variable substitutions
1774 cat >extract <<'EOS'
1775 PERL_CONFIG_SH=true
1776 echo "Doing variable substitutions on .SH files..."
1777 if test -f MANIFEST; then
1778         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1779 else
1780         echo "(Looking for .SH files under the source directory.)"
1781         set x `(cd "$src"; find . -name "*.SH" -print)`
1782 fi
1783 shift
1784 case $# in
1785 0) set x `(cd "$src"; echo *.SH)`; shift;;
1786 esac
1787 if test ! -f "$src/$1"; then
1788         shift
1789 fi
1790 mkdir_p='
1791 name=$1;
1792 create="";
1793 while test $name; do
1794         if test ! -d "$name"; then
1795                 create="$name $create";
1796                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1797                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1798         else
1799                 name="";
1800         fi;
1801 done;
1802 for file in $create; do
1803         mkdir $file;
1804 done
1805 '
1806 for file in $*; do
1807         case "$src" in
1808         ".")
1809                 case "$file" in
1810                 */*)
1811                         dir=`expr X$file : 'X\(.*\)/'`
1812                         file=`expr X$file : 'X.*/\(.*\)'`
1813                         (cd "$dir" && . ./$file)
1814                         ;;
1815                 *)
1816                         . ./$file
1817                         ;;
1818                 esac
1819                 ;;
1820         *)
1821                 case "$file" in
1822                 */*)
1823                         dir=`expr X$file : 'X\(.*\)/'`
1824                         file=`expr X$file : 'X.*/\(.*\)'`
1825                         (set x $dir; shift; eval $mkdir_p)
1826                         sh <"$src/$dir/$file"
1827                         ;;
1828                 *)
1829                         sh <"$src/$file"
1830                         ;;
1831                 esac
1832                 ;;
1833         esac
1834 done
1835 if test -f "$src/config_h.SH"; then
1836         if test ! -f config.h; then
1837         : oops, they left it out of MANIFEST, probably, so do it anyway.
1838         . "$src/config_h.SH"
1839         fi
1840 fi
1841 EOS
1842
1843 : extract files and exit if asked to do so
1844 case "$extractsh" in
1845 true)
1846         case "$realsilent" in
1847         true) ;;
1848         *) exec 1>&4;;
1849         esac
1850         case "$config_sh" in
1851         '') config_sh='config.sh';;
1852         esac
1853         echo " "
1854         echo "Fetching answers from $config_sh..."
1855         cd ..
1856         . $config_sh
1857         test "$override" && . ./optdef.sh
1858         echo " "
1859         . UU/extract
1860         rm -rf UU
1861         echo "Extraction done."
1862         exit 0
1863         ;;
1864 esac
1865
1866 : Eunice requires " " instead of "", can you believe it
1867 echo " "
1868 : Here we go...
1869 echo "Beginning of configuration questions for $package."
1870
1871 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1872
1873 : first determine how to suppress newline on echo command
1874 echo " "
1875 echo "Checking echo to see how to suppress newlines..."
1876 (echo "hi there\c" ; echo " ") >.echotmp
1877 if $contains c .echotmp >/dev/null 2>&1 ; then
1878         echo "...using -n."
1879         n='-n'
1880         c=''
1881 else
1882         cat <<'EOM'
1883 ...using \c
1884 EOM
1885         n=''
1886         c='\c'
1887 fi
1888 echo $n "The star should be here-->$c"
1889 echo '*'
1890 rm -f .echotmp
1891
1892 : Now test for existence of everything in MANIFEST
1893 echo " "
1894 if test -f "$rsrc/MANIFEST"; then
1895         echo "First let's make sure your kit is complete.  Checking..." >&4
1896         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1897         rm -f missing
1898         tmppwd=`pwd`
1899         for filelist in x??; do
1900                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1901         done
1902         if test -s missing; then
1903                 cat missing >&4
1904                 cat >&4 <<'EOM'
1905
1906 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1907
1908 You have the option of continuing the configuration process, despite the
1909 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1910 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1911 and contact the author (perlbug@perl.org).
1912
1913 EOM
1914                 echo $n "Continue? [n] $c" >&4
1915                 read ans
1916                 case "$ans" in
1917                 y*)
1918                         echo "Continuing..." >&4
1919                         rm -f missing
1920                         ;;
1921                 *)
1922                         echo "ABORTING..." >&4
1923                         kill $$
1924                         ;;
1925                 esac
1926         else
1927                 echo "Looks good..."
1928         fi
1929 else
1930         echo "There is no MANIFEST file.  I hope your kit is complete !"
1931 fi
1932 rm -f missing x??
1933
1934 echo " "
1935 : Find the appropriate value for a newline for tr
1936 if test -n "$DJGPP"; then
1937        trnl='\012'
1938 fi
1939 if test X"$trnl" = X; then
1940         case "`echo foo|tr '\n' x 2>/dev/null`" in
1941         foox) trnl='\n' ;;
1942         esac
1943 fi
1944 if test X"$trnl" = X; then
1945         case "`echo foo|tr '\012' x 2>/dev/null`" in
1946         foox) trnl='\012' ;;
1947         esac
1948 fi
1949 if test X"$trnl" = X; then
1950        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1951        fooxy) trnl='\n\r' ;;
1952        esac
1953 fi
1954 if test X"$trnl" = X; then
1955         cat <<EOM >&2
1956
1957 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1958
1959 EOM
1960         exit 1
1961 fi
1962
1963 : compute the number of columns on the terminal for proper question formatting
1964 case "$COLUMNS" in
1965 '') COLUMNS='80';;
1966 esac
1967
1968 : set up the echo used in my read
1969 myecho="case \"\$xxxm\" in
1970 '') echo $n \"\$rp $c\" >&4;;
1971 *) case \"\$rp\" in
1972         '') echo $n \"[\$xxxm] $c\";;
1973         *)
1974                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1975                         echo \"\$rp\" >&4
1976                         echo $n \"[\$xxxm] $c\" >&4
1977                 else
1978                         echo $n \"\$rp [\$xxxm] $c\" >&4
1979                 fi
1980                 ;;
1981         esac;;
1982 esac"
1983
1984 : now set up to do reads with possible shell escape and default assignment
1985 cat <<EOSC >myread
1986 $startsh
1987 xxxm=\$dflt
1988 $myecho
1989 ans='!'
1990 case "\$fastread" in
1991 yes) case "\$dflt" in
1992         '') ;;
1993         *) ans='';
1994                 case "\$silent-\$rp" in
1995                 true-) ;;
1996                 *) echo " " >&4;;
1997                 esac;;
1998         esac;;
1999 *) case "\$silent" in
2000         true) case "\$rp" in
2001                 '') ans='';;
2002                 esac;;
2003         esac;;
2004 esac
2005 while expr "X\$ans" : "X!" >/dev/null; do
2006         read answ
2007         set x \$xxxm
2008         shift
2009         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2010         case  "\$answ" in
2011         "!")
2012                 sh 1>&4
2013                 echo " "
2014                 $myecho
2015                 ;;
2016         !*)
2017                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2018                 shift
2019                 sh 1>&4 -c "\$*"
2020                 echo " "
2021                 $myecho
2022                 ;;
2023         "\$ans")
2024                 case "\$ans" in
2025                 \\&*)
2026                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2027                         shift
2028                         case "\$1" in
2029                         -d)
2030                                 fastread=yes
2031                                 echo "(OK, I'll run with -d after this question.)" >&4
2032                                 ;;
2033                         -*)
2034                                 echo "*** Sorry, \$1 not supported yet." >&4
2035                                 ;;
2036                         esac
2037                         $myecho
2038                         ans=!
2039                         ;;
2040                 esac;;
2041         *)
2042                 case "\$aok" in
2043                 y)
2044                         echo "*** Substitution done -- please confirm."
2045                         xxxm="\$ans"
2046                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2047                         xxxm="\$ans"
2048                         ans=!
2049                         ;;
2050                 *)
2051                         echo "*** Error -- try again."
2052                         ans=!
2053                         ;;
2054                 esac
2055                 $myecho
2056                 ;;
2057         esac
2058         case "\$ans\$xxxm\$nostick" in
2059         '')
2060                 ans=!
2061                 $myecho
2062                 ;;
2063         esac
2064 done
2065 case "\$ans" in
2066 '') ans="\$xxxm";;
2067 esac
2068 EOSC
2069
2070 : create .config dir to save info across Configure sessions
2071 test -d ../.config || mkdir ../.config
2072 cat >../.config/README <<EOF
2073 This directory created by Configure to save information that should
2074 persist across sessions for $package.
2075
2076 You may safely delete it if you wish.
2077 EOF
2078
2079 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2080 case "$usedevel" in
2081 $define|true|[yY]*) ;;
2082 *) case "$xversion" in
2083    *[13579])
2084         cat >&4 <<EOH
2085 *** WHOA THERE!!! ***
2086
2087     This is an UNSTABLE DEVELOPMENT release.
2088     The version of this $package distribution is $xversion, that is, odd,
2089     (as opposed to even) and that signifies a development release.
2090     If you want a maintenance release, you want an even-numbered version.
2091
2092     Do ***NOT*** install this into production use.
2093     Data corruption and crashes are possible.
2094
2095     It is most seriously suggested that you do not continue any further
2096     unless you want to help in developing and debugging Perl.
2097
2098     If you *still* want to build perl, you can answer 'y' now,
2099     or pass -Dusedevel to Configure.
2100
2101 EOH
2102         rp='Do you really want to continue?'
2103         dflt='n'
2104         . ./myread
2105         case "$ans" in
2106         [yY]) echo >&4 "Okay, continuing."
2107               usedevel="$define" ;;
2108         *) echo >&4 "Okay, bye."
2109            exit 1
2110            ;;
2111         esac
2112         ;;
2113     esac
2114     ;;
2115 esac
2116 case "$usedevel" in
2117 $define|true|[yY]*)
2118         case "$versiononly" in
2119         '') versiononly="$define" ;;
2120         esac
2121         case "$installusrbinperl" in
2122         '') installusrbinperl="$undef" ;;
2123         esac
2124         ;;
2125 esac
2126
2127 : general instructions
2128 needman=true
2129 firsttime=true
2130 user=`(logname) 2>/dev/null`
2131 case "$user" in
2132 '') user=`whoami 2>&1`;;
2133 esac
2134 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2135         firsttime=false
2136         echo " "
2137         rp='Would you like to see the instructions?'
2138         dflt=n
2139         . ./myread
2140         case "$ans" in
2141         [yY]*) ;;
2142         *) needman=false;;
2143         esac
2144 fi
2145 if $needman; then
2146         cat <<EOH
2147
2148 This installation shell script will examine your system and ask you questions
2149 to determine how the perl5 package should be installed. If you get
2150 stuck on a question, you may use a ! shell escape to start a subshell or
2151 execute a command.  Many of the questions will have default answers in square
2152 brackets; typing carriage return will give you the default.
2153
2154 On some of the questions which ask for file or directory names you are allowed
2155 to use the ~name construct to specify the login directory belonging to "name",
2156 even if you don't have a shell which knows about that.  Questions where this is
2157 allowed will be marked "(~name ok)".
2158
2159 EOH
2160         rp=''
2161         dflt='Type carriage return to continue'
2162         . ./myread
2163         cat <<'EOH'
2164
2165 The prompter used in this script allows you to use shell variables and
2166 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2167 in the default answer, as if the default line was a set of arguments given to a
2168 script shell.  This means you may also use $* to repeat the whole default line,
2169 so you do not have to re-type everything to add something to the default.
2170
2171 Everytime there is a substitution, you will have to confirm.  If there is an
2172 error (e.g. an unmatched backtick), the default answer will remain unchanged
2173 and you will be prompted again.
2174
2175 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2176 the questions and use the computed defaults (or the previous answers if there
2177 was already a config.sh file). Type 'Configure -h' for a list of options.
2178 You may also start interactively and then answer '& -d' at any prompt to turn
2179 on the non-interactive behaviour for the remainder of the execution.
2180
2181 EOH
2182         . ./myread
2183         cat <<EOH
2184
2185 Much effort has been expended to ensure that this shell script will run on any
2186 Unix system.  If despite that it blows up on yours, your best bet is to edit
2187 Configure and run it again.  If you can't run Configure for some reason,
2188 you'll have to generate a config.sh file by hand.  Whatever problems you
2189 have, let me (perlbug@perl.org) know how I blew it.
2190
2191 This installation script affects things in two ways:
2192
2193 1) it may do direct variable substitutions on some of the files included
2194    in this kit.
2195 2) it builds a config.h file for inclusion in C programs.  You may edit
2196    any of these files as the need arises after running this script.
2197
2198 If you make a mistake on a question, there is no easy way to back up to it
2199 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2200 files.  Configure will offer to let you do this before it runs the SH files.
2201
2202 EOH
2203         dflt='Type carriage return to continue'
2204         . ./myread
2205         case "$firsttime" in
2206         true) echo $user >>../.config/instruct;;
2207         esac
2208 fi
2209
2210 : find out where common programs are
2211 echo " "
2212 echo "Locating common programs..." >&4
2213 cat <<EOSC >loc
2214 $startsh
2215 case \$# in
2216 0) exit 1;;
2217 esac
2218 thing=\$1
2219 shift
2220 dflt=\$1
2221 shift
2222 for dir in \$*; do
2223         case "\$thing" in
2224         .)
2225         if test -d \$dir/\$thing; then
2226                 echo \$dir
2227                 exit 0
2228         fi
2229         ;;
2230         *)
2231         for thisthing in \$dir/\$thing; do
2232                 : just loop through to pick last item
2233         done
2234         if test -f \$thisthing; then
2235                 echo \$thisthing
2236                 exit 0
2237         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2238                 echo \$thisthing
2239                 exit 0
2240         elif test -f \$dir/\$thing.exe; then
2241                 if test -n "$DJGPP"; then
2242                         echo \$dir/\$thing.exe
2243                 elif test "$eunicefix" != ":"; then
2244                         : on Eunice apparently
2245                         echo \$dir/\$thing
2246                         exit 0
2247                 fi
2248                 exit 0
2249         fi
2250         ;;
2251         esac
2252 done
2253 echo \$dflt
2254 exit 1
2255 EOSC
2256 chmod +x loc
2257 $eunicefix loc
2258 loclist="
2259 awk
2260 cat
2261 chmod
2262 comm
2263 cp
2264 echo
2265 expr
2266 grep
2267 ls
2268 mkdir
2269 rm
2270 sed
2271 sort
2272 touch
2273 tr
2274 uniq
2275 "
2276 trylist="
2277 Mcc
2278 ar
2279 bison
2280 byacc
2281 cpp
2282 csh
2283 date
2284 egrep
2285 gmake
2286 gzip
2287 less
2288 ln
2289 make
2290 more
2291 nm
2292 nroff
2293 pg
2294 test
2295 uname
2296 zip
2297 "
2298 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2299 pth="$pth /lib /usr/lib"
2300 for file in $loclist; do
2301         eval xxx=\$$file
2302         case "$xxx" in
2303         /*|?:[\\/]*)
2304                 if test -f "$xxx"; then
2305                         : ok
2306                 else
2307                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2308                         xxx=`./loc $file $file $pth`
2309                 fi
2310                 ;;
2311         '') xxx=`./loc $file $file $pth`;;
2312         *) xxx=`./loc $xxx $xxx $pth`;;
2313         esac
2314         eval $file=$xxx$_exe
2315         eval _$file=$xxx
2316         case "$xxx" in
2317         /*)
2318                 echo $file is in $xxx.
2319                 ;;
2320         ?:[\\/]*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         *)
2324                 echo "I don't know where '$file' is, and my life depends on it." >&4
2325                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2326                 exit 1
2327                 ;;
2328         esac
2329 done
2330 echo " "
2331 echo "Don't worry if any of the following aren't found..."
2332 say=offhand
2333 for file in $trylist; do
2334         eval xxx=\$$file
2335         case "$xxx" in
2336         /*|?:[\\/]*)
2337                 if test -f "$xxx"; then
2338                         : ok
2339                 else
2340                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2341                         xxx=`./loc $file $file $pth`
2342                 fi
2343                 ;;
2344         '') xxx=`./loc $file $file $pth`;;
2345         *) xxx=`./loc $xxx $xxx $pth`;;
2346         esac
2347         eval $file=$xxx$_exe
2348         eval _$file=$xxx
2349         case "$xxx" in
2350         /*)
2351                 echo $file is in $xxx.
2352                 ;;
2353         ?:[\\/]*)
2354                 echo $file is in $xxx.
2355                 ;;
2356         *)
2357                 echo "I don't see $file out there, $say."
2358                 say=either
2359                 ;;
2360         esac
2361 done
2362 case "$egrep" in
2363 egrep)
2364         echo "Substituting grep for egrep."
2365         egrep=$grep
2366         _egrep=$grep
2367         ;;
2368 esac
2369 case "$ln" in
2370 ln)
2371         echo "Substituting cp for ln."
2372         ln=$cp
2373         _ln=$cp
2374         ;;
2375 esac
2376 case "$make" in
2377 make)   
2378         case "$gmake" in
2379         gmake)
2380         echo "I can't find make or gmake, and my life depends on it." >&4
2381         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2382         exit 1
2383         ;;
2384         esac
2385         ;;
2386 esac    
2387 case "$gmake" in
2388 gmake)  ;;
2389 *)      # We can't have osname yet.
2390         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2391                 # Assume that gmake, if found, is definitely GNU make
2392                 # and prefer it over the system make.
2393                 echo "Substituting gmake for make."
2394                 make=$gmake
2395                 _make=$gmake
2396         fi
2397         ;;
2398 esac
2399 case "$test" in
2400 test)
2401         echo "Hopefully test is built into your sh."
2402         ;;
2403 *)
2404         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2405                 echo "Using the test built into your sh."
2406                 test=test
2407                 _test=test
2408         fi
2409         ;;
2410 esac
2411 case "$echo" in
2412 echo)
2413         echo "Hopefully echo is built into your sh."
2414         ;;
2415 '') ;;
2416 *)
2417         echo " "
2418 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2419         $echo $n "hi there$c" >foo1
2420         echo $n "hi there$c" >foo2
2421         if cmp foo1 foo2 >/dev/null 2>&1; then
2422                 echo "They are compatible.  In fact, they may be identical."
2423         else
2424                 case "$n" in
2425                 '-n') n='' c='\c';;
2426                 *) n='-n' c='';;
2427                 esac
2428                 cat <<FOO
2429 They are not compatible!  You are probably running ksh on a non-USG system.
2430 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2431 have echo built in and we may have to run some Bourne shell scripts.  That
2432 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2433
2434 FOO
2435                 $echo $n "The star should be here-->$c"
2436                 $echo "*"
2437         fi
2438         $rm -f foo1 foo2
2439         ;;
2440 esac
2441
2442 cat <<EOS >trygcc
2443 $startsh
2444 EOS
2445 cat <<'EOSC' >>trygcc
2446 case "$cc" in
2447 '') ;;
2448 *)  $rm -f try try.*
2449     $cat >try.c <<EOM
2450 int main(int argc, char *argv[]) {
2451   return 0;
2452 }
2453 EOM
2454     if $cc -o try $ccflags $ldflags try.c; then
2455        :
2456     else
2457         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2458         despair=yes
2459         trygcc=yes
2460         case "$cc" in
2461         *gcc*) trygcc=no ;;
2462         esac
2463         case "`$cc -v -c try.c 2>&1`" in
2464         *gcc*) trygcc=no ;;
2465         esac
2466         if $test X"$trygcc" = Xyes; then
2467             if gcc -o try -c try.c; then
2468                 echo " "
2469                 echo "You seem to have a working gcc, though." >&4
2470                 rp="Would you like to use it?"
2471                 dflt=y
2472                 if $test -f myread; then
2473                     . ./myread
2474                 else
2475                     if $test -f UU/myread; then
2476                         . ./UU/myread
2477                     else
2478                         echo "Cannot find myread, sorry.  Aborting." >&2
2479                         exit 1
2480                     fi
2481                 fi  
2482                 case "$ans" in
2483                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2484                        if $test -f usethreads.cbu; then
2485                            $cat >&4 <<EOM 
2486
2487 *** However, any setting of the C compiler flags (e.g. for thread support)
2488 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2489 *** (together with e.g. -Dusethreads).
2490
2491 EOM
2492                        fi;;
2493                 esac
2494             fi
2495         fi
2496     fi
2497     $rm -f try try.*
2498     ;;
2499 esac
2500 EOSC
2501
2502 cat <<EOS >checkcc
2503 $startsh
2504 EOS
2505 cat <<'EOSC' >>checkcc
2506 case "$cc" in        
2507 '') ;;
2508 *)  $rm -f try try.*              
2509     $cat >try.c <<EOM
2510 int main(int argc, char *argv[]) {
2511   return 0;
2512 }
2513 EOM
2514     if $cc -o try $ccflags $ldflags try.c; then
2515        :
2516     else
2517         if $test X"$despair" = Xyes; then
2518            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2519         fi
2520         $cat >&4 <<EOM         
2521 You need to find a working C compiler.
2522 Either (purchase and) install the C compiler supplied by your OS vendor,
2523 or for a free C compiler try http://gcc.gnu.org/
2524 I cannot continue any further, aborting.
2525 EOM
2526         exit 1
2527     fi
2528     $rm -f try try.*
2529     ;;
2530 esac
2531 EOSC
2532
2533 : determine whether symbolic links are supported
2534 echo " "
2535 $touch blurfl
2536 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2537         echo "Symbolic links are supported." >&4
2538         lns="$ln -s"
2539 else
2540         echo "Symbolic links are NOT supported." >&4
2541         lns="$ln"
2542 fi
2543 $rm -f blurfl sym
2544
2545 : determine whether symbolic links are supported
2546 echo " "
2547 case "$lns" in
2548 *"ln"*" -s")
2549         echo "Checking how to test for symbolic links..." >&4
2550         $lns blurfl sym
2551         if $test "X$issymlink" = X; then
2552                 case "$newsh" in
2553                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2554                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2555                 esac
2556                 if test $? = 0; then
2557                         issymlink="test -h"
2558                 else
2559                         echo "Your builtin 'test -h' may be broken." >&4
2560                         case "$test" in
2561                         /*)     ;;
2562                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2563                                 for p in $pth
2564                                 do
2565                                         if test -f "$p/$test"; then
2566                                                 test="$p/$test"
2567                                                 break
2568                                         fi
2569                                 done
2570                                 ;;
2571                         esac
2572                         case "$test" in
2573                         /*)
2574                                 echo "Trying external '$test -h'." >&4
2575                                 issymlink="$test -h"
2576                                 if $test ! -h sym >/dev/null 2>&1; then
2577                                         echo "External '$test -h' is broken, too." >&4
2578                                         issymlink=''
2579                                 fi
2580                                 ;;
2581                         *)      issymlink='' ;;
2582                         esac
2583                 fi              
2584         fi
2585         if $test "X$issymlink" = X; then
2586                 if $test -L sym 2>/dev/null; then
2587                         issymlink="$test -L"
2588                         echo "The builtin '$test -L' worked." >&4
2589                 fi
2590         fi
2591         if $test "X$issymlink" != X; then
2592                 echo "You can test for symbolic links with '$issymlink'." >&4
2593         else
2594                 echo "I do not know how you can test for symbolic links." >&4
2595         fi
2596         $rm -f blurfl sym
2597         ;;
2598 *)      echo "No symbolic links, so not testing for their testing..." >&4
2599         ;;
2600 esac
2601 echo " "
2602
2603
2604 case "$mksymlinks" in
2605 $define|true|[yY]*)
2606         case "$src" in
2607         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2608                 exit 1
2609                 ;;
2610         *)      case "$lns:$issymlink" in
2611                 *"ln"*" -s:"*"test -"?)
2612                         echo "Creating the symbolic links..." >&4
2613                         echo "(First creating the subdirectories...)" >&4
2614                         cd ..
2615                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2616                                 read directory
2617                                 test -z "$directory" && break
2618                                 mkdir -p $directory
2619                         done
2620                         # Sanity check 1.
2621                         if test ! -d t/base; then
2622                                 echo "Failed to create the subdirectories.  Aborting." >&4
2623                                 exit 1
2624                         fi
2625                         echo "(Then creating the symlinks...)" >&4
2626                         awk '{print $1}' $src/MANIFEST | while true; do
2627                                 read filename
2628                                 test -z "$filename" && break
2629                                 if test -f $filename; then
2630                                         if $issymlink $filename; then
2631                                                 rm -f $filename
2632                                         fi
2633                                 fi
2634                                 if test -f $filename; then
2635                                         echo "$filename already exists, not symlinking."
2636                                 else
2637                                         ln -s $src/$filename $filename
2638                                 fi
2639                         done
2640                         # Sanity check 2.
2641                         if test ! -f t/base/lex.t; then
2642                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2643                                 exit 1
2644                         fi
2645                         cd UU
2646                         ;;
2647                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2648                         ;;
2649                 esac
2650                 ;;
2651         esac
2652         ;;
2653 esac
2654
2655
2656 case "$usecrosscompile" in
2657 $define|true|[yY]*)
2658         $echo "Cross-compiling..."
2659         croak=''
2660         case "$cc" in
2661         *-*-gcc) # A cross-compiling gcc, probably.
2662             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2663             ar=$targetarch-ar
2664             # leave out ld, choosing it is more complex
2665             nm=$targetarch-nm
2666             ranlib=$targetarch-ranlib
2667             $echo 'extern int foo;' > try.c
2668             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2669             shift
2670             if $test $# -gt 0; then
2671                 incpth="$incpth $*"
2672                 incpth="`$echo $incpth|$sed 's/^ //'`"
2673                 echo "Guessing incpth '$incpth'." >&4
2674                 for i in $*; do
2675                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2676                     if $test -d $j; then
2677                         libpth="$libpth $j"
2678                     fi
2679                 done   
2680                 libpth="`$echo $libpth|$sed 's/^ //'`"
2681                 echo "Guessing libpth '$libpth'." >&4
2682             fi
2683             $rm -f try.c
2684             ;;
2685         esac
2686         case "$targetarch" in
2687         '') echo "Targetarch not defined." >&4; croak=y ;;
2688         *)  echo "Using targetarch $targetarch." >&4 ;;
2689         esac
2690         case "$incpth" in
2691         '') echo "Incpth not defined." >&4; croak=y ;;
2692         *)  echo "Using incpth '$incpth'." >&4 ;;
2693         esac
2694         case "$libpth" in
2695         '') echo "Libpth not defined." >&4; croak=y ;;
2696         *)  echo "Using libpth '$libpth'." >&4 ;;
2697         esac
2698         case "$usrinc" in
2699         '') for i in $incpth; do
2700                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2701                     usrinc=$i
2702                     echo "Guessing usrinc $usrinc." >&4
2703                     break
2704                 fi
2705             done
2706             case "$usrinc" in
2707             '') echo "Usrinc not defined." >&4; croak=y ;;
2708             esac
2709             ;;
2710         *)  echo "Using usrinc $usrinc." >&4 ;;
2711         esac
2712         case "$targethost" in
2713         '') echo "Targethost not defined." >&4; croak=y ;;
2714         *)  echo "Using targethost $targethost." >&4
2715         esac
2716         locincpth=' '
2717         loclibpth=' '
2718         case "$croak" in
2719         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2720         esac
2721         case "$src" in
2722         /*) run=$src/Cross/run
2723             targetmkdir=$src/Cross/mkdir
2724             to=$src/Cross/to
2725             from=$src/Cross/from
2726             ;;
2727         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2728             run=$pwd/Cross/run
2729             targetmkdir=$pwd/Cross/mkdir
2730             to=$pwd/Cross/to
2731             from=$pwd/Cross/from
2732             ;;
2733         esac
2734         case "$targetrun" in
2735         '') targetrun=ssh ;;
2736         esac
2737         case "$targetto" in
2738         '') targetto=scp ;;
2739         esac
2740         case "$targetfrom" in
2741         '') targetfrom=scp ;;
2742         esac
2743         run=$run-$targetrun
2744         to=$to-$targetto
2745         from=$from-$targetfrom
2746         case "$targetdir" in
2747         '')  targetdir=/tmp
2748              echo "Guessing targetdir $targetdir." >&4
2749              ;;
2750         esac
2751         case "$targetuser" in
2752         '')  targetuser=root
2753              echo "Guessing targetuser $targetuser." >&4
2754              ;;
2755         esac
2756         case "$targetfrom" in
2757         scp)    q=-q ;;
2758         *)      q='' ;;
2759         esac
2760         case "$targetrun" in
2761         ssh|rsh)
2762             cat >$run <<EOF
2763 #!/bin/sh
2764 case "\$1" in
2765 -cwd)
2766   shift
2767   cwd=\$1
2768   shift
2769   ;;
2770 esac
2771 case "\$cwd" in
2772 '') cwd=$targetdir ;;
2773 esac
2774 exe=\$1
2775 shift
2776 if $test ! -f \$exe.xok; then
2777   $to \$exe
2778   $touch \$exe.xok
2779 fi
2780 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2781 EOF
2782             ;;
2783         *)  echo "Unknown targetrun '$targetrun'" >&4
2784             exit 1
2785             ;;
2786         esac
2787         case "$targetmkdir" in
2788         */Cross/mkdir)
2789             cat >$targetmkdir <<EOF
2790 #!/bin/sh
2791 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2792 EOF
2793             $chmod a+rx $targetmkdir
2794             ;;
2795         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2796             exit 1
2797             ;;
2798         esac
2799         case "$targetto" in
2800         scp|rcp)
2801             cat >$to <<EOF
2802 #!/bin/sh
2803 for f in \$@
2804 do
2805   case "\$f" in
2806   /*)
2807     $targetmkdir \`dirname \$f\`
2808     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2809     ;;
2810   *)
2811     $targetmkdir $targetdir/\`dirname \$f\`
2812     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2813     ;;
2814   esac
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         cp) cat >$to <<EOF
2820 #!/bin/sh
2821 for f in \$@
2822 do
2823   case "\$f" in
2824   /*)
2825     $mkdir -p $targetdir/\`dirname \$f\`
2826     $cp \$f $targetdir/\$f || exit 1
2827     ;;
2828   *)
2829     $targetmkdir $targetdir/\`dirname \$f\`
2830     $cp \$f $targetdir/\$f || exit 1
2831     ;;
2832   esac
2833 done
2834 exit 0
2835 EOF
2836             ;;
2837         *)  echo "Unknown targetto '$targetto'" >&4
2838             exit 1
2839             ;;
2840         esac
2841         case "$targetfrom" in
2842         scp|rcp)
2843           cat >$from <<EOF
2844 #!/bin/sh
2845 for f in \$@
2846 do
2847   $rm -f \$f
2848   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2849 done
2850 exit 0
2851 EOF
2852             ;;
2853         cp) cat >$from <<EOF
2854 #!/bin/sh
2855 for f in \$@
2856 do
2857   $rm -f \$f
2858   cp $targetdir/\$f . || exit 1
2859 done
2860 exit 0
2861 EOF
2862             ;;
2863         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2864             exit 1
2865             ;;
2866         esac
2867         if $test ! -f $run; then
2868             echo "Target 'run' script '$run' not found." >&4
2869         else
2870             $chmod a+rx $run
2871         fi
2872         if $test ! -f $to; then
2873             echo "Target 'to' script '$to' not found." >&4
2874         else
2875             $chmod a+rx $to
2876         fi
2877         if $test ! -f $from; then
2878             echo "Target 'from' script '$from' not found." >&4
2879         else
2880             $chmod a+rx $from
2881         fi
2882         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2883             exit 1
2884         fi
2885         cat >&4 <<EOF
2886 Using '$run' for remote execution,
2887 and '$from' and '$to'
2888 for remote file transfer.
2889 EOF
2890         ;;
2891 *)      run=''
2892         to=:
2893         from=:
2894         usecrosscompile='undef'
2895         targetarch=''
2896         ;;
2897 esac
2898
2899 : see whether [:lower:] and [:upper:] are supported character classes
2900 echo " "
2901 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2902 ABYZ)
2903         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2904         up='[:upper:]'
2905         low='[:lower:]'
2906         ;;
2907 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2908         # (0xd9 and 0xe2), therefore that is a nice testing point.
2909         if test "X$up" = X -o "X$low" = X; then
2910             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2911             rs) up='[A-Z]'
2912                 low='[a-z]'
2913                 ;;
2914             esac
2915         fi
2916         if test "X$up" = X -o "X$low" = X; then
2917             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2918             rs) up='A-Z'
2919                 low='a-z'
2920                 ;;
2921             esac
2922         fi
2923         if test "X$up" = X -o "X$low" = X; then
2924             case "`echo RS | od -x 2>/dev/null`" in
2925             *D9E2*|*d9e2*)
2926                 echo "Hey, this might be EBCDIC." >&4
2927                 if test "X$up" = X -o "X$low" = X; then
2928                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2929                     rs) up='[A-IJ-RS-Z]'
2930                         low='[a-ij-rs-z]'
2931                         ;;
2932                     esac
2933                 fi
2934                 if test "X$up" = X -o "X$low" = X; then
2935                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2936                     rs) up='A-IJ-RS-Z'
2937                         low='a-ij-rs-z'
2938                         ;;
2939                     esac
2940                 fi
2941                 ;;
2942             esac
2943         fi
2944 esac
2945 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2946 rs)
2947     echo "Using $up and $low to convert case." >&4
2948     ;;
2949 *)
2950     echo "I don't know how to translate letters from upper to lower case." >&4
2951     echo "Your tr is not acting any way I know of." >&4
2952     exit 1
2953     ;;
2954 esac
2955 : set up the translation script tr, must be called with ./tr of course
2956 cat >tr <<EOSC
2957 $startsh
2958 case "\$1\$2" in
2959 '[A-Z][a-z]') exec $tr '$up' '$low';;
2960 '[a-z][A-Z]') exec $tr '$low' '$up';;
2961 esac
2962 exec $tr "\$@"
2963 EOSC
2964 chmod +x tr
2965 $eunicefix tr
2966
2967 : Try to determine whether config.sh was made on this system
2968 case "$config_sh" in
2969 '')
2970 myuname=`$uname -a 2>/dev/null`
2971 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2972 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2973 # because the A-Z/a-z are not consecutive.
2974 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2975         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2976 newmyuname="$myuname"
2977 dflt=n
2978 case "$knowitall" in
2979 '')
2980         if test -f ../config.sh; then
2981                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2982                         eval "`grep myuname= ../config.sh`"
2983                 fi
2984                 if test "X$myuname" = "X$newmyuname"; then
2985                         dflt=y
2986                 fi
2987         fi
2988         ;;
2989 *) dflt=y;;
2990 esac
2991
2992 : Get old answers from old config file if Configure was run on the
2993 : same system, otherwise use the hints.
2994 hint=default
2995 cd ..
2996 if test -f config.sh; then
2997         echo " "
2998         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2999         . UU/myread
3000         case "$ans" in
3001         n*|N*) echo "OK, I'll ignore it."
3002                 mv config.sh config.sh.old
3003                 myuname="$newmyuname"
3004                 ;;
3005         *)  echo "Fetching default answers from your old config.sh file..." >&4
3006                 tmp_n="$n"
3007                 tmp_c="$c"
3008                 tmp_sh="$sh"
3009                 . ./config.sh
3010                 cp config.sh UU
3011                 n="$tmp_n"
3012                 c="$tmp_c"
3013                 : Older versions did not always set $sh.  Catch re-use of such
3014                 : an old config.sh.
3015                 case "$sh" in
3016                 '') sh="$tmp_sh" ;;
3017                 esac
3018                 hint=previous
3019                 ;;
3020         esac
3021 fi
3022 . ./UU/checkcc
3023 if test ! -f config.sh; then
3024         $cat <<EOM
3025
3026 First time through, eh?  I have some defaults handy for some systems
3027 that need some extra help getting the Configure answers right:
3028
3029 EOM
3030         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3031         dflt=''
3032         : Half the following guesses are probably wrong... If you have better
3033         : tests or hints, please send them to perlbug@perl.org
3034         : The metaconfig authors would also appreciate a copy...
3035         $test -f /irix && osname=irix
3036         $test -f /xenix && osname=sco_xenix
3037         $test -f /dynix && osname=dynix
3038         $test -f /dnix && osname=dnix
3039         $test -f /lynx.os && osname=lynxos
3040         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3041         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3042         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3043         $test -f /bin/mips && /bin/mips && osname=mips
3044         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3045                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3046         $test -d /usr/apollo/bin && osname=apollo
3047         $test -f /etc/saf/_sactab && osname=svr4
3048         $test -d /usr/include/minix && osname=minix
3049         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3050         if $test -d /MachTen -o -d /MachTen_Folder; then
3051                 osname=machten
3052                 if $test -x /sbin/version; then
3053                         osvers=`/sbin/version | $awk '{print $2}' |
3054                         $sed -e 's/[A-Za-z]$//'`
3055                 elif $test -x /usr/etc/version; then
3056                         osvers=`/usr/etc/version | $awk '{print $2}' |
3057                         $sed -e 's/[A-Za-z]$//'`
3058                 else
3059                         osvers="$2.$3"
3060                 fi
3061         fi
3062
3063         $test -f /sys/posix.dll &&
3064                 $test -f /usr/bin/what &&
3065                 set X `/usr/bin/what /sys/posix.dll` &&
3066                 $test "$3" = UWIN &&
3067                 osname=uwin &&
3068                 osvers="$5"
3069
3070         if $test -f $uname; then
3071                 set X $myuname
3072                 shift
3073
3074                 case "$5" in
3075                 fps*) osname=fps ;;
3076                 mips*)
3077                         case "$4" in
3078                         umips) osname=umips ;;
3079                         *) osname=mips ;;
3080                         esac;;
3081                 [23]100) osname=mips ;;
3082                 next*) osname=next ;;
3083                 i386*)
3084                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3085                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3086                                 osname='sco'
3087                                 osvers=$tmp
3088                         elif $test -f /etc/kconfig; then
3089                                 osname=isc
3090                                 if test "$lns" = "$ln -s"; then
3091                                         osvers=4
3092                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3093                                         osvers=3
3094                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3095                                         osvers=2
3096                                 fi
3097                         fi
3098                         tmp=''
3099                         ;;
3100                 pc*)
3101                         if test -n "$DJGPP"; then
3102                                 osname=dos
3103                                 osvers=djgpp
3104                         fi
3105                         ;;
3106                 esac
3107
3108                 case "$1" in
3109                 aix) osname=aix
3110                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3111                         case "$tmp" in
3112                         # oslevel can fail with:
3113                         # oslevel: Unable to acquire lock.
3114                         *not\ found) osvers="$4"."$3" ;;
3115                         '<3240'|'<>3240') osvers=3.2.0 ;;
3116                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3117                         '=3250'|'>3250') osvers=3.2.5 ;;
3118                         *) osvers=$tmp;;
3119                         esac
3120                         ;;
3121                 bsd386) osname=bsd386
3122                         osvers=`$uname -r`
3123                         ;;
3124                 cygwin*) osname=cygwin
3125                         osvers="$3"
3126                         ;;
3127                 *dc.osx) osname=dcosx
3128                         osvers="$3"
3129                         ;;
3130                 dnix) osname=dnix
3131                         osvers="$3"
3132                         ;;
3133                 domainos) osname=apollo
3134                         osvers="$3"
3135                         ;;
3136                 dgux)   osname=dgux
3137                         osvers="$3"
3138                         ;;
3139                 dragonfly) osname=dragonfly
3140                         osvers="$3"
3141                         ;;
3142                 dynixptx*) osname=dynixptx
3143                         osvers=`echo "$4"|sed 's/^v//'`
3144                         ;;
3145                 freebsd) osname=freebsd
3146                         osvers="$3" ;;
3147                 genix)  osname=genix ;;
3148                 gnu)    osname=gnu
3149                         osvers="$3" ;;
3150                 hp*)    osname=hpux
3151                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3152                         ;;
3153                 irix*)  osname=irix
3154                         case "$3" in
3155                         4*) osvers=4 ;;
3156                         5*) osvers=5 ;;
3157                         *)      osvers="$3" ;;
3158                         esac
3159                         ;;
3160                 linux)  osname=linux
3161                         case "$3" in
3162                         *)      osvers="$3" ;;
3163                         esac
3164                         ;;
3165                 MiNT)   osname=mint
3166                         ;;
3167                 netbsd*) osname=netbsd
3168                         osvers="$3"
3169                         ;;
3170                 news-os) osvers="$3"
3171                         case "$3" in
3172                         4*) osname=newsos4 ;;
3173                         *) osname=newsos ;;
3174                         esac
3175                         ;;
3176                 next*) osname=next ;;
3177                 nonstop-ux) osname=nonstopux ;;
3178                 openbsd) osname=openbsd
3179                         osvers="$3"
3180                         ;;
3181                 os2)    osname=os2
3182                         osvers="$4"
3183                         ;;
3184                 POSIX-BC | posix-bc ) osname=posix-bc
3185                         osvers="$3"
3186                         ;;
3187                 powerux | power_ux | powermax_os | powermaxos | \
3188                 powerunix | power_unix) osname=powerux
3189                         osvers="$3"
3190                         ;;
3191                 qnx) osname=qnx
3192                         osvers="$4"
3193                         ;;
3194                 solaris) osname=solaris
3195                         case "$3" in
3196                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3197                         *)      osvers="$3" ;;
3198                         esac
3199                         ;;
3200                 sunos) osname=sunos
3201                         case "$3" in
3202                         5*) osname=solaris
3203                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3204                         *)      osvers="$3" ;;
3205                         esac
3206                         ;;
3207                 titanos) osname=titanos
3208                         case "$3" in
3209                         1*) osvers=1 ;;
3210                         2*) osvers=2 ;;
3211                         3*) osvers=3 ;;
3212                         4*) osvers=4 ;;
3213                         *)      osvers="$3" ;;
3214                         esac
3215                         ;;
3216                 ultrix) osname=ultrix
3217                         osvers="$3"
3218                         ;;
3219                 osf1|mls+)      case "$5" in
3220                                 alpha)
3221                                         osname=dec_osf
3222                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3223                                         case "$osvers" in
3224                                         [1-9].[0-9]*) ;;
3225                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3226                                         esac
3227                                         ;;
3228                         hp*)    osname=hp_osf1  ;;
3229                         mips)   osname=mips_osf1 ;;
3230                         esac
3231                         ;;
3232                 # UnixWare 7.1.2 is known as Open UNIX 8
3233                 openunix|unixware) osname=svr5
3234                         osvers="$4"
3235                         ;;
3236                 uts)    osname=uts
3237                         osvers="$3"
3238                         ;;
3239                 vos) osvers="$3"
3240                         ;;
3241                 $2) case "$osname" in
3242                         *isc*) ;;
3243                         *freebsd*) ;;
3244                         svr*)
3245                                 : svr4.x or possibly later
3246                                 case "svr$3" in
3247                                 ${osname}*)
3248                                         osname=svr$3
3249                                         osvers=$4
3250                                         ;;
3251                                 esac
3252                                 case "$osname" in
3253                                 svr4.0)
3254                                         : Check for ESIX
3255                                         if test -f /stand/boot ; then
3256                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3257                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3258                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3259                                                         if test -n "$isesix"; then
3260                                                                 osname=esix4
3261                                                         fi
3262                                                 fi
3263                                         fi
3264                                         ;;
3265                                 esac
3266                                 ;;
3267                         *)      if test -f /etc/systemid; then
3268                                         osname=sco
3269                                         set `echo $3 | $sed 's/\./ /g'` $4
3270                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3271                                                 osvers=$1.$2.$3
3272                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3273                                                 osvers=$1.$2
3274                                         elif $test -f $src/hints/sco_$1.sh; then
3275                                                 osvers=$1
3276                                         fi
3277                                 else
3278                                         case "$osname" in
3279                                         '') : Still unknown.  Probably a generic Sys V.
3280                                                 osname="sysv"
3281                                                 osvers="$3"
3282                                                 ;;
3283                                         esac
3284                                 fi
3285                                 ;;
3286                         esac
3287                         ;;
3288                 *)      case "$osname" in
3289                         '') : Still unknown.  Probably a generic BSD.
3290                                 osname="$1"
3291                                 osvers="$3"
3292                                 ;;
3293                         esac
3294                         ;;
3295                 esac
3296         else
3297                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3298                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3299                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3300                                 osname=news_os
3301                         fi
3302                         $rm -f UU/kernel.what
3303                 elif test -d c:/. -o -n "$is_os2" ; then
3304                         set X $myuname
3305                         osname=os2
3306                         osvers="$5"
3307                 fi
3308         fi
3309
3310         case "$targetarch" in
3311         '') ;;
3312         *)  hostarch=$osname
3313             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3314             osvers=''
3315             ;;
3316         esac
3317
3318         : Now look for a hint file osname_osvers, unless one has been
3319         : specified already.
3320         case "$hintfile" in
3321         ''|' ')
3322                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3323                 : Also try without trailing minor version numbers.
3324                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3325                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3326                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3327                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3328                 case "$file" in
3329                 '') dflt=none ;;
3330                 *)  case "$osvers" in
3331                         '') dflt=$file
3332                                 ;;
3333                         *)  if $test -f $src/hints/$file.sh ; then
3334                                         dflt=$file
3335                                 elif $test -f $src/hints/$xfile.sh ; then
3336                                         dflt=$xfile
3337                                 elif $test -f $src/hints/$xxfile.sh ; then
3338                                         dflt=$xxfile
3339                                 elif $test -f $src/hints/$xxxfile.sh ; then
3340                                         dflt=$xxxfile
3341                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3342                                         dflt=$xxxxfile
3343                                 elif $test -f "$src/hints/${osname}.sh" ; then
3344                                         dflt="${osname}"
3345                                 else
3346                                         dflt=none
3347                                 fi
3348                                 ;;
3349                         esac
3350                         ;;
3351                 esac
3352                 if $test -f Policy.sh ; then
3353                         case "$dflt" in
3354                         *Policy*) ;;
3355                         none) dflt="Policy" ;;
3356                         *) dflt="Policy $dflt" ;;
3357                         esac
3358                 fi
3359                 ;;
3360         *)
3361                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3362                 ;;
3363         esac
3364
3365         if $test -f Policy.sh ; then
3366                 $cat <<EOM
3367
3368 There's also a Policy hint file available, which should make the
3369 site-specific (policy) questions easier to answer.
3370 EOM
3371
3372         fi
3373
3374         $cat <<EOM
3375
3376 You may give one or more space-separated answers, or "none" if appropriate.
3377 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3378 is a good thing.  DO NOT give a wrong version or a wrong OS.
3379
3380 EOM
3381
3382         rp="Which of these apply, if any?"
3383         . UU/myread
3384         tans=$ans
3385         for file in $tans; do
3386                 if $test X$file = XPolicy -a -f Policy.sh; then
3387                         . Policy.sh
3388                         $cat Policy.sh >> UU/config.sh
3389                 elif $test -f $src/hints/$file.sh; then
3390                         . $src/hints/$file.sh
3391                         $cat $src/hints/$file.sh >> UU/config.sh
3392                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3393                         : nothing
3394                 else
3395                         : Give one chance to correct a possible typo.
3396                         echo "$file.sh does not exist"
3397                         dflt=$file
3398                         rp="hint to use instead?"
3399                         . UU/myread
3400                         for file in $ans; do
3401                                 if $test -f "$src/hints/$file.sh"; then
3402                                         . $src/hints/$file.sh
3403                                         $cat $src/hints/$file.sh >> UU/config.sh
3404                                 elif $test X$ans = X -o X$ans = Xnone ; then
3405                                         : nothing
3406                                 else
3407                                         echo "$file.sh does not exist -- ignored."
3408                                 fi
3409                         done
3410                 fi
3411         done
3412
3413         hint=recommended
3414         : Remember our hint file for later.
3415         if $test -f "$src/hints/$file.sh" ; then
3416                 hintfile="$file"
3417         else
3418                 hintfile=''
3419         fi
3420 fi
3421 cd UU
3422 ;;
3423 *)
3424         echo " "
3425         echo "Fetching default answers from $config_sh..." >&4
3426         tmp_n="$n"
3427         tmp_c="$c"
3428         cd ..
3429         cp $config_sh config.sh 2>/dev/null
3430         chmod +w config.sh
3431         . ./config.sh
3432         cd UU
3433         cp ../config.sh .
3434         n="$tmp_n"
3435         c="$tmp_c"
3436         hint=previous
3437         ;;
3438 esac
3439 test "$override" && . ./optdef.sh
3440
3441 : Restore computed paths
3442 for file in $loclist $trylist; do
3443         eval $file="\$_$file"
3444 done
3445
3446 cat << EOM
3447
3448 Configure uses the operating system name and version to set some defaults.
3449 The default value is probably right if the name rings a bell. Otherwise,
3450 since spelling matters for me, either accept the default or answer "none"
3451 to leave it blank.
3452
3453 EOM
3454 case "$osname" in
3455         ''|' ')
3456                 case "$hintfile" in
3457                 ''|' '|none) dflt=none ;;
3458                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3459                 esac
3460                 ;;
3461         *) dflt="$osname" ;;
3462 esac
3463 rp="Operating system name?"
3464 . ./myread
3465 case "$ans" in
3466 none)  osname='' ;;
3467 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3468 esac
3469 echo " "
3470 case "$osvers" in
3471         ''|' ')
3472                 case "$hintfile" in
3473                 ''|' '|none) dflt=none ;;
3474                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3475                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3476                         case "$dflt" in
3477                         ''|' ') dflt=none ;;
3478                         esac
3479                         ;;
3480                 esac
3481                 ;;
3482         *) dflt="$osvers" ;;
3483 esac
3484 rp="Operating system version?"
3485 . ./myread
3486 case "$ans" in
3487 none)  osvers='' ;;
3488 *) osvers="$ans" ;;
3489 esac
3490
3491
3492 . ./posthint.sh
3493
3494 : who configured the system
3495 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3496 case "$cf_by" in
3497 "")
3498         cf_by=`(logname) 2>/dev/null`
3499         case "$cf_by" in
3500         "")
3501                 cf_by=`(whoami) 2>/dev/null`
3502                 case "$cf_by" in
3503                 "") cf_by=unknown ;;
3504                 esac ;;
3505         esac ;;
3506 esac
3507
3508 : set up the script used to warn in case of inconsistency
3509 cat <<EOS >whoa
3510 $startsh
3511 EOS
3512 cat <<'EOSC' >>whoa
3513 dflt=y
3514 echo " "
3515 echo "*** WHOA THERE!!! ***" >&4
3516 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3517 rp="    Keep the $hint value?"
3518 . ./myread
3519 case "$ans" in
3520 y) td=$was; tu=$was;;
3521 esac
3522 EOSC
3523
3524 : function used to set $1 to $val
3525 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3526 case "$val$was" in
3527 $define$undef) . ./whoa; eval "$var=\$td";;
3528 $undef$define) . ./whoa; eval "$var=\$tu";;
3529 *) eval "$var=$val";;
3530 esac'
3531
3532 case "$usesocks" in
3533 $define|true|[yY]*)     dflt='y';;
3534 *) dflt='n';;
3535 esac
3536 cat <<EOM
3537
3538 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3539 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3540 to use the PerlIO abstraction layer, this will be implicitly selected.
3541
3542 If this doesn't make any sense to you, just accept the default '$dflt'.
3543 EOM
3544 rp='Build Perl for SOCKS?'
3545 . ./myread
3546 case "$ans" in
3547 y|Y)    val="$define" ;;     
3548 *)      val="$undef" ;;
3549 esac
3550 set usesocks
3551 eval $setvar
3552
3553 case "$mad" in
3554 $define|true|[yY]*)     dflt='y';;
3555 *) dflt='n';;
3556 esac
3557 cat <<EOM
3558
3559 Would you like to build with Misc Attribute Decoration? This is development
3560 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
3561 overhead on the interpreter.
3562
3563 If this doesn't make any sense to you, just accept the default '$dflt'.
3564 EOM
3565 rp='Build Perl with MAD?'
3566 . ./myread
3567 case "$ans" in
3568 y|Y)    val="$define" ;;     
3569 *)      val="$undef" ;;
3570 esac
3571 set mad
3572 eval $setvar
3573
3574 case "$usesocks" in
3575 $define|true|[yY]*) useperlio="$define";;
3576 esac
3577
3578 case "$useperlio" in
3579 $define|true|[yY]*|'')  dflt='y';;
3580 *) dflt='n';;
3581 esac
3582 cat <<EOM
3583
3584 Previous version of $package used the standard IO mechanisms as
3585 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3586 alternate IO mechanisms via the PerlIO abstraction layer, but the
3587 stdio mechanism is still available if needed.  The abstraction layer
3588 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3589 Using PerlIO with sfio may cause problems with some extension modules.
3590
3591 If this doesn't make any sense to you, just accept the default '$dflt'.
3592 EOM
3593 rp='Use the PerlIO abstraction layer?'
3594 . ./myread
3595 case "$ans" in
3596 y|Y) 
3597         val="$define"
3598         ;;
3599 *)      
3600         echo "Ok, doing things the stdio way."
3601         val="$undef"
3602         ;;
3603 esac
3604 set useperlio
3605 eval $setvar 
3606
3607 case "$usesocks" in
3608 $define|true|[yY]*)
3609         case "$useperlio" in
3610         $define|true|[yY]*) ;;
3611         *)      cat >&4 <<EOM
3612
3613 You are using the SOCKS proxy protocol library which means that you
3614 should also use the PerlIO layer.  You may be headed for trouble.
3615
3616 EOM
3617                 ;;
3618         esac
3619         ;;
3620 esac
3621
3622         
3623 case "$usethreads" in
3624 $define|true|[yY]*)     dflt='y';;
3625 *)     # Catch case where user specified ithreads or 5005threads but
3626        # forgot -Dusethreads (A.D. 4/2002)
3627        case "$useithreads$use5005threads" in
3628        *$define*)      
3629                 case "$useperlio" in
3630                 "$define")      dflt='y' ;;
3631                 *)              dflt='n' ;;
3632                 esac
3633                 ;;
3634        *)       dflt='n';;
3635        esac
3636        ;;
3637 esac
3638 cat <<EOM
3639
3640 Perl can be built to take advantage of threads on some systems.
3641 To do so, Configure can be run with -Dusethreads.
3642
3643 Note that Perl built with threading support runs slightly slower
3644 and uses more memory than plain Perl. The current implementation
3645 is believed to be stable, but it is fairly new, and so should be
3646 treated with caution.
3647
3648 If this doesn't make any sense to you, just accept the default '$dflt'.
3649 EOM
3650 rp='Build a threading Perl?'
3651 . ./myread
3652 case "$ans" in
3653 y|Y)    val="$define" ;;
3654 *)      val="$undef" ;;
3655 esac
3656 set usethreads
3657 eval $setvar
3658
3659 case "$usethreads" in
3660 $define)
3661         $cat <<EOM
3662
3663 Since release 5.6, Perl has had two different threading implementations,
3664 the newer interpreter-based version (ithreads) with one interpreter per
3665 thread, and the older 5.005 version (5005threads).
3666 The 5005threads version is effectively unmaintained and will probably be
3667 removed in Perl 5.10, so there should be no need to build a Perl using it
3668 unless needed for backwards compatibility with some existing 5.005threads
3669 code.
3670
3671 EOM
3672         : Default to ithreads unless overridden on command line or with
3673         : old config.sh
3674         dflt='y'
3675         case "$use5005threads" in
3676                 $define|true|[yY]*) dflt='n';;
3677         esac
3678         case "$useithreads" in
3679                 $undef|false|[nN]*) dflt='n';;
3680         esac
3681         rp='Use the newer interpreter-based ithreads?'
3682         . ./myread
3683         case "$ans" in
3684         y|Y)    val="$define" ;;
3685         *)      val="$undef" ;;
3686         esac
3687         set useithreads
3688         eval $setvar
3689         : Now set use5005threads to the opposite value.
3690         case "$useithreads" in
3691         $define) val="$undef" ;;
3692         *) val="$define" ;;
3693         esac
3694         set use5005threads
3695         eval $setvar
3696         ;;
3697 *)
3698         useithreads="$undef"
3699         use5005threads="$undef"
3700         ;;
3701 esac
3702
3703 case "$useithreads$use5005threads" in
3704 "$define$define")
3705         $cat >&4 <<EOM
3706
3707 You cannot have both the ithreads and the 5.005 threads enabled
3708 at the same time.  Disabling the 5.005 threads since they are
3709 much less stable than the ithreads.
3710
3711 EOM
3712         use5005threads="$undef"
3713         ;;
3714 esac
3715
3716 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3717         cat >&4 <<EOF
3718 ***
3719 *** To build with ithreads you must also use the PerlIO layer.
3720 *** Cannot continue, aborting.
3721 ***
3722 EOF
3723         exit 1
3724 fi
3725
3726 case "$d_oldpthreads" in
3727 '')     : Configure tests would be welcome here.  For now, assume undef.
3728         val="$undef" ;;
3729 *)      val="$d_oldpthreads" ;;
3730 esac
3731 set d_oldpthreads
3732 eval $setvar
3733
3734
3735 : Look for a hint-file generated 'call-back-unit'.  If the
3736 : user has specified that a threading perl is to be built,
3737 : we may need to set or change some other defaults.
3738 if $test -f usethreads.cbu; then
3739     echo "Your platform has some specific hints regarding threaded builds, using them..."
3740     . ./usethreads.cbu
3741 else
3742     case "$usethreads" in
3743         "$define"|true|[yY]*)
3744                 $cat <<EOM
3745 (Your platform does not have any specific hints for threaded builds.
3746  Assuming POSIX threads, then.)
3747 EOM
3748         ;;
3749     esac
3750 fi
3751
3752 cat <<EOM
3753
3754 Perl can be built so that multiple Perl interpreters can coexist
3755 within the same Perl executable.
3756 EOM
3757
3758 case "$useithreads" in
3759 $define)
3760         cat <<EOM
3761 This multiple interpreter support is required for interpreter-based threads.
3762 EOM
3763         val="$define"
3764         ;;
3765 *)      case "$usemultiplicity" in
3766         $define|true|[yY]*)     dflt='y';;
3767         *) dflt='n';;
3768         esac
3769         echo " "
3770         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3771         rp='Build Perl for multiplicity?'
3772         . ./myread
3773         case "$ans" in
3774         y|Y)    val="$define" ;;
3775         *)      val="$undef" ;;
3776         esac
3777         ;;
3778 esac
3779 set usemultiplicity
3780 eval $setvar
3781
3782
3783 case "$usemorebits" in
3784 "$define"|true|[yY]*)
3785         use64bitint="$define"
3786         uselongdouble="$define"
3787         usemorebits="$define"
3788         ;;
3789 *)      usemorebits="$undef"
3790         ;;
3791 esac
3792
3793 : make some quick guesses about what we are up against
3794 echo " "
3795 $echo $n "Hmm...  $c"
3796 echo exit 1 >bsd
3797 echo exit 1 >usg
3798 echo exit 1 >v7
3799 echo exit 1 >osf1
3800 echo exit 1 >eunice
3801 echo exit 1 >xenix
3802 echo exit 1 >venix
3803 echo exit 1 >os2
3804 d_bsd="$undef"
3805 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3806 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3807 then
3808         echo "Looks kind of like an OSF/1 system, but we'll see..."
3809         echo exit 0 >osf1
3810 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3811         xxx=`./loc addbib blurfl $pth`
3812         if $test -f $xxx; then
3813         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3814                 echo exit 0 >bsd
3815                 echo exit 0 >usg
3816         else
3817                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3818                         echo "Looks kind of like an extended USG system, but we'll see..."
3819                 else
3820                         echo "Looks kind of like a USG system, but we'll see..."
3821                 fi
3822                 echo exit 0 >usg
3823         fi
3824 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3825         echo "Looks kind of like a BSD system, but we'll see..."
3826         d_bsd="$define"
3827         echo exit 0 >bsd
3828 else
3829         echo "Looks kind of like a Version 7 system, but we'll see..."
3830         echo exit 0 >v7
3831 fi
3832 case "$eunicefix" in
3833 *unixtovms*)
3834         $cat <<'EOI'
3835 There is, however, a strange, musty smell in the air that reminds me of
3836 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3837 EOI
3838         echo exit 0 >eunice
3839         d_eunice="$define"
3840 : it so happens the Eunice I know will not run shell scripts in Unix format
3841         ;;
3842 *)
3843         echo " "
3844         echo "Congratulations.  You aren't running Eunice."
3845         d_eunice="$undef"
3846         ;;
3847 esac
3848 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3849 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3850 : semicolon as a patch separator
3851 case "$p_" in
3852 :) ;;
3853 *)
3854         $cat <<'EOI'
3855 I have the feeling something is not exactly right, however...don't tell me...
3856 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3857 (Or you may be running DOS with DJGPP.)
3858 EOI
3859         echo exit 0 >os2
3860         ;;
3861 esac
3862 if test -f /xenix; then
3863         echo "Actually, this looks more like a XENIX system..."
3864         echo exit 0 >xenix
3865         d_xenix="$define"
3866 else
3867         echo " "
3868         echo "It's not Xenix..."
3869         d_xenix="$undef"
3870 fi
3871 chmod +x xenix
3872 $eunicefix xenix
3873 if test -f /venix; then
3874         echo "Actually, this looks more like a VENIX system..."
3875         echo exit 0 >venix
3876 else
3877         echo " "
3878         if ./xenix; then
3879                 : null
3880         else
3881                 echo "Nor is it Venix..."
3882         fi
3883 fi
3884 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3885 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3886 $rm -f foo
3887
3888 case "$cc" in
3889 '') dflt=cc;;
3890 *) dflt="$cc";;
3891 esac
3892 rp="Use which C compiler?"
3893 . ./myread
3894 cc="$ans"
3895
3896 : See if they have not cc but they do have gcc
3897 . ./trygcc
3898 : Look for a hint-file generated 'call-back-unit'.  Now that the
3899 : user has specified the compiler, we may need to set or change some
3900 : other defaults.
3901 if $test -f cc.cbu; then
3902     . ./cc.cbu
3903 fi
3904 . ./checkcc
3905
3906 echo " "
3907 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3908 $cat >try.c <<EOM
3909 #include <stdio.h>
3910 int main() {
3911 #ifdef __GNUC__
3912 #ifdef __VERSION__
3913         printf("%s\n", __VERSION__);
3914 #else
3915         printf("%s\n", "1");
3916 #endif
3917 #endif
3918         return(0);
3919 }
3920 EOM
3921 if $cc -o try $ccflags $ldflags try.c; then
3922         gccversion=`$run ./try`
3923         case "$gccversion" in
3924         '') echo "You are not using GNU cc." ;;
3925         *)  echo "You are using GNU cc $gccversion."
3926             ccname=gcc
3927             ;;
3928         esac
3929 else
3930         echo " "
3931         echo "*** WHOA THERE!!! ***" >&4
3932         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3933         case "$knowitall" in
3934         '')
3935         echo "    You'd better start hunting for one and let me know about it." >&4
3936                 exit 1
3937                 ;;
3938         esac
3939 fi
3940 $rm -f try try.*
3941 case "$gccversion" in
3942 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3943 esac
3944 case "$gccversion" in
3945 '') gccosandvers='' ;;
3946 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3947    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3948    gccshortvers=''
3949    case "$gccosandvers" in
3950    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3951    $osname$osvers) ;; # looking good
3952    $osname*) cat <<EOM >&4
3953
3954 *** WHOA THERE!!! ***
3955
3956     Your gcc has not been compiled for the exact release of
3957     your operating system ($gccosandvers versus $osname$osvers).
3958
3959     In general it is a good idea to keep gcc synchronized with
3960     the operating system because otherwise serious problems
3961     may ensue when trying to compile software, like Perl.
3962
3963     I'm trying to be optimistic here, though, and will continue.
3964     If later during the configuration and build icky compilation
3965     problems appear (headerfile conflicts being the most common
3966     manifestation), I suggest reinstalling the gcc to match
3967     your operating system release.
3968
3969 EOM
3970       ;;
3971    *) gccosandvers='' ;; # failed to parse, better be silent
3972    esac
3973    ;;
3974 esac
3975 case "$ccname" in
3976 '') ccname="$cc" ;;
3977 esac
3978
3979 # gcc 3.* complain about adding -Idirectories that they already know about,
3980 # so we will take those off from locincpth.
3981 case "$gccversion" in
3982 3*)
3983     echo "main(){}">try.c
3984     for incdir in $locincpth; do
3985        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3986              grep '^c[cp]p*[01]: warning: changing search order '`
3987        if test "X$warn" != X; then
3988            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3989        fi
3990     done
3991     $rm -f try try.*
3992 esac
3993
3994 : decide how portable to be.  Allow command line overrides.
3995 case "$d_portable" in
3996 "$undef") ;;
3997 *)      d_portable="$define" ;;
3998 esac
3999
4000 : set up shell script to do ~ expansion
4001 cat >filexp <<EOSS
4002 $startsh
4003 : expand filename
4004 case "\$1" in
4005  ~/*|~)
4006         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
4007         ;;
4008  ~*)
4009         if $test -f /bin/csh; then
4010                 /bin/csh -f -c "glob \$1"
4011                 failed=\$?
4012                 echo ""
4013                 exit \$failed
4014         else
4015                 name=\`$expr x\$1 : '..\([^/]*\)'\`
4016                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
4017                 if $test ! -d "\$dir"; then
4018                         me=\`basename \$0\`
4019                         echo "\$me: can't locate home directory for: \$name" >&2
4020                         exit 1
4021                 fi
4022                 case "\$1" in
4023                 */*)
4024                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4025                         ;;
4026                 *)
4027                         echo \$dir
4028                         ;;
4029                 esac
4030         fi
4031         ;;
4032 *)
4033         echo \$1
4034         ;;
4035 esac
4036 EOSS
4037 chmod +x filexp
4038 $eunicefix filexp
4039
4040 : now set up to get a file name
4041 cat <<EOS >getfile
4042 $startsh
4043 EOS
4044 cat <<'EOSC' >>getfile
4045 tilde=''
4046 fullpath=''
4047 already=''
4048 skip=''
4049 none_ok=''
4050 exp_file=''
4051 nopath_ok=''
4052 orig_rp="$rp"
4053 orig_dflt="$dflt"
4054 case "$gfpth" in
4055 '') gfpth='.' ;;
4056 esac
4057
4058 case "$fn" in
4059 *\(*)
4060         : getfile will accept an answer from the comma-separated list
4061         : enclosed in parentheses even if it does not meet other criteria.
4062         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4063         fn=`echo $fn | sed 's/(.*)//'`
4064         ;;
4065 esac
4066
4067 case "$fn" in
4068 *:*)
4069         loc_file=`expr $fn : '.*:\(.*\)'`
4070         fn=`expr $fn : '\(.*\):.*'`
4071         ;;
4072 esac
4073
4074 case "$fn" in
4075 *~*) tilde=true;;
4076 esac
4077 case "$fn" in
4078 */*) fullpath=true;;
4079 esac
4080 case "$fn" in
4081 *+*) skip=true;;
4082 esac
4083 case "$fn" in
4084 *n*) none_ok=true;;
4085 esac
4086 case "$fn" in
4087 *e*) exp_file=true;;
4088 esac
4089 case "$fn" in
4090 *p*) nopath_ok=true;;
4091 esac
4092
4093 case "$fn" in
4094 *f*) type='File';;
4095 *d*) type='Directory';;
4096 *l*) type='Locate';;
4097 esac
4098
4099 what="$type"
4100 case "$what" in
4101 Locate) what='File';;
4102 esac
4103
4104 case "$exp_file" in
4105 '')
4106         case "$d_portable" in
4107         "$define") ;;
4108         *) exp_file=true;;
4109         esac
4110         ;;
4111 esac
4112
4113 cd ..
4114 while test "$type"; do
4115         redo=''
4116         rp="$orig_rp"
4117         dflt="$orig_dflt"
4118         case "$tilde" in
4119         true) rp="$rp (~name ok)";;
4120         esac
4121         . UU/myread
4122         if test -f UU/getfile.ok && \
4123                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4124         then
4125                 value="$ans"
4126                 ansexp="$ans"
4127                 break
4128         fi
4129         case "$ans" in
4130         none)
4131                 value=''
4132                 ansexp=''
4133                 case "$none_ok" in
4134                 true) type='';;
4135                 esac
4136                 ;;
4137         *)
4138                 case "$tilde" in
4139                 '') value="$ans"
4140                         ansexp="$ans";;
4141                 *)
4142                         value=`UU/filexp $ans`
4143                         case $? in
4144                         0)
4145                                 if test "$ans" != "$value"; then
4146                                         echo "(That expands to $value on this system.)"
4147                                 fi
4148                                 ;;
4149                         *) value="$ans";;
4150                         esac
4151                         ansexp="$value"
4152                         case "$exp_file" in
4153                         '') value="$ans";;
4154                         esac
4155                         ;;
4156                 esac
4157                 case "$fullpath" in
4158                 true)
4159                         case "$ansexp" in
4160                         /*) value="$ansexp" ;;
4161                         [a-zA-Z]:/*) value="$ansexp" ;;
4162                         *)
4163                                 redo=true
4164                                 case "$already" in
4165                                 true)
4166                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4167                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4168                                         ;;
4169                                 *)
4170                                 echo "Please give a full path name, starting with slash." >&4
4171                                         case "$tilde" in
4172                                         true)
4173                                 echo "Note that using ~name is ok provided it expands well." >&4
4174                                                 already=true
4175                                                 ;;
4176                                         esac
4177                                 esac
4178                                 ;;
4179                         esac
4180                         ;;
4181                 esac
4182                 case "$redo" in
4183                 '')
4184                         case "$type" in
4185                         File)
4186                                 for fp in $gfpth; do
4187                                         if test "X$fp" = X.; then
4188                                             pf="$ansexp"
4189                                         else    
4190                                             pf="$fp/$ansexp"
4191                                         fi
4192                                         if test -f "$pf"; then
4193                                                 type=''
4194                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4195                                         then
4196                                                 echo "($value is not a plain file, but that's ok.)"
4197                                                 type=''
4198                                         fi
4199                                         if test X"$type" = X; then
4200                                             value="$pf"
4201                                             break
4202                                         fi
4203                                 done
4204                                 ;;
4205                         Directory)
4206                                 for fp in $gfpth; do
4207                                         if test "X$fp" = X.; then
4208                                             dir="$ans"
4209                                             direxp="$ansexp"
4210                                         else    
4211                                             dir="$fp/$ansexp"
4212                                             direxp="$fp/$ansexp"
4213                                         fi
4214                                         if test -d "$direxp"; then
4215                                                 type=''
4216                                                 value="$dir"
4217                                                 break
4218                                         fi
4219                                 done
4220                                 ;;
4221                         Locate)
4222                                 if test -d "$ansexp"; then
4223                                         echo "(Looking for $loc_file in directory $value.)"
4224                                         value="$value/$loc_file"
4225                                         ansexp="$ansexp/$loc_file"
4226                                 fi
4227                                 if test -f "$ansexp"; then
4228                                         type=''
4229                                 fi
4230                                 case "$nopath_ok" in
4231                                 true)   case "$value" in
4232                                         */*) ;;
4233                                         *)      echo "Assuming $value will be in people's path."
4234                                                 type=''
4235                                                 ;;
4236                                         esac
4237                                         ;;
4238                                 esac
4239                                 ;;
4240                         esac
4241
4242                         case "$skip" in
4243                         true) type='';
4244                         esac
4245
4246                         case "$type" in
4247                         '') ;;
4248                         *)
4249                                 if test "$fastread" = yes; then
4250                                         dflt=y
4251                                 else
4252                                         dflt=n
4253                                 fi
4254                                 rp="$what $value doesn't exist.  Use that name anyway?"
4255                                 . UU/myread
4256                                 dflt=''
4257                                 case "$ans" in
4258                                 y*) type='';;
4259                                 *) echo " ";;
4260                                 esac
4261                                 ;;
4262                         esac
4263                         ;;
4264                 esac
4265                 ;;
4266         esac
4267 done
4268 cd UU
4269 ans="$value"
4270 rp="$orig_rp"
4271 dflt="$orig_dflt"
4272 rm -f getfile.ok
4273 test "X$gfpthkeep" != Xy && gfpth=""
4274 EOSC
4275
4276 : What should the include directory be ?
4277 echo " "
4278 $echo $n "Hmm...  $c"
4279 dflt='/usr/include'
4280 incpath=''
4281 mips_type=''
4282 if $test -f /bin/mips && /bin/mips; then
4283         echo "Looks like a MIPS system..."
4284         $cat >usr.c <<'EOCP'
4285 #ifdef SYSTYPE_BSD43
4286 /bsd43
4287 #endif
4288 EOCP
4289         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4290                 dflt='/bsd43/usr/include'
4291                 incpath='/bsd43'
4292                 mips_type='BSD 4.3'
4293         else
4294                 mips_type='System V'
4295         fi
4296         $rm -f usr.c usr.out
4297         echo "and you're compiling with the $mips_type compiler and libraries."
4298         xxx_prompt=y
4299         echo "exit 0" >mips
4300 else
4301         echo "Doesn't look like a MIPS system."
4302         xxx_prompt=n
4303         echo "exit 1" >mips
4304 fi
4305 chmod +x mips
4306 $eunicefix mips
4307 case "$usrinc" in
4308 '') ;;
4309 *) dflt="$usrinc";;
4310 esac
4311 case "$xxx_prompt" in
4312 y)      fn=d/
4313         echo " "
4314         rp='Where are the include files you want to use?'
4315         . ./getfile
4316         usrinc="$ans"
4317         ;;
4318 *)      usrinc="$dflt"
4319         ;;
4320 esac
4321
4322 : see how we invoke the C preprocessor
4323 echo " "
4324 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4325 cat <<'EOT' >testcpp.c
4326 #define ABC abc
4327 #define XYZ xyz
4328 ABC.XYZ
4329 EOT
4330 cd ..
4331 if test ! -f cppstdin; then
4332         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4333                 # AIX cc -E doesn't show the absolute headerfile
4334                 # locations but we'll cheat by using the -M flag.
4335                 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
4336         else
4337                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4338         fi
4339 else
4340         echo "Keeping your $hint cppstdin wrapper."
4341 fi
4342 chmod 755 cppstdin
4343 wrapper=`pwd`/cppstdin
4344 ok='false'
4345 cd UU
4346
4347 if $test "X$cppstdin" != "X" && \
4348         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4349         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4350 then
4351         echo "You used to use $cppstdin $cppminus so we'll use that again."
4352         case "$cpprun" in
4353         '') echo "But let's see if we can live without a wrapper..." ;;
4354         *)
4355                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4356                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4357                 then
4358                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4359                         ok='true'
4360                 else
4361                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4362                 fi
4363                 ;;
4364         esac
4365 else
4366         case "$cppstdin" in
4367         '') ;;
4368         *)
4369                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4370                 ;;
4371         esac
4372 fi
4373
4374 if $ok; then
4375         : nothing
4376 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4377         $cc -E <testcpp.c >testcpp.out 2>&1; \
4378         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379         echo "Yup, it does."
4380         x_cpp="$cc -E"
4381         x_minus='';
4382 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4383         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4384         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385         echo "Yup, it does."
4386         x_cpp="$cc -E"
4387         x_minus='-';
4388 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4389         $cc -P <testcpp.c >testcpp.out 2>&1; \
4390         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391         echo "Yipee, that works!"
4392         x_cpp="$cc -P"
4393         x_minus='';
4394 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4395         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4396         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397         echo "At long last!"
4398         x_cpp="$cc -P"
4399         x_minus='-';
4400 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4401         $cpp <testcpp.c >testcpp.out 2>&1; \
4402         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4403         echo "It works!"
4404         x_cpp="$cpp"
4405         x_minus='';
4406 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4407         $cpp - <testcpp.c >testcpp.out 2>&1; \
4408         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4409         echo "Hooray, it works!  I was beginning to wonder."
4410         x_cpp="$cpp"
4411         x_minus='-';
4412 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4413         $wrapper <testcpp.c >testcpp.out 2>&1; \
4414         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4415         x_cpp="$wrapper"
4416         x_minus=''
4417         echo "Eureka!"
4418 else
4419         dflt=''
4420         rp="No dice.  I can't find a C preprocessor.  Name one:"
4421         . ./myread
4422         x_cpp="$ans"
4423         x_minus=''
4424         $x_cpp <testcpp.c >testcpp.out 2>&1
4425         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4426                 echo "OK, that will do." >&4
4427         else
4428 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4429                 exit 1
4430         fi
4431 fi
4432
4433 case "$ok" in
4434 false)
4435         cppstdin="$x_cpp"
4436         cppminus="$x_minus"
4437         cpprun="$x_cpp"
4438         cpplast="$x_minus"
4439         set X $x_cpp
4440         shift
4441         case "$1" in
4442         "$cpp")
4443                 echo "Perhaps can we force $cc -E using a wrapper..."
4444                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4445                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4446                 then
4447                         echo "Yup, we can."
4448                         cppstdin="$wrapper"
4449                         cppminus='';
4450                 else
4451                         echo "Nope, we'll have to live without it..."
4452                 fi
4453                 ;;
4454         esac
4455         case "$cpprun" in
4456         "$wrapper")
4457                 cpprun=''
4458                 cpplast=''
4459                 ;;
4460         esac
4461         ;;
4462 esac
4463
4464 case "$cppstdin" in
4465 "$wrapper"|'cppstdin') ;;
4466 *) $rm -f $wrapper;;
4467 esac
4468 $rm -f testcpp.c testcpp.out
4469
4470 : Set private lib path
4471 case "$plibpth" in
4472 '') if ./mips; then
4473                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4474         fi;;
4475 esac
4476 case "$libpth" in
4477 ' ') dlist='';;
4478 '') dlist="$loclibpth $plibpth $glibpth";;
4479 *) dlist="$libpth";;
4480 esac
4481
4482 : Now check and see which directories actually exist, avoiding duplicates
4483 libpth=''
4484 for xxx in $dlist
4485 do
4486     if $test -d $xxx; then
4487                 case " $libpth " in
4488                 *" $xxx "*) ;;
4489                 *) libpth="$libpth $xxx";;
4490                 esac
4491     fi
4492 done
4493 $cat <<'EOM'
4494
4495 Some systems have incompatible or broken versions of libraries.  Among
4496 the directories listed in the question below, please remove any you
4497 know not to be holding relevant libraries, and add any that are needed.
4498 Say "none" for none.
4499
4500 EOM
4501 case "$libpth" in
4502 '') dflt='none';;
4503 *)
4504         set X $libpth
4505         shift
4506         dflt=${1+"$@"}
4507         ;;
4508 esac
4509 rp="Directories to use for library searches?"
4510 . ./myread
4511 case "$ans" in
4512 none) libpth=' ';;
4513 *) libpth="$ans";;
4514 esac
4515
4516 : compute shared library extension
4517 case "$so" in
4518 '')
4519         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4520                 dflt='sl'
4521         else
4522                 dflt='so'
4523         fi
4524         ;;
4525 *) dflt="$so";;
4526 esac
4527 $cat <<EOM
4528
4529 On some systems, shared libraries may be available.  Answer 'none' if
4530 you want to suppress searching of shared libraries for the remainder
4531 of this configuration.
4532
4533 EOM
4534 rp='What is the file extension used for shared libraries?'
4535 . ./myread
4536 so="$ans"
4537
4538 : Define several unixisms.
4539 : Hints files or command line option can be used to override them.
4540 : The convoluted testing is in case hints files set either the old
4541 : or the new name.
4542 case "$_exe" in
4543 '')     case "$exe_ext" in
4544         '')     ;;
4545         *)      _exe="$exe_ext" ;;
4546         esac
4547         ;;
4548 esac
4549 case "$_a" in
4550 '')     case "$lib_ext" in
4551     '') _a='.a';;
4552         *)      _a="$lib_ext" ;;
4553         esac
4554         ;;
4555 esac
4556 case "$_o" in
4557 '') case "$obj_ext" in
4558         '')     _o='.o';;
4559         *)      _o="$obj_ext";;
4560         esac
4561         ;;
4562 esac
4563 case "$p_" in
4564 '') case "$path_sep" in
4565         '')     p_=':';;
4566         *)      p_="$path_sep";;
4567         esac
4568         ;;
4569 esac
4570 exe_ext=$_exe
4571 lib_ext=$_a
4572 obj_ext=$_o
4573 path_sep=$p_
4574
4575 : Which makefile gets called first.  This is used by make depend.
4576 case "$firstmakefile" in
4577 '') firstmakefile='makefile';;
4578 esac
4579
4580 case "$ccflags" in
4581 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4582 esac
4583
4584 case "$uselongdouble" in
4585 $define|true|[yY]*)     dflt='y';;
4586 *) dflt='n';;
4587 esac
4588 cat <<EOM
4589
4590 Perl can be built to take advantage of long doubles which
4591 (if available) may give more accuracy and range for floating point numbers.
4592
4593 If this doesn't make any sense to you, just accept the default '$dflt'.
4594 EOM
4595 rp='Try to use long doubles if available?'
4596 . ./myread
4597 case "$ans" in
4598 y|Y)    val="$define"   ;;
4599 *)      val="$undef"    ;;
4600 esac
4601 set uselongdouble
4602 eval $setvar
4603
4604 case "$uselongdouble" in
4605 true|[yY]*) uselongdouble="$define" ;;
4606 esac
4607
4608 : Look for a hint-file generated 'call-back-unit'.  If the
4609 : user has specified that long doubles should be used,
4610 : we may need to set or change some other defaults.
4611 if $test -f uselongdouble.cbu; then
4612     echo "Your platform has some specific hints regarding long doubles, using them..."
4613     . ./uselongdouble.cbu
4614 else
4615     case "$uselongdouble" in
4616         $define)
4617                 $cat <<EOM
4618 (Your platform does not have any specific hints for long doubles.)
4619 EOM
4620         ;;
4621     esac
4622 fi
4623
4624 : Looking for optional libraries
4625 echo " "
4626 echo "Checking for optional libraries..." >&4
4627 case "$libs" in
4628 ' '|'') dflt='';;
4629 *) dflt="$libs";;
4630 esac
4631 case "$libswanted" in
4632 '') libswanted='c_s';;
4633 esac
4634 case "$usesocks" in
4635 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4636 esac
4637 libsfound=''
4638 libsfiles=''
4639 libsdirs=''
4640 libspath=''
4641 for thisdir in $libpth $xlibpth; do
4642   test -d $thisdir && libspath="$libspath $thisdir"
4643 done
4644 for thislib in $libswanted; do
4645         for thisdir in $libspath; do
4646             xxx=''
4647             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4648                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4649                 $test -f "$xxx" && eval $libscheck
4650                 $test -f "$xxx" && libstyle=shared
4651             fi
4652             if test ! -f "$xxx"; then
4653                 xxx=$thisdir/lib$thislib.$so
4654                 $test -f "$xxx" && eval $libscheck
4655                 $test -f "$xxx" && libstyle=shared
4656             fi  
4657             if test ! -f "$xxx"; then
4658                 xxx=$thisdir/lib$thislib$_a
4659                 $test -f "$xxx" && eval $libscheck
4660                 $test -f "$xxx" && libstyle=static
4661             fi
4662             if test ! -f "$xxx"; then
4663                 xxx=$thisdir/$thislib$_a
4664                 $test -f "$xxx" && eval $libscheck
4665                 $test -f "$xxx" && libstyle=static
4666             fi
4667             if test ! -f "$xxx"; then
4668                 xxx=$thisdir/lib${thislib}_s$_a
4669                 $test -f "$xxx" && eval $libscheck
4670                 $test -f "$xxx" && libstyle=static
4671                 $test -f "$xxx" && thislib=${thislib}_s
4672             fi
4673             if test ! -f "$xxx"; then
4674                 xxx=$thisdir/Slib$thislib$_a
4675                 $test -f "$xxx" && eval $libscheck
4676                 $test -f "$xxx" && libstyle=static
4677             fi
4678             if $test -f "$xxx"; then
4679                 case "$libstyle" in
4680                 shared) echo "Found -l$thislib (shared)." ;;
4681                 static) echo "Found -l$thislib." ;;
4682                 *)      echo "Found -l$thislib ($libstyle)." ;;
4683                 esac
4684                 case " $dflt " in
4685                 *"-l$thislib "*);;
4686                 *) dflt="$dflt -l$thislib"
4687                    libsfound="$libsfound $xxx"
4688                    yyy=`basename $xxx`
4689                    libsfiles="$libsfiles $yyy"
4690                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4691                    case " $libsdirs " in
4692                    *" $yyy "*) ;;
4693                    *) libsdirs="$libsdirs $yyy" ;;
4694                    esac
4695                    ;;
4696                 esac
4697                 break
4698             fi  
4699         done
4700         if $test ! -f "$xxx"; then
4701             echo "No -l$thislib."
4702         fi
4703 done
4704 set X $dflt
4705 shift
4706 dflt="$*"
4707 case "$libs" in
4708 '') dflt="$dflt";;
4709 *) dflt="$libs";;
4710 esac
4711 case "$dflt" in
4712 ' '|'') dflt='none';;
4713 esac
4714
4715 $cat <<EOM
4716
4717 In order to compile $package on your machine, a number of libraries
4718 are usually needed.  Include any other special libraries here as well.
4719 Say "none" for none.  The default list is almost always right.
4720 EOM
4721
4722 echo " "
4723 rp="What libraries to use?"
4724 . ./myread
4725 case "$ans" in
4726 none) libs=' ';;
4727 *) libs="$ans";;
4728 esac
4729
4730 : determine optimization, if desired, or use for debug flag also
4731 case "$optimize" in
4732 ' '|$undef) dflt='none';;
4733 '') dflt='-O';;
4734 *) dflt="$optimize";;
4735 esac
4736 $cat <<EOH
4737
4738 By default, $package compiles with the -O flag to use the optimizer.
4739 Alternately, you might want to use the symbolic debugger, which uses
4740 the -g flag (on traditional Unix systems).  Either flag can be
4741 specified here.  To use neither flag, specify the word "none".
4742
4743 EOH
4744 rp="What optimizer/debugger flag should be used?"
4745 . ./myread
4746 optimize="$ans"
4747 case "$optimize" in
4748 'none') optimize=" ";;
4749 esac
4750
4751 dflt=''
4752 : We will not override a previous value, but we might want to
4753 : augment a hint file
4754 case "$hint" in
4755 default|recommended)
4756         case "$gccversion" in
4757         1*) dflt='-fpcc-struct-return' ;;
4758         esac
4759         case "$optimize" in
4760         *-g*) dflt="$dflt -DDEBUGGING";;
4761         esac
4762         case "$gccversion" in
4763         2*) if test -d /etc/conf/kconfig.d &&
4764                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4765                 then
4766                         # Interactive Systems (ISC) POSIX mode.
4767                         dflt="$dflt -posix"
4768                 fi
4769                 ;;
4770         esac
4771         case "$gccversion" in
4772         1*) ;;
4773         2.[0-8]*) ;;
4774         ?*)     echo " "
4775                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4776                 echo 'int main(void) { return 0; }' > gcctest.c
4777                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4778                         echo "Yes, it does." 2>&1
4779                         case "$ccflags" in
4780                         *strict-aliasing*)
4781                                 echo "Leaving current flags $ccflags alone." 2>&1
4782                                 ;;
4783                         *) dflt="$dflt -fno-strict-aliasing" ;;
4784                         esac
4785                 else
4786                         echo "Nope, it doesn't, but that's ok." 2>&1
4787                 fi
4788                 ;;
4789         esac
4790         # For gcc, adding -pipe speeds up compilations for some, but apparently
4791         # some assemblers can't read from stdin.  (It also slows down compilations
4792         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4793         case "$gccversion" in
4794         ?*)     echo " "
4795                 echo "Checking if your compiler accepts -pipe" 2>&1
4796                 echo 'int main(void) { return 0; }' > gcctest.c
4797                 if $cc -pipe -o gcctest gcctest.c; then
4798                         echo "Yes, it does." 2>&1
4799                         case "$ccflags" in
4800                         *-pipe*)
4801                                 echo "Leaving current flags $ccflags alone." 2>&1
4802                                 ;;
4803                         *) dflt="$dflt -pipe" ;;
4804                         esac
4805                 else
4806                         echo "Nope, it doesn't, but that's ok." 2>&1
4807                 fi
4808
4809                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4810                 echo 'int main(void) { return 0; }' > gcctest.c
4811                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4812                         echo "Yes, it does." 2>&1
4813                         case "$ccflags" in
4814                         *-Wdeclaration-after-statement*)
4815                                 echo "Leaving current flags $ccflags alone." 2>&1
4816                                 ;;
4817                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4818                         esac
4819                 else
4820                         echo "Nope, it doesn't, but that's ok." 2>&1
4821                 fi
4822                 ;;
4823         esac
4824         ;;
4825 esac
4826
4827 case "$mips_type" in
4828 *BSD*|'') inclwanted="$locincpth $usrinc";;
4829 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4830 esac
4831 for thisincl in $inclwanted; do
4832         if $test -d $thisincl; then
4833                 if $test x$thisincl != x$usrinc; then
4834                         case "$dflt" in
4835                         *" -I$thisincl "*);;
4836                         *) dflt="$dflt -I$thisincl ";;
4837                         esac
4838                 fi
4839         fi
4840 done
4841
4842 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4843         xxx=true;
4844 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4845         xxx=true;
4846 else
4847         xxx=false;
4848 fi;
4849 if $xxx; then
4850         case "$dflt" in
4851         *$2*);;
4852         *) dflt="$dflt -D$2";;
4853         esac;
4854 fi'
4855
4856 set signal.h LANGUAGE_C; eval $inctest
4857
4858 case "$usesocks" in
4859 $define)
4860         ccflags="$ccflags -DSOCKS"
4861         ;;
4862 esac
4863
4864 case "$hint" in
4865 default|recommended) dflt="$ccflags $dflt" ;;
4866 *) dflt="$ccflags";;
4867 esac
4868
4869 case "$dflt" in
4870 ''|' ') dflt=none;;
4871 esac
4872
4873 $cat <<EOH
4874
4875 Your C compiler may want other flags.  For this question you should include
4876 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4877 but you should NOT include libraries or ld flags like -lwhatever.  If you
4878 want $package to honor its debug switch, you should include -DDEBUGGING here.
4879 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4880
4881 To use no flags, specify the word "none".
4882
4883 EOH
4884 set X $dflt
4885 shift
4886 dflt=${1+"$@"}
4887 rp="Any additional cc flags?"
4888 . ./myread
4889 case "$ans" in
4890 none) ccflags='';;
4891 *) ccflags="$ans";;
4892 esac
4893
4894 : the following weeds options from ccflags that are of no interest to cpp
4895 case "$cppflags" in
4896 '') cppflags="$ccflags" ;;
4897 *)  cppflags="$cppflags $ccflags" ;;
4898 esac
4899 case "$gccversion" in
4900 1*) cppflags="$cppflags -D__GNUC__"
4901 esac
4902 case "$mips_type" in
4903 '');;
4904 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4905 esac
4906 case "$cppflags" in
4907 '');;
4908 *)
4909         echo " "
4910         echo "Let me guess what the preprocessor flags are..." >&4
4911         set X $cppflags
4912         shift
4913         cppflags=''
4914         $cat >cpp.c <<'EOM'
4915 #define BLURFL foo
4916
4917 BLURFL xx LFRULB
4918 EOM
4919         previous=''
4920         for flag in $*
4921         do
4922                 case "$flag" in
4923                 -*) ftry="$flag";;
4924                 *) ftry="$previous $flag";;
4925                 esac
4926                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4927                         >cpp1.out 2>/dev/null && \
4928                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4929                         >cpp2.out 2>/dev/null && \
4930                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4931                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4932                 then
4933                         cppflags="$cppflags $ftry"
4934                         previous=''
4935                 else
4936                         previous="$flag"
4937                 fi
4938         done
4939         set X $cppflags
4940         shift
4941         cppflags=${1+"$@"}
4942         case "$cppflags" in
4943         *-*)  echo "They appear to be: $cppflags";;
4944         esac
4945         $rm -f cpp.c cpp?.out
4946         ;;
4947 esac
4948
4949 : flags used in final linking phase
4950 case "$ldflags" in
4951 '') if ./venix; then
4952                 dflt='-i -z'
4953         else
4954                 dflt=''
4955         fi
4956         case "$ccflags" in
4957         *-posix*) dflt="$dflt -posix" ;;
4958         esac
4959         ;;
4960 *) dflt="$ldflags";;
4961 esac
4962
4963 : Try to guess additional flags to pick up local libraries.
4964 for thislibdir in $libpth; do
4965         case " $loclibpth " in
4966         *" $thislibdir "*)
4967                 case "$dflt " in
4968                 *"-L$thislibdir "*) ;;
4969                 *)  dflt="$dflt -L$thislibdir" ;;
4970                 esac
4971                 ;;
4972         esac
4973 done
4974
4975 case "$dflt" in
4976 '') dflt='none' ;;
4977 esac
4978
4979 $cat <<EOH
4980
4981 Your C linker may need flags.  For this question you should
4982 include -L/whatever and any other flags used by the C linker, but you
4983 should NOT include libraries like -lwhatever.
4984
4985 Make sure you include the appropriate -L/path flags if your C linker
4986 does not normally search all of the directories you specified above,
4987 namely
4988         $libpth
4989 To use no flags, specify the word "none".
4990
4991 EOH
4992
4993 rp="Any additional ld flags (NOT including libraries)?"
4994 . ./myread
4995 case "$ans" in
4996 none) ldflags='';;
4997 *) ldflags="$ans";;
4998 esac
4999 rmlist="$rmlist pdp11"
5000
5001 : coherency check
5002 echo " "
5003 echo "Checking your choice of C compiler and flags for coherency..." >&4
5004 $cat > try.c <<'EOF'
5005 #include <stdio.h>
5006 int main() { printf("Ok\n"); return(0); }
5007 EOF
5008 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5009 shift
5010 $cat >try.msg <<'EOM'
5011 I've tried to compile and run the following simple program:
5012
5013 EOM
5014 $cat try.c >> try.msg
5015
5016 $cat >> try.msg <<EOM
5017
5018 I used the command:
5019
5020         $*
5021         $run ./try
5022
5023 and I got the following output:
5024
5025 EOM
5026 dflt=y
5027 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5028         if $sh -c "$run ./try" >>try.msg 2>&1; then
5029                 xxx=`$run ./try`
5030                 case "$xxx" in
5031                 "Ok") dflt=n ;;
5032                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5033                         case " $libs " in
5034                         *" -lsfio "*)
5035                                 cat >> try.msg <<'EOQS'
5036 If $libs contains -lsfio, and sfio is mis-configured, then it
5037 sometimes (apparently) runs and exits with a 0 status, but with no
5038 output!  It may have to do with sfio's use of _exit vs. exit.
5039
5040 EOQS
5041                                 rp="You have a big problem.  Shall I abort Configure"
5042                                 dflt=y
5043                                 ;;
5044                         esac
5045                         ;;
5046                 esac
5047         else
5048                 echo "The program compiled OK, but exited with status $?." >>try.msg
5049                 rp="You have a problem.  Shall I abort Configure"
5050                 dflt=y
5051         fi
5052 else
5053         echo "I can't compile the test program." >>try.msg
5054         rp="You have a BIG problem.  Shall I abort Configure"
5055         dflt=y
5056 fi
5057 case "$dflt" in
5058 y)
5059         $cat try.msg >&4
5060         case "$knowitall" in
5061         '')
5062                 echo "(The supplied flags or libraries might be incorrect.)"
5063                 ;;
5064         *) dflt=n;;
5065         esac
5066         echo " "
5067         . ./myread
5068         case "$ans" in
5069         n*|N*) ;;
5070         *)      echo "Ok.  Stopping Configure." >&4
5071                 exit 1
5072                 ;;
5073         esac
5074         ;;
5075 n) echo "OK, that should do.";;
5076 esac
5077 $rm -f try try.* core
5078
5079 : define a shorthand compile call
5080 compile='
5081 mc_file=$1;
5082 shift;
5083 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5084 : define a shorthand compile call for compilations that should be ok.
5085 compile_ok='
5086 mc_file=$1;
5087 shift;
5088 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5089
5090 : determine filename position in cpp output
5091 echo " "
5092 echo "Computing filename position in cpp output for #include directives..." >&4
5093 case "$osname" in
5094 vos) testaccess=-e ;;
5095 *)   testaccess=-r ;;
5096 esac
5097 echo '#include <stdio.h>' > foo.c
5098 $cat >fieldn <<EOF
5099 $startsh
5100 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5101 $grep '^[       ]*#.*stdio\.h' | \
5102 while read cline; do
5103         pos=1
5104         set \$cline
5105         while $test \$# -gt 0; do
5106                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5107                         echo "\$pos"
5108                         exit 0
5109                 fi
5110                 shift
5111                 pos=\`expr \$pos + 1\`
5112         done
5113 done
5114 EOF
5115 chmod +x fieldn
5116 fieldn=`./fieldn`
5117 $rm -f foo.c fieldn
5118 case $fieldn in
5119 '') pos='???';;
5120 1) pos=first;;
5121 2) pos=second;;
5122 3) pos=third;;
5123 *) pos="${fieldn}th";;
5124 esac
5125 echo "Your cpp writes the filename in the $pos field of the line."
5126
5127 case "$osname" in
5128 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5129 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5130 *)   cppfilter='' ;;
5131 esac
5132 : locate header file
5133 $cat >findhdr <<EOF
5134 $startsh
5135 wanted=\$1
5136 name=''
5137 for usrincdir in $usrinc
5138 do
5139         if test -f \$usrincdir/\$wanted; then
5140                 echo "\$usrincdir/\$wanted"
5141                 exit 0
5142         fi
5143 done
5144 awkprg='{ print \$$fieldn }'
5145 echo "#include <\$wanted>" > foo\$\$.c
5146 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5147 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5148 while read cline; do
5149         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5150         case "\$name" in
5151         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5152         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5153         *) exit 2;;
5154         esac;
5155 done;
5156 #
5157 # status = 0: grep returned 0 lines, case statement not executed
5158 # status = 1: headerfile found
5159 # status = 2: while loop executed, no headerfile found
5160 #
5161 status=\$?
5162 $rm -f foo\$\$.c;
5163 if test \$status -eq 1; then
5164         exit 0;
5165 fi
5166 exit 1
5167 EOF
5168 chmod +x findhdr
5169
5170 : define an alternate in-header-list? function
5171 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5172 cont=true; xxf="echo \"<\$1> found.\" >&4";
5173 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5174 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5175 esac;
5176 case $# in 4) instead=instead;; *) instead="at last";; esac;
5177 while $test "$cont"; do
5178         xxx=`./findhdr $1`
5179         var=$2; eval "was=\$$2";
5180         if $test "$xxx" && $test -r "$xxx";
5181         then eval $xxf;
5182         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5183                 cont="";
5184         else eval $xxnf;
5185         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5186         set $yyy; shift; shift; yyy=$@;
5187         case $# in 0) cont="";;
5188         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5189                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5190         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5191                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5192         esac;
5193 done;
5194 while $test "$yyy";
5195 do set $yyy; var=$2; eval "was=\$$2";
5196         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5197         set $yyy; shift; shift; yyy=$@;
5198 done'
5199
5200 : see if stdlib is available
5201 set stdlib.h i_stdlib
5202 eval $inhdr
5203
5204 : check for lengths of integral types
5205 echo " "
5206 case "$intsize" in
5207 '')
5208         echo "Checking to see how big your integers are..." >&4
5209         $cat >try.c <<EOCP
5210 #include <stdio.h>
5211 #$i_stdlib I_STDLIB
5212 #ifdef I_STDLIB
5213 #include <stdlib.h>
5214 #endif
5215 int main()
5216 {
5217         printf("intsize=%d;\n", (int)sizeof(int));
5218         printf("longsize=%d;\n", (int)sizeof(long));
5219         printf("shortsize=%d;\n", (int)sizeof(short));
5220         exit(0);
5221 }
5222 EOCP
5223         set try
5224         if eval $compile_ok && $run ./try > /dev/null; then
5225                 eval `$run ./try`
5226                 echo "Your integers are $intsize bytes long."
5227                 echo "Your long integers are $longsize bytes long."
5228                 echo "Your short integers are $shortsize bytes long."
5229         else
5230                 $cat >&4 <<EOM
5231 !
5232 Help! I can't compile and run the intsize test program: please enlighten me!
5233 (This is probably a misconfiguration in your system or libraries, and
5234 you really ought to fix it.  Still, I'll try anyway.)
5235 !
5236 EOM
5237                 dflt=4
5238                 rp="What is the size of an integer (in bytes)?"
5239                 . ./myread
5240                 intsize="$ans"
5241                 dflt=$intsize
5242                 rp="What is the size of a long integer (in bytes)?"
5243                 . ./myread
5244                 longsize="$ans"
5245                 dflt=2
5246                 rp="What is the size of a short integer (in bytes)?"
5247                 . ./myread
5248                 shortsize="$ans"
5249         fi
5250         ;;
5251 esac
5252 $rm -f try try.*
5253
5254 : check for long long
5255 echo " "
5256 echo "Checking to see if you have long long..." >&4
5257 echo 'int main() { long long x = 7; return 0; }' > try.c
5258 set try
5259 if eval $compile; then
5260         val="$define"
5261         echo "You have long long."
5262 else
5263         val="$undef"
5264         echo "You do not have long long."
5265 fi
5266 $rm try.*
5267 set d_longlong
5268 eval $setvar
5269
5270 : check for length of long long
5271 case "${d_longlong}${longlongsize}" in
5272 $define)
5273         echo " "
5274         echo "Checking to see how big your long longs are..." >&4
5275         $cat >try.c <<'EOCP'
5276 #include <stdio.h>
5277 int main()
5278 {
5279     printf("%d\n", (int)sizeof(long long));
5280     return(0);
5281 }
5282 EOCP
5283         set try
5284         if eval $compile_ok; then
5285                 longlongsize=`$run ./try`
5286                 echo "Your long longs are $longlongsize bytes long."
5287         else
5288                 dflt='8'
5289                 echo " "
5290                 echo "(I can't seem to compile the test program.  Guessing...)"
5291                 rp="What is the size of a long long (in bytes)?"
5292                 . ./myread
5293                 longlongsize="$ans"
5294         fi
5295         if $test "X$longsize" = "X$longlongsize"; then
5296                 echo "(That isn't any different from an ordinary long.)"
5297         fi      
5298         ;;
5299 esac
5300 $rm -f try.* try
5301
5302 : see if inttypes.h is available
5303 : we want a real compile instead of Inhdr because some systems
5304 : have an inttypes.h which includes non-existent headers
5305 echo " "
5306 $cat >try.c <<EOCP
5307 #include <inttypes.h>
5308 int main() {
5309         static int32_t foo32 = 0x12345678;
5310 }
5311 EOCP
5312 set try
5313 if eval $compile; then
5314         echo "<inttypes.h> found." >&4
5315         val="$define"
5316 else
5317         echo "<inttypes.h> NOT found." >&4
5318         val="$undef"
5319 fi
5320 $rm -f try.c try
5321 set i_inttypes
5322 eval $setvar
5323
5324 : check for int64_t
5325 echo " "
5326 echo "Checking to see if you have int64_t..." >&4
5327 $cat >try.c <<EOCP
5328 #include <sys/types.h>
5329 #$i_inttypes I_INTTYPES
5330 #ifdef I_INTTYPES
5331 #include <inttypes.h>
5332 #endif
5333 int main() { int64_t x = 7; }
5334 EOCP
5335 set try
5336 if eval $compile; then
5337         val="$define"
5338         echo "You have int64_t."
5339 else
5340         val="$undef"
5341         echo "You do not have int64_t."
5342 fi
5343 $rm -f try try.*
5344 set d_int64_t
5345 eval $setvar
5346
5347
5348 echo " "
5349 echo "Checking which 64-bit integer type we could use..." >&4
5350
5351 case "$intsize" in
5352 8) val=int
5353    set quadtype
5354    eval $setvar
5355    val='"unsigned int"'
5356    set uquadtype
5357    eval $setvar
5358    quadkind=1
5359    ;;
5360 *) case "$longsize" in
5361    8) val=long
5362       set quadtype
5363       eval $setvar
5364       val='"unsigned long"'
5365       set uquadtype
5366       eval $setvar
5367       quadkind=2
5368       ;;
5369    *) case "$d_longlong:$longlongsize" in
5370       define:8)
5371         val='"long long"'
5372         set quadtype
5373         eval $setvar
5374         val='"unsigned long long"'
5375         set uquadtype
5376         eval $setvar
5377         quadkind=3
5378         ;;
5379       *) case "$d_int64_t" in
5380          define)
5381            val=int64_t
5382            set quadtype
5383            eval $setvar
5384            val=uint64_t
5385            set uquadtype
5386            eval $setvar
5387            quadkind=4
5388            ;;
5389          esac
5390          ;;
5391       esac
5392       ;;
5393    esac
5394    ;;
5395 esac
5396
5397 case "$quadtype" in
5398 '')     echo "Alas, no 64-bit integer types in sight." >&4
5399         d_quad="$undef"
5400         ;;
5401 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5402         d_quad="$define"
5403         ;;
5404 esac
5405
5406
5407 case "$uselonglong" in
5408 "$define"|true|[yY]*)
5409         cat <<EOM >&4
5410
5411 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5412 EOM
5413         use64bitint="$define"
5414         ;;
5415 esac                          
5416 case "$use64bits" in
5417 "$define"|true|[yY]*)
5418         cat <<EOM >&4
5419
5420 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5421 EOM
5422         use64bitint="$define"
5423         ;;
5424 esac                          
5425 case "$use64bitints" in
5426 "$define"|true|[yY]*)
5427         cat <<EOM >&4
5428
5429 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5430 EOM
5431         use64bitint="$define"
5432         ;;
5433 esac                          
5434 case "$use64bitsint" in
5435 "$define"|true|[yY]*)
5436         cat <<EOM >&4
5437
5438 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5439 EOM
5440         use64bitint="$define"
5441         ;;
5442 esac                          
5443 case "$uselonglongs" in
5444 "$define"|true|[yY]*)
5445         cat <<EOM >&4
5446
5447 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5448 EOM
5449         use64bitint="$define"
5450         ;;
5451 esac                          
5452 case "$use64bitsall" in
5453 "$define"|true|[yY]*)
5454         cat <<EOM >&4
5455
5456 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5457 EOM
5458         use64bitall="$define"
5459         ;;
5460 esac                          
5461
5462 case "$ccflags" in
5463 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5464 esac
5465 case "$use64bitall" in
5466 "$define"|true|[yY]*) use64bitint="$define" ;;
5467 esac
5468
5469 case "$longsize" in
5470 8) cat <<EOM
5471
5472 You have natively 64-bit long integers.
5473 EOM
5474    val="$define"
5475    ;;
5476 *) case "$use64bitint" in
5477    "$define"|true|[yY]*) dflt='y';;
5478    *) dflt='n';;
5479    esac
5480    case "$d_quad" in
5481    "$define") ;;
5482    *) dflt='n' ;;
5483    esac
5484    cat <<EOM
5485
5486 Perl can be built to take advantage of 64-bit integer types
5487 on some systems.  To do so, Configure can be run with -Duse64bitint.
5488 Choosing this option will most probably introduce binary incompatibilities.
5489
5490 If this doesn't make any sense to you, just accept the default '$dflt'.
5491 (The default has been chosen based on your configuration.)
5492 EOM
5493    rp='Try to use 64-bit integers, if available?'
5494    . ./myread
5495    case "$ans" in
5496    [yY]*) val="$define" ;;
5497    *)     val="$undef"  ;;
5498    esac
5499    ;;
5500 esac
5501 set use64bitint
5502 eval $setvar
5503
5504 case "$use64bitall" in
5505 "$define"|true|[yY]*) dflt='y' ;;
5506 *) case "$longsize" in
5507    8) dflt='y' ;;
5508    *) dflt='n' ;;
5509    esac
5510    ;;
5511 esac    
5512 cat <<EOM
5513
5514 You may also choose to try maximal 64-bitness.  It means using as much
5515 64-bitness as possible on the platform.  This in turn means even more
5516 binary incompatibilities.  On the other hand, your platform may not
5517 have any more 64-bitness available than what you already have chosen.
5518
5519 If this doesn't make any sense to you, just accept the default '$dflt'.
5520 (The default has been chosen based on your configuration.)
5521 EOM
5522 rp='Try to use maximal 64-bit support, if available?'
5523 . ./myread
5524 case "$ans" in
5525 [yY]*) val="$define" ;;
5526 *)     val="$undef"  ;;
5527 esac
5528 set use64bitall
5529 eval $setvar
5530 case "$use64bitall" in
5531 "$define")
5532         case "$use64bitint" in
5533         "$undef")
5534                 cat <<EOM
5535
5536 Since you have chosen a maximally 64-bit build, I'm also turning on
5537 the use of 64-bit integers.
5538 EOM
5539                 use64bitint="$define" ;;
5540         esac
5541         ;;
5542 esac
5543
5544 : Look for a hint-file generated 'call-back-unit'.  If the
5545 : user has specified that a 64-bit perl is to be built,
5546 : we may need to set or change some other defaults.
5547 if $test -f use64bitint.cbu; then
5548         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5549         . ./use64bitint.cbu
5550 fi
5551 case "$use64bitint" in
5552 "$define"|true|[yY]*)
5553         case "$longsize" in
5554         4) case "$archname64" in
5555            '') archname64=64int ;;
5556            esac
5557            ;;
5558         esac
5559         ;;
5560 esac
5561
5562 : Look for a hint-file generated 'call-back-unit'.  If the
5563 : user has specified that a maximally 64-bit perl is to be built,
5564 : we may need to set or change some other defaults.
5565 if $test -f use64bitall.cbu; then
5566         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5567         . ./use64bitall.cbu
5568 fi
5569 case "$use64bitall" in
5570 "$define"|true|[yY]*)
5571         case "$longsize" in
5572         4) case "$archname64" in
5573            ''|64int) archname64=64all ;;
5574            esac
5575            ;;
5576         esac
5577         ;;
5578 esac
5579
5580 case "$d_quad:$use64bitint" in
5581 $undef:$define)
5582         cat >&4 <<EOF
5583
5584 *** You have chosen to use 64-bit integers,
5585 *** but none can be found.
5586 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5587 *** Cannot continue, aborting.
5588
5589 EOF
5590         exit 1
5591         ;;
5592 esac
5593
5594 : check for length of double
5595 echo " "
5596 case "$doublesize" in
5597 '')
5598         echo "Checking to see how big your double precision numbers are..." >&4
5599         $cat >try.c <<EOCP
5600 #include <stdio.h>
5601 #$i_stdlib I_STDLIB
5602 #ifdef I_STDLIB
5603 #include <stdlib.h>
5604 #endif
5605 int main()
5606 {
5607     printf("%d\n", (int)sizeof(double));
5608     exit(0);
5609 }
5610 EOCP
5611         set try
5612         if eval $compile_ok; then
5613                 doublesize=`$run ./try`
5614                 echo "Your double is $doublesize bytes long."
5615         else
5616                 dflt='8'
5617                 echo "(I can't seem to compile the test program.  Guessing...)"
5618                 rp="What is the size of a double precision number (in bytes)?"
5619                 . ./myread
5620                 doublesize="$ans"
5621         fi
5622         ;;
5623 esac
5624 $rm -f try.c try
5625
5626 : check for long doubles
5627 echo " "
5628 echo "Checking to see if you have long double..." >&4
5629 echo 'int main() { long double x = 7.0; }' > try.c
5630 set try
5631 if eval $compile; then
5632         val="$define"
5633         echo "You have long double."
5634 else
5635         val="$undef"
5636         echo "You do not have long double."
5637 fi
5638 $rm try.*
5639 set d_longdbl
5640 eval $setvar
5641
5642 : check for length of long double
5643 case "${d_longdbl}${longdblsize}" in
5644 $define)
5645         echo " "
5646         echo "Checking to see how big your long doubles are..." >&4
5647         $cat >try.c <<'EOCP'
5648 #include <stdio.h>
5649 int main()
5650 {
5651         printf("%d\n", sizeof(long double));
5652 }
5653 EOCP
5654         set try
5655         set try
5656         if eval $compile; then
5657                 longdblsize=`$run ./try`
5658                 echo "Your long doubles are $longdblsize bytes long."
5659         else
5660                 dflt='8'
5661                 echo " "
5662                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5663                 rp="What is the size of a long double (in bytes)?"
5664                 . ./myread
5665                 longdblsize="$ans"
5666         fi
5667         if $test "X$doublesize" = "X$longdblsize"; then
5668                 echo "That isn't any different from an ordinary double."
5669                 echo "I'll keep your setting anyway, but you may see some"
5670                 echo "harmless compilation warnings."
5671         fi      
5672         ;;
5673 esac
5674 $rm -f try.* try
5675
5676 : determine the architecture name
5677 echo " "
5678 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5679         tarch=`arch`"-$osname"
5680 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5681         if uname -m > tmparch 2>&1 ; then
5682                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5683                         -e 's/$/'"-$osname/" tmparch`
5684         else
5685                 tarch="$osname"
5686         fi
5687         $rm -f tmparch
5688 else
5689         tarch="$osname"
5690 fi
5691 case "$myarchname" in
5692 ''|"$tarch") ;;
5693 *)
5694         echo "(Your architecture name used to be $myarchname.)"
5695         archname=''
5696         ;;
5697 esac
5698 case "$targetarch" in
5699 '') ;;
5700 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5701 esac
5702 myarchname="$tarch"
5703 case "$archname" in
5704 '') dflt="$tarch";;
5705 *) dflt="$archname";;
5706 esac
5707 rp='What is your architecture name'
5708 . ./myread
5709 archname="$ans"
5710 case "$usethreads" in
5711 $define)
5712         echo "Threads selected." >&4
5713         case "$archname" in
5714         *-thread*) echo "...and architecture name already has -thread." >&4
5715                 ;;
5716         *)      archname="$archname-thread"
5717                 echo "...setting architecture name to $archname." >&4
5718                 ;;
5719         esac
5720         ;;
5721 esac
5722 case "$usemultiplicity" in
5723 $define)
5724         echo "Multiplicity selected." >&4
5725         case "$archname" in
5726         *-multi*) echo "...and architecture name already has -multi." >&4
5727                 ;;
5728         *)      archname="$archname-multi"
5729                 echo "...setting architecture name to $archname." >&4
5730                 ;;
5731         esac
5732         ;;
5733 esac
5734 case "$use64bitint$use64bitall" in
5735 *"$define"*)
5736         case "$archname64" in
5737         '')
5738                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5739                 ;;
5740         *)
5741                 case "$use64bitint" in
5742                 "$define") echo "64 bit integers selected." >&4 ;;
5743                 esac
5744                 case "$use64bitall" in
5745                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5746                 esac
5747                 case "$archname" in
5748                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5749                         ;;
5750                 *)      archname="$archname-$archname64"
5751                         echo "...setting architecture name to $archname." >&4
5752                         ;;
5753                 esac
5754                 ;;
5755         esac
5756 esac
5757 case "$uselongdouble" in
5758 $define)
5759         echo "Long doubles selected." >&4
5760         case "$longdblsize" in
5761         $doublesize)
5762                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5763                 ;;
5764         *)
5765                 case "$archname" in
5766                 *-ld*) echo "...and architecture name already has -ld." >&4
5767                         ;;
5768                 *)      archname="$archname-ld"
5769                         echo "...setting architecture name to $archname." >&4
5770                         ;;
5771                 esac
5772                 ;;
5773         esac
5774         ;;
5775 esac
5776 case "$useperlio" in
5777 $define)
5778         echo "Perlio selected." >&4
5779         ;;
5780 *)
5781         echo "Perlio not selected, using stdio." >&4
5782         case "$archname" in
5783         *-stdio*) echo "...and architecture name already has -stdio." >&4
5784                 ;;
5785         *)      archname="$archname-stdio"
5786                 echo "...setting architecture name to $archname." >&4
5787                 ;;
5788         esac
5789         ;;
5790 esac
5791 if $test -f archname.cbu; then
5792         echo "Your platform has some specific hints for architecture name, using them..."
5793         . ./archname.cbu
5794 fi
5795
5796 : determine root of directory hierarchy where package will be installed.
5797 case "$prefix" in
5798 '')
5799         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5800         ;;
5801 *?/)
5802         dflt=`echo "$prefix" | sed 's/.$//'`
5803         ;;
5804 *)
5805         dflt="$prefix"
5806         ;;
5807 esac
5808 $cat <<EOM
5809
5810 By default, $package will be installed in $dflt/bin, manual pages
5811 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5812 installation directories. Typically this is something like /usr/local.
5813 If you wish to have binaries under /usr/bin but other parts of the
5814 installation under /usr/local, that's ok: you will be prompted
5815 separately for each of the installation directories, the prefix being
5816 only used to set the defaults.
5817
5818 EOM
5819 fn=d~
5820 rp='Installation prefix to use?'
5821 . ./getfile
5822 oldprefix=''
5823 case "$prefix" in
5824 '') ;;
5825 *)
5826         case "$ans" in
5827         "$prefix") ;;
5828         *) oldprefix="$prefix";;
5829         esac
5830         ;;
5831 esac
5832 prefix="$ans"
5833 prefixexp="$ansexp"
5834
5835 case "$afsroot" in
5836 '')     afsroot=/afs ;;
5837 *)      afsroot=$afsroot ;;
5838 esac
5839
5840 : is AFS running?
5841 echo " "
5842 case "$afs" in
5843 $define|true)   afs=true ;;
5844 $undef|false)   afs=false ;;
5845 *)      if test -d $afsroot; then
5846                 afs=true
5847         else
5848                 afs=false
5849         fi
5850         ;;
5851 esac
5852 if $afs; then
5853         echo "AFS may be running... I'll be extra cautious then..." >&4
5854 else
5855         echo "AFS does not seem to be running..." >&4
5856 fi
5857
5858 : determine installation prefix for where package is to be installed.
5859 if $afs; then 
5860 $cat <<EOM
5861
5862 Since you are running AFS, I need to distinguish the directory in which
5863 files will reside from the directory in which they are installed (and from
5864 which they are presumably copied to the former directory by occult means).
5865
5866 EOM
5867         case "$installprefix" in
5868         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5869         *) dflt="$installprefix";;
5870         esac
5871 else
5872 $cat <<EOM
5873
5874 In some special cases, particularly when building $package for distribution,
5875 it is convenient to distinguish the directory in which files should be
5876 installed from the directory ($prefix) in which they will
5877 eventually reside.  For most users, these two directories are the same.
5878
5879 EOM
5880         case "$installprefix" in
5881         '') dflt=$prefix ;;
5882         *) dflt=$installprefix;;
5883         esac
5884 fi
5885 fn=d~
5886 rp='What installation prefix should I use for installing files?'
5887 . ./getfile
5888 installprefix="$ans"
5889 installprefixexp="$ansexp"
5890
5891 : set the prefixit variable, to compute a suitable default value
5892 prefixit='case "$3" in
5893 ""|none)
5894         case "$oldprefix" in
5895         "") eval "$1=\"\$$2\"";;
5896         *)
5897                 case "$3" in
5898                 "") eval "$1=";;
5899                 none)
5900                         eval "tp=\"\$$2\"";
5901                         case "$tp" in
5902                         ""|" ") eval "$1=\"\$$2\"";;
5903                         *) eval "$1=";;
5904                         esac;;
5905                 esac;;
5906         esac;;
5907 *)
5908         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5909         case "$tp" in
5910         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5911         /*-$oldprefix/*|\~*-$oldprefix/*)
5912                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5913         *) eval "$1=\"\$$2\"";;
5914         esac;;
5915 esac'
5916
5917 : get the patchlevel
5918 echo " "
5919 echo "Getting the current patchlevel..." >&4
5920 if $test -r $rsrc/patchlevel.h;then
5921         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5922         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5923         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5924         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5925         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5926         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5927         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5928 else
5929         revision=0
5930         patchlevel=0
5931         subversion=0
5932         api_revision=0
5933         api_version=0
5934         api_subversion=0
5935         perl_patchlevel=0
5936         $echo "(You do not have patchlevel.h.  Eek.)"
5937 fi
5938 if $test -r $rsrc/.patch ; then
5939         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5940                 perl_patchlevel=`cat $rsrc/.patch`
5941         fi
5942 fi
5943 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5944 version_patchlevel_string="version $patchlevel subversion $subversion"
5945 case "$perl_patchlevel" in
5946 0|'') ;;
5947 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5948 esac
5949
5950 $echo "(You have $package $version_patchlevel_string.)"
5951
5952 case "$osname" in
5953 dos|vms)
5954         : XXX Should be a Configure test for double-dots in filenames.
5955         version=`echo $revision $patchlevel $subversion | \
5956                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5957         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5958                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5959         ;;
5960 *)
5961         version=`echo $revision $patchlevel $subversion | \
5962                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5963         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5964                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5965         ;;
5966 esac
5967 : Special case the 5.005_xx maintenance series, which used 5.005
5968 : without any subversion label as a subdirectory in $sitelib
5969 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5970         api_versionstring='5.005'
5971 fi
5972
5973 : determine installation style
5974 : For now, try to deduce it from prefix unless it is already set.
5975 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5976 case "$installstyle" in
5977 '')     case "$prefix" in
5978                 *perl*) dflt='lib';;
5979                 *) dflt='lib/perl5' ;;
5980         esac
5981         ;;
5982 *)      dflt="$installstyle" ;;
5983 esac
5984 : Probably not worth prompting for this since we prompt for all
5985 : the directories individually, and the prompt would be too long and
5986 : confusing anyway.
5987 installstyle=$dflt
5988
5989 : determine where private library files go
5990 : Usual default is /usr/local/lib/perl5/$version.
5991 : Also allow things like /opt/perl/lib/$version, since 
5992 : /opt/perl/lib/perl5... would be redundant.
5993 : The default "style" setting is made in installstyle.U
5994 case "$installstyle" in
5995 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5996 *)       set dflt privlib lib/$version ;;
5997 esac
5998 eval $prefixit
5999 $cat <<EOM
6000
6001 There are some auxiliary files for $package that need to be put into a
6002 private library directory that is accessible by everyone.
6003
6004 EOM
6005 fn=d~+
6006 rp='Pathname where the private library files will reside?'
6007 . ./getfile
6008 privlib="$ans"
6009 privlibexp="$ansexp"
6010 : Change installation prefix, if necessary.
6011 if $test X"$prefix" != X"$installprefix"; then
6012         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6013 else
6014         installprivlib="$privlibexp"
6015 fi
6016
6017 : set the prefixup variable, to restore leading tilda escape
6018 prefixup='case "$prefixexp" in
6019 "$prefix") ;;
6020 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6021 esac'
6022
6023 : determine where public architecture dependent libraries go
6024 set archlib archlib
6025 eval $prefixit
6026 : privlib default is /usr/local/lib/$package/$version
6027 : archlib default is /usr/local/lib/$package/$version/$archname
6028 : privlib may have an optional trailing /share.
6029 tdflt=`echo $privlib | $sed 's,/share$,,'`
6030 tdflt=$tdflt/$archname
6031 case "$archlib" in
6032 '')     dflt=$tdflt
6033         ;;
6034 *)      dflt="$archlib"
6035     ;;
6036 esac
6037 $cat <<EOM
6038
6039 $spackage contains architecture-dependent library files.  If you are
6040 sharing libraries in a heterogeneous environment, you might store
6041 these files in a separate location.  Otherwise, you can just include
6042 them with the rest of the public library files.
6043
6044 EOM
6045 fn=d+~
6046 rp='Where do you want to put the public architecture-dependent libraries?'
6047 . ./getfile
6048 archlib="$ans"
6049 archlibexp="$ansexp"
6050 if $test X"$archlib" = X"$privlib"; then
6051         d_archlib="$undef"
6052 else
6053         d_archlib="$define"
6054 fi
6055 : Change installation prefix, if necessary.
6056 if $test X"$prefix" != X"$installprefix"; then
6057         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6058 else
6059         installarchlib="$archlibexp"
6060 fi
6061
6062 : see if setuid scripts can be secure
6063 $cat <<EOM
6064
6065 Some kernels have a bug that prevents setuid #! scripts from being
6066 secure.  Some sites have disabled setuid #! scripts because of this.
6067
6068 First let's decide if your kernel supports secure setuid #! scripts.
6069 (If setuid #! scripts would be secure but have been disabled anyway,
6070 don't say that they are secure if asked.)
6071
6072 EOM
6073
6074 val="$undef"
6075 if $test -d /dev/fd; then
6076         echo "#!$ls" >reflect
6077         chmod +x,u+s reflect
6078         ./reflect >flect 2>&1
6079         if $contains "/dev/fd" flect >/dev/null; then
6080                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6081                 val="$define"
6082         else
6083                 $cat <<EOM
6084 If you are not sure if they are secure, I can check but I'll need a
6085 username and password different from the one you are using right now.
6086 If you don't have such a username or don't want me to test, simply
6087 enter 'none'.
6088
6089 EOM
6090                 rp='Other username to test security of setuid scripts with?'
6091                 dflt='none'
6092                 . ./myread
6093                 case "$ans" in
6094                 n|none)
6095                         case "$d_suidsafe" in
6096                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6097                                 dflt=n;;
6098                         "$undef")
6099                                 echo "Well, the $hint value is *not* secure." >&4
6100                                 dflt=n;;
6101                         *)      echo "Well, the $hint value *is* secure." >&4
6102                                 dflt=y;;
6103                         esac
6104                         ;;
6105                 *)
6106                         $rm -f reflect flect
6107                         echo "#!$ls" >reflect
6108                         chmod +x,u+s reflect
6109                         echo >flect
6110                         chmod a+w flect
6111                         echo '"su" will (probably) prompt you for '"$ans's password."
6112                         su $ans -c './reflect >flect'
6113                         if $contains "/dev/fd" flect >/dev/null; then
6114                                 echo "Okay, it looks like setuid scripts are secure." >&4
6115                                 dflt=y
6116                         else
6117                                 echo "I don't think setuid scripts are secure." >&4
6118                                 dflt=n
6119                         fi
6120                         ;;
6121                 esac
6122                 rp='Does your kernel have *secure* setuid scripts?'
6123                 . ./myread
6124                 case "$ans" in
6125                 [yY]*)  val="$define";;
6126                 *)      val="$undef";;
6127                 esac
6128         fi
6129 else
6130         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6131         echo "(That's for file descriptors, not floppy disks.)"
6132         val="$undef"
6133 fi
6134 set d_suidsafe
6135 eval $setvar
6136
6137 $rm -f reflect flect
6138
6139 : now see if they want to do setuid emulation
6140 echo " "
6141 val="$undef"
6142 case "$d_suidsafe" in
6143 "$define")
6144         val="$undef"
6145         echo "No need to emulate SUID scripts since they are secure here." >&4
6146         ;;
6147 *)
6148         $cat <<EOM
6149 Some systems have disabled setuid scripts, especially systems where
6150 setuid scripts cannot be secure.  On systems where setuid scripts have
6151 been disabled, the setuid/setgid bits on scripts are currently
6152 useless.  It is possible for $package to detect those bits and emulate
6153 setuid/setgid in a secure fashion.  This emulation will only work if
6154 setuid scripts have been disabled in your kernel.
6155
6156 EOM
6157         case "$d_dosuid" in
6158         "$define") dflt=y ;;
6159         *) dflt=n ;;
6160         esac
6161         rp="Do you want to do setuid/setgid emulation?"
6162         . ./myread
6163         case "$ans" in
6164         [yY]*)  val="$define";;
6165         *)      val="$undef";;
6166         esac
6167         ;;
6168 esac
6169 set d_dosuid
6170 eval $setvar
6171
6172 : see if this is a malloc.h system
6173 : we want a real compile instead of Inhdr because some systems have a
6174 : malloc.h that just gives a compile error saying to use stdlib.h instead
6175 echo " "
6176 $cat >try.c <<EOCP
6177 #include <stdlib.h>
6178 #include <malloc.h>
6179 int main () { return 0; }
6180 EOCP
6181 set try
6182 if eval $compile; then
6183     echo "<malloc.h> found." >&4
6184     val="$define"
6185 else
6186     echo "<malloc.h> NOT found." >&4
6187     val="$undef"
6188 fi
6189 $rm -f try.c try
6190 set i_malloc
6191 eval $setvar
6192
6193 : check for void type
6194 echo " "
6195 echo "Checking to see how well your C compiler groks the void type..." >&4
6196 case "$voidflags" in
6197 '')
6198         $cat >try.c <<EOCP
6199 #$i_stdlib I_STDLIB
6200 #ifdef I_STDLIB
6201 #include <stdlib.h>
6202 #endif
6203 #if TRY & 1
6204 void sub() {
6205 #else
6206 sub() {
6207 #endif
6208         extern void moo();      /* function returning void */
6209         void (*goo)();          /* ptr to func returning void */
6210 #if TRY & 8
6211         void *hue;              /* generic ptr */
6212 #endif
6213 #if TRY & 2
6214         void (*foo[10])();
6215 #endif
6216
6217 #if TRY & 4
6218         if(goo == moo) {
6219                 exit(0);
6220         }
6221 #endif
6222         exit(0);
6223 }
6224 int main() { sub(); }
6225 EOCP
6226         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6227                 voidflags=$defvoidused
6228         echo "Good.  It appears to support void to the level $package wants.">&4
6229                 if $contains warning .out >/dev/null 2>&1; then
6230                         echo "However, you might get some warnings that look like this:"
6231                         $cat .out
6232                 fi
6233         else
6234 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6235                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6236                         echo "It supports 1..."
6237                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6238                                 echo "It also supports 2..."
6239                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6240                                         voidflags=7
6241                                         echo "And it supports 4 but not 8 definitely."
6242                                 else
6243                                         echo "It doesn't support 4..."
6244                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6245                                                 voidflags=11
6246                                                 echo "But it supports 8."
6247                                         else
6248                                                 voidflags=3
6249                                                 echo "Neither does it support 8."
6250                                         fi
6251                                 fi
6252                         else
6253                                 echo "It does not support 2..."
6254                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6255                                         voidflags=13
6256                                         echo "But it supports 4 and 8."
6257                                 else
6258                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6259                                                 voidflags=5
6260                                                 echo "And it supports 4 but has not heard about 8."
6261                                         else
6262                                                 echo "However it supports 8 but not 4."
6263                                         fi
6264                                 fi
6265                         fi
6266                 else
6267                         echo "There is no support at all for void."
6268                         voidflags=0
6269                 fi
6270         fi
6271 esac
6272 case "$voidflags" in
6273 "$defvoidused") ;;
6274 *)      $cat >&4 <<'EOM'
6275   Support flag bits are:
6276     1: basic void declarations.
6277     2: arrays of pointers to functions returning void.
6278     4: operations between pointers to and addresses of void functions.
6279     8: generic void pointers.
6280 EOM
6281         dflt="$voidflags";
6282         rp="Your void support flags add up to what?"
6283         . ./myread
6284         voidflags="$ans"
6285         ;;
6286 esac
6287 $rm -f try.* .out
6288
6289 : check for length of pointer
6290 echo " "
6291 case "$ptrsize" in
6292 '')
6293         echo "Checking to see how big your pointers are..." >&4
6294         if test "$voidflags" -gt 7; then
6295                 echo '#define VOID_PTR char *' > try.c
6296         else
6297                 echo '#define VOID_PTR void *' > try.c
6298         fi
6299         $cat >>try.c <<EOCP
6300 #include <stdio.h>
6301 #$i_stdlib I_STDLIB
6302 #ifdef I_STDLIB
6303 #include <stdlib.h>
6304 #endif
6305 int main()
6306 {
6307     printf("%d\n", (int)sizeof(VOID_PTR));
6308     exit(0);
6309 }
6310 EOCP
6311         set try
6312         if eval $compile_ok; then
6313                 ptrsize=`$run ./try`
6314                 echo "Your pointers are $ptrsize bytes long."
6315         else
6316                 dflt='4'
6317                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6318                 rp="What is the size of a pointer (in bytes)?"
6319                 . ./myread
6320                 ptrsize="$ans"
6321         fi
6322         ;;
6323 esac
6324 $rm -f try.c try
6325 case "$use64bitall" in
6326 "$define"|true|[yY]*)
6327         case "$ptrsize" in
6328         4)      cat <<EOM >&4
6329
6330 *** You have chosen a maximally 64-bit build,
6331 *** but your pointers are only 4 bytes wide.
6332 *** Please rerun Configure without -Duse64bitall.
6333 EOM
6334                 case "$d_quad" in
6335                 define)
6336                         cat <<EOM >&4
6337 *** Since you have quads, you could possibly try with -Duse64bitint.
6338 EOM
6339                         ;;
6340                 esac
6341                 cat <<EOM >&4
6342 *** Cannot continue, aborting.
6343
6344 EOM
6345
6346                 exit 1
6347                 ;;
6348         esac
6349         ;;
6350 esac
6351
6352
6353 : determine whether to use malloc wrapping
6354 echo " "
6355 case "$usemallocwrap" in
6356 [yY]*|true|$define)     dflt='y' ;;
6357 [nN]*|false|$undef)     dflt='n' ;;
6358 *)      case "$usedevel" in
6359         [yY]*|true|$define)     dflt='y' ;;
6360         *) dflt='n' ;;
6361         esac
6362         ;;
6363 esac
6364 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6365 . ./myread
6366 usemallocwrap="$ans"
6367 case "$ans" in
6368 y*|true)
6369         usemallocwrap="$define" ;;
6370 *)
6371         usemallocwrap="$undef" ;;
6372 esac
6373
6374 : determine which malloc to compile in
6375 echo " "
6376 case "$usemymalloc" in
6377 [yY]*|true|$define)     dflt='y' ;;
6378 [nN]*|false|$undef)     dflt='n' ;;
6379 *)      case "$ptrsize" in
6380         4) dflt='y' ;;
6381         *) dflt='n' ;;
6382         esac
6383         ;;
6384 esac
6385 rp="Do you wish to attempt to use the malloc that comes with $package?"
6386 . ./myread
6387 usemymalloc="$ans"
6388 case "$ans" in
6389 y*|true)
6390         usemymalloc='y'
6391         mallocsrc='malloc.c'
6392         mallocobj="malloc$_o"
6393         d_mymalloc="$define"
6394         case "$libs" in
6395         *-lmalloc*)
6396                 : Remove malloc from list of libraries to use
6397                 echo "Removing unneeded -lmalloc from library list" >&4
6398                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6399                 shift
6400                 libs="$*"
6401                 echo "libs = $libs" >&4
6402                 ;;
6403         esac
6404         ;;
6405 *)
6406         usemymalloc='n'
6407         mallocsrc=''
6408         mallocobj=''
6409         d_mymalloc="$undef"
6410         ;;
6411 esac
6412
6413 : compute the return types of malloc and free
6414 echo " "
6415 $cat >malloc.c <<END
6416 #$i_malloc I_MALLOC
6417 #$i_stdlib I_STDLIB
6418 #include <stdio.h>
6419 #include <sys/types.h>
6420 #ifdef I_MALLOC
6421 #include <malloc.h>
6422 #endif
6423 #ifdef I_STDLIB
6424 #include <stdlib.h>
6425 #endif
6426 #ifdef TRY_MALLOC
6427 void *malloc();
6428 #endif
6429 #ifdef TRY_FREE
6430 void free();
6431 #endif
6432 END
6433 case "$malloctype" in
6434 '')
6435         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6436                 malloctype='void *'
6437         else
6438                 malloctype='char *'
6439         fi
6440         ;;
6441 esac
6442 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6443
6444 case "$freetype" in
6445 '')
6446         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6447                 freetype='void'
6448         else
6449                 freetype='int'
6450         fi
6451         ;;
6452 esac
6453 echo "Your system uses $freetype free(), it would seem." >&4
6454 $rm -f malloc.[co]
6455 $cat <<EOM
6456
6457 After $package is installed, you may wish to install various
6458 add-on modules and utilities.  Typically, these add-ons will
6459 be installed under $prefix with the rest
6460 of this package.  However, you may wish to install such add-ons
6461 elsewhere under a different prefix.
6462
6463 If you do not wish to put everything under a single prefix, that's
6464 ok.  You will be prompted for the individual locations; this siteprefix
6465 is only used to suggest the defaults.
6466
6467 The default should be fine for most people.
6468
6469 EOM
6470 fn=d~+
6471 rp='Installation prefix to use for add-on modules and utilities?'
6472 : XXX Here might be another good place for an installstyle setting.
6473 case "$siteprefix" in
6474 '') dflt=$prefix ;;
6475 *)  dflt=$siteprefix ;;
6476 esac
6477 . ./getfile
6478 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6479 oldsiteprefix=''
6480 case "$siteprefix" in
6481 '') ;;
6482 *)      case "$ans" in
6483         "$prefix") ;;
6484         *) oldsiteprefix="$prefix";;
6485         esac
6486         ;;
6487 esac
6488 siteprefix="$ans"
6489 siteprefixexp="$ansexp"
6490
6491 : determine where site specific libraries go.
6492 : Usual default is /usr/local/lib/perl5/site_perl/$version
6493 : The default "style" setting is made in installstyle.U
6494 : XXX No longer works with Prefixit stuff.
6495 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6496 case "$sitelib" in
6497 '') case "$installstyle" in
6498         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6499         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6500         esac
6501         ;;
6502 *)      dflt="$sitelib"
6503         ;;
6504 esac
6505 $cat <<EOM
6506
6507 The installation process will create a directory for
6508 site-specific extensions and modules.  Most users find it convenient
6509 to place all site-specific files in this directory rather than in the
6510 main distribution directory.
6511
6512 EOM
6513 fn=d~+
6514 rp='Pathname for the site-specific library files?'
6515 . ./getfile
6516 sitelib="$ans"
6517 sitelibexp="$ansexp"
6518 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6519 : Change installation prefix, if necessary.
6520 if $test X"$prefix" != X"$installprefix"; then
6521         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6522 else
6523         installsitelib="$sitelibexp"
6524 fi
6525
6526 : determine where site specific architecture-dependent libraries go.
6527 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6528 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6529 : sitelib may have an optional trailing /share.
6530 case "$sitearch" in
6531 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6532         dflt="$dflt/$archname"
6533         ;;
6534 *)      dflt="$sitearch"
6535         ;;
6536 esac
6537 set sitearch sitearch none
6538 eval $prefixit
6539 $cat <<EOM
6540
6541 The installation process will also create a directory for
6542 architecture-dependent site-specific extensions and modules.
6543
6544 EOM
6545 fn=d~+
6546 rp='Pathname for the site-specific architecture-dependent library files?'
6547 . ./getfile
6548 sitearch="$ans"
6549 sitearchexp="$ansexp"
6550 : Change installation prefix, if necessary.
6551 if $test X"$prefix" != X"$installprefix"; then
6552         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6553 else
6554         installsitearch="$sitearchexp"
6555 fi
6556
6557 $cat <<EOM
6558
6559 The installation process will also create a directory for
6560 vendor-supplied add-ons.  Vendors who supply perl with their system
6561 may find it convenient to place all vendor-supplied files in this
6562 directory rather than in the main distribution directory.  This will
6563 ease upgrades between binary-compatible maintenance versions of perl.
6564
6565 Of course you may also use these directories in whatever way you see
6566 fit.  For example, you might use them to access modules shared over a
6567 company-wide network.
6568
6569 The default answer should be fine for most people.
6570 This causes further questions about vendor add-ons to be skipped
6571 and no vendor-specific directories will be configured for perl.
6572
6573 EOM
6574 rp='Do you want to configure vendor-specific add-on directories?'
6575 case "$usevendorprefix" in
6576 define|true|[yY]*) dflt=y ;;
6577 *)      : User may have set vendorprefix directly on Configure command line.
6578         case "$vendorprefix" in
6579         ''|' ') dflt=n ;;
6580         *)      dflt=y ;;
6581         esac
6582         ;;
6583 esac
6584 . ./myread
6585 case "$ans" in
6586 [yY]*)  fn=d~+
6587         rp='Installation prefix to use for vendor-supplied add-ons?'
6588         case "$vendorprefix" in
6589         '') dflt='' ;;
6590         *)  dflt=$vendorprefix ;;
6591         esac
6592         . ./getfile
6593         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6594         oldvendorprefix=''
6595         case "$vendorprefix" in
6596         '') ;;
6597         *)      case "$ans" in
6598                 "$prefix") ;;
6599                 *) oldvendorprefix="$prefix";;
6600                 esac
6601                 ;;
6602         esac
6603         usevendorprefix="$define"
6604         vendorprefix="$ans"
6605         vendorprefixexp="$ansexp"
6606         ;;
6607 *)      usevendorprefix="$undef"
6608         vendorprefix=''
6609         vendorprefixexp=''
6610         ;;
6611 esac
6612
6613 case "$vendorprefix" in
6614 '')     d_vendorlib="$undef"
6615         vendorlib=''
6616         vendorlibexp=''
6617         ;;
6618 *)      d_vendorlib="$define"
6619         : determine where vendor-supplied modules go.
6620         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6621         case "$vendorlib" in
6622         '')
6623                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6624                 case "$installstyle" in
6625                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6626                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6627                 esac
6628                 ;;
6629         *)      dflt="$vendorlib"
6630                 ;;
6631         esac
6632         fn=d~+
6633         rp='Pathname for the vendor-supplied library files?'
6634         . ./getfile
6635         vendorlib="$ans"
6636         vendorlibexp="$ansexp"
6637         ;;
6638 esac
6639 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6640 : Change installation prefix, if necessary.
6641 if $test X"$prefix" != X"$installprefix"; then
6642         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6643 else
6644         installvendorlib="$vendorlibexp"
6645 fi
6646
6647 case "$vendorprefix" in
6648 '')     d_vendorarch="$undef"
6649         vendorarch=''
6650         vendorarchexp=''
6651         ;;
6652 *)      d_vendorarch="$define"
6653         : determine where vendor-supplied architecture-dependent libraries go.
6654         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6655         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6656         : vendorlib may have an optional trailing /share.
6657         case "$vendorarch" in
6658         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6659                 dflt="$dflt/$archname"
6660                 ;;
6661         *)      dflt="$vendorarch" ;;
6662         esac
6663         fn=d~+
6664         rp='Pathname for vendor-supplied architecture-dependent files?'
6665         . ./getfile
6666         vendorarch="$ans"
6667         vendorarchexp="$ansexp"
6668         ;;
6669 esac
6670 : Change installation prefix, if necessary.
6671 if $test X"$prefix" != X"$installprefix"; then
6672         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6673 else
6674         installvendorarch="$vendorarchexp"
6675 fi
6676
6677 : Final catch-all directories to search
6678 $cat <<EOM
6679
6680 Lastly, you can have perl look in other directories for extensions and
6681 modules in addition to those already specified.
6682 These directories will be searched after 
6683         $sitearch 
6684         $sitelib 
6685 EOM
6686 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6687 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6688 echo ' '
6689 case "$otherlibdirs" in
6690 ''|' ') dflt='none' ;;
6691 *)      dflt="$otherlibdirs" ;;
6692 esac
6693 $cat <<EOM
6694 Enter a colon-separated set of extra paths to include in perl's @INC
6695 search path, or enter 'none' for no extra paths.
6696
6697 EOM
6698
6699 rp='Colon-separated list of additional directories for perl to search?'
6700 . ./myread
6701 case "$ans" in
6702 ' '|''|none)    otherlibdirs=' ' ;;     
6703 *)      otherlibdirs="$ans" ;;
6704 esac
6705 case "$otherlibdirs" in
6706 ' ') val=$undef ;;
6707 *)      val=$define ;;
6708 esac
6709 set d_perl_otherlibdirs
6710 eval $setvar
6711
6712 : Cruising for prototypes
6713 echo " "
6714 echo "Checking out function prototypes..." >&4
6715 $cat >prototype.c <<EOCP
6716 #$i_stdlib I_STDLIB
6717 #ifdef I_STDLIB
6718 #include <stdlib.h>
6719 #endif
6720 int main(int argc, char *argv[]) {
6721         exit(0);}
6722 EOCP
6723 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6724         echo "Your C compiler appears to support function prototypes."
6725         val="$define"
6726 else
6727         echo "Your C compiler doesn't seem to understand function prototypes."
6728         val="$undef"
6729 fi
6730 set prototype
6731 eval $setvar
6732 $rm -f prototype*
6733
6734 case "$prototype" in
6735 "$define") ;;
6736 *)      ansi2knr='ansi2knr'
6737         echo " "
6738         cat <<EOM >&4
6739
6740 $me:  FATAL ERROR:
6741 This version of $package can only be compiled by a compiler that 
6742 understands function prototypes.  Unfortunately, your C compiler 
6743         $cc $ccflags
6744 doesn't seem to understand them.  Sorry about that.
6745
6746 If GNU cc is available for your system, perhaps you could try that instead.  
6747
6748 Eventually, we hope to support building Perl with pre-ANSI compilers.
6749 If you would like to help in that effort, please contact <perlbug@perl.org>.
6750
6751 Aborting Configure now.
6752 EOM
6753         exit 2
6754         ;;
6755 esac
6756
6757 : determine where public executables go
6758 echo " "
6759 set dflt bin bin
6760 eval $prefixit
6761 fn=d~
6762 rp='Pathname where the public executables will reside?'
6763 . ./getfile
6764 if $test "X$ansexp" != "X$binexp"; then
6765         installbin=''
6766 fi
6767 bin="$ans"
6768 binexp="$ansexp"
6769 : Change installation prefix, if necessary.
6770 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6771 if $test X"$prefix" != X"$installprefix"; then
6772         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6773 else
6774         installbin="$binexp"
6775 fi
6776
6777 echo " "
6778 case "$extras" in
6779 '') dflt='n';;
6780 *) dflt='y';;
6781 esac
6782 cat <<EOM
6783 Perl can be built with extra modules or bundles of modules which
6784 will be fetched from the CPAN and installed alongside Perl.
6785
6786 Notice that you will need access to the CPAN; either via the Internet,
6787 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6788 be asked later to configure the CPAN.pm module which will in turn do
6789 the installation of the rest of the extra modules or bundles.)
6790
6791 Notice also that if the modules require any external software such as
6792 libraries and headers (the libz library and the zlib.h header for the
6793 Compress::Zlib module, for example) you MUST have any such software
6794 already installed, this configuration process will NOT install such
6795 things for you.
6796
6797 If this doesn't make any sense to you, just accept the default '$dflt'.
6798 EOM
6799 rp='Install any extra modules (y or n)?'
6800 . ./myread
6801 case "$ans" in
6802 y|Y)
6803         cat <<EOM
6804
6805 Please list any extra modules or bundles to be installed from CPAN,
6806 with spaces between the names.  The names can be in any format the
6807 'install' command of CPAN.pm will understand.  (Answer 'none',
6808 without the quotes, to install no extra modules or bundles.)
6809 EOM
6810         rp='Extras?'
6811         dflt="$extras"
6812         . ./myread
6813         extras="$ans"
6814 esac
6815 case "$extras" in
6816 ''|'none')
6817         val=''
6818         $rm -f ../extras.lst
6819         ;;
6820 *)      echo "(Saving the list of extras for later...)"
6821         echo "$extras" > ../extras.lst
6822         val="'$extras'"
6823         ;;
6824 esac
6825 set extras
6826 eval $setvar
6827 echo " "
6828
6829 : determine where html pages for programs go
6830 set html1dir html1dir none
6831 eval $prefixit
6832 $cat <<EOM
6833
6834 If you wish to install html files for programs in $spackage, indicate 
6835 the appropriate directory here.  To skip installing html files,
6836 answer "none".
6837 EOM
6838 case "$html1dir" in
6839 ''|none|$undef|' ') dflt=none ;;
6840 *) dflt=$html1dir ;;
6841 esac
6842 fn=dn+~
6843 rp="Directory for the main $spackage html pages?"
6844 . ./getfile
6845 html1dir="$ans"
6846 html1direxp="$ansexp"
6847 : Use ' ' for none so value is preserved next time through Configure
6848 $test X"$html1dir" = "X" && html1dir=' '
6849 : Change installation prefix, if necessary.
6850 if $test X"$prefix" != X"$installprefix"; then
6851         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6852 else
6853         installhtml1dir="$html1direxp"
6854 fi
6855
6856 : determine where html pages for libraries and modules go
6857 set html3dir html3dir none
6858 eval $prefixit
6859 $cat <<EOM
6860
6861 If you wish to install html files for modules associated with $spackage,
6862 indicate the appropriate directory here.  To skip installing html files,
6863 answer "none".
6864 EOM
6865 : There is no obvious default.  If they have specified html1dir, then
6866 : try to key off that, possibly changing .../html1 into .../html3.
6867 case "$html3dir" in
6868 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6869 *) dflt=$html3dir ;;
6870 esac
6871 fn=dn+~
6872 rp="Directory for the $spackage module html pages?"
6873 . ./getfile
6874 html3dir="$ans"
6875 html3direxp="$ansexp"
6876 : Use ' ' for none so value is preserved next time through Configure
6877 $test X"$html3dir" = "X" && html3dir=' '
6878 : Change installation prefix, if necessary.
6879 if $test X"$prefix" != X"$installprefix"; then
6880         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6881 else
6882         installhtml3dir="$html3direxp"
6883 fi
6884
6885 : Find perl5.005 or later.
6886 echo "Looking for a previously installed perl5.005 or later... "
6887 case "$perl5" in
6888 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6889                 : Check if this perl is recent and can load a simple module
6890                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6891                         perl5=$tdir/perl
6892                         break;
6893                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6894                         perl5=$tdir/perl5
6895                         break;
6896                 fi
6897         done
6898         ;;
6899 *)      perl5="$perl5"
6900         ;;
6901 esac
6902 case "$perl5" in
6903 '')     echo "None found.  That's ok.";;
6904 *)      echo "Using $perl5." ;;
6905 esac
6906
6907 : Determine list of previous versions to include in @INC
6908 $cat > getverlist <<EOPL
6909 #!$perl5 -w
6910 use File::Basename;
6911 \$api_versionstring = "$api_versionstring";
6912 \$version = "$version";
6913 \$stem = "$sitelib_stem";
6914 \$archname = "$archname";
6915 EOPL
6916         $cat >> getverlist <<'EOPL'
6917 # Can't have leading @ because metaconfig interprets it as a command!
6918 ;@inc_version_list=();
6919 # XXX Redo to do opendir/readdir? 
6920 if (-d $stem) {
6921     chdir($stem);
6922     ;@candidates = glob("5.*");
6923 }
6924 else {
6925     ;@candidates = ();
6926 }
6927
6928 # XXX ToDo:  These comparisons must be reworked when two-digit
6929 # subversions come along, so that 5.7.10 compares as greater than
6930 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6931 # widespread that we can use the built-in version vectors rather
6932 # than reinventing them here.  For 5.6.0, however, we must
6933 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6934 foreach $d (@candidates) {
6935     if ($d lt $version) {
6936         if ($d ge $api_versionstring) {
6937             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6938         }
6939         elsif ($d ge "5.005") {
6940             unshift(@inc_version_list, grep { -d } $d);
6941         }
6942     }
6943     else {
6944         # Skip newer version.  I.e. don't look in
6945         # 5.7.0 if we're installing 5.6.1.
6946     }
6947 }
6948
6949 if (@inc_version_list) {
6950     print join(' ', @inc_version_list);
6951 }
6952 else {
6953     # Blank space to preserve value for next Configure run.
6954     print " ";
6955 }
6956 EOPL
6957 chmod +x getverlist
6958 case "$inc_version_list" in
6959 '')     if test -x "$perl5$exe_ext"; then
6960                 dflt=`$perl5 getverlist`
6961         else
6962                 dflt='none'
6963         fi
6964         ;;
6965 $undef) dflt='none' ;;
6966 *)  eval dflt=\"$inc_version_list\" ;;
6967 esac
6968 case "$dflt" in
6969 ''|' ') dflt=none ;;
6970 esac
6971 case "$dflt" in
6972 5.005) dflt=none ;;
6973 esac
6974 $cat <<EOM
6975
6976 In order to ease the process of upgrading, this version of perl 
6977 can be configured to use modules built and installed with earlier 
6978 versions of perl that were installed under $prefix.  Specify here
6979 the list of earlier versions that this version of perl should check.
6980 If Configure detected no earlier versions of perl installed under
6981 $prefix, then the list will be empty.  Answer 'none' to tell perl
6982 to not search earlier versions.
6983
6984 The default should almost always be sensible, so if you're not sure,
6985 just accept the default.
6986 EOM
6987
6988 rp='List of earlier versions to include in @INC?'
6989 . ./myread
6990 case "$ans" in
6991 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6992 *) inc_version_list="$ans" ;;
6993 esac
6994 case "$inc_version_list" in
6995 ''|' ') 
6996         inc_version_list_init='0';;
6997 *)      inc_version_list_init=`echo $inc_version_list |
6998                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6999         ;;
7000 esac
7001 $rm -f getverlist
7002
7003 : determine whether to install perl also as /usr/bin/perl
7004
7005 echo " "
7006 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7007         $cat <<EOM
7008 Many scripts expect perl to be installed as /usr/bin/perl.
7009
7010 If you want to, I can install the perl you are about to compile
7011 as /usr/bin/perl (in addition to $bin/perl).
7012 EOM
7013         if test -f /usr/bin/perl; then
7014             $cat <<EOM
7015
7016 However, please note that because you already have a /usr/bin/perl,
7017 overwriting that with a new Perl would very probably cause problems.
7018 Therefore I'm assuming you don't want to do that (unless you insist).
7019
7020 EOM
7021             case "$installusrbinperl" in
7022             "$define"|[yY]*)    dflt='y';;
7023             *)                  dflt='n';;
7024             esac
7025         else
7026             $cat <<EOM
7027
7028 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7029
7030 EOM
7031             case "$installusrbinperl" in
7032             "$undef"|[nN]*)     dflt='n';;
7033             *)                  dflt='y';;
7034             esac
7035         fi
7036         rp="Do you want to install perl as /usr/bin/perl?"
7037         . ./myread
7038         case "$ans" in
7039         [yY]*)  val="$define";;
7040         *)      val="$undef" ;;
7041         esac
7042 else
7043         val="$undef"
7044 fi
7045 set installusrbinperl
7046 eval $setvar
7047
7048 echo " "
7049 echo "Checking for GNU C Library..." >&4
7050 cat >try.c <<'EOCP'
7051 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7052    alone are insufficient to distinguish different versions, such as
7053    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7054    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7055 */
7056 #include <stdio.h>
7057 int main(void)
7058 {
7059 #ifdef __GLIBC__
7060 #   ifdef __GLIBC_MINOR__
7061 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7062 #           include <gnu/libc-version.h>
7063             printf("%s\n",  gnu_get_libc_version());
7064 #       else
7065             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7066 #       endif
7067 #   else
7068         printf("%d\n",  __GLIBC__);
7069 #   endif
7070     return 0;
7071 #else
7072     return 1;
7073 #endif
7074 }
7075 EOCP
7076 set try
7077 if eval $compile_ok && $run ./try > glibc.ver; then
7078         val="$define"
7079         gnulibc_version=`$cat glibc.ver`
7080         echo "You are using the GNU C Library version $gnulibc_version"
7081 else
7082         val="$undef"
7083         gnulibc_version=''
7084         echo "You are not using the GNU C Library"
7085 fi
7086 $rm -f try try.* glibc.ver
7087 set d_gnulibc
7088 eval $setvar
7089
7090 : see if nm is to be used to determine whether a symbol is defined or not
7091 case "$usenm" in
7092 '')
7093         dflt=''
7094         case "$d_gnulibc" in
7095         "$define")
7096                 echo " "
7097                 echo "nm probably won't work on the GNU C Library." >&4
7098                 dflt=n
7099                 ;;
7100         esac
7101         case "$dflt" in
7102         '') 
7103                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7104                         echo " "
7105                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7106                         echo "'nm' won't be sufficient on this sytem." >&4
7107                         dflt=n
7108                 fi
7109                 ;;
7110         esac
7111         case "$dflt" in
7112         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7113                 if $test $dflt -gt 20; then
7114                         dflt=y
7115                 else
7116                         dflt=n
7117                 fi
7118                 ;;
7119         esac
7120         ;;
7121 *)
7122         case "$usenm" in
7123         true|$define) dflt=y;;
7124         *) dflt=n;;
7125         esac
7126         ;;
7127 esac
7128 $cat <<EOM
7129
7130 I can use $nm to extract the symbols from your C libraries. This
7131 is a time consuming task which may generate huge output on the disk (up
7132 to 3 megabytes) but that should make the symbols extraction faster. The
7133 alternative is to skip the 'nm' extraction part and to compile a small
7134 test program instead to determine whether each symbol is present. If
7135 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7136 this may be the best solution.
7137
7138 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7139
7140 EOM
7141 rp="Shall I use $nm to extract C symbols from the libraries?"
7142 . ./myread
7143 case "$ans" in
7144 [Nn]*) usenm=false;;
7145 *) usenm=true;;
7146 esac
7147
7148 runnm=$usenm
7149 case "$reuseval" in
7150 true) runnm=false;;
7151 esac
7152
7153 : nm options which may be necessary
7154 case "$nm_opt" in
7155 '') if $test -f /mach_boot; then
7156                 nm_opt=''       # Mach
7157         elif $test -d /usr/ccs/lib; then
7158                 nm_opt='-p'     # Solaris (and SunOS?)
7159         elif $test -f /dgux; then
7160                 nm_opt='-p'     # DG-UX
7161         elif $test -f /lib64/rld; then
7162                 nm_opt='-p'     # 64-bit Irix
7163         else
7164                 nm_opt=''
7165         fi;;
7166 esac
7167
7168 : nm options which may be necessary for shared libraries but illegal
7169 : for archive libraries.  Thank you, Linux.
7170 case "$nm_so_opt" in
7171 '')     case "$myuname" in
7172         *linux*|gnu*)
7173                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7174                         nm_so_opt='--dynamic'
7175                 fi
7176                 ;;
7177         esac
7178         ;;
7179 esac
7180
7181 case "$runnm" in
7182 true)
7183 : get list of predefined functions in a handy place
7184 echo " "
7185 case "$libc" in
7186 '') libc=unknown
7187         case "$libs" in
7188         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7189         esac
7190         ;;
7191 esac
7192 case "$libs" in
7193 '') ;;
7194 *)  for thislib in $libs; do
7195         case "$thislib" in
7196         -lc|-lc_s)
7197                 : Handle C library specially below.
7198                 ;;
7199         -l*)
7200                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7201                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7202                         :
7203                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7204                         :
7205                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7206                         :
7207                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7208                         :
7209                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7210                         :
7211                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7212                         :
7213                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7214                         :
7215                 else
7216                         try=''
7217                 fi
7218                 libnames="$libnames $try"
7219                 ;;
7220         *) libnames="$libnames $thislib" ;;
7221         esac
7222         done
7223         ;;
7224 esac
7225 xxx=normal
7226 case "$libc" in
7227 unknown)
7228         set /lib/libc.$so
7229         for xxx in $libpth; do
7230                 $test -r $1 || set $xxx/libc.$so
7231                 : The messy sed command sorts on library version numbers.
7232                 $test -r $1 || \
7233                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7234                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7235                                 h
7236                                 s/[0-9][0-9]*/0000&/g
7237                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7238                                 G
7239                                 s/\n/ /' | \
7240                          $sort | $sed -e 's/^.* //'`
7241                 eval set \$$#
7242         done
7243         $test -r $1 || set /usr/ccs/lib/libc.$so
7244         $test -r $1 || set /lib/libsys_s$_a
7245         ;;
7246 *)
7247         set blurfl
7248         ;;
7249 esac
7250 if $test -r "$1"; then
7251         echo "Your (shared) C library seems to be in $1."
7252         libc="$1"
7253 elif $test -r /lib/libc && $test -r /lib/clib; then
7254         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7255         xxx=apollo
7256         libc='/lib/clib /lib/libc'
7257         if $test -r /lib/syslib; then
7258                 echo "(Your math library is in /lib/syslib.)"
7259                 libc="$libc /lib/syslib"
7260         fi
7261 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7262         echo "Your C library seems to be in $libc, as you said before."
7263 elif $test -r $incpath/usr/lib/libc$_a; then
7264         libc=$incpath/usr/lib/libc$_a;
7265         echo "Your C library seems to be in $libc.  That's fine."
7266 elif $test -r /lib/libc$_a; then
7267         libc=/lib/libc$_a;
7268         echo "Your C library seems to be in $libc.  You're normal."
7269 else
7270         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7271                 :
7272         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7273                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7274         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7275                 :
7276         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7277                 :
7278         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7279                 :
7280         else
7281                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7282         fi
7283         if $test -r "$tans"; then
7284                 echo "Your C library seems to be in $tans, of all places."
7285                 libc=$tans
7286         else
7287                 libc='blurfl'
7288         fi
7289 fi
7290 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7291         dflt="$libc"
7292         cat <<EOM
7293
7294 If the guess above is wrong (which it might be if you're using a strange
7295 compiler, or your machine supports multiple models), you can override it here.
7296
7297 EOM
7298 else
7299         dflt=''
7300         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7301         cat >&4 <<EOM
7302 I can't seem to find your C library.  I've looked in the following places:
7303
7304 EOM
7305         $sed 's/^/      /' libpath
7306         cat <<EOM
7307
7308 None of these seems to contain your C library. I need to get its name...
7309
7310 EOM
7311 fi
7312 fn=f
7313 rp='Where is your C library?'
7314 . ./getfile
7315 libc="$ans"
7316
7317 echo " "
7318 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7319 set X `cat libnames`
7320 shift
7321 xxx=files
7322 case $# in 1) xxx=file; esac
7323 echo "Extracting names from the following $xxx for later perusal:" >&4
7324 echo " "
7325 $sed 's/^/      /' libnames >&4
7326 echo " "
7327 $echo $n "This may take a while...$c" >&4
7328
7329 for file in $*; do
7330         case $file in
7331         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7332         *) $nm $nm_opt $file 2>/dev/null;;
7333         esac
7334 done >libc.tmp
7335
7336 $echo $n ".$c"
7337 $grep fprintf libc.tmp > libc.ptf
7338 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7339 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7340 xxx='[ADTSIW]'
7341 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7342         eval $xscan;\
7343         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7344                 eval $xrun
7345 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7346         eval $xscan;\
7347         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7348                 eval $xrun
7349 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7350         eval $xscan;\
7351         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7352                 eval $xrun
7353 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7354         eval $xscan;\
7355         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7356                 eval $xrun
7357 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7358         eval $xscan;\
7359         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360                 eval $xrun
7361 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7362         eval $xscan;\
7363         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364                 eval $xrun
7365 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7366                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7367         eval $xscan;\
7368         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7369                 eval $xrun
7370 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7371         eval $xscan;\
7372         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7373                 eval $xrun
7374 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7375         eval $xscan;\
7376         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7377                 eval $xrun
7378 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7379         eval $xscan;\
7380         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7381                 eval $xrun
7382 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7383         eval $xscan;\
7384         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7385                 eval $xrun
7386 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7387         eval $xscan;\
7388         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7389                 eval $xrun
7390 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7391         eval $xscan;\
7392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393                 eval $xrun
7394 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7395         eval $xscan;\
7396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397                 eval $xrun
7398 else
7399         $nm -p $* 2>/dev/null >libc.tmp
7400         $grep fprintf libc.tmp > libc.ptf
7401         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7402                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7403         then
7404                 nm_opt='-p'
7405                 eval $xrun
7406         else
7407                 echo " "
7408                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7409                 com=''
7410                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7411                         for thisname in $libnames $libc; do
7412                                 $ar t $thisname >>libc.tmp
7413                         done
7414                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7415                         echo "Ok." >&4
7416                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7417                         # Repeat libc to extract forwarders to DLL entries too
7418                         for thisname in $libnames $libc; do
7419                                 $ar tv $thisname >>libc.tmp
7420                                 # Revision 50 of EMX has bug in $ar.
7421                                 # it will not extract forwarders to DLL entries
7422                                 # Use emximp which will extract exactly them.
7423                                 emximp -o tmp.imp $thisname \
7424                                     2>/dev/null && \
7425                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7426                                     < tmp.imp >>libc.tmp
7427                                 $rm tmp.imp
7428                         done
7429                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7430                         echo "Ok." >&4
7431                 else
7432                         echo "$ar didn't seem to work right." >&4
7433                         echo "Maybe this is a Cray...trying bld instead..." >&4
7434                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7435                         then
7436                                 for thisname in $libnames; do
7437                                         bld t $libnames | \
7438                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7439                                         $ar t $thisname >>libc.tmp
7440                                 done
7441                                 echo "Ok." >&4
7442                         else
7443                                 echo "That didn't work either.  Giving up." >&4
7444                                 exit 1
7445                         fi
7446                 fi
7447         fi
7448 fi
7449 nm_extract="$com"
7450 case "$PASE" in
7451 define)
7452     echo " "
7453     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7454     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7455     ;;
7456 *)  if $test -f /lib/syscalls.exp; then
7457         echo " "
7458         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7459         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7460     fi
7461     ;;
7462 esac
7463 ;;
7464 esac
7465 $rm -f libnames libpath
7466
7467 : see if dld is available
7468 set dld.h i_dld
7469 eval $inhdr
7470
7471 : is a C symbol defined?
7472 csym='tlook=$1;
7473 case "$3" in
7474 -v) tf=libc.tmp; tdc="";;
7475 -a) tf=libc.tmp; tdc="[]";;
7476 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7477 esac;
7478 tx=yes;
7479 case "$reuseval-$4" in
7480 true-) ;;
7481 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7482 esac;
7483 case "$tx" in
7484 yes)
7485         tval=false;
7486         if $test "$runnm" = true; then
7487                 if $contains $tlook $tf >/dev/null 2>&1; then
7488                         tval=true;
7489                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7490                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7491                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7492                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7493                         $rm -f try$_exe try.c core core.* try.core;
7494                 fi;
7495         else
7496                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7497                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7498                 $rm -f try$_exe try.c;
7499         fi;
7500         ;;
7501 *)
7502         case "$tval" in
7503         $define) tval=true;;
7504         *) tval=false;;
7505         esac;
7506         ;;
7507 esac;
7508 eval "$2=$tval"'
7509
7510 : define an is-in-libc? function
7511 inlibc='echo " "; td=$define; tu=$undef;
7512 sym=$1; var=$2; eval "was=\$$2";
7513 tx=yes;
7514 case "$reuseval$was" in
7515 true) ;;
7516 true*) tx=no;;
7517 esac;
7518 case "$tx" in
7519 yes)
7520         set $sym tres -f;
7521         eval $csym;
7522         case "$tres" in
7523         true)
7524                 echo "$sym() found." >&4;
7525                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7526         *)
7527                 echo "$sym() NOT found." >&4;
7528                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7529         esac;;
7530 *)
7531         case "$was" in
7532         $define) echo "$sym() found." >&4;;
7533         *) echo "$sym() NOT found." >&4;;
7534         esac;;
7535 esac'
7536
7537 : see if dlopen exists
7538 xxx_runnm="$runnm"
7539 runnm=false
7540 set dlopen d_dlopen
7541 eval $inlibc
7542 runnm="$xxx_runnm"
7543
7544 : determine which dynamic loading, if any, to compile in
7545 echo " "
7546 dldir="ext/DynaLoader"
7547 case "$usedl" in
7548 $define|y|true)
7549         dflt='y'
7550         usedl="$define"
7551         ;;
7552 $undef|n|false)
7553         dflt='n'
7554         usedl="$undef"
7555         ;;
7556 *) 
7557         dflt='n'
7558         case "$d_dlopen" in
7559             $define) dflt='y' ;;
7560         esac
7561         case "$i_dld" in
7562             $define) dflt='y' ;;
7563         esac
7564         : Does a dl_xxx.xs file exist for this operating system
7565         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7566         ;;
7567 esac
7568 rp="Do you wish to use dynamic loading?"
7569 . ./myread
7570 usedl="$ans"
7571 case "$ans" in
7572 y*) usedl="$define"
7573         case "$dlsrc" in
7574         '')
7575                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7576                         dflt="$dldir/dl_${osname}.xs"
7577                 elif $test "$d_dlopen" = "$define" ; then
7578                         dflt="$dldir/dl_dlopen.xs"
7579                 elif $test "$i_dld" = "$define" ; then
7580                         dflt="$dldir/dl_dld.xs"
7581                 else
7582                         dflt=''
7583                 fi
7584                 ;;
7585         *)      dflt="$dldir/$dlsrc"
7586                 ;;
7587         esac
7588     echo "The following dynamic loading files are available:"
7589         : Can not go over to $dldir because getfile has path hard-coded in.
7590         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7591         rp="Source file to use for dynamic loading"
7592         fn="fne"
7593         gfpth="$src"
7594         . ./getfile
7595         usedl="$define"
7596         : emulate basename
7597         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7598
7599         $cat << EOM
7600
7601 Some systems may require passing special flags to $cc -c to
7602 compile modules that will be used to create a shared library.
7603 To use no flags, say "none".
7604
7605 EOM
7606     case "$cccdlflags" in
7607     '') case "$gccversion" in
7608                 '') case "$osname" in
7609                         hpux)   dflt='+z' ;;
7610                         next)   dflt='none' ;;
7611                         irix*)  dflt='-KPIC' ;;
7612                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7613                         sunos)  dflt='-pic' ;;
7614                         *)      dflt='none' ;;
7615                     esac
7616                         ;;
7617                 *)  case "$osname" in
7618                         darwin) dflt='none' ;;
7619                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7620                         *)      dflt='-fpic' ;;
7621                     esac ;;
7622             esac ;;
7623         ' ') dflt='none' ;;
7624     *)  dflt="$cccdlflags" ;;
7625     esac
7626     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7627     . ./myread
7628     case "$ans" in
7629     none) cccdlflags=' ' ;;
7630     *) cccdlflags="$ans" ;;
7631     esac
7632
7633     cat << EOM
7634
7635 Some systems use ld to create libraries that can be dynamically loaded,
7636 while other systems (such as those using ELF) use $cc.
7637
7638 EOM
7639         case "$ld" in
7640         '')     $cat >try.c <<EOM
7641 /* Test for whether ELF binaries are produced */
7642 #include <fcntl.h>
7643 #$i_stdlib I_STDLIB
7644 #ifdef I_STDLIB
7645 #include <stdlib.h>
7646 #endif
7647 int main() {
7648         char b[4];
7649         int i = open("a.out",O_RDONLY);
7650         if(i == -1) 
7651                 exit(1); /* fail */
7652         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7653                 exit(0); /* succeed (yes, it's ELF) */
7654         else
7655                 exit(1); /* fail */
7656 }
7657 EOM
7658                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7659                         cat <<EOM
7660 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7661 EOM
7662                         dflt="$cc"
7663                 else
7664                         echo "I'll use ld to build dynamic libraries."
7665                         dflt='ld'
7666                 fi
7667                 rm -f try.c a.out
7668                 ;;
7669         *)      dflt="$ld"
7670                 ;;
7671         esac
7672
7673     rp="What command should be used to create dynamic libraries?"
7674     . ./myread
7675         ld="$ans"
7676
7677     cat << EOM
7678
7679 Some systems may require passing special flags to $ld to create a
7680 library that can be dynamically loaded.  If your ld flags include
7681 -L/other/path options to locate libraries outside your loader's normal
7682 search path, you may need to specify those -L options here as well.  To
7683 use no flags, say "none".
7684
7685 EOM
7686     case "$lddlflags" in
7687     '') case "$osname" in
7688                         beos) dflt='-nostart' ;;
7689                         hpux) dflt='-b';
7690                               case "$gccversion" in
7691                               '') dflt="$dflt +vnocompatwarnings" ;;
7692                               esac
7693                               ;;        
7694                         linux|irix*|gnu*)       dflt='-shared' ;;
7695                         next)  dflt='none' ;;
7696                         solaris) dflt='-G' ;;
7697                         sunos) dflt='-assert nodefinitions' ;;
7698                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7699                 *)     dflt='none' ;;
7700                         esac
7701                         ;;
7702     *) dflt="$lddlflags" ;;
7703     esac
7704
7705         : Try to guess additional flags to pick up local libraries.
7706         : Be careful not to append to a plain 'none'
7707         case "$dflt" in
7708         none) dflt='' ;;
7709         esac
7710         for thisflag in $ldflags; do
7711                 case "$thisflag" in
7712                 -L*|-R*|-Wl,-R*)
7713                         case " $dflt " in
7714                         *" $thisflag "*) ;;
7715                         *) dflt="$dflt $thisflag" ;;
7716                         esac
7717                         ;;
7718                 esac
7719         done
7720
7721         case "$dflt" in
7722         ''|' ') dflt='none' ;;
7723         esac
7724
7725     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7726     . ./myread
7727     case "$ans" in
7728     none) lddlflags=' ' ;;
7729     *) lddlflags="$ans" ;;
7730     esac
7731
7732         cat <<EOM
7733
7734 Some systems may require passing special flags to $cc to indicate that
7735 the resulting executable will use dynamic linking.  To use no flags,
7736 say "none".
7737
7738 EOM
7739     case "$ccdlflags" in
7740     '') case "$osname" in
7741             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7742             next|sunos) dflt='none' ;;
7743             *)          dflt='none' ;;
7744             esac ;;
7745     ' ')  dflt='none' ;;
7746     *)  dflt="$ccdlflags" ;;
7747     esac
7748     rp="Any special flags to pass to $cc to use dynamic linking?"
7749     . ./myread
7750     case "$ans" in
7751     none) ccdlflags=' ' ;;
7752     *) ccdlflags="$ans" ;;
7753     esac
7754     ;;
7755 *)  usedl="$undef"
7756         ld='ld'
7757     dlsrc='dl_none.xs'
7758     lddlflags=''
7759     ccdlflags=''
7760     ;;
7761 esac
7762
7763 also=''
7764 case "$usedl" in
7765 $undef)
7766         # No dynamic loading being used, so don't bother even to prompt.
7767         useshrplib='false'
7768         ;;
7769 *)      case "$useshrplib" in
7770         '')     case "$osname" in
7771                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7772                         dflt=y
7773                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7774                         ;;
7775                 next*)
7776                         case "$osvers" in
7777                         4*)     dflt=y
7778                                 also='Building a shared libperl is needed for MAB support.'
7779                                 ;;
7780                         *)      dflt=n
7781                                 ;;
7782                         esac
7783                         ;;
7784                 *)      dflt=n
7785                         ;;
7786                 esac
7787                 ;;
7788         $define|true|[Yy]*)
7789                 dflt=y
7790                 ;;
7791         *)      dflt=n
7792                 ;;
7793         esac
7794         $cat << EOM
7795
7796 The perl executable is normally obtained by linking perlmain.c with
7797 libperl${_a}, any static extensions (usually just DynaLoader), and
7798 any other libraries needed on this system (such as -lm, etc.).  Since
7799 your system supports dynamic loading, it is probably possible to build
7800 a shared libperl.$so.  If you will have more than one executable linked
7801 to libperl.$so, this will significantly reduce the size of each
7802 executable, but it may have a noticeable effect on performance.  The
7803 default is probably sensible for your system.
7804 $also
7805
7806 EOM
7807         rp="Build a shared libperl.$so (y/n)"
7808         . ./myread
7809         case "$ans" in
7810         true|$define|[Yy]*)
7811                 useshrplib='true'  ;;
7812         *)      useshrplib='false' ;;
7813         esac
7814         ;;
7815 esac
7816
7817 case "$useshrplib" in
7818 true)
7819         case "$libperl" in
7820         '')
7821                 # Figure out a good name for libperl.so.  Since it gets stored in
7822                 # a version-specific architecture-dependent library, the version
7823                 # number isn't really that important, except for making cc/ld happy.
7824                 #
7825                 # A name such as libperl.so.3.1
7826                 majmin="libperl.$so.$patchlevel.$subversion"
7827                 # A name such as libperl.so.301
7828                 majonly=`echo $patchlevel $subversion |
7829                         $awk '{printf "%d%02d", $1, $2}'`
7830                 majonly=libperl.$so.$majonly
7831                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7832                 # rely on figuring it out from the naming of libc.
7833                 case "${osname}${osvers}" in
7834                 next4*)
7835                         dflt=libperl.5.$so
7836                         # XXX How handle the --version stuff for MAB?
7837                         ;;
7838                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7839                         dflt=libperl.$so
7840                         ;;
7841                 cygwin*) # ld links against an importlib
7842                         dflt=libperl$lib_ext
7843                         ;;
7844                 *)      # Try to guess based on whether libc has major.minor.
7845                         case "$libc" in
7846                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7847                         *libc.$so.[0-9]*) dflt=$majonly ;;
7848                         *)      dflt=libperl.$so ;;
7849                         esac
7850                         ;;
7851                 esac
7852                 ;;
7853         *)      dflt=$libperl
7854                 ;;
7855         esac
7856         cat << EOM
7857
7858 I need to select a good name for the shared libperl.  If your system uses
7859 library names with major and minor numbers, then you might want something
7860 like $majmin.  Alternatively, if your system uses a single version
7861 number for shared libraries, then you might want to use $majonly.
7862 Or, your system might be quite happy with a simple libperl.$so.
7863
7864 Since the shared libperl will get installed into a version-specific
7865 architecture-dependent directory, the version number of the shared perl
7866 library probably isn't important, so the default should be o.k.
7867
7868 EOM
7869         rp='What name do you want to give to the shared libperl?'
7870         . ./myread
7871         libperl=$ans
7872         echo "Ok, I'll use $libperl"
7873         ;;
7874 *)
7875         libperl="libperl${_a}"
7876         ;;
7877 esac
7878
7879 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7880 case "$shrpdir" in
7881 '') ;;
7882 *)      $cat >&4 <<EOM
7883 WARNING:  Use of the shrpdir variable for the installation location of
7884 the shared $libperl is not supported.  It was never documented and
7885 will not work in this version.  Let me (perlbug@perl.org)
7886 know of any problems this may cause.
7887
7888 EOM
7889         case "$shrpdir" in
7890         "$archlibexp/CORE")
7891                 $cat >&4 <<EOM
7892 But your current setting of $shrpdir is
7893 the default anyway, so it's harmless.
7894 EOM
7895                 ;;
7896         *)
7897                 $cat >&4 <<EOM
7898 Further, your current attempted setting of $shrpdir
7899 conflicts with the value of $archlibexp/CORE
7900 that installperl will use.
7901 EOM
7902                 ;;
7903         esac
7904         ;;
7905 esac
7906
7907 # How will the perl executable find the installed shared $libperl?
7908 # Add $xxx to ccdlflags.
7909 # If we can't figure out a command-line option, use $shrpenv to
7910 # set env LD_RUN_PATH.  The main perl makefile uses this.
7911 shrpdir=$archlibexp/CORE
7912 xxx=''
7913 tmp_shrpenv=''
7914 if "$useshrplib"; then
7915     case "$osname" in 
7916         aix)
7917                 # We'll set it in Makefile.SH...
7918                 ;;
7919         solaris)
7920                 xxx="-R $shrpdir"
7921                 ;;
7922         freebsd|netbsd|openbsd|interix|dragonfly)
7923                 xxx="-Wl,-R$shrpdir"
7924                 ;;
7925         bsdos|linux|irix*|dec_osf|gnu*)
7926                 xxx="-Wl,-rpath,$shrpdir"
7927                 ;;
7928         next)
7929                 # next doesn't like the default...
7930                 ;;
7931         beos)
7932                 # beos doesn't like the default, either.
7933                 ;;
7934         hpux*)
7935                 # hpux doesn't like the default, either.
7936                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7937                 ;;
7938         *)
7939                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7940                 ;;
7941         esac
7942         case "$xxx" in
7943         '') ;;
7944         *)      
7945                 # Only add $xxx if it isn't already in ccdlflags.
7946                 case " $ccdlflags " in
7947                 *" $xxx "*)     ;;
7948                 *)      ccdlflags="$ccdlflags $xxx"
7949                         cat <<EOM >&4
7950
7951 Adding $xxx to the flags
7952 passed to $ld so that the perl executable will find the 
7953 installed shared $libperl.
7954
7955 EOM
7956                         ;;
7957                 esac
7958                 ;;
7959         esac
7960 fi
7961 # Fix ccdlflags in AIX for building external extensions.
7962 # (For building Perl itself bare -bE:perl.exp is needed,
7963 #  Makefile.SH takes care of this.)
7964 case "$osname" in
7965 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7966 esac
7967 # Respect a hint or command-line value.
7968 case "$shrpenv" in
7969 '') shrpenv="$tmp_shrpenv" ;;
7970 esac
7971 case "$ldlibpthname" in
7972 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7973 none)   ldlibpthname='' ;;
7974 esac
7975
7976 : determine where manual pages are on this system
7977 echo " "
7978 case "$sysman" in
7979 '') 
7980         syspath='/usr/share/man/man1 /usr/man/man1'
7981         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7982         syspath="$syspath /usr/man/u_man/man1"
7983         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7984         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7985         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7986         sysman=`./loc . /usr/man/man1 $syspath`
7987         ;;
7988 esac
7989 if $test -d "$sysman"; then
7990         echo "System manual is in $sysman." >&4
7991 else
7992         echo "Could not find manual pages in source form." >&4
7993 fi
7994
7995 : determine where manual pages go
7996 set man1dir man1dir none
7997 eval $prefixit
7998 $cat <<EOM
7999
8000 $spackage has manual pages available in source form.
8001 EOM
8002 case "$nroff" in
8003 nroff)
8004         echo "However, you don't have nroff, so they're probably useless to you."
8005         case "$man1dir" in
8006         '') man1dir="none";;
8007         esac;;
8008 esac
8009 echo "If you don't want the manual sources installed, answer 'none'."
8010 case "$man1dir" in
8011 ' ') dflt=none
8012         ;;
8013 '')
8014         lookpath="$prefixexp/share/man/man1"
8015         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8016         lookpath="$lookpath $prefixexp/man/p_man/man1"
8017         lookpath="$lookpath $prefixexp/man/u_man/man1"
8018         lookpath="$lookpath $prefixexp/man/man.1"
8019         case "$sysman" in
8020         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8021         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8022         esac
8023         set dflt
8024         eval $prefixup
8025         ;;
8026 *)  dflt="$man1dir"
8027         ;;
8028 esac
8029 echo " "
8030 fn=dn+~
8031 rp="Where do the main $spackage manual pages (source) go?"
8032 . ./getfile
8033 if $test "X$man1direxp" != "X$ansexp"; then
8034         installman1dir=''
8035 fi
8036 man1dir="$ans"
8037 man1direxp="$ansexp"
8038 case "$man1dir" in
8039 '')     man1dir=' '
8040         installman1dir='';;
8041 esac
8042
8043 : Change installation prefix, if necessary.
8044 if $test X"$prefix" != X"$installprefix"; then
8045         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8046 else
8047         installman1dir="$man1direxp"
8048 fi
8049
8050 : What suffix to use on installed man pages
8051
8052 case "$man1dir" in
8053 ' ')
8054         man1ext='0'
8055         ;;
8056 *)
8057         rp="What suffix should be used for the main $spackage man pages?"
8058         case "$man1ext" in
8059         '')     case "$man1dir" in
8060                 *1)  dflt=1 ;;
8061                 *1p) dflt=1p ;;
8062                 *1pm) dflt=1pm ;;
8063                 *l) dflt=l;;
8064                 *n) dflt=n;;
8065                 *o) dflt=o;;
8066                 *p) dflt=p;;
8067                 *C) dflt=C;;
8068                 *L) dflt=L;;
8069                 *L1) dflt=L1;;
8070                 *) dflt=1;;
8071                 esac
8072                 ;;
8073         *)      dflt="$man1ext";;
8074         esac
8075         . ./myread
8076         man1ext="$ans"
8077         ;;
8078 esac
8079
8080 : see if we can have long filenames
8081 echo " "
8082 first=123456789abcdef
8083 $rm -f $first
8084 if (echo hi >$first) 2>/dev/null; then
8085         if $test -f 123456789abcde; then
8086                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8087                 val="$undef"
8088         else
8089                 echo 'You can have filenames longer than 14 characters.'>&4
8090                 val="$define"
8091         fi
8092 else
8093         $cat <<'EOM'
8094 You can't have filenames longer than 14 chars.
8095 You can't even think about them!
8096 EOM
8097         val="$undef"
8098 fi 
8099 set d_flexfnam
8100 eval $setvar
8101 $rm -rf 123456789abcde*
8102
8103 : determine where library module manual pages go
8104 set man3dir man3dir none
8105 eval $prefixit
8106 $cat <<EOM
8107
8108 $spackage has manual pages for many of the library modules.
8109 EOM
8110
8111 case "$nroff" in
8112 nroff)
8113         $cat <<'EOM'
8114 However, you don't have nroff, so they're probably useless to you.
8115 EOM
8116         case "$man3dir" in
8117         '') man3dir="none";;
8118         esac;;
8119 esac
8120
8121 case "$d_flexfnam" in
8122 undef)
8123         $cat <<'EOM'
8124 However, your system can't handle the long file names like File::Basename.3. 
8125 EOM
8126         case "$man3dir" in
8127         '') man3dir="none";;
8128         esac;;
8129 esac
8130
8131 echo "If you don't want the manual sources installed, answer 'none'."
8132 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8133 case "$man3dir" in
8134 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8135         if $test -d "$privlib/man/man3"; then
8136                 cat <<EOM >&4
8137
8138 WARNING:  Previous versions of perl installed man3 pages into
8139 $privlib/man/man3.  This version will suggest a 
8140 new default of $dflt.  
8141 EOM
8142                 tdflt=$dflt
8143                 dflt='n'
8144                 rp='Do you wish to preserve the old behavior?(y/n)'
8145                 . ./myread
8146                 case "$ans" in
8147                 y*) dflt="$privlib/man/man3" ;;
8148                 *)  dflt=$tdflt ;;
8149                 esac
8150     fi
8151         ;;
8152 *)      dflt="$man3dir" ;;
8153 esac
8154 case "$dflt" in
8155 ' ') dflt=none ;;
8156 esac
8157 echo " "
8158 fn=dn+~
8159 rp="Where do the $package library man pages (source) go?"
8160 . ./getfile
8161 man3dir="$ans"
8162 man3direxp="$ansexp"
8163 case "$man3dir" in
8164 '')     man3dir=' '
8165         installman3dir='';;
8166 esac
8167
8168 : Change installation prefix, if necessary.
8169 if $test X"$prefix" != X"$installprefix"; then
8170         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8171 else
8172         installman3dir="$man3direxp"
8173 fi
8174
8175 : What suffix to use on installed man pages
8176 case "$man3dir" in
8177 ' ')
8178         man3ext='0'
8179         ;;
8180 *)
8181         rp="What suffix should be used for the $package library man pages?"
8182         case "$man3ext" in
8183         '')     case "$man3dir" in
8184                 *3)  dflt=3 ;;
8185                 *3p) dflt=3p ;;
8186                 *3pm) dflt=3pm ;;
8187                 *l) dflt=l;;
8188                 *n) dflt=n;;
8189                 *o) dflt=o;;
8190                 *p) dflt=p;;
8191                 *C) dflt=C;;
8192                 *L) dflt=L;;
8193                 *L3) dflt=L3;;
8194                 *) dflt=3;;
8195                 esac
8196                 ;;
8197         *)      dflt="$man3ext";;
8198         esac
8199         . ./myread
8200         man3ext="$ans"
8201         ;;
8202 esac
8203
8204 : see if we have to deal with yellow pages, now NIS.
8205 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8206         if $test -f /usr/etc/nibindd; then
8207                 echo " "
8208                 echo "I'm fairly confident you're on a NeXT."
8209                 echo " "
8210                 rp='Do you get the hosts file via NetInfo?'
8211                 dflt=y
8212                 case "$hostcat" in
8213                 nidump*) ;;
8214                 '') ;;
8215                 *) dflt=n;;
8216                 esac
8217                 . ./myread
8218                 case "$ans" in
8219                 y*) hostcat='nidump hosts .';;
8220                 *)      case "$hostcat" in
8221                         nidump*) hostcat='';;
8222                         esac
8223                         ;;
8224                 esac
8225         fi
8226         case "$hostcat" in
8227         nidump*) ;;
8228         *)
8229                 case "$hostcat" in
8230                 *ypcat*) dflt=y;;
8231                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8232                                 dflt=y
8233                         else
8234                                 dflt=n
8235                         fi;;
8236                 *) dflt=n;;
8237                 esac
8238                 echo " "
8239                 rp='Are you getting the hosts file via yellow pages?'
8240                 . ./myread
8241                 case "$ans" in
8242                 y*) hostcat='ypcat hosts';;
8243                 *) hostcat='cat /etc/hosts';;
8244                 esac
8245                 ;;
8246         esac
8247 fi
8248 case "$hostcat" in
8249 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8250 esac
8251 case "$groupcat" in
8252 '') test -f /etc/group && groupcat='cat /etc/group';;
8253 esac
8254 case "$passcat" in
8255 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8256 esac
8257
8258 : now get the host name
8259 echo " "
8260 echo "Figuring out host name..." >&4
8261 case "$myhostname" in
8262 '') cont=true
8263         echo 'Maybe "hostname" will work...'
8264         if tans=`sh -c hostname 2>&1` ; then
8265                 myhostname=$tans
8266                 phostname=hostname
8267                 cont=''
8268         fi
8269         ;;
8270 *) cont='';;
8271 esac
8272 if $test "$cont"; then
8273         if ./xenix; then
8274                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8275                 if tans=`cat /etc/systemid 2>&1` ; then
8276                         myhostname=$tans
8277                         phostname='cat /etc/systemid'
8278                         echo "Whadyaknow.  Xenix always was a bit strange..."
8279                         cont=''
8280                 fi
8281         elif $test -r /etc/systemid; then
8282                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8283         fi
8284 fi
8285 if $test "$cont"; then
8286         echo 'No, maybe "uuname -l" will work...'
8287         if tans=`sh -c 'uuname -l' 2>&1` ; then
8288                 myhostname=$tans
8289                 phostname='uuname -l'
8290         else
8291                 echo 'Strange.  Maybe "uname -n" will work...'
8292                 if tans=`sh -c 'uname -n' 2>&1` ; then
8293                         myhostname=$tans
8294                         phostname='uname -n'
8295                 else
8296                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8297                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8298                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8299                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8300                         else
8301                                 case "$myhostname" in
8302                                 '') echo "Does this machine have an identity crisis or something?"
8303                                         phostname='';;
8304                                 *)
8305                                         echo "Well, you said $myhostname before..."
8306                                         phostname='echo $myhostname';;
8307                                 esac
8308                         fi
8309                 fi
8310         fi
8311 fi
8312 case "$myhostname" in
8313 '') myhostname=noname ;;
8314 esac
8315 : you do not want to know about this
8316 set $myhostname
8317 myhostname=$1
8318
8319 : verify guess
8320 if $test "$myhostname" ; then
8321         dflt=y
8322         rp='Your host name appears to be "'$myhostname'".'" Right?"
8323         . ./myread
8324         case "$ans" in
8325         y*) ;;
8326         *) myhostname='';;
8327         esac
8328 fi
8329
8330 : bad guess or no guess
8331 while $test "X$myhostname" = X ; do
8332         dflt=''
8333         rp="Please type the (one word) name of your host:"
8334         . ./myread
8335         myhostname="$ans"
8336 done
8337
8338 : translate upper to lower if necessary
8339 case "$myhostname" in
8340 *[A-Z]*)
8341         echo "(Normalizing case in your host name)"
8342         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8343         ;;
8344 esac
8345
8346 case "$myhostname" in
8347 *.*)
8348         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8349         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8350         echo "(Trimming domain name from host name--host name is now $myhostname)"
8351         ;;
8352 *) case "$mydomain" in
8353         '')
8354                 {
8355                         test "X$hostcat" = "Xypcat hosts" &&
8356                         ypmatch "$myhostname" hosts 2>/dev/null |\
8357                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8358                         $test -s hosts
8359                 } || {
8360                         test "X$hostcat" != "X" &&
8361                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8362                                         /[       ]$myhostname[  . ]/p" > hosts
8363                 }
8364                 tmp_re="[       . ]"
8365                 if $test -f hosts; then
8366                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8367                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8368                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8369                                 hosts | $sort | $uniq | \
8370                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8371                         case `$echo X$dflt` in
8372                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8373                                 dflt=.
8374                                 ;;
8375                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8376                                 ;;
8377                         esac
8378                 else
8379                         echo "(I cannot locate a hosts database anywhere)"
8380                         dflt=.
8381                 fi
8382                 case "$dflt" in
8383                 .)
8384                         tans=`./loc resolv.conf X /etc /usr/etc`
8385                         if $test -f "$tans"; then
8386                                 echo "(Attempting domain name extraction from $tans)"
8387                                 dflt=.`$sed -n -e 's/   / /g' \
8388                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8389                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8390                                 case "$dflt" in
8391                                 .) dflt=.`$sed -n -e 's/        / /g' \
8392                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8393                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8394                                         ;;
8395                                 esac
8396                         fi
8397                         ;;
8398                 esac
8399                 case "$dflt" in
8400                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8401                         dflt=.`sh -c domainname 2>/dev/null`
8402                         case "$dflt" in
8403                         '') dflt='.';;
8404                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8405                         esac
8406                         ;;
8407                 esac
8408                 case "$dflt$osname" in
8409                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8410                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8411                         ;;
8412                 esac
8413                 case "$dflt" in
8414                 .) echo "(Lost all hope -- silly guess then)"
8415                         dflt='.nonet'
8416                         ;;
8417                 esac
8418                 $rm -f hosts
8419                 ;;
8420         *) dflt="$mydomain";;
8421         esac;;
8422 esac
8423 echo " "
8424 rp="What is your domain name?"
8425 . ./myread
8426 tans="$ans"
8427 case "$ans" in
8428 '') ;;
8429 .*) ;;
8430 *) tans=".$tans";;
8431 esac
8432 mydomain="$tans"
8433
8434 : translate upper to lower if necessary
8435 case "$mydomain" in
8436 *[A-Z]*)
8437         echo "(Normalizing case in your domain name)"
8438         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8439         ;;
8440 esac
8441
8442 : a little sanity check here
8443 case "$phostname" in
8444 '') ;;
8445 *)
8446         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8447         $myhostname$mydomain|$myhostname) ;;
8448         *)
8449                 case "$phostname" in
8450                 sed*)
8451                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8452                         ;;
8453                 *)
8454                         echo "(That doesn't agree with your $phostname command, by the way.)"
8455                         ;;
8456                 esac
8457         ;;
8458         esac
8459         ;;
8460 esac
8461
8462 $cat <<EOM
8463
8464 I need to get your e-mail address in Internet format if possible, i.e.
8465 something like user@host.domain. Please answer accurately since I have
8466 no easy means to double check it. The default value provided below
8467 is most probably close to reality but may not be valid from outside
8468 your organization...
8469
8470 EOM
8471 cont=x
8472 while test "$cont"; do
8473         case "$cf_email" in
8474         '') dflt="$cf_by@$myhostname$mydomain";;
8475         *) dflt="$cf_email";;
8476         esac
8477         rp='What is your e-mail address?'
8478         . ./myread
8479         cf_email="$ans"
8480         case "$cf_email" in
8481         *@*.*) cont='' ;;
8482         *)
8483                 rp='Address does not look like an Internet one.  Use it anyway?'
8484                 case "$fastread" in
8485                 yes) dflt=y ;;
8486                 *) dflt=n ;;
8487                 esac
8488                 . ./myread
8489                 case "$ans" in
8490                 y*) cont='' ;;
8491                 *) echo " " ;;
8492                 esac
8493                 ;;
8494         esac
8495 done
8496
8497 $cat <<EOM
8498
8499 If you or somebody else will be maintaining perl at your site, please
8500 fill in the correct e-mail address here so that they may be contacted
8501 if necessary. Currently, the "perlbug" program included with perl
8502 will send mail to this address in addition to perlbug@perl.org. You may
8503 enter "none" for no administrator.
8504
8505 EOM
8506 case "$perladmin" in
8507 '') dflt="$cf_email";;
8508 *) dflt="$perladmin";;
8509 esac
8510 rp='Perl administrator e-mail address'
8511 . ./myread
8512 perladmin="$ans"
8513
8514 : determine whether to only install version-specific parts.
8515 echo " "
8516 $cat <<EOM
8517 Do you want to install only the version-specific parts of the perl
8518 distribution?  Usually you do *not* want to do this.
8519 EOM
8520 case "$versiononly" in
8521 "$define"|[Yy]*|true) dflt='y' ;;
8522 *) dflt='n';
8523 esac
8524 rp="Do you want to install only the version-specific parts of perl?"
8525 . ./myread
8526 case "$ans" in
8527 [yY]*)  val="$define";;
8528 *)      val="$undef" ;;
8529 esac
8530 set versiononly
8531 eval $setvar
8532
8533 case "$versiononly" in
8534 "$define") inc_version_list=''
8535            inc_version_list_init=0
8536            ;;
8537 esac
8538
8539 : figure out how to guarantee perl startup
8540 case "$startperl" in
8541 '')
8542         case "$sharpbang" in
8543         *!)
8544                 $cat <<EOH
8545
8546 I can use the #! construct to start perl on your system. This will
8547 make startup of perl scripts faster, but may cause problems if you
8548 want to share those scripts and perl is not in a standard place
8549 ($binexp/perl) on all your platforms. The alternative is to force
8550 a shell by starting the script with a single ':' character.
8551
8552 EOH
8553                 case "$versiononly" in
8554                 "$define")      dflt="$binexp/perl$version";;  
8555                 *)              dflt="$binexp/perl";;
8556                 esac
8557                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8558                 . ./myread
8559                 case "$ans" in
8560                 none)   startperl=": # use perl";;
8561                 *)      startperl="#!$ans"
8562                         if $test 30 -lt `echo "$ans" | wc -c`; then
8563                                 $cat >&4 <<EOM
8564
8565 WARNING:  Some systems limit the #! command to 32 characters.
8566 If you experience difficulty running Perl scripts with #!, try
8567 installing Perl in a directory with a shorter pathname.
8568
8569 EOM
8570                         fi ;;
8571                 esac
8572                 ;;
8573         *) startperl=": # use perl"
8574                 ;;
8575         esac
8576         ;;
8577 esac
8578 echo "I'll use $startperl to start perl scripts."
8579
8580 : figure best path for perl in scripts
8581 case "$perlpath" in
8582 '')
8583         case "$versiononly" in
8584         "$define")      perlpath="$binexp/perl$version";;
8585         *)              perlpath="$binexp/perl";;
8586         esac
8587         case "$startperl" in
8588         *!*) ;;
8589         *)
8590                 $cat <<EOH
8591
8592 I will use the "eval 'exec'" idiom to start Perl on your system.
8593 I can use the full path of your Perl binary for this purpose, but
8594 doing so may cause problems if you want to share those scripts and
8595 Perl is not always in a standard place ($binexp/perl).
8596
8597 EOH
8598                 dflt="$binexp/perl"
8599                 rp="What path shall I use in \"eval 'exec'\"?"
8600                 . ./myread
8601                 perlpath="$ans"
8602                 ;;
8603         esac
8604         ;;
8605 esac
8606 case "$startperl" in
8607 *!*)    ;;
8608 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8609 esac
8610
8611 : determine where public executable scripts go
8612 set scriptdir scriptdir
8613 eval $prefixit
8614 case "$scriptdir" in
8615 '')
8616         dflt="$bin"
8617         : guess some guesses
8618         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8619         $test -d /usr/share/bin     && dflt=/usr/share/bin
8620         $test -d /usr/local/script  && dflt=/usr/local/script
8621         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8622         $test -d $prefixexp/script  && dflt=$prefixexp/script
8623         set dflt
8624         eval $prefixup
8625         ;;
8626 *)  dflt="$scriptdir"
8627         ;;
8628 esac
8629 $cat <<EOM
8630  
8631 Some installations have a separate directory just for executable scripts so
8632 that they can mount it across multiple architectures but keep the scripts in
8633 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8634 Or you might just lump your scripts in with all your other executables.
8635  
8636 EOM
8637 fn=d~
8638 rp='Where do you keep publicly executable scripts?'
8639 . ./getfile
8640 if $test "X$ansexp" != "X$scriptdirexp"; then
8641         installscript=''
8642 fi
8643 scriptdir="$ans"
8644 scriptdirexp="$ansexp"
8645 : Change installation prefix, if necessary.
8646 if $test X"$prefix" != X"$installprefix"; then
8647         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8648 else
8649         installscript="$scriptdirexp"
8650 fi
8651
8652 : determine where add-on public executables go
8653 case "$sitebin" in
8654 '')     dflt=$siteprefix/bin ;;
8655 *)      dflt=$sitebin ;;
8656 esac
8657 fn=d~
8658 rp='Pathname where the add-on public executables should be installed?'
8659 . ./getfile
8660 sitebin="$ans"
8661 sitebinexp="$ansexp"
8662 : Change installation prefix, if necessary.
8663 if $test X"$prefix" != X"$installprefix"; then
8664         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8665 else
8666         installsitebin="$sitebinexp"
8667 fi
8668
8669 : determine where add-on html pages go
8670 : There is no standard location, so try to copy the previously-selected
8671 : directory structure for the core html pages.
8672 case "$sitehtml1dir" in
8673 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8674 *)     dflt=$sitehtml1dir ;;
8675 esac
8676 case "$dflt" in
8677 ''|' ') dflt=none ;;
8678 esac
8679 fn=dn+~
8680 rp='Pathname where the site-specific html pages should be installed?'
8681 . ./getfile
8682 sitehtml1dir="$ans"
8683 sitehtml1direxp="$ansexp"
8684 : Change installation prefix, if necessary.
8685 if $test X"$prefix" != X"$installprefix"; then
8686         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8687 else
8688         installsitehtml1dir="$sitehtml1direxp"
8689 fi
8690
8691 : determine where add-on library html pages go
8692 : There is no standard location, so try to copy the previously-selected
8693 : directory structure for the core html pages.
8694 case "$sitehtml3dir" in
8695 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8696 *)     dflt=$sitehtml3dir ;;
8697 esac
8698 case "$dflt" in
8699 ''|' ') dflt=none ;;
8700 esac
8701 fn=dn+~
8702 rp='Pathname where the site-specific library html pages should be installed?'
8703 . ./getfile
8704 sitehtml3dir="$ans"
8705 sitehtml3direxp="$ansexp"
8706 : Change installation prefix, if necessary.
8707 if $test X"$prefix" != X"$installprefix"; then
8708         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8709 else
8710         installsitehtml3dir="$sitehtml3direxp"
8711 fi
8712
8713 : determine where add-on manual pages go
8714 case "$siteman1dir" in
8715 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8716 *)      dflt=$siteman1dir ;;
8717 esac
8718 case "$dflt" in
8719 ''|' ') dflt=none ;;
8720 esac
8721 fn=dn+~
8722 rp='Pathname where the site-specific manual pages should be installed?'
8723 . ./getfile
8724 siteman1dir="$ans"
8725 siteman1direxp="$ansexp"
8726 : Change installation prefix, if necessary.
8727 if $test X"$prefix" != X"$installprefix"; then
8728         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8729 else
8730         installsiteman1dir="$siteman1direxp"
8731 fi
8732
8733 : determine where add-on library man pages go
8734 case "$siteman3dir" in
8735 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8736 *)      dflt=$siteman3dir ;;
8737 esac
8738 case "$dflt" in
8739 ''|' ') dflt=none ;;
8740 esac
8741 fn=dn+~
8742 rp='Pathname where the site-specific library manual pages should be installed?'
8743 . ./getfile
8744 siteman3dir="$ans"
8745 siteman3direxp="$ansexp"
8746 : Change installation prefix, if necessary.
8747 if $test X"$prefix" != X"$installprefix"; then
8748         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8749 else
8750         installsiteman3dir="$siteman3direxp"
8751 fi
8752
8753 : determine where add-on public executable scripts go
8754 case "$sitescript" in
8755 '')     dflt=$siteprefix/script
8756         $test -d $dflt || dflt=$sitebin ;;
8757 *)  dflt="$sitescript" ;;
8758 esac
8759 fn=d~+
8760 rp='Pathname where add-on public executable scripts should be installed?'
8761 . ./getfile
8762 sitescript="$ans"
8763 sitescriptexp="$ansexp"
8764 : Change installation prefix, if necessary.
8765 if $test X"$prefix" != X"$installprefix"; then
8766         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8767 else
8768         installsitescript="$sitescriptexp"
8769 fi
8770
8771 case "$usefaststdio" in
8772 $define|true|[yY]*|'')
8773         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8774         case "$xversion" in
8775         [68])   dflt='y' ;;
8776         *)      dflt='n' ;;
8777         esac
8778         ;;
8779 *) dflt='n';;
8780 esac
8781 cat <<EOM
8782
8783 Perl can be built to use 'fast stdio', which means using the stdio
8784 library but also directly manipulating the stdio buffers to enable
8785 faster I/O.  Using stdio is better for backward compatibility (especially
8786 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8787 interface has been preferred instead of stdio.
8788
8789 If this doesn't make any sense to you, just accept the default '$dflt'.
8790 EOM
8791 rp='Use the "fast stdio" if available?'
8792 . ./myread
8793 case "$ans" in
8794 y|Y)    val="$define" ;;     
8795 *)      val="$undef" ;;
8796 esac
8797 set usefaststdio
8798 eval $setvar
8799
8800
8801 : define an is-a-typedef? function
8802 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8803 case "$inclist" in
8804 "") inclist="sys/types.h";;
8805 esac;
8806 eval "varval=\$$var";
8807 case "$varval" in
8808 "")
8809         $rm -f temp.c;
8810         for inc in $inclist; do
8811                 echo "#include <$inc>" >>temp.c;
8812         done;
8813         echo "#ifdef $type" >> temp.c;
8814         echo "printf(\"We have $type\");" >> temp.c;
8815         echo "#endif" >> temp.c;
8816         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8817         if $contains $type temp.E >/dev/null 2>&1; then
8818                 eval "$var=\$type";
8819         else
8820                 eval "$var=\$def";
8821         fi;
8822         $rm -f temp.?;;
8823 *) eval "$var=\$varval";;
8824 esac'
8825
8826 : define an is-a-typedef? function that prompts if the type is not available.
8827 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8828 case "$inclist" in
8829 "") inclist="sys/types.h";;
8830 esac;
8831 eval "varval=\$$var";
8832 case "$varval" in
8833 "")
8834         $rm -f temp.c;
8835         for inc in $inclist; do
8836                 echo "#include <$inc>" >>temp.c;
8837         done;
8838         echo "#ifdef $type" >> temp.c;
8839         echo "printf(\"We have $type\");" >> temp.c;
8840         echo "#endif" >> temp.c;
8841         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8842         echo " " ;
8843         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8844         if $contains $type temp.E >/dev/null 2>&1; then
8845                 echo "$type found." >&4;
8846                 eval "$var=\$type";
8847         else
8848                 echo "$type NOT found." >&4;
8849                 dflt="$def";
8850                 . ./myread ;
8851                 eval "$var=\$ans";
8852         fi;
8853         $rm -f temp.?;;
8854 *) eval "$var=\$varval";;
8855 esac'
8856
8857 : see what type lseek is declared as in the kernel
8858 rp="What is the type used for lseek's offset on this system?"
8859 set off_t lseektype long stdio.h sys/types.h
8860 eval $typedef_ask
8861
8862 echo " "
8863 echo "Checking to see how big your file offsets are..." >&4
8864 $cat >try.c <<EOCP
8865 #include <sys/types.h>
8866 #include <stdio.h>
8867 int main()
8868 {
8869     printf("%d\n", (int)sizeof($lseektype));
8870     return(0); 
8871 }
8872 EOCP
8873 set try
8874 if eval $compile_ok; then
8875         lseeksize=`$run ./try`
8876         echo "Your file offsets are $lseeksize bytes long."
8877 else
8878         dflt=$longsize
8879         echo " "
8880         echo "(I can't seem to compile the test program.  Guessing...)"
8881         rp="What is the size of your file offsets (in bytes)?"
8882         . ./myread
8883         lseeksize="$ans"
8884 fi
8885 $rm -f try.c try
8886
8887 : see what type file positions are declared as in the library
8888 rp="What is the type for file position used by fsetpos()?"
8889 set fpos_t fpostype long stdio.h sys/types.h
8890 eval $typedef_ask
8891
8892 echo " "
8893 case "$fpostype" in
8894 *_t) zzz="$fpostype"    ;;
8895 *)   zzz="fpos_t"       ;;
8896 esac
8897 echo "Checking the size of $zzz..." >&4 
8898 cat > try.c <<EOCP
8899 #include <sys/types.h>
8900 #include <stdio.h>
8901 #$i_stdlib I_STDLIB
8902 #ifdef I_STDLIB
8903 #include <stdlib.h>
8904 #endif
8905 int main() {
8906     printf("%d\n", (int)sizeof($fpostype));
8907     exit(0);
8908 }
8909 EOCP
8910 set try
8911 if eval $compile_ok; then
8912         yyy=`$run ./try`
8913         case "$yyy" in
8914         '')     fpossize=4
8915                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8916                 ;;
8917         *)      fpossize=$yyy
8918                 echo "Your $zzz is $fpossize bytes long."
8919                 ;;
8920         esac
8921 else
8922         dflt="$longsize"
8923         echo " " >&4
8924         echo "(I can't compile the test program.  Guessing...)" >&4
8925         rp="What is the size of your file positions (in bytes)?"
8926         . ./myread
8927         fpossize="$ans"
8928 fi
8929
8930 # Backward compatibility (uselfs is deprecated).
8931 case "$uselfs" in
8932 "$define"|true|[yY]*)
8933         cat <<EOM >&4
8934
8935 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8936 EOM
8937         uselargefiles="$define"
8938         ;;
8939 esac                          
8940
8941 case "$lseeksize:$fpossize" in
8942 8:8) cat <<EOM
8943
8944 You can have files larger than 2 gigabytes.
8945 EOM
8946    val="$define" ;;
8947 *)    case "$uselargefiles" in
8948    "$undef"|false|[nN]*) dflt='n' ;;
8949    *)   dflt='y' ;;
8950    esac
8951    cat <<EOM
8952
8953 Perl can be built to understand large files (files larger than 2 gigabytes)
8954 on some systems.  To do so, Configure can be run with -Duselargefiles.
8955
8956 If this doesn't make any sense to you, just accept the default '$dflt'.
8957 EOM
8958    rp='Try to understand large files, if available?'
8959    . ./myread
8960    case "$ans" in
8961    y|Y)         val="$define" ;;
8962    *)           val="$undef"  ;;
8963    esac
8964    ;;
8965 esac
8966 set uselargefiles
8967 eval $setvar
8968 : Look for a hint-file generated 'call-back-unit'.  If the
8969 : user has specified that a large files perl is to be built,
8970 : we may need to set or change some other defaults.
8971 if $test -f uselargefiles.cbu; then
8972         echo "Your platform has some specific hints regarding large file builds, using them..."
8973         . ./uselargefiles.cbu
8974 fi
8975 case "$uselargefiles" in
8976 "$define")
8977         if $test -f uselargefiles.cbu; then
8978                 echo " "
8979                 echo "Rechecking to see how big your file offsets are..." >&4
8980                 $cat >try.c <<EOCP
8981 #include <sys/types.h>
8982 #include <stdio.h>
8983 int main()
8984 {
8985     printf("%d\n", (int)sizeof($lseektype));
8986     return(0); 
8987 }
8988 EOCP
8989                 set try
8990                 if eval $compile_ok; then
8991                         lseeksize=`$run ./try`
8992                         $echo "Your file offsets are now $lseeksize bytes long."
8993                 else
8994                         dflt="$lseeksize"
8995                         echo " "
8996                         echo "(I can't seem to compile the test program.  Guessing...)"
8997                         rp="What is the size of your file offsets (in bytes)?"
8998                         . ./myread
8999                         lseeksize="$ans"
9000                 fi
9001                 case "$fpostype" in
9002                 *_t) zzz="$fpostype"    ;;
9003                 *)   zzz="fpos_t"       ;;
9004                 esac
9005                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9006                 $cat > try.c <<EOCP
9007 #include <sys/types.h>
9008 #include <stdio.h>
9009 #$i_stdlib I_STDLIB
9010 #ifdef I_STDLIB
9011 #include <stdlib.h>
9012 #endif
9013 int main() {
9014     printf("%d\n", (int)sizeof($fpostype));
9015     return(0);
9016 }
9017 EOCP
9018                 set try
9019                 if eval $compile_ok; then
9020                         yyy=`$run ./try`
9021                         dflt="$lseeksize"
9022                         case "$yyy" in
9023                         '')     echo " "
9024                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9025                                 ;;
9026                         *)      fpossize=$yyy
9027                                 echo " $fpossize bytes." >&4
9028                                 ;;
9029                         esac
9030                 else
9031                         dflt="$fpossize"
9032                         echo " "
9033                         echo "(I can't compile the test program.  Guessing...)" >&4
9034                         rp="What is the size of your file positions (in bytes)?"
9035                         . ./myread
9036                         fpossize="$ans"
9037                 fi
9038                 $rm -f try.c try
9039         fi
9040         ;;
9041 esac
9042
9043 # probably will refer to
9044 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9045 need_relocation=0
9046 userelocatableinc=undef
9047
9048 case "$vendorprefix" in
9049 '')     d_vendorbin="$undef"
9050         vendorbin=''
9051         vendorbinexp=''
9052         ;;
9053 *)      d_vendorbin="$define"
9054         : determine where vendor-supplied executables go.
9055         case "$vendorbin" in
9056         '') dflt=$vendorprefix/bin ;;
9057         *)      dflt="$vendorbin" ;;
9058         esac
9059         fn=d~+
9060         rp='Pathname for the vendor-supplied executables directory?'
9061         . ./getfile
9062         vendorbin="$ans"
9063         vendorbinexp="$ansexp"
9064         ;;
9065 esac
9066 : Change installation prefix, if necessary.
9067 if $test X"$prefix" != X"$installprefix"; then
9068         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9069 else
9070         installvendorbin="$vendorbinexp"
9071 fi
9072
9073 case "$vendorprefix" in
9074 '')     vendorhtml1dir=''
9075         vendorhtml1direxp=''
9076         ;;
9077 *)      : determine where vendor-supplied html pages go.
9078         : There is no standard location, so try to copy the previously-selected
9079         : directory structure for the core html pages.
9080         : XXX Better default suggestions would be welcome.
9081         case "$vendorhtml1dir" in
9082         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9083         *)      dflt=$vendorhtml1dir ;;
9084         esac
9085         case "$dflt" in
9086         ''|' ') dflt=none ;;
9087         esac
9088         fn=dn+~
9089         rp='Pathname for the vendor-supplied html pages?'
9090         . ./getfile
9091         vendorhtml1dir="$ans"
9092         vendorhtml1direxp="$ansexp"
9093         ;;
9094 esac
9095 : Use ' ' for none so value is preserved next time through Configure
9096 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9097 : Change installation prefix, if necessary.
9098 if $test X"$prefix" != X"$installprefix"; then
9099         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9100 else
9101         installvendorhtml1dir="$vendorhtml1direxp"
9102 fi
9103
9104 case "$vendorprefix" in
9105 '')     vendorhtml3dir=''
9106         vendorhtml3direxp=''
9107         ;;
9108 *)      : determine where vendor-supplied module html pages go.
9109         : There is no standard location, so try to copy the previously-selected
9110         : directory structure for the core html pages.
9111         : XXX Better default suggestions would be welcome.
9112         case "$vendorhtml3dir" in
9113         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9114         *)      dflt=$vendorhtml3dir ;;
9115         esac
9116         case "$dflt" in
9117         ''|' ') dflt=none ;;
9118         esac
9119         fn=dn+~
9120         rp='Pathname for the vendor-supplied html pages?'
9121         . ./getfile
9122         vendorhtml3dir="$ans"
9123         vendorhtml3direxp="$ansexp"
9124         ;;
9125 esac
9126 : Use ' ' for none so value is preserved next time through Configure
9127 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9128 : Change installation prefix, if necessary.
9129 if $test X"$prefix" != X"$installprefix"; then
9130         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9131 else
9132         installvendorhtml3dir="$vendorhtml3direxp"
9133 fi
9134
9135 case "$vendorprefix" in
9136 '')     vendorman1dir=''
9137         vendorman1direxp=''
9138         ;;
9139 *)      : determine where vendor-supplied manual pages go.
9140         case "$vendorman1dir" in
9141         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9142         *)      dflt=$vendorman1dir ;;
9143         esac
9144         case "$dflt" in
9145         ''|' ') dflt=none ;;
9146         esac
9147         fn=nd~+
9148         rp='Pathname for the vendor-supplied manual section 1 pages?'
9149         . ./getfile
9150         vendorman1dir="$ans"
9151         vendorman1direxp="$ansexp"
9152         ;;
9153 esac
9154 : Use ' ' for none so value is preserved next time through Configure
9155 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9156 : Change installation prefix, if necessary.
9157 if $test X"$prefix" != X"$installprefix"; then
9158         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9159 else
9160         installvendorman1dir="$vendorman1direxp"
9161 fi
9162
9163 case "$vendorprefix" in
9164 '')     vendorman3dir=''
9165         vendorman3direxp=''
9166         ;;
9167 *)      : determine where vendor-supplied module manual pages go.
9168         case "$vendorman3dir" in
9169         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9170         *)      dflt=$vendorman3dir ;;
9171         esac
9172         case "$dflt" in
9173         ''|' ') dflt=none ;;
9174         esac
9175         fn=nd~+
9176         rp='Pathname for the vendor-supplied manual section 3 pages?'
9177         . ./getfile
9178         vendorman3dir="$ans"
9179         vendorman3direxp="$ansexp"
9180         ;;
9181 esac
9182 : Use ' ' for none so value is preserved next time through Configure
9183 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9184 : Change installation prefix, if necessary.
9185 if $test X"$prefix" != X"$installprefix"; then
9186         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9187 else
9188         installvendorman3dir="$vendorman3direxp"
9189 fi
9190
9191 case "$vendorprefix" in
9192 '')     d_vendorscript="$undef"
9193         vendorscript=''
9194         vendorscriptexp=''
9195         ;;
9196 *)      d_vendorscript="$define"
9197         : determine where vendor-supplied scripts go.
9198         case "$vendorscript" in
9199         '')     dflt=$vendorprefix/script
9200                 $test -d $dflt || dflt=$vendorbin ;;
9201         *)  dflt="$vendorscript" ;;
9202         esac
9203         $cat <<EOM
9204
9205 The installation process will create a directory for 
9206 vendor-supplied scripts.
9207
9208 EOM
9209         fn=d~+
9210         rp='Pathname for the vendor-supplied scripts directory?'
9211         . ./getfile
9212         vendorscript="$ans"
9213         vendorscriptexp="$ansexp"
9214         ;;
9215 esac
9216 : Change installation prefix, if necessary.
9217 if $test X"$prefix" != X"$installprefix"; then
9218         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9219 else
9220         installvendorscript="$vendorscriptexp"
9221 fi
9222
9223 : see if qgcvt exists
9224 set qgcvt d_qgcvt
9225 eval $inlibc
9226
9227 echo " "
9228
9229 if $test X"$d_longdbl" = X"$define"; then
9230
9231 echo "Checking how to print long doubles..." >&4
9232
9233 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9234         $cat >try.c <<'EOCP'
9235 #include <sys/types.h>
9236 #include <stdio.h>
9237 int main() {
9238   double d = 123.456;
9239   printf("%.3f\n", d);
9240 }
9241 EOCP
9242         set try
9243         if eval $compile; then
9244                 yyy=`$run ./try`
9245                 case "$yyy" in
9246                 123.456)
9247                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9248                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9249                         echo "We will use %f."
9250                         ;;
9251                 esac
9252         fi
9253 fi
9254
9255 if $test X"$sPRIfldbl" = X; then
9256         $cat >try.c <<'EOCP'
9257 #include <sys/types.h>
9258 #include <stdio.h>
9259 int main() {
9260   long double d = 123.456;
9261   printf("%.3Lf\n", d);
9262 }
9263 EOCP
9264         set try
9265         if eval $compile; then
9266                 yyy=`$run ./try`
9267                 case "$yyy" in
9268                 123.456)
9269                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9270                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9271                         echo "We will use %Lf."
9272                         ;;
9273                 esac
9274         fi
9275 fi
9276
9277 if $test X"$sPRIfldbl" = X; then
9278         $cat >try.c <<'EOCP'
9279 #include <sys/types.h>
9280 #include <stdio.h>
9281 int main() {
9282   long double d = 123.456;
9283   printf("%.3llf\n", d);
9284 }
9285 EOCP
9286         set try
9287         if eval $compile; then
9288                 yyy=`$run ./try`
9289                 case "$yyy" in
9290                 123.456)
9291                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9292                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9293                         echo "We will use %llf."
9294                         ;;
9295                 esac
9296         fi
9297 fi
9298
9299 if $test X"$sPRIfldbl" = X; then
9300         $cat >try.c <<'EOCP'
9301 #include <sys/types.h>
9302 #include <stdio.h>
9303 int main() {
9304   long double d = 123.456;
9305   printf("%.3lf\n", d);
9306 }
9307 EOCP
9308         set try
9309         if eval $compile; then
9310                 yyy=`$run ./try`
9311                 case "$yyy" in
9312                 123.456)
9313                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9314                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9315                         echo "We will use %lf."
9316                         ;;
9317                 esac
9318         fi
9319 fi
9320
9321 if $test X"$sPRIfldbl" = X; then
9322         echo "Cannot figure out how to print long doubles." >&4
9323 else
9324         sSCNfldbl=$sPRIfldbl    # expect consistency
9325 fi
9326
9327 $rm -f try try.*
9328
9329 fi # d_longdbl
9330
9331 case "$sPRIfldbl" in
9332 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9333         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9334         d_SCNfldbl="$undef";
9335         ;;
9336 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9337         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9338         d_SCNfldbl="$define";
9339         ;;
9340 esac
9341
9342 : Check how to convert floats to strings.
9343
9344 if test "X$d_Gconvert" = X; then
9345
9346 echo " "
9347 echo "Checking for an efficient way to convert floats to strings."
9348 echo " " > try.c
9349 case "$uselongdouble" in
9350 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9351 esac
9352 case "$d_longdbl" in
9353 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9354 esac
9355 case "$d_PRIgldbl" in
9356 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9357 esac
9358 $cat >>try.c <<EOP
9359 #ifdef TRY_gconvert
9360 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9361 char *myname = "gconvert";
9362 #endif
9363 #ifdef TRY_gcvt
9364 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9365 char *myname = "gcvt";
9366 #endif
9367 #ifdef TRY_qgcvt
9368 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9369 char *myname = "qgcvt";
9370 #define DOUBLETYPE long double
9371 #endif
9372 #ifdef TRY_sprintf
9373 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9374 #ifdef HAS_PRIgldbl
9375 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9376 #else
9377 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9378 #endif
9379 #else
9380 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9381 #endif
9382 char *myname = "sprintf";
9383 #endif
9384
9385 #ifndef DOUBLETYPE
9386 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9387 #define DOUBLETYPE long double
9388 #else
9389 #define DOUBLETYPE double
9390 #endif
9391 #endif
9392
9393 #include <stdio.h>
9394
9395 #define I_STDLIB $i_stdlib
9396 #ifdef I_STDLIB
9397 #include <stdlib.h>
9398 #endif
9399
9400 int
9401 checkit(expect, got)
9402 char *expect;
9403 char *got;
9404 {
9405     if (strcmp(expect, got)) {
9406                 printf("%s oddity:  Expected %s, got %s\n",
9407                         myname, expect, got);
9408                 exit(1);
9409         }
9410 }
9411
9412 int main()
9413
9414         char buf[64]; 
9415         buf[63] = '\0';
9416
9417         /* This must be 1st test on (which?) platform */
9418         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9419         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9420         checkit("0.1", buf);
9421
9422         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9423         checkit("0.01", buf);
9424
9425         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9426         checkit("0.001", buf);
9427
9428         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9429         checkit("0.0001", buf);
9430
9431         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9432         if (strlen(buf) > 5)
9433             checkit("9e-005", buf); /* for Microsoft ?? */
9434         else
9435             checkit("9e-05", buf);
9436
9437         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9438         checkit("1", buf);
9439
9440         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9441         checkit("1.1", buf);
9442
9443         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9444         checkit("1.01", buf);
9445
9446         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9447         checkit("1.001", buf);
9448
9449         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9450         checkit("1.0001", buf);
9451
9452         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9453         checkit("1.00001", buf);
9454
9455         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9456         checkit("1.000001", buf);
9457
9458         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9459         checkit("0", buf);
9460
9461         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9462         checkit("-1", buf);
9463
9464         /* Some Linux gcvt's give 1.e+5 here. */
9465         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9466         checkit("100000", buf);
9467         
9468         /* Some Linux gcvt's give -1.e+5 here. */
9469         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9470         checkit("-100000", buf);
9471
9472         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9473         checkit("123.456", buf);
9474
9475         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9476         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9477         /* 34 should be enough to scare even long double
9478          * places into using the e notation. */
9479         if (strlen(buf) > 5)
9480             checkit("1e+034", buf); /* for Microsoft */
9481         else
9482             checkit("1e+34", buf);
9483
9484         /* For Perl, if you add additional tests here, also add them to
9485          * t/base/num.t for benefit of platforms not using Configure or
9486          * overriding d_Gconvert */
9487
9488         exit(0);
9489 }
9490 EOP
9491 : first add preferred functions to our list
9492 xxx_list=""
9493 for xxx_convert in $gconvert_preference; do
9494     case $xxx_convert in
9495     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9496     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9497     esac 
9498 done
9499 : then add any others
9500 for xxx_convert in gconvert gcvt sprintf; do
9501     case "$xxx_list" in
9502     *$xxx_convert*) ;;
9503     *) xxx_list="$xxx_list $xxx_convert" ;;
9504     esac 
9505 done
9506
9507 case "$d_longdbl$uselongdouble" in
9508 "$define$define")
9509     : again, add prefered functions to our list first
9510     xxx_ld_list=""
9511     for xxx_convert in $gconvert_ld_preference; do
9512         case $xxx_convert in
9513         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9514         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9515         esac
9516     done
9517     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9518     for xxx_convert in qgcvt sprintf $xxx_list; do
9519         case "$xxx_ld_list" in
9520         $xxx_convert*|*" $xxx_convert"*) ;;
9521         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9522         esac
9523     done
9524     : if sprintf cannot do long doubles, move it to the end
9525     if test "$d_PRIgldbl" != "$define"; then
9526         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9527     fi
9528     : if no qgcvt, remove it
9529     if test "$d_qgcvt" != "$define"; then
9530         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9531     fi
9532     : use the ld_list
9533     xxx_list="$xxx_ld_list"
9534     ;;
9535 esac
9536
9537 for xxx_convert in $xxx_list; do
9538         echo "Trying $xxx_convert..."
9539         $rm -f try try$_o
9540         set try -DTRY_$xxx_convert
9541         if eval $compile; then
9542                 echo "$xxx_convert() found." >&4
9543                 if $run ./try; then
9544                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9545                         break;
9546                 else
9547                         echo "...But $xxx_convert didn't work as I expected."
9548                         xxx_convert=''
9549                 fi
9550         else
9551                 echo "$xxx_convert NOT found." >&4
9552         fi
9553 done
9554
9555 if test X$xxx_convert = X; then
9556     echo "*** WHOA THERE!!! ***" >&4
9557     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9558     xxx_convert=sprintf
9559 fi
9560
9561 case "$xxx_convert" in
9562 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9563 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9564 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9565 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9566    "$define$define$define")
9567       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9568    "$define$define$undef")
9569       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9570    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9571    esac
9572    ;;  
9573 esac
9574
9575 fi
9576
9577 : see if _fwalk exists
9578 set fwalk d__fwalk
9579 eval $inlibc
9580
9581 : Initialize h_fcntl
9582 h_fcntl=false
9583
9584 : Initialize h_sysfile
9585 h_sysfile=false
9586
9587 : access call always available on UNIX
9588 set access d_access
9589 eval $inlibc
9590
9591 : locate the flags for 'access()'
9592 case "$d_access" in
9593 "$define")
9594         echo " "
9595         $cat >access.c <<EOCP
9596 #include <sys/types.h>
9597 #ifdef I_FCNTL
9598 #include <fcntl.h>
9599 #endif
9600 #ifdef I_SYS_FILE
9601 #include <sys/file.h>
9602 #endif
9603 #ifdef I_UNISTD
9604 #include <unistd.h>
9605 #endif
9606 #$i_stdlib I_STDLIB
9607 #ifdef I_STDLIB
9608 #include <stdlib.h>
9609 #endif
9610 int main() {
9611         exit(R_OK);
9612 }
9613 EOCP
9614         : check sys/file.h first, no particular reason here
9615         if $test `./findhdr sys/file.h` && \
9616                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9617                 h_sysfile=true;
9618                 echo "<sys/file.h> defines the *_OK access constants." >&4
9619         elif $test `./findhdr fcntl.h` && \
9620                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9621                 h_fcntl=true;
9622                 echo "<fcntl.h> defines the *_OK access constants." >&4
9623         elif $test `./findhdr unistd.h` && \
9624                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9625                 echo "<unistd.h> defines the *_OK access constants." >&4
9626         else
9627                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9628         fi
9629         ;;
9630 esac
9631 $rm -f access*
9632
9633 : see if accessx exists
9634 set accessx d_accessx
9635 eval $inlibc
9636
9637 : see if aintl exists
9638 set aintl d_aintl
9639 eval $inlibc
9640
9641 : see if alarm exists
9642 set alarm d_alarm
9643 eval $inlibc
9644
9645 : see if POSIX threads are available
9646 set pthread.h i_pthread
9647 eval $inhdr
9648
9649 : define a fucntion to check prototypes
9650 $cat > protochk <<EOSH
9651 $startsh
9652 cc="$cc"
9653 optimize="$optimize"
9654 ccflags="$ccflags"
9655 prototype="$prototype"
9656 define="$define"
9657 rm=$rm
9658 usethreads=$usethreads
9659 i_pthread=$i_pthread
9660 pthread_h_first=$pthread_h_first
9661 EOSH
9662
9663 $cat >> protochk <<'EOSH'
9664
9665 $rm -f try.c
9666 foo="$1"
9667 shift
9668 while test $# -ge 2; do
9669         case "$1" in
9670                 $define) echo "#include <$2>" >> try.c ;;
9671                 literal) echo "$2" >> try.c ;;
9672         esac
9673     # Extra magic for the benefit of systems that need pthread.h
9674     # to be included early to correctly detect threadsafe functions.
9675     # Such functions must guarantee themselves, though, that the usethreads
9676     # and i_pthread have been defined, before calling protochk.
9677     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9678         echo "#include <pthread.h>" >> try.c
9679         pthread_h_done=yes
9680     fi
9681     shift 2
9682 done
9683 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9684 cat >> try.c <<'EOCP'
9685 #ifdef CAN_PROTOTYPE
9686 #define _(args) args
9687 #else
9688 #define _(args) ()
9689 #endif
9690 EOCP
9691 echo "$foo" >> try.c
9692 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9693 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9694 status=$?
9695 $rm -f try.[co]
9696 exit $status
9697 EOSH
9698 chmod +x protochk
9699 $eunicefix protochk
9700
9701 hasproto='varname=$1; func=$2; 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 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9709 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9710         echo "$func() prototype found.";
9711         val="$define";
9712 else
9713         echo "$func() prototype NOT found.";
9714         val="$undef";
9715 fi;
9716 set $varname;
9717 eval $setvar;
9718 $rm -f try.c tryout.c'
9719
9720 : see if sys/types.h has to be included
9721 set sys/types.h i_systypes
9722 eval $inhdr
9723
9724 : see if sys/select.h has to be included
9725 set sys/select.h i_sysselct
9726 eval $inhdr
9727
9728 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9729 while $test $# -ge 2; do
9730         case "$1" in
9731         $define) echo "#include <$2>";;
9732         esac ;
9733     shift 2;
9734 done > try.c;
9735 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9736 set try;
9737 if eval $compile; then
9738         val="$define";
9739 else
9740         val="$undef";
9741 fi;
9742 set $varname;
9743 eval $setvar;
9744 $rm -f try.c try.o'
9745
9746 : see if we should include time.h, sys/time.h, or both
9747 echo " "
9748 if test "X$timeincl" = X; then
9749         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9750         $echo $n "I'm now running the test program...$c"
9751         $cat >try.c <<EOCP
9752 #include <sys/types.h>
9753 #ifdef I_TIME
9754 #include <time.h>
9755 #endif
9756 #ifdef I_SYSTIME
9757 #ifdef SYSTIMEKERNEL
9758 #define KERNEL
9759 #endif
9760 #include <sys/time.h>
9761 #endif
9762 #ifdef I_SYSSELECT
9763 #include <sys/select.h>
9764 #endif
9765 #$i_stdlib I_STDLIB
9766 #ifdef I_STDLIB
9767 #include <stdlib.h>
9768 #endif
9769 int main()
9770 {
9771         struct tm foo;
9772 #ifdef S_TIMEVAL
9773         struct timeval bar;
9774 #endif
9775 #ifdef S_TIMEZONE
9776         struct timezone tzp;
9777 #endif
9778         if (foo.tm_sec == foo.tm_sec)
9779                 exit(0);
9780 #ifdef S_TIMEVAL
9781         if (bar.tv_sec == bar.tv_sec)
9782                 exit(0);
9783 #endif
9784         exit(1);
9785 }
9786 EOCP
9787         flags=''
9788         for s_timezone in '-DS_TIMEZONE' ''; do
9789         sysselect=''
9790         for s_timeval in '-DS_TIMEVAL' ''; do
9791         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9792         for i_time in '' '-DI_TIME'; do
9793         for i_systime in '-DI_SYSTIME' ''; do
9794                 case "$flags" in
9795                 '') $echo $n ".$c"
9796                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9797                         if eval $compile; then
9798                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9799                                 shift
9800                                 flags="$*"
9801                                 echo " "
9802                                 $echo $n "Succeeded with $flags$c"
9803                         fi
9804                         ;;
9805                 esac
9806         done
9807         done
9808         done
9809         done
9810         done
9811         timeincl=''
9812         echo " "
9813         case "$flags" in
9814         *SYSTIMEKERNEL*) i_systimek="$define"
9815                 timeincl=`./findhdr sys/time.h`
9816                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9817         *) i_systimek="$undef";;
9818         esac
9819         case "$flags" in
9820         *I_TIME*) i_time="$define"
9821                 timeincl=`./findhdr time.h`" $timeincl"
9822                 echo "We'll include <time.h>." >&4;;
9823         *) i_time="$undef";;
9824         esac
9825         case "$flags" in
9826         *I_SYSTIME*) i_systime="$define"
9827                 timeincl=`./findhdr sys/time.h`" $timeincl"
9828                 echo "We'll include <sys/time.h>." >&4;;
9829         *) i_systime="$undef";;
9830         esac
9831         $rm -f try.c try
9832 fi
9833 : see if struct tm knows about tm_zone
9834 case "$i_systime$i_time" in
9835 *$define*) 
9836         echo " "
9837         echo "Checking to see if your struct tm has tm_zone field..." >&4
9838         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9839         eval $hasfield
9840         ;;
9841 *)      val="$undef"
9842         set d_tm_tm_zone
9843         eval $setvar
9844         ;;
9845 esac
9846 case "$d_tm_tm_zone" in
9847 "$define")      echo "Yes, it does."   ;;
9848 *)              echo "No, it doesn't." ;;
9849 esac
9850 : see if struct tm knows about tm_gmtoff
9851 case "$i_systime$i_time" in
9852 *$define*) 
9853         echo " "
9854         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9855         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9856         eval $hasfield
9857         ;;
9858 *)      val="$undef"
9859         set d_tm_tm_gmtoff
9860         eval $setvar
9861         ;;
9862 esac
9863 case "$d_tm_tm_gmtoff" in
9864 "$define")      echo "Yes, it does."   ;;
9865 *)              echo "No, it doesn't." ;;
9866 esac
9867
9868 : see if asctime_r exists
9869 set asctime_r d_asctime_r
9870 eval $inlibc
9871 case "$d_asctime_r" in
9872 "$define")
9873         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9874         case "$d_asctime_r_proto:$usethreads" in
9875         ":define")      d_asctime_r_proto=define
9876                 set d_asctime_r_proto asctime_r $hdrs
9877                 eval $hasproto ;;
9878         *)      ;;
9879         esac
9880         case "$d_asctime_r_proto" in
9881         define)
9882         case "$asctime_r_proto" in
9883         ''|0) try='char* asctime_r(const struct tm*, char*);'
9884         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9885         esac
9886         case "$asctime_r_proto" in
9887         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9888         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9889         esac
9890         case "$asctime_r_proto" in
9891         ''|0) try='int asctime_r(const struct tm*, char*);'
9892         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9893         esac
9894         case "$asctime_r_proto" in
9895         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9896         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9897         esac
9898         case "$asctime_r_proto" in
9899         ''|0)   d_asctime_r=undef
9900                 asctime_r_proto=0
9901                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9902         * )     case "$asctime_r_proto" in
9903                 REENTRANT_PROTO*) ;;
9904                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9905                 esac
9906                 echo "Prototype: $try" ;;
9907         esac
9908         ;;
9909         *)      case "$usethreads" in
9910                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9911                 esac
9912                 d_asctime_r=undef
9913                 asctime_r_proto=0
9914                 ;;
9915         esac
9916         ;;
9917 *)      asctime_r_proto=0
9918         ;;
9919 esac
9920
9921 : see if atolf exists
9922 set atolf d_atolf
9923 eval $inlibc
9924
9925 : see if atoll exists
9926 set atoll d_atoll
9927 eval $inlibc
9928
9929 : Look for GCC-style attribute format
9930 case "$d_attribute_format" in
9931 '')
9932 echo " "
9933 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9934 $cat >attrib.c <<'EOCP'
9935 #include <stdio.h>
9936 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9937 EOCP
9938 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9939         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9940                 echo "Your C compiler doesn't support __attribute__((format))."
9941                 val="$undef"
9942         else
9943                 echo "Your C compiler supports __attribute__((format))."
9944                 val="$define"
9945         fi
9946 else
9947         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9948         val="$undef"
9949 fi
9950 ;;
9951 *) val="$d_attribute_format" ;;
9952 esac
9953 set d_attribute_format
9954 eval $setvar
9955 $rm -f attrib*
9956
9957 : Look for GCC-style attribute malloc
9958 case "$d_attribute_malloc" in
9959 '')
9960 echo " "
9961 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9962 $cat >attrib.c <<'EOCP'
9963 #include <stdio.h>
9964 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9965 EOCP
9966 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9967         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9968                 echo "Your C compiler doesn't support __attribute__((malloc))."
9969                 val="$undef"
9970         else
9971                 echo "Your C compiler supports __attribute__((malloc))."
9972                 val="$define"
9973         fi
9974 else
9975         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9976         val="$undef"
9977 fi
9978 ;;
9979 *) val="$d_attribute_malloc" ;;
9980 esac
9981 set d_attribute_malloc
9982 eval $setvar
9983 $rm -f attrib*
9984
9985 : Look for GCC-style attribute nonnull
9986 case "$d_attribute_nonnull" in
9987 '')
9988 echo " "
9989 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9990 $cat >attrib.c <<'EOCP'
9991 #include <stdio.h>
9992 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9993 EOCP
9994 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9995         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9996                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9997                 val="$undef"
9998         else
9999                 echo "Your C compiler supports __attribute__((nonnull))."
10000                 val="$define"
10001         fi
10002 else
10003         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10004         val="$undef"
10005 fi
10006 ;;
10007 *) val="$d_attribute_nonnull" ;;
10008 esac
10009 set d_attribute_nonnull
10010 eval $setvar
10011 $rm -f attrib*
10012
10013 : Look for GCC-style attribute noreturn
10014 case "$d_attribute_noreturn" in
10015 '')
10016 echo " "
10017 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10018 $cat >attrib.c <<'EOCP'
10019 #include <stdio.h>
10020 void fall_over_dead( void ) __attribute__((noreturn));
10021 EOCP
10022 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10023         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10024                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10025                 val="$undef"
10026         else
10027                 echo "Your C compiler supports __attribute__((noreturn))."
10028                 val="$define"
10029         fi
10030 else
10031         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10032         val="$undef"
10033 fi
10034 ;;
10035 *) val="$d_attribute_noreturn" ;;
10036 esac
10037 set d_attribute_noreturn
10038 eval $setvar
10039 $rm -f attrib*
10040
10041 : Look for GCC-style attribute pure
10042 case "$d_attribute_pure" in
10043 '')
10044 echo " "
10045 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10046 $cat >attrib.c <<'EOCP'
10047 #include <stdio.h>
10048 int square( int n ) __attribute__((pure));
10049 EOCP
10050 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10051         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10052                 echo "Your C compiler doesn't support __attribute__((pure))."
10053                 val="$undef"
10054         else
10055                 echo "Your C compiler supports __attribute__((pure))."
10056                 val="$define"
10057         fi
10058 else
10059         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10060         val="$undef"
10061 fi
10062 ;;
10063 *) val="$d_attribute_pure" ;;
10064 esac
10065 set d_attribute_pure
10066 eval $setvar
10067 $rm -f attrib*
10068
10069 : Look for GCC-style attribute unused
10070 case "$d_attribute_unused" in
10071 '')
10072 echo " "
10073 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10074 $cat >attrib.c <<'EOCP'
10075 #include <stdio.h>
10076 int do_something( int dummy __attribute__((unused)), int n );
10077 EOCP
10078 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10079         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10080                 echo "Your C compiler doesn't support __attribute__((unused))."
10081                 val="$undef"
10082         else
10083                 echo "Your C compiler supports __attribute__((unused))."
10084                 val="$define"
10085         fi
10086 else
10087         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10088         val="$undef"
10089 fi
10090 ;;
10091 *) val="$d_attribute_unused" ;;
10092 esac
10093 set d_attribute_unused
10094 eval $setvar
10095 $rm -f attrib*
10096
10097 : Look for GCC-style attribute warn_unused_result
10098 case "$d_attribute_warn_unused_result" in
10099 '')
10100 echo " "
10101 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10102 $cat >attrib.c <<'EOCP'
10103 #include <stdio.h>
10104 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10105 EOCP
10106 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10107         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10108                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10109                 val="$undef"
10110         else
10111                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10112                 val="$define"
10113         fi
10114 else
10115         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10116         val="$undef"
10117 fi
10118 ;;
10119 *) val="$d_attribute_warn_unused_result" ;;
10120 esac
10121 set d_attribute_warn_unused_result
10122 eval $setvar
10123 $rm -f attrib*
10124
10125 : see if bcmp exists
10126 set bcmp d_bcmp
10127 eval $inlibc
10128
10129 : see if bcopy exists
10130 set bcopy d_bcopy
10131 eval $inlibc
10132
10133 : see if this is a unistd.h system
10134 set unistd.h i_unistd
10135 eval $inhdr
10136
10137 : see if getpgrp exists
10138 set getpgrp d_getpgrp
10139 eval $inlibc
10140
10141 case "$d_getpgrp" in
10142 "$define")
10143         echo " "
10144         echo "Checking to see which flavor of getpgrp is in use..."
10145         $cat >try.c <<EOP
10146 #$i_unistd I_UNISTD
10147 #include <sys/types.h>
10148 #ifdef I_UNISTD
10149 #  include <unistd.h>
10150 #endif
10151 #$i_stdlib I_STDLIB
10152 #ifdef I_STDLIB
10153 #include <stdlib.h>
10154 #endif
10155 int main()
10156 {
10157         if (getuid() == 0) {
10158                 printf("(I see you are running Configure as super-user...)\n");
10159                 setuid(1);
10160         }
10161 #ifdef TRY_BSD_PGRP
10162         if (getpgrp(1) == 0)
10163                 exit(0);
10164 #else
10165         if (getpgrp() > 0)
10166                 exit(0);
10167 #endif
10168         exit(1);
10169 }
10170 EOP
10171         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10172                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10173                 val="$define"
10174         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10175                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10176                 val="$undef"
10177         else
10178                 echo "I can't seem to compile and run the test program."
10179                 if ./usg; then
10180                         xxx="a USG one, i.e. you use getpgrp()."
10181                 else
10182                         # SVR4 systems can appear rather BSD-ish.
10183                         case "$i_unistd" in
10184                         $undef)
10185                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10186                                 val="$define"
10187                                 ;;
10188                         $define)
10189                                 xxx="probably a USG one, i.e. you use getpgrp()."
10190                                 val="$undef"
10191                                 ;;
10192                         esac
10193                 fi
10194                 echo "Assuming your getpgrp is $xxx" >&4
10195         fi
10196         ;;
10197 *) val="$undef";;
10198 esac
10199 set d_bsdgetpgrp
10200 eval $setvar
10201 $rm -f try try.*
10202
10203 : see if setpgrp exists
10204 set setpgrp d_setpgrp
10205 eval $inlibc
10206
10207 case "$d_setpgrp" in
10208 "$define")
10209         echo " "
10210         echo "Checking to see which flavor of setpgrp is in use..."
10211         $cat >try.c <<EOP
10212 #$i_unistd I_UNISTD
10213 #include <sys/types.h>
10214 #ifdef I_UNISTD
10215 #  include <unistd.h>
10216 #endif
10217 #$i_stdlib I_STDLIB
10218 #ifdef I_STDLIB
10219 #include <stdlib.h>
10220 #endif
10221 int main()
10222 {
10223         if (getuid() == 0) {
10224                 printf("(I see you are running Configure as super-user...)\n");
10225                 setuid(1);
10226         }
10227 #ifdef TRY_BSD_PGRP
10228         if (-1 == setpgrp(1, 1))
10229                 exit(0);
10230 #else
10231         if (setpgrp() != -1)
10232                 exit(0);
10233 #endif
10234         exit(1);
10235 }
10236 EOP
10237         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10238                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10239                 val="$define"
10240         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10241                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10242                 val="$undef"
10243         else
10244                 echo "(I can't seem to compile and run the test program.)"
10245                 if ./usg; then
10246                         xxx="a USG one, i.e. you use setpgrp()."
10247                 else
10248                         # SVR4 systems can appear rather BSD-ish.
10249                         case "$i_unistd" in
10250                         $undef)
10251                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10252                                 val="$define"
10253                                 ;;
10254                         $define)
10255                                 xxx="probably a USG one, i.e. you use setpgrp()."
10256                                 val="$undef"
10257                                 ;;
10258                         esac
10259                 fi
10260                 echo "Assuming your setpgrp is $xxx" >&4
10261         fi
10262         ;;
10263 *) val="$undef";;
10264 esac
10265 set d_bsdsetpgrp
10266 eval $setvar
10267 $rm -f try try.*
10268 : Look for GCC-style __builtin_choose_expr
10269 case "$d_builtin_choose_expr" in
10270 '')
10271     echo " "
10272     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10273     $cat >try.c <<'EOCP'
10274 #include <assert.h>
10275 #include <stdlib.h>
10276 #include <stdio.h>
10277
10278 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10279
10280 int main(void) {
10281     assert( SYRINX(1) == 2112 );
10282     assert( SYRINX(1) != 5150 );
10283     assert( SYRINX(0) == 5150 );
10284     assert( SYRINX(0) != 2112 );
10285     puts( "All good!" );
10286     exit(0);
10287 }
10288
10289 EOCP
10290     set try
10291     if eval $compile; then
10292         echo "Your C compiler supports __builtin_choose_expr."
10293         val="$define"
10294     else
10295         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10296         val="$undef"
10297     fi
10298 ;;
10299 *) val="$d_builtin_choose_expr" ;;
10300 esac
10301
10302 set d_builtin_choose_expr
10303 eval $setvar
10304 $rm -f try.* try core core.try.*
10305
10306 : Look for GCC-style __builtin_expect
10307 case "$d_builtin_expect" in
10308 '')
10309     echo " "
10310     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10311     $cat >builtin.c <<'EOCP'
10312 int main(void) {
10313     int n = 50;
10314     if ( __builtin_expect(n, 0) ) n = 1;
10315 }
10316 EOCP
10317     set try
10318     if eval $compile; then
10319         echo "Your C compiler supports __builtin_choose_expr."
10320         val="$define"
10321     else
10322         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10323         val="$undef"
10324     fi
10325     ;;
10326 *) val="$d_builtin_expect" ;;
10327 esac
10328
10329 set d_builtin_expect
10330 eval $setvar
10331 $rm -f try.* try core core.try.*
10332
10333 : see if bzero exists
10334 set bzero d_bzero
10335 eval $inlibc
10336
10337 : see if signal is declared as pointer to function returning int or void
10338 echo " "
10339 xxx=`./findhdr signal.h`
10340 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10341 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10342         echo "You have int (*signal())() instead of void." >&4
10343         val="$undef"
10344 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10345         echo "You have void (*signal())()." >&4
10346         val="$define"
10347 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10348         echo "You have int (*signal())() instead of void." >&4
10349         val="$undef"
10350 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10351         echo "You have void (*signal())()." >&4
10352         val="$define"
10353 else
10354         case "$d_voidsig" in
10355         '')
10356         echo "I can't determine whether signal handler returns void or int..." >&4
10357                 dflt=void
10358                 rp="What type does your signal handler return?"
10359                 . ./myread
10360                 case "$ans" in
10361                 v*) val="$define";;
10362                 *) val="$undef";;
10363                 esac;;
10364         "$define")
10365                 echo "As you already told me, signal handler returns void." >&4
10366                 val="$define"
10367                 ;;
10368         *)      echo "As you already told me, signal handler returns int." >&4
10369                 val="$undef"
10370                 ;;
10371         esac
10372 fi
10373 set d_voidsig
10374 eval $setvar
10375 case "$d_voidsig" in
10376 "$define") signal_t="void";;
10377 *) signal_t="int";;
10378 esac
10379 $rm -f $$.tmp
10380
10381 : check for ability to cast large floats to 32-bit ints.
10382 echo " "
10383 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10384 if $test "$intsize" -ge 4; then
10385         xxx=int
10386 else
10387         xxx=long
10388 fi
10389 $cat >try.c <<EOCP
10390 #include <stdio.h>
10391 #$i_stdlib I_STDLIB
10392 #ifdef I_STDLIB
10393 #include <stdlib.h>
10394 #endif
10395 #include <sys/types.h>
10396 #include <signal.h>
10397 $signal_t blech(s) int s; { exit(3); }
10398 int main()
10399 {
10400         $xxx i32;
10401         double f, g;
10402         int result = 0;
10403         char str[16];
10404         signal(SIGFPE, blech);
10405
10406         /* Don't let compiler optimize the test away.  Store the number 
10407            in a writable string for gcc to pass to sscanf under HP/UX.
10408         */
10409         sprintf(str, "2147483647");
10410         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10411         g = 10 * f;
10412         i32  = ($xxx) g;
10413
10414         /* x86 processors will probably give 0x8000 0000, which is a
10415            sign change.  We don't want that.  We want to mimic SPARC
10416            behavior here, which is to preserve the sign and give
10417            back 0x7fff ffff.
10418         */
10419         if (i32 != ($xxx) f)
10420                 result |= 1;
10421         exit(result);
10422 }
10423 EOCP
10424 set try
10425 if eval $compile_ok; then
10426         $run ./try
10427         yyy=$?
10428 else
10429         echo "(I can't seem to compile the test program--assuming it can't)"
10430         yyy=1
10431 fi
10432 case "$yyy" in
10433 0)      val="$define"
10434         echo "Yup, it can."
10435         ;;
10436 *)      val="$undef"
10437         echo "Nope, it can't."
10438         ;;
10439 esac
10440 set d_casti32
10441 eval $setvar
10442 $rm -f try try.*
10443
10444 : check for ability to cast negative floats to unsigned
10445 echo " "
10446 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10447 $cat >try.c <<EOCP
10448 #include <stdio.h>
10449 #$i_stdlib I_STDLIB
10450 #ifdef I_STDLIB
10451 #include <stdlib.h>
10452 #endif
10453 #include <sys/types.h>
10454 #include <signal.h>
10455 $signal_t blech(s) int s; { exit(7); }
10456 $signal_t blech_in_list(s) int s; { exit(4); }
10457 unsigned long dummy_long(p) unsigned long p; { return p; }
10458 unsigned int dummy_int(p) unsigned int p; { return p; }
10459 unsigned short dummy_short(p) unsigned short p; { return p; }
10460 int main()
10461 {
10462         double f;
10463         unsigned long along;
10464         unsigned int aint;
10465         unsigned short ashort;
10466         int result = 0;
10467         char str[16];
10468         
10469         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10470            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10471            optimized the whole file away
10472         */
10473         /* Store the number in a writable string for gcc to pass to 
10474            sscanf under HP/UX.
10475         */
10476         sprintf(str, "-123");
10477         sscanf(str, "%lf", &f);  /* f = -123.; */
10478
10479         signal(SIGFPE, blech);
10480         along = (unsigned long)f;
10481         aint = (unsigned int)f;
10482         ashort = (unsigned short)f;
10483         if (along != (unsigned long)-123)
10484                 result |= 1;
10485         if (aint != (unsigned int)-123)
10486                 result |= 1;
10487         if (ashort != (unsigned short)-123)
10488                 result |= 1;
10489         sprintf(str, "1073741824.");
10490         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10491         f = f + f;
10492         along = 0;
10493         along = (unsigned long)f;
10494         if (along != 0x80000000)
10495                 result |= 2;
10496         f -= 1.;
10497         along = 0;
10498         along = (unsigned long)f;
10499         if (along != 0x7fffffff)
10500                 result |= 1;
10501         f += 2.;
10502         along = 0;
10503         along = (unsigned long)f;
10504         if (along != 0x80000001)
10505                 result |= 2;
10506         if (result)
10507                 exit(result);
10508         signal(SIGFPE, blech_in_list);
10509         sprintf(str, "123.");
10510         sscanf(str, "%lf", &f);  /* f = 123.; */
10511         along = dummy_long((unsigned long)f);
10512         aint = dummy_int((unsigned int)f);
10513         ashort = dummy_short((unsigned short)f);
10514         if (along != (unsigned long)123)
10515                 result |= 4;
10516         if (aint != (unsigned int)123)
10517                 result |= 4;
10518         if (ashort != (unsigned short)123)
10519                 result |= 4;
10520         exit(result);
10521
10522 }
10523 EOCP
10524 set try
10525 if eval $compile_ok; then
10526         $run ./try
10527         castflags=$?
10528 else
10529         echo "(I can't seem to compile the test program--assuming it can't)"
10530         castflags=7
10531 fi
10532 case "$castflags" in
10533 0)      val="$define"
10534         echo "Yup, it can."
10535         ;;
10536 *)      val="$undef"
10537         echo "Nope, it can't."
10538         ;;
10539 esac
10540 set d_castneg
10541 eval $setvar
10542 $rm -f try.*
10543
10544 : see if vprintf exists
10545 echo " "
10546 if set vprintf val -f d_vprintf; eval $csym; $val; then
10547         echo 'vprintf() found.' >&4
10548         val="$define"
10549         $cat >try.c <<EOF
10550 #include <varargs.h>
10551 #$i_stdlib I_STDLIB
10552 #ifdef I_STDLIB
10553 #include <stdlib.h>
10554 #endif
10555
10556 int main() { xxx("foo"); }
10557
10558 xxx(va_alist)
10559 va_dcl
10560 {
10561         va_list args;
10562         char buf[10];
10563
10564         va_start(args);
10565         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10566 }
10567 EOF
10568         set try
10569         if eval $compile && $run ./try; then
10570                 echo "Your vsprintf() returns (int)." >&4
10571                 val2="$undef"
10572         else
10573                 echo "Your vsprintf() returns (char*)." >&4
10574                 val2="$define"
10575         fi
10576 else
10577         echo 'vprintf() NOT found.' >&4
10578                 val="$undef"
10579                 val2="$undef"
10580 fi
10581 $rm -f try try.*
10582 set d_vprintf
10583 eval $setvar
10584 val=$val2
10585 set d_charvspr
10586 eval $setvar
10587
10588 : see if chown exists
10589 set chown d_chown
10590 eval $inlibc
10591
10592 : see if chroot exists
10593 set chroot d_chroot
10594 eval $inlibc
10595
10596 : see if chsize exists
10597 set chsize d_chsize
10598 eval $inlibc
10599
10600 : see if class exists
10601 set class d_class
10602 eval $inlibc
10603
10604 : see if clearenv exists
10605 set clearenv d_clearenv
10606 eval $inlibc
10607
10608 hasstruct='varname=$1; struct=$2; shift; shift;
10609 while $test $# -ge 2; do
10610         case "$1" in
10611         $define) echo "#include <$2>";;
10612         esac ;
10613     shift 2;
10614 done > try.c;
10615 echo "int main () { struct $struct foo; }" >> try.c;
10616 set try;
10617 if eval $compile; then
10618         val="$define";
10619 else
10620         val="$undef";
10621 fi;
10622 set $varname;
10623 eval $setvar;
10624 $rm -f try.c try.o'
10625
10626 socketlib=''
10627 sockethdr=''
10628 : see whether socket exists
10629 echo " "
10630 $echo $n "Hmm... $c" >&4
10631 if set socket val -f d_socket; eval $csym; $val; then
10632         echo "Looks like you have Berkeley networking support." >&4
10633         d_socket="$define"
10634         if set setsockopt val -f; eval $csym; $val; then
10635                 d_oldsock="$undef"
10636         else
10637                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10638                 d_oldsock="$define"
10639         fi
10640 else
10641         if $contains socklib libc.list >/dev/null 2>&1; then
10642                 echo "Looks like you have Berkeley networking support." >&4
10643                 d_socket="$define"
10644                 : we will have to assume that it supports the 4.2 BSD interface
10645                 d_oldsock="$undef"
10646         else
10647                 echo "You don't have Berkeley networking in libc$_a..." >&4
10648                 if test "X$d_socket" = "X$define"; then
10649                    echo "...but you seem to believe that you have sockets." >&4
10650                 else
10651                         for net in net socket
10652                         do
10653                                 if test -f /usr/lib/lib$net$_a; then
10654                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10655                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10656                                         if $contains socket libc.list >/dev/null 2>&1; then
10657                                                 d_socket="$define"
10658                                                 socketlib="-l$net"
10659                                                 case "$net" in
10660                                                 net)
10661                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10662                                                         sockethdr="-I/usr/netinclude"
10663                                                         ;;
10664                                                 esac
10665                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10666                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10667                                                         d_oldsock="$undef"
10668                                                 else
10669                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10670                                                         d_oldsock="$define"
10671                                                 fi
10672                                                 break
10673                                         fi
10674                                 fi
10675                         done
10676                         if test "X$d_socket" != "X$define"; then
10677                            echo "or anywhere else I see." >&4
10678                            d_socket="$undef"
10679                            d_oldsock="$undef"
10680                         fi
10681                 fi
10682         fi
10683 fi
10684
10685 : see if socketpair exists
10686 set socketpair d_sockpair
10687 eval $inlibc
10688
10689
10690 echo " "
10691 echo "Checking the availability of certain socket constants..." >&4
10692 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10693         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10694         $cat >try.c <<EOF
10695 #include <sys/types.h>
10696 #include <sys/socket.h>
10697 int main() {
10698     int i = $ENUM;
10699 }
10700 EOF
10701         val="$undef"
10702         set try; if eval $compile; then
10703                 val="$define"
10704         fi
10705         set d_${enum}; eval $setvar
10706         $rm -f try.c try
10707 done
10708
10709 : see if this is a sys/uio.h system
10710 set sys/uio.h i_sysuio
10711 eval $inhdr
10712
10713
10714 echo " "
10715 echo "Checking to see if your system supports struct cmsghdr..." >&4
10716 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10717 eval $hasstruct
10718 case "$d_cmsghdr_s" in
10719 "$define")      echo "Yes, it does."   ;;
10720 *)              echo "No, it doesn't." ;;
10721 esac
10722
10723
10724 : check for const keyword
10725 echo " "
10726 echo 'Checking to see if your C compiler knows about "const"...' >&4
10727 $cat >const.c <<'EOCP'
10728 typedef struct spug { int drokk; } spug;
10729 int main()
10730 {
10731         const char *foo;
10732         const spug y;
10733 }
10734 EOCP
10735 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10736         val="$define"
10737         echo "Yup, it does."
10738 else
10739         val="$undef"
10740         echo "Nope, it doesn't."
10741 fi
10742 set d_const
10743 eval $setvar
10744
10745 : see if copysignl exists
10746 set copysignl d_copysignl
10747 eval $inlibc
10748
10749 : see if crypt exists
10750 echo " "
10751 set crypt d_crypt
10752 eval $inlibc
10753 case "$d_crypt" in
10754 $define) cryptlib='' ;;
10755 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10756                 echo 'crypt() found.' >&4
10757                 val="$define"
10758                 cryptlib=''
10759         else
10760                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10761                 if $test -z "$cryptlib"; then
10762                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10763                 else
10764                         cryptlib=-lcrypt
10765                 fi
10766                 if $test -z "$cryptlib"; then
10767                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10768                 else
10769                         cryptlib=-lcrypt
10770                 fi
10771                 if $test -z "$cryptlib"; then
10772                         cryptlib=`./loc libcrypt$_a "" $libpth`
10773                 else
10774                         cryptlib=-lcrypt
10775                 fi
10776                 if $test -z "$cryptlib"; then
10777                         echo 'crypt() NOT found.' >&4
10778                         val="$undef"
10779                 else
10780                         val="$define"
10781                 fi
10782         fi
10783         set d_crypt
10784         eval $setvar
10785         ;;
10786 esac
10787
10788 : see if this is a crypt.h system
10789 set crypt.h i_crypt
10790 eval $inhdr
10791
10792 : see if crypt_r exists
10793 set crypt_r d_crypt_r
10794 eval $inlibc
10795 case "$d_crypt_r" in
10796 "$define")
10797         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10798         case "$d_crypt_r_proto:$usethreads" in
10799         ":define")      d_crypt_r_proto=define
10800                 set d_crypt_r_proto crypt_r $hdrs
10801                 eval $hasproto ;;
10802         *)      ;;
10803         esac
10804         case "$d_crypt_r_proto" in
10805         define)
10806         case "$crypt_r_proto" in
10807         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10808         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10809         esac
10810         case "$crypt_r_proto" in
10811         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10812         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10813         esac
10814         case "$crypt_r_proto" in
10815         ''|0)   d_crypt_r=undef
10816                 crypt_r_proto=0
10817                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10818         * )     case "$crypt_r_proto" in
10819                 REENTRANT_PROTO*) ;;
10820                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10821                 esac
10822                 echo "Prototype: $try" ;;
10823         esac
10824         ;;
10825         *)      case "$usethreads" in
10826                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10827                 esac
10828                 d_crypt_r=undef
10829                 crypt_r_proto=0
10830                 ;;
10831         esac
10832         ;;
10833 *)      crypt_r_proto=0
10834         ;;
10835 esac
10836
10837 : get csh whereabouts
10838 case "$csh" in
10839 'csh') val="$undef" ;;
10840 *) val="$define" ;;
10841 esac
10842 set d_csh
10843 eval $setvar
10844 : Respect a hint or command line value for full_csh.
10845 case "$full_csh" in
10846 '') full_csh=$csh ;;
10847 esac
10848
10849 : see if ctermid_r exists
10850 set ctermid_r d_ctermid_r
10851 eval $inlibc
10852 case "$d_ctermid_r" in
10853 "$define")
10854         hdrs="$i_systypes sys/types.h define stdio.h "
10855         case "$d_ctermid_r_proto:$usethreads" in
10856         ":define")      d_ctermid_r_proto=define
10857                 set d_ctermid_r_proto ctermid_r $hdrs
10858                 eval $hasproto ;;
10859         *)      ;;
10860         esac
10861         case "$d_ctermid_r_proto" in
10862         define)
10863         case "$ctermid_r_proto" in
10864         ''|0) try='char* ctermid_r(char*);'
10865         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10866         esac
10867         case "$ctermid_r_proto" in
10868         ''|0)   d_ctermid_r=undef
10869                 ctermid_r_proto=0
10870                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10871         * )     case "$ctermid_r_proto" in
10872                 REENTRANT_PROTO*) ;;
10873                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10874                 esac
10875                 echo "Prototype: $try" ;;
10876         esac
10877         ;;
10878         *)      case "$usethreads" in
10879                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10880                 esac
10881                 d_ctermid_r=undef
10882                 ctermid_r_proto=0
10883                 ;;
10884         esac
10885         ;;
10886 *)      ctermid_r_proto=0
10887         ;;
10888 esac
10889
10890 : see if ctime_r exists
10891 set ctime_r d_ctime_r
10892 eval $inlibc
10893 case "$d_ctime_r" in
10894 "$define")
10895         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10896         case "$d_ctime_r_proto:$usethreads" in
10897         ":define")      d_ctime_r_proto=define
10898                 set d_ctime_r_proto ctime_r $hdrs
10899                 eval $hasproto ;;
10900         *)      ;;
10901         esac
10902         case "$d_ctime_r_proto" in
10903         define)
10904         case "$ctime_r_proto" in
10905         ''|0) try='char* ctime_r(const time_t*, char*);'
10906         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10907         esac
10908         case "$ctime_r_proto" in
10909         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10910         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10911         esac
10912         case "$ctime_r_proto" in
10913         ''|0) try='int ctime_r(const time_t*, char*);'
10914         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10915         esac
10916         case "$ctime_r_proto" in
10917         ''|0) try='int ctime_r(const time_t*, char*, int);'
10918         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10919         esac
10920         case "$ctime_r_proto" in
10921         ''|0)   d_ctime_r=undef
10922                 ctime_r_proto=0
10923                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10924         * )     case "$ctime_r_proto" in
10925                 REENTRANT_PROTO*) ;;
10926                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10927                 esac
10928                 echo "Prototype: $try" ;;
10929         esac
10930         ;;
10931         *)      case "$usethreads" in
10932                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10933                 esac
10934                 d_ctime_r=undef
10935                 ctime_r_proto=0
10936                 ;;
10937         esac
10938         ;;
10939 *)      ctime_r_proto=0
10940         ;;
10941 esac
10942
10943 : see if cuserid exists
10944 set cuserid d_cuserid
10945 eval $inlibc
10946
10947 : see if this is a limits.h system
10948 set limits.h i_limits
10949 eval $inhdr
10950
10951 : see if this is a float.h system
10952 set float.h i_float
10953 eval $inhdr
10954
10955 : See if number of significant digits in a double precision number is known
10956 echo " "
10957 $cat >dbl_dig.c <<EOM
10958 #$i_limits I_LIMITS
10959 #$i_float I_FLOAT
10960 #ifdef I_LIMITS
10961 #include <limits.h>
10962 #endif
10963 #ifdef I_FLOAT
10964 #include <float.h>
10965 #endif
10966 #ifdef DBL_DIG
10967 printf("Contains DBL_DIG");
10968 #endif
10969 EOM
10970 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10971 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10972         echo "DBL_DIG found." >&4
10973         val="$define"
10974 else
10975         echo "DBL_DIG NOT found." >&4
10976         val="$undef"
10977 fi
10978 $rm -f dbl_dig.?
10979 set d_dbl_dig
10980 eval $setvar
10981
10982 : see if dbm.h is available
10983 : see if dbmclose exists
10984 set dbmclose d_dbmclose
10985 eval $inlibc
10986
10987 case "$d_dbmclose" in
10988 $define)
10989         set dbm.h i_dbm
10990         eval $inhdr
10991         case "$i_dbm" in
10992         $define)
10993                 val="$undef"
10994                 set i_rpcsvcdbm
10995                 eval $setvar
10996                 ;;
10997         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10998                 eval $inhdr
10999                 ;;
11000         esac
11001         ;;
11002 *)      echo "We won't be including <dbm.h>"
11003         val="$undef"
11004         set i_dbm
11005         eval $setvar
11006         val="$undef"
11007         set i_rpcsvcdbm
11008         eval $setvar
11009         ;;
11010 esac
11011
11012 : see if prototype for dbminit is available
11013 echo " "
11014 set d_dbminitproto dbminit $i_dbm dbm.h
11015 eval $hasproto
11016
11017 : see if difftime exists
11018 set difftime d_difftime
11019 eval $inlibc
11020
11021 : see if this is a dirent system
11022 echo " "
11023 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11024         val="$define"
11025         echo "<dirent.h> found." >&4
11026 else
11027         val="$undef"
11028         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11029                 echo "<sys/dir.h> found." >&4
11030                 echo " "
11031         else
11032                 xinc=`./findhdr sys/ndir.h`
11033         fi
11034         echo "<dirent.h> NOT found." >&4
11035 fi
11036 set i_dirent
11037 eval $setvar
11038
11039 : Look for type of directory structure.
11040 echo " "
11041 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11042
11043 case "$direntrytype" in
11044 ''|' ')
11045         case "$i_dirent" in
11046         $define) guess1='struct dirent' ;;
11047         *) guess1='struct direct'  ;;
11048         esac
11049         ;;
11050 *)      guess1="$direntrytype"
11051         ;;
11052 esac
11053
11054 case "$guess1" in
11055 'struct dirent') guess2='struct direct' ;;
11056 *) guess2='struct dirent' ;;
11057 esac
11058                 
11059 if $contains "$guess1" try.c >/dev/null 2>&1; then
11060         direntrytype="$guess1"
11061         echo "Your directory entries are $direntrytype." >&4
11062 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11063         direntrytype="$guess2"
11064         echo "Your directory entries seem to be $direntrytype." >&4
11065 else
11066         echo "I don't recognize your system's directory entries." >&4
11067         rp="What type is used for directory entries on this system?"
11068         dflt="$guess1"
11069         . ./myread
11070         direntrytype="$ans"
11071 fi
11072 $rm -f try.c
11073
11074
11075 : see if the directory entry stores field length
11076 echo " "
11077 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11078 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11079         echo "Good, your directory entry keeps length information in d_namlen." >&4
11080         val="$define"
11081 else
11082         echo "Your directory entry does not know about the d_namlen field." >&4
11083         val="$undef"
11084 fi
11085 set d_dirnamlen
11086 eval $setvar
11087 $rm -f try.c
11088
11089 : see if this is an sysdir system
11090 set sys/dir.h i_sysdir
11091 eval $inhdr
11092
11093 : see if this is an sysndir system
11094 set sys/ndir.h i_sysndir
11095 eval $inhdr
11096
11097 : Look for dirfd
11098 echo " "
11099 $cat >dirfd.c <<EOM
11100 #include <stdio.h>
11101 #$i_stdlib I_STDLIB
11102 #ifdef I_STDLIB
11103 #include <stdlib.h>
11104 #endif
11105 #$i_dirent I_DIRENT             /**/
11106 #$i_sysdir I_SYS_DIR            /**/
11107 #$i_sysndir I_SYS_NDIR          /**/
11108 #$i_systypes I_SYS_TYPES        /**/
11109 #if defined(I_SYS_TYPES)
11110 #include <sys/types.h>
11111 #endif
11112 #if defined(I_DIRENT)
11113 #include <dirent.h>
11114 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11115 #include <sys/dir.h>
11116 #endif
11117 #else
11118 #ifdef I_SYS_NDIR
11119 #include <sys/ndir.h>
11120 #else
11121 #ifdef I_SYS_DIR
11122 #ifdef hp9000s500
11123 #include <ndir.h>       /* may be wrong in the future */
11124 #else
11125 #include <sys/dir.h>
11126 #endif
11127 #endif
11128 #endif
11129 #endif 
11130 int main() {
11131         DIR *dirp = opendir(".");
11132         if (dirfd(dirp) >= 0)
11133                 exit(0);
11134         else
11135                 exit(1);
11136 }
11137 EOM
11138 val=$undef
11139 set dirfd
11140 if eval $compile; then
11141         val="$define"
11142 fi
11143 case "$val" in
11144 $define)        echo "dirfd() found." >&4       ;;
11145 *)              echo "dirfd() NOT found." >&4   ;;
11146 esac
11147 set d_dirfd
11148 eval $setvar
11149 $rm -f dirfd*
11150
11151 : see if dlerror exists
11152 xxx_runnm="$runnm"
11153 runnm=false
11154 set dlerror d_dlerror
11155 eval $inlibc
11156 runnm="$xxx_runnm"
11157
11158 : see if dlfcn is available
11159 set dlfcn.h i_dlfcn
11160 eval $inhdr
11161
11162 case "$usedl" in
11163 $define|y|true)
11164         $cat << EOM
11165
11166 On a few systems, the dynamically loaded modules that perl generates and uses
11167 will need a different extension than shared libs. The default will probably
11168 be appropriate.
11169
11170 EOM
11171         case "$dlext" in
11172         '')     dflt="$so" ;;
11173         *)      dflt="$dlext" ;;
11174         esac
11175         rp='What is the extension of dynamically loaded modules'
11176         . ./myread
11177         dlext="$ans"
11178         ;;
11179 *)
11180         dlext="none"
11181         ;;
11182 esac
11183
11184 : Check if dlsym need a leading underscore
11185 echo " "
11186 val="$undef"
11187
11188 case "$dlsrc" in
11189 dl_dlopen.xs)
11190         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11191         $cat >dyna.c <<'EOM'
11192 fred () { }
11193 EOM
11194
11195 $cat >fred.c<<EOM
11196
11197 #include <stdio.h>
11198 #$i_stdlib I_STDLIB
11199 #ifdef I_STDLIB
11200 #include <stdlib.h>
11201 #endif
11202 #$i_dlfcn I_DLFCN
11203 #ifdef I_DLFCN
11204 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11205 #else
11206 #include <sys/types.h>
11207 #include <nlist.h>
11208 #include <link.h>
11209 #endif
11210
11211 extern int fred() ;
11212
11213 int main()
11214 {
11215     void * handle ;
11216     void * symbol ;
11217 #ifndef RTLD_LAZY
11218     int mode = 1 ;
11219 #else
11220     int mode = RTLD_LAZY ;
11221 #endif
11222     handle = dlopen("./dyna.$dlext", mode) ;
11223     if (handle == NULL) {
11224         printf ("1\n") ;
11225         fflush (stdout) ;
11226         exit(0);
11227     }
11228     symbol = dlsym(handle, "fred") ;
11229     if (symbol == NULL) {
11230         /* try putting a leading underscore */
11231         symbol = dlsym(handle, "_fred") ;
11232         if (symbol == NULL) {
11233             printf ("2\n") ;
11234             fflush (stdout) ;
11235             exit(0);
11236         }
11237         printf ("3\n") ;
11238     }
11239     else
11240         printf ("4\n") ;
11241     fflush (stdout) ;
11242     exit(0);
11243 }
11244 EOM
11245         : Call the object file tmp-dyna.o in case dlext=o.
11246         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11247                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11248                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11249                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11250                 xxx=`$run ./fred`
11251                 case $xxx in
11252                 1)      echo "Test program failed using dlopen." >&4
11253                         echo "Perhaps you should not use dynamic loading." >&4;;
11254                 2)      echo "Test program failed using dlsym." >&4
11255                         echo "Perhaps you should not use dynamic loading." >&4;;
11256                 3)      echo "dlsym needs a leading underscore" >&4
11257                         val="$define" ;;
11258                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11259                 esac
11260         else
11261                 echo "I can't compile and run the test program." >&4
11262                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11263         fi
11264         ;;
11265 esac
11266                 
11267 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11268
11269 set d_dlsymun
11270 eval $setvar
11271
11272 : see if drand48_r exists
11273 set drand48_r d_drand48_r
11274 eval $inlibc
11275 case "$d_drand48_r" in
11276 "$define")
11277         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11278         case "$d_drand48_r_proto:$usethreads" in
11279         ":define")      d_drand48_r_proto=define
11280                 set d_drand48_r_proto drand48_r $hdrs
11281                 eval $hasproto ;;
11282         *)      ;;
11283         esac
11284         case "$d_drand48_r_proto" in
11285         define)
11286         case "$drand48_r_proto" in
11287         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11288         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11289         esac
11290         case "$drand48_r_proto" in
11291         ''|0)   d_drand48_r=undef
11292                 drand48_r_proto=0
11293                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11294         * )     case "$drand48_r_proto" in
11295                 REENTRANT_PROTO*) ;;
11296                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11297                 esac
11298                 echo "Prototype: $try" ;;
11299         esac
11300         ;;
11301         *)      case "$usethreads" in
11302                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11303                 esac
11304                 d_drand48_r=undef
11305                 drand48_r_proto=0
11306                 ;;
11307         esac
11308         ;;
11309 *)      drand48_r_proto=0
11310         ;;
11311 esac
11312
11313 : see if prototype for drand48 is available
11314 echo " "
11315 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11316 eval $hasproto
11317
11318 : see if dup2 exists
11319 set dup2 d_dup2
11320 eval $inlibc
11321
11322 : see if eaccess exists
11323 set eaccess d_eaccess
11324 eval $inlibc
11325
11326 : see if endgrent exists
11327 set endgrent d_endgrent
11328 eval $inlibc
11329
11330 : see if this is an grp system
11331 set grp.h i_grp
11332 eval $inhdr
11333
11334 case "$i_grp" in
11335 $define)
11336         xxx=`./findhdr grp.h`
11337         $cppstdin $cppflags $cppminus < $xxx >$$.h
11338
11339         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11340                 val="$define"
11341         else
11342                 val="$undef"
11343         fi
11344         set d_grpasswd
11345         eval $setvar
11346
11347         $rm -f $$.h
11348         ;;
11349 *)
11350         val="$undef";
11351         set d_grpasswd; eval $setvar
11352         ;;
11353 esac
11354
11355 : see if endgrent_r exists
11356 set endgrent_r d_endgrent_r
11357 eval $inlibc
11358 case "$d_endgrent_r" in
11359 "$define")
11360         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11361         case "$d_endgrent_r_proto:$usethreads" in
11362         ":define")      d_endgrent_r_proto=define
11363                 set d_endgrent_r_proto endgrent_r $hdrs
11364                 eval $hasproto ;;
11365         *)      ;;
11366         esac
11367         case "$d_endgrent_r_proto" in
11368         define)
11369         case "$endgrent_r_proto" in
11370         ''|0) try='int endgrent_r(FILE**);'
11371         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11372         esac
11373         case "$endgrent_r_proto" in
11374         ''|0) try='void endgrent_r(FILE**);'
11375         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11376         esac
11377         case "$endgrent_r_proto" in
11378         ''|0)   d_endgrent_r=undef
11379                 endgrent_r_proto=0
11380                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11381         * )     case "$endgrent_r_proto" in
11382                 REENTRANT_PROTO*) ;;
11383                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11384                 esac
11385                 echo "Prototype: $try" ;;
11386         esac
11387         ;;
11388         *)      case "$usethreads" in
11389                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11390                 esac
11391                 d_endgrent_r=undef
11392                 endgrent_r_proto=0
11393                 ;;
11394         esac
11395         ;;
11396 *)      endgrent_r_proto=0
11397         ;;
11398 esac
11399
11400 : see if endhostent exists
11401 set endhostent d_endhent
11402 eval $inlibc
11403
11404 : see if this is a netdb.h system
11405 set netdb.h i_netdb
11406 eval $inhdr
11407
11408 : see if endhostent_r exists
11409 set endhostent_r d_endhostent_r
11410 eval $inlibc
11411 case "$d_endhostent_r" in
11412 "$define")
11413         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11414         case "$d_endhostent_r_proto:$usethreads" in
11415         ":define")      d_endhostent_r_proto=define
11416                 set d_endhostent_r_proto endhostent_r $hdrs
11417                 eval $hasproto ;;
11418         *)      ;;
11419         esac
11420         case "$d_endhostent_r_proto" in
11421         define)
11422         case "$endhostent_r_proto" in
11423         ''|0) try='int endhostent_r(struct hostent_data*);'
11424         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11425         esac
11426         case "$endhostent_r_proto" in
11427         ''|0) try='void endhostent_r(struct hostent_data*);'
11428         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11429         esac
11430         case "$endhostent_r_proto" in
11431         ''|0)   d_endhostent_r=undef
11432                 endhostent_r_proto=0
11433                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11434         * )     case "$endhostent_r_proto" in
11435                 REENTRANT_PROTO*) ;;
11436                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11437                 esac
11438                 echo "Prototype: $try" ;;
11439         esac
11440         ;;
11441         *)      case "$usethreads" in
11442                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11443                 esac
11444                 d_endhostent_r=undef
11445                 endhostent_r_proto=0
11446                 ;;
11447         esac
11448         ;;
11449 *)      endhostent_r_proto=0
11450         ;;
11451 esac
11452
11453 : see if endnetent exists
11454 set endnetent d_endnent
11455 eval $inlibc
11456
11457 : see if endnetent_r exists
11458 set endnetent_r d_endnetent_r
11459 eval $inlibc
11460 case "$d_endnetent_r" in
11461 "$define")
11462         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11463         case "$d_endnetent_r_proto:$usethreads" in
11464         ":define")      d_endnetent_r_proto=define
11465                 set d_endnetent_r_proto endnetent_r $hdrs
11466                 eval $hasproto ;;
11467         *)      ;;
11468         esac
11469         case "$d_endnetent_r_proto" in
11470         define)
11471         case "$endnetent_r_proto" in
11472         ''|0) try='int endnetent_r(struct netent_data*);'
11473         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11474         esac
11475         case "$endnetent_r_proto" in
11476         ''|0) try='void endnetent_r(struct netent_data*);'
11477         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11478         esac
11479         case "$endnetent_r_proto" in
11480         ''|0)   d_endnetent_r=undef
11481                 endnetent_r_proto=0
11482                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11483         * )     case "$endnetent_r_proto" in
11484                 REENTRANT_PROTO*) ;;
11485                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11486                 esac
11487                 echo "Prototype: $try" ;;
11488         esac
11489         ;;
11490         *)      case "$usethreads" in
11491                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11492                 esac
11493                 d_endnetent_r=undef
11494                 endnetent_r_proto=0
11495                 ;;
11496         esac
11497         ;;
11498 *)      endnetent_r_proto=0
11499         ;;
11500 esac
11501
11502 : see if endprotoent exists
11503 set endprotoent d_endpent
11504 eval $inlibc
11505
11506 : see if endprotoent_r exists
11507 set endprotoent_r d_endprotoent_r
11508 eval $inlibc
11509 case "$d_endprotoent_r" in
11510 "$define")
11511         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11512         case "$d_endprotoent_r_proto:$usethreads" in
11513         ":define")      d_endprotoent_r_proto=define
11514                 set d_endprotoent_r_proto endprotoent_r $hdrs
11515                 eval $hasproto ;;
11516         *)      ;;
11517         esac
11518         case "$d_endprotoent_r_proto" in
11519         define)
11520         case "$endprotoent_r_proto" in
11521         ''|0) try='int endprotoent_r(struct protoent_data*);'
11522         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11523         esac
11524         case "$endprotoent_r_proto" in
11525         ''|0) try='void endprotoent_r(struct protoent_data*);'
11526         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11527         esac
11528         case "$endprotoent_r_proto" in
11529         ''|0)   d_endprotoent_r=undef
11530                 endprotoent_r_proto=0
11531                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11532         * )     case "$endprotoent_r_proto" in
11533                 REENTRANT_PROTO*) ;;
11534                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11535                 esac
11536                 echo "Prototype: $try" ;;
11537         esac
11538         ;;
11539         *)      case "$usethreads" in
11540                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11541                 esac
11542                 d_endprotoent_r=undef
11543                 endprotoent_r_proto=0
11544                 ;;
11545         esac
11546         ;;
11547 *)      endprotoent_r_proto=0
11548         ;;
11549 esac
11550
11551 : see if endpwent exists
11552 set endpwent d_endpwent
11553 eval $inlibc
11554
11555 : see if this is a pwd.h system
11556 set pwd.h i_pwd
11557 eval $inhdr
11558
11559 case "$i_pwd" in
11560 $define)
11561         xxx=`./findhdr pwd.h`
11562         $cppstdin $cppflags $cppminus < $xxx >$$.h
11563
11564         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11565                 val="$define"
11566         else
11567                 val="$undef"
11568         fi
11569         set d_pwquota
11570         eval $setvar
11571
11572         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11573                 val="$define"
11574         else
11575                 val="$undef"
11576         fi
11577         set d_pwage
11578         eval $setvar
11579
11580         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11581                 val="$define"
11582         else
11583                 val="$undef"
11584         fi
11585         set d_pwchange
11586         eval $setvar
11587
11588         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11589                 val="$define"
11590         else
11591                 val="$undef"
11592         fi
11593         set d_pwclass
11594         eval $setvar
11595
11596         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11597                 val="$define"
11598         else
11599                 val="$undef"
11600         fi
11601         set d_pwexpire
11602         eval $setvar
11603
11604         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11605                 val="$define"
11606         else
11607                 val="$undef"
11608         fi
11609         set d_pwcomment
11610         eval $setvar
11611
11612         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11613                 val="$define"
11614         else
11615                 val="$undef"
11616         fi
11617         set d_pwgecos
11618         eval $setvar
11619
11620         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11621                 val="$define"
11622         else
11623                 val="$undef"
11624         fi
11625         set d_pwpasswd
11626         eval $setvar
11627
11628         $rm -f $$.h
11629         ;;
11630 *)
11631         val="$undef"; 
11632         set d_pwquota; eval $setvar
11633         set d_pwage; eval $setvar
11634         set d_pwchange; eval $setvar
11635         set d_pwclass; eval $setvar
11636         set d_pwexpire; eval $setvar
11637         set d_pwcomment; eval $setvar
11638         set d_pwgecos; eval $setvar
11639         set d_pwpasswd; eval $setvar
11640         ;;
11641 esac
11642
11643 : see if endpwent_r exists
11644 set endpwent_r d_endpwent_r
11645 eval $inlibc
11646 case "$d_endpwent_r" in
11647 "$define")
11648         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11649         case "$d_endpwent_r_proto:$usethreads" in
11650         ":define")      d_endpwent_r_proto=define
11651                 set d_endpwent_r_proto endpwent_r $hdrs
11652                 eval $hasproto ;;
11653         *)      ;;
11654         esac
11655         case "$d_endpwent_r_proto" in
11656         define)
11657         case "$endpwent_r_proto" in
11658         ''|0) try='int endpwent_r(FILE**);'
11659         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11660         esac
11661         case "$endpwent_r_proto" in
11662         ''|0) try='void endpwent_r(FILE**);'
11663         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11664         esac
11665         case "$endpwent_r_proto" in
11666         ''|0)   d_endpwent_r=undef
11667                 endpwent_r_proto=0
11668                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11669         * )     case "$endpwent_r_proto" in
11670                 REENTRANT_PROTO*) ;;
11671                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11672                 esac
11673                 echo "Prototype: $try" ;;
11674         esac
11675         ;;
11676         *)      case "$usethreads" in
11677                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11678                 esac
11679                 d_endpwent_r=undef
11680                 endpwent_r_proto=0
11681                 ;;
11682         esac
11683         ;;
11684 *)      endpwent_r_proto=0
11685         ;;
11686 esac
11687
11688 : see if endservent exists
11689 set endservent d_endsent
11690 eval $inlibc
11691
11692 : see if endservent_r exists
11693 set endservent_r d_endservent_r
11694 eval $inlibc
11695 case "$d_endservent_r" in
11696 "$define")
11697         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11698         case "$d_endservent_r_proto:$usethreads" in
11699         ":define")      d_endservent_r_proto=define
11700                 set d_endservent_r_proto endservent_r $hdrs
11701                 eval $hasproto ;;
11702         *)      ;;
11703         esac
11704         case "$d_endservent_r_proto" in
11705         define)
11706         case "$endservent_r_proto" in
11707         ''|0) try='int endservent_r(struct servent_data*);'
11708         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11709         esac
11710         case "$endservent_r_proto" in
11711         ''|0) try='void endservent_r(struct servent_data*);'
11712         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11713         esac
11714         case "$endservent_r_proto" in
11715         ''|0)   d_endservent_r=undef
11716                 endservent_r_proto=0
11717                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11718         * )     case "$endservent_r_proto" in
11719                 REENTRANT_PROTO*) ;;
11720                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11721                 esac
11722                 echo "Prototype: $try" ;;
11723         esac
11724         ;;
11725         *)      case "$usethreads" in
11726                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11727                 esac
11728                 d_endservent_r=undef
11729                 endservent_r_proto=0
11730                 ;;
11731         esac
11732         ;;
11733 *)      endservent_r_proto=0
11734         ;;
11735 esac
11736
11737 : Locate the flags for 'open()'
11738 echo " "
11739 $cat >try.c <<EOCP
11740 #include <sys/types.h>
11741 #ifdef I_FCNTL
11742 #include <fcntl.h>
11743 #endif
11744 #ifdef I_SYS_FILE
11745 #include <sys/file.h>
11746 #endif
11747 #$i_stdlib I_STDLIB
11748 #ifdef I_STDLIB
11749 #include <stdlib.h>
11750 #endif
11751 int main() {
11752         if(O_RDONLY);
11753 #ifdef O_TRUNC
11754         exit(0);
11755 #else
11756         exit(1);
11757 #endif
11758 }
11759 EOCP
11760 : check sys/file.h first to get FREAD on Sun
11761 if $test `./findhdr sys/file.h` && \
11762                 set try -DI_SYS_FILE && eval $compile; then
11763         h_sysfile=true;
11764         echo "<sys/file.h> defines the O_* constants..." >&4
11765         if $run ./try; then
11766                 echo "and you have the 3 argument form of open()." >&4
11767                 val="$define"
11768         else
11769                 echo "but not the 3 argument form of open().  Oh, well." >&4
11770                 val="$undef"
11771         fi
11772 elif $test `./findhdr fcntl.h` && \
11773                 set try -DI_FCNTL && eval $compile; then
11774         h_fcntl=true;
11775         echo "<fcntl.h> defines the O_* constants..." >&4
11776         if $run ./try; then
11777                 echo "and you have the 3 argument form of open()." >&4
11778                 val="$define"
11779         else
11780                 echo "but not the 3 argument form of open().  Oh, well." >&4
11781                 val="$undef"
11782         fi
11783 else
11784         val="$undef"
11785         echo "I can't find the O_* constant definitions!  You got problems." >&4
11786 fi
11787 set d_open3
11788 eval $setvar
11789 $rm -f try try.*
11790
11791 : see which of string.h or strings.h is needed
11792 echo " "
11793 strings=`./findhdr string.h`
11794 if $test "$strings" && $test -r "$strings"; then
11795         echo "Using <string.h> instead of <strings.h>." >&4
11796         val="$define"
11797 else
11798         val="$undef"
11799         strings=`./findhdr strings.h`
11800         if $test "$strings" && $test -r "$strings"; then
11801                 echo "Using <strings.h> instead of <string.h>." >&4
11802         else
11803                 echo "No string header found -- You'll surely have problems." >&4
11804         fi
11805 fi
11806 set i_string
11807 eval $setvar
11808 case "$i_string" in
11809 "$undef") strings=`./findhdr strings.h`;;
11810 *)        strings=`./findhdr string.h`;;
11811 esac
11812
11813 : see if this is a sys/file.h system
11814 val=''
11815 set sys/file.h val
11816 eval $inhdr
11817
11818 : do we need to include sys/file.h ?
11819 case "$val" in
11820 "$define")
11821         echo " "
11822         if $h_sysfile; then
11823                 val="$define"
11824                 echo "We'll be including <sys/file.h>." >&4
11825         else
11826                 val="$undef"
11827                 echo "We won't be including <sys/file.h>." >&4
11828         fi
11829         ;;
11830 *)
11831         h_sysfile=false
11832         ;;
11833 esac
11834 set i_sysfile
11835 eval $setvar
11836
11837 : see if fcntl.h is there
11838 val=''
11839 set fcntl.h val
11840 eval $inhdr
11841
11842 : see if we can include fcntl.h
11843 case "$val" in
11844 "$define")
11845         echo " "
11846         if $h_fcntl; then
11847                 val="$define"
11848                 echo "We'll be including <fcntl.h>." >&4
11849         else
11850                 val="$undef"
11851                 if $h_sysfile; then
11852         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11853                 else
11854                         echo "We won't be including <fcntl.h>." >&4
11855                 fi
11856         fi
11857         ;;
11858 *)
11859         h_fcntl=false
11860         val="$undef"
11861         ;;
11862 esac
11863 set i_fcntl
11864 eval $setvar
11865
11866 : check for non-blocking I/O stuff
11867 case "$h_sysfile" in
11868 true) echo "#include <sys/file.h>" > head.c;;
11869 *)
11870        case "$h_fcntl" in
11871        true) echo "#include <fcntl.h>" > head.c;;
11872        *) echo "#include <sys/fcntl.h>" > head.c;;
11873        esac
11874        ;;
11875 esac
11876 echo " "
11877 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11878 case "$o_nonblock" in
11879 '')
11880         $cat head.c > try.c
11881         $cat >>try.c <<EOCP
11882 #include <stdio.h>
11883 #$i_stdlib I_STDLIB
11884 #ifdef I_STDLIB
11885 #include <stdlib.h>
11886 #endif
11887 #$i_fcntl I_FCNTL
11888 #ifdef I_FCNTL
11889 #include <fcntl.h>
11890 #endif
11891 int main() {
11892 #ifdef O_NONBLOCK
11893         printf("O_NONBLOCK\n");
11894         exit(0);
11895 #endif
11896 #ifdef O_NDELAY
11897         printf("O_NDELAY\n");
11898         exit(0);
11899 #endif
11900 #ifdef FNDELAY
11901         printf("FNDELAY\n");
11902         exit(0);
11903 #endif
11904         exit(0);
11905 }
11906 EOCP
11907         set try
11908         if eval $compile_ok; then
11909                 o_nonblock=`$run ./try`
11910                 case "$o_nonblock" in
11911                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11912                 *) echo "Seems like we can use $o_nonblock.";;
11913                 esac
11914         else
11915                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11916         fi
11917         ;;
11918 *) echo "Using $hint value $o_nonblock.";;
11919 esac
11920 $rm -f try try.* .out core
11921
11922 echo " "
11923 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11924 case "$eagain" in
11925 '')
11926         $cat head.c > try.c
11927         $cat >>try.c <<EOCP
11928 #include <errno.h>
11929 #include <sys/types.h>
11930 #include <signal.h>
11931 #include <stdio.h> 
11932 #$i_stdlib I_STDLIB
11933 #ifdef I_STDLIB
11934 #include <stdlib.h>
11935 #endif
11936 #$i_fcntl I_FCNTL
11937 #ifdef I_FCNTL
11938 #include <fcntl.h>
11939 #endif
11940 #define MY_O_NONBLOCK $o_nonblock
11941 #ifndef errno  /* XXX need better Configure test */
11942 extern int errno;
11943 #endif
11944 #$i_unistd I_UNISTD
11945 #ifdef I_UNISTD
11946 #include <unistd.h>
11947 #endif
11948 #$i_string I_STRING
11949 #ifdef I_STRING
11950 #include <string.h>
11951 #else
11952 #include <strings.h>
11953 #endif
11954 $signal_t blech(x) int x; { exit(3); }
11955 EOCP
11956         $cat >> try.c <<'EOCP'
11957 int main()
11958 {
11959         int pd[2];
11960         int pu[2];
11961         char buf[1];
11962         char string[100];
11963
11964         pipe(pd);       /* Down: child -> parent */
11965         pipe(pu);       /* Up: parent -> child */
11966         if (0 != fork()) {
11967                 int ret;
11968                 close(pd[1]);   /* Parent reads from pd[0] */
11969                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11970 #ifdef F_SETFL
11971                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11972                         exit(1);
11973 #else
11974                 exit(4);
11975 #endif
11976                 signal(SIGALRM, blech);
11977                 alarm(5);
11978                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11979                         exit(2);
11980                 sprintf(string, "%d\n", ret);
11981                 write(2, string, strlen(string));
11982                 alarm(0);
11983 #ifdef EAGAIN
11984                 if (errno == EAGAIN) {
11985                         printf("EAGAIN\n");
11986                         goto ok;
11987                 }
11988 #endif
11989 #ifdef EWOULDBLOCK
11990                 if (errno == EWOULDBLOCK)
11991                         printf("EWOULDBLOCK\n");
11992 #endif
11993         ok:
11994                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11995                 sleep(2);                               /* Give it time to close our pipe */
11996                 alarm(5);
11997                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11998                 alarm(0);
11999                 sprintf(string, "%d\n", ret);
12000                 write(4, string, strlen(string));
12001                 exit(0);
12002         }
12003
12004         close(pd[0]);                   /* We write to pd[1] */
12005         close(pu[1]);                   /* We read from pu[0] */
12006         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12007         close(pd[1]);                   /* Pipe pd is now fully closed! */
12008         exit(0);                                /* Bye bye, thank you for playing! */
12009 }
12010 EOCP
12011         set try
12012         if eval $compile_ok; then
12013                 echo "$startsh" >mtry
12014                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12015                 chmod +x mtry
12016                 ./mtry >/dev/null 2>&1
12017                 case $? in
12018                 0) eagain=`$cat try.out`;;
12019                 1) echo "Could not perform non-blocking setting!";;
12020                 2) echo "I did a successful read() for something that was not there!";;
12021                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12022                 4) echo "Could not find F_SETFL!";;
12023                 *) echo "Something terribly wrong happened during testing.";;
12024                 esac
12025                 rd_nodata=`$cat try.ret`
12026                 echo "A read() system call with no data present returns $rd_nodata."
12027                 case "$rd_nodata" in
12028                 0|-1) ;;
12029                 *)
12030                         echo "(That's peculiar, fixing that to be -1.)"
12031                         rd_nodata=-1
12032                         ;;
12033                 esac
12034                 case "$eagain" in
12035                 '')
12036                         echo "Forcing errno EAGAIN on read() with no data available."
12037                         eagain=EAGAIN
12038                         ;;
12039                 *)
12040                         echo "Your read() sets errno to $eagain when no data is available."
12041                         ;;
12042                 esac
12043                 status=`$cat try.err`
12044                 case "$status" in
12045                 0) echo "And it correctly returns 0 to signal EOF.";;
12046                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12047                 *) echo "However, your read() returns '$status' on EOF??";;
12048                 esac
12049                 val="$define"
12050                 if test "$status" = "$rd_nodata"; then
12051                         echo "WARNING: you can't distinguish between EOF and no data!"
12052                         val="$undef"
12053                 fi
12054         else
12055                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12056                 eagain=EAGAIN
12057         fi
12058         set d_eofnblk
12059         eval $setvar
12060         ;;
12061 *)
12062         echo "Using $hint value $eagain."
12063         echo "Your read() returns $rd_nodata when no data is present."
12064         case "$d_eofnblk" in
12065         "$define") echo "And you can see EOF because read() returns 0.";;
12066         "$undef") echo "But you can't see EOF status from read() returned value.";;
12067         *)
12068                 echo "(Assuming you can't see EOF status from read anyway.)"
12069                 d_eofnblk=$undef
12070                 ;;
12071         esac
12072         ;;
12073 esac
12074 $rm -f try try.* .out core head.c mtry
12075
12076 : see if _ptr and _cnt from stdio act std
12077 echo " "
12078
12079 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12080         echo "(Looks like you have stdio.h from BSD.)"
12081         case "$stdio_ptr" in
12082         '') stdio_ptr='((fp)->_p)'
12083                 ptr_lval=$define
12084                 ;;
12085         *)      ptr_lval=$d_stdio_ptr_lval;;
12086         esac
12087         case "$stdio_cnt" in
12088         '') stdio_cnt='((fp)->_r)'
12089                 cnt_lval=$define
12090                 ;;
12091         *)      cnt_lval=$d_stdio_cnt_lval;;
12092         esac
12093         case "$stdio_base" in
12094         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12095         esac
12096         case "$stdio_bufsiz" in
12097         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12098         esac
12099 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12100         echo "(Looks like you have stdio.h from Linux.)"
12101         case "$stdio_ptr" in
12102         '') stdio_ptr='((fp)->_IO_read_ptr)'
12103                 ptr_lval=$define
12104                 ;;
12105         *)      ptr_lval=$d_stdio_ptr_lval;;
12106         esac
12107         case "$stdio_cnt" in
12108         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12109                 cnt_lval=$undef
12110                 ;;
12111         *)      cnt_lval=$d_stdio_cnt_lval;;
12112         esac
12113         case "$stdio_base" in
12114         '') stdio_base='((fp)->_IO_read_base)';;
12115         esac
12116         case "$stdio_bufsiz" in
12117         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12118         esac
12119 else
12120         case "$stdio_ptr" in
12121         '') stdio_ptr='((fp)->_ptr)'
12122                 ptr_lval=$define
12123                 ;;
12124         *)      ptr_lval=$d_stdio_ptr_lval;;
12125         esac
12126         case "$stdio_cnt" in
12127         '') stdio_cnt='((fp)->_cnt)'
12128                 cnt_lval=$define
12129                 ;;
12130         *)      cnt_lval=$d_stdio_cnt_lval;;
12131         esac
12132         case "$stdio_base" in
12133         '') stdio_base='((fp)->_base)';;
12134         esac
12135         case "$stdio_bufsiz" in
12136         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12137         esac
12138 fi
12139
12140 : test whether _ptr and _cnt really work
12141 echo "Checking how std your stdio is..." >&4
12142 $cat >try.c <<EOP
12143 #include <stdio.h>
12144 #$i_stdlib I_STDLIB
12145 #ifdef I_STDLIB
12146 #include <stdlib.h>
12147 #endif
12148 #define FILE_ptr(fp)    $stdio_ptr
12149 #define FILE_cnt(fp)    $stdio_cnt
12150 int main() {
12151         FILE *fp = fopen("try.c", "r");
12152         char c = getc(fp);
12153         if (
12154                 18 <= FILE_cnt(fp) &&
12155                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12156         )
12157                 exit(0);
12158         exit(1);
12159 }
12160 EOP
12161 val="$undef"
12162 set try
12163 if eval $compile && $to try.c; then
12164         if $run ./try; then
12165                 echo "Your stdio acts pretty std."
12166                 val="$define"
12167         else
12168                 echo "Your stdio isn't very std."
12169         fi
12170 else
12171         echo "Your stdio doesn't appear very std."
12172 fi
12173 $rm -f try.c try
12174
12175 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12176 # direct buffer manipulation no longer works.  The Configure tests
12177 # should be changed to correctly detect this, but until then,
12178 # the following check should at least let perl compile and run.
12179 # (This quick fix should be updated before 5.8.1.)
12180 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12181 # A. Dougherty, June 3, 2002.
12182 case "$d_gnulibc" in
12183 $define)
12184         case "$gnulibc_version" in
12185         2.[01]*)  ;;
12186         2.2) ;;
12187         2.2.[0-9]) ;;
12188         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12189                 val="$undef"
12190                 ;;
12191         esac
12192         ;;
12193 esac
12194 set d_stdstdio
12195 eval $setvar
12196
12197 : Can _ptr be used as an lvalue?
12198 case "$d_stdstdio$ptr_lval" in
12199 $define$define) val=$define ;;
12200 *) val=$undef ;;
12201 esac
12202 set d_stdio_ptr_lval
12203 eval $setvar
12204
12205 : Can _cnt be used as an lvalue?
12206 case "$d_stdstdio$cnt_lval" in
12207 $define$define) val=$define ;;
12208 *) val=$undef ;;
12209 esac
12210 set d_stdio_cnt_lval
12211 eval $setvar
12212
12213
12214 : test whether setting _ptr sets _cnt as a side effect
12215 d_stdio_ptr_lval_sets_cnt="$undef"
12216 d_stdio_ptr_lval_nochange_cnt="$undef"
12217 case "$d_stdio_ptr_lval$d_stdstdio" in
12218 $define$define)
12219         echo "Checking to see what happens if we set the stdio ptr..." >&4
12220 $cat >try.c <<EOP
12221 #include <stdio.h>
12222 /* Can we scream? */
12223 /* Eat dust sed :-) */
12224 /* In the buffer space, no one can hear you scream. */
12225 #$i_stdlib I_STDLIB
12226 #ifdef I_STDLIB
12227 #include <stdlib.h>
12228 #endif
12229 #define FILE_ptr(fp)    $stdio_ptr
12230 #define FILE_cnt(fp)    $stdio_cnt
12231 #include <sys/types.h>
12232 int main() {
12233         FILE *fp = fopen("try.c", "r");
12234         int c;
12235         char *ptr;
12236         size_t cnt;
12237         if (!fp) {
12238             puts("Fail even to read");
12239             exit(1);
12240         }
12241         c = getc(fp); /* Read away the first # */
12242         if (c == EOF) {
12243             puts("Fail even to read");
12244             exit(1);
12245         }
12246         if (!(
12247                 18 <= FILE_cnt(fp) &&
12248                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12249         )) {
12250                 puts("Fail even to read");
12251                 exit (1);
12252         }
12253         ptr = (char*) FILE_ptr(fp);
12254         cnt = (size_t)FILE_cnt(fp);
12255
12256         FILE_ptr(fp) += 42;
12257
12258         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12259                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12260                 exit (1);
12261         }
12262         if (FILE_cnt(fp) <= 20) {
12263                 printf ("Fail (<20 chars to test)");
12264                 exit (1);
12265         }
12266         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12267                 puts("Fail compare");
12268                 exit (1);
12269         }
12270         if (cnt == FILE_cnt(fp)) {
12271                 puts("Pass_unchanged");
12272                 exit (0);
12273         }       
12274         if (FILE_cnt(fp) == (cnt - 42)) {
12275                 puts("Pass_changed");
12276                 exit (0);
12277         }
12278         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12279         return 1;
12280
12281 }
12282 EOP
12283         set try
12284         if eval $compile && $to try.c; then
12285                 case `$run ./try` in
12286                 Pass_changed)
12287                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12288                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12289                 Pass_unchanged)
12290                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12291                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12292                 Fail*)
12293                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12294                 *)
12295                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12296         esac
12297         else
12298                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12299         fi
12300         $rm -f try.c try
12301         ;;
12302 esac
12303
12304 : see if _base is also standard
12305 val="$undef"
12306 case "$d_stdstdio" in
12307 $define)
12308         $cat >try.c <<EOP
12309 #include <stdio.h>
12310 #$i_stdlib I_STDLIB
12311 #ifdef I_STDLIB
12312 #include <stdlib.h>
12313 #endif
12314 #define FILE_base(fp)   $stdio_base
12315 #define FILE_bufsiz(fp) $stdio_bufsiz
12316 int main() {
12317         FILE *fp = fopen("try.c", "r");
12318         char c = getc(fp);
12319         if (
12320                 19 <= FILE_bufsiz(fp) &&
12321                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12322         )
12323                 exit(0);
12324         exit(1);
12325 }
12326 EOP
12327         set try
12328         if eval $compile && $to try.c; then
12329                 if $run ./try; then
12330                         echo "And its _base field acts std."
12331                         val="$define"
12332                 else
12333                         echo "But its _base field isn't std."
12334                 fi
12335         else
12336                 echo "However, it seems to be lacking the _base field."
12337         fi
12338         $rm -f try.c try
12339         ;;
12340 esac
12341 set d_stdiobase
12342 eval $setvar
12343
12344 : see if fast_stdio exists
12345 val="$undef"
12346 case "$d_stdstdio:$d_stdio_ptr_lval" in
12347 "$define:$define")
12348         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12349         *$define*)
12350                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12351                 val="$define"
12352                 ;;
12353         esac
12354         ;;
12355 esac
12356 set d_faststdio
12357 eval $setvar
12358
12359
12360
12361 : see if fchdir exists
12362 set fchdir d_fchdir
12363 eval $inlibc
12364
12365 : see if fchmod exists
12366 set fchmod d_fchmod
12367 eval $inlibc
12368
12369 : see if fchown exists
12370 set fchown d_fchown
12371 eval $inlibc
12372
12373 : see if this is an fcntl system
12374 set fcntl d_fcntl
12375 eval $inlibc
12376
12377 echo " "
12378 : See if fcntl-based locking works.
12379 $cat >try.c <<EOCP
12380 #$i_stdlib I_STDLIB
12381 #ifdef I_STDLIB
12382 #include <stdlib.h>
12383 #endif
12384 #include <unistd.h>
12385 #include <fcntl.h>
12386 #include <signal.h>
12387 $signal_t blech(x) int x; { exit(3); }
12388 int main() {
12389 #if defined(F_SETLK) && defined(F_SETLKW)
12390      struct flock flock;
12391      int retval, fd;
12392      fd = open("try.c", O_RDONLY);
12393      flock.l_type = F_RDLCK;
12394      flock.l_whence = SEEK_SET;
12395      flock.l_start = flock.l_len = 0;
12396      signal(SIGALRM, blech);
12397      alarm(10);
12398      retval = fcntl(fd, F_SETLK, &flock);
12399      close(fd);
12400      (retval < 0 ? exit(2) : exit(0));
12401 #else
12402      exit(2);
12403 #endif
12404 }
12405 EOCP
12406 echo "Checking if fcntl-based file locking works... "
12407 case "$d_fcntl" in
12408 "$define")
12409         set try
12410         if eval $compile_ok; then
12411                 if $run ./try; then
12412                         echo "Yes, it seems to work."
12413                         val="$define"
12414                 else
12415                         echo "Nope, it didn't work."
12416                         val="$undef"
12417                         case "$?" in
12418                         3) $cat >&4 <<EOM
12419 ***
12420 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12421 *** This is (almost) impossible.
12422 *** If your NFS lock daemons are not feeling well, something like
12423 *** this may happen, please investigate.  Cannot continue, aborting.
12424 ***
12425 EOM
12426                                 exit 1
12427                                 ;;
12428                         esac
12429                 fi
12430         else
12431                 echo "I'm unable to compile the test program, so I'll assume not."
12432                 val="$undef"
12433         fi
12434         ;;
12435 *) val="$undef";
12436         echo "Nope, since you don't even have fcntl()."
12437         ;;
12438 esac
12439 set d_fcntl_can_lock
12440 eval $setvar
12441 $rm -f try*
12442
12443
12444 : check for fd_set items
12445 $cat <<EOM
12446
12447 Checking to see how well your C compiler handles fd_set and friends ...
12448 EOM
12449 $cat >try.c <<EOCP
12450 #$i_stdlib I_STDLIB
12451 #ifdef I_STDLIB
12452 #include <stdlib.h>
12453 #endif
12454 #$i_systime I_SYS_TIME
12455 #$i_sysselct I_SYS_SELECT
12456 #$d_socket HAS_SOCKET
12457 #include <sys/types.h>
12458 #ifdef HAS_SOCKET
12459 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12460 #endif
12461 #ifdef I_SYS_TIME
12462 #include <sys/time.h>
12463 #endif
12464 #ifdef I_SYS_SELECT
12465 #include <sys/select.h>
12466 #endif
12467 int main() {
12468         fd_set fds;
12469
12470 #ifdef TRYBITS
12471         if(fds.fds_bits);
12472 #endif
12473
12474 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12475         exit(0);
12476 #else
12477         exit(1);
12478 #endif
12479 }
12480 EOCP
12481 set try -DTRYBITS
12482 if eval $compile; then
12483         d_fds_bits="$define"
12484         d_fd_set="$define"
12485         echo "Well, your system knows about the normal fd_set typedef..." >&4
12486         if $run ./try; then
12487                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12488                 d_fd_macros="$define"
12489         else
12490                 $cat >&4 <<'EOM'
12491 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12492 EOM
12493                 d_fd_macros="$undef"
12494         fi
12495 else
12496         $cat <<'EOM'
12497 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12498 EOM
12499         set try
12500         if eval $compile; then
12501                 d_fds_bits="$undef"
12502                 d_fd_set="$define"
12503                 echo "Well, your system has some sort of fd_set available..." >&4
12504                 if $run ./try; then
12505                         echo "and you have the normal fd_set macros." >&4
12506                         d_fd_macros="$define"
12507                 else
12508                         $cat <<'EOM'
12509 but not the normal fd_set macros!  Gross!  More work for me...
12510 EOM
12511                         d_fd_macros="$undef"
12512                 fi
12513         else
12514         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12515                 d_fd_set="$undef"
12516                 d_fds_bits="$undef"
12517                 d_fd_macros="$undef"
12518         fi
12519 fi
12520 $rm -f try try.*
12521
12522 : see if fgetpos exists
12523 set fgetpos d_fgetpos
12524 eval $inlibc
12525
12526 : see if finite exists
12527 set finite d_finite
12528 eval $inlibc
12529
12530 : see if finitel exists
12531 set finitel d_finitel
12532 eval $inlibc
12533
12534 : see if flock exists
12535 set flock d_flock
12536 eval $inlibc
12537
12538 : see if prototype for flock is available
12539 echo " "
12540 set d_flockproto flock $i_sysfile sys/file.h
12541 eval $hasproto
12542
12543 : see if fork exists
12544 set fork d_fork
12545 eval $inlibc
12546
12547 : see if fp_class exists
12548 set fp_class d_fp_class
12549 eval $inlibc
12550
12551 : see if pathconf exists
12552 set pathconf d_pathconf
12553 eval $inlibc
12554
12555 : see if fpathconf exists
12556 set fpathconf d_fpathconf
12557 eval $inlibc
12558
12559 : see if fpclass exists
12560 set fpclass d_fpclass
12561 eval $inlibc
12562
12563 : see if fpclassify exists
12564 set fpclassify d_fpclassify
12565 eval $inlibc
12566
12567 : see if fpclassl exists
12568 set fpclassl d_fpclassl
12569 eval $inlibc
12570
12571
12572 : check for fpos64_t
12573 echo " "
12574 echo "Checking to see if you have fpos64_t..." >&4
12575 $cat >try.c <<EOCP
12576 #include <stdio.h>
12577 int main() { fpos64_t x = 7; }
12578 EOCP
12579 set try
12580 if eval $compile; then
12581         val="$define"
12582         echo "You have fpos64_t."
12583 else
12584         val="$undef"
12585         echo "You do not have fpos64_t."
12586         case "$fpossize" in
12587         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12588         esac
12589 fi
12590 $rm -f try.* try
12591 set d_fpos64_t
12592 eval $setvar
12593
12594 : see if frexpl exists
12595 set frexpl d_frexpl
12596 eval $inlibc
12597
12598 : see if this is a sys/param system
12599 set sys/param.h i_sysparam
12600 eval $inhdr
12601
12602 : see if this is a sys/mount.h system
12603 set sys/mount.h i_sysmount
12604 eval $inhdr
12605
12606
12607 echo " "
12608 echo "Checking to see if your system supports struct fs_data..." >&4
12609 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12610 eval $hasstruct
12611 case "$d_fs_data_s" in
12612 "$define")      echo "Yes, it does."   ;;
12613 *)              echo "No, it doesn't." ;;
12614 esac
12615
12616 : see if fseeko exists
12617 set fseeko d_fseeko
12618 eval $inlibc
12619 case "$longsize" in
12620 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12621 esac
12622
12623 : see if fsetpos exists
12624 set fsetpos d_fsetpos
12625 eval $inlibc
12626
12627
12628 : see if fstatfs exists
12629 set fstatfs d_fstatfs
12630 eval $inlibc
12631
12632
12633 : see if statvfs exists
12634 set statvfs d_statvfs
12635 eval $inlibc
12636
12637 : see if fstatvfs exists
12638 set fstatvfs d_fstatvfs
12639 eval $inlibc
12640
12641
12642 : see if fsync exists
12643 set fsync d_fsync
12644 eval $inlibc
12645
12646 : see if ftello exists
12647 set ftello d_ftello
12648 eval $inlibc
12649 case "$longsize" in
12650 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12651 esac
12652
12653 d_futimes="$undef"
12654 : check for a working futimes
12655 echo " "
12656 echo "Checking for a working futimes()" >&4
12657 $cat >try.c <<EOCP
12658 #include <stdio.h>
12659 #include <sys/time.h>
12660 #include <errno.h>
12661 #include <fcntl.h>
12662
12663 int main ()
12664 {
12665     int fd, rv;
12666     fd = open ("try.c", O_RDWR);
12667     if (-1 == fd) exit (1);
12668     rv = futimes (fd, NULL);
12669     exit (rv == -1 ? errno : 0);
12670 }
12671 EOCP
12672 set try
12673 if eval $compile; then
12674     `$run ./try`
12675     rc=$?
12676     case "$rc" in
12677         0)  echo "Yes, it does" >&4
12678             d_futimes="$define"
12679             ;;
12680         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12681             ;;
12682     esac
12683 else
12684     echo "No, it does not (probably harmless)\n" >&4
12685 fi
12686 $rm -f try.* try core core.try.*
12687
12688 : see if getcwd exists
12689 set getcwd d_getcwd
12690 eval $inlibc
12691
12692 : see if getespwnam exists
12693 set getespwnam d_getespwnam
12694 eval $inlibc
12695
12696
12697 : see if getfsstat exists
12698 set getfsstat d_getfsstat
12699 eval $inlibc
12700
12701 : see if getgrent exists
12702 set getgrent d_getgrent
12703 eval $inlibc
12704
12705 : see if getgrent_r exists
12706 set getgrent_r d_getgrent_r
12707 eval $inlibc
12708 case "$d_getgrent_r" in
12709 "$define")
12710         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12711         case "$d_getgrent_r_proto:$usethreads" in
12712         ":define")      d_getgrent_r_proto=define
12713                 set d_getgrent_r_proto getgrent_r $hdrs
12714                 eval $hasproto ;;
12715         *)      ;;
12716         esac
12717         case "$d_getgrent_r_proto" in
12718         define)
12719         case "$getgrent_r_proto" in
12720         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12721         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12722         esac
12723         case "$getgrent_r_proto" in
12724         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12725         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12726         esac
12727         case "$getgrent_r_proto" in
12728         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12729         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12730         esac
12731         case "$getgrent_r_proto" in
12732         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12733         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12734         esac
12735         case "$getgrent_r_proto" in
12736         ''|0) try='int getgrent_r(struct group*, char*, int);'
12737         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12738         esac
12739         case "$getgrent_r_proto" in
12740         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12741         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12742         esac
12743         case "$getgrent_r_proto" in
12744         ''|0)   d_getgrent_r=undef
12745                 getgrent_r_proto=0
12746                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12747         * )     case "$getgrent_r_proto" in
12748                 REENTRANT_PROTO*) ;;
12749                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12750                 esac
12751                 echo "Prototype: $try" ;;
12752         esac
12753         ;;
12754         *)      case "$usethreads" in
12755                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12756                 esac
12757                 d_getgrent_r=undef
12758                 getgrent_r_proto=0
12759                 ;;
12760         esac
12761         ;;
12762 *)      getgrent_r_proto=0
12763         ;;
12764 esac
12765
12766 : see if getgrgid_r exists
12767 set getgrgid_r d_getgrgid_r
12768 eval $inlibc
12769 case "$d_getgrgid_r" in
12770 "$define")
12771         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12772         case "$d_getgrgid_r_proto:$usethreads" in
12773         ":define")      d_getgrgid_r_proto=define
12774                 set d_getgrgid_r_proto getgrgid_r $hdrs
12775                 eval $hasproto ;;
12776         *)      ;;
12777         esac
12778         case "$d_getgrgid_r_proto" in
12779         define)
12780         case "$getgrgid_r_proto" in
12781         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12782         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12783         esac
12784         case "$getgrgid_r_proto" in
12785         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12786         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12787         esac
12788         case "$getgrgid_r_proto" in
12789         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12790         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12791         esac
12792         case "$getgrgid_r_proto" in
12793         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12794         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12795         esac
12796         case "$getgrgid_r_proto" in
12797         ''|0)   d_getgrgid_r=undef
12798                 getgrgid_r_proto=0
12799                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12800         * )     case "$getgrgid_r_proto" in
12801                 REENTRANT_PROTO*) ;;
12802                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12803                 esac
12804                 echo "Prototype: $try" ;;
12805         esac
12806         ;;
12807         *)      case "$usethreads" in
12808                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12809                 esac
12810                 d_getgrgid_r=undef
12811                 getgrgid_r_proto=0
12812                 ;;
12813         esac
12814         ;;
12815 *)      getgrgid_r_proto=0
12816         ;;
12817 esac
12818
12819 : see if getgrnam_r exists
12820 set getgrnam_r d_getgrnam_r
12821 eval $inlibc
12822 case "$d_getgrnam_r" in
12823 "$define")
12824         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12825         case "$d_getgrnam_r_proto:$usethreads" in
12826         ":define")      d_getgrnam_r_proto=define
12827                 set d_getgrnam_r_proto getgrnam_r $hdrs
12828                 eval $hasproto ;;
12829         *)      ;;
12830         esac
12831         case "$d_getgrnam_r_proto" in
12832         define)
12833         case "$getgrnam_r_proto" in
12834         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12835         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12836         esac
12837         case "$getgrnam_r_proto" in
12838         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12839         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12840         esac
12841         case "$getgrnam_r_proto" in
12842         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12843         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12844         esac
12845         case "$getgrnam_r_proto" in
12846         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12847         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12848         esac
12849         case "$getgrnam_r_proto" in
12850         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12851         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12852         esac
12853         case "$getgrnam_r_proto" in
12854         ''|0)   d_getgrnam_r=undef
12855                 getgrnam_r_proto=0
12856                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12857         * )     case "$getgrnam_r_proto" in
12858                 REENTRANT_PROTO*) ;;
12859                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12860                 esac
12861                 echo "Prototype: $try" ;;
12862         esac
12863         ;;
12864         *)      case "$usethreads" in
12865                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12866                 esac
12867                 d_getgrnam_r=undef
12868                 getgrnam_r_proto=0
12869                 ;;
12870         esac
12871         ;;
12872 *)      getgrnam_r_proto=0
12873         ;;
12874 esac
12875
12876 : see if gethostbyaddr exists
12877 set gethostbyaddr d_gethbyaddr
12878 eval $inlibc
12879
12880 : see if gethostbyname exists
12881 set gethostbyname d_gethbyname
12882 eval $inlibc
12883
12884 : see if gethostent exists
12885 set gethostent d_gethent
12886 eval $inlibc
12887
12888 : see how we will look up host name
12889 echo " "
12890 call=''
12891 if set gethostname val -f d_gethname; eval $csym; $val; then
12892         echo 'gethostname() found.' >&4
12893         d_gethname="$define"
12894         call=gethostname
12895 fi
12896 if set uname val -f d_uname; eval $csym; $val; then
12897         if ./xenix; then
12898                 $cat <<'EOM'
12899 uname() was found, but you're running xenix, and older versions of xenix
12900 have a broken uname(). If you don't really know whether your xenix is old
12901 enough to have a broken system call, use the default answer.
12902
12903 EOM
12904                 dflt=y
12905                 case "$d_uname" in
12906                 "$define") dflt=n;;
12907                 esac
12908                 rp='Is your uname() broken?'
12909                 . ./myread
12910                 case "$ans" in
12911                 n*) d_uname="$define"; call=uname;;
12912                 esac
12913         else
12914                 echo 'uname() found.' >&4
12915                 d_uname="$define"
12916                 case "$call" in
12917                 '') call=uname ;;
12918                 esac
12919         fi
12920 fi
12921 case "$d_gethname" in
12922 '') d_gethname="$undef";;
12923 esac
12924 case "$d_uname" in
12925 '') d_uname="$undef";;
12926 esac
12927 case "$d_uname$d_gethname" in
12928 *define*)
12929         dflt=n
12930         cat <<EOM
12931  
12932 Every now and then someone has a $call() that lies about the hostname
12933 but can't be fixed for political or economic reasons.  If you wish, I can
12934 pretend $call() isn't there and maybe compute hostname at run-time
12935 thanks to the '$phostname' command.
12936
12937 EOM
12938         rp="Shall I ignore $call() from now on?"
12939         . ./myread
12940         case "$ans" in
12941         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12942         esac;;
12943 esac
12944 case "$phostname" in
12945 '') aphostname='';;
12946 *) case "$aphostname" in
12947         /*) ;;
12948         *) set X $phostname
12949                 shift
12950                 file=$1
12951                 shift
12952                 file=`./loc $file $file $pth`
12953                 aphostname=`echo $file $*`
12954                 ;;
12955         esac
12956         ;;
12957 esac
12958 case "$d_uname$d_gethname" in
12959 *define*) ;;
12960 *)
12961         case "$phostname" in
12962         '')
12963                 echo "There will be no way for $package to get your hostname." >&4;;
12964         *)
12965         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12966                 ;;
12967         esac;;
12968 esac
12969 case "$d_phostname" in
12970 '') d_phostname="$undef";;
12971 esac
12972
12973 : see if gethostbyaddr_r exists
12974 set gethostbyaddr_r d_gethostbyaddr_r
12975 eval $inlibc
12976 case "$d_gethostbyaddr_r" in
12977 "$define")
12978         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12979         case "$d_gethostbyaddr_r_proto:$usethreads" in
12980         ":define")      d_gethostbyaddr_r_proto=define
12981                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12982                 eval $hasproto ;;
12983         *)      ;;
12984         esac
12985         case "$d_gethostbyaddr_r_proto" in
12986         define)
12987         case "$gethostbyaddr_r_proto" in
12988         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12989         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12990         esac
12991         case "$gethostbyaddr_r_proto" in
12992         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12993         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12994         esac
12995         case "$gethostbyaddr_r_proto" in
12996         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12997         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12998         esac
12999         case "$gethostbyaddr_r_proto" in
13000         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13001         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13002         esac
13003         case "$gethostbyaddr_r_proto" in
13004         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13005         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13006         esac
13007         case "$gethostbyaddr_r_proto" in
13008         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13009         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13010         esac
13011         case "$gethostbyaddr_r_proto" in
13012         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13013         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13014         esac
13015         case "$gethostbyaddr_r_proto" in
13016         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13017         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13018         esac
13019         case "$gethostbyaddr_r_proto" in
13020         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13021         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13022         esac
13023         case "$gethostbyaddr_r_proto" in
13024         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13025         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13026         esac
13027         case "$gethostbyaddr_r_proto" in
13028         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13029         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13030         esac
13031         case "$gethostbyaddr_r_proto" in
13032         ''|0)   d_gethostbyaddr_r=undef
13033                 gethostbyaddr_r_proto=0
13034                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13035         * )     case "$gethostbyaddr_r_proto" in
13036                 REENTRANT_PROTO*) ;;
13037                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13038                 esac
13039                 echo "Prototype: $try" ;;
13040         esac
13041         ;;
13042         *)      case "$usethreads" in
13043                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13044                 esac
13045                 d_gethostbyaddr_r=undef
13046                 gethostbyaddr_r_proto=0
13047                 ;;
13048         esac
13049         ;;
13050 *)      gethostbyaddr_r_proto=0
13051         ;;
13052 esac
13053
13054 : see if gethostbyname_r exists
13055 set gethostbyname_r d_gethostbyname_r
13056 eval $inlibc
13057 case "$d_gethostbyname_r" in
13058 "$define")
13059         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13060         case "$d_gethostbyname_r_proto:$usethreads" in
13061         ":define")      d_gethostbyname_r_proto=define
13062                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13063                 eval $hasproto ;;
13064         *)      ;;
13065         esac
13066         case "$d_gethostbyname_r_proto" in
13067         define)
13068         case "$gethostbyname_r_proto" in
13069         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13070         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13071         esac
13072         case "$gethostbyname_r_proto" in
13073         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13074         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13075         esac
13076         case "$gethostbyname_r_proto" in
13077         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13078         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13079         esac
13080         case "$gethostbyname_r_proto" in
13081         ''|0)   d_gethostbyname_r=undef
13082                 gethostbyname_r_proto=0
13083                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13084         * )     case "$gethostbyname_r_proto" in
13085                 REENTRANT_PROTO*) ;;
13086                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13087                 esac
13088                 echo "Prototype: $try" ;;
13089         esac
13090         ;;
13091         *)      case "$usethreads" in
13092                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13093                 esac
13094                 d_gethostbyname_r=undef
13095                 gethostbyname_r_proto=0
13096                 ;;
13097         esac
13098         ;;
13099 *)      gethostbyname_r_proto=0
13100         ;;
13101 esac
13102
13103 : see if gethostent_r exists
13104 set gethostent_r d_gethostent_r
13105 eval $inlibc
13106 case "$d_gethostent_r" in
13107 "$define")
13108         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13109         case "$d_gethostent_r_proto:$usethreads" in
13110         ":define")      d_gethostent_r_proto=define
13111                 set d_gethostent_r_proto gethostent_r $hdrs
13112                 eval $hasproto ;;
13113         *)      ;;
13114         esac
13115         case "$d_gethostent_r_proto" in
13116         define)
13117         case "$gethostent_r_proto" in
13118         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13119         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13120         esac
13121         case "$gethostent_r_proto" in
13122         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13123         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13124         esac
13125         case "$gethostent_r_proto" in
13126         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13127         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13128         esac
13129         case "$gethostent_r_proto" in
13130         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13131         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13132         esac
13133         case "$gethostent_r_proto" in
13134         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13135         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13136         esac
13137         case "$gethostent_r_proto" in
13138         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13139         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13140         esac
13141         case "$gethostent_r_proto" in
13142         ''|0)   d_gethostent_r=undef
13143                 gethostent_r_proto=0
13144                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13145         * )     case "$gethostent_r_proto" in
13146                 REENTRANT_PROTO*) ;;
13147                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13148                 esac
13149                 echo "Prototype: $try" ;;
13150         esac
13151         ;;
13152         *)      case "$usethreads" in
13153                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13154                 esac
13155                 d_gethostent_r=undef
13156                 gethostent_r_proto=0
13157                 ;;
13158         esac
13159         ;;
13160 *)      gethostent_r_proto=0
13161         ;;
13162 esac
13163
13164 : see if prototypes for various gethostxxx netdb.h functions are available
13165 echo " "
13166 set d_gethostprotos gethostent $i_netdb netdb.h
13167 eval $hasproto
13168
13169 : see if getitimer exists
13170 set getitimer d_getitimer
13171 eval $inlibc
13172
13173 : see if getlogin exists
13174 set getlogin d_getlogin
13175 eval $inlibc
13176
13177 : see if getlogin_r exists
13178 set getlogin_r d_getlogin_r
13179 eval $inlibc
13180 case "$d_getlogin_r" in
13181 "$define")
13182         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13183         case "$d_getlogin_r_proto:$usethreads" in
13184         ":define")      d_getlogin_r_proto=define
13185                 set d_getlogin_r_proto getlogin_r $hdrs
13186                 eval $hasproto ;;
13187         *)      ;;
13188         esac
13189         case "$d_getlogin_r_proto" in
13190         define)
13191         case "$getlogin_r_proto" in
13192         ''|0) try='int getlogin_r(char*, size_t);'
13193         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13194         esac
13195         case "$getlogin_r_proto" in
13196         ''|0) try='int getlogin_r(char*, int);'
13197         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13198         esac
13199         case "$getlogin_r_proto" in
13200         ''|0) try='char* getlogin_r(char*, size_t);'
13201         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13202         esac
13203         case "$getlogin_r_proto" in
13204         ''|0) try='char* getlogin_r(char*, int);'
13205         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13206         esac
13207         case "$getlogin_r_proto" in
13208         ''|0)   d_getlogin_r=undef
13209                 getlogin_r_proto=0
13210                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13211         * )     case "$getlogin_r_proto" in
13212                 REENTRANT_PROTO*) ;;
13213                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13214                 esac
13215                 echo "Prototype: $try" ;;
13216         esac
13217         ;;
13218         *)      case "$usethreads" in
13219                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13220                 esac
13221                 d_getlogin_r=undef
13222                 getlogin_r_proto=0
13223                 ;;
13224         esac
13225         ;;
13226 *)      getlogin_r_proto=0
13227         ;;
13228 esac
13229
13230 : see if getmnt exists
13231 set getmnt d_getmnt
13232 eval $inlibc
13233
13234 : see if getmntent exists
13235 set getmntent d_getmntent
13236 eval $inlibc
13237
13238 : see if getnetbyaddr exists
13239 set getnetbyaddr d_getnbyaddr
13240 eval $inlibc
13241
13242 : see if getnetbyname exists
13243 set getnetbyname d_getnbyname
13244 eval $inlibc
13245
13246 : see if getnetent exists
13247 set getnetent d_getnent
13248 eval $inlibc
13249
13250 : see if getnetbyaddr_r exists
13251 set getnetbyaddr_r d_getnetbyaddr_r
13252 eval $inlibc
13253 case "$d_getnetbyaddr_r" in
13254 "$define")
13255         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13256         case "$d_getnetbyaddr_r_proto:$usethreads" in
13257         ":define")      d_getnetbyaddr_r_proto=define
13258                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13259                 eval $hasproto ;;
13260         *)      ;;
13261         esac
13262         case "$d_getnetbyaddr_r_proto" in
13263         define)
13264         case "$getnetbyaddr_r_proto" in
13265         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13266         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13267         esac
13268         case "$getnetbyaddr_r_proto" in
13269         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13270         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13271         esac
13272         case "$getnetbyaddr_r_proto" in
13273         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13274         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13275         esac
13276         case "$getnetbyaddr_r_proto" in
13277         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13278         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13279         esac
13280         case "$getnetbyaddr_r_proto" in
13281         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13282         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13283         esac
13284         case "$getnetbyaddr_r_proto" in
13285         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13286         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13287         esac
13288         case "$getnetbyaddr_r_proto" in
13289         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13290         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13291         esac
13292         case "$getnetbyaddr_r_proto" in
13293         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13294         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13295         esac
13296         case "$getnetbyaddr_r_proto" in
13297         ''|0)   d_getnetbyaddr_r=undef
13298                 getnetbyaddr_r_proto=0
13299                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13300         * )     case "$getnetbyaddr_r_proto" in
13301                 REENTRANT_PROTO*) ;;
13302                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13303                 esac
13304                 echo "Prototype: $try" ;;
13305         esac
13306         ;;
13307         *)      case "$usethreads" in
13308                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13309                 esac
13310                 d_getnetbyaddr_r=undef
13311                 getnetbyaddr_r_proto=0
13312                 ;;
13313         esac
13314         ;;
13315 *)      getnetbyaddr_r_proto=0
13316         ;;
13317 esac
13318
13319 : see if getnetbyname_r exists
13320 set getnetbyname_r d_getnetbyname_r
13321 eval $inlibc
13322 case "$d_getnetbyname_r" in
13323 "$define")
13324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13325         case "$d_getnetbyname_r_proto:$usethreads" in
13326         ":define")      d_getnetbyname_r_proto=define
13327                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13328                 eval $hasproto ;;
13329         *)      ;;
13330         esac
13331         case "$d_getnetbyname_r_proto" in
13332         define)
13333         case "$getnetbyname_r_proto" in
13334         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13335         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13336         esac
13337         case "$getnetbyname_r_proto" in
13338         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13339         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13340         esac
13341         case "$getnetbyname_r_proto" in
13342         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13343         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13344         esac
13345         case "$getnetbyname_r_proto" in
13346         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13347         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13348         esac
13349         case "$getnetbyname_r_proto" in
13350         ''|0)   d_getnetbyname_r=undef
13351                 getnetbyname_r_proto=0
13352                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13353         * )     case "$getnetbyname_r_proto" in
13354                 REENTRANT_PROTO*) ;;
13355                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13356                 esac
13357                 echo "Prototype: $try" ;;
13358         esac
13359         ;;
13360         *)      case "$usethreads" in
13361                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13362                 esac
13363                 d_getnetbyname_r=undef
13364                 getnetbyname_r_proto=0
13365                 ;;
13366         esac
13367         ;;
13368 *)      getnetbyname_r_proto=0
13369         ;;
13370 esac
13371
13372 : see if getnetent_r exists
13373 set getnetent_r d_getnetent_r
13374 eval $inlibc
13375 case "$d_getnetent_r" in
13376 "$define")
13377         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13378         case "$d_getnetent_r_proto:$usethreads" in
13379         ":define")      d_getnetent_r_proto=define
13380                 set d_getnetent_r_proto getnetent_r $hdrs
13381                 eval $hasproto ;;
13382         *)      ;;
13383         esac
13384         case "$d_getnetent_r_proto" in
13385         define)
13386         case "$getnetent_r_proto" in
13387         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13388         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13389         esac
13390         case "$getnetent_r_proto" in
13391         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13392         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13393         esac
13394         case "$getnetent_r_proto" in
13395         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13396         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13397         esac
13398         case "$getnetent_r_proto" in
13399         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13400         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13401         esac
13402         case "$getnetent_r_proto" in
13403         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13404         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13405         esac
13406         case "$getnetent_r_proto" in
13407         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13408         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13409         esac
13410         case "$getnetent_r_proto" in
13411         ''|0)   d_getnetent_r=undef
13412                 getnetent_r_proto=0
13413                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13414         * )     case "$getnetent_r_proto" in
13415                 REENTRANT_PROTO*) ;;
13416                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13417                 esac
13418                 echo "Prototype: $try" ;;
13419         esac
13420         ;;
13421         *)      case "$usethreads" in
13422                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13423                 esac
13424                 d_getnetent_r=undef
13425                 getnetent_r_proto=0
13426                 ;;
13427         esac
13428         ;;
13429 *)      getnetent_r_proto=0
13430         ;;
13431 esac
13432
13433 : see if prototypes for various getnetxxx netdb.h functions are available
13434 echo " "
13435 set d_getnetprotos getnetent $i_netdb netdb.h
13436 eval $hasproto
13437
13438 : see if getpagesize exists
13439 set getpagesize d_getpagsz
13440 eval $inlibc
13441
13442
13443 : see if getprotobyname exists
13444 set getprotobyname d_getpbyname
13445 eval $inlibc
13446
13447 : see if getprotobynumber exists
13448 set getprotobynumber d_getpbynumber
13449 eval $inlibc
13450
13451 : see if getprotoent exists
13452 set getprotoent d_getpent
13453 eval $inlibc
13454
13455 : see if getpgid exists
13456 set getpgid d_getpgid
13457 eval $inlibc
13458
13459 : see if getpgrp2 exists
13460 set getpgrp2 d_getpgrp2
13461 eval $inlibc
13462
13463 : see if getppid exists
13464 set getppid d_getppid
13465 eval $inlibc
13466
13467 : see if getpriority exists
13468 set getpriority d_getprior
13469 eval $inlibc
13470
13471 : see if getprotobyname_r exists
13472 set getprotobyname_r d_getprotobyname_r
13473 eval $inlibc
13474 case "$d_getprotobyname_r" in
13475 "$define")
13476         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13477         case "$d_getprotobyname_r_proto:$usethreads" in
13478         ":define")      d_getprotobyname_r_proto=define
13479                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13480                 eval $hasproto ;;
13481         *)      ;;
13482         esac
13483         case "$d_getprotobyname_r_proto" in
13484         define)
13485         case "$getprotobyname_r_proto" in
13486         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13487         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13488         esac
13489         case "$getprotobyname_r_proto" in
13490         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13491         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13492         esac
13493         case "$getprotobyname_r_proto" in
13494         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13495         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13496         esac
13497         case "$getprotobyname_r_proto" in
13498         ''|0)   d_getprotobyname_r=undef
13499                 getprotobyname_r_proto=0
13500                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13501         * )     case "$getprotobyname_r_proto" in
13502                 REENTRANT_PROTO*) ;;
13503                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13504                 esac
13505                 echo "Prototype: $try" ;;
13506         esac
13507         ;;
13508         *)      case "$usethreads" in
13509                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13510                 esac
13511                 d_getprotobyname_r=undef
13512                 getprotobyname_r_proto=0
13513                 ;;
13514         esac
13515         ;;
13516 *)      getprotobyname_r_proto=0
13517         ;;
13518 esac
13519
13520 : see if getprotobynumber_r exists
13521 set getprotobynumber_r d_getprotobynumber_r
13522 eval $inlibc
13523 case "$d_getprotobynumber_r" in
13524 "$define")
13525         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13526         case "$d_getprotobynumber_r_proto:$usethreads" in
13527         ":define")      d_getprotobynumber_r_proto=define
13528                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13529                 eval $hasproto ;;
13530         *)      ;;
13531         esac
13532         case "$d_getprotobynumber_r_proto" in
13533         define)
13534         case "$getprotobynumber_r_proto" in
13535         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13536         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13537         esac
13538         case "$getprotobynumber_r_proto" in
13539         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13540         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13541         esac
13542         case "$getprotobynumber_r_proto" in
13543         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13544         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13545         esac
13546         case "$getprotobynumber_r_proto" in
13547         ''|0)   d_getprotobynumber_r=undef
13548                 getprotobynumber_r_proto=0
13549                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13550         * )     case "$getprotobynumber_r_proto" in
13551                 REENTRANT_PROTO*) ;;
13552                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13553                 esac
13554                 echo "Prototype: $try" ;;
13555         esac
13556         ;;
13557         *)      case "$usethreads" in
13558                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13559                 esac
13560                 d_getprotobynumber_r=undef
13561                 getprotobynumber_r_proto=0
13562                 ;;
13563         esac
13564         ;;
13565 *)      getprotobynumber_r_proto=0
13566         ;;
13567 esac
13568
13569 : see if getprotoent_r exists
13570 set getprotoent_r d_getprotoent_r
13571 eval $inlibc
13572 case "$d_getprotoent_r" in
13573 "$define")
13574         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13575         case "$d_getprotoent_r_proto:$usethreads" in
13576         ":define")      d_getprotoent_r_proto=define
13577                 set d_getprotoent_r_proto getprotoent_r $hdrs
13578                 eval $hasproto ;;
13579         *)      ;;
13580         esac
13581         case "$d_getprotoent_r_proto" in
13582         define)
13583         case "$getprotoent_r_proto" in
13584         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13585         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13586         esac
13587         case "$getprotoent_r_proto" in
13588         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13589         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13590         esac
13591         case "$getprotoent_r_proto" in
13592         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13593         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13594         esac
13595         case "$getprotoent_r_proto" in
13596         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13597         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13598         esac
13599         case "$getprotoent_r_proto" in
13600         ''|0)   d_getprotoent_r=undef
13601                 getprotoent_r_proto=0
13602                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13603         * )     case "$getprotoent_r_proto" in
13604                 REENTRANT_PROTO*) ;;
13605                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13606                 esac
13607                 echo "Prototype: $try" ;;
13608         esac
13609         ;;
13610         *)      case "$usethreads" in
13611                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13612                 esac
13613                 d_getprotoent_r=undef
13614                 getprotoent_r_proto=0
13615                 ;;
13616         esac
13617         ;;
13618 *)      getprotoent_r_proto=0
13619         ;;
13620 esac
13621
13622 : see if prototypes for various getprotoxxx netdb.h functions are available
13623 echo " "
13624 set d_getprotoprotos getprotoent $i_netdb netdb.h
13625 eval $hasproto
13626
13627 : see if getprpwnam exists
13628 set getprpwnam d_getprpwnam
13629 eval $inlibc
13630
13631 : see if getpwent exists
13632 set getpwent d_getpwent
13633 eval $inlibc
13634
13635 : see if getpwent_r exists
13636 set getpwent_r d_getpwent_r
13637 eval $inlibc
13638 case "$d_getpwent_r" in
13639 "$define")
13640         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13641         case "$d_getpwent_r_proto:$usethreads" in
13642         ":define")      d_getpwent_r_proto=define
13643                 set d_getpwent_r_proto getpwent_r $hdrs
13644                 eval $hasproto ;;
13645         *)      ;;
13646         esac
13647         case "$d_getpwent_r_proto" in
13648         define)
13649         case "$getpwent_r_proto" in
13650         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13651         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13652         esac
13653         case "$getpwent_r_proto" in
13654         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13655         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13656         esac
13657         case "$getpwent_r_proto" in
13658         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13659         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13660         esac
13661         case "$getpwent_r_proto" in
13662         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13663         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13664         esac
13665         case "$getpwent_r_proto" in
13666         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13667         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13668         esac
13669         case "$getpwent_r_proto" in
13670         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13671         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13672         esac
13673         case "$getpwent_r_proto" in
13674         ''|0)   d_getpwent_r=undef
13675                 getpwent_r_proto=0
13676                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13677         * )     case "$getpwent_r_proto" in
13678                 REENTRANT_PROTO*) ;;
13679                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13680                 esac
13681                 echo "Prototype: $try" ;;
13682         esac
13683         ;;
13684         *)      case "$usethreads" in
13685                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13686                 esac
13687                 d_getpwent_r=undef
13688                 getpwent_r_proto=0
13689                 ;;
13690         esac
13691         ;;
13692 *)      getpwent_r_proto=0
13693         ;;
13694 esac
13695
13696 : see if getpwnam_r exists
13697 set getpwnam_r d_getpwnam_r
13698 eval $inlibc
13699 case "$d_getpwnam_r" in
13700 "$define")
13701         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13702         case "$d_getpwnam_r_proto:$usethreads" in
13703         ":define")      d_getpwnam_r_proto=define
13704                 set d_getpwnam_r_proto getpwnam_r $hdrs
13705                 eval $hasproto ;;
13706         *)      ;;
13707         esac
13708         case "$d_getpwnam_r_proto" in
13709         define)
13710         case "$getpwnam_r_proto" in
13711         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13712         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13713         esac
13714         case "$getpwnam_r_proto" in
13715         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13716         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13717         esac
13718         case "$getpwnam_r_proto" in
13719         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13720         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13721         esac
13722         case "$getpwnam_r_proto" in
13723         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13724         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13725         esac
13726         case "$getpwnam_r_proto" in
13727         ''|0)   d_getpwnam_r=undef
13728                 getpwnam_r_proto=0
13729                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13730         * )     case "$getpwnam_r_proto" in
13731                 REENTRANT_PROTO*) ;;
13732                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13733                 esac
13734                 echo "Prototype: $try" ;;
13735         esac
13736         ;;
13737         *)      case "$usethreads" in
13738                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13739                 esac
13740                 d_getpwnam_r=undef
13741                 getpwnam_r_proto=0
13742                 ;;
13743         esac
13744         ;;
13745 *)      getpwnam_r_proto=0
13746         ;;
13747 esac
13748
13749 : see if getpwuid_r exists
13750 set getpwuid_r d_getpwuid_r
13751 eval $inlibc
13752 case "$d_getpwuid_r" in
13753 "$define")
13754         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13755         case "$d_getpwuid_r_proto:$usethreads" in
13756         ":define")      d_getpwuid_r_proto=define
13757                 set d_getpwuid_r_proto getpwuid_r $hdrs
13758                 eval $hasproto ;;
13759         *)      ;;
13760         esac
13761         case "$d_getpwuid_r_proto" in
13762         define)
13763         case "$getpwuid_r_proto" in
13764         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13765         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13766         esac
13767         case "$getpwuid_r_proto" in
13768         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13769         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13770         esac
13771         case "$getpwuid_r_proto" in
13772         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13773         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13774         esac
13775         case "$getpwuid_r_proto" in
13776         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13777         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13778         esac
13779         case "$getpwuid_r_proto" in
13780         ''|0)   d_getpwuid_r=undef
13781                 getpwuid_r_proto=0
13782                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13783         * )     case "$getpwuid_r_proto" in
13784                 REENTRANT_PROTO*) ;;
13785                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13786                 esac
13787                 echo "Prototype: $try" ;;
13788         esac
13789         ;;
13790         *)      case "$usethreads" in
13791                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13792                 esac
13793                 d_getpwuid_r=undef
13794                 getpwuid_r_proto=0
13795                 ;;
13796         esac
13797         ;;
13798 *)      getpwuid_r_proto=0
13799         ;;
13800 esac
13801
13802
13803 : see if getservbyname exists
13804 set getservbyname d_getsbyname
13805 eval $inlibc
13806
13807 : see if getservbyport exists
13808 set getservbyport d_getsbyport
13809 eval $inlibc
13810
13811 : see if getservent exists
13812 set getservent d_getsent
13813 eval $inlibc
13814
13815 : see if getservbyname_r exists
13816 set getservbyname_r d_getservbyname_r
13817 eval $inlibc
13818 case "$d_getservbyname_r" in
13819 "$define")
13820         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13821         case "$d_getservbyname_r_proto:$usethreads" in
13822         ":define")      d_getservbyname_r_proto=define
13823                 set d_getservbyname_r_proto getservbyname_r $hdrs
13824                 eval $hasproto ;;
13825         *)      ;;
13826         esac
13827         case "$d_getservbyname_r_proto" in
13828         define)
13829         case "$getservbyname_r_proto" in
13830         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13831         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13832         esac
13833         case "$getservbyname_r_proto" in
13834         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13835         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13836         esac
13837         case "$getservbyname_r_proto" in
13838         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13839         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13840         esac
13841         case "$getservbyname_r_proto" in
13842         ''|0)   d_getservbyname_r=undef
13843                 getservbyname_r_proto=0
13844                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13845         * )     case "$getservbyname_r_proto" in
13846                 REENTRANT_PROTO*) ;;
13847                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13848                 esac
13849                 echo "Prototype: $try" ;;
13850         esac
13851         ;;
13852         *)      case "$usethreads" in
13853                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13854                 esac
13855                 d_getservbyname_r=undef
13856                 getservbyname_r_proto=0
13857                 ;;
13858         esac
13859         ;;
13860 *)      getservbyname_r_proto=0
13861         ;;
13862 esac
13863
13864 : see if getservbyport_r exists
13865 set getservbyport_r d_getservbyport_r
13866 eval $inlibc
13867 case "$d_getservbyport_r" in
13868 "$define")
13869         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13870         case "$d_getservbyport_r_proto:$usethreads" in
13871         ":define")      d_getservbyport_r_proto=define
13872                 set d_getservbyport_r_proto getservbyport_r $hdrs
13873                 eval $hasproto ;;
13874         *)      ;;
13875         esac
13876         case "$d_getservbyport_r_proto" in
13877         define)
13878         case "$getservbyport_r_proto" in
13879         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13880         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13881         esac
13882         case "$getservbyport_r_proto" in
13883         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13884         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13885         esac
13886         case "$getservbyport_r_proto" in
13887         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13888         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13889         esac
13890         case "$getservbyport_r_proto" in
13891         ''|0)   d_getservbyport_r=undef
13892                 getservbyport_r_proto=0
13893                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13894         * )     case "$getservbyport_r_proto" in
13895                 REENTRANT_PROTO*) ;;
13896                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13897                 esac
13898                 echo "Prototype: $try" ;;
13899         esac
13900         ;;
13901         *)      case "$usethreads" in
13902                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13903                 esac
13904                 d_getservbyport_r=undef
13905                 getservbyport_r_proto=0
13906                 ;;
13907         esac
13908         ;;
13909 *)      getservbyport_r_proto=0
13910         ;;
13911 esac
13912
13913 : see if getservent_r exists
13914 set getservent_r d_getservent_r
13915 eval $inlibc
13916 case "$d_getservent_r" in
13917 "$define")
13918         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13919         case "$d_getservent_r_proto:$usethreads" in
13920         ":define")      d_getservent_r_proto=define
13921                 set d_getservent_r_proto getservent_r $hdrs
13922                 eval $hasproto ;;
13923         *)      ;;
13924         esac
13925         case "$d_getservent_r_proto" in
13926         define)
13927         case "$getservent_r_proto" in
13928         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13929         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13930         esac
13931         case "$getservent_r_proto" in
13932         ''|0) try='int getservent_r(struct servent*, char*, int);'
13933         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13934         esac
13935         case "$getservent_r_proto" in
13936         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13937         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13938         esac
13939         case "$getservent_r_proto" in
13940         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13941         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13942         esac
13943         case "$getservent_r_proto" in
13944         ''|0)   d_getservent_r=undef
13945                 getservent_r_proto=0
13946                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13947         * )     case "$getservent_r_proto" in
13948                 REENTRANT_PROTO*) ;;
13949                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13950                 esac
13951                 echo "Prototype: $try" ;;
13952         esac
13953         ;;
13954         *)      case "$usethreads" in
13955                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13956                 esac
13957                 d_getservent_r=undef
13958                 getservent_r_proto=0
13959                 ;;
13960         esac
13961         ;;
13962 *)      getservent_r_proto=0
13963         ;;
13964 esac
13965
13966 : see if prototypes for various getservxxx netdb.h functions are available
13967 echo " "
13968 set d_getservprotos getservent $i_netdb netdb.h
13969 eval $hasproto
13970
13971 : see if getspnam exists
13972 set getspnam d_getspnam
13973 eval $inlibc
13974
13975 : see if this is a shadow.h system
13976 set shadow.h i_shadow
13977 eval $inhdr
13978
13979 : see if getspnam_r exists
13980 set getspnam_r d_getspnam_r
13981 eval $inlibc
13982 case "$d_getspnam_r" in
13983 "$define")
13984         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13985         case "$d_getspnam_r_proto:$usethreads" in
13986         ":define")      d_getspnam_r_proto=define
13987                 set d_getspnam_r_proto getspnam_r $hdrs
13988                 eval $hasproto ;;
13989         *)      ;;
13990         esac
13991         case "$d_getspnam_r_proto" in
13992         define)
13993         case "$getspnam_r_proto" in
13994         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13995         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13996         esac
13997         case "$getspnam_r_proto" in
13998         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13999         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14000         esac
14001         case "$getspnam_r_proto" in
14002         ''|0)   d_getspnam_r=undef
14003                 getspnam_r_proto=0
14004                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14005         * )     case "$getspnam_r_proto" in
14006                 REENTRANT_PROTO*) ;;
14007                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14008                 esac
14009                 echo "Prototype: $try" ;;
14010         esac
14011         ;;
14012         *)      case "$usethreads" in
14013                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14014                 esac
14015                 d_getspnam_r=undef
14016                 getspnam_r_proto=0
14017                 ;;
14018         esac
14019         ;;
14020 *)      getspnam_r_proto=0
14021         ;;
14022 esac
14023
14024 : see if gettimeofday or ftime exists
14025 set gettimeofday d_gettimeod
14026 eval $inlibc
14027 case "$d_gettimeod" in
14028 "$undef")
14029         set ftime d_ftime 
14030         eval $inlibc
14031         ;;
14032 *)
14033         val="$undef"; set d_ftime; eval $setvar
14034         ;;
14035 esac
14036 case "$d_gettimeod$d_ftime" in
14037 "$undef$undef")
14038         echo " "
14039         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14040         ;;
14041 esac
14042
14043 : see if gmtime_r exists
14044 set gmtime_r d_gmtime_r
14045 eval $inlibc
14046 case "$d_gmtime_r" in
14047 "$define")
14048         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14049         case "$d_gmtime_r_proto:$usethreads" in
14050         ":define")      d_gmtime_r_proto=define
14051                 set d_gmtime_r_proto gmtime_r $hdrs
14052                 eval $hasproto ;;
14053         *)      ;;
14054         esac
14055         case "$d_gmtime_r_proto" in
14056         define)
14057         case "$gmtime_r_proto" in
14058         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14059         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14060         esac
14061         case "$gmtime_r_proto" in
14062         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14063         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14064         esac
14065         case "$gmtime_r_proto" in
14066         ''|0)   d_gmtime_r=undef
14067                 gmtime_r_proto=0
14068                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14069         * )     case "$gmtime_r_proto" in
14070                 REENTRANT_PROTO*) ;;
14071                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14072                 esac
14073                 echo "Prototype: $try" ;;
14074         esac
14075         ;;
14076         *)      case "$usethreads" in
14077                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14078                 esac
14079                 d_gmtime_r=undef
14080                 gmtime_r_proto=0
14081                 ;;
14082         esac
14083         ;;
14084 *)      gmtime_r_proto=0
14085         ;;
14086 esac
14087
14088 : see if hasmntopt exists
14089 set hasmntopt d_hasmntopt
14090 eval $inlibc
14091
14092 : see if this is a netinet/in.h or sys/in.h system
14093 set netinet/in.h i_niin sys/in.h i_sysin
14094 eval $inhdr
14095
14096 : see if arpa/inet.h has to be included
14097 set arpa/inet.h i_arpainet
14098 eval $inhdr
14099
14100 : see if htonl --and friends-- exists
14101 val=''
14102 set htonl val
14103 eval $inlibc
14104
14105 : Maybe they are macros.
14106 case "$val" in
14107 $undef)
14108         $cat >htonl.c <<EOM
14109 #include <stdio.h>
14110 #include <sys/types.h>
14111 #$i_niin I_NETINET_IN
14112 #$i_sysin I_SYS_IN
14113 #$i_arpainet I_ARPA_INET
14114 #ifdef I_NETINET_IN
14115 #include <netinet/in.h>
14116 #endif
14117 #ifdef I_SYS_IN
14118 #include <sys/in.h>
14119 #endif
14120 #ifdef I_ARPA_INET
14121 #include <arpa/inet.h>
14122 #endif
14123 #ifdef htonl
14124 printf("Defined as a macro.");
14125 #endif
14126 EOM
14127         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14128         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14129                 val="$define"
14130                 echo "But it seems to be defined as a macro." >&4
14131         fi
14132         $rm -f htonl.?
14133         ;;
14134 esac
14135 set d_htonl
14136 eval $setvar
14137
14138 : see if ilogbl exists
14139 set ilogbl d_ilogbl
14140 eval $inlibc
14141
14142 : index or strchr
14143 echo " "
14144 if set index val -f; eval $csym; $val; then
14145         if set strchr val -f d_strchr; eval $csym; $val; then
14146                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14147                         val="$define"
14148                         vali="$undef"
14149                         echo "strchr() found." >&4
14150                 else
14151                         val="$undef"
14152                         vali="$define"
14153                         echo "index() found." >&4
14154                 fi
14155         else
14156                 val="$undef"
14157                 vali="$define"
14158                 echo "index() found." >&4
14159         fi
14160 else
14161         if set strchr val -f d_strchr; eval $csym; $val; then
14162                 val="$define"
14163                 vali="$undef"
14164                 echo "strchr() found." >&4
14165         else
14166                 echo "No index() or strchr() found!" >&4
14167                 val="$undef"
14168                 vali="$undef"
14169         fi
14170 fi
14171 set d_strchr; eval $setvar
14172 val="$vali"
14173 set d_index; eval $setvar
14174
14175 : check whether inet_aton exists
14176 set inet_aton d_inetaton
14177 eval $inlibc
14178
14179 : Look for isascii
14180 echo " "
14181 $cat >isascii.c <<EOCP
14182 #include <stdio.h>
14183 #include <ctype.h>
14184 #$i_stdlib I_STDLIB
14185 #ifdef I_STDLIB
14186 #include <stdlib.h>
14187 #endif
14188 int main() {
14189         int c = 'A';
14190         if (isascii(c))
14191                 exit(0);
14192         else
14193                 exit(1);
14194 }
14195 EOCP
14196 set isascii
14197 if eval $compile; then
14198         echo "isascii() found." >&4
14199         val="$define"
14200 else
14201         echo "isascii() NOT found." >&4
14202         val="$undef"
14203 fi
14204 set d_isascii
14205 eval $setvar
14206 $rm -f isascii*
14207
14208 : see if isfinite exists
14209 set isfinite d_isfinite
14210 eval $inlibc
14211
14212 : see if isinf exists
14213 set isinf d_isinf
14214 eval $inlibc
14215
14216 : see if isnan exists
14217 set isnan d_isnan
14218 eval $inlibc
14219
14220 : see if isnanl exists
14221 set isnanl d_isnanl
14222 eval $inlibc
14223
14224 : see if killpg exists
14225 set killpg d_killpg
14226 eval $inlibc
14227
14228 : see if lchown exists
14229 echo " "
14230 $cat > try.c <<'EOCP'
14231 /* System header to define __stub macros and hopefully few prototypes,
14232     which can conflict with char lchown(); below.  */
14233 #include <assert.h>
14234 /* Override any gcc2 internal prototype to avoid an error.  */
14235 /* We use char because int might match the return type of a gcc2
14236    builtin and then its argument prototype would still apply.  */
14237 char lchown();
14238 int main() {
14239     /*  The GNU C library defines this for functions which it implements
14240         to always fail with ENOSYS.  Some functions are actually named
14241         something starting with __ and the normal name is an alias.  */
14242 #if defined (__stub_lchown) || defined (__stub___lchown)
14243 choke me
14244 #else
14245 lchown();
14246 #endif
14247 ; return 0; }
14248 EOCP
14249 set try
14250 if eval $compile; then
14251     $echo "lchown() found." >&4
14252     val="$define"
14253 else
14254     $echo "lchown() NOT found." >&4
14255     val="$undef"
14256 fi
14257 set d_lchown
14258 eval $setvar
14259
14260 : See if number of significant digits in a double precision number is known
14261 echo " "
14262 $cat >ldbl_dig.c <<EOM
14263 #$i_limits I_LIMITS
14264 #$i_float I_FLOAT
14265 #ifdef I_LIMITS
14266 #include <limits.h>
14267 #endif
14268 #ifdef I_FLOAT
14269 #include <float.h>
14270 #endif
14271 #ifdef LDBL_DIG
14272 printf("Contains LDBL_DIG");
14273 #endif
14274 EOM
14275 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14276 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14277         echo "LDBL_DIG found." >&4
14278         val="$define"
14279 else
14280         echo "LDBL_DIG NOT found." >&4
14281         val="$undef"
14282 fi
14283 $rm -f ldbl_dig.?
14284 set d_ldbl_dig
14285 eval $setvar
14286
14287 : see if this is a math.h system
14288 set math.h i_math
14289 eval $inhdr
14290
14291 d_libm_lib_version="$undef"
14292 case $i_math in
14293     $define)
14294         : check to see if math.h defines _LIB_VERSION
14295         echo " "
14296         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14297         $cat >try.c <<EOCP
14298 #include <unistd.h>
14299 #include <math.h>
14300 int main (int argc, char *argv[])
14301 {
14302     printf ("%d\n", _LIB_VERSION);
14303     return (0);
14304     } /* main */
14305 EOCP
14306         set try
14307         if eval $compile; then
14308             foo=`$run ./try`
14309             echo "Yes, it does ($foo)" >&4
14310             d_libm_lib_version="$define"
14311         else
14312             echo "No, it does not (probably harmless)\n" >&4
14313             fi
14314         $rm -f try.* try core core.try.*
14315         ;;
14316
14317     esac
14318
14319 : see if link exists
14320 set link d_link
14321 eval $inlibc
14322
14323 : see if localtime_r exists
14324 set localtime_r d_localtime_r
14325 eval $inlibc
14326 case "$d_localtime_r" in
14327 "$define")
14328         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14329         case "$d_localtime_r_proto:$usethreads" in
14330         ":define")      d_localtime_r_proto=define
14331                 set d_localtime_r_proto localtime_r $hdrs
14332                 eval $hasproto ;;
14333         *)      ;;
14334         esac
14335         case "$d_localtime_r_proto" in
14336         define)
14337         case "$localtime_r_proto" in
14338         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14339         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14340         esac
14341         case "$localtime_r_proto" in
14342         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14343         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14344         esac
14345         case "$localtime_r_proto" in
14346         ''|0)   d_localtime_r=undef
14347                 localtime_r_proto=0
14348                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14349         * )     case "$localtime_r_proto" in
14350                 REENTRANT_PROTO*) ;;
14351                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14352                 esac
14353                 echo "Prototype: $try" ;;
14354         esac
14355         ;;
14356         *)      case "$usethreads" in
14357                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14358                 esac
14359                 d_localtime_r=undef
14360                 localtime_r_proto=0
14361                 ;;
14362         esac
14363         ;;
14364 *)      localtime_r_proto=0
14365         ;;
14366 esac
14367
14368 : see if localeconv exists
14369 set localeconv d_locconv
14370 eval $inlibc
14371
14372 : see if lockf exists
14373 set lockf d_lockf
14374 eval $inlibc
14375
14376 : see if prototype for lseek is available
14377 echo " "
14378 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14379 eval $hasproto
14380
14381 : see if lstat exists
14382 set lstat d_lstat
14383 eval $inlibc
14384
14385 : see if madvise exists
14386 set madvise d_madvise
14387 eval $inlibc
14388
14389 : see if malloc_size exists
14390 set malloc_size d_malloc_size
14391 eval $inlibc
14392
14393 : see if malloc_size_good exists
14394 set malloc_good_size d_malloc_good_size
14395 eval $inlibc
14396
14397 : see if mblen exists
14398 set mblen d_mblen
14399 eval $inlibc
14400
14401 : see if mbstowcs exists
14402 set mbstowcs d_mbstowcs
14403 eval $inlibc
14404
14405 : see if mbtowc exists
14406 set mbtowc d_mbtowc
14407 eval $inlibc
14408
14409 : see if memchr exists
14410 set memchr d_memchr
14411 eval $inlibc
14412
14413 : see if memcmp exists
14414 set memcmp d_memcmp
14415 eval $inlibc
14416
14417 : see if memcpy exists
14418 set memcpy d_memcpy
14419 eval $inlibc
14420
14421 : see if memmove exists
14422 set memmove d_memmove
14423 eval $inlibc
14424
14425 : see if memset exists
14426 set memset d_memset
14427 eval $inlibc
14428
14429 : see if mkdir exists
14430 set mkdir d_mkdir
14431 eval $inlibc
14432
14433 : see if mkdtemp exists
14434 set mkdtemp d_mkdtemp
14435 eval $inlibc
14436
14437 : see if mkfifo exists
14438 set mkfifo d_mkfifo
14439 eval $inlibc
14440
14441 : see if mkstemp exists
14442 set mkstemp d_mkstemp
14443 eval $inlibc
14444
14445 : see if mkstemps exists
14446 set mkstemps d_mkstemps
14447 eval $inlibc
14448
14449 : see if mktime exists
14450 set mktime d_mktime
14451 eval $inlibc
14452
14453 : see if this is a sys/mman.h system
14454 set sys/mman.h i_sysmman
14455 eval $inhdr
14456
14457 : see if mmap exists
14458 set mmap d_mmap
14459 eval $inlibc
14460 : see what shmat returns
14461 : default to something harmless
14462 mmaptype='void *'
14463 case "$i_sysmman$d_mmap" in
14464 "$define$define")
14465         $cat >mmap.c <<'END'
14466 #include <sys/mman.h>
14467 void *mmap();
14468 END
14469         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14470                 mmaptype='void *'
14471         else
14472                 mmaptype='caddr_t'
14473         fi
14474         echo "and it returns ($mmaptype)." >&4
14475         ;;
14476 esac
14477
14478
14479
14480 : see if sqrtl exists
14481 set sqrtl d_sqrtl
14482 eval $inlibc
14483
14484 : see if scalbnl exists
14485 set scalbnl d_scalbnl
14486 eval $inlibc
14487
14488 : see if modfl exists
14489 set modfl d_modfl
14490 eval $inlibc
14491
14492 : see if prototype for modfl is available
14493 echo " "
14494 set d_modflproto modfl $i_math math.h
14495 eval $hasproto
14496
14497 d_modfl_pow32_bug="$undef"
14498
14499 case "$d_longdbl$d_modfl" in
14500 $define$define)
14501         $cat <<EOM
14502 Checking to see whether your modfl() is okay for large values...
14503 EOM
14504 $cat >try.c <<EOCP
14505 #include <math.h> 
14506 #include <stdio.h>
14507 EOCP
14508 if $test "X$d_modflproto" != "X$define"; then
14509         $cat >>try.c <<EOCP
14510 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14511 long double modfl (long double, long double *);
14512 EOCP
14513 fi
14514 $cat >>try.c <<EOCP
14515 int main() {
14516     long double nv = 4294967303.15;
14517     long double v, w;
14518     v = modfl(nv, &w);         
14519 #ifdef __GLIBC__
14520     printf("glibc");
14521 #endif
14522     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14523     return 0;
14524 }
14525 EOCP
14526         case "$osname:$gccversion" in
14527         aix:)   saveccflags="$ccflags"
14528                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14529         esac
14530         set try
14531         if eval $compile; then
14532                 foo=`$run ./try`
14533                 case "$foo" in
14534                 *" 4294967303.150000 1.150000 4294967302.000000")
14535                         echo >&4 "Your modfl() is broken for large values."
14536                         d_modfl_pow32_bug="$define"
14537                         case "$foo" in
14538                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14539                         ;;
14540                         esac
14541                         ;;
14542                 *" 4294967303.150000 0.150000 4294967303.000000")
14543                         echo >&4 "Your modfl() seems okay for large values."
14544                         ;;
14545                 *)      echo >&4 "I don't understand your modfl() at all."
14546                         d_modfl="$undef"
14547                         ;;
14548                 esac
14549                 $rm -f try.* try core core.try.*
14550         else
14551                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14552                 d_modfl="$undef"
14553         fi
14554         case "$osname:$gccversion" in
14555         aix:)   ccflags="$saveccflags" ;; # restore
14556         esac
14557         ;;
14558 esac
14559
14560 if $test "$uselongdouble" = "$define"; then
14561     message=""
14562     if $test "$d_sqrtl" != "$define"; then
14563         message="$message sqrtl"
14564     fi
14565     if $test "$d_modfl" != "$define"; then
14566         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14567             echo "You have both aintl and copysignl, so I can emulate modfl."
14568         else
14569             message="$message modfl"
14570         fi
14571     fi
14572     if $test "$d_frexpl" != "$define"; then
14573         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14574             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14575         else
14576             message="$message frexpl"
14577         fi
14578     fi
14579
14580     if $test "$message" != ""; then
14581         $cat <<EOM >&4
14582
14583 *** You requested the use of long doubles but you do not seem to have
14584 *** the following mathematical functions needed for long double support:
14585 ***    $message
14586 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14587 *** Cannot continue, aborting.
14588
14589 EOM
14590
14591         exit 1
14592     fi
14593 fi
14594
14595 : see if mprotect exists
14596 set mprotect d_mprotect
14597 eval $inlibc
14598
14599 : see if msgctl exists
14600 set msgctl d_msgctl
14601 eval $inlibc
14602
14603 : see if msgget exists
14604 set msgget d_msgget
14605 eval $inlibc
14606
14607 : see if msgsnd exists
14608 set msgsnd d_msgsnd
14609 eval $inlibc
14610
14611 : see if msgrcv exists
14612 set msgrcv d_msgrcv
14613 eval $inlibc
14614
14615 : see how much of the 'msg*(2)' library is present.
14616 h_msg=true
14617 echo " "
14618 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14619 *"$undef"*) h_msg=false;;
14620 esac
14621 case "$osname" in
14622 freebsd)
14623     case "`ipcs 2>&1`" in
14624     "SVID messages"*"not configured"*)
14625         echo "Your $osname does not have the msg*(2) configured." >&4
14626         h_msg=false
14627         val="$undef"
14628         set msgctl d_msgctl
14629         eval $setvar
14630         set msgget d_msgget
14631         eval $setvar
14632         set msgsnd d_msgsnd
14633         eval $setvar
14634         set msgrcv d_msgrcv
14635         eval $setvar
14636         ;;
14637     esac
14638     ;;
14639 esac
14640 : we could also check for sys/ipc.h ...
14641 if $h_msg && $test `./findhdr sys/msg.h`; then
14642         echo "You have the full msg*(2) library." >&4
14643         val="$define"
14644 else
14645         echo "You don't have the full msg*(2) library." >&4
14646         val="$undef"
14647 fi
14648 set d_msg
14649 eval $setvar
14650
14651
14652 echo " "
14653 echo "Checking to see if your system supports struct msghdr..." >&4
14654 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14655 eval $hasstruct
14656 case "$d_msghdr_s" in
14657 "$define")      echo "Yes, it does."   ;;
14658 *)              echo "No, it doesn't." ;;
14659 esac
14660
14661
14662 : see if msync exists
14663 set msync d_msync
14664 eval $inlibc
14665
14666 : see if munmap exists
14667 set munmap d_munmap
14668 eval $inlibc
14669
14670 : see if nice exists
14671 set nice d_nice
14672 eval $inlibc
14673
14674 : see if this is a langinfo.h system
14675 set langinfo.h i_langinfo
14676 eval $inhdr
14677
14678 : see if nl_langinfo exists
14679 set nl_langinfo d_nl_langinfo
14680 eval $inlibc
14681
14682 : check for length of character
14683 echo " "
14684 case "$charsize" in
14685 '')
14686         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14687         $cat >try.c <<EOCP
14688 #include <stdio.h>
14689 #$i_stdlib I_STDLIB
14690 #ifdef I_STDLIB
14691 #include <stdlib.h>
14692 #endif
14693 int main()
14694 {
14695     printf("%d\n", (int)sizeof(char));
14696     exit(0);
14697 }
14698 EOCP
14699         set try
14700         if eval $compile_ok; then
14701                 dflt=`$run ./try`
14702         else
14703                 dflt='1'
14704                 echo "(I can't seem to compile the test program.  Guessing...)"
14705         fi
14706         ;;
14707 *)
14708         dflt="$charsize"
14709         ;;
14710 esac
14711 rp="What is the size of a character (in bytes)?"
14712 . ./myread
14713 charsize="$ans"
14714 $rm -f try.c try
14715
14716 : check for volatile keyword
14717 echo " "
14718 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14719 $cat >try.c <<'EOCP'
14720 int main()
14721 {
14722         typedef struct _goo_struct goo_struct;
14723         goo_struct * volatile goo = ((goo_struct *)0);
14724         struct _goo_struct {
14725                 long long_int;
14726                 int reg_int;
14727                 char char_var;
14728         };
14729         typedef unsigned short foo_t;
14730         char *volatile foo;
14731         volatile int bar;
14732         volatile foo_t blech;
14733         foo = foo;
14734 }
14735 EOCP
14736 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14737         val="$define"
14738         echo "Yup, it does."
14739 else
14740         val="$undef"
14741         echo "Nope, it doesn't."
14742 fi
14743 set d_volatile
14744 eval $setvar
14745 $rm -f try.*
14746
14747
14748 echo " "
14749 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14750
14751 case "$use64bitint:$d_quad:$quadtype" in
14752 define:define:?*)
14753         ivtype="$quadtype"
14754         uvtype="$uquadtype"
14755         ivsize=8
14756         uvsize=8
14757         ;;
14758 *)      ivtype="long"
14759         uvtype="unsigned long"
14760         ivsize=$longsize
14761         uvsize=$longsize
14762         ;;
14763 esac
14764
14765 case "$uselongdouble:$d_longdbl" in
14766 define:define)
14767         nvtype="long double"
14768         nvsize=$longdblsize
14769         ;;
14770 *)      nvtype=double
14771         nvsize=$doublesize
14772         ;;
14773 esac
14774
14775 $echo "(IV will be "$ivtype", $ivsize bytes)"
14776 $echo "(UV will be "$uvtype", $uvsize bytes)"
14777 $echo "(NV will be "$nvtype", $nvsize bytes)"
14778
14779 $cat >try.c <<EOCP
14780 #$i_inttypes I_INTTYPES
14781 #ifdef I_INTTYPES
14782 #include <inttypes.h>
14783 #endif
14784 #include <stdio.h>
14785 int main() {
14786 #ifdef INT8
14787    int8_t i =  INT8_MAX;
14788   uint8_t u = UINT8_MAX;
14789   printf("int8_t\n");
14790 #endif
14791 #ifdef INT16
14792    int16_t i =  INT16_MAX;
14793   uint16_t i = UINT16_MAX;
14794   printf("int16_t\n");
14795 #endif
14796 #ifdef INT32
14797    int32_t i =  INT32_MAX;
14798   uint32_t u = UINT32_MAX;
14799   printf("int32_t\n");
14800 #endif
14801 }
14802 EOCP
14803
14804 case "$i8type" in
14805 '')     case "$charsize" in
14806         1)      i8type=char
14807                 u8type="unsigned char"
14808                 i8size=$charsize
14809                 u8size=$charsize
14810                 ;;
14811         esac
14812         ;;
14813 esac
14814 case "$i8type" in
14815 '')     set try -DINT8
14816         if eval $compile; then
14817                 case "`$run ./try`" in
14818                 int8_t) i8type=int8_t
14819                         u8type=uint8_t
14820                         i8size=1
14821                         u8size=1
14822                         ;;
14823                 esac
14824         fi
14825         ;;
14826 esac
14827 case "$i8type" in
14828 '')     if $test $charsize -ge 1; then
14829                 i8type=char
14830                 u8type="unsigned char"
14831                 i8size=$charsize
14832                 u8size=$charsize
14833         fi
14834         ;;
14835 esac
14836
14837 case "$i16type" in
14838 '')     case "$shortsize" in
14839         2)      i16type=short
14840                 u16type="unsigned short"
14841                 i16size=$shortsize
14842                 u16size=$shortsize
14843                 ;;
14844         esac
14845         ;;
14846 esac
14847 case "$i16type" in
14848 '')     set try -DINT16
14849         if eval $compile; then
14850                 case "`$run ./try`" in
14851                 int16_t)
14852                         i16type=int16_t
14853                         u16type=uint16_t
14854                         i16size=2
14855                         u16size=2
14856                         ;;
14857                 esac
14858         fi
14859         ;;
14860 esac
14861 case "$i16type" in
14862 '')     if $test $shortsize -ge 2; then
14863                 i16type=short
14864                 u16type="unsigned short"
14865                 i16size=$shortsize
14866                 u16size=$shortsize
14867         fi
14868         ;;
14869 esac
14870
14871 case "$i32type" in
14872 '')     case "$longsize" in
14873         4)      i32type=long
14874                 u32type="unsigned long"
14875                 i32size=$longsize
14876                 u32size=$longsize
14877                 ;;
14878         *)      case "$intsize" in
14879                 4)      i32type=int
14880                         u32type="unsigned int"
14881                         i32size=$intsize
14882                         u32size=$intsize
14883                         ;;
14884                 esac
14885                 ;;
14886         esac
14887         ;;
14888 esac
14889 case "$i32type" in
14890 '')     set try -DINT32
14891         if eval $compile; then
14892                 case "`$run ./try`" in
14893                 int32_t)
14894                         i32type=int32_t
14895                         u32type=uint32_t
14896                         i32size=4
14897                         u32size=4
14898                         ;;
14899                 esac
14900         fi
14901         ;;
14902 esac
14903 case "$i32type" in
14904 '')     if $test $intsize -ge 4; then
14905                 i32type=int
14906                 u32type="unsigned int"
14907                 i32size=$intsize
14908                 u32size=$intsize
14909         fi
14910         ;;
14911 esac
14912
14913 case "$i64type" in
14914 '')     case "$d_quad:$quadtype" in
14915         define:?*)
14916                 i64type="$quadtype"
14917                 u64type="$uquadtype"
14918                 i64size=8
14919                 u64size=8
14920                 ;;
14921         esac
14922         ;;
14923 esac
14924
14925 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14926 : volatile so that the compiler has to store it out to memory.
14927 if test X"$d_volatile" = X"$define"; then
14928         volatile=volatile
14929 fi
14930 $cat <<EOP >try.c
14931 #include <stdio.h>
14932 #$i_stdlib I_STDLIB
14933 #ifdef I_STDLIB
14934 #include <stdlib.h>
14935 #endif
14936 #include <sys/types.h>
14937 #include <signal.h>
14938 #ifdef SIGFPE
14939 $volatile int bletched = 0;
14940 $signal_t blech(s) int s; { bletched = 1; }
14941 #endif
14942 int main() {
14943     $uvtype u = 0;
14944     $nvtype d;
14945     int     n = 8 * $uvsize;
14946     int     i;
14947 #ifdef SIGFPE
14948     signal(SIGFPE, blech);
14949 #endif
14950
14951     for (i = 0; i < n; i++) {
14952       u = u << 1 | ($uvtype)1;
14953       d = ($nvtype)u;
14954       if (($uvtype)d != u)
14955         break;
14956       if (d <= 0)
14957         break;
14958       d = ($nvtype)(u - 1);
14959       if (($uvtype)d != (u - 1))
14960         break;
14961 #ifdef SIGFPE
14962       if (bletched) {
14963         break;
14964 #endif
14965       } 
14966     }
14967     printf("%d\n", ((i == n) ? -n : i));
14968     exit(0);
14969 }
14970 EOP
14971 set try
14972
14973 d_nv_preserves_uv="$undef"
14974 if eval $compile; then
14975         nv_preserves_uv_bits="`$run ./try`"
14976 fi
14977 case "$nv_preserves_uv_bits" in
14978 \-[1-9]*)       
14979         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14980         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14981         d_nv_preserves_uv="$define"
14982         ;;
14983 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14984         d_nv_preserves_uv="$undef" ;;
14985 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14986         nv_preserves_uv_bits="$undef" ;;
14987 esac
14988
14989 $rm -f try.* try
14990
14991 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14992 : volatile so that the compiler has to store it out to memory.
14993 if test X"$d_volatile" = X"$define"; then
14994         volatile=volatile
14995 fi
14996 $cat <<EOP >try.c
14997 #include <stdio.h>
14998 #$i_stdlib I_STDLIB
14999 #ifdef I_STDLIB
15000 #include <stdlib.h>
15001 #endif
15002 #$i_string I_STRING
15003 #ifdef I_STRING
15004 #  include <string.h>
15005 #else
15006 #  include <strings.h>
15007 #endif
15008 #include <sys/types.h>
15009 #include <signal.h>
15010 #ifdef SIGFPE
15011 $volatile int bletched = 0;
15012 $signal_t blech(s) int s; { bletched = 1; }
15013 #endif
15014
15015 int checkit($nvtype d, char *where) {
15016     unsigned char *p = (char *)&d;
15017     unsigned char *end = p + sizeof(d);
15018     int fail = 0;
15019
15020     while (p < end)
15021         fail += *p++;
15022
15023     if (!fail)
15024         return 0;
15025
15026     p = (char *)&d;
15027     printf("No - %s: 0x", where);
15028     while (p < end)
15029         printf ("%02X", *p++);
15030     printf("\n");
15031     return 1;
15032 }
15033
15034 int main(int argc, char **argv) {
15035     $nvtype d = 0.0;
15036     int fail = 0;
15037     fail += checkit(d, "0.0");
15038
15039     /* The compiler shouldn't be assuming that bletched is 0  */
15040     d = bletched;
15041
15042     fail += checkit(d, "bleched");
15043
15044 #ifdef SIGFPE
15045     signal(SIGFPE, blech);
15046 #endif
15047
15048     /* Paranoia - the compiler should have no way of knowing that ANSI says
15049        that argv[argc] will always be NULL.  Actually, if it did assume this it
15050        would be buggy, as this is C and main() can be called from elsewhere in
15051        the program.  */
15052     d = argv[argc] ? 1 : 0;
15053
15054     if (d) {
15055         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15056     }
15057
15058     fail += checkit(d, "ternary");
15059
15060     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15061
15062     if (d != 0.0) {
15063         printf("No - memset doesn't give 0.0\n");
15064         /* This might just blow up:  */
15065         printf("(gives %g)\n", d);
15066         return 1;
15067     }
15068     
15069 #ifdef SIGFPE
15070     if (bletched) {
15071         printf("No - something bleched\n");
15072         return 1;
15073     }
15074 #endif
15075     if (fail) {
15076       printf("No - %d fail(s)\n", fail);
15077       return 1;
15078     }
15079     printf("Yes\n");
15080     return 0;
15081 }
15082 EOP
15083 set try
15084
15085 d_nv_zero_is_allbits_zero="$undef"
15086 if eval $compile; then
15087     xxx="`$run ./try`"
15088     case "$?" in
15089         0)
15090             case "$xxx" in
15091                 Yes)  cat >&4 <<EOM
15092 0.0 is represented as all bits zero in memory
15093 EOM
15094                     d_nv_zero_is_allbits_zero="$define"
15095                     ;;
15096                 *)  cat >&4 <<EOM
15097 0.0 is not represented as all bits zero in memory
15098 EOM
15099                     d_nv_zero_is_allbits_zero="$undef"
15100                     ;;
15101             esac
15102             ;;
15103         *)  cat >&4 <<EOM
15104 0.0 is not represented as all bits zero in memory
15105 EOM
15106             d_nv_zero_is_allbits_zero="$undef"
15107             ;;
15108     esac
15109 fi
15110
15111 $rm -f try.* try
15112
15113
15114 : check for off64_t
15115 echo " "
15116 echo "Checking to see if you have off64_t..." >&4
15117 $cat >try.c <<EOCP
15118 #include <sys/types.h>
15119 #include <unistd.h>
15120 int main() { off64_t x = 7; }
15121 EOCP
15122 set try
15123 if eval $compile; then
15124         val="$define"
15125         echo "You have off64_t."
15126 else
15127         val="$undef"
15128         echo "You do not have off64_t."
15129         case "$lseeksize" in
15130         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15131         esac
15132 fi
15133 $rm -f try.* try
15134 set d_off64_t
15135 eval $setvar
15136
15137 : how to create joinable pthreads
15138 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15139         echo " "
15140         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15141         $cat >try.c <<'EOCP'
15142 #include <pthread.h>
15143 int main() {
15144     int detachstate = JOINABLE;
15145 }
15146 EOCP
15147         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15148         if eval $compile; then
15149                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15150                 val="$undef" # Yes, undef.
15151                 set d_old_pthread_create_joinable
15152                 eval $setvar
15153                 val=""
15154                 set old_pthread_create_joinable
15155                 eval $setvar
15156         else
15157                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15158                 if eval $compile; then
15159                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15160                         val="$define"
15161                         set d_old_pthread_create_joinable
15162                         eval $setvar
15163                         val=PTHREAD_CREATE_UNDETACHED
15164                         set old_pthread_create_joinable
15165                         eval $setvar
15166                 else            
15167                         set try -DJOINABLE=__UNDETACHED
15168                         if eval $compile; then
15169                                 echo "You seem to use __UNDETACHED." >&4
15170                                 val="$define"
15171                                 set d_old_pthread_create_joinable
15172                                 eval $setvar
15173                                 val=__UNDETACHED
15174                                 set old_pthread_create_joinable
15175                                 eval $setvar
15176                         else
15177                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15178                                 val="$define"
15179                                 set d_old_pthread_create_joinable
15180                                 eval $setvar
15181                                 val=0
15182                                 set old_pthread_create_joinable
15183                                 eval $setvar
15184                         fi
15185                 fi
15186         fi
15187         $rm -f try try.*
15188 else
15189     d_old_pthread_create_joinable="$undef"
15190     old_pthread_create_joinable=""
15191 fi
15192
15193 : see if pause exists
15194 set pause d_pause
15195 eval $inlibc
15196
15197 : see if pipe exists
15198 set pipe d_pipe
15199 eval $inlibc
15200
15201 : see if poll exists
15202 set poll d_poll
15203 eval $inlibc
15204
15205 : see if readlink exists
15206 set readlink d_readlink
15207 eval $inlibc
15208
15209 echo " "
15210 procselfexe=''
15211 val="$undef"
15212 case "$d_readlink" in
15213 "$define")
15214         if $issymlink /proc/self/exe ; then
15215                 $ls -l /proc/self/exe > reflect
15216                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15217                         echo "You have Linux-like /proc/self/exe."
15218                         procselfexe='"/proc/self/exe"'
15219                         val="$define"
15220                 fi
15221         fi
15222         if $issymlink /proc/curproc/file ; then
15223                 $ls -l /proc/curproc/file > reflect
15224                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15225                         echo "You have BSD-like /proc/curproc/file."
15226                         procselfexe='"/proc/curproc/file"'
15227                         val="$define"
15228                 fi
15229         fi
15230         ;;
15231 esac
15232 $rm -f reflect
15233 set d_procselfexe
15234 eval $setvar
15235
15236 : see whether the pthread_atfork exists
15237 $cat >try.c <<EOP
15238 #include <pthread.h>
15239 #include <stdio.h>
15240 int main() {
15241 #ifdef  PTHREAD_ATFORK
15242         pthread_atfork(NULL,NULL,NULL);
15243 #endif
15244 }
15245 EOP
15246
15247 : see if pthread_atfork exists
15248 set try -DPTHREAD_ATFORK
15249 if eval $compile; then
15250     val="$define"
15251 else
15252     val="$undef"
15253 fi
15254 case "$usethreads" in
15255 $define)
15256         case "$val" in
15257         $define) echo 'pthread_atfork found.' >&4        ;;
15258         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15259         esac
15260 esac
15261 set d_pthread_atfork
15262 eval $setvar
15263
15264 : see if pthread_attr_setscope exists
15265 set pthread_attr_setscope d_pthread_attr_setscope
15266 eval $inlibc
15267
15268
15269 : see whether the various POSIXish _yields exist
15270 $cat >try.c <<EOP
15271 #include <pthread.h>
15272 #include <stdio.h>
15273 int main() {
15274 #ifdef SCHED_YIELD
15275         sched_yield();
15276 #else
15277 #ifdef PTHREAD_YIELD
15278         pthread_yield();
15279 #else
15280 #ifdef PTHREAD_YIELD_NULL
15281         pthread_yield(NULL);
15282 #endif
15283 #endif
15284 #endif
15285 }
15286 EOP
15287 : see if sched_yield exists
15288 set try -DSCHED_YIELD
15289 if eval $compile; then
15290     val="$define"
15291     sched_yield='sched_yield()'
15292 else
15293     val="$undef"
15294 fi
15295 case "$usethreads" in
15296 $define)
15297         case "$val" in
15298         $define) echo 'sched_yield() found.' >&4        ;;
15299         *)       echo 'sched_yield() NOT found.' >&4    ;;
15300         esac
15301 esac
15302 set d_sched_yield
15303 eval $setvar
15304
15305 : see if pthread_yield exists
15306 set try -DPTHREAD_YIELD
15307 if eval $compile; then
15308     val="$define"
15309     case "$sched_yield" in
15310     '') sched_yield='pthread_yield()' ;;
15311     esac
15312 else
15313     set try -DPTHREAD_YIELD_NULL
15314     if eval $compile; then
15315         val="$define"
15316         case "$sched_yield" in
15317         '') sched_yield='pthread_yield(NULL)' ;;
15318         esac
15319     else
15320         val="$undef"
15321     fi
15322 fi
15323 case "$usethreads" in
15324 $define)
15325         case "$val" in
15326         $define) echo 'pthread_yield() found.' >&4      ;;
15327         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15328         esac
15329         ;;
15330 esac
15331 set d_pthread_yield
15332 eval $setvar
15333
15334 case "$sched_yield" in
15335 '') sched_yield=undef ;;
15336 esac
15337
15338 $rm -f try try.*
15339
15340 : see if random_r exists
15341 set random_r d_random_r
15342 eval $inlibc
15343 case "$d_random_r" in
15344 "$define")
15345         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15346         case "$d_random_r_proto:$usethreads" in
15347         ":define")      d_random_r_proto=define
15348                 set d_random_r_proto random_r $hdrs
15349                 eval $hasproto ;;
15350         *)      ;;
15351         esac
15352         case "$d_random_r_proto" in
15353         define)
15354         case "$random_r_proto" in
15355         ''|0) try='int random_r(int*, struct random_data*);'
15356         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15357         esac
15358         case "$random_r_proto" in
15359         ''|0) try='int random_r(long*, struct random_data*);'
15360         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15361         esac
15362         case "$random_r_proto" in
15363         ''|0) try='int random_r(struct random_data*, int32_t*);'
15364         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15365         esac
15366         case "$random_r_proto" in
15367         ''|0)   d_random_r=undef
15368                 random_r_proto=0
15369                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15370         * )     case "$random_r_proto" in
15371                 REENTRANT_PROTO*) ;;
15372                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15373                 esac
15374                 echo "Prototype: $try" ;;
15375         esac
15376         ;;
15377         *)      case "$usethreads" in
15378                 define) echo "random_r has no prototype, not using it." >&4 ;;
15379                 esac
15380                 d_random_r=undef
15381                 random_r_proto=0
15382                 ;;
15383         esac
15384         ;;
15385 *)      random_r_proto=0
15386         ;;
15387 esac
15388
15389 : see if readdir and friends exist
15390 set readdir d_readdir
15391 eval $inlibc
15392 set seekdir d_seekdir
15393 eval $inlibc
15394 set telldir d_telldir
15395 eval $inlibc
15396 set rewinddir d_rewinddir
15397 eval $inlibc
15398
15399 : see if readdir64_r exists
15400 set readdir64_r d_readdir64_r
15401 eval $inlibc
15402 case "$d_readdir64_r" in
15403 "$define")
15404         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15405         case "$d_readdir64_r_proto:$usethreads" in
15406         ":define")      d_readdir64_r_proto=define
15407                 set d_readdir64_r_proto readdir64_r $hdrs
15408                 eval $hasproto ;;
15409         *)      ;;
15410         esac
15411         case "$d_readdir64_r_proto" in
15412         define)
15413         case "$readdir64_r_proto" in
15414         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15415         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15416         esac
15417         case "$readdir64_r_proto" in
15418         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15419         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15420         esac
15421         case "$readdir64_r_proto" in
15422         ''|0)   d_readdir64_r=undef
15423                 readdir64_r_proto=0
15424                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15425         * )     case "$readdir64_r_proto" in
15426                 REENTRANT_PROTO*) ;;
15427                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15428                 esac
15429                 echo "Prototype: $try" ;;
15430         esac
15431         ;;
15432         *)      case "$usethreads" in
15433                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15434                 esac
15435                 d_readdir64_r=undef
15436                 readdir64_r_proto=0
15437                 ;;
15438         esac
15439         ;;
15440 *)      readdir64_r_proto=0
15441         ;;
15442 esac
15443
15444 : see if readdir_r exists
15445 set readdir_r d_readdir_r
15446 eval $inlibc
15447 case "$d_readdir_r" in
15448 "$define")
15449         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15450         case "$d_readdir_r_proto:$usethreads" in
15451         ":define")      d_readdir_r_proto=define
15452                 set d_readdir_r_proto readdir_r $hdrs
15453                 eval $hasproto ;;
15454         *)      ;;
15455         esac
15456         case "$d_readdir_r_proto" in
15457         define)
15458         case "$readdir_r_proto" in
15459         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15460         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15461         esac
15462         case "$readdir_r_proto" in
15463         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15464         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15465         esac
15466         case "$readdir_r_proto" in
15467         ''|0)   d_readdir_r=undef
15468                 readdir_r_proto=0
15469                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15470         * )     case "$readdir_r_proto" in
15471                 REENTRANT_PROTO*) ;;
15472                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15473                 esac
15474                 echo "Prototype: $try" ;;
15475         esac
15476         ;;
15477         *)      case "$usethreads" in
15478                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15479                 esac
15480                 d_readdir_r=undef
15481                 readdir_r_proto=0
15482                 ;;
15483         esac
15484         ;;
15485 *)      readdir_r_proto=0
15486         ;;
15487 esac
15488
15489 : see if readv exists
15490 set readv d_readv
15491 eval $inlibc
15492
15493 : see if recvmsg exists
15494 set recvmsg d_recvmsg
15495 eval $inlibc
15496
15497 : see if rename exists
15498 set rename d_rename
15499 eval $inlibc
15500
15501 : see if rmdir exists
15502 set rmdir d_rmdir
15503 eval $inlibc
15504
15505 : see if memory.h is available.
15506 val=''
15507 set memory.h val
15508 eval $inhdr
15509
15510 : See if it conflicts with string.h
15511 case "$val" in
15512 $define)
15513         case "$strings" in
15514         '') ;;
15515         *)
15516                 $cppstdin $cppflags $cppminus < $strings > mem.h
15517                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15518                         echo " "
15519                         echo "We won't be including <memory.h>."
15520                         val="$undef"
15521                 fi
15522                 $rm -f mem.h
15523                 ;;
15524         esac
15525 esac
15526 set i_memory
15527 eval $setvar
15528
15529 : can bcopy handle overlapping blocks?
15530 echo " "
15531 val="$undef"
15532 case "$d_memmove" in
15533 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15534 *)      case "$d_bcopy" in
15535         "$define")
15536                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15537                 $cat >try.c <<EOCP
15538 #$i_memory I_MEMORY
15539 #$i_stdlib I_STDLIB
15540 #$i_string I_STRING
15541 #$i_unistd I_UNISTD
15542 EOCP
15543         $cat >>try.c <<'EOCP'
15544 #include <stdio.h>
15545 #ifdef I_MEMORY
15546 #  include <memory.h>
15547 #endif
15548 #ifdef I_STDLIB
15549 #  include <stdlib.h>
15550 #endif
15551 #ifdef I_STRING
15552 #  include <string.h>
15553 #else
15554 #  include <strings.h>
15555 #endif
15556 #ifdef I_UNISTD
15557 #  include <unistd.h>  /* Needed for NetBSD */
15558 #endif
15559 int main()
15560 {
15561 char buf[128], abc[128];
15562 char *b;
15563 int len;
15564 int off;
15565 int align;
15566
15567 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15568    try to store the string in read-only memory. */
15569 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15570
15571 for (align = 7; align >= 0; align--) {
15572         for (len = 36; len; len--) {
15573                 b = buf+align;
15574                 bcopy(abc, b, len);
15575                 for (off = 1; off <= len; off++) {
15576                         bcopy(b, b+off, len);
15577                         bcopy(b+off, b, len);
15578                         if (bcmp(b, abc, len))
15579                                 exit(1);
15580                 }
15581         }
15582 }
15583 exit(0);
15584 }
15585 EOCP
15586                 set try
15587                 if eval $compile_ok; then
15588                         if ./try 2>/dev/null; then
15589                                 echo "Yes, it can."
15590                                 val="$define"
15591                         else
15592                                 echo "It can't, sorry."
15593                         fi
15594                 else
15595                         echo "(I can't compile the test program, so we'll assume not...)"
15596                 fi
15597                 ;;
15598         esac
15599         $rm -f try.* try core
15600         ;;
15601 esac
15602 set d_safebcpy
15603 eval $setvar
15604
15605 : can memcpy handle overlapping blocks?
15606 echo " "
15607 val="$undef"
15608 case "$d_memmove" in
15609 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15610 *)      case "$d_memcpy" in
15611         "$define")
15612                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15613                 $cat >try.c <<EOCP
15614 #$i_memory I_MEMORY
15615 #$i_stdlib I_STDLIB
15616 #$i_string I_STRING
15617 #$i_unistd I_UNISTD
15618 EOCP
15619         $cat >>try.c <<'EOCP'
15620 #include <stdio.h>
15621 #ifdef I_MEMORY
15622 #  include <memory.h>
15623 #endif
15624 #ifdef I_STDLIB
15625 #  include <stdlib.h>
15626 #endif
15627 #ifdef I_STRING
15628 #  include <string.h>
15629 #else
15630 #  include <strings.h>
15631 #endif
15632 #ifdef I_UNISTD
15633 #  include <unistd.h>  /* Needed for NetBSD */
15634 #endif
15635 int main()
15636 {
15637 char buf[128], abc[128];
15638 char *b;
15639 int len;
15640 int off;
15641 int align;
15642
15643 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15644    try to store the string in read-only memory. */
15645 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15646
15647 for (align = 7; align >= 0; align--) {
15648         for (len = 36; len; len--) {
15649                 b = buf+align;
15650                 memcpy(b, abc, len);
15651                 for (off = 1; off <= len; off++) {
15652                         memcpy(b+off, b, len);
15653                         memcpy(b, b+off, len);
15654                         if (memcmp(b, abc, len))
15655                                 exit(1);
15656                 }
15657         }
15658 }
15659 exit(0);
15660 }
15661 EOCP
15662                 set try
15663                 if eval $compile_ok; then
15664                         if ./try 2>/dev/null; then
15665                                 echo "Yes, it can."
15666                                 val="$define"
15667                         else
15668                                 echo "It can't, sorry."
15669                         fi
15670                 else
15671                         echo "(I can't compile the test program, so we'll assume not...)"
15672                 fi
15673                 ;;
15674         esac
15675         $rm -f try.* try core
15676         ;;
15677 esac
15678 set d_safemcpy
15679 eval $setvar
15680
15681 : can memcmp be trusted to compare relative magnitude?
15682 val="$undef"
15683 case "$d_memcmp" in
15684 "$define")
15685         echo " "
15686         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15687         $cat >try.c <<EOCP
15688 #$i_memory I_MEMORY
15689 #$i_stdlib I_STDLIB
15690 #$i_string I_STRING
15691 #$i_unistd I_UNISTD
15692 EOCP
15693         $cat >>try.c <<'EOCP'
15694 #include <stdio.h>
15695 #ifdef I_MEMORY
15696 #  include <memory.h>
15697 #endif
15698 #ifdef I_STDLIB
15699 #  include <stdlib.h>
15700 #endif
15701 #ifdef I_STRING
15702 #  include <string.h>
15703 #else
15704 #  include <strings.h>
15705 #endif
15706 #ifdef I_UNISTD
15707 #  include <unistd.h>  /* Needed for NetBSD */
15708 #endif
15709 int main()
15710 {
15711 char a = -1;
15712 char b = 0;
15713 if ((a < b) && memcmp(&a, &b, 1) < 0)
15714         exit(1);
15715 exit(0);
15716 }
15717 EOCP
15718         set try
15719         if eval $compile_ok; then
15720                 if $run ./try 2>/dev/null; then
15721                         echo "Yes, it can."
15722                         val="$define"
15723                 else
15724                         echo "No, it can't (it uses signed chars)."
15725                 fi
15726         else
15727                 echo "(I can't compile the test program, so we'll assume not...)"
15728         fi
15729         ;;
15730 esac
15731 $rm -f try.* try core
15732 set d_sanemcmp
15733 eval $setvar
15734
15735 : see if prototype for sbrk is available
15736 echo " "
15737 set d_sbrkproto sbrk $i_unistd unistd.h
15738 eval $hasproto
15739
15740 : see if select exists
15741 set select d_select
15742 eval $inlibc
15743
15744 : see if semctl exists
15745 set semctl d_semctl
15746 eval $inlibc
15747
15748 : see if semget exists
15749 set semget d_semget
15750 eval $inlibc
15751
15752 : see if semop exists
15753 set semop d_semop
15754 eval $inlibc
15755
15756 : see how much of the 'sem*(2)' library is present.
15757 h_sem=true
15758 echo " "
15759 case "$d_semctl$d_semget$d_semop" in
15760 *"$undef"*) h_sem=false;;
15761 esac
15762 case "$osname" in
15763 freebsd)
15764     case "`ipcs 2>&1`" in
15765     "SVID messages"*"not configured"*)
15766         echo "Your $osname does not have the sem*(2) configured." >&4
15767         h_sem=false
15768         val="$undef"
15769         set semctl d_semctl
15770         eval $setvar
15771         set semget d_semget
15772         eval $setvar
15773         set semop d_semop
15774         eval $setvar
15775         ;;
15776     esac
15777     ;;
15778 esac
15779 : we could also check for sys/ipc.h ...
15780 if $h_sem && $test `./findhdr sys/sem.h`; then
15781         echo "You have the full sem*(2) library." >&4
15782         val="$define"
15783 else
15784         echo "You don't have the full sem*(2) library." >&4
15785         val="$undef"
15786 fi
15787 set d_sem
15788 eval $setvar
15789
15790 : see whether sys/sem.h defines union semun
15791 echo " "
15792 $cat > try.c <<'END'
15793 #include <sys/types.h>
15794 #include <sys/ipc.h>
15795 #include <sys/sem.h>
15796 int main () { union semun semun; semun.buf = 0; }
15797 END
15798 set try
15799 if eval $compile; then
15800     echo "You have union semun in <sys/sem.h>." >&4
15801     val="$define"
15802 else
15803     echo "You do not have union semun in <sys/sem.h>." >&4
15804     val="$undef"
15805 fi
15806 $rm -f try try.c
15807 set d_union_semun
15808 eval $setvar
15809
15810 : see how to do semctl IPC_STAT
15811 case "$d_sem" in
15812 $define)
15813     echo " "
15814     $cat > try.h <<END
15815 #ifndef S_IRUSR
15816 #   ifdef S_IREAD
15817 #       define S_IRUSR S_IREAD
15818 #       define S_IWUSR S_IWRITE
15819 #       define S_IXUSR S_IEXEC
15820 #   else
15821 #       define S_IRUSR 0400
15822 #       define S_IWUSR 0200
15823 #       define S_IXUSR 0100
15824 #   endif
15825 #   define S_IRGRP (S_IRUSR>>3)
15826 #   define S_IWGRP (S_IWUSR>>3)
15827 #   define S_IXGRP (S_IXUSR>>3)
15828 #   define S_IROTH (S_IRUSR>>6)
15829 #   define S_IWOTH (S_IWUSR>>6)
15830 #   define S_IXOTH (S_IXUSR>>6)
15831 #endif
15832 #ifndef S_IRWXU
15833 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15834 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15835 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15836 #endif
15837 END
15838     : see whether semctl IPC_STAT can use union semun
15839     case "$d_semctl_semun" in
15840     '')
15841       val="$undef"
15842       $cat > try.c <<END
15843 #include <sys/types.h>
15844 #include <sys/ipc.h>
15845 #include <sys/sem.h>
15846 #include <sys/stat.h>
15847 #include <stdio.h>
15848 #include <errno.h>
15849 #include "try.h"
15850 #ifndef errno
15851 extern int errno;
15852 #endif
15853 #$d_union_semun HAS_UNION_SEMUN
15854 int main() {
15855     union semun
15856 #ifndef HAS_UNION_SEMUN
15857     {
15858         int val;
15859         struct semid_ds *buf;
15860         unsigned short *array;
15861     }
15862 #endif
15863     arg;
15864     int sem, st;
15865
15866 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15867     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15868     if (sem > -1) {
15869         struct semid_ds argbuf;
15870         arg.buf = &argbuf;
15871 #       ifdef IPC_STAT
15872         st = semctl(sem, 0, IPC_STAT, arg);
15873         if (st == 0)
15874             printf("semun\n");
15875         else
15876 #       endif /* IPC_STAT */
15877             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15878 #       ifdef IPC_RMID
15879         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15880 #       endif /* IPC_RMID */
15881             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15882     } else
15883 #endif /* IPC_PRIVATE && ... */
15884         printf("semget failed: errno = %d\n", errno);
15885   return 0;
15886 }
15887 END
15888       set try
15889       if eval $compile; then
15890           xxx=`$run ./try`
15891           case "$xxx" in
15892           semun) val="$define" ;;
15893           esac
15894       fi
15895       $rm -f try try.c
15896       set d_semctl_semun
15897       eval $setvar
15898       ;;
15899     esac
15900     case "$d_semctl_semun" in
15901     $define)
15902         echo "You can use union semun for semctl IPC_STAT." >&4
15903         also='also'
15904         ;;
15905     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15906         also=''
15907         ;;
15908     esac
15909
15910     : see whether semctl IPC_STAT can use struct semid_ds pointer
15911     case "$d_semctl_semid_ds" in
15912     '')
15913       val="$undef"
15914       $cat > try.c <<'END'
15915 #include <sys/types.h>
15916 #include <sys/ipc.h>
15917 #include <sys/sem.h>
15918 #include <sys/stat.h>
15919 #include "try.h"
15920 #include <stdio.h>
15921 #include <errno.h>
15922 #ifndef errno
15923 extern int errno;
15924 #endif
15925 int main() {
15926     struct semid_ds arg;
15927     int sem, st;
15928
15929 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15930     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15931     if (sem > -1) {
15932 #       ifdef IPC_STAT
15933         st = semctl(sem, 0, IPC_STAT, &arg);
15934         if (st == 0)
15935             printf("semid_ds\n");
15936         else
15937 #       endif /* IPC_STAT */
15938             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15939 #       ifdef IPC_RMID
15940         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15941 #       endif /* IPC_RMID */
15942             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15943     } else
15944 #endif /* IPC_PRIVATE && ... */
15945         printf("semget failed: errno = %d\n", errno);
15946
15947     return 0;
15948 }
15949 END
15950       set try
15951       if eval $compile; then
15952           xxx=`$run ./try`
15953           case "$xxx" in
15954           semid_ds) val="$define" ;;
15955           esac
15956       fi
15957       $rm -f try try.c
15958       set d_semctl_semid_ds
15959       eval $setvar
15960       ;;
15961     esac
15962     case "$d_semctl_semid_ds" in
15963     $define)
15964         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15965         ;;
15966     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15967         ;;
15968     esac
15969     $rm -f try.h
15970     ;;
15971 *)  val="$undef"
15972
15973     # We do not have the full sem*(2) library, so assume we can not
15974     # use either.
15975
15976     set d_semctl_semun
15977     eval $setvar
15978
15979     set d_semctl_semid_ds
15980     eval $setvar
15981     ;;
15982 esac
15983
15984 : see if sendmsg exists
15985 set sendmsg d_sendmsg
15986 eval $inlibc
15987
15988 : see if setegid exists
15989 set setegid d_setegid
15990 eval $inlibc
15991
15992 : see if seteuid exists
15993 set seteuid d_seteuid
15994 eval $inlibc
15995
15996 : see if setgrent exists
15997 set setgrent d_setgrent
15998 eval $inlibc
15999
16000 : see if setgrent_r exists
16001 set setgrent_r d_setgrent_r
16002 eval $inlibc
16003 case "$d_setgrent_r" in
16004 "$define")
16005         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16006         case "$d_setgrent_r_proto:$usethreads" in
16007         ":define")      d_setgrent_r_proto=define
16008                 set d_setgrent_r_proto setgrent_r $hdrs
16009                 eval $hasproto ;;
16010         *)      ;;
16011         esac
16012         case "$d_setgrent_r_proto" in
16013         define)
16014         case "$setgrent_r_proto" in
16015         ''|0) try='int setgrent_r(FILE**);'
16016         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16017         esac
16018         case "$setgrent_r_proto" in
16019         ''|0) try='void setgrent_r(FILE**);'
16020         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16021         esac
16022         case "$setgrent_r_proto" in
16023         ''|0)   d_setgrent_r=undef
16024                 setgrent_r_proto=0
16025                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16026         * )     case "$setgrent_r_proto" in
16027                 REENTRANT_PROTO*) ;;
16028                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16029                 esac
16030                 echo "Prototype: $try" ;;
16031         esac
16032         ;;
16033         *)      case "$usethreads" in
16034                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16035                 esac
16036                 d_setgrent_r=undef
16037                 setgrent_r_proto=0
16038                 ;;
16039         esac
16040         ;;
16041 *)      setgrent_r_proto=0
16042         ;;
16043 esac
16044
16045 : see if sethostent exists
16046 set sethostent d_sethent
16047 eval $inlibc
16048
16049 : see if sethostent_r exists
16050 set sethostent_r d_sethostent_r
16051 eval $inlibc
16052 case "$d_sethostent_r" in
16053 "$define")
16054         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16055         case "$d_sethostent_r_proto:$usethreads" in
16056         ":define")      d_sethostent_r_proto=define
16057                 set d_sethostent_r_proto sethostent_r $hdrs
16058                 eval $hasproto ;;
16059         *)      ;;
16060         esac
16061         case "$d_sethostent_r_proto" in
16062         define)
16063         case "$sethostent_r_proto" in
16064         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16065         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16066         esac
16067         case "$sethostent_r_proto" in
16068         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16069         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16070         esac
16071         case "$sethostent_r_proto" in
16072         ''|0)   d_sethostent_r=undef
16073                 sethostent_r_proto=0
16074                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16075         * )     case "$sethostent_r_proto" in
16076                 REENTRANT_PROTO*) ;;
16077                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16078                 esac
16079                 echo "Prototype: $try" ;;
16080         esac
16081         ;;
16082         *)      case "$usethreads" in
16083                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16084                 esac
16085                 d_sethostent_r=undef
16086                 sethostent_r_proto=0
16087                 ;;
16088         esac
16089         ;;
16090 *)      sethostent_r_proto=0
16091         ;;
16092 esac
16093
16094 : see if setitimer exists
16095 set setitimer d_setitimer
16096 eval $inlibc
16097
16098 : see if setlinebuf exists
16099 set setlinebuf d_setlinebuf
16100 eval $inlibc
16101
16102 : see if setlocale exists
16103 set setlocale d_setlocale
16104 eval $inlibc
16105
16106 : see if locale.h is available
16107 set locale.h i_locale
16108 eval $inhdr
16109
16110 : see if setlocale_r exists
16111 set setlocale_r d_setlocale_r
16112 eval $inlibc
16113 case "$d_setlocale_r" in
16114 "$define")
16115         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16116         case "$d_setlocale_r_proto:$usethreads" in
16117         ":define")      d_setlocale_r_proto=define
16118                 set d_setlocale_r_proto setlocale_r $hdrs
16119                 eval $hasproto ;;
16120         *)      ;;
16121         esac
16122         case "$d_setlocale_r_proto" in
16123         define)
16124         case "$setlocale_r_proto" in
16125         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16126         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16127         esac
16128         case "$setlocale_r_proto" in
16129         ''|0)   d_setlocale_r=undef
16130                 setlocale_r_proto=0
16131                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16132         * )     case "$setlocale_r_proto" in
16133                 REENTRANT_PROTO*) ;;
16134                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16135                 esac
16136                 echo "Prototype: $try" ;;
16137         esac
16138         ;;
16139         *)      case "$usethreads" in
16140                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16141                 esac
16142                 d_setlocale_r=undef
16143                 setlocale_r_proto=0
16144                 ;;
16145         esac
16146         ;;
16147 *)      setlocale_r_proto=0
16148         ;;
16149 esac
16150
16151 : see if setnetent exists
16152 set setnetent d_setnent
16153 eval $inlibc
16154
16155 : see if setnetent_r exists
16156 set setnetent_r d_setnetent_r
16157 eval $inlibc
16158 case "$d_setnetent_r" in
16159 "$define")
16160         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16161         case "$d_setnetent_r_proto:$usethreads" in
16162         ":define")      d_setnetent_r_proto=define
16163                 set d_setnetent_r_proto setnetent_r $hdrs
16164                 eval $hasproto ;;
16165         *)      ;;
16166         esac
16167         case "$d_setnetent_r_proto" in
16168         define)
16169         case "$setnetent_r_proto" in
16170         ''|0) try='int setnetent_r(int, struct netent_data*);'
16171         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16172         esac
16173         case "$setnetent_r_proto" in
16174         ''|0) try='void setnetent_r(int, struct netent_data*);'
16175         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16176         esac
16177         case "$setnetent_r_proto" in
16178         ''|0)   d_setnetent_r=undef
16179                 setnetent_r_proto=0
16180                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16181         * )     case "$setnetent_r_proto" in
16182                 REENTRANT_PROTO*) ;;
16183                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16184                 esac
16185                 echo "Prototype: $try" ;;
16186         esac
16187         ;;
16188         *)      case "$usethreads" in
16189                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16190                 esac
16191                 d_setnetent_r=undef
16192                 setnetent_r_proto=0
16193                 ;;
16194         esac
16195         ;;
16196 *)      setnetent_r_proto=0
16197         ;;
16198 esac
16199
16200 : see if setprotoent exists
16201 set setprotoent d_setpent
16202 eval $inlibc
16203
16204 : see if setpgid exists
16205 set setpgid d_setpgid
16206 eval $inlibc
16207
16208 : see if setpgrp2 exists
16209 set setpgrp2 d_setpgrp2
16210 eval $inlibc
16211
16212 : see if setpriority exists
16213 set setpriority d_setprior
16214 eval $inlibc
16215
16216 : see if setproctitle exists
16217 set setproctitle d_setproctitle
16218 eval $inlibc
16219
16220 : see if setprotoent_r exists
16221 set setprotoent_r d_setprotoent_r
16222 eval $inlibc
16223 case "$d_setprotoent_r" in
16224 "$define")
16225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16226         case "$d_setprotoent_r_proto:$usethreads" in
16227         ":define")      d_setprotoent_r_proto=define
16228                 set d_setprotoent_r_proto setprotoent_r $hdrs
16229                 eval $hasproto ;;
16230         *)      ;;
16231         esac
16232         case "$d_setprotoent_r_proto" in
16233         define)
16234         case "$setprotoent_r_proto" in
16235         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16236         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16237         esac
16238         case "$setprotoent_r_proto" in
16239         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16240         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16241         esac
16242         case "$setprotoent_r_proto" in
16243         ''|0)   d_setprotoent_r=undef
16244                 setprotoent_r_proto=0
16245                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16246         * )     case "$setprotoent_r_proto" in
16247                 REENTRANT_PROTO*) ;;
16248                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16249                 esac
16250                 echo "Prototype: $try" ;;
16251         esac
16252         ;;
16253         *)      case "$usethreads" in
16254                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16255                 esac
16256                 d_setprotoent_r=undef
16257                 setprotoent_r_proto=0
16258                 ;;
16259         esac
16260         ;;
16261 *)      setprotoent_r_proto=0
16262         ;;
16263 esac
16264
16265 : see if setpwent exists
16266 set setpwent d_setpwent
16267 eval $inlibc
16268
16269 : see if setpwent_r exists
16270 set setpwent_r d_setpwent_r
16271 eval $inlibc
16272 case "$d_setpwent_r" in
16273 "$define")
16274         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16275         case "$d_setpwent_r_proto:$usethreads" in
16276         ":define")      d_setpwent_r_proto=define
16277                 set d_setpwent_r_proto setpwent_r $hdrs
16278                 eval $hasproto ;;
16279         *)      ;;
16280         esac
16281         case "$d_setpwent_r_proto" in
16282         define)
16283         case "$setpwent_r_proto" in
16284         ''|0) try='int setpwent_r(FILE**);'
16285         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16286         esac
16287         case "$setpwent_r_proto" in
16288         ''|0) try='void setpwent_r(FILE**);'
16289         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16290         esac
16291         case "$setpwent_r_proto" in
16292         ''|0)   d_setpwent_r=undef
16293                 setpwent_r_proto=0
16294                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16295         * )     case "$setpwent_r_proto" in
16296                 REENTRANT_PROTO*) ;;
16297                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16298                 esac
16299                 echo "Prototype: $try" ;;
16300         esac
16301         ;;
16302         *)      case "$usethreads" in
16303                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16304                 esac
16305                 d_setpwent_r=undef
16306                 setpwent_r_proto=0
16307                 ;;
16308         esac
16309         ;;
16310 *)      setpwent_r_proto=0
16311         ;;
16312 esac
16313
16314 : see if setregid exists
16315 set setregid d_setregid
16316 eval $inlibc
16317 set setresgid d_setresgid
16318 eval $inlibc
16319
16320 : see if setreuid exists
16321 set setreuid d_setreuid
16322 eval $inlibc
16323 set setresuid d_setresuid
16324 eval $inlibc
16325
16326 : see if setrgid exists
16327 set setrgid d_setrgid
16328 eval $inlibc
16329
16330 : see if setruid exists
16331 set setruid d_setruid
16332 eval $inlibc
16333
16334 : see if setservent exists
16335 set setservent d_setsent
16336 eval $inlibc
16337
16338 : see if setservent_r exists
16339 set setservent_r d_setservent_r
16340 eval $inlibc
16341 case "$d_setservent_r" in
16342 "$define")
16343         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16344         case "$d_setservent_r_proto:$usethreads" in
16345         ":define")      d_setservent_r_proto=define
16346                 set d_setservent_r_proto setservent_r $hdrs
16347                 eval $hasproto ;;
16348         *)      ;;
16349         esac
16350         case "$d_setservent_r_proto" in
16351         define)
16352         case "$setservent_r_proto" in
16353         ''|0) try='int setservent_r(int, struct servent_data*);'
16354         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16355         esac
16356         case "$setservent_r_proto" in
16357         ''|0) try='void setservent_r(int, struct servent_data*);'
16358         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16359         esac
16360         case "$setservent_r_proto" in
16361         ''|0)   d_setservent_r=undef
16362                 setservent_r_proto=0
16363                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16364         * )     case "$setservent_r_proto" in
16365                 REENTRANT_PROTO*) ;;
16366                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16367                 esac
16368                 echo "Prototype: $try" ;;
16369         esac
16370         ;;
16371         *)      case "$usethreads" in
16372                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16373                 esac
16374                 d_setservent_r=undef
16375                 setservent_r_proto=0
16376                 ;;
16377         esac
16378         ;;
16379 *)      setservent_r_proto=0
16380         ;;
16381 esac
16382
16383 : see if setsid exists
16384 set setsid d_setsid
16385 eval $inlibc
16386
16387 : see if setvbuf exists
16388 set setvbuf d_setvbuf
16389 eval $inlibc
16390
16391 : see if sfio.h is available
16392 set sfio.h i_sfio
16393 eval $inhdr
16394
16395
16396 : see if sfio library is available
16397 case "$i_sfio" in
16398 $define)
16399         val=''
16400         set sfreserve val
16401         eval $inlibc
16402         ;;
16403 *)
16404         val="$undef"
16405         ;;
16406 esac
16407 : Ok, but do we want to use it.
16408 case "$val" in
16409 $define)
16410         case "$usesfio" in
16411         true|$define|[yY]*) dflt='y';;
16412         *) dflt='n';;
16413         esac
16414         echo "$package can use the sfio library, but it is experimental."
16415         case "$useperlio" in
16416         "$undef")
16417             echo "For sfio also the PerlIO abstraction layer is needed."
16418             echo "Earlier you said you wouldn't want that."
16419             ;;
16420         esac
16421         rp="You seem to have sfio available, do you want to try using it?"
16422         . ./myread
16423         case "$ans" in
16424         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16425                 useperlio="$define"
16426                 val="$define"
16427                 ;;
16428         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16429                 val="$undef"
16430                 ;;
16431         esac
16432         ;;
16433 *)      case "$usesfio" in
16434         true|$define|[yY]*)
16435                 echo "Sorry, cannot find sfio on this machine." >&4
16436                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16437                 val="$undef"
16438                 ;;
16439         esac
16440         ;;
16441 esac
16442 set d_sfio
16443 eval $setvar
16444 case "$d_sfio" in
16445 $define) usesfio='true';;
16446 *) usesfio='false';;
16447 esac
16448 case "$d_sfio" in
16449 $define) ;;
16450 *)      : Remove sfio from list of libraries to use
16451         case "$libs" in
16452         *-lsfio*)
16453                 echo "Removing unneeded -lsfio from library list" >&4
16454                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16455                 shift
16456                 libs="$*"
16457                 echo "libs = $libs" >&4
16458                 ;;
16459         esac
16460 ;;
16461 esac
16462
16463
16464 : see if shmctl exists
16465 set shmctl d_shmctl
16466 eval $inlibc
16467
16468 : see if shmget exists
16469 set shmget d_shmget
16470 eval $inlibc
16471
16472 : see if shmat exists
16473 set shmat d_shmat
16474 eval $inlibc
16475 : see what shmat returns
16476 case "$d_shmat" in
16477 "$define")
16478         $cat >shmat.c <<'END'
16479 #include <sys/shm.h>
16480 void *shmat();
16481 END
16482         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16483                 shmattype='void *'
16484         else
16485                 shmattype='char *'
16486         fi
16487         echo "and it returns ($shmattype)." >&4
16488         : see if a prototype for shmat is available
16489         xxx=`./findhdr sys/shm.h`
16490         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16491         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16492                 val="$define"
16493         else
16494                 val="$undef"
16495         fi
16496         $rm -f shmat.[co]
16497         ;;
16498 *)
16499         val="$undef"
16500         ;;
16501 esac
16502 set d_shmatprototype
16503 eval $setvar
16504
16505 : see if shmdt exists
16506 set shmdt d_shmdt
16507 eval $inlibc
16508
16509 : see how much of the 'shm*(2)' library is present.
16510 h_shm=true
16511 echo " "
16512 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16513 *"$undef"*) h_shm=false;;
16514 esac
16515 case "$osname" in
16516 freebsd)
16517     case "`ipcs 2>&1`" in
16518     "SVID shared memory"*"not configured"*)
16519         echo "Your $osname does not have the shm*(2) configured." >&4
16520         h_shm=false
16521         val="$undef"
16522         set shmctl d_shmctl
16523         evat $setvar
16524         set shmget d_shmget
16525         evat $setvar
16526         set shmat d_shmat
16527         evat $setvar
16528         set shmdt d_shmdt
16529         evat $setvar
16530         ;;
16531     esac
16532     ;;
16533 esac
16534 : we could also check for sys/ipc.h ...
16535 if $h_shm && $test `./findhdr sys/shm.h`; then
16536         echo "You have the full shm*(2) library." >&4
16537         val="$define"
16538 else
16539         echo "You don't have the full shm*(2) library." >&4
16540         val="$undef"
16541 fi
16542 set d_shm
16543 eval $setvar
16544
16545 echo " "
16546 : see if we have sigaction
16547 if set sigaction val -f d_sigaction; eval $csym; $val; then
16548         echo 'sigaction() found.' >&4
16549         $cat > try.c <<EOP
16550 #include <stdio.h>
16551 #include <sys/types.h>
16552 #include <signal.h>
16553 #$i_stdlib I_STDLIB
16554 #ifdef I_STDLIB
16555 #include <stdlib.h>
16556 #endif
16557 int main()
16558 {
16559     struct sigaction act, oact;
16560     act.sa_flags = 0;
16561     oact.sa_handler = 0;
16562     /* so that act and oact are used */
16563     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16564 }
16565 EOP
16566         set try
16567         if eval $compile_ok; then
16568                 val="$define"
16569         else
16570                 echo "But you don't seem to have a useable struct sigaction." >&4
16571                 val="$undef"
16572         fi
16573 else
16574         echo 'sigaction NOT found.' >&4
16575         val="$undef"
16576 fi
16577 set d_sigaction; eval $setvar
16578 $rm -f try try$_o try.c
16579
16580 : see if sigprocmask exists
16581 set sigprocmask d_sigprocmask
16582 eval $inlibc
16583
16584 : see if sigsetjmp exists
16585 echo " "
16586 case "$d_sigsetjmp" in
16587 '')
16588         $cat >try.c <<EOP
16589 #include <setjmp.h>
16590 #$i_stdlib I_STDLIB
16591 #ifdef I_STDLIB
16592 #include <stdlib.h>
16593 #endif
16594 sigjmp_buf env;
16595 int set = 1;
16596 int main()
16597 {
16598         if (sigsetjmp(env,1))
16599                 exit(set);
16600         set = 0;
16601         siglongjmp(env, 1);
16602         exit(1);
16603 }
16604 EOP
16605         set try
16606         if eval $compile; then
16607                 if $run ./try >/dev/null 2>&1; then
16608                         echo "POSIX sigsetjmp found." >&4
16609                         val="$define"
16610                 else
16611                         $cat >&4 <<EOM
16612 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16613 I'll ignore them.
16614 EOM
16615                         val="$undef"
16616                 fi
16617         else
16618                 echo "sigsetjmp not found." >&4
16619                 val="$undef"
16620         fi
16621         ;;
16622 *) val="$d_sigsetjmp"
16623         case "$d_sigsetjmp" in
16624         $define) echo "POSIX sigsetjmp found." >&4;;
16625         $undef) echo "sigsetjmp not found." >&4;;
16626         esac
16627         ;;
16628 esac
16629 set d_sigsetjmp
16630 eval $setvar
16631 $rm -f try.c try
16632
16633 : see if snprintf exists
16634 set snprintf d_snprintf
16635 eval $inlibc
16636
16637 : see if vsnprintf exists
16638 set vsnprintf d_vsnprintf
16639 eval $inlibc
16640
16641 case "$d_snprintf-$d_vsnprintf" in
16642 "$define-$define")
16643     $cat <<EOM
16644 Checking whether your snprintf() and vsnprintf() work okay...
16645 EOM
16646     $cat >try.c <<'EOCP'
16647 /* v?snprintf testing logic courtesy of Russ Allbery.
16648  * According to C99:
16649  * - if the buffer is too short it still must be \0-terminated
16650  * - if the buffer is too short the potentially required length
16651  *   must be returned and not -1
16652  * - if the buffer is NULL the potentially required length
16653  *   must be returned and not -1 or core dump
16654  */
16655 #include <stdio.h>
16656 #include <stdarg.h>
16657
16658 char buf[2];
16659
16660 int test (char *format, ...)
16661 {
16662     va_list args;
16663     int count;
16664
16665     va_start (args, format);
16666     count = vsnprintf (buf, sizeof buf, format, args);
16667     va_end (args);
16668     return count;
16669 }
16670
16671 int main ()
16672 {
16673     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16674              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16675 }
16676 EOCP
16677     set try
16678     if eval $compile; then
16679         `$run ./try`
16680         case "$?" in
16681         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16682         *) cat <<EOM >&4
16683 Your snprintf() and snprintf() don't seem to be working okay.
16684 EOM
16685            d_snprintf="$undef"
16686            d_vsnprintf="$undef"
16687            ;;
16688         esac
16689     else
16690         echo "(I can't seem to compile the test program--assuming they don't)"
16691         d_snprintf="$undef"
16692         d_vsnprintf="$undef"
16693     fi
16694     $rm -f try.* try core core.try.*
16695     ;;
16696 esac
16697
16698 : see if sockatmark exists
16699 set sockatmark d_sockatmark
16700 eval $inlibc
16701
16702 : see if prototype for sockatmark is available
16703 echo " "
16704 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16705 eval $hasproto
16706
16707 : see if socks5_init exists
16708 set socks5_init d_socks5_init
16709 eval $inlibc
16710
16711 : see if sprintf returns the length of the string in the buffer as per ANSI
16712 $echo "Checking whether sprintf returns the length of the string..." >&4
16713 $cat <<EOP >try.c
16714 #include <stdio.h>
16715 #$i_stdlib I_STDLIB
16716 #ifdef I_STDLIB
16717 #include <stdlib.h>
16718 #endif
16719 #$i_string I_STRING
16720 #ifdef I_STRING
16721 #  include <string.h>
16722 #else
16723 #  include <strings.h>
16724 #endif
16725 #$i_math I_MATH
16726 #ifdef I_MATH
16727 #include <math.h>
16728 #endif
16729
16730 char buffer[256];
16731
16732 int check (size_t expect, int test) {
16733   size_t got = strlen(buffer);
16734   if (expect == got)
16735     return 0;
16736
16737   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16738        test, buffer);
16739   exit (test);
16740 }
16741
16742 int main(int argc, char **argv) {
16743   int test = 0;
16744
16745   check(sprintf(buffer, ""), ++test);
16746   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16747   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16748
16749   return 0;
16750 }
16751 EOP
16752 set try
16753
16754 d_sprintf_returns_strlen="$undef"
16755 if eval $compile; then
16756     xxx="`$run ./try`"
16757     case "$?" in
16758         0) cat >&4 <<EOM
16759 sprintf returns the length of the string (as ANSI says it should)
16760 EOM
16761         d_sprintf_returns_strlen="$define"
16762         ;;
16763         *) cat >&4 <<EOM
16764 sprintf does not return the length of the string (how old is this system?)
16765 EOM
16766         d_sprintf_returns_strlen="$undef"
16767         ;;
16768     esac
16769 fi
16770
16771 $rm -f try.* try
16772
16773 : see if srand48_r exists
16774 set srand48_r d_srand48_r
16775 eval $inlibc
16776 case "$d_srand48_r" in
16777 "$define")
16778         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16779         case "$d_srand48_r_proto:$usethreads" in
16780         ":define")      d_srand48_r_proto=define
16781                 set d_srand48_r_proto srand48_r $hdrs
16782                 eval $hasproto ;;
16783         *)      ;;
16784         esac
16785         case "$d_srand48_r_proto" in
16786         define)
16787         case "$srand48_r_proto" in
16788         ''|0) try='int srand48_r(long, struct drand48_data*);'
16789         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16790         esac
16791         case "$srand48_r_proto" in
16792         ''|0)   d_srand48_r=undef
16793                 srand48_r_proto=0
16794                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16795         * )     case "$srand48_r_proto" in
16796                 REENTRANT_PROTO*) ;;
16797                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16798                 esac
16799                 echo "Prototype: $try" ;;
16800         esac
16801         ;;
16802         *)      case "$usethreads" in
16803                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16804                 esac
16805                 d_srand48_r=undef
16806                 srand48_r_proto=0
16807                 ;;
16808         esac
16809         ;;
16810 *)      srand48_r_proto=0
16811         ;;
16812 esac
16813
16814 : see if srandom_r exists
16815 set srandom_r d_srandom_r
16816 eval $inlibc
16817 case "$d_srandom_r" in
16818 "$define")
16819         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16820         case "$d_srandom_r_proto:$usethreads" in
16821         ":define")      d_srandom_r_proto=define
16822                 set d_srandom_r_proto srandom_r $hdrs
16823                 eval $hasproto ;;
16824         *)      ;;
16825         esac
16826         case "$d_srandom_r_proto" in
16827         define)
16828         case "$srandom_r_proto" in
16829         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16830         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16831         esac
16832         case "$srandom_r_proto" in
16833         ''|0)   d_srandom_r=undef
16834                 srandom_r_proto=0
16835                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16836         * )     case "$srandom_r_proto" in
16837                 REENTRANT_PROTO*) ;;
16838                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16839                 esac
16840                 echo "Prototype: $try" ;;
16841         esac
16842         ;;
16843         *)      case "$usethreads" in
16844                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16845                 esac
16846                 d_srandom_r=undef
16847                 srandom_r_proto=0
16848                 ;;
16849         esac
16850         ;;
16851 *)      srandom_r_proto=0
16852         ;;
16853 esac
16854
16855 : see if prototype for setresgid is available
16856 echo " "
16857 set d_sresgproto setresgid $i_unistd unistd.h
16858 eval $hasproto
16859
16860 : see if prototype for setresuid is available
16861 echo " "
16862 set d_sresuproto setresuid $i_unistd unistd.h
16863 eval $hasproto
16864
16865 : see if sys/stat.h is available
16866 set sys/stat.h i_sysstat
16867 eval $inhdr
16868
16869
16870 : see if stat knows about block sizes
16871 echo " "
16872 echo "Checking to see if your struct stat has st_blocks field..." >&4
16873 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16874 eval $hasfield
16875
16876
16877 : see if this is a sys/vfs.h system
16878 set sys/vfs.h i_sysvfs
16879 eval $inhdr
16880
16881
16882 : see if this is a sys/statfs.h system
16883 set sys/statfs.h i_sysstatfs
16884 eval $inhdr
16885
16886
16887 echo " "
16888 echo "Checking to see if your system supports struct statfs..." >&4
16889 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
16890 eval $hasstruct
16891 case "$d_statfs_s" in
16892 "$define")      echo "Yes, it does."   ;;
16893 *)              echo "No, it doesn't." ;;
16894 esac
16895
16896
16897
16898 : see if struct statfs knows about f_flags
16899 case "$d_statfs_s" in
16900 define) 
16901         echo " "
16902         echo "Checking to see if your struct statfs has f_flags field..." >&4
16903         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
16904         eval $hasfield
16905         ;;
16906 *)      val="$undef"
16907         set d_statfs_f_flags
16908         eval $setvar
16909         ;;
16910 esac
16911 case "$d_statfs_f_flags" in
16912 "$define")      echo "Yes, it does."   ;;
16913 *)              echo "No, it doesn't." ;;
16914 esac
16915
16916 $cat >&4 <<EOM
16917 Checking how to access stdio streams by file descriptor number...
16918 EOM
16919 case "$stdio_stream_array" in
16920 '')     $cat >try.c <<EOCP
16921 #include <stdio.h>
16922 int main() {
16923   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16924     printf("yes\n");
16925 }
16926 EOCP
16927         for s in _iob __iob __sF
16928         do
16929                 set try -DSTDIO_STREAM_ARRAY=$s
16930                 if eval $compile; then
16931                         case "`$run ./try`" in
16932                         yes)    stdio_stream_array=$s; break ;;
16933                         esac
16934                 fi
16935         done
16936         $rm -f try.* try$exe_ext
16937 esac
16938 case "$stdio_stream_array" in
16939 '')     $cat >&4 <<EOM
16940 I can't figure out how to access stdio streams by file descriptor number.
16941 EOM
16942         d_stdio_stream_array="$undef"
16943         ;;
16944 *)      $cat >&4 <<EOM
16945 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16946 EOM
16947         d_stdio_stream_array="$define"
16948         ;;
16949 esac
16950
16951 : see if strcoll exists
16952 set strcoll d_strcoll
16953 eval $inlibc
16954
16955 : check for structure copying
16956 echo " "
16957 echo "Checking to see if your C compiler can copy structs..." >&4
16958 $cat >try.c <<'EOCP'
16959 int main()
16960 {
16961         struct blurfl {
16962                 int dyick;
16963         } foo, bar;
16964
16965         foo = bar;
16966 }
16967 EOCP
16968 if $cc -c try.c >/dev/null 2>&1 ; then
16969         val="$define"
16970         echo "Yup, it can."
16971 else
16972         val="$undef"
16973         echo "Nope, it can't."
16974 fi
16975 set d_strctcpy
16976 eval $setvar
16977 $rm -f try.*
16978
16979 : see if strerror and/or sys_errlist[] exist
16980 echo " "
16981 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16982     if set strerror val -f d_strerror; eval $csym; $val; then
16983                 echo 'strerror() found.' >&4
16984                 d_strerror="$define"
16985                 d_strerrm='strerror(e)'
16986                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16987                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16988                         d_syserrlst="$define"
16989                 else
16990                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16991                         d_syserrlst="$undef"
16992                 fi
16993     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16994                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16995                 echo 'strerror() found in string header.' >&4
16996                 d_strerror="$define"
16997                 d_strerrm='strerror(e)'
16998                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16999                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17000                                 d_syserrlst="$define"
17001                 else
17002                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17003                         d_syserrlst="$undef"
17004                 fi
17005     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17006                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17007                 d_strerror="$undef"
17008                 d_syserrlst="$define"
17009                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17010     else
17011                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17012                 d_strerror="$undef"
17013                 d_syserrlst="$undef"
17014                 d_strerrm='"unknown"'
17015     fi
17016 fi
17017
17018 : see if strerror_r exists
17019 set strerror_r d_strerror_r
17020 eval $inlibc
17021 case "$d_strerror_r" in
17022 "$define")
17023         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17024         case "$d_strerror_r_proto:$usethreads" in
17025         ":define")      d_strerror_r_proto=define
17026                 set d_strerror_r_proto strerror_r $hdrs
17027                 eval $hasproto ;;
17028         *)      ;;
17029         esac
17030         case "$d_strerror_r_proto" in
17031         define)
17032         case "$strerror_r_proto" in
17033         ''|0) try='int strerror_r(int, char*, size_t);'
17034         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17035         esac
17036         case "$strerror_r_proto" in
17037         ''|0) try='int strerror_r(int, char*, int);'
17038         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17039         esac
17040         case "$strerror_r_proto" in
17041         ''|0) try='char* strerror_r(int, char*, size_t);'
17042         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17043         esac
17044         case "$strerror_r_proto" in
17045         ''|0)   d_strerror_r=undef
17046                 strerror_r_proto=0
17047                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17048         * )     case "$strerror_r_proto" in
17049                 REENTRANT_PROTO*) ;;
17050                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17051                 esac
17052                 echo "Prototype: $try" ;;
17053         esac
17054         ;;
17055         *)      case "$usethreads" in
17056                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17057                 esac
17058                 d_strerror_r=undef
17059                 strerror_r_proto=0
17060                 ;;
17061         esac
17062         ;;
17063 *)      strerror_r_proto=0
17064         ;;
17065 esac
17066
17067 : see if strftime exists
17068 set strftime d_strftime
17069 eval $inlibc
17070
17071 : see if strlcat exists
17072 set strlcat d_strlcat
17073 eval $inlibc
17074
17075 : see if strlcpy exists
17076 set strlcpy d_strlcpy
17077 eval $inlibc
17078
17079 : see if strtod exists
17080 set strtod d_strtod
17081 eval $inlibc
17082
17083 : see if strtol exists
17084 set strtol d_strtol
17085 eval $inlibc
17086
17087 : see if strtold exists
17088 set strtold d_strtold
17089 eval $inlibc
17090
17091 : see if strtoll exists
17092 set strtoll d_strtoll
17093 eval $inlibc
17094
17095 case "$d_longlong-$d_strtoll" in
17096 "$define-$define")
17097         $cat <<EOM
17098 Checking whether your strtoll() works okay...
17099 EOM
17100         $cat >try.c <<'EOCP'
17101 #include <errno.h>
17102 #ifdef __hpux
17103 #define strtoll __strtoll
17104 #endif
17105 #ifdef __EMX__
17106 #define strtoll _strtoll
17107 #endif
17108 #include <stdio.h>
17109 extern long long int strtoll(char *s, char **, int); 
17110 static int bad = 0;
17111 int check(char *s, long long ell, int een) {
17112         long long gll;
17113         errno = 0;
17114         gll = strtoll(s, 0, 10);
17115         if (!((gll == ell) && (errno == een)))
17116                 bad++;
17117 }
17118 int main() {
17119         check(" 1",                                      1LL, 0);
17120         check(" 0",                                      0LL, 0);
17121         check("-1",                                     -1LL, 0);
17122         check("-9223372036854775808", -9223372036854775808LL, 0);
17123         check("-9223372036854775808", -9223372036854775808LL, 0);
17124         check(" 9223372036854775807",  9223372036854775807LL, 0);
17125         check("-9223372036854775808", -9223372036854775808LL, 0);
17126         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17127         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17128         if (!bad)
17129                 printf("ok\n");
17130 }
17131 EOCP
17132         set try
17133         if eval $compile; then
17134                 yyy=`$run ./try`
17135                 case "$yyy" in
17136                 ok) echo "Your strtoll() seems to be working okay." ;;
17137                 *) cat <<EOM >&4
17138 Your strtoll() doesn't seem to be working okay.
17139 EOM
17140                    d_strtoll="$undef"
17141                    ;;
17142                 esac
17143         else
17144                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17145                 d_strtoll="$undef"
17146         fi
17147         ;;
17148 esac
17149
17150 : see if strtoq exists
17151 set strtoq d_strtoq
17152 eval $inlibc
17153
17154 : see if strtoul exists
17155 set strtoul d_strtoul
17156 eval $inlibc
17157
17158 case "$d_strtoul" in
17159 "$define")
17160         $cat <<EOM
17161 Checking whether your strtoul() works okay...
17162 EOM
17163         $cat >try.c <<'EOCP'
17164 #include <errno.h>
17165 #include <stdio.h>
17166 extern unsigned long int strtoul(char *s, char **, int); 
17167 static int bad = 0;
17168 void check(char *s, unsigned long eul, int een) {
17169         unsigned long gul;
17170         errno = 0;
17171         gul = strtoul(s, 0, 10);
17172         if (!((gul == eul) && (errno == een)))
17173                 bad++;
17174 }
17175 int main() {
17176         check(" 1", 1L, 0);
17177         check(" 0", 0L, 0);
17178 EOCP
17179         case "$longsize" in
17180         8)
17181             $cat >>try.c <<'EOCP'
17182         check("18446744073709551615", 18446744073709551615UL, 0);
17183         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17184 #if 0 /* strtoul() for /^-/ strings is undefined. */
17185         check("-1", 18446744073709551615UL, 0);
17186         check("-18446744073709551614", 2, 0);
17187         check("-18446744073709551615", 1, 0);
17188         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17189         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17190 #endif
17191 EOCP
17192                 ;;
17193         4)
17194                     $cat >>try.c <<'EOCP'
17195         check("4294967295", 4294967295UL, 0);
17196         check("4294967296", 4294967295UL, ERANGE);
17197 #if 0 /* strtoul() for /^-/ strings is undefined. */
17198         check("-1", 4294967295UL, 0);
17199         check("-4294967294", 2, 0);
17200         check("-4294967295", 1, 0);
17201         check("-4294967296", 4294967295UL, ERANGE);
17202         check("-4294967297", 4294967295UL, ERANGE);
17203 #endif
17204 EOCP
17205                 ;;
17206         *)
17207 : Should we write these tests to be more portable by sprintf-ing
17208 : ~0 and then manipulating that char string as input for strtol?
17209                 ;;
17210         esac
17211         $cat >>try.c <<'EOCP'
17212         if (!bad)
17213                 printf("ok\n");
17214         return 0;
17215 }
17216 EOCP
17217         set try
17218         if eval $compile; then
17219                 case "`$run ./try`" in
17220                 ok) echo "Your strtoul() seems to be working okay." ;;
17221                 *) cat <<EOM >&4
17222 Your strtoul() doesn't seem to be working okay.
17223 EOM
17224                    d_strtoul="$undef"
17225                    ;;
17226                 esac
17227         fi
17228         ;;
17229 esac
17230
17231 : see if strtoull exists
17232 set strtoull d_strtoull
17233 eval $inlibc
17234
17235 case "$d_longlong-$d_strtoull" in
17236 "$define-$define")
17237         $cat <<EOM
17238 Checking whether your strtoull() works okay...
17239 EOM
17240         $cat >try.c <<'EOCP'
17241 #include <errno.h>
17242 #ifdef __hpux
17243 #define strtoull __strtoull
17244 #endif
17245 #include <stdio.h>
17246 extern unsigned long long int strtoull(char *s, char **, int); 
17247 static int bad = 0;
17248 int check(char *s, long long eull, int een) {
17249         long long gull;
17250         errno = 0;
17251         gull = strtoull(s, 0, 10);
17252         if (!((gull == eull) && (errno == een)))
17253                 bad++;
17254 }
17255 int main() {
17256         check(" 1",                                        1LL, 0);
17257         check(" 0",                                        0LL, 0);
17258         check("18446744073709551615",  18446744073709551615ULL, 0);
17259         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17260 #if 0 /* strtoull() for /^-/ strings is undefined. */
17261         check("-1",                    18446744073709551615ULL, 0);
17262         check("-18446744073709551614",                     2LL, 0);
17263         check("-18446744073709551615",                     1LL, 0);
17264         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17265         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17266 #endif
17267         if (!bad)
17268                 printf("ok\n");
17269 }
17270 EOCP
17271         set try
17272         if eval $compile; then
17273                 case "`$run ./try`" in
17274                 ok) echo "Your strtoull() seems to be working okay." ;;
17275                 *) cat <<EOM >&4
17276 Your strtoull() doesn't seem to be working okay.
17277 EOM
17278                    d_strtoull="$undef"
17279                    ;;
17280                 esac
17281         fi
17282         ;;
17283 esac
17284
17285 : see if strtouq exists
17286 set strtouq d_strtouq
17287 eval $inlibc
17288
17289 case "$d_strtouq" in
17290 "$define")
17291         $cat <<EOM
17292 Checking whether your strtouq() works okay...
17293 EOM
17294         $cat >try.c <<'EOCP'
17295 #include <errno.h>
17296 #include <stdio.h>
17297 extern unsigned long long int strtouq(char *s, char **, int); 
17298 static int bad = 0;
17299 void check(char *s, unsigned long long eull, int een) {
17300         unsigned long long gull;
17301         errno = 0;
17302         gull = strtouq(s, 0, 10);
17303         if (!((gull == eull) && (errno == een)))
17304                 bad++;
17305 }
17306 int main() {
17307         check(" 1",                                        1LL, 0);
17308         check(" 0",                                        0LL, 0);
17309         check("18446744073709551615",  18446744073709551615ULL, 0);
17310         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17311 #if 0 /* strtouq() for /^-/ strings is undefined. */
17312         check("-1",                    18446744073709551615ULL, 0);
17313         check("-18446744073709551614",                     2LL, 0);
17314         check("-18446744073709551615",                     1LL, 0);
17315         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17316         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17317 #endif
17318         if (!bad)
17319                 printf("ok\n");
17320         return 0;
17321 }
17322 EOCP
17323         set try
17324         if eval $compile; then
17325                 case "`$run ./try`" in
17326                 ok) echo "Your strtouq() seems to be working okay." ;;
17327                 *) cat <<EOM >&4
17328 Your strtouq() doesn't seem to be working okay.
17329 EOM
17330                    d_strtouq="$undef"
17331                    ;;
17332                 esac
17333         fi
17334         ;;
17335 esac
17336
17337 : see if strxfrm exists
17338 set strxfrm d_strxfrm
17339 eval $inlibc
17340
17341 : see if symlink exists
17342 set symlink d_symlink
17343 eval $inlibc
17344
17345 : see if syscall exists
17346 set syscall d_syscall
17347 eval $inlibc
17348
17349 : see if prototype for syscall is available
17350 echo " "
17351 set d_syscallproto syscall $i_unistd unistd.h
17352 eval $hasproto
17353
17354 : see if sysconf exists
17355 set sysconf d_sysconf
17356 eval $inlibc
17357
17358 : see if system exists
17359 set system d_system
17360 eval $inlibc
17361
17362 : see if tcgetpgrp exists
17363 set tcgetpgrp d_tcgetpgrp
17364 eval $inlibc
17365
17366 : see if tcsetpgrp exists
17367 set tcsetpgrp d_tcsetpgrp
17368 eval $inlibc
17369
17370 : see if prototype for telldir is available
17371 echo " "
17372 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17373 eval $hasproto
17374
17375 : see if time exists
17376 echo " "
17377 if test "X$d_time" = X -o X"$timetype" = X; then
17378     if set time val -f d_time; eval $csym; $val; then
17379                 echo 'time() found.' >&4
17380                 val="$define"
17381                 rp="What is the type returned by time() on this system?"
17382                 set time_t timetype long stdio.h sys/types.h
17383                 eval $typedef_ask
17384     else
17385                 echo 'time() not found, hope that will do.' >&4
17386                 val="$undef"
17387                 timetype='int';
17388     fi
17389     set d_time
17390     eval $setvar
17391 fi
17392
17393 : see if this is a sys/times.h system
17394 set sys/times.h i_systimes
17395 eval $inhdr
17396
17397 : see if times exists
17398 echo " "
17399 if set times val -f d_times; eval $csym; $val; then
17400         echo 'times() found.' >&4
17401         d_times="$define"
17402         inc=''
17403         case "$i_systimes" in
17404         "$define") inc='sys/times.h';;
17405         esac
17406         rp="What is the type returned by times() on this system?"
17407         set clock_t clocktype long stdio.h sys/types.h $inc
17408         eval $typedef_ask
17409 else
17410         echo 'times() NOT found, hope that will do.' >&4
17411         d_times="$undef"
17412         clocktype='int'
17413 fi
17414
17415 : see if tmpnam_r exists
17416 set tmpnam_r d_tmpnam_r
17417 eval $inlibc
17418 case "$d_tmpnam_r" in
17419 "$define")
17420         hdrs="$i_systypes sys/types.h define stdio.h "
17421         case "$d_tmpnam_r_proto:$usethreads" in
17422         ":define")      d_tmpnam_r_proto=define
17423                 set d_tmpnam_r_proto tmpnam_r $hdrs
17424                 eval $hasproto ;;
17425         *)      ;;
17426         esac
17427         case "$d_tmpnam_r_proto" in
17428         define)
17429         case "$tmpnam_r_proto" in
17430         ''|0) try='char* tmpnam_r(char*);'
17431         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17432         esac
17433         case "$tmpnam_r_proto" in
17434         ''|0)   d_tmpnam_r=undef
17435                 tmpnam_r_proto=0
17436                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17437         * )     case "$tmpnam_r_proto" in
17438                 REENTRANT_PROTO*) ;;
17439                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17440                 esac
17441                 echo "Prototype: $try" ;;
17442         esac
17443         ;;
17444         *)      case "$usethreads" in
17445                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17446                 esac
17447                 d_tmpnam_r=undef
17448                 tmpnam_r_proto=0
17449                 ;;
17450         esac
17451         ;;
17452 *)      tmpnam_r_proto=0
17453         ;;
17454 esac
17455
17456 : see if truncate exists
17457 set truncate d_truncate
17458 eval $inlibc
17459
17460 : see if ttyname_r exists
17461 set ttyname_r d_ttyname_r
17462 eval $inlibc
17463 case "$d_ttyname_r" in
17464 "$define")
17465         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17466         case "$d_ttyname_r_proto:$usethreads" in
17467         ":define")      d_ttyname_r_proto=define
17468                 set d_ttyname_r_proto ttyname_r $hdrs
17469                 eval $hasproto ;;
17470         *)      ;;
17471         esac
17472         case "$d_ttyname_r_proto" in
17473         define)
17474         case "$ttyname_r_proto" in
17475         ''|0) try='int ttyname_r(int, char*, size_t);'
17476         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17477         esac
17478         case "$ttyname_r_proto" in
17479         ''|0) try='int ttyname_r(int, char*, int);'
17480         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17481         esac
17482         case "$ttyname_r_proto" in
17483         ''|0) try='char* ttyname_r(int, char*, int);'
17484         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17485         esac
17486         case "$ttyname_r_proto" in
17487         ''|0)   d_ttyname_r=undef
17488                 ttyname_r_proto=0
17489                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17490         * )     case "$ttyname_r_proto" in
17491                 REENTRANT_PROTO*) ;;
17492                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17493                 esac
17494                 echo "Prototype: $try" ;;
17495         esac
17496         ;;
17497         *)      case "$usethreads" in
17498                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17499                 esac
17500                 d_ttyname_r=undef
17501                 ttyname_r_proto=0
17502                 ;;
17503         esac
17504         ;;
17505 *)      ttyname_r_proto=0
17506         ;;
17507 esac
17508
17509 : see if tzname[] exists
17510 echo " "
17511 if set tzname val -a d_tzname; eval $csym; $val; then
17512         val="$define"
17513         echo 'tzname[] found.' >&4
17514 else
17515         val="$undef"
17516         echo 'tzname[] NOT found.' >&4
17517 fi
17518 set d_tzname
17519 eval $setvar
17520
17521 case "$osname" in
17522 next|rhapsody|darwin) multiarch="$define" ;;
17523 esac
17524 case "$multiarch" in
17525 ''|[nN]*) multiarch="$undef" ;;
17526 esac
17527
17528 : check for ordering of bytes in a UV
17529 echo " "
17530 case "$usecrosscompile$multiarch" in
17531 *$define*)
17532         $cat <<EOM
17533 You seem to be either cross-compiling or doing a multiarchitecture build,
17534 skipping the byteorder check.
17535
17536 EOM
17537         byteorder='ffff'
17538         ;;
17539 *)
17540         case "$byteorder" in
17541         '')
17542                 $cat <<'EOM'
17543 In the following, larger digits indicate more significance.  A big-endian
17544 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17545 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17546 machines may have weird orders like 3412.  A Cray will report 87654321,
17547 an Alpha will report 12345678. If the test program works the default is
17548 probably right.
17549 I'm now running the test program...
17550 EOM
17551                 $cat >try.c <<EOCP
17552 #include <stdio.h>
17553 #$i_stdlib I_STDLIB
17554 #ifdef I_STDLIB
17555 #include <stdlib.h>
17556 #endif
17557 #include <sys/types.h>
17558 typedef $uvtype UV;
17559 int main()
17560 {
17561         int i;
17562         union {
17563                 UV l;
17564                 char c[$uvsize];
17565         } u;
17566
17567         if ($uvsize > 4)
17568                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17569         else
17570                 u.l = (UV)0x04030201;
17571         for (i = 0; i < $uvsize; i++)
17572                 printf("%c", u.c[i]+'0');
17573         printf("\n");
17574         exit(0);
17575 }
17576 EOCP
17577                 xxx_prompt=y
17578                 set try
17579                 if eval $compile && ./try > /dev/null; then
17580                         dflt=`$run ./try`
17581                         case "$dflt" in
17582                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17583                                 echo "(The test program ran ok.)"
17584                                 echo "byteorder=$dflt"
17585                                 xxx_prompt=n
17586                         ;;
17587                         ????|????????) echo "(The test program ran ok.)" ;;
17588                         *) echo "(The test program didn't run right for some reason.)" ;;
17589                         esac
17590                 else
17591                         dflt='4321'
17592                         cat <<'EOM'
17593 (I can't seem to compile the test program.  Guessing big-endian...)
17594 EOM
17595                 fi
17596                 case "$xxx_prompt" in
17597                 y)
17598                         rp="What is the order of bytes in $uvtype?"
17599                         . ./myread
17600                         byteorder="$ans"
17601                         ;;
17602                 *)      byteorder=$dflt
17603                         ;;
17604                 esac
17605                 ;;
17606         esac
17607         $rm -f try.c try
17608         ;;
17609 esac
17610
17611
17612 $cat <<EOM
17613
17614 Checking to see whether you can access character data unalignedly...
17615 EOM
17616 case "$d_u32align" in
17617 '')   $cat >try.c <<EOCP
17618 #include <stdio.h>
17619 #$i_stdlib I_STDLIB
17620 #ifdef I_STDLIB
17621 #include <stdlib.h>
17622 #endif
17623 #define U32 $u32type
17624 #define BYTEORDER 0x$byteorder
17625 #define U8 $u8type
17626 #include <signal.h>
17627 #ifdef SIGBUS
17628 $signal_t bletch(s) int s; { exit(4); }
17629 #endif
17630 int main() {
17631 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17632     U8 buf[8];
17633     U32 *up;
17634     int i;
17635
17636     if (sizeof(U32) != 4) {
17637         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17638         exit(1);
17639     }
17640
17641     fflush(stdout);
17642
17643 #ifdef SIGBUS
17644     signal(SIGBUS, bletch);
17645 #endif
17646
17647     buf[0] = 0;
17648     buf[1] = 0;
17649     buf[2] = 0;
17650     buf[3] = 1;
17651     buf[4] = 0;
17652     buf[5] = 0;
17653     buf[6] = 0;
17654     buf[7] = 1;
17655
17656     for (i = 0; i < 4; i++) {
17657         up = (U32*)(buf + i);
17658         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17659                (*up == 1 << (8*(3-i)))  /* little-endian */
17660               )
17661            )
17662         {
17663             printf("read failed (%x)\n", *up);
17664             exit(2);
17665         }
17666     }
17667
17668     /* write test */
17669     for (i = 0; i < 4; i++) {
17670         up = (U32*)(buf + i);
17671         *up = 0xBeef;
17672         if (*up != 0xBeef) {
17673             printf("write failed (%x)\n", *up);
17674             exit(3);
17675         }
17676     }
17677
17678     exit(0);
17679 #else
17680     printf("1\n");
17681     exit(1);
17682 #endif
17683     return 0;
17684 }
17685 EOCP
17686 set try
17687 if eval $compile_ok; then
17688         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17689         $run ./try 2>&1 >/dev/null
17690         case "$?" in
17691         0)      cat >&4 <<EOM
17692 You can access character data pretty unalignedly.
17693 EOM
17694                 d_u32align="$undef"
17695                 ;;
17696         *)      cat >&4 <<EOM
17697 It seems that you must access character data in an aligned manner.
17698 EOM
17699                 d_u32align="$define"
17700                 ;;
17701         esac
17702 else
17703         rp='Can you access character data at unaligned addresses?'
17704         dflt='n'
17705         . ./myread
17706         case "$ans" in
17707         [yY]*)  d_u32align="$undef"  ;;
17708         *)      d_u32align="$define" ;;
17709         esac
17710 fi
17711 $rm -f core core.try.* try.core
17712 ;;
17713 esac
17714
17715 : see if ualarm exists
17716 set ualarm d_ualarm
17717 eval $inlibc
17718
17719 : see if umask exists
17720 set umask d_umask
17721 eval $inlibc
17722
17723 : see if unordered exists
17724 set unordered d_unordered
17725 eval $inlibc
17726
17727 : see if unsetenv exists
17728 set unsetenv d_unsetenv
17729 eval $inlibc
17730
17731 : see if usleep exists
17732 set usleep d_usleep
17733 eval $inlibc
17734
17735 : see if prototype for usleep is available
17736 echo " "
17737 set d_usleepproto usleep $i_unistd unistd.h
17738 eval $hasproto
17739
17740 : see if ustat exists
17741 set ustat d_ustat
17742 eval $inlibc
17743
17744 : backward compatibility for d_hvfork
17745 if test X$d_hvfork != X; then
17746         d_vfork="$d_hvfork"
17747         d_hvfork=''
17748 fi
17749 : see if there is a vfork
17750 val=''
17751 set vfork val
17752 eval $inlibc
17753
17754 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17755 : perl on Solaris 2.x, and probably elsewhere.
17756 case "$val" in
17757 $define)
17758         echo " "
17759         case "$usevfork" in
17760         false) dflt='n';;
17761         *) dflt='y';;
17762         esac
17763         cat <<'EOM'
17764  
17765 Perl can only use a vfork() that doesn't suffer from strict
17766 restrictions on calling functions or modifying global data in
17767 the child.  For example, glibc-2.1 contains such a vfork()
17768 that is unsuitable.  If your system provides a proper fork()
17769 call, chances are that you do NOT want perl to use vfork().
17770
17771 EOM
17772         rp="Do you still want to use vfork()?"
17773         . ./myread
17774         case "$ans" in
17775         y|Y) ;;
17776         *)
17777                 echo "Ok, we won't use vfork()."
17778                 val="$undef"
17779                 ;;
17780         esac
17781         ;;
17782 esac
17783 set d_vfork
17784 eval $setvar
17785 case "$d_vfork" in
17786 $define) usevfork='true';;
17787 *) usevfork='false';;
17788 esac
17789
17790 : see if closedir exists
17791 set closedir d_closedir
17792 eval $inlibc
17793
17794 case "$d_closedir" in
17795 "$define")
17796         echo " "
17797         echo "Checking whether closedir() returns a status..." >&4
17798         cat > try.c <<EOM
17799 #$i_dirent I_DIRENT             /**/
17800 #$i_sysdir I_SYS_DIR            /**/
17801 #$i_sysndir I_SYS_NDIR          /**/
17802 #$i_systypes I_SYS_TYPES        /**/
17803
17804 #if defined(I_SYS_TYPES)
17805 #include <sys/types.h>
17806 #endif
17807 #if defined(I_DIRENT)
17808 #include <dirent.h>
17809 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17810 #include <sys/dir.h>
17811 #endif
17812 #else
17813 #ifdef I_SYS_NDIR
17814 #include <sys/ndir.h>
17815 #else
17816 #ifdef I_SYS_DIR
17817 #ifdef hp9000s500
17818 #include <ndir.h>       /* may be wrong in the future */
17819 #else
17820 #include <sys/dir.h>
17821 #endif
17822 #endif
17823 #endif
17824 #endif 
17825 int main() { return closedir(opendir(".")); }
17826 EOM
17827         set try
17828         if eval $compile_ok; then
17829                 if $run ./try > /dev/null 2>&1 ; then
17830                         echo "Yes, it does."
17831                         val="$undef"
17832                 else
17833                         echo "No, it doesn't."
17834                         val="$define"
17835                 fi
17836         else
17837                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17838                 val="$define"
17839         fi
17840         ;;
17841 *)
17842         val="$undef";
17843         ;;
17844 esac
17845 set d_void_closedir
17846 eval $setvar
17847 $rm -f try try.*
17848 : see if there is a wait4
17849 set wait4 d_wait4
17850 eval $inlibc
17851
17852 : see if waitpid exists
17853 set waitpid d_waitpid
17854 eval $inlibc
17855
17856 : see if wcstombs exists
17857 set wcstombs d_wcstombs
17858 eval $inlibc
17859
17860 : see if wctomb exists
17861 set wctomb d_wctomb
17862 eval $inlibc
17863
17864 : see if writev exists
17865 set writev d_writev
17866 eval $inlibc
17867
17868 : preserve RCS keywords in files with variable substitution, grrr
17869 Date='$Date'
17870 Id='$Id'
17871 Log='$Log'
17872 RCSfile='$RCSfile'
17873 Revision='$Revision'
17874
17875 : check for alignment requirements
17876 echo " "
17877 case "$usecrosscompile$multiarch" in
17878 *$define*)
17879         $cat <<EOM
17880 You seem to be either cross-compiling or doing a multiarchitecture build,
17881 skipping the memory alignment check.
17882
17883 EOM
17884         case "$alignbytes" in
17885         '') alignbytes=8 ;;
17886         esac
17887         ;;
17888 *)
17889         case "$alignbytes" in
17890         '') echo "Checking alignment constraints..." >&4
17891                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17892                         $cat >try.c <<'EOCP'
17893 typedef long double NV;
17894 EOCP
17895                 else
17896                         $cat >try.c <<'EOCP'
17897 typedef double NV;
17898 EOCP
17899                 fi
17900                 $cat >>try.c <<'EOCP'
17901 #include <stdio.h>
17902 struct foobar {
17903         char foo;
17904         NV bar;
17905 } try_algn;
17906 int main()
17907 {
17908     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17909     return(0);
17910 }
17911 EOCP
17912                 set try
17913                 if eval $compile_ok; then
17914                         dflt=`$run ./try`
17915                 else
17916                         dflt='8'
17917                         echo "(I can't seem to compile the test program...)"
17918                 fi
17919                 ;;
17920         *) dflt="$alignbytes"
17921                 ;;
17922         esac
17923         rp="Doubles must be aligned on a how-many-byte boundary?"
17924         . ./myread
17925         alignbytes="$ans"
17926         $rm -f try.c try
17927         ;;
17928 esac
17929
17930
17931 : set the base revision
17932 baserev=5.0
17933
17934 : how do we concatenate cpp tokens here?
17935 echo " "
17936 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17937 $cat >cpp_stuff.c <<'EOCP'
17938 #define RCAT(a,b)a/**/b
17939 #define ACAT(a,b)a ## b
17940 RCAT(Rei,ser)
17941 ACAT(Cir,cus)
17942 EOCP
17943 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17944 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17945         echo "Oh!  Smells like ANSI's been here." >&4
17946         echo "We can catify or stringify, separately or together!"
17947         cpp_stuff=42
17948 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17949         echo "Ah, yes!  The good old days!" >&4
17950         echo "However, in the good old days we don't know how to stringify and"
17951         echo "catify at the same time."
17952         cpp_stuff=1
17953 else
17954         $cat >&4 <<EOM
17955 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17956 You're going to have to edit the values of CAT[2-5] in config.h...
17957 EOM
17958         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17959 fi
17960 $rm -f cpp_stuff.*
17961
17962 : see if this is a db.h system
17963 set db.h i_db
17964 eval $inhdr
17965
17966 case "$i_db" in
17967 $define)
17968         : Check db version.
17969         echo " "
17970         echo "Checking Berkeley DB version ..." >&4
17971         $cat >try.c <<EOCP
17972 #$d_const HASCONST
17973 #ifndef HASCONST
17974 #define const
17975 #endif
17976 #include <sys/types.h>
17977 #include <stdio.h>
17978 #$i_stdlib I_STDLIB
17979 #ifdef I_STDLIB
17980 #include <stdlib.h>
17981 #endif
17982 #include <db.h>
17983 int main(int argc, char *argv[])
17984 {
17985 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17986     int Major, Minor, Patch ;
17987     unsigned long Version ;
17988     (void)db_version(&Major, &Minor, &Patch) ;
17989     if (argc == 2) {
17990         printf("%d %d %d %d %d %d\n",
17991                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17992                Major, Minor, Patch);
17993         exit(0);
17994     }
17995     printf("You have Berkeley DB Version 2 or greater.\n");
17996
17997     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17998                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17999     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18000                 Major, Minor, Patch) ;
18001
18002     /* check that db.h & libdb are compatible */
18003     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18004         printf("db.h and libdb are incompatible.\n") ;
18005         exit(3);        
18006     }
18007
18008     printf("db.h and libdb are compatible.\n") ;
18009
18010     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18011                 + DB_VERSION_PATCH ;
18012
18013     /* needs to be >= 2.3.4 */
18014     if (Version < 2003004) {
18015     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18016         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18017         exit(2);        
18018     }
18019
18020     exit(0);
18021 #else
18022 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18023     if (argc == 2) {
18024         printf("1 0 0\n");
18025         exit(0);
18026     }
18027     printf("You have Berkeley DB Version 1.\n");
18028     exit(0);    /* DB version < 2: the coast is clear. */
18029 #else
18030     exit(1);    /* <db.h> not Berkeley DB? */
18031 #endif
18032 #endif
18033 }
18034 EOCP
18035         set try
18036         if eval $compile_ok && $run ./try; then
18037                 echo 'Looks OK.' >&4
18038                 set `$run ./try 1`
18039                 db_version_major=$1
18040                 db_version_minor=$2
18041                 db_version_patch=$3
18042         else
18043                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18044                 i_db=$undef
18045                 case " $libs " in
18046                 *"-ldb "*)
18047                         : Remove db from list of libraries to use
18048                         echo "Removing unusable -ldb from library list" >&4
18049                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18050                         shift
18051                         libs="$*"
18052                         echo "libs = $libs" >&4
18053                         ;;
18054                 esac
18055         fi
18056         $rm -f try.*
18057         ;;
18058 esac
18059
18060 case "$i_db" in
18061 define)
18062         : Check the return type needed for hash 
18063         echo " "
18064         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18065         $cat >try.c <<EOCP
18066 #$d_const HASCONST
18067 #ifndef HASCONST
18068 #define const
18069 #endif
18070 #include <sys/types.h>
18071 #include <db.h>
18072
18073 #ifndef DB_VERSION_MAJOR
18074 u_int32_t hash_cb (ptr, size)
18075 const void *ptr;
18076 size_t size;
18077 {
18078 }
18079 HASHINFO info;
18080 int main()
18081 {
18082         info.hash = hash_cb;
18083 }
18084 #endif
18085 EOCP
18086         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18087                 if $contains warning try.out >>/dev/null 2>&1 ; then
18088                         db_hashtype='int'
18089                 else
18090                         db_hashtype='u_int32_t'
18091                 fi
18092         else
18093                 : XXX Maybe we should just give up here.
18094                 db_hashtype=u_int32_t
18095                 $cat try.out >&4
18096                 echo "Help:  I can't seem to compile the db test program." >&4
18097                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18098         fi
18099         $rm -f try.*
18100         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18101         ;;
18102 *)      db_hashtype=u_int32_t
18103         ;;
18104 esac
18105 case "$i_db" in
18106 define)
18107         : Check the return type needed for prefix 
18108         echo " "
18109         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18110         cat >try.c <<EOCP
18111 #$d_const HASCONST
18112 #ifndef HASCONST
18113 #define const
18114 #endif
18115 #include <sys/types.h>
18116 #include <db.h>
18117
18118 #ifndef DB_VERSION_MAJOR
18119 size_t prefix_cb (key1, key2)
18120 const DBT *key1;
18121 const DBT *key2;
18122 {
18123 }
18124 BTREEINFO info;
18125 int main()
18126 {
18127         info.prefix = prefix_cb;
18128 }
18129 #endif
18130 EOCP
18131         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18132                 if $contains warning try.out >>/dev/null 2>&1 ; then
18133                         db_prefixtype='int'
18134                 else
18135                         db_prefixtype='size_t'
18136                 fi
18137         else
18138                 db_prefixtype='size_t'
18139                 : XXX Maybe we should just give up here.
18140                 $cat try.out >&4
18141                 echo "Help:  I can't seem to compile the db test program." >&4
18142                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18143         fi
18144         $rm -f try.*
18145         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18146         ;;
18147 *)      db_prefixtype='size_t'
18148         ;;
18149 esac
18150
18151
18152 : How can we generate normalized random numbers ?
18153 echo " "
18154 echo "Looking for a random number function..." >&4
18155 case "$randfunc" in
18156 '')
18157         if set drand48 val -f; eval $csym; $val; then
18158                 dflt="drand48"
18159                 echo "Good, found drand48()." >&4
18160         elif set random val -f; eval $csym; $val; then
18161                 dflt="random"
18162                 echo "OK, found random()." >&4
18163         else
18164                 dflt="rand"
18165                 echo "Yick, looks like I have to use rand()." >&4
18166         fi
18167         echo " "
18168         ;;
18169 *)
18170         dflt="$randfunc"
18171         ;;
18172 esac
18173 cont=true
18174
18175 case "$ccflags" in
18176 *-Dmy_rand=*|*-Dmy_srand=*)
18177         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18178         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18179         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18180         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18181         ;;
18182 esac
18183
18184 while $test "$cont"; do
18185         rp="Use which function to generate random numbers?"
18186         . ./myread
18187         if $test "$ans" = "$dflt"; then
18188                 : null
18189         else
18190                 randbits=''
18191         fi
18192         randfunc="$ans"
18193         if set $ans val -f; eval $csym; $val; then
18194                 cont=''
18195         else
18196                 dflt=y
18197                 rp="I cannot find function $ans. Use that name anyway?"
18198                 . ./myread
18199                 dflt=rand
18200                 case "$ans" in
18201                         [yY]*) cont='';;
18202                 esac
18203         fi
18204         case "$cont" in
18205         '')
18206                 case "$randfunc" in
18207                 drand48)
18208                         drand01="drand48()"
18209                         seedfunc="srand48"
18210                         randbits=48
18211                         randseedtype=long
18212                         ;;
18213                 rand|random)
18214                         case "$randbits" in
18215                         '')
18216 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18217                                 $cat >try.c <<EOCP
18218 #$i_unistd I_UNISTD
18219 #$i_stdlib I_STDLIB
18220 #include <stdio.h>
18221 #ifdef I_UNISTD
18222 #  include <unistd.h>
18223 #endif
18224 #ifdef I_STDLIB
18225 #  include <stdlib.h>
18226 #endif
18227 int main()
18228 {
18229         register int i;
18230         register unsigned long tmp;
18231         register unsigned long max = 0L;
18232
18233         for (i = 1000; i; i--) {
18234                 tmp = (unsigned long) $randfunc();
18235                 if (tmp > max) max = tmp;
18236         }
18237         for (i = 0; max; i++)
18238                 max /= 2;
18239         printf("%d\n",i);
18240 }
18241 EOCP
18242                                 set try
18243                                 if eval $compile_ok; then
18244                                         dflt=`try`
18245                                 else
18246                                         dflt='?'
18247                                         echo "(I can't seem to compile the test program...)"
18248                                 fi
18249                                 ;;
18250                         *)
18251                                 dflt="$randbits"
18252                                 ;;
18253                         esac
18254                         rp="How many bits does your $randfunc() function produce?"
18255                         . ./myread
18256                         randbits="$ans"
18257                         $rm -f try.c try
18258                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18259                         seedfunc="s$randfunc"
18260                         randseedtype=unsigned
18261                         ;;
18262                 *)
18263                         dflt="31"
18264                         rp="How many bits does your $randfunc() function produce?"
18265                         . ./myread
18266                         randbits="$ans"
18267                         seedfunc="s$randfunc"
18268                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18269                         if set $seedfunc val -f; eval $csym; $val; then
18270                                 echo "(Using $seedfunc() to seed random generator)"
18271                         else
18272                                 echo "(Warning: no $seedfunc() to seed random generator)"
18273                                 seedfunc=rand
18274                         fi
18275                         randseedtype=unsigned
18276                         ;;
18277                 esac
18278                 ;;
18279         esac
18280 done
18281
18282 echo " "
18283 echo "Determining whether or not we are on an EBCDIC system..." >&4
18284 $cat >try.c <<'EOM'
18285 int main()
18286 {
18287   if ('M'==0xd4) return 0;
18288   return 1;
18289 }
18290 EOM
18291
18292 val=$undef
18293 set try
18294 if eval $compile_ok; then
18295         if $run ./try; then
18296                 echo "You seem to speak EBCDIC." >&4
18297                 val="$define"
18298         else
18299                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18300         fi
18301 else
18302         echo "I'm unable to compile the test program." >&4
18303         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18304 fi
18305 $rm -f try try.*
18306 set ebcdic
18307 eval $setvar
18308
18309 echo " "
18310 $cat >&4 <<EOM
18311 Checking how to flush all pending stdio output...
18312 EOM
18313 # I only know how to find the first 32 possibly open files on SunOS.
18314 # See also hints/sunos_4_1.sh and util.c  --AD
18315 case "$osname" in
18316 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18317 esac
18318 $cat >>try.c <<EOCP
18319 #include <stdio.h>
18320 #$i_stdlib I_STDLIB
18321 #ifdef I_STDLIB
18322 #include <stdlib.h>
18323 #endif
18324 #$i_unistd I_UNISTD
18325 #ifdef I_UNISTD
18326 # include <unistd.h>
18327 #endif
18328 #$d_sysconf HAS_SYSCONF
18329 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18330 #ifdef HAS_STDIO_STREAM_ARRAY
18331 # define STDIO_STREAM_ARRAY $stdio_stream_array
18332 #endif
18333 int main() {
18334   FILE* p;
18335   unlink("try.out");
18336   p = fopen("try.out", "w");
18337 #ifdef TRY_FPUTC
18338   fputc('x', p);
18339 #else
18340 # ifdef TRY_FPRINTF
18341   fprintf(p, "x");
18342 # endif
18343 #endif
18344 #ifdef TRY_FFLUSH_NULL
18345   fflush(NULL);
18346 #endif
18347 #ifdef TRY_FFLUSH_ALL
18348   {
18349     long open_max = -1;
18350 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18351     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18352 # else
18353 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18354     open_max = sysconf(_SC_OPEN_MAX);
18355 #  else
18356 #   ifdef FOPEN_MAX
18357     open_max = FOPEN_MAX;
18358 #   else
18359 #    ifdef OPEN_MAX
18360     open_max = OPEN_MAX;
18361 #    else
18362 #     ifdef _NFILE
18363     open_max = _NFILE;
18364 #     endif
18365 #    endif
18366 #   endif
18367 #  endif
18368 # endif 
18369 # ifdef HAS_STDIO_STREAM_ARRAY
18370     if (open_max > 0) {
18371       long i;
18372       for (i = 0; i < open_max; i++)
18373             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18374                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18375                 STDIO_STREAM_ARRAY[i]._flag)
18376                 fflush(&STDIO_STREAM_ARRAY[i]);
18377     }   
18378   }
18379 # endif
18380 #endif
18381   _exit(42);
18382 }
18383 EOCP
18384 : first we have to find out how _not_ to flush
18385 $to try.c
18386 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18387     output=''
18388     set try -DTRY_FPUTC
18389     if eval $compile; then
18390             $run ./try 2>/dev/null
18391             code="$?"
18392             $from try.out
18393             if $test ! -s try.out -a "X$code" = X42; then
18394                 output=-DTRY_FPUTC
18395             fi
18396     fi
18397     case "$output" in
18398     '')
18399             set try -DTRY_FPRINTF
18400             if eval $compile; then
18401                     $run ./try 2>/dev/null
18402                     code="$?"
18403                     $from try.out
18404                     if $test ! -s try.out -a "X$code" = X42; then
18405                         output=-DTRY_FPRINTF
18406                     fi
18407             fi
18408         ;;
18409     esac
18410 fi
18411 : check for fflush NULL behaviour
18412 case "$fflushNULL" in
18413 '')     set try -DTRY_FFLUSH_NULL $output
18414         if eval $compile; then
18415                 $run ./try 2>/dev/null
18416                 code="$?"
18417                 $from try.out
18418                 if $test -s try.out -a "X$code" = X42; then
18419                         fflushNULL="`$cat try.out`"
18420                 else
18421                         if $test "X$code" != X42; then
18422                                 $cat >&4 <<EOM
18423 (If this test failed, don't worry, we'll try another method shortly.)
18424 EOM
18425                         fi
18426                 fi
18427         fi
18428         $rm -f core try.core core.try.*
18429         case "$fflushNULL" in
18430         x)      $cat >&4 <<EOM
18431 Your fflush(NULL) works okay for output streams.
18432 Let's see if it clobbers input pipes...
18433 EOM
18434 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18435 # bug that improperly flushes the input end of pipes.  So we avoid the
18436 # autoflush on fork/system/exec support for now. :-(
18437 $cat >tryp.c <<EOCP
18438 #include <stdio.h>
18439 int
18440 main(int argc, char **argv)
18441 {
18442     char buf[1024];
18443     int i;
18444     char *bp = buf;
18445     while (1) {
18446         while ((i = getc(stdin)) != -1
18447                && (*bp++ = i) != '\n'
18448                && bp < &buf[1024])
18449         /* DO NOTHING */ ;
18450         *bp = '\0';
18451         fprintf(stdout, "%s", buf);
18452         fflush(NULL);
18453         if (i == -1)
18454             return 0;
18455         bp = buf;
18456     }
18457 }
18458 EOCP
18459                 fflushNULL="$define"
18460                 set tryp
18461                 if eval $compile; then
18462                     $rm -f tryp.out
18463                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18464                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18465                        $cat >&4 <<EOM
18466 fflush(NULL) seems to behave okay with input streams.
18467 EOM
18468                         fflushNULL="$define"
18469                     else
18470                         $cat >&4 <<EOM
18471 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18472 EOM
18473                         fflushNULL="$undef"
18474                     fi
18475                 fi
18476                 $rm -f core tryp.c tryp.core core.tryp.*
18477                 ;;
18478         '')     $cat >&4 <<EOM
18479 Your fflush(NULL) isn't working (contrary to ANSI C).
18480 EOM
18481                 fflushNULL="$undef"
18482                 ;;
18483         *)      $cat >&4 <<EOM
18484 Cannot figure out whether your fflush(NULL) works or not.
18485 I'm assuming it doesn't (contrary to ANSI C).
18486 EOM
18487                 fflushNULL="$undef"
18488                 ;;
18489         esac
18490         ;;
18491 $define|true|[yY]*)
18492         fflushNULL="$define"
18493         ;;
18494 *)
18495         fflushNULL="$undef"
18496         ;;
18497 esac
18498 : check explicit looping only if NULL did not work, and if the pipe
18499 : bug does not show up on an explicit flush too
18500 case "$fflushNULL" in
18501 "$undef")
18502         $cat >tryp.c <<EOCP
18503 #include <stdio.h>
18504 int
18505 main(int argc, char **argv)
18506 {
18507     char buf[1024];
18508     int i;
18509     char *bp = buf;
18510     while (1) {
18511         while ((i = getc(stdin)) != -1
18512                && (*bp++ = i) != '\n'
18513                && bp < &buf[1024])
18514         /* DO NOTHING */ ;
18515         *bp = '\0';
18516         fprintf(stdout, "%s", buf);
18517         fflush(stdin);
18518         if (i == -1)
18519             return 0;
18520         bp = buf;
18521     }
18522 }
18523 EOCP
18524         set tryp
18525         if eval $compile; then
18526             $rm -f tryp.out
18527             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18528             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18529                $cat >&4 <<EOM
18530 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18531 EOM
18532                 : now check for fflushall behaviour
18533                 case "$fflushall" in
18534                 '')     set try -DTRY_FFLUSH_ALL $output
18535                         if eval $compile; then
18536                                 $cat >&4 <<EOM
18537 (Now testing the other method--but note that this also may fail.)
18538 EOM
18539                                 $run ./try 2>/dev/null
18540                                 code=$?
18541                                 $from try.out
18542                                 if $test -s try.out -a "X$code" = X42; then
18543                                         fflushall="`$cat try.out`"
18544                                 fi
18545                         fi
18546                         $rm -f core try.core core.try.*
18547                         case "$fflushall" in
18548                         x)      $cat >&4 <<EOM
18549 Whew. Flushing explicitly all the stdio streams works.
18550 EOM
18551                                 fflushall="$define"
18552                                 ;;
18553                         '')     $cat >&4 <<EOM
18554 Sigh. Flushing explicitly all the stdio streams doesn't work.
18555 EOM
18556                                 fflushall="$undef"
18557                                 ;;
18558                         *)      $cat >&4 <<EOM
18559 Cannot figure out whether flushing stdio streams explicitly works or not.
18560 I'm assuming it doesn't.
18561 EOM
18562                                 fflushall="$undef"
18563                                 ;;
18564                         esac
18565                         ;;
18566                 "$define"|true|[yY]*)
18567                         fflushall="$define"
18568                         ;;
18569                 *)
18570                         fflushall="$undef"
18571                         ;;
18572                 esac
18573             else
18574                 $cat >&4 <<EOM
18575 All is futile.  Even fflush(stdin) clobbers input pipes!
18576 EOM
18577                 fflushall="$undef"
18578             fi
18579         else
18580             fflushall="$undef"
18581         fi
18582         $rm -f core tryp.c tryp.core core.tryp.*
18583         ;;
18584 *)      fflushall="$undef"
18585         ;;
18586 esac
18587
18588 case "$fflushNULL$fflushall" in
18589 undefundef)
18590         $cat <<EOM
18591 OK, I give up.  I cannot figure out how to flush pending stdio output.
18592 We won't be flushing handles at all before fork/exec/popen.
18593 EOM
18594         ;;
18595 esac
18596 $rm -f try.* try$exe_ext
18597
18598 : Store the full pathname to the ar program for use in the C program
18599 : Respect a hint or command line value for full_ar.
18600 case "$full_ar" in
18601 '') full_ar=$ar ;;
18602 esac
18603
18604 : Store the full pathname to the sed program for use in the C program
18605 full_sed=$sed
18606
18607 : see what type gids are declared as in the kernel
18608 echo " "
18609 echo "Looking for the type for group ids returned by getgid()."
18610 set gid_t gidtype xxx stdio.h sys/types.h
18611 eval $typedef
18612 case "$gidtype" in
18613 xxx)
18614         xxx=`./findhdr sys/user.h`
18615         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18616         case $1 in
18617         unsigned) dflt="$1 $2" ;;
18618         *) dflt="$1" ;;
18619         esac
18620         ;;
18621 *) dflt="$gidtype";;
18622 esac
18623 case "$gidtype" in
18624 gid_t) echo "gid_t found." ;;
18625 *)      rp="What is the type for group ids returned by getgid()?"
18626         . ./myread
18627         gidtype="$ans"
18628         ;;
18629 esac
18630
18631 echo " "
18632 case "$gidtype" in
18633 *_t) zzz="$gidtype"     ;;
18634 *)   zzz="gid"          ;;
18635 esac
18636 echo "Checking the size of $zzz..." >&4 
18637 cat > try.c <<EOCP
18638 #include <sys/types.h>
18639 #include <stdio.h>
18640 #$i_stdlib I_STDLIB
18641 #ifdef I_STDLIB
18642 #include <stdlib.h>
18643 #endif
18644 int main() {
18645     printf("%d\n", (int)sizeof($gidtype));
18646     exit(0);
18647 }
18648 EOCP
18649 set try
18650 if eval $compile_ok; then
18651         yyy=`$run ./try`
18652         case "$yyy" in
18653         '')     gidsize=4
18654                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18655                 ;;
18656         *)      gidsize=$yyy
18657                 echo "Your $zzz is $gidsize bytes long."
18658                 ;;
18659         esac
18660 else
18661         gidsize=4
18662         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18663 fi
18664
18665
18666 echo " "
18667 case "$gidtype" in
18668 *_t) zzz="$gidtype"     ;;
18669 *)   zzz="gid"          ;;
18670 esac
18671 echo "Checking the sign of $zzz..." >&4 
18672 cat > try.c <<EOCP
18673 #include <sys/types.h>
18674 #include <stdio.h>
18675 int main() {
18676         $gidtype foo = -1;
18677         if (foo < 0)
18678                 printf("-1\n");
18679         else
18680                 printf("1\n");
18681 }
18682 EOCP
18683 set try
18684 if eval $compile; then
18685         yyy=`$run ./try`
18686         case "$yyy" in
18687         '')     gidsign=1
18688                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18689                 ;;
18690         *)      gidsign=$yyy
18691                 case "$gidsign" in
18692                  1) echo "Your $zzz is unsigned." ;;
18693                 -1) echo "Your $zzz is signed."   ;;
18694                 esac
18695                 ;;
18696         esac
18697 else
18698         gidsign=1
18699         echo "(I can't compile the test program--guessing unsigned.)" >&4
18700 fi
18701
18702
18703 echo " "
18704
18705 if $test X"$quadtype" != X; then
18706
18707 echo "Checking how to print 64-bit integers..." >&4
18708
18709 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18710         $cat >try.c <<'EOCP'
18711 #include <sys/types.h>
18712 #include <stdio.h>
18713 int main() {
18714   int q = 12345678901;
18715   printf("%ld\n", q);
18716 }
18717 EOCP
18718         set try
18719         if eval $compile; then
18720                 yyy=`$run ./try`
18721                 case "$yyy" in
18722                 12345678901)
18723                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18724                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18725                         echo "We will use %d."
18726                         ;;
18727                 esac
18728         fi
18729 fi
18730
18731 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18732         $cat >try.c <<'EOCP'
18733 #include <sys/types.h>
18734 #include <stdio.h>
18735 int main() {
18736   long q = 12345678901;
18737   printf("%ld\n", q);
18738 }
18739 EOCP
18740         set try
18741         if eval $compile; then
18742                 yyy=`$run ./try`
18743                 case "$yyy" in
18744                 12345678901)
18745                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18746                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18747                         echo "We will use %ld."
18748                         ;;
18749                 esac
18750         fi
18751 fi
18752
18753 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18754         $cat >try.c <<'EOCP'
18755 #include <sys/types.h>
18756 #include <inttypes.h>
18757 #include <stdio.h>
18758 int main() {
18759   int64_t q = 12345678901;
18760   printf("%" PRId64 "\n", q);
18761 }
18762 EOCP
18763         set try
18764         if eval $compile; then
18765                 yyy=`$run ./try`
18766                 case "$yyy" in
18767                 12345678901)
18768                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18769                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18770                         echo "We will use the C9X style."
18771                         ;;
18772                 esac
18773         fi
18774 fi
18775
18776 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18777         $cat >try.c <<EOCP
18778 #include <sys/types.h>
18779 #include <stdio.h>
18780 int main() {
18781   $quadtype q = 12345678901;
18782   printf("%Ld\n", q);
18783 }
18784 EOCP
18785         set try
18786         if eval $compile; then
18787                 yyy=`$run ./try`
18788                 case "$yyy" in
18789                 12345678901)
18790                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18791                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18792                         echo "We will use %Ld."
18793                         ;;
18794                 esac
18795         fi
18796 fi
18797
18798 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18799         $cat >try.c <<'EOCP'
18800 #include <sys/types.h>
18801 #include <stdio.h>
18802 int main() {
18803   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18804   printf("%lld\n", q);
18805 }
18806 EOCP
18807         set try
18808         if eval $compile; then
18809                 yyy=`$run ./try`
18810                 case "$yyy" in
18811                 12345678901)
18812                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18813                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18814                         echo "We will use the %lld style."
18815                         ;;
18816                 esac
18817         fi
18818 fi
18819
18820 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18821         $cat >try.c <<EOCP
18822 #include <sys/types.h>
18823 #include <stdio.h>
18824 int main() {
18825   $quadtype q = 12345678901;
18826   printf("%qd\n", q);
18827 }
18828 EOCP
18829         set try
18830         if eval $compile; then
18831                 yyy=`$run ./try`
18832                 case "$yyy" in
18833                 12345678901)
18834                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18835                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18836                         echo "We will use %qd."
18837                         ;;
18838                 esac
18839         fi
18840 fi
18841
18842 if $test X"$sPRId64" = X; then
18843         echo "Cannot figure out how to print 64-bit integers." >&4
18844 fi
18845
18846 $rm -f try try.*
18847
18848 fi
18849
18850 case "$sPRId64" in
18851 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18852         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18853         ;;
18854 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18855         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18856         ;;
18857 esac
18858
18859
18860 echo " "
18861 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18862
18863 if $test X"$ivsize" = X8; then
18864         ivdformat="$sPRId64"
18865         uvuformat="$sPRIu64"
18866         uvoformat="$sPRIo64"
18867         uvxformat="$sPRIx64"
18868         uvXUformat="$sPRIXU64"
18869 else
18870         if $test X"$ivsize" = X"$longsize"; then
18871                 ivdformat='"ld"'
18872                 uvuformat='"lu"'
18873                 uvoformat='"lo"'
18874                 uvxformat='"lx"'
18875                 uvXUformat='"lX"'
18876         else
18877                 if $test X"$ivsize" = X"$intsize"; then
18878                         ivdformat='"d"'
18879                         uvuformat='"u"'
18880                         uvoformat='"o"'
18881                         uvxformat='"x"'
18882                         uvXUformat='"X"'
18883                 else
18884                         : far out
18885                         if $test X"$ivsize" = X"$shortsize"; then
18886                                 ivdformat='"hd"'
18887                                 uvuformat='"hu"'
18888                                 uvoformat='"ho"'
18889                                 uvxformat='"hx"'
18890                                 uvXUformat='"hX"'
18891                         fi
18892                 fi
18893         fi
18894 fi
18895
18896 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18897         nveformat="$sPRIeldbl"
18898         nvfformat="$sPRIfldbl"
18899         nvgformat="$sPRIgldbl"
18900         nvEUformat="$sPRIEUldbl"
18901         nvFUformat="$sPRIFUldbl"
18902         nvGUformat="$sPRIGUldbl"
18903 else
18904         nveformat='"e"'
18905         nvfformat='"f"'
18906         nvgformat='"g"'
18907         nvEUformat='"E"'
18908         nvFUformat='"F"'
18909         nvGUformat='"G"'
18910 fi
18911
18912 case "$ivdformat" in
18913 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18914     exit 1
18915     ;;
18916 esac
18917
18918
18919 echo " "
18920 $echo "Checking the format string to be used for gids..." >&4
18921
18922 case "$gidsign" in
18923 -1)     if $test X"$gidsize" = X"$ivsize"; then
18924                 gidformat="$ivdformat"
18925         else
18926                 if $test X"$gidsize" = X"$longsize"; then
18927                         gidformat='"ld"'
18928                 else
18929                         if $test X"$gidsize" = X"$intsize"; then
18930                                 gidformat='"d"'
18931                         else
18932                                 if $test X"$gidsize" = X"$shortsize"; then
18933                                         gidformat='"hd"'
18934                                 fi
18935                         fi
18936                 fi
18937         fi
18938         ;;
18939 *)      if $test X"$gidsize" = X"$uvsize"; then
18940                 gidformat="$uvuformat"
18941         else
18942                 if $test X"$gidsize" = X"$longsize"; then
18943                         gidformat='"lu"'
18944                 else
18945                         if $test X"$gidsize" = X"$intsize"; then
18946                                 gidformat='"u"'
18947                         else
18948                                 if $test X"$gidsize" = X"$shortsize"; then
18949                                         gidformat='"hu"'
18950                                 fi
18951                         fi
18952                 fi
18953         fi
18954         ;;
18955 esac
18956
18957 : see if getgroups exists
18958 set getgroups d_getgrps
18959 eval $inlibc
18960
18961 : see if setgroups exists
18962 set setgroups d_setgrps
18963 eval $inlibc
18964
18965
18966 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18967 echo " "
18968 case "$d_getgrps$d_setgrps" in
18969 *define*)
18970         case "$groupstype" in
18971         '') dflt="$gidtype" ;;
18972         *)  dflt="$groupstype" ;;
18973         esac
18974         $cat <<EOM
18975 What type of pointer is the second argument to getgroups() and setgroups()?
18976 Usually this is the same as group ids, $gidtype, but not always.
18977
18978 EOM
18979         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18980         . ./myread
18981         groupstype="$ans"
18982         ;;
18983 *)  groupstype="$gidtype";;
18984 esac
18985
18986 echo " "
18987 echo "Checking if your $make program sets \$(MAKE)..." >&4
18988 case "$make_set_make" in
18989 '')
18990         $sed 's/^X //' > testmake.mak << 'EOF'
18991 Xall:
18992 X       @echo 'maketemp="$(MAKE)"'
18993 EOF
18994         case "`$make -f testmake.mak 2>/dev/null`" in
18995         *maketemp=*) make_set_make='#' ;;
18996         *)      make_set_make="MAKE=$make" ;;
18997         esac
18998         $rm -f testmake.mak
18999         ;;
19000 esac
19001 case "$make_set_make" in
19002 '#') echo "Yup, it does.";;
19003 *) echo "Nope, it doesn't.";;
19004 esac
19005
19006 : see what type is used for mode_t
19007 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19008 set mode_t modetype int stdio.h sys/types.h
19009 eval $typedef_ask
19010
19011 : see if stdarg is available
19012 echo " "
19013 if $test `./findhdr stdarg.h`; then
19014         echo "<stdarg.h> found." >&4
19015         valstd="$define"
19016 else
19017         echo "<stdarg.h> NOT found." >&4
19018         valstd="$undef"
19019 fi
19020
19021 : see if varags is available
19022 echo " "
19023 if $test `./findhdr varargs.h`; then
19024         echo "<varargs.h> found." >&4
19025 else
19026         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19027 fi
19028
19029 : set up the varargs testing programs
19030 $cat > varargs.c <<EOP
19031 #ifdef I_STDARG
19032 #include <stdarg.h>
19033 #endif
19034 #ifdef I_VARARGS
19035 #include <varargs.h>
19036 #endif
19037
19038 #ifdef I_STDARG
19039 int f(char *p, ...)
19040 #else
19041 int f(va_alist)
19042 va_dcl
19043 #endif
19044 {
19045         va_list ap;
19046 #ifndef I_STDARG
19047         char *p;
19048 #endif
19049 #ifdef I_STDARG
19050         va_start(ap,p);
19051 #else
19052         va_start(ap);
19053         p = va_arg(ap, char *);
19054 #endif
19055         va_end(ap);
19056 }
19057 EOP
19058 $cat > varargs <<EOP
19059 $startsh
19060 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19061         echo "true"
19062 else
19063         echo "false"
19064 fi
19065 $rm -f varargs$_o
19066 EOP
19067 chmod +x varargs
19068
19069 : now check which varargs header should be included
19070 echo " "
19071 i_varhdr=''
19072 case "$valstd" in
19073 "$define")
19074         if `./varargs I_STDARG`; then
19075                 val='stdarg.h'
19076         elif `./varargs I_VARARGS`; then
19077                 val='varargs.h'
19078         fi
19079         ;;
19080 *)
19081         if `./varargs I_VARARGS`; then
19082                 val='varargs.h'
19083         fi
19084         ;;
19085 esac
19086 case "$val" in
19087 '')
19088 echo "I could not find the definition for va_dcl... You have problems..." >&4
19089         val="$undef"; set i_stdarg; eval $setvar
19090         val="$undef"; set i_varargs; eval $setvar
19091         ;;
19092 *) 
19093         set i_varhdr
19094         eval $setvar
19095         case "$i_varhdr" in
19096         stdarg.h)
19097                 val="$define"; set i_stdarg; eval $setvar
19098                 val="$undef"; set i_varargs; eval $setvar
19099                 ;;
19100         varargs.h)
19101                 val="$undef"; set i_stdarg; eval $setvar
19102                 val="$define"; set i_varargs; eval $setvar
19103                 ;;
19104         esac
19105         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19106 esac
19107 $rm -f varargs*
19108
19109 : see if we need va_copy
19110 echo " "
19111 case "$i_stdarg" in
19112 "$define")
19113         $cat >try.c <<EOCP
19114 #include <stdarg.h>
19115 #include <stdio.h>
19116 #$i_stdlib I_STDLIB
19117 #ifdef I_STDLIB
19118 #include <stdlib.h>
19119 #endif
19120 #include <signal.h>
19121
19122 int
19123 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19124 {
19125   return vfprintf(f, fmt, *valp);
19126 }
19127  
19128 int    
19129 myvfprintf(FILE *f, const  char *fmt, va_list val)
19130 {
19131   return ivfprintf(f, fmt, &val);
19132 }
19133       
19134 int
19135 myprintf(char *fmt, ...) 
19136 {
19137   va_list val;
19138   va_start(val, fmt);
19139   return myvfprintf(stdout, fmt, val); 
19140 }         
19141
19142 int
19143 main(int ac, char **av)
19144 {
19145   signal(SIGSEGV, exit);
19146
19147   myprintf("%s%cs all right, then\n", "that", '\'');                            
19148   exit(0);      
19149 }
19150 EOCP
19151         set try
19152         if eval $compile && $run ./try 2>&1 >/dev/null; then
19153                 case "`$run ./try`" in
19154                 "that's all right, then")
19155                         okay=yes
19156                         ;;
19157                 esac
19158         fi
19159         case "$okay" in
19160         yes)    echo "It seems that you don't need va_copy()." >&4
19161                 need_va_copy="$undef"
19162                 ;;
19163         *)      echo "It seems that va_copy() or similar will be needed." >&4
19164                 need_va_copy="$define"
19165                 ;;
19166         esac
19167         $rm -f try.* core core.* *.core *.core.*
19168         ;;
19169 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19170         ;;
19171 esac
19172
19173 : see what type is used for size_t
19174 rp="What is the type used for the length parameter for string functions?"
19175 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19176 eval $typedef_ask
19177
19178 : check for type of arguments to gethostbyaddr. 
19179 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19180         case "$d_gethbyaddr" in
19181         $define)
19182                 $cat <<EOM
19183
19184 Checking to see what type of arguments are accepted by gethostbyaddr().
19185 EOM
19186                 hdrs="$define sys/types.h
19187                         $d_socket sys/socket.h 
19188                         $i_niin netinet/in.h 
19189                         $i_netdb netdb.h
19190                         $i_unistd unistd.h"
19191                 : The first arg can 'char *' or 'void *'
19192                 : The second arg is some of integral type
19193                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19194                         for yyy in size_t long int; do
19195                                 case "$netdb_host_type" in
19196                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19197                                         if ./protochk "$try" $hdrs; then
19198                                                 echo "Your system accepts $xxx for the first arg."
19199                                                 echo "...and $yyy for the second arg."
19200                                                 netdb_host_type="$xxx"
19201                                                 netdb_hlen_type="$yyy"
19202                                         fi
19203                                         ;;
19204                                 esac
19205                         done
19206                 done
19207                 : In case none of those worked, prompt the user.
19208                 case "$netdb_host_type" in
19209                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19210                         dflt='char *'
19211                         . ./myread
19212                         netdb_host_type=$ans
19213                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19214                         dflt="$sizetype"
19215                         . ./myread
19216                         netdb_hlen_type=$ans
19217                         ;;
19218                 esac
19219                 ;;
19220         *)      : no gethostbyaddr, so pick harmless defaults
19221                 netdb_host_type='char *'
19222                 netdb_hlen_type="$sizetype"
19223                 ;;
19224         esac
19225         # Remove the "const" if needed. -- but then we'll have a 
19226         # prototype clash!
19227         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19228 fi
19229
19230 : check for type of argument to gethostbyname. 
19231 if test "X$netdb_name_type" = X ; then
19232         case "$d_gethbyname" in
19233         $define)
19234                 $cat <<EOM
19235
19236 Checking to see what type of argument is accepted by gethostbyname().
19237 EOM
19238                 hdrs="$define sys/types.h
19239                         $d_socket sys/socket.h 
19240                         $i_niin netinet/in.h 
19241                         $i_netdb netdb.h
19242                         $i_unistd unistd.h"
19243                 for xxx in "const char *" "char *"; do
19244                         case "$netdb_name_type" in
19245                         '')     try="extern struct hostent *gethostbyname($xxx);"
19246                                 if ./protochk "$try" $hdrs; then
19247                                         echo "Your system accepts $xxx."
19248                                         netdb_name_type="$xxx"
19249                                 fi
19250                                 ;;
19251                         esac
19252                 done
19253                 : In case none of those worked, prompt the user.
19254                 case "$netdb_name_type" in
19255                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19256                         dflt='char *'
19257                         . ./myread
19258                         netdb_name_type=$ans
19259                         ;;
19260                 esac
19261                 ;;
19262         *)      : no gethostbyname, so pick harmless default
19263                 netdb_name_type='char *'
19264                 ;;
19265         esac
19266 fi
19267
19268 : check for type of 1st argument to getnetbyaddr. 
19269 if test "X$netdb_net_type" = X ; then
19270         case "$d_getnbyaddr" in
19271         $define)
19272                 $cat <<EOM
19273
19274 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19275 EOM
19276                 hdrs="$define sys/types.h
19277                         $d_socket sys/socket.h 
19278                         $i_niin netinet/in.h 
19279                         $i_netdb netdb.h
19280                         $i_unistd unistd.h"
19281                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19282                         case "$netdb_net_type" in
19283                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19284                                 if ./protochk "$try" $hdrs; then
19285                                         echo "Your system accepts $xxx."
19286                                         netdb_net_type="$xxx"
19287                                 fi
19288                                 ;;
19289                         esac
19290                 done
19291                 : In case none of those worked, prompt the user.
19292                 case "$netdb_net_type" in
19293                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19294                         dflt='long'
19295                         . ./myread
19296                         netdb_net_type=$ans
19297                         ;;
19298                 esac
19299                 ;;
19300         *)      : no getnetbyaddr, so pick harmless default
19301                 netdb_net_type='long'
19302                 ;;
19303         esac
19304 fi
19305 : locate the preferred pager for this system
19306 fn=f/
19307 case "$pager" in
19308 '')
19309         dflt=''
19310         case "$pg" in
19311         /*) dflt=$pg;;
19312         [a-zA-Z]:/*) dflt=$pg;;
19313         esac
19314         case "$more" in
19315         /*) dflt=$more;;
19316         [a-zA-Z]:/*) dflt=$more;;
19317         esac
19318         case "$less" in
19319         /*) dflt=$less;;
19320         [a-zA-Z]:/*) dflt=$less;;
19321         esac
19322         case "$dflt" in
19323         '') dflt=/usr/ucb/more;;
19324         esac
19325         ;;
19326 *)      dflt="$pager"
19327         : Instruct ./getfile to trust the hinted or previous pager value,
19328         : even if it does not begin with a slash.  For example, on os2,
19329         : pager might be cmd /c more.  See comments in UU/getfile.
19330         fn="f/($pager)"
19331         ;;
19332 esac
19333 echo " "
19334 rp='What pager is used on your system?'
19335 . ./getfile
19336 pager="$ans"
19337
19338 : see what type pids are declared as in the kernel
19339 rp="What is the type of process ids on this system?"
19340 set pid_t pidtype int stdio.h sys/types.h
19341 eval $typedef_ask
19342
19343 : see if ar generates random libraries by itself
19344 echo " "
19345 echo "Checking how to generate random libraries on your machine..." >&4
19346 echo 'int bar1() { return bar2(); }' > bar1.c
19347 echo 'int bar2() { return 2; }' > bar2.c
19348 $cat > foo.c <<EOP
19349 #$i_stdlib I_STDLIB
19350 #ifdef I_STDLIB
19351 #include <stdlib.h>
19352 #endif
19353 int main() { printf("%d\n", bar1()); exit(0); }
19354 EOP
19355 $cc $ccflags -c bar1.c >/dev/null 2>&1
19356 $cc $ccflags -c bar2.c >/dev/null 2>&1
19357 $cc $ccflags -c foo.c >/dev/null 2>&1
19358 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19359 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19360         $run ./foobar >/dev/null 2>&1; then
19361         echo "$ar appears to generate random libraries itself."
19362         orderlib=false
19363         if [ "X$ranlib" = "X" ]; then
19364             ranlib=":"
19365         fi
19366 elif $ar s bar$_a >/dev/null 2>&1 &&
19367         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19368         $run ./foobar >/dev/null 2>&1; then
19369                 echo "a table of contents needs to be added with '$ar s'."
19370                 orderlib=false
19371                 ranlib="$ar s"
19372 elif $ar ts bar$_a >/dev/null 2>&1 &&
19373         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19374         $run ./foobar >/dev/null 2>&1; then
19375                 echo "a table of contents needs to be added with '$ar ts'."
19376                 orderlib=false
19377                 ranlib="$ar ts"
19378 else
19379         case "$ranlib" in
19380         :) ranlib='';;
19381         '')
19382                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19383                 $test -f $ranlib || ranlib=''
19384                 ;;
19385         esac
19386         if $test -n "$ranlib"; then
19387                 echo "your system has '$ranlib'; we'll use that."
19388                 orderlib=false
19389         else
19390                 echo "your system doesn't seem to support random libraries"
19391                 echo "so we'll use lorder and tsort to order the libraries."
19392                 orderlib=true
19393                 ranlib=":"
19394         fi
19395 fi
19396 $rm -f foo* bar*
19397
19398 : check for type of arguments to select. 
19399 case "$selecttype" in
19400 '') case "$d_select" in
19401         $define)
19402                 echo " "
19403                 $cat <<EOM
19404 Checking to see what type of arguments are accepted by select().
19405 EOM
19406                 hdrs="$define sys/types.h
19407                         $i_systime sys/time.h 
19408                         $i_sysselct sys/select.h
19409                         $d_socket sys/socket.h"
19410                 : The first arg can be int, unsigned, or size_t
19411                 : The last arg may or may not be 'const'
19412                 val=''
19413                 : void pointer has been seen but using that
19414                 : breaks the selectminbits test
19415                 for xxx in 'fd_set *' 'int *'; do
19416                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19417                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19418                                         case "$val" in
19419                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19420                                                 if ./protochk "$try" $hdrs; then
19421                                                         echo "Your system accepts $xxx."
19422                                                         val="$xxx"
19423                                                 fi
19424                                                 ;;
19425                                         esac
19426                                 done
19427                         done
19428                 done
19429                 case "$val" in
19430                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19431                         case "$d_fd_set" in
19432                                 $define) dflt="fd_set *" ;;
19433                                 *)              dflt="int *" ;;
19434                         esac
19435                         . ./myread
19436                         val=$ans
19437                         ;;
19438                 esac
19439                 selecttype="$val"
19440                 ;;
19441         *)      : no select, so pick a harmless default
19442                 selecttype='int *'
19443                 ;;
19444         esac
19445         ;;
19446 esac
19447
19448 : check for the select 'width'
19449 case "$selectminbits" in
19450 '') safebits=`expr $ptrsize \* 8`
19451     case "$d_select" in
19452         $define)
19453                 $cat <<EOM
19454
19455 Checking to see on how many bits at a time your select() operates...
19456 EOM
19457                 $cat >try.c <<EOCP
19458 #include <sys/types.h>
19459 #$i_time I_TIME
19460 #$i_systime I_SYS_TIME
19461 #$i_systimek I_SYS_TIME_KERNEL
19462 #ifdef I_TIME
19463 #   include <time.h>
19464 #endif
19465 #ifdef I_SYS_TIME
19466 #   ifdef I_SYS_TIME_KERNEL
19467 #       define KERNEL
19468 #   endif
19469 #   include <sys/time.h>
19470 #   ifdef I_SYS_TIME_KERNEL
19471 #       undef KERNEL
19472 #   endif
19473 #endif
19474 #$i_sysselct I_SYS_SELECT
19475 #ifdef I_SYS_SELECT
19476 #include <sys/select.h>
19477 #endif
19478 #$d_socket HAS_SOCKET
19479 #ifdef HAS_SOCKET
19480 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19481 #endif
19482 #include <stdio.h>
19483 #$i_stdlib I_STDLIB
19484 #ifdef I_STDLIB
19485 #include <stdlib.h>
19486 #endif
19487 $selecttype b;
19488 #define S sizeof(*(b))
19489 #define MINBITS 64
19490 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19491 #define NBITS  (NBYTES * 8)
19492 int main() {
19493     char *s = malloc(NBYTES);
19494     struct timeval t;
19495     int i;
19496     FILE* fp;
19497     int fd;
19498
19499     if (!s)
19500         exit(1);
19501     fclose(stdin);
19502     fp = fopen("try.c", "r");
19503     if (fp == 0)
19504       exit(2);
19505     fd = fileno(fp);
19506     if (fd < 0)
19507       exit(3);
19508     b = ($selecttype)s;
19509     for (i = 0; i < NBITS; i++)
19510         FD_SET(i, b);
19511     t.tv_sec  = 0;
19512     t.tv_usec = 0;
19513     select(fd + 1, b, 0, 0, &t);
19514     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19515     free(s);
19516     printf("%d\n", i + 1);
19517     return 0;
19518 }
19519 EOCP
19520                 set try
19521                 if eval $compile_ok; then
19522                         selectminbits=`$run ./try`
19523                         case "$selectminbits" in
19524                         '')     cat >&4 <<EOM
19525 Cannot figure out on how many bits at a time your select() operates.
19526 I'll play safe and guess it is $safebits bits.
19527 EOM
19528                                 selectminbits=$safebits
19529                                 bits="$safebits bits"
19530                                 ;;
19531                         1)      bits="1 bit" ;;
19532                         *)      bits="$selectminbits bits" ;;
19533                         esac
19534                         echo "Your select() operates on $bits at a time." >&4
19535                 else
19536                         rp='What is the minimum number of bits your select() operates on?'
19537                         case "$byteorder" in
19538                         12345678)       dflt=64 ;;
19539                         1234)           dflt=32 ;;
19540                         *)              dflt=1  ;;
19541                         esac
19542                         . ./myread
19543                         val=$ans
19544                         selectminbits="$val"
19545                 fi
19546                 $rm -f try.* try
19547                 ;;
19548         *)      : no select, so pick a harmless default
19549                 selectminbits=$safebits
19550                 ;;
19551         esac
19552         ;;
19553 esac
19554
19555 : Trace out the files included by signal.h, then look for SIGxxx names.
19556 : Remove SIGARRAYSIZE used by HPUX.
19557 : Remove SIGSTKSIZE used by Linux.
19558 : Remove SIGSTKSZ used by Posix.
19559 : Remove SIGTYP void lines used by OS2.
19560 : Some cpps, like os390, dont give the file name anywhere
19561 if [ "X$fieldn" = X ]; then
19562         : Just make some guesses.  We check them later.
19563         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19564 else
19565         xxx=`echo '#include <signal.h>' |
19566         $cppstdin $cppminus $cppflags 2>/dev/null |
19567         $grep '^[       ]*#.*include' | 
19568         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19569 fi
19570 : Check this list of files to be sure we have parsed the cpp output ok.
19571 : This will also avoid potentially non-existent files, such 
19572 : as ../foo/bar.h
19573 xxxfiles=''
19574 for xx in $xxx /dev/null ; do
19575         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19576 done
19577 : If we have found no files, at least try signal.h
19578 case "$xxxfiles" in
19579 '')     xxxfiles=`./findhdr signal.h` ;;
19580 esac
19581 xxx=`awk '
19582 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19583         print substr($2, 4, 20)
19584 }
19585 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19586         print substr($3, 4, 20)
19587 }' $xxxfiles`
19588 : Append some common names just in case the awk scan failed.
19589 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19590 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19591 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19592 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19593 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19594
19595 : generate a few handy files for later
19596 $cat > signal.c <<EOCP
19597 #include <sys/types.h>
19598 #include <signal.h>
19599 #$i_stdlib I_STDLIB
19600 #ifdef I_STDLIB
19601 #include <stdlib.h>
19602 #endif
19603 #include <stdio.h>
19604 int main() {
19605
19606 /* Strange style to avoid deeply-nested #if/#else/#endif */
19607 #ifndef NSIG
19608 #  ifdef _NSIG
19609 #    define NSIG (_NSIG)
19610 #  endif
19611 #endif
19612
19613 #ifndef NSIG
19614 #  ifdef SIGMAX
19615 #    define NSIG (SIGMAX+1)
19616 #  endif
19617 #endif
19618
19619 #ifndef NSIG
19620 #  ifdef SIG_MAX
19621 #    define NSIG (SIG_MAX+1)
19622 #  endif
19623 #endif
19624
19625 #ifndef NSIG
19626 #  ifdef _SIG_MAX
19627 #    define NSIG (_SIG_MAX+1)
19628 #  endif
19629 #endif
19630
19631 #ifndef NSIG
19632 #  ifdef MAXSIG
19633 #    define NSIG (MAXSIG+1)
19634 #  endif
19635 #endif
19636
19637 #ifndef NSIG
19638 #  ifdef MAX_SIG
19639 #    define NSIG (MAX_SIG+1)
19640 #  endif
19641 #endif
19642
19643 #ifndef NSIG
19644 #  ifdef SIGARRAYSIZE
19645 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19646 #  endif
19647 #endif
19648
19649 #ifndef NSIG
19650 #  ifdef _sys_nsig
19651 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19652 #  endif
19653 #endif
19654
19655 /* Default to some arbitrary number that's big enough to get most
19656    of the common signals.
19657 */
19658 #ifndef NSIG
19659 #    define NSIG 50
19660 #endif
19661
19662 printf("NSIG %d\n", NSIG);
19663
19664 #ifndef JUST_NSIG
19665
19666 EOCP
19667
19668 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19669 {
19670         printf "#ifdef SIG"; printf $1; printf "\n"
19671         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19672         printf $1; printf ");\n"
19673         printf "#endif\n"
19674 }
19675 END {
19676         printf "#endif /* JUST_NSIG */\n";
19677         printf "exit(0);\n}\n";
19678 }
19679 ' >>signal.c
19680 $cat >signal.awk <<'EOP'
19681 BEGIN { ndups = 0 }
19682 $1 ~ /^NSIG$/ { nsig = $2 }
19683 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19684     if ($2 > maxsig) { maxsig = $2 }
19685     if (sig_name[$2]) {
19686         dup_name[ndups] = $1
19687         dup_num[ndups] = $2
19688         ndups++ 
19689     }
19690     else {
19691         sig_name[$2] = $1
19692         sig_num[$2] = $2
19693     }
19694 }
19695 END { 
19696     if (nsig == 0) {
19697         nsig = maxsig + 1
19698     }
19699     printf("NSIG %d\n", nsig);
19700     for (n = 1; n < nsig; n++) {
19701         if (sig_name[n]) {
19702             printf("%s %d\n", sig_name[n], sig_num[n])
19703         }
19704         else {
19705             printf("NUM%d %d\n", n, n) 
19706         }
19707     }
19708     for (n = 0; n < ndups; n++) {
19709         printf("%s %d\n", dup_name[n], dup_num[n])
19710     }
19711 }
19712 EOP
19713 $cat >signal_cmd <<EOS
19714 $startsh
19715 if $test -s signal.lst; then
19716     echo "Using your existing signal.lst file"
19717         exit 0
19718 fi
19719 xxx="$xxx"
19720 EOS
19721 $cat >>signal_cmd <<'EOS'
19722
19723 set signal
19724 if eval $compile_ok; then
19725         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19726 else
19727         echo "(I can't seem be able to compile the whole test program)" >&4
19728         echo "(I'll try it in little pieces.)" >&4
19729         set signal -DJUST_NSIG
19730         if eval $compile_ok; then
19731                 $run ./signal$_exe > signal.nsg
19732                 $cat signal.nsg
19733         else
19734                 echo "I can't seem to figure out how many signals you have." >&4
19735                 echo "Guessing 50." >&4
19736                 echo 'NSIG 50' > signal.nsg
19737         fi
19738         : Now look at all the signal names, one at a time.
19739         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19740                 $cat > signal.c <<EOCP
19741 #include <sys/types.h>
19742 #include <signal.h>
19743 #include <stdio.h>
19744 int main() {
19745 printf("$xx %d\n", SIG${xx});
19746 return 0;
19747 }
19748 EOCP
19749                 set signal
19750                 if eval $compile; then
19751                         echo "SIG${xx} found."
19752                         $run ./signal$_exe  >> signal.ls1
19753                 else
19754                         echo "SIG${xx} NOT found."
19755                 fi
19756         done
19757         if $test -s signal.ls1; then
19758                 $cat signal.nsg signal.ls1 |
19759                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19760         fi
19761
19762 fi
19763 if $test -s signal.lst; then
19764         :
19765 else
19766         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19767         echo 'kill -l' >signal
19768         set X `csh -f <signal`
19769         $rm -f signal
19770         shift
19771         case $# in
19772         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19773         esac
19774         echo $@ | $tr ' ' $trnl | \
19775             $awk '{ printf "%s %d\n", $1, ++s; }
19776                   END { printf "NSIG %d\n", ++s }' >signal.lst
19777 fi
19778 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19779 EOS
19780 chmod a+x signal_cmd
19781 $eunicefix signal_cmd
19782
19783 : generate list of signal names
19784 echo " "
19785 case "$sig_name_init" in
19786 '') doinit=yes ;;
19787 *)  case "$sig_num_init" in
19788     ''|*,*) doinit=yes ;;
19789     esac ;;
19790 esac
19791 case "$doinit" in
19792 yes)
19793         echo "Generating a list of signal names and numbers..." >&4
19794         . ./signal_cmd
19795         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19796         sig_name=`$awk 'BEGIN { printf "ZERO " }
19797                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19798         sig_num=`$awk  'BEGIN { printf "0 " }
19799                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19800         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19801                              !/^NSIG/   { printf "\"%s\", ", $1 }
19802                              END        { printf "0\n" }' signal.lst`
19803         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19804                              !/^NSIG/   { printf "%d, ", $2}
19805                              END        { printf "0\n"}' signal.lst`
19806         ;;
19807 esac
19808 echo "The following $sig_count signals are available:"
19809 echo " "
19810 echo $sig_name | $awk \
19811 'BEGIN { linelen = 0 }
19812 {
19813         for (i = 1; i <= NF; i++) {
19814                 name = "SIG" $i " "
19815                 linelen = linelen + length(name)
19816                 if (linelen > 70) {
19817                         printf "\n"
19818                         linelen = length(name)
19819                 }
19820                 printf "%s", name
19821         }
19822         printf "\n"
19823 }'
19824 sig_size=`echo $sig_name | awk '{print NF}'`
19825 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19826
19827 echo " "
19828 case "$sizetype" in
19829 *_t) zzz="$sizetype"    ;;
19830 *)   zzz="filesize"     ;;
19831 esac
19832 echo "Checking the size of $zzz..." >&4 
19833 cat > try.c <<EOCP
19834 #include <sys/types.h>
19835 #include <stdio.h>
19836 #$i_stdlib I_STDLIB
19837 #ifdef I_STDLIB
19838 #include <stdlib.h>
19839 #endif
19840 int main() {
19841     printf("%d\n", (int)sizeof($sizetype));
19842     exit(0);
19843 }
19844 EOCP
19845 set try
19846 if eval $compile_ok; then
19847         yyy=`$run ./try`
19848         case "$yyy" in
19849         '')     sizesize=4
19850                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19851                 ;;
19852         *)      sizesize=$yyy
19853                 echo "Your $zzz size is $sizesize bytes."
19854                 ;;
19855         esac
19856 else
19857         sizesize=4
19858         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19859 fi
19860
19861
19862 : check for socklen_t
19863 echo " "
19864 echo "Checking to see if you have socklen_t..." >&4
19865 $cat >try.c <<EOCP
19866 #include <sys/types.h>
19867 #$d_socket HAS_SOCKET
19868 #ifdef HAS_SOCKET
19869 #include <sys/socket.h>
19870 #endif
19871 int main() { socklen_t x = 16; }
19872 EOCP
19873 set try
19874 if eval $compile; then
19875         val="$define"
19876         echo "You have socklen_t."
19877 else
19878         val="$undef"
19879         echo "You do not have socklen_t."
19880         case "$sizetype" in
19881         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19882         esac
19883 fi
19884 $rm -f try try.*
19885 set d_socklen_t
19886 eval $setvar
19887
19888 : see if this is a socks.h system
19889 set socks.h i_socks
19890 eval $inhdr
19891
19892 : check for type of the size argument to socket calls
19893 case "$d_socket" in
19894 "$define")
19895         $cat <<EOM
19896
19897 Checking to see what type is the last argument of accept().
19898 EOM
19899         yyy=''
19900         case "$d_socklen_t" in
19901         "$define") yyy="$yyy socklen_t"
19902         esac
19903         yyy="$yyy $sizetype int long unsigned"
19904         for xxx in $yyy; do
19905                 case "$socksizetype" in
19906                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19907                         case "$usesocks" in
19908                         "$define")
19909                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19910                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19911                                         socksizetype="$xxx"
19912                                 fi
19913                                 ;;
19914                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19915                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19916                                         socksizetype="$xxx"
19917                                 fi
19918                                 ;;
19919                         esac
19920                         ;;
19921                 esac
19922         done
19923 : In case none of those worked, prompt the user.
19924         case "$socksizetype" in
19925         '')     rp='What is the type for socket address structure sizes?'
19926                 dflt='int'
19927                 . ./myread
19928                 socksizetype=$ans
19929                 ;;
19930         esac
19931         ;;
19932 *)      : no sockets, so pick relatively harmless default
19933         socksizetype='int'
19934         ;;
19935 esac
19936
19937 : see what type is used for signed size_t
19938 set ssize_t ssizetype int stdio.h sys/types.h
19939 eval $typedef
19940 dflt="$ssizetype"
19941 $cat > try.c <<EOM
19942 #include <stdio.h>
19943 #$i_stdlib I_STDLIB
19944 #ifdef I_STDLIB
19945 #include <stdlib.h>
19946 #endif
19947 #include <sys/types.h>
19948 #define Size_t $sizetype
19949 #define SSize_t $dflt
19950 int main()
19951 {
19952         if (sizeof(Size_t) == sizeof(SSize_t))
19953                 printf("$dflt\n");
19954         else if (sizeof(Size_t) == sizeof(int))
19955                 printf("int\n");
19956         else 
19957                 printf("long\n");
19958         exit(0);
19959 }
19960 EOM
19961 echo " "
19962 set try
19963 if eval $compile_ok && $run ./try > /dev/null; then
19964         ssizetype=`$run ./try`
19965         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19966 else
19967         $cat >&4 <<EOM
19968 Help! I can't compile and run the ssize_t test program: please enlighten me!
19969 (This is probably a misconfiguration in your system or libraries, and
19970 you really ought to fix it.  Still, I'll try anyway.)
19971
19972 I need a type that is the same size as $sizetype, but is guaranteed to
19973 be signed.  Common values are ssize_t, int and long.
19974
19975 EOM
19976         rp="What signed type is the same size as $sizetype?"
19977         . ./myread
19978         ssizetype="$ans"
19979 fi
19980 $rm -f try try.*
19981
19982 : see what type of char stdio uses.
19983 echo " "
19984 echo '#include <stdio.h>' > stdio.c
19985 $cppstdin $cppminus < stdio.c > stdioh
19986 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19987         echo "Your stdio uses unsigned chars." >&4
19988         stdchar="unsigned char"
19989 else
19990         echo "Your stdio uses signed chars." >&4
19991         stdchar="char"
19992 fi
19993 $rm -f stdio.* stdioh
19994
19995 : see what type uids are declared as in the kernel
19996 echo " "
19997 echo "Looking for the type for user ids returned by getuid()."
19998 set uid_t uidtype xxx stdio.h sys/types.h
19999 eval $typedef
20000 case "$uidtype" in
20001 xxx)
20002         xxx=`./findhdr sys/user.h`
20003         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20004         case $1 in
20005         unsigned) dflt="$1 $2" ;;
20006         *) dflt="$1" ;;
20007         esac
20008         ;;
20009 *) dflt="$uidtype";;
20010 esac
20011 case "$uidtype" in
20012 uid_t)  echo "uid_t found." ;;
20013 *)      rp="What is the type for user ids returned by getuid()?"
20014         . ./myread
20015         uidtype="$ans"
20016         ;;
20017 esac
20018
20019 echo " "
20020 case "$uidtype" in
20021 *_t) zzz="$uidtype"     ;;
20022 *)   zzz="uid"          ;;
20023 esac
20024 echo "Checking the size of $zzz..." >&4 
20025 cat > try.c <<EOCP
20026 #include <sys/types.h>
20027 #include <stdio.h>
20028 #$i_stdlib I_STDLIB
20029 #ifdef I_STDLIB
20030 #include <stdlib.h>
20031 #endif
20032 int main() {
20033     printf("%d\n", (int)sizeof($uidtype));
20034     exit(0);
20035 }
20036 EOCP
20037 set try
20038 if eval $compile_ok; then
20039         yyy=`$run ./try`
20040         case "$yyy" in
20041         '')     uidsize=4
20042                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20043                 ;;
20044         *)      uidsize=$yyy
20045                 echo "Your $zzz is $uidsize bytes long."
20046                 ;;
20047         esac
20048 else
20049         uidsize=4
20050         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20051 fi
20052
20053 echo " "
20054 case "$uidtype" in
20055 *_t) zzz="$uidtype"     ;;
20056 *)   zzz="uid"          ;;
20057 esac
20058 echo "Checking the sign of $zzz..." >&4
20059 cat > try.c <<EOCP
20060 #include <sys/types.h>
20061 #include <stdio.h>
20062 int main() {
20063         $uidtype foo = -1;
20064         if (foo < 0)
20065                 printf("-1\n");
20066         else
20067                 printf("1\n");
20068 }
20069 EOCP
20070 set try
20071 if eval $compile; then
20072         yyy=`$run ./try`
20073         case "$yyy" in
20074         '')     uidsign=1
20075                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20076                 ;;
20077         *)      uidsign=$yyy
20078                 case "$uidsign" in
20079                  1) echo "Your $zzz is unsigned." ;;
20080                 -1) echo "Your $zzz is signed."   ;;
20081                 esac
20082                 ;;
20083         esac
20084 else
20085         uidsign=1
20086         echo "(I can't compile the test program--guessing unsigned.)" >&4
20087 fi
20088
20089
20090
20091 echo " "
20092 $echo "Checking the format string to be used for uids..." >&4
20093
20094 case "$uidsign" in
20095 -1)     if $test X"$uidsize" = X"$ivsize"; then
20096                 uidformat="$ivdformat"
20097         else
20098                 if $test X"$uidsize" = X"$longsize"; then
20099                         uidformat='"ld"'
20100                 else
20101                         if $test X"$uidsize" = X"$intsize"; then
20102                                 uidformat='"d"'
20103                         else
20104                                 if $test X"$uidsize" = X"$shortsize"; then
20105                                         uidformat='"hd"'
20106                                 fi
20107                         fi
20108                 fi
20109         fi
20110         ;;
20111 *)      if $test X"$uidsize" = X"$uvsize"; then
20112                 uidformat="$uvuformat"
20113         else
20114                 if $test X"$uidsize" = X"$longsize"; then
20115                         uidformat='"lu"'
20116                 else
20117                         if $test X"$uidsize" = X"$intsize"; then
20118                                 uidformat='"u"'
20119                         else
20120                                 if $test X"$uidsize" = X"$shortsize"; then
20121                                         uidformat='"hu"'
20122                                 fi
20123                         fi
20124                 fi
20125         fi
20126         ;;
20127 esac
20128
20129
20130 case "$usesitecustomize" in
20131     $define|true|[Yy]*)
20132         usesitecustomize="$define"
20133         ;;
20134     *)
20135         usesitecustomize="$undef"
20136         ;;
20137     esac
20138
20139 : determine compiler compiler
20140 case "$yacc" in
20141 '')
20142         dflt=yacc;;
20143 *)
20144         dflt="$yacc";;
20145 esac
20146 echo " "
20147 comp='yacc'
20148 if $test -f "$byacc$_exe"; then
20149         dflt="$byacc"
20150         comp="byacc or $comp"
20151 fi
20152 if $test -f "$bison$_exe"; then
20153         comp="$comp or bison -y"
20154 fi
20155 rp="Which compiler compiler ($comp) shall I use?"
20156 . ./myread
20157 yacc="$ans"
20158 case "$yacc" in
20159 *bis*)
20160         case "$yacc" in
20161         *-y*) ;;
20162         *)
20163                 yacc="$yacc -y"
20164                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20165                 ;;
20166         esac
20167         ;;
20168 esac
20169
20170 : see if this is a fp.h system
20171 set fp.h i_fp
20172 eval $inhdr
20173
20174 : see if this is a fp_class.h system
20175 set fp_class.h i_fp_class
20176 eval $inhdr
20177
20178 : see if this is a ieeefp.h system
20179 case "$i_ieeefp" in
20180 '' ) set ieeefp.h i_ieeefp
20181      eval $inhdr
20182      ;;
20183 esac
20184
20185 : see if this is a libutil.h system
20186 set libutil.h i_libutil
20187 eval $inhdr
20188
20189 : see if mach cthreads are available
20190 if test "X$usethreads" = "X$define"; then
20191         set mach/cthreads.h i_machcthr
20192         eval $inhdr
20193 else
20194         i_machcthr="$undef"
20195 fi
20196
20197
20198
20199 : see if this is a mntent.h system
20200 set mntent.h i_mntent
20201 eval $inhdr
20202
20203 : see if ndbm.h is available
20204 set ndbm.h t_ndbm
20205 eval $inhdr
20206
20207 case "$t_ndbm" in
20208 $undef)
20209     # Some Linux distributions such as RedHat 7.1 put the
20210     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20211     if $test -f /usr/include/gdbm/ndbm.h; then
20212         echo '<gdbm/ndbm.h> found.'
20213         ccflags="$ccflags -I/usr/include/gdbm"
20214         cppflags="$cppflags -I/usr/include/gdbm"
20215         t_ndbm=$define
20216     fi
20217     ;;
20218 esac
20219
20220 case "$t_ndbm" in
20221 $define)
20222         : see if dbm_open exists
20223         set dbm_open d_dbm_open
20224         eval $inlibc
20225         case "$d_dbm_open" in
20226         $undef)
20227                 t_ndbm="$undef"
20228                 echo "We won't be including <ndbm.h>"
20229                 ;;
20230         esac
20231         ;;
20232 esac
20233 val="$t_ndbm"
20234 set i_ndbm
20235 eval $setvar
20236
20237 : see if net/errno.h is available
20238 val=''
20239 set net/errno.h val
20240 eval $inhdr
20241
20242 : Unfortunately, it causes problems on some systems.  Arrgh.
20243 case "$val" in
20244 $define)
20245         cat > try.c <<'EOM'
20246 #include <stdio.h>
20247 #include <errno.h>
20248 #include <net/errno.h>
20249 int func()
20250 {
20251         return ENOTSOCK;
20252 }
20253 EOM
20254         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20255                 echo "We'll be including <net/errno.h>." >&4
20256         else
20257                 echo "We won't be including <net/errno.h>." >&4
20258                 val="$undef"
20259         fi
20260         $rm -f try.* try
20261         ;;
20262 esac
20263 set i_neterrno
20264 eval $setvar
20265
20266 : see if netinet/tcp.h is available
20267 set netinet/tcp.h i_netinettcp
20268 eval $inhdr
20269
20270 : see if this is a poll.h system
20271 set poll.h i_poll
20272 eval $inhdr
20273
20274 : see if this is a prot.h system
20275 set prot.h i_prot
20276 eval $inhdr
20277
20278 echo " "
20279 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20280 $cat <<'EOSH' > Cppsym.know
20281 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20282 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20283 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20284 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20285 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20286 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20287 bull c cadmus clipper CMU COFF COMPILER_VERSION
20288 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20289 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20290 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20291 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20292 GLIBC GLIBC_MINOR
20293 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20294 H3050R H3050RX hbullx20 hcx host_mips
20295 hp200 hp300 hp700 HP700 hp800 hp9000
20296 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20297 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20298 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20299 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20300 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20301 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20302 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20303 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20304 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20305 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20306 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20307 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20308 MATH_HAS_NO_SIDE_EFFECTS
20309 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20310 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20311 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20312 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20313 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20314 NetBSD news1500 news1700 news1800 news1900 news3700
20315 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20316 ns32016 ns32332 ns32k nsc32000
20317 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20318 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20319 pc532 pdp11 PGC PIC plexus PORTAR posix
20320 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20321 POSIX_C_SOURCE POSIX_SOURCE POWER
20322 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20323 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20324 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20325 sony sony_news sonyrisc sparc sparclite spectrum
20326 stardent stdc STDC_EXT stratos sun sun3 sun386
20327 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20328 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20329 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20330 sysV68 sysV88 Tek4132 Tek4300 titan
20331 TM3200 TM5400 TM5600
20332 tower tower32 tower32_200 tower32_600 tower32_700
20333 tower32_800 tower32_850 tss
20334 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20335 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20336 unix UNIX95 UNIX99 unixpc unos
20337 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20338 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20339 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20340 USGr4 USGr4_2
20341 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20342 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20343 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20344 z8000
20345 EOSH
20346 # Maybe put other stuff here too.
20347 cat <<EOSH >>Cppsym.know
20348 $osname
20349 EOSH
20350 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20351 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20352 $cat Cppsym.know > Cppsym.c
20353 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20354 $rm -f Cppsym.a Cppsym.b Cppsym.c
20355 cat <<EOSH > Cppsym
20356 $startsh
20357 if $test \$# -gt 0; then
20358     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20359     if $test -s Cppsym.got; then
20360         $rm -f Cppsym.got
20361         exit 0
20362     fi
20363     $rm -f Cppsym.got
20364     exit 1
20365 else
20366     $tr " " "$trnl" | ./Cppsym.try
20367     exit 0
20368 fi
20369 EOSH
20370 chmod +x Cppsym
20371 $eunicefix Cppsym
20372 cat <<EOSH > Cppsym.try
20373 $startsh
20374 cat <<'EOCP' > try.c
20375 #include <stdio.h>
20376 #if cpp_stuff == 1
20377 #define STRINGIFY(a)    "a"
20378 #endif
20379 #if cpp_stuff == 42
20380 #define StGiFy(a)  #a
20381 #define STRINGIFY(a)    StGiFy(a)
20382 #endif
20383 #if $cpp_stuff != 1 && $cpp_stuff != 42
20384 #   include "Bletch: How does this C preprocessor stringify macros?"
20385 #endif
20386 int main() {
20387 EOCP
20388 $awk \\
20389 EOSH
20390 cat <<'EOSH' >> Cppsym.try
20391 'length($1) > 0 {
20392     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20393     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20394     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20395     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20396 }'       >> try.c
20397 echo 'return 0;}' >> try.c
20398 EOSH
20399 cat <<EOSH >> Cppsym.try
20400 ccflags="$ccflags"
20401 case "$osname-$gccversion" in
20402 irix-) ccflags="\$ccflags -woff 1178" ;;
20403 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20404 esac
20405 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20406 EOSH
20407 chmod +x Cppsym.try
20408 $eunicefix Cppsym.try
20409 ./Cppsym < Cppsym.know > Cppsym.true
20410 : Add in any linux cpp "predefined macros":
20411 case "$osname::$gccversion" in
20412   *linux*::*.*)
20413     tHdrH=_tmpHdr
20414     rm -f $tHdrH'.h' $tHdrH
20415     touch $tHdrH'.h'
20416     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20417        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20418        if [ -s $tHdrH'_cppsym.real' ]; then
20419           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20420        fi
20421     fi
20422     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20423   ;;
20424 esac
20425 : now check the C compiler for additional symbols
20426 postprocess_cc_v=''
20427 case "$osname" in
20428 aix) postprocess_cc_v="|$tr , ' '" ;;
20429 esac
20430 $cat >ccsym <<EOS
20431 $startsh
20432 $cat >tmp.c <<EOF
20433 extern int foo;
20434 EOF
20435 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20436 do
20437         case "\$i" in
20438         -D*) echo "\$i" | $sed 's/^-D//';;
20439         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20440         esac
20441 done
20442 $rm -f try.c
20443 EOS
20444 postprocess_cc_v=''
20445 chmod +x ccsym
20446 $eunicefix ccsym
20447 ./ccsym > ccsym1.raw
20448 if $test -s ccsym1.raw; then
20449        $sort ccsym1.raw | $uniq >ccsym.raw
20450 else
20451        mv ccsym1.raw ccsym.raw
20452 fi
20453
20454 $awk '/\=/ { print $0; next }
20455         { print $0"=1" }' ccsym.raw >ccsym.list
20456 $comm -13 Cppsym.true ccsym.list >ccsym.own
20457 $comm -12 Cppsym.true ccsym.list >ccsym.com
20458 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20459 also=''
20460 if $test -z ccsym.raw; then
20461         echo "Your C compiler doesn't seem to define any symbols!" >&4
20462         echo " "
20463         echo "However, your C preprocessor defines the following symbols:"
20464         $cat Cppsym.true
20465         ccsymbols=''
20466         cppsymbols=`$cat Cppsym.true`
20467         cppsymbols=`echo $cppsymbols`
20468         cppccsymbols="$cppsymbols"
20469 else
20470         if $test -s ccsym.com; then
20471                 echo "Your C compiler and pre-processor define these symbols:"
20472                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20473                 also='also '
20474                 symbols='ones'
20475                 cppccsymbols=`$cat ccsym.com`
20476                 cppccsymbols=`echo $cppccsymbols`
20477                 $test "$silent" || sleep 1
20478         fi
20479         if $test -s ccsym.cpp; then
20480                 $test "$also" && echo " "
20481                 echo "Your C pre-processor ${also}defines the following symbols:"
20482                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20483                 also='further '
20484                 cppsymbols=`$cat ccsym.cpp`
20485                 cppsymbols=`echo $cppsymbols`
20486                 $test "$silent" || sleep 1
20487         fi
20488         if $test -s ccsym.own; then
20489                 $test "$also" && echo " "
20490                 echo "Your C compiler ${also}defines the following cpp symbols:"
20491                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20492                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20493                 ccsymbols=`$cat ccsym.own`
20494                 ccsymbols=`echo $ccsymbols`
20495                 $test "$silent" || sleep 1
20496         fi
20497 fi
20498
20499 : see if this is a termio system
20500 val="$undef"
20501 val2="$undef"
20502 val3="$undef"
20503 if $test `./findhdr termios.h`; then
20504         set tcsetattr i_termios
20505         eval $inlibc
20506         val3="$i_termios"
20507 fi
20508 echo " "
20509 case "$val3" in
20510 "$define") echo "You have POSIX termios.h... good!" >&4;;
20511 *) if ./Cppsym pyr; then
20512                 case "`/bin/universe`" in
20513                 ucb) if $test `./findhdr sgtty.h`; then
20514                                 val2="$define"
20515                                 echo "<sgtty.h> found." >&4
20516                         else
20517                                 echo "System is pyramid with BSD universe."
20518                                 echo "<sgtty.h> not found--you could have problems." >&4
20519                         fi;;
20520                 *) if $test `./findhdr termio.h`; then
20521                                 val="$define"
20522                                 echo "<termio.h> found." >&4
20523                         else
20524                                 echo "System is pyramid with USG universe."
20525                                 echo "<termio.h> not found--you could have problems." >&4
20526                         fi;;
20527                 esac
20528         elif ./usg; then
20529                 if $test `./findhdr termio.h`; then
20530                         echo "<termio.h> found." >&4
20531                         val="$define"
20532                 elif $test `./findhdr sgtty.h`; then
20533                         echo "<sgtty.h> found." >&4
20534                         val2="$define"
20535                 else
20536 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20537                 fi
20538         else
20539                 if $test `./findhdr sgtty.h`; then
20540                         echo "<sgtty.h> found." >&4
20541                         val2="$define"
20542                 elif $test `./findhdr termio.h`; then
20543                         echo "<termio.h> found." >&4
20544                         val="$define"
20545                 else
20546 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20547                 fi
20548         fi;;
20549 esac
20550 set i_termio; eval $setvar
20551 val=$val2; set i_sgtty; eval $setvar
20552 val=$val3; set i_termios; eval $setvar
20553
20554 : see if stddef is available
20555 set stddef.h i_stddef
20556 eval $inhdr
20557
20558 : see if this is a sunmath.h system
20559 set sunmath.h i_sunmath
20560 eval $inhdr
20561
20562 : see if sys/access.h is available
20563 set sys/access.h i_sysaccess
20564 eval $inhdr
20565
20566 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20567 set sys/filio.h i_sysfilio
20568 eval $inhdr
20569 echo " "
20570 if $test `./findhdr sys/ioctl.h`; then
20571         val="$define"
20572         echo '<sys/ioctl.h> found.' >&4
20573 else
20574         val="$undef"
20575         if $test $i_sysfilio = "$define"; then
20576             echo '<sys/ioctl.h> NOT found.' >&4
20577         else
20578                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20579                 $test $i_termio = "$define" && xxx="termio.h"
20580                 $test $i_termios = "$define" && xxx="termios.h"
20581 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20582         fi
20583 fi
20584 set i_sysioctl
20585 eval $setvar
20586
20587 : see if socket ioctl defs are in sys/sockio.h
20588 echo " "
20589 xxx=`./findhdr sys/sockio.h`
20590 if $test "$xxx"; then
20591         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20592                 val="$define"
20593                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20594         else
20595                 val="$undef"
20596                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20597         fi
20598 else
20599         val="$undef"
20600         $cat <<EOM
20601 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20602 EOM
20603 fi
20604 set i_syssockio
20605 eval $setvar
20606
20607
20608 : see if this is a syslog.h system
20609 set syslog.h i_syslog
20610 eval $inhdr
20611
20612
20613 : see if this is a sys/mode.h system
20614 set sys/mode.h i_sysmode
20615 eval $inhdr
20616
20617 : see if sys/resource.h has to be included
20618 set sys/resource.h i_sysresrc
20619 eval $inhdr
20620
20621 : see if sys/security.h is available
20622 set sys/security.h i_syssecrt
20623 eval $inhdr
20624
20625 : see if this is a sys/statvfs.h system
20626 set sys/statvfs.h i_sysstatvfs
20627 eval $inhdr
20628
20629 : see if this is a sys/un.h system
20630 set sys/un.h i_sysun
20631 eval $inhdr
20632
20633
20634 : see if this is a sys/utsname.h system
20635 set sys/utsname.h i_sysutsname
20636 eval $inhdr
20637
20638 : see if this is a syswait system
20639 set sys/wait.h i_syswait
20640 eval $inhdr
20641
20642 : see if this is a ustat.h system
20643 set ustat.h i_ustat
20644 eval $inhdr
20645
20646 : see if this is an utime system
20647 set utime.h i_utime
20648 eval $inhdr
20649
20650 : see if this is a values.h system
20651 set values.h i_values
20652 eval $inhdr
20653
20654 : see if this is a vfork system
20655 case "$d_vfork" in
20656 "$define")
20657         set vfork.h i_vfork
20658         eval $inhdr
20659         ;;
20660 *)
20661         i_vfork="$undef"
20662         ;;
20663 esac
20664
20665 : see if gdbm.h is available
20666 set gdbm.h t_gdbm
20667 eval $inhdr
20668 case "$t_gdbm" in
20669 $define)
20670         : see if gdbm_open exists
20671         set gdbm_open d_gdbm_open
20672         eval $inlibc
20673         case "$d_gdbm_open" in
20674         $undef)
20675                 t_gdbm="$undef"
20676                 echo "We won't be including <gdbm.h>"
20677                 ;;
20678         esac
20679         ;;
20680 esac
20681 val="$t_gdbm"
20682 set i_gdbm
20683 eval $setvar
20684
20685 echo " "
20686 echo "Looking for extensions..." >&4
20687 : If we are using the old config.sh, known_extensions may contain
20688 : old or inaccurate or duplicate values.
20689 known_extensions=''
20690 nonxs_extensions=''
20691 : We do not use find because it might not be available.
20692 : We do not just use MANIFEST because the user may have dropped
20693 : some additional extensions into the source tree and expect them
20694 : to be built.
20695
20696 : Function to recursively find available extensions, ignoring DynaLoader
20697 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20698 find_extensions='
20699     for xxx in *; do
20700        case "$xxx" in
20701            DynaLoader|dynaload) ;;
20702            *)
20703            if $test -f $xxx/$xxx.xs; then
20704                known_extensions="$known_extensions $1$xxx";
20705            elif $test -f $xxx/Makefile.PL; then
20706                nonxs_extensions="$nonxs_extensions $1$xxx";
20707            else
20708                if $test -d $xxx -a $# -lt 10; then
20709                    set $1$xxx/ $*;
20710                    cd "$xxx";
20711                    eval $find_extensions;
20712                    cd ..;
20713                    shift;
20714                fi;
20715            fi
20716            ;;
20717        esac;
20718     done'
20719 tdir=`pwd`
20720 cd "$rsrc/ext"
20721 set X
20722 shift
20723 eval $find_extensions
20724 # Special case:  Add in threads/shared since it is not picked up by the
20725 # recursive find above (and adding in general recursive finding breaks
20726 # SDBM_File/sdbm).  A.D.  10/25/2001.
20727 known_extensions="$known_extensions threads/shared"
20728 set X $nonxs_extensions
20729 shift
20730 nonxs_extensions="$*"
20731 set X $known_extensions
20732 shift
20733 known_extensions="$*"
20734 cd "$tdir"
20735
20736 : Now see which are supported on this system.
20737 avail_ext=''
20738 for xxx in $known_extensions ; do
20739         case "$xxx" in
20740         DB_File|db_file)
20741                 case "$i_db" in
20742                 $define) avail_ext="$avail_ext $xxx" ;;
20743                 esac
20744                 ;;
20745         GDBM_File|gdbm_fil)
20746                 case "$i_gdbm" in 
20747                 $define) avail_ext="$avail_ext $xxx" ;;
20748                 esac
20749                 ;;
20750         I18N/Langinfo|i18n_lan)
20751                 case "$i_langinfo$d_nl_langinfo" in 
20752                 $define$define) avail_ext="$avail_ext $xxx" ;;
20753                 esac
20754                 ;;
20755         NDBM_File|ndbm_fil)
20756                 case "$i_ndbm" in
20757                 $define)
20758                     case "$osname-$use64bitint" in
20759                     hpux-define)
20760                         case "$libs" in
20761                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20762                         esac
20763                         ;;
20764                     *) avail_ext="$avail_ext $xxx" ;;
20765                     esac
20766                     ;;
20767                 esac
20768                 ;;
20769         ODBM_File|odbm_fil) 
20770                 case "${i_dbm}${i_rpcsvcdbm}" in
20771                 *"${define}"*)
20772                     case "$osname-$use64bitint" in
20773                     hpux-define)
20774                         case "$libs" in
20775                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20776                         esac
20777                         ;;
20778                     *) avail_ext="$avail_ext $xxx" ;;
20779                     esac
20780                     ;;
20781                 esac
20782                 ;;
20783         POSIX|posix)
20784                 case "$useposix" in
20785                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20786                 esac
20787                 ;;
20788         Opcode|opcode)
20789                 case "$useopcode" in
20790                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20791                 esac
20792                 ;;
20793         Socket|socket)
20794                 case "$d_socket" in 
20795                 true|$define|y)
20796                     case "$osname" in
20797                     beos) ;; # not unless BONE
20798                     *) avail_ext="$avail_ext $xxx" ;;
20799                     esac
20800                     ;;
20801                 esac
20802                 ;;
20803         Sys/Syslog|sys/syslog)
20804                 : XXX syslog requires socket
20805                 case "$d_socket" in 
20806                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20807                 esac
20808                 ;;
20809         Thread|thread)
20810                 case "$usethreads" in
20811                 true|$define|y)
20812                         case "$useithreads" in
20813                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20814                         esac
20815                 esac
20816                 ;;
20817         XS/APItest|xs/apitest)
20818                 # This is just for testing.  Skip it unless we have dynamic loading.
20819
20820                 case "$usedl" in
20821                 $define) avail_ext="$avail_ext $xxx" ;;
20822                 esac
20823                 ;;
20824         XS/Typemap|xs/typemap)
20825                 # This is just for testing.  Skip it unless we have dynamic loading.
20826                 case "$usedl" in
20827                 $define) avail_ext="$avail_ext $xxx" ;;
20828                 esac
20829                 ;;
20830         threads|threads/shared)
20831                 # threads and threads::shared are special cases.
20832                 # To stop people from asking "Perl 5.8.0 was supposed
20833                 # to have this new fancy threads implementation but my
20834                 # perl doesn't have it" and from people trying to
20835                 # (re)install the threads module using CPAN.pm and
20836                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20837                 # the threads.pm and threads/shared.pm will always be
20838                 # there, croaking informatively ("you need to rebuild
20839                 # all of Perl with threads, sorry") when threads haven't
20840                 # been compiled in.
20841                 # --jhi
20842                 avail_ext="$avail_ext $xxx"
20843                 ;;
20844         IPC/SysV|ipc/sysv)
20845                 : XXX Do we need a useipcsysv variable here
20846                 case "${d_msg}${d_sem}${d_shm}" in 
20847                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20848                 esac
20849                 ;;
20850         *)      avail_ext="$avail_ext $xxx"
20851                 ;;
20852         esac
20853 done
20854
20855 set X $avail_ext
20856 shift
20857 avail_ext="$*"
20858
20859 case "$onlyextensions" in
20860 '') ;;
20861 *)  keepextensions=''
20862     echo "You have requested that only certains extensions be included..." >&4
20863     for i in $onlyextensions; do
20864         case " $avail_ext " in
20865         *" $i "*)
20866             echo "Keeping extension $i."
20867             keepextensions="$keepextensions $i"
20868             ;;
20869         *) echo "Ignoring extension $i." ;;
20870         esac
20871     done
20872     avail_ext="$keepextensions"
20873     ;;
20874 esac
20875
20876 case "$noextensions" in
20877 '') ;;
20878 *)  keepextensions=''
20879     echo "You have requested that certain extensions be ignored..." >&4
20880     for i in $avail_ext; do
20881         case " $noextensions " in
20882         *" $i "*) echo "Ignoring extension $i." ;;
20883         *) echo "Keeping extension $i.";
20884            keepextensions="$keepextensions $i"
20885            ;;
20886         esac
20887     done
20888     avail_ext="$keepextensions"
20889     ;;
20890 esac
20891
20892 : Now see which nonxs extensions are supported on this system.
20893 : For now assume all are.
20894 nonxs_ext=''
20895 for xxx in $nonxs_extensions ; do
20896         case "$xxx" in
20897         *)      nonxs_ext="$nonxs_ext $xxx"
20898                 ;;
20899         esac
20900 done
20901
20902 set X $nonxs_ext
20903 shift
20904 nonxs_ext="$*"
20905
20906 case $usedl in
20907 $define)
20908         $cat <<EOM
20909 A number of extensions are supplied with $package.  You may choose to
20910 compile these extensions for dynamic loading (the default), compile
20911 them into the $package executable (static loading), or not include
20912 them at all.  Answer "none" to include no extensions.
20913 Note that DynaLoader is always built and need not be mentioned here.
20914
20915 EOM
20916         case "$dynamic_ext" in
20917         '')
20918                 : Exclude those listed in static_ext
20919                 dflt=''
20920                 for xxx in $avail_ext; do
20921                         case " $static_ext " in
20922                         *" $xxx "*) ;;
20923                         *) dflt="$dflt $xxx" ;;
20924                         esac
20925                 done
20926                 set X $dflt
20927                 shift
20928                 dflt="$*"
20929                 ;;
20930         *)      dflt="$dynamic_ext"
20931                 # Perhaps we are reusing an old out-of-date config.sh.
20932                 case "$hint" in
20933                 previous)
20934                         if test X"$dynamic_ext" != X"$avail_ext"; then
20935                                 $cat <<EOM
20936 NOTICE:  Your previous config.sh list may be incorrect. 
20937 The extensions now available to you are 
20938         ${avail_ext}
20939 but the default list from your previous config.sh is
20940         ${dynamic_ext} 
20941
20942 EOM
20943                         fi
20944                         ;;
20945                 esac
20946                 ;;
20947         esac
20948         case "$dflt" in
20949         '')     dflt=none;;
20950         esac
20951         rp="What extensions do you wish to load dynamically?"
20952         . ./myread
20953         case "$ans" in
20954         none) dynamic_ext=' ' ;;
20955         *) dynamic_ext="$ans" ;;
20956         esac
20957
20958         case "$static_ext" in
20959         '')
20960                 : Exclude those already listed in dynamic linking
20961                 dflt=''
20962                 for xxx in $avail_ext; do
20963                         case " $dynamic_ext " in
20964                         *" $xxx "*) ;;
20965                         *) dflt="$dflt $xxx" ;;
20966                         esac
20967                 done
20968                 set X $dflt
20969                 shift
20970                 dflt="$*"
20971                 ;;
20972         *)  dflt="$static_ext" 
20973                 ;;
20974         esac
20975
20976         case "$dflt" in
20977         '')     dflt=none;;
20978         esac
20979         rp="What extensions do you wish to load statically?"
20980         . ./myread
20981         case "$ans" in
20982         none) static_ext=' ' ;;
20983         *) static_ext="$ans" ;;
20984         esac
20985         ;;
20986 *)
20987         $cat <<EOM
20988 A number of extensions are supplied with $package.  Answer "none" 
20989 to include no extensions. 
20990 Note that DynaLoader is always built and need not be mentioned here.
20991
20992 EOM
20993         case "$static_ext" in
20994         '') dflt="$avail_ext" ;;
20995         *)      dflt="$static_ext"
20996                 # Perhaps we are reusing an old out-of-date config.sh.
20997                 case "$hint" in
20998                 previous)
20999                         if test X"$static_ext" != X"$avail_ext"; then
21000                                 $cat <<EOM
21001 NOTICE:  Your previous config.sh list may be incorrect. 
21002 The extensions now available to you are 
21003         ${avail_ext}
21004 but the default list from your previous config.sh is
21005         ${static_ext} 
21006
21007 EOM
21008                         fi
21009                         ;;
21010                 esac
21011                 ;;
21012         esac
21013         : Exclude those that are not xs extensions
21014         case "$dflt" in
21015         '')     dflt=none;;
21016         esac
21017         rp="What extensions do you wish to include?"
21018         . ./myread
21019         case "$ans" in
21020         none) static_ext=' ' ;;
21021         *) static_ext="$ans" ;;
21022         esac
21023         ;;
21024 esac
21025 #        
21026 # Encode is a special case.  If we are building Encode as a static
21027 # extension, we need to explicitly list its subextensions as well.
21028 # For other nested extensions, this is handled automatically by
21029 # the appropriate Makefile.PL.
21030 case " $static_ext " in
21031         *" Encode "*) # Add the subextensions of Encode
21032         cd "$rsrc/ext"
21033         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21034                 static_ext="$static_ext Encode/$xxx"
21035         done
21036         cd "$tdir"
21037         ;;
21038 esac
21039
21040 set X $dynamic_ext $static_ext $nonxs_ext
21041 shift
21042 extensions="$*"
21043
21044 # Sanity check:  We require an extension suitable for use with
21045 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21046 # should show up as failures in the test suite, but it's helpful to
21047 # catch them now.) The 'extensions' list is normally sorted
21048 # alphabetically, so we need to accept either
21049 #    DB_File ... Fcntl ... IO  ....
21050 # or something like
21051 #    Fcntl ... NDBM_File ... IO  ....
21052 case " $extensions"  in
21053 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21054 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21055 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21056 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21057    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21058    ;;
21059 esac
21060
21061 : Remove libraries needed only for extensions
21062 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21063 : The exception is SunOS 4.x, which needs them.
21064 case "${osname}X${osvers}" in
21065 sunos*X4*)
21066     perllibs="$libs"
21067     ;;
21068 *) case "$usedl" in
21069     $define|true|[yY]*)
21070             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21071             shift
21072             perllibs="$*"
21073             ;;
21074     *)  perllibs="$libs"
21075             ;;
21076     esac
21077     ;;
21078 esac
21079
21080 : Remove build directory name from cppstdin so it can be used from
21081 : either the present location or the final installed location.
21082 echo " "
21083 : Get out of the UU directory to get correct path name.
21084 cd ..
21085 case "$cppstdin" in
21086 `pwd`/cppstdin)
21087         echo "Stripping down cppstdin path name"
21088         cppstdin=cppstdin
21089         ;;
21090 esac
21091 cd UU
21092
21093 : end of configuration questions
21094 echo " "
21095 echo "End of configuration questions."
21096 echo " "
21097
21098 : back to where it started
21099 if test -d ../UU; then
21100         cd ..
21101 fi
21102
21103 : configuration may be patched via a 'config.arch' file
21104 if $test -f config.arch; then
21105         echo "I see a config.arch file, loading it."
21106         . ./config.arch
21107 fi
21108
21109 : configuration may be patched via a 'config.over' file
21110 if $test -f config.over; then
21111         echo " "
21112         dflt=y
21113         rp='I see a config.over file.  Do you wish to load it?'
21114         . UU/myread
21115         case "$ans" in
21116         n*) echo "OK, I'll ignore it.";;
21117         *)      . ./config.over
21118                 echo "Configuration override changes have been loaded."
21119                 ;;
21120         esac
21121 fi
21122
21123 : in case they want portability, strip down executable paths
21124 case "$d_portable" in
21125 "$define")
21126         echo " "
21127         echo "Stripping down executable paths..." >&4
21128         for file in $loclist $trylist; do
21129                 eval temp=\$$file
21130                 eval $file=`basename $temp`
21131         done
21132         ;;
21133 esac
21134
21135 : create config.sh file
21136 echo " "
21137 echo "Creating config.sh..." >&4
21138 $spitshell <<EOT >config.sh
21139 $startsh
21140 #
21141 # This file was produced by running the Configure script. It holds all the
21142 # definitions figured out by Configure. Should you modify one of these values,
21143 # do not forget to propagate your changes by running "Configure -der". You may
21144 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21145 #
21146
21147 # Package name      : $package
21148 # Source directory  : $src
21149 # Configuration time: $cf_time
21150 # Configured by     : $cf_by
21151 # Target system     : $myuname
21152
21153 Author='$Author'
21154 Date='$Date'
21155 Header='$Header'
21156 Id='$Id'
21157 Locker='$Locker'
21158 Log='$Log'
21159 Mcc='$Mcc'
21160 RCSfile='$RCSfile'
21161 Revision='$Revision'
21162 Source='$Source'
21163 State='$State'
21164 _a='$_a'
21165 _exe='$_exe'
21166 _o='$_o'
21167 afs='$afs'
21168 afsroot='$afsroot'
21169 alignbytes='$alignbytes'
21170 ansi2knr='$ansi2knr'
21171 aphostname='$aphostname'
21172 api_revision='$api_revision'
21173 api_subversion='$api_subversion'
21174 api_version='$api_version'
21175 api_versionstring='$api_versionstring'
21176 ar='$ar'
21177 archlib='$archlib'
21178 archlibexp='$archlibexp'
21179 archname64='$archname64'
21180 archname='$archname'
21181 archobjs='$archobjs'
21182 asctime_r_proto='$asctime_r_proto'
21183 awk='$awk'
21184 baserev='$baserev'
21185 bash='$bash'
21186 bin='$bin'
21187 binexp='$binexp'
21188 bison='$bison'
21189 byacc='$byacc'
21190 byteorder='$byteorder'
21191 c='$c'
21192 castflags='$castflags'
21193 cat='$cat'
21194 cc='$cc'
21195 cccdlflags='$cccdlflags'
21196 ccdlflags='$ccdlflags'
21197 ccflags='$ccflags'
21198 ccflags_uselargefiles='$ccflags_uselargefiles'
21199 ccname='$ccname'
21200 ccsymbols='$ccsymbols'
21201 ccversion='$ccversion'
21202 cf_by='$cf_by'
21203 cf_email='$cf_email'
21204 cf_time='$cf_time'
21205 charsize='$charsize'
21206 chgrp='$chgrp'
21207 chmod='$chmod'
21208 chown='$chown'
21209 clocktype='$clocktype'
21210 comm='$comm'
21211 compress='$compress'
21212 contains='$contains'
21213 cp='$cp'
21214 cpio='$cpio'
21215 cpp='$cpp'
21216 cpp_stuff='$cpp_stuff'
21217 cppccsymbols='$cppccsymbols'
21218 cppflags='$cppflags'
21219 cpplast='$cpplast'
21220 cppminus='$cppminus'
21221 cpprun='$cpprun'
21222 cppstdin='$cppstdin'
21223 cppsymbols='$cppsymbols'
21224 crypt_r_proto='$crypt_r_proto'
21225 cryptlib='$cryptlib'
21226 csh='$csh'
21227 ctermid_r_proto='$ctermid_r_proto'
21228 ctime_r_proto='$ctime_r_proto'
21229 d_Gconvert='$d_Gconvert'
21230 d_PRIEUldbl='$d_PRIEUldbl'
21231 d_PRIFUldbl='$d_PRIFUldbl'
21232 d_PRIGUldbl='$d_PRIGUldbl'
21233 d_PRIXU64='$d_PRIXU64'
21234 d_PRId64='$d_PRId64'
21235 d_PRIeldbl='$d_PRIeldbl'
21236 d_PRIfldbl='$d_PRIfldbl'
21237 d_PRIgldbl='$d_PRIgldbl'
21238 d_PRIi64='$d_PRIi64'
21239 d_PRIo64='$d_PRIo64'
21240 d_PRIu64='$d_PRIu64'
21241 d_PRIx64='$d_PRIx64'
21242 d_SCNfldbl='$d_SCNfldbl'
21243 d__fwalk='$d__fwalk'
21244 d_access='$d_access'
21245 d_accessx='$d_accessx'
21246 d_aintl='$d_aintl'
21247 d_alarm='$d_alarm'
21248 d_archlib='$d_archlib'
21249 d_asctime_r='$d_asctime_r'
21250 d_atolf='$d_atolf'
21251 d_atoll='$d_atoll'
21252 d_attribute_format='$d_attribute_format'
21253 d_attribute_malloc='$d_attribute_malloc'
21254 d_attribute_nonnull='$d_attribute_nonnull'
21255 d_attribute_noreturn='$d_attribute_noreturn'
21256 d_attribute_pure='$d_attribute_pure'
21257 d_attribute_unused='$d_attribute_unused'
21258 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21259 d_bcmp='$d_bcmp'
21260 d_bcopy='$d_bcopy'
21261 d_bsd='$d_bsd'
21262 d_bsdgetpgrp='$d_bsdgetpgrp'
21263 d_bsdsetpgrp='$d_bsdsetpgrp'
21264 d_builtin_choose_expr='$d_builtin_choose_expr'
21265 d_builtin_expect='$d_builtin_expect'
21266 d_bzero='$d_bzero'
21267 d_casti32='$d_casti32'
21268 d_castneg='$d_castneg'
21269 d_charvspr='$d_charvspr'
21270 d_chown='$d_chown'
21271 d_chroot='$d_chroot'
21272 d_chsize='$d_chsize'
21273 d_class='$d_class'
21274 d_clearenv='$d_clearenv'
21275 d_closedir='$d_closedir'
21276 d_cmsghdr_s='$d_cmsghdr_s'
21277 d_const='$d_const'
21278 d_copysignl='$d_copysignl'
21279 d_crypt='$d_crypt'
21280 d_crypt_r='$d_crypt_r'
21281 d_csh='$d_csh'
21282 d_ctermid_r='$d_ctermid_r'
21283 d_ctime_r='$d_ctime_r'
21284 d_cuserid='$d_cuserid'
21285 d_dbl_dig='$d_dbl_dig'
21286 d_dbminitproto='$d_dbminitproto'
21287 d_difftime='$d_difftime'
21288 d_dirfd='$d_dirfd'
21289 d_dirnamlen='$d_dirnamlen'
21290 d_dlerror='$d_dlerror'
21291 d_dlopen='$d_dlopen'
21292 d_dlsymun='$d_dlsymun'
21293 d_dosuid='$d_dosuid'
21294 d_drand48_r='$d_drand48_r'
21295 d_drand48proto='$d_drand48proto'
21296 d_dup2='$d_dup2'
21297 d_eaccess='$d_eaccess'
21298 d_endgrent='$d_endgrent'
21299 d_endgrent_r='$d_endgrent_r'
21300 d_endhent='$d_endhent'
21301 d_endhostent_r='$d_endhostent_r'
21302 d_endnent='$d_endnent'
21303 d_endnetent_r='$d_endnetent_r'
21304 d_endpent='$d_endpent'
21305 d_endprotoent_r='$d_endprotoent_r'
21306 d_endpwent='$d_endpwent'
21307 d_endpwent_r='$d_endpwent_r'
21308 d_endsent='$d_endsent'
21309 d_endservent_r='$d_endservent_r'
21310 d_eofnblk='$d_eofnblk'
21311 d_eunice='$d_eunice'
21312 d_faststdio='$d_faststdio'
21313 d_fchdir='$d_fchdir'
21314 d_fchmod='$d_fchmod'
21315 d_fchown='$d_fchown'
21316 d_fcntl='$d_fcntl'
21317 d_fcntl_can_lock='$d_fcntl_can_lock'
21318 d_fd_macros='$d_fd_macros'
21319 d_fd_set='$d_fd_set'
21320 d_fds_bits='$d_fds_bits'
21321 d_fgetpos='$d_fgetpos'
21322 d_finite='$d_finite'
21323 d_finitel='$d_finitel'
21324 d_flexfnam='$d_flexfnam'
21325 d_flock='$d_flock'
21326 d_flockproto='$d_flockproto'
21327 d_fork='$d_fork'
21328 d_fp_class='$d_fp_class'
21329 d_fpathconf='$d_fpathconf'
21330 d_fpclass='$d_fpclass'
21331 d_fpclassify='$d_fpclassify'
21332 d_fpclassl='$d_fpclassl'
21333 d_fpos64_t='$d_fpos64_t'
21334 d_frexpl='$d_frexpl'
21335 d_fs_data_s='$d_fs_data_s'
21336 d_fseeko='$d_fseeko'
21337 d_fsetpos='$d_fsetpos'
21338 d_fstatfs='$d_fstatfs'
21339 d_fstatvfs='$d_fstatvfs'
21340 d_fsync='$d_fsync'
21341 d_ftello='$d_ftello'
21342 d_ftime='$d_ftime'
21343 d_futimes='$d_futimes'
21344 d_getcwd='$d_getcwd'
21345 d_getespwnam='$d_getespwnam'
21346 d_getfsstat='$d_getfsstat'
21347 d_getgrent='$d_getgrent'
21348 d_getgrent_r='$d_getgrent_r'
21349 d_getgrgid_r='$d_getgrgid_r'
21350 d_getgrnam_r='$d_getgrnam_r'
21351 d_getgrps='$d_getgrps'
21352 d_gethbyaddr='$d_gethbyaddr'
21353 d_gethbyname='$d_gethbyname'
21354 d_gethent='$d_gethent'
21355 d_gethname='$d_gethname'
21356 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21357 d_gethostbyname_r='$d_gethostbyname_r'
21358 d_gethostent_r='$d_gethostent_r'
21359 d_gethostprotos='$d_gethostprotos'
21360 d_getitimer='$d_getitimer'
21361 d_getlogin='$d_getlogin'
21362 d_getlogin_r='$d_getlogin_r'
21363 d_getmnt='$d_getmnt'
21364 d_getmntent='$d_getmntent'
21365 d_getnbyaddr='$d_getnbyaddr'
21366 d_getnbyname='$d_getnbyname'
21367 d_getnent='$d_getnent'
21368 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21369 d_getnetbyname_r='$d_getnetbyname_r'
21370 d_getnetent_r='$d_getnetent_r'
21371 d_getnetprotos='$d_getnetprotos'
21372 d_getpagsz='$d_getpagsz'
21373 d_getpbyname='$d_getpbyname'
21374 d_getpbynumber='$d_getpbynumber'
21375 d_getpent='$d_getpent'
21376 d_getpgid='$d_getpgid'
21377 d_getpgrp2='$d_getpgrp2'
21378 d_getpgrp='$d_getpgrp'
21379 d_getppid='$d_getppid'
21380 d_getprior='$d_getprior'
21381 d_getprotobyname_r='$d_getprotobyname_r'
21382 d_getprotobynumber_r='$d_getprotobynumber_r'
21383 d_getprotoent_r='$d_getprotoent_r'
21384 d_getprotoprotos='$d_getprotoprotos'
21385 d_getprpwnam='$d_getprpwnam'
21386 d_getpwent='$d_getpwent'
21387 d_getpwent_r='$d_getpwent_r'
21388 d_getpwnam_r='$d_getpwnam_r'
21389 d_getpwuid_r='$d_getpwuid_r'
21390 d_getsbyname='$d_getsbyname'
21391 d_getsbyport='$d_getsbyport'
21392 d_getsent='$d_getsent'
21393 d_getservbyname_r='$d_getservbyname_r'
21394 d_getservbyport_r='$d_getservbyport_r'
21395 d_getservent_r='$d_getservent_r'
21396 d_getservprotos='$d_getservprotos'
21397 d_getspnam='$d_getspnam'
21398 d_getspnam_r='$d_getspnam_r'
21399 d_gettimeod='$d_gettimeod'
21400 d_gmtime_r='$d_gmtime_r'
21401 d_gnulibc='$d_gnulibc'
21402 d_grpasswd='$d_grpasswd'
21403 d_hasmntopt='$d_hasmntopt'
21404 d_htonl='$d_htonl'
21405 d_ilogbl='$d_ilogbl'
21406 d_index='$d_index'
21407 d_inetaton='$d_inetaton'
21408 d_int64_t='$d_int64_t'
21409 d_isascii='$d_isascii'
21410 d_isfinite='$d_isfinite'
21411 d_isinf='$d_isinf'
21412 d_isnan='$d_isnan'
21413 d_isnanl='$d_isnanl'
21414 d_killpg='$d_killpg'
21415 d_lchown='$d_lchown'
21416 d_ldbl_dig='$d_ldbl_dig'
21417 d_libm_lib_version='$d_libm_lib_version'
21418 d_link='$d_link'
21419 d_localtime_r='$d_localtime_r'
21420 d_locconv='$d_locconv'
21421 d_lockf='$d_lockf'
21422 d_longdbl='$d_longdbl'
21423 d_longlong='$d_longlong'
21424 d_lseekproto='$d_lseekproto'
21425 d_lstat='$d_lstat'
21426 d_madvise='$d_madvise'
21427 d_malloc_good_size='$d_malloc_good_size'
21428 d_malloc_size='$d_malloc_size'
21429 d_mblen='$d_mblen'
21430 d_mbstowcs='$d_mbstowcs'
21431 d_mbtowc='$d_mbtowc'
21432 d_memchr='$d_memchr'
21433 d_memcmp='$d_memcmp'
21434 d_memcpy='$d_memcpy'
21435 d_memmove='$d_memmove'
21436 d_memset='$d_memset'
21437 d_mkdir='$d_mkdir'
21438 d_mkdtemp='$d_mkdtemp'
21439 d_mkfifo='$d_mkfifo'
21440 d_mkstemp='$d_mkstemp'
21441 d_mkstemps='$d_mkstemps'
21442 d_mktime='$d_mktime'
21443 d_mmap='$d_mmap'
21444 d_modfl='$d_modfl'
21445 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21446 d_modflproto='$d_modflproto'
21447 d_mprotect='$d_mprotect'
21448 d_msg='$d_msg'
21449 d_msg_ctrunc='$d_msg_ctrunc'
21450 d_msg_dontroute='$d_msg_dontroute'
21451 d_msg_oob='$d_msg_oob'
21452 d_msg_peek='$d_msg_peek'
21453 d_msg_proxy='$d_msg_proxy'
21454 d_msgctl='$d_msgctl'
21455 d_msgget='$d_msgget'
21456 d_msghdr_s='$d_msghdr_s'
21457 d_msgrcv='$d_msgrcv'
21458 d_msgsnd='$d_msgsnd'
21459 d_msync='$d_msync'
21460 d_munmap='$d_munmap'
21461 d_mymalloc='$d_mymalloc'
21462 d_nice='$d_nice'
21463 d_nl_langinfo='$d_nl_langinfo'
21464 d_nv_preserves_uv='$d_nv_preserves_uv'
21465 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21466 d_off64_t='$d_off64_t'
21467 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21468 d_oldpthreads='$d_oldpthreads'
21469 d_oldsock='$d_oldsock'
21470 d_open3='$d_open3'
21471 d_pathconf='$d_pathconf'
21472 d_pause='$d_pause'
21473 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21474 d_phostname='$d_phostname'
21475 d_pipe='$d_pipe'
21476 d_poll='$d_poll'
21477 d_portable='$d_portable'
21478 d_procselfexe='$d_procselfexe'
21479 d_pthread_atfork='$d_pthread_atfork'
21480 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21481 d_pthread_yield='$d_pthread_yield'
21482 d_pwage='$d_pwage'
21483 d_pwchange='$d_pwchange'
21484 d_pwclass='$d_pwclass'
21485 d_pwcomment='$d_pwcomment'
21486 d_pwexpire='$d_pwexpire'
21487 d_pwgecos='$d_pwgecos'
21488 d_pwpasswd='$d_pwpasswd'
21489 d_pwquota='$d_pwquota'
21490 d_qgcvt='$d_qgcvt'
21491 d_quad='$d_quad'
21492 d_random_r='$d_random_r'
21493 d_readdir64_r='$d_readdir64_r'
21494 d_readdir='$d_readdir'
21495 d_readdir_r='$d_readdir_r'
21496 d_readlink='$d_readlink'
21497 d_readv='$d_readv'
21498 d_recvmsg='$d_recvmsg'
21499 d_rename='$d_rename'
21500 d_rewinddir='$d_rewinddir'
21501 d_rmdir='$d_rmdir'
21502 d_safebcpy='$d_safebcpy'
21503 d_safemcpy='$d_safemcpy'
21504 d_sanemcmp='$d_sanemcmp'
21505 d_sbrkproto='$d_sbrkproto'
21506 d_scalbnl='$d_scalbnl'
21507 d_sched_yield='$d_sched_yield'
21508 d_scm_rights='$d_scm_rights'
21509 d_seekdir='$d_seekdir'
21510 d_select='$d_select'
21511 d_sem='$d_sem'
21512 d_semctl='$d_semctl'
21513 d_semctl_semid_ds='$d_semctl_semid_ds'
21514 d_semctl_semun='$d_semctl_semun'
21515 d_semget='$d_semget'
21516 d_semop='$d_semop'
21517 d_sendmsg='$d_sendmsg'
21518 d_setegid='$d_setegid'
21519 d_seteuid='$d_seteuid'
21520 d_setgrent='$d_setgrent'
21521 d_setgrent_r='$d_setgrent_r'
21522 d_setgrps='$d_setgrps'
21523 d_sethent='$d_sethent'
21524 d_sethostent_r='$d_sethostent_r'
21525 d_setitimer='$d_setitimer'
21526 d_setlinebuf='$d_setlinebuf'
21527 d_setlocale='$d_setlocale'
21528 d_setlocale_r='$d_setlocale_r'
21529 d_setnent='$d_setnent'
21530 d_setnetent_r='$d_setnetent_r'
21531 d_setpent='$d_setpent'
21532 d_setpgid='$d_setpgid'
21533 d_setpgrp2='$d_setpgrp2'
21534 d_setpgrp='$d_setpgrp'
21535 d_setprior='$d_setprior'
21536 d_setproctitle='$d_setproctitle'
21537 d_setprotoent_r='$d_setprotoent_r'
21538 d_setpwent='$d_setpwent'
21539 d_setpwent_r='$d_setpwent_r'
21540 d_setregid='$d_setregid'
21541 d_setresgid='$d_setresgid'
21542 d_setresuid='$d_setresuid'
21543 d_setreuid='$d_setreuid'
21544 d_setrgid='$d_setrgid'
21545 d_setruid='$d_setruid'
21546 d_setsent='$d_setsent'
21547 d_setservent_r='$d_setservent_r'
21548 d_setsid='$d_setsid'
21549 d_setvbuf='$d_setvbuf'
21550 d_sfio='$d_sfio'
21551 d_shm='$d_shm'
21552 d_shmat='$d_shmat'
21553 d_shmatprototype='$d_shmatprototype'
21554 d_shmctl='$d_shmctl'
21555 d_shmdt='$d_shmdt'
21556 d_shmget='$d_shmget'
21557 d_sigaction='$d_sigaction'
21558 d_sigprocmask='$d_sigprocmask'
21559 d_sigsetjmp='$d_sigsetjmp'
21560 d_snprintf='$d_snprintf'
21561 d_sockatmark='$d_sockatmark'
21562 d_sockatmarkproto='$d_sockatmarkproto'
21563 d_socket='$d_socket'
21564 d_socklen_t='$d_socklen_t'
21565 d_sockpair='$d_sockpair'
21566 d_socks5_init='$d_socks5_init'
21567 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21568 d_sqrtl='$d_sqrtl'
21569 d_srand48_r='$d_srand48_r'
21570 d_srandom_r='$d_srandom_r'
21571 d_sresgproto='$d_sresgproto'
21572 d_sresuproto='$d_sresuproto'
21573 d_statblks='$d_statblks'
21574 d_statfs_f_flags='$d_statfs_f_flags'
21575 d_statfs_s='$d_statfs_s'
21576 d_statvfs='$d_statvfs'
21577 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21578 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21579 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21580 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21581 d_stdio_stream_array='$d_stdio_stream_array'
21582 d_stdiobase='$d_stdiobase'
21583 d_stdstdio='$d_stdstdio'
21584 d_strchr='$d_strchr'
21585 d_strcoll='$d_strcoll'
21586 d_strctcpy='$d_strctcpy'
21587 d_strerrm='$d_strerrm'
21588 d_strerror='$d_strerror'
21589 d_strerror_r='$d_strerror_r'
21590 d_strftime='$d_strftime'
21591 d_strlcat='$d_strlcat'
21592 d_strlcpy='$d_strlcpy'
21593 d_strtod='$d_strtod'
21594 d_strtol='$d_strtol'
21595 d_strtold='$d_strtold'
21596 d_strtoll='$d_strtoll'
21597 d_strtoq='$d_strtoq'
21598 d_strtoul='$d_strtoul'
21599 d_strtoull='$d_strtoull'
21600 d_strtouq='$d_strtouq'
21601 d_strxfrm='$d_strxfrm'
21602 d_suidsafe='$d_suidsafe'
21603 d_symlink='$d_symlink'
21604 d_syscall='$d_syscall'
21605 d_syscallproto='$d_syscallproto'
21606 d_sysconf='$d_sysconf'
21607 d_sysernlst='$d_sysernlst'
21608 d_syserrlst='$d_syserrlst'
21609 d_system='$d_system'
21610 d_tcgetpgrp='$d_tcgetpgrp'
21611 d_tcsetpgrp='$d_tcsetpgrp'
21612 d_telldir='$d_telldir'
21613 d_telldirproto='$d_telldirproto'
21614 d_time='$d_time'
21615 d_times='$d_times'
21616 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21617 d_tm_tm_zone='$d_tm_tm_zone'
21618 d_tmpnam_r='$d_tmpnam_r'
21619 d_truncate='$d_truncate'
21620 d_ttyname_r='$d_ttyname_r'
21621 d_tzname='$d_tzname'
21622 d_u32align='$d_u32align'
21623 d_ualarm='$d_ualarm'
21624 d_umask='$d_umask'
21625 d_uname='$d_uname'
21626 d_union_semun='$d_union_semun'
21627 d_unordered='$d_unordered'
21628 d_unsetenv='$d_unsetenv'
21629 d_usleep='$d_usleep'
21630 d_usleepproto='$d_usleepproto'
21631 d_ustat='$d_ustat'
21632 d_vendorarch='$d_vendorarch'
21633 d_vendorbin='$d_vendorbin'
21634 d_vendorlib='$d_vendorlib'
21635 d_vendorscript='$d_vendorscript'
21636 d_vfork='$d_vfork'
21637 d_void_closedir='$d_void_closedir'
21638 d_voidsig='$d_voidsig'
21639 d_voidtty='$d_voidtty'
21640 d_volatile='$d_volatile'
21641 d_vprintf='$d_vprintf'
21642 d_vsnprintf='$d_vsnprintf'
21643 d_wait4='$d_wait4'
21644 d_waitpid='$d_waitpid'
21645 d_wcstombs='$d_wcstombs'
21646 d_wctomb='$d_wctomb'
21647 d_writev='$d_writev'
21648 d_xenix='$d_xenix'
21649 date='$date'
21650 db_hashtype='$db_hashtype'
21651 db_prefixtype='$db_prefixtype'
21652 db_version_major='$db_version_major'
21653 db_version_minor='$db_version_minor'
21654 db_version_patch='$db_version_patch'
21655 defvoidused='$defvoidused'
21656 direntrytype='$direntrytype'
21657 dlext='$dlext'
21658 dlsrc='$dlsrc'
21659 doublesize='$doublesize'
21660 drand01='$drand01'
21661 drand48_r_proto='$drand48_r_proto'
21662 dynamic_ext='$dynamic_ext'
21663 eagain='$eagain'
21664 ebcdic='$ebcdic'
21665 echo='$echo'
21666 egrep='$egrep'
21667 emacs='$emacs'
21668 endgrent_r_proto='$endgrent_r_proto'
21669 endhostent_r_proto='$endhostent_r_proto'
21670 endnetent_r_proto='$endnetent_r_proto'
21671 endprotoent_r_proto='$endprotoent_r_proto'
21672 endpwent_r_proto='$endpwent_r_proto'
21673 endservent_r_proto='$endservent_r_proto'
21674 eunicefix='$eunicefix'
21675 exe_ext='$exe_ext'
21676 expr='$expr'
21677 extensions='$extensions'
21678 extras='$extras'
21679 fflushNULL='$fflushNULL'
21680 fflushall='$fflushall'
21681 find='$find'
21682 firstmakefile='$firstmakefile'
21683 flex='$flex'
21684 fpossize='$fpossize'
21685 fpostype='$fpostype'
21686 freetype='$freetype'
21687 from='$from'
21688 full_ar='$full_ar'
21689 full_csh='$full_csh'
21690 full_sed='$full_sed'
21691 gccansipedantic='$gccansipedantic'
21692 gccosandvers='$gccosandvers'
21693 gccversion='$gccversion'
21694 getgrent_r_proto='$getgrent_r_proto'
21695 getgrgid_r_proto='$getgrgid_r_proto'
21696 getgrnam_r_proto='$getgrnam_r_proto'
21697 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21698 gethostbyname_r_proto='$gethostbyname_r_proto'
21699 gethostent_r_proto='$gethostent_r_proto'
21700 getlogin_r_proto='$getlogin_r_proto'
21701 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21702 getnetbyname_r_proto='$getnetbyname_r_proto'
21703 getnetent_r_proto='$getnetent_r_proto'
21704 getprotobyname_r_proto='$getprotobyname_r_proto'
21705 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21706 getprotoent_r_proto='$getprotoent_r_proto'
21707 getpwent_r_proto='$getpwent_r_proto'
21708 getpwnam_r_proto='$getpwnam_r_proto'
21709 getpwuid_r_proto='$getpwuid_r_proto'
21710 getservbyname_r_proto='$getservbyname_r_proto'
21711 getservbyport_r_proto='$getservbyport_r_proto'
21712 getservent_r_proto='$getservent_r_proto'
21713 getspnam_r_proto='$getspnam_r_proto'
21714 gidformat='$gidformat'
21715 gidsign='$gidsign'
21716 gidsize='$gidsize'
21717 gidtype='$gidtype'
21718 glibpth='$glibpth'
21719 gmake='$gmake'
21720 gmtime_r_proto='$gmtime_r_proto'
21721 gnulibc_version='$gnulibc_version'
21722 grep='$grep'
21723 groupcat='$groupcat'
21724 groupstype='$groupstype'
21725 gzip='$gzip'
21726 h_fcntl='$h_fcntl'
21727 h_sysfile='$h_sysfile'
21728 hint='$hint'
21729 hostcat='$hostcat'
21730 html1dir='$html1dir'
21731 html1direxp='$html1direxp'
21732 html3dir='$html3dir'
21733 html3direxp='$html3direxp'
21734 i16size='$i16size'
21735 i16type='$i16type'
21736 i32size='$i32size'
21737 i32type='$i32type'
21738 i64size='$i64size'
21739 i64type='$i64type'
21740 i8size='$i8size'
21741 i8type='$i8type'
21742 i_arpainet='$i_arpainet'
21743 i_bsdioctl='$i_bsdioctl'
21744 i_crypt='$i_crypt'
21745 i_db='$i_db'
21746 i_dbm='$i_dbm'
21747 i_dirent='$i_dirent'
21748 i_dld='$i_dld'
21749 i_dlfcn='$i_dlfcn'
21750 i_fcntl='$i_fcntl'
21751 i_float='$i_float'
21752 i_fp='$i_fp'
21753 i_fp_class='$i_fp_class'
21754 i_gdbm='$i_gdbm'
21755 i_grp='$i_grp'
21756 i_ieeefp='$i_ieeefp'
21757 i_inttypes='$i_inttypes'
21758 i_langinfo='$i_langinfo'
21759 i_libutil='$i_libutil'
21760 i_limits='$i_limits'
21761 i_locale='$i_locale'
21762 i_machcthr='$i_machcthr'
21763 i_malloc='$i_malloc'
21764 i_math='$i_math'
21765 i_memory='$i_memory'
21766 i_mntent='$i_mntent'
21767 i_ndbm='$i_ndbm'
21768 i_netdb='$i_netdb'
21769 i_neterrno='$i_neterrno'
21770 i_netinettcp='$i_netinettcp'
21771 i_niin='$i_niin'
21772 i_poll='$i_poll'
21773 i_prot='$i_prot'
21774 i_pthread='$i_pthread'
21775 i_pwd='$i_pwd'
21776 i_rpcsvcdbm='$i_rpcsvcdbm'
21777 i_sfio='$i_sfio'
21778 i_sgtty='$i_sgtty'
21779 i_shadow='$i_shadow'
21780 i_socks='$i_socks'
21781 i_stdarg='$i_stdarg'
21782 i_stddef='$i_stddef'
21783 i_stdlib='$i_stdlib'
21784 i_string='$i_string'
21785 i_sunmath='$i_sunmath'
21786 i_sysaccess='$i_sysaccess'
21787 i_sysdir='$i_sysdir'
21788 i_sysfile='$i_sysfile'
21789 i_sysfilio='$i_sysfilio'
21790 i_sysin='$i_sysin'
21791 i_sysioctl='$i_sysioctl'
21792 i_syslog='$i_syslog'
21793 i_sysmman='$i_sysmman'
21794 i_sysmode='$i_sysmode'
21795 i_sysmount='$i_sysmount'
21796 i_sysndir='$i_sysndir'
21797 i_sysparam='$i_sysparam'
21798 i_sysresrc='$i_sysresrc'
21799 i_syssecrt='$i_syssecrt'
21800 i_sysselct='$i_sysselct'
21801 i_syssockio='$i_syssockio'
21802 i_sysstat='$i_sysstat'
21803 i_sysstatfs='$i_sysstatfs'
21804 i_sysstatvfs='$i_sysstatvfs'
21805 i_systime='$i_systime'
21806 i_systimek='$i_systimek'
21807 i_systimes='$i_systimes'
21808 i_systypes='$i_systypes'
21809 i_sysuio='$i_sysuio'
21810 i_sysun='$i_sysun'
21811 i_sysutsname='$i_sysutsname'
21812 i_sysvfs='$i_sysvfs'
21813 i_syswait='$i_syswait'
21814 i_termio='$i_termio'
21815 i_termios='$i_termios'
21816 i_time='$i_time'
21817 i_unistd='$i_unistd'
21818 i_ustat='$i_ustat'
21819 i_utime='$i_utime'
21820 i_values='$i_values'
21821 i_varargs='$i_varargs'
21822 i_varhdr='$i_varhdr'
21823 i_vfork='$i_vfork'
21824 ignore_versioned_solibs='$ignore_versioned_solibs'
21825 inc_version_list='$inc_version_list'
21826 inc_version_list_init='$inc_version_list_init'
21827 incpath='$incpath'
21828 inews='$inews'
21829 installarchlib='$installarchlib'
21830 installbin='$installbin'
21831 installhtml1dir='$installhtml1dir'
21832 installhtml3dir='$installhtml3dir'
21833 installman1dir='$installman1dir'
21834 installman3dir='$installman3dir'
21835 installprefix='$installprefix'
21836 installprefixexp='$installprefixexp'
21837 installprivlib='$installprivlib'
21838 installscript='$installscript'
21839 installsitearch='$installsitearch'
21840 installsitebin='$installsitebin'
21841 installsitehtml1dir='$installsitehtml1dir'
21842 installsitehtml3dir='$installsitehtml3dir'
21843 installsitelib='$installsitelib'
21844 installsiteman1dir='$installsiteman1dir'
21845 installsiteman3dir='$installsiteman3dir'
21846 installsitescript='$installsitescript'
21847 installstyle='$installstyle'
21848 installusrbinperl='$installusrbinperl'
21849 installvendorarch='$installvendorarch'
21850 installvendorbin='$installvendorbin'
21851 installvendorhtml1dir='$installvendorhtml1dir'
21852 installvendorhtml3dir='$installvendorhtml3dir'
21853 installvendorlib='$installvendorlib'
21854 installvendorman1dir='$installvendorman1dir'
21855 installvendorman3dir='$installvendorman3dir'
21856 installvendorscript='$installvendorscript'
21857 intsize='$intsize'
21858 issymlink='$issymlink'
21859 ivdformat='$ivdformat'
21860 ivsize='$ivsize'
21861 ivtype='$ivtype'
21862 known_extensions='$known_extensions'
21863 ksh='$ksh'
21864 ld='$ld'
21865 lddlflags='$lddlflags'
21866 ldflags='$ldflags'
21867 ldflags_uselargefiles='$ldflags_uselargefiles'
21868 ldlibpthname='$ldlibpthname'
21869 less='$less'
21870 lib_ext='$lib_ext'
21871 libc='$libc'
21872 libperl='$libperl'
21873 libpth='$libpth'
21874 libs='$libs'
21875 libsdirs='$libsdirs'
21876 libsfiles='$libsfiles'
21877 libsfound='$libsfound'
21878 libspath='$libspath'
21879 libswanted='$libswanted'
21880 libswanted_uselargefiles='$libswanted_uselargefiles'
21881 line='$line'
21882 lint='$lint'
21883 lkflags='$lkflags'
21884 ln='$ln'
21885 lns='$lns'
21886 localtime_r_proto='$localtime_r_proto'
21887 locincpth='$locincpth'
21888 loclibpth='$loclibpth'
21889 longdblsize='$longdblsize'
21890 longlongsize='$longlongsize'
21891 longsize='$longsize'
21892 lp='$lp'
21893 lpr='$lpr'
21894 ls='$ls'
21895 lseeksize='$lseeksize'
21896 lseektype='$lseektype'
21897 mad='$mad'
21898 mail='$mail'
21899 mailx='$mailx'
21900 make='$make'
21901 make_set_make='$make_set_make'
21902 mallocobj='$mallocobj'
21903 mallocsrc='$mallocsrc'
21904 malloctype='$malloctype'
21905 man1dir='$man1dir'
21906 man1direxp='$man1direxp'
21907 man1ext='$man1ext'
21908 man3dir='$man3dir'
21909 man3direxp='$man3direxp'
21910 man3ext='$man3ext'
21911 mips_type='$mips_type'
21912 mistrustnm='$mistrustnm'
21913 mkdir='$mkdir'
21914 mmaptype='$mmaptype'
21915 modetype='$modetype'
21916 more='$more'
21917 multiarch='$multiarch'
21918 mv='$mv'
21919 myarchname='$myarchname'
21920 mydomain='$mydomain'
21921 myhostname='$myhostname'
21922 myuname='$myuname'
21923 n='$n'
21924 need_va_copy='$need_va_copy'
21925 netdb_hlen_type='$netdb_hlen_type'
21926 netdb_host_type='$netdb_host_type'
21927 netdb_name_type='$netdb_name_type'
21928 netdb_net_type='$netdb_net_type'
21929 nm='$nm'
21930 nm_opt='$nm_opt'
21931 nm_so_opt='$nm_so_opt'
21932 nonxs_ext='$nonxs_ext'
21933 nroff='$nroff'
21934 nvEUformat='$nvEUformat'
21935 nvFUformat='$nvFUformat'
21936 nvGUformat='$nvGUformat'
21937 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21938 nveformat='$nveformat'
21939 nvfformat='$nvfformat'
21940 nvgformat='$nvgformat'
21941 nvsize='$nvsize'
21942 nvtype='$nvtype'
21943 o_nonblock='$o_nonblock'
21944 obj_ext='$obj_ext'
21945 old_pthread_create_joinable='$old_pthread_create_joinable'
21946 optimize='$optimize'
21947 orderlib='$orderlib'
21948 osname='$osname'
21949 osvers='$osvers'
21950 otherlibdirs='$otherlibdirs'
21951 package='$package'
21952 pager='$pager'
21953 passcat='$passcat'
21954 patchlevel='$patchlevel'
21955 path_sep='$path_sep'
21956 perl5='$perl5'
21957 perl='$perl'
21958 perl_patchlevel='$perl_patchlevel'
21959 perladmin='$perladmin'
21960 perllibs='$perllibs'
21961 perlpath='$perlpath'
21962 pg='$pg'
21963 phostname='$phostname'
21964 pidtype='$pidtype'
21965 plibpth='$plibpth'
21966 pmake='$pmake'
21967 pr='$pr'
21968 prefix='$prefix'
21969 prefixexp='$prefixexp'
21970 privlib='$privlib'
21971 privlibexp='$privlibexp'
21972 procselfexe='$procselfexe'
21973 prototype='$prototype'
21974 ptrsize='$ptrsize'
21975 quadkind='$quadkind'
21976 quadtype='$quadtype'
21977 randbits='$randbits'
21978 randfunc='$randfunc'
21979 random_r_proto='$random_r_proto'
21980 randseedtype='$randseedtype'
21981 ranlib='$ranlib'
21982 rd_nodata='$rd_nodata'
21983 readdir64_r_proto='$readdir64_r_proto'
21984 readdir_r_proto='$readdir_r_proto'
21985 revision='$revision'
21986 rm='$rm'
21987 rmail='$rmail'
21988 run='$run'
21989 runnm='$runnm'
21990 sPRIEUldbl='$sPRIEUldbl'
21991 sPRIFUldbl='$sPRIFUldbl'
21992 sPRIGUldbl='$sPRIGUldbl'
21993 sPRIXU64='$sPRIXU64'
21994 sPRId64='$sPRId64'
21995 sPRIeldbl='$sPRIeldbl'
21996 sPRIfldbl='$sPRIfldbl'
21997 sPRIgldbl='$sPRIgldbl'
21998 sPRIi64='$sPRIi64'
21999 sPRIo64='$sPRIo64'
22000 sPRIu64='$sPRIu64'
22001 sPRIx64='$sPRIx64'
22002 sSCNfldbl='$sSCNfldbl'
22003 sched_yield='$sched_yield'
22004 scriptdir='$scriptdir'
22005 scriptdirexp='$scriptdirexp'
22006 sed='$sed'
22007 seedfunc='$seedfunc'
22008 selectminbits='$selectminbits'
22009 selecttype='$selecttype'
22010 sendmail='$sendmail'
22011 setgrent_r_proto='$setgrent_r_proto'
22012 sethostent_r_proto='$sethostent_r_proto'
22013 setlocale_r_proto='$setlocale_r_proto'
22014 setnetent_r_proto='$setnetent_r_proto'
22015 setprotoent_r_proto='$setprotoent_r_proto'
22016 setpwent_r_proto='$setpwent_r_proto'
22017 setservent_r_proto='$setservent_r_proto'
22018 sh='$sh'
22019 shar='$shar'
22020 sharpbang='$sharpbang'
22021 shmattype='$shmattype'
22022 shortsize='$shortsize'
22023 shrpenv='$shrpenv'
22024 shsharp='$shsharp'
22025 sig_count='$sig_count'
22026 sig_name='$sig_name'
22027 sig_name_init='$sig_name_init'
22028 sig_num='$sig_num'
22029 sig_num_init='$sig_num_init'
22030 sig_size='$sig_size'
22031 signal_t='$signal_t'
22032 sitearch='$sitearch'
22033 sitearchexp='$sitearchexp'
22034 sitebin='$sitebin'
22035 sitebinexp='$sitebinexp'
22036 sitehtml1dir='$sitehtml1dir'
22037 sitehtml1direxp='$sitehtml1direxp'
22038 sitehtml3dir='$sitehtml3dir'
22039 sitehtml3direxp='$sitehtml3direxp'
22040 sitelib='$sitelib'
22041 sitelib_stem='$sitelib_stem'
22042 sitelibexp='$sitelibexp'
22043 siteman1dir='$siteman1dir'
22044 siteman1direxp='$siteman1direxp'
22045 siteman3dir='$siteman3dir'
22046 siteman3direxp='$siteman3direxp'
22047 siteprefix='$siteprefix'
22048 siteprefixexp='$siteprefixexp'
22049 sitescript='$sitescript'
22050 sitescriptexp='$sitescriptexp'
22051 sizesize='$sizesize'
22052 sizetype='$sizetype'
22053 sleep='$sleep'
22054 smail='$smail'
22055 so='$so'
22056 sockethdr='$sockethdr'
22057 socketlib='$socketlib'
22058 socksizetype='$socksizetype'
22059 sort='$sort'
22060 spackage='$spackage'
22061 spitshell='$spitshell'
22062 srand48_r_proto='$srand48_r_proto'
22063 srandom_r_proto='$srandom_r_proto'
22064 src='$src'
22065 ssizetype='$ssizetype'
22066 startperl='$startperl'
22067 startsh='$startsh'
22068 static_ext='$static_ext'
22069 stdchar='$stdchar'
22070 stdio_base='$stdio_base'
22071 stdio_bufsiz='$stdio_bufsiz'
22072 stdio_cnt='$stdio_cnt'
22073 stdio_filbuf='$stdio_filbuf'
22074 stdio_ptr='$stdio_ptr'
22075 stdio_stream_array='$stdio_stream_array'
22076 strerror_r_proto='$strerror_r_proto'
22077 strings='$strings'
22078 submit='$submit'
22079 subversion='$subversion'
22080 sysman='$sysman'
22081 tail='$tail'
22082 tar='$tar'
22083 targetarch='$targetarch'
22084 tbl='$tbl'
22085 tee='$tee'
22086 test='$test'
22087 timeincl='$timeincl'
22088 timetype='$timetype'
22089 tmpnam_r_proto='$tmpnam_r_proto'
22090 to='$to'
22091 touch='$touch'
22092 tr='$tr'
22093 trnl='$trnl'
22094 troff='$troff'
22095 ttyname_r_proto='$ttyname_r_proto'
22096 u16size='$u16size'
22097 u16type='$u16type'
22098 u32size='$u32size'
22099 u32type='$u32type'
22100 u64size='$u64size'
22101 u64type='$u64type'
22102 u8size='$u8size'
22103 u8type='$u8type'
22104 uidformat='$uidformat'
22105 uidsign='$uidsign'
22106 uidsize='$uidsize'
22107 uidtype='$uidtype'
22108 uname='$uname'
22109 uniq='$uniq'
22110 uquadtype='$uquadtype'
22111 use5005threads='$use5005threads'
22112 use64bitall='$use64bitall'
22113 use64bitint='$use64bitint'
22114 usecrosscompile='$usecrosscompile'
22115 usedl='$usedl'
22116 usefaststdio='$usefaststdio'
22117 useithreads='$useithreads'
22118 uselargefiles='$uselargefiles'
22119 uselongdouble='$uselongdouble'
22120 usemallocwrap='$usemallocwrap'
22121 usemorebits='$usemorebits'
22122 usemultiplicity='$usemultiplicity'
22123 usemymalloc='$usemymalloc'
22124 usenm='$usenm'
22125 useopcode='$useopcode'
22126 useperlio='$useperlio'
22127 useposix='$useposix'
22128 usereentrant='$usereentrant'
22129 userelocatableinc='$userelocatableinc'
22130 usesfio='$usesfio'
22131 useshrplib='$useshrplib'
22132 usesitecustomize='$usesitecustomize'
22133 usesocks='$usesocks'
22134 usethreads='$usethreads'
22135 usevendorprefix='$usevendorprefix'
22136 usevfork='$usevfork'
22137 usrinc='$usrinc'
22138 uuname='$uuname'
22139 uvXUformat='$uvXUformat'
22140 uvoformat='$uvoformat'
22141 uvsize='$uvsize'
22142 uvtype='$uvtype'
22143 uvuformat='$uvuformat'
22144 uvxformat='$uvxformat'
22145 vendorarch='$vendorarch'
22146 vendorarchexp='$vendorarchexp'
22147 vendorbin='$vendorbin'
22148 vendorbinexp='$vendorbinexp'
22149 vendorhtml1dir='$vendorhtml1dir'
22150 vendorhtml1direxp='$vendorhtml1direxp'
22151 vendorhtml3dir='$vendorhtml3dir'
22152 vendorhtml3direxp='$vendorhtml3direxp'
22153 vendorlib='$vendorlib'
22154 vendorlib_stem='$vendorlib_stem'
22155 vendorlibexp='$vendorlibexp'
22156 vendorman1dir='$vendorman1dir'
22157 vendorman1direxp='$vendorman1direxp'
22158 vendorman3dir='$vendorman3dir'
22159 vendorman3direxp='$vendorman3direxp'
22160 vendorprefix='$vendorprefix'
22161 vendorprefixexp='$vendorprefixexp'
22162 vendorscript='$vendorscript'
22163 vendorscriptexp='$vendorscriptexp'
22164 version='$version'
22165 version_patchlevel_string='$version_patchlevel_string'
22166 versiononly='$versiononly'
22167 vi='$vi'
22168 voidflags='$voidflags'
22169 xlibpth='$xlibpth'
22170 yacc='$yacc'
22171 yaccflags='$yaccflags'
22172 zcat='$zcat'
22173 zip='$zip'
22174 EOT
22175
22176 : Add in command line options if available
22177 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22178
22179 : add special variables
22180 $test -f $src/patchlevel.h && \
22181 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22182 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22183 echo "PERL_CONFIG_SH=true" >>config.sh
22184
22185 : propagate old symbols
22186 if $test -f UU/config.sh; then
22187         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22188         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22189         $sort | $uniq -u >UU/oldsyms
22190         set X `cat UU/oldsyms`
22191         shift
22192         case $# in
22193         0) ;;
22194         *)
22195                 cat <<EOM
22196 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22197 EOM
22198                 echo "# Variables propagated from previous config.sh file." >>config.sh
22199                 for sym in `cat UU/oldsyms`; do
22200                         echo "    Propagating $hint variable "'$'"$sym..."
22201                         eval 'tmp="$'"${sym}"'"'
22202                         echo "$tmp" | \
22203                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22204                 done
22205                 ;;
22206         esac
22207 fi
22208
22209 : Finish up by extracting the .SH files
22210 case "$alldone" in
22211 exit)
22212         $rm -rf UU
22213         echo "Extraction done."
22214         exit 0
22215         ;;
22216 cont)
22217         ;;
22218 '')
22219         dflt=''
22220         nostick=true
22221         $cat <<EOM
22222
22223 If you'd like to make any changes to the config.sh file before I begin
22224 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22225
22226 EOM
22227         rp="Press return or use a shell escape to edit config.sh:"
22228         . UU/myread
22229         nostick=''
22230         case "$ans" in
22231         '') ;;
22232         *) : in case they cannot read
22233                 sh 1>&4 -c "$ans";;
22234         esac
22235         ;;
22236 esac
22237
22238 : if this fails, just run all the .SH files by hand
22239 . ./config.sh
22240
22241 echo " "
22242 exec 1>&4
22243 pwd=`pwd`
22244 . ./UU/extract
22245 cd "$pwd"
22246
22247 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22248         dflt=y
22249         case "$silent" in
22250         true) ;;
22251         *)
22252                 $cat <<EOM
22253
22254 Now you need to generate make dependencies by running "$make depend".
22255 You might prefer to run it in background: "$make depend > makedepend.out &"
22256 It can take a while, so you might not want to run it right now.
22257
22258 EOM
22259                 ;;
22260         esac
22261         rp="Run $make depend now?"
22262         . UU/myread
22263         case "$ans" in
22264         y*)
22265                 $make depend && echo "Now you must run '$make'."
22266                 ;;
22267         *)
22268                 echo "You must run '$make depend' then '$make'."
22269                 ;;
22270         esac
22271 elif test -f [Mm]akefile; then
22272         echo " "
22273         echo "Now you must run a $make."
22274 else
22275         echo "Configure done."
22276 fi
22277
22278 if $test -f Policy.sh; then
22279     $cat <<EOM
22280
22281 If you compile $package on a different machine or from a different object
22282 directory, copy the Policy.sh file from this object directory to the
22283 new one before you run Configure -- this will help you with most of
22284 the policy defaults.
22285
22286 EOM
22287 fi
22288 if $test -f config.msg; then
22289     echo "Hmm.  I also noted the following information while running:"
22290     echo " "
22291     $cat config.msg >&4
22292     $rm -f config.msg
22293 fi
22294 $rm -f kit*isdone ark*isdone
22295 $rm -rf UU
22296
22297 : End of Configure
22298