This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Mon May 22 19:21:39 CEST 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_c99_variadic_macros=''
363 d_casti32=''
364 castflags=''
365 d_castneg=''
366 d_chown=''
367 d_chroot=''
368 d_chsize=''
369 d_class=''
370 d_clearenv=''
371 d_closedir=''
372 d_void_closedir=''
373 d_cmsghdr_s=''
374 d_const=''
375 d_copysignl=''
376 cryptlib=''
377 d_crypt=''
378 crypt_r_proto=''
379 d_crypt_r=''
380 d_csh=''
381 full_csh=''
382 ctermid_r_proto=''
383 d_ctermid_r=''
384 ctime_r_proto=''
385 d_ctime_r=''
386 d_cuserid=''
387 d_dbl_dig=''
388 d_dbminitproto=''
389 d_difftime=''
390 d_dirfd=''
391 d_dlerror=''
392 d_dlopen=''
393 d_dlsymun=''
394 d_dosuid=''
395 d_suidsafe=''
396 d_drand48_r=''
397 drand48_r_proto=''
398 d_drand48proto=''
399 d_dup2=''
400 d_eaccess=''
401 d_endgrent=''
402 d_endgrent_r=''
403 endgrent_r_proto=''
404 d_endhent=''
405 d_endhostent_r=''
406 endhostent_r_proto=''
407 d_endnent=''
408 d_endnetent_r=''
409 endnetent_r_proto=''
410 d_endpent=''
411 d_endprotoent_r=''
412 endprotoent_r_proto=''
413 d_endpwent=''
414 d_endpwent_r=''
415 endpwent_r_proto=''
416 d_endsent=''
417 d_endservent_r=''
418 endservent_r_proto=''
419 d_faststdio=''
420 d_fchdir=''
421 d_fchmod=''
422 d_fchown=''
423 d_fcntl=''
424 d_fcntl_can_lock=''
425 d_fd_macros=''
426 d_fd_set=''
427 d_fds_bits=''
428 d_fgetpos=''
429 d_finite=''
430 d_finitel=''
431 d_flexfnam=''
432 d_flock=''
433 d_flockproto=''
434 d_fork=''
435 d_fp_class=''
436 d_fpclass=''
437 d_fpclassify=''
438 d_fpclassl=''
439 d_fpos64_t=''
440 d_frexpl=''
441 d_fs_data_s=''
442 d_fseeko=''
443 d_fsetpos=''
444 d_fstatfs=''
445 d_fsync=''
446 d_ftello=''
447 d_ftime=''
448 d_gettimeod=''
449 d_futimes=''
450 d_Gconvert=''
451 d_getcwd=''
452 d_getespwnam=''
453 d_getfsstat=''
454 d_getgrent=''
455 d_getgrent_r=''
456 getgrent_r_proto=''
457 d_getgrgid_r=''
458 getgrgid_r_proto=''
459 d_getgrnam_r=''
460 getgrnam_r_proto=''
461 d_getgrps=''
462 d_gethbyaddr=''
463 d_gethbyname=''
464 d_gethent=''
465 aphostname=''
466 d_gethname=''
467 d_phostname=''
468 d_uname=''
469 d_gethostbyaddr_r=''
470 gethostbyaddr_r_proto=''
471 d_gethostbyname_r=''
472 gethostbyname_r_proto=''
473 d_gethostent_r=''
474 gethostent_r_proto=''
475 d_gethostprotos=''
476 d_getitimer=''
477 d_getlogin=''
478 d_getlogin_r=''
479 getlogin_r_proto=''
480 d_getmnt=''
481 d_getmntent=''
482 d_getnbyaddr=''
483 d_getnbyname=''
484 d_getnent=''
485 d_getnetbyaddr_r=''
486 getnetbyaddr_r_proto=''
487 d_getnetbyname_r=''
488 getnetbyname_r_proto=''
489 d_getnetent_r=''
490 getnetent_r_proto=''
491 d_getnetprotos=''
492 d_getpagsz=''
493 d_getpent=''
494 d_getpgid=''
495 d_getpgrp2=''
496 d_bsdgetpgrp=''
497 d_getpgrp=''
498 d_getppid=''
499 d_getprior=''
500 d_getpbyname=''
501 d_getpbynumber=''
502 d_getprotobyname_r=''
503 getprotobyname_r_proto=''
504 d_getprotobynumber_r=''
505 getprotobynumber_r_proto=''
506 d_getprotoent_r=''
507 getprotoent_r_proto=''
508 d_getprotoprotos=''
509 d_getprpwnam=''
510 d_getpwent=''
511 d_getpwent_r=''
512 getpwent_r_proto=''
513 d_getpwnam_r=''
514 getpwnam_r_proto=''
515 d_getpwuid_r=''
516 getpwuid_r_proto=''
517 d_getsent=''
518 d_getservbyname_r=''
519 getservbyname_r_proto=''
520 d_getservbyport_r=''
521 getservbyport_r_proto=''
522 d_getservent_r=''
523 getservent_r_proto=''
524 d_getservprotos=''
525 d_getspnam=''
526 d_getspnam_r=''
527 getspnam_r_proto=''
528 d_getsbyname=''
529 d_getsbyport=''
530 d_gmtime_r=''
531 gmtime_r_proto=''
532 d_gnulibc=''
533 gnulibc_version=''
534 d_hasmntopt=''
535 d_htonl=''
536 d_ilogbl=''
537 d_inetaton=''
538 d_int64_t=''
539 d_isascii=''
540 d_isfinite=''
541 d_isinf=''
542 d_isnan=''
543 d_isnanl=''
544 d_killpg=''
545 d_lchown=''
546 d_ldbl_dig=''
547 d_libm_lib_version=''
548 d_link=''
549 d_localtime_r=''
550 localtime_r_proto=''
551 d_locconv=''
552 d_lockf=''
553 d_longdbl=''
554 longdblsize=''
555 d_longlong=''
556 longlongsize=''
557 d_lseekproto=''
558 d_lstat=''
559 d_madvise=''
560 d_malloc_good_size=''
561 d_malloc_size=''
562 d_mblen=''
563 d_mbstowcs=''
564 d_mbtowc=''
565 d_memchr=''
566 d_memcmp=''
567 d_memcpy=''
568 d_memmove=''
569 d_memset=''
570 d_mkdir=''
571 d_mkdtemp=''
572 d_mkfifo=''
573 d_mkstemp=''
574 d_mkstemps=''
575 d_mktime=''
576 d_mmap=''
577 mmaptype=''
578 d_modfl=''
579 d_modfl_pow32_bug=''
580 d_modflproto=''
581 d_mprotect=''
582 d_msg=''
583 d_msgctl=''
584 d_msgget=''
585 d_msghdr_s=''
586 d_msgrcv=''
587 d_msgsnd=''
588 d_msync=''
589 d_munmap=''
590 d_nice=''
591 d_nl_langinfo=''
592 d_off64_t=''
593 d_open3=''
594 d_fpathconf=''
595 d_pathconf=''
596 d_pause=''
597 d_pipe=''
598 d_poll=''
599 d_portable=''
600 d_procselfexe=''
601 procselfexe=''
602 d_old_pthread_create_joinable=''
603 old_pthread_create_joinable=''
604 d_pthread_atfork=''
605 d_pthread_attr_setscope=''
606 d_pthread_yield=''
607 d_sched_yield=''
608 sched_yield=''
609 d_qgcvt=''
610 d_random_r=''
611 random_r_proto=''
612 d_readdir64_r=''
613 readdir64_r_proto=''
614 d_readdir=''
615 d_rewinddir=''
616 d_seekdir=''
617 d_telldir=''
618 d_readdir_r=''
619 readdir_r_proto=''
620 d_readlink=''
621 d_readv=''
622 d_recvmsg=''
623 d_rename=''
624 d_rmdir=''
625 d_safebcpy=''
626 d_safemcpy=''
627 d_sanemcmp=''
628 d_sbrkproto=''
629 d_scalbnl=''
630 d_select=''
631 d_sem=''
632 d_semctl=''
633 d_semget=''
634 d_semop=''
635 d_sendmsg=''
636 d_setegid=''
637 d_seteuid=''
638 d_setgrent=''
639 d_setgrent_r=''
640 setgrent_r_proto=''
641 d_setgrps=''
642 d_sethent=''
643 d_sethostent_r=''
644 sethostent_r_proto=''
645 d_setitimer=''
646 d_setlinebuf=''
647 d_setlocale=''
648 d_setlocale_r=''
649 setlocale_r_proto=''
650 d_setnent=''
651 d_setnetent_r=''
652 setnetent_r_proto=''
653 d_setpent=''
654 d_setpgid=''
655 d_setpgrp2=''
656 d_bsdsetpgrp=''
657 d_setpgrp=''
658 d_setprior=''
659 d_setproctitle=''
660 d_setprotoent_r=''
661 setprotoent_r_proto=''
662 d_setpwent=''
663 d_setpwent_r=''
664 setpwent_r_proto=''
665 d_setregid=''
666 d_setresgid=''
667 d_setresuid=''
668 d_setreuid=''
669 d_setrgid=''
670 d_setruid=''
671 d_setsent=''
672 d_setservent_r=''
673 setservent_r_proto=''
674 d_setsid=''
675 d_setvbuf=''
676 d_sfio=''
677 usesfio=''
678 d_shm=''
679 d_shmat=''
680 d_shmatprototype=''
681 shmattype=''
682 d_shmctl=''
683 d_shmdt=''
684 d_shmget=''
685 d_sigaction=''
686 d_sigprocmask=''
687 d_sigsetjmp=''
688 usesitecustomize=''
689 d_snprintf=''
690 d_vsnprintf=''
691 d_sockatmark=''
692 d_sockatmarkproto=''
693 d_msg_ctrunc=''
694 d_msg_dontroute=''
695 d_msg_oob=''
696 d_msg_peek=''
697 d_msg_proxy=''
698 d_oldsock=''
699 d_scm_rights=''
700 d_socket=''
701 d_sockpair=''
702 sockethdr=''
703 socketlib=''
704 d_socklen_t=''
705 d_socks5_init=''
706 d_sprintf_returns_strlen=''
707 d_sqrtl=''
708 d_srand48_r=''
709 srand48_r_proto=''
710 d_srandom_r=''
711 srandom_r_proto=''
712 d_sresgproto=''
713 d_sresuproto=''
714 d_statblks=''
715 d_statfs_f_flags=''
716 d_statfs_s=''
717 d_fstatvfs=''
718 d_statvfs=''
719 d_stdio_cnt_lval=''
720 d_stdio_ptr_lval=''
721 d_stdio_ptr_lval_nochange_cnt=''
722 d_stdio_ptr_lval_sets_cnt=''
723 d_stdiobase=''
724 d_stdstdio=''
725 stdio_base=''
726 stdio_bufsiz=''
727 stdio_cnt=''
728 stdio_filbuf=''
729 stdio_ptr=''
730 d_index=''
731 d_strchr=''
732 d_strcoll=''
733 d_strctcpy=''
734 d_strerrm=''
735 d_strerror=''
736 d_sysernlst=''
737 d_syserrlst=''
738 d_strerror_r=''
739 strerror_r_proto=''
740 d_strftime=''
741 d_strlcat=''
742 d_strlcpy=''
743 d_strtod=''
744 d_strtol=''
745 d_strtold=''
746 d_strtoll=''
747 d_strtoq=''
748 d_strtoul=''
749 d_strtoull=''
750 d_strtouq=''
751 d_strxfrm=''
752 d_symlink=''
753 d_syscall=''
754 d_syscallproto=''
755 d_sysconf=''
756 d_system=''
757 d_tcgetpgrp=''
758 d_tcsetpgrp=''
759 d_telldirproto=''
760 d_time=''
761 timetype=''
762 clocktype=''
763 d_times=''
764 d_tmpnam_r=''
765 tmpnam_r_proto=''
766 d_truncate=''
767 d_ttyname_r=''
768 ttyname_r_proto=''
769 d_tzname=''
770 d_u32align=''
771 d_ualarm=''
772 d_umask=''
773 d_semctl_semid_ds=''
774 d_semctl_semun=''
775 d_union_semun=''
776 d_unordered=''
777 d_unsetenv=''
778 d_usleep=''
779 d_usleepproto=''
780 d_ustat=''
781 d_vfork=''
782 usevfork=''
783 d_voidsig=''
784 signal_t=''
785 d_volatile=''
786 d_charvspr=''
787 d_vprintf=''
788 d_wait4=''
789 d_waitpid=''
790 d_wcstombs=''
791 d_wctomb=''
792 d_writev=''
793 dlext=''
794 cccdlflags=''
795 ccdlflags=''
796 dlsrc=''
797 ld=''
798 lddlflags=''
799 usedl=''
800 doublesize=''
801 ebcdic=''
802 fflushNULL=''
803 fflushall=''
804 fpossize=''
805 fpostype=''
806 gccansipedantic=''
807 gccosandvers=''
808 gccversion=''
809 gidformat=''
810 gidsign=''
811 gidsize=''
812 gidtype=''
813 groupstype=''
814 h_fcntl=''
815 h_sysfile=''
816 html1dir=''
817 html1direxp=''
818 installhtml1dir=''
819 html3dir=''
820 html3direxp=''
821 installhtml3dir=''
822 i_arpainet=''
823 i_crypt=''
824 db_hashtype=''
825 db_prefixtype=''
826 db_version_major=''
827 db_version_minor=''
828 db_version_patch=''
829 i_db=''
830 i_dbm=''
831 i_rpcsvcdbm=''
832 d_dirnamlen=''
833 direntrytype=''
834 i_dirent=''
835 i_dld=''
836 i_dlfcn=''
837 i_fcntl=''
838 i_float=''
839 i_fp=''
840 i_fp_class=''
841 i_gdbm=''
842 d_grpasswd=''
843 i_grp=''
844 i_ieeefp=''
845 i_inttypes=''
846 i_langinfo=''
847 i_libutil=''
848 i_limits=''
849 i_locale=''
850 i_machcthr=''
851 i_malloc=''
852 i_math=''
853 i_memory=''
854 i_mntent=''
855 i_ndbm=''
856 i_netdb=''
857 i_neterrno=''
858 i_netinettcp=''
859 i_niin=''
860 i_sysin=''
861 i_poll=''
862 i_prot=''
863 i_pthread=''
864 d_pwage=''
865 d_pwchange=''
866 d_pwclass=''
867 d_pwcomment=''
868 d_pwexpire=''
869 d_pwgecos=''
870 d_pwpasswd=''
871 d_pwquota=''
872 i_pwd=''
873 i_sfio=''
874 i_shadow=''
875 i_socks=''
876 i_stddef=''
877 i_stdlib=''
878 i_string=''
879 strings=''
880 i_sunmath=''
881 i_sysaccess=''
882 i_sysdir=''
883 i_sysfile=''
884 d_voidtty=''
885 i_bsdioctl=''
886 i_sysfilio=''
887 i_sysioctl=''
888 i_syssockio=''
889 i_syslog=''
890 i_sysmman=''
891 i_sysmode=''
892 i_sysmount=''
893 i_sysndir=''
894 i_sysparam=''
895 i_sysresrc=''
896 i_syssecrt=''
897 i_sysselct=''
898 i_sysstat=''
899 i_sysstatfs=''
900 i_sysstatvfs=''
901 i_systimes=''
902 i_systypes=''
903 i_sysuio=''
904 i_sysun=''
905 i_sysutsname=''
906 i_sysvfs=''
907 i_syswait=''
908 i_sgtty=''
909 i_termio=''
910 i_termios=''
911 d_tm_tm_gmtoff=''
912 d_tm_tm_zone=''
913 i_systime=''
914 i_systimek=''
915 i_time=''
916 timeincl=''
917 i_unistd=''
918 i_ustat=''
919 i_utime=''
920 i_values=''
921 i_stdarg=''
922 i_varargs=''
923 i_varhdr=''
924 i_vfork=''
925 d_inc_version_list=''
926 inc_version_list=''
927 inc_version_list_init=''
928 installprefix=''
929 installprefixexp=''
930 installstyle=''
931 installusrbinperl=''
932 intsize=''
933 longsize=''
934 shortsize=''
935 issymlink=''
936 libc=''
937 ldlibpthname=''
938 libperl=''
939 shrpenv=''
940 useshrplib=''
941 glibpth=''
942 libpth=''
943 loclibpth=''
944 plibpth=''
945 xlibpth=''
946 ignore_versioned_solibs=''
947 libs=''
948 libsdirs=''
949 libsfiles=''
950 libsfound=''
951 libspath=''
952 lns=''
953 d_PRIEUldbl=''
954 d_PRIFUldbl=''
955 d_PRIGUldbl=''
956 d_PRIeldbl=''
957 d_PRIfldbl=''
958 d_PRIgldbl=''
959 d_SCNfldbl=''
960 sPRIEUldbl=''
961 sPRIFUldbl=''
962 sPRIGUldbl=''
963 sPRIeldbl=''
964 sPRIfldbl=''
965 sPRIgldbl=''
966 sSCNfldbl=''
967 lseeksize=''
968 lseektype=''
969 mad=''
970 madlyh=''
971 madlyobj=''
972 madlysrc=''
973 make_set_make=''
974 d_mymalloc=''
975 freetype=''
976 mallocobj=''
977 mallocsrc=''
978 malloctype=''
979 usemallocwrap=''
980 usemymalloc=''
981 installman1dir=''
982 man1dir=''
983 man1direxp=''
984 man1ext=''
985 installman3dir=''
986 man3dir=''
987 man3direxp=''
988 man3ext=''
989 modetype=''
990 multiarch=''
991 mydomain=''
992 myhostname=''
993 phostname=''
994 c=''
995 n=''
996 d_eofnblk=''
997 eagain=''
998 o_nonblock=''
999 rd_nodata=''
1000 need_va_copy=''
1001 netdb_hlen_type=''
1002 netdb_host_type=''
1003 netdb_name_type=''
1004 netdb_net_type=''
1005 groupcat=''
1006 hostcat=''
1007 passcat=''
1008 orderlib=''
1009 ranlib=''
1010 d_perl_otherlibdirs=''
1011 otherlibdirs=''
1012 package=''
1013 spackage=''
1014 pager=''
1015 api_revision=''
1016 api_subversion=''
1017 api_version=''
1018 api_versionstring=''
1019 patchlevel=''
1020 perl_patchlevel=''
1021 revision=''
1022 subversion=''
1023 version=''
1024 version_patchlevel_string=''
1025 perl5=''
1026 perladmin=''
1027 perlpath=''
1028 d_nv_preserves_uv=''
1029 d_nv_zero_is_allbits_zero=''
1030 i16size=''
1031 i16type=''
1032 i32size=''
1033 i32type=''
1034 i64size=''
1035 i64type=''
1036 i8size=''
1037 i8type=''
1038 ivsize=''
1039 ivtype=''
1040 nv_preserves_uv_bits=''
1041 nvsize=''
1042 nvtype=''
1043 u16size=''
1044 u16type=''
1045 u32size=''
1046 u32type=''
1047 u64size=''
1048 u64type=''
1049 u8size=''
1050 u8type=''
1051 uvsize=''
1052 uvtype=''
1053 ivdformat=''
1054 nvEUformat=''
1055 nvFUformat=''
1056 nvGUformat=''
1057 nveformat=''
1058 nvfformat=''
1059 nvgformat=''
1060 uvXUformat=''
1061 uvoformat=''
1062 uvuformat=''
1063 uvxformat=''
1064 pidtype=''
1065 prefix=''
1066 prefixexp=''
1067 installprivlib=''
1068 privlib=''
1069 privlibexp=''
1070 prototype=''
1071 ptrsize=''
1072 d_PRIXU64=''
1073 d_PRId64=''
1074 d_PRIi64=''
1075 d_PRIo64=''
1076 d_PRIu64=''
1077 d_PRIx64=''
1078 sPRIXU64=''
1079 sPRId64=''
1080 sPRIi64=''
1081 sPRIo64=''
1082 sPRIu64=''
1083 sPRIx64=''
1084 d_quad=''
1085 quadkind=''
1086 quadtype=''
1087 uquadtype=''
1088 drand01=''
1089 randbits=''
1090 randfunc=''
1091 randseedtype=''
1092 seedfunc=''
1093 installscript=''
1094 scriptdir=''
1095 scriptdirexp=''
1096 selectminbits=''
1097 selecttype=''
1098 sh=''
1099 sig_count=''
1100 sig_name=''
1101 sig_name_init=''
1102 sig_num=''
1103 sig_num_init=''
1104 sig_size=''
1105 d_sitearch=''
1106 installsitearch=''
1107 sitearch=''
1108 sitearchexp=''
1109 installsitebin=''
1110 sitebin=''
1111 sitebinexp=''
1112 installsitehtml1dir=''
1113 sitehtml1dir=''
1114 sitehtml1direxp=''
1115 installsitehtml3dir=''
1116 sitehtml3dir=''
1117 sitehtml3direxp=''
1118 installsitelib=''
1119 sitelib=''
1120 sitelib_stem=''
1121 sitelibexp=''
1122 installsiteman1dir=''
1123 siteman1dir=''
1124 siteman1direxp=''
1125 installsiteman3dir=''
1126 siteman3dir=''
1127 siteman3direxp=''
1128 siteprefix=''
1129 siteprefixexp=''
1130 installsitescript=''
1131 sitescript=''
1132 sitescriptexp=''
1133 sizesize=''
1134 sizetype=''
1135 so=''
1136 socksizetype=''
1137 sharpbang=''
1138 shsharp=''
1139 spitshell=''
1140 src=''
1141 ssizetype=''
1142 startperl=''
1143 startsh=''
1144 stdchar=''
1145 d_stdio_stream_array=''
1146 stdio_stream_array=''
1147 sysman=''
1148 trnl=''
1149 uidformat=''
1150 uidsign=''
1151 uidsize=''
1152 uidtype=''
1153 archname64=''
1154 use64bitall=''
1155 use64bitint=''
1156 usefaststdio=''
1157 ccflags_uselargefiles=''
1158 ldflags_uselargefiles=''
1159 libswanted_uselargefiles=''
1160 uselargefiles=''
1161 uselongdouble=''
1162 usemorebits=''
1163 usemultiplicity=''
1164 nm_opt=''
1165 nm_so_opt=''
1166 runnm=''
1167 usenm=''
1168 useperlio=''
1169 usesocks=''
1170 d_oldpthreads=''
1171 use5005threads=''
1172 useithreads=''
1173 usereentrant=''
1174 usethreads=''
1175 incpath=''
1176 mips_type=''
1177 usrinc=''
1178 d_vendorarch=''
1179 installvendorarch=''
1180 vendorarch=''
1181 vendorarchexp=''
1182 d_vendorbin=''
1183 installvendorbin=''
1184 vendorbin=''
1185 vendorbinexp=''
1186 installvendorhtml1dir=''
1187 vendorhtml1dir=''
1188 vendorhtml1direxp=''
1189 installvendorhtml3dir=''
1190 vendorhtml3dir=''
1191 vendorhtml3direxp=''
1192 d_vendorlib=''
1193 installvendorlib=''
1194 vendorlib=''
1195 vendorlib_stem=''
1196 vendorlibexp=''
1197 installvendorman1dir=''
1198 vendorman1dir=''
1199 vendorman1direxp=''
1200 installvendorman3dir=''
1201 vendorman3dir=''
1202 vendorman3direxp=''
1203 usevendorprefix=''
1204 vendorprefix=''
1205 vendorprefixexp=''
1206 d_vendorscript=''
1207 installvendorscript=''
1208 vendorscript=''
1209 vendorscriptexp=''
1210 versiononly=''
1211 defvoidused=''
1212 voidflags=''
1213 yacc=''
1214 yaccflags=''
1215 CONFIG=''
1216
1217 define='define'
1218 undef='undef'
1219 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1220 rmlist=''
1221
1222 : We must find out about Eunice early
1223 eunicefix=':'
1224 if test -f /etc/unixtovms; then
1225         eunicefix=/etc/unixtovms
1226 fi
1227 if test -f /etc/unixtovms.exe; then
1228         eunicefix=/etc/unixtovms.exe
1229 fi
1230
1231 : Set executable suffix now -- needed before hints available
1232 if test -f "/libs/version.library"; then
1233 : Amiga OS
1234     _exe=""
1235 elif test -f "/system/gnu_library/bin/ar.pm"; then
1236 : Stratus VOS
1237     _exe=".pm"
1238 elif test -n "$DJGPP"; then
1239 : DOS DJGPP
1240     _exe=".exe"
1241 elif test -d c:/. -o -n "$is_os2" ; then
1242 : OS/2 or cygwin
1243     _exe=".exe"
1244 fi
1245
1246 i_whoami=''
1247 ccname=''
1248 ccversion=''
1249 perllibs=''
1250 : set useposix=false in your hint file to disable the POSIX extension.
1251 useposix=true
1252 : set useopcode=false in your hint file to disable the Opcode extension.
1253 useopcode=true
1254 : Trailing extension.  Override this in a hint file, if needed.
1255 : Extra object files, if any, needed on this platform.
1256 archobjs=''
1257 archname=''
1258 : Possible local include directories to search.
1259 : Set locincpth to "" in a hint file to defeat local include searches.
1260 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1261 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1262 :
1263 : no include file wanted by default
1264 inclwanted=''
1265
1266 : Enable -DEBUGGING and -DDEBUGGING from the command line
1267 EBUGGING=''
1268 DEBUGGING=old
1269
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283
1284 : Private path used by Configure to find libraries.  Its value
1285 : is prepended to libpth. This variable takes care of special
1286 : machines, like the mips.  Usually, it should be empty.
1287 plibpth=''
1288
1289 : default library list
1290 libswanted=''
1291 : some systems want to use only the non-versioned libso:s
1292 ignore_versioned_solibs=''
1293 siteman1dir=''
1294 siteman3dir=''
1295 sitescript=''
1296 archname64=''
1297 ccflags_uselargefiles=''
1298 ldflags_uselargefiles=''
1299 libswanted_uselargefiles=''
1300 : set usemultiplicity on the Configure command line to enable multiplicity.
1301 : set usesocks on the Configure command line to enable socks.
1302 : set usethreads on the Configure command line to enable threads.
1303 usereentrant='undef'
1304 : full support for void wanted by default
1305 defvoidused=15
1306
1307 : List of libraries we want.
1308 : If anyone needs extra -lxxx, put those in a hint file.
1309 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1310 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1311 : We probably want to search /usr/shlib before most other libraries.
1312 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1313 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1314 glibpth="/usr/shlib $glibpth"
1315 : Do not use vfork unless overridden by a hint file.
1316 usevfork=false
1317
1318 : Find the basic shell for Bourne shell scripts
1319 case "$sh" in
1320 '')
1321         case "$SYSTYPE" in
1322         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1323         *) xxx='/bin/sh';;
1324         esac
1325         if test -f "$xxx"; then
1326                 sh="$xxx"
1327         else
1328                 : Build up a list and do a single loop so we can 'break' out.
1329                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1330                 for xxx in sh bash ksh pdksh ash; do
1331                         for p in $pth; do
1332                                 try="$try ${p}/${xxx}"
1333                         done
1334                 done
1335                 for xxx in $try; do
1336                         if test -f "$xxx"; then
1337                                 sh="$xxx";
1338                                 break
1339                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1340                                 sh="$xxx";
1341                                 break
1342                         elif test -f "$xxx.exe"; then
1343                                 sh="$xxx";
1344                                 break
1345                         fi
1346                 done
1347         fi
1348         ;;
1349 esac
1350
1351 case "$sh" in
1352 '')     cat >&2 <<EOM
1353 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1354
1355 Usually it's in /bin/sh.  How did you even get this far?
1356 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1357 we'll try to straighten this all out.
1358 EOM
1359         exit 1
1360         ;;
1361 esac
1362
1363 : see if sh knows # comments
1364 if `$sh -c '#' >/dev/null 2>&1`; then
1365         shsharp=true
1366         spitshell=cat
1367         xcat=/bin/cat
1368         test -f $xcat$_exe || xcat=/usr/bin/cat
1369         if test ! -f $xcat$_exe; then
1370                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1371                         if test -f $p/cat$_exe; then
1372                                 xcat=$p/cat
1373                                 break
1374                         fi
1375                 done
1376                 if test ! -f $xcat$_exe; then
1377                         echo "Can't find cat anywhere!"
1378                         exit 1
1379                 fi
1380         fi
1381         echo "#!$xcat" >sharp
1382         $eunicefix sharp
1383         chmod +x sharp
1384         ./sharp > today
1385         if test -s today; then
1386                 sharpbang='#!'
1387         else
1388                 echo "#! $xcat" > sharp
1389                 $eunicefix sharp
1390                 chmod +x sharp
1391                 ./sharp > today
1392                 if test -s today; then
1393                         sharpbang='#! '
1394                 else
1395                         sharpbang=': use '
1396                 fi
1397         fi
1398 else
1399         echo " "
1400         echo "Your $sh doesn't grok # comments--I will strip them later on."
1401         shsharp=false
1402         cd ..
1403         echo "exec grep -v '^[  ]*#'" >spitshell
1404         chmod +x spitshell
1405         $eunicefix spitshell
1406         spitshell=`pwd`/spitshell
1407         cd UU
1408         echo "I presume that if # doesn't work, #! won't work either!"
1409         sharpbang=': use '
1410 fi
1411 rm -f sharp today
1412
1413 : figure out how to guarantee sh startup
1414 case "$startsh" in
1415 '') startsh=${sharpbang}${sh} ;;
1416 *)
1417 esac
1418 cat >sharp <<EOSS
1419 $startsh
1420 set abc
1421 test "$?abc" != 1
1422 EOSS
1423
1424 chmod +x sharp
1425 $eunicefix sharp
1426 if ./sharp; then
1427         : echo "Yup, it does."
1428 else
1429         echo "Hmm... '$startsh' does not guarantee sh startup..."
1430         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1431 fi
1432 rm -f sharp
1433
1434
1435 : Save command line options in file UU/cmdline.opt for later use in
1436 : generating config.sh.
1437 cat > cmdline.opt <<EOSH
1438 # Configure command line arguments.
1439 config_arg0='$0'
1440 config_args='$*'
1441 config_argc=$#
1442 EOSH
1443 argn=1
1444 args_exp=''
1445 args_sep=''
1446 for arg in "$@"; do
1447         cat >>cmdline.opt <<EOSH
1448 config_arg$argn='$arg'
1449 EOSH
1450         # Extreme backslashitis: replace each ' by '"'"'
1451         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1452 $arg
1453 EOC
1454         arg_exp=`cat cmdl.opt`
1455         args_exp="$args_exp$args_sep'$arg_exp'"
1456         argn=`expr $argn + 1`
1457         args_sep=' '
1458 done
1459 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1460 # used by ./hints/os2.sh
1461 rm -f cmdl.opt
1462
1463 : produce awk script to parse command line options
1464 cat >options.awk <<'EOF'
1465 BEGIN {
1466         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1467
1468         len = length(optstr);
1469         for (i = 1; i <= len; i++) {
1470                 c = substr(optstr, i, 1);
1471                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1472                 if (a == ":") {
1473                         arg[c] = 1;
1474                         i++;
1475                 }
1476                 opt[c] = 1;
1477         }
1478 }
1479 {
1480         expect = 0;
1481         str = $0;
1482         if (substr(str, 1, 1) != "-") {
1483                 printf("'%s'\n", str);
1484                 next;
1485         }
1486         len = length($0);
1487         for (i = 2; i <= len; i++) {
1488                 c = substr(str, i, 1);
1489                 if (!opt[c]) {
1490                         printf("-%s\n", substr(str, i));
1491                         next;
1492                 }
1493                 printf("-%s\n", c);
1494                 if (arg[c]) {
1495                         if (i < len)
1496                                 printf("'%s'\n", substr(str, i + 1));
1497                         else
1498                                 expect = 1;
1499                         next;
1500                 }
1501         }
1502 }
1503 END {
1504         if (expect)
1505                 print "?";
1506 }
1507 EOF
1508
1509 : process the command line options
1510 set X `for arg in "$@"; do echo "X$arg"; done |
1511         sed -e s/X// | awk -f options.awk`
1512 eval "set $*"
1513 shift
1514 rm -f options.awk
1515
1516 : set up default values
1517 fastread=''
1518 reuseval=false
1519 config_sh=''
1520 alldone=''
1521 error=''
1522 silent=''
1523 extractsh=''
1524 override=''
1525 knowitall=''
1526 rm -f optdef.sh posthint.sh
1527 cat >optdef.sh <<EOS
1528 $startsh
1529 EOS
1530
1531
1532 : option parsing
1533 while test $# -gt 0; do
1534         case "$1" in
1535         -d) shift; fastread=yes;;
1536         -e) shift; alldone=cont;;
1537         -f)
1538                 shift
1539                 cd ..
1540                 if test -r "$1"; then
1541                         config_sh="$1"
1542                 else
1543                         echo "$me: cannot read config file $1." >&2
1544                         error=true
1545                 fi
1546                 cd UU
1547                 shift;;
1548         -h) shift; error=true;;
1549         -r) shift; reuseval=true;;
1550         -s) shift; silent=true; realsilent=true;;
1551         -E) shift; alldone=exit;;
1552         -K) shift; knowitall=true;;
1553         -O) shift; override=true;;
1554         -S) shift; silent=true; extractsh=true;;
1555         -D)
1556                 shift
1557                 case "$1" in
1558                 *=)
1559                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1560                         echo "$me: ignoring -D $1" >&2
1561                         ;;
1562                 *=*) echo "$1" | \
1563                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1564                 *) echo "$1='define'" >> optdef.sh;;
1565                 esac
1566                 shift
1567                 ;;
1568         -U)
1569                 shift
1570                 case "$1" in
1571                 *=) echo "$1" >> optdef.sh;;
1572                 *=*)
1573                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1574                         echo "$me: ignoring -U $1" >&2
1575                         ;;
1576                 *) echo "$1='undef'" >> optdef.sh;;
1577                 esac
1578                 shift
1579                 ;;
1580         -A)
1581             shift
1582             xxx=''
1583             yyy="$1"
1584             zzz=''
1585             uuu=undef
1586             case "$yyy" in
1587             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1588                  case "$zzz" in
1589                  *:*) zzz='' ;;
1590                  *)   xxx=append
1591                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1592                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1593                  esac
1594                  ;;
1595             esac
1596             case "$xxx" in
1597             '')  case "$yyy" in
1598                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1599                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1600                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1601                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1602                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1603                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1604                  esac
1605                  ;;       
1606             esac
1607             case "$xxx" in
1608             append)
1609                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1610             clear)
1611                 echo "$yyy=''"                  >> posthint.sh ;;
1612             define)
1613                 case "$zzz" in
1614                 '') zzz=define ;;
1615                 esac
1616                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1617             eval)
1618                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1619             prepend)
1620                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1621             undef)
1622                 case "$zzz" in
1623                 '') zzz="$uuu" ;;
1624                 esac
1625                 echo "$yyy=$zzz"                >> posthint.sh ;;
1626             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1627             esac
1628             shift
1629             ;;
1630         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1631             exit 0;;
1632         --) break;;
1633         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1634         *) break;;
1635         esac
1636 done
1637
1638 case "$error" in
1639 true)
1640         cat >&2 <<EOM
1641 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1642                  [-U symbol] [-U symbol=] [-A command:symbol...]
1643   -d : use defaults for all answers.
1644   -e : go on without questioning past the production of config.sh.
1645   -f : specify an alternate default configuration file.
1646   -h : print this help message and exit (with an error status).
1647   -r : reuse C symbols value if possible (skips costly nm extraction).
1648   -s : silent mode, only echoes questions and essential information.
1649   -D : define symbol to have some value:
1650          -D symbol         symbol gets the value 'define'
1651          -D symbol=value   symbol gets the value 'value'
1652   -E : stop at the end of questions, after having produced config.sh.
1653   -K : do not use unless you know what you are doing.
1654   -O : let -D and -U override definitions from loaded configuration file.
1655   -S : perform variable substitutions on all .SH files (can mix with -f)
1656   -U : undefine symbol:
1657          -U symbol    symbol gets the value 'undef'
1658          -U symbol=   symbol gets completely empty
1659   -A : manipulate symbol after the platform specific hints have been applied:
1660          -A symbol=value                append " "value to symbol
1661          -A append:symbol=value         append value to symbol
1662          -A define:symbol=value         define symbol to have value
1663          -A clear:symbol                define symbol to be ''
1664          -A define:symbol               define symbol to be 'define'
1665          -A eval:symbol=value           define symbol to be eval of value
1666          -A prepend:symbol=value        prepend value to symbol
1667          -A undef:symbol                define symbol to be 'undef'
1668          -A undef:symbol=               define symbol to be ''
1669   -V : print version number and exit (with a zero status).
1670 EOM
1671         exit 1
1672         ;;
1673 esac
1674
1675 : Sanity checks
1676 case "$fastread$alldone" in
1677 yescont|yesexit) ;;
1678 *)
1679         case "$extractsh" in
1680         true) ;;
1681         *)
1682                 if test ! -t 0; then
1683                         echo "Say 'sh Configure', not 'sh <Configure'"
1684                         exit 1
1685                 fi
1686                 ;;
1687         esac
1688         ;;
1689 esac
1690
1691 exec 4>&1
1692 case "$silent" in
1693 true) exec 1>/dev/null;;
1694 esac
1695
1696 : run the defines and the undefines, if any, but leave the file out there...
1697 touch optdef.sh
1698 . ./optdef.sh
1699 : create the posthint manipulation script and leave the file out there...
1700 touch posthint.sh
1701
1702 : set package name
1703 package=perl5
1704 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1705 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1706 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1707 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1708 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1709 esac
1710
1711 : Some greps do not return status, grrr.
1712 echo "grimblepritz" >grimble
1713 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1714         contains=contains
1715 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1716         contains=grep
1717 else
1718         contains=contains
1719 fi
1720 rm -f grimble
1721 : the following should work in any shell
1722 case "$contains" in
1723 contains*)
1724         echo " "
1725         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1726         cat >contains <<'EOSS'
1727 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1728 EOSS
1729 chmod +x contains
1730 esac
1731
1732 : Find the path to the source tree
1733 case "$src" in
1734 '') case "$0" in
1735     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1736          case "$src" in
1737          /*)    ;;
1738          .)     ;;
1739          *)     src=`cd ../$src && pwd` ;;
1740          esac
1741          ;;
1742     *)   src='.';;
1743     esac;;
1744 esac
1745 case "$src" in
1746 '')     src=/
1747         rsrc=/
1748         ;;
1749 /*) rsrc="$src";;
1750 *) rsrc="../$src";;
1751 esac
1752 if test -f $rsrc/Configure && \
1753         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1754 then
1755    : found it, so we are ok.
1756 else
1757         rsrc=''
1758         for src in . .. ../.. ../../.. ../../../..; do
1759                 if test -f ../$src/Configure && \
1760                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1761                 then
1762                         rsrc=../$src
1763                         break
1764                 fi
1765         done
1766 fi
1767 case "$rsrc" in
1768 '')
1769         cat <<EOM >&4
1770
1771 Sorry, I can't seem to locate the source dir for $package.  Please start
1772 Configure with an explicit path -- i.e. /some/path/Configure.
1773
1774 EOM
1775         exit 1
1776         ;;
1777 ../.)   rsrc='..';;
1778 *)
1779         echo " "
1780         echo "Sources for $package found in \"$src\"." >&4
1781         ;;
1782 esac
1783
1784 : script used to extract .SH files with variable substitutions
1785 cat >extract <<'EOS'
1786 PERL_CONFIG_SH=true
1787 echo "Doing variable substitutions on .SH files..."
1788 if test -f MANIFEST; then
1789         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1790 else
1791         echo "(Looking for .SH files under the source directory.)"
1792         set x `(cd "$src"; find . -name "*.SH" -print)`
1793 fi
1794 shift
1795 case $# in
1796 0) set x `(cd "$src"; echo *.SH)`; shift;;
1797 esac
1798 if test ! -f "$src/$1"; then
1799         shift
1800 fi
1801 mkdir_p='
1802 name=$1;
1803 create="";
1804 while test $name; do
1805         if test ! -d "$name"; then
1806                 create="$name $create";
1807                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1808                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1809         else
1810                 name="";
1811         fi;
1812 done;
1813 for file in $create; do
1814         mkdir $file;
1815 done
1816 '
1817 for file in $*; do
1818         case "$src" in
1819         ".")
1820                 case "$file" in
1821                 */*)
1822                         dir=`expr X$file : 'X\(.*\)/'`
1823                         file=`expr X$file : 'X.*/\(.*\)'`
1824                         (cd "$dir" && . ./$file)
1825                         ;;
1826                 *)
1827                         . ./$file
1828                         ;;
1829                 esac
1830                 ;;
1831         *)
1832                 case "$file" in
1833                 */*)
1834                         dir=`expr X$file : 'X\(.*\)/'`
1835                         file=`expr X$file : 'X.*/\(.*\)'`
1836                         (set x $dir; shift; eval $mkdir_p)
1837                         sh <"$src/$dir/$file"
1838                         ;;
1839                 *)
1840                         sh <"$src/$file"
1841                         ;;
1842                 esac
1843                 ;;
1844         esac
1845 done
1846 if test -f "$src/config_h.SH"; then
1847         if test ! -f config.h; then
1848         : oops, they left it out of MANIFEST, probably, so do it anyway.
1849         . "$src/config_h.SH"
1850         fi
1851 fi
1852 EOS
1853
1854 : extract files and exit if asked to do so
1855 case "$extractsh" in
1856 true)
1857         case "$realsilent" in
1858         true) ;;
1859         *) exec 1>&4;;
1860         esac
1861         case "$config_sh" in
1862         '') config_sh='config.sh';;
1863         esac
1864         echo " "
1865         echo "Fetching answers from $config_sh..."
1866         cd ..
1867         . $config_sh
1868         test "$override" && . ./optdef.sh
1869         echo " "
1870         . UU/extract
1871         rm -rf UU
1872         echo "Extraction done."
1873         exit 0
1874         ;;
1875 esac
1876
1877 : Eunice requires " " instead of "", can you believe it
1878 echo " "
1879 : Here we go...
1880 echo "Beginning of configuration questions for $package."
1881
1882 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1883
1884 : first determine how to suppress newline on echo command
1885 echo " "
1886 echo "Checking echo to see how to suppress newlines..."
1887 (echo "hi there\c" ; echo " ") >.echotmp
1888 if $contains c .echotmp >/dev/null 2>&1 ; then
1889         echo "...using -n."
1890         n='-n'
1891         c=''
1892 else
1893         cat <<'EOM'
1894 ...using \c
1895 EOM
1896         n=''
1897         c='\c'
1898 fi
1899 echo $n "The star should be here-->$c"
1900 echo '*'
1901 rm -f .echotmp
1902
1903 : Now test for existence of everything in MANIFEST
1904 echo " "
1905 if test -f "$rsrc/MANIFEST"; then
1906         echo "First let's make sure your kit is complete.  Checking..." >&4
1907         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1908         rm -f missing
1909         tmppwd=`pwd`
1910         for filelist in x??; do
1911                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1912         done
1913         if test -s missing; then
1914                 cat missing >&4
1915                 cat >&4 <<'EOM'
1916
1917 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1918
1919 You have the option of continuing the configuration process, despite the
1920 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1921 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1922 and contact the author (perlbug@perl.org).
1923
1924 EOM
1925                 echo $n "Continue? [n] $c" >&4
1926                 read ans
1927                 case "$ans" in
1928                 y*)
1929                         echo "Continuing..." >&4
1930                         rm -f missing
1931                         ;;
1932                 *)
1933                         echo "ABORTING..." >&4
1934                         kill $$
1935                         ;;
1936                 esac
1937         else
1938                 echo "Looks good..."
1939         fi
1940 else
1941         echo "There is no MANIFEST file.  I hope your kit is complete !"
1942 fi
1943 rm -f missing x??
1944
1945 echo " "
1946 : Find the appropriate value for a newline for tr
1947 if test -n "$DJGPP"; then
1948        trnl='\012'
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\n' x 2>/dev/null`" in
1952         foox) trnl='\n' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956         case "`echo foo|tr '\012' x 2>/dev/null`" in
1957         foox) trnl='\012' ;;
1958         esac
1959 fi
1960 if test X"$trnl" = X; then
1961        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1962        fooxy) trnl='\n\r' ;;
1963        esac
1964 fi
1965 if test X"$trnl" = X; then
1966         cat <<EOM >&2
1967
1968 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1969
1970 EOM
1971         exit 1
1972 fi
1973
1974 : compute the number of columns on the terminal for proper question formatting
1975 case "$COLUMNS" in
1976 '') COLUMNS='80';;
1977 esac
1978
1979 : set up the echo used in my read
1980 myecho="case \"\$xxxm\" in
1981 '') echo $n \"\$rp $c\" >&4;;
1982 *) case \"\$rp\" in
1983         '') echo $n \"[\$xxxm] $c\";;
1984         *)
1985                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1986                         echo \"\$rp\" >&4
1987                         echo $n \"[\$xxxm] $c\" >&4
1988                 else
1989                         echo $n \"\$rp [\$xxxm] $c\" >&4
1990                 fi
1991                 ;;
1992         esac;;
1993 esac"
1994
1995 : now set up to do reads with possible shell escape and default assignment
1996 cat <<EOSC >myread
1997 $startsh
1998 xxxm=\$dflt
1999 $myecho
2000 ans='!'
2001 case "\$fastread" in
2002 yes) case "\$dflt" in
2003         '') ;;
2004         *) ans='';
2005                 case "\$silent-\$rp" in
2006                 true-) ;;
2007                 *) echo " " >&4;;
2008                 esac;;
2009         esac;;
2010 *) case "\$silent" in
2011         true) case "\$rp" in
2012                 '') ans='';;
2013                 esac;;
2014         esac;;
2015 esac
2016 while expr "X\$ans" : "X!" >/dev/null; do
2017         read answ
2018         set x \$xxxm
2019         shift
2020         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2021         case  "\$answ" in
2022         "!")
2023                 sh 1>&4
2024                 echo " "
2025                 $myecho
2026                 ;;
2027         !*)
2028                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2029                 shift
2030                 sh 1>&4 -c "\$*"
2031                 echo " "
2032                 $myecho
2033                 ;;
2034         "\$ans")
2035                 case "\$ans" in
2036                 \\&*)
2037                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2038                         shift
2039                         case "\$1" in
2040                         -d)
2041                                 fastread=yes
2042                                 echo "(OK, I'll run with -d after this question.)" >&4
2043                                 ;;
2044                         -*)
2045                                 echo "*** Sorry, \$1 not supported yet." >&4
2046                                 ;;
2047                         esac
2048                         $myecho
2049                         ans=!
2050                         ;;
2051                 esac;;
2052         *)
2053                 case "\$aok" in
2054                 y)
2055                         echo "*** Substitution done -- please confirm."
2056                         xxxm="\$ans"
2057                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2058                         xxxm="\$ans"
2059                         ans=!
2060                         ;;
2061                 *)
2062                         echo "*** Error -- try again."
2063                         ans=!
2064                         ;;
2065                 esac
2066                 $myecho
2067                 ;;
2068         esac
2069         case "\$ans\$xxxm\$nostick" in
2070         '')
2071                 ans=!
2072                 $myecho
2073                 ;;
2074         esac
2075 done
2076 case "\$ans" in
2077 '') ans="\$xxxm";;
2078 esac
2079 EOSC
2080
2081 : create .config dir to save info across Configure sessions
2082 test -d ../.config || mkdir ../.config
2083 cat >../.config/README <<EOF
2084 This directory created by Configure to save information that should
2085 persist across sessions for $package.
2086
2087 You may safely delete it if you wish.
2088 EOF
2089
2090 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2091 case "$usedevel" in
2092 $define|true|[yY]*) ;;
2093 *) case "$xversion" in
2094    *[13579])
2095         cat >&4 <<EOH
2096 *** WHOA THERE!!! ***
2097
2098     This is an UNSTABLE DEVELOPMENT release.
2099     The version of this $package distribution is $xversion, that is, odd,
2100     (as opposed to even) and that signifies a development release.
2101     If you want a maintenance release, you want an even-numbered version.
2102
2103     Do ***NOT*** install this into production use.
2104     Data corruption and crashes are possible.
2105
2106     It is most seriously suggested that you do not continue any further
2107     unless you want to help in developing and debugging Perl.
2108
2109     If you *still* want to build perl, you can answer 'y' now,
2110     or pass -Dusedevel to Configure.
2111
2112 EOH
2113         rp='Do you really want to continue?'
2114         dflt='n'
2115         . ./myread
2116         case "$ans" in
2117         [yY]) echo >&4 "Okay, continuing."
2118               usedevel="$define" ;;
2119         *) echo >&4 "Okay, bye."
2120            exit 1
2121            ;;
2122         esac
2123         ;;
2124     esac
2125     ;;
2126 esac
2127 case "$usedevel" in
2128 $define|true|[yY]*)
2129         case "$versiononly" in
2130         '') versiononly="$define" ;;
2131         esac
2132         case "$installusrbinperl" in
2133         '') installusrbinperl="$undef" ;;
2134         esac
2135         ;;
2136 esac
2137
2138 : general instructions
2139 needman=true
2140 firsttime=true
2141 user=`(logname) 2>/dev/null`
2142 case "$user" in
2143 '') user=`whoami 2>&1`;;
2144 esac
2145 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2146         firsttime=false
2147         echo " "
2148         rp='Would you like to see the instructions?'
2149         dflt=n
2150         . ./myread
2151         case "$ans" in
2152         [yY]*) ;;
2153         *) needman=false;;
2154         esac
2155 fi
2156 if $needman; then
2157         cat <<EOH
2158
2159 This installation shell script will examine your system and ask you questions
2160 to determine how the perl5 package should be installed. If you get
2161 stuck on a question, you may use a ! shell escape to start a subshell or
2162 execute a command.  Many of the questions will have default answers in square
2163 brackets; typing carriage return will give you the default.
2164
2165 On some of the questions which ask for file or directory names you are allowed
2166 to use the ~name construct to specify the login directory belonging to "name",
2167 even if you don't have a shell which knows about that.  Questions where this is
2168 allowed will be marked "(~name ok)".
2169
2170 EOH
2171         rp=''
2172         dflt='Type carriage return to continue'
2173         . ./myread
2174         cat <<'EOH'
2175
2176 The prompter used in this script allows you to use shell variables and
2177 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2178 in the default answer, as if the default line was a set of arguments given to a
2179 script shell.  This means you may also use $* to repeat the whole default line,
2180 so you do not have to re-type everything to add something to the default.
2181
2182 Everytime there is a substitution, you will have to confirm.  If there is an
2183 error (e.g. an unmatched backtick), the default answer will remain unchanged
2184 and you will be prompted again.
2185
2186 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2187 the questions and use the computed defaults (or the previous answers if there
2188 was already a config.sh file). Type 'Configure -h' for a list of options.
2189 You may also start interactively and then answer '& -d' at any prompt to turn
2190 on the non-interactive behaviour for the remainder of the execution.
2191
2192 EOH
2193         . ./myread
2194         cat <<EOH
2195
2196 Much effort has been expended to ensure that this shell script will run on any
2197 Unix system.  If despite that it blows up on yours, your best bet is to edit
2198 Configure and run it again.  If you can't run Configure for some reason,
2199 you'll have to generate a config.sh file by hand.  Whatever problems you
2200 have, let me (perlbug@perl.org) know how I blew it.
2201
2202 This installation script affects things in two ways:
2203
2204 1) it may do direct variable substitutions on some of the files included
2205    in this kit.
2206 2) it builds a config.h file for inclusion in C programs.  You may edit
2207    any of these files as the need arises after running this script.
2208
2209 If you make a mistake on a question, there is no easy way to back up to it
2210 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2211 files.  Configure will offer to let you do this before it runs the SH files.
2212
2213 EOH
2214         dflt='Type carriage return to continue'
2215         . ./myread
2216         case "$firsttime" in
2217         true) echo $user >>../.config/instruct;;
2218         esac
2219 fi
2220
2221 : find out where common programs are
2222 echo " "
2223 echo "Locating common programs..." >&4
2224 cat <<EOSC >loc
2225 $startsh
2226 case \$# in
2227 0) exit 1;;
2228 esac
2229 thing=\$1
2230 shift
2231 dflt=\$1
2232 shift
2233 for dir in \$*; do
2234         case "\$thing" in
2235         .)
2236         if test -d \$dir/\$thing; then
2237                 echo \$dir
2238                 exit 0
2239         fi
2240         ;;
2241         *)
2242         for thisthing in \$dir/\$thing; do
2243                 : just loop through to pick last item
2244         done
2245         if test -f \$thisthing; then
2246                 echo \$thisthing
2247                 exit 0
2248         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2249                 echo \$thisthing
2250                 exit 0
2251         elif test -f \$dir/\$thing.exe; then
2252                 if test -n "$DJGPP"; then
2253                         echo \$dir/\$thing.exe
2254                 elif test "$eunicefix" != ":"; then
2255                         : on Eunice apparently
2256                         echo \$dir/\$thing
2257                         exit 0
2258                 fi
2259                 exit 0
2260         fi
2261         ;;
2262         esac
2263 done
2264 echo \$dflt
2265 exit 1
2266 EOSC
2267 chmod +x loc
2268 $eunicefix loc
2269 loclist="
2270 awk
2271 cat
2272 chmod
2273 comm
2274 cp
2275 echo
2276 expr
2277 grep
2278 ls
2279 mkdir
2280 rm
2281 sed
2282 sort
2283 touch
2284 tr
2285 uniq
2286 "
2287 trylist="
2288 Mcc
2289 ar
2290 bison
2291 byacc
2292 cpp
2293 csh
2294 date
2295 egrep
2296 gmake
2297 gzip
2298 less
2299 ln
2300 make
2301 more
2302 nm
2303 nroff
2304 pg
2305 test
2306 uname
2307 zip
2308 "
2309 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2310 pth="$pth /lib /usr/lib"
2311 for file in $loclist; do
2312         eval xxx=\$$file
2313         case "$xxx" in
2314         /*|?:[\\/]*)
2315                 if test -f "$xxx"; then
2316                         : ok
2317                 else
2318                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2319                         xxx=`./loc $file $file $pth`
2320                 fi
2321                 ;;
2322         '') xxx=`./loc $file $file $pth`;;
2323         *) xxx=`./loc $xxx $xxx $pth`;;
2324         esac
2325         eval $file=$xxx$_exe
2326         eval _$file=$xxx
2327         case "$xxx" in
2328         /*)
2329                 echo $file is in $xxx.
2330                 ;;
2331         ?:[\\/]*)
2332                 echo $file is in $xxx.
2333                 ;;
2334         *)
2335                 echo "I don't know where '$file' is, and my life depends on it." >&4
2336                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337                 exit 1
2338                 ;;
2339         esac
2340 done
2341 echo " "
2342 echo "Don't worry if any of the following aren't found..."
2343 say=offhand
2344 for file in $trylist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't see $file out there, $say."
2369                 say=either
2370                 ;;
2371         esac
2372 done
2373 case "$egrep" in
2374 egrep)
2375         echo "Substituting grep for egrep."
2376         egrep=$grep
2377         _egrep=$grep
2378         ;;
2379 esac
2380 case "$ln" in
2381 ln)
2382         echo "Substituting cp for ln."
2383         ln=$cp
2384         _ln=$cp
2385         ;;
2386 esac
2387 case "$make" in
2388 make)   
2389         case "$gmake" in
2390         gmake)
2391         echo "I can't find make or gmake, and my life depends on it." >&4
2392         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2393         exit 1
2394         ;;
2395         esac
2396         ;;
2397 esac    
2398 case "$gmake" in
2399 gmake)  ;;
2400 *)      # We can't have osname yet.
2401         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2402                 # Assume that gmake, if found, is definitely GNU make
2403                 # and prefer it over the system make.
2404                 echo "Substituting gmake for make."
2405                 make=$gmake
2406                 _make=$gmake
2407         fi
2408         ;;
2409 esac
2410 case "$test" in
2411 test)
2412         echo "Hopefully test is built into your sh."
2413         ;;
2414 *)
2415         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2416                 echo "Using the test built into your sh."
2417                 test=test
2418                 _test=test
2419         fi
2420         ;;
2421 esac
2422 case "$echo" in
2423 echo)
2424         echo "Hopefully echo is built into your sh."
2425         ;;
2426 '') ;;
2427 *)
2428         echo " "
2429 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2430         $echo $n "hi there$c" >foo1
2431         echo $n "hi there$c" >foo2
2432         if cmp foo1 foo2 >/dev/null 2>&1; then
2433                 echo "They are compatible.  In fact, they may be identical."
2434         else
2435                 case "$n" in
2436                 '-n') n='' c='\c';;
2437                 *) n='-n' c='';;
2438                 esac
2439                 cat <<FOO
2440 They are not compatible!  You are probably running ksh on a non-USG system.
2441 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2442 have echo built in and we may have to run some Bourne shell scripts.  That
2443 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2444
2445 FOO
2446                 $echo $n "The star should be here-->$c"
2447                 $echo "*"
2448         fi
2449         $rm -f foo1 foo2
2450         ;;
2451 esac
2452
2453 cat <<EOS >trygcc
2454 $startsh
2455 EOS
2456 cat <<'EOSC' >>trygcc
2457 case "$cc" in
2458 '') ;;
2459 *)  $rm -f try try.*
2460     $cat >try.c <<EOM
2461 int main(int argc, char *argv[]) {
2462   return 0;
2463 }
2464 EOM
2465     if $cc -o try $ccflags $ldflags try.c; then
2466        :
2467     else
2468         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2469         despair=yes
2470         trygcc=yes
2471         case "$cc" in
2472         *gcc*) trygcc=no ;;
2473         esac
2474         case "`$cc -v -c try.c 2>&1`" in
2475         *gcc*) trygcc=no ;;
2476         esac
2477         if $test X"$trygcc" = Xyes; then
2478             if gcc -o try -c try.c; then
2479                 echo " "
2480                 echo "You seem to have a working gcc, though." >&4
2481                 rp="Would you like to use it?"
2482                 dflt=y
2483                 if $test -f myread; then
2484                     . ./myread
2485                 else
2486                     if $test -f UU/myread; then
2487                         . ./UU/myread
2488                     else
2489                         echo "Cannot find myread, sorry.  Aborting." >&2
2490                         exit 1
2491                     fi
2492                 fi  
2493                 case "$ans" in
2494                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2495                        if $test -f usethreads.cbu; then
2496                            $cat >&4 <<EOM 
2497
2498 *** However, any setting of the C compiler flags (e.g. for thread support)
2499 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2500 *** (together with e.g. -Dusethreads).
2501
2502 EOM
2503                        fi;;
2504                 esac
2505             fi
2506         fi
2507     fi
2508     $rm -f try try.*
2509     ;;
2510 esac
2511 EOSC
2512
2513 cat <<EOS >checkcc
2514 $startsh
2515 EOS
2516 cat <<'EOSC' >>checkcc
2517 case "$cc" in        
2518 '') ;;
2519 *)  $rm -f try try.*              
2520     $cat >try.c <<EOM
2521 int main(int argc, char *argv[]) {
2522   return 0;
2523 }
2524 EOM
2525     if $cc -o try $ccflags $ldflags try.c; then
2526        :
2527     else
2528         if $test X"$despair" = Xyes; then
2529            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530         fi
2531         $cat >&4 <<EOM         
2532 You need to find a working C compiler.
2533 Either (purchase and) install the C compiler supplied by your OS vendor,
2534 or for a free C compiler try http://gcc.gnu.org/
2535 I cannot continue any further, aborting.
2536 EOM
2537         exit 1
2538     fi
2539     $rm -f try try.*
2540     ;;
2541 esac
2542 EOSC
2543
2544 : determine whether symbolic links are supported
2545 echo " "
2546 $touch blurfl
2547 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2548         echo "Symbolic links are supported." >&4
2549         lns="$ln -s"
2550 else
2551         echo "Symbolic links are NOT supported." >&4
2552         lns="$ln"
2553 fi
2554 $rm -f blurfl sym
2555
2556 : determine whether symbolic links are supported
2557 echo " "
2558 case "$lns" in
2559 *"ln"*" -s")
2560         echo "Checking how to test for symbolic links..." >&4
2561         $lns blurfl sym
2562         if $test "X$issymlink" = X; then
2563                 case "$newsh" in
2564                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 esac
2567                 if test $? = 0; then
2568                         issymlink="test -h"
2569                 else
2570                         echo "Your builtin 'test -h' may be broken." >&4
2571                         case "$test" in
2572                         /*)     ;;
2573                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2574                                 for p in $pth
2575                                 do
2576                                         if test -f "$p/$test"; then
2577                                                 test="$p/$test"
2578                                                 break
2579                                         fi
2580                                 done
2581                                 ;;
2582                         esac
2583                         case "$test" in
2584                         /*)
2585                                 echo "Trying external '$test -h'." >&4
2586                                 issymlink="$test -h"
2587                                 if $test ! -h sym >/dev/null 2>&1; then
2588                                         echo "External '$test -h' is broken, too." >&4
2589                                         issymlink=''
2590                                 fi
2591                                 ;;
2592                         *)      issymlink='' ;;
2593                         esac
2594                 fi              
2595         fi
2596         if $test "X$issymlink" = X; then
2597                 if $test -L sym 2>/dev/null; then
2598                         issymlink="$test -L"
2599                         echo "The builtin '$test -L' worked." >&4
2600                 fi
2601         fi
2602         if $test "X$issymlink" != X; then
2603                 echo "You can test for symbolic links with '$issymlink'." >&4
2604         else
2605                 echo "I do not know how you can test for symbolic links." >&4
2606         fi
2607         $rm -f blurfl sym
2608         ;;
2609 *)      echo "No symbolic links, so not testing for their testing..." >&4
2610         ;;
2611 esac
2612 echo " "
2613
2614
2615 case "$mksymlinks" in
2616 $define|true|[yY]*)
2617         case "$src" in
2618         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2619                 exit 1
2620                 ;;
2621         *)      case "$lns:$issymlink" in
2622                 *"ln"*" -s:"*"test -"?)
2623                         echo "Creating the symbolic links..." >&4
2624                         echo "(First creating the subdirectories...)" >&4
2625                         cd ..
2626                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2627                                 read directory
2628                                 test -z "$directory" && break
2629                                 mkdir -p $directory
2630                         done
2631                         # Sanity check 1.
2632                         if test ! -d t/base; then
2633                                 echo "Failed to create the subdirectories.  Aborting." >&4
2634                                 exit 1
2635                         fi
2636                         echo "(Then creating the symlinks...)" >&4
2637                         awk '{print $1}' $src/MANIFEST | while true; do
2638                                 read filename
2639                                 test -z "$filename" && break
2640                                 if test -f $filename; then
2641                                         if $issymlink $filename; then
2642                                                 rm -f $filename
2643                                         fi
2644                                 fi
2645                                 if test -f $filename; then
2646                                         echo "$filename already exists, not symlinking."
2647                                 else
2648                                         ln -s $src/$filename $filename
2649                                 fi
2650                         done
2651                         # Sanity check 2.
2652                         if test ! -f t/base/lex.t; then
2653                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         cd UU
2657                         ;;
2658                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2659                         ;;
2660                 esac
2661                 ;;
2662         esac
2663         ;;
2664 esac
2665
2666
2667 case "$usecrosscompile" in
2668 $define|true|[yY]*)
2669         $echo "Cross-compiling..."
2670         croak=''
2671         case "$cc" in
2672         *-*-gcc) # A cross-compiling gcc, probably.
2673             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2674             ar=$targetarch-ar
2675             # leave out ld, choosing it is more complex
2676             nm=$targetarch-nm
2677             ranlib=$targetarch-ranlib
2678             $echo 'extern int foo;' > try.c
2679             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2680             shift
2681             if $test $# -gt 0; then
2682                 incpth="$incpth $*"
2683                 incpth="`$echo $incpth|$sed 's/^ //'`"
2684                 echo "Guessing incpth '$incpth'." >&4
2685                 for i in $*; do
2686                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2687                     if $test -d $j; then
2688                         libpth="$libpth $j"
2689                     fi
2690                 done   
2691                 libpth="`$echo $libpth|$sed 's/^ //'`"
2692                 echo "Guessing libpth '$libpth'." >&4
2693             fi
2694             $rm -f try.c
2695             ;;
2696         esac
2697         case "$targetarch" in
2698         '') echo "Targetarch not defined." >&4; croak=y ;;
2699         *)  echo "Using targetarch $targetarch." >&4 ;;
2700         esac
2701         case "$incpth" in
2702         '') echo "Incpth not defined." >&4; croak=y ;;
2703         *)  echo "Using incpth '$incpth'." >&4 ;;
2704         esac
2705         case "$libpth" in
2706         '') echo "Libpth not defined." >&4; croak=y ;;
2707         *)  echo "Using libpth '$libpth'." >&4 ;;
2708         esac
2709         case "$usrinc" in
2710         '') for i in $incpth; do
2711                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2712                     usrinc=$i
2713                     echo "Guessing usrinc $usrinc." >&4
2714                     break
2715                 fi
2716             done
2717             case "$usrinc" in
2718             '') echo "Usrinc not defined." >&4; croak=y ;;
2719             esac
2720             ;;
2721         *)  echo "Using usrinc $usrinc." >&4 ;;
2722         esac
2723         case "$targethost" in
2724         '') echo "Targethost not defined." >&4; croak=y ;;
2725         *)  echo "Using targethost $targethost." >&4
2726         esac
2727         locincpth=' '
2728         loclibpth=' '
2729         case "$croak" in
2730         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2731         esac
2732         case "$src" in
2733         /*) run=$src/Cross/run
2734             targetmkdir=$src/Cross/mkdir
2735             to=$src/Cross/to
2736             from=$src/Cross/from
2737             ;;
2738         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2739             run=$pwd/Cross/run
2740             targetmkdir=$pwd/Cross/mkdir
2741             to=$pwd/Cross/to
2742             from=$pwd/Cross/from
2743             ;;
2744         esac
2745         case "$targetrun" in
2746         '') targetrun=ssh ;;
2747         esac
2748         case "$targetto" in
2749         '') targetto=scp ;;
2750         esac
2751         case "$targetfrom" in
2752         '') targetfrom=scp ;;
2753         esac
2754         run=$run-$targetrun
2755         to=$to-$targetto
2756         from=$from-$targetfrom
2757         case "$targetdir" in
2758         '')  targetdir=/tmp
2759              echo "Guessing targetdir $targetdir." >&4
2760              ;;
2761         esac
2762         case "$targetuser" in
2763         '')  targetuser=root
2764              echo "Guessing targetuser $targetuser." >&4
2765              ;;
2766         esac
2767         case "$targetfrom" in
2768         scp)    q=-q ;;
2769         *)      q='' ;;
2770         esac
2771         case "$targetrun" in
2772         ssh|rsh)
2773             cat >$run <<EOF
2774 #!/bin/sh
2775 case "\$1" in
2776 -cwd)
2777   shift
2778   cwd=\$1
2779   shift
2780   ;;
2781 esac
2782 case "\$cwd" in
2783 '') cwd=$targetdir ;;
2784 esac
2785 exe=\$1
2786 shift
2787 if $test ! -f \$exe.xok; then
2788   $to \$exe
2789   $touch \$exe.xok
2790 fi
2791 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2792 EOF
2793             ;;
2794         *)  echo "Unknown targetrun '$targetrun'" >&4
2795             exit 1
2796             ;;
2797         esac
2798         case "$targetmkdir" in
2799         */Cross/mkdir)
2800             cat >$targetmkdir <<EOF
2801 #!/bin/sh
2802 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2803 EOF
2804             $chmod a+rx $targetmkdir
2805             ;;
2806         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2807             exit 1
2808             ;;
2809         esac
2810         case "$targetto" in
2811         scp|rcp)
2812             cat >$to <<EOF
2813 #!/bin/sh
2814 for f in \$@
2815 do
2816   case "\$f" in
2817   /*)
2818     $targetmkdir \`dirname \$f\`
2819     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2820     ;;
2821   *)
2822     $targetmkdir $targetdir/\`dirname \$f\`
2823     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2824     ;;
2825   esac
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         cp) cat >$to <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   case "\$f" in
2835   /*)
2836     $mkdir -p $targetdir/\`dirname \$f\`
2837     $cp \$f $targetdir/\$f || exit 1
2838     ;;
2839   *)
2840     $targetmkdir $targetdir/\`dirname \$f\`
2841     $cp \$f $targetdir/\$f || exit 1
2842     ;;
2843   esac
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         *)  echo "Unknown targetto '$targetto'" >&4
2849             exit 1
2850             ;;
2851         esac
2852         case "$targetfrom" in
2853         scp|rcp)
2854           cat >$from <<EOF
2855 #!/bin/sh
2856 for f in \$@
2857 do
2858   $rm -f \$f
2859   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2860 done
2861 exit 0
2862 EOF
2863             ;;
2864         cp) cat >$from <<EOF
2865 #!/bin/sh
2866 for f in \$@
2867 do
2868   $rm -f \$f
2869   cp $targetdir/\$f . || exit 1
2870 done
2871 exit 0
2872 EOF
2873             ;;
2874         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2875             exit 1
2876             ;;
2877         esac
2878         if $test ! -f $run; then
2879             echo "Target 'run' script '$run' not found." >&4
2880         else
2881             $chmod a+rx $run
2882         fi
2883         if $test ! -f $to; then
2884             echo "Target 'to' script '$to' not found." >&4
2885         else
2886             $chmod a+rx $to
2887         fi
2888         if $test ! -f $from; then
2889             echo "Target 'from' script '$from' not found." >&4
2890         else
2891             $chmod a+rx $from
2892         fi
2893         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2894             exit 1
2895         fi
2896         cat >&4 <<EOF
2897 Using '$run' for remote execution,
2898 and '$from' and '$to'
2899 for remote file transfer.
2900 EOF
2901         ;;
2902 *)      run=''
2903         to=:
2904         from=:
2905         usecrosscompile='undef'
2906         targetarch=''
2907         ;;
2908 esac
2909
2910 : see whether [:lower:] and [:upper:] are supported character classes
2911 echo " "
2912 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2913 ABYZ)
2914         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2915         up='[:upper:]'
2916         low='[:lower:]'
2917         ;;
2918 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2919         # (0xd9 and 0xe2), therefore that is a nice testing point.
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2922             rs) up='[A-Z]'
2923                 low='[a-z]'
2924                 ;;
2925             esac
2926         fi
2927         if test "X$up" = X -o "X$low" = X; then
2928             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2929             rs) up='A-Z'
2930                 low='a-z'
2931                 ;;
2932             esac
2933         fi
2934         if test "X$up" = X -o "X$low" = X; then
2935             case "`echo RS | od -x 2>/dev/null`" in
2936             *D9E2*|*d9e2*)
2937                 echo "Hey, this might be EBCDIC." >&4
2938                 if test "X$up" = X -o "X$low" = X; then
2939                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2940                     rs) up='[A-IJ-RS-Z]'
2941                         low='[a-ij-rs-z]'
2942                         ;;
2943                     esac
2944                 fi
2945                 if test "X$up" = X -o "X$low" = X; then
2946                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2947                     rs) up='A-IJ-RS-Z'
2948                         low='a-ij-rs-z'
2949                         ;;
2950                     esac
2951                 fi
2952                 ;;
2953             esac
2954         fi
2955 esac
2956 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2957 rs)
2958     echo "Using $up and $low to convert case." >&4
2959     ;;
2960 *)
2961     echo "I don't know how to translate letters from upper to lower case." >&4
2962     echo "Your tr is not acting any way I know of." >&4
2963     exit 1
2964     ;;
2965 esac
2966 : set up the translation script tr, must be called with ./tr of course
2967 cat >tr <<EOSC
2968 $startsh
2969 case "\$1\$2" in
2970 '[A-Z][a-z]') exec $tr '$up' '$low';;
2971 '[a-z][A-Z]') exec $tr '$low' '$up';;
2972 esac
2973 exec $tr "\$@"
2974 EOSC
2975 chmod +x tr
2976 $eunicefix tr
2977
2978 : Try to determine whether config.sh was made on this system
2979 case "$config_sh" in
2980 '')
2981 myuname=`$uname -a 2>/dev/null`
2982 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2983 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2984 # because the A-Z/a-z are not consecutive.
2985 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2986         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2987 newmyuname="$myuname"
2988 dflt=n
2989 case "$knowitall" in
2990 '')
2991         if test -f ../config.sh; then
2992                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2993                         eval "`grep myuname= ../config.sh`"
2994                 fi
2995                 if test "X$myuname" = "X$newmyuname"; then
2996                         dflt=y
2997                 fi
2998         fi
2999         ;;
3000 *) dflt=y;;
3001 esac
3002
3003 : Get old answers from old config file if Configure was run on the
3004 : same system, otherwise use the hints.
3005 hint=default
3006 cd ..
3007 if test -f config.sh; then
3008         echo " "
3009         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3010         . UU/myread
3011         case "$ans" in
3012         n*|N*) echo "OK, I'll ignore it."
3013                 mv config.sh config.sh.old
3014                 myuname="$newmyuname"
3015                 ;;
3016         *)  echo "Fetching default answers from your old config.sh file..." >&4
3017                 tmp_n="$n"
3018                 tmp_c="$c"
3019                 tmp_sh="$sh"
3020                 . ./config.sh
3021                 cp config.sh UU
3022                 n="$tmp_n"
3023                 c="$tmp_c"
3024                 : Older versions did not always set $sh.  Catch re-use of such
3025                 : an old config.sh.
3026                 case "$sh" in
3027                 '') sh="$tmp_sh" ;;
3028                 esac
3029                 hint=previous
3030                 ;;
3031         esac
3032 fi
3033 . ./UU/checkcc
3034 if test ! -f config.sh; then
3035         $cat <<EOM
3036
3037 First time through, eh?  I have some defaults handy for some systems
3038 that need some extra help getting the Configure answers right:
3039
3040 EOM
3041         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3042         dflt=''
3043         : Half the following guesses are probably wrong... If you have better
3044         : tests or hints, please send them to perlbug@perl.org
3045         : The metaconfig authors would also appreciate a copy...
3046         $test -f /irix && osname=irix
3047         $test -f /xenix && osname=sco_xenix
3048         $test -f /dynix && osname=dynix
3049         $test -f /dnix && osname=dnix
3050         $test -f /lynx.os && osname=lynxos
3051         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3052         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3053         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /bin/mips && /bin/mips && osname=mips
3055         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3056                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3057         $test -d /usr/apollo/bin && osname=apollo
3058         $test -f /etc/saf/_sactab && osname=svr4
3059         $test -d /usr/include/minix && osname=minix
3060         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3061         if $test -d /MachTen -o -d /MachTen_Folder; then
3062                 osname=machten
3063                 if $test -x /sbin/version; then
3064                         osvers=`/sbin/version | $awk '{print $2}' |
3065                         $sed -e 's/[A-Za-z]$//'`
3066                 elif $test -x /usr/etc/version; then
3067                         osvers=`/usr/etc/version | $awk '{print $2}' |
3068                         $sed -e 's/[A-Za-z]$//'`
3069                 else
3070                         osvers="$2.$3"
3071                 fi
3072         fi
3073
3074         $test -f /sys/posix.dll &&
3075                 $test -f /usr/bin/what &&
3076                 set X `/usr/bin/what /sys/posix.dll` &&
3077                 $test "$3" = UWIN &&
3078                 osname=uwin &&
3079                 osvers="$5"
3080
3081         if $test -f $uname; then
3082                 set X $myuname
3083                 shift
3084
3085                 case "$5" in
3086                 fps*) osname=fps ;;
3087                 mips*)
3088                         case "$4" in
3089                         umips) osname=umips ;;
3090                         *) osname=mips ;;
3091                         esac;;
3092                 [23]100) osname=mips ;;
3093                 next*) osname=next ;;
3094                 i386*)
3095                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3096                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3097                                 osname='sco'
3098                                 osvers=$tmp
3099                         elif $test -f /etc/kconfig; then
3100                                 osname=isc
3101                                 if test "$lns" = "$ln -s"; then
3102                                         osvers=4
3103                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3104                                         osvers=3
3105                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3106                                         osvers=2
3107                                 fi
3108                         fi
3109                         tmp=''
3110                         ;;
3111                 pc*)
3112                         if test -n "$DJGPP"; then
3113                                 osname=dos
3114                                 osvers=djgpp
3115                         fi
3116                         ;;
3117                 esac
3118
3119                 case "$1" in
3120                 aix) osname=aix
3121                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3122                         case "$tmp" in
3123                         # oslevel can fail with:
3124                         # oslevel: Unable to acquire lock.
3125                         *not\ found) osvers="$4"."$3" ;;
3126                         '<3240'|'<>3240') osvers=3.2.0 ;;
3127                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3128                         '=3250'|'>3250') osvers=3.2.5 ;;
3129                         *) osvers=$tmp;;
3130                         esac
3131                         ;;
3132                 bsd386) osname=bsd386
3133                         osvers=`$uname -r`
3134                         ;;
3135                 cygwin*) osname=cygwin
3136                         osvers="$3"
3137                         ;;
3138                 *dc.osx) osname=dcosx
3139                         osvers="$3"
3140                         ;;
3141                 dnix) osname=dnix
3142                         osvers="$3"
3143                         ;;
3144                 domainos) osname=apollo
3145                         osvers="$3"
3146                         ;;
3147                 dgux)   osname=dgux
3148                         osvers="$3"
3149                         ;;
3150                 dragonfly) osname=dragonfly
3151                         osvers="$3"
3152                         ;;
3153                 dynixptx*) osname=dynixptx
3154                         osvers=`echo "$4"|sed 's/^v//'`
3155                         ;;
3156                 freebsd) osname=freebsd
3157                         osvers="$3" ;;
3158                 genix)  osname=genix ;;
3159                 gnu)    osname=gnu
3160                         osvers="$3" ;;
3161                 hp*)    osname=hpux
3162                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3163                         ;;
3164                 irix*)  osname=irix
3165                         case "$3" in
3166                         4*) osvers=4 ;;
3167                         5*) osvers=5 ;;
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 linux)  osname=linux
3172                         case "$3" in
3173                         *)      osvers="$3" ;;
3174                         esac
3175                         ;;
3176                 MiNT)   osname=mint
3177                         ;;
3178                 netbsd*) osname=netbsd
3179                         osvers="$3"
3180                         ;;
3181                 news-os) osvers="$3"
3182                         case "$3" in
3183                         4*) osname=newsos4 ;;
3184                         *) osname=newsos ;;
3185                         esac
3186                         ;;
3187                 next*) osname=next ;;
3188                 nonstop-ux) osname=nonstopux ;;
3189                 openbsd) osname=openbsd
3190                         osvers="$3"
3191                         ;;
3192                 os2)    osname=os2
3193                         osvers="$4"
3194                         ;;
3195                 POSIX-BC | posix-bc ) osname=posix-bc
3196                         osvers="$3"
3197                         ;;
3198                 powerux | power_ux | powermax_os | powermaxos | \
3199                 powerunix | power_unix) osname=powerux
3200                         osvers="$3"
3201                         ;;
3202                 qnx) osname=qnx
3203                         osvers="$4"
3204                         ;;
3205                 solaris) osname=solaris
3206                         case "$3" in
3207                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3208                         *)      osvers="$3" ;;
3209                         esac
3210                         ;;
3211                 sunos) osname=sunos
3212                         case "$3" in
3213                         5*) osname=solaris
3214                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3215                         *)      osvers="$3" ;;
3216                         esac
3217                         ;;
3218                 titanos) osname=titanos
3219                         case "$3" in
3220                         1*) osvers=1 ;;
3221                         2*) osvers=2 ;;
3222                         3*) osvers=3 ;;
3223                         4*) osvers=4 ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 ultrix) osname=ultrix
3228                         osvers="$3"
3229                         ;;
3230                 osf1|mls+)      case "$5" in
3231                                 alpha)
3232                                         osname=dec_osf
3233                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3234                                         case "$osvers" in
3235                                         [1-9].[0-9]*) ;;
3236                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3237                                         esac
3238                                         ;;
3239                         hp*)    osname=hp_osf1  ;;
3240                         mips)   osname=mips_osf1 ;;
3241                         esac
3242                         ;;
3243                 # UnixWare 7.1.2 is known as Open UNIX 8
3244                 openunix|unixware) osname=svr5
3245                         osvers="$4"
3246                         ;;
3247                 uts)    osname=uts
3248                         osvers="$3"
3249                         ;;
3250                 vos) osvers="$3"
3251                         ;;
3252                 $2) case "$osname" in
3253                         *isc*) ;;
3254                         *freebsd*) ;;
3255                         svr*)
3256                                 : svr4.x or possibly later
3257                                 case "svr$3" in
3258                                 ${osname}*)
3259                                         osname=svr$3
3260                                         osvers=$4
3261                                         ;;
3262                                 esac
3263                                 case "$osname" in
3264                                 svr4.0)
3265                                         : Check for ESIX
3266                                         if test -f /stand/boot ; then
3267                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3268                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3269                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3270                                                         if test -n "$isesix"; then
3271                                                                 osname=esix4
3272                                                         fi
3273                                                 fi
3274                                         fi
3275                                         ;;
3276                                 esac
3277                                 ;;
3278                         *)      if test -f /etc/systemid; then
3279                                         osname=sco
3280                                         set `echo $3 | $sed 's/\./ /g'` $4
3281                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3282                                                 osvers=$1.$2.$3
3283                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3284                                                 osvers=$1.$2
3285                                         elif $test -f $src/hints/sco_$1.sh; then
3286                                                 osvers=$1
3287                                         fi
3288                                 else
3289                                         case "$osname" in
3290                                         '') : Still unknown.  Probably a generic Sys V.
3291                                                 osname="sysv"
3292                                                 osvers="$3"
3293                                                 ;;
3294                                         esac
3295                                 fi
3296                                 ;;
3297                         esac
3298                         ;;
3299                 *)      case "$osname" in
3300                         '') : Still unknown.  Probably a generic BSD.
3301                                 osname="$1"
3302                                 osvers="$3"
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307         else
3308                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3309                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3310                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3311                                 osname=news_os
3312                         fi
3313                         $rm -f UU/kernel.what
3314                 elif test -d c:/. -o -n "$is_os2" ; then
3315                         set X $myuname
3316                         osname=os2
3317                         osvers="$5"
3318                 fi
3319         fi
3320
3321         case "$targetarch" in
3322         '') ;;
3323         *)  hostarch=$osname
3324             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3325             osvers=''
3326             ;;
3327         esac
3328
3329         : Now look for a hint file osname_osvers, unless one has been
3330         : specified already.
3331         case "$hintfile" in
3332         ''|' ')
3333                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3334                 : Also try without trailing minor version numbers.
3335                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3336                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3337                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3339                 case "$file" in
3340                 '') dflt=none ;;
3341                 *)  case "$osvers" in
3342                         '') dflt=$file
3343                                 ;;
3344                         *)  if $test -f $src/hints/$file.sh ; then
3345                                         dflt=$file
3346                                 elif $test -f $src/hints/$xfile.sh ; then
3347                                         dflt=$xfile
3348                                 elif $test -f $src/hints/$xxfile.sh ; then
3349                                         dflt=$xxfile
3350                                 elif $test -f $src/hints/$xxxfile.sh ; then
3351                                         dflt=$xxxfile
3352                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3353                                         dflt=$xxxxfile
3354                                 elif $test -f "$src/hints/${osname}.sh" ; then
3355                                         dflt="${osname}"
3356                                 else
3357                                         dflt=none
3358                                 fi
3359                                 ;;
3360                         esac
3361                         ;;
3362                 esac
3363                 if $test -f Policy.sh ; then
3364                         case "$dflt" in
3365                         *Policy*) ;;
3366                         none) dflt="Policy" ;;
3367                         *) dflt="Policy $dflt" ;;
3368                         esac
3369                 fi
3370                 ;;
3371         *)
3372                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3373                 ;;
3374         esac
3375
3376         if $test -f Policy.sh ; then
3377                 $cat <<EOM
3378
3379 There's also a Policy hint file available, which should make the
3380 site-specific (policy) questions easier to answer.
3381 EOM
3382
3383         fi
3384
3385         $cat <<EOM
3386
3387 You may give one or more space-separated answers, or "none" if appropriate.
3388 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3389 previous run of Configure, you may specify it as well as or instead of
3390 OS-specific hints.  If hints are provided for your OS, you should use them:
3391 although Perl can probably be built without hints on many platforms, using
3392 hints often improve performance and may enable features that Configure can't
3393 set up on its own. If there are no hints that match your OS, specify "none";
3394 DO NOT give a wrong version or a wrong OS.
3395
3396 EOM
3397
3398         rp="Which of these apply, if any?"
3399         . UU/myread
3400         tans=$ans
3401         for file in $tans; do
3402                 if $test X$file = XPolicy -a -f Policy.sh; then
3403                         . Policy.sh
3404                         $cat Policy.sh >> UU/config.sh
3405                 elif $test -f $src/hints/$file.sh; then
3406                         . $src/hints/$file.sh
3407                         $cat $src/hints/$file.sh >> UU/config.sh
3408                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3409                         : nothing
3410                 else
3411                         : Give one chance to correct a possible typo.
3412                         echo "$file.sh does not exist"
3413                         dflt=$file
3414                         rp="hint to use instead?"
3415                         . UU/myread
3416                         for file in $ans; do
3417                                 if $test -f "$src/hints/$file.sh"; then
3418                                         . $src/hints/$file.sh
3419                                         $cat $src/hints/$file.sh >> UU/config.sh
3420                                 elif $test X$ans = X -o X$ans = Xnone ; then
3421                                         : nothing
3422                                 else
3423                                         echo "$file.sh does not exist -- ignored."
3424                                 fi
3425                         done
3426                 fi
3427         done
3428
3429         hint=recommended
3430         : Remember our hint file for later.
3431         if $test -f "$src/hints/$file.sh" ; then
3432                 hintfile="$file"
3433         else
3434                 hintfile=''
3435         fi
3436 fi
3437 cd UU
3438 ;;
3439 *)
3440         echo " "
3441         echo "Fetching default answers from $config_sh..." >&4
3442         tmp_n="$n"
3443         tmp_c="$c"
3444         cd ..
3445         cp $config_sh config.sh 2>/dev/null
3446         chmod +w config.sh
3447         . ./config.sh
3448         cd UU
3449         cp ../config.sh .
3450         n="$tmp_n"
3451         c="$tmp_c"
3452         hint=previous
3453         ;;
3454 esac
3455 test "$override" && . ./optdef.sh
3456
3457 : Restore computed paths
3458 for file in $loclist $trylist; do
3459         eval $file="\$_$file"
3460 done
3461
3462 cat << EOM
3463
3464 Configure uses the operating system name and version to set some defaults.
3465 The default value is probably right if the name rings a bell. Otherwise,
3466 since spelling matters for me, either accept the default or answer "none"
3467 to leave it blank.
3468
3469 EOM
3470 case "$osname" in
3471         ''|' ')
3472                 case "$hintfile" in
3473                 ''|' '|none) dflt=none ;;
3474                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3475                 esac
3476                 ;;
3477         *) dflt="$osname" ;;
3478 esac
3479 rp="Operating system name?"
3480 . ./myread
3481 case "$ans" in
3482 none)  osname='' ;;
3483 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3484 esac
3485 echo " "
3486 case "$osvers" in
3487         ''|' ')
3488                 case "$hintfile" in
3489                 ''|' '|none) dflt=none ;;
3490                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3491                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3492                         case "$dflt" in
3493                         ''|' ') dflt=none ;;
3494                         esac
3495                         ;;
3496                 esac
3497                 ;;
3498         *) dflt="$osvers" ;;
3499 esac
3500 rp="Operating system version?"
3501 . ./myread
3502 case "$ans" in
3503 none)  osvers='' ;;
3504 *) osvers="$ans" ;;
3505 esac
3506
3507
3508 . ./posthint.sh
3509
3510 : who configured the system
3511 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3512 case "$cf_by" in
3513 "")
3514         cf_by=`(logname) 2>/dev/null`
3515         case "$cf_by" in
3516         "")
3517                 cf_by=`(whoami) 2>/dev/null`
3518                 case "$cf_by" in
3519                 "") cf_by=unknown ;;
3520                 esac ;;
3521         esac ;;
3522 esac
3523
3524 : decide how portable to be.  Allow command line overrides.
3525 case "$d_portable" in
3526 "$undef") ;;
3527 *)      d_portable="$define" ;;
3528 esac
3529
3530 : set up shell script to do ~ expansion
3531 cat >filexp <<EOSS
3532 $startsh
3533 : expand filename
3534 case "\$1" in
3535  ~/*|~)
3536         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3537         ;;
3538  ~*)
3539         if $test -f /bin/csh; then
3540                 /bin/csh -f -c "glob \$1"
3541                 failed=\$?
3542                 echo ""
3543                 exit \$failed
3544         else
3545                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3546                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3547                 if $test ! -d "\$dir"; then
3548                         me=\`basename \$0\`
3549                         echo "\$me: can't locate home directory for: \$name" >&2
3550                         exit 1
3551                 fi
3552                 case "\$1" in
3553                 */*)
3554                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3555                         ;;
3556                 *)
3557                         echo \$dir
3558                         ;;
3559                 esac
3560         fi
3561         ;;
3562 *)
3563         echo \$1
3564         ;;
3565 esac
3566 EOSS
3567 chmod +x filexp
3568 $eunicefix filexp
3569
3570 : now set up to get a file name
3571 cat <<EOS >getfile
3572 $startsh
3573 EOS
3574 cat <<'EOSC' >>getfile
3575 tilde=''
3576 fullpath=''
3577 already=''
3578 skip=''
3579 none_ok=''
3580 exp_file=''
3581 nopath_ok=''
3582 orig_rp="$rp"
3583 orig_dflt="$dflt"
3584 case "$gfpth" in
3585 '') gfpth='.' ;;
3586 esac
3587
3588 case "$fn" in
3589 *\(*)
3590         : getfile will accept an answer from the comma-separated list
3591         : enclosed in parentheses even if it does not meet other criteria.
3592         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3593         fn=`echo $fn | sed 's/(.*)//'`
3594         ;;
3595 esac
3596
3597 case "$fn" in
3598 *:*)
3599         loc_file=`expr $fn : '.*:\(.*\)'`
3600         fn=`expr $fn : '\(.*\):.*'`
3601         ;;
3602 esac
3603
3604 case "$fn" in
3605 *~*) tilde=true;;
3606 esac
3607 case "$fn" in
3608 */*) fullpath=true;;
3609 esac
3610 case "$fn" in
3611 *+*) skip=true;;
3612 esac
3613 case "$fn" in
3614 *n*) none_ok=true;;
3615 esac
3616 case "$fn" in
3617 *e*) exp_file=true;;
3618 esac
3619 case "$fn" in
3620 *p*) nopath_ok=true;;
3621 esac
3622
3623 case "$fn" in
3624 *f*) type='File';;
3625 *d*) type='Directory';;
3626 *l*) type='Locate';;
3627 esac
3628
3629 what="$type"
3630 case "$what" in
3631 Locate) what='File';;
3632 esac
3633
3634 case "$exp_file" in
3635 '')
3636         case "$d_portable" in
3637         "$define") ;;
3638         *) exp_file=true;;
3639         esac
3640         ;;
3641 esac
3642
3643 cd ..
3644 while test "$type"; do
3645         redo=''
3646         rp="$orig_rp"
3647         dflt="$orig_dflt"
3648         case "$tilde" in
3649         true) rp="$rp (~name ok)";;
3650         esac
3651         . UU/myread
3652         if test -f UU/getfile.ok && \
3653                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3654         then
3655                 value="$ans"
3656                 ansexp="$ans"
3657                 break
3658         fi
3659         case "$ans" in
3660         none)
3661                 value=''
3662                 ansexp=''
3663                 case "$none_ok" in
3664                 true) type='';;
3665                 esac
3666                 ;;
3667         *)
3668                 case "$tilde" in
3669                 '') value="$ans"
3670                         ansexp="$ans";;
3671                 *)
3672                         value=`UU/filexp $ans`
3673                         case $? in
3674                         0)
3675                                 if test "$ans" != "$value"; then
3676                                         echo "(That expands to $value on this system.)"
3677                                 fi
3678                                 ;;
3679                         *) value="$ans";;
3680                         esac
3681                         ansexp="$value"
3682                         case "$exp_file" in
3683                         '') value="$ans";;
3684                         esac
3685                         ;;
3686                 esac
3687                 case "$fullpath" in
3688                 true)
3689                         case "$ansexp" in
3690                         /*) value="$ansexp" ;;
3691                         [a-zA-Z]:/*) value="$ansexp" ;;
3692                         *)
3693                                 redo=true
3694                                 case "$already" in
3695                                 true)
3696                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3697                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3698                                         ;;
3699                                 *)
3700                                 echo "Please give a full path name, starting with slash." >&4
3701                                         case "$tilde" in
3702                                         true)
3703                                 echo "Note that using ~name is ok provided it expands well." >&4
3704                                                 already=true
3705                                                 ;;
3706                                         esac
3707                                 esac
3708                                 ;;
3709                         esac
3710                         ;;
3711                 esac
3712                 case "$redo" in
3713                 '')
3714                         case "$type" in
3715                         File)
3716                                 for fp in $gfpth; do
3717                                         if test "X$fp" = X.; then
3718                                             pf="$ansexp"
3719                                         else    
3720                                             pf="$fp/$ansexp"
3721                                         fi
3722                                         if test -f "$pf"; then
3723                                                 type=''
3724                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3725                                         then
3726                                                 echo "($value is not a plain file, but that's ok.)"
3727                                                 type=''
3728                                         fi
3729                                         if test X"$type" = X; then
3730                                             value="$pf"
3731                                             break
3732                                         fi
3733                                 done
3734                                 ;;
3735                         Directory)
3736                                 for fp in $gfpth; do
3737                                         if test "X$fp" = X.; then
3738                                             dir="$ans"
3739                                             direxp="$ansexp"
3740                                         else    
3741                                             dir="$fp/$ansexp"
3742                                             direxp="$fp/$ansexp"
3743                                         fi
3744                                         if test -d "$direxp"; then
3745                                                 type=''
3746                                                 value="$dir"
3747                                                 break
3748                                         fi
3749                                 done
3750                                 ;;
3751                         Locate)
3752                                 if test -d "$ansexp"; then
3753                                         echo "(Looking for $loc_file in directory $value.)"
3754                                         value="$value/$loc_file"
3755                                         ansexp="$ansexp/$loc_file"
3756                                 fi
3757                                 if test -f "$ansexp"; then
3758                                         type=''
3759                                 fi
3760                                 case "$nopath_ok" in
3761                                 true)   case "$value" in
3762                                         */*) ;;
3763                                         *)      echo "Assuming $value will be in people's path."
3764                                                 type=''
3765                                                 ;;
3766                                         esac
3767                                         ;;
3768                                 esac
3769                                 ;;
3770                         esac
3771
3772                         case "$skip" in
3773                         true) type='';
3774                         esac
3775
3776                         case "$type" in
3777                         '') ;;
3778                         *)
3779                                 if test "$fastread" = yes; then
3780                                         dflt=y
3781                                 else
3782                                         dflt=n
3783                                 fi
3784                                 rp="$what $value doesn't exist.  Use that name anyway?"
3785                                 . UU/myread
3786                                 dflt=''
3787                                 case "$ans" in
3788                                 y*) type='';;
3789                                 *) echo " ";;
3790                                 esac
3791                                 ;;
3792                         esac
3793                         ;;
3794                 esac
3795                 ;;
3796         esac
3797 done
3798 cd UU
3799 ans="$value"
3800 rp="$orig_rp"
3801 dflt="$orig_dflt"
3802 rm -f getfile.ok
3803 test "X$gfpthkeep" != Xy && gfpth=""
3804 EOSC
3805
3806 : determine root of directory hierarchy where package will be installed.
3807 case "$prefix" in
3808 '')
3809         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3810         ;;
3811 *?/)
3812         dflt=`echo "$prefix" | sed 's/.$//'`
3813         ;;
3814 *)
3815         dflt="$prefix"
3816         ;;
3817 esac
3818 $cat <<EOM
3819
3820 By default, $package will be installed in $dflt/bin, manual pages
3821 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3822 installation directories. Typically this is something like /usr/local.
3823 If you wish to have binaries under /usr/bin but other parts of the
3824 installation under /usr/local, that's ok: you will be prompted
3825 separately for each of the installation directories, the prefix being
3826 only used to set the defaults.
3827
3828 EOM
3829 fn=d~
3830 rp='Installation prefix to use?'
3831 . ./getfile
3832 oldprefix=''
3833 case "$prefix" in
3834 '') ;;
3835 *)
3836         case "$ans" in
3837         "$prefix") ;;
3838         *) oldprefix="$prefix";;
3839         esac
3840         ;;
3841 esac
3842 prefix="$ans"
3843 prefixexp="$ansexp"
3844
3845 case "$afsroot" in
3846 '')     afsroot=/afs ;;
3847 *)      afsroot=$afsroot ;;
3848 esac
3849
3850 : is AFS running?
3851 echo " "
3852 case "$afs" in
3853 $define|true)   afs=true ;;
3854 $undef|false)   afs=false ;;
3855 *)      if test -d $afsroot; then
3856                 afs=true
3857         else
3858                 afs=false
3859         fi
3860         ;;
3861 esac
3862 if $afs; then
3863         echo "AFS may be running... I'll be extra cautious then..." >&4
3864 else
3865         echo "AFS does not seem to be running..." >&4
3866 fi
3867
3868 : determine installation prefix for where package is to be installed.
3869 if $afs; then 
3870 $cat <<EOM
3871
3872 Since you are running AFS, I need to distinguish the directory in which
3873 files will reside from the directory in which they are installed (and from
3874 which they are presumably copied to the former directory by occult means).
3875
3876 EOM
3877         case "$installprefix" in
3878         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3879         *) dflt="$installprefix";;
3880         esac
3881 else
3882 $cat <<EOM
3883
3884 In some special cases, particularly when building $package for distribution,
3885 it is convenient to distinguish the directory in which files should be
3886 installed from the directory ($prefix) in which they will
3887 eventually reside.  For most users, these two directories are the same.
3888
3889 EOM
3890         case "$installprefix" in
3891         '') dflt=$prefix ;;
3892         *) dflt=$installprefix;;
3893         esac
3894 fi
3895 fn=d~
3896 rp='What installation prefix should I use for installing files?'
3897 . ./getfile
3898 installprefix="$ans"
3899 installprefixexp="$ansexp"
3900
3901 : Perform the prefixexp/installprefixexp correction if necessary
3902 cat <<EOS >installprefix
3903 $startsh
3904 EOS
3905 cat <<'EOSC' >>installprefix
3906 : Change installation prefix, if necessary.
3907 if $test X"$prefix" != X"$installprefix"; then
3908     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3909 else
3910     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3911 fi
3912 EOSC
3913 chmod +x installprefix
3914 $eunicefix installprefix
3915
3916 : Set variables such as privlib and privlibexp from the output of ./getfile
3917 : performing the prefixexp/installprefixexp correction if necessary.
3918 cat <<EOS >setprefixvar
3919 $startsh
3920 EOS
3921 cat <<'EOSC' >>setprefixvar
3922 eval "${prefixvar}=\"\$ans\""
3923 eval "${prefixvar}exp=\"\$ansexp\""
3924 . ./installprefix
3925 EOSC
3926 chmod +x setprefixvar
3927 $eunicefix setprefixvar
3928
3929 : set up the script used to warn in case of inconsistency
3930 cat <<EOS >whoa
3931 $startsh
3932 EOS
3933 cat <<'EOSC' >>whoa
3934 dflt=y
3935 echo " "
3936 echo "*** WHOA THERE!!! ***" >&4
3937 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3938 rp="    Keep the $hint value?"
3939 . ./myread
3940 case "$ans" in
3941 y) td=$was; tu=$was;;
3942 esac
3943 EOSC
3944
3945 : function used to set $1 to $val
3946 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3947 case "$val$was" in
3948 $define$undef) . ./whoa; eval "$var=\$td";;
3949 $undef$define) . ./whoa; eval "$var=\$tu";;
3950 *) eval "$var=$val";;
3951 esac'
3952
3953 case "$usesocks" in
3954 $define|true|[yY]*)     dflt='y';;
3955 *) dflt='n';;
3956 esac
3957 cat <<EOM
3958
3959 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3960 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3961 to use the PerlIO abstraction layer, this will be implicitly selected.
3962
3963 If this doesn't make any sense to you, just accept the default '$dflt'.
3964 EOM
3965 rp='Build Perl for SOCKS?'
3966 . ./myread
3967 case "$ans" in
3968 y|Y)    val="$define" ;;     
3969 *)      val="$undef" ;;
3970 esac
3971 set usesocks
3972 eval $setvar
3973
3974 case "$usesocks" in
3975 $define|true|[yY]*) useperlio="$define";;
3976 esac
3977
3978 case "$useperlio" in
3979 $define|true|[yY]*|'')  dflt='y';;
3980 *) dflt='n';;
3981 esac
3982 cat <<EOM
3983
3984 Previous version of $package used the standard IO mechanisms as
3985 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3986 alternate IO mechanisms via the PerlIO abstraction layer, but the
3987 stdio mechanism is still available if needed.  The abstraction layer
3988 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3989 Using PerlIO with sfio may cause problems with some extension modules.
3990
3991 If this doesn't make any sense to you, just accept the default '$dflt'.
3992 EOM
3993 rp='Use the PerlIO abstraction layer?'
3994 . ./myread
3995 case "$ans" in
3996 y|Y) 
3997         val="$define"
3998         ;;
3999 *)      
4000         echo "Ok, doing things the stdio way."
4001         val="$undef"
4002         ;;
4003 esac
4004 set useperlio
4005 eval $setvar 
4006
4007 case "$usesocks" in
4008 $define|true|[yY]*)
4009         case "$useperlio" in
4010         $define|true|[yY]*) ;;
4011         *)      cat >&4 <<EOM
4012
4013 You are using the SOCKS proxy protocol library which means that you
4014 should also use the PerlIO layer.  You may be headed for trouble.
4015
4016 EOM
4017                 ;;
4018         esac
4019         ;;
4020 esac
4021
4022         
4023 case "$usethreads" in
4024 $define|true|[yY]*)     dflt='y';;
4025 *)     # Catch case where user specified ithreads or 5005threads but
4026        # forgot -Dusethreads (A.D. 4/2002)
4027        case "$useithreads$use5005threads" in
4028        *$define*)      
4029                 case "$useperlio" in
4030                 "$define")      dflt='y' ;;
4031                 *)              dflt='n' ;;
4032                 esac
4033                 ;;
4034        *)       dflt='n';;
4035        esac
4036        ;;
4037 esac
4038 cat <<EOM
4039
4040 Perl can be built to take advantage of threads on some systems.
4041 To do so, Configure can be run with -Dusethreads.
4042
4043 Note that Perl built with threading support runs slightly slower
4044 and uses more memory than plain Perl. The current implementation
4045 is believed to be stable, but it is fairly new, and so should be
4046 treated with caution.
4047
4048 If this doesn't make any sense to you, just accept the default '$dflt'.
4049 EOM
4050 rp='Build a threading Perl?'
4051 . ./myread
4052 case "$ans" in
4053 y|Y)    val="$define" ;;
4054 *)      val="$undef" ;;
4055 esac
4056 set usethreads
4057 eval $setvar
4058
4059 case "$usethreads" in
4060 $define)
4061         $cat <<EOM
4062
4063 Since release 5.6, Perl has had two different threading implementations,
4064 the newer interpreter-based version (ithreads) with one interpreter per
4065 thread, and the older 5.005 version (5005threads).
4066 The 5005threads version is effectively unmaintained and will probably be
4067 removed in Perl 5.10, so there should be no need to build a Perl using it
4068 unless needed for backwards compatibility with some existing 5.005threads
4069 code.
4070
4071 EOM
4072         : Default to ithreads unless overridden on command line or with
4073         : old config.sh
4074         dflt='y'
4075         case "$use5005threads" in
4076                 $define|true|[yY]*) dflt='n';;
4077         esac
4078         case "$useithreads" in
4079                 $undef|false|[nN]*) dflt='n';;
4080         esac
4081         rp='Use the newer interpreter-based ithreads?'
4082         . ./myread
4083         case "$ans" in
4084         y|Y)    val="$define" ;;
4085         *)      val="$undef" ;;
4086         esac
4087         set useithreads
4088         eval $setvar
4089         : Now set use5005threads to the opposite value.
4090         case "$useithreads" in
4091         $define) val="$undef" ;;
4092         *) val="$define" ;;
4093         esac
4094         set use5005threads
4095         eval $setvar
4096         ;;
4097 *)
4098         useithreads="$undef"
4099         use5005threads="$undef"
4100         ;;
4101 esac
4102
4103 case "$useithreads$use5005threads" in
4104 "$define$define")
4105         $cat >&4 <<EOM
4106
4107 You cannot have both the ithreads and the 5.005 threads enabled
4108 at the same time.  Disabling the 5.005 threads since they are
4109 much less stable than the ithreads.
4110
4111 EOM
4112         use5005threads="$undef"
4113         ;;
4114 esac
4115
4116 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4117         cat >&4 <<EOF
4118 ***
4119 *** To build with ithreads you must also use the PerlIO layer.
4120 *** Cannot continue, aborting.
4121 ***
4122 EOF
4123         exit 1
4124 fi
4125
4126 case "$d_oldpthreads" in
4127 '')     : Configure tests would be welcome here.  For now, assume undef.
4128         val="$undef" ;;
4129 *)      val="$d_oldpthreads" ;;
4130 esac
4131 set d_oldpthreads
4132 eval $setvar
4133
4134
4135 : Look for a hint-file generated 'call-back-unit'.  If the
4136 : user has specified that a threading perl is to be built,
4137 : we may need to set or change some other defaults.
4138 if $test -f usethreads.cbu; then
4139     echo "Your platform has some specific hints regarding threaded builds, using them..."
4140     . ./usethreads.cbu
4141 else
4142     case "$usethreads" in
4143         "$define"|true|[yY]*)
4144                 $cat <<EOM
4145 (Your platform does not have any specific hints for threaded builds.
4146  Assuming POSIX threads, then.)
4147 EOM
4148         ;;
4149     esac
4150 fi
4151
4152 cat <<EOM
4153
4154 Perl can be built so that multiple Perl interpreters can coexist
4155 within the same Perl executable.
4156 EOM
4157
4158 case "$useithreads" in
4159 $define)
4160         cat <<EOM
4161 This multiple interpreter support is required for interpreter-based threads.
4162 EOM
4163         val="$define"
4164         ;;
4165 *)      case "$usemultiplicity" in
4166         $define|true|[yY]*)     dflt='y';;
4167         *) dflt='n';;
4168         esac
4169         echo " "
4170         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4171         rp='Build Perl for multiplicity?'
4172         . ./myread
4173         case "$ans" in
4174         y|Y)    val="$define" ;;
4175         *)      val="$undef" ;;
4176         esac
4177         ;;
4178 esac
4179 set usemultiplicity
4180 eval $setvar
4181
4182
4183 case "$usemorebits" in
4184 "$define"|true|[yY]*)
4185         use64bitint="$define"
4186         uselongdouble="$define"
4187         usemorebits="$define"
4188         ;;
4189 *)      usemorebits="$undef"
4190         ;;
4191 esac
4192
4193 : make some quick guesses about what we are up against
4194 echo " "
4195 $echo $n "Hmm...  $c"
4196 echo exit 1 >bsd
4197 echo exit 1 >usg
4198 echo exit 1 >v7
4199 echo exit 1 >osf1
4200 echo exit 1 >eunice
4201 echo exit 1 >xenix
4202 echo exit 1 >venix
4203 echo exit 1 >os2
4204 d_bsd="$undef"
4205 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4206 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4207 then
4208         echo "Looks kind of like an OSF/1 system, but we'll see..."
4209         echo exit 0 >osf1
4210 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4211         xxx=`./loc addbib blurfl $pth`
4212         if $test -f $xxx; then
4213         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4214                 echo exit 0 >bsd
4215                 echo exit 0 >usg
4216         else
4217                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4218                         echo "Looks kind of like an extended USG system, but we'll see..."
4219                 else
4220                         echo "Looks kind of like a USG system, but we'll see..."
4221                 fi
4222                 echo exit 0 >usg
4223         fi
4224 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4225         echo "Looks kind of like a BSD system, but we'll see..."
4226         d_bsd="$define"
4227         echo exit 0 >bsd
4228 else
4229         echo "Looks kind of like a Version 7 system, but we'll see..."
4230         echo exit 0 >v7
4231 fi
4232 case "$eunicefix" in
4233 *unixtovms*)
4234         $cat <<'EOI'
4235 There is, however, a strange, musty smell in the air that reminds me of
4236 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4237 EOI
4238         echo exit 0 >eunice
4239         d_eunice="$define"
4240 : it so happens the Eunice I know will not run shell scripts in Unix format
4241         ;;
4242 *)
4243         echo " "
4244         echo "Congratulations.  You aren't running Eunice."
4245         d_eunice="$undef"
4246         ;;
4247 esac
4248 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4249 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4250 : semicolon as a patch separator
4251 case "$p_" in
4252 :) ;;
4253 *)
4254         $cat <<'EOI'
4255 I have the feeling something is not exactly right, however...don't tell me...
4256 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4257 (Or you may be running DOS with DJGPP.)
4258 EOI
4259         echo exit 0 >os2
4260         ;;
4261 esac
4262 if test -f /xenix; then
4263         echo "Actually, this looks more like a XENIX system..."
4264         echo exit 0 >xenix
4265         d_xenix="$define"
4266 else
4267         echo " "
4268         echo "It's not Xenix..."
4269         d_xenix="$undef"
4270 fi
4271 chmod +x xenix
4272 $eunicefix xenix
4273 if test -f /venix; then
4274         echo "Actually, this looks more like a VENIX system..."
4275         echo exit 0 >venix
4276 else
4277         echo " "
4278         if ./xenix; then
4279                 : null
4280         else
4281                 echo "Nor is it Venix..."
4282         fi
4283 fi
4284 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4285 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4286 $rm -f foo
4287
4288 case "$cc" in
4289 '') dflt=cc;;
4290 *) dflt="$cc";;
4291 esac
4292 rp="Use which C compiler?"
4293 . ./myread
4294 cc="$ans"
4295
4296 : See if they have not cc but they do have gcc
4297 . ./trygcc
4298 : Look for a hint-file generated 'call-back-unit'.  Now that the
4299 : user has specified the compiler, we may need to set or change some
4300 : other defaults.
4301 if $test -f cc.cbu; then
4302     . ./cc.cbu
4303 fi
4304 . ./checkcc
4305
4306 echo " "
4307 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4308 $cat >try.c <<EOM
4309 #include <stdio.h>
4310 int main() {
4311 #ifdef __GNUC__
4312 #ifdef __VERSION__
4313         printf("%s\n", __VERSION__);
4314 #else
4315         printf("%s\n", "1");
4316 #endif
4317 #endif
4318         return(0);
4319 }
4320 EOM
4321 if $cc -o try $ccflags $ldflags try.c; then
4322         gccversion=`$run ./try`
4323         case "$gccversion" in
4324         '') echo "You are not using GNU cc." ;;
4325         *)  echo "You are using GNU cc $gccversion."
4326             ccname=gcc
4327             ;;
4328         esac
4329 else
4330         echo " "
4331         echo "*** WHOA THERE!!! ***" >&4
4332         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4333         case "$knowitall" in
4334         '')
4335         echo "    You'd better start hunting for one and let me know about it." >&4
4336                 exit 1
4337                 ;;
4338         esac
4339 fi
4340 $rm -f try try.*
4341 case "$gccversion" in
4342 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4343 esac
4344 case "$gccversion" in
4345 '') gccosandvers='' ;;
4346 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4347    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4348    gccshortvers=''
4349    case "$gccosandvers" in
4350    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4351    $osname$osvers) ;; # looking good
4352    $osname*) cat <<EOM >&4
4353
4354 *** WHOA THERE!!! ***
4355
4356     Your gcc has not been compiled for the exact release of
4357     your operating system ($gccosandvers versus $osname$osvers).
4358
4359     In general it is a good idea to keep gcc synchronized with
4360     the operating system because otherwise serious problems
4361     may ensue when trying to compile software, like Perl.
4362
4363     I'm trying to be optimistic here, though, and will continue.
4364     If later during the configuration and build icky compilation
4365     problems appear (headerfile conflicts being the most common
4366     manifestation), I suggest reinstalling the gcc to match
4367     your operating system release.
4368
4369 EOM
4370       ;;
4371    *) gccosandvers='' ;; # failed to parse, better be silent
4372    esac
4373    ;;
4374 esac
4375 case "$ccname" in
4376 '') ccname="$cc" ;;
4377 esac
4378
4379 # gcc 3.* complain about adding -Idirectories that they already know about,
4380 # so we will take those off from locincpth.
4381 case "$gccversion" in
4382 3*)
4383     echo "main(){}">try.c
4384     for incdir in $locincpth; do
4385        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4386              grep '^c[cp]p*[01]: warning: changing search order '`
4387        if test "X$warn" != X; then
4388            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4389        fi
4390     done
4391     $rm -f try try.*
4392 esac
4393
4394 : What should the include directory be ?
4395 echo " "
4396 $echo $n "Hmm...  $c"
4397 dflt='/usr/include'
4398 incpath=''
4399 mips_type=''
4400 if $test -f /bin/mips && /bin/mips; then
4401         echo "Looks like a MIPS system..."
4402         $cat >usr.c <<'EOCP'
4403 #ifdef SYSTYPE_BSD43
4404 /bsd43
4405 #endif
4406 EOCP
4407         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4408                 dflt='/bsd43/usr/include'
4409                 incpath='/bsd43'
4410                 mips_type='BSD 4.3'
4411         else
4412                 mips_type='System V'
4413         fi
4414         $rm -f usr.c usr.out
4415         echo "and you're compiling with the $mips_type compiler and libraries."
4416         xxx_prompt=y
4417         echo "exit 0" >mips
4418 else
4419         echo "Doesn't look like a MIPS system."
4420         xxx_prompt=n
4421         echo "exit 1" >mips
4422 fi
4423 chmod +x mips
4424 $eunicefix mips
4425 case "$usrinc" in
4426 '') ;;
4427 *) dflt="$usrinc";;
4428 esac
4429 case "$xxx_prompt" in
4430 y)      fn=d/
4431         echo " "
4432         rp='Where are the include files you want to use?'
4433         . ./getfile
4434         usrinc="$ans"
4435         ;;
4436 *)      usrinc="$dflt"
4437         ;;
4438 esac
4439
4440 : see how we invoke the C preprocessor
4441 echo " "
4442 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4443 cat <<'EOT' >testcpp.c
4444 #define ABC abc
4445 #define XYZ xyz
4446 ABC.XYZ
4447 EOT
4448 cd ..
4449 if test ! -f cppstdin; then
4450         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4451                 # AIX cc -E doesn't show the absolute headerfile
4452                 # locations but we'll cheat by using the -M flag.
4453                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4454         else
4455                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4456         fi
4457 else
4458         echo "Keeping your $hint cppstdin wrapper."
4459 fi
4460 chmod 755 cppstdin
4461 wrapper=`pwd`/cppstdin
4462 ok='false'
4463 cd UU
4464
4465 if $test "X$cppstdin" != "X" && \
4466         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4467         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4468 then
4469         echo "You used to use $cppstdin $cppminus so we'll use that again."
4470         case "$cpprun" in
4471         '') echo "But let's see if we can live without a wrapper..." ;;
4472         *)
4473                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4474                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4475                 then
4476                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4477                         ok='true'
4478                 else
4479                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4480                 fi
4481                 ;;
4482         esac
4483 else
4484         case "$cppstdin" in
4485         '') ;;
4486         *)
4487                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4488                 ;;
4489         esac
4490 fi
4491
4492 if $ok; then
4493         : nothing
4494 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4495         $cc -E <testcpp.c >testcpp.out 2>&1; \
4496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4497         echo "Yup, it does."
4498         x_cpp="$cc -E"
4499         x_minus='';
4500 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4501         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4502         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4503         echo "Yup, it does."
4504         x_cpp="$cc -E"
4505         x_minus='-';
4506 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4507         $cc -P <testcpp.c >testcpp.out 2>&1; \
4508         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4509         echo "Yipee, that works!"
4510         x_cpp="$cc -P"
4511         x_minus='';
4512 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4513         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4514         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4515         echo "At long last!"
4516         x_cpp="$cc -P"
4517         x_minus='-';
4518 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4519         $cpp <testcpp.c >testcpp.out 2>&1; \
4520         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4521         echo "It works!"
4522         x_cpp="$cpp"
4523         x_minus='';
4524 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4525         $cpp - <testcpp.c >testcpp.out 2>&1; \
4526         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4527         echo "Hooray, it works!  I was beginning to wonder."
4528         x_cpp="$cpp"
4529         x_minus='-';
4530 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4531         $wrapper <testcpp.c >testcpp.out 2>&1; \
4532         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4533         x_cpp="$wrapper"
4534         x_minus=''
4535         echo "Eureka!"
4536 else
4537         dflt=''
4538         rp="No dice.  I can't find a C preprocessor.  Name one:"
4539         . ./myread
4540         x_cpp="$ans"
4541         x_minus=''
4542         $x_cpp <testcpp.c >testcpp.out 2>&1
4543         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4544                 echo "OK, that will do." >&4
4545         else
4546 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4547                 exit 1
4548         fi
4549 fi
4550
4551 case "$ok" in
4552 false)
4553         cppstdin="$x_cpp"
4554         cppminus="$x_minus"
4555         cpprun="$x_cpp"
4556         cpplast="$x_minus"
4557         set X $x_cpp
4558         shift
4559         case "$1" in
4560         "$cpp")
4561                 echo "Perhaps can we force $cc -E using a wrapper..."
4562                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4563                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4564                 then
4565                         echo "Yup, we can."
4566                         cppstdin="$wrapper"
4567                         cppminus='';
4568                 else
4569                         echo "Nope, we'll have to live without it..."
4570                 fi
4571                 ;;
4572         esac
4573         case "$cpprun" in
4574         "$wrapper")
4575                 cpprun=''
4576                 cpplast=''
4577                 ;;
4578         esac
4579         ;;
4580 esac
4581
4582 case "$cppstdin" in
4583 "$wrapper"|'cppstdin') ;;
4584 *) $rm -f $wrapper;;
4585 esac
4586 $rm -f testcpp.c testcpp.out
4587
4588 : Set private lib path
4589 case "$plibpth" in
4590 '') if ./mips; then
4591                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4592         fi;;
4593 esac
4594 case "$libpth" in
4595 ' ') dlist='';;
4596 '') dlist="$loclibpth $plibpth $glibpth";;
4597 *) dlist="$libpth";;
4598 esac
4599
4600 : Now check and see which directories actually exist, avoiding duplicates
4601 libpth=''
4602 for xxx in $dlist
4603 do
4604     if $test -d $xxx; then
4605                 case " $libpth " in
4606                 *" $xxx "*) ;;
4607                 *) libpth="$libpth $xxx";;
4608                 esac
4609     fi
4610 done
4611 $cat <<'EOM'
4612
4613 Some systems have incompatible or broken versions of libraries.  Among
4614 the directories listed in the question below, please remove any you
4615 know not to be holding relevant libraries, and add any that are needed.
4616 Say "none" for none.
4617
4618 EOM
4619 case "$libpth" in
4620 '') dflt='none';;
4621 *)
4622         set X $libpth
4623         shift
4624         dflt=${1+"$@"}
4625         ;;
4626 esac
4627 rp="Directories to use for library searches?"
4628 . ./myread
4629 case "$ans" in
4630 none) libpth=' ';;
4631 *) libpth="$ans";;
4632 esac
4633
4634 : compute shared library extension
4635 case "$so" in
4636 '')
4637         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4638                 dflt='sl'
4639         else
4640                 dflt='so'
4641         fi
4642         ;;
4643 *) dflt="$so";;
4644 esac
4645 $cat <<EOM
4646
4647 On some systems, shared libraries may be available.  Answer 'none' if
4648 you want to suppress searching of shared libraries for the remainder
4649 of this configuration.
4650
4651 EOM
4652 rp='What is the file extension used for shared libraries?'
4653 . ./myread
4654 so="$ans"
4655
4656 : Define several unixisms.
4657 : Hints files or command line option can be used to override them.
4658 : The convoluted testing is in case hints files set either the old
4659 : or the new name.
4660 case "$_exe" in
4661 '')     case "$exe_ext" in
4662         '')     ;;
4663         *)      _exe="$exe_ext" ;;
4664         esac
4665         ;;
4666 esac
4667 case "$_a" in
4668 '')     case "$lib_ext" in
4669     '') _a='.a';;
4670         *)      _a="$lib_ext" ;;
4671         esac
4672         ;;
4673 esac
4674 case "$_o" in
4675 '') case "$obj_ext" in
4676         '')     _o='.o';;
4677         *)      _o="$obj_ext";;
4678         esac
4679         ;;
4680 esac
4681 case "$p_" in
4682 '') case "$path_sep" in
4683         '')     p_=':';;
4684         *)      p_="$path_sep";;
4685         esac
4686         ;;
4687 esac
4688 exe_ext=$_exe
4689 lib_ext=$_a
4690 obj_ext=$_o
4691 path_sep=$p_
4692
4693 : Which makefile gets called first.  This is used by make depend.
4694 case "$firstmakefile" in
4695 '') firstmakefile='makefile';;
4696 esac
4697
4698 case "$ccflags" in
4699 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4700 esac
4701
4702 case "$uselongdouble" in
4703 $define|true|[yY]*)     dflt='y';;
4704 *) dflt='n';;
4705 esac
4706 cat <<EOM
4707
4708 Perl can be built to take advantage of long doubles which
4709 (if available) may give more accuracy and range for floating point numbers.
4710
4711 If this doesn't make any sense to you, just accept the default '$dflt'.
4712 EOM
4713 rp='Try to use long doubles if available?'
4714 . ./myread
4715 case "$ans" in
4716 y|Y)    val="$define"   ;;
4717 *)      val="$undef"    ;;
4718 esac
4719 set uselongdouble
4720 eval $setvar
4721
4722 case "$uselongdouble" in
4723 true|[yY]*) uselongdouble="$define" ;;
4724 esac
4725
4726 : Look for a hint-file generated 'call-back-unit'.  If the
4727 : user has specified that long doubles should be used,
4728 : we may need to set or change some other defaults.
4729 if $test -f uselongdouble.cbu; then
4730     echo "Your platform has some specific hints regarding long doubles, using them..."
4731     . ./uselongdouble.cbu
4732 else
4733     case "$uselongdouble" in
4734         $define)
4735                 $cat <<EOM
4736 (Your platform does not have any specific hints for long doubles.)
4737 EOM
4738         ;;
4739     esac
4740 fi
4741
4742 : Looking for optional libraries
4743 echo " "
4744 echo "Checking for optional libraries..." >&4
4745 case "$libs" in
4746 ' '|'') dflt='';;
4747 *) dflt="$libs";;
4748 esac
4749 case "$libswanted" in
4750 '') libswanted='c_s';;
4751 esac
4752 case "$usesocks" in
4753 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4754 esac
4755 libsfound=''
4756 libsfiles=''
4757 libsdirs=''
4758 libspath=''
4759 for thisdir in $libpth $xlibpth; do
4760   test -d $thisdir && libspath="$libspath $thisdir"
4761 done
4762 for thislib in $libswanted; do
4763         for thisdir in $libspath; do
4764             xxx=''
4765             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4766                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4767                 $test -f "$xxx" && eval $libscheck
4768                 $test -f "$xxx" && libstyle=shared
4769             fi
4770             if test ! -f "$xxx"; then
4771                 xxx=$thisdir/lib$thislib.$so
4772                 $test -f "$xxx" && eval $libscheck
4773                 $test -f "$xxx" && libstyle=shared
4774             fi  
4775             if test ! -f "$xxx"; then
4776                 xxx=$thisdir/lib$thislib$_a
4777                 $test -f "$xxx" && eval $libscheck
4778                 $test -f "$xxx" && libstyle=static
4779             fi
4780             if test ! -f "$xxx"; then
4781                 xxx=$thisdir/$thislib$_a
4782                 $test -f "$xxx" && eval $libscheck
4783                 $test -f "$xxx" && libstyle=static
4784             fi
4785             if test ! -f "$xxx"; then
4786                 xxx=$thisdir/lib${thislib}_s$_a
4787                 $test -f "$xxx" && eval $libscheck
4788                 $test -f "$xxx" && libstyle=static
4789                 $test -f "$xxx" && thislib=${thislib}_s
4790             fi
4791             if test ! -f "$xxx"; then
4792                 xxx=$thisdir/Slib$thislib$_a
4793                 $test -f "$xxx" && eval $libscheck
4794                 $test -f "$xxx" && libstyle=static
4795             fi
4796             if $test -f "$xxx"; then
4797                 case "$libstyle" in
4798                 shared) echo "Found -l$thislib (shared)." ;;
4799                 static) echo "Found -l$thislib." ;;
4800                 *)      echo "Found -l$thislib ($libstyle)." ;;
4801                 esac
4802                 case " $dflt " in
4803                 *"-l$thislib "*);;
4804                 *) dflt="$dflt -l$thislib"
4805                    libsfound="$libsfound $xxx"
4806                    yyy=`basename $xxx`
4807                    libsfiles="$libsfiles $yyy"
4808                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4809                    case " $libsdirs " in
4810                    *" $yyy "*) ;;
4811                    *) libsdirs="$libsdirs $yyy" ;;
4812                    esac
4813                    ;;
4814                 esac
4815                 break
4816             fi  
4817         done
4818         if $test ! -f "$xxx"; then
4819             echo "No -l$thislib."
4820         fi
4821 done
4822 set X $dflt
4823 shift
4824 dflt="$*"
4825 case "$libs" in
4826 '') dflt="$dflt";;
4827 *) dflt="$libs";;
4828 esac
4829 case "$dflt" in
4830 ' '|'') dflt='none';;
4831 esac
4832
4833 $cat <<EOM
4834
4835 In order to compile $package on your machine, a number of libraries
4836 are usually needed.  Include any other special libraries here as well.
4837 Say "none" for none.  The default list is almost always right.
4838 EOM
4839
4840 echo " "
4841 rp="What libraries to use?"
4842 . ./myread
4843 case "$ans" in
4844 none) libs=' ';;
4845 *) libs="$ans";;
4846 esac
4847
4848 : determine optimization, if desired, or use for debug flag also
4849 case "$optimize" in
4850 ' '|$undef) dflt='none';;
4851 '') dflt='-O';;
4852 *) dflt="$optimize";;
4853 esac
4854 $cat <<EOH
4855
4856 By default, $package compiles with the -O flag to use the optimizer.
4857 Alternately, you might want to use the symbolic debugger, which uses
4858 the -g flag (on traditional Unix systems).  Either flag can be
4859 specified here.  To use neither flag, specify the word "none".
4860
4861 EOH
4862 rp="What optimizer/debugger flag should be used?"
4863 . ./myread
4864 optimize="$ans"
4865 case "$optimize" in
4866 'none') optimize=" ";;
4867 esac
4868
4869 : Check what DEBUGGING is required from the command line
4870 : -DEBUGGING      or -DDEBUGGING or
4871 : -DEBUGGING=both                       = -g + -DDEBUGGING
4872 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4873 : -DEBUGGING=none or -UDEBUGGING        =
4874 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4875 case "$EBUGGING" in
4876 '')     ;;
4877 *)      DEBUGGING=$EBUGGING ;;
4878 esac
4879
4880 case "$DEBUGGING" in
4881 -g|$define)
4882     case "$optimize" in
4883         *-g*) ;;
4884         *)    optimize="$optimize -g" ;;
4885     esac ;;
4886 none|$undef)
4887     case "$optimize" in
4888         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4889                 shift
4890                 optimize="$*"
4891                 ;;
4892     esac ;;
4893 esac
4894
4895 dflt=''
4896 case "$DEBUGGING" in
4897 both|$define) dflt='-DDEBUGGING'
4898 esac
4899
4900 : We will not override a previous value, but we might want to
4901 : augment a hint file
4902 case "$hint" in
4903 default|recommended)
4904         case "$gccversion" in
4905         1*) dflt="$dflt -fpcc-struct-return" ;;
4906         esac
4907         case "$optimize:$DEBUGGING" in
4908         *-g*:old) dflt="$dflt -DDEBUGGING";;
4909         esac
4910         case "$gccversion" in
4911         2*) if test -d /etc/conf/kconfig.d &&
4912                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4913                 then
4914                         # Interactive Systems (ISC) POSIX mode.
4915                         dflt="$dflt -posix"
4916                 fi
4917                 ;;
4918         esac
4919         case "$gccversion" in
4920         1*) ;;
4921         2.[0-8]*) ;;
4922         ?*)     echo " "
4923                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4924                 echo 'int main(void) { return 0; }' > gcctest.c
4925                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4926                         echo "Yes, it does." 2>&1
4927                         case "$ccflags" in
4928                         *strict-aliasing*)
4929                                 echo "Leaving current flags $ccflags alone." 2>&1
4930                                 ;;
4931                         *) dflt="$dflt -fno-strict-aliasing" ;;
4932                         esac
4933                 else
4934                         echo "Nope, it doesn't, but that's ok." 2>&1
4935                 fi
4936                 ;;
4937         esac
4938         # For gcc, adding -pipe speeds up compilations for some, but apparently
4939         # some assemblers can't read from stdin.  (It also slows down compilations
4940         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4941         case "$gccversion" in
4942         ?*)     echo " "
4943                 echo "Checking if your compiler accepts -pipe" 2>&1
4944                 echo 'int main(void) { return 0; }' > gcctest.c
4945                 if $cc -pipe -o gcctest gcctest.c; then
4946                         echo "Yes, it does." 2>&1
4947                         case "$ccflags" in
4948                         *-pipe*)
4949                                 echo "Leaving current flags $ccflags alone." 2>&1
4950                                 ;;
4951                         *) dflt="$dflt -pipe" ;;
4952                         esac
4953                 else
4954                         echo "Nope, it doesn't, but that's ok." 2>&1
4955                 fi
4956
4957                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4958                 echo 'int main(void) { return 0; }' > gcctest.c
4959                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4960                         echo "Yes, it does." 2>&1
4961                         case "$ccflags" in
4962                         *-Wdeclaration-after-statement*)
4963                                 echo "Leaving current flags $ccflags alone." 2>&1
4964                                 ;;
4965                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4966                         esac
4967                 else
4968                         echo "Nope, it doesn't, but that's ok." 2>&1
4969                 fi
4970                 ;;
4971         esac
4972         ;;
4973 esac
4974
4975 case "$mips_type" in
4976 *BSD*|'') inclwanted="$locincpth $usrinc";;
4977 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4978 esac
4979 for thisincl in $inclwanted; do
4980         if $test -d $thisincl; then
4981                 if $test x$thisincl != x$usrinc; then
4982                         case "$dflt" in
4983                         *" -I$thisincl "*);;
4984                         *) dflt="$dflt -I$thisincl ";;
4985                         esac
4986                 fi
4987         fi
4988 done
4989
4990 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4991         xxx=true;
4992 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4993         xxx=true;
4994 else
4995         xxx=false;
4996 fi;
4997 if $xxx; then
4998         case "$dflt" in
4999         *$2*);;
5000         *) dflt="$dflt -D$2";;
5001         esac;
5002 fi'
5003
5004 set signal.h LANGUAGE_C; eval $inctest
5005
5006 case "$usesocks" in
5007 $define)
5008         ccflags="$ccflags -DSOCKS"
5009         ;;
5010 esac
5011
5012 case "$hint" in
5013 default|recommended) dflt="$ccflags $dflt" ;;
5014 *) dflt="$ccflags";;
5015 esac
5016
5017 case "$dflt" in
5018 ''|' ') dflt=none;;
5019 esac
5020
5021 $cat <<EOH
5022
5023 Your C compiler may want other flags.  For this question you should include
5024 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5025 but you should NOT include libraries or ld flags like -lwhatever.  If you
5026 want $package to honor its debug switch, you should include -DDEBUGGING here.
5027 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5028
5029 To use no flags, specify the word "none".
5030
5031 EOH
5032 set X $dflt
5033 shift
5034 dflt=${1+"$@"}
5035 rp="Any additional cc flags?"
5036 . ./myread
5037 case "$ans" in
5038 none) ccflags='';;
5039 *) ccflags="$ans";;
5040 esac
5041
5042 : the following weeds options from ccflags that are of no interest to cpp
5043 case "$cppflags" in
5044 '') cppflags="$ccflags" ;;
5045 *)  cppflags="$cppflags $ccflags" ;;
5046 esac
5047 case "$gccversion" in
5048 1*) cppflags="$cppflags -D__GNUC__"
5049 esac
5050 case "$mips_type" in
5051 '');;
5052 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5053 esac
5054 case "$cppflags" in
5055 '');;
5056 *)
5057         echo " "
5058         echo "Let me guess what the preprocessor flags are..." >&4
5059         set X $cppflags
5060         shift
5061         cppflags=''
5062         $cat >cpp.c <<'EOM'
5063 #define BLURFL foo
5064
5065 BLURFL xx LFRULB
5066 EOM
5067         previous=''
5068         for flag in $*
5069         do
5070                 case "$flag" in
5071                 -*) ftry="$flag";;
5072                 *) ftry="$previous $flag";;
5073                 esac
5074                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5075                         >cpp1.out 2>/dev/null && \
5076                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5077                         >cpp2.out 2>/dev/null && \
5078                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5079                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5080                 then
5081                         cppflags="$cppflags $ftry"
5082                         previous=''
5083                 else
5084                         previous="$flag"
5085                 fi
5086         done
5087         set X $cppflags
5088         shift
5089         cppflags=${1+"$@"}
5090         case "$cppflags" in
5091         *-*)  echo "They appear to be: $cppflags";;
5092         esac
5093         $rm -f cpp.c cpp?.out
5094         ;;
5095 esac
5096
5097 : flags used in final linking phase
5098 case "$ldflags" in
5099 '') if ./venix; then
5100                 dflt='-i -z'
5101         else
5102                 dflt=''
5103         fi
5104         case "$ccflags" in
5105         *-posix*) dflt="$dflt -posix" ;;
5106         esac
5107         ;;
5108 *) dflt="$ldflags";;
5109 esac
5110
5111 : Try to guess additional flags to pick up local libraries.
5112 for thislibdir in $libpth; do
5113         case " $loclibpth " in
5114         *" $thislibdir "*)
5115                 case "$dflt " in
5116                 *"-L$thislibdir "*) ;;
5117                 *)  dflt="$dflt -L$thislibdir" ;;
5118                 esac
5119                 ;;
5120         esac
5121 done
5122
5123 case "$dflt" in
5124 '') dflt='none' ;;
5125 esac
5126
5127 $cat <<EOH
5128
5129 Your C linker may need flags.  For this question you should
5130 include -L/whatever and any other flags used by the C linker, but you
5131 should NOT include libraries like -lwhatever.
5132
5133 Make sure you include the appropriate -L/path flags if your C linker
5134 does not normally search all of the directories you specified above,
5135 namely
5136         $libpth
5137 To use no flags, specify the word "none".
5138
5139 EOH
5140
5141 rp="Any additional ld flags (NOT including libraries)?"
5142 . ./myread
5143 case "$ans" in
5144 none) ldflags='';;
5145 *) ldflags="$ans";;
5146 esac
5147 rmlist="$rmlist pdp11"
5148
5149 : coherency check
5150 echo " "
5151 echo "Checking your choice of C compiler and flags for coherency..." >&4
5152 $cat > try.c <<'EOF'
5153 #include <stdio.h>
5154 int main() { printf("Ok\n"); return(0); }
5155 EOF
5156 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5157 shift
5158 $cat >try.msg <<'EOM'
5159 I've tried to compile and run the following simple program:
5160
5161 EOM
5162 $cat try.c >> try.msg
5163
5164 $cat >> try.msg <<EOM
5165
5166 I used the command:
5167
5168         $*
5169         $run ./try
5170
5171 and I got the following output:
5172
5173 EOM
5174 dflt=y
5175 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5176         if $sh -c "$run ./try" >>try.msg 2>&1; then
5177                 xxx=`$run ./try`
5178                 case "$xxx" in
5179                 "Ok") dflt=n ;;
5180                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5181                         case " $libs " in
5182                         *" -lsfio "*)
5183                                 cat >> try.msg <<'EOQS'
5184 If $libs contains -lsfio, and sfio is mis-configured, then it
5185 sometimes (apparently) runs and exits with a 0 status, but with no
5186 output!  It may have to do with sfio's use of _exit vs. exit.
5187
5188 EOQS
5189                                 rp="You have a big problem.  Shall I abort Configure"
5190                                 dflt=y
5191                                 ;;
5192                         esac
5193                         ;;
5194                 esac
5195         else
5196                 echo "The program compiled OK, but exited with status $?." >>try.msg
5197                 rp="You have a problem.  Shall I abort Configure"
5198                 dflt=y
5199         fi
5200 else
5201         echo "I can't compile the test program." >>try.msg
5202         rp="You have a BIG problem.  Shall I abort Configure"
5203         dflt=y
5204 fi
5205 case "$dflt" in
5206 y)
5207         $cat try.msg >&4
5208         case "$knowitall" in
5209         '')
5210                 echo "(The supplied flags or libraries might be incorrect.)"
5211                 ;;
5212         *) dflt=n;;
5213         esac
5214         echo " "
5215         . ./myread
5216         case "$ans" in
5217         n*|N*) ;;
5218         *)      echo "Ok.  Stopping Configure." >&4
5219                 exit 1
5220                 ;;
5221         esac
5222         ;;
5223 n) echo "OK, that should do.";;
5224 esac
5225 $rm -f try try.* core
5226
5227 : define a shorthand compile call
5228 compile='
5229 mc_file=$1;
5230 shift;
5231 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5232 : define a shorthand compile call for compilations that should be ok.
5233 compile_ok='
5234 mc_file=$1;
5235 shift;
5236 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5237
5238 : determine filename position in cpp output
5239 echo " "
5240 echo "Computing filename position in cpp output for #include directives..." >&4
5241 case "$osname" in
5242 vos) testaccess=-e ;;
5243 *)   testaccess=-r ;;
5244 esac
5245 echo '#include <stdio.h>' > foo.c
5246 $cat >fieldn <<EOF
5247 $startsh
5248 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5249 $grep '^[       ]*#.*stdio\.h' | \
5250 while read cline; do
5251         pos=1
5252         set \$cline
5253         while $test \$# -gt 0; do
5254                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5255                         echo "\$pos"
5256                         exit 0
5257                 fi
5258                 shift
5259                 pos=\`expr \$pos + 1\`
5260         done
5261 done
5262 EOF
5263 chmod +x fieldn
5264 fieldn=`./fieldn`
5265 $rm -f foo.c fieldn
5266 case $fieldn in
5267 '') pos='???';;
5268 1) pos=first;;
5269 2) pos=second;;
5270 3) pos=third;;
5271 *) pos="${fieldn}th";;
5272 esac
5273 echo "Your cpp writes the filename in the $pos field of the line."
5274
5275 case "$osname" in
5276 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5277 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5278 *)   cppfilter='' ;;
5279 esac
5280 : locate header file
5281 $cat >findhdr <<EOF
5282 $startsh
5283 wanted=\$1
5284 name=''
5285 for usrincdir in $usrinc
5286 do
5287         if test -f \$usrincdir/\$wanted; then
5288                 echo "\$usrincdir/\$wanted"
5289                 exit 0
5290         fi
5291 done
5292 awkprg='{ print \$$fieldn }'
5293 echo "#include <\$wanted>" > foo\$\$.c
5294 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5295 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5296 while read cline; do
5297         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5298         case "\$name" in
5299         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5300         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5301         *) exit 2;;
5302         esac;
5303 done;
5304 #
5305 # status = 0: grep returned 0 lines, case statement not executed
5306 # status = 1: headerfile found
5307 # status = 2: while loop executed, no headerfile found
5308 #
5309 status=\$?
5310 $rm -f foo\$\$.c;
5311 if test \$status -eq 1; then
5312         exit 0;
5313 fi
5314 exit 1
5315 EOF
5316 chmod +x findhdr
5317
5318 : define an alternate in-header-list? function
5319 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5320 cont=true; xxf="echo \"<\$1> found.\" >&4";
5321 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5322 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5323 esac;
5324 case $# in 4) instead=instead;; *) instead="at last";; esac;
5325 while $test "$cont"; do
5326         xxx=`./findhdr $1`
5327         var=$2; eval "was=\$$2";
5328         if $test "$xxx" && $test -r "$xxx";
5329         then eval $xxf;
5330         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5331                 cont="";
5332         else eval $xxnf;
5333         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5334         set $yyy; shift; shift; yyy=$@;
5335         case $# in 0) cont="";;
5336         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5337                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5338         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5339                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5340         esac;
5341 done;
5342 while $test "$yyy";
5343 do set $yyy; var=$2; eval "was=\$$2";
5344         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5345         set $yyy; shift; shift; yyy=$@;
5346 done'
5347
5348 : see if stdlib is available
5349 set stdlib.h i_stdlib
5350 eval $inhdr
5351
5352 : check for lengths of integral types
5353 echo " "
5354 case "$intsize" in
5355 '')
5356         echo "Checking to see how big your integers are..." >&4
5357         $cat >try.c <<EOCP
5358 #include <stdio.h>
5359 #$i_stdlib I_STDLIB
5360 #ifdef I_STDLIB
5361 #include <stdlib.h>
5362 #endif
5363 int main()
5364 {
5365         printf("intsize=%d;\n", (int)sizeof(int));
5366         printf("longsize=%d;\n", (int)sizeof(long));
5367         printf("shortsize=%d;\n", (int)sizeof(short));
5368         exit(0);
5369 }
5370 EOCP
5371         set try
5372         if eval $compile_ok && $run ./try > /dev/null; then
5373                 eval `$run ./try`
5374                 echo "Your integers are $intsize bytes long."
5375                 echo "Your long integers are $longsize bytes long."
5376                 echo "Your short integers are $shortsize bytes long."
5377         else
5378                 $cat >&4 <<EOM
5379 !
5380 Help! I can't compile and run the intsize test program: please enlighten me!
5381 (This is probably a misconfiguration in your system or libraries, and
5382 you really ought to fix it.  Still, I'll try anyway.)
5383 !
5384 EOM
5385                 dflt=4
5386                 rp="What is the size of an integer (in bytes)?"
5387                 . ./myread
5388                 intsize="$ans"
5389                 dflt=$intsize
5390                 rp="What is the size of a long integer (in bytes)?"
5391                 . ./myread
5392                 longsize="$ans"
5393                 dflt=2
5394                 rp="What is the size of a short integer (in bytes)?"
5395                 . ./myread
5396                 shortsize="$ans"
5397         fi
5398         ;;
5399 esac
5400 $rm -f try try.*
5401
5402 : check for long long
5403 echo " "
5404 echo "Checking to see if you have long long..." >&4
5405 echo 'int main() { long long x = 7; return 0; }' > try.c
5406 set try
5407 if eval $compile; then
5408         val="$define"
5409         echo "You have long long."
5410 else
5411         val="$undef"
5412         echo "You do not have long long."
5413 fi
5414 $rm try.*
5415 set d_longlong
5416 eval $setvar
5417
5418 : check for length of long long
5419 case "${d_longlong}${longlongsize}" in
5420 $define)
5421         echo " "
5422         echo "Checking to see how big your long longs are..." >&4
5423         $cat >try.c <<'EOCP'
5424 #include <stdio.h>
5425 int main()
5426 {
5427     printf("%d\n", (int)sizeof(long long));
5428     return(0);
5429 }
5430 EOCP
5431         set try
5432         if eval $compile_ok; then
5433                 longlongsize=`$run ./try`
5434                 echo "Your long longs are $longlongsize bytes long."
5435         else
5436                 dflt='8'
5437                 echo " "
5438                 echo "(I can't seem to compile the test program.  Guessing...)"
5439                 rp="What is the size of a long long (in bytes)?"
5440                 . ./myread
5441                 longlongsize="$ans"
5442         fi
5443         if $test "X$longsize" = "X$longlongsize"; then
5444                 echo "(That isn't any different from an ordinary long.)"
5445         fi      
5446         ;;
5447 esac
5448 $rm -f try.* try
5449
5450 : see if inttypes.h is available
5451 : we want a real compile instead of Inhdr because some systems
5452 : have an inttypes.h which includes non-existent headers
5453 echo " "
5454 $cat >try.c <<EOCP
5455 #include <inttypes.h>
5456 int main() {
5457         static int32_t foo32 = 0x12345678;
5458 }
5459 EOCP
5460 set try
5461 if eval $compile; then
5462         echo "<inttypes.h> found." >&4
5463         val="$define"
5464 else
5465         echo "<inttypes.h> NOT found." >&4
5466         val="$undef"
5467 fi
5468 $rm -f try.c try
5469 set i_inttypes
5470 eval $setvar
5471
5472 : check for int64_t
5473 echo " "
5474 echo "Checking to see if you have int64_t..." >&4
5475 $cat >try.c <<EOCP
5476 #include <sys/types.h>
5477 #$i_inttypes I_INTTYPES
5478 #ifdef I_INTTYPES
5479 #include <inttypes.h>
5480 #endif
5481 int main() { int64_t x = 7; }
5482 EOCP
5483 set try
5484 if eval $compile; then
5485         val="$define"
5486         echo "You have int64_t."
5487 else
5488         val="$undef"
5489         echo "You do not have int64_t."
5490 fi
5491 $rm -f try try.*
5492 set d_int64_t
5493 eval $setvar
5494
5495
5496 echo " "
5497 echo "Checking which 64-bit integer type we could use..." >&4
5498
5499 case "$intsize" in
5500 8) val=int
5501    set quadtype
5502    eval $setvar
5503    val='"unsigned int"'
5504    set uquadtype
5505    eval $setvar
5506    quadkind=1
5507    ;;
5508 *) case "$longsize" in
5509    8) val=long
5510       set quadtype
5511       eval $setvar
5512       val='"unsigned long"'
5513       set uquadtype
5514       eval $setvar
5515       quadkind=2
5516       ;;
5517    *) case "$d_longlong:$longlongsize" in
5518       define:8)
5519         val='"long long"'
5520         set quadtype
5521         eval $setvar
5522         val='"unsigned long long"'
5523         set uquadtype
5524         eval $setvar
5525         quadkind=3
5526         ;;
5527       *) case "$d_int64_t" in
5528          define)
5529            val=int64_t
5530            set quadtype
5531            eval $setvar
5532            val=uint64_t
5533            set uquadtype
5534            eval $setvar
5535            quadkind=4
5536            ;;
5537          esac
5538          ;;
5539       esac
5540       ;;
5541    esac
5542    ;;
5543 esac
5544
5545 case "$quadtype" in
5546 '')     echo "Alas, no 64-bit integer types in sight." >&4
5547         d_quad="$undef"
5548         ;;
5549 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5550         d_quad="$define"
5551         ;;
5552 esac
5553
5554
5555 case "$uselonglong" in
5556 "$define"|true|[yY]*)
5557         cat <<EOM >&4
5558
5559 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5560 EOM
5561         use64bitint="$define"
5562         ;;
5563 esac                          
5564 case "$use64bits" in
5565 "$define"|true|[yY]*)
5566         cat <<EOM >&4
5567
5568 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5569 EOM
5570         use64bitint="$define"
5571         ;;
5572 esac                          
5573 case "$use64bitints" in
5574 "$define"|true|[yY]*)
5575         cat <<EOM >&4
5576
5577 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5578 EOM
5579         use64bitint="$define"
5580         ;;
5581 esac                          
5582 case "$use64bitsint" in
5583 "$define"|true|[yY]*)
5584         cat <<EOM >&4
5585
5586 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5587 EOM
5588         use64bitint="$define"
5589         ;;
5590 esac                          
5591 case "$uselonglongs" in
5592 "$define"|true|[yY]*)
5593         cat <<EOM >&4
5594
5595 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5596 EOM
5597         use64bitint="$define"
5598         ;;
5599 esac                          
5600 case "$use64bitsall" in
5601 "$define"|true|[yY]*)
5602         cat <<EOM >&4
5603
5604 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5605 EOM
5606         use64bitall="$define"
5607         ;;
5608 esac                          
5609
5610 case "$ccflags" in
5611 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5612 esac
5613 case "$use64bitall" in
5614 "$define"|true|[yY]*) use64bitint="$define" ;;
5615 esac
5616
5617 case "$longsize" in
5618 8) cat <<EOM
5619
5620 You have natively 64-bit long integers.
5621 EOM
5622    val="$define"
5623    ;;
5624 *) case "$use64bitint" in
5625    "$define"|true|[yY]*) dflt='y';;
5626    *) dflt='n';;
5627    esac
5628    case "$d_quad" in
5629    "$define") ;;
5630    *) dflt='n' ;;
5631    esac
5632    cat <<EOM
5633
5634 Perl can be built to take advantage of 64-bit integer types
5635 on some systems.  To do so, Configure can be run with -Duse64bitint.
5636 Choosing this option will most probably introduce binary incompatibilities.
5637
5638 If this doesn't make any sense to you, just accept the default '$dflt'.
5639 (The default has been chosen based on your configuration.)
5640 EOM
5641    rp='Try to use 64-bit integers, if available?'
5642    . ./myread
5643    case "$ans" in
5644    [yY]*) val="$define" ;;
5645    *)     val="$undef"  ;;
5646    esac
5647    ;;
5648 esac
5649 set use64bitint
5650 eval $setvar
5651
5652 case "$use64bitall" in
5653 "$define"|true|[yY]*) dflt='y' ;;
5654 *) case "$longsize" in
5655    8) dflt='y' ;;
5656    *) dflt='n' ;;
5657    esac
5658    ;;
5659 esac    
5660 cat <<EOM
5661
5662 You may also choose to try maximal 64-bitness.  It means using as much
5663 64-bitness as possible on the platform.  This in turn means even more
5664 binary incompatibilities.  On the other hand, your platform may not
5665 have any more 64-bitness available than what you already have chosen.
5666
5667 If this doesn't make any sense to you, just accept the default '$dflt'.
5668 (The default has been chosen based on your configuration.)
5669 EOM
5670 rp='Try to use maximal 64-bit support, if available?'
5671 . ./myread
5672 case "$ans" in
5673 [yY]*) val="$define" ;;
5674 *)     val="$undef"  ;;
5675 esac
5676 set use64bitall
5677 eval $setvar
5678 case "$use64bitall" in
5679 "$define")
5680         case "$use64bitint" in
5681         "$undef")
5682                 cat <<EOM
5683
5684 Since you have chosen a maximally 64-bit build, I'm also turning on
5685 the use of 64-bit integers.
5686 EOM
5687                 use64bitint="$define" ;;
5688         esac
5689         ;;
5690 esac
5691
5692 : Look for a hint-file generated 'call-back-unit'.  If the
5693 : user has specified that a 64-bit perl is to be built,
5694 : we may need to set or change some other defaults.
5695 if $test -f use64bitint.cbu; then
5696         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5697         . ./use64bitint.cbu
5698 fi
5699 case "$use64bitint" in
5700 "$define"|true|[yY]*)
5701         case "$longsize" in
5702         4) case "$archname64" in
5703            '') archname64=64int ;;
5704            esac
5705            ;;
5706         esac
5707         ;;
5708 esac
5709
5710 : Look for a hint-file generated 'call-back-unit'.  If the
5711 : user has specified that a maximally 64-bit perl is to be built,
5712 : we may need to set or change some other defaults.
5713 if $test -f use64bitall.cbu; then
5714         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5715         . ./use64bitall.cbu
5716 fi
5717 case "$use64bitall" in
5718 "$define"|true|[yY]*)
5719         case "$longsize" in
5720         4) case "$archname64" in
5721            ''|64int) archname64=64all ;;
5722            esac
5723            ;;
5724         esac
5725         ;;
5726 esac
5727
5728 case "$d_quad:$use64bitint" in
5729 $undef:$define)
5730         cat >&4 <<EOF
5731
5732 *** You have chosen to use 64-bit integers,
5733 *** but none can be found.
5734 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5735 *** Cannot continue, aborting.
5736
5737 EOF
5738         exit 1
5739         ;;
5740 esac
5741
5742 : check for length of double
5743 echo " "
5744 case "$doublesize" in
5745 '')
5746         echo "Checking to see how big your double precision numbers are..." >&4
5747         $cat >try.c <<EOCP
5748 #include <stdio.h>
5749 #$i_stdlib I_STDLIB
5750 #ifdef I_STDLIB
5751 #include <stdlib.h>
5752 #endif
5753 int main()
5754 {
5755     printf("%d\n", (int)sizeof(double));
5756     exit(0);
5757 }
5758 EOCP
5759         set try
5760         if eval $compile_ok; then
5761                 doublesize=`$run ./try`
5762                 echo "Your double is $doublesize bytes long."
5763         else
5764                 dflt='8'
5765                 echo "(I can't seem to compile the test program.  Guessing...)"
5766                 rp="What is the size of a double precision number (in bytes)?"
5767                 . ./myread
5768                 doublesize="$ans"
5769         fi
5770         ;;
5771 esac
5772 $rm -f try.c try
5773
5774 : check for long doubles
5775 echo " "
5776 echo "Checking to see if you have long double..." >&4
5777 echo 'int main() { long double x = 7.0; }' > try.c
5778 set try
5779 if eval $compile; then
5780         val="$define"
5781         echo "You have long double."
5782 else
5783         val="$undef"
5784         echo "You do not have long double."
5785 fi
5786 $rm try.*
5787 set d_longdbl
5788 eval $setvar
5789
5790 : check for length of long double
5791 case "${d_longdbl}${longdblsize}" in
5792 $define)
5793         echo " "
5794         echo "Checking to see how big your long doubles are..." >&4
5795         $cat >try.c <<'EOCP'
5796 #include <stdio.h>
5797 int main()
5798 {
5799         printf("%d\n", sizeof(long double));
5800 }
5801 EOCP
5802         set try
5803         set try
5804         if eval $compile; then
5805                 longdblsize=`$run ./try`
5806                 echo "Your long doubles are $longdblsize bytes long."
5807         else
5808                 dflt='8'
5809                 echo " "
5810                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5811                 rp="What is the size of a long double (in bytes)?"
5812                 . ./myread
5813                 longdblsize="$ans"
5814         fi
5815         if $test "X$doublesize" = "X$longdblsize"; then
5816                 echo "That isn't any different from an ordinary double."
5817                 echo "I'll keep your setting anyway, but you may see some"
5818                 echo "harmless compilation warnings."
5819         fi      
5820         ;;
5821 esac
5822 $rm -f try.* try
5823
5824 : determine the architecture name
5825 echo " "
5826 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5827         tarch=`arch`"-$osname"
5828 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5829         if uname -m > tmparch 2>&1 ; then
5830                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5831                         -e 's/$/'"-$osname/" tmparch`
5832         else
5833                 tarch="$osname"
5834         fi
5835         $rm -f tmparch
5836 else
5837         tarch="$osname"
5838 fi
5839 case "$myarchname" in
5840 ''|"$tarch") ;;
5841 *)
5842         echo "(Your architecture name used to be $myarchname.)"
5843         archname=''
5844         ;;
5845 esac
5846 case "$targetarch" in
5847 '') ;;
5848 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5849 esac
5850 myarchname="$tarch"
5851 case "$archname" in
5852 '') dflt="$tarch";;
5853 *) dflt="$archname";;
5854 esac
5855 rp='What is your architecture name'
5856 . ./myread
5857 archname="$ans"
5858 case "$usethreads" in
5859 $define)
5860         echo "Threads selected." >&4
5861         case "$archname" in
5862         *-thread*) echo "...and architecture name already has -thread." >&4
5863                 ;;
5864         *)      archname="$archname-thread"
5865                 echo "...setting architecture name to $archname." >&4
5866                 ;;
5867         esac
5868         ;;
5869 esac
5870 case "$usemultiplicity" in
5871 $define)
5872         echo "Multiplicity selected." >&4
5873         case "$archname" in
5874         *-multi*) echo "...and architecture name already has -multi." >&4
5875                 ;;
5876         *)      archname="$archname-multi"
5877                 echo "...setting architecture name to $archname." >&4
5878                 ;;
5879         esac
5880         ;;
5881 esac
5882 case "$use64bitint$use64bitall" in
5883 *"$define"*)
5884         case "$archname64" in
5885         '')
5886                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5887                 ;;
5888         *)
5889                 case "$use64bitint" in
5890                 "$define") echo "64 bit integers selected." >&4 ;;
5891                 esac
5892                 case "$use64bitall" in
5893                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5894                 esac
5895                 case "$archname" in
5896                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5897                         ;;
5898                 *)      archname="$archname-$archname64"
5899                         echo "...setting architecture name to $archname." >&4
5900                         ;;
5901                 esac
5902                 ;;
5903         esac
5904 esac
5905 case "$uselongdouble" in
5906 $define)
5907         echo "Long doubles selected." >&4
5908         case "$longdblsize" in
5909         $doublesize)
5910                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5911                 ;;
5912         *)
5913                 case "$archname" in
5914                 *-ld*) echo "...and architecture name already has -ld." >&4
5915                         ;;
5916                 *)      archname="$archname-ld"
5917                         echo "...setting architecture name to $archname." >&4
5918                         ;;
5919                 esac
5920                 ;;
5921         esac
5922         ;;
5923 esac
5924 case "$useperlio" in
5925 $define)
5926         echo "Perlio selected." >&4
5927         ;;
5928 *)
5929         echo "Perlio not selected, using stdio." >&4
5930         case "$archname" in
5931         *-stdio*) echo "...and architecture name already has -stdio." >&4
5932                 ;;
5933         *)      archname="$archname-stdio"
5934                 echo "...setting architecture name to $archname." >&4
5935                 ;;
5936         esac
5937         ;;
5938 esac
5939 if $test -f archname.cbu; then
5940         echo "Your platform has some specific hints for architecture name, using them..."
5941         . ./archname.cbu
5942 fi
5943
5944 : set the prefixit variable, to compute a suitable default value
5945 prefixit='case "$3" in
5946 ""|none)
5947         case "$oldprefix" in
5948         "") eval "$1=\"\$$2\"";;
5949         *)
5950                 case "$3" in
5951                 "") eval "$1=";;
5952                 none)
5953                         eval "tp=\"\$$2\"";
5954                         case "$tp" in
5955                         ""|" ") eval "$1=\"\$$2\"";;
5956                         *) eval "$1=";;
5957                         esac;;
5958                 esac;;
5959         esac;;
5960 *)
5961         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5962         case "$tp" in
5963         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5964         /*-$oldprefix/*|\~*-$oldprefix/*)
5965                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5966         *) eval "$1=\"\$$2\"";;
5967         esac;;
5968 esac'
5969
5970 : get the patchlevel
5971 echo " "
5972 echo "Getting the current patchlevel..." >&4
5973 if $test -r $rsrc/patchlevel.h;then
5974         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5975         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5976         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5977         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5978         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5979         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5980        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5981 else
5982         revision=0
5983         patchlevel=0
5984         subversion=0
5985         api_revision=0
5986         api_version=0
5987         api_subversion=0
5988         perl_patchlevel=0
5989         $echo "(You do not have patchlevel.h.  Eek.)"
5990 fi
5991 if $test -r $rsrc/.patch ; then  
5992         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5993                 perl_patchlevel=`cat $rsrc/.patch`
5994         fi
5995 fi
5996 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5997 version_patchlevel_string="version $patchlevel subversion $subversion"
5998 case "$perl_patchlevel" in
5999 0|'') ;;
6000 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6001 esac
6002
6003 $echo "(You have $package $version_patchlevel_string.)"
6004
6005 case "$osname" in
6006 dos|vms)
6007         : XXX Should be a Configure test for double-dots in filenames.
6008         version=`echo $revision $patchlevel $subversion | \
6009                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6010         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6011                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6012         ;;
6013 *)
6014         version=`echo $revision $patchlevel $subversion | \
6015                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6016         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6017                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6018         ;;
6019 esac
6020 : Special case the 5.005_xx maintenance series, which used 5.005
6021 : without any subversion label as a subdirectory in $sitelib
6022 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6023         api_versionstring='5.005'
6024 fi
6025
6026 : determine installation style
6027 : For now, try to deduce it from prefix unless it is already set.
6028 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6029 case "$installstyle" in
6030 '')     case "$prefix" in
6031                 *perl*) dflt='lib';;
6032                 *) dflt='lib/perl5' ;;
6033         esac
6034         ;;
6035 *)      dflt="$installstyle" ;;
6036 esac
6037 : Probably not worth prompting for this since we prompt for all
6038 : the directories individually, and the prompt would be too long and
6039 : confusing anyway.
6040 installstyle=$dflt
6041
6042 : determine where public executables go
6043 echo " "
6044 set dflt bin bin
6045 eval $prefixit
6046 fn=d~
6047 rp='Pathname where the public executables will reside?'
6048 . ./getfile
6049 if $test "X$ansexp" != "X$binexp"; then
6050         installbin=''
6051 fi
6052 prefixvar=bin
6053 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6054 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6055 :     this via initialinstalllocation
6056 . ./setprefixvar
6057
6058 case "$userelocatableinc" in
6059 $define|true|[yY]*)     dflt='y' ;;
6060 *)                      dflt='n' ;;
6061 esac
6062 cat <<EOM
6063
6064 Would you like to build Perl so that the installation is relocatable, so that
6065 library paths in @INC are determined relative to the path of the perl binary?
6066 This is not advised for system Perl installs, or if you need to run setid
6067 scripts or scripts under taint mode.
6068
6069 If this doesn't make any sense to you, just accept the default '$dflt'.
6070 EOM
6071 rp='Use relocatable @INC?'
6072 . ./myread
6073 case "$ans" in
6074 y|Y)    val="$define" ;;
6075 *)      val="$undef"  ;;
6076 esac
6077 set userelocatableinc
6078 eval $setvar
6079
6080 initialinstalllocation="$binexp"
6081 : Default prefix is now "up one level from where the binaries are"
6082 case "$userelocatableinc" in
6083 $define|true|[yY]*)
6084     bin=".../"
6085     binexp=".../"
6086     prefix=".../.."
6087     prefixexp=".../.."
6088     installprefixexp=".../.."
6089     ;;
6090 esac
6091
6092 : determine where private library files go
6093 : Usual default is /usr/local/lib/perl5/$version.
6094 : Also allow things like /opt/perl/lib/$version, since
6095 : /opt/perl/lib/perl5... would be redundant.
6096 : The default "style" setting is made in installstyle.U
6097 case "$installstyle" in
6098 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6099 *)       set dflt privlib lib/$version ;;
6100 esac
6101 eval $prefixit
6102 $cat <<EOM
6103
6104 There are some auxiliary files for $package that need to be put into a
6105 private library directory that is accessible by everyone.
6106
6107 EOM
6108 fn=$binexp
6109 fn=d~+
6110 rp='Pathname where the private library files will reside?'
6111 . ./getfile
6112 prefixvar=privlib
6113 . ./setprefixvar
6114
6115 : set the prefixup variable, to restore leading tilda escape
6116 prefixup='case "$prefixexp" in
6117 "$prefix") ;;
6118 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6119 esac'
6120
6121 : determine where public architecture dependent libraries go
6122 set archlib archlib
6123 eval $prefixit
6124 : privlib default is /usr/local/lib/$package/$version
6125 : archlib default is /usr/local/lib/$package/$version/$archname
6126 : privlib may have an optional trailing /share.
6127 tdflt=`echo $privlib | $sed 's,/share$,,'`
6128 tdflt=$tdflt/$archname
6129 case "$archlib" in
6130 '')     dflt=$tdflt
6131         ;;
6132 *)      dflt="$archlib"
6133     ;;
6134 esac
6135 $cat <<EOM
6136
6137 $spackage contains architecture-dependent library files.  If you are
6138 sharing libraries in a heterogeneous environment, you might store
6139 these files in a separate location.  Otherwise, you can just include
6140 them with the rest of the public library files.
6141
6142 EOM
6143 fn=$binexp
6144 fn=d+~
6145 rp='Where do you want to put the public architecture-dependent libraries?'
6146 . ./getfile
6147 prefixvar=archlib
6148 . ./setprefixvar
6149 if $test X"$archlib" = X"$privlib"; then
6150         d_archlib="$undef"
6151 else
6152         d_archlib="$define"
6153 fi
6154
6155 : see if setuid scripts can be secure
6156 $cat <<EOM
6157
6158 Some kernels have a bug that prevents setuid #! scripts from being
6159 secure.  Some sites have disabled setuid #! scripts because of this.
6160
6161 First let's decide if your kernel supports secure setuid #! scripts.
6162 (If setuid #! scripts would be secure but have been disabled anyway,
6163 don't say that they are secure if asked.)
6164
6165 EOM
6166
6167 val="$undef"
6168 if $test -d /dev/fd; then
6169         echo "#!$ls" >reflect
6170         chmod +x,u+s reflect
6171         ./reflect >flect 2>&1
6172         if $contains "/dev/fd" flect >/dev/null; then
6173                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6174                 val="$define"
6175         else
6176                 $cat <<EOM
6177 If you are not sure if they are secure, I can check but I'll need a
6178 username and password different from the one you are using right now.
6179 If you don't have such a username or don't want me to test, simply
6180 enter 'none'.
6181
6182 EOM
6183                 rp='Other username to test security of setuid scripts with?'
6184                 dflt='none'
6185                 . ./myread
6186                 case "$ans" in
6187                 n|none)
6188                         case "$d_suidsafe" in
6189                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6190                                 dflt=n;;
6191                         "$undef")
6192                                 echo "Well, the $hint value is *not* secure." >&4
6193                                 dflt=n;;
6194                         *)      echo "Well, the $hint value *is* secure." >&4
6195                                 dflt=y;;
6196                         esac
6197                         ;;
6198                 *)
6199                         $rm -f reflect flect
6200                         echo "#!$ls" >reflect
6201                         chmod +x,u+s reflect
6202                         echo >flect
6203                         chmod a+w flect
6204                         echo '"su" will (probably) prompt you for '"$ans's password."
6205                         su $ans -c './reflect >flect'
6206                         if $contains "/dev/fd" flect >/dev/null; then
6207                                 echo "Okay, it looks like setuid scripts are secure." >&4
6208                                 dflt=y
6209                         else
6210                                 echo "I don't think setuid scripts are secure." >&4
6211                                 dflt=n
6212                         fi
6213                         ;;
6214                 esac
6215                 rp='Does your kernel have *secure* setuid scripts?'
6216                 . ./myread
6217                 case "$ans" in
6218                 [yY]*)  val="$define";;
6219                 *)      val="$undef";;
6220                 esac
6221         fi
6222 else
6223         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6224         echo "(That's for file descriptors, not floppy disks.)"
6225         val="$undef"
6226 fi
6227 set d_suidsafe
6228 eval $setvar
6229
6230 $rm -f reflect flect
6231
6232 : now see if they want to do setuid emulation
6233 echo " "
6234 val="$undef"
6235 case "$d_suidsafe" in
6236 "$define")
6237         val="$undef"
6238         echo "No need to emulate SUID scripts since they are secure here." >&4
6239         ;;
6240 *)
6241         $cat <<EOM
6242 Some systems have disabled setuid scripts, especially systems where
6243 setuid scripts cannot be secure.  On systems where setuid scripts have
6244 been disabled, the setuid/setgid bits on scripts are currently
6245 useless.  It is possible for $package to detect those bits and emulate
6246 setuid/setgid in a secure fashion.  This emulation will only work if
6247 setuid scripts have been disabled in your kernel.
6248
6249 EOM
6250         case "$d_dosuid" in
6251         "$define") dflt=y ;;
6252         *) dflt=n ;;
6253         esac
6254         rp="Do you want to do setuid/setgid emulation?"
6255         . ./myread
6256         case "$ans" in
6257         [yY]*)  val="$define";;
6258         *)      val="$undef";;
6259         esac
6260         ;;
6261 esac
6262 set d_dosuid
6263 eval $setvar
6264
6265 : Find perl5.005 or later.
6266 echo "Looking for a previously installed perl5.005 or later... "
6267 case "$perl5" in
6268 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6269                 : Check if this perl is recent and can load a simple module
6270                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6271                         perl5=$tdir/perl
6272                         break;
6273                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6274                         perl5=$tdir/perl5
6275                         break;
6276                 fi
6277         done
6278         ;;
6279 *)      perl5="$perl5"
6280         ;;
6281 esac
6282 case "$perl5" in
6283 '')     echo "None found.  That's ok.";;
6284 *)      echo "Using $perl5." ;;
6285 esac
6286
6287 $cat <<EOM
6288
6289 After $package is installed, you may wish to install various
6290 add-on modules and utilities.  Typically, these add-ons will
6291 be installed under $prefix with the rest
6292 of this package.  However, you may wish to install such add-ons
6293 elsewhere under a different prefix.
6294
6295 If you do not wish to put everything under a single prefix, that's
6296 ok.  You will be prompted for the individual locations; this siteprefix
6297 is only used to suggest the defaults.
6298
6299 The default should be fine for most people.
6300
6301 EOM
6302 fn=d~+
6303 rp='Installation prefix to use for add-on modules and utilities?'
6304 : XXX Here might be another good place for an installstyle setting.
6305 case "$siteprefix" in
6306 '') dflt=$prefix ;;
6307 *)  dflt=$siteprefix ;;
6308 esac
6309 . ./getfile
6310 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6311 oldsiteprefix=''
6312 case "$siteprefix" in
6313 '') ;;
6314 *)      case "$ans" in
6315         "$prefix") ;;
6316         *) oldsiteprefix="$prefix";;
6317         esac
6318         ;;
6319 esac
6320 siteprefix="$ans"
6321 siteprefixexp="$ansexp"
6322
6323 : determine where site specific libraries go.
6324 : Usual default is /usr/local/lib/perl5/site_perl/$version
6325 : The default "style" setting is made in installstyle.U
6326 : XXX No longer works with Prefixit stuff.
6327 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6328 case "$sitelib" in
6329 '') case "$installstyle" in
6330         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6331         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6332         esac
6333         ;;
6334 *)      dflt="$sitelib"
6335         ;;
6336 esac
6337 $cat <<EOM
6338
6339 The installation process will create a directory for
6340 site-specific extensions and modules.  Most users find it convenient
6341 to place all site-specific files in this directory rather than in the
6342 main distribution directory.
6343
6344 EOM
6345 fn=d~+
6346 rp='Pathname for the site-specific library files?'
6347 . ./getfile
6348 prefixvar=sitelib
6349 . ./setprefixvar
6350 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6351
6352 : Determine list of previous versions to include in @INC
6353 $cat > getverlist <<EOPL
6354 #!$perl5 -w
6355 use File::Basename;
6356 \$api_versionstring = "$api_versionstring";
6357 \$version = "$version";
6358 \$stem = "$sitelib_stem";
6359 \$archname = "$archname";
6360 EOPL
6361         $cat >> getverlist <<'EOPL'
6362 # Can't have leading @ because metaconfig interprets it as a command!
6363 ;@inc_version_list=();
6364 # XXX Redo to do opendir/readdir?
6365 if (-d $stem) {
6366     chdir($stem);
6367     ;@candidates = glob("5.*");
6368 }
6369 else {
6370     ;@candidates = ();
6371 }
6372
6373 # XXX ToDo:  These comparisons must be reworked when two-digit
6374 # subversions come along, so that 5.7.10 compares as greater than
6375 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6376 # widespread that we can use the built-in version vectors rather
6377 # than reinventing them here.  For 5.6.0, however, we must
6378 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6379 foreach $d (@candidates) {
6380     if ($d lt $version) {
6381         if ($d ge $api_versionstring) {
6382             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6383         }
6384         elsif ($d ge "5.005") {
6385             unshift(@inc_version_list, grep { -d } $d);
6386         }
6387     }
6388     else {
6389         # Skip newer version.  I.e. don't look in
6390         # 5.7.0 if we're installing 5.6.1.
6391     }
6392 }
6393
6394 if (@inc_version_list) {
6395     print join(' ', @inc_version_list);
6396 }
6397 else {
6398     # Blank space to preserve value for next Configure run.
6399     print " ";
6400 }
6401 EOPL
6402 chmod +x getverlist
6403 case "$inc_version_list" in
6404 '')     if test -x "$perl5$exe_ext"; then
6405                 dflt=`$perl5 getverlist`
6406         else
6407                 dflt='none'
6408         fi
6409         ;;
6410 $undef) dflt='none' ;;
6411 *)  eval dflt=\"$inc_version_list\" ;;
6412 esac
6413 case "$dflt" in
6414 ''|' ') dflt=none ;;
6415 esac
6416 case "$dflt" in
6417 5.005) dflt=none ;;
6418 esac
6419 $cat <<EOM
6420
6421 In order to ease the process of upgrading, this version of perl
6422 can be configured to use modules built and installed with earlier
6423 versions of perl that were installed under $prefix.  Specify here
6424 the list of earlier versions that this version of perl should check.
6425 If Configure detected no earlier versions of perl installed under
6426 $prefix, then the list will be empty.  Answer 'none' to tell perl
6427 to not search earlier versions.
6428
6429 The default should almost always be sensible, so if you're not sure,
6430 just accept the default.
6431 EOM
6432
6433 rp='List of earlier versions to include in @INC?'
6434 . ./myread
6435 case "$ans" in
6436 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6437 *) inc_version_list="$ans" ;;
6438 esac
6439 case "$inc_version_list" in
6440 ''|' ')
6441         inc_version_list_init='0'
6442         d_inc_version_list="$undef"
6443         ;;
6444 *)      inc_version_list_init=`echo $inc_version_list |
6445                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6446         d_inc_version_list="$define"
6447         ;;
6448 esac
6449 $rm -f getverlist
6450
6451 : see if this is a malloc.h system
6452 : we want a real compile instead of Inhdr because some systems have a
6453 : malloc.h that just gives a compile error saying to use stdlib.h instead
6454 echo " "
6455 $cat >try.c <<EOCP
6456 #include <stdlib.h>
6457 #include <malloc.h>
6458 int main () { return 0; }
6459 EOCP
6460 set try
6461 if eval $compile; then
6462     echo "<malloc.h> found." >&4
6463     val="$define"
6464 else
6465     echo "<malloc.h> NOT found." >&4
6466     val="$undef"
6467 fi
6468 $rm -f try.c try
6469 set i_malloc
6470 eval $setvar
6471
6472 : check for void type
6473 echo " "
6474 echo "Checking to see how well your C compiler groks the void type..." >&4
6475 case "$voidflags" in
6476 '')
6477         $cat >try.c <<EOCP
6478 #$i_stdlib I_STDLIB
6479 #ifdef I_STDLIB
6480 #include <stdlib.h>
6481 #endif
6482 #if TRY & 1
6483 void sub() {
6484 #else
6485 sub() {
6486 #endif
6487         extern void moo();      /* function returning void */
6488         void (*goo)();          /* ptr to func returning void */
6489 #if TRY & 8
6490         void *hue;              /* generic ptr */
6491 #endif
6492 #if TRY & 2
6493         void (*foo[10])();
6494 #endif
6495
6496 #if TRY & 4
6497         if(goo == moo) {
6498                 exit(0);
6499         }
6500 #endif
6501         exit(0);
6502 }
6503 int main() { sub(); }
6504 EOCP
6505         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6506                 voidflags=$defvoidused
6507         echo "Good.  It appears to support void to the level $package wants.">&4
6508                 if $contains warning .out >/dev/null 2>&1; then
6509                         echo "However, you might get some warnings that look like this:"
6510                         $cat .out
6511                 fi
6512         else
6513 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6514                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6515                         echo "It supports 1..."
6516                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6517                                 echo "It also supports 2..."
6518                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6519                                         voidflags=7
6520                                         echo "And it supports 4 but not 8 definitely."
6521                                 else
6522                                         echo "It doesn't support 4..."
6523                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6524                                                 voidflags=11
6525                                                 echo "But it supports 8."
6526                                         else
6527                                                 voidflags=3
6528                                                 echo "Neither does it support 8."
6529                                         fi
6530                                 fi
6531                         else
6532                                 echo "It does not support 2..."
6533                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6534                                         voidflags=13
6535                                         echo "But it supports 4 and 8."
6536                                 else
6537                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6538                                                 voidflags=5
6539                                                 echo "And it supports 4 but has not heard about 8."
6540                                         else
6541                                                 echo "However it supports 8 but not 4."
6542                                         fi
6543                                 fi
6544                         fi
6545                 else
6546                         echo "There is no support at all for void."
6547                         voidflags=0
6548                 fi
6549         fi
6550 esac
6551 case "$voidflags" in
6552 "$defvoidused") ;;
6553 *)      $cat >&4 <<'EOM'
6554   Support flag bits are:
6555     1: basic void declarations.
6556     2: arrays of pointers to functions returning void.
6557     4: operations between pointers to and addresses of void functions.
6558     8: generic void pointers.
6559 EOM
6560         dflt="$voidflags";
6561         rp="Your void support flags add up to what?"
6562         . ./myread
6563         voidflags="$ans"
6564         ;;
6565 esac
6566 $rm -f try.* .out
6567
6568 : check for length of pointer
6569 echo " "
6570 case "$ptrsize" in
6571 '')
6572         echo "Checking to see how big your pointers are..." >&4
6573         if test "$voidflags" -gt 7; then
6574                 echo '#define VOID_PTR char *' > try.c
6575         else
6576                 echo '#define VOID_PTR void *' > try.c
6577         fi
6578         $cat >>try.c <<EOCP
6579 #include <stdio.h>
6580 #$i_stdlib I_STDLIB
6581 #ifdef I_STDLIB
6582 #include <stdlib.h>
6583 #endif
6584 int main()
6585 {
6586     printf("%d\n", (int)sizeof(VOID_PTR));
6587     exit(0);
6588 }
6589 EOCP
6590         set try
6591         if eval $compile_ok; then
6592                 ptrsize=`$run ./try`
6593                 echo "Your pointers are $ptrsize bytes long."
6594         else
6595                 dflt='4'
6596                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6597                 rp="What is the size of a pointer (in bytes)?"
6598                 . ./myread
6599                 ptrsize="$ans"
6600         fi
6601         ;;
6602 esac
6603 $rm -f try.c try
6604 case "$use64bitall" in
6605 "$define"|true|[yY]*)
6606         case "$ptrsize" in
6607         4)      cat <<EOM >&4
6608
6609 *** You have chosen a maximally 64-bit build,
6610 *** but your pointers are only 4 bytes wide.
6611 *** Please rerun Configure without -Duse64bitall.
6612 EOM
6613                 case "$d_quad" in
6614                 define)
6615                         cat <<EOM >&4
6616 *** Since you have quads, you could possibly try with -Duse64bitint.
6617 EOM
6618                         ;;
6619                 esac
6620                 cat <<EOM >&4
6621 *** Cannot continue, aborting.
6622
6623 EOM
6624
6625                 exit 1
6626                 ;;
6627         esac
6628         ;;
6629 esac
6630
6631
6632 : determine whether to use malloc wrapping
6633 echo " "
6634 case "$usemallocwrap" in
6635 [yY]*|true|$define)     dflt='y' ;;
6636 [nN]*|false|$undef)     dflt='n' ;;
6637 *)      case "$usedevel" in
6638         [yY]*|true|$define)     dflt='y' ;;
6639         *) dflt='n' ;;
6640         esac
6641         ;;
6642 esac
6643 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6644 . ./myread
6645 usemallocwrap="$ans"
6646 case "$ans" in
6647 y*|true)
6648         usemallocwrap="$define" ;;
6649 *)
6650         usemallocwrap="$undef" ;;
6651 esac
6652
6653 : determine which malloc to compile in
6654 echo " "
6655 case "$usemymalloc" in
6656 [yY]*|true|$define)     dflt='y' ;;
6657 [nN]*|false|$undef)     dflt='n' ;;
6658 *)      case "$ptrsize" in
6659         4) dflt='y' ;;
6660         *) dflt='n' ;;
6661         esac
6662         ;;
6663 esac
6664 rp="Do you wish to attempt to use the malloc that comes with $package?"
6665 . ./myread
6666 usemymalloc="$ans"
6667 case "$ans" in
6668 y*|true)
6669         usemymalloc='y'
6670         mallocsrc='malloc.c'
6671         mallocobj="malloc$_o"
6672         d_mymalloc="$define"
6673         case "$libs" in
6674         *-lmalloc*)
6675                 : Remove malloc from list of libraries to use
6676                 echo "Removing unneeded -lmalloc from library list" >&4
6677                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6678                 shift
6679                 libs="$*"
6680                 echo "libs = $libs" >&4
6681                 ;;
6682         esac
6683         ;;
6684 *)
6685         usemymalloc='n'
6686         mallocsrc=''
6687         mallocobj=''
6688         d_mymalloc="$undef"
6689         ;;
6690 esac
6691
6692 : compute the return types of malloc and free
6693 echo " "
6694 $cat >malloc.c <<END
6695 #$i_malloc I_MALLOC
6696 #$i_stdlib I_STDLIB
6697 #include <stdio.h>
6698 #include <sys/types.h>
6699 #ifdef I_MALLOC
6700 #include <malloc.h>
6701 #endif
6702 #ifdef I_STDLIB
6703 #include <stdlib.h>
6704 #endif
6705 #ifdef TRY_MALLOC
6706 void *malloc();
6707 #endif
6708 #ifdef TRY_FREE
6709 void free();
6710 #endif
6711 END
6712 case "$malloctype" in
6713 '')
6714         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6715                 malloctype='void *'
6716         else
6717                 malloctype='char *'
6718         fi
6719         ;;
6720 esac
6721 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6722
6723 case "$freetype" in
6724 '')
6725         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6726                 freetype='void'
6727         else
6728                 freetype='int'
6729         fi
6730         ;;
6731 esac
6732 echo "Your system uses $freetype free(), it would seem." >&4
6733 $rm -f malloc.[co]
6734 : determine where site specific architecture-dependent libraries go.
6735 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6736 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6737 : sitelib may have an optional trailing /share.
6738 case "$sitearch" in
6739 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6740         dflt="$dflt/$archname"
6741         ;;
6742 *)      dflt="$sitearch"
6743         ;;
6744 esac
6745 set sitearch sitearch none
6746 eval $prefixit
6747 $cat <<EOM
6748
6749 The installation process will also create a directory for
6750 architecture-dependent site-specific extensions and modules.
6751
6752 EOM
6753 fn=d~+
6754 rp='Pathname for the site-specific architecture-dependent library files?'
6755 . ./getfile
6756 prefixvar=sitearch
6757 . ./setprefixvar
6758 if $test X"$sitearch" = X"$sitelib"; then
6759         d_sitearch="$undef"
6760 else
6761         d_sitearch="$define"
6762 fi
6763
6764 $cat <<EOM
6765
6766 The installation process will also create a directory for
6767 vendor-supplied add-ons.  Vendors who supply perl with their system
6768 may find it convenient to place all vendor-supplied files in this
6769 directory rather than in the main distribution directory.  This will
6770 ease upgrades between binary-compatible maintenance versions of perl.
6771
6772 Of course you may also use these directories in whatever way you see
6773 fit.  For example, you might use them to access modules shared over a
6774 company-wide network.
6775
6776 The default answer should be fine for most people.
6777 This causes further questions about vendor add-ons to be skipped
6778 and no vendor-specific directories will be configured for perl.
6779
6780 EOM
6781 rp='Do you want to configure vendor-specific add-on directories?'
6782 case "$usevendorprefix" in
6783 define|true|[yY]*) dflt=y ;;
6784 *)      : User may have set vendorprefix directly on Configure command line.
6785         case "$vendorprefix" in
6786         ''|' ') dflt=n ;;
6787         *)      dflt=y ;;
6788         esac
6789         ;;
6790 esac
6791 . ./myread
6792 case "$ans" in
6793 [yY]*)  fn=d~+
6794         rp='Installation prefix to use for vendor-supplied add-ons?'
6795         case "$vendorprefix" in
6796         '') dflt='' ;;
6797         *)  dflt=$vendorprefix ;;
6798         esac
6799         . ./getfile
6800         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6801         oldvendorprefix=''
6802         case "$vendorprefix" in
6803         '') ;;
6804         *)      case "$ans" in
6805                 "$prefix") ;;
6806                 *) oldvendorprefix="$prefix";;
6807                 esac
6808                 ;;
6809         esac
6810         usevendorprefix="$define"
6811         vendorprefix="$ans"
6812         vendorprefixexp="$ansexp"
6813         ;;
6814 *)      usevendorprefix="$undef"
6815         vendorprefix=''
6816         vendorprefixexp=''
6817         ;;
6818 esac
6819
6820 case "$vendorprefix" in
6821 '')     d_vendorlib="$undef"
6822         vendorlib=''
6823         vendorlibexp=''
6824         ;;
6825 *)      d_vendorlib="$define"
6826         : determine where vendor-supplied modules go.
6827         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6828         case "$vendorlib" in
6829         '')
6830                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6831                 case "$installstyle" in
6832                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6833                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6834                 esac
6835                 ;;
6836         *)      dflt="$vendorlib"
6837                 ;;
6838         esac
6839         fn=d~+
6840         rp='Pathname for the vendor-supplied library files?'
6841         . ./getfile
6842         vendorlib="$ans"
6843         vendorlibexp="$ansexp"
6844         ;;
6845 esac
6846 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6847 prefixvar=vendorlib
6848 . ./installprefix
6849
6850 case "$vendorprefix" in
6851 '')     d_vendorarch="$undef"
6852         vendorarch=''
6853         vendorarchexp=''
6854         ;;
6855 *)      d_vendorarch="$define"
6856         : determine where vendor-supplied architecture-dependent libraries go.
6857         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6858         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6859         : vendorlib may have an optional trailing /share.
6860         case "$vendorarch" in
6861         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6862                 dflt="$dflt/$archname"
6863                 ;;
6864         *)      dflt="$vendorarch" ;;
6865         esac
6866         fn=d~+
6867         rp='Pathname for vendor-supplied architecture-dependent files?'
6868         . ./getfile
6869         vendorarch="$ans"
6870         vendorarchexp="$ansexp"
6871         ;;
6872 esac
6873 prefixvar=vendorarch
6874 . ./installprefix
6875
6876 : Final catch-all directories to search
6877 $cat <<EOM
6878
6879 Lastly, you can have perl look in other directories for extensions and
6880 modules in addition to those already specified.
6881 These directories will be searched after 
6882         $sitearch 
6883         $sitelib 
6884 EOM
6885 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6886 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6887 echo ' '
6888 case "$otherlibdirs" in
6889 ''|' ') dflt='none' ;;
6890 *)      dflt="$otherlibdirs" ;;
6891 esac
6892 $cat <<EOM
6893 Enter a colon-separated set of extra paths to include in perl's @INC
6894 search path, or enter 'none' for no extra paths.
6895
6896 EOM
6897
6898 rp='Colon-separated list of additional directories for perl to search?'
6899 . ./myread
6900 case "$ans" in
6901 ' '|''|none)    otherlibdirs=' ' ;;     
6902 *)      otherlibdirs="$ans" ;;
6903 esac
6904 case "$otherlibdirs" in
6905 ' ') val=$undef ;;
6906 *)      val=$define ;;
6907 esac
6908 set d_perl_otherlibdirs
6909 eval $setvar
6910
6911 : Cruising for prototypes
6912 echo " "
6913 echo "Checking out function prototypes..." >&4
6914 $cat >prototype.c <<EOCP
6915 #$i_stdlib I_STDLIB
6916 #ifdef I_STDLIB
6917 #include <stdlib.h>
6918 #endif
6919 int main(int argc, char *argv[]) {
6920         exit(0);}
6921 EOCP
6922 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6923         echo "Your C compiler appears to support function prototypes."
6924         val="$define"
6925 else
6926         echo "Your C compiler doesn't seem to understand function prototypes."
6927         val="$undef"
6928 fi
6929 set prototype
6930 eval $setvar
6931 $rm -f prototype*
6932
6933 case "$prototype" in
6934 "$define") ;;
6935 *)      ansi2knr='ansi2knr'
6936         echo " "
6937         cat <<EOM >&4
6938
6939 $me:  FATAL ERROR:
6940 This version of $package can only be compiled by a compiler that 
6941 understands function prototypes.  Unfortunately, your C compiler 
6942         $cc $ccflags
6943 doesn't seem to understand them.  Sorry about that.
6944
6945 If GNU cc is available for your system, perhaps you could try that instead.  
6946
6947 Eventually, we hope to support building Perl with pre-ANSI compilers.
6948 If you would like to help in that effort, please contact <perlbug@perl.org>.
6949
6950 Aborting Configure now.
6951 EOM
6952         exit 2
6953         ;;
6954 esac
6955
6956 echo " "
6957 case "$extras" in
6958 '') dflt='n';;
6959 *) dflt='y';;
6960 esac
6961 cat <<EOM
6962 Perl can be built with extra modules or bundles of modules which
6963 will be fetched from the CPAN and installed alongside Perl.
6964
6965 Notice that you will need access to the CPAN; either via the Internet,
6966 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6967 be asked later to configure the CPAN.pm module which will in turn do
6968 the installation of the rest of the extra modules or bundles.)
6969
6970 Notice also that if the modules require any external software such as
6971 libraries and headers (the libz library and the zlib.h header for the
6972 Compress::Zlib module, for example) you MUST have any such software
6973 already installed, this configuration process will NOT install such
6974 things for you.
6975
6976 If this doesn't make any sense to you, just accept the default '$dflt'.
6977 EOM
6978 rp='Install any extra modules (y or n)?'
6979 . ./myread
6980 case "$ans" in
6981 y|Y)
6982         cat <<EOM
6983
6984 Please list any extra modules or bundles to be installed from CPAN,
6985 with spaces between the names.  The names can be in any format the
6986 'install' command of CPAN.pm will understand.  (Answer 'none',
6987 without the quotes, to install no extra modules or bundles.)
6988 EOM
6989         rp='Extras?'
6990         dflt="$extras"
6991         . ./myread
6992         extras="$ans"
6993 esac
6994 case "$extras" in
6995 ''|'none')
6996         val=''
6997         $rm -f ../extras.lst
6998         ;;
6999 *)      echo "(Saving the list of extras for later...)"
7000         echo "$extras" > ../extras.lst
7001         val="'$extras'"
7002         ;;
7003 esac
7004 set extras
7005 eval $setvar
7006 echo " "
7007
7008 : determine where html pages for programs go
7009 set html1dir html1dir none
7010 eval $prefixit
7011 $cat <<EOM
7012
7013 If you wish to install html files for programs in $spackage, indicate
7014 the appropriate directory here.  To skip installing html files,
7015 answer "none".
7016 EOM
7017 case "$html1dir" in
7018 ''|none|$undef|' ') dflt=none ;;
7019 *) dflt=$html1dir ;;
7020 esac
7021 fn=dn+~
7022 rp="Directory for the main $spackage html pages?"
7023 . ./getfile
7024 prefixvar=html1dir
7025 . ./setprefixvar
7026 : Use ' ' for none so value is preserved next time through Configure
7027 $test X"$html1dir" = "X" && html1dir=' '
7028
7029 : determine where html pages for libraries and modules go
7030 set html3dir html3dir none
7031 eval $prefixit
7032 $cat <<EOM
7033
7034 If you wish to install html files for modules associated with $spackage,
7035 indicate the appropriate directory here.  To skip installing html files,
7036 answer "none".
7037 EOM
7038 : There is no obvious default.  If they have specified html1dir, then
7039 : try to key off that, possibly changing .../html1 into .../html3.
7040 case "$html3dir" in
7041 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7042 *) dflt=$html3dir ;;
7043 esac
7044 fn=dn+~
7045 rp="Directory for the $spackage module html pages?"
7046 . ./getfile
7047 prefixvar=html3dir
7048 . ./setprefixvar
7049 : Use ' ' for none so value is preserved next time through Configure
7050 $test X"$html3dir" = "X" && html3dir=' '
7051
7052 : determine whether to install perl also as /usr/bin/perl
7053
7054 echo " "
7055 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7056         $cat <<EOM
7057 Many scripts expect perl to be installed as /usr/bin/perl.
7058
7059 If you want to, I can install the perl you are about to compile
7060 as /usr/bin/perl (in addition to $bin/perl).
7061 EOM
7062         if test -f /usr/bin/perl; then
7063             $cat <<EOM
7064
7065 However, please note that because you already have a /usr/bin/perl,
7066 overwriting that with a new Perl would very probably cause problems.
7067 Therefore I'm assuming you don't want to do that (unless you insist).
7068
7069 EOM
7070             case "$installusrbinperl" in
7071             "$define"|[yY]*)    dflt='y';;
7072             *)                  dflt='n';;
7073             esac
7074         else
7075             $cat <<EOM
7076
7077 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7078
7079 EOM
7080             case "$installusrbinperl" in
7081             "$undef"|[nN]*)     dflt='n';;
7082             *)                  dflt='y';;
7083             esac
7084         fi
7085         rp="Do you want to install perl as /usr/bin/perl?"
7086         . ./myread
7087         case "$ans" in
7088         [yY]*)  val="$define";;
7089         *)      val="$undef" ;;
7090         esac
7091 else
7092         val="$undef"
7093 fi
7094 set installusrbinperl
7095 eval $setvar
7096
7097 echo " "
7098 echo "Checking for GNU C Library..." >&4
7099 cat >try.c <<'EOCP'
7100 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7101    alone are insufficient to distinguish different versions, such as
7102    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7103    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7104 */
7105 #include <stdio.h>
7106 int main(void)
7107 {
7108 #ifdef __GLIBC__
7109 #   ifdef __GLIBC_MINOR__
7110 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7111 #           include <gnu/libc-version.h>
7112             printf("%s\n",  gnu_get_libc_version());
7113 #       else
7114             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7115 #       endif
7116 #   else
7117         printf("%d\n",  __GLIBC__);
7118 #   endif
7119     return 0;
7120 #else
7121     return 1;
7122 #endif
7123 }
7124 EOCP
7125 set try
7126 if eval $compile_ok && $run ./try > glibc.ver; then
7127         val="$define"
7128         gnulibc_version=`$cat glibc.ver`
7129         echo "You are using the GNU C Library version $gnulibc_version"
7130 else
7131         val="$undef"
7132         gnulibc_version=''
7133         echo "You are not using the GNU C Library"
7134 fi
7135 $rm -f try try.* glibc.ver
7136 set d_gnulibc
7137 eval $setvar
7138
7139 : see if nm is to be used to determine whether a symbol is defined or not
7140 case "$usenm" in
7141 '')
7142         dflt=''
7143         case "$d_gnulibc" in
7144         "$define")
7145                 echo " "
7146                 echo "nm probably won't work on the GNU C Library." >&4
7147                 dflt=n
7148                 ;;
7149         esac
7150         case "$dflt" in
7151         '') 
7152                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7153                         echo " "
7154                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7155                         echo "'nm' won't be sufficient on this sytem." >&4
7156                         dflt=n
7157                 fi
7158                 ;;
7159         esac
7160         case "$dflt" in
7161         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7162                 if $test $dflt -gt 20; then
7163                         dflt=y
7164                 else
7165                         dflt=n
7166                 fi
7167                 ;;
7168         esac
7169         ;;
7170 *)
7171         case "$usenm" in
7172         true|$define) dflt=y;;
7173         *) dflt=n;;
7174         esac
7175         ;;
7176 esac
7177 $cat <<EOM
7178
7179 I can use $nm to extract the symbols from your C libraries. This
7180 is a time consuming task which may generate huge output on the disk (up
7181 to 3 megabytes) but that should make the symbols extraction faster. The
7182 alternative is to skip the 'nm' extraction part and to compile a small
7183 test program instead to determine whether each symbol is present. If
7184 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7185 this may be the best solution.
7186
7187 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7188
7189 EOM
7190 rp="Shall I use $nm to extract C symbols from the libraries?"
7191 . ./myread
7192 case "$ans" in
7193 [Nn]*) usenm=false;;
7194 *) usenm=true;;
7195 esac
7196
7197 runnm=$usenm
7198 case "$reuseval" in
7199 true) runnm=false;;
7200 esac
7201
7202 : nm options which may be necessary
7203 case "$nm_opt" in
7204 '') if $test -f /mach_boot; then
7205                 nm_opt=''       # Mach
7206         elif $test -d /usr/ccs/lib; then
7207                 nm_opt='-p'     # Solaris (and SunOS?)
7208         elif $test -f /dgux; then
7209                 nm_opt='-p'     # DG-UX
7210         elif $test -f /lib64/rld; then
7211                 nm_opt='-p'     # 64-bit Irix
7212         else
7213                 nm_opt=''
7214         fi;;
7215 esac
7216
7217 : nm options which may be necessary for shared libraries but illegal
7218 : for archive libraries.  Thank you, Linux.
7219 case "$nm_so_opt" in
7220 '')     case "$myuname" in
7221         *linux*|gnu*)
7222                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7223                         nm_so_opt='--dynamic'
7224                 fi
7225                 ;;
7226         esac
7227         ;;
7228 esac
7229
7230 case "$runnm" in
7231 true)
7232 : get list of predefined functions in a handy place
7233 echo " "
7234 case "$libc" in
7235 '') libc=unknown
7236         case "$libs" in
7237         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7238         esac
7239         ;;
7240 esac
7241 case "$libs" in
7242 '') ;;
7243 *)  for thislib in $libs; do
7244         case "$thislib" in
7245         -lc|-lc_s)
7246                 : Handle C library specially below.
7247                 ;;
7248         -l*)
7249                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7250                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7251                         :
7252                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7253                         :
7254                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7255                         :
7256                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7257                         :
7258                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7259                         :
7260                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7261                         :
7262                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7263                         :
7264                 else
7265                         try=''
7266                 fi
7267                 libnames="$libnames $try"
7268                 ;;
7269         *) libnames="$libnames $thislib" ;;
7270         esac
7271         done
7272         ;;
7273 esac
7274 xxx=normal
7275 case "$libc" in
7276 unknown)
7277         set /lib/libc.$so
7278         for xxx in $libpth; do
7279                 $test -r $1 || set $xxx/libc.$so
7280                 : The messy sed command sorts on library version numbers.
7281                 $test -r $1 || \
7282                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7283                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7284                                 h
7285                                 s/[0-9][0-9]*/0000&/g
7286                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7287                                 G
7288                                 s/\n/ /' | \
7289                          $sort | $sed -e 's/^.* //'`
7290                 eval set \$$#
7291         done
7292         $test -r $1 || set /usr/ccs/lib/libc.$so
7293         $test -r $1 || set /lib/libsys_s$_a
7294         ;;
7295 *)
7296         set blurfl
7297         ;;
7298 esac
7299 if $test -r "$1"; then
7300         echo "Your (shared) C library seems to be in $1."
7301         libc="$1"
7302 elif $test -r /lib/libc && $test -r /lib/clib; then
7303         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7304         xxx=apollo
7305         libc='/lib/clib /lib/libc'
7306         if $test -r /lib/syslib; then
7307                 echo "(Your math library is in /lib/syslib.)"
7308                 libc="$libc /lib/syslib"
7309         fi
7310 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7311         echo "Your C library seems to be in $libc, as you said before."
7312 elif $test -r $incpath/usr/lib/libc$_a; then
7313         libc=$incpath/usr/lib/libc$_a;
7314         echo "Your C library seems to be in $libc.  That's fine."
7315 elif $test -r /lib/libc$_a; then
7316         libc=/lib/libc$_a;
7317         echo "Your C library seems to be in $libc.  You're normal."
7318 else
7319         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7320                 :
7321         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7322                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7323         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7324                 :
7325         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7326                 :
7327         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7328                 :
7329         else
7330                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7331         fi
7332         if $test -r "$tans"; then
7333                 echo "Your C library seems to be in $tans, of all places."
7334                 libc=$tans
7335         else
7336                 libc='blurfl'
7337         fi
7338 fi
7339 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7340         dflt="$libc"
7341         cat <<EOM
7342
7343 If the guess above is wrong (which it might be if you're using a strange
7344 compiler, or your machine supports multiple models), you can override it here.
7345
7346 EOM
7347 else
7348         dflt=''
7349         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7350         cat >&4 <<EOM
7351 I can't seem to find your C library.  I've looked in the following places:
7352
7353 EOM
7354         $sed 's/^/      /' libpath
7355         cat <<EOM
7356
7357 None of these seems to contain your C library. I need to get its name...
7358
7359 EOM
7360 fi
7361 fn=f
7362 rp='Where is your C library?'
7363 . ./getfile
7364 libc="$ans"
7365
7366 echo " "
7367 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7368 set X `cat libnames`
7369 shift
7370 xxx=files
7371 case $# in 1) xxx=file; esac
7372 echo "Extracting names from the following $xxx for later perusal:" >&4
7373 echo " "
7374 $sed 's/^/      /' libnames >&4
7375 echo " "
7376 $echo $n "This may take a while...$c" >&4
7377
7378 for file in $*; do
7379         case $file in
7380         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7381         *) $nm $nm_opt $file 2>/dev/null;;
7382         esac
7383 done >libc.tmp
7384
7385 $echo $n ".$c"
7386 $grep fprintf libc.tmp > libc.ptf
7387 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7388 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7389 xxx='[ADTSIW]'
7390 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7391         eval $xscan;\
7392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393                 eval $xrun
7394 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7395         eval $xscan;\
7396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397                 eval $xrun
7398 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7399         eval $xscan;\
7400         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401                 eval $xrun
7402 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7403         eval $xscan;\
7404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405                 eval $xrun
7406 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7407         eval $xscan;\
7408         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7409                 eval $xrun
7410 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7411         eval $xscan;\
7412         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7413                 eval $xrun
7414 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7415                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7416         eval $xscan;\
7417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418                 eval $xrun
7419 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7420         eval $xscan;\
7421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422                 eval $xrun
7423 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7424         eval $xscan;\
7425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426                 eval $xrun
7427 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7428         eval $xscan;\
7429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430                 eval $xrun
7431 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7432         eval $xscan;\
7433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434                 eval $xrun
7435 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7436         eval $xscan;\
7437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438                 eval $xrun
7439 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7440         eval $xscan;\
7441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7442                 eval $xrun
7443 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7444         eval $xscan;\
7445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7446                 eval $xrun
7447 else
7448         $nm -p $* 2>/dev/null >libc.tmp
7449         $grep fprintf libc.tmp > libc.ptf
7450         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7451                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7452         then
7453                 nm_opt='-p'
7454                 eval $xrun
7455         else
7456                 echo " "
7457                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7458                 com=''
7459                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7460                         for thisname in $libnames $libc; do
7461                                 $ar t $thisname >>libc.tmp
7462                         done
7463                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7464                         echo "Ok." >&4
7465                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7466                         # Repeat libc to extract forwarders to DLL entries too
7467                         for thisname in $libnames $libc; do
7468                                 $ar tv $thisname >>libc.tmp
7469                                 # Revision 50 of EMX has bug in $ar.
7470                                 # it will not extract forwarders to DLL entries
7471                                 # Use emximp which will extract exactly them.
7472                                 emximp -o tmp.imp $thisname \
7473                                     2>/dev/null && \
7474                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7475                                     < tmp.imp >>libc.tmp
7476                                 $rm tmp.imp
7477                         done
7478                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7479                         echo "Ok." >&4
7480                 else
7481                         echo "$ar didn't seem to work right." >&4
7482                         echo "Maybe this is a Cray...trying bld instead..." >&4
7483                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7484                         then
7485                                 for thisname in $libnames; do
7486                                         bld t $libnames | \
7487                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7488                                         $ar t $thisname >>libc.tmp
7489                                 done
7490                                 echo "Ok." >&4
7491                         else
7492                                 echo "That didn't work either.  Giving up." >&4
7493                                 exit 1
7494                         fi
7495                 fi
7496         fi
7497 fi
7498 nm_extract="$com"
7499 case "$PASE" in
7500 define)
7501     echo " "
7502     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7503     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7504     ;;
7505 *)  if $test -f /lib/syscalls.exp; then
7506         echo " "
7507         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7508         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7509     fi
7510     ;;
7511 esac
7512 ;;
7513 esac
7514 $rm -f libnames libpath
7515
7516 : see if dld is available
7517 set dld.h i_dld
7518 eval $inhdr
7519
7520 : is a C symbol defined?
7521 csym='tlook=$1;
7522 case "$3" in
7523 -v) tf=libc.tmp; tdc="";;
7524 -a) tf=libc.tmp; tdc="[]";;
7525 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7526 esac;
7527 tx=yes;
7528 case "$reuseval-$4" in
7529 true-) ;;
7530 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7531 esac;
7532 case "$tx" in
7533 yes)
7534         tval=false;
7535         if $test "$runnm" = true; then
7536                 if $contains $tlook $tf >/dev/null 2>&1; then
7537                         tval=true;
7538                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7539                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7540                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7541                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7542                         $rm -f try$_exe try.c core core.* try.core;
7543                 fi;
7544         else
7545                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7546                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7547                 $rm -f try$_exe try.c;
7548         fi;
7549         ;;
7550 *)
7551         case "$tval" in
7552         $define) tval=true;;
7553         *) tval=false;;
7554         esac;
7555         ;;
7556 esac;
7557 eval "$2=$tval"'
7558
7559 : define an is-in-libc? function
7560 inlibc='echo " "; td=$define; tu=$undef;
7561 sym=$1; var=$2; eval "was=\$$2";
7562 tx=yes;
7563 case "$reuseval$was" in
7564 true) ;;
7565 true*) tx=no;;
7566 esac;
7567 case "$tx" in
7568 yes)
7569         set $sym tres -f;
7570         eval $csym;
7571         case "$tres" in
7572         true)
7573                 echo "$sym() found." >&4;
7574                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7575         *)
7576                 echo "$sym() NOT found." >&4;
7577                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7578         esac;;
7579 *)
7580         case "$was" in
7581         $define) echo "$sym() found." >&4;;
7582         *) echo "$sym() NOT found." >&4;;
7583         esac;;
7584 esac'
7585
7586 : see if dlopen exists
7587 xxx_runnm="$runnm"
7588 runnm=false
7589 set dlopen d_dlopen
7590 eval $inlibc
7591 runnm="$xxx_runnm"
7592
7593 : determine which dynamic loading, if any, to compile in
7594 echo " "
7595 dldir="ext/DynaLoader"
7596 case "$usedl" in
7597 $define|y|true)
7598         dflt='y'
7599         usedl="$define"
7600         ;;
7601 $undef|n|false)
7602         dflt='n'
7603         usedl="$undef"
7604         ;;
7605 *) 
7606         dflt='n'
7607         case "$d_dlopen" in
7608             $define) dflt='y' ;;
7609         esac
7610         case "$i_dld" in
7611             $define) dflt='y' ;;
7612         esac
7613         : Does a dl_xxx.xs file exist for this operating system
7614         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7615         ;;
7616 esac
7617 rp="Do you wish to use dynamic loading?"
7618 . ./myread
7619 usedl="$ans"
7620 case "$ans" in
7621 y*) usedl="$define"
7622         case "$dlsrc" in
7623         '')
7624                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7625                         dflt="$dldir/dl_${osname}.xs"
7626                 elif $test "$d_dlopen" = "$define" ; then
7627                         dflt="$dldir/dl_dlopen.xs"
7628                 elif $test "$i_dld" = "$define" ; then
7629                         dflt="$dldir/dl_dld.xs"
7630                 else
7631                         dflt=''
7632                 fi
7633                 ;;
7634         *)      dflt="$dldir/$dlsrc"
7635                 ;;
7636         esac
7637     echo "The following dynamic loading files are available:"
7638         : Can not go over to $dldir because getfile has path hard-coded in.
7639         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7640         rp="Source file to use for dynamic loading"
7641         fn="fne"
7642         gfpth="$src"
7643         . ./getfile
7644         usedl="$define"
7645         : emulate basename
7646         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7647
7648         $cat << EOM
7649
7650 Some systems may require passing special flags to $cc -c to
7651 compile modules that will be used to create a shared library.
7652 To use no flags, say "none".
7653
7654 EOM
7655     case "$cccdlflags" in
7656     '') case "$gccversion" in
7657                 '') case "$osname" in
7658                         hpux)   dflt='+z' ;;
7659                         next)   dflt='none' ;;
7660                         irix*)  dflt='-KPIC' ;;
7661                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7662                         sunos)  dflt='-pic' ;;
7663                         *)      dflt='none' ;;
7664                     esac
7665                         ;;
7666                 *)  case "$osname" in
7667                         darwin) dflt='none' ;;
7668                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7669                         *)      dflt='-fpic' ;;
7670                     esac ;;
7671             esac ;;
7672         ' ') dflt='none' ;;
7673     *)  dflt="$cccdlflags" ;;
7674     esac
7675     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7676     . ./myread
7677     case "$ans" in
7678     none) cccdlflags=' ' ;;
7679     *) cccdlflags="$ans" ;;
7680     esac
7681
7682     cat << EOM
7683
7684 Some systems use ld to create libraries that can be dynamically loaded,
7685 while other systems (such as those using ELF) use $cc.
7686
7687 EOM
7688         case "$ld" in
7689         '')     $cat >try.c <<EOM
7690 /* Test for whether ELF binaries are produced */
7691 #include <fcntl.h>
7692 #$i_stdlib I_STDLIB
7693 #ifdef I_STDLIB
7694 #include <stdlib.h>
7695 #endif
7696 int main() {
7697         char b[4];
7698         int i = open("a.out",O_RDONLY);
7699         if(i == -1) 
7700                 exit(1); /* fail */
7701         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7702                 exit(0); /* succeed (yes, it's ELF) */
7703         else
7704                 exit(1); /* fail */
7705 }
7706 EOM
7707                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7708                         cat <<EOM
7709 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7710 EOM
7711                         dflt="$cc"
7712                 else
7713                         echo "I'll use ld to build dynamic libraries."
7714                         dflt='ld'
7715                 fi
7716                 rm -f try.c a.out
7717                 ;;
7718         *)      dflt="$ld"
7719                 ;;
7720         esac
7721
7722     rp="What command should be used to create dynamic libraries?"
7723     . ./myread
7724         ld="$ans"
7725
7726     cat << EOM
7727
7728 Some systems may require passing special flags to $ld to create a
7729 library that can be dynamically loaded.  If your ld flags include
7730 -L/other/path options to locate libraries outside your loader's normal
7731 search path, you may need to specify those -L options here as well.  To
7732 use no flags, say "none".
7733
7734 EOM
7735     case "$lddlflags" in
7736     '') case "$osname" in
7737                         beos) dflt='-nostart' ;;
7738                         hpux) dflt='-b';
7739                               case "$gccversion" in
7740                               '') dflt="$dflt +vnocompatwarnings" ;;
7741                               esac
7742                               ;;        
7743                         linux|irix*|gnu*)       dflt='-shared' ;;
7744                         next)  dflt='none' ;;
7745                         solaris) dflt='-G' ;;
7746                         sunos) dflt='-assert nodefinitions' ;;
7747                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7748                 *)     dflt='none' ;;
7749                         esac
7750                         ;;
7751     *) dflt="$lddlflags" ;;
7752     esac
7753
7754         : Try to guess additional flags to pick up local libraries.
7755         : Be careful not to append to a plain 'none'
7756         case "$dflt" in
7757         none) dflt='' ;;
7758         esac
7759         for thisflag in $ldflags; do
7760                 case "$thisflag" in
7761                 -L*|-R*|-Wl,-R*)
7762                         case " $dflt " in
7763                         *" $thisflag "*) ;;
7764                         *) dflt="$dflt $thisflag" ;;
7765                         esac
7766                         ;;
7767                 esac
7768         done
7769
7770         case "$dflt" in
7771         ''|' ') dflt='none' ;;
7772         esac
7773
7774     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7775     . ./myread
7776     case "$ans" in
7777     none) lddlflags=' ' ;;
7778     *) lddlflags="$ans" ;;
7779     esac
7780
7781         cat <<EOM
7782
7783 Some systems may require passing special flags to $cc to indicate that
7784 the resulting executable will use dynamic linking.  To use no flags,
7785 say "none".
7786
7787 EOM
7788     case "$ccdlflags" in
7789     '') case "$osname" in
7790             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7791             next|sunos) dflt='none' ;;
7792             *)          dflt='none' ;;
7793             esac ;;
7794     ' ')  dflt='none' ;;
7795     *)  dflt="$ccdlflags" ;;
7796     esac
7797     rp="Any special flags to pass to $cc to use dynamic linking?"
7798     . ./myread
7799     case "$ans" in
7800     none) ccdlflags=' ' ;;
7801     *) ccdlflags="$ans" ;;
7802     esac
7803     ;;
7804 *)  usedl="$undef"
7805         ld='ld'
7806     dlsrc='dl_none.xs'
7807     lddlflags=''
7808     ccdlflags=''
7809     ;;
7810 esac
7811
7812 also=''
7813 case "$usedl" in
7814 $undef)
7815         # No dynamic loading being used, so don't bother even to prompt.
7816         useshrplib='false'
7817         ;;
7818 *)      case "$useshrplib" in
7819         '')     case "$osname" in
7820                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7821                         dflt=y
7822                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7823                         ;;
7824                 next*)
7825                         case "$osvers" in
7826                         4*)     dflt=y
7827                                 also='Building a shared libperl is needed for MAB support.'
7828                                 ;;
7829                         *)      dflt=n
7830                                 ;;
7831                         esac
7832                         ;;
7833                 *)      dflt=n
7834                         ;;
7835                 esac
7836                 ;;
7837         $define|true|[Yy]*)
7838                 dflt=y
7839                 ;;
7840         *)      dflt=n
7841                 ;;
7842         esac
7843         $cat << EOM
7844
7845 The perl executable is normally obtained by linking perlmain.c with
7846 libperl${_a}, any static extensions (usually just DynaLoader), and
7847 any other libraries needed on this system (such as -lm, etc.).  Since
7848 your system supports dynamic loading, it is probably possible to build
7849 a shared libperl.$so.  If you will have more than one executable linked
7850 to libperl.$so, this will significantly reduce the size of each
7851 executable, but it may have a noticeable effect on performance.  The
7852 default is probably sensible for your system.
7853 $also
7854
7855 EOM
7856         rp="Build a shared libperl.$so (y/n)"
7857         . ./myread
7858         case "$ans" in
7859         true|$define|[Yy]*)
7860                 useshrplib='true'  ;;
7861         *)      useshrplib='false' ;;
7862         esac
7863         ;;
7864 esac
7865
7866 case "$useshrplib" in
7867 true)
7868         case "$libperl" in
7869         '')
7870                 # Figure out a good name for libperl.so.  Since it gets stored in
7871                 # a version-specific architecture-dependent library, the version
7872                 # number isn't really that important, except for making cc/ld happy.
7873                 #
7874                 # A name such as libperl.so.3.1
7875                 majmin="libperl.$so.$patchlevel.$subversion"
7876                 # A name such as libperl.so.301
7877                 majonly=`echo $patchlevel $subversion |
7878                         $awk '{printf "%d%02d", $1, $2}'`
7879                 majonly=libperl.$so.$majonly
7880                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7881                 # rely on figuring it out from the naming of libc.
7882                 case "${osname}${osvers}" in
7883                 next4*)
7884                         dflt=libperl.5.$so
7885                         # XXX How handle the --version stuff for MAB?
7886                         ;;
7887                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7888                         dflt=libperl.$so
7889                         ;;
7890                 cygwin*) # ld links against an importlib
7891                         dflt=libperl$lib_ext
7892                         ;;
7893                 *)      # Try to guess based on whether libc has major.minor.
7894                         case "$libc" in
7895                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7896                         *libc.$so.[0-9]*) dflt=$majonly ;;
7897                         *)      dflt=libperl.$so ;;
7898                         esac
7899                         ;;
7900                 esac
7901                 ;;
7902         *)      dflt=$libperl
7903                 ;;
7904         esac
7905         cat << EOM
7906
7907 I need to select a good name for the shared libperl.  If your system uses
7908 library names with major and minor numbers, then you might want something
7909 like $majmin.  Alternatively, if your system uses a single version
7910 number for shared libraries, then you might want to use $majonly.
7911 Or, your system might be quite happy with a simple libperl.$so.
7912
7913 Since the shared libperl will get installed into a version-specific
7914 architecture-dependent directory, the version number of the shared perl
7915 library probably isn't important, so the default should be o.k.
7916
7917 EOM
7918         rp='What name do you want to give to the shared libperl?'
7919         . ./myread
7920         libperl=$ans
7921         echo "Ok, I'll use $libperl"
7922         ;;
7923 *)
7924         libperl="libperl${_a}"
7925         ;;
7926 esac
7927
7928 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7929 case "$shrpdir" in
7930 '') ;;
7931 *)      $cat >&4 <<EOM
7932 WARNING:  Use of the shrpdir variable for the installation location of
7933 the shared $libperl is not supported.  It was never documented and
7934 will not work in this version.  Let me (perlbug@perl.org)
7935 know of any problems this may cause.
7936
7937 EOM
7938         case "$shrpdir" in
7939         "$archlibexp/CORE")
7940                 $cat >&4 <<EOM
7941 But your current setting of $shrpdir is
7942 the default anyway, so it's harmless.
7943 EOM
7944                 ;;
7945         *)
7946                 $cat >&4 <<EOM
7947 Further, your current attempted setting of $shrpdir
7948 conflicts with the value of $archlibexp/CORE
7949 that installperl will use.
7950 EOM
7951                 ;;
7952         esac
7953         ;;
7954 esac
7955
7956 # How will the perl executable find the installed shared $libperl?
7957 # Add $xxx to ccdlflags.
7958 # If we can't figure out a command-line option, use $shrpenv to
7959 # set env LD_RUN_PATH.  The main perl makefile uses this.
7960 shrpdir=$archlibexp/CORE
7961 xxx=''
7962 tmp_shrpenv=''
7963 if "$useshrplib"; then
7964     case "$osname" in 
7965         aix)
7966                 # We'll set it in Makefile.SH...
7967                 ;;
7968         solaris)
7969                 xxx="-R $shrpdir"
7970                 ;;
7971         freebsd|netbsd|openbsd|interix|dragonfly)
7972                 xxx="-Wl,-R$shrpdir"
7973                 ;;
7974         bsdos|linux|irix*|dec_osf|gnu*)
7975                 xxx="-Wl,-rpath,$shrpdir"
7976                 ;;
7977         next)
7978                 # next doesn't like the default...
7979                 ;;
7980         beos)
7981                 # beos doesn't like the default, either.
7982                 ;;
7983         hpux*)
7984                 # hpux doesn't like the default, either.
7985                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7986                 ;;
7987         *)
7988                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7989                 ;;
7990         esac
7991         case "$xxx" in
7992         '') ;;
7993         *)      
7994                 # Only add $xxx if it isn't already in ccdlflags.
7995                 case " $ccdlflags " in
7996                 *" $xxx "*)     ;;
7997                 *)      ccdlflags="$ccdlflags $xxx"
7998                         cat <<EOM >&4
7999
8000 Adding $xxx to the flags
8001 passed to $ld so that the perl executable will find the 
8002 installed shared $libperl.
8003
8004 EOM
8005                         ;;
8006                 esac
8007                 ;;
8008         esac
8009 fi
8010 # Fix ccdlflags in AIX for building external extensions.
8011 # (For building Perl itself bare -bE:perl.exp is needed,
8012 #  Makefile.SH takes care of this.)
8013 case "$osname" in
8014 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8015 esac
8016 # Respect a hint or command-line value.
8017 case "$shrpenv" in
8018 '') shrpenv="$tmp_shrpenv" ;;
8019 esac
8020 case "$ldlibpthname" in
8021 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8022 none)   ldlibpthname='' ;;
8023 esac
8024
8025 : determine where manual pages are on this system
8026 echo " "
8027 case "$sysman" in
8028 '') 
8029         syspath='/usr/share/man/man1 /usr/man/man1'
8030         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8031         syspath="$syspath /usr/man/u_man/man1"
8032         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8033         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8034         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8035         sysman=`./loc . /usr/man/man1 $syspath`
8036         ;;
8037 esac
8038 if $test -d "$sysman"; then
8039         echo "System manual is in $sysman." >&4
8040 else
8041         echo "Could not find manual pages in source form." >&4
8042 fi
8043
8044 : determine where manual pages go
8045 set man1dir man1dir none
8046 eval $prefixit
8047 $cat <<EOM
8048
8049 $spackage has manual pages available in source form.
8050 EOM
8051 case "$nroff" in
8052 nroff)
8053         echo "However, you don't have nroff, so they're probably useless to you."
8054         case "$man1dir" in
8055         '') man1dir="none";;
8056         esac;;
8057 esac
8058 echo "If you don't want the manual sources installed, answer 'none'."
8059 case "$man1dir" in
8060 ' ') dflt=none
8061         ;;
8062 '')
8063         lookpath="$prefixexp/share/man/man1"
8064         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8065         lookpath="$lookpath $prefixexp/man/p_man/man1"
8066         lookpath="$lookpath $prefixexp/man/u_man/man1"
8067         lookpath="$lookpath $prefixexp/man/man.1"
8068         case "$sysman" in
8069         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8070         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8071         esac
8072         set dflt
8073         eval $prefixup
8074         ;;
8075 *)  dflt="$man1dir"
8076         ;;
8077 esac
8078 echo " "
8079 fn=dn+~
8080 rp="Where do the main $spackage manual pages (source) go?"
8081 . ./getfile
8082 if $test "X$man1direxp" != "X$ansexp"; then
8083         installman1dir=''
8084 fi
8085 prefixvar=man1dir
8086 . ./setprefixvar
8087
8088 case "$man1dir" in
8089 '')     man1dir=' '
8090         installman1dir='';;
8091 esac
8092
8093 : What suffix to use on installed man pages
8094
8095 case "$man1dir" in
8096 ' ')
8097         man1ext='0'
8098         ;;
8099 *)
8100         rp="What suffix should be used for the main $spackage man pages?"
8101         case "$man1ext" in
8102         '')     case "$man1dir" in
8103                 *1)  dflt=1 ;;
8104                 *1p) dflt=1p ;;
8105                 *1pm) dflt=1pm ;;
8106                 *l) dflt=l;;
8107                 *n) dflt=n;;
8108                 *o) dflt=o;;
8109                 *p) dflt=p;;
8110                 *C) dflt=C;;
8111                 *L) dflt=L;;
8112                 *L1) dflt=L1;;
8113                 *) dflt=1;;
8114                 esac
8115                 ;;
8116         *)      dflt="$man1ext";;
8117         esac
8118         . ./myread
8119         man1ext="$ans"
8120         ;;
8121 esac
8122
8123 : see if we can have long filenames
8124 echo " "
8125 first=123456789abcdef
8126 $rm -f $first
8127 if (echo hi >$first) 2>/dev/null; then
8128         if $test -f 123456789abcde; then
8129                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8130                 val="$undef"
8131         else
8132                 echo 'You can have filenames longer than 14 characters.'>&4
8133                 val="$define"
8134         fi
8135 else
8136         $cat <<'EOM'
8137 You can't have filenames longer than 14 chars.
8138 You can't even think about them!
8139 EOM
8140         val="$undef"
8141 fi 
8142 set d_flexfnam
8143 eval $setvar
8144 $rm -rf 123456789abcde*
8145
8146 : determine where library module manual pages go
8147 set man3dir man3dir none
8148 eval $prefixit
8149 $cat <<EOM
8150
8151 $spackage has manual pages for many of the library modules.
8152 EOM
8153
8154 case "$nroff" in
8155 nroff)
8156         $cat <<'EOM'
8157 However, you don't have nroff, so they're probably useless to you.
8158 EOM
8159         case "$man3dir" in
8160         '') man3dir="none";;
8161         esac;;
8162 esac
8163
8164 case "$d_flexfnam" in
8165 undef)
8166         $cat <<'EOM'
8167 However, your system can't handle the long file names like File::Basename.3.
8168 EOM
8169         case "$man3dir" in
8170         '') man3dir="none";;
8171         esac;;
8172 esac
8173
8174 echo "If you don't want the manual sources installed, answer 'none'."
8175 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8176 case "$man3dir" in
8177 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8178         if $test -d "$privlib/man/man3"; then
8179                 cat <<EOM >&4
8180
8181 WARNING:  Previous versions of perl installed man3 pages into
8182 $privlib/man/man3.  This version will suggest a
8183 new default of $dflt.
8184 EOM
8185                 tdflt=$dflt
8186                 dflt='n'
8187                 rp='Do you wish to preserve the old behavior?(y/n)'
8188                 . ./myread
8189                 case "$ans" in
8190                 y*) dflt="$privlib/man/man3" ;;
8191                 *)  dflt=$tdflt ;;
8192                 esac
8193     fi
8194         ;;
8195 *)      dflt="$man3dir" ;;
8196 esac
8197 case "$dflt" in
8198 ' ') dflt=none ;;
8199 esac
8200 echo " "
8201 fn=dn+~
8202 rp="Where do the $package library man pages (source) go?"
8203 . ./getfile
8204 prefixvar=man3dir
8205 . ./setprefixvar
8206
8207 case "$man3dir" in
8208 '')     man3dir=' '
8209         installman3dir='';;
8210 esac
8211
8212 : What suffix to use on installed man pages
8213 case "$man3dir" in
8214 ' ')
8215         man3ext='0'
8216         ;;
8217 *)
8218         rp="What suffix should be used for the $package library man pages?"
8219         case "$man3ext" in
8220         '')     case "$man3dir" in
8221                 *3)  dflt=3 ;;
8222                 *3p) dflt=3p ;;
8223                 *3pm) dflt=3pm ;;
8224                 *l) dflt=l;;
8225                 *n) dflt=n;;
8226                 *o) dflt=o;;
8227                 *p) dflt=p;;
8228                 *C) dflt=C;;
8229                 *L) dflt=L;;
8230                 *L3) dflt=L3;;
8231                 *) dflt=3;;
8232                 esac
8233                 ;;
8234         *)      dflt="$man3ext";;
8235         esac
8236         . ./myread
8237         man3ext="$ans"
8238         ;;
8239 esac
8240
8241 : see if we have to deal with yellow pages, now NIS.
8242 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8243         if $test -f /usr/etc/nibindd; then
8244                 echo " "
8245                 echo "I'm fairly confident you're on a NeXT."
8246                 echo " "
8247                 rp='Do you get the hosts file via NetInfo?'
8248                 dflt=y
8249                 case "$hostcat" in
8250                 nidump*) ;;
8251                 '') ;;
8252                 *) dflt=n;;
8253                 esac
8254                 . ./myread
8255                 case "$ans" in
8256                 y*) hostcat='nidump hosts .';;
8257                 *)      case "$hostcat" in
8258                         nidump*) hostcat='';;
8259                         esac
8260                         ;;
8261                 esac
8262         fi
8263         case "$hostcat" in
8264         nidump*) ;;
8265         *)
8266                 case "$hostcat" in
8267                 *ypcat*) dflt=y;;
8268                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8269                                 dflt=y
8270                         else
8271                                 dflt=n
8272                         fi;;
8273                 *) dflt=n;;
8274                 esac
8275                 echo " "
8276                 rp='Are you getting the hosts file via yellow pages?'
8277                 . ./myread
8278                 case "$ans" in
8279                 y*) hostcat='ypcat hosts';;
8280                 *) hostcat='cat /etc/hosts';;
8281                 esac
8282                 ;;
8283         esac
8284 fi
8285 case "$hostcat" in
8286 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8287 esac
8288 case "$groupcat" in
8289 '') test -f /etc/group && groupcat='cat /etc/group';;
8290 esac
8291 case "$passcat" in
8292 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8293 esac
8294
8295 : now get the host name
8296 echo " "
8297 echo "Figuring out host name..." >&4
8298 case "$myhostname" in
8299 '') cont=true
8300         echo 'Maybe "hostname" will work...'
8301         if tans=`sh -c hostname 2>&1` ; then
8302                 myhostname=$tans
8303                 phostname=hostname
8304                 cont=''
8305         fi
8306         ;;
8307 *) cont='';;
8308 esac
8309 if $test "$cont"; then
8310         if ./xenix; then
8311                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8312                 if tans=`cat /etc/systemid 2>&1` ; then
8313                         myhostname=$tans
8314                         phostname='cat /etc/systemid'
8315                         echo "Whadyaknow.  Xenix always was a bit strange..."
8316                         cont=''
8317                 fi
8318         elif $test -r /etc/systemid; then
8319                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8320         fi
8321 fi
8322 if $test "$cont"; then
8323         echo 'No, maybe "uuname -l" will work...'
8324         if tans=`sh -c 'uuname -l' 2>&1` ; then
8325                 myhostname=$tans
8326                 phostname='uuname -l'
8327         else
8328                 echo 'Strange.  Maybe "uname -n" will work...'
8329                 if tans=`sh -c 'uname -n' 2>&1` ; then
8330                         myhostname=$tans
8331                         phostname='uname -n'
8332                 else
8333                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8334                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8335                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8336                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8337                         else
8338                                 case "$myhostname" in
8339                                 '') echo "Does this machine have an identity crisis or something?"
8340                                         phostname='';;
8341                                 *)
8342                                         echo "Well, you said $myhostname before..."
8343                                         phostname='echo $myhostname';;
8344                                 esac
8345                         fi
8346                 fi
8347         fi
8348 fi
8349 case "$myhostname" in
8350 '') myhostname=noname ;;
8351 esac
8352 : you do not want to know about this
8353 set $myhostname
8354 myhostname=$1
8355
8356 : verify guess
8357 if $test "$myhostname" ; then
8358         dflt=y
8359         rp='Your host name appears to be "'$myhostname'".'" Right?"
8360         . ./myread
8361         case "$ans" in
8362         y*) ;;
8363         *) myhostname='';;
8364         esac
8365 fi
8366
8367 : bad guess or no guess
8368 while $test "X$myhostname" = X ; do
8369         dflt=''
8370         rp="Please type the (one word) name of your host:"
8371         . ./myread
8372         myhostname="$ans"
8373 done
8374
8375 : translate upper to lower if necessary
8376 case "$myhostname" in
8377 *[A-Z]*)
8378         echo "(Normalizing case in your host name)"
8379         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8380         ;;
8381 esac
8382
8383 case "$myhostname" in
8384 *.*)
8385         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8386         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8387         echo "(Trimming domain name from host name--host name is now $myhostname)"
8388         ;;
8389 *) case "$mydomain" in
8390         '')
8391                 {
8392                         test "X$hostcat" = "Xypcat hosts" &&
8393                         ypmatch "$myhostname" hosts 2>/dev/null |\
8394                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8395                         $test -s hosts
8396                 } || {
8397                         test "X$hostcat" != "X" &&
8398                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8399                                         /[       ]$myhostname[  . ]/p" > hosts
8400                 }
8401                 tmp_re="[       . ]"
8402                 if $test -f hosts; then
8403                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8404                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8405                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8406                                 hosts | $sort | $uniq | \
8407                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8408                         case `$echo X$dflt` in
8409                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8410                                 dflt=.
8411                                 ;;
8412                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8413                                 ;;
8414                         esac
8415                 else
8416                         echo "(I cannot locate a hosts database anywhere)"
8417                         dflt=.
8418                 fi
8419                 case "$dflt" in
8420                 .)
8421                         tans=`./loc resolv.conf X /etc /usr/etc`
8422                         if $test -f "$tans"; then
8423                                 echo "(Attempting domain name extraction from $tans)"
8424                                 dflt=.`$sed -n -e 's/   / /g' \
8425                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8426                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8427                                 case "$dflt" in
8428                                 .) dflt=.`$sed -n -e 's/        / /g' \
8429                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8430                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8431                                         ;;
8432                                 esac
8433                         fi
8434                         ;;
8435                 esac
8436                 case "$dflt" in
8437                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8438                         dflt=.`sh -c domainname 2>/dev/null`
8439                         case "$dflt" in
8440                         '') dflt='.';;
8441                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8442                         esac
8443                         ;;
8444                 esac
8445                 case "$dflt$osname" in
8446                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8447                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8448                         ;;
8449                 esac
8450                 case "$dflt" in
8451                 .) echo "(Lost all hope -- silly guess then)"
8452                         dflt='.nonet'
8453                         ;;
8454                 esac
8455                 $rm -f hosts
8456                 ;;
8457         *) dflt="$mydomain";;
8458         esac;;
8459 esac
8460 echo " "
8461 rp="What is your domain name?"
8462 . ./myread
8463 tans="$ans"
8464 case "$ans" in
8465 '') ;;
8466 .*) ;;
8467 *) tans=".$tans";;
8468 esac
8469 mydomain="$tans"
8470
8471 : translate upper to lower if necessary
8472 case "$mydomain" in
8473 *[A-Z]*)
8474         echo "(Normalizing case in your domain name)"
8475         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8476         ;;
8477 esac
8478
8479 : a little sanity check here
8480 case "$phostname" in
8481 '') ;;
8482 *)
8483         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8484         $myhostname$mydomain|$myhostname) ;;
8485         *)
8486                 case "$phostname" in
8487                 sed*)
8488                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8489                         ;;
8490                 *)
8491                         echo "(That doesn't agree with your $phostname command, by the way.)"
8492                         ;;
8493                 esac
8494         ;;
8495         esac
8496         ;;
8497 esac
8498
8499 $cat <<EOM
8500
8501 I need to get your e-mail address in Internet format if possible, i.e.
8502 something like user@host.domain. Please answer accurately since I have
8503 no easy means to double check it. The default value provided below
8504 is most probably close to reality but may not be valid from outside
8505 your organization...
8506
8507 EOM
8508 cont=x
8509 while test "$cont"; do
8510         case "$cf_email" in
8511         '') dflt="$cf_by@$myhostname$mydomain";;
8512         *) dflt="$cf_email";;
8513         esac
8514         rp='What is your e-mail address?'
8515         . ./myread
8516         cf_email="$ans"
8517         case "$cf_email" in
8518         *@*.*) cont='' ;;
8519         *)
8520                 rp='Address does not look like an Internet one.  Use it anyway?'
8521                 case "$fastread" in
8522                 yes) dflt=y ;;
8523                 *) dflt=n ;;
8524                 esac
8525                 . ./myread
8526                 case "$ans" in
8527                 y*) cont='' ;;
8528                 *) echo " " ;;
8529                 esac
8530                 ;;
8531         esac
8532 done
8533
8534 $cat <<EOM
8535
8536 If you or somebody else will be maintaining perl at your site, please
8537 fill in the correct e-mail address here so that they may be contacted
8538 if necessary. Currently, the "perlbug" program included with perl
8539 will send mail to this address in addition to perlbug@perl.org. You may
8540 enter "none" for no administrator.
8541
8542 EOM
8543 case "$perladmin" in
8544 '') dflt="$cf_email";;
8545 *) dflt="$perladmin";;
8546 esac
8547 rp='Perl administrator e-mail address'
8548 . ./myread
8549 perladmin="$ans"
8550
8551 : determine whether to only install version-specific parts.
8552 echo " "
8553 $cat <<EOM
8554 Do you want to install only the version-specific parts of the perl
8555 distribution?  Usually you do *not* want to do this.
8556 EOM
8557 case "$versiononly" in
8558 "$define"|[Yy]*|true) dflt='y' ;;
8559 *) dflt='n';
8560 esac
8561 rp="Do you want to install only the version-specific parts of perl?"
8562 . ./myread
8563 case "$ans" in
8564 [yY]*)  val="$define";;
8565 *)      val="$undef" ;;
8566 esac
8567 set versiononly
8568 eval $setvar
8569
8570 case "$versiononly" in
8571 "$define") inc_version_list=''
8572            inc_version_list_init=0
8573            ;;
8574 esac
8575
8576 : figure out how to guarantee perl startup
8577 : XXX Note that this currently takes advantage of the bug that binexp ignores
8578 :     the Configure -Dinstallprefix setting, which in turn means that under
8579 :     relocatable @INC, initialinstalllocation is what binexp started as.
8580 case "$startperl" in
8581 '')
8582         case "$sharpbang" in
8583         *!)
8584                 $cat <<EOH
8585
8586 I can use the #! construct to start perl on your system. This will
8587 make startup of perl scripts faster, but may cause problems if you
8588 want to share those scripts and perl is not in a standard place
8589 ($initialinstalllocation/perl) on all your platforms. The alternative
8590 is to force a shell by starting the script with a single ':' character.
8591
8592 EOH
8593                 case "$versiononly" in
8594                 "$define")      dflt="$initialinstalllocation/perl$version";;
8595                 *)              dflt="$initialinstalllocation/perl";;
8596                 esac
8597                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8598                 . ./myread
8599                 case "$ans" in
8600                 none)   startperl=": # use perl";;
8601                 *)      startperl="#!$ans"
8602                         if $test 30 -lt `echo "$ans" | wc -c`; then
8603                                 $cat >&4 <<EOM
8604
8605 WARNING:  Some systems limit the #! command to 32 characters.
8606 If you experience difficulty running Perl scripts with #!, try
8607 installing Perl in a directory with a shorter pathname.
8608
8609 EOM
8610                         fi ;;
8611                 esac
8612                 ;;
8613         *) startperl=": # use perl"
8614                 ;;
8615         esac
8616         ;;
8617 esac
8618 echo "I'll use $startperl to start perl scripts."
8619
8620 : figure best path for perl in scripts
8621 case "$perlpath" in
8622 '')
8623         case "$versiononly" in
8624         "$define")      perlpath="$initialinstalllocation/perl$version";;
8625         *)              perlpath="$initialinstalllocation/perl";;
8626         esac
8627         case "$startperl" in
8628         *!*) ;;
8629         *)
8630                 $cat <<EOH
8631
8632 I will use the "eval 'exec'" idiom to start Perl on your system.
8633 I can use the full path of your Perl binary for this purpose, but
8634 doing so may cause problems if you want to share those scripts and
8635 Perl is not always in a standard place ($initialinstalllocation/perl).
8636
8637 EOH
8638                 dflt="$initialinstalllocation/perl"
8639                 rp="What path shall I use in \"eval 'exec'\"?"
8640                 . ./myread
8641                 perlpath="$ans"
8642                 ;;
8643         esac
8644         ;;
8645 esac
8646 case "$startperl" in
8647 *!*)    ;;
8648 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8649 esac
8650
8651 : determine where public executable scripts go
8652 set scriptdir scriptdir
8653 eval $prefixit
8654 case "$scriptdir" in
8655 '')
8656         dflt="$bin"
8657         : guess some guesses
8658         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8659         $test -d /usr/share/bin     && dflt=/usr/share/bin
8660         $test -d /usr/local/script  && dflt=/usr/local/script
8661         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8662         $test -d $prefixexp/script  && dflt=$prefixexp/script
8663         set dflt
8664         eval $prefixup
8665         ;;
8666 *)  dflt="$scriptdir"
8667         ;;
8668 esac
8669 $cat <<EOM
8670
8671 Some installations have a separate directory just for executable scripts so
8672 that they can mount it across multiple architectures but keep the scripts in
8673 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8674 Or you might just lump your scripts in with all your other executables.
8675
8676 EOM
8677 fn=d~
8678 rp='Where do you keep publicly executable scripts?'
8679 . ./getfile
8680 if $test "X$ansexp" != "X$scriptdirexp"; then
8681         installscript=''
8682 fi
8683 installscriptdir=''
8684 prefixvar=scriptdir
8685 . ./setprefixvar
8686 : A little fix up for an irregularly named variable.
8687 installscript="$installscriptdir"
8688
8689 : determine where add-on public executables go
8690 case "$sitebin" in
8691 '')     dflt=$siteprefix/bin ;;
8692 *)      dflt=$sitebin ;;
8693 esac
8694 fn=d~
8695 rp='Pathname where the add-on public executables should be installed?'
8696 . ./getfile
8697 prefixvar=sitebin
8698 . ./setprefixvar
8699
8700 : determine where add-on html pages go
8701 : There is no standard location, so try to copy the previously-selected
8702 : directory structure for the core html pages.
8703 case "$sitehtml1dir" in
8704 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8705 *)     dflt=$sitehtml1dir ;;
8706 esac
8707 case "$dflt" in
8708 ''|' ') dflt=none ;;
8709 esac
8710 fn=dn+~
8711 rp='Pathname where the site-specific html pages should be installed?'
8712 . ./getfile
8713 prefixvar=sitehtml1dir
8714 . ./setprefixvar
8715
8716 : determine where add-on library html pages go
8717 : There is no standard location, so try to copy the previously-selected
8718 : directory structure for the core html pages.
8719 case "$sitehtml3dir" in
8720 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8721 *)     dflt=$sitehtml3dir ;;
8722 esac
8723 case "$dflt" in
8724 ''|' ') dflt=none ;;
8725 esac
8726 fn=dn+~
8727 rp='Pathname where the site-specific library html pages should be installed?'
8728 . ./getfile
8729 prefixvar=sitehtml3dir
8730 . ./setprefixvar
8731
8732 : determine where add-on manual pages go
8733 case "$siteman1dir" in
8734 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8735 *)      dflt=$siteman1dir ;;
8736 esac
8737 case "$dflt" in
8738 ''|' ') dflt=none ;;
8739 esac
8740 fn=dn+~
8741 rp='Pathname where the site-specific manual pages should be installed?'
8742 . ./getfile
8743 prefixvar=siteman1dir
8744 . ./setprefixvar
8745
8746 : determine where add-on library man pages go
8747 case "$siteman3dir" in
8748 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8749 *)      dflt=$siteman3dir ;;
8750 esac
8751 case "$dflt" in
8752 ''|' ') dflt=none ;;
8753 esac
8754 fn=dn+~
8755 rp='Pathname where the site-specific library manual pages should be installed?'
8756 . ./getfile
8757 prefixvar=siteman3dir
8758 . ./setprefixvar
8759
8760 : determine where add-on public executable scripts go
8761 case "$sitescript" in
8762 '')     dflt=$siteprefix/script
8763         $test -d $dflt || dflt=$sitebin ;;
8764 *)  dflt="$sitescript" ;;
8765 esac
8766 fn=d~+
8767 rp='Pathname where add-on public executable scripts should be installed?'
8768 . ./getfile
8769 prefixvar=sitescript
8770 . ./setprefixvar
8771
8772 case "$usefaststdio" in
8773 $define|true|[yY]*|'')
8774         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8775         case "$xversion" in
8776         [68])   dflt='y' ;;
8777         *)      dflt='n' ;;
8778         esac
8779         ;;
8780 *) dflt='n';;
8781 esac
8782 cat <<EOM
8783
8784 Perl can be built to use 'fast stdio', which means using the stdio
8785 library but also directly manipulating the stdio buffers to enable
8786 faster I/O.  Using stdio is better for backward compatibility (especially
8787 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8788 interface has been preferred instead of stdio.
8789
8790 If this doesn't make any sense to you, just accept the default '$dflt'.
8791 EOM
8792 rp='Use the "fast stdio" if available?'
8793 . ./myread
8794 case "$ans" in
8795 y|Y)    val="$define" ;;     
8796 *)      val="$undef" ;;
8797 esac
8798 set usefaststdio
8799 eval $setvar
8800
8801
8802 : define an is-a-typedef? function
8803 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8804 case "$inclist" in
8805 "") inclist="sys/types.h";;
8806 esac;
8807 eval "varval=\$$var";
8808 case "$varval" in
8809 "")
8810         $rm -f temp.c;
8811         for inc in $inclist; do
8812                 echo "#include <$inc>" >>temp.c;
8813         done;
8814         echo "#ifdef $type" >> temp.c;
8815         echo "printf(\"We have $type\");" >> temp.c;
8816         echo "#endif" >> temp.c;
8817         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8818         if $contains $type temp.E >/dev/null 2>&1; then
8819                 eval "$var=\$type";
8820         else
8821                 eval "$var=\$def";
8822         fi;
8823         $rm -f temp.?;;
8824 *) eval "$var=\$varval";;
8825 esac'
8826
8827 : define an is-a-typedef? function that prompts if the type is not available.
8828 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8829 case "$inclist" in
8830 "") inclist="sys/types.h";;
8831 esac;
8832 eval "varval=\$$var";
8833 case "$varval" in
8834 "")
8835         $rm -f temp.c;
8836         for inc in $inclist; do
8837                 echo "#include <$inc>" >>temp.c;
8838         done;
8839         echo "#ifdef $type" >> temp.c;
8840         echo "printf(\"We have $type\");" >> temp.c;
8841         echo "#endif" >> temp.c;
8842         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8843         echo " " ;
8844         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8845         if $contains $type temp.E >/dev/null 2>&1; then
8846                 echo "$type found." >&4;
8847                 eval "$var=\$type";
8848         else
8849                 echo "$type NOT found." >&4;
8850                 dflt="$def";
8851                 . ./myread ;
8852                 eval "$var=\$ans";
8853         fi;
8854         $rm -f temp.?;;
8855 *) eval "$var=\$varval";;
8856 esac'
8857
8858 : see what type lseek is declared as in the kernel
8859 rp="What is the type used for lseek's offset on this system?"
8860 set off_t lseektype long stdio.h sys/types.h
8861 eval $typedef_ask
8862
8863 echo " "
8864 echo "Checking to see how big your file offsets are..." >&4
8865 $cat >try.c <<EOCP
8866 #include <sys/types.h>
8867 #include <stdio.h>
8868 int main()
8869 {
8870     printf("%d\n", (int)sizeof($lseektype));
8871     return(0); 
8872 }
8873 EOCP
8874 set try
8875 if eval $compile_ok; then
8876         lseeksize=`$run ./try`
8877         echo "Your file offsets are $lseeksize bytes long."
8878 else
8879         dflt=$longsize
8880         echo " "
8881         echo "(I can't seem to compile the test program.  Guessing...)"
8882         rp="What is the size of your file offsets (in bytes)?"
8883         . ./myread
8884         lseeksize="$ans"
8885 fi
8886 $rm -f try.c try
8887
8888 : see what type file positions are declared as in the library
8889 rp="What is the type for file position used by fsetpos()?"
8890 set fpos_t fpostype long stdio.h sys/types.h
8891 eval $typedef_ask
8892
8893 echo " "
8894 case "$fpostype" in
8895 *_t) zzz="$fpostype"    ;;
8896 *)   zzz="fpos_t"       ;;
8897 esac
8898 echo "Checking the size of $zzz..." >&4 
8899 cat > try.c <<EOCP
8900 #include <sys/types.h>
8901 #include <stdio.h>
8902 #$i_stdlib I_STDLIB
8903 #ifdef I_STDLIB
8904 #include <stdlib.h>
8905 #endif
8906 int main() {
8907     printf("%d\n", (int)sizeof($fpostype));
8908     exit(0);
8909 }
8910 EOCP
8911 set try
8912 if eval $compile_ok; then
8913         yyy=`$run ./try`
8914         case "$yyy" in
8915         '')     fpossize=4
8916                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8917                 ;;
8918         *)      fpossize=$yyy
8919                 echo "Your $zzz is $fpossize bytes long."
8920                 ;;
8921         esac
8922 else
8923         dflt="$longsize"
8924         echo " " >&4
8925         echo "(I can't compile the test program.  Guessing...)" >&4
8926         rp="What is the size of your file positions (in bytes)?"
8927         . ./myread
8928         fpossize="$ans"
8929 fi
8930
8931 # Backward compatibility (uselfs is deprecated).
8932 case "$uselfs" in
8933 "$define"|true|[yY]*)
8934         cat <<EOM >&4
8935
8936 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8937 EOM
8938         uselargefiles="$define"
8939         ;;
8940 esac                          
8941
8942 case "$lseeksize:$fpossize" in
8943 8:8) cat <<EOM
8944
8945 You can have files larger than 2 gigabytes.
8946 EOM
8947    val="$define" ;;
8948 *)    case "$uselargefiles" in
8949    "$undef"|false|[nN]*) dflt='n' ;;
8950    *)   dflt='y' ;;
8951    esac
8952    cat <<EOM
8953
8954 Perl can be built to understand large files (files larger than 2 gigabytes)
8955 on some systems.  To do so, Configure can be run with -Duselargefiles.
8956
8957 If this doesn't make any sense to you, just accept the default '$dflt'.
8958 EOM
8959    rp='Try to understand large files, if available?'
8960    . ./myread
8961    case "$ans" in
8962    y|Y)         val="$define" ;;
8963    *)           val="$undef"  ;;
8964    esac
8965    ;;
8966 esac
8967 set uselargefiles
8968 eval $setvar
8969 : Look for a hint-file generated 'call-back-unit'.  If the
8970 : user has specified that a large files perl is to be built,
8971 : we may need to set or change some other defaults.
8972 if $test -f uselargefiles.cbu; then
8973         echo "Your platform has some specific hints regarding large file builds, using them..."
8974         . ./uselargefiles.cbu
8975 fi
8976 case "$uselargefiles" in
8977 "$define")
8978         if $test -f uselargefiles.cbu; then
8979                 echo " "
8980                 echo "Rechecking to see how big your file offsets are..." >&4
8981                 $cat >try.c <<EOCP
8982 #include <sys/types.h>
8983 #include <stdio.h>
8984 int main()
8985 {
8986     printf("%d\n", (int)sizeof($lseektype));
8987     return(0); 
8988 }
8989 EOCP
8990                 set try
8991                 if eval $compile_ok; then
8992                         lseeksize=`$run ./try`
8993                         $echo "Your file offsets are now $lseeksize bytes long."
8994                 else
8995                         dflt="$lseeksize"
8996                         echo " "
8997                         echo "(I can't seem to compile the test program.  Guessing...)"
8998                         rp="What is the size of your file offsets (in bytes)?"
8999                         . ./myread
9000                         lseeksize="$ans"
9001                 fi
9002                 case "$fpostype" in
9003                 *_t) zzz="$fpostype"    ;;
9004                 *)   zzz="fpos_t"       ;;
9005                 esac
9006                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9007                 $cat > try.c <<EOCP
9008 #include <sys/types.h>
9009 #include <stdio.h>
9010 #$i_stdlib I_STDLIB
9011 #ifdef I_STDLIB
9012 #include <stdlib.h>
9013 #endif
9014 int main() {
9015     printf("%d\n", (int)sizeof($fpostype));
9016     return(0);
9017 }
9018 EOCP
9019                 set try
9020                 if eval $compile_ok; then
9021                         yyy=`$run ./try`
9022                         dflt="$lseeksize"
9023                         case "$yyy" in
9024                         '')     echo " "
9025                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9026                                 ;;
9027                         *)      fpossize=$yyy
9028                                 echo " $fpossize bytes." >&4
9029                                 ;;
9030                         esac
9031                 else
9032                         dflt="$fpossize"
9033                         echo " "
9034                         echo "(I can't compile the test program.  Guessing...)" >&4
9035                         rp="What is the size of your file positions (in bytes)?"
9036                         . ./myread
9037                         fpossize="$ans"
9038                 fi
9039                 $rm -f try.c try
9040         fi
9041         ;;
9042 esac
9043
9044 case "$vendorprefix" in
9045 '')     d_vendorbin="$undef"
9046         vendorbin=''
9047         vendorbinexp=''
9048         ;;
9049 *)      d_vendorbin="$define"
9050         : determine where vendor-supplied executables go.
9051         case "$vendorbin" in
9052         '') dflt=$vendorprefix/bin ;;
9053         *)      dflt="$vendorbin" ;;
9054         esac
9055         fn=d~+
9056         rp='Pathname for the vendor-supplied executables directory?'
9057         . ./getfile
9058         vendorbin="$ans"
9059         vendorbinexp="$ansexp"
9060         ;;
9061 esac
9062 prefixvar=vendorbin
9063 . ./installprefix
9064
9065 case "$vendorprefix" in
9066 '')     vendorhtml1dir=''
9067         vendorhtml1direxp=''
9068         ;;
9069 *)      : determine where vendor-supplied html pages go.
9070         : There is no standard location, so try to copy the previously-selected
9071         : directory structure for the core html pages.
9072         : XXX Better default suggestions would be welcome.
9073         case "$vendorhtml1dir" in
9074         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9075         *)      dflt=$vendorhtml1dir ;;
9076         esac
9077         case "$dflt" in
9078         ''|' ') dflt=none ;;
9079         esac
9080         fn=dn+~
9081         rp='Pathname for the vendor-supplied html pages?'
9082         . ./getfile
9083         vendorhtml1dir="$ans"
9084         vendorhtml1direxp="$ansexp"
9085         ;;
9086 esac
9087 : Use ' ' for none so value is preserved next time through Configure
9088 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9089 prefixvar=vendorhtml1dir
9090 . ./installprefix
9091
9092 case "$vendorprefix" in
9093 '')     vendorhtml3dir=''
9094         vendorhtml3direxp=''
9095         ;;
9096 *)      : determine where vendor-supplied module html pages go.
9097         : There is no standard location, so try to copy the previously-selected
9098         : directory structure for the core html pages.
9099         : XXX Better default suggestions would be welcome.
9100         case "$vendorhtml3dir" in
9101         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9102         *)      dflt=$vendorhtml3dir ;;
9103         esac
9104         case "$dflt" in
9105         ''|' ') dflt=none ;;
9106         esac
9107         fn=dn+~
9108         rp='Pathname for the vendor-supplied html pages?'
9109         . ./getfile
9110         vendorhtml3dir="$ans"
9111         vendorhtml3direxp="$ansexp"
9112         ;;
9113 esac
9114 : Use ' ' for none so value is preserved next time through Configure
9115 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9116 prefixvar=vendorhtml3dir
9117 . ./installprefix
9118
9119 case "$vendorprefix" in
9120 '')     vendorman1dir=''
9121         vendorman1direxp=''
9122         ;;
9123 *)      : determine where vendor-supplied manual pages go.
9124         case "$vendorman1dir" in
9125         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9126         *)      dflt=$vendorman1dir ;;
9127         esac
9128         case "$dflt" in
9129         ''|' ') dflt=none ;;
9130         esac
9131         fn=nd~+
9132         rp='Pathname for the vendor-supplied manual section 1 pages?'
9133         . ./getfile
9134         vendorman1dir="$ans"
9135         vendorman1direxp="$ansexp"
9136         ;;
9137 esac
9138 : Use ' ' for none so value is preserved next time through Configure
9139 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9140 prefixvar=vendorman1dir
9141 . ./installprefix
9142
9143 case "$vendorprefix" in
9144 '')     vendorman3dir=''
9145         vendorman3direxp=''
9146         ;;
9147 *)      : determine where vendor-supplied module manual pages go.
9148         case "$vendorman3dir" in
9149         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9150         *)      dflt=$vendorman3dir ;;
9151         esac
9152         case "$dflt" in
9153         ''|' ') dflt=none ;;
9154         esac
9155         fn=nd~+
9156         rp='Pathname for the vendor-supplied manual section 3 pages?'
9157         . ./getfile
9158         vendorman3dir="$ans"
9159         vendorman3direxp="$ansexp"
9160         ;;
9161 esac
9162 : Use ' ' for none so value is preserved next time through Configure
9163 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9164 prefixvar=vendorman3dir
9165 . ./installprefix
9166
9167 case "$vendorprefix" in
9168 '')     d_vendorscript="$undef"
9169         vendorscript=''
9170         vendorscriptexp=''
9171         ;;
9172 *)      d_vendorscript="$define"
9173         : determine where vendor-supplied scripts go.
9174         case "$vendorscript" in
9175         '')     dflt=$vendorprefix/script
9176                 $test -d $dflt || dflt=$vendorbin ;;
9177         *)  dflt="$vendorscript" ;;
9178         esac
9179         $cat <<EOM
9180
9181 The installation process will create a directory for
9182 vendor-supplied scripts.
9183
9184 EOM
9185         fn=d~+
9186         rp='Pathname for the vendor-supplied scripts directory?'
9187         . ./getfile
9188         vendorscript="$ans"
9189         vendorscriptexp="$ansexp"
9190         ;;
9191 esac
9192 prefixvar=vendorscript
9193 . ./installprefix
9194
9195 : see if qgcvt exists
9196 set qgcvt d_qgcvt
9197 eval $inlibc
9198
9199 echo " "
9200
9201 if $test X"$d_longdbl" = X"$define"; then
9202
9203 echo "Checking how to print long doubles..." >&4
9204
9205 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9206         $cat >try.c <<'EOCP'
9207 #include <sys/types.h>
9208 #include <stdio.h>
9209 int main() {
9210   double d = 123.456;
9211   printf("%.3f\n", d);
9212 }
9213 EOCP
9214         set try
9215         if eval $compile; then
9216                 yyy=`$run ./try`
9217                 case "$yyy" in
9218                 123.456)
9219                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9220                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9221                         echo "We will use %f."
9222                         ;;
9223                 esac
9224         fi
9225 fi
9226
9227 if $test X"$sPRIfldbl" = X; then
9228         $cat >try.c <<'EOCP'
9229 #include <sys/types.h>
9230 #include <stdio.h>
9231 int main() {
9232   long double d = 123.456;
9233   printf("%.3Lf\n", d);
9234 }
9235 EOCP
9236         set try
9237         if eval $compile; then
9238                 yyy=`$run ./try`
9239                 case "$yyy" in
9240                 123.456)
9241                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9242                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9243                         echo "We will use %Lf."
9244                         ;;
9245                 esac
9246         fi
9247 fi
9248
9249 if $test X"$sPRIfldbl" = X; then
9250         $cat >try.c <<'EOCP'
9251 #include <sys/types.h>
9252 #include <stdio.h>
9253 int main() {
9254   long double d = 123.456;
9255   printf("%.3llf\n", d);
9256 }
9257 EOCP
9258         set try
9259         if eval $compile; then
9260                 yyy=`$run ./try`
9261                 case "$yyy" in
9262                 123.456)
9263                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9264                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9265                         echo "We will use %llf."
9266                         ;;
9267                 esac
9268         fi
9269 fi
9270
9271 if $test X"$sPRIfldbl" = X; then
9272         $cat >try.c <<'EOCP'
9273 #include <sys/types.h>
9274 #include <stdio.h>
9275 int main() {
9276   long double d = 123.456;
9277   printf("%.3lf\n", d);
9278 }
9279 EOCP
9280         set try
9281         if eval $compile; then
9282                 yyy=`$run ./try`
9283                 case "$yyy" in
9284                 123.456)
9285                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9286                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9287                         echo "We will use %lf."
9288                         ;;
9289                 esac
9290         fi
9291 fi
9292
9293 if $test X"$sPRIfldbl" = X; then
9294         echo "Cannot figure out how to print long doubles." >&4
9295 else
9296         sSCNfldbl=$sPRIfldbl    # expect consistency
9297 fi
9298
9299 $rm -f try try.*
9300
9301 fi # d_longdbl
9302
9303 case "$sPRIfldbl" in
9304 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9305         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9306         d_SCNfldbl="$undef";
9307         ;;
9308 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9309         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9310         d_SCNfldbl="$define";
9311         ;;
9312 esac
9313
9314 : Check how to convert floats to strings.
9315
9316 if test "X$d_Gconvert" = X; then
9317
9318 echo " "
9319 echo "Checking for an efficient way to convert floats to strings."
9320 echo " " > try.c
9321 case "$uselongdouble" in
9322 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9323 esac
9324 case "$d_longdbl" in
9325 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9326 esac
9327 case "$d_PRIgldbl" in
9328 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9329 esac
9330 $cat >>try.c <<EOP
9331 #ifdef TRY_gconvert
9332 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9333 char *myname = "gconvert";
9334 #endif
9335 #ifdef TRY_gcvt
9336 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9337 char *myname = "gcvt";
9338 #endif
9339 #ifdef TRY_qgcvt
9340 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9341 char *myname = "qgcvt";
9342 #define DOUBLETYPE long double
9343 #endif
9344 #ifdef TRY_sprintf
9345 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9346 #ifdef HAS_PRIgldbl
9347 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9348 #else
9349 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9350 #endif
9351 #else
9352 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9353 #endif
9354 char *myname = "sprintf";
9355 #endif
9356
9357 #ifndef DOUBLETYPE
9358 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9359 #define DOUBLETYPE long double
9360 #else
9361 #define DOUBLETYPE double
9362 #endif
9363 #endif
9364
9365 #include <stdio.h>
9366
9367 #define I_STDLIB $i_stdlib
9368 #ifdef I_STDLIB
9369 #include <stdlib.h>
9370 #endif
9371
9372 int
9373 checkit(expect, got)
9374 char *expect;
9375 char *got;
9376 {
9377     if (strcmp(expect, got)) {
9378                 printf("%s oddity:  Expected %s, got %s\n",
9379                         myname, expect, got);
9380                 exit(1);
9381         }
9382 }
9383
9384 int main()
9385
9386         char buf[64]; 
9387         buf[63] = '\0';
9388
9389         /* This must be 1st test on (which?) platform */
9390         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9391         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9392         checkit("0.1", buf);
9393
9394         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9395         checkit("0.01", buf);
9396
9397         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9398         checkit("0.001", buf);
9399
9400         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9401         checkit("0.0001", buf);
9402
9403         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9404         if (strlen(buf) > 5)
9405             checkit("9e-005", buf); /* for Microsoft ?? */
9406         else
9407             checkit("9e-05", buf);
9408
9409         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9410         checkit("1", buf);
9411
9412         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9413         checkit("1.1", buf);
9414
9415         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9416         checkit("1.01", buf);
9417
9418         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9419         checkit("1.001", buf);
9420
9421         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9422         checkit("1.0001", buf);
9423
9424         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9425         checkit("1.00001", buf);
9426
9427         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9428         checkit("1.000001", buf);
9429
9430         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9431         checkit("0", buf);
9432
9433         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9434         checkit("-1", buf);
9435
9436         /* Some Linux gcvt's give 1.e+5 here. */
9437         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9438         checkit("100000", buf);
9439         
9440         /* Some Linux gcvt's give -1.e+5 here. */
9441         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9442         checkit("-100000", buf);
9443
9444         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9445         checkit("123.456", buf);
9446
9447         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9448         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9449         /* 34 should be enough to scare even long double
9450          * places into using the e notation. */
9451         if (strlen(buf) > 5)
9452             checkit("1e+034", buf); /* for Microsoft */
9453         else
9454             checkit("1e+34", buf);
9455
9456         /* For Perl, if you add additional tests here, also add them to
9457          * t/base/num.t for benefit of platforms not using Configure or
9458          * overriding d_Gconvert */
9459
9460         exit(0);
9461 }
9462 EOP
9463 : first add preferred functions to our list
9464 xxx_list=""
9465 for xxx_convert in $gconvert_preference; do
9466     case $xxx_convert in
9467     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9468     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9469     esac 
9470 done
9471 : then add any others
9472 for xxx_convert in gconvert gcvt sprintf; do
9473     case "$xxx_list" in
9474     *$xxx_convert*) ;;
9475     *) xxx_list="$xxx_list $xxx_convert" ;;
9476     esac 
9477 done
9478
9479 case "$d_longdbl$uselongdouble" in
9480 "$define$define")
9481     : again, add prefered functions to our list first
9482     xxx_ld_list=""
9483     for xxx_convert in $gconvert_ld_preference; do
9484         case $xxx_convert in
9485         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9486         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9487         esac
9488     done
9489     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9490     for xxx_convert in qgcvt sprintf $xxx_list; do
9491         case "$xxx_ld_list" in
9492         $xxx_convert*|*" $xxx_convert"*) ;;
9493         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9494         esac
9495     done
9496     : if sprintf cannot do long doubles, move it to the end
9497     if test "$d_PRIgldbl" != "$define"; then
9498         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9499     fi
9500     : if no qgcvt, remove it
9501     if test "$d_qgcvt" != "$define"; then
9502         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9503     fi
9504     : use the ld_list
9505     xxx_list="$xxx_ld_list"
9506     ;;
9507 esac
9508
9509 for xxx_convert in $xxx_list; do
9510         echo "Trying $xxx_convert..."
9511         $rm -f try try$_o
9512         set try -DTRY_$xxx_convert
9513         if eval $compile; then
9514                 echo "$xxx_convert() found." >&4
9515                 if $run ./try; then
9516                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9517                         break;
9518                 else
9519                         echo "...But $xxx_convert didn't work as I expected."
9520                         xxx_convert=''
9521                 fi
9522         else
9523                 echo "$xxx_convert NOT found." >&4
9524         fi
9525 done
9526
9527 if test X$xxx_convert = X; then
9528     echo "*** WHOA THERE!!! ***" >&4
9529     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9530     xxx_convert=sprintf
9531 fi
9532
9533 case "$xxx_convert" in
9534 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9535 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9536 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9537 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9538    "$define$define$define")
9539       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9540    "$define$define$undef")
9541       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9542    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9543    esac
9544    ;;  
9545 esac
9546
9547 fi
9548
9549 : see if _fwalk exists
9550 set fwalk d__fwalk
9551 eval $inlibc
9552
9553 : Initialize h_fcntl
9554 h_fcntl=false
9555
9556 : Initialize h_sysfile
9557 h_sysfile=false
9558
9559 : access call always available on UNIX
9560 set access d_access
9561 eval $inlibc
9562
9563 : locate the flags for 'access()'
9564 case "$d_access" in
9565 "$define")
9566         echo " "
9567         $cat >access.c <<EOCP
9568 #include <sys/types.h>
9569 #ifdef I_FCNTL
9570 #include <fcntl.h>
9571 #endif
9572 #ifdef I_SYS_FILE
9573 #include <sys/file.h>
9574 #endif
9575 #ifdef I_UNISTD
9576 #include <unistd.h>
9577 #endif
9578 #$i_stdlib I_STDLIB
9579 #ifdef I_STDLIB
9580 #include <stdlib.h>
9581 #endif
9582 int main() {
9583         exit(R_OK);
9584 }
9585 EOCP
9586         : check sys/file.h first, no particular reason here
9587         if $test `./findhdr sys/file.h` && \
9588                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9589                 h_sysfile=true;
9590                 echo "<sys/file.h> defines the *_OK access constants." >&4
9591         elif $test `./findhdr fcntl.h` && \
9592                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9593                 h_fcntl=true;
9594                 echo "<fcntl.h> defines the *_OK access constants." >&4
9595         elif $test `./findhdr unistd.h` && \
9596                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9597                 echo "<unistd.h> defines the *_OK access constants." >&4
9598         else
9599                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9600         fi
9601         ;;
9602 esac
9603 $rm -f access*
9604
9605 : see if accessx exists
9606 set accessx d_accessx
9607 eval $inlibc
9608
9609 : see if aintl exists
9610 set aintl d_aintl
9611 eval $inlibc
9612
9613 : see if alarm exists
9614 set alarm d_alarm
9615 eval $inlibc
9616
9617 : see if POSIX threads are available
9618 set pthread.h i_pthread
9619 eval $inhdr
9620
9621 : define a fucntion to check prototypes
9622 $cat > protochk <<EOSH
9623 $startsh
9624 cc="$cc"
9625 optimize="$optimize"
9626 ccflags="$ccflags"
9627 prototype="$prototype"
9628 define="$define"
9629 rm=$rm
9630 usethreads=$usethreads
9631 i_pthread=$i_pthread
9632 pthread_h_first=$pthread_h_first
9633 EOSH
9634
9635 $cat >> protochk <<'EOSH'
9636
9637 $rm -f try.c
9638 foo="$1"
9639 shift
9640 while test $# -ge 2; do
9641         case "$1" in
9642                 $define) echo "#include <$2>" >> try.c ;;
9643                 literal) echo "$2" >> try.c ;;
9644         esac
9645     # Extra magic for the benefit of systems that need pthread.h
9646     # to be included early to correctly detect threadsafe functions.
9647     # Such functions must guarantee themselves, though, that the usethreads
9648     # and i_pthread have been defined, before calling protochk.
9649     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9650         echo "#include <pthread.h>" >> try.c
9651         pthread_h_done=yes
9652     fi
9653     shift 2
9654 done
9655 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9656 cat >> try.c <<'EOCP'
9657 #ifdef CAN_PROTOTYPE
9658 #define _(args) args
9659 #else
9660 #define _(args) ()
9661 #endif
9662 EOCP
9663 echo "$foo" >> try.c
9664 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9665 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9666 status=$?
9667 $rm -f try.[co]
9668 exit $status
9669 EOSH
9670 chmod +x protochk
9671 $eunicefix protochk
9672
9673 hasproto='varname=$1; func=$2; shift; shift;
9674 while $test $# -ge 2; do
9675         case "$1" in
9676         $define) echo "#include <$2>";;
9677         esac ;
9678     shift 2;
9679 done > try.c;
9680 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9681 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9682         echo "$func() prototype found.";
9683         val="$define";
9684 else
9685         echo "$func() prototype NOT found.";
9686         val="$undef";
9687 fi;
9688 set $varname;
9689 eval $setvar;
9690 $rm -f try.c tryout.c'
9691
9692 : see if sys/types.h has to be included
9693 set sys/types.h i_systypes
9694 eval $inhdr
9695
9696 : see if sys/select.h has to be included
9697 set sys/select.h i_sysselct
9698 eval $inhdr
9699
9700 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9701 while $test $# -ge 2; do
9702         case "$1" in
9703         $define) echo "#include <$2>";;
9704         esac ;
9705     shift 2;
9706 done > try.c;
9707 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9708 set try;
9709 if eval $compile; then
9710         val="$define";
9711 else
9712         val="$undef";
9713 fi;
9714 set $varname;
9715 eval $setvar;
9716 $rm -f try.c try.o'
9717
9718 : see if we should include time.h, sys/time.h, or both
9719 echo " "
9720 if test "X$timeincl" = X; then
9721         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9722         $echo $n "I'm now running the test program...$c"
9723         $cat >try.c <<EOCP
9724 #include <sys/types.h>
9725 #ifdef I_TIME
9726 #include <time.h>
9727 #endif
9728 #ifdef I_SYSTIME
9729 #ifdef SYSTIMEKERNEL
9730 #define KERNEL
9731 #endif
9732 #include <sys/time.h>
9733 #endif
9734 #ifdef I_SYSSELECT
9735 #include <sys/select.h>
9736 #endif
9737 #$i_stdlib I_STDLIB
9738 #ifdef I_STDLIB
9739 #include <stdlib.h>
9740 #endif
9741 int main()
9742 {
9743         struct tm foo;
9744 #ifdef S_TIMEVAL
9745         struct timeval bar;
9746 #endif
9747 #ifdef S_TIMEZONE
9748         struct timezone tzp;
9749 #endif
9750         if (foo.tm_sec == foo.tm_sec)
9751                 exit(0);
9752 #ifdef S_TIMEVAL
9753         if (bar.tv_sec == bar.tv_sec)
9754                 exit(0);
9755 #endif
9756         exit(1);
9757 }
9758 EOCP
9759         flags=''
9760         for s_timezone in '-DS_TIMEZONE' ''; do
9761         sysselect=''
9762         for s_timeval in '-DS_TIMEVAL' ''; do
9763         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9764         for i_time in '' '-DI_TIME'; do
9765         for i_systime in '-DI_SYSTIME' ''; do
9766                 case "$flags" in
9767                 '') $echo $n ".$c"
9768                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9769                         if eval $compile; then
9770                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9771                                 shift
9772                                 flags="$*"
9773                                 echo " "
9774                                 $echo $n "Succeeded with $flags$c"
9775                         fi
9776                         ;;
9777                 esac
9778         done
9779         done
9780         done
9781         done
9782         done
9783         timeincl=''
9784         echo " "
9785         case "$flags" in
9786         *SYSTIMEKERNEL*) i_systimek="$define"
9787                 timeincl=`./findhdr sys/time.h`
9788                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9789         *) i_systimek="$undef";;
9790         esac
9791         case "$flags" in
9792         *I_TIME*) i_time="$define"
9793                 timeincl=`./findhdr time.h`" $timeincl"
9794                 echo "We'll include <time.h>." >&4;;
9795         *) i_time="$undef";;
9796         esac
9797         case "$flags" in
9798         *I_SYSTIME*) i_systime="$define"
9799                 timeincl=`./findhdr sys/time.h`" $timeincl"
9800                 echo "We'll include <sys/time.h>." >&4;;
9801         *) i_systime="$undef";;
9802         esac
9803         $rm -f try.c try
9804 fi
9805 : see if struct tm knows about tm_zone
9806 case "$i_systime$i_time" in
9807 *$define*) 
9808         echo " "
9809         echo "Checking to see if your struct tm has tm_zone field..." >&4
9810         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9811         eval $hasfield
9812         ;;
9813 *)      val="$undef"
9814         set d_tm_tm_zone
9815         eval $setvar
9816         ;;
9817 esac
9818 case "$d_tm_tm_zone" in
9819 "$define")      echo "Yes, it does."   ;;
9820 *)              echo "No, it doesn't." ;;
9821 esac
9822 : see if struct tm knows about tm_gmtoff
9823 case "$i_systime$i_time" in
9824 *$define*) 
9825         echo " "
9826         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9827         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9828         eval $hasfield
9829         ;;
9830 *)      val="$undef"
9831         set d_tm_tm_gmtoff
9832         eval $setvar
9833         ;;
9834 esac
9835 case "$d_tm_tm_gmtoff" in
9836 "$define")      echo "Yes, it does."   ;;
9837 *)              echo "No, it doesn't." ;;
9838 esac
9839
9840 : see if asctime_r exists
9841 set asctime_r d_asctime_r
9842 eval $inlibc
9843 case "$d_asctime_r" in
9844 "$define")
9845         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9846         case "$d_asctime_r_proto:$usethreads" in
9847         ":define")      d_asctime_r_proto=define
9848                 set d_asctime_r_proto asctime_r $hdrs
9849                 eval $hasproto ;;
9850         *)      ;;
9851         esac
9852         case "$d_asctime_r_proto" in
9853         define)
9854         case "$asctime_r_proto" in
9855         ''|0) try='char* asctime_r(const struct tm*, char*);'
9856         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9857         esac
9858         case "$asctime_r_proto" in
9859         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9860         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9861         esac
9862         case "$asctime_r_proto" in
9863         ''|0) try='int asctime_r(const struct tm*, char*);'
9864         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9865         esac
9866         case "$asctime_r_proto" in
9867         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9868         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9869         esac
9870         case "$asctime_r_proto" in
9871         ''|0)   d_asctime_r=undef
9872                 asctime_r_proto=0
9873                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9874         * )     case "$asctime_r_proto" in
9875                 REENTRANT_PROTO*) ;;
9876                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9877                 esac
9878                 echo "Prototype: $try" ;;
9879         esac
9880         ;;
9881         *)      case "$usethreads" in
9882                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9883                 esac
9884                 d_asctime_r=undef
9885                 asctime_r_proto=0
9886                 ;;
9887         esac
9888         ;;
9889 *)      asctime_r_proto=0
9890         ;;
9891 esac
9892
9893 : see if atolf exists
9894 set atolf d_atolf
9895 eval $inlibc
9896
9897 : see if atoll exists
9898 set atoll d_atoll
9899 eval $inlibc
9900
9901 : Look for GCC-style attribute format
9902 case "$d_attribute_format" in
9903 '')
9904 echo " "
9905 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9906 $cat >attrib.c <<'EOCP'
9907 #include <stdio.h>
9908 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9909 EOCP
9910 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9911         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9912                 echo "Your C compiler doesn't support __attribute__((format))."
9913                 val="$undef"
9914         else
9915                 echo "Your C compiler supports __attribute__((format))."
9916                 val="$define"
9917         fi
9918 else
9919         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9920         val="$undef"
9921 fi
9922 ;;
9923 *) val="$d_attribute_format" ;;
9924 esac
9925 set d_attribute_format
9926 eval $setvar
9927 $rm -f attrib*
9928
9929 : Look for GCC-style attribute malloc
9930 case "$d_attribute_malloc" in
9931 '')
9932 echo " "
9933 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9934 $cat >attrib.c <<'EOCP'
9935 #include <stdio.h>
9936 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
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__((malloc))."
9941                 val="$undef"
9942         else
9943                 echo "Your C compiler supports __attribute__((malloc))."
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_malloc" ;;
9952 esac
9953 set d_attribute_malloc
9954 eval $setvar
9955 $rm -f attrib*
9956
9957 : Look for GCC-style attribute nonnull
9958 case "$d_attribute_nonnull" in
9959 '')
9960 echo " "
9961 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9962 $cat >attrib.c <<'EOCP'
9963 #include <stdio.h>
9964 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
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__((nonnull))."
9969                 val="$undef"
9970         else
9971                 echo "Your C compiler supports __attribute__((nonnull))."
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_nonnull" ;;
9980 esac
9981 set d_attribute_nonnull
9982 eval $setvar
9983 $rm -f attrib*
9984
9985 : Look for GCC-style attribute noreturn
9986 case "$d_attribute_noreturn" in
9987 '')
9988 echo " "
9989 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9990 $cat >attrib.c <<'EOCP'
9991 #include <stdio.h>
9992 void fall_over_dead( void ) __attribute__((noreturn));
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__((noreturn))."
9997                 val="$undef"
9998         else
9999                 echo "Your C compiler supports __attribute__((noreturn))."
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_noreturn" ;;
10008 esac
10009 set d_attribute_noreturn
10010 eval $setvar
10011 $rm -f attrib*
10012
10013 : Look for GCC-style attribute pure
10014 case "$d_attribute_pure" in
10015 '')
10016 echo " "
10017 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10018 $cat >attrib.c <<'EOCP'
10019 #include <stdio.h>
10020 int square( int n ) __attribute__((pure));
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__((pure))."
10025                 val="$undef"
10026         else
10027                 echo "Your C compiler supports __attribute__((pure))."
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_pure" ;;
10036 esac
10037 set d_attribute_pure
10038 eval $setvar
10039 $rm -f attrib*
10040
10041 : Look for GCC-style attribute unused
10042 case "$d_attribute_unused" in
10043 '')
10044 echo " "
10045 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10046 $cat >attrib.c <<'EOCP'
10047 #include <stdio.h>
10048 int do_something( int dummy __attribute__((unused)), int n );
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__((unused))."
10053                 val="$undef"
10054         else
10055                 echo "Your C compiler supports __attribute__((unused))."
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_unused" ;;
10064 esac
10065 set d_attribute_unused
10066 eval $setvar
10067 $rm -f attrib*
10068
10069 : Look for GCC-style attribute warn_unused_result
10070 case "$d_attribute_warn_unused_result" in
10071 '')
10072 echo " "
10073 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10074 $cat >attrib.c <<'EOCP'
10075 #include <stdio.h>
10076 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
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__((warn_unused_result))."
10081                 val="$undef"
10082         else
10083                 echo "Your C compiler supports __attribute__((warn_unused_result))."
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_warn_unused_result" ;;
10092 esac
10093 set d_attribute_warn_unused_result
10094 eval $setvar
10095 $rm -f attrib*
10096
10097 : see if bcmp exists
10098 set bcmp d_bcmp
10099 eval $inlibc
10100
10101 : see if bcopy exists
10102 set bcopy d_bcopy
10103 eval $inlibc
10104
10105 : see if this is a unistd.h system
10106 set unistd.h i_unistd
10107 eval $inhdr
10108
10109 : see if getpgrp exists
10110 set getpgrp d_getpgrp
10111 eval $inlibc
10112
10113 case "$d_getpgrp" in
10114 "$define")
10115         echo " "
10116         echo "Checking to see which flavor of getpgrp is in use..."
10117         $cat >try.c <<EOP
10118 #$i_unistd I_UNISTD
10119 #include <sys/types.h>
10120 #ifdef I_UNISTD
10121 #  include <unistd.h>
10122 #endif
10123 #$i_stdlib I_STDLIB
10124 #ifdef I_STDLIB
10125 #include <stdlib.h>
10126 #endif
10127 int main()
10128 {
10129         if (getuid() == 0) {
10130                 printf("(I see you are running Configure as super-user...)\n");
10131                 setuid(1);
10132         }
10133 #ifdef TRY_BSD_PGRP
10134         if (getpgrp(1) == 0)
10135                 exit(0);
10136 #else
10137         if (getpgrp() > 0)
10138                 exit(0);
10139 #endif
10140         exit(1);
10141 }
10142 EOP
10143         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10144                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10145                 val="$define"
10146         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10147                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10148                 val="$undef"
10149         else
10150                 echo "I can't seem to compile and run the test program."
10151                 if ./usg; then
10152                         xxx="a USG one, i.e. you use getpgrp()."
10153                 else
10154                         # SVR4 systems can appear rather BSD-ish.
10155                         case "$i_unistd" in
10156                         $undef)
10157                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10158                                 val="$define"
10159                                 ;;
10160                         $define)
10161                                 xxx="probably a USG one, i.e. you use getpgrp()."
10162                                 val="$undef"
10163                                 ;;
10164                         esac
10165                 fi
10166                 echo "Assuming your getpgrp is $xxx" >&4
10167         fi
10168         ;;
10169 *) val="$undef";;
10170 esac
10171 set d_bsdgetpgrp
10172 eval $setvar
10173 $rm -f try try.*
10174
10175 : see if setpgrp exists
10176 set setpgrp d_setpgrp
10177 eval $inlibc
10178
10179 case "$d_setpgrp" in
10180 "$define")
10181         echo " "
10182         echo "Checking to see which flavor of setpgrp is in use..."
10183         $cat >try.c <<EOP
10184 #$i_unistd I_UNISTD
10185 #include <sys/types.h>
10186 #ifdef I_UNISTD
10187 #  include <unistd.h>
10188 #endif
10189 #$i_stdlib I_STDLIB
10190 #ifdef I_STDLIB
10191 #include <stdlib.h>
10192 #endif
10193 int main()
10194 {
10195         if (getuid() == 0) {
10196                 printf("(I see you are running Configure as super-user...)\n");
10197                 setuid(1);
10198         }
10199 #ifdef TRY_BSD_PGRP
10200         if (-1 == setpgrp(1, 1))
10201                 exit(0);
10202 #else
10203         if (setpgrp() != -1)
10204                 exit(0);
10205 #endif
10206         exit(1);
10207 }
10208 EOP
10209         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10210                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10211                 val="$define"
10212         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10213                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10214                 val="$undef"
10215         else
10216                 echo "(I can't seem to compile and run the test program.)"
10217                 if ./usg; then
10218                         xxx="a USG one, i.e. you use setpgrp()."
10219                 else
10220                         # SVR4 systems can appear rather BSD-ish.
10221                         case "$i_unistd" in
10222                         $undef)
10223                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10224                                 val="$define"
10225                                 ;;
10226                         $define)
10227                                 xxx="probably a USG one, i.e. you use setpgrp()."
10228                                 val="$undef"
10229                                 ;;
10230                         esac
10231                 fi
10232                 echo "Assuming your setpgrp is $xxx" >&4
10233         fi
10234         ;;
10235 *) val="$undef";;
10236 esac
10237 set d_bsdsetpgrp
10238 eval $setvar
10239 $rm -f try try.*
10240 : Look for GCC-style __builtin_choose_expr
10241 case "$d_builtin_choose_expr" in
10242 '')
10243     echo " "
10244     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10245     $cat >try.c <<'EOCP'
10246 #include <assert.h>
10247 #include <stdlib.h>
10248 #include <stdio.h>
10249
10250 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10251
10252 int main(void) {
10253     assert( SYRINX(1) == 2112 );
10254     assert( SYRINX(1) != 5150 );
10255     assert( SYRINX(0) == 5150 );
10256     assert( SYRINX(0) != 2112 );
10257     puts( "All good!" );
10258     exit(0);
10259 }
10260
10261 EOCP
10262     set try
10263     if eval $compile; then
10264         echo "Your C compiler supports __builtin_choose_expr."
10265         val="$define"
10266     else
10267         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10268         val="$undef"
10269     fi
10270 ;;
10271 *) val="$d_builtin_choose_expr" ;;
10272 esac
10273
10274 set d_builtin_choose_expr
10275 eval $setvar
10276 $rm -f try.* try core core.try.*
10277
10278 : Look for GCC-style __builtin_expect
10279 case "$d_builtin_expect" in
10280 '')
10281     echo " "
10282     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10283     $cat >builtin.c <<'EOCP'
10284 int main(void) {
10285     int n = 50;
10286     if ( __builtin_expect(n, 0) ) n = 1;
10287 }
10288 EOCP
10289     set try
10290     if eval $compile; then
10291         echo "Your C compiler supports __builtin_choose_expr."
10292         val="$define"
10293     else
10294         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10295         val="$undef"
10296     fi
10297     ;;
10298 *) val="$d_builtin_expect" ;;
10299 esac
10300
10301 set d_builtin_expect
10302 eval $setvar
10303 $rm -f try.* try core core.try.*
10304
10305 : see if bzero exists
10306 set bzero d_bzero
10307 eval $inlibc
10308
10309 : see if stdarg is available
10310 echo " "
10311 if $test `./findhdr stdarg.h`; then
10312         echo "<stdarg.h> found." >&4
10313         valstd="$define"
10314 else
10315         echo "<stdarg.h> NOT found." >&4
10316         valstd="$undef"
10317 fi
10318
10319 : see if varags is available
10320 echo " "
10321 if $test `./findhdr varargs.h`; then
10322         echo "<varargs.h> found." >&4
10323 else
10324         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10325 fi
10326
10327 : set up the varargs testing programs
10328 $cat > varargs.c <<EOP
10329 #ifdef I_STDARG
10330 #include <stdarg.h>
10331 #endif
10332 #ifdef I_VARARGS
10333 #include <varargs.h>
10334 #endif
10335
10336 #ifdef I_STDARG
10337 int f(char *p, ...)
10338 #else
10339 int f(va_alist)
10340 va_dcl
10341 #endif
10342 {
10343         va_list ap;
10344 #ifndef I_STDARG
10345         char *p;
10346 #endif
10347 #ifdef I_STDARG
10348         va_start(ap,p);
10349 #else
10350         va_start(ap);
10351         p = va_arg(ap, char *);
10352 #endif
10353         va_end(ap);
10354 }
10355 EOP
10356 $cat > varargs <<EOP
10357 $startsh
10358 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10359         echo "true"
10360 else
10361         echo "false"
10362 fi
10363 $rm -f varargs$_o
10364 EOP
10365 chmod +x varargs
10366
10367 : now check which varargs header should be included
10368 echo " "
10369 i_varhdr=''
10370 case "$valstd" in
10371 "$define")
10372         if `./varargs I_STDARG`; then
10373                 val='stdarg.h'
10374         elif `./varargs I_VARARGS`; then
10375                 val='varargs.h'
10376         fi
10377         ;;
10378 *)
10379         if `./varargs I_VARARGS`; then
10380                 val='varargs.h'
10381         fi
10382         ;;
10383 esac
10384 case "$val" in
10385 '')
10386 echo "I could not find the definition for va_dcl... You have problems..." >&4
10387         val="$undef"; set i_stdarg; eval $setvar
10388         val="$undef"; set i_varargs; eval $setvar
10389         ;;
10390 *) 
10391         set i_varhdr
10392         eval $setvar
10393         case "$i_varhdr" in
10394         stdarg.h)
10395                 val="$define"; set i_stdarg; eval $setvar
10396                 val="$undef"; set i_varargs; eval $setvar
10397                 ;;
10398         varargs.h)
10399                 val="$undef"; set i_stdarg; eval $setvar
10400                 val="$define"; set i_varargs; eval $setvar
10401                 ;;
10402         esac
10403         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10404 esac
10405 $rm -f varargs*
10406
10407 : see if the Compiler supports C99 variadic macros
10408 case "$i_stdarg$i_stdlib" in
10409     "$define$define")
10410     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10411     $cat >try.c <<EOCP
10412 #include <stdio.h>
10413 #include <stdarg.h>
10414
10415 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10416
10417 int main() {
10418   char buf[20];
10419   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10420   puts(buf);
10421   return 0;
10422 }
10423 EOCP
10424     set try
10425     if eval $compile && $run ./try 2>&1 >/dev/null; then
10426         case "`$run ./try`" in
10427             "123 456 789")
10428             echo "You have C99 variadic macros." >&4
10429             d_c99_variadic_macros="$define"
10430             ;;
10431             *)
10432             echo "You don't have functional C99 variadic macros." >&4
10433             d_c99_variadic_macros="$undef"
10434             ;;
10435         esac
10436     else
10437         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10438         d_c99_variadic_macros="$undef"
10439     fi
10440     $rm -f try.* try core core.try.*
10441     ;;
10442     *)
10443     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10444     d_c99_variadic_macros="$undef"
10445     ;;
10446 esac
10447
10448 : see if signal is declared as pointer to function returning int or void
10449 echo " "
10450 xxx=`./findhdr signal.h`
10451 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10452 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10453         echo "You have int (*signal())() instead of void." >&4
10454         val="$undef"
10455 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10456         echo "You have void (*signal())()." >&4
10457         val="$define"
10458 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10459         echo "You have int (*signal())() instead of void." >&4
10460         val="$undef"
10461 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10462         echo "You have void (*signal())()." >&4
10463         val="$define"
10464 else
10465         case "$d_voidsig" in
10466         '')
10467         echo "I can't determine whether signal handler returns void or int..." >&4
10468                 dflt=void
10469                 rp="What type does your signal handler return?"
10470                 . ./myread
10471                 case "$ans" in
10472                 v*) val="$define";;
10473                 *) val="$undef";;
10474                 esac;;
10475         "$define")
10476                 echo "As you already told me, signal handler returns void." >&4
10477                 val="$define"
10478                 ;;
10479         *)      echo "As you already told me, signal handler returns int." >&4
10480                 val="$undef"
10481                 ;;
10482         esac
10483 fi
10484 set d_voidsig
10485 eval $setvar
10486 case "$d_voidsig" in
10487 "$define") signal_t="void";;
10488 *) signal_t="int";;
10489 esac
10490 $rm -f $$.tmp
10491
10492 : check for ability to cast large floats to 32-bit ints.
10493 echo " "
10494 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10495 if $test "$intsize" -ge 4; then
10496         xxx=int
10497 else
10498         xxx=long
10499 fi
10500 $cat >try.c <<EOCP
10501 #include <stdio.h>
10502 #$i_stdlib I_STDLIB
10503 #ifdef I_STDLIB
10504 #include <stdlib.h>
10505 #endif
10506 #include <sys/types.h>
10507 #include <signal.h>
10508 $signal_t blech(s) int s; { exit(3); }
10509 int main()
10510 {
10511         $xxx i32;
10512         double f, g;
10513         int result = 0;
10514         char str[16];
10515         signal(SIGFPE, blech);
10516
10517         /* Don't let compiler optimize the test away.  Store the number 
10518            in a writable string for gcc to pass to sscanf under HP/UX.
10519         */
10520         sprintf(str, "2147483647");
10521         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10522         g = 10 * f;
10523         i32  = ($xxx) g;
10524
10525         /* x86 processors will probably give 0x8000 0000, which is a
10526            sign change.  We don't want that.  We want to mimic SPARC
10527            behavior here, which is to preserve the sign and give
10528            back 0x7fff ffff.
10529         */
10530         if (i32 != ($xxx) f)
10531                 result |= 1;
10532         exit(result);
10533 }
10534 EOCP
10535 set try
10536 if eval $compile_ok; then
10537         $run ./try
10538         yyy=$?
10539 else
10540         echo "(I can't seem to compile the test program--assuming it can't)"
10541         yyy=1
10542 fi
10543 case "$yyy" in
10544 0)      val="$define"
10545         echo "Yup, it can."
10546         ;;
10547 *)      val="$undef"
10548         echo "Nope, it can't."
10549         ;;
10550 esac
10551 set d_casti32
10552 eval $setvar
10553 $rm -f try try.*
10554
10555 : check for ability to cast negative floats to unsigned
10556 echo " "
10557 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10558 $cat >try.c <<EOCP
10559 #include <stdio.h>
10560 #$i_stdlib I_STDLIB
10561 #ifdef I_STDLIB
10562 #include <stdlib.h>
10563 #endif
10564 #include <sys/types.h>
10565 #include <signal.h>
10566 $signal_t blech(s) int s; { exit(7); }
10567 $signal_t blech_in_list(s) int s; { exit(4); }
10568 unsigned long dummy_long(p) unsigned long p; { return p; }
10569 unsigned int dummy_int(p) unsigned int p; { return p; }
10570 unsigned short dummy_short(p) unsigned short p; { return p; }
10571 int main()
10572 {
10573         double f;
10574         unsigned long along;
10575         unsigned int aint;
10576         unsigned short ashort;
10577         int result = 0;
10578         char str[16];
10579         
10580         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10581            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10582            optimized the whole file away
10583         */
10584         /* Store the number in a writable string for gcc to pass to 
10585            sscanf under HP/UX.
10586         */
10587         sprintf(str, "-123");
10588         sscanf(str, "%lf", &f);  /* f = -123.; */
10589
10590         signal(SIGFPE, blech);
10591         along = (unsigned long)f;
10592         aint = (unsigned int)f;
10593         ashort = (unsigned short)f;
10594         if (along != (unsigned long)-123)
10595                 result |= 1;
10596         if (aint != (unsigned int)-123)
10597                 result |= 1;
10598         if (ashort != (unsigned short)-123)
10599                 result |= 1;
10600         sprintf(str, "1073741824.");
10601         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10602         f = f + f;
10603         along = 0;
10604         along = (unsigned long)f;
10605         if (along != 0x80000000)
10606                 result |= 2;
10607         f -= 1.;
10608         along = 0;
10609         along = (unsigned long)f;
10610         if (along != 0x7fffffff)
10611                 result |= 1;
10612         f += 2.;
10613         along = 0;
10614         along = (unsigned long)f;
10615         if (along != 0x80000001)
10616                 result |= 2;
10617         if (result)
10618                 exit(result);
10619         signal(SIGFPE, blech_in_list);
10620         sprintf(str, "123.");
10621         sscanf(str, "%lf", &f);  /* f = 123.; */
10622         along = dummy_long((unsigned long)f);
10623         aint = dummy_int((unsigned int)f);
10624         ashort = dummy_short((unsigned short)f);
10625         if (along != (unsigned long)123)
10626                 result |= 4;
10627         if (aint != (unsigned int)123)
10628                 result |= 4;
10629         if (ashort != (unsigned short)123)
10630                 result |= 4;
10631         exit(result);
10632
10633 }
10634 EOCP
10635 set try
10636 if eval $compile_ok; then
10637         $run ./try
10638         castflags=$?
10639 else
10640         echo "(I can't seem to compile the test program--assuming it can't)"
10641         castflags=7
10642 fi
10643 case "$castflags" in
10644 0)      val="$define"
10645         echo "Yup, it can."
10646         ;;
10647 *)      val="$undef"
10648         echo "Nope, it can't."
10649         ;;
10650 esac
10651 set d_castneg
10652 eval $setvar
10653 $rm -f try.*
10654
10655 : see if vprintf exists
10656 echo " "
10657 if set vprintf val -f d_vprintf; eval $csym; $val; then
10658         echo 'vprintf() found.' >&4
10659         val="$define"
10660         $cat >try.c <<EOF
10661 #include <varargs.h>
10662 #$i_stdlib I_STDLIB
10663 #ifdef I_STDLIB
10664 #include <stdlib.h>
10665 #endif
10666
10667 int main() { xxx("foo"); }
10668
10669 xxx(va_alist)
10670 va_dcl
10671 {
10672         va_list args;
10673         char buf[10];
10674
10675         va_start(args);
10676         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10677 }
10678 EOF
10679         set try
10680         if eval $compile && $run ./try; then
10681                 echo "Your vsprintf() returns (int)." >&4
10682                 val2="$undef"
10683         else
10684                 echo "Your vsprintf() returns (char*)." >&4
10685                 val2="$define"
10686         fi
10687 else
10688         echo 'vprintf() NOT found.' >&4
10689                 val="$undef"
10690                 val2="$undef"
10691 fi
10692 $rm -f try try.*
10693 set d_vprintf
10694 eval $setvar
10695 val=$val2
10696 set d_charvspr
10697 eval $setvar
10698
10699 : see if chown exists
10700 set chown d_chown
10701 eval $inlibc
10702
10703 : see if chroot exists
10704 set chroot d_chroot
10705 eval $inlibc
10706
10707 : see if chsize exists
10708 set chsize d_chsize
10709 eval $inlibc
10710
10711 : see if class exists
10712 set class d_class
10713 eval $inlibc
10714
10715 : see if clearenv exists
10716 set clearenv d_clearenv
10717 eval $inlibc
10718
10719 hasstruct='varname=$1; struct=$2; shift; shift;
10720 while $test $# -ge 2; do
10721         case "$1" in
10722         $define) echo "#include <$2>";;
10723         esac ;
10724     shift 2;
10725 done > try.c;
10726 echo "int main () { struct $struct foo; }" >> try.c;
10727 set try;
10728 if eval $compile; then
10729         val="$define";
10730 else
10731         val="$undef";
10732 fi;
10733 set $varname;
10734 eval $setvar;
10735 $rm -f try.c try.o'
10736
10737 socketlib=''
10738 sockethdr=''
10739 : see whether socket exists
10740 echo " "
10741 $echo $n "Hmm... $c" >&4
10742 if set socket val -f d_socket; eval $csym; $val; then
10743         echo "Looks like you have Berkeley networking support." >&4
10744         d_socket="$define"
10745         if set setsockopt val -f; eval $csym; $val; then
10746                 d_oldsock="$undef"
10747         else
10748                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10749                 d_oldsock="$define"
10750         fi
10751 else
10752         if $contains socklib libc.list >/dev/null 2>&1; then
10753                 echo "Looks like you have Berkeley networking support." >&4
10754                 d_socket="$define"
10755                 : we will have to assume that it supports the 4.2 BSD interface
10756                 d_oldsock="$undef"
10757         else
10758                 echo "You don't have Berkeley networking in libc$_a..." >&4
10759                 if test "X$d_socket" = "X$define"; then
10760                    echo "...but you seem to believe that you have sockets." >&4
10761                 else
10762                         for net in net socket
10763                         do
10764                                 if test -f /usr/lib/lib$net$_a; then
10765                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10766                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10767                                         if $contains socket libc.list >/dev/null 2>&1; then
10768                                                 d_socket="$define"
10769                                                 socketlib="-l$net"
10770                                                 case "$net" in
10771                                                 net)
10772                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10773                                                         sockethdr="-I/usr/netinclude"
10774                                                         ;;
10775                                                 esac
10776                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10777                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10778                                                         d_oldsock="$undef"
10779                                                 else
10780                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10781                                                         d_oldsock="$define"
10782                                                 fi
10783                                                 break
10784                                         fi
10785                                 fi
10786                         done
10787                         if test "X$d_socket" != "X$define"; then
10788                            echo "or anywhere else I see." >&4
10789                            d_socket="$undef"
10790                            d_oldsock="$undef"
10791                         fi
10792                 fi
10793         fi
10794 fi
10795
10796 : see if socketpair exists
10797 set socketpair d_sockpair
10798 eval $inlibc
10799
10800
10801 echo " "
10802 echo "Checking the availability of certain socket constants..." >&4
10803 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10804         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10805         $cat >try.c <<EOF
10806 #include <sys/types.h>
10807 #include <sys/socket.h>
10808 int main() {
10809     int i = $ENUM;
10810 }
10811 EOF
10812         val="$undef"
10813         set try; if eval $compile; then
10814                 val="$define"
10815         fi
10816         set d_${enum}; eval $setvar
10817         $rm -f try.c try
10818 done
10819
10820 : see if this is a sys/uio.h system
10821 set sys/uio.h i_sysuio
10822 eval $inhdr
10823
10824
10825 echo " "
10826 echo "Checking to see if your system supports struct cmsghdr..." >&4
10827 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10828 eval $hasstruct
10829 case "$d_cmsghdr_s" in
10830 "$define")      echo "Yes, it does."   ;;
10831 *)              echo "No, it doesn't." ;;
10832 esac
10833
10834
10835 : check for const keyword
10836 echo " "
10837 echo 'Checking to see if your C compiler knows about "const"...' >&4
10838 $cat >const.c <<'EOCP'
10839 typedef struct spug { int drokk; } spug;
10840 int main()
10841 {
10842         const char *foo;
10843         const spug y;
10844 }
10845 EOCP
10846 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10847         val="$define"
10848         echo "Yup, it does."
10849 else
10850         val="$undef"
10851         echo "Nope, it doesn't."
10852 fi
10853 set d_const
10854 eval $setvar
10855
10856 : see if copysignl exists
10857 set copysignl d_copysignl
10858 eval $inlibc
10859
10860 : see if crypt exists
10861 echo " "
10862 set crypt d_crypt
10863 eval $inlibc
10864 case "$d_crypt" in
10865 $define) cryptlib='' ;;
10866 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10867                 echo 'crypt() found.' >&4
10868                 val="$define"
10869                 cryptlib=''
10870         else
10871                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10872                 if $test -z "$cryptlib"; then
10873                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10874                 else
10875                         cryptlib=-lcrypt
10876                 fi
10877                 if $test -z "$cryptlib"; then
10878                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10879                 else
10880                         cryptlib=-lcrypt
10881                 fi
10882                 if $test -z "$cryptlib"; then
10883                         cryptlib=`./loc libcrypt$_a "" $libpth`
10884                 else
10885                         cryptlib=-lcrypt
10886                 fi
10887                 if $test -z "$cryptlib"; then
10888                         echo 'crypt() NOT found.' >&4
10889                         val="$undef"
10890                 else
10891                         val="$define"
10892                 fi
10893         fi
10894         set d_crypt
10895         eval $setvar
10896         ;;
10897 esac
10898
10899 : see if this is a crypt.h system
10900 set crypt.h i_crypt
10901 eval $inhdr
10902
10903 : see if crypt_r exists
10904 set crypt_r d_crypt_r
10905 eval $inlibc
10906 case "$d_crypt_r" in
10907 "$define")
10908         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10909         case "$d_crypt_r_proto:$usethreads" in
10910         ":define")      d_crypt_r_proto=define
10911                 set d_crypt_r_proto crypt_r $hdrs
10912                 eval $hasproto ;;
10913         *)      ;;
10914         esac
10915         case "$d_crypt_r_proto" in
10916         define)
10917         case "$crypt_r_proto" in
10918         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10919         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10920         esac
10921         case "$crypt_r_proto" in
10922         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10923         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10924         esac
10925         case "$crypt_r_proto" in
10926         ''|0)   d_crypt_r=undef
10927                 crypt_r_proto=0
10928                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10929         * )     case "$crypt_r_proto" in
10930                 REENTRANT_PROTO*) ;;
10931                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10932                 esac
10933                 echo "Prototype: $try" ;;
10934         esac
10935         ;;
10936         *)      case "$usethreads" in
10937                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10938                 esac
10939                 d_crypt_r=undef
10940                 crypt_r_proto=0
10941                 ;;
10942         esac
10943         ;;
10944 *)      crypt_r_proto=0
10945         ;;
10946 esac
10947
10948 : get csh whereabouts
10949 case "$csh" in
10950 'csh') val="$undef" ;;
10951 *) val="$define" ;;
10952 esac
10953 set d_csh
10954 eval $setvar
10955 : Respect a hint or command line value for full_csh.
10956 case "$full_csh" in
10957 '') full_csh=$csh ;;
10958 esac
10959
10960 : see if ctermid_r exists
10961 set ctermid_r d_ctermid_r
10962 eval $inlibc
10963 case "$d_ctermid_r" in
10964 "$define")
10965         hdrs="$i_systypes sys/types.h define stdio.h "
10966         case "$d_ctermid_r_proto:$usethreads" in
10967         ":define")      d_ctermid_r_proto=define
10968                 set d_ctermid_r_proto ctermid_r $hdrs
10969                 eval $hasproto ;;
10970         *)      ;;
10971         esac
10972         case "$d_ctermid_r_proto" in
10973         define)
10974         case "$ctermid_r_proto" in
10975         ''|0) try='char* ctermid_r(char*);'
10976         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10977         esac
10978         case "$ctermid_r_proto" in
10979         ''|0)   d_ctermid_r=undef
10980                 ctermid_r_proto=0
10981                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10982         * )     case "$ctermid_r_proto" in
10983                 REENTRANT_PROTO*) ;;
10984                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10985                 esac
10986                 echo "Prototype: $try" ;;
10987         esac
10988         ;;
10989         *)      case "$usethreads" in
10990                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10991                 esac
10992                 d_ctermid_r=undef
10993                 ctermid_r_proto=0
10994                 ;;
10995         esac
10996         ;;
10997 *)      ctermid_r_proto=0
10998         ;;
10999 esac
11000
11001 : see if ctime_r exists
11002 set ctime_r d_ctime_r
11003 eval $inlibc
11004 case "$d_ctime_r" in
11005 "$define")
11006         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11007         case "$d_ctime_r_proto:$usethreads" in
11008         ":define")      d_ctime_r_proto=define
11009                 set d_ctime_r_proto ctime_r $hdrs
11010                 eval $hasproto ;;
11011         *)      ;;
11012         esac
11013         case "$d_ctime_r_proto" in
11014         define)
11015         case "$ctime_r_proto" in
11016         ''|0) try='char* ctime_r(const time_t*, char*);'
11017         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11018         esac
11019         case "$ctime_r_proto" in
11020         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11021         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11022         esac
11023         case "$ctime_r_proto" in
11024         ''|0) try='int ctime_r(const time_t*, char*);'
11025         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11026         esac
11027         case "$ctime_r_proto" in
11028         ''|0) try='int ctime_r(const time_t*, char*, int);'
11029         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11030         esac
11031         case "$ctime_r_proto" in
11032         ''|0)   d_ctime_r=undef
11033                 ctime_r_proto=0
11034                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11035         * )     case "$ctime_r_proto" in
11036                 REENTRANT_PROTO*) ;;
11037                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11038                 esac
11039                 echo "Prototype: $try" ;;
11040         esac
11041         ;;
11042         *)      case "$usethreads" in
11043                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11044                 esac
11045                 d_ctime_r=undef
11046                 ctime_r_proto=0
11047                 ;;
11048         esac
11049         ;;
11050 *)      ctime_r_proto=0
11051         ;;
11052 esac
11053
11054 : see if cuserid exists
11055 set cuserid d_cuserid
11056 eval $inlibc
11057
11058 : see if this is a limits.h system
11059 set limits.h i_limits
11060 eval $inhdr
11061
11062 : see if this is a float.h system
11063 set float.h i_float
11064 eval $inhdr
11065
11066 : See if number of significant digits in a double precision number is known
11067 echo " "
11068 $cat >dbl_dig.c <<EOM
11069 #$i_limits I_LIMITS
11070 #$i_float I_FLOAT
11071 #ifdef I_LIMITS
11072 #include <limits.h>
11073 #endif
11074 #ifdef I_FLOAT
11075 #include <float.h>
11076 #endif
11077 #ifdef DBL_DIG
11078 printf("Contains DBL_DIG");
11079 #endif
11080 EOM
11081 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11082 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11083         echo "DBL_DIG found." >&4
11084         val="$define"
11085 else
11086         echo "DBL_DIG NOT found." >&4
11087         val="$undef"
11088 fi
11089 $rm -f dbl_dig.?
11090 set d_dbl_dig
11091 eval $setvar
11092
11093 : see if dbm.h is available
11094 : see if dbmclose exists
11095 set dbmclose d_dbmclose
11096 eval $inlibc
11097
11098 case "$d_dbmclose" in
11099 $define)
11100         set dbm.h i_dbm
11101         eval $inhdr
11102         case "$i_dbm" in
11103         $define)
11104                 val="$undef"
11105                 set i_rpcsvcdbm
11106                 eval $setvar
11107                 ;;
11108         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11109                 eval $inhdr
11110                 ;;
11111         esac
11112         ;;
11113 *)      echo "We won't be including <dbm.h>"
11114         val="$undef"
11115         set i_dbm
11116         eval $setvar
11117         val="$undef"
11118         set i_rpcsvcdbm
11119         eval $setvar
11120         ;;
11121 esac
11122
11123 : see if prototype for dbminit is available
11124 echo " "
11125 set d_dbminitproto dbminit $i_dbm dbm.h
11126 eval $hasproto
11127
11128 : see if difftime exists
11129 set difftime d_difftime
11130 eval $inlibc
11131
11132 : see if this is a dirent system
11133 echo " "
11134 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11135         val="$define"
11136         echo "<dirent.h> found." >&4
11137 else
11138         val="$undef"
11139         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11140                 echo "<sys/dir.h> found." >&4
11141                 echo " "
11142         else
11143                 xinc=`./findhdr sys/ndir.h`
11144         fi
11145         echo "<dirent.h> NOT found." >&4
11146 fi
11147 set i_dirent
11148 eval $setvar
11149
11150 : Look for type of directory structure.
11151 echo " "
11152 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11153
11154 case "$direntrytype" in
11155 ''|' ')
11156         case "$i_dirent" in
11157         $define) guess1='struct dirent' ;;
11158         *) guess1='struct direct'  ;;
11159         esac
11160         ;;
11161 *)      guess1="$direntrytype"
11162         ;;
11163 esac
11164
11165 case "$guess1" in
11166 'struct dirent') guess2='struct direct' ;;
11167 *) guess2='struct dirent' ;;
11168 esac
11169                 
11170 if $contains "$guess1" try.c >/dev/null 2>&1; then
11171         direntrytype="$guess1"
11172         echo "Your directory entries are $direntrytype." >&4
11173 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11174         direntrytype="$guess2"
11175         echo "Your directory entries seem to be $direntrytype." >&4
11176 else
11177         echo "I don't recognize your system's directory entries." >&4
11178         rp="What type is used for directory entries on this system?"
11179         dflt="$guess1"
11180         . ./myread
11181         direntrytype="$ans"
11182 fi
11183 $rm -f try.c
11184
11185
11186 : see if the directory entry stores field length
11187 echo " "
11188 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11189 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11190         echo "Good, your directory entry keeps length information in d_namlen." >&4
11191         val="$define"
11192 else
11193         echo "Your directory entry does not know about the d_namlen field." >&4
11194         val="$undef"
11195 fi
11196 set d_dirnamlen
11197 eval $setvar
11198 $rm -f try.c
11199
11200 : see if this is an sysdir system
11201 set sys/dir.h i_sysdir
11202 eval $inhdr
11203
11204 : see if this is an sysndir system
11205 set sys/ndir.h i_sysndir
11206 eval $inhdr
11207
11208 : Look for dirfd
11209 echo " "
11210 $cat >dirfd.c <<EOM
11211 #include <stdio.h>
11212 #$i_stdlib I_STDLIB
11213 #ifdef I_STDLIB
11214 #include <stdlib.h>
11215 #endif
11216 #$i_dirent I_DIRENT             /**/
11217 #$i_sysdir I_SYS_DIR            /**/
11218 #$i_sysndir I_SYS_NDIR          /**/
11219 #$i_systypes I_SYS_TYPES        /**/
11220 #if defined(I_SYS_TYPES)
11221 #include <sys/types.h>
11222 #endif
11223 #if defined(I_DIRENT)
11224 #include <dirent.h>
11225 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11226 #include <sys/dir.h>
11227 #endif
11228 #else
11229 #ifdef I_SYS_NDIR
11230 #include <sys/ndir.h>
11231 #else
11232 #ifdef I_SYS_DIR
11233 #ifdef hp9000s500
11234 #include <ndir.h>       /* may be wrong in the future */
11235 #else
11236 #include <sys/dir.h>
11237 #endif
11238 #endif
11239 #endif
11240 #endif 
11241 int main() {
11242         DIR *dirp = opendir(".");
11243         if (dirfd(dirp) >= 0)
11244                 exit(0);
11245         else
11246                 exit(1);
11247 }
11248 EOM
11249 val=$undef
11250 set dirfd
11251 if eval $compile; then
11252         val="$define"
11253 fi
11254 case "$val" in
11255 $define)        echo "dirfd() found." >&4       ;;
11256 *)              echo "dirfd() NOT found." >&4   ;;
11257 esac
11258 set d_dirfd
11259 eval $setvar
11260 $rm -f dirfd*
11261
11262 : see if dlerror exists
11263 xxx_runnm="$runnm"
11264 runnm=false
11265 set dlerror d_dlerror
11266 eval $inlibc
11267 runnm="$xxx_runnm"
11268
11269 : see if dlfcn is available
11270 set dlfcn.h i_dlfcn
11271 eval $inhdr
11272
11273 case "$usedl" in
11274 $define|y|true)
11275         $cat << EOM
11276
11277 On a few systems, the dynamically loaded modules that perl generates and uses
11278 will need a different extension than shared libs. The default will probably
11279 be appropriate.
11280
11281 EOM
11282         case "$dlext" in
11283         '')     dflt="$so" ;;
11284         *)      dflt="$dlext" ;;
11285         esac
11286         rp='What is the extension of dynamically loaded modules'
11287         . ./myread
11288         dlext="$ans"
11289         ;;
11290 *)
11291         dlext="none"
11292         ;;
11293 esac
11294
11295 : Check if dlsym need a leading underscore
11296 echo " "
11297 val="$undef"
11298
11299 case "$dlsrc" in
11300 dl_dlopen.xs)
11301         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11302         $cat >dyna.c <<'EOM'
11303 fred () { }
11304 EOM
11305
11306 $cat >fred.c<<EOM
11307
11308 #include <stdio.h>
11309 #$i_stdlib I_STDLIB
11310 #ifdef I_STDLIB
11311 #include <stdlib.h>
11312 #endif
11313 #$i_dlfcn I_DLFCN
11314 #ifdef I_DLFCN
11315 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11316 #else
11317 #include <sys/types.h>
11318 #include <nlist.h>
11319 #include <link.h>
11320 #endif
11321
11322 extern int fred() ;
11323
11324 int main()
11325 {
11326     void * handle ;
11327     void * symbol ;
11328 #ifndef RTLD_LAZY
11329     int mode = 1 ;
11330 #else
11331     int mode = RTLD_LAZY ;
11332 #endif
11333     handle = dlopen("./dyna.$dlext", mode) ;
11334     if (handle == NULL) {
11335         printf ("1\n") ;
11336         fflush (stdout) ;
11337         exit(0);
11338     }
11339     symbol = dlsym(handle, "fred") ;
11340     if (symbol == NULL) {
11341         /* try putting a leading underscore */
11342         symbol = dlsym(handle, "_fred") ;
11343         if (symbol == NULL) {
11344             printf ("2\n") ;
11345             fflush (stdout) ;
11346             exit(0);
11347         }
11348         printf ("3\n") ;
11349     }
11350     else
11351         printf ("4\n") ;
11352     fflush (stdout) ;
11353     exit(0);
11354 }
11355 EOM
11356         : Call the object file tmp-dyna.o in case dlext=o.
11357         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11358                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11359                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11360                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11361                 xxx=`$run ./fred`
11362                 case $xxx in
11363                 1)      echo "Test program failed using dlopen." >&4
11364                         echo "Perhaps you should not use dynamic loading." >&4;;
11365                 2)      echo "Test program failed using dlsym." >&4
11366                         echo "Perhaps you should not use dynamic loading." >&4;;
11367                 3)      echo "dlsym needs a leading underscore" >&4
11368                         val="$define" ;;
11369                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11370                 esac
11371         else
11372                 echo "I can't compile and run the test program." >&4
11373                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11374         fi
11375         ;;
11376 esac
11377                 
11378 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11379
11380 set d_dlsymun
11381 eval $setvar
11382
11383 : see if drand48_r exists
11384 set drand48_r d_drand48_r
11385 eval $inlibc
11386 case "$d_drand48_r" in
11387 "$define")
11388         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11389         case "$d_drand48_r_proto:$usethreads" in
11390         ":define")      d_drand48_r_proto=define
11391                 set d_drand48_r_proto drand48_r $hdrs
11392                 eval $hasproto ;;
11393         *)      ;;
11394         esac
11395         case "$d_drand48_r_proto" in
11396         define)
11397         case "$drand48_r_proto" in
11398         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11399         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11400         esac
11401         case "$drand48_r_proto" in
11402         ''|0)   d_drand48_r=undef
11403                 drand48_r_proto=0
11404                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11405         * )     case "$drand48_r_proto" in
11406                 REENTRANT_PROTO*) ;;
11407                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11408                 esac
11409                 echo "Prototype: $try" ;;
11410         esac
11411         ;;
11412         *)      case "$usethreads" in
11413                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11414                 esac
11415                 d_drand48_r=undef
11416                 drand48_r_proto=0
11417                 ;;
11418         esac
11419         ;;
11420 *)      drand48_r_proto=0
11421         ;;
11422 esac
11423
11424 : see if prototype for drand48 is available
11425 echo " "
11426 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11427 eval $hasproto
11428
11429 : see if dup2 exists
11430 set dup2 d_dup2
11431 eval $inlibc
11432
11433 : see if eaccess exists
11434 set eaccess d_eaccess
11435 eval $inlibc
11436
11437 : see if endgrent exists
11438 set endgrent d_endgrent
11439 eval $inlibc
11440
11441 : see if this is an grp system
11442 set grp.h i_grp
11443 eval $inhdr
11444
11445 case "$i_grp" in
11446 $define)
11447         xxx=`./findhdr grp.h`
11448         $cppstdin $cppflags $cppminus < $xxx >$$.h
11449
11450         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11451                 val="$define"
11452         else
11453                 val="$undef"
11454         fi
11455         set d_grpasswd
11456         eval $setvar
11457
11458         $rm -f $$.h
11459         ;;
11460 *)
11461         val="$undef";
11462         set d_grpasswd; eval $setvar
11463         ;;
11464 esac
11465
11466 : see if endgrent_r exists
11467 set endgrent_r d_endgrent_r
11468 eval $inlibc
11469 case "$d_endgrent_r" in
11470 "$define")
11471         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11472         case "$d_endgrent_r_proto:$usethreads" in
11473         ":define")      d_endgrent_r_proto=define
11474                 set d_endgrent_r_proto endgrent_r $hdrs
11475                 eval $hasproto ;;
11476         *)      ;;
11477         esac
11478         case "$d_endgrent_r_proto" in
11479         define)
11480         case "$endgrent_r_proto" in
11481         ''|0) try='int endgrent_r(FILE**);'
11482         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11483         esac
11484         case "$endgrent_r_proto" in
11485         ''|0) try='void endgrent_r(FILE**);'
11486         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11487         esac
11488         case "$endgrent_r_proto" in
11489         ''|0)   d_endgrent_r=undef
11490                 endgrent_r_proto=0
11491                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11492         * )     case "$endgrent_r_proto" in
11493                 REENTRANT_PROTO*) ;;
11494                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11495                 esac
11496                 echo "Prototype: $try" ;;
11497         esac
11498         ;;
11499         *)      case "$usethreads" in
11500                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11501                 esac
11502                 d_endgrent_r=undef
11503                 endgrent_r_proto=0
11504                 ;;
11505         esac
11506         ;;
11507 *)      endgrent_r_proto=0
11508         ;;
11509 esac
11510
11511 : see if endhostent exists
11512 set endhostent d_endhent
11513 eval $inlibc
11514
11515 : see if this is a netdb.h system
11516 set netdb.h i_netdb
11517 eval $inhdr
11518
11519 : see if endhostent_r exists
11520 set endhostent_r d_endhostent_r
11521 eval $inlibc
11522 case "$d_endhostent_r" in
11523 "$define")
11524         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11525         case "$d_endhostent_r_proto:$usethreads" in
11526         ":define")      d_endhostent_r_proto=define
11527                 set d_endhostent_r_proto endhostent_r $hdrs
11528                 eval $hasproto ;;
11529         *)      ;;
11530         esac
11531         case "$d_endhostent_r_proto" in
11532         define)
11533         case "$endhostent_r_proto" in
11534         ''|0) try='int endhostent_r(struct hostent_data*);'
11535         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11536         esac
11537         case "$endhostent_r_proto" in
11538         ''|0) try='void endhostent_r(struct hostent_data*);'
11539         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11540         esac
11541         case "$endhostent_r_proto" in
11542         ''|0)   d_endhostent_r=undef
11543                 endhostent_r_proto=0
11544                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11545         * )     case "$endhostent_r_proto" in
11546                 REENTRANT_PROTO*) ;;
11547                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11548                 esac
11549                 echo "Prototype: $try" ;;
11550         esac
11551         ;;
11552         *)      case "$usethreads" in
11553                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11554                 esac
11555                 d_endhostent_r=undef
11556                 endhostent_r_proto=0
11557                 ;;
11558         esac
11559         ;;
11560 *)      endhostent_r_proto=0
11561         ;;
11562 esac
11563
11564 : see if endnetent exists
11565 set endnetent d_endnent
11566 eval $inlibc
11567
11568 : see if endnetent_r exists
11569 set endnetent_r d_endnetent_r
11570 eval $inlibc
11571 case "$d_endnetent_r" in
11572 "$define")
11573         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11574         case "$d_endnetent_r_proto:$usethreads" in
11575         ":define")      d_endnetent_r_proto=define
11576                 set d_endnetent_r_proto endnetent_r $hdrs
11577                 eval $hasproto ;;
11578         *)      ;;
11579         esac
11580         case "$d_endnetent_r_proto" in
11581         define)
11582         case "$endnetent_r_proto" in
11583         ''|0) try='int endnetent_r(struct netent_data*);'
11584         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11585         esac
11586         case "$endnetent_r_proto" in
11587         ''|0) try='void endnetent_r(struct netent_data*);'
11588         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11589         esac
11590         case "$endnetent_r_proto" in
11591         ''|0)   d_endnetent_r=undef
11592                 endnetent_r_proto=0
11593                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11594         * )     case "$endnetent_r_proto" in
11595                 REENTRANT_PROTO*) ;;
11596                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11597                 esac
11598                 echo "Prototype: $try" ;;
11599         esac
11600         ;;
11601         *)      case "$usethreads" in
11602                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11603                 esac
11604                 d_endnetent_r=undef
11605                 endnetent_r_proto=0
11606                 ;;
11607         esac
11608         ;;
11609 *)      endnetent_r_proto=0
11610         ;;
11611 esac
11612
11613 : see if endprotoent exists
11614 set endprotoent d_endpent
11615 eval $inlibc
11616
11617 : see if endprotoent_r exists
11618 set endprotoent_r d_endprotoent_r
11619 eval $inlibc
11620 case "$d_endprotoent_r" in
11621 "$define")
11622         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11623         case "$d_endprotoent_r_proto:$usethreads" in
11624         ":define")      d_endprotoent_r_proto=define
11625                 set d_endprotoent_r_proto endprotoent_r $hdrs
11626                 eval $hasproto ;;
11627         *)      ;;
11628         esac
11629         case "$d_endprotoent_r_proto" in
11630         define)
11631         case "$endprotoent_r_proto" in
11632         ''|0) try='int endprotoent_r(struct protoent_data*);'
11633         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11634         esac
11635         case "$endprotoent_r_proto" in
11636         ''|0) try='void endprotoent_r(struct protoent_data*);'
11637         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11638         esac
11639         case "$endprotoent_r_proto" in
11640         ''|0)   d_endprotoent_r=undef
11641                 endprotoent_r_proto=0
11642                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11643         * )     case "$endprotoent_r_proto" in
11644                 REENTRANT_PROTO*) ;;
11645                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11646                 esac
11647                 echo "Prototype: $try" ;;
11648         esac
11649         ;;
11650         *)      case "$usethreads" in
11651                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11652                 esac
11653                 d_endprotoent_r=undef
11654                 endprotoent_r_proto=0
11655                 ;;
11656         esac
11657         ;;
11658 *)      endprotoent_r_proto=0
11659         ;;
11660 esac
11661
11662 : see if endpwent exists
11663 set endpwent d_endpwent
11664 eval $inlibc
11665
11666 : see if this is a pwd.h system
11667 set pwd.h i_pwd
11668 eval $inhdr
11669
11670 case "$i_pwd" in
11671 $define)
11672         xxx=`./findhdr pwd.h`
11673         $cppstdin $cppflags $cppminus < $xxx >$$.h
11674
11675         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11676                 val="$define"
11677         else
11678                 val="$undef"
11679         fi
11680         set d_pwquota
11681         eval $setvar
11682
11683         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11684                 val="$define"
11685         else
11686                 val="$undef"
11687         fi
11688         set d_pwage
11689         eval $setvar
11690
11691         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11692                 val="$define"
11693         else
11694                 val="$undef"
11695         fi
11696         set d_pwchange
11697         eval $setvar
11698
11699         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11700                 val="$define"
11701         else
11702                 val="$undef"
11703         fi
11704         set d_pwclass
11705         eval $setvar
11706
11707         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11708                 val="$define"
11709         else
11710                 val="$undef"
11711         fi
11712         set d_pwexpire
11713         eval $setvar
11714
11715         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11716                 val="$define"
11717         else
11718                 val="$undef"
11719         fi
11720         set d_pwcomment
11721         eval $setvar
11722
11723         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11724                 val="$define"
11725         else
11726                 val="$undef"
11727         fi
11728         set d_pwgecos
11729         eval $setvar
11730
11731         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11732                 val="$define"
11733         else
11734                 val="$undef"
11735         fi
11736         set d_pwpasswd
11737         eval $setvar
11738
11739         $rm -f $$.h
11740         ;;
11741 *)
11742         val="$undef"; 
11743         set d_pwquota; eval $setvar
11744         set d_pwage; eval $setvar
11745         set d_pwchange; eval $setvar
11746         set d_pwclass; eval $setvar
11747         set d_pwexpire; eval $setvar
11748         set d_pwcomment; eval $setvar
11749         set d_pwgecos; eval $setvar
11750         set d_pwpasswd; eval $setvar
11751         ;;
11752 esac
11753
11754 : see if endpwent_r exists
11755 set endpwent_r d_endpwent_r
11756 eval $inlibc
11757 case "$d_endpwent_r" in
11758 "$define")
11759         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11760         case "$d_endpwent_r_proto:$usethreads" in
11761         ":define")      d_endpwent_r_proto=define
11762                 set d_endpwent_r_proto endpwent_r $hdrs
11763                 eval $hasproto ;;
11764         *)      ;;
11765         esac
11766         case "$d_endpwent_r_proto" in
11767         define)
11768         case "$endpwent_r_proto" in
11769         ''|0) try='int endpwent_r(FILE**);'
11770         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11771         esac
11772         case "$endpwent_r_proto" in
11773         ''|0) try='void endpwent_r(FILE**);'
11774         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11775         esac
11776         case "$endpwent_r_proto" in
11777         ''|0)   d_endpwent_r=undef
11778                 endpwent_r_proto=0
11779                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11780         * )     case "$endpwent_r_proto" in
11781                 REENTRANT_PROTO*) ;;
11782                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11783                 esac
11784                 echo "Prototype: $try" ;;
11785         esac
11786         ;;
11787         *)      case "$usethreads" in
11788                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11789                 esac
11790                 d_endpwent_r=undef
11791                 endpwent_r_proto=0
11792                 ;;
11793         esac
11794         ;;
11795 *)      endpwent_r_proto=0
11796         ;;
11797 esac
11798
11799 : see if endservent exists
11800 set endservent d_endsent
11801 eval $inlibc
11802
11803 : see if endservent_r exists
11804 set endservent_r d_endservent_r
11805 eval $inlibc
11806 case "$d_endservent_r" in
11807 "$define")
11808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11809         case "$d_endservent_r_proto:$usethreads" in
11810         ":define")      d_endservent_r_proto=define
11811                 set d_endservent_r_proto endservent_r $hdrs
11812                 eval $hasproto ;;
11813         *)      ;;
11814         esac
11815         case "$d_endservent_r_proto" in
11816         define)
11817         case "$endservent_r_proto" in
11818         ''|0) try='int endservent_r(struct servent_data*);'
11819         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11820         esac
11821         case "$endservent_r_proto" in
11822         ''|0) try='void endservent_r(struct servent_data*);'
11823         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11824         esac
11825         case "$endservent_r_proto" in
11826         ''|0)   d_endservent_r=undef
11827                 endservent_r_proto=0
11828                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11829         * )     case "$endservent_r_proto" in
11830                 REENTRANT_PROTO*) ;;
11831                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11832                 esac
11833                 echo "Prototype: $try" ;;
11834         esac
11835         ;;
11836         *)      case "$usethreads" in
11837                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11838                 esac
11839                 d_endservent_r=undef
11840                 endservent_r_proto=0
11841                 ;;
11842         esac
11843         ;;
11844 *)      endservent_r_proto=0
11845         ;;
11846 esac
11847
11848 : Locate the flags for 'open()'
11849 echo " "
11850 $cat >try.c <<EOCP
11851 #include <sys/types.h>
11852 #ifdef I_FCNTL
11853 #include <fcntl.h>
11854 #endif
11855 #ifdef I_SYS_FILE
11856 #include <sys/file.h>
11857 #endif
11858 #$i_stdlib I_STDLIB
11859 #ifdef I_STDLIB
11860 #include <stdlib.h>
11861 #endif
11862 int main() {
11863         if(O_RDONLY);
11864 #ifdef O_TRUNC
11865         exit(0);
11866 #else
11867         exit(1);
11868 #endif
11869 }
11870 EOCP
11871 : check sys/file.h first to get FREAD on Sun
11872 if $test `./findhdr sys/file.h` && \
11873                 set try -DI_SYS_FILE && eval $compile; then
11874         h_sysfile=true;
11875         echo "<sys/file.h> defines the O_* constants..." >&4
11876         if $run ./try; then
11877                 echo "and you have the 3 argument form of open()." >&4
11878                 val="$define"
11879         else
11880                 echo "but not the 3 argument form of open().  Oh, well." >&4
11881                 val="$undef"
11882         fi
11883 elif $test `./findhdr fcntl.h` && \
11884                 set try -DI_FCNTL && eval $compile; then
11885         h_fcntl=true;
11886         echo "<fcntl.h> defines the O_* constants..." >&4
11887         if $run ./try; then
11888                 echo "and you have the 3 argument form of open()." >&4
11889                 val="$define"
11890         else
11891                 echo "but not the 3 argument form of open().  Oh, well." >&4
11892                 val="$undef"
11893         fi
11894 else
11895         val="$undef"
11896         echo "I can't find the O_* constant definitions!  You got problems." >&4
11897 fi
11898 set d_open3
11899 eval $setvar
11900 $rm -f try try.*
11901
11902 : see which of string.h or strings.h is needed
11903 echo " "
11904 strings=`./findhdr string.h`
11905 if $test "$strings" && $test -r "$strings"; then
11906         echo "Using <string.h> instead of <strings.h>." >&4
11907         val="$define"
11908 else
11909         val="$undef"
11910         strings=`./findhdr strings.h`
11911         if $test "$strings" && $test -r "$strings"; then
11912                 echo "Using <strings.h> instead of <string.h>." >&4
11913         else
11914                 echo "No string header found -- You'll surely have problems." >&4
11915         fi
11916 fi
11917 set i_string
11918 eval $setvar
11919 case "$i_string" in
11920 "$undef") strings=`./findhdr strings.h`;;
11921 *)        strings=`./findhdr string.h`;;
11922 esac
11923
11924 : see if this is a sys/file.h system
11925 val=''
11926 set sys/file.h val
11927 eval $inhdr
11928
11929 : do we need to include sys/file.h ?
11930 case "$val" in
11931 "$define")
11932         echo " "
11933         if $h_sysfile; then
11934                 val="$define"
11935                 echo "We'll be including <sys/file.h>." >&4
11936         else
11937                 val="$undef"
11938                 echo "We won't be including <sys/file.h>." >&4
11939         fi
11940         ;;
11941 *)
11942         h_sysfile=false
11943         ;;
11944 esac
11945 set i_sysfile
11946 eval $setvar
11947
11948 : see if fcntl.h is there
11949 val=''
11950 set fcntl.h val
11951 eval $inhdr
11952
11953 : see if we can include fcntl.h
11954 case "$val" in
11955 "$define")
11956         echo " "
11957         if $h_fcntl; then
11958                 val="$define"
11959                 echo "We'll be including <fcntl.h>." >&4
11960         else
11961                 val="$undef"
11962                 if $h_sysfile; then
11963         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11964                 else
11965                         echo "We won't be including <fcntl.h>." >&4
11966                 fi
11967         fi
11968         ;;
11969 *)
11970         h_fcntl=false
11971         val="$undef"
11972         ;;
11973 esac
11974 set i_fcntl
11975 eval $setvar
11976
11977 : check for non-blocking I/O stuff
11978 case "$h_sysfile" in
11979 true) echo "#include <sys/file.h>" > head.c;;
11980 *)
11981        case "$h_fcntl" in
11982        true) echo "#include <fcntl.h>" > head.c;;
11983        *) echo "#include <sys/fcntl.h>" > head.c;;
11984        esac
11985        ;;
11986 esac
11987 echo " "
11988 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11989 case "$o_nonblock" in
11990 '')
11991         $cat head.c > try.c
11992         $cat >>try.c <<EOCP
11993 #include <stdio.h>
11994 #$i_stdlib I_STDLIB
11995 #ifdef I_STDLIB
11996 #include <stdlib.h>
11997 #endif
11998 #$i_fcntl I_FCNTL
11999 #ifdef I_FCNTL
12000 #include <fcntl.h>
12001 #endif
12002 int main() {
12003 #ifdef O_NONBLOCK
12004         printf("O_NONBLOCK\n");
12005         exit(0);
12006 #endif
12007 #ifdef O_NDELAY
12008         printf("O_NDELAY\n");
12009         exit(0);
12010 #endif
12011 #ifdef FNDELAY
12012         printf("FNDELAY\n");
12013         exit(0);
12014 #endif
12015         exit(0);
12016 }
12017 EOCP
12018         set try
12019         if eval $compile_ok; then
12020                 o_nonblock=`$run ./try`
12021                 case "$o_nonblock" in
12022                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12023                 *) echo "Seems like we can use $o_nonblock.";;
12024                 esac
12025         else
12026                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12027         fi
12028         ;;
12029 *) echo "Using $hint value $o_nonblock.";;
12030 esac
12031 $rm -f try try.* .out core
12032
12033 echo " "
12034 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12035 case "$eagain" in
12036 '')
12037         $cat head.c > try.c
12038         $cat >>try.c <<EOCP
12039 #include <errno.h>
12040 #include <sys/types.h>
12041 #include <signal.h>
12042 #include <stdio.h> 
12043 #$i_stdlib I_STDLIB
12044 #ifdef I_STDLIB
12045 #include <stdlib.h>
12046 #endif
12047 #$i_fcntl I_FCNTL
12048 #ifdef I_FCNTL
12049 #include <fcntl.h>
12050 #endif
12051 #define MY_O_NONBLOCK $o_nonblock
12052 #ifndef errno  /* XXX need better Configure test */
12053 extern int errno;
12054 #endif
12055 #$i_unistd I_UNISTD
12056 #ifdef I_UNISTD
12057 #include <unistd.h>
12058 #endif
12059 #$i_string I_STRING
12060 #ifdef I_STRING
12061 #include <string.h>
12062 #else
12063 #include <strings.h>
12064 #endif
12065 $signal_t blech(x) int x; { exit(3); }
12066 EOCP
12067         $cat >> try.c <<'EOCP'
12068 int main()
12069 {
12070         int pd[2];
12071         int pu[2];
12072         char buf[1];
12073         char string[100];
12074
12075         pipe(pd);       /* Down: child -> parent */
12076         pipe(pu);       /* Up: parent -> child */
12077         if (0 != fork()) {
12078                 int ret;
12079                 close(pd[1]);   /* Parent reads from pd[0] */
12080                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12081 #ifdef F_SETFL
12082                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12083                         exit(1);
12084 #else
12085                 exit(4);
12086 #endif
12087                 signal(SIGALRM, blech);
12088                 alarm(5);
12089                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12090                         exit(2);
12091                 sprintf(string, "%d\n", ret);
12092                 write(2, string, strlen(string));
12093                 alarm(0);
12094 #ifdef EAGAIN
12095                 if (errno == EAGAIN) {
12096                         printf("EAGAIN\n");
12097                         goto ok;
12098                 }
12099 #endif
12100 #ifdef EWOULDBLOCK
12101                 if (errno == EWOULDBLOCK)
12102                         printf("EWOULDBLOCK\n");
12103 #endif
12104         ok:
12105                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12106                 sleep(2);                               /* Give it time to close our pipe */
12107                 alarm(5);
12108                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12109                 alarm(0);
12110                 sprintf(string, "%d\n", ret);
12111                 write(4, string, strlen(string));
12112                 exit(0);
12113         }
12114
12115         close(pd[0]);                   /* We write to pd[1] */
12116         close(pu[1]);                   /* We read from pu[0] */
12117         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12118         close(pd[1]);                   /* Pipe pd is now fully closed! */
12119         exit(0);                                /* Bye bye, thank you for playing! */
12120 }
12121 EOCP
12122         set try
12123         if eval $compile_ok; then
12124                 echo "$startsh" >mtry
12125                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12126                 chmod +x mtry
12127                 ./mtry >/dev/null 2>&1
12128                 case $? in
12129                 0) eagain=`$cat try.out`;;
12130                 1) echo "Could not perform non-blocking setting!";;
12131                 2) echo "I did a successful read() for something that was not there!";;
12132                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12133                 4) echo "Could not find F_SETFL!";;
12134                 *) echo "Something terribly wrong happened during testing.";;
12135                 esac
12136                 rd_nodata=`$cat try.ret`
12137                 echo "A read() system call with no data present returns $rd_nodata."
12138                 case "$rd_nodata" in
12139                 0|-1) ;;
12140                 *)
12141                         echo "(That's peculiar, fixing that to be -1.)"
12142                         rd_nodata=-1
12143                         ;;
12144                 esac
12145                 case "$eagain" in
12146                 '')
12147                         echo "Forcing errno EAGAIN on read() with no data available."
12148                         eagain=EAGAIN
12149                         ;;
12150                 *)
12151                         echo "Your read() sets errno to $eagain when no data is available."
12152                         ;;
12153                 esac
12154                 status=`$cat try.err`
12155                 case "$status" in
12156                 0) echo "And it correctly returns 0 to signal EOF.";;
12157                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12158                 *) echo "However, your read() returns '$status' on EOF??";;
12159                 esac
12160                 val="$define"
12161                 if test "$status" = "$rd_nodata"; then
12162                         echo "WARNING: you can't distinguish between EOF and no data!"
12163                         val="$undef"
12164                 fi
12165         else
12166                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12167                 eagain=EAGAIN
12168         fi
12169         set d_eofnblk
12170         eval $setvar
12171         ;;
12172 *)
12173         echo "Using $hint value $eagain."
12174         echo "Your read() returns $rd_nodata when no data is present."
12175         case "$d_eofnblk" in
12176         "$define") echo "And you can see EOF because read() returns 0.";;
12177         "$undef") echo "But you can't see EOF status from read() returned value.";;
12178         *)
12179                 echo "(Assuming you can't see EOF status from read anyway.)"
12180                 d_eofnblk=$undef
12181                 ;;
12182         esac
12183         ;;
12184 esac
12185 $rm -f try try.* .out core head.c mtry
12186
12187 : see if _ptr and _cnt from stdio act std
12188 echo " "
12189
12190 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12191         echo "(Looks like you have stdio.h from BSD.)"
12192         case "$stdio_ptr" in
12193         '') stdio_ptr='((fp)->_p)'
12194                 ptr_lval=$define
12195                 ;;
12196         *)      ptr_lval=$d_stdio_ptr_lval;;
12197         esac
12198         case "$stdio_cnt" in
12199         '') stdio_cnt='((fp)->_r)'
12200                 cnt_lval=$define
12201                 ;;
12202         *)      cnt_lval=$d_stdio_cnt_lval;;
12203         esac
12204         case "$stdio_base" in
12205         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12206         esac
12207         case "$stdio_bufsiz" in
12208         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12209         esac
12210 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12211         echo "(Looks like you have stdio.h from Linux.)"
12212         case "$stdio_ptr" in
12213         '') stdio_ptr='((fp)->_IO_read_ptr)'
12214                 ptr_lval=$define
12215                 ;;
12216         *)      ptr_lval=$d_stdio_ptr_lval;;
12217         esac
12218         case "$stdio_cnt" in
12219         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12220                 cnt_lval=$undef
12221                 ;;
12222         *)      cnt_lval=$d_stdio_cnt_lval;;
12223         esac
12224         case "$stdio_base" in
12225         '') stdio_base='((fp)->_IO_read_base)';;
12226         esac
12227         case "$stdio_bufsiz" in
12228         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12229         esac
12230 else
12231         case "$stdio_ptr" in
12232         '') stdio_ptr='((fp)->_ptr)'
12233                 ptr_lval=$define
12234                 ;;
12235         *)      ptr_lval=$d_stdio_ptr_lval;;
12236         esac
12237         case "$stdio_cnt" in
12238         '') stdio_cnt='((fp)->_cnt)'
12239                 cnt_lval=$define
12240                 ;;
12241         *)      cnt_lval=$d_stdio_cnt_lval;;
12242         esac
12243         case "$stdio_base" in
12244         '') stdio_base='((fp)->_base)';;
12245         esac
12246         case "$stdio_bufsiz" in
12247         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12248         esac
12249 fi
12250
12251 : test whether _ptr and _cnt really work
12252 echo "Checking how std your stdio is..." >&4
12253 $cat >try.c <<EOP
12254 #include <stdio.h>
12255 #$i_stdlib I_STDLIB
12256 #ifdef I_STDLIB
12257 #include <stdlib.h>
12258 #endif
12259 #define FILE_ptr(fp)    $stdio_ptr
12260 #define FILE_cnt(fp)    $stdio_cnt
12261 int main() {
12262         FILE *fp = fopen("try.c", "r");
12263         char c = getc(fp);
12264         if (
12265                 18 <= FILE_cnt(fp) &&
12266                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12267         )
12268                 exit(0);
12269         exit(1);
12270 }
12271 EOP
12272 val="$undef"
12273 set try
12274 if eval $compile && $to try.c; then
12275         if $run ./try; then
12276                 echo "Your stdio acts pretty std."
12277                 val="$define"
12278         else
12279                 echo "Your stdio isn't very std."
12280         fi
12281 else
12282         echo "Your stdio doesn't appear very std."
12283 fi
12284 $rm -f try.c try
12285
12286 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12287 # direct buffer manipulation no longer works.  The Configure tests
12288 # should be changed to correctly detect this, but until then,
12289 # the following check should at least let perl compile and run.
12290 # (This quick fix should be updated before 5.8.1.)
12291 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12292 # A. Dougherty, June 3, 2002.
12293 case "$d_gnulibc" in
12294 $define)
12295         case "$gnulibc_version" in
12296         2.[01]*)  ;;
12297         2.2) ;;
12298         2.2.[0-9]) ;;
12299         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12300                 val="$undef"
12301                 ;;
12302         esac
12303         ;;
12304 esac
12305 set d_stdstdio
12306 eval $setvar
12307
12308 : Can _ptr be used as an lvalue?
12309 case "$d_stdstdio$ptr_lval" in
12310 $define$define) val=$define ;;
12311 *) val=$undef ;;
12312 esac
12313 set d_stdio_ptr_lval
12314 eval $setvar
12315
12316 : Can _cnt be used as an lvalue?
12317 case "$d_stdstdio$cnt_lval" in
12318 $define$define) val=$define ;;
12319 *) val=$undef ;;
12320 esac
12321 set d_stdio_cnt_lval
12322 eval $setvar
12323
12324
12325 : test whether setting _ptr sets _cnt as a side effect
12326 d_stdio_ptr_lval_sets_cnt="$undef"
12327 d_stdio_ptr_lval_nochange_cnt="$undef"
12328 case "$d_stdio_ptr_lval$d_stdstdio" in
12329 $define$define)
12330         echo "Checking to see what happens if we set the stdio ptr..." >&4
12331 $cat >try.c <<EOP
12332 #include <stdio.h>
12333 /* Can we scream? */
12334 /* Eat dust sed :-) */
12335 /* In the buffer space, no one can hear you scream. */
12336 #$i_stdlib I_STDLIB
12337 #ifdef I_STDLIB
12338 #include <stdlib.h>
12339 #endif
12340 #define FILE_ptr(fp)    $stdio_ptr
12341 #define FILE_cnt(fp)    $stdio_cnt
12342 #include <sys/types.h>
12343 int main() {
12344         FILE *fp = fopen("try.c", "r");
12345         int c;
12346         char *ptr;
12347         size_t cnt;
12348         if (!fp) {
12349             puts("Fail even to read");
12350             exit(1);
12351         }
12352         c = getc(fp); /* Read away the first # */
12353         if (c == EOF) {
12354             puts("Fail even to read");
12355             exit(1);
12356         }
12357         if (!(
12358                 18 <= FILE_cnt(fp) &&
12359                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12360         )) {
12361                 puts("Fail even to read");
12362                 exit (1);
12363         }
12364         ptr = (char*) FILE_ptr(fp);
12365         cnt = (size_t)FILE_cnt(fp);
12366
12367         FILE_ptr(fp) += 42;
12368
12369         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12370                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12371                 exit (1);
12372         }
12373         if (FILE_cnt(fp) <= 20) {
12374                 printf ("Fail (<20 chars to test)");
12375                 exit (1);
12376         }
12377         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12378                 puts("Fail compare");
12379                 exit (1);
12380         }
12381         if (cnt == FILE_cnt(fp)) {
12382                 puts("Pass_unchanged");
12383                 exit (0);
12384         }       
12385         if (FILE_cnt(fp) == (cnt - 42)) {
12386                 puts("Pass_changed");
12387                 exit (0);
12388         }
12389         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12390         return 1;
12391
12392 }
12393 EOP
12394         set try
12395         if eval $compile && $to try.c; then
12396                 case `$run ./try` in
12397                 Pass_changed)
12398                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12399                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12400                 Pass_unchanged)
12401                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12402                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12403                 Fail*)
12404                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12405                 *)
12406                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12407         esac
12408         else
12409                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12410         fi
12411         $rm -f try.c try
12412         ;;
12413 esac
12414
12415 : see if _base is also standard
12416 val="$undef"
12417 case "$d_stdstdio" in
12418 $define)
12419         $cat >try.c <<EOP
12420 #include <stdio.h>
12421 #$i_stdlib I_STDLIB
12422 #ifdef I_STDLIB
12423 #include <stdlib.h>
12424 #endif
12425 #define FILE_base(fp)   $stdio_base
12426 #define FILE_bufsiz(fp) $stdio_bufsiz
12427 int main() {
12428         FILE *fp = fopen("try.c", "r");
12429         char c = getc(fp);
12430         if (
12431                 19 <= FILE_bufsiz(fp) &&
12432                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12433         )
12434                 exit(0);
12435         exit(1);
12436 }
12437 EOP
12438         set try
12439         if eval $compile && $to try.c; then
12440                 if $run ./try; then
12441                         echo "And its _base field acts std."
12442                         val="$define"
12443                 else
12444                         echo "But its _base field isn't std."
12445                 fi
12446         else
12447                 echo "However, it seems to be lacking the _base field."
12448         fi
12449         $rm -f try.c try
12450         ;;
12451 esac
12452 set d_stdiobase
12453 eval $setvar
12454
12455 : see if fast_stdio exists
12456 val="$undef"
12457 case "$d_stdstdio:$d_stdio_ptr_lval" in
12458 "$define:$define")
12459         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12460         *$define*)
12461                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12462                 val="$define"
12463                 ;;
12464         esac
12465         ;;
12466 esac
12467 set d_faststdio
12468 eval $setvar
12469
12470
12471
12472 : see if fchdir exists
12473 set fchdir d_fchdir
12474 eval $inlibc
12475
12476 : see if fchmod exists
12477 set fchmod d_fchmod
12478 eval $inlibc
12479
12480 : see if fchown exists
12481 set fchown d_fchown
12482 eval $inlibc
12483
12484 : see if this is an fcntl system
12485 set fcntl d_fcntl
12486 eval $inlibc
12487
12488 echo " "
12489 : See if fcntl-based locking works.
12490 $cat >try.c <<EOCP
12491 #$i_stdlib I_STDLIB
12492 #ifdef I_STDLIB
12493 #include <stdlib.h>
12494 #endif
12495 #include <unistd.h>
12496 #include <fcntl.h>
12497 #include <signal.h>
12498 $signal_t blech(x) int x; { exit(3); }
12499 int main() {
12500 #if defined(F_SETLK) && defined(F_SETLKW)
12501      struct flock flock;
12502      int retval, fd;
12503      fd = open("try.c", O_RDONLY);
12504      flock.l_type = F_RDLCK;
12505      flock.l_whence = SEEK_SET;
12506      flock.l_start = flock.l_len = 0;
12507      signal(SIGALRM, blech);
12508      alarm(10);
12509      retval = fcntl(fd, F_SETLK, &flock);
12510      close(fd);
12511      (retval < 0 ? exit(2) : exit(0));
12512 #else
12513      exit(2);
12514 #endif
12515 }
12516 EOCP
12517 echo "Checking if fcntl-based file locking works... "
12518 case "$d_fcntl" in
12519 "$define")
12520         set try
12521         if eval $compile_ok; then
12522                 if $run ./try; then
12523                         echo "Yes, it seems to work."
12524                         val="$define"
12525                 else
12526                         echo "Nope, it didn't work."
12527                         val="$undef"
12528                         case "$?" in
12529                         3) $cat >&4 <<EOM
12530 ***
12531 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12532 *** This is (almost) impossible.
12533 *** If your NFS lock daemons are not feeling well, something like
12534 *** this may happen, please investigate.  Cannot continue, aborting.
12535 ***
12536 EOM
12537                                 exit 1
12538                                 ;;
12539                         esac
12540                 fi
12541         else
12542                 echo "I'm unable to compile the test program, so I'll assume not."
12543                 val="$undef"
12544         fi
12545         ;;
12546 *) val="$undef";
12547         echo "Nope, since you don't even have fcntl()."
12548         ;;
12549 esac
12550 set d_fcntl_can_lock
12551 eval $setvar
12552 $rm -f try*
12553
12554
12555 : check for fd_set items
12556 $cat <<EOM
12557
12558 Checking to see how well your C compiler handles fd_set and friends ...
12559 EOM
12560 $cat >try.c <<EOCP
12561 #$i_stdlib I_STDLIB
12562 #ifdef I_STDLIB
12563 #include <stdlib.h>
12564 #endif
12565 #$i_systime I_SYS_TIME
12566 #$i_sysselct I_SYS_SELECT
12567 #$d_socket HAS_SOCKET
12568 #include <sys/types.h>
12569 #ifdef HAS_SOCKET
12570 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12571 #endif
12572 #ifdef I_SYS_TIME
12573 #include <sys/time.h>
12574 #endif
12575 #ifdef I_SYS_SELECT
12576 #include <sys/select.h>
12577 #endif
12578 int main() {
12579         fd_set fds;
12580
12581 #ifdef TRYBITS
12582         if(fds.fds_bits);
12583 #endif
12584
12585 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12586         exit(0);
12587 #else
12588         exit(1);
12589 #endif
12590 }
12591 EOCP
12592 set try -DTRYBITS
12593 if eval $compile; then
12594         d_fds_bits="$define"
12595         d_fd_set="$define"
12596         echo "Well, your system knows about the normal fd_set typedef..." >&4
12597         if $run ./try; then
12598                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12599                 d_fd_macros="$define"
12600         else
12601                 $cat >&4 <<'EOM'
12602 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12603 EOM
12604                 d_fd_macros="$undef"
12605         fi
12606 else
12607         $cat <<'EOM'
12608 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12609 EOM
12610         set try
12611         if eval $compile; then
12612                 d_fds_bits="$undef"
12613                 d_fd_set="$define"
12614                 echo "Well, your system has some sort of fd_set available..." >&4
12615                 if $run ./try; then
12616                         echo "and you have the normal fd_set macros." >&4
12617                         d_fd_macros="$define"
12618                 else
12619                         $cat <<'EOM'
12620 but not the normal fd_set macros!  Gross!  More work for me...
12621 EOM
12622                         d_fd_macros="$undef"
12623                 fi
12624         else
12625         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12626                 d_fd_set="$undef"
12627                 d_fds_bits="$undef"
12628                 d_fd_macros="$undef"
12629         fi
12630 fi
12631 $rm -f try try.*
12632
12633 : see if fgetpos exists
12634 set fgetpos d_fgetpos
12635 eval $inlibc
12636
12637 : see if finite exists
12638 set finite d_finite
12639 eval $inlibc
12640
12641 : see if finitel exists
12642 set finitel d_finitel
12643 eval $inlibc
12644
12645 : see if flock exists
12646 set flock d_flock
12647 eval $inlibc
12648
12649 : see if prototype for flock is available
12650 echo " "
12651 set d_flockproto flock $i_sysfile sys/file.h
12652 eval $hasproto
12653
12654 : see if fork exists
12655 set fork d_fork
12656 eval $inlibc
12657
12658 : see if fp_class exists
12659 set fp_class d_fp_class
12660 eval $inlibc
12661
12662 : see if pathconf exists
12663 set pathconf d_pathconf
12664 eval $inlibc
12665
12666 : see if fpathconf exists
12667 set fpathconf d_fpathconf
12668 eval $inlibc
12669
12670 : see if fpclass exists
12671 set fpclass d_fpclass
12672 eval $inlibc
12673
12674 : see if fpclassify exists
12675 set fpclassify d_fpclassify
12676 eval $inlibc
12677
12678 : see if fpclassl exists
12679 set fpclassl d_fpclassl
12680 eval $inlibc
12681
12682
12683 : check for fpos64_t
12684 echo " "
12685 echo "Checking to see if you have fpos64_t..." >&4
12686 $cat >try.c <<EOCP
12687 #include <stdio.h>
12688 int main() { fpos64_t x = 7; }
12689 EOCP
12690 set try
12691 if eval $compile; then
12692         val="$define"
12693         echo "You have fpos64_t."
12694 else
12695         val="$undef"
12696         echo "You do not have fpos64_t."
12697         case "$fpossize" in
12698         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12699         esac
12700 fi
12701 $rm -f try.* try
12702 set d_fpos64_t
12703 eval $setvar
12704
12705 : see if frexpl exists
12706 set frexpl d_frexpl
12707 eval $inlibc
12708
12709 : see if this is a sys/param system
12710 set sys/param.h i_sysparam
12711 eval $inhdr
12712
12713 : see if this is a sys/mount.h system
12714 set sys/mount.h i_sysmount
12715 eval $inhdr
12716
12717
12718 echo " "
12719 echo "Checking to see if your system supports struct fs_data..." >&4
12720 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12721 eval $hasstruct
12722 case "$d_fs_data_s" in
12723 "$define")      echo "Yes, it does."   ;;
12724 *)              echo "No, it doesn't." ;;
12725 esac
12726
12727 : see if fseeko exists
12728 set fseeko d_fseeko
12729 eval $inlibc
12730 case "$longsize" in
12731 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12732 esac
12733
12734 : see if fsetpos exists
12735 set fsetpos d_fsetpos
12736 eval $inlibc
12737
12738
12739 : see if fstatfs exists
12740 set fstatfs d_fstatfs
12741 eval $inlibc
12742
12743
12744 : see if statvfs exists
12745 set statvfs d_statvfs
12746 eval $inlibc
12747
12748 : see if fstatvfs exists
12749 set fstatvfs d_fstatvfs
12750 eval $inlibc
12751
12752
12753 : see if fsync exists
12754 set fsync d_fsync
12755 eval $inlibc
12756
12757 : see if ftello exists
12758 set ftello d_ftello
12759 eval $inlibc
12760 case "$longsize" in
12761 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12762 esac
12763
12764 d_futimes="$undef"
12765 : check for a working futimes
12766 echo " "
12767 echo "Checking for a working futimes()" >&4
12768 $cat >try.c <<EOCP
12769 #include <stdio.h>
12770 #include <sys/time.h>
12771 #include <errno.h>
12772 #include <fcntl.h>
12773
12774 int main ()
12775 {
12776     int fd, rv;
12777     fd = open ("try.c", O_RDWR);
12778     if (-1 == fd) exit (1);
12779     rv = futimes (fd, NULL);
12780     exit (rv == -1 ? errno : 0);
12781 }
12782 EOCP
12783 set try
12784 if eval $compile; then
12785     `$run ./try`
12786     rc=$?
12787     case "$rc" in
12788         0)  echo "Yes, it does" >&4
12789             d_futimes="$define"
12790             ;;
12791         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12792             ;;
12793     esac
12794 else
12795     echo "No, it does not (probably harmless)\n" >&4
12796 fi
12797 $rm -f try.* try core core.try.*
12798
12799 : see if getcwd exists
12800 set getcwd d_getcwd
12801 eval $inlibc
12802
12803 : see if getespwnam exists
12804 set getespwnam d_getespwnam
12805 eval $inlibc
12806
12807
12808 : see if getfsstat exists
12809 set getfsstat d_getfsstat
12810 eval $inlibc
12811
12812 : see if getgrent exists
12813 set getgrent d_getgrent
12814 eval $inlibc
12815
12816 : see if getgrent_r exists
12817 set getgrent_r d_getgrent_r
12818 eval $inlibc
12819 case "$d_getgrent_r" in
12820 "$define")
12821         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12822         case "$d_getgrent_r_proto:$usethreads" in
12823         ":define")      d_getgrent_r_proto=define
12824                 set d_getgrent_r_proto getgrent_r $hdrs
12825                 eval $hasproto ;;
12826         *)      ;;
12827         esac
12828         case "$d_getgrent_r_proto" in
12829         define)
12830         case "$getgrent_r_proto" in
12831         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12832         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12833         esac
12834         case "$getgrent_r_proto" in
12835         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12836         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12837         esac
12838         case "$getgrent_r_proto" in
12839         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12840         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12841         esac
12842         case "$getgrent_r_proto" in
12843         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12844         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12845         esac
12846         case "$getgrent_r_proto" in
12847         ''|0) try='int getgrent_r(struct group*, char*, int);'
12848         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12849         esac
12850         case "$getgrent_r_proto" in
12851         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12852         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12853         esac
12854         case "$getgrent_r_proto" in
12855         ''|0)   d_getgrent_r=undef
12856                 getgrent_r_proto=0
12857                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12858         * )     case "$getgrent_r_proto" in
12859                 REENTRANT_PROTO*) ;;
12860                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12861                 esac
12862                 echo "Prototype: $try" ;;
12863         esac
12864         ;;
12865         *)      case "$usethreads" in
12866                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12867                 esac
12868                 d_getgrent_r=undef
12869                 getgrent_r_proto=0
12870                 ;;
12871         esac
12872         ;;
12873 *)      getgrent_r_proto=0
12874         ;;
12875 esac
12876
12877 : see if getgrgid_r exists
12878 set getgrgid_r d_getgrgid_r
12879 eval $inlibc
12880 case "$d_getgrgid_r" in
12881 "$define")
12882         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12883         case "$d_getgrgid_r_proto:$usethreads" in
12884         ":define")      d_getgrgid_r_proto=define
12885                 set d_getgrgid_r_proto getgrgid_r $hdrs
12886                 eval $hasproto ;;
12887         *)      ;;
12888         esac
12889         case "$d_getgrgid_r_proto" in
12890         define)
12891         case "$getgrgid_r_proto" in
12892         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12893         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12894         esac
12895         case "$getgrgid_r_proto" in
12896         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12897         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12898         esac
12899         case "$getgrgid_r_proto" in
12900         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12901         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12902         esac
12903         case "$getgrgid_r_proto" in
12904         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12905         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12906         esac
12907         case "$getgrgid_r_proto" in
12908         ''|0)   d_getgrgid_r=undef
12909                 getgrgid_r_proto=0
12910                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12911         * )     case "$getgrgid_r_proto" in
12912                 REENTRANT_PROTO*) ;;
12913                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12914                 esac
12915                 echo "Prototype: $try" ;;
12916         esac
12917         ;;
12918         *)      case "$usethreads" in
12919                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12920                 esac
12921                 d_getgrgid_r=undef
12922                 getgrgid_r_proto=0
12923                 ;;
12924         esac
12925         ;;
12926 *)      getgrgid_r_proto=0
12927         ;;
12928 esac
12929
12930 : see if getgrnam_r exists
12931 set getgrnam_r d_getgrnam_r
12932 eval $inlibc
12933 case "$d_getgrnam_r" in
12934 "$define")
12935         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12936         case "$d_getgrnam_r_proto:$usethreads" in
12937         ":define")      d_getgrnam_r_proto=define
12938                 set d_getgrnam_r_proto getgrnam_r $hdrs
12939                 eval $hasproto ;;
12940         *)      ;;
12941         esac
12942         case "$d_getgrnam_r_proto" in
12943         define)
12944         case "$getgrnam_r_proto" in
12945         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12946         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12947         esac
12948         case "$getgrnam_r_proto" in
12949         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12950         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12951         esac
12952         case "$getgrnam_r_proto" in
12953         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12954         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12955         esac
12956         case "$getgrnam_r_proto" in
12957         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12958         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12959         esac
12960         case "$getgrnam_r_proto" in
12961         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12962         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12963         esac
12964         case "$getgrnam_r_proto" in
12965         ''|0)   d_getgrnam_r=undef
12966                 getgrnam_r_proto=0
12967                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12968         * )     case "$getgrnam_r_proto" in
12969                 REENTRANT_PROTO*) ;;
12970                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12971                 esac
12972                 echo "Prototype: $try" ;;
12973         esac
12974         ;;
12975         *)      case "$usethreads" in
12976                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12977                 esac
12978                 d_getgrnam_r=undef
12979                 getgrnam_r_proto=0
12980                 ;;
12981         esac
12982         ;;
12983 *)      getgrnam_r_proto=0
12984         ;;
12985 esac
12986
12987 : see if gethostbyaddr exists
12988 set gethostbyaddr d_gethbyaddr
12989 eval $inlibc
12990
12991 : see if gethostbyname exists
12992 set gethostbyname d_gethbyname
12993 eval $inlibc
12994
12995 : see if gethostent exists
12996 set gethostent d_gethent
12997 eval $inlibc
12998
12999 : see how we will look up host name
13000 echo " "
13001 call=''
13002 if set gethostname val -f d_gethname; eval $csym; $val; then
13003         echo 'gethostname() found.' >&4
13004         d_gethname="$define"
13005         call=gethostname
13006 fi
13007 if set uname val -f d_uname; eval $csym; $val; then
13008         if ./xenix; then
13009                 $cat <<'EOM'
13010 uname() was found, but you're running xenix, and older versions of xenix
13011 have a broken uname(). If you don't really know whether your xenix is old
13012 enough to have a broken system call, use the default answer.
13013
13014 EOM
13015                 dflt=y
13016                 case "$d_uname" in
13017                 "$define") dflt=n;;
13018                 esac
13019                 rp='Is your uname() broken?'
13020                 . ./myread
13021                 case "$ans" in
13022                 n*) d_uname="$define"; call=uname;;
13023                 esac
13024         else
13025                 echo 'uname() found.' >&4
13026                 d_uname="$define"
13027                 case "$call" in
13028                 '') call=uname ;;
13029                 esac
13030         fi
13031 fi
13032 case "$d_gethname" in
13033 '') d_gethname="$undef";;
13034 esac
13035 case "$d_uname" in
13036 '') d_uname="$undef";;
13037 esac
13038 case "$d_uname$d_gethname" in
13039 *define*)
13040         dflt=n
13041         cat <<EOM
13042  
13043 Every now and then someone has a $call() that lies about the hostname
13044 but can't be fixed for political or economic reasons.  If you wish, I can
13045 pretend $call() isn't there and maybe compute hostname at run-time
13046 thanks to the '$phostname' command.
13047
13048 EOM
13049         rp="Shall I ignore $call() from now on?"
13050         . ./myread
13051         case "$ans" in
13052         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13053         esac;;
13054 esac
13055 case "$phostname" in
13056 '') aphostname='';;
13057 *) case "$aphostname" in
13058         /*) ;;
13059         *) set X $phostname
13060                 shift
13061                 file=$1
13062                 shift
13063                 file=`./loc $file $file $pth`
13064                 aphostname=`echo $file $*`
13065                 ;;
13066         esac
13067         ;;
13068 esac
13069 case "$d_uname$d_gethname" in
13070 *define*) ;;
13071 *)
13072         case "$phostname" in
13073         '')
13074                 echo "There will be no way for $package to get your hostname." >&4;;
13075         *)
13076         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13077                 ;;
13078         esac;;
13079 esac
13080 case "$d_phostname" in
13081 '') d_phostname="$undef";;
13082 esac
13083
13084 : see if gethostbyaddr_r exists
13085 set gethostbyaddr_r d_gethostbyaddr_r
13086 eval $inlibc
13087 case "$d_gethostbyaddr_r" in
13088 "$define")
13089         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13090         case "$d_gethostbyaddr_r_proto:$usethreads" in
13091         ":define")      d_gethostbyaddr_r_proto=define
13092                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13093                 eval $hasproto ;;
13094         *)      ;;
13095         esac
13096         case "$d_gethostbyaddr_r_proto" in
13097         define)
13098         case "$gethostbyaddr_r_proto" in
13099         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13100         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13101         esac
13102         case "$gethostbyaddr_r_proto" in
13103         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13104         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13105         esac
13106         case "$gethostbyaddr_r_proto" in
13107         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13108         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13109         esac
13110         case "$gethostbyaddr_r_proto" in
13111         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13112         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13113         esac
13114         case "$gethostbyaddr_r_proto" in
13115         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13116         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13117         esac
13118         case "$gethostbyaddr_r_proto" in
13119         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13120         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13121         esac
13122         case "$gethostbyaddr_r_proto" in
13123         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13124         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13125         esac
13126         case "$gethostbyaddr_r_proto" in
13127         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13128         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13129         esac
13130         case "$gethostbyaddr_r_proto" in
13131         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13132         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13133         esac
13134         case "$gethostbyaddr_r_proto" in
13135         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13136         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13137         esac
13138         case "$gethostbyaddr_r_proto" in
13139         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13140         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13141         esac
13142         case "$gethostbyaddr_r_proto" in
13143         ''|0)   d_gethostbyaddr_r=undef
13144                 gethostbyaddr_r_proto=0
13145                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13146         * )     case "$gethostbyaddr_r_proto" in
13147                 REENTRANT_PROTO*) ;;
13148                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13149                 esac
13150                 echo "Prototype: $try" ;;
13151         esac
13152         ;;
13153         *)      case "$usethreads" in
13154                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13155                 esac
13156                 d_gethostbyaddr_r=undef
13157                 gethostbyaddr_r_proto=0
13158                 ;;
13159         esac
13160         ;;
13161 *)      gethostbyaddr_r_proto=0
13162         ;;
13163 esac
13164
13165 : see if gethostbyname_r exists
13166 set gethostbyname_r d_gethostbyname_r
13167 eval $inlibc
13168 case "$d_gethostbyname_r" in
13169 "$define")
13170         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13171         case "$d_gethostbyname_r_proto:$usethreads" in
13172         ":define")      d_gethostbyname_r_proto=define
13173                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13174                 eval $hasproto ;;
13175         *)      ;;
13176         esac
13177         case "$d_gethostbyname_r_proto" in
13178         define)
13179         case "$gethostbyname_r_proto" in
13180         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13181         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13182         esac
13183         case "$gethostbyname_r_proto" in
13184         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13185         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13186         esac
13187         case "$gethostbyname_r_proto" in
13188         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13189         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13190         esac
13191         case "$gethostbyname_r_proto" in
13192         ''|0)   d_gethostbyname_r=undef
13193                 gethostbyname_r_proto=0
13194                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13195         * )     case "$gethostbyname_r_proto" in
13196                 REENTRANT_PROTO*) ;;
13197                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13198                 esac
13199                 echo "Prototype: $try" ;;
13200         esac
13201         ;;
13202         *)      case "$usethreads" in
13203                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13204                 esac
13205                 d_gethostbyname_r=undef
13206                 gethostbyname_r_proto=0
13207                 ;;
13208         esac
13209         ;;
13210 *)      gethostbyname_r_proto=0
13211         ;;
13212 esac
13213
13214 : see if gethostent_r exists
13215 set gethostent_r d_gethostent_r
13216 eval $inlibc
13217 case "$d_gethostent_r" in
13218 "$define")
13219         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13220         case "$d_gethostent_r_proto:$usethreads" in
13221         ":define")      d_gethostent_r_proto=define
13222                 set d_gethostent_r_proto gethostent_r $hdrs
13223                 eval $hasproto ;;
13224         *)      ;;
13225         esac
13226         case "$d_gethostent_r_proto" in
13227         define)
13228         case "$gethostent_r_proto" in
13229         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13230         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13231         esac
13232         case "$gethostent_r_proto" in
13233         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13234         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13235         esac
13236         case "$gethostent_r_proto" in
13237         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13238         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13239         esac
13240         case "$gethostent_r_proto" in
13241         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13242         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13243         esac
13244         case "$gethostent_r_proto" in
13245         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13246         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13247         esac
13248         case "$gethostent_r_proto" in
13249         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13250         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13251         esac
13252         case "$gethostent_r_proto" in
13253         ''|0)   d_gethostent_r=undef
13254                 gethostent_r_proto=0
13255                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13256         * )     case "$gethostent_r_proto" in
13257                 REENTRANT_PROTO*) ;;
13258                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13259                 esac
13260                 echo "Prototype: $try" ;;
13261         esac
13262         ;;
13263         *)      case "$usethreads" in
13264                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13265                 esac
13266                 d_gethostent_r=undef
13267                 gethostent_r_proto=0
13268                 ;;
13269         esac
13270         ;;
13271 *)      gethostent_r_proto=0
13272         ;;
13273 esac
13274
13275 : see if prototypes for various gethostxxx netdb.h functions are available
13276 echo " "
13277 set d_gethostprotos gethostent $i_netdb netdb.h
13278 eval $hasproto
13279
13280 : see if getitimer exists
13281 set getitimer d_getitimer
13282 eval $inlibc
13283
13284 : see if getlogin exists
13285 set getlogin d_getlogin
13286 eval $inlibc
13287
13288 : see if getlogin_r exists
13289 set getlogin_r d_getlogin_r
13290 eval $inlibc
13291 case "$d_getlogin_r" in
13292 "$define")
13293         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13294         case "$d_getlogin_r_proto:$usethreads" in
13295         ":define")      d_getlogin_r_proto=define
13296                 set d_getlogin_r_proto getlogin_r $hdrs
13297                 eval $hasproto ;;
13298         *)      ;;
13299         esac
13300         case "$d_getlogin_r_proto" in
13301         define)
13302         case "$getlogin_r_proto" in
13303         ''|0) try='int getlogin_r(char*, size_t);'
13304         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13305         esac
13306         case "$getlogin_r_proto" in
13307         ''|0) try='int getlogin_r(char*, int);'
13308         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13309         esac
13310         case "$getlogin_r_proto" in
13311         ''|0) try='char* getlogin_r(char*, size_t);'
13312         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13313         esac
13314         case "$getlogin_r_proto" in
13315         ''|0) try='char* getlogin_r(char*, int);'
13316         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13317         esac
13318         case "$getlogin_r_proto" in
13319         ''|0)   d_getlogin_r=undef
13320                 getlogin_r_proto=0
13321                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13322         * )     case "$getlogin_r_proto" in
13323                 REENTRANT_PROTO*) ;;
13324                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13325                 esac
13326                 echo "Prototype: $try" ;;
13327         esac
13328         ;;
13329         *)      case "$usethreads" in
13330                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13331                 esac
13332                 d_getlogin_r=undef
13333                 getlogin_r_proto=0
13334                 ;;
13335         esac
13336         ;;
13337 *)      getlogin_r_proto=0
13338         ;;
13339 esac
13340
13341 : see if getmnt exists
13342 set getmnt d_getmnt
13343 eval $inlibc
13344
13345 : see if getmntent exists
13346 set getmntent d_getmntent
13347 eval $inlibc
13348
13349 : see if getnetbyaddr exists
13350 set getnetbyaddr d_getnbyaddr
13351 eval $inlibc
13352
13353 : see if getnetbyname exists
13354 set getnetbyname d_getnbyname
13355 eval $inlibc
13356
13357 : see if getnetent exists
13358 set getnetent d_getnent
13359 eval $inlibc
13360
13361 : see if getnetbyaddr_r exists
13362 set getnetbyaddr_r d_getnetbyaddr_r
13363 eval $inlibc
13364 case "$d_getnetbyaddr_r" in
13365 "$define")
13366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13367         case "$d_getnetbyaddr_r_proto:$usethreads" in
13368         ":define")      d_getnetbyaddr_r_proto=define
13369                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13370                 eval $hasproto ;;
13371         *)      ;;
13372         esac
13373         case "$d_getnetbyaddr_r_proto" in
13374         define)
13375         case "$getnetbyaddr_r_proto" in
13376         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13377         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13378         esac
13379         case "$getnetbyaddr_r_proto" in
13380         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13381         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13382         esac
13383         case "$getnetbyaddr_r_proto" in
13384         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13385         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13386         esac
13387         case "$getnetbyaddr_r_proto" in
13388         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13389         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13390         esac
13391         case "$getnetbyaddr_r_proto" in
13392         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13393         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13394         esac
13395         case "$getnetbyaddr_r_proto" in
13396         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13397         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13398         esac
13399         case "$getnetbyaddr_r_proto" in
13400         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13401         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13402         esac
13403         case "$getnetbyaddr_r_proto" in
13404         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13405         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13406         esac
13407         case "$getnetbyaddr_r_proto" in
13408         ''|0)   d_getnetbyaddr_r=undef
13409                 getnetbyaddr_r_proto=0
13410                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13411         * )     case "$getnetbyaddr_r_proto" in
13412                 REENTRANT_PROTO*) ;;
13413                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13414                 esac
13415                 echo "Prototype: $try" ;;
13416         esac
13417         ;;
13418         *)      case "$usethreads" in
13419                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13420                 esac
13421                 d_getnetbyaddr_r=undef
13422                 getnetbyaddr_r_proto=0
13423                 ;;
13424         esac
13425         ;;
13426 *)      getnetbyaddr_r_proto=0
13427         ;;
13428 esac
13429
13430 : see if getnetbyname_r exists
13431 set getnetbyname_r d_getnetbyname_r
13432 eval $inlibc
13433 case "$d_getnetbyname_r" in
13434 "$define")
13435         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13436         case "$d_getnetbyname_r_proto:$usethreads" in
13437         ":define")      d_getnetbyname_r_proto=define
13438                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13439                 eval $hasproto ;;
13440         *)      ;;
13441         esac
13442         case "$d_getnetbyname_r_proto" in
13443         define)
13444         case "$getnetbyname_r_proto" in
13445         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13446         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13447         esac
13448         case "$getnetbyname_r_proto" in
13449         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13450         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13451         esac
13452         case "$getnetbyname_r_proto" in
13453         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13454         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13455         esac
13456         case "$getnetbyname_r_proto" in
13457         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13458         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13459         esac
13460         case "$getnetbyname_r_proto" in
13461         ''|0)   d_getnetbyname_r=undef
13462                 getnetbyname_r_proto=0
13463                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13464         * )     case "$getnetbyname_r_proto" in
13465                 REENTRANT_PROTO*) ;;
13466                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13467                 esac
13468                 echo "Prototype: $try" ;;
13469         esac
13470         ;;
13471         *)      case "$usethreads" in
13472                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13473                 esac
13474                 d_getnetbyname_r=undef
13475                 getnetbyname_r_proto=0
13476                 ;;
13477         esac
13478         ;;
13479 *)      getnetbyname_r_proto=0
13480         ;;
13481 esac
13482
13483 : see if getnetent_r exists
13484 set getnetent_r d_getnetent_r
13485 eval $inlibc
13486 case "$d_getnetent_r" in
13487 "$define")
13488         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13489         case "$d_getnetent_r_proto:$usethreads" in
13490         ":define")      d_getnetent_r_proto=define
13491                 set d_getnetent_r_proto getnetent_r $hdrs
13492                 eval $hasproto ;;
13493         *)      ;;
13494         esac
13495         case "$d_getnetent_r_proto" in
13496         define)
13497         case "$getnetent_r_proto" in
13498         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13499         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13500         esac
13501         case "$getnetent_r_proto" in
13502         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13503         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13504         esac
13505         case "$getnetent_r_proto" in
13506         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13507         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13508         esac
13509         case "$getnetent_r_proto" in
13510         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13511         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13512         esac
13513         case "$getnetent_r_proto" in
13514         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13515         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13516         esac
13517         case "$getnetent_r_proto" in
13518         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13519         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13520         esac
13521         case "$getnetent_r_proto" in
13522         ''|0)   d_getnetent_r=undef
13523                 getnetent_r_proto=0
13524                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13525         * )     case "$getnetent_r_proto" in
13526                 REENTRANT_PROTO*) ;;
13527                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13528                 esac
13529                 echo "Prototype: $try" ;;
13530         esac
13531         ;;
13532         *)      case "$usethreads" in
13533                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13534                 esac
13535                 d_getnetent_r=undef
13536                 getnetent_r_proto=0
13537                 ;;
13538         esac
13539         ;;
13540 *)      getnetent_r_proto=0
13541         ;;
13542 esac
13543
13544 : see if prototypes for various getnetxxx netdb.h functions are available
13545 echo " "
13546 set d_getnetprotos getnetent $i_netdb netdb.h
13547 eval $hasproto
13548
13549 : see if getpagesize exists
13550 set getpagesize d_getpagsz
13551 eval $inlibc
13552
13553
13554 : see if getprotobyname exists
13555 set getprotobyname d_getpbyname
13556 eval $inlibc
13557
13558 : see if getprotobynumber exists
13559 set getprotobynumber d_getpbynumber
13560 eval $inlibc
13561
13562 : see if getprotoent exists
13563 set getprotoent d_getpent
13564 eval $inlibc
13565
13566 : see if getpgid exists
13567 set getpgid d_getpgid
13568 eval $inlibc
13569
13570 : see if getpgrp2 exists
13571 set getpgrp2 d_getpgrp2
13572 eval $inlibc
13573
13574 : see if getppid exists
13575 set getppid d_getppid
13576 eval $inlibc
13577
13578 : see if getpriority exists
13579 set getpriority d_getprior
13580 eval $inlibc
13581
13582 : see if getprotobyname_r exists
13583 set getprotobyname_r d_getprotobyname_r
13584 eval $inlibc
13585 case "$d_getprotobyname_r" in
13586 "$define")
13587         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13588         case "$d_getprotobyname_r_proto:$usethreads" in
13589         ":define")      d_getprotobyname_r_proto=define
13590                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13591                 eval $hasproto ;;
13592         *)      ;;
13593         esac
13594         case "$d_getprotobyname_r_proto" in
13595         define)
13596         case "$getprotobyname_r_proto" in
13597         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13598         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13599         esac
13600         case "$getprotobyname_r_proto" in
13601         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13602         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13603         esac
13604         case "$getprotobyname_r_proto" in
13605         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13606         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13607         esac
13608         case "$getprotobyname_r_proto" in
13609         ''|0)   d_getprotobyname_r=undef
13610                 getprotobyname_r_proto=0
13611                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13612         * )     case "$getprotobyname_r_proto" in
13613                 REENTRANT_PROTO*) ;;
13614                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13615                 esac
13616                 echo "Prototype: $try" ;;
13617         esac
13618         ;;
13619         *)      case "$usethreads" in
13620                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13621                 esac
13622                 d_getprotobyname_r=undef
13623                 getprotobyname_r_proto=0
13624                 ;;
13625         esac
13626         ;;
13627 *)      getprotobyname_r_proto=0
13628         ;;
13629 esac
13630
13631 : see if getprotobynumber_r exists
13632 set getprotobynumber_r d_getprotobynumber_r
13633 eval $inlibc
13634 case "$d_getprotobynumber_r" in
13635 "$define")
13636         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13637         case "$d_getprotobynumber_r_proto:$usethreads" in
13638         ":define")      d_getprotobynumber_r_proto=define
13639                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13640                 eval $hasproto ;;
13641         *)      ;;
13642         esac
13643         case "$d_getprotobynumber_r_proto" in
13644         define)
13645         case "$getprotobynumber_r_proto" in
13646         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13647         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13648         esac
13649         case "$getprotobynumber_r_proto" in
13650         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13651         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13652         esac
13653         case "$getprotobynumber_r_proto" in
13654         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13655         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13656         esac
13657         case "$getprotobynumber_r_proto" in
13658         ''|0)   d_getprotobynumber_r=undef
13659                 getprotobynumber_r_proto=0
13660                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13661         * )     case "$getprotobynumber_r_proto" in
13662                 REENTRANT_PROTO*) ;;
13663                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13664                 esac
13665                 echo "Prototype: $try" ;;
13666         esac
13667         ;;
13668         *)      case "$usethreads" in
13669                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13670                 esac
13671                 d_getprotobynumber_r=undef
13672                 getprotobynumber_r_proto=0
13673                 ;;
13674         esac
13675         ;;
13676 *)      getprotobynumber_r_proto=0
13677         ;;
13678 esac
13679
13680 : see if getprotoent_r exists
13681 set getprotoent_r d_getprotoent_r
13682 eval $inlibc
13683 case "$d_getprotoent_r" in
13684 "$define")
13685         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13686         case "$d_getprotoent_r_proto:$usethreads" in
13687         ":define")      d_getprotoent_r_proto=define
13688                 set d_getprotoent_r_proto getprotoent_r $hdrs
13689                 eval $hasproto ;;
13690         *)      ;;
13691         esac
13692         case "$d_getprotoent_r_proto" in
13693         define)
13694         case "$getprotoent_r_proto" in
13695         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13696         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13697         esac
13698         case "$getprotoent_r_proto" in
13699         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13700         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13701         esac
13702         case "$getprotoent_r_proto" in
13703         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13704         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13705         esac
13706         case "$getprotoent_r_proto" in
13707         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13708         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13709         esac
13710         case "$getprotoent_r_proto" in
13711         ''|0)   d_getprotoent_r=undef
13712                 getprotoent_r_proto=0
13713                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13714         * )     case "$getprotoent_r_proto" in
13715                 REENTRANT_PROTO*) ;;
13716                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13717                 esac
13718                 echo "Prototype: $try" ;;
13719         esac
13720         ;;
13721         *)      case "$usethreads" in
13722                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13723                 esac
13724                 d_getprotoent_r=undef
13725                 getprotoent_r_proto=0
13726                 ;;
13727         esac
13728         ;;
13729 *)      getprotoent_r_proto=0
13730         ;;
13731 esac
13732
13733 : see if prototypes for various getprotoxxx netdb.h functions are available
13734 echo " "
13735 set d_getprotoprotos getprotoent $i_netdb netdb.h
13736 eval $hasproto
13737
13738 : see if getprpwnam exists
13739 set getprpwnam d_getprpwnam
13740 eval $inlibc
13741
13742 : see if getpwent exists
13743 set getpwent d_getpwent
13744 eval $inlibc
13745
13746 : see if getpwent_r exists
13747 set getpwent_r d_getpwent_r
13748 eval $inlibc
13749 case "$d_getpwent_r" in
13750 "$define")
13751         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13752         case "$d_getpwent_r_proto:$usethreads" in
13753         ":define")      d_getpwent_r_proto=define
13754                 set d_getpwent_r_proto getpwent_r $hdrs
13755                 eval $hasproto ;;
13756         *)      ;;
13757         esac
13758         case "$d_getpwent_r_proto" in
13759         define)
13760         case "$getpwent_r_proto" in
13761         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13762         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13763         esac
13764         case "$getpwent_r_proto" in
13765         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13766         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13767         esac
13768         case "$getpwent_r_proto" in
13769         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13770         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13771         esac
13772         case "$getpwent_r_proto" in
13773         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13774         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13775         esac
13776         case "$getpwent_r_proto" in
13777         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13778         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13779         esac
13780         case "$getpwent_r_proto" in
13781         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13782         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13783         esac
13784         case "$getpwent_r_proto" in
13785         ''|0)   d_getpwent_r=undef
13786                 getpwent_r_proto=0
13787                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13788         * )     case "$getpwent_r_proto" in
13789                 REENTRANT_PROTO*) ;;
13790                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13791                 esac
13792                 echo "Prototype: $try" ;;
13793         esac
13794         ;;
13795         *)      case "$usethreads" in
13796                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13797                 esac
13798                 d_getpwent_r=undef
13799                 getpwent_r_proto=0
13800                 ;;
13801         esac
13802         ;;
13803 *)      getpwent_r_proto=0
13804         ;;
13805 esac
13806
13807 : see if getpwnam_r exists
13808 set getpwnam_r d_getpwnam_r
13809 eval $inlibc
13810 case "$d_getpwnam_r" in
13811 "$define")
13812         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13813         case "$d_getpwnam_r_proto:$usethreads" in
13814         ":define")      d_getpwnam_r_proto=define
13815                 set d_getpwnam_r_proto getpwnam_r $hdrs
13816                 eval $hasproto ;;
13817         *)      ;;
13818         esac
13819         case "$d_getpwnam_r_proto" in
13820         define)
13821         case "$getpwnam_r_proto" in
13822         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13823         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13824         esac
13825         case "$getpwnam_r_proto" in
13826         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13827         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13828         esac
13829         case "$getpwnam_r_proto" in
13830         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13831         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13832         esac
13833         case "$getpwnam_r_proto" in
13834         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13835         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13836         esac
13837         case "$getpwnam_r_proto" in
13838         ''|0)   d_getpwnam_r=undef
13839                 getpwnam_r_proto=0
13840                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13841         * )     case "$getpwnam_r_proto" in
13842                 REENTRANT_PROTO*) ;;
13843                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13844                 esac
13845                 echo "Prototype: $try" ;;
13846         esac
13847         ;;
13848         *)      case "$usethreads" in
13849                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13850                 esac
13851                 d_getpwnam_r=undef
13852                 getpwnam_r_proto=0
13853                 ;;
13854         esac
13855         ;;
13856 *)      getpwnam_r_proto=0
13857         ;;
13858 esac
13859
13860 : see if getpwuid_r exists
13861 set getpwuid_r d_getpwuid_r
13862 eval $inlibc
13863 case "$d_getpwuid_r" in
13864 "$define")
13865         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13866         case "$d_getpwuid_r_proto:$usethreads" in
13867         ":define")      d_getpwuid_r_proto=define
13868                 set d_getpwuid_r_proto getpwuid_r $hdrs
13869                 eval $hasproto ;;
13870         *)      ;;
13871         esac
13872         case "$d_getpwuid_r_proto" in
13873         define)
13874         case "$getpwuid_r_proto" in
13875         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13876         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13877         esac
13878         case "$getpwuid_r_proto" in
13879         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13880         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13881         esac
13882         case "$getpwuid_r_proto" in
13883         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13884         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13885         esac
13886         case "$getpwuid_r_proto" in
13887         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13888         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13889         esac
13890         case "$getpwuid_r_proto" in
13891         ''|0)   d_getpwuid_r=undef
13892                 getpwuid_r_proto=0
13893                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13894         * )     case "$getpwuid_r_proto" in
13895                 REENTRANT_PROTO*) ;;
13896                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13897                 esac
13898                 echo "Prototype: $try" ;;
13899         esac
13900         ;;
13901         *)      case "$usethreads" in
13902                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13903                 esac
13904                 d_getpwuid_r=undef
13905                 getpwuid_r_proto=0
13906                 ;;
13907         esac
13908         ;;
13909 *)      getpwuid_r_proto=0
13910         ;;
13911 esac
13912
13913
13914 : see if getservbyname exists
13915 set getservbyname d_getsbyname
13916 eval $inlibc
13917
13918 : see if getservbyport exists
13919 set getservbyport d_getsbyport
13920 eval $inlibc
13921
13922 : see if getservent exists
13923 set getservent d_getsent
13924 eval $inlibc
13925
13926 : see if getservbyname_r exists
13927 set getservbyname_r d_getservbyname_r
13928 eval $inlibc
13929 case "$d_getservbyname_r" in
13930 "$define")
13931         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13932         case "$d_getservbyname_r_proto:$usethreads" in
13933         ":define")      d_getservbyname_r_proto=define
13934                 set d_getservbyname_r_proto getservbyname_r $hdrs
13935                 eval $hasproto ;;
13936         *)      ;;
13937         esac
13938         case "$d_getservbyname_r_proto" in
13939         define)
13940         case "$getservbyname_r_proto" in
13941         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13942         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13943         esac
13944         case "$getservbyname_r_proto" in
13945         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13946         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13947         esac
13948         case "$getservbyname_r_proto" in
13949         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13950         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13951         esac
13952         case "$getservbyname_r_proto" in
13953         ''|0)   d_getservbyname_r=undef
13954                 getservbyname_r_proto=0
13955                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13956         * )     case "$getservbyname_r_proto" in
13957                 REENTRANT_PROTO*) ;;
13958                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13959                 esac
13960                 echo "Prototype: $try" ;;
13961         esac
13962         ;;
13963         *)      case "$usethreads" in
13964                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13965                 esac
13966                 d_getservbyname_r=undef
13967                 getservbyname_r_proto=0
13968                 ;;
13969         esac
13970         ;;
13971 *)      getservbyname_r_proto=0
13972         ;;
13973 esac
13974
13975 : see if getservbyport_r exists
13976 set getservbyport_r d_getservbyport_r
13977 eval $inlibc
13978 case "$d_getservbyport_r" in
13979 "$define")
13980         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13981         case "$d_getservbyport_r_proto:$usethreads" in
13982         ":define")      d_getservbyport_r_proto=define
13983                 set d_getservbyport_r_proto getservbyport_r $hdrs
13984                 eval $hasproto ;;
13985         *)      ;;
13986         esac
13987         case "$d_getservbyport_r_proto" in
13988         define)
13989         case "$getservbyport_r_proto" in
13990         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13991         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13992         esac
13993         case "$getservbyport_r_proto" in
13994         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13995         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13996         esac
13997         case "$getservbyport_r_proto" in
13998         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13999         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14000         esac
14001         case "$getservbyport_r_proto" in
14002         ''|0)   d_getservbyport_r=undef
14003                 getservbyport_r_proto=0
14004                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14005         * )     case "$getservbyport_r_proto" in
14006                 REENTRANT_PROTO*) ;;
14007                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14008                 esac
14009                 echo "Prototype: $try" ;;
14010         esac
14011         ;;
14012         *)      case "$usethreads" in
14013                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14014                 esac
14015                 d_getservbyport_r=undef
14016                 getservbyport_r_proto=0
14017                 ;;
14018         esac
14019         ;;
14020 *)      getservbyport_r_proto=0
14021         ;;
14022 esac
14023
14024 : see if getservent_r exists
14025 set getservent_r d_getservent_r
14026 eval $inlibc
14027 case "$d_getservent_r" in
14028 "$define")
14029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14030         case "$d_getservent_r_proto:$usethreads" in
14031         ":define")      d_getservent_r_proto=define
14032                 set d_getservent_r_proto getservent_r $hdrs
14033                 eval $hasproto ;;
14034         *)      ;;
14035         esac
14036         case "$d_getservent_r_proto" in
14037         define)
14038         case "$getservent_r_proto" in
14039         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14040         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14041         esac
14042         case "$getservent_r_proto" in
14043         ''|0) try='int getservent_r(struct servent*, char*, int);'
14044         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14045         esac
14046         case "$getservent_r_proto" in
14047         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14048         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14049         esac
14050         case "$getservent_r_proto" in
14051         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14052         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14053         esac
14054         case "$getservent_r_proto" in
14055         ''|0)   d_getservent_r=undef
14056                 getservent_r_proto=0
14057                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14058         * )     case "$getservent_r_proto" in
14059                 REENTRANT_PROTO*) ;;
14060                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14061                 esac
14062                 echo "Prototype: $try" ;;
14063         esac
14064         ;;
14065         *)      case "$usethreads" in
14066                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14067                 esac
14068                 d_getservent_r=undef
14069                 getservent_r_proto=0
14070                 ;;
14071         esac
14072         ;;
14073 *)      getservent_r_proto=0
14074         ;;
14075 esac
14076
14077 : see if prototypes for various getservxxx netdb.h functions are available
14078 echo " "
14079 set d_getservprotos getservent $i_netdb netdb.h
14080 eval $hasproto
14081
14082 : see if getspnam exists
14083 set getspnam d_getspnam
14084 eval $inlibc
14085
14086 : see if this is a shadow.h system
14087 set shadow.h i_shadow
14088 eval $inhdr
14089
14090 : see if getspnam_r exists
14091 set getspnam_r d_getspnam_r
14092 eval $inlibc
14093 case "$d_getspnam_r" in
14094 "$define")
14095         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14096         case "$d_getspnam_r_proto:$usethreads" in
14097         ":define")      d_getspnam_r_proto=define
14098                 set d_getspnam_r_proto getspnam_r $hdrs
14099                 eval $hasproto ;;
14100         *)      ;;
14101         esac
14102         case "$d_getspnam_r_proto" in
14103         define)
14104         case "$getspnam_r_proto" in
14105         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14106         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14107         esac
14108         case "$getspnam_r_proto" in
14109         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14110         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14111         esac
14112         case "$getspnam_r_proto" in
14113         ''|0)   d_getspnam_r=undef
14114                 getspnam_r_proto=0
14115                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14116         * )     case "$getspnam_r_proto" in
14117                 REENTRANT_PROTO*) ;;
14118                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14119                 esac
14120                 echo "Prototype: $try" ;;
14121         esac
14122         ;;
14123         *)      case "$usethreads" in
14124                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14125                 esac
14126                 d_getspnam_r=undef
14127                 getspnam_r_proto=0
14128                 ;;
14129         esac
14130         ;;
14131 *)      getspnam_r_proto=0
14132         ;;
14133 esac
14134
14135 : see if gettimeofday or ftime exists
14136 set gettimeofday d_gettimeod
14137 eval $inlibc
14138 case "$d_gettimeod" in
14139 "$undef")
14140         set ftime d_ftime 
14141         eval $inlibc
14142         ;;
14143 *)
14144         val="$undef"; set d_ftime; eval $setvar
14145         ;;
14146 esac
14147 case "$d_gettimeod$d_ftime" in
14148 "$undef$undef")
14149         echo " "
14150         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14151         ;;
14152 esac
14153
14154 : see if gmtime_r exists
14155 set gmtime_r d_gmtime_r
14156 eval $inlibc
14157 case "$d_gmtime_r" in
14158 "$define")
14159         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14160         case "$d_gmtime_r_proto:$usethreads" in
14161         ":define")      d_gmtime_r_proto=define
14162                 set d_gmtime_r_proto gmtime_r $hdrs
14163                 eval $hasproto ;;
14164         *)      ;;
14165         esac
14166         case "$d_gmtime_r_proto" in
14167         define)
14168         case "$gmtime_r_proto" in
14169         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14170         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14171         esac
14172         case "$gmtime_r_proto" in
14173         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14174         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14175         esac
14176         case "$gmtime_r_proto" in
14177         ''|0)   d_gmtime_r=undef
14178                 gmtime_r_proto=0
14179                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14180         * )     case "$gmtime_r_proto" in
14181                 REENTRANT_PROTO*) ;;
14182                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14183                 esac
14184                 echo "Prototype: $try" ;;
14185         esac
14186         ;;
14187         *)      case "$usethreads" in
14188                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14189                 esac
14190                 d_gmtime_r=undef
14191                 gmtime_r_proto=0
14192                 ;;
14193         esac
14194         ;;
14195 *)      gmtime_r_proto=0
14196         ;;
14197 esac
14198
14199 : see if hasmntopt exists
14200 set hasmntopt d_hasmntopt
14201 eval $inlibc
14202
14203 : see if this is a netinet/in.h or sys/in.h system
14204 set netinet/in.h i_niin sys/in.h i_sysin
14205 eval $inhdr
14206
14207 : see if arpa/inet.h has to be included
14208 set arpa/inet.h i_arpainet
14209 eval $inhdr
14210
14211 : see if htonl --and friends-- exists
14212 val=''
14213 set htonl val
14214 eval $inlibc
14215
14216 : Maybe they are macros.
14217 case "$val" in
14218 $undef)
14219         $cat >htonl.c <<EOM
14220 #include <stdio.h>
14221 #include <sys/types.h>
14222 #$i_niin I_NETINET_IN
14223 #$i_sysin I_SYS_IN
14224 #$i_arpainet I_ARPA_INET
14225 #ifdef I_NETINET_IN
14226 #include <netinet/in.h>
14227 #endif
14228 #ifdef I_SYS_IN
14229 #include <sys/in.h>
14230 #endif
14231 #ifdef I_ARPA_INET
14232 #include <arpa/inet.h>
14233 #endif
14234 #ifdef htonl
14235 printf("Defined as a macro.");
14236 #endif
14237 EOM
14238         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14239         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14240                 val="$define"
14241                 echo "But it seems to be defined as a macro." >&4
14242         fi
14243         $rm -f htonl.?
14244         ;;
14245 esac
14246 set d_htonl
14247 eval $setvar
14248
14249 : see if ilogbl exists
14250 set ilogbl d_ilogbl
14251 eval $inlibc
14252
14253 : index or strchr
14254 echo " "
14255 if set index val -f; eval $csym; $val; then
14256         if set strchr val -f d_strchr; eval $csym; $val; then
14257                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14258                         val="$define"
14259                         vali="$undef"
14260                         echo "strchr() found." >&4
14261                 else
14262                         val="$undef"
14263                         vali="$define"
14264                         echo "index() found." >&4
14265                 fi
14266         else
14267                 val="$undef"
14268                 vali="$define"
14269                 echo "index() found." >&4
14270         fi
14271 else
14272         if set strchr val -f d_strchr; eval $csym; $val; then
14273                 val="$define"
14274                 vali="$undef"
14275                 echo "strchr() found." >&4
14276         else
14277                 echo "No index() or strchr() found!" >&4
14278                 val="$undef"
14279                 vali="$undef"
14280         fi
14281 fi
14282 set d_strchr; eval $setvar
14283 val="$vali"
14284 set d_index; eval $setvar
14285
14286 : check whether inet_aton exists
14287 set inet_aton d_inetaton
14288 eval $inlibc
14289
14290 : Look for isascii
14291 echo " "
14292 $cat >isascii.c <<EOCP
14293 #include <stdio.h>
14294 #include <ctype.h>
14295 #$i_stdlib I_STDLIB
14296 #ifdef I_STDLIB
14297 #include <stdlib.h>
14298 #endif
14299 int main() {
14300         int c = 'A';
14301         if (isascii(c))
14302                 exit(0);
14303         else
14304                 exit(1);
14305 }
14306 EOCP
14307 set isascii
14308 if eval $compile; then
14309         echo "isascii() found." >&4
14310         val="$define"
14311 else
14312         echo "isascii() NOT found." >&4
14313         val="$undef"
14314 fi
14315 set d_isascii
14316 eval $setvar
14317 $rm -f isascii*
14318
14319 : see if isfinite exists
14320 set isfinite d_isfinite
14321 eval $inlibc
14322
14323 : see if isinf exists
14324 set isinf d_isinf
14325 eval $inlibc
14326
14327 : see if isnan exists
14328 set isnan d_isnan
14329 eval $inlibc
14330
14331 : see if isnanl exists
14332 set isnanl d_isnanl
14333 eval $inlibc
14334
14335 : see if killpg exists
14336 set killpg d_killpg
14337 eval $inlibc
14338
14339 : see if lchown exists
14340 echo " "
14341 $cat > try.c <<'EOCP'
14342 /* System header to define __stub macros and hopefully few prototypes,
14343     which can conflict with char lchown(); below.  */
14344 #include <assert.h>
14345 /* Override any gcc2 internal prototype to avoid an error.  */
14346 /* We use char because int might match the return type of a gcc2
14347    builtin and then its argument prototype would still apply.  */
14348 char lchown();
14349 int main() {
14350     /*  The GNU C library defines this for functions which it implements
14351         to always fail with ENOSYS.  Some functions are actually named
14352         something starting with __ and the normal name is an alias.  */
14353 #if defined (__stub_lchown) || defined (__stub___lchown)
14354 choke me
14355 #else
14356 lchown();
14357 #endif
14358 ; return 0; }
14359 EOCP
14360 set try
14361 if eval $compile; then
14362     $echo "lchown() found." >&4
14363     val="$define"
14364 else
14365     $echo "lchown() NOT found." >&4
14366     val="$undef"
14367 fi
14368 set d_lchown
14369 eval $setvar
14370
14371 : See if number of significant digits in a double precision number is known
14372 echo " "
14373 $cat >ldbl_dig.c <<EOM
14374 #$i_limits I_LIMITS
14375 #$i_float I_FLOAT
14376 #ifdef I_LIMITS
14377 #include <limits.h>
14378 #endif
14379 #ifdef I_FLOAT
14380 #include <float.h>
14381 #endif
14382 #ifdef LDBL_DIG
14383 printf("Contains LDBL_DIG");
14384 #endif
14385 EOM
14386 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14387 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14388         echo "LDBL_DIG found." >&4
14389         val="$define"
14390 else
14391         echo "LDBL_DIG NOT found." >&4
14392         val="$undef"
14393 fi
14394 $rm -f ldbl_dig.?
14395 set d_ldbl_dig
14396 eval $setvar
14397
14398 : see if this is a math.h system
14399 set math.h i_math
14400 eval $inhdr
14401
14402 d_libm_lib_version="$undef"
14403 case $i_math in
14404     $define)
14405         : check to see if math.h defines _LIB_VERSION
14406         echo " "
14407         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14408         $cat >try.c <<EOCP
14409 #include <unistd.h>
14410 #include <math.h>
14411 int main (int argc, char *argv[])
14412 {
14413     printf ("%d\n", _LIB_VERSION);
14414     return (0);
14415     } /* main */
14416 EOCP
14417         set try
14418         if eval $compile; then
14419             foo=`$run ./try`
14420             echo "Yes, it does ($foo)" >&4
14421             d_libm_lib_version="$define"
14422         else
14423             echo "No, it does not (probably harmless)\n" >&4
14424             fi
14425         $rm -f try.* try core core.try.*
14426         ;;
14427
14428     esac
14429
14430 : see if link exists
14431 set link d_link
14432 eval $inlibc
14433
14434 : see if localtime_r exists
14435 set localtime_r d_localtime_r
14436 eval $inlibc
14437 case "$d_localtime_r" in
14438 "$define")
14439         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14440         case "$d_localtime_r_proto:$usethreads" in
14441         ":define")      d_localtime_r_proto=define
14442                 set d_localtime_r_proto localtime_r $hdrs
14443                 eval $hasproto ;;
14444         *)      ;;
14445         esac
14446         case "$d_localtime_r_proto" in
14447         define)
14448         case "$localtime_r_proto" in
14449         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14450         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14451         esac
14452         case "$localtime_r_proto" in
14453         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14454         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14455         esac
14456         case "$localtime_r_proto" in
14457         ''|0)   d_localtime_r=undef
14458                 localtime_r_proto=0
14459                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14460         * )     case "$localtime_r_proto" in
14461                 REENTRANT_PROTO*) ;;
14462                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14463                 esac
14464                 echo "Prototype: $try" ;;
14465         esac
14466         ;;
14467         *)      case "$usethreads" in
14468                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14469                 esac
14470                 d_localtime_r=undef
14471                 localtime_r_proto=0
14472                 ;;
14473         esac
14474         ;;
14475 *)      localtime_r_proto=0
14476         ;;
14477 esac
14478
14479 : see if localeconv exists
14480 set localeconv d_locconv
14481 eval $inlibc
14482
14483 : see if lockf exists
14484 set lockf d_lockf
14485 eval $inlibc
14486
14487 : see if prototype for lseek is available
14488 echo " "
14489 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14490 eval $hasproto
14491
14492 : see if lstat exists
14493 set lstat d_lstat
14494 eval $inlibc
14495
14496 : see if madvise exists
14497 set madvise d_madvise
14498 eval $inlibc
14499
14500 : see if malloc_size exists
14501 set malloc_size d_malloc_size
14502 eval $inlibc
14503
14504 : see if malloc_size_good exists
14505 set malloc_good_size d_malloc_good_size
14506 eval $inlibc
14507
14508 : see if mblen exists
14509 set mblen d_mblen
14510 eval $inlibc
14511
14512 : see if mbstowcs exists
14513 set mbstowcs d_mbstowcs
14514 eval $inlibc
14515
14516 : see if mbtowc exists
14517 set mbtowc d_mbtowc
14518 eval $inlibc
14519
14520 : see if memchr exists
14521 set memchr d_memchr
14522 eval $inlibc
14523
14524 : see if memcmp exists
14525 set memcmp d_memcmp
14526 eval $inlibc
14527
14528 : see if memcpy exists
14529 set memcpy d_memcpy
14530 eval $inlibc
14531
14532 : see if memmove exists
14533 set memmove d_memmove
14534 eval $inlibc
14535
14536 : see if memset exists
14537 set memset d_memset
14538 eval $inlibc
14539
14540 : see if mkdir exists
14541 set mkdir d_mkdir
14542 eval $inlibc
14543
14544 : see if mkdtemp exists
14545 set mkdtemp d_mkdtemp
14546 eval $inlibc
14547
14548 : see if mkfifo exists
14549 set mkfifo d_mkfifo
14550 eval $inlibc
14551
14552 : see if mkstemp exists
14553 set mkstemp d_mkstemp
14554 eval $inlibc
14555
14556 : see if mkstemps exists
14557 set mkstemps d_mkstemps
14558 eval $inlibc
14559
14560 : see if mktime exists
14561 set mktime d_mktime
14562 eval $inlibc
14563
14564 : see if this is a sys/mman.h system
14565 set sys/mman.h i_sysmman
14566 eval $inhdr
14567
14568 : see if mmap exists
14569 set mmap d_mmap
14570 eval $inlibc
14571 : see what shmat returns
14572 : default to something harmless
14573 mmaptype='void *'
14574 case "$i_sysmman$d_mmap" in
14575 "$define$define")
14576         $cat >mmap.c <<'END'
14577 #include <sys/mman.h>
14578 void *mmap();
14579 END
14580         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14581                 mmaptype='void *'
14582         else
14583                 mmaptype='caddr_t'
14584         fi
14585         echo "and it returns ($mmaptype)." >&4
14586         ;;
14587 esac
14588
14589
14590
14591 : see if sqrtl exists
14592 set sqrtl d_sqrtl
14593 eval $inlibc
14594
14595 : see if scalbnl exists
14596 set scalbnl d_scalbnl
14597 eval $inlibc
14598
14599 : see if modfl exists
14600 set modfl d_modfl
14601 eval $inlibc
14602
14603 : see if prototype for modfl is available
14604 echo " "
14605 set d_modflproto modfl $i_math math.h
14606 eval $hasproto
14607
14608 d_modfl_pow32_bug="$undef"
14609
14610 case "$d_longdbl$d_modfl" in
14611 $define$define)
14612         $cat <<EOM
14613 Checking to see whether your modfl() is okay for large values...
14614 EOM
14615 $cat >try.c <<EOCP
14616 #include <math.h> 
14617 #include <stdio.h>
14618 EOCP
14619 if $test "X$d_modflproto" != "X$define"; then
14620         $cat >>try.c <<EOCP
14621 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14622 long double modfl (long double, long double *);
14623 EOCP
14624 fi
14625 $cat >>try.c <<EOCP
14626 int main() {
14627     long double nv = 4294967303.15;
14628     long double v, w;
14629     v = modfl(nv, &w);         
14630 #ifdef __GLIBC__
14631     printf("glibc");
14632 #endif
14633     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14634     return 0;
14635 }
14636 EOCP
14637         case "$osname:$gccversion" in
14638         aix:)   saveccflags="$ccflags"
14639                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14640         esac
14641         set try
14642         if eval $compile; then
14643                 foo=`$run ./try`
14644                 case "$foo" in
14645                 *" 4294967303.150000 1.150000 4294967302.000000")
14646                         echo >&4 "Your modfl() is broken for large values."
14647                         d_modfl_pow32_bug="$define"
14648                         case "$foo" in
14649                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14650                         ;;
14651                         esac
14652                         ;;
14653                 *" 4294967303.150000 0.150000 4294967303.000000")
14654                         echo >&4 "Your modfl() seems okay for large values."
14655                         ;;
14656                 *)      echo >&4 "I don't understand your modfl() at all."
14657                         d_modfl="$undef"
14658                         ;;
14659                 esac
14660                 $rm -f try.* try core core.try.*
14661         else
14662                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14663                 d_modfl="$undef"
14664         fi
14665         case "$osname:$gccversion" in
14666         aix:)   ccflags="$saveccflags" ;; # restore
14667         esac
14668         ;;
14669 esac
14670
14671 if $test "$uselongdouble" = "$define"; then
14672     message=""
14673     if $test "$d_sqrtl" != "$define"; then
14674         message="$message sqrtl"
14675     fi
14676     if $test "$d_modfl" != "$define"; then
14677         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14678             echo "You have both aintl and copysignl, so I can emulate modfl."
14679         else
14680             message="$message modfl"
14681         fi
14682     fi
14683     if $test "$d_frexpl" != "$define"; then
14684         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14685             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14686         else
14687             message="$message frexpl"
14688         fi
14689     fi
14690
14691     if $test "$message" != ""; then
14692         $cat <<EOM >&4
14693
14694 *** You requested the use of long doubles but you do not seem to have
14695 *** the following mathematical functions needed for long double support:
14696 ***    $message
14697 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14698 *** Cannot continue, aborting.
14699
14700 EOM
14701
14702         exit 1
14703     fi
14704 fi
14705
14706 : see if mprotect exists
14707 set mprotect d_mprotect
14708 eval $inlibc
14709
14710 : see if msgctl exists
14711 set msgctl d_msgctl
14712 eval $inlibc
14713
14714 : see if msgget exists
14715 set msgget d_msgget
14716 eval $inlibc
14717
14718 : see if msgsnd exists
14719 set msgsnd d_msgsnd
14720 eval $inlibc
14721
14722 : see if msgrcv exists
14723 set msgrcv d_msgrcv
14724 eval $inlibc
14725
14726 : see how much of the 'msg*(2)' library is present.
14727 h_msg=true
14728 echo " "
14729 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14730 *"$undef"*) h_msg=false;;
14731 esac
14732 case "$osname" in
14733 freebsd)
14734     case "`ipcs 2>&1`" in
14735     "SVID messages"*"not configured"*)
14736         echo "Your $osname does not have the msg*(2) configured." >&4
14737         h_msg=false
14738         val="$undef"
14739         set msgctl d_msgctl
14740         eval $setvar
14741         set msgget d_msgget
14742         eval $setvar
14743         set msgsnd d_msgsnd
14744         eval $setvar
14745         set msgrcv d_msgrcv
14746         eval $setvar
14747         ;;
14748     esac
14749     ;;
14750 esac
14751 : we could also check for sys/ipc.h ...
14752 if $h_msg && $test `./findhdr sys/msg.h`; then
14753         echo "You have the full msg*(2) library." >&4
14754         val="$define"
14755 else
14756         echo "You don't have the full msg*(2) library." >&4
14757         val="$undef"
14758 fi
14759 set d_msg
14760 eval $setvar
14761
14762
14763 echo " "
14764 echo "Checking to see if your system supports struct msghdr..." >&4
14765 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14766 eval $hasstruct
14767 case "$d_msghdr_s" in
14768 "$define")      echo "Yes, it does."   ;;
14769 *)              echo "No, it doesn't." ;;
14770 esac
14771
14772
14773 : see if msync exists
14774 set msync d_msync
14775 eval $inlibc
14776
14777 : see if munmap exists
14778 set munmap d_munmap
14779 eval $inlibc
14780
14781 : see if nice exists
14782 set nice d_nice
14783 eval $inlibc
14784
14785 : see if this is a langinfo.h system
14786 set langinfo.h i_langinfo
14787 eval $inhdr
14788
14789 : see if nl_langinfo exists
14790 set nl_langinfo d_nl_langinfo
14791 eval $inlibc
14792
14793 : check for length of character
14794 echo " "
14795 case "$charsize" in
14796 '')
14797         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14798         $cat >try.c <<EOCP
14799 #include <stdio.h>
14800 #$i_stdlib I_STDLIB
14801 #ifdef I_STDLIB
14802 #include <stdlib.h>
14803 #endif
14804 int main()
14805 {
14806     printf("%d\n", (int)sizeof(char));
14807     exit(0);
14808 }
14809 EOCP
14810         set try
14811         if eval $compile_ok; then
14812                 dflt=`$run ./try`
14813         else
14814                 dflt='1'
14815                 echo "(I can't seem to compile the test program.  Guessing...)"
14816         fi
14817         ;;
14818 *)
14819         dflt="$charsize"
14820         ;;
14821 esac
14822 rp="What is the size of a character (in bytes)?"
14823 . ./myread
14824 charsize="$ans"
14825 $rm -f try.c try
14826
14827 : check for volatile keyword
14828 echo " "
14829 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14830 $cat >try.c <<'EOCP'
14831 int main()
14832 {
14833         typedef struct _goo_struct goo_struct;
14834         goo_struct * volatile goo = ((goo_struct *)0);
14835         struct _goo_struct {
14836                 long long_int;
14837                 int reg_int;
14838                 char char_var;
14839         };
14840         typedef unsigned short foo_t;
14841         char *volatile foo;
14842         volatile int bar;
14843         volatile foo_t blech;
14844         foo = foo;
14845 }
14846 EOCP
14847 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14848         val="$define"
14849         echo "Yup, it does."
14850 else
14851         val="$undef"
14852         echo "Nope, it doesn't."
14853 fi
14854 set d_volatile
14855 eval $setvar
14856 $rm -f try.*
14857
14858
14859 echo " "
14860 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14861
14862 case "$use64bitint:$d_quad:$quadtype" in
14863 define:define:?*)
14864         ivtype="$quadtype"
14865         uvtype="$uquadtype"
14866         ivsize=8
14867         uvsize=8
14868         ;;
14869 *)      ivtype="long"
14870         uvtype="unsigned long"
14871         ivsize=$longsize
14872         uvsize=$longsize
14873         ;;
14874 esac
14875
14876 case "$uselongdouble:$d_longdbl" in
14877 define:define)
14878         nvtype="long double"
14879         nvsize=$longdblsize
14880         ;;
14881 *)      nvtype=double
14882         nvsize=$doublesize
14883         ;;
14884 esac
14885
14886 $echo "(IV will be "$ivtype", $ivsize bytes)"
14887 $echo "(UV will be "$uvtype", $uvsize bytes)"
14888 $echo "(NV will be "$nvtype", $nvsize bytes)"
14889
14890 $cat >try.c <<EOCP
14891 #$i_inttypes I_INTTYPES
14892 #ifdef I_INTTYPES
14893 #include <inttypes.h>
14894 #endif
14895 #include <stdio.h>
14896 int main() {
14897 #ifdef INT8
14898    int8_t i =  INT8_MAX;
14899   uint8_t u = UINT8_MAX;
14900   printf("int8_t\n");
14901 #endif
14902 #ifdef INT16
14903    int16_t i =  INT16_MAX;
14904   uint16_t i = UINT16_MAX;
14905   printf("int16_t\n");
14906 #endif
14907 #ifdef INT32
14908    int32_t i =  INT32_MAX;
14909   uint32_t u = UINT32_MAX;
14910   printf("int32_t\n");
14911 #endif
14912 }
14913 EOCP
14914
14915 case "$i8type" in
14916 '')     case "$charsize" in
14917         1)      i8type=char
14918                 u8type="unsigned char"
14919                 i8size=$charsize
14920                 u8size=$charsize
14921                 ;;
14922         esac
14923         ;;
14924 esac
14925 case "$i8type" in
14926 '')     set try -DINT8
14927         if eval $compile; then
14928                 case "`$run ./try`" in
14929                 int8_t) i8type=int8_t
14930                         u8type=uint8_t
14931                         i8size=1
14932                         u8size=1
14933                         ;;
14934                 esac
14935         fi
14936         ;;
14937 esac
14938 case "$i8type" in
14939 '')     if $test $charsize -ge 1; then
14940                 i8type=char
14941                 u8type="unsigned char"
14942                 i8size=$charsize
14943                 u8size=$charsize
14944         fi
14945         ;;
14946 esac
14947
14948 case "$i16type" in
14949 '')     case "$shortsize" in
14950         2)      i16type=short
14951                 u16type="unsigned short"
14952                 i16size=$shortsize
14953                 u16size=$shortsize
14954                 ;;
14955         esac
14956         ;;
14957 esac
14958 case "$i16type" in
14959 '')     set try -DINT16
14960         if eval $compile; then
14961                 case "`$run ./try`" in
14962                 int16_t)
14963                         i16type=int16_t
14964                         u16type=uint16_t
14965                         i16size=2
14966                         u16size=2
14967                         ;;
14968                 esac
14969         fi
14970         ;;
14971 esac
14972 case "$i16type" in
14973 '')     if $test $shortsize -ge 2; then
14974                 i16type=short
14975                 u16type="unsigned short"
14976                 i16size=$shortsize
14977                 u16size=$shortsize
14978         fi
14979         ;;
14980 esac
14981
14982 case "$i32type" in
14983 '')     case "$longsize" in
14984         4)      i32type=long
14985                 u32type="unsigned long"
14986                 i32size=$longsize
14987                 u32size=$longsize
14988                 ;;
14989         *)      case "$intsize" in
14990                 4)      i32type=int
14991                         u32type="unsigned int"
14992                         i32size=$intsize
14993                         u32size=$intsize
14994                         ;;
14995                 esac
14996                 ;;
14997         esac
14998         ;;
14999 esac
15000 case "$i32type" in
15001 '')     set try -DINT32
15002         if eval $compile; then
15003                 case "`$run ./try`" in
15004                 int32_t)
15005                         i32type=int32_t
15006                         u32type=uint32_t
15007                         i32size=4
15008                         u32size=4
15009                         ;;
15010                 esac
15011         fi
15012         ;;
15013 esac
15014 case "$i32type" in
15015 '')     if $test $intsize -ge 4; then
15016                 i32type=int
15017                 u32type="unsigned int"
15018                 i32size=$intsize
15019                 u32size=$intsize
15020         fi
15021         ;;
15022 esac
15023
15024 case "$i64type" in
15025 '')     case "$d_quad:$quadtype" in
15026         define:?*)
15027                 i64type="$quadtype"
15028                 u64type="$uquadtype"
15029                 i64size=8
15030                 u64size=8
15031                 ;;
15032         esac
15033         ;;
15034 esac
15035
15036 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15037 : volatile so that the compiler has to store it out to memory.
15038 if test X"$d_volatile" = X"$define"; then
15039         volatile=volatile
15040 fi
15041 $cat <<EOP >try.c
15042 #include <stdio.h>
15043 #$i_stdlib I_STDLIB
15044 #ifdef I_STDLIB
15045 #include <stdlib.h>
15046 #endif
15047 #include <sys/types.h>
15048 #include <signal.h>
15049 #ifdef SIGFPE
15050 $volatile int bletched = 0;
15051 $signal_t blech(s) int s; { bletched = 1; }
15052 #endif
15053 int main() {
15054     $uvtype u = 0;
15055     $nvtype d;
15056     int     n = 8 * $uvsize;
15057     int     i;
15058 #ifdef SIGFPE
15059     signal(SIGFPE, blech);
15060 #endif
15061
15062     for (i = 0; i < n; i++) {
15063       u = u << 1 | ($uvtype)1;
15064       d = ($nvtype)u;
15065       if (($uvtype)d != u)
15066         break;
15067       if (d <= 0)
15068         break;
15069       d = ($nvtype)(u - 1);
15070       if (($uvtype)d != (u - 1))
15071         break;
15072 #ifdef SIGFPE
15073       if (bletched) {
15074         break;
15075 #endif
15076       } 
15077     }
15078     printf("%d\n", ((i == n) ? -n : i));
15079     exit(0);
15080 }
15081 EOP
15082 set try
15083
15084 d_nv_preserves_uv="$undef"
15085 if eval $compile; then
15086         nv_preserves_uv_bits="`$run ./try`"
15087 fi
15088 case "$nv_preserves_uv_bits" in
15089 \-[1-9]*)       
15090         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15091         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15092         d_nv_preserves_uv="$define"
15093         ;;
15094 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15095         d_nv_preserves_uv="$undef" ;;
15096 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15097         nv_preserves_uv_bits="$undef" ;;
15098 esac
15099
15100 $rm -f try.* try
15101
15102 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15103 : volatile so that the compiler has to store it out to memory.
15104 if test X"$d_volatile" = X"$define"; then
15105         volatile=volatile
15106 fi
15107 $cat <<EOP >try.c
15108 #include <stdio.h>
15109 #$i_stdlib I_STDLIB
15110 #ifdef I_STDLIB
15111 #include <stdlib.h>
15112 #endif
15113 #$i_string I_STRING
15114 #ifdef I_STRING
15115 #  include <string.h>
15116 #else
15117 #  include <strings.h>
15118 #endif
15119 #include <sys/types.h>
15120 #include <signal.h>
15121 #ifdef SIGFPE
15122 $volatile int bletched = 0;
15123 $signal_t blech(s) int s; { bletched = 1; }
15124 #endif
15125
15126 int checkit($nvtype d, char *where) {
15127     unsigned char *p = (char *)&d;
15128     unsigned char *end = p + sizeof(d);
15129     int fail = 0;
15130
15131     while (p < end)
15132         fail += *p++;
15133
15134     if (!fail)
15135         return 0;
15136
15137     p = (char *)&d;
15138     printf("No - %s: 0x", where);
15139     while (p < end)
15140         printf ("%02X", *p++);
15141     printf("\n");
15142     return 1;
15143 }
15144
15145 int main(int argc, char **argv) {
15146     $nvtype d = 0.0;
15147     int fail = 0;
15148     fail += checkit(d, "0.0");
15149
15150     /* The compiler shouldn't be assuming that bletched is 0  */
15151     d = bletched;
15152
15153     fail += checkit(d, "bleched");
15154
15155 #ifdef SIGFPE
15156     signal(SIGFPE, blech);
15157 #endif
15158
15159     /* Paranoia - the compiler should have no way of knowing that ANSI says
15160        that argv[argc] will always be NULL.  Actually, if it did assume this it
15161        would be buggy, as this is C and main() can be called from elsewhere in
15162        the program.  */
15163     d = argv[argc] ? 1 : 0;
15164
15165     if (d) {
15166         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15167     }
15168
15169     fail += checkit(d, "ternary");
15170
15171     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15172
15173     if (d != 0.0) {
15174         printf("No - memset doesn't give 0.0\n");
15175         /* This might just blow up:  */
15176         printf("(gives %g)\n", d);
15177         return 1;
15178     }
15179     
15180 #ifdef SIGFPE
15181     if (bletched) {
15182         printf("No - something bleched\n");
15183         return 1;
15184     }
15185 #endif
15186     if (fail) {
15187       printf("No - %d fail(s)\n", fail);
15188       return 1;
15189     }
15190     printf("Yes\n");
15191     return 0;
15192 }
15193 EOP
15194 set try
15195
15196 d_nv_zero_is_allbits_zero="$undef"
15197 if eval $compile; then
15198     xxx="`$run ./try`"
15199     case "$?" in
15200         0)
15201             case "$xxx" in
15202                 Yes)  cat >&4 <<EOM
15203 0.0 is represented as all bits zero in memory
15204 EOM
15205                     d_nv_zero_is_allbits_zero="$define"
15206                     ;;
15207                 *)  cat >&4 <<EOM
15208 0.0 is not represented as all bits zero in memory
15209 EOM
15210                     d_nv_zero_is_allbits_zero="$undef"
15211                     ;;
15212             esac
15213             ;;
15214         *)  cat >&4 <<EOM
15215 0.0 is not represented as all bits zero in memory
15216 EOM
15217             d_nv_zero_is_allbits_zero="$undef"
15218             ;;
15219     esac
15220 fi
15221
15222 $rm -f try.* try
15223
15224
15225 : check for off64_t
15226 echo " "
15227 echo "Checking to see if you have off64_t..." >&4
15228 $cat >try.c <<EOCP
15229 #include <sys/types.h>
15230 #include <unistd.h>
15231 int main() { off64_t x = 7; }
15232 EOCP
15233 set try
15234 if eval $compile; then
15235         val="$define"
15236         echo "You have off64_t."
15237 else
15238         val="$undef"
15239         echo "You do not have off64_t."
15240         case "$lseeksize" in
15241         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15242         esac
15243 fi
15244 $rm -f try.* try
15245 set d_off64_t
15246 eval $setvar
15247
15248 : how to create joinable pthreads
15249 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15250         echo " "
15251         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15252         $cat >try.c <<'EOCP'
15253 #include <pthread.h>
15254 int main() {
15255     int detachstate = JOINABLE;
15256 }
15257 EOCP
15258         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15259         if eval $compile; then
15260                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15261                 val="$undef" # Yes, undef.
15262                 set d_old_pthread_create_joinable
15263                 eval $setvar
15264                 val=""
15265                 set old_pthread_create_joinable
15266                 eval $setvar
15267         else
15268                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15269                 if eval $compile; then
15270                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15271                         val="$define"
15272                         set d_old_pthread_create_joinable
15273                         eval $setvar
15274                         val=PTHREAD_CREATE_UNDETACHED
15275                         set old_pthread_create_joinable
15276                         eval $setvar
15277                 else            
15278                         set try -DJOINABLE=__UNDETACHED
15279                         if eval $compile; then
15280                                 echo "You seem to use __UNDETACHED." >&4
15281                                 val="$define"
15282                                 set d_old_pthread_create_joinable
15283                                 eval $setvar
15284                                 val=__UNDETACHED
15285                                 set old_pthread_create_joinable
15286                                 eval $setvar
15287                         else
15288                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15289                                 val="$define"
15290                                 set d_old_pthread_create_joinable
15291                                 eval $setvar
15292                                 val=0
15293                                 set old_pthread_create_joinable
15294                                 eval $setvar
15295                         fi
15296                 fi
15297         fi
15298         $rm -f try try.*
15299 else
15300     d_old_pthread_create_joinable="$undef"
15301     old_pthread_create_joinable=""
15302 fi
15303
15304 : see if pause exists
15305 set pause d_pause
15306 eval $inlibc
15307
15308 : see if pipe exists
15309 set pipe d_pipe
15310 eval $inlibc
15311
15312 : see if poll exists
15313 set poll d_poll
15314 eval $inlibc
15315
15316 : see if readlink exists
15317 set readlink d_readlink
15318 eval $inlibc
15319
15320 echo " "
15321 procselfexe=''
15322 val="$undef"
15323 case "$d_readlink" in
15324 "$define")
15325         if $issymlink /proc/self/exe ; then
15326                 $ls -l /proc/self/exe > reflect
15327                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15328                         echo "You have Linux-like /proc/self/exe."
15329                         procselfexe='"/proc/self/exe"'
15330                         val="$define"
15331                 fi
15332         fi
15333         if $issymlink /proc/curproc/file ; then
15334                 $ls -l /proc/curproc/file > reflect
15335                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15336                         echo "You have BSD-like /proc/curproc/file."
15337                         procselfexe='"/proc/curproc/file"'
15338                         val="$define"
15339                 fi
15340         fi
15341         ;;
15342 esac
15343 $rm -f reflect
15344 set d_procselfexe
15345 eval $setvar
15346
15347 : see whether the pthread_atfork exists
15348 $cat >try.c <<EOP
15349 #include <pthread.h>
15350 #include <stdio.h>
15351 int main() {
15352 #ifdef  PTHREAD_ATFORK
15353         pthread_atfork(NULL,NULL,NULL);
15354 #endif
15355 }
15356 EOP
15357
15358 : see if pthread_atfork exists
15359 set try -DPTHREAD_ATFORK
15360 if eval $compile; then
15361     val="$define"
15362 else
15363     val="$undef"
15364 fi
15365 case "$usethreads" in
15366 $define)
15367         case "$val" in
15368         $define) echo 'pthread_atfork found.' >&4        ;;
15369         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15370         esac
15371 esac
15372 set d_pthread_atfork
15373 eval $setvar
15374
15375 : see if pthread_attr_setscope exists
15376 set pthread_attr_setscope d_pthread_attr_setscope
15377 eval $inlibc
15378
15379
15380 : see whether the various POSIXish _yields exist
15381 $cat >try.c <<EOP
15382 #include <pthread.h>
15383 #include <stdio.h>
15384 int main() {
15385 #ifdef SCHED_YIELD
15386         sched_yield();
15387 #else
15388 #ifdef PTHREAD_YIELD
15389         pthread_yield();
15390 #else
15391 #ifdef PTHREAD_YIELD_NULL
15392         pthread_yield(NULL);
15393 #endif
15394 #endif
15395 #endif
15396 }
15397 EOP
15398 : see if sched_yield exists
15399 set try -DSCHED_YIELD
15400 if eval $compile; then
15401     val="$define"
15402     sched_yield='sched_yield()'
15403 else
15404     val="$undef"
15405 fi
15406 case "$usethreads" in
15407 $define)
15408         case "$val" in
15409         $define) echo 'sched_yield() found.' >&4        ;;
15410         *)       echo 'sched_yield() NOT found.' >&4    ;;
15411         esac
15412 esac
15413 set d_sched_yield
15414 eval $setvar
15415
15416 : see if pthread_yield exists
15417 set try -DPTHREAD_YIELD
15418 if eval $compile; then
15419     val="$define"
15420     case "$sched_yield" in
15421     '') sched_yield='pthread_yield()' ;;
15422     esac
15423 else
15424     set try -DPTHREAD_YIELD_NULL
15425     if eval $compile; then
15426         val="$define"
15427         case "$sched_yield" in
15428         '') sched_yield='pthread_yield(NULL)' ;;
15429         esac
15430     else
15431         val="$undef"
15432     fi
15433 fi
15434 case "$usethreads" in
15435 $define)
15436         case "$val" in
15437         $define) echo 'pthread_yield() found.' >&4      ;;
15438         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15439         esac
15440         ;;
15441 esac
15442 set d_pthread_yield
15443 eval $setvar
15444
15445 case "$sched_yield" in
15446 '') sched_yield=undef ;;
15447 esac
15448
15449 $rm -f try try.*
15450
15451 : see if random_r exists
15452 set random_r d_random_r
15453 eval $inlibc
15454 case "$d_random_r" in
15455 "$define")
15456         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15457         case "$d_random_r_proto:$usethreads" in
15458         ":define")      d_random_r_proto=define
15459                 set d_random_r_proto random_r $hdrs
15460                 eval $hasproto ;;
15461         *)      ;;
15462         esac
15463         case "$d_random_r_proto" in
15464         define)
15465         case "$random_r_proto" in
15466         ''|0) try='int random_r(int*, struct random_data*);'
15467         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15468         esac
15469         case "$random_r_proto" in
15470         ''|0) try='int random_r(long*, struct random_data*);'
15471         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15472         esac
15473         case "$random_r_proto" in
15474         ''|0) try='int random_r(struct random_data*, int32_t*);'
15475         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15476         esac
15477         case "$random_r_proto" in
15478         ''|0)   d_random_r=undef
15479                 random_r_proto=0
15480                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15481         * )     case "$random_r_proto" in
15482                 REENTRANT_PROTO*) ;;
15483                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15484                 esac
15485                 echo "Prototype: $try" ;;
15486         esac
15487         ;;
15488         *)      case "$usethreads" in
15489                 define) echo "random_r has no prototype, not using it." >&4 ;;
15490                 esac
15491                 d_random_r=undef
15492                 random_r_proto=0
15493                 ;;
15494         esac
15495         ;;
15496 *)      random_r_proto=0
15497         ;;
15498 esac
15499
15500 : see if readdir and friends exist
15501 set readdir d_readdir
15502 eval $inlibc
15503 set seekdir d_seekdir
15504 eval $inlibc
15505 set telldir d_telldir
15506 eval $inlibc
15507 set rewinddir d_rewinddir
15508 eval $inlibc
15509
15510 : see if readdir64_r exists
15511 set readdir64_r d_readdir64_r
15512 eval $inlibc
15513 case "$d_readdir64_r" in
15514 "$define")
15515         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15516         case "$d_readdir64_r_proto:$usethreads" in
15517         ":define")      d_readdir64_r_proto=define
15518                 set d_readdir64_r_proto readdir64_r $hdrs
15519                 eval $hasproto ;;
15520         *)      ;;
15521         esac
15522         case "$d_readdir64_r_proto" in
15523         define)
15524         case "$readdir64_r_proto" in
15525         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15526         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15527         esac
15528         case "$readdir64_r_proto" in
15529         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15530         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15531         esac
15532         case "$readdir64_r_proto" in
15533         ''|0)   d_readdir64_r=undef
15534                 readdir64_r_proto=0
15535                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15536         * )     case "$readdir64_r_proto" in
15537                 REENTRANT_PROTO*) ;;
15538                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15539                 esac
15540                 echo "Prototype: $try" ;;
15541         esac
15542         ;;
15543         *)      case "$usethreads" in
15544                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15545                 esac
15546                 d_readdir64_r=undef
15547                 readdir64_r_proto=0
15548                 ;;
15549         esac
15550         ;;
15551 *)      readdir64_r_proto=0
15552         ;;
15553 esac
15554
15555 : see if readdir_r exists
15556 set readdir_r d_readdir_r
15557 eval $inlibc
15558 case "$d_readdir_r" in
15559 "$define")
15560         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15561         case "$d_readdir_r_proto:$usethreads" in
15562         ":define")      d_readdir_r_proto=define
15563                 set d_readdir_r_proto readdir_r $hdrs
15564                 eval $hasproto ;;
15565         *)      ;;
15566         esac
15567         case "$d_readdir_r_proto" in
15568         define)
15569         case "$readdir_r_proto" in
15570         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15571         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15572         esac
15573         case "$readdir_r_proto" in
15574         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15575         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15576         esac
15577         case "$readdir_r_proto" in
15578         ''|0)   d_readdir_r=undef
15579                 readdir_r_proto=0
15580                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15581         * )     case "$readdir_r_proto" in
15582                 REENTRANT_PROTO*) ;;
15583                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15584                 esac
15585                 echo "Prototype: $try" ;;
15586         esac
15587         ;;
15588         *)      case "$usethreads" in
15589                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15590                 esac
15591                 d_readdir_r=undef
15592                 readdir_r_proto=0
15593                 ;;
15594         esac
15595         ;;
15596 *)      readdir_r_proto=0
15597         ;;
15598 esac
15599
15600 : see if readv exists
15601 set readv d_readv
15602 eval $inlibc
15603
15604 : see if recvmsg exists
15605 set recvmsg d_recvmsg
15606 eval $inlibc
15607
15608 : see if rename exists
15609 set rename d_rename
15610 eval $inlibc
15611
15612 : see if rmdir exists
15613 set rmdir d_rmdir
15614 eval $inlibc
15615
15616 : see if memory.h is available.
15617 val=''
15618 set memory.h val
15619 eval $inhdr
15620
15621 : See if it conflicts with string.h
15622 case "$val" in
15623 $define)
15624         case "$strings" in
15625         '') ;;
15626         *)
15627                 $cppstdin $cppflags $cppminus < $strings > mem.h
15628                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15629                         echo " "
15630                         echo "We won't be including <memory.h>."
15631                         val="$undef"
15632                 fi
15633                 $rm -f mem.h
15634                 ;;
15635         esac
15636 esac
15637 set i_memory
15638 eval $setvar
15639
15640 : can bcopy handle overlapping blocks?
15641 echo " "
15642 val="$undef"
15643 case "$d_memmove" in
15644 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15645 *)      case "$d_bcopy" in
15646         "$define")
15647                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15648                 $cat >try.c <<EOCP
15649 #$i_memory I_MEMORY
15650 #$i_stdlib I_STDLIB
15651 #$i_string I_STRING
15652 #$i_unistd I_UNISTD
15653 EOCP
15654         $cat >>try.c <<'EOCP'
15655 #include <stdio.h>
15656 #ifdef I_MEMORY
15657 #  include <memory.h>
15658 #endif
15659 #ifdef I_STDLIB
15660 #  include <stdlib.h>
15661 #endif
15662 #ifdef I_STRING
15663 #  include <string.h>
15664 #else
15665 #  include <strings.h>
15666 #endif
15667 #ifdef I_UNISTD
15668 #  include <unistd.h>  /* Needed for NetBSD */
15669 #endif
15670 int main()
15671 {
15672 char buf[128], abc[128];
15673 char *b;
15674 int len;
15675 int off;
15676 int align;
15677
15678 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15679    try to store the string in read-only memory. */
15680 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15681
15682 for (align = 7; align >= 0; align--) {
15683         for (len = 36; len; len--) {
15684                 b = buf+align;
15685                 bcopy(abc, b, len);
15686                 for (off = 1; off <= len; off++) {
15687                         bcopy(b, b+off, len);
15688                         bcopy(b+off, b, len);
15689                         if (bcmp(b, abc, len))
15690                                 exit(1);
15691                 }
15692         }
15693 }
15694 exit(0);
15695 }
15696 EOCP
15697                 set try
15698                 if eval $compile_ok; then
15699                         if ./try 2>/dev/null; then
15700                                 echo "Yes, it can."
15701                                 val="$define"
15702                         else
15703                                 echo "It can't, sorry."
15704                         fi
15705                 else
15706                         echo "(I can't compile the test program, so we'll assume not...)"
15707                 fi
15708                 ;;
15709         esac
15710         $rm -f try.* try core
15711         ;;
15712 esac
15713 set d_safebcpy
15714 eval $setvar
15715
15716 : can memcpy handle overlapping blocks?
15717 echo " "
15718 val="$undef"
15719 case "$d_memmove" in
15720 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15721 *)      case "$d_memcpy" in
15722         "$define")
15723                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15724                 $cat >try.c <<EOCP
15725 #$i_memory I_MEMORY
15726 #$i_stdlib I_STDLIB
15727 #$i_string I_STRING
15728 #$i_unistd I_UNISTD
15729 EOCP
15730         $cat >>try.c <<'EOCP'
15731 #include <stdio.h>
15732 #ifdef I_MEMORY
15733 #  include <memory.h>
15734 #endif
15735 #ifdef I_STDLIB
15736 #  include <stdlib.h>
15737 #endif
15738 #ifdef I_STRING
15739 #  include <string.h>
15740 #else
15741 #  include <strings.h>
15742 #endif
15743 #ifdef I_UNISTD
15744 #  include <unistd.h>  /* Needed for NetBSD */
15745 #endif
15746 int main()
15747 {
15748 char buf[128], abc[128];
15749 char *b;
15750 int len;
15751 int off;
15752 int align;
15753
15754 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15755    try to store the string in read-only memory. */
15756 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15757
15758 for (align = 7; align >= 0; align--) {
15759         for (len = 36; len; len--) {
15760                 b = buf+align;
15761                 memcpy(b, abc, len);
15762                 for (off = 1; off <= len; off++) {
15763                         memcpy(b+off, b, len);
15764                         memcpy(b, b+off, len);
15765                         if (memcmp(b, abc, len))
15766                                 exit(1);
15767                 }
15768         }
15769 }
15770 exit(0);
15771 }
15772 EOCP
15773                 set try
15774                 if eval $compile_ok; then
15775                         if ./try 2>/dev/null; then
15776                                 echo "Yes, it can."
15777                                 val="$define"
15778                         else
15779                                 echo "It can't, sorry."
15780                         fi
15781                 else
15782                         echo "(I can't compile the test program, so we'll assume not...)"
15783                 fi
15784                 ;;
15785         esac
15786         $rm -f try.* try core
15787         ;;
15788 esac
15789 set d_safemcpy
15790 eval $setvar
15791
15792 : can memcmp be trusted to compare relative magnitude?
15793 val="$undef"
15794 case "$d_memcmp" in
15795 "$define")
15796         echo " "
15797         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15798         $cat >try.c <<EOCP
15799 #$i_memory I_MEMORY
15800 #$i_stdlib I_STDLIB
15801 #$i_string I_STRING
15802 #$i_unistd I_UNISTD
15803 EOCP
15804         $cat >>try.c <<'EOCP'
15805 #include <stdio.h>
15806 #ifdef I_MEMORY
15807 #  include <memory.h>
15808 #endif
15809 #ifdef I_STDLIB
15810 #  include <stdlib.h>
15811 #endif
15812 #ifdef I_STRING
15813 #  include <string.h>
15814 #else
15815 #  include <strings.h>
15816 #endif
15817 #ifdef I_UNISTD
15818 #  include <unistd.h>  /* Needed for NetBSD */
15819 #endif
15820 int main()
15821 {
15822 char a = -1;
15823 char b = 0;
15824 if ((a < b) && memcmp(&a, &b, 1) < 0)
15825         exit(1);
15826 exit(0);
15827 }
15828 EOCP
15829         set try
15830         if eval $compile_ok; then
15831                 if $run ./try 2>/dev/null; then
15832                         echo "Yes, it can."
15833                         val="$define"
15834                 else
15835                         echo "No, it can't (it uses signed chars)."
15836                 fi
15837         else
15838                 echo "(I can't compile the test program, so we'll assume not...)"
15839         fi
15840         ;;
15841 esac
15842 $rm -f try.* try core
15843 set d_sanemcmp
15844 eval $setvar
15845
15846 : see if prototype for sbrk is available
15847 echo " "
15848 set d_sbrkproto sbrk $i_unistd unistd.h
15849 eval $hasproto
15850
15851 : see if select exists
15852 set select d_select
15853 eval $inlibc
15854
15855 : see if semctl exists
15856 set semctl d_semctl
15857 eval $inlibc
15858
15859 : see if semget exists
15860 set semget d_semget
15861 eval $inlibc
15862
15863 : see if semop exists
15864 set semop d_semop
15865 eval $inlibc
15866
15867 : see how much of the 'sem*(2)' library is present.
15868 h_sem=true
15869 echo " "
15870 case "$d_semctl$d_semget$d_semop" in
15871 *"$undef"*) h_sem=false;;
15872 esac
15873 case "$osname" in
15874 freebsd)
15875     case "`ipcs 2>&1`" in
15876     "SVID messages"*"not configured"*)
15877         echo "Your $osname does not have the sem*(2) configured." >&4
15878         h_sem=false
15879         val="$undef"
15880         set semctl d_semctl
15881         eval $setvar
15882         set semget d_semget
15883         eval $setvar
15884         set semop d_semop
15885         eval $setvar
15886         ;;
15887     esac
15888     ;;
15889 esac
15890 : we could also check for sys/ipc.h ...
15891 if $h_sem && $test `./findhdr sys/sem.h`; then
15892         echo "You have the full sem*(2) library." >&4
15893         val="$define"
15894 else
15895         echo "You don't have the full sem*(2) library." >&4
15896         val="$undef"
15897 fi
15898 set d_sem
15899 eval $setvar
15900
15901 : see whether sys/sem.h defines union semun
15902 echo " "
15903 $cat > try.c <<'END'
15904 #include <sys/types.h>
15905 #include <sys/ipc.h>
15906 #include <sys/sem.h>
15907 int main () { union semun semun; semun.buf = 0; }
15908 END
15909 set try
15910 if eval $compile; then
15911     echo "You have union semun in <sys/sem.h>." >&4
15912     val="$define"
15913 else
15914     echo "You do not have union semun in <sys/sem.h>." >&4
15915     val="$undef"
15916 fi
15917 $rm -f try try.c
15918 set d_union_semun
15919 eval $setvar
15920
15921 : see how to do semctl IPC_STAT
15922 case "$d_sem" in
15923 $define)
15924     echo " "
15925     $cat > try.h <<END
15926 #ifndef S_IRUSR
15927 #   ifdef S_IREAD
15928 #       define S_IRUSR S_IREAD
15929 #       define S_IWUSR S_IWRITE
15930 #       define S_IXUSR S_IEXEC
15931 #   else
15932 #       define S_IRUSR 0400
15933 #       define S_IWUSR 0200
15934 #       define S_IXUSR 0100
15935 #   endif
15936 #   define S_IRGRP (S_IRUSR>>3)
15937 #   define S_IWGRP (S_IWUSR>>3)
15938 #   define S_IXGRP (S_IXUSR>>3)
15939 #   define S_IROTH (S_IRUSR>>6)
15940 #   define S_IWOTH (S_IWUSR>>6)
15941 #   define S_IXOTH (S_IXUSR>>6)
15942 #endif
15943 #ifndef S_IRWXU
15944 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15945 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15946 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15947 #endif
15948 END
15949     : see whether semctl IPC_STAT can use union semun
15950     val="$undef"
15951     case "$d_semctl_semun" in
15952     '')
15953       $cat > try.c <<END
15954 #include <sys/types.h>
15955 #include <sys/ipc.h>
15956 #include <sys/sem.h>
15957 #include <sys/stat.h>
15958 #include <stdio.h>
15959 #include <errno.h>
15960 #include "try.h"
15961 #ifndef errno
15962 extern int errno;
15963 #endif
15964 #$d_union_semun HAS_UNION_SEMUN
15965 int main() {
15966     union semun
15967 #ifndef HAS_UNION_SEMUN
15968     {
15969         int val;
15970         struct semid_ds *buf;
15971         unsigned short *array;
15972     }
15973 #endif
15974     arg;
15975     int sem, st;
15976
15977 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15978     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15979     if (sem > -1) {
15980         struct semid_ds argbuf;
15981         arg.buf = &argbuf;
15982 #       ifdef IPC_STAT
15983         st = semctl(sem, 0, IPC_STAT, arg);
15984         if (st == 0)
15985             printf("semun\n");
15986         else
15987 #       endif /* IPC_STAT */
15988             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15989 #       ifdef IPC_RMID
15990         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15991 #       endif /* IPC_RMID */
15992             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15993     } else
15994 #endif /* IPC_PRIVATE && ... */
15995         printf("semget failed: errno = %d\n", errno);
15996   return 0;
15997 }
15998 END
15999       set try
16000       if eval $compile; then
16001           xxx=`$run ./try`
16002           case "$xxx" in
16003           semun) val="$define" ;;
16004           esac
16005       fi
16006       $rm -f try try.c
16007       ;;
16008     esac
16009     set d_semctl_semun
16010     eval $setvar
16011     case "$d_semctl_semun" in
16012     $define)
16013         echo "You can use union semun for semctl IPC_STAT." >&4
16014         also='also'
16015         ;;
16016     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16017         also=''
16018         ;;
16019     esac
16020
16021     : see whether semctl IPC_STAT can use struct semid_ds pointer
16022     val="$undef"
16023     case "$d_semctl_semid_ds" in
16024     '')
16025       $cat > try.c <<'END'
16026 #include <sys/types.h>
16027 #include <sys/ipc.h>
16028 #include <sys/sem.h>
16029 #include <sys/stat.h>
16030 #include "try.h"
16031 #include <stdio.h>
16032 #include <errno.h>
16033 #ifndef errno
16034 extern int errno;
16035 #endif
16036 int main() {
16037     struct semid_ds arg;
16038     int sem, st;
16039
16040 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16041     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16042     if (sem > -1) {
16043 #       ifdef IPC_STAT
16044         st = semctl(sem, 0, IPC_STAT, &arg);
16045         if (st == 0)
16046             printf("semid_ds\n");
16047         else
16048 #       endif /* IPC_STAT */
16049             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16050 #       ifdef IPC_RMID
16051         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16052 #       endif /* IPC_RMID */
16053             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16054     } else
16055 #endif /* IPC_PRIVATE && ... */
16056         printf("semget failed: errno = %d\n", errno);
16057
16058     return 0;
16059 }
16060 END
16061       set try
16062       if eval $compile; then
16063           xxx=`$run ./try`
16064           case "$xxx" in
16065           semid_ds) val="$define" ;;
16066           esac
16067       fi
16068       $rm -f try try.c
16069       ;;
16070     esac
16071     set d_semctl_semid_ds
16072     eval $setvar
16073     case "$d_semctl_semid_ds" in
16074     $define)
16075         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16076         ;;
16077     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16078         ;;
16079     esac
16080     $rm -f try.h
16081     ;;
16082 *)  val="$undef"
16083
16084     # We do not have the full sem*(2) library, so assume we can not
16085     # use either.
16086
16087     set d_semctl_semun
16088     eval $setvar
16089
16090     set d_semctl_semid_ds
16091     eval $setvar
16092     ;;
16093 esac
16094
16095 : see if sendmsg exists
16096 set sendmsg d_sendmsg
16097 eval $inlibc
16098
16099 : see if setegid exists
16100 set setegid d_setegid
16101 eval $inlibc
16102
16103 : see if seteuid exists
16104 set seteuid d_seteuid
16105 eval $inlibc
16106
16107 : see if setgrent exists
16108 set setgrent d_setgrent
16109 eval $inlibc
16110
16111 : see if setgrent_r exists
16112 set setgrent_r d_setgrent_r
16113 eval $inlibc
16114 case "$d_setgrent_r" in
16115 "$define")
16116         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16117         case "$d_setgrent_r_proto:$usethreads" in
16118         ":define")      d_setgrent_r_proto=define
16119                 set d_setgrent_r_proto setgrent_r $hdrs
16120                 eval $hasproto ;;
16121         *)      ;;
16122         esac
16123         case "$d_setgrent_r_proto" in
16124         define)
16125         case "$setgrent_r_proto" in
16126         ''|0) try='int setgrent_r(FILE**);'
16127         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16128         esac
16129         case "$setgrent_r_proto" in
16130         ''|0) try='void setgrent_r(FILE**);'
16131         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16132         esac
16133         case "$setgrent_r_proto" in
16134         ''|0)   d_setgrent_r=undef
16135                 setgrent_r_proto=0
16136                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16137         * )     case "$setgrent_r_proto" in
16138                 REENTRANT_PROTO*) ;;
16139                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16140                 esac
16141                 echo "Prototype: $try" ;;
16142         esac
16143         ;;
16144         *)      case "$usethreads" in
16145                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16146                 esac
16147                 d_setgrent_r=undef
16148                 setgrent_r_proto=0
16149                 ;;
16150         esac
16151         ;;
16152 *)      setgrent_r_proto=0
16153         ;;
16154 esac
16155
16156 : see if sethostent exists
16157 set sethostent d_sethent
16158 eval $inlibc
16159
16160 : see if sethostent_r exists
16161 set sethostent_r d_sethostent_r
16162 eval $inlibc
16163 case "$d_sethostent_r" in
16164 "$define")
16165         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16166         case "$d_sethostent_r_proto:$usethreads" in
16167         ":define")      d_sethostent_r_proto=define
16168                 set d_sethostent_r_proto sethostent_r $hdrs
16169                 eval $hasproto ;;
16170         *)      ;;
16171         esac
16172         case "$d_sethostent_r_proto" in
16173         define)
16174         case "$sethostent_r_proto" in
16175         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16176         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16177         esac
16178         case "$sethostent_r_proto" in
16179         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16180         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16181         esac
16182         case "$sethostent_r_proto" in
16183         ''|0)   d_sethostent_r=undef
16184                 sethostent_r_proto=0
16185                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16186         * )     case "$sethostent_r_proto" in
16187                 REENTRANT_PROTO*) ;;
16188                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16189                 esac
16190                 echo "Prototype: $try" ;;
16191         esac
16192         ;;
16193         *)      case "$usethreads" in
16194                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16195                 esac
16196                 d_sethostent_r=undef
16197                 sethostent_r_proto=0
16198                 ;;
16199         esac
16200         ;;
16201 *)      sethostent_r_proto=0
16202         ;;
16203 esac
16204
16205 : see if setitimer exists
16206 set setitimer d_setitimer
16207 eval $inlibc
16208
16209 : see if setlinebuf exists
16210 set setlinebuf d_setlinebuf
16211 eval $inlibc
16212
16213 : see if setlocale exists
16214 set setlocale d_setlocale
16215 eval $inlibc
16216
16217 : see if locale.h is available
16218 set locale.h i_locale
16219 eval $inhdr
16220
16221 : see if setlocale_r exists
16222 set setlocale_r d_setlocale_r
16223 eval $inlibc
16224 case "$d_setlocale_r" in
16225 "$define")
16226         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16227         case "$d_setlocale_r_proto:$usethreads" in
16228         ":define")      d_setlocale_r_proto=define
16229                 set d_setlocale_r_proto setlocale_r $hdrs
16230                 eval $hasproto ;;
16231         *)      ;;
16232         esac
16233         case "$d_setlocale_r_proto" in
16234         define)
16235         case "$setlocale_r_proto" in
16236         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16237         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16238         esac
16239         case "$setlocale_r_proto" in
16240         ''|0)   d_setlocale_r=undef
16241                 setlocale_r_proto=0
16242                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16243         * )     case "$setlocale_r_proto" in
16244                 REENTRANT_PROTO*) ;;
16245                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16246                 esac
16247                 echo "Prototype: $try" ;;
16248         esac
16249         ;;
16250         *)      case "$usethreads" in
16251                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16252                 esac
16253                 d_setlocale_r=undef
16254                 setlocale_r_proto=0
16255                 ;;
16256         esac
16257         ;;
16258 *)      setlocale_r_proto=0
16259         ;;
16260 esac
16261
16262 : see if setnetent exists
16263 set setnetent d_setnent
16264 eval $inlibc
16265
16266 : see if setnetent_r exists
16267 set setnetent_r d_setnetent_r
16268 eval $inlibc
16269 case "$d_setnetent_r" in
16270 "$define")
16271         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16272         case "$d_setnetent_r_proto:$usethreads" in
16273         ":define")      d_setnetent_r_proto=define
16274                 set d_setnetent_r_proto setnetent_r $hdrs
16275                 eval $hasproto ;;
16276         *)      ;;
16277         esac
16278         case "$d_setnetent_r_proto" in
16279         define)
16280         case "$setnetent_r_proto" in
16281         ''|0) try='int setnetent_r(int, struct netent_data*);'
16282         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16283         esac
16284         case "$setnetent_r_proto" in
16285         ''|0) try='void setnetent_r(int, struct netent_data*);'
16286         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16287         esac
16288         case "$setnetent_r_proto" in
16289         ''|0)   d_setnetent_r=undef
16290                 setnetent_r_proto=0
16291                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16292         * )     case "$setnetent_r_proto" in
16293                 REENTRANT_PROTO*) ;;
16294                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16295                 esac
16296                 echo "Prototype: $try" ;;
16297         esac
16298         ;;
16299         *)      case "$usethreads" in
16300                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16301                 esac
16302                 d_setnetent_r=undef
16303                 setnetent_r_proto=0
16304                 ;;
16305         esac
16306         ;;
16307 *)      setnetent_r_proto=0
16308         ;;
16309 esac
16310
16311 : see if setprotoent exists
16312 set setprotoent d_setpent
16313 eval $inlibc
16314
16315 : see if setpgid exists
16316 set setpgid d_setpgid
16317 eval $inlibc
16318
16319 : see if setpgrp2 exists
16320 set setpgrp2 d_setpgrp2
16321 eval $inlibc
16322
16323 : see if setpriority exists
16324 set setpriority d_setprior
16325 eval $inlibc
16326
16327 : see if setproctitle exists
16328 set setproctitle d_setproctitle
16329 eval $inlibc
16330
16331 : see if setprotoent_r exists
16332 set setprotoent_r d_setprotoent_r
16333 eval $inlibc
16334 case "$d_setprotoent_r" in
16335 "$define")
16336         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16337         case "$d_setprotoent_r_proto:$usethreads" in
16338         ":define")      d_setprotoent_r_proto=define
16339                 set d_setprotoent_r_proto setprotoent_r $hdrs
16340                 eval $hasproto ;;
16341         *)      ;;
16342         esac
16343         case "$d_setprotoent_r_proto" in
16344         define)
16345         case "$setprotoent_r_proto" in
16346         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16347         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16348         esac
16349         case "$setprotoent_r_proto" in
16350         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16351         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16352         esac
16353         case "$setprotoent_r_proto" in
16354         ''|0)   d_setprotoent_r=undef
16355                 setprotoent_r_proto=0
16356                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16357         * )     case "$setprotoent_r_proto" in
16358                 REENTRANT_PROTO*) ;;
16359                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16360                 esac
16361                 echo "Prototype: $try" ;;
16362         esac
16363         ;;
16364         *)      case "$usethreads" in
16365                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16366                 esac
16367                 d_setprotoent_r=undef
16368                 setprotoent_r_proto=0
16369                 ;;
16370         esac
16371         ;;
16372 *)      setprotoent_r_proto=0
16373         ;;
16374 esac
16375
16376 : see if setpwent exists
16377 set setpwent d_setpwent
16378 eval $inlibc
16379
16380 : see if setpwent_r exists
16381 set setpwent_r d_setpwent_r
16382 eval $inlibc
16383 case "$d_setpwent_r" in
16384 "$define")
16385         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16386         case "$d_setpwent_r_proto:$usethreads" in
16387         ":define")      d_setpwent_r_proto=define
16388                 set d_setpwent_r_proto setpwent_r $hdrs
16389                 eval $hasproto ;;
16390         *)      ;;
16391         esac
16392         case "$d_setpwent_r_proto" in
16393         define)
16394         case "$setpwent_r_proto" in
16395         ''|0) try='int setpwent_r(FILE**);'
16396         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16397         esac
16398         case "$setpwent_r_proto" in
16399         ''|0) try='void setpwent_r(FILE**);'
16400         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16401         esac
16402         case "$setpwent_r_proto" in
16403         ''|0)   d_setpwent_r=undef
16404                 setpwent_r_proto=0
16405                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16406         * )     case "$setpwent_r_proto" in
16407                 REENTRANT_PROTO*) ;;
16408                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16409                 esac
16410                 echo "Prototype: $try" ;;
16411         esac
16412         ;;
16413         *)      case "$usethreads" in
16414                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16415                 esac
16416                 d_setpwent_r=undef
16417                 setpwent_r_proto=0
16418                 ;;
16419         esac
16420         ;;
16421 *)      setpwent_r_proto=0
16422         ;;
16423 esac
16424
16425 : see if setregid exists
16426 set setregid d_setregid
16427 eval $inlibc
16428 set setresgid d_setresgid
16429 eval $inlibc
16430
16431 : see if setreuid exists
16432 set setreuid d_setreuid
16433 eval $inlibc
16434 set setresuid d_setresuid
16435 eval $inlibc
16436
16437 : see if setrgid exists
16438 set setrgid d_setrgid
16439 eval $inlibc
16440
16441 : see if setruid exists
16442 set setruid d_setruid
16443 eval $inlibc
16444
16445 : see if setservent exists
16446 set setservent d_setsent
16447 eval $inlibc
16448
16449 : see if setservent_r exists
16450 set setservent_r d_setservent_r
16451 eval $inlibc
16452 case "$d_setservent_r" in
16453 "$define")
16454         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16455         case "$d_setservent_r_proto:$usethreads" in
16456         ":define")      d_setservent_r_proto=define
16457                 set d_setservent_r_proto setservent_r $hdrs
16458                 eval $hasproto ;;
16459         *)      ;;
16460         esac
16461         case "$d_setservent_r_proto" in
16462         define)
16463         case "$setservent_r_proto" in
16464         ''|0) try='int setservent_r(int, struct servent_data*);'
16465         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16466         esac
16467         case "$setservent_r_proto" in
16468         ''|0) try='void setservent_r(int, struct servent_data*);'
16469         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16470         esac
16471         case "$setservent_r_proto" in
16472         ''|0)   d_setservent_r=undef
16473                 setservent_r_proto=0
16474                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16475         * )     case "$setservent_r_proto" in
16476                 REENTRANT_PROTO*) ;;
16477                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16478                 esac
16479                 echo "Prototype: $try" ;;
16480         esac
16481         ;;
16482         *)      case "$usethreads" in
16483                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16484                 esac
16485                 d_setservent_r=undef
16486                 setservent_r_proto=0
16487                 ;;
16488         esac
16489         ;;
16490 *)      setservent_r_proto=0
16491         ;;
16492 esac
16493
16494 : see if setsid exists
16495 set setsid d_setsid
16496 eval $inlibc
16497
16498 : see if setvbuf exists
16499 set setvbuf d_setvbuf
16500 eval $inlibc
16501
16502 : see if sfio.h is available
16503 set sfio.h i_sfio
16504 eval $inhdr
16505
16506
16507 : see if sfio library is available
16508 case "$i_sfio" in
16509 $define)
16510         val=''
16511         set sfreserve val
16512         eval $inlibc
16513         ;;
16514 *)
16515         val="$undef"
16516         ;;
16517 esac
16518 : Ok, but do we want to use it.
16519 case "$val" in
16520 $define)
16521         case "$usesfio" in
16522         true|$define|[yY]*) dflt='y';;
16523         *) dflt='n';;
16524         esac
16525         echo "$package can use the sfio library, but it is experimental."
16526         case "$useperlio" in
16527         "$undef")
16528             echo "For sfio also the PerlIO abstraction layer is needed."
16529             echo "Earlier you said you wouldn't want that."
16530             ;;
16531         esac
16532         rp="You seem to have sfio available, do you want to try using it?"
16533         . ./myread
16534         case "$ans" in
16535         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16536                 useperlio="$define"
16537                 val="$define"
16538                 ;;
16539         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16540                 val="$undef"
16541                 ;;
16542         esac
16543         ;;
16544 *)      case "$usesfio" in
16545         true|$define|[yY]*)
16546                 echo "Sorry, cannot find sfio on this machine." >&4
16547                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16548                 val="$undef"
16549                 ;;
16550         esac
16551         ;;
16552 esac
16553 set d_sfio
16554 eval $setvar
16555 case "$d_sfio" in
16556 $define) usesfio='true';;
16557 *) usesfio='false';;
16558 esac
16559 case "$d_sfio" in
16560 $define) ;;
16561 *)      : Remove sfio from list of libraries to use
16562         case "$libs" in
16563         *-lsfio*)
16564                 echo "Removing unneeded -lsfio from library list" >&4
16565                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16566                 shift
16567                 libs="$*"
16568                 echo "libs = $libs" >&4
16569                 ;;
16570         esac
16571 ;;
16572 esac
16573
16574
16575 : see if shmctl exists
16576 set shmctl d_shmctl
16577 eval $inlibc
16578
16579 : see if shmget exists
16580 set shmget d_shmget
16581 eval $inlibc
16582
16583 : see if shmat exists
16584 set shmat d_shmat
16585 eval $inlibc
16586 : see what shmat returns
16587 case "$d_shmat" in
16588 "$define")
16589         $cat >shmat.c <<'END'
16590 #include <sys/shm.h>
16591 void *shmat();
16592 END
16593         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16594                 shmattype='void *'
16595         else
16596                 shmattype='char *'
16597         fi
16598         echo "and it returns ($shmattype)." >&4
16599         : see if a prototype for shmat is available
16600         xxx=`./findhdr sys/shm.h`
16601         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16602         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16603                 val="$define"
16604         else
16605                 val="$undef"
16606         fi
16607         $rm -f shmat.[co]
16608         ;;
16609 *)
16610         val="$undef"
16611         ;;
16612 esac
16613 set d_shmatprototype
16614 eval $setvar
16615
16616 : see if shmdt exists
16617 set shmdt d_shmdt
16618 eval $inlibc
16619
16620 : see how much of the 'shm*(2)' library is present.
16621 h_shm=true
16622 echo " "
16623 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16624 *"$undef"*) h_shm=false;;
16625 esac
16626 case "$osname" in
16627 freebsd)
16628     case "`ipcs 2>&1`" in
16629     "SVID shared memory"*"not configured"*)
16630         echo "Your $osname does not have the shm*(2) configured." >&4
16631         h_shm=false
16632         val="$undef"
16633         set shmctl d_shmctl
16634         evat $setvar
16635         set shmget d_shmget
16636         evat $setvar
16637         set shmat d_shmat
16638         evat $setvar
16639         set shmdt d_shmdt
16640         evat $setvar
16641         ;;
16642     esac
16643     ;;
16644 esac
16645 : we could also check for sys/ipc.h ...
16646 if $h_shm && $test `./findhdr sys/shm.h`; then
16647         echo "You have the full shm*(2) library." >&4
16648         val="$define"
16649 else
16650         echo "You don't have the full shm*(2) library." >&4
16651         val="$undef"
16652 fi
16653 set d_shm
16654 eval $setvar
16655
16656 echo " "
16657 : see if we have sigaction
16658 if set sigaction val -f d_sigaction; eval $csym; $val; then
16659         echo 'sigaction() found.' >&4
16660         $cat > try.c <<EOP
16661 #include <stdio.h>
16662 #include <sys/types.h>
16663 #include <signal.h>
16664 #$i_stdlib I_STDLIB
16665 #ifdef I_STDLIB
16666 #include <stdlib.h>
16667 #endif
16668 int main()
16669 {
16670     struct sigaction act, oact;
16671     act.sa_flags = 0;
16672     oact.sa_handler = 0;
16673     /* so that act and oact are used */
16674     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16675 }
16676 EOP
16677         set try
16678         if eval $compile_ok; then
16679                 val="$define"
16680         else
16681                 echo "But you don't seem to have a useable struct sigaction." >&4
16682                 val="$undef"
16683         fi
16684 else
16685         echo 'sigaction NOT found.' >&4
16686         val="$undef"
16687 fi
16688 set d_sigaction; eval $setvar
16689 $rm -f try try$_o try.c
16690
16691 : see if sigprocmask exists
16692 set sigprocmask d_sigprocmask
16693 eval $inlibc
16694
16695 : see if sigsetjmp exists
16696 echo " "
16697 case "$d_sigsetjmp" in
16698 '')
16699         $cat >try.c <<EOP
16700 #include <setjmp.h>
16701 #$i_stdlib I_STDLIB
16702 #ifdef I_STDLIB
16703 #include <stdlib.h>
16704 #endif
16705 sigjmp_buf env;
16706 int set = 1;
16707 int main()
16708 {
16709         if (sigsetjmp(env,1))
16710                 exit(set);
16711         set = 0;
16712         siglongjmp(env, 1);
16713         exit(1);
16714 }
16715 EOP
16716         set try
16717         if eval $compile; then
16718                 if $run ./try >/dev/null 2>&1; then
16719                         echo "POSIX sigsetjmp found." >&4
16720                         val="$define"
16721                 else
16722                         $cat >&4 <<EOM
16723 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16724 I'll ignore them.
16725 EOM
16726                         val="$undef"
16727                 fi
16728         else
16729                 echo "sigsetjmp not found." >&4
16730                 val="$undef"
16731         fi
16732         ;;
16733 *) val="$d_sigsetjmp"
16734         case "$d_sigsetjmp" in
16735         $define) echo "POSIX sigsetjmp found." >&4;;
16736         $undef) echo "sigsetjmp not found." >&4;;
16737         esac
16738         ;;
16739 esac
16740 set d_sigsetjmp
16741 eval $setvar
16742 $rm -f try.c try
16743
16744 : see if snprintf exists
16745 set snprintf d_snprintf
16746 eval $inlibc
16747
16748 : see if vsnprintf exists
16749 set vsnprintf d_vsnprintf
16750 eval $inlibc
16751
16752 case "$d_snprintf-$d_vsnprintf" in
16753 "$define-$define")
16754     $cat <<EOM
16755 Checking whether your snprintf() and vsnprintf() work okay...
16756 EOM
16757     $cat >try.c <<'EOCP'
16758 /* v?snprintf testing logic courtesy of Russ Allbery.
16759  * According to C99:
16760  * - if the buffer is too short it still must be \0-terminated
16761  * - if the buffer is too short the potentially required length
16762  *   must be returned and not -1
16763  * - if the buffer is NULL the potentially required length
16764  *   must be returned and not -1 or core dump
16765  */
16766 #include <stdio.h>
16767 #include <stdarg.h>
16768
16769 char buf[2];
16770
16771 int test (char *format, ...)
16772 {
16773     va_list args;
16774     int count;
16775
16776     va_start (args, format);
16777     count = vsnprintf (buf, sizeof buf, format, args);
16778     va_end (args);
16779     return count;
16780 }
16781
16782 int main ()
16783 {
16784     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16785              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16786 }
16787 EOCP
16788     set try
16789     if eval $compile; then
16790         `$run ./try`
16791         case "$?" in
16792         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16793         *) cat <<EOM >&4
16794 Your snprintf() and snprintf() don't seem to be working okay.
16795 EOM
16796            d_snprintf="$undef"
16797            d_vsnprintf="$undef"
16798            ;;
16799         esac
16800     else
16801         echo "(I can't seem to compile the test program--assuming they don't)"
16802         d_snprintf="$undef"
16803         d_vsnprintf="$undef"
16804     fi
16805     $rm -f try.* try core core.try.*
16806     ;;
16807 esac
16808
16809 : see if sockatmark exists
16810 set sockatmark d_sockatmark
16811 eval $inlibc
16812
16813 : see if prototype for sockatmark is available
16814 echo " "
16815 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16816 eval $hasproto
16817
16818 : see if socks5_init exists
16819 set socks5_init d_socks5_init
16820 eval $inlibc
16821
16822 : see if sprintf returns the length of the string in the buffer as per ANSI
16823 $echo "Checking whether sprintf returns the length of the string..." >&4
16824 $cat <<EOP >try.c
16825 #include <stdio.h>
16826 #$i_stdlib I_STDLIB
16827 #ifdef I_STDLIB
16828 #include <stdlib.h>
16829 #endif
16830 #$i_string I_STRING
16831 #ifdef I_STRING
16832 #  include <string.h>
16833 #else
16834 #  include <strings.h>
16835 #endif
16836 #$i_math I_MATH
16837 #ifdef I_MATH
16838 #include <math.h>
16839 #endif
16840
16841 char buffer[256];
16842
16843 int check (size_t expect, int test) {
16844   size_t got = strlen(buffer);
16845   if (expect == got)
16846     return 0;
16847
16848   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16849        test, buffer);
16850   exit (test);
16851 }
16852
16853 int main(int argc, char **argv) {
16854   int test = 0;
16855
16856   check(sprintf(buffer, ""), ++test);
16857   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16858   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16859
16860   return 0;
16861 }
16862 EOP
16863 set try
16864
16865 d_sprintf_returns_strlen="$undef"
16866 if eval $compile; then
16867     xxx="`$run ./try`"
16868     case "$?" in
16869         0) cat >&4 <<EOM
16870 sprintf returns the length of the string (as ANSI says it should)
16871 EOM
16872         d_sprintf_returns_strlen="$define"
16873         ;;
16874         *) cat >&4 <<EOM
16875 sprintf does not return the length of the string (how old is this system?)
16876 EOM
16877         d_sprintf_returns_strlen="$undef"
16878         ;;
16879     esac
16880 fi
16881
16882 $rm -f try.* try
16883
16884 : see if srand48_r exists
16885 set srand48_r d_srand48_r
16886 eval $inlibc
16887 case "$d_srand48_r" in
16888 "$define")
16889         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16890         case "$d_srand48_r_proto:$usethreads" in
16891         ":define")      d_srand48_r_proto=define
16892                 set d_srand48_r_proto srand48_r $hdrs
16893                 eval $hasproto ;;
16894         *)      ;;
16895         esac
16896         case "$d_srand48_r_proto" in
16897         define)
16898         case "$srand48_r_proto" in
16899         ''|0) try='int srand48_r(long, struct drand48_data*);'
16900         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16901         esac
16902         case "$srand48_r_proto" in
16903         ''|0)   d_srand48_r=undef
16904                 srand48_r_proto=0
16905                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16906         * )     case "$srand48_r_proto" in
16907                 REENTRANT_PROTO*) ;;
16908                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16909                 esac
16910                 echo "Prototype: $try" ;;
16911         esac
16912         ;;
16913         *)      case "$usethreads" in
16914                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16915                 esac
16916                 d_srand48_r=undef
16917                 srand48_r_proto=0
16918                 ;;
16919         esac
16920         ;;
16921 *)      srand48_r_proto=0
16922         ;;
16923 esac
16924
16925 : see if srandom_r exists
16926 set srandom_r d_srandom_r
16927 eval $inlibc
16928 case "$d_srandom_r" in
16929 "$define")
16930         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16931         case "$d_srandom_r_proto:$usethreads" in
16932         ":define")      d_srandom_r_proto=define
16933                 set d_srandom_r_proto srandom_r $hdrs
16934                 eval $hasproto ;;
16935         *)      ;;
16936         esac
16937         case "$d_srandom_r_proto" in
16938         define)
16939         case "$srandom_r_proto" in
16940         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16941         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16942         esac
16943         case "$srandom_r_proto" in
16944         ''|0)   d_srandom_r=undef
16945                 srandom_r_proto=0
16946                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16947         * )     case "$srandom_r_proto" in
16948                 REENTRANT_PROTO*) ;;
16949                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16950                 esac
16951                 echo "Prototype: $try" ;;
16952         esac
16953         ;;
16954         *)      case "$usethreads" in
16955                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16956                 esac
16957                 d_srandom_r=undef
16958                 srandom_r_proto=0
16959                 ;;
16960         esac
16961         ;;
16962 *)      srandom_r_proto=0
16963         ;;
16964 esac
16965
16966 : see if prototype for setresgid is available
16967 echo " "
16968 set d_sresgproto setresgid $i_unistd unistd.h
16969 eval $hasproto
16970
16971 : see if prototype for setresuid is available
16972 echo " "
16973 set d_sresuproto setresuid $i_unistd unistd.h
16974 eval $hasproto
16975
16976 : see if sys/stat.h is available
16977 set sys/stat.h i_sysstat
16978 eval $inhdr
16979
16980
16981 : see if stat knows about block sizes
16982 echo " "
16983 echo "Checking to see if your struct stat has st_blocks field..." >&4
16984 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16985 eval $hasfield
16986
16987
16988 : see if this is a sys/vfs.h system
16989 set sys/vfs.h i_sysvfs
16990 eval $inhdr
16991
16992
16993 : see if this is a sys/statfs.h system
16994 set sys/statfs.h i_sysstatfs
16995 eval $inhdr
16996
16997
16998 echo " "
16999 echo "Checking to see if your system supports struct statfs..." >&4
17000 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
17001 eval $hasstruct
17002 case "$d_statfs_s" in
17003 "$define")      echo "Yes, it does."   ;;
17004 *)              echo "No, it doesn't." ;;
17005 esac
17006
17007
17008
17009 : see if struct statfs knows about f_flags
17010 case "$d_statfs_s" in
17011 define) 
17012         echo " "
17013         echo "Checking to see if your struct statfs has f_flags field..." >&4
17014         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
17015         eval $hasfield
17016         ;;
17017 *)      val="$undef"
17018         set d_statfs_f_flags
17019         eval $setvar
17020         ;;
17021 esac
17022 case "$d_statfs_f_flags" in
17023 "$define")      echo "Yes, it does."   ;;
17024 *)              echo "No, it doesn't." ;;
17025 esac
17026
17027 $cat >&4 <<EOM
17028 Checking how to access stdio streams by file descriptor number...
17029 EOM
17030 case "$stdio_stream_array" in
17031 '')     $cat >try.c <<EOCP
17032 #include <stdio.h>
17033 int main() {
17034   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17035     printf("yes\n");
17036 }
17037 EOCP
17038         for s in _iob __iob __sF
17039         do
17040                 set try -DSTDIO_STREAM_ARRAY=$s
17041                 if eval $compile; then
17042                         case "`$run ./try`" in
17043                         yes)    stdio_stream_array=$s; break ;;
17044                         esac
17045                 fi
17046         done
17047         $rm -f try.* try$exe_ext
17048 esac
17049 case "$stdio_stream_array" in
17050 '')     $cat >&4 <<EOM
17051 I can't figure out how to access stdio streams by file descriptor number.
17052 EOM
17053         d_stdio_stream_array="$undef"
17054         ;;
17055 *)      $cat >&4 <<EOM
17056 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17057 EOM
17058         d_stdio_stream_array="$define"
17059         ;;
17060 esac
17061
17062 : see if strcoll exists
17063 set strcoll d_strcoll
17064 eval $inlibc
17065
17066 : check for structure copying
17067 echo " "
17068 echo "Checking to see if your C compiler can copy structs..." >&4
17069 $cat >try.c <<'EOCP'
17070 int main()
17071 {
17072         struct blurfl {
17073                 int dyick;
17074         } foo, bar;
17075
17076         foo = bar;
17077 }
17078 EOCP
17079 if $cc -c try.c >/dev/null 2>&1 ; then
17080         val="$define"
17081         echo "Yup, it can."
17082 else
17083         val="$undef"
17084         echo "Nope, it can't."
17085 fi
17086 set d_strctcpy
17087 eval $setvar
17088 $rm -f try.*
17089
17090 : see if strerror and/or sys_errlist[] exist
17091 echo " "
17092 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17093     if set strerror val -f d_strerror; eval $csym; $val; then
17094                 echo 'strerror() found.' >&4
17095                 d_strerror="$define"
17096                 d_strerrm='strerror(e)'
17097                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17098                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17099                         d_syserrlst="$define"
17100                 else
17101                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17102                         d_syserrlst="$undef"
17103                 fi
17104     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17105                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17106                 echo 'strerror() found in string header.' >&4
17107                 d_strerror="$define"
17108                 d_strerrm='strerror(e)'
17109                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17110                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17111                                 d_syserrlst="$define"
17112                 else
17113                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17114                         d_syserrlst="$undef"
17115                 fi
17116     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17117                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17118                 d_strerror="$undef"
17119                 d_syserrlst="$define"
17120                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17121     else
17122                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17123                 d_strerror="$undef"
17124                 d_syserrlst="$undef"
17125                 d_strerrm='"unknown"'
17126     fi
17127 fi
17128
17129 : see if strerror_r exists
17130 set strerror_r d_strerror_r
17131 eval $inlibc
17132 case "$d_strerror_r" in
17133 "$define")
17134         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17135         case "$d_strerror_r_proto:$usethreads" in
17136         ":define")      d_strerror_r_proto=define
17137                 set d_strerror_r_proto strerror_r $hdrs
17138                 eval $hasproto ;;
17139         *)      ;;
17140         esac
17141         case "$d_strerror_r_proto" in
17142         define)
17143         case "$strerror_r_proto" in
17144         ''|0) try='int strerror_r(int, char*, size_t);'
17145         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17146         esac
17147         case "$strerror_r_proto" in
17148         ''|0) try='int strerror_r(int, char*, int);'
17149         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17150         esac
17151         case "$strerror_r_proto" in
17152         ''|0) try='char* strerror_r(int, char*, size_t);'
17153         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17154         esac
17155         case "$strerror_r_proto" in
17156         ''|0)   d_strerror_r=undef
17157                 strerror_r_proto=0
17158                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17159         * )     case "$strerror_r_proto" in
17160                 REENTRANT_PROTO*) ;;
17161                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17162                 esac
17163                 echo "Prototype: $try" ;;
17164         esac
17165         ;;
17166         *)      case "$usethreads" in
17167                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17168                 esac
17169                 d_strerror_r=undef
17170                 strerror_r_proto=0
17171                 ;;
17172         esac
17173         ;;
17174 *)      strerror_r_proto=0
17175         ;;
17176 esac
17177
17178 : see if strftime exists
17179 set strftime d_strftime
17180 eval $inlibc
17181
17182 : see if strlcat exists
17183 set strlcat d_strlcat
17184 eval $inlibc
17185
17186 : see if strlcpy exists
17187 set strlcpy d_strlcpy
17188 eval $inlibc
17189
17190 : see if strtod exists
17191 set strtod d_strtod
17192 eval $inlibc
17193
17194 : see if strtol exists
17195 set strtol d_strtol
17196 eval $inlibc
17197
17198 : see if strtold exists
17199 set strtold d_strtold
17200 eval $inlibc
17201
17202 : see if strtoll exists
17203 set strtoll d_strtoll
17204 eval $inlibc
17205
17206 case "$d_longlong-$d_strtoll" in
17207 "$define-$define")
17208         $cat <<EOM
17209 Checking whether your strtoll() works okay...
17210 EOM
17211         $cat >try.c <<'EOCP'
17212 #include <errno.h>
17213 #ifdef __hpux
17214 #define strtoll __strtoll
17215 #endif
17216 #ifdef __EMX__
17217 #define strtoll _strtoll
17218 #endif
17219 #include <stdio.h>
17220 extern long long int strtoll(char *s, char **, int); 
17221 static int bad = 0;
17222 int check(char *s, long long ell, int een) {
17223         long long gll;
17224         errno = 0;
17225         gll = strtoll(s, 0, 10);
17226         if (!((gll == ell) && (errno == een)))
17227                 bad++;
17228 }
17229 int main() {
17230         check(" 1",                                      1LL, 0);
17231         check(" 0",                                      0LL, 0);
17232         check("-1",                                     -1LL, 0);
17233         check("-9223372036854775808", -9223372036854775808LL, 0);
17234         check("-9223372036854775808", -9223372036854775808LL, 0);
17235         check(" 9223372036854775807",  9223372036854775807LL, 0);
17236         check("-9223372036854775808", -9223372036854775808LL, 0);
17237         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17238         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17239         if (!bad)
17240                 printf("ok\n");
17241 }
17242 EOCP
17243         set try
17244         if eval $compile; then
17245                 yyy=`$run ./try`
17246                 case "$yyy" in
17247                 ok) echo "Your strtoll() seems to be working okay." ;;
17248                 *) cat <<EOM >&4
17249 Your strtoll() doesn't seem to be working okay.
17250 EOM
17251                    d_strtoll="$undef"
17252                    ;;
17253                 esac
17254         else
17255                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17256                 d_strtoll="$undef"
17257         fi
17258         ;;
17259 esac
17260
17261 : see if strtoq exists
17262 set strtoq d_strtoq
17263 eval $inlibc
17264
17265 : see if strtoul exists
17266 set strtoul d_strtoul
17267 eval $inlibc
17268
17269 case "$d_strtoul" in
17270 "$define")
17271         $cat <<EOM
17272 Checking whether your strtoul() works okay...
17273 EOM
17274         $cat >try.c <<'EOCP'
17275 #include <errno.h>
17276 #include <stdio.h>
17277 extern unsigned long int strtoul(char *s, char **, int); 
17278 static int bad = 0;
17279 void check(char *s, unsigned long eul, int een) {
17280         unsigned long gul;
17281         errno = 0;
17282         gul = strtoul(s, 0, 10);
17283         if (!((gul == eul) && (errno == een)))
17284                 bad++;
17285 }
17286 int main() {
17287         check(" 1", 1L, 0);
17288         check(" 0", 0L, 0);
17289 EOCP
17290         case "$longsize" in
17291         8)
17292             $cat >>try.c <<'EOCP'
17293         check("18446744073709551615", 18446744073709551615UL, 0);
17294         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17295 #if 0 /* strtoul() for /^-/ strings is undefined. */
17296         check("-1", 18446744073709551615UL, 0);
17297         check("-18446744073709551614", 2, 0);
17298         check("-18446744073709551615", 1, 0);
17299         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17300         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17301 #endif
17302 EOCP
17303                 ;;
17304         4)
17305                     $cat >>try.c <<'EOCP'
17306         check("4294967295", 4294967295UL, 0);
17307         check("4294967296", 4294967295UL, ERANGE);
17308 #if 0 /* strtoul() for /^-/ strings is undefined. */
17309         check("-1", 4294967295UL, 0);
17310         check("-4294967294", 2, 0);
17311         check("-4294967295", 1, 0);
17312         check("-4294967296", 4294967295UL, ERANGE);
17313         check("-4294967297", 4294967295UL, ERANGE);
17314 #endif
17315 EOCP
17316                 ;;
17317         *)
17318 : Should we write these tests to be more portable by sprintf-ing
17319 : ~0 and then manipulating that char string as input for strtol?
17320                 ;;
17321         esac
17322         $cat >>try.c <<'EOCP'
17323         if (!bad)
17324                 printf("ok\n");
17325         return 0;
17326 }
17327 EOCP
17328         set try
17329         if eval $compile; then
17330                 case "`$run ./try`" in
17331                 ok) echo "Your strtoul() seems to be working okay." ;;
17332                 *) cat <<EOM >&4
17333 Your strtoul() doesn't seem to be working okay.
17334 EOM
17335                    d_strtoul="$undef"
17336                    ;;
17337                 esac
17338         fi
17339         ;;
17340 esac
17341
17342 : see if strtoull exists
17343 set strtoull d_strtoull
17344 eval $inlibc
17345
17346 case "$d_longlong-$d_strtoull" in
17347 "$define-$define")
17348         $cat <<EOM
17349 Checking whether your strtoull() works okay...
17350 EOM
17351         $cat >try.c <<'EOCP'
17352 #include <errno.h>
17353 #ifdef __hpux
17354 #define strtoull __strtoull
17355 #endif
17356 #include <stdio.h>
17357 extern unsigned long long int strtoull(char *s, char **, int); 
17358 static int bad = 0;
17359 int check(char *s, long long eull, int een) {
17360         long long gull;
17361         errno = 0;
17362         gull = strtoull(s, 0, 10);
17363         if (!((gull == eull) && (errno == een)))
17364                 bad++;
17365 }
17366 int main() {
17367         check(" 1",                                        1LL, 0);
17368         check(" 0",                                        0LL, 0);
17369         check("18446744073709551615",  18446744073709551615ULL, 0);
17370         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17371 #if 0 /* strtoull() for /^-/ strings is undefined. */
17372         check("-1",                    18446744073709551615ULL, 0);
17373         check("-18446744073709551614",                     2LL, 0);
17374         check("-18446744073709551615",                     1LL, 0);
17375         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17376         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17377 #endif
17378         if (!bad)
17379                 printf("ok\n");
17380 }
17381 EOCP
17382         set try
17383         if eval $compile; then
17384                 case "`$run ./try`" in
17385                 ok) echo "Your strtoull() seems to be working okay." ;;
17386                 *) cat <<EOM >&4
17387 Your strtoull() doesn't seem to be working okay.
17388 EOM
17389                    d_strtoull="$undef"
17390                    ;;
17391                 esac
17392         fi
17393         ;;
17394 esac
17395
17396 : see if strtouq exists
17397 set strtouq d_strtouq
17398 eval $inlibc
17399
17400 case "$d_strtouq" in
17401 "$define")
17402         $cat <<EOM
17403 Checking whether your strtouq() works okay...
17404 EOM
17405         $cat >try.c <<'EOCP'
17406 #include <errno.h>
17407 #include <stdio.h>
17408 extern unsigned long long int strtouq(char *s, char **, int); 
17409 static int bad = 0;
17410 void check(char *s, unsigned long long eull, int een) {
17411         unsigned long long gull;
17412         errno = 0;
17413         gull = strtouq(s, 0, 10);
17414         if (!((gull == eull) && (errno == een)))
17415                 bad++;
17416 }
17417 int main() {
17418         check(" 1",                                        1LL, 0);
17419         check(" 0",                                        0LL, 0);
17420         check("18446744073709551615",  18446744073709551615ULL, 0);
17421         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17422 #if 0 /* strtouq() for /^-/ strings is undefined. */
17423         check("-1",                    18446744073709551615ULL, 0);
17424         check("-18446744073709551614",                     2LL, 0);
17425         check("-18446744073709551615",                     1LL, 0);
17426         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17427         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17428 #endif
17429         if (!bad)
17430                 printf("ok\n");
17431         return 0;
17432 }
17433 EOCP
17434         set try
17435         if eval $compile; then
17436                 case "`$run ./try`" in
17437                 ok) echo "Your strtouq() seems to be working okay." ;;
17438                 *) cat <<EOM >&4
17439 Your strtouq() doesn't seem to be working okay.
17440 EOM
17441                    d_strtouq="$undef"
17442                    ;;
17443                 esac
17444         fi
17445         ;;
17446 esac
17447
17448 : see if strxfrm exists
17449 set strxfrm d_strxfrm
17450 eval $inlibc
17451
17452 : see if symlink exists
17453 set symlink d_symlink
17454 eval $inlibc
17455
17456 : see if syscall exists
17457 set syscall d_syscall
17458 eval $inlibc
17459
17460 : see if prototype for syscall is available
17461 echo " "
17462 set d_syscallproto syscall $i_unistd unistd.h
17463 eval $hasproto
17464
17465 : see if sysconf exists
17466 set sysconf d_sysconf
17467 eval $inlibc
17468
17469 : see if system exists
17470 set system d_system
17471 eval $inlibc
17472
17473 : see if tcgetpgrp exists
17474 set tcgetpgrp d_tcgetpgrp
17475 eval $inlibc
17476
17477 : see if tcsetpgrp exists
17478 set tcsetpgrp d_tcsetpgrp
17479 eval $inlibc
17480
17481 : see if prototype for telldir is available
17482 echo " "
17483 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17484 eval $hasproto
17485
17486 : see if time exists
17487 echo " "
17488 if test "X$d_time" = X -o X"$timetype" = X; then
17489     if set time val -f d_time; eval $csym; $val; then
17490                 echo 'time() found.' >&4
17491                 val="$define"
17492                 rp="What is the type returned by time() on this system?"
17493                 set time_t timetype long stdio.h sys/types.h
17494                 eval $typedef_ask
17495     else
17496                 echo 'time() not found, hope that will do.' >&4
17497                 val="$undef"
17498                 timetype='int';
17499     fi
17500     set d_time
17501     eval $setvar
17502 fi
17503
17504 : see if this is a sys/times.h system
17505 set sys/times.h i_systimes
17506 eval $inhdr
17507
17508 : see if times exists
17509 echo " "
17510 if set times val -f d_times; eval $csym; $val; then
17511         echo 'times() found.' >&4
17512         d_times="$define"
17513         inc=''
17514         case "$i_systimes" in
17515         "$define") inc='sys/times.h';;
17516         esac
17517         rp="What is the type returned by times() on this system?"
17518         set clock_t clocktype long stdio.h sys/types.h $inc
17519         eval $typedef_ask
17520 else
17521         echo 'times() NOT found, hope that will do.' >&4
17522         d_times="$undef"
17523         clocktype='int'
17524 fi
17525
17526 : see if tmpnam_r exists
17527 set tmpnam_r d_tmpnam_r
17528 eval $inlibc
17529 case "$d_tmpnam_r" in
17530 "$define")
17531         hdrs="$i_systypes sys/types.h define stdio.h "
17532         case "$d_tmpnam_r_proto:$usethreads" in
17533         ":define")      d_tmpnam_r_proto=define
17534                 set d_tmpnam_r_proto tmpnam_r $hdrs
17535                 eval $hasproto ;;
17536         *)      ;;
17537         esac
17538         case "$d_tmpnam_r_proto" in
17539         define)
17540         case "$tmpnam_r_proto" in
17541         ''|0) try='char* tmpnam_r(char*);'
17542         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17543         esac
17544         case "$tmpnam_r_proto" in
17545         ''|0)   d_tmpnam_r=undef
17546                 tmpnam_r_proto=0
17547                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17548         * )     case "$tmpnam_r_proto" in
17549                 REENTRANT_PROTO*) ;;
17550                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17551                 esac
17552                 echo "Prototype: $try" ;;
17553         esac
17554         ;;
17555         *)      case "$usethreads" in
17556                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17557                 esac
17558                 d_tmpnam_r=undef
17559                 tmpnam_r_proto=0
17560                 ;;
17561         esac
17562         ;;
17563 *)      tmpnam_r_proto=0
17564         ;;
17565 esac
17566
17567 : see if truncate exists
17568 set truncate d_truncate
17569 eval $inlibc
17570
17571 : see if ttyname_r exists
17572 set ttyname_r d_ttyname_r
17573 eval $inlibc
17574 case "$d_ttyname_r" in
17575 "$define")
17576         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17577         case "$d_ttyname_r_proto:$usethreads" in
17578         ":define")      d_ttyname_r_proto=define
17579                 set d_ttyname_r_proto ttyname_r $hdrs
17580                 eval $hasproto ;;
17581         *)      ;;
17582         esac
17583         case "$d_ttyname_r_proto" in
17584         define)
17585         case "$ttyname_r_proto" in
17586         ''|0) try='int ttyname_r(int, char*, size_t);'
17587         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17588         esac
17589         case "$ttyname_r_proto" in
17590         ''|0) try='int ttyname_r(int, char*, int);'
17591         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17592         esac
17593         case "$ttyname_r_proto" in
17594         ''|0) try='char* ttyname_r(int, char*, int);'
17595         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17596         esac
17597         case "$ttyname_r_proto" in
17598         ''|0)   d_ttyname_r=undef
17599                 ttyname_r_proto=0
17600                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17601         * )     case "$ttyname_r_proto" in
17602                 REENTRANT_PROTO*) ;;
17603                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17604                 esac
17605                 echo "Prototype: $try" ;;
17606         esac
17607         ;;
17608         *)      case "$usethreads" in
17609                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17610                 esac
17611                 d_ttyname_r=undef
17612                 ttyname_r_proto=0
17613                 ;;
17614         esac
17615         ;;
17616 *)      ttyname_r_proto=0
17617         ;;
17618 esac
17619
17620 : see if tzname[] exists
17621 echo " "
17622 if set tzname val -a d_tzname; eval $csym; $val; then
17623         val="$define"
17624         echo 'tzname[] found.' >&4
17625 else
17626         val="$undef"
17627         echo 'tzname[] NOT found.' >&4
17628 fi
17629 set d_tzname
17630 eval $setvar
17631
17632 case "$osname" in
17633 next|rhapsody|darwin) multiarch="$define" ;;
17634 esac
17635 case "$multiarch" in
17636 ''|[nN]*) multiarch="$undef" ;;
17637 esac
17638
17639 : check for ordering of bytes in a UV
17640 echo " "
17641 case "$usecrosscompile$multiarch" in
17642 *$define*)
17643         $cat <<EOM
17644 You seem to be either cross-compiling or doing a multiarchitecture build,
17645 skipping the byteorder check.
17646
17647 EOM
17648         byteorder='ffff'
17649         ;;
17650 *)
17651         case "$byteorder" in
17652         '')
17653                 $cat <<'EOM'
17654 In the following, larger digits indicate more significance.  A big-endian
17655 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17656 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17657 machines may have weird orders like 3412.  A Cray will report 87654321,
17658 an Alpha will report 12345678. If the test program works the default is
17659 probably right.
17660 I'm now running the test program...
17661 EOM
17662                 $cat >try.c <<EOCP
17663 #include <stdio.h>
17664 #$i_stdlib I_STDLIB
17665 #ifdef I_STDLIB
17666 #include <stdlib.h>
17667 #endif
17668 #include <sys/types.h>
17669 typedef $uvtype UV;
17670 int main()
17671 {
17672         int i;
17673         union {
17674                 UV l;
17675                 char c[$uvsize];
17676         } u;
17677
17678         if ($uvsize > 4)
17679                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17680         else
17681                 u.l = (UV)0x04030201;
17682         for (i = 0; i < $uvsize; i++)
17683                 printf("%c", u.c[i]+'0');
17684         printf("\n");
17685         exit(0);
17686 }
17687 EOCP
17688                 xxx_prompt=y
17689                 set try
17690                 if eval $compile && ./try > /dev/null; then
17691                         dflt=`$run ./try`
17692                         case "$dflt" in
17693                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17694                                 echo "(The test program ran ok.)"
17695                                 echo "byteorder=$dflt"
17696                                 xxx_prompt=n
17697                         ;;
17698                         ????|????????) echo "(The test program ran ok.)" ;;
17699                         *) echo "(The test program didn't run right for some reason.)" ;;
17700                         esac
17701                 else
17702                         dflt='4321'
17703                         cat <<'EOM'
17704 (I can't seem to compile the test program.  Guessing big-endian...)
17705 EOM
17706                 fi
17707                 case "$xxx_prompt" in
17708                 y)
17709                         rp="What is the order of bytes in $uvtype?"
17710                         . ./myread
17711                         byteorder="$ans"
17712                         ;;
17713                 *)      byteorder=$dflt
17714                         ;;
17715                 esac
17716                 ;;
17717         esac
17718         $rm -f try.c try
17719         ;;
17720 esac
17721
17722
17723 $cat <<EOM
17724
17725 Checking to see whether you can access character data unalignedly...
17726 EOM
17727 case "$d_u32align" in
17728 '')   $cat >try.c <<EOCP
17729 #include <stdio.h>
17730 #$i_stdlib I_STDLIB
17731 #ifdef I_STDLIB
17732 #include <stdlib.h>
17733 #endif
17734 #define U32 $u32type
17735 #define BYTEORDER 0x$byteorder
17736 #define U8 $u8type
17737 #include <signal.h>
17738 #ifdef SIGBUS
17739 $signal_t bletch(s) int s; { exit(4); }
17740 #endif
17741 int main() {
17742 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17743     U8 buf[8];
17744     U32 *up;
17745     int i;
17746
17747     if (sizeof(U32) != 4) {
17748         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17749         exit(1);
17750     }
17751
17752     fflush(stdout);
17753
17754 #ifdef SIGBUS
17755     signal(SIGBUS, bletch);
17756 #endif
17757
17758     buf[0] = 0;
17759     buf[1] = 0;
17760     buf[2] = 0;
17761     buf[3] = 1;
17762     buf[4] = 0;
17763     buf[5] = 0;
17764     buf[6] = 0;
17765     buf[7] = 1;
17766
17767     for (i = 0; i < 4; i++) {
17768         up = (U32*)(buf + i);
17769         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17770                (*up == 1 << (8*(3-i)))  /* little-endian */
17771               )
17772            )
17773         {
17774             printf("read failed (%x)\n", *up);
17775             exit(2);
17776         }
17777     }
17778
17779     /* write test */
17780     for (i = 0; i < 4; i++) {
17781         up = (U32*)(buf + i);
17782         *up = 0xBeef;
17783         if (*up != 0xBeef) {
17784             printf("write failed (%x)\n", *up);
17785             exit(3);
17786         }
17787     }
17788
17789     exit(0);
17790 #else
17791     printf("1\n");
17792     exit(1);
17793 #endif
17794     return 0;
17795 }
17796 EOCP
17797 set try
17798 if eval $compile_ok; then
17799         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17800         $run ./try 2>&1 >/dev/null
17801         case "$?" in
17802         0)      cat >&4 <<EOM
17803 You can access character data pretty unalignedly.
17804 EOM
17805                 d_u32align="$undef"
17806                 ;;
17807         *)      cat >&4 <<EOM
17808 It seems that you must access character data in an aligned manner.
17809 EOM
17810                 d_u32align="$define"
17811                 ;;
17812         esac
17813 else
17814         rp='Can you access character data at unaligned addresses?'
17815         dflt='n'
17816         . ./myread
17817         case "$ans" in
17818         [yY]*)  d_u32align="$undef"  ;;
17819         *)      d_u32align="$define" ;;
17820         esac
17821 fi
17822 $rm -f core core.try.* try.core
17823 ;;
17824 esac
17825
17826 : see if ualarm exists
17827 set ualarm d_ualarm
17828 eval $inlibc
17829
17830 : see if umask exists
17831 set umask d_umask
17832 eval $inlibc
17833
17834 : see if unordered exists
17835 set unordered d_unordered
17836 eval $inlibc
17837
17838 : see if unsetenv exists
17839 set unsetenv d_unsetenv
17840 eval $inlibc
17841
17842 : see if usleep exists
17843 set usleep d_usleep
17844 eval $inlibc
17845
17846 : see if prototype for usleep is available
17847 echo " "
17848 set d_usleepproto usleep $i_unistd unistd.h
17849 eval $hasproto
17850
17851 : see if ustat exists
17852 set ustat d_ustat
17853 eval $inlibc
17854
17855 : backward compatibility for d_hvfork
17856 if test X$d_hvfork != X; then
17857         d_vfork="$d_hvfork"
17858         d_hvfork=''
17859 fi
17860 : see if there is a vfork
17861 val=''
17862 set vfork val
17863 eval $inlibc
17864
17865 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17866 : perl on Solaris 2.x, and probably elsewhere.
17867 case "$val" in
17868 $define)
17869         echo " "
17870         case "$usevfork" in
17871         false) dflt='n';;
17872         *) dflt='y';;
17873         esac
17874         cat <<'EOM'
17875  
17876 Perl can only use a vfork() that doesn't suffer from strict
17877 restrictions on calling functions or modifying global data in
17878 the child.  For example, glibc-2.1 contains such a vfork()
17879 that is unsuitable.  If your system provides a proper fork()
17880 call, chances are that you do NOT want perl to use vfork().
17881
17882 EOM
17883         rp="Do you still want to use vfork()?"
17884         . ./myread
17885         case "$ans" in
17886         y|Y) ;;
17887         *)
17888                 echo "Ok, we won't use vfork()."
17889                 val="$undef"
17890                 ;;
17891         esac
17892         ;;
17893 esac
17894 set d_vfork
17895 eval $setvar
17896 case "$d_vfork" in
17897 $define) usevfork='true';;
17898 *) usevfork='false';;
17899 esac
17900
17901 : see if closedir exists
17902 set closedir d_closedir
17903 eval $inlibc
17904
17905 case "$d_closedir" in
17906 "$define")
17907         echo " "
17908         echo "Checking whether closedir() returns a status..." >&4
17909         cat > try.c <<EOM
17910 #$i_dirent I_DIRENT             /**/
17911 #$i_sysdir I_SYS_DIR            /**/
17912 #$i_sysndir I_SYS_NDIR          /**/
17913 #$i_systypes I_SYS_TYPES        /**/
17914
17915 #if defined(I_SYS_TYPES)
17916 #include <sys/types.h>
17917 #endif
17918 #if defined(I_DIRENT)
17919 #include <dirent.h>
17920 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17921 #include <sys/dir.h>
17922 #endif
17923 #else
17924 #ifdef I_SYS_NDIR
17925 #include <sys/ndir.h>
17926 #else
17927 #ifdef I_SYS_DIR
17928 #ifdef hp9000s500
17929 #include <ndir.h>       /* may be wrong in the future */
17930 #else
17931 #include <sys/dir.h>
17932 #endif
17933 #endif
17934 #endif
17935 #endif 
17936 int main() { return closedir(opendir(".")); }
17937 EOM
17938         set try
17939         if eval $compile_ok; then
17940                 if $run ./try > /dev/null 2>&1 ; then
17941                         echo "Yes, it does."
17942                         val="$undef"
17943                 else
17944                         echo "No, it doesn't."
17945                         val="$define"
17946                 fi
17947         else
17948                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17949                 val="$define"
17950         fi
17951         ;;
17952 *)
17953         val="$undef";
17954         ;;
17955 esac
17956 set d_void_closedir
17957 eval $setvar
17958 $rm -f try try.*
17959 : see if there is a wait4
17960 set wait4 d_wait4
17961 eval $inlibc
17962
17963 : see if waitpid exists
17964 set waitpid d_waitpid
17965 eval $inlibc
17966
17967 : see if wcstombs exists
17968 set wcstombs d_wcstombs
17969 eval $inlibc
17970
17971 : see if wctomb exists
17972 set wctomb d_wctomb
17973 eval $inlibc
17974
17975 : see if writev exists
17976 set writev d_writev
17977 eval $inlibc
17978
17979 : preserve RCS keywords in files with variable substitution, grrr
17980 Date='$Date'
17981 Id='$Id'
17982 Log='$Log'
17983 RCSfile='$RCSfile'
17984 Revision='$Revision'
17985
17986 : check for alignment requirements
17987 echo " "
17988 case "$usecrosscompile$multiarch" in
17989 *$define*)
17990         $cat <<EOM
17991 You seem to be either cross-compiling or doing a multiarchitecture build,
17992 skipping the memory alignment check.
17993
17994 EOM
17995         case "$alignbytes" in
17996         '') alignbytes=8 ;;
17997         esac
17998         ;;
17999 *)
18000         case "$alignbytes" in
18001         '') echo "Checking alignment constraints..." >&4
18002                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18003                         $cat >try.c <<'EOCP'
18004 typedef long double NV;
18005 EOCP
18006                 else
18007                         $cat >try.c <<'EOCP'
18008 typedef double NV;
18009 EOCP
18010                 fi
18011                 $cat >>try.c <<'EOCP'
18012 #include <stdio.h>
18013 struct foobar {
18014         char foo;
18015         NV bar;
18016 } try_algn;
18017 int main()
18018 {
18019     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18020     return(0);
18021 }
18022 EOCP
18023                 set try
18024                 if eval $compile_ok; then
18025                         dflt=`$run ./try`
18026                 else
18027                         dflt='8'
18028                         echo "(I can't seem to compile the test program...)"
18029                 fi
18030                 ;;
18031         *) dflt="$alignbytes"
18032                 ;;
18033         esac
18034         rp="Doubles must be aligned on a how-many-byte boundary?"
18035         . ./myread
18036         alignbytes="$ans"
18037         $rm -f try.c try
18038         ;;
18039 esac
18040
18041
18042 : set the base revision
18043 baserev=5.0
18044
18045 : how do we concatenate cpp tokens here?
18046 echo " "
18047 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18048 $cat >cpp_stuff.c <<'EOCP'
18049 #define RCAT(a,b)a/**/b
18050 #define ACAT(a,b)a ## b
18051 RCAT(Rei,ser)
18052 ACAT(Cir,cus)
18053 EOCP
18054 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18055 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18056         echo "Oh!  Smells like ANSI's been here." >&4
18057         echo "We can catify or stringify, separately or together!"
18058         cpp_stuff=42
18059 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18060         echo "Ah, yes!  The good old days!" >&4
18061         echo "However, in the good old days we don't know how to stringify and"
18062         echo "catify at the same time."
18063         cpp_stuff=1
18064 else
18065         $cat >&4 <<EOM
18066 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18067 You're going to have to edit the values of CAT[2-5] in config.h...
18068 EOM
18069         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18070 fi
18071 $rm -f cpp_stuff.*
18072
18073 : see if this is a db.h system
18074 set db.h i_db
18075 eval $inhdr
18076
18077 case "$i_db" in
18078 $define)
18079         : Check db version.
18080         echo " "
18081         echo "Checking Berkeley DB version ..." >&4
18082         $cat >try.c <<EOCP
18083 #$d_const HASCONST
18084 #ifndef HASCONST
18085 #define const
18086 #endif
18087 #include <sys/types.h>
18088 #include <stdio.h>
18089 #$i_stdlib I_STDLIB
18090 #ifdef I_STDLIB
18091 #include <stdlib.h>
18092 #endif
18093 #include <db.h>
18094 int main(int argc, char *argv[])
18095 {
18096 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18097     int Major, Minor, Patch ;
18098     unsigned long Version ;
18099     (void)db_version(&Major, &Minor, &Patch) ;
18100     if (argc == 2) {
18101         printf("%d %d %d %d %d %d\n",
18102                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18103                Major, Minor, Patch);
18104         exit(0);
18105     }
18106     printf("You have Berkeley DB Version 2 or greater.\n");
18107
18108     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18109                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18110     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18111                 Major, Minor, Patch) ;
18112
18113     /* check that db.h & libdb are compatible */
18114     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18115         printf("db.h and libdb are incompatible.\n") ;
18116         exit(3);        
18117     }
18118
18119     printf("db.h and libdb are compatible.\n") ;
18120
18121     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18122                 + DB_VERSION_PATCH ;
18123
18124     /* needs to be >= 2.3.4 */
18125     if (Version < 2003004) {
18126     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18127         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18128         exit(2);        
18129     }
18130
18131     exit(0);
18132 #else
18133 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18134     if (argc == 2) {
18135         printf("1 0 0\n");
18136         exit(0);
18137     }
18138     printf("You have Berkeley DB Version 1.\n");
18139     exit(0);    /* DB version < 2: the coast is clear. */
18140 #else
18141     exit(1);    /* <db.h> not Berkeley DB? */
18142 #endif
18143 #endif
18144 }
18145 EOCP
18146         set try
18147         if eval $compile_ok && $run ./try; then
18148                 echo 'Looks OK.' >&4
18149                 set `$run ./try 1`
18150                 db_version_major=$1
18151                 db_version_minor=$2
18152                 db_version_patch=$3
18153         else
18154                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18155                 i_db=$undef
18156                 case " $libs " in
18157                 *"-ldb "*)
18158                         : Remove db from list of libraries to use
18159                         echo "Removing unusable -ldb from library list" >&4
18160                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18161                         shift
18162                         libs="$*"
18163                         echo "libs = $libs" >&4
18164                         ;;
18165                 esac
18166         fi
18167         $rm -f try.*
18168         ;;
18169 esac
18170
18171 case "$i_db" in
18172 define)
18173         : Check the return type needed for hash 
18174         echo " "
18175         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18176         $cat >try.c <<EOCP
18177 #$d_const HASCONST
18178 #ifndef HASCONST
18179 #define const
18180 #endif
18181 #include <sys/types.h>
18182 #include <db.h>
18183
18184 #ifndef DB_VERSION_MAJOR
18185 u_int32_t hash_cb (ptr, size)
18186 const void *ptr;
18187 size_t size;
18188 {
18189 }
18190 HASHINFO info;
18191 int main()
18192 {
18193         info.hash = hash_cb;
18194 }
18195 #endif
18196 EOCP
18197         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18198                 if $contains warning try.out >>/dev/null 2>&1 ; then
18199                         db_hashtype='int'
18200                 else
18201                         db_hashtype='u_int32_t'
18202                 fi
18203         else
18204                 : XXX Maybe we should just give up here.
18205                 db_hashtype=u_int32_t
18206                 $cat try.out >&4
18207                 echo "Help:  I can't seem to compile the db test program." >&4
18208                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18209         fi
18210         $rm -f try.*
18211         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18212         ;;
18213 *)      db_hashtype=u_int32_t
18214         ;;
18215 esac
18216 case "$i_db" in
18217 define)
18218         : Check the return type needed for prefix 
18219         echo " "
18220         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18221         cat >try.c <<EOCP
18222 #$d_const HASCONST
18223 #ifndef HASCONST
18224 #define const
18225 #endif
18226 #include <sys/types.h>
18227 #include <db.h>
18228
18229 #ifndef DB_VERSION_MAJOR
18230 size_t prefix_cb (key1, key2)
18231 const DBT *key1;
18232 const DBT *key2;
18233 {
18234 }
18235 BTREEINFO info;
18236 int main()
18237 {
18238         info.prefix = prefix_cb;
18239 }
18240 #endif
18241 EOCP
18242         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18243                 if $contains warning try.out >>/dev/null 2>&1 ; then
18244                         db_prefixtype='int'
18245                 else
18246                         db_prefixtype='size_t'
18247                 fi
18248         else
18249                 db_prefixtype='size_t'
18250                 : XXX Maybe we should just give up here.
18251                 $cat try.out >&4
18252                 echo "Help:  I can't seem to compile the db test program." >&4
18253                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18254         fi
18255         $rm -f try.*
18256         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18257         ;;
18258 *)      db_prefixtype='size_t'
18259         ;;
18260 esac
18261
18262
18263 : How can we generate normalized random numbers ?
18264 echo " "
18265 echo "Looking for a random number function..." >&4
18266 case "$randfunc" in
18267 '')
18268         if set drand48 val -f; eval $csym; $val; then
18269                 dflt="drand48"
18270                 echo "Good, found drand48()." >&4
18271         elif set random val -f; eval $csym; $val; then
18272                 dflt="random"
18273                 echo "OK, found random()." >&4
18274         else
18275                 dflt="rand"
18276                 echo "Yick, looks like I have to use rand()." >&4
18277         fi
18278         echo " "
18279         ;;
18280 *)
18281         dflt="$randfunc"
18282         ;;
18283 esac
18284 cont=true
18285
18286 case "$ccflags" in
18287 *-Dmy_rand=*|*-Dmy_srand=*)
18288         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18289         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18290         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18291         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18292         ;;
18293 esac
18294
18295 while $test "$cont"; do
18296         rp="Use which function to generate random numbers?"
18297         . ./myread
18298         if $test "$ans" = "$dflt"; then
18299                 : null
18300         else
18301                 randbits=''
18302         fi
18303         randfunc="$ans"
18304         if set $ans val -f; eval $csym; $val; then
18305                 cont=''
18306         else
18307                 dflt=y
18308                 rp="I cannot find function $ans. Use that name anyway?"
18309                 . ./myread
18310                 dflt=rand
18311                 case "$ans" in
18312                         [yY]*) cont='';;
18313                 esac
18314         fi
18315         case "$cont" in
18316         '')
18317                 case "$randfunc" in
18318                 drand48)
18319                         drand01="drand48()"
18320                         seedfunc="srand48"
18321                         randbits=48
18322                         randseedtype=long
18323                         ;;
18324                 rand|random)
18325                         case "$randbits" in
18326                         '')
18327 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18328                                 $cat >try.c <<EOCP
18329 #$i_unistd I_UNISTD
18330 #$i_stdlib I_STDLIB
18331 #include <stdio.h>
18332 #ifdef I_UNISTD
18333 #  include <unistd.h>
18334 #endif
18335 #ifdef I_STDLIB
18336 #  include <stdlib.h>
18337 #endif
18338 int main()
18339 {
18340         register int i;
18341         register unsigned long tmp;
18342         register unsigned long max = 0L;
18343
18344         for (i = 1000; i; i--) {
18345                 tmp = (unsigned long) $randfunc();
18346                 if (tmp > max) max = tmp;
18347         }
18348         for (i = 0; max; i++)
18349                 max /= 2;
18350         printf("%d\n",i);
18351 }
18352 EOCP
18353                                 set try
18354                                 if eval $compile_ok; then
18355                                         dflt=`try`
18356                                 else
18357                                         dflt='?'
18358                                         echo "(I can't seem to compile the test program...)"
18359                                 fi
18360                                 ;;
18361                         *)
18362                                 dflt="$randbits"
18363                                 ;;
18364                         esac
18365                         rp="How many bits does your $randfunc() function produce?"
18366                         . ./myread
18367                         randbits="$ans"
18368                         $rm -f try.c try
18369                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18370                         seedfunc="s$randfunc"
18371                         randseedtype=unsigned
18372                         ;;
18373                 *)
18374                         dflt="31"
18375                         rp="How many bits does your $randfunc() function produce?"
18376                         . ./myread
18377                         randbits="$ans"
18378                         seedfunc="s$randfunc"
18379                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18380                         if set $seedfunc val -f; eval $csym; $val; then
18381                                 echo "(Using $seedfunc() to seed random generator)"
18382                         else
18383                                 echo "(Warning: no $seedfunc() to seed random generator)"
18384                                 seedfunc=rand
18385                         fi
18386                         randseedtype=unsigned
18387                         ;;
18388                 esac
18389                 ;;
18390         esac
18391 done
18392
18393 echo " "
18394 echo "Determining whether or not we are on an EBCDIC system..." >&4
18395 $cat >try.c <<'EOM'
18396 int main()
18397 {
18398   if ('M'==0xd4) return 0;
18399   return 1;
18400 }
18401 EOM
18402
18403 val=$undef
18404 set try
18405 if eval $compile_ok; then
18406         if $run ./try; then
18407                 echo "You seem to speak EBCDIC." >&4
18408                 val="$define"
18409         else
18410                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18411         fi
18412 else
18413         echo "I'm unable to compile the test program." >&4
18414         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18415 fi
18416 $rm -f try try.*
18417 set ebcdic
18418 eval $setvar
18419
18420 echo " "
18421 $cat >&4 <<EOM
18422 Checking how to flush all pending stdio output...
18423 EOM
18424 # I only know how to find the first 32 possibly open files on SunOS.
18425 # See also hints/sunos_4_1.sh and util.c  --AD
18426 case "$osname" in
18427 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18428 esac
18429 $cat >>try.c <<EOCP
18430 #include <stdio.h>
18431 #$i_stdlib I_STDLIB
18432 #ifdef I_STDLIB
18433 #include <stdlib.h>
18434 #endif
18435 #$i_unistd I_UNISTD
18436 #ifdef I_UNISTD
18437 # include <unistd.h>
18438 #endif
18439 #$d_sysconf HAS_SYSCONF
18440 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18441 #ifdef HAS_STDIO_STREAM_ARRAY
18442 # define STDIO_STREAM_ARRAY $stdio_stream_array
18443 #endif
18444 int main() {
18445   FILE* p;
18446   unlink("try.out");
18447   p = fopen("try.out", "w");
18448 #ifdef TRY_FPUTC
18449   fputc('x', p);
18450 #else
18451 # ifdef TRY_FPRINTF
18452   fprintf(p, "x");
18453 # endif
18454 #endif
18455 #ifdef TRY_FFLUSH_NULL
18456   fflush(NULL);
18457 #endif
18458 #ifdef TRY_FFLUSH_ALL
18459   {
18460     long open_max = -1;
18461 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18462     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18463 # else
18464 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18465     open_max = sysconf(_SC_OPEN_MAX);
18466 #  else
18467 #   ifdef FOPEN_MAX
18468     open_max = FOPEN_MAX;
18469 #   else
18470 #    ifdef OPEN_MAX
18471     open_max = OPEN_MAX;
18472 #    else
18473 #     ifdef _NFILE
18474     open_max = _NFILE;
18475 #     endif
18476 #    endif
18477 #   endif
18478 #  endif
18479 # endif 
18480 # ifdef HAS_STDIO_STREAM_ARRAY
18481     if (open_max > 0) {
18482       long i;
18483       for (i = 0; i < open_max; i++)
18484             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18485                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18486                 STDIO_STREAM_ARRAY[i]._flag)
18487                 fflush(&STDIO_STREAM_ARRAY[i]);
18488     }   
18489   }
18490 # endif
18491 #endif
18492   _exit(42);
18493 }
18494 EOCP
18495 : first we have to find out how _not_ to flush
18496 $to try.c
18497 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18498     output=''
18499     set try -DTRY_FPUTC
18500     if eval $compile; then
18501             $run ./try 2>/dev/null
18502             code="$?"
18503             $from try.out
18504             if $test ! -s try.out -a "X$code" = X42; then
18505                 output=-DTRY_FPUTC
18506             fi
18507     fi
18508     case "$output" in
18509     '')
18510             set try -DTRY_FPRINTF
18511             if eval $compile; then
18512                     $run ./try 2>/dev/null
18513                     code="$?"
18514                     $from try.out
18515                     if $test ! -s try.out -a "X$code" = X42; then
18516                         output=-DTRY_FPRINTF
18517                     fi
18518             fi
18519         ;;
18520     esac
18521 fi
18522 : check for fflush NULL behaviour
18523 case "$fflushNULL" in
18524 '')     set try -DTRY_FFLUSH_NULL $output
18525         if eval $compile; then
18526                 $run ./try 2>/dev/null
18527                 code="$?"
18528                 $from try.out
18529                 if $test -s try.out -a "X$code" = X42; then
18530                         fflushNULL="`$cat try.out`"
18531                 else
18532                         if $test "X$code" != X42; then
18533                                 $cat >&4 <<EOM
18534 (If this test failed, don't worry, we'll try another method shortly.)
18535 EOM
18536                         fi
18537                 fi
18538         fi
18539         $rm -f core try.core core.try.*
18540         case "$fflushNULL" in
18541         x)      $cat >&4 <<EOM
18542 Your fflush(NULL) works okay for output streams.
18543 Let's see if it clobbers input pipes...
18544 EOM
18545 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18546 # bug that improperly flushes the input end of pipes.  So we avoid the
18547 # autoflush on fork/system/exec support for now. :-(
18548 $cat >tryp.c <<EOCP
18549 #include <stdio.h>
18550 int
18551 main(int argc, char **argv)
18552 {
18553     char buf[1024];
18554     int i;
18555     char *bp = buf;
18556     while (1) {
18557         while ((i = getc(stdin)) != -1
18558                && (*bp++ = i) != '\n'
18559                && bp < &buf[1024])
18560         /* DO NOTHING */ ;
18561         *bp = '\0';
18562         fprintf(stdout, "%s", buf);
18563         fflush(NULL);
18564         if (i == -1)
18565             return 0;
18566         bp = buf;
18567     }
18568 }
18569 EOCP
18570                 fflushNULL="$define"
18571                 set tryp
18572                 if eval $compile; then
18573                     $rm -f tryp.out
18574                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18575                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18576                        $cat >&4 <<EOM
18577 fflush(NULL) seems to behave okay with input streams.
18578 EOM
18579                         fflushNULL="$define"
18580                     else
18581                         $cat >&4 <<EOM
18582 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18583 EOM
18584                         fflushNULL="$undef"
18585                     fi
18586                 fi
18587                 $rm -f core tryp.c tryp.core core.tryp.*
18588                 ;;
18589         '')     $cat >&4 <<EOM
18590 Your fflush(NULL) isn't working (contrary to ANSI C).
18591 EOM
18592                 fflushNULL="$undef"
18593                 ;;
18594         *)      $cat >&4 <<EOM
18595 Cannot figure out whether your fflush(NULL) works or not.
18596 I'm assuming it doesn't (contrary to ANSI C).
18597 EOM
18598                 fflushNULL="$undef"
18599                 ;;
18600         esac
18601         ;;
18602 $define|true|[yY]*)
18603         fflushNULL="$define"
18604         ;;
18605 *)
18606         fflushNULL="$undef"
18607         ;;
18608 esac
18609 : check explicit looping only if NULL did not work, and if the pipe
18610 : bug does not show up on an explicit flush too
18611 case "$fflushNULL" in
18612 "$undef")
18613         $cat >tryp.c <<EOCP
18614 #include <stdio.h>
18615 int
18616 main(int argc, char **argv)
18617 {
18618     char buf[1024];
18619     int i;
18620     char *bp = buf;
18621     while (1) {
18622         while ((i = getc(stdin)) != -1
18623                && (*bp++ = i) != '\n'
18624                && bp < &buf[1024])
18625         /* DO NOTHING */ ;
18626         *bp = '\0';
18627         fprintf(stdout, "%s", buf);
18628         fflush(stdin);
18629         if (i == -1)
18630             return 0;
18631         bp = buf;
18632     }
18633 }
18634 EOCP
18635         set tryp
18636         if eval $compile; then
18637             $rm -f tryp.out
18638             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18639             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18640                $cat >&4 <<EOM
18641 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18642 EOM
18643                 : now check for fflushall behaviour
18644                 case "$fflushall" in
18645                 '')     set try -DTRY_FFLUSH_ALL $output
18646                         if eval $compile; then
18647                                 $cat >&4 <<EOM
18648 (Now testing the other method--but note that this also may fail.)
18649 EOM
18650                                 $run ./try 2>/dev/null
18651                                 code=$?
18652                                 $from try.out
18653                                 if $test -s try.out -a "X$code" = X42; then
18654                                         fflushall="`$cat try.out`"
18655                                 fi
18656                         fi
18657                         $rm -f core try.core core.try.*
18658                         case "$fflushall" in
18659                         x)      $cat >&4 <<EOM
18660 Whew. Flushing explicitly all the stdio streams works.
18661 EOM
18662                                 fflushall="$define"
18663                                 ;;
18664                         '')     $cat >&4 <<EOM
18665 Sigh. Flushing explicitly all the stdio streams doesn't work.
18666 EOM
18667                                 fflushall="$undef"
18668                                 ;;
18669                         *)      $cat >&4 <<EOM
18670 Cannot figure out whether flushing stdio streams explicitly works or not.
18671 I'm assuming it doesn't.
18672 EOM
18673                                 fflushall="$undef"
18674                                 ;;
18675                         esac
18676                         ;;
18677                 "$define"|true|[yY]*)
18678                         fflushall="$define"
18679                         ;;
18680                 *)
18681                         fflushall="$undef"
18682                         ;;
18683                 esac
18684             else
18685                 $cat >&4 <<EOM
18686 All is futile.  Even fflush(stdin) clobbers input pipes!
18687 EOM
18688                 fflushall="$undef"
18689             fi
18690         else
18691             fflushall="$undef"
18692         fi
18693         $rm -f core tryp.c tryp.core core.tryp.*
18694         ;;
18695 *)      fflushall="$undef"
18696         ;;
18697 esac
18698
18699 case "$fflushNULL$fflushall" in
18700 undefundef)
18701         $cat <<EOM
18702 OK, I give up.  I cannot figure out how to flush pending stdio output.
18703 We won't be flushing handles at all before fork/exec/popen.
18704 EOM
18705         ;;
18706 esac
18707 $rm -f try.* try$exe_ext
18708
18709 : Store the full pathname to the ar program for use in the C program
18710 : Respect a hint or command line value for full_ar.
18711 case "$full_ar" in
18712 '') full_ar=$ar ;;
18713 esac
18714
18715 : Store the full pathname to the sed program for use in the C program
18716 full_sed=$sed
18717
18718 : see what type gids are declared as in the kernel
18719 echo " "
18720 echo "Looking for the type for group ids returned by getgid()."
18721 set gid_t gidtype xxx stdio.h sys/types.h
18722 eval $typedef
18723 case "$gidtype" in
18724 xxx)
18725         xxx=`./findhdr sys/user.h`
18726         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18727         case $1 in
18728         unsigned) dflt="$1 $2" ;;
18729         *) dflt="$1" ;;
18730         esac
18731         ;;
18732 *) dflt="$gidtype";;
18733 esac
18734 case "$gidtype" in
18735 gid_t) echo "gid_t found." ;;
18736 *)      rp="What is the type for group ids returned by getgid()?"
18737         . ./myread
18738         gidtype="$ans"
18739         ;;
18740 esac
18741
18742 echo " "
18743 case "$gidtype" in
18744 *_t) zzz="$gidtype"     ;;
18745 *)   zzz="gid"          ;;
18746 esac
18747 echo "Checking the size of $zzz..." >&4 
18748 cat > try.c <<EOCP
18749 #include <sys/types.h>
18750 #include <stdio.h>
18751 #$i_stdlib I_STDLIB
18752 #ifdef I_STDLIB
18753 #include <stdlib.h>
18754 #endif
18755 int main() {
18756     printf("%d\n", (int)sizeof($gidtype));
18757     exit(0);
18758 }
18759 EOCP
18760 set try
18761 if eval $compile_ok; then
18762         yyy=`$run ./try`
18763         case "$yyy" in
18764         '')     gidsize=4
18765                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18766                 ;;
18767         *)      gidsize=$yyy
18768                 echo "Your $zzz is $gidsize bytes long."
18769                 ;;
18770         esac
18771 else
18772         gidsize=4
18773         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18774 fi
18775
18776
18777 echo " "
18778 case "$gidtype" in
18779 *_t) zzz="$gidtype"     ;;
18780 *)   zzz="gid"          ;;
18781 esac
18782 echo "Checking the sign of $zzz..." >&4 
18783 cat > try.c <<EOCP
18784 #include <sys/types.h>
18785 #include <stdio.h>
18786 int main() {
18787         $gidtype foo = -1;
18788         if (foo < 0)
18789                 printf("-1\n");
18790         else
18791                 printf("1\n");
18792 }
18793 EOCP
18794 set try
18795 if eval $compile; then
18796         yyy=`$run ./try`
18797         case "$yyy" in
18798         '')     gidsign=1
18799                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18800                 ;;
18801         *)      gidsign=$yyy
18802                 case "$gidsign" in
18803                  1) echo "Your $zzz is unsigned." ;;
18804                 -1) echo "Your $zzz is signed."   ;;
18805                 esac
18806                 ;;
18807         esac
18808 else
18809         gidsign=1
18810         echo "(I can't compile the test program--guessing unsigned.)" >&4
18811 fi
18812
18813
18814 echo " "
18815
18816 if $test X"$quadtype" != X; then
18817
18818 echo "Checking how to print 64-bit integers..." >&4
18819
18820 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18821         $cat >try.c <<'EOCP'
18822 #include <sys/types.h>
18823 #include <stdio.h>
18824 int main() {
18825   int q = 12345678901;
18826   printf("%ld\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='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18835                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18836                         echo "We will use %d."
18837                         ;;
18838                 esac
18839         fi
18840 fi
18841
18842 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18843         $cat >try.c <<'EOCP'
18844 #include <sys/types.h>
18845 #include <stdio.h>
18846 int main() {
18847   long q = 12345678901;
18848   printf("%ld\n", q);
18849 }
18850 EOCP
18851         set try
18852         if eval $compile; then
18853                 yyy=`$run ./try`
18854                 case "$yyy" in
18855                 12345678901)
18856                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18857                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18858                         echo "We will use %ld."
18859                         ;;
18860                 esac
18861         fi
18862 fi
18863
18864 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18865         $cat >try.c <<'EOCP'
18866 #include <sys/types.h>
18867 #include <inttypes.h>
18868 #include <stdio.h>
18869 int main() {
18870   int64_t q = 12345678901;
18871   printf("%" PRId64 "\n", q);
18872 }
18873 EOCP
18874         set try
18875         if eval $compile; then
18876                 yyy=`$run ./try`
18877                 case "$yyy" in
18878                 12345678901)
18879                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18880                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18881                         echo "We will use the C9X style."
18882                         ;;
18883                 esac
18884         fi
18885 fi
18886
18887 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18888         $cat >try.c <<EOCP
18889 #include <sys/types.h>
18890 #include <stdio.h>
18891 int main() {
18892   $quadtype q = 12345678901;
18893   printf("%Ld\n", q);
18894 }
18895 EOCP
18896         set try
18897         if eval $compile; then
18898                 yyy=`$run ./try`
18899                 case "$yyy" in
18900                 12345678901)
18901                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18902                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18903                         echo "We will use %Ld."
18904                         ;;
18905                 esac
18906         fi
18907 fi
18908
18909 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18910         $cat >try.c <<'EOCP'
18911 #include <sys/types.h>
18912 #include <stdio.h>
18913 int main() {
18914   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18915   printf("%lld\n", q);
18916 }
18917 EOCP
18918         set try
18919         if eval $compile; then
18920                 yyy=`$run ./try`
18921                 case "$yyy" in
18922                 12345678901)
18923                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18924                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18925                         echo "We will use the %lld style."
18926                         ;;
18927                 esac
18928         fi
18929 fi
18930
18931 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18932         $cat >try.c <<EOCP
18933 #include <sys/types.h>
18934 #include <stdio.h>
18935 int main() {
18936   $quadtype q = 12345678901;
18937   printf("%qd\n", q);
18938 }
18939 EOCP
18940         set try
18941         if eval $compile; then
18942                 yyy=`$run ./try`
18943                 case "$yyy" in
18944                 12345678901)
18945                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18946                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18947                         echo "We will use %qd."
18948                         ;;
18949                 esac
18950         fi
18951 fi
18952
18953 if $test X"$sPRId64" = X; then
18954         echo "Cannot figure out how to print 64-bit integers." >&4
18955 fi
18956
18957 $rm -f try try.*
18958
18959 fi
18960
18961 case "$sPRId64" in
18962 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18963         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18964         ;;
18965 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18966         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18967         ;;
18968 esac
18969
18970
18971 echo " "
18972 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18973
18974 if $test X"$ivsize" = X8; then
18975         ivdformat="$sPRId64"
18976         uvuformat="$sPRIu64"
18977         uvoformat="$sPRIo64"
18978         uvxformat="$sPRIx64"
18979         uvXUformat="$sPRIXU64"
18980 else
18981         if $test X"$ivsize" = X"$longsize"; then
18982                 ivdformat='"ld"'
18983                 uvuformat='"lu"'
18984                 uvoformat='"lo"'
18985                 uvxformat='"lx"'
18986                 uvXUformat='"lX"'
18987         else
18988                 if $test X"$ivsize" = X"$intsize"; then
18989                         ivdformat='"d"'
18990                         uvuformat='"u"'
18991                         uvoformat='"o"'
18992                         uvxformat='"x"'
18993                         uvXUformat='"X"'
18994                 else
18995                         : far out
18996                         if $test X"$ivsize" = X"$shortsize"; then
18997                                 ivdformat='"hd"'
18998                                 uvuformat='"hu"'
18999                                 uvoformat='"ho"'
19000                                 uvxformat='"hx"'
19001                                 uvXUformat='"hX"'
19002                         fi
19003                 fi
19004         fi
19005 fi
19006
19007 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19008         nveformat="$sPRIeldbl"
19009         nvfformat="$sPRIfldbl"
19010         nvgformat="$sPRIgldbl"
19011         nvEUformat="$sPRIEUldbl"
19012         nvFUformat="$sPRIFUldbl"
19013         nvGUformat="$sPRIGUldbl"
19014 else
19015         nveformat='"e"'
19016         nvfformat='"f"'
19017         nvgformat='"g"'
19018         nvEUformat='"E"'
19019         nvFUformat='"F"'
19020         nvGUformat='"G"'
19021 fi
19022
19023 case "$ivdformat" in
19024 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19025     exit 1
19026     ;;
19027 esac
19028
19029
19030 echo " "
19031 $echo "Checking the format string to be used for gids..." >&4
19032
19033 case "$gidsign" in
19034 -1)     if $test X"$gidsize" = X"$ivsize"; then
19035                 gidformat="$ivdformat"
19036         else
19037                 if $test X"$gidsize" = X"$longsize"; then
19038                         gidformat='"ld"'
19039                 else
19040                         if $test X"$gidsize" = X"$intsize"; then
19041                                 gidformat='"d"'
19042                         else
19043                                 if $test X"$gidsize" = X"$shortsize"; then
19044                                         gidformat='"hd"'
19045                                 fi
19046                         fi
19047                 fi
19048         fi
19049         ;;
19050 *)      if $test X"$gidsize" = X"$uvsize"; then
19051                 gidformat="$uvuformat"
19052         else
19053                 if $test X"$gidsize" = X"$longsize"; then
19054                         gidformat='"lu"'
19055                 else
19056                         if $test X"$gidsize" = X"$intsize"; then
19057                                 gidformat='"u"'
19058                         else
19059                                 if $test X"$gidsize" = X"$shortsize"; then
19060                                         gidformat='"hu"'
19061                                 fi
19062                         fi
19063                 fi
19064         fi
19065         ;;
19066 esac
19067
19068 : see if getgroups exists
19069 set getgroups d_getgrps
19070 eval $inlibc
19071
19072 : see if setgroups exists
19073 set setgroups d_setgrps
19074 eval $inlibc
19075
19076
19077 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19078 echo " "
19079 case "$d_getgrps$d_setgrps" in
19080 *define*)
19081         case "$groupstype" in
19082         '') dflt="$gidtype" ;;
19083         *)  dflt="$groupstype" ;;
19084         esac
19085         $cat <<EOM
19086 What type of pointer is the second argument to getgroups() and setgroups()?
19087 Usually this is the same as group ids, $gidtype, but not always.
19088
19089 EOM
19090         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19091         . ./myread
19092         groupstype="$ans"
19093         ;;
19094 *)  groupstype="$gidtype";;
19095 esac
19096
19097
19098 if $test $patchlevel -lt 9; then
19099 : MAD is not available in 5.8.x or earlier.
19100     ans=n;
19101 else
19102     case "$mad" in
19103     $define|true|[yY]*) dflt='y' ;;
19104     *)                  dflt='n' ;;
19105     esac
19106     cat <<EOM
19107
19108 Would you like to build with Misc Attribute Decoration? This is development
19109 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19110 overhead on the interpreter.
19111
19112 If this doesn't make any sense to you, just accept the default '$dflt'.
19113 EOM
19114     rp='Build Perl with MAD?'
19115     . ./myread
19116 fi
19117 case "$ans" in
19118 y|Y)    val="$define"
19119         madlyh='madly.h madly.act madly.tab'
19120         madlysrc='madly.c'
19121         madlyobj="madly$_o" ;;
19122 *)      val="$undef"
19123         madlyh=''
19124         madlysrc=''
19125         madlyobj='' ;;
19126 esac
19127 set mad
19128 eval $setvar
19129
19130 echo " "
19131 echo "Checking if your $make program sets \$(MAKE)..." >&4
19132 case "$make_set_make" in
19133 '')
19134         $sed 's/^X //' > testmake.mak << 'EOF'
19135 Xall:
19136 X       @echo 'maketemp="$(MAKE)"'
19137 EOF
19138         case "`$make -f testmake.mak 2>/dev/null`" in
19139         *maketemp=*) make_set_make='#' ;;
19140         *)      make_set_make="MAKE=$make" ;;
19141         esac
19142         $rm -f testmake.mak
19143         ;;
19144 esac
19145 case "$make_set_make" in
19146 '#') echo "Yup, it does.";;
19147 *) echo "Nope, it doesn't.";;
19148 esac
19149
19150 : see what type is used for mode_t
19151 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19152 set mode_t modetype int stdio.h sys/types.h
19153 eval $typedef_ask
19154
19155 : see if we need va_copy
19156 echo " "
19157 case "$i_stdarg" in
19158 "$define")
19159         $cat >try.c <<EOCP
19160 #include <stdarg.h>
19161 #include <stdio.h>
19162 #$i_stdlib I_STDLIB
19163 #ifdef I_STDLIB
19164 #include <stdlib.h>
19165 #endif
19166 #include <signal.h>
19167
19168 int
19169 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19170 {
19171   return vfprintf(f, fmt, *valp);
19172 }
19173  
19174 int    
19175 myvfprintf(FILE *f, const  char *fmt, va_list val)
19176 {
19177   return ivfprintf(f, fmt, &val);
19178 }
19179       
19180 int
19181 myprintf(char *fmt, ...) 
19182 {
19183   va_list val;
19184   va_start(val, fmt);
19185   return myvfprintf(stdout, fmt, val); 
19186 }         
19187
19188 int
19189 main(int ac, char **av)
19190 {
19191   signal(SIGSEGV, exit);
19192
19193   myprintf("%s%cs all right, then\n", "that", '\'');                            
19194   exit(0);      
19195 }
19196 EOCP
19197         set try
19198         if eval $compile && $run ./try 2>&1 >/dev/null; then
19199                 case "`$run ./try`" in
19200                 "that's all right, then")
19201                         okay=yes
19202                         ;;
19203                 esac
19204         fi
19205         case "$okay" in
19206         yes)    echo "It seems that you don't need va_copy()." >&4
19207                 need_va_copy="$undef"
19208                 ;;
19209         *)      echo "It seems that va_copy() or similar will be needed." >&4
19210                 need_va_copy="$define"
19211                 ;;
19212         esac
19213         $rm -f try.* core core.* *.core *.core.*
19214         ;;
19215 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19216         ;;
19217 esac
19218
19219 : see what type is used for size_t
19220 rp="What is the type used for the length parameter for string functions?"
19221 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19222 eval $typedef_ask
19223
19224 : check for type of arguments to gethostbyaddr. 
19225 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19226         case "$d_gethbyaddr" in
19227         $define)
19228                 $cat <<EOM
19229
19230 Checking to see what type of arguments are accepted by gethostbyaddr().
19231 EOM
19232                 hdrs="$define sys/types.h
19233                         $d_socket sys/socket.h 
19234                         $i_niin netinet/in.h 
19235                         $i_netdb netdb.h
19236                         $i_unistd unistd.h"
19237                 : The first arg can 'char *' or 'void *'
19238                 : The second arg is some of integral type
19239                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19240                         for yyy in size_t long int; do
19241                                 case "$netdb_host_type" in
19242                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19243                                         if ./protochk "$try" $hdrs; then
19244                                                 echo "Your system accepts $xxx for the first arg."
19245                                                 echo "...and $yyy for the second arg."
19246                                                 netdb_host_type="$xxx"
19247                                                 netdb_hlen_type="$yyy"
19248                                         fi
19249                                         ;;
19250                                 esac
19251                         done
19252                 done
19253                 : In case none of those worked, prompt the user.
19254                 case "$netdb_host_type" in
19255                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19256                         dflt='char *'
19257                         . ./myread
19258                         netdb_host_type=$ans
19259                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19260                         dflt="$sizetype"
19261                         . ./myread
19262                         netdb_hlen_type=$ans
19263                         ;;
19264                 esac
19265                 ;;
19266         *)      : no gethostbyaddr, so pick harmless defaults
19267                 netdb_host_type='char *'
19268                 netdb_hlen_type="$sizetype"
19269                 ;;
19270         esac
19271         # Remove the "const" if needed. -- but then we'll have a 
19272         # prototype clash!
19273         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19274 fi
19275
19276 : check for type of argument to gethostbyname. 
19277 if test "X$netdb_name_type" = X ; then
19278         case "$d_gethbyname" in
19279         $define)
19280                 $cat <<EOM
19281
19282 Checking to see what type of argument is accepted by gethostbyname().
19283 EOM
19284                 hdrs="$define sys/types.h
19285                         $d_socket sys/socket.h 
19286                         $i_niin netinet/in.h 
19287                         $i_netdb netdb.h
19288                         $i_unistd unistd.h"
19289                 for xxx in "const char *" "char *"; do
19290                         case "$netdb_name_type" in
19291                         '')     try="extern struct hostent *gethostbyname($xxx);"
19292                                 if ./protochk "$try" $hdrs; then
19293                                         echo "Your system accepts $xxx."
19294                                         netdb_name_type="$xxx"
19295                                 fi
19296                                 ;;
19297                         esac
19298                 done
19299                 : In case none of those worked, prompt the user.
19300                 case "$netdb_name_type" in
19301                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19302                         dflt='char *'
19303                         . ./myread
19304                         netdb_name_type=$ans
19305                         ;;
19306                 esac
19307                 ;;
19308         *)      : no gethostbyname, so pick harmless default
19309                 netdb_name_type='char *'
19310                 ;;
19311         esac
19312 fi
19313
19314 : check for type of 1st argument to getnetbyaddr. 
19315 if test "X$netdb_net_type" = X ; then
19316         case "$d_getnbyaddr" in
19317         $define)
19318                 $cat <<EOM
19319
19320 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19321 EOM
19322                 hdrs="$define sys/types.h
19323                         $d_socket sys/socket.h 
19324                         $i_niin netinet/in.h 
19325                         $i_netdb netdb.h
19326                         $i_unistd unistd.h"
19327                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19328                         case "$netdb_net_type" in
19329                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19330                                 if ./protochk "$try" $hdrs; then
19331                                         echo "Your system accepts $xxx."
19332                                         netdb_net_type="$xxx"
19333                                 fi
19334                                 ;;
19335                         esac
19336                 done
19337                 : In case none of those worked, prompt the user.
19338                 case "$netdb_net_type" in
19339                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19340                         dflt='long'
19341                         . ./myread
19342                         netdb_net_type=$ans
19343                         ;;
19344                 esac
19345                 ;;
19346         *)      : no getnetbyaddr, so pick harmless default
19347                 netdb_net_type='long'
19348                 ;;
19349         esac
19350 fi
19351 : locate the preferred pager for this system
19352 fn=f/
19353 case "$pager" in
19354 '')
19355         dflt=''
19356         case "$pg" in
19357         /*) dflt=$pg;;
19358         [a-zA-Z]:/*) dflt=$pg;;
19359         esac
19360         case "$more" in
19361         /*) dflt=$more;;
19362         [a-zA-Z]:/*) dflt=$more;;
19363         esac
19364         case "$less" in
19365         /*) dflt=$less;;
19366         [a-zA-Z]:/*) dflt=$less;;
19367         esac
19368         case "$dflt" in
19369         '') dflt=/usr/ucb/more;;
19370         esac
19371         ;;
19372 *)      dflt="$pager"
19373         : Instruct ./getfile to trust the hinted or previous pager value,
19374         : even if it does not begin with a slash.  For example, on os2,
19375         : pager might be cmd /c more.  See comments in UU/getfile.
19376         fn="f/($pager)"
19377         ;;
19378 esac
19379 echo " "
19380 rp='What pager is used on your system?'
19381 . ./getfile
19382 pager="$ans"
19383
19384 : see what type pids are declared as in the kernel
19385 rp="What is the type of process ids on this system?"
19386 set pid_t pidtype int stdio.h sys/types.h
19387 eval $typedef_ask
19388
19389 : see if ar generates random libraries by itself
19390 echo " "
19391 echo "Checking how to generate random libraries on your machine..." >&4
19392 echo 'int bar1() { return bar2(); }' > bar1.c
19393 echo 'int bar2() { return 2; }' > bar2.c
19394 $cat > foo.c <<EOP
19395 #$i_stdlib I_STDLIB
19396 #ifdef I_STDLIB
19397 #include <stdlib.h>
19398 #endif
19399 int main() { printf("%d\n", bar1()); exit(0); }
19400 EOP
19401 $cc $ccflags -c bar1.c >/dev/null 2>&1
19402 $cc $ccflags -c bar2.c >/dev/null 2>&1
19403 $cc $ccflags -c foo.c >/dev/null 2>&1
19404 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19405 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19406         $run ./foobar >/dev/null 2>&1; then
19407         echo "$ar appears to generate random libraries itself."
19408         orderlib=false
19409         if [ "X$ranlib" = "X" ]; then
19410             ranlib=":"
19411         fi
19412 elif $ar ts bar$_a >/dev/null 2>&1 &&
19413         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19414         $run ./foobar >/dev/null 2>&1; then
19415                 echo "a table of contents needs to be added with '$ar ts'."
19416                 orderlib=false
19417                 ranlib="$ar ts"
19418 else
19419         case "$ranlib" in
19420         :) ranlib='';;
19421         '')
19422                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19423                 $test -f $ranlib || ranlib=''
19424                 ;;
19425         esac
19426         if $test -n "$ranlib"; then
19427                 echo "your system has '$ranlib'; we'll use that."
19428                 orderlib=false
19429         else
19430                 echo "your system doesn't seem to support random libraries"
19431                 echo "so we'll use lorder and tsort to order the libraries."
19432                 orderlib=true
19433                 ranlib=":"
19434         fi
19435 fi
19436 $rm -f foo* bar* 
19437
19438 : check for type of arguments to select. 
19439 case "$selecttype" in
19440 '') case "$d_select" in
19441         $define)
19442                 echo " "
19443                 $cat <<EOM
19444 Checking to see what type of arguments are accepted by select().
19445 EOM
19446                 hdrs="$define sys/types.h
19447                         $i_systime sys/time.h 
19448                         $i_sysselct sys/select.h
19449                         $d_socket sys/socket.h"
19450                 : The first arg can be int, unsigned, or size_t
19451                 : The last arg may or may not be 'const'
19452                 val=''
19453                 : void pointer has been seen but using that
19454                 : breaks the selectminbits test
19455                 for xxx in 'fd_set *' 'int *'; do
19456                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19457                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19458                                         case "$val" in
19459                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19460                                                 if ./protochk "$try" $hdrs; then
19461                                                         echo "Your system accepts $xxx."
19462                                                         val="$xxx"
19463                                                 fi
19464                                                 ;;
19465                                         esac
19466                                 done
19467                         done
19468                 done
19469                 case "$val" in
19470                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19471                         case "$d_fd_set" in
19472                                 $define) dflt="fd_set *" ;;
19473                                 *)              dflt="int *" ;;
19474                         esac
19475                         . ./myread
19476                         val=$ans
19477                         ;;
19478                 esac
19479                 selecttype="$val"
19480                 ;;
19481         *)      : no select, so pick a harmless default
19482                 selecttype='int *'
19483                 ;;
19484         esac
19485         ;;
19486 esac
19487
19488 : check for the select 'width'
19489 case "$selectminbits" in
19490 '') safebits=`expr $ptrsize \* 8`
19491     case "$d_select" in
19492         $define)
19493                 $cat <<EOM
19494
19495 Checking to see on how many bits at a time your select() operates...
19496 EOM
19497                 $cat >try.c <<EOCP
19498 #include <sys/types.h>
19499 #$i_time I_TIME
19500 #$i_systime I_SYS_TIME
19501 #$i_systimek I_SYS_TIME_KERNEL
19502 #ifdef I_TIME
19503 #   include <time.h>
19504 #endif
19505 #ifdef I_SYS_TIME
19506 #   ifdef I_SYS_TIME_KERNEL
19507 #       define KERNEL
19508 #   endif
19509 #   include <sys/time.h>
19510 #   ifdef I_SYS_TIME_KERNEL
19511 #       undef KERNEL
19512 #   endif
19513 #endif
19514 #$i_sysselct I_SYS_SELECT
19515 #ifdef I_SYS_SELECT
19516 #include <sys/select.h>
19517 #endif
19518 #$d_socket HAS_SOCKET
19519 #ifdef HAS_SOCKET
19520 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19521 #endif
19522 #include <stdio.h>
19523 #$i_stdlib I_STDLIB
19524 #ifdef I_STDLIB
19525 #include <stdlib.h>
19526 #endif
19527 $selecttype b;
19528 #define S sizeof(*(b))
19529 #define MINBITS 64
19530 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19531 #define NBITS  (NBYTES * 8)
19532 int main() {
19533     char *s = malloc(NBYTES);
19534     struct timeval t;
19535     int i;
19536     FILE* fp;
19537     int fd;
19538
19539     if (!s)
19540         exit(1);
19541     fclose(stdin);
19542     fp = fopen("try.c", "r");
19543     if (fp == 0)
19544       exit(2);
19545     fd = fileno(fp);
19546     if (fd < 0)
19547       exit(3);
19548     b = ($selecttype)s;
19549     for (i = 0; i < NBITS; i++)
19550         FD_SET(i, b);
19551     t.tv_sec  = 0;
19552     t.tv_usec = 0;
19553     select(fd + 1, b, 0, 0, &t);
19554     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19555     free(s);
19556     printf("%d\n", i + 1);
19557     return 0;
19558 }
19559 EOCP
19560                 set try
19561                 if eval $compile_ok; then
19562                         selectminbits=`$run ./try`
19563                         case "$selectminbits" in
19564                         '')     cat >&4 <<EOM
19565 Cannot figure out on how many bits at a time your select() operates.
19566 I'll play safe and guess it is $safebits bits.
19567 EOM
19568                                 selectminbits=$safebits
19569                                 bits="$safebits bits"
19570                                 ;;
19571                         1)      bits="1 bit" ;;
19572                         *)      bits="$selectminbits bits" ;;
19573                         esac
19574                         echo "Your select() operates on $bits at a time." >&4
19575                 else
19576                         rp='What is the minimum number of bits your select() operates on?'
19577                         case "$byteorder" in
19578                         12345678)       dflt=64 ;;
19579                         1234)           dflt=32 ;;
19580                         *)              dflt=1  ;;
19581                         esac
19582                         . ./myread
19583                         val=$ans
19584                         selectminbits="$val"
19585                 fi
19586                 $rm -f try.* try
19587                 ;;
19588         *)      : no select, so pick a harmless default
19589                 selectminbits=$safebits
19590                 ;;
19591         esac
19592         ;;
19593 esac
19594
19595 : Trace out the files included by signal.h, then look for SIGxxx names.
19596 : Remove SIGARRAYSIZE used by HPUX.
19597 : Remove SIGSTKSIZE used by Linux.
19598 : Remove SIGSTKSZ used by Posix.
19599 : Remove SIGTYP void lines used by OS2.
19600 : Some cpps, like os390, dont give the file name anywhere
19601 if [ "X$fieldn" = X ]; then
19602         : Just make some guesses.  We check them later.
19603         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19604 else
19605         xxx=`echo '#include <signal.h>' |
19606         $cppstdin $cppminus $cppflags 2>/dev/null |
19607         $grep '^[       ]*#.*include' | 
19608         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19609 fi
19610 : Check this list of files to be sure we have parsed the cpp output ok.
19611 : This will also avoid potentially non-existent files, such 
19612 : as ../foo/bar.h
19613 xxxfiles=''
19614 for xx in $xxx /dev/null ; do
19615         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19616 done
19617 : If we have found no files, at least try signal.h
19618 case "$xxxfiles" in
19619 '')     xxxfiles=`./findhdr signal.h` ;;
19620 esac
19621 xxx=`awk '
19622 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19623         print substr($2, 4, 20)
19624 }
19625 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19626         print substr($3, 4, 20)
19627 }' $xxxfiles`
19628 : Append some common names just in case the awk scan failed.
19629 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19630 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19631 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19632 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19633 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19634
19635 : generate a few handy files for later
19636 $cat > signal.c <<EOCP
19637 #include <sys/types.h>
19638 #include <signal.h>
19639 #$i_stdlib I_STDLIB
19640 #ifdef I_STDLIB
19641 #include <stdlib.h>
19642 #endif
19643 #include <stdio.h>
19644 int main() {
19645
19646 /* Strange style to avoid deeply-nested #if/#else/#endif */
19647 #ifndef NSIG
19648 #  ifdef _NSIG
19649 #    define NSIG (_NSIG)
19650 #  endif
19651 #endif
19652
19653 #ifndef NSIG
19654 #  ifdef SIGMAX
19655 #    define NSIG (SIGMAX+1)
19656 #  endif
19657 #endif
19658
19659 #ifndef NSIG
19660 #  ifdef SIG_MAX
19661 #    define NSIG (SIG_MAX+1)
19662 #  endif
19663 #endif
19664
19665 #ifndef NSIG
19666 #  ifdef _SIG_MAX
19667 #    define NSIG (_SIG_MAX+1)
19668 #  endif
19669 #endif
19670
19671 #ifndef NSIG
19672 #  ifdef MAXSIG
19673 #    define NSIG (MAXSIG+1)
19674 #  endif
19675 #endif
19676
19677 #ifndef NSIG
19678 #  ifdef MAX_SIG
19679 #    define NSIG (MAX_SIG+1)
19680 #  endif
19681 #endif
19682
19683 #ifndef NSIG
19684 #  ifdef SIGARRAYSIZE
19685 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19686 #  endif
19687 #endif
19688
19689 #ifndef NSIG
19690 #  ifdef _sys_nsig
19691 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19692 #  endif
19693 #endif
19694
19695 /* Default to some arbitrary number that's big enough to get most
19696    of the common signals.
19697 */
19698 #ifndef NSIG
19699 #    define NSIG 50
19700 #endif
19701
19702 printf("NSIG %d\n", NSIG);
19703
19704 #ifndef JUST_NSIG
19705
19706 EOCP
19707
19708 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19709 {
19710         printf "#ifdef SIG"; printf $1; printf "\n"
19711         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19712         printf $1; printf ");\n"
19713         printf "#endif\n"
19714 }
19715 END {
19716         printf "#endif /* JUST_NSIG */\n";
19717         printf "exit(0);\n}\n";
19718 }
19719 ' >>signal.c
19720 $cat >signal.awk <<'EOP'
19721 BEGIN { ndups = 0 }
19722 $1 ~ /^NSIG$/ { nsig = $2 }
19723 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19724     if ($2 > maxsig) { maxsig = $2 }
19725     if (sig_name[$2]) {
19726         dup_name[ndups] = $1
19727         dup_num[ndups] = $2
19728         ndups++ 
19729     }
19730     else {
19731         sig_name[$2] = $1
19732         sig_num[$2] = $2
19733     }
19734 }
19735 END { 
19736     if (nsig == 0) {
19737         nsig = maxsig + 1
19738     }
19739     printf("NSIG %d\n", nsig);
19740     for (n = 1; n < nsig; n++) {
19741         if (sig_name[n]) {
19742             printf("%s %d\n", sig_name[n], sig_num[n])
19743         }
19744         else {
19745             printf("NUM%d %d\n", n, n) 
19746         }
19747     }
19748     for (n = 0; n < ndups; n++) {
19749         printf("%s %d\n", dup_name[n], dup_num[n])
19750     }
19751 }
19752 EOP
19753 $cat >signal_cmd <<EOS
19754 $startsh
19755 if $test -s signal.lst; then
19756     echo "Using your existing signal.lst file"
19757         exit 0
19758 fi
19759 xxx="$xxx"
19760 EOS
19761 $cat >>signal_cmd <<'EOS'
19762
19763 set signal
19764 if eval $compile_ok; then
19765         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19766 else
19767         echo "(I can't seem be able to compile the whole test program)" >&4
19768         echo "(I'll try it in little pieces.)" >&4
19769         set signal -DJUST_NSIG
19770         if eval $compile_ok; then
19771                 $run ./signal$_exe > signal.nsg
19772                 $cat signal.nsg
19773         else
19774                 echo "I can't seem to figure out how many signals you have." >&4
19775                 echo "Guessing 50." >&4
19776                 echo 'NSIG 50' > signal.nsg
19777         fi
19778         : Now look at all the signal names, one at a time.
19779         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19780                 $cat > signal.c <<EOCP
19781 #include <sys/types.h>
19782 #include <signal.h>
19783 #include <stdio.h>
19784 int main() {
19785 printf("$xx %d\n", SIG${xx});
19786 return 0;
19787 }
19788 EOCP
19789                 set signal
19790                 if eval $compile; then
19791                         echo "SIG${xx} found."
19792                         $run ./signal$_exe  >> signal.ls1
19793                 else
19794                         echo "SIG${xx} NOT found."
19795                 fi
19796         done
19797         if $test -s signal.ls1; then
19798                 $cat signal.nsg signal.ls1 |
19799                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19800         fi
19801
19802 fi
19803 if $test -s signal.lst; then
19804         :
19805 else
19806         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19807         echo 'kill -l' >signal
19808         set X `csh -f <signal`
19809         $rm -f signal
19810         shift
19811         case $# in
19812         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19813         esac
19814         echo $@ | $tr ' ' $trnl | \
19815             $awk '{ printf "%s %d\n", $1, ++s; }
19816                   END { printf "NSIG %d\n", ++s }' >signal.lst
19817 fi
19818 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19819 EOS
19820 chmod a+x signal_cmd
19821 $eunicefix signal_cmd
19822
19823 : generate list of signal names
19824 echo " "
19825 case "$sig_name_init" in
19826 '') doinit=yes ;;
19827 *)  case "$sig_num_init" in
19828     ''|*,*) doinit=yes ;;
19829     esac ;;
19830 esac
19831 case "$doinit" in
19832 yes)
19833         echo "Generating a list of signal names and numbers..." >&4
19834         . ./signal_cmd
19835         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19836         sig_name=`$awk 'BEGIN { printf "ZERO " }
19837                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19838         sig_num=`$awk  'BEGIN { printf "0 " }
19839                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19840         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19841                              !/^NSIG/   { printf "\"%s\", ", $1 }
19842                              END        { printf "0\n" }' signal.lst`
19843         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19844                              !/^NSIG/   { printf "%d, ", $2}
19845                              END        { printf "0\n"}' signal.lst`
19846         ;;
19847 esac
19848 echo "The following $sig_count signals are available:"
19849 echo " "
19850 echo $sig_name | $awk \
19851 'BEGIN { linelen = 0 }
19852 {
19853         for (i = 1; i <= NF; i++) {
19854                 name = "SIG" $i " "
19855                 linelen = linelen + length(name)
19856                 if (linelen > 70) {
19857                         printf "\n"
19858                         linelen = length(name)
19859                 }
19860                 printf "%s", name
19861         }
19862         printf "\n"
19863 }'
19864 sig_size=`echo $sig_name | awk '{print NF}'`
19865 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19866
19867 echo " "
19868 case "$sizetype" in
19869 *_t) zzz="$sizetype"    ;;
19870 *)   zzz="filesize"     ;;
19871 esac
19872 echo "Checking the size of $zzz..." >&4 
19873 cat > try.c <<EOCP
19874 #include <sys/types.h>
19875 #include <stdio.h>
19876 #$i_stdlib I_STDLIB
19877 #ifdef I_STDLIB
19878 #include <stdlib.h>
19879 #endif
19880 int main() {
19881     printf("%d\n", (int)sizeof($sizetype));
19882     exit(0);
19883 }
19884 EOCP
19885 set try
19886 if eval $compile_ok; then
19887         yyy=`$run ./try`
19888         case "$yyy" in
19889         '')     sizesize=4
19890                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19891                 ;;
19892         *)      sizesize=$yyy
19893                 echo "Your $zzz size is $sizesize bytes."
19894                 ;;
19895         esac
19896 else
19897         sizesize=4
19898         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19899 fi
19900
19901
19902 : check for socklen_t
19903 echo " "
19904 echo "Checking to see if you have socklen_t..." >&4
19905 $cat >try.c <<EOCP
19906 #include <sys/types.h>
19907 #$d_socket HAS_SOCKET
19908 #ifdef HAS_SOCKET
19909 #include <sys/socket.h>
19910 #endif
19911 int main() { socklen_t x = 16; }
19912 EOCP
19913 set try
19914 if eval $compile; then
19915         val="$define"
19916         echo "You have socklen_t."
19917 else
19918         val="$undef"
19919         echo "You do not have socklen_t."
19920         case "$sizetype" in
19921         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19922         esac
19923 fi
19924 $rm -f try try.*
19925 set d_socklen_t
19926 eval $setvar
19927
19928 : see if this is a socks.h system
19929 set socks.h i_socks
19930 eval $inhdr
19931
19932 : check for type of the size argument to socket calls
19933 case "$d_socket" in
19934 "$define")
19935         $cat <<EOM
19936
19937 Checking to see what type is the last argument of accept().
19938 EOM
19939         yyy=''
19940         case "$d_socklen_t" in
19941         "$define") yyy="$yyy socklen_t"
19942         esac
19943         yyy="$yyy $sizetype int long unsigned"
19944         for xxx in $yyy; do
19945                 case "$socksizetype" in
19946                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19947                         case "$usesocks" in
19948                         "$define")
19949                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19950                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19951                                         socksizetype="$xxx"
19952                                 fi
19953                                 ;;
19954                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19955                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19956                                         socksizetype="$xxx"
19957                                 fi
19958                                 ;;
19959                         esac
19960                         ;;
19961                 esac
19962         done
19963 : In case none of those worked, prompt the user.
19964         case "$socksizetype" in
19965         '')     rp='What is the type for socket address structure sizes?'
19966                 dflt='int'
19967                 . ./myread
19968                 socksizetype=$ans
19969                 ;;
19970         esac
19971         ;;
19972 *)      : no sockets, so pick relatively harmless default
19973         socksizetype='int'
19974         ;;
19975 esac
19976
19977 : see what type is used for signed size_t
19978 set ssize_t ssizetype int stdio.h sys/types.h
19979 eval $typedef
19980 dflt="$ssizetype"
19981 $cat > try.c <<EOM
19982 #include <stdio.h>
19983 #$i_stdlib I_STDLIB
19984 #ifdef I_STDLIB
19985 #include <stdlib.h>
19986 #endif
19987 #include <sys/types.h>
19988 #define Size_t $sizetype
19989 #define SSize_t $dflt
19990 int main()
19991 {
19992         if (sizeof(Size_t) == sizeof(SSize_t))
19993                 printf("$dflt\n");
19994         else if (sizeof(Size_t) == sizeof(int))
19995                 printf("int\n");
19996         else 
19997                 printf("long\n");
19998         exit(0);
19999 }
20000 EOM
20001 echo " "
20002 set try
20003 if eval $compile_ok && $run ./try > /dev/null; then
20004         ssizetype=`$run ./try`
20005         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20006 else
20007         $cat >&4 <<EOM
20008 Help! I can't compile and run the ssize_t test program: please enlighten me!
20009 (This is probably a misconfiguration in your system or libraries, and
20010 you really ought to fix it.  Still, I'll try anyway.)
20011
20012 I need a type that is the same size as $sizetype, but is guaranteed to
20013 be signed.  Common values are ssize_t, int and long.
20014
20015 EOM
20016         rp="What signed type is the same size as $sizetype?"
20017         . ./myread
20018         ssizetype="$ans"
20019 fi
20020 $rm -f try try.*
20021
20022 : see what type of char stdio uses.
20023 echo " "
20024 echo '#include <stdio.h>' > stdio.c
20025 $cppstdin $cppminus < stdio.c > stdioh
20026 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20027         echo "Your stdio uses unsigned chars." >&4
20028         stdchar="unsigned char"
20029 else
20030         echo "Your stdio uses signed chars." >&4
20031         stdchar="char"
20032 fi
20033 $rm -f stdio.* stdioh
20034
20035 : see what type uids are declared as in the kernel
20036 echo " "
20037 echo "Looking for the type for user ids returned by getuid()."
20038 set uid_t uidtype xxx stdio.h sys/types.h
20039 eval $typedef
20040 case "$uidtype" in
20041 xxx)
20042         xxx=`./findhdr sys/user.h`
20043         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20044         case $1 in
20045         unsigned) dflt="$1 $2" ;;
20046         *) dflt="$1" ;;
20047         esac
20048         ;;
20049 *) dflt="$uidtype";;
20050 esac
20051 case "$uidtype" in
20052 uid_t)  echo "uid_t found." ;;
20053 *)      rp="What is the type for user ids returned by getuid()?"
20054         . ./myread
20055         uidtype="$ans"
20056         ;;
20057 esac
20058
20059 echo " "
20060 case "$uidtype" in
20061 *_t) zzz="$uidtype"     ;;
20062 *)   zzz="uid"          ;;
20063 esac
20064 echo "Checking the size of $zzz..." >&4 
20065 cat > try.c <<EOCP
20066 #include <sys/types.h>
20067 #include <stdio.h>
20068 #$i_stdlib I_STDLIB
20069 #ifdef I_STDLIB
20070 #include <stdlib.h>
20071 #endif
20072 int main() {
20073     printf("%d\n", (int)sizeof($uidtype));
20074     exit(0);
20075 }
20076 EOCP
20077 set try
20078 if eval $compile_ok; then
20079         yyy=`$run ./try`
20080         case "$yyy" in
20081         '')     uidsize=4
20082                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20083                 ;;
20084         *)      uidsize=$yyy
20085                 echo "Your $zzz is $uidsize bytes long."
20086                 ;;
20087         esac
20088 else
20089         uidsize=4
20090         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20091 fi
20092
20093 echo " "
20094 case "$uidtype" in
20095 *_t) zzz="$uidtype"     ;;
20096 *)   zzz="uid"          ;;
20097 esac
20098 echo "Checking the sign of $zzz..." >&4
20099 cat > try.c <<EOCP
20100 #include <sys/types.h>
20101 #include <stdio.h>
20102 int main() {
20103         $uidtype foo = -1;
20104         if (foo < 0)
20105                 printf("-1\n");
20106         else
20107                 printf("1\n");
20108 }
20109 EOCP
20110 set try
20111 if eval $compile; then
20112         yyy=`$run ./try`
20113         case "$yyy" in
20114         '')     uidsign=1
20115                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20116                 ;;
20117         *)      uidsign=$yyy
20118                 case "$uidsign" in
20119                  1) echo "Your $zzz is unsigned." ;;
20120                 -1) echo "Your $zzz is signed."   ;;
20121                 esac
20122                 ;;
20123         esac
20124 else
20125         uidsign=1
20126         echo "(I can't compile the test program--guessing unsigned.)" >&4
20127 fi
20128
20129
20130
20131 echo " "
20132 $echo "Checking the format string to be used for uids..." >&4
20133
20134 case "$uidsign" in
20135 -1)     if $test X"$uidsize" = X"$ivsize"; then
20136                 uidformat="$ivdformat"
20137         else
20138                 if $test X"$uidsize" = X"$longsize"; then
20139                         uidformat='"ld"'
20140                 else
20141                         if $test X"$uidsize" = X"$intsize"; then
20142                                 uidformat='"d"'
20143                         else
20144                                 if $test X"$uidsize" = X"$shortsize"; then
20145                                         uidformat='"hd"'
20146                                 fi
20147                         fi
20148                 fi
20149         fi
20150         ;;
20151 *)      if $test X"$uidsize" = X"$uvsize"; then
20152                 uidformat="$uvuformat"
20153         else
20154                 if $test X"$uidsize" = X"$longsize"; then
20155                         uidformat='"lu"'
20156                 else
20157                         if $test X"$uidsize" = X"$intsize"; then
20158                                 uidformat='"u"'
20159                         else
20160                                 if $test X"$uidsize" = X"$shortsize"; then
20161                                         uidformat='"hu"'
20162                                 fi
20163                         fi
20164                 fi
20165         fi
20166         ;;
20167 esac
20168
20169
20170 case "$usesitecustomize" in
20171     $define|true|[Yy]*)
20172         usesitecustomize="$define"
20173         ;;
20174     *)
20175         usesitecustomize="$undef"
20176         ;;
20177     esac
20178
20179 : determine compiler compiler
20180 case "$yacc" in
20181 '')
20182         dflt=yacc;;
20183 *)
20184         dflt="$yacc";;
20185 esac
20186 echo " "
20187 comp='yacc'
20188 if $test -f "$byacc$_exe"; then
20189         dflt="$byacc"
20190         comp="byacc or $comp"
20191 fi
20192 if $test -f "$bison$_exe"; then
20193         comp="$comp or bison -y"
20194 fi
20195 rp="Which compiler compiler ($comp) shall I use?"
20196 . ./myread
20197 yacc="$ans"
20198 case "$yacc" in
20199 *bis*)
20200         case "$yacc" in
20201         *-y*) ;;
20202         *)
20203                 yacc="$yacc -y"
20204                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20205                 ;;
20206         esac
20207         ;;
20208 esac
20209
20210 : see if this is a fp.h system
20211 set fp.h i_fp
20212 eval $inhdr
20213
20214 : see if this is a fp_class.h system
20215 set fp_class.h i_fp_class
20216 eval $inhdr
20217
20218 : see if this is a ieeefp.h system
20219 case "$i_ieeefp" in
20220 '' ) set ieeefp.h i_ieeefp
20221      eval $inhdr
20222      ;;
20223 esac
20224
20225 : see if this is a libutil.h system
20226 set libutil.h i_libutil
20227 eval $inhdr
20228
20229 : see if mach cthreads are available
20230 if test "X$usethreads" = "X$define"; then
20231         set mach/cthreads.h i_machcthr
20232         eval $inhdr
20233 else
20234         i_machcthr="$undef"
20235 fi
20236
20237
20238
20239 : see if this is a mntent.h system
20240 set mntent.h i_mntent
20241 eval $inhdr
20242
20243 : see if ndbm.h is available
20244 set ndbm.h t_ndbm
20245 eval $inhdr
20246
20247 case "$t_ndbm" in
20248 $undef)
20249     # Some Linux distributions such as RedHat 7.1 put the
20250     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20251     if $test -f /usr/include/gdbm/ndbm.h; then
20252         echo '<gdbm/ndbm.h> found.'
20253         ccflags="$ccflags -I/usr/include/gdbm"
20254         cppflags="$cppflags -I/usr/include/gdbm"
20255         t_ndbm=$define
20256     fi
20257     ;;
20258 esac
20259
20260 case "$t_ndbm" in
20261 $define)
20262         : see if dbm_open exists
20263         set dbm_open d_dbm_open
20264         eval $inlibc
20265         case "$d_dbm_open" in
20266         $undef)
20267                 t_ndbm="$undef"
20268                 echo "We won't be including <ndbm.h>"
20269                 ;;
20270         esac
20271         ;;
20272 esac
20273 val="$t_ndbm"
20274 set i_ndbm
20275 eval $setvar
20276
20277 : see if net/errno.h is available
20278 val=''
20279 set net/errno.h val
20280 eval $inhdr
20281
20282 : Unfortunately, it causes problems on some systems.  Arrgh.
20283 case "$val" in
20284 $define)
20285         cat > try.c <<'EOM'
20286 #include <stdio.h>
20287 #include <errno.h>
20288 #include <net/errno.h>
20289 int func()
20290 {
20291         return ENOTSOCK;
20292 }
20293 EOM
20294         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20295                 echo "We'll be including <net/errno.h>." >&4
20296         else
20297                 echo "We won't be including <net/errno.h>." >&4
20298                 val="$undef"
20299         fi
20300         $rm -f try.* try
20301         ;;
20302 esac
20303 set i_neterrno
20304 eval $setvar
20305
20306 : see if netinet/tcp.h is available
20307 set netinet/tcp.h i_netinettcp
20308 eval $inhdr
20309
20310 : see if this is a poll.h system
20311 set poll.h i_poll
20312 eval $inhdr
20313
20314 : see if this is a prot.h system
20315 set prot.h i_prot
20316 eval $inhdr
20317
20318 echo " "
20319 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20320 $cat <<'EOSH' > Cppsym.know
20321 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20322 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20323 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20324 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20325 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20326 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20327 bull c cadmus clipper CMU COFF COMPILER_VERSION
20328 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20329 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20330 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20331 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20332 GLIBC GLIBC_MINOR
20333 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20334 H3050R H3050RX hbullx20 hcx host_mips
20335 hp200 hp300 hp700 HP700 hp800 hp9000
20336 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20337 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20338 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20339 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20340 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20341 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20342 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20343 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20344 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20345 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20346 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20347 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20348 MATH_HAS_NO_SIDE_EFFECTS
20349 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20350 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20351 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20352 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20353 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20354 NetBSD news1500 news1700 news1800 news1900 news3700
20355 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20356 ns32016 ns32332 ns32k nsc32000
20357 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20358 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20359 pc532 pdp11 PGC PIC plexus PORTAR posix
20360 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20361 POSIX_C_SOURCE POSIX_SOURCE POWER
20362 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20363 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20364 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20365 sony sony_news sonyrisc sparc sparclite spectrum
20366 stardent stdc STDC_EXT stratos sun sun3 sun386
20367 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20368 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20369 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20370 sysV68 sysV88 Tek4132 Tek4300 titan
20371 TM3200 TM5400 TM5600
20372 tower tower32 tower32_200 tower32_600 tower32_700
20373 tower32_800 tower32_850 tss
20374 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20375 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20376 unix UNIX95 UNIX99 unixpc unos
20377 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20378 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20379 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20380 USGr4 USGr4_2
20381 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20382 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20383 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20384 z8000
20385 EOSH
20386 # Maybe put other stuff here too.
20387 cat <<EOSH >>Cppsym.know
20388 $osname
20389 EOSH
20390 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20391 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20392 $cat Cppsym.know > Cppsym.c
20393 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20394 $rm -f Cppsym.a Cppsym.b Cppsym.c
20395 cat <<EOSH > Cppsym
20396 $startsh
20397 if $test \$# -gt 0; then
20398     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20399     if $test -s Cppsym.got; then
20400         $rm -f Cppsym.got
20401         exit 0
20402     fi
20403     $rm -f Cppsym.got
20404     exit 1
20405 else
20406     $tr " " "$trnl" | ./Cppsym.try
20407     exit 0
20408 fi
20409 EOSH
20410 chmod +x Cppsym
20411 $eunicefix Cppsym
20412 cat <<EOSH > Cppsym.try
20413 $startsh
20414 cat <<'EOCP' > try.c
20415 #include <stdio.h>
20416 #if cpp_stuff == 1
20417 #define STRINGIFY(a)    "a"
20418 #endif
20419 #if cpp_stuff == 42
20420 #define StGiFy(a)  #a
20421 #define STRINGIFY(a)    StGiFy(a)
20422 #endif
20423 #if $cpp_stuff != 1 && $cpp_stuff != 42
20424 #   include "Bletch: How does this C preprocessor stringify macros?"
20425 #endif
20426 int main() {
20427 EOCP
20428 $awk \\
20429 EOSH
20430 cat <<'EOSH' >> Cppsym.try
20431 'length($1) > 0 {
20432     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20433     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20434     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20435     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20436 }'       >> try.c
20437 echo 'return 0;}' >> try.c
20438 EOSH
20439 cat <<EOSH >> Cppsym.try
20440 ccflags="$ccflags"
20441 case "$osname-$gccversion" in
20442 irix-) ccflags="\$ccflags -woff 1178" ;;
20443 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20444 esac
20445 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20446 EOSH
20447 chmod +x Cppsym.try
20448 $eunicefix Cppsym.try
20449 ./Cppsym < Cppsym.know > Cppsym.true
20450 : Add in any linux cpp "predefined macros":
20451 case "$osname::$gccversion" in
20452   *linux*::*.*)
20453     tHdrH=_tmpHdr
20454     rm -f $tHdrH'.h' $tHdrH
20455     touch $tHdrH'.h'
20456     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20457        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20458        if [ -s $tHdrH'_cppsym.real' ]; then
20459           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20460        fi
20461     fi
20462     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20463   ;;
20464 esac
20465 : now check the C compiler for additional symbols
20466 postprocess_cc_v=''
20467 case "$osname" in
20468 aix) postprocess_cc_v="|$tr , ' '" ;;
20469 esac
20470 $cat >ccsym <<EOS
20471 $startsh
20472 $cat >tmp.c <<EOF
20473 extern int foo;
20474 EOF
20475 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20476 do
20477         case "\$i" in
20478         -D*) echo "\$i" | $sed 's/^-D//';;
20479         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20480         esac
20481 done
20482 $rm -f try.c
20483 EOS
20484 postprocess_cc_v=''
20485 chmod +x ccsym
20486 $eunicefix ccsym
20487 ./ccsym > ccsym1.raw
20488 if $test -s ccsym1.raw; then
20489        $sort ccsym1.raw | $uniq >ccsym.raw
20490 else
20491        mv ccsym1.raw ccsym.raw
20492 fi
20493
20494 $awk '/\=/ { print $0; next }
20495         { print $0"=1" }' ccsym.raw >ccsym.list
20496 $comm -13 Cppsym.true ccsym.list >ccsym.own
20497 $comm -12 Cppsym.true ccsym.list >ccsym.com
20498 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20499 also=''
20500 if $test -z ccsym.raw; then
20501         echo "Your C compiler doesn't seem to define any symbols!" >&4
20502         echo " "
20503         echo "However, your C preprocessor defines the following symbols:"
20504         $cat Cppsym.true
20505         ccsymbols=''
20506         cppsymbols=`$cat Cppsym.true`
20507         cppsymbols=`echo $cppsymbols`
20508         cppccsymbols="$cppsymbols"
20509 else
20510         if $test -s ccsym.com; then
20511                 echo "Your C compiler and pre-processor define these symbols:"
20512                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20513                 also='also '
20514                 symbols='ones'
20515                 cppccsymbols=`$cat ccsym.com`
20516                 cppccsymbols=`echo $cppccsymbols`
20517                 $test "$silent" || sleep 1
20518         fi
20519         if $test -s ccsym.cpp; then
20520                 $test "$also" && echo " "
20521                 echo "Your C pre-processor ${also}defines the following symbols:"
20522                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20523                 also='further '
20524                 cppsymbols=`$cat ccsym.cpp`
20525                 cppsymbols=`echo $cppsymbols`
20526                 $test "$silent" || sleep 1
20527         fi
20528         if $test -s ccsym.own; then
20529                 $test "$also" && echo " "
20530                 echo "Your C compiler ${also}defines the following cpp symbols:"
20531                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20532                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20533                 ccsymbols=`$cat ccsym.own`
20534                 ccsymbols=`echo $ccsymbols`
20535                 $test "$silent" || sleep 1
20536         fi
20537 fi
20538
20539 : see if this is a termio system
20540 val="$undef"
20541 val2="$undef"
20542 val3="$undef"
20543 if $test `./findhdr termios.h`; then
20544         set tcsetattr i_termios
20545         eval $inlibc
20546         val3="$i_termios"
20547 fi
20548 echo " "
20549 case "$val3" in
20550 "$define") echo "You have POSIX termios.h... good!" >&4;;
20551 *) if ./Cppsym pyr; then
20552                 case "`/bin/universe`" in
20553                 ucb) if $test `./findhdr sgtty.h`; then
20554                                 val2="$define"
20555                                 echo "<sgtty.h> found." >&4
20556                         else
20557                                 echo "System is pyramid with BSD universe."
20558                                 echo "<sgtty.h> not found--you could have problems." >&4
20559                         fi;;
20560                 *) if $test `./findhdr termio.h`; then
20561                                 val="$define"
20562                                 echo "<termio.h> found." >&4
20563                         else
20564                                 echo "System is pyramid with USG universe."
20565                                 echo "<termio.h> not found--you could have problems." >&4
20566                         fi;;
20567                 esac
20568         elif ./usg; then
20569                 if $test `./findhdr termio.h`; then
20570                         echo "<termio.h> found." >&4
20571                         val="$define"
20572                 elif $test `./findhdr sgtty.h`; then
20573                         echo "<sgtty.h> found." >&4
20574                         val2="$define"
20575                 else
20576 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20577                 fi
20578         else
20579                 if $test `./findhdr sgtty.h`; then
20580                         echo "<sgtty.h> found." >&4
20581                         val2="$define"
20582                 elif $test `./findhdr termio.h`; then
20583                         echo "<termio.h> found." >&4
20584                         val="$define"
20585                 else
20586 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20587                 fi
20588         fi;;
20589 esac
20590 set i_termio; eval $setvar
20591 val=$val2; set i_sgtty; eval $setvar
20592 val=$val3; set i_termios; eval $setvar
20593
20594 : see if stddef is available
20595 set stddef.h i_stddef
20596 eval $inhdr
20597
20598 : see if this is a sunmath.h system
20599 set sunmath.h i_sunmath
20600 eval $inhdr
20601
20602 : see if sys/access.h is available
20603 set sys/access.h i_sysaccess
20604 eval $inhdr
20605
20606 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20607 set sys/filio.h i_sysfilio
20608 eval $inhdr
20609 echo " "
20610 if $test `./findhdr sys/ioctl.h`; then
20611         val="$define"
20612         echo '<sys/ioctl.h> found.' >&4
20613 else
20614         val="$undef"
20615         if $test $i_sysfilio = "$define"; then
20616             echo '<sys/ioctl.h> NOT found.' >&4
20617         else
20618                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20619                 $test $i_termio = "$define" && xxx="termio.h"
20620                 $test $i_termios = "$define" && xxx="termios.h"
20621 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20622         fi
20623 fi
20624 set i_sysioctl
20625 eval $setvar
20626
20627 : see if socket ioctl defs are in sys/sockio.h
20628 echo " "
20629 xxx=`./findhdr sys/sockio.h`
20630 if $test "$xxx"; then
20631         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20632                 val="$define"
20633                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20634         else
20635                 val="$undef"
20636                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20637         fi
20638 else
20639         val="$undef"
20640         $cat <<EOM
20641 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20642 EOM
20643 fi
20644 set i_syssockio
20645 eval $setvar
20646
20647
20648 : see if this is a syslog.h system
20649 set syslog.h i_syslog
20650 eval $inhdr
20651
20652
20653 : see if this is a sys/mode.h system
20654 set sys/mode.h i_sysmode
20655 eval $inhdr
20656
20657 : see if sys/resource.h has to be included
20658 set sys/resource.h i_sysresrc
20659 eval $inhdr
20660
20661 : see if sys/security.h is available
20662 set sys/security.h i_syssecrt
20663 eval $inhdr
20664
20665 : see if this is a sys/statvfs.h system
20666 set sys/statvfs.h i_sysstatvfs
20667 eval $inhdr
20668
20669 : see if this is a sys/un.h system
20670 set sys/un.h i_sysun
20671 eval $inhdr
20672
20673
20674 : see if this is a sys/utsname.h system
20675 set sys/utsname.h i_sysutsname
20676 eval $inhdr
20677
20678 : see if this is a syswait system
20679 set sys/wait.h i_syswait
20680 eval $inhdr
20681
20682 : see if this is a ustat.h system
20683 set ustat.h i_ustat
20684 eval $inhdr
20685
20686 : see if this is an utime system
20687 set utime.h i_utime
20688 eval $inhdr
20689
20690 : see if this is a values.h system
20691 set values.h i_values
20692 eval $inhdr
20693
20694 : see if this is a vfork system
20695 case "$d_vfork" in
20696 "$define")
20697         set vfork.h i_vfork
20698         eval $inhdr
20699         ;;
20700 *)
20701         i_vfork="$undef"
20702         ;;
20703 esac
20704
20705 : see if gdbm.h is available
20706 set gdbm.h t_gdbm
20707 eval $inhdr
20708 case "$t_gdbm" in
20709 $define)
20710         : see if gdbm_open exists
20711         set gdbm_open d_gdbm_open
20712         eval $inlibc
20713         case "$d_gdbm_open" in
20714         $undef)
20715                 t_gdbm="$undef"
20716                 echo "We won't be including <gdbm.h>"
20717                 ;;
20718         esac
20719         ;;
20720 esac
20721 val="$t_gdbm"
20722 set i_gdbm
20723 eval $setvar
20724
20725 echo " "
20726 echo "Looking for extensions..." >&4
20727 : If we are using the old config.sh, known_extensions may contain
20728 : old or inaccurate or duplicate values.
20729 known_extensions=''
20730 nonxs_extensions=''
20731 : We do not use find because it might not be available.
20732 : We do not just use MANIFEST because the user may have dropped
20733 : some additional extensions into the source tree and expect them
20734 : to be built.
20735
20736 : Function to recursively find available extensions, ignoring DynaLoader
20737 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20738 find_extensions='
20739     for xxx in *; do
20740        case "$xxx" in
20741            DynaLoader|dynaload) ;;
20742            *)
20743            if $test -f $xxx/$xxx.xs; then
20744                known_extensions="$known_extensions $1$xxx";
20745            elif $test -f $xxx/Makefile.PL; then
20746                nonxs_extensions="$nonxs_extensions $1$xxx";
20747            else
20748                if $test -d $xxx -a $# -lt 10; then
20749                    set $1$xxx/ $*;
20750                    cd "$xxx";
20751                    eval $find_extensions;
20752                    cd ..;
20753                    shift;
20754                fi;
20755            fi
20756            ;;
20757        esac;
20758     done'
20759 tdir=`pwd`
20760 cd "$rsrc/ext"
20761 set X
20762 shift
20763 eval $find_extensions
20764 # Special case:  Add in threads/shared since it is not picked up by the
20765 # recursive find above (and adding in general recursive finding breaks
20766 # SDBM_File/sdbm).  A.D.  10/25/2001.
20767 known_extensions="$known_extensions threads/shared"
20768 set X $nonxs_extensions
20769 shift
20770 nonxs_extensions="$*"
20771 set X $known_extensions
20772 shift
20773 known_extensions="$*"
20774 cd "$tdir"
20775
20776 : Now see which are supported on this system.
20777 avail_ext=''
20778 for xxx in $known_extensions ; do
20779         case "$xxx" in
20780         DB_File|db_file)
20781                 case "$i_db" in
20782                 $define) avail_ext="$avail_ext $xxx" ;;
20783                 esac
20784                 ;;
20785         GDBM_File|gdbm_fil)
20786                 case "$i_gdbm" in 
20787                 $define) avail_ext="$avail_ext $xxx" ;;
20788                 esac
20789                 ;;
20790         I18N/Langinfo|i18n_lan)
20791                 case "$i_langinfo$d_nl_langinfo" in 
20792                 $define$define) avail_ext="$avail_ext $xxx" ;;
20793                 esac
20794                 ;;
20795         NDBM_File|ndbm_fil)
20796                 case "$i_ndbm" in
20797                 $define)
20798                     case "$osname-$use64bitint" in
20799                     hpux-define)
20800                         case "$libs" in
20801                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20802                         esac
20803                         ;;
20804                     *) avail_ext="$avail_ext $xxx" ;;
20805                     esac
20806                     ;;
20807                 esac
20808                 ;;
20809         ODBM_File|odbm_fil) 
20810                 case "${i_dbm}${i_rpcsvcdbm}" in
20811                 *"${define}"*)
20812                     case "$osname-$use64bitint" in
20813                     hpux-define)
20814                         case "$libs" in
20815                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20816                         esac
20817                         ;;
20818                     *) avail_ext="$avail_ext $xxx" ;;
20819                     esac
20820                     ;;
20821                 esac
20822                 ;;
20823         POSIX|posix)
20824                 case "$useposix" in
20825                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20826                 esac
20827                 ;;
20828         Opcode|opcode)
20829                 case "$useopcode" in
20830                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20831                 esac
20832                 ;;
20833         Socket|socket)
20834                 case "$d_socket" in 
20835                 true|$define|y)
20836                     case "$osname" in
20837                     beos) ;; # not unless BONE
20838                     *) avail_ext="$avail_ext $xxx" ;;
20839                     esac
20840                     ;;
20841                 esac
20842                 ;;
20843         Sys/Syslog|sys/syslog)
20844                 : XXX syslog requires socket
20845                 case "$d_socket" in 
20846                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20847                 esac
20848                 ;;
20849         Thread|thread)
20850                 case "$usethreads" in
20851                 true|$define|y)
20852                         case "$useithreads" in
20853                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20854                         esac
20855                 esac
20856                 ;;
20857         XS/APItest|xs/apitest)
20858                 # This is just for testing.  Skip it unless we have dynamic loading.
20859
20860                 case "$usedl" in
20861                 $define) avail_ext="$avail_ext $xxx" ;;
20862                 esac
20863                 ;;
20864         XS/Typemap|xs/typemap)
20865                 # This is just for testing.  Skip it unless we have dynamic loading.
20866                 case "$usedl" in
20867                 $define) avail_ext="$avail_ext $xxx" ;;
20868                 esac
20869                 ;;
20870         threads|threads/shared)
20871                 # threads and threads::shared are special cases.
20872                 # To stop people from asking "Perl 5.8.0 was supposed
20873                 # to have this new fancy threads implementation but my
20874                 # perl doesn't have it" and from people trying to
20875                 # (re)install the threads module using CPAN.pm and
20876                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20877                 # the threads.pm and threads/shared.pm will always be
20878                 # there, croaking informatively ("you need to rebuild
20879                 # all of Perl with threads, sorry") when threads haven't
20880                 # been compiled in.
20881                 # --jhi
20882                 avail_ext="$avail_ext $xxx"
20883                 ;;
20884         IPC/SysV|ipc/sysv)
20885                 : XXX Do we need a useipcsysv variable here
20886                 case "${d_msg}${d_sem}${d_shm}" in 
20887                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20888                 esac
20889                 ;;
20890         *)      avail_ext="$avail_ext $xxx"
20891                 ;;
20892         esac
20893 done
20894
20895 set X $avail_ext
20896 shift
20897 avail_ext="$*"
20898
20899 case "$onlyextensions" in
20900 '') ;;
20901 *)  keepextensions=''
20902     echo "You have requested that only certains extensions be included..." >&4
20903     for i in $onlyextensions; do
20904         case " $avail_ext " in
20905         *" $i "*)
20906             echo "Keeping extension $i."
20907             keepextensions="$keepextensions $i"
20908             ;;
20909         *) echo "Ignoring extension $i." ;;
20910         esac
20911     done
20912     avail_ext="$keepextensions"
20913     ;;
20914 esac
20915
20916 case "$noextensions" in
20917 '') ;;
20918 *)  keepextensions=''
20919     echo "You have requested that certain extensions be ignored..." >&4
20920     for i in $avail_ext; do
20921         case " $noextensions " in
20922         *" $i "*) echo "Ignoring extension $i." ;;
20923         *) echo "Keeping extension $i.";
20924            keepextensions="$keepextensions $i"
20925            ;;
20926         esac
20927     done
20928     avail_ext="$keepextensions"
20929     ;;
20930 esac
20931
20932 : Now see which nonxs extensions are supported on this system.
20933 : For now assume all are.
20934 nonxs_ext=''
20935 for xxx in $nonxs_extensions ; do
20936         case "$xxx" in
20937         *)      nonxs_ext="$nonxs_ext $xxx"
20938                 ;;
20939         esac
20940 done
20941
20942 set X $nonxs_ext
20943 shift
20944 nonxs_ext="$*"
20945
20946 case $usedl in
20947 $define)
20948         $cat <<EOM
20949 A number of extensions are supplied with $package.  You may choose to
20950 compile these extensions for dynamic loading (the default), compile
20951 them into the $package executable (static loading), or not include
20952 them at all.  Answer "none" to include no extensions.
20953 Note that DynaLoader is always built and need not be mentioned here.
20954
20955 EOM
20956         case "$dynamic_ext" in
20957         '')
20958                 : Exclude those listed in static_ext
20959                 dflt=''
20960                 for xxx in $avail_ext; do
20961                         case " $static_ext " in
20962                         *" $xxx "*) ;;
20963                         *) dflt="$dflt $xxx" ;;
20964                         esac
20965                 done
20966                 set X $dflt
20967                 shift
20968                 dflt="$*"
20969                 ;;
20970         *)      dflt="$dynamic_ext"
20971                 # Perhaps we are reusing an old out-of-date config.sh.
20972                 case "$hint" in
20973                 previous)
20974                         if test X"$dynamic_ext" != X"$avail_ext"; then
20975                                 $cat <<EOM
20976 NOTICE:  Your previous config.sh list may be incorrect. 
20977 The extensions now available to you are 
20978         ${avail_ext}
20979 but the default list from your previous config.sh is
20980         ${dynamic_ext} 
20981
20982 EOM
20983                         fi
20984                         ;;
20985                 esac
20986                 ;;
20987         esac
20988         case "$dflt" in
20989         '')     dflt=none;;
20990         esac
20991         rp="What extensions do you wish to load dynamically?"
20992         . ./myread
20993         case "$ans" in
20994         none) dynamic_ext=' ' ;;
20995         *) dynamic_ext="$ans" ;;
20996         esac
20997
20998         case "$static_ext" in
20999         '')
21000                 : Exclude those already listed in dynamic linking
21001                 dflt=''
21002                 for xxx in $avail_ext; do
21003                         case " $dynamic_ext " in
21004                         *" $xxx "*) ;;
21005                         *) dflt="$dflt $xxx" ;;
21006                         esac
21007                 done
21008                 set X $dflt
21009                 shift
21010                 dflt="$*"
21011                 ;;
21012         *)  dflt="$static_ext" 
21013                 ;;
21014         esac
21015
21016         case "$dflt" in
21017         '')     dflt=none;;
21018         esac
21019         rp="What extensions do you wish to load statically?"
21020         . ./myread
21021         case "$ans" in
21022         none) static_ext=' ' ;;
21023         *) static_ext="$ans" ;;
21024         esac
21025         ;;
21026 *)
21027         $cat <<EOM
21028 A number of extensions are supplied with $package.  Answer "none" 
21029 to include no extensions. 
21030 Note that DynaLoader is always built and need not be mentioned here.
21031
21032 EOM
21033         case "$static_ext" in
21034         '') dflt="$avail_ext" ;;
21035         *)      dflt="$static_ext"
21036                 # Perhaps we are reusing an old out-of-date config.sh.
21037                 case "$hint" in
21038                 previous)
21039                         if test X"$static_ext" != X"$avail_ext"; then
21040                                 $cat <<EOM
21041 NOTICE:  Your previous config.sh list may be incorrect. 
21042 The extensions now available to you are 
21043         ${avail_ext}
21044 but the default list from your previous config.sh is
21045         ${static_ext} 
21046
21047 EOM
21048                         fi
21049                         ;;
21050                 esac
21051                 ;;
21052         esac
21053         : Exclude those that are not xs extensions
21054         case "$dflt" in
21055         '')     dflt=none;;
21056         esac
21057         rp="What extensions do you wish to include?"
21058         . ./myread
21059         case "$ans" in
21060         none) static_ext=' ' ;;
21061         *) static_ext="$ans" ;;
21062         esac
21063         ;;
21064 esac
21065 #        
21066 # Encode is a special case.  If we are building Encode as a static
21067 # extension, we need to explicitly list its subextensions as well.
21068 # For other nested extensions, this is handled automatically by
21069 # the appropriate Makefile.PL.
21070 case " $static_ext " in
21071         *" Encode "*) # Add the subextensions of Encode
21072         cd "$rsrc/ext"
21073         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21074                 static_ext="$static_ext Encode/$xxx"
21075         done
21076         cd "$tdir"
21077         ;;
21078 esac
21079
21080 set X $dynamic_ext $static_ext $nonxs_ext
21081 shift
21082 extensions="$*"
21083
21084 # Sanity check:  We require an extension suitable for use with
21085 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21086 # should show up as failures in the test suite, but it's helpful to
21087 # catch them now.) The 'extensions' list is normally sorted
21088 # alphabetically, so we need to accept either
21089 #    DB_File ... Fcntl ... IO  ....
21090 # or something like
21091 #    Fcntl ... NDBM_File ... IO  ....
21092 case " $extensions"  in
21093 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21094 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21095 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21096 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21097    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21098    ;;
21099 esac
21100
21101 : Remove libraries needed only for extensions
21102 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21103 : The exception is SunOS 4.x, which needs them.
21104 case "${osname}X${osvers}" in
21105 sunos*X4*)
21106     perllibs="$libs"
21107     ;;
21108 *) case "$usedl" in
21109     $define|true|[yY]*)
21110             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21111             shift
21112             perllibs="$*"
21113             ;;
21114     *)  perllibs="$libs"
21115             ;;
21116     esac
21117     ;;
21118 esac
21119
21120 : Remove build directory name from cppstdin so it can be used from
21121 : either the present location or the final installed location.
21122 echo " "
21123 : Get out of the UU directory to get correct path name.
21124 cd ..
21125 case "$cppstdin" in
21126 `pwd`/cppstdin)
21127         echo "Stripping down cppstdin path name"
21128         cppstdin=cppstdin
21129         ;;
21130 esac
21131 cd UU
21132
21133 : end of configuration questions
21134 echo " "
21135 echo "End of configuration questions."
21136 echo " "
21137
21138 : back to where it started
21139 if test -d ../UU; then
21140         cd ..
21141 fi
21142
21143 : configuration may be patched via a 'config.arch' file
21144 if $test -f config.arch; then
21145         echo "I see a config.arch file, loading it."
21146         . ./config.arch
21147 fi
21148
21149 : configuration may be patched via a 'config.over' file
21150 if $test -f config.over; then
21151         echo " "
21152         dflt=y
21153         rp='I see a config.over file.  Do you wish to load it?'
21154         . UU/myread
21155         case "$ans" in
21156         n*) echo "OK, I'll ignore it.";;
21157         *)      . ./config.over
21158                 echo "Configuration override changes have been loaded."
21159                 ;;
21160         esac
21161 fi
21162
21163 : in case they want portability, strip down executable paths
21164 case "$d_portable" in
21165 "$define")
21166         echo " "
21167         echo "Stripping down executable paths..." >&4
21168         for file in $loclist $trylist; do
21169                 eval temp=\$$file
21170                 eval $file=`basename $temp`
21171         done
21172         ;;
21173 esac
21174
21175 : create config.sh file
21176 echo " "
21177 echo "Creating config.sh..." >&4
21178 $spitshell <<EOT >config.sh
21179 $startsh
21180 #
21181 # This file was produced by running the Configure script. It holds all the
21182 # definitions figured out by Configure. Should you modify one of these values,
21183 # do not forget to propagate your changes by running "Configure -der". You may
21184 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21185 #
21186
21187 # Package name      : $package
21188 # Source directory  : $src
21189 # Configuration time: $cf_time
21190 # Configured by     : $cf_by
21191 # Target system     : $myuname
21192
21193 Author='$Author'
21194 Date='$Date'
21195 Header='$Header'
21196 Id='$Id'
21197 Locker='$Locker'
21198 Log='$Log'
21199 Mcc='$Mcc'
21200 RCSfile='$RCSfile'
21201 Revision='$Revision'
21202 Source='$Source'
21203 State='$State'
21204 _a='$_a'
21205 _exe='$_exe'
21206 _o='$_o'
21207 afs='$afs'
21208 afsroot='$afsroot'
21209 alignbytes='$alignbytes'
21210 ansi2knr='$ansi2knr'
21211 aphostname='$aphostname'
21212 api_revision='$api_revision'
21213 api_subversion='$api_subversion'
21214 api_version='$api_version'
21215 api_versionstring='$api_versionstring'
21216 ar='$ar'
21217 archlib='$archlib'
21218 archlibexp='$archlibexp'
21219 archname64='$archname64'
21220 archname='$archname'
21221 archobjs='$archobjs'
21222 asctime_r_proto='$asctime_r_proto'
21223 awk='$awk'
21224 baserev='$baserev'
21225 bash='$bash'
21226 bin='$bin'
21227 binexp='$binexp'
21228 bison='$bison'
21229 byacc='$byacc'
21230 byteorder='$byteorder'
21231 c='$c'
21232 castflags='$castflags'
21233 cat='$cat'
21234 cc='$cc'
21235 cccdlflags='$cccdlflags'
21236 ccdlflags='$ccdlflags'
21237 ccflags='$ccflags'
21238 ccflags_uselargefiles='$ccflags_uselargefiles'
21239 ccname='$ccname'
21240 ccsymbols='$ccsymbols'
21241 ccversion='$ccversion'
21242 cf_by='$cf_by'
21243 cf_email='$cf_email'
21244 cf_time='$cf_time'
21245 charsize='$charsize'
21246 chgrp='$chgrp'
21247 chmod='$chmod'
21248 chown='$chown'
21249 clocktype='$clocktype'
21250 comm='$comm'
21251 compress='$compress'
21252 contains='$contains'
21253 cp='$cp'
21254 cpio='$cpio'
21255 cpp='$cpp'
21256 cpp_stuff='$cpp_stuff'
21257 cppccsymbols='$cppccsymbols'
21258 cppflags='$cppflags'
21259 cpplast='$cpplast'
21260 cppminus='$cppminus'
21261 cpprun='$cpprun'
21262 cppstdin='$cppstdin'
21263 cppsymbols='$cppsymbols'
21264 crypt_r_proto='$crypt_r_proto'
21265 cryptlib='$cryptlib'
21266 csh='$csh'
21267 ctermid_r_proto='$ctermid_r_proto'
21268 ctime_r_proto='$ctime_r_proto'
21269 d_Gconvert='$d_Gconvert'
21270 d_PRIEUldbl='$d_PRIEUldbl'
21271 d_PRIFUldbl='$d_PRIFUldbl'
21272 d_PRIGUldbl='$d_PRIGUldbl'
21273 d_PRIXU64='$d_PRIXU64'
21274 d_PRId64='$d_PRId64'
21275 d_PRIeldbl='$d_PRIeldbl'
21276 d_PRIfldbl='$d_PRIfldbl'
21277 d_PRIgldbl='$d_PRIgldbl'
21278 d_PRIi64='$d_PRIi64'
21279 d_PRIo64='$d_PRIo64'
21280 d_PRIu64='$d_PRIu64'
21281 d_PRIx64='$d_PRIx64'
21282 d_SCNfldbl='$d_SCNfldbl'
21283 d__fwalk='$d__fwalk'
21284 d_access='$d_access'
21285 d_accessx='$d_accessx'
21286 d_aintl='$d_aintl'
21287 d_alarm='$d_alarm'
21288 d_archlib='$d_archlib'
21289 d_asctime_r='$d_asctime_r'
21290 d_atolf='$d_atolf'
21291 d_atoll='$d_atoll'
21292 d_attribute_format='$d_attribute_format'
21293 d_attribute_malloc='$d_attribute_malloc'
21294 d_attribute_nonnull='$d_attribute_nonnull'
21295 d_attribute_noreturn='$d_attribute_noreturn'
21296 d_attribute_pure='$d_attribute_pure'
21297 d_attribute_unused='$d_attribute_unused'
21298 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21299 d_bcmp='$d_bcmp'
21300 d_bcopy='$d_bcopy'
21301 d_bsd='$d_bsd'
21302 d_bsdgetpgrp='$d_bsdgetpgrp'
21303 d_bsdsetpgrp='$d_bsdsetpgrp'
21304 d_builtin_choose_expr='$d_builtin_choose_expr'
21305 d_builtin_expect='$d_builtin_expect'
21306 d_bzero='$d_bzero'
21307 d_c99_variadic_macros='$d_c99_variadic_macros'
21308 d_casti32='$d_casti32'
21309 d_castneg='$d_castneg'
21310 d_charvspr='$d_charvspr'
21311 d_chown='$d_chown'
21312 d_chroot='$d_chroot'
21313 d_chsize='$d_chsize'
21314 d_class='$d_class'
21315 d_clearenv='$d_clearenv'
21316 d_closedir='$d_closedir'
21317 d_cmsghdr_s='$d_cmsghdr_s'
21318 d_const='$d_const'
21319 d_copysignl='$d_copysignl'
21320 d_crypt='$d_crypt'
21321 d_crypt_r='$d_crypt_r'
21322 d_csh='$d_csh'
21323 d_ctermid_r='$d_ctermid_r'
21324 d_ctime_r='$d_ctime_r'
21325 d_cuserid='$d_cuserid'
21326 d_dbl_dig='$d_dbl_dig'
21327 d_dbminitproto='$d_dbminitproto'
21328 d_difftime='$d_difftime'
21329 d_dirfd='$d_dirfd'
21330 d_dirnamlen='$d_dirnamlen'
21331 d_dlerror='$d_dlerror'
21332 d_dlopen='$d_dlopen'
21333 d_dlsymun='$d_dlsymun'
21334 d_dosuid='$d_dosuid'
21335 d_drand48_r='$d_drand48_r'
21336 d_drand48proto='$d_drand48proto'
21337 d_dup2='$d_dup2'
21338 d_eaccess='$d_eaccess'
21339 d_endgrent='$d_endgrent'
21340 d_endgrent_r='$d_endgrent_r'
21341 d_endhent='$d_endhent'
21342 d_endhostent_r='$d_endhostent_r'
21343 d_endnent='$d_endnent'
21344 d_endnetent_r='$d_endnetent_r'
21345 d_endpent='$d_endpent'
21346 d_endprotoent_r='$d_endprotoent_r'
21347 d_endpwent='$d_endpwent'
21348 d_endpwent_r='$d_endpwent_r'
21349 d_endsent='$d_endsent'
21350 d_endservent_r='$d_endservent_r'
21351 d_eofnblk='$d_eofnblk'
21352 d_eunice='$d_eunice'
21353 d_faststdio='$d_faststdio'
21354 d_fchdir='$d_fchdir'
21355 d_fchmod='$d_fchmod'
21356 d_fchown='$d_fchown'
21357 d_fcntl='$d_fcntl'
21358 d_fcntl_can_lock='$d_fcntl_can_lock'
21359 d_fd_macros='$d_fd_macros'
21360 d_fd_set='$d_fd_set'
21361 d_fds_bits='$d_fds_bits'
21362 d_fgetpos='$d_fgetpos'
21363 d_finite='$d_finite'
21364 d_finitel='$d_finitel'
21365 d_flexfnam='$d_flexfnam'
21366 d_flock='$d_flock'
21367 d_flockproto='$d_flockproto'
21368 d_fork='$d_fork'
21369 d_fp_class='$d_fp_class'
21370 d_fpathconf='$d_fpathconf'
21371 d_fpclass='$d_fpclass'
21372 d_fpclassify='$d_fpclassify'
21373 d_fpclassl='$d_fpclassl'
21374 d_fpos64_t='$d_fpos64_t'
21375 d_frexpl='$d_frexpl'
21376 d_fs_data_s='$d_fs_data_s'
21377 d_fseeko='$d_fseeko'
21378 d_fsetpos='$d_fsetpos'
21379 d_fstatfs='$d_fstatfs'
21380 d_fstatvfs='$d_fstatvfs'
21381 d_fsync='$d_fsync'
21382 d_ftello='$d_ftello'
21383 d_ftime='$d_ftime'
21384 d_futimes='$d_futimes'
21385 d_getcwd='$d_getcwd'
21386 d_getespwnam='$d_getespwnam'
21387 d_getfsstat='$d_getfsstat'
21388 d_getgrent='$d_getgrent'
21389 d_getgrent_r='$d_getgrent_r'
21390 d_getgrgid_r='$d_getgrgid_r'
21391 d_getgrnam_r='$d_getgrnam_r'
21392 d_getgrps='$d_getgrps'
21393 d_gethbyaddr='$d_gethbyaddr'
21394 d_gethbyname='$d_gethbyname'
21395 d_gethent='$d_gethent'
21396 d_gethname='$d_gethname'
21397 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21398 d_gethostbyname_r='$d_gethostbyname_r'
21399 d_gethostent_r='$d_gethostent_r'
21400 d_gethostprotos='$d_gethostprotos'
21401 d_getitimer='$d_getitimer'
21402 d_getlogin='$d_getlogin'
21403 d_getlogin_r='$d_getlogin_r'
21404 d_getmnt='$d_getmnt'
21405 d_getmntent='$d_getmntent'
21406 d_getnbyaddr='$d_getnbyaddr'
21407 d_getnbyname='$d_getnbyname'
21408 d_getnent='$d_getnent'
21409 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21410 d_getnetbyname_r='$d_getnetbyname_r'
21411 d_getnetent_r='$d_getnetent_r'
21412 d_getnetprotos='$d_getnetprotos'
21413 d_getpagsz='$d_getpagsz'
21414 d_getpbyname='$d_getpbyname'
21415 d_getpbynumber='$d_getpbynumber'
21416 d_getpent='$d_getpent'
21417 d_getpgid='$d_getpgid'
21418 d_getpgrp2='$d_getpgrp2'
21419 d_getpgrp='$d_getpgrp'
21420 d_getppid='$d_getppid'
21421 d_getprior='$d_getprior'
21422 d_getprotobyname_r='$d_getprotobyname_r'
21423 d_getprotobynumber_r='$d_getprotobynumber_r'
21424 d_getprotoent_r='$d_getprotoent_r'
21425 d_getprotoprotos='$d_getprotoprotos'
21426 d_getprpwnam='$d_getprpwnam'
21427 d_getpwent='$d_getpwent'
21428 d_getpwent_r='$d_getpwent_r'
21429 d_getpwnam_r='$d_getpwnam_r'
21430 d_getpwuid_r='$d_getpwuid_r'
21431 d_getsbyname='$d_getsbyname'
21432 d_getsbyport='$d_getsbyport'
21433 d_getsent='$d_getsent'
21434 d_getservbyname_r='$d_getservbyname_r'
21435 d_getservbyport_r='$d_getservbyport_r'
21436 d_getservent_r='$d_getservent_r'
21437 d_getservprotos='$d_getservprotos'
21438 d_getspnam='$d_getspnam'
21439 d_getspnam_r='$d_getspnam_r'
21440 d_gettimeod='$d_gettimeod'
21441 d_gmtime_r='$d_gmtime_r'
21442 d_gnulibc='$d_gnulibc'
21443 d_grpasswd='$d_grpasswd'
21444 d_hasmntopt='$d_hasmntopt'
21445 d_htonl='$d_htonl'
21446 d_ilogbl='$d_ilogbl'
21447 d_inc_version_list='$d_inc_version_list'
21448 d_index='$d_index'
21449 d_inetaton='$d_inetaton'
21450 d_int64_t='$d_int64_t'
21451 d_isascii='$d_isascii'
21452 d_isfinite='$d_isfinite'
21453 d_isinf='$d_isinf'
21454 d_isnan='$d_isnan'
21455 d_isnanl='$d_isnanl'
21456 d_killpg='$d_killpg'
21457 d_lchown='$d_lchown'
21458 d_ldbl_dig='$d_ldbl_dig'
21459 d_libm_lib_version='$d_libm_lib_version'
21460 d_link='$d_link'
21461 d_localtime_r='$d_localtime_r'
21462 d_locconv='$d_locconv'
21463 d_lockf='$d_lockf'
21464 d_longdbl='$d_longdbl'
21465 d_longlong='$d_longlong'
21466 d_lseekproto='$d_lseekproto'
21467 d_lstat='$d_lstat'
21468 d_madvise='$d_madvise'
21469 d_malloc_good_size='$d_malloc_good_size'
21470 d_malloc_size='$d_malloc_size'
21471 d_mblen='$d_mblen'
21472 d_mbstowcs='$d_mbstowcs'
21473 d_mbtowc='$d_mbtowc'
21474 d_memchr='$d_memchr'
21475 d_memcmp='$d_memcmp'
21476 d_memcpy='$d_memcpy'
21477 d_memmove='$d_memmove'
21478 d_memset='$d_memset'
21479 d_mkdir='$d_mkdir'
21480 d_mkdtemp='$d_mkdtemp'
21481 d_mkfifo='$d_mkfifo'
21482 d_mkstemp='$d_mkstemp'
21483 d_mkstemps='$d_mkstemps'
21484 d_mktime='$d_mktime'
21485 d_mmap='$d_mmap'
21486 d_modfl='$d_modfl'
21487 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21488 d_modflproto='$d_modflproto'
21489 d_mprotect='$d_mprotect'
21490 d_msg='$d_msg'
21491 d_msg_ctrunc='$d_msg_ctrunc'
21492 d_msg_dontroute='$d_msg_dontroute'
21493 d_msg_oob='$d_msg_oob'
21494 d_msg_peek='$d_msg_peek'
21495 d_msg_proxy='$d_msg_proxy'
21496 d_msgctl='$d_msgctl'
21497 d_msgget='$d_msgget'
21498 d_msghdr_s='$d_msghdr_s'
21499 d_msgrcv='$d_msgrcv'
21500 d_msgsnd='$d_msgsnd'
21501 d_msync='$d_msync'
21502 d_munmap='$d_munmap'
21503 d_mymalloc='$d_mymalloc'
21504 d_nice='$d_nice'
21505 d_nl_langinfo='$d_nl_langinfo'
21506 d_nv_preserves_uv='$d_nv_preserves_uv'
21507 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21508 d_off64_t='$d_off64_t'
21509 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21510 d_oldpthreads='$d_oldpthreads'
21511 d_oldsock='$d_oldsock'
21512 d_open3='$d_open3'
21513 d_pathconf='$d_pathconf'
21514 d_pause='$d_pause'
21515 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21516 d_phostname='$d_phostname'
21517 d_pipe='$d_pipe'
21518 d_poll='$d_poll'
21519 d_portable='$d_portable'
21520 d_procselfexe='$d_procselfexe'
21521 d_pthread_atfork='$d_pthread_atfork'
21522 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21523 d_pthread_yield='$d_pthread_yield'
21524 d_pwage='$d_pwage'
21525 d_pwchange='$d_pwchange'
21526 d_pwclass='$d_pwclass'
21527 d_pwcomment='$d_pwcomment'
21528 d_pwexpire='$d_pwexpire'
21529 d_pwgecos='$d_pwgecos'
21530 d_pwpasswd='$d_pwpasswd'
21531 d_pwquota='$d_pwquota'
21532 d_qgcvt='$d_qgcvt'
21533 d_quad='$d_quad'
21534 d_random_r='$d_random_r'
21535 d_readdir64_r='$d_readdir64_r'
21536 d_readdir='$d_readdir'
21537 d_readdir_r='$d_readdir_r'
21538 d_readlink='$d_readlink'
21539 d_readv='$d_readv'
21540 d_recvmsg='$d_recvmsg'
21541 d_rename='$d_rename'
21542 d_rewinddir='$d_rewinddir'
21543 d_rmdir='$d_rmdir'
21544 d_safebcpy='$d_safebcpy'
21545 d_safemcpy='$d_safemcpy'
21546 d_sanemcmp='$d_sanemcmp'
21547 d_sbrkproto='$d_sbrkproto'
21548 d_scalbnl='$d_scalbnl'
21549 d_sched_yield='$d_sched_yield'
21550 d_scm_rights='$d_scm_rights'
21551 d_seekdir='$d_seekdir'
21552 d_select='$d_select'
21553 d_sem='$d_sem'
21554 d_semctl='$d_semctl'
21555 d_semctl_semid_ds='$d_semctl_semid_ds'
21556 d_semctl_semun='$d_semctl_semun'
21557 d_semget='$d_semget'
21558 d_semop='$d_semop'
21559 d_sendmsg='$d_sendmsg'
21560 d_setegid='$d_setegid'
21561 d_seteuid='$d_seteuid'
21562 d_setgrent='$d_setgrent'
21563 d_setgrent_r='$d_setgrent_r'
21564 d_setgrps='$d_setgrps'
21565 d_sethent='$d_sethent'
21566 d_sethostent_r='$d_sethostent_r'
21567 d_setitimer='$d_setitimer'
21568 d_setlinebuf='$d_setlinebuf'
21569 d_setlocale='$d_setlocale'
21570 d_setlocale_r='$d_setlocale_r'
21571 d_setnent='$d_setnent'
21572 d_setnetent_r='$d_setnetent_r'
21573 d_setpent='$d_setpent'
21574 d_setpgid='$d_setpgid'
21575 d_setpgrp2='$d_setpgrp2'
21576 d_setpgrp='$d_setpgrp'
21577 d_setprior='$d_setprior'
21578 d_setproctitle='$d_setproctitle'
21579 d_setprotoent_r='$d_setprotoent_r'
21580 d_setpwent='$d_setpwent'
21581 d_setpwent_r='$d_setpwent_r'
21582 d_setregid='$d_setregid'
21583 d_setresgid='$d_setresgid'
21584 d_setresuid='$d_setresuid'
21585 d_setreuid='$d_setreuid'
21586 d_setrgid='$d_setrgid'
21587 d_setruid='$d_setruid'
21588 d_setsent='$d_setsent'
21589 d_setservent_r='$d_setservent_r'
21590 d_setsid='$d_setsid'
21591 d_setvbuf='$d_setvbuf'
21592 d_sfio='$d_sfio'
21593 d_shm='$d_shm'
21594 d_shmat='$d_shmat'
21595 d_shmatprototype='$d_shmatprototype'
21596 d_shmctl='$d_shmctl'
21597 d_shmdt='$d_shmdt'
21598 d_shmget='$d_shmget'
21599 d_sigaction='$d_sigaction'
21600 d_sigprocmask='$d_sigprocmask'
21601 d_sigsetjmp='$d_sigsetjmp'
21602 d_snprintf='$d_snprintf'
21603 d_sitearch='$d_sitearch'
21604 d_sockatmark='$d_sockatmark'
21605 d_sockatmarkproto='$d_sockatmarkproto'
21606 d_socket='$d_socket'
21607 d_socklen_t='$d_socklen_t'
21608 d_sockpair='$d_sockpair'
21609 d_socks5_init='$d_socks5_init'
21610 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21611 d_sqrtl='$d_sqrtl'
21612 d_srand48_r='$d_srand48_r'
21613 d_srandom_r='$d_srandom_r'
21614 d_sresgproto='$d_sresgproto'
21615 d_sresuproto='$d_sresuproto'
21616 d_statblks='$d_statblks'
21617 d_statfs_f_flags='$d_statfs_f_flags'
21618 d_statfs_s='$d_statfs_s'
21619 d_statvfs='$d_statvfs'
21620 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21621 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21622 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21623 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21624 d_stdio_stream_array='$d_stdio_stream_array'
21625 d_stdiobase='$d_stdiobase'
21626 d_stdstdio='$d_stdstdio'
21627 d_strchr='$d_strchr'
21628 d_strcoll='$d_strcoll'
21629 d_strctcpy='$d_strctcpy'
21630 d_strerrm='$d_strerrm'
21631 d_strerror='$d_strerror'
21632 d_strerror_r='$d_strerror_r'
21633 d_strftime='$d_strftime'
21634 d_strlcat='$d_strlcat'
21635 d_strlcpy='$d_strlcpy'
21636 d_strtod='$d_strtod'
21637 d_strtol='$d_strtol'
21638 d_strtold='$d_strtold'
21639 d_strtoll='$d_strtoll'
21640 d_strtoq='$d_strtoq'
21641 d_strtoul='$d_strtoul'
21642 d_strtoull='$d_strtoull'
21643 d_strtouq='$d_strtouq'
21644 d_strxfrm='$d_strxfrm'
21645 d_suidsafe='$d_suidsafe'
21646 d_symlink='$d_symlink'
21647 d_syscall='$d_syscall'
21648 d_syscallproto='$d_syscallproto'
21649 d_sysconf='$d_sysconf'
21650 d_sysernlst='$d_sysernlst'
21651 d_syserrlst='$d_syserrlst'
21652 d_system='$d_system'
21653 d_tcgetpgrp='$d_tcgetpgrp'
21654 d_tcsetpgrp='$d_tcsetpgrp'
21655 d_telldir='$d_telldir'
21656 d_telldirproto='$d_telldirproto'
21657 d_time='$d_time'
21658 d_times='$d_times'
21659 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21660 d_tm_tm_zone='$d_tm_tm_zone'
21661 d_tmpnam_r='$d_tmpnam_r'
21662 d_truncate='$d_truncate'
21663 d_ttyname_r='$d_ttyname_r'
21664 d_tzname='$d_tzname'
21665 d_u32align='$d_u32align'
21666 d_ualarm='$d_ualarm'
21667 d_umask='$d_umask'
21668 d_uname='$d_uname'
21669 d_union_semun='$d_union_semun'
21670 d_unordered='$d_unordered'
21671 d_unsetenv='$d_unsetenv'
21672 d_usleep='$d_usleep'
21673 d_usleepproto='$d_usleepproto'
21674 d_ustat='$d_ustat'
21675 d_vendorarch='$d_vendorarch'
21676 d_vendorbin='$d_vendorbin'
21677 d_vendorlib='$d_vendorlib'
21678 d_vendorscript='$d_vendorscript'
21679 d_vfork='$d_vfork'
21680 d_void_closedir='$d_void_closedir'
21681 d_voidsig='$d_voidsig'
21682 d_voidtty='$d_voidtty'
21683 d_volatile='$d_volatile'
21684 d_vprintf='$d_vprintf'
21685 d_vsnprintf='$d_vsnprintf'
21686 d_wait4='$d_wait4'
21687 d_waitpid='$d_waitpid'
21688 d_wcstombs='$d_wcstombs'
21689 d_wctomb='$d_wctomb'
21690 d_writev='$d_writev'
21691 d_xenix='$d_xenix'
21692 date='$date'
21693 db_hashtype='$db_hashtype'
21694 db_prefixtype='$db_prefixtype'
21695 db_version_major='$db_version_major'
21696 db_version_minor='$db_version_minor'
21697 db_version_patch='$db_version_patch'
21698 defvoidused='$defvoidused'
21699 direntrytype='$direntrytype'
21700 dlext='$dlext'
21701 dlsrc='$dlsrc'
21702 doublesize='$doublesize'
21703 drand01='$drand01'
21704 drand48_r_proto='$drand48_r_proto'
21705 dynamic_ext='$dynamic_ext'
21706 eagain='$eagain'
21707 ebcdic='$ebcdic'
21708 echo='$echo'
21709 egrep='$egrep'
21710 emacs='$emacs'
21711 endgrent_r_proto='$endgrent_r_proto'
21712 endhostent_r_proto='$endhostent_r_proto'
21713 endnetent_r_proto='$endnetent_r_proto'
21714 endprotoent_r_proto='$endprotoent_r_proto'
21715 endpwent_r_proto='$endpwent_r_proto'
21716 endservent_r_proto='$endservent_r_proto'
21717 eunicefix='$eunicefix'
21718 exe_ext='$exe_ext'
21719 expr='$expr'
21720 extensions='$extensions'
21721 extras='$extras'
21722 fflushNULL='$fflushNULL'
21723 fflushall='$fflushall'
21724 find='$find'
21725 firstmakefile='$firstmakefile'
21726 flex='$flex'
21727 fpossize='$fpossize'
21728 fpostype='$fpostype'
21729 freetype='$freetype'
21730 from='$from'
21731 full_ar='$full_ar'
21732 full_csh='$full_csh'
21733 full_sed='$full_sed'
21734 gccansipedantic='$gccansipedantic'
21735 gccosandvers='$gccosandvers'
21736 gccversion='$gccversion'
21737 getgrent_r_proto='$getgrent_r_proto'
21738 getgrgid_r_proto='$getgrgid_r_proto'
21739 getgrnam_r_proto='$getgrnam_r_proto'
21740 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21741 gethostbyname_r_proto='$gethostbyname_r_proto'
21742 gethostent_r_proto='$gethostent_r_proto'
21743 getlogin_r_proto='$getlogin_r_proto'
21744 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21745 getnetbyname_r_proto='$getnetbyname_r_proto'
21746 getnetent_r_proto='$getnetent_r_proto'
21747 getprotobyname_r_proto='$getprotobyname_r_proto'
21748 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21749 getprotoent_r_proto='$getprotoent_r_proto'
21750 getpwent_r_proto='$getpwent_r_proto'
21751 getpwnam_r_proto='$getpwnam_r_proto'
21752 getpwuid_r_proto='$getpwuid_r_proto'
21753 getservbyname_r_proto='$getservbyname_r_proto'
21754 getservbyport_r_proto='$getservbyport_r_proto'
21755 getservent_r_proto='$getservent_r_proto'
21756 getspnam_r_proto='$getspnam_r_proto'
21757 gidformat='$gidformat'
21758 gidsign='$gidsign'
21759 gidsize='$gidsize'
21760 gidtype='$gidtype'
21761 glibpth='$glibpth'
21762 gmake='$gmake'
21763 gmtime_r_proto='$gmtime_r_proto'
21764 gnulibc_version='$gnulibc_version'
21765 grep='$grep'
21766 groupcat='$groupcat'
21767 groupstype='$groupstype'
21768 gzip='$gzip'
21769 h_fcntl='$h_fcntl'
21770 h_sysfile='$h_sysfile'
21771 hint='$hint'
21772 hostcat='$hostcat'
21773 html1dir='$html1dir'
21774 html1direxp='$html1direxp'
21775 html3dir='$html3dir'
21776 html3direxp='$html3direxp'
21777 i16size='$i16size'
21778 i16type='$i16type'
21779 i32size='$i32size'
21780 i32type='$i32type'
21781 i64size='$i64size'
21782 i64type='$i64type'
21783 i8size='$i8size'
21784 i8type='$i8type'
21785 i_arpainet='$i_arpainet'
21786 i_bsdioctl='$i_bsdioctl'
21787 i_crypt='$i_crypt'
21788 i_db='$i_db'
21789 i_dbm='$i_dbm'
21790 i_dirent='$i_dirent'
21791 i_dld='$i_dld'
21792 i_dlfcn='$i_dlfcn'
21793 i_fcntl='$i_fcntl'
21794 i_float='$i_float'
21795 i_fp='$i_fp'
21796 i_fp_class='$i_fp_class'
21797 i_gdbm='$i_gdbm'
21798 i_grp='$i_grp'
21799 i_ieeefp='$i_ieeefp'
21800 i_inttypes='$i_inttypes'
21801 i_langinfo='$i_langinfo'
21802 i_libutil='$i_libutil'
21803 i_limits='$i_limits'
21804 i_locale='$i_locale'
21805 i_machcthr='$i_machcthr'
21806 i_malloc='$i_malloc'
21807 i_math='$i_math'
21808 i_memory='$i_memory'
21809 i_mntent='$i_mntent'
21810 i_ndbm='$i_ndbm'
21811 i_netdb='$i_netdb'
21812 i_neterrno='$i_neterrno'
21813 i_netinettcp='$i_netinettcp'
21814 i_niin='$i_niin'
21815 i_poll='$i_poll'
21816 i_prot='$i_prot'
21817 i_pthread='$i_pthread'
21818 i_pwd='$i_pwd'
21819 i_rpcsvcdbm='$i_rpcsvcdbm'
21820 i_sfio='$i_sfio'
21821 i_sgtty='$i_sgtty'
21822 i_shadow='$i_shadow'
21823 i_socks='$i_socks'
21824 i_stdarg='$i_stdarg'
21825 i_stddef='$i_stddef'
21826 i_stdlib='$i_stdlib'
21827 i_string='$i_string'
21828 i_sunmath='$i_sunmath'
21829 i_sysaccess='$i_sysaccess'
21830 i_sysdir='$i_sysdir'
21831 i_sysfile='$i_sysfile'
21832 i_sysfilio='$i_sysfilio'
21833 i_sysin='$i_sysin'
21834 i_sysioctl='$i_sysioctl'
21835 i_syslog='$i_syslog'
21836 i_sysmman='$i_sysmman'
21837 i_sysmode='$i_sysmode'
21838 i_sysmount='$i_sysmount'
21839 i_sysndir='$i_sysndir'
21840 i_sysparam='$i_sysparam'
21841 i_sysresrc='$i_sysresrc'
21842 i_syssecrt='$i_syssecrt'
21843 i_sysselct='$i_sysselct'
21844 i_syssockio='$i_syssockio'
21845 i_sysstat='$i_sysstat'
21846 i_sysstatfs='$i_sysstatfs'
21847 i_sysstatvfs='$i_sysstatvfs'
21848 i_systime='$i_systime'
21849 i_systimek='$i_systimek'
21850 i_systimes='$i_systimes'
21851 i_systypes='$i_systypes'
21852 i_sysuio='$i_sysuio'
21853 i_sysun='$i_sysun'
21854 i_sysutsname='$i_sysutsname'
21855 i_sysvfs='$i_sysvfs'
21856 i_syswait='$i_syswait'
21857 i_termio='$i_termio'
21858 i_termios='$i_termios'
21859 i_time='$i_time'
21860 i_unistd='$i_unistd'
21861 i_ustat='$i_ustat'
21862 i_utime='$i_utime'
21863 i_values='$i_values'
21864 i_varargs='$i_varargs'
21865 i_varhdr='$i_varhdr'
21866 i_vfork='$i_vfork'
21867 ignore_versioned_solibs='$ignore_versioned_solibs'
21868 inc_version_list='$inc_version_list'
21869 inc_version_list_init='$inc_version_list_init'
21870 incpath='$incpath'
21871 inews='$inews'
21872 initialinstalllocation='$initialinstalllocation'
21873 installarchlib='$installarchlib'
21874 installbin='$installbin'
21875 installhtml1dir='$installhtml1dir'
21876 installhtml3dir='$installhtml3dir'
21877 installman1dir='$installman1dir'
21878 installman3dir='$installman3dir'
21879 installprefix='$installprefix'
21880 installprefixexp='$installprefixexp'
21881 installprivlib='$installprivlib'
21882 installscript='$installscript'
21883 installsitearch='$installsitearch'
21884 installsitebin='$installsitebin'
21885 installsitehtml1dir='$installsitehtml1dir'
21886 installsitehtml3dir='$installsitehtml3dir'
21887 installsitelib='$installsitelib'
21888 installsiteman1dir='$installsiteman1dir'
21889 installsiteman3dir='$installsiteman3dir'
21890 installsitescript='$installsitescript'
21891 installstyle='$installstyle'
21892 installusrbinperl='$installusrbinperl'
21893 installvendorarch='$installvendorarch'
21894 installvendorbin='$installvendorbin'
21895 installvendorhtml1dir='$installvendorhtml1dir'
21896 installvendorhtml3dir='$installvendorhtml3dir'
21897 installvendorlib='$installvendorlib'
21898 installvendorman1dir='$installvendorman1dir'
21899 installvendorman3dir='$installvendorman3dir'
21900 installvendorscript='$installvendorscript'
21901 intsize='$intsize'
21902 issymlink='$issymlink'
21903 ivdformat='$ivdformat'
21904 ivsize='$ivsize'
21905 ivtype='$ivtype'
21906 known_extensions='$known_extensions'
21907 ksh='$ksh'
21908 ld='$ld'
21909 lddlflags='$lddlflags'
21910 ldflags='$ldflags'
21911 ldflags_uselargefiles='$ldflags_uselargefiles'
21912 ldlibpthname='$ldlibpthname'
21913 less='$less'
21914 lib_ext='$lib_ext'
21915 libc='$libc'
21916 libperl='$libperl'
21917 libpth='$libpth'
21918 libs='$libs'
21919 libsdirs='$libsdirs'
21920 libsfiles='$libsfiles'
21921 libsfound='$libsfound'
21922 libspath='$libspath'
21923 libswanted='$libswanted'
21924 libswanted_uselargefiles='$libswanted_uselargefiles'
21925 line='$line'
21926 lint='$lint'
21927 lkflags='$lkflags'
21928 ln='$ln'
21929 lns='$lns'
21930 localtime_r_proto='$localtime_r_proto'
21931 locincpth='$locincpth'
21932 loclibpth='$loclibpth'
21933 longdblsize='$longdblsize'
21934 longlongsize='$longlongsize'
21935 longsize='$longsize'
21936 lp='$lp'
21937 lpr='$lpr'
21938 ls='$ls'
21939 lseeksize='$lseeksize'
21940 lseektype='$lseektype'
21941 mad='$mad'
21942 madlyh='$madlyh'
21943 madlyobj='$madlyobj'
21944 madlysrc='$madlysrc'
21945 mail='$mail'
21946 mailx='$mailx'
21947 make='$make'
21948 make_set_make='$make_set_make'
21949 mallocobj='$mallocobj'
21950 mallocsrc='$mallocsrc'
21951 malloctype='$malloctype'
21952 man1dir='$man1dir'
21953 man1direxp='$man1direxp'
21954 man1ext='$man1ext'
21955 man3dir='$man3dir'
21956 man3direxp='$man3direxp'
21957 man3ext='$man3ext'
21958 mips_type='$mips_type'
21959 mistrustnm='$mistrustnm'
21960 mkdir='$mkdir'
21961 mmaptype='$mmaptype'
21962 modetype='$modetype'
21963 more='$more'
21964 multiarch='$multiarch'
21965 mv='$mv'
21966 myarchname='$myarchname'
21967 mydomain='$mydomain'
21968 myhostname='$myhostname'
21969 myuname='$myuname'
21970 n='$n'
21971 need_va_copy='$need_va_copy'
21972 netdb_hlen_type='$netdb_hlen_type'
21973 netdb_host_type='$netdb_host_type'
21974 netdb_name_type='$netdb_name_type'
21975 netdb_net_type='$netdb_net_type'
21976 nm='$nm'
21977 nm_opt='$nm_opt'
21978 nm_so_opt='$nm_so_opt'
21979 nonxs_ext='$nonxs_ext'
21980 nroff='$nroff'
21981 nvEUformat='$nvEUformat'
21982 nvFUformat='$nvFUformat'
21983 nvGUformat='$nvGUformat'
21984 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21985 nveformat='$nveformat'
21986 nvfformat='$nvfformat'
21987 nvgformat='$nvgformat'
21988 nvsize='$nvsize'
21989 nvtype='$nvtype'
21990 o_nonblock='$o_nonblock'
21991 obj_ext='$obj_ext'
21992 old_pthread_create_joinable='$old_pthread_create_joinable'
21993 optimize='$optimize'
21994 orderlib='$orderlib'
21995 osname='$osname'
21996 osvers='$osvers'
21997 otherlibdirs='$otherlibdirs'
21998 package='$package'
21999 pager='$pager'
22000 passcat='$passcat'
22001 patchlevel='$patchlevel'
22002 path_sep='$path_sep'
22003 perl5='$perl5'
22004 perl='$perl'
22005 perl_patchlevel='$perl_patchlevel'
22006 perladmin='$perladmin'
22007 perllibs='$perllibs'
22008 perlpath='$perlpath'
22009 pg='$pg'
22010 phostname='$phostname'
22011 pidtype='$pidtype'
22012 plibpth='$plibpth'
22013 pmake='$pmake'
22014 pr='$pr'
22015 prefix='$prefix'
22016 prefixexp='$prefixexp'
22017 privlib='$privlib'
22018 privlibexp='$privlibexp'
22019 procselfexe='$procselfexe'
22020 prototype='$prototype'
22021 ptrsize='$ptrsize'
22022 quadkind='$quadkind'
22023 quadtype='$quadtype'
22024 randbits='$randbits'
22025 randfunc='$randfunc'
22026 random_r_proto='$random_r_proto'
22027 randseedtype='$randseedtype'
22028 ranlib='$ranlib'
22029 rd_nodata='$rd_nodata'
22030 readdir64_r_proto='$readdir64_r_proto'
22031 readdir_r_proto='$readdir_r_proto'
22032 revision='$revision'
22033 rm='$rm'
22034 rmail='$rmail'
22035 run='$run'
22036 runnm='$runnm'
22037 sPRIEUldbl='$sPRIEUldbl'
22038 sPRIFUldbl='$sPRIFUldbl'
22039 sPRIGUldbl='$sPRIGUldbl'
22040 sPRIXU64='$sPRIXU64'
22041 sPRId64='$sPRId64'
22042 sPRIeldbl='$sPRIeldbl'
22043 sPRIfldbl='$sPRIfldbl'
22044 sPRIgldbl='$sPRIgldbl'
22045 sPRIi64='$sPRIi64'
22046 sPRIo64='$sPRIo64'
22047 sPRIu64='$sPRIu64'
22048 sPRIx64='$sPRIx64'
22049 sSCNfldbl='$sSCNfldbl'
22050 sched_yield='$sched_yield'
22051 scriptdir='$scriptdir'
22052 scriptdirexp='$scriptdirexp'
22053 sed='$sed'
22054 seedfunc='$seedfunc'
22055 selectminbits='$selectminbits'
22056 selecttype='$selecttype'
22057 sendmail='$sendmail'
22058 setgrent_r_proto='$setgrent_r_proto'
22059 sethostent_r_proto='$sethostent_r_proto'
22060 setlocale_r_proto='$setlocale_r_proto'
22061 setnetent_r_proto='$setnetent_r_proto'
22062 setprotoent_r_proto='$setprotoent_r_proto'
22063 setpwent_r_proto='$setpwent_r_proto'
22064 setservent_r_proto='$setservent_r_proto'
22065 sh='$sh'
22066 shar='$shar'
22067 sharpbang='$sharpbang'
22068 shmattype='$shmattype'
22069 shortsize='$shortsize'
22070 shrpenv='$shrpenv'
22071 shsharp='$shsharp'
22072 sig_count='$sig_count'
22073 sig_name='$sig_name'
22074 sig_name_init='$sig_name_init'
22075 sig_num='$sig_num'
22076 sig_num_init='$sig_num_init'
22077 sig_size='$sig_size'
22078 signal_t='$signal_t'
22079 sitearch='$sitearch'
22080 sitearchexp='$sitearchexp'
22081 sitebin='$sitebin'
22082 sitebinexp='$sitebinexp'
22083 sitehtml1dir='$sitehtml1dir'
22084 sitehtml1direxp='$sitehtml1direxp'
22085 sitehtml3dir='$sitehtml3dir'
22086 sitehtml3direxp='$sitehtml3direxp'
22087 sitelib='$sitelib'
22088 sitelib_stem='$sitelib_stem'
22089 sitelibexp='$sitelibexp'
22090 siteman1dir='$siteman1dir'
22091 siteman1direxp='$siteman1direxp'
22092 siteman3dir='$siteman3dir'
22093 siteman3direxp='$siteman3direxp'
22094 siteprefix='$siteprefix'
22095 siteprefixexp='$siteprefixexp'
22096 sitescript='$sitescript'
22097 sitescriptexp='$sitescriptexp'
22098 sizesize='$sizesize'
22099 sizetype='$sizetype'
22100 sleep='$sleep'
22101 smail='$smail'
22102 so='$so'
22103 sockethdr='$sockethdr'
22104 socketlib='$socketlib'
22105 socksizetype='$socksizetype'
22106 sort='$sort'
22107 spackage='$spackage'
22108 spitshell='$spitshell'
22109 srand48_r_proto='$srand48_r_proto'
22110 srandom_r_proto='$srandom_r_proto'
22111 src='$src'
22112 ssizetype='$ssizetype'
22113 startperl='$startperl'
22114 startsh='$startsh'
22115 static_ext='$static_ext'
22116 stdchar='$stdchar'
22117 stdio_base='$stdio_base'
22118 stdio_bufsiz='$stdio_bufsiz'
22119 stdio_cnt='$stdio_cnt'
22120 stdio_filbuf='$stdio_filbuf'
22121 stdio_ptr='$stdio_ptr'
22122 stdio_stream_array='$stdio_stream_array'
22123 strerror_r_proto='$strerror_r_proto'
22124 strings='$strings'
22125 submit='$submit'
22126 subversion='$subversion'
22127 sysman='$sysman'
22128 tail='$tail'
22129 tar='$tar'
22130 targetarch='$targetarch'
22131 tbl='$tbl'
22132 tee='$tee'
22133 test='$test'
22134 timeincl='$timeincl'
22135 timetype='$timetype'
22136 tmpnam_r_proto='$tmpnam_r_proto'
22137 to='$to'
22138 touch='$touch'
22139 tr='$tr'
22140 trnl='$trnl'
22141 troff='$troff'
22142 ttyname_r_proto='$ttyname_r_proto'
22143 u16size='$u16size'
22144 u16type='$u16type'
22145 u32size='$u32size'
22146 u32type='$u32type'
22147 u64size='$u64size'
22148 u64type='$u64type'
22149 u8size='$u8size'
22150 u8type='$u8type'
22151 uidformat='$uidformat'
22152 uidsign='$uidsign'
22153 uidsize='$uidsize'
22154 uidtype='$uidtype'
22155 uname='$uname'
22156 uniq='$uniq'
22157 uquadtype='$uquadtype'
22158 use5005threads='$use5005threads'
22159 use64bitall='$use64bitall'
22160 use64bitint='$use64bitint'
22161 usecrosscompile='$usecrosscompile'
22162 usedl='$usedl'
22163 usefaststdio='$usefaststdio'
22164 useithreads='$useithreads'
22165 uselargefiles='$uselargefiles'
22166 uselongdouble='$uselongdouble'
22167 usemallocwrap='$usemallocwrap'
22168 usemorebits='$usemorebits'
22169 usemultiplicity='$usemultiplicity'
22170 usemymalloc='$usemymalloc'
22171 usenm='$usenm'
22172 useopcode='$useopcode'
22173 useperlio='$useperlio'
22174 useposix='$useposix'
22175 usereentrant='$usereentrant'
22176 userelocatableinc='$userelocatableinc'
22177 usesfio='$usesfio'
22178 useshrplib='$useshrplib'
22179 usesitecustomize='$usesitecustomize'
22180 usesocks='$usesocks'
22181 usethreads='$usethreads'
22182 usevendorprefix='$usevendorprefix'
22183 usevfork='$usevfork'
22184 usrinc='$usrinc'
22185 uuname='$uuname'
22186 uvXUformat='$uvXUformat'
22187 uvoformat='$uvoformat'
22188 uvsize='$uvsize'
22189 uvtype='$uvtype'
22190 uvuformat='$uvuformat'
22191 uvxformat='$uvxformat'
22192 vendorarch='$vendorarch'
22193 vendorarchexp='$vendorarchexp'
22194 vendorbin='$vendorbin'
22195 vendorbinexp='$vendorbinexp'
22196 vendorhtml1dir='$vendorhtml1dir'
22197 vendorhtml1direxp='$vendorhtml1direxp'
22198 vendorhtml3dir='$vendorhtml3dir'
22199 vendorhtml3direxp='$vendorhtml3direxp'
22200 vendorlib='$vendorlib'
22201 vendorlib_stem='$vendorlib_stem'
22202 vendorlibexp='$vendorlibexp'
22203 vendorman1dir='$vendorman1dir'
22204 vendorman1direxp='$vendorman1direxp'
22205 vendorman3dir='$vendorman3dir'
22206 vendorman3direxp='$vendorman3direxp'
22207 vendorprefix='$vendorprefix'
22208 vendorprefixexp='$vendorprefixexp'
22209 vendorscript='$vendorscript'
22210 vendorscriptexp='$vendorscriptexp'
22211 version='$version'
22212 version_patchlevel_string='$version_patchlevel_string'
22213 versiononly='$versiononly'
22214 vi='$vi'
22215 voidflags='$voidflags'
22216 xlibpth='$xlibpth'
22217 yacc='$yacc'
22218 yaccflags='$yaccflags'
22219 zcat='$zcat'
22220 zip='$zip'
22221 EOT
22222
22223 : Add in command line options if available
22224 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22225
22226 : add special variables
22227 $test -f $src/patchlevel.h && \
22228 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22229 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22230 echo "PERL_CONFIG_SH=true" >>config.sh
22231
22232 : propagate old symbols
22233 if $test -f UU/config.sh; then
22234         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22235         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22236         $sort | $uniq -u >UU/oldsyms
22237         set X `cat UU/oldsyms`
22238         shift
22239         case $# in
22240         0) ;;
22241         *)
22242                 cat <<EOM
22243 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22244 EOM
22245                 echo "# Variables propagated from previous config.sh file." >>config.sh
22246                 for sym in `cat UU/oldsyms`; do
22247                         echo "    Propagating $hint variable "'$'"$sym..."
22248                         eval 'tmp="$'"${sym}"'"'
22249                         echo "$tmp" | \
22250                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22251                 done
22252                 ;;
22253         esac
22254 fi
22255
22256 : Finish up by extracting the .SH files
22257 case "$alldone" in
22258 exit)
22259         $rm -rf UU
22260         echo "Extraction done."
22261         exit 0
22262         ;;
22263 cont)
22264         ;;
22265 '')
22266         dflt=''
22267         nostick=true
22268         $cat <<EOM
22269
22270 If you'd like to make any changes to the config.sh file before I begin
22271 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22272
22273 EOM
22274         rp="Press return or use a shell escape to edit config.sh:"
22275         . UU/myread
22276         nostick=''
22277         case "$ans" in
22278         '') ;;
22279         *) : in case they cannot read
22280                 sh 1>&4 -c "$ans";;
22281         esac
22282         ;;
22283 esac
22284
22285 : if this fails, just run all the .SH files by hand
22286 . ./config.sh
22287
22288 echo " "
22289 exec 1>&4
22290 pwd=`pwd`
22291 . ./UU/extract
22292 cd "$pwd"
22293
22294 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22295         dflt=y
22296         case "$silent" in
22297         true) ;;
22298         *)
22299                 $cat <<EOM
22300
22301 Now you need to generate make dependencies by running "$make depend".
22302 You might prefer to run it in background: "$make depend > makedepend.out &"
22303 It can take a while, so you might not want to run it right now.
22304
22305 EOM
22306                 ;;
22307         esac
22308         rp="Run $make depend now?"
22309         . UU/myread
22310         case "$ans" in
22311         y*)
22312                 $make depend && echo "Now you must run '$make'."
22313                 ;;
22314         *)
22315                 echo "You must run '$make depend' then '$make'."
22316                 ;;
22317         esac
22318 elif test -f [Mm]akefile; then
22319         echo " "
22320         echo "Now you must run a $make."
22321 else
22322         echo "Configure done."
22323 fi
22324
22325 if $test -f Policy.sh; then
22326     $cat <<EOM
22327
22328 If you compile $package on a different machine or from a different object
22329 directory, copy the Policy.sh file from this object directory to the
22330 new one before you run Configure -- this will help you with most of
22331 the policy defaults.
22332
22333 EOM
22334 fi
22335 if $test -f config.msg; then
22336     echo "Hmm.  I also noted the following information while running:"
22337     echo " "
22338     $cat config.msg >&4
22339     $rm -f config.msg
22340 fi
22341 $rm -f kit*isdone ark*isdone
22342 $rm -rf UU
22343
22344 : End of Configure
22345