This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
I'll finally get it right. (thanks to Sadahiro Tomoyuki)
[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 Oct 23 17:35:45 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 d_cplusplus=''
377 cryptlib=''
378 d_crypt=''
379 crypt_r_proto=''
380 d_crypt_r=''
381 d_csh=''
382 full_csh=''
383 d_ctermid=''
384 ctermid_r_proto=''
385 d_ctermid_r=''
386 ctime_r_proto=''
387 d_ctime_r=''
388 d_cuserid=''
389 d_dbl_dig=''
390 d_dbminitproto=''
391 d_difftime=''
392 d_dirfd=''
393 d_dlerror=''
394 d_dlopen=''
395 d_dlsymun=''
396 d_dosuid=''
397 d_suidsafe=''
398 d_drand48_r=''
399 drand48_r_proto=''
400 d_drand48proto=''
401 d_dup2=''
402 d_eaccess=''
403 d_endgrent=''
404 d_endgrent_r=''
405 endgrent_r_proto=''
406 d_endhent=''
407 d_endhostent_r=''
408 endhostent_r_proto=''
409 d_endnent=''
410 d_endnetent_r=''
411 endnetent_r_proto=''
412 d_endpent=''
413 d_endprotoent_r=''
414 endprotoent_r_proto=''
415 d_endpwent=''
416 d_endpwent_r=''
417 endpwent_r_proto=''
418 d_endsent=''
419 d_endservent_r=''
420 endservent_r_proto=''
421 d_faststdio=''
422 d_fchdir=''
423 d_fchmod=''
424 d_fchown=''
425 d_fcntl=''
426 d_fcntl_can_lock=''
427 d_fd_macros=''
428 d_fd_set=''
429 d_fds_bits=''
430 d_fgetpos=''
431 d_finite=''
432 d_finitel=''
433 d_flexfnam=''
434 d_flock=''
435 d_flockproto=''
436 d_fork=''
437 d_fp_class=''
438 d_fpclass=''
439 d_fpclassify=''
440 d_fpclassl=''
441 d_fpos64_t=''
442 d_frexpl=''
443 d_fs_data_s=''
444 d_fseeko=''
445 d_fsetpos=''
446 d_fstatfs=''
447 d_fsync=''
448 d_ftello=''
449 d_ftime=''
450 d_gettimeod=''
451 d_futimes=''
452 d_Gconvert=''
453 d_getcwd=''
454 d_getespwnam=''
455 d_getfsstat=''
456 d_getgrent=''
457 d_getgrent_r=''
458 getgrent_r_proto=''
459 d_getgrgid_r=''
460 getgrgid_r_proto=''
461 d_getgrnam_r=''
462 getgrnam_r_proto=''
463 d_getgrps=''
464 d_gethbyaddr=''
465 d_gethbyname=''
466 d_gethent=''
467 aphostname=''
468 d_gethname=''
469 d_phostname=''
470 d_uname=''
471 d_gethostbyaddr_r=''
472 gethostbyaddr_r_proto=''
473 d_gethostbyname_r=''
474 gethostbyname_r_proto=''
475 d_gethostent_r=''
476 gethostent_r_proto=''
477 d_gethostprotos=''
478 d_getitimer=''
479 d_getlogin=''
480 d_getlogin_r=''
481 getlogin_r_proto=''
482 d_getmnt=''
483 d_getmntent=''
484 d_getnbyaddr=''
485 d_getnbyname=''
486 d_getnent=''
487 d_getnetbyaddr_r=''
488 getnetbyaddr_r_proto=''
489 d_getnetbyname_r=''
490 getnetbyname_r_proto=''
491 d_getnetent_r=''
492 getnetent_r_proto=''
493 d_getnetprotos=''
494 d_getpagsz=''
495 d_getpent=''
496 d_getpgid=''
497 d_getpgrp2=''
498 d_bsdgetpgrp=''
499 d_getpgrp=''
500 d_getppid=''
501 d_getprior=''
502 d_getpbyname=''
503 d_getpbynumber=''
504 d_getprotobyname_r=''
505 getprotobyname_r_proto=''
506 d_getprotobynumber_r=''
507 getprotobynumber_r_proto=''
508 d_getprotoent_r=''
509 getprotoent_r_proto=''
510 d_getprotoprotos=''
511 d_getprpwnam=''
512 d_getpwent=''
513 d_getpwent_r=''
514 getpwent_r_proto=''
515 d_getpwnam_r=''
516 getpwnam_r_proto=''
517 d_getpwuid_r=''
518 getpwuid_r_proto=''
519 d_getsent=''
520 d_getservbyname_r=''
521 getservbyname_r_proto=''
522 d_getservbyport_r=''
523 getservbyport_r_proto=''
524 d_getservent_r=''
525 getservent_r_proto=''
526 d_getservprotos=''
527 d_getspnam=''
528 d_getspnam_r=''
529 getspnam_r_proto=''
530 d_getsbyname=''
531 d_getsbyport=''
532 d_gmtime_r=''
533 gmtime_r_proto=''
534 d_gnulibc=''
535 gnulibc_version=''
536 d_hasmntopt=''
537 d_htonl=''
538 d_ilogbl=''
539 d_inetaton=''
540 d_int64_t=''
541 d_isascii=''
542 d_isfinite=''
543 d_isinf=''
544 d_isnan=''
545 d_isnanl=''
546 d_killpg=''
547 d_lchown=''
548 d_ldbl_dig=''
549 d_libm_lib_version=''
550 d_link=''
551 d_localtime_r=''
552 localtime_r_proto=''
553 d_locconv=''
554 d_lockf=''
555 d_longdbl=''
556 longdblsize=''
557 d_longlong=''
558 longlongsize=''
559 d_lseekproto=''
560 d_lstat=''
561 d_madvise=''
562 d_malloc_good_size=''
563 d_malloc_size=''
564 d_mblen=''
565 d_mbstowcs=''
566 d_mbtowc=''
567 d_memchr=''
568 d_memcmp=''
569 d_memcpy=''
570 d_memmove=''
571 d_memset=''
572 d_mkdir=''
573 d_mkdtemp=''
574 d_mkfifo=''
575 d_mkstemp=''
576 d_mkstemps=''
577 d_mktime=''
578 d_mmap=''
579 mmaptype=''
580 d_modfl=''
581 d_modfl_pow32_bug=''
582 d_modflproto=''
583 d_mprotect=''
584 d_msg=''
585 d_msgctl=''
586 d_msgget=''
587 d_msghdr_s=''
588 d_msgrcv=''
589 d_msgsnd=''
590 d_msync=''
591 d_munmap=''
592 d_nice=''
593 d_nl_langinfo=''
594 d_off64_t=''
595 d_open3=''
596 d_fpathconf=''
597 d_pathconf=''
598 d_pause=''
599 d_pipe=''
600 d_poll=''
601 d_portable=''
602 d_procselfexe=''
603 procselfexe=''
604 d_old_pthread_create_joinable=''
605 old_pthread_create_joinable=''
606 d_pthread_atfork=''
607 d_pthread_attr_setscope=''
608 d_pthread_yield=''
609 d_sched_yield=''
610 sched_yield=''
611 d_qgcvt=''
612 d_random_r=''
613 random_r_proto=''
614 d_readdir64_r=''
615 readdir64_r_proto=''
616 d_readdir=''
617 d_rewinddir=''
618 d_seekdir=''
619 d_telldir=''
620 d_readdir_r=''
621 readdir_r_proto=''
622 d_readlink=''
623 d_readv=''
624 d_recvmsg=''
625 d_rename=''
626 d_rmdir=''
627 d_safebcpy=''
628 d_safemcpy=''
629 d_sanemcmp=''
630 d_sbrkproto=''
631 d_scalbnl=''
632 d_select=''
633 d_sem=''
634 d_semctl=''
635 d_semget=''
636 d_semop=''
637 d_sendmsg=''
638 d_setegid=''
639 d_seteuid=''
640 d_setgrent=''
641 d_setgrent_r=''
642 setgrent_r_proto=''
643 d_setgrps=''
644 d_sethent=''
645 d_sethostent_r=''
646 sethostent_r_proto=''
647 d_setitimer=''
648 d_setlinebuf=''
649 d_setlocale=''
650 d_setlocale_r=''
651 setlocale_r_proto=''
652 d_setnent=''
653 d_setnetent_r=''
654 setnetent_r_proto=''
655 d_setpent=''
656 d_setpgid=''
657 d_setpgrp2=''
658 d_bsdsetpgrp=''
659 d_setpgrp=''
660 d_setprior=''
661 d_setproctitle=''
662 d_setprotoent_r=''
663 setprotoent_r_proto=''
664 d_setpwent=''
665 d_setpwent_r=''
666 setpwent_r_proto=''
667 d_setregid=''
668 d_setresgid=''
669 d_setresuid=''
670 d_setreuid=''
671 d_setrgid=''
672 d_setruid=''
673 d_setsent=''
674 d_setservent_r=''
675 setservent_r_proto=''
676 d_setsid=''
677 d_setvbuf=''
678 d_sfio=''
679 usesfio=''
680 d_shm=''
681 d_shmat=''
682 d_shmatprototype=''
683 shmattype=''
684 d_shmctl=''
685 d_shmdt=''
686 d_shmget=''
687 d_sigaction=''
688 d_sigprocmask=''
689 d_sigsetjmp=''
690 usesitecustomize=''
691 d_snprintf=''
692 d_vsnprintf=''
693 d_sockatmark=''
694 d_sockatmarkproto=''
695 d_msg_ctrunc=''
696 d_msg_dontroute=''
697 d_msg_oob=''
698 d_msg_peek=''
699 d_msg_proxy=''
700 d_oldsock=''
701 d_scm_rights=''
702 d_socket=''
703 d_sockpair=''
704 sockethdr=''
705 socketlib=''
706 d_socklen_t=''
707 d_socks5_init=''
708 d_sprintf_returns_strlen=''
709 d_sqrtl=''
710 d_srand48_r=''
711 srand48_r_proto=''
712 d_srandom_r=''
713 srandom_r_proto=''
714 d_sresgproto=''
715 d_sresuproto=''
716 d_statblks=''
717 d_statfs_f_flags=''
718 d_statfs_s=''
719 d_fstatvfs=''
720 d_statvfs=''
721 d_stdio_cnt_lval=''
722 d_stdio_ptr_lval=''
723 d_stdio_ptr_lval_nochange_cnt=''
724 d_stdio_ptr_lval_sets_cnt=''
725 d_stdiobase=''
726 d_stdstdio=''
727 stdio_base=''
728 stdio_bufsiz=''
729 stdio_cnt=''
730 stdio_filbuf=''
731 stdio_ptr=''
732 d_index=''
733 d_strchr=''
734 d_strcoll=''
735 d_strctcpy=''
736 d_strerrm=''
737 d_strerror=''
738 d_sysernlst=''
739 d_syserrlst=''
740 d_strerror_r=''
741 strerror_r_proto=''
742 d_strftime=''
743 d_strlcat=''
744 d_strlcpy=''
745 d_strtod=''
746 d_strtol=''
747 d_strtold=''
748 d_strtoll=''
749 d_strtoq=''
750 d_strtoul=''
751 d_strtoull=''
752 d_strtouq=''
753 d_strxfrm=''
754 d_symlink=''
755 d_syscall=''
756 d_syscallproto=''
757 d_sysconf=''
758 d_system=''
759 d_tcgetpgrp=''
760 d_tcsetpgrp=''
761 d_telldirproto=''
762 d_time=''
763 timetype=''
764 clocktype=''
765 d_times=''
766 d_tmpnam_r=''
767 tmpnam_r_proto=''
768 d_truncate=''
769 d_ttyname_r=''
770 ttyname_r_proto=''
771 d_tzname=''
772 d_u32align=''
773 d_ualarm=''
774 d_umask=''
775 d_semctl_semid_ds=''
776 d_semctl_semun=''
777 d_union_semun=''
778 d_unordered=''
779 d_unsetenv=''
780 d_usleep=''
781 d_usleepproto=''
782 d_ustat=''
783 d_vfork=''
784 usevfork=''
785 d_voidsig=''
786 signal_t=''
787 d_volatile=''
788 d_charvspr=''
789 d_vprintf=''
790 d_wait4=''
791 d_waitpid=''
792 d_wcstombs=''
793 d_wctomb=''
794 d_writev=''
795 dlext=''
796 cccdlflags=''
797 ccdlflags=''
798 dlsrc=''
799 ld=''
800 lddlflags=''
801 usedl=''
802 doublesize=''
803 ebcdic=''
804 fflushNULL=''
805 fflushall=''
806 fpossize=''
807 fpostype=''
808 gccansipedantic=''
809 gccosandvers=''
810 gccversion=''
811 gidformat=''
812 gidsign=''
813 gidsize=''
814 gidtype=''
815 groupstype=''
816 h_fcntl=''
817 h_sysfile=''
818 html1dir=''
819 html1direxp=''
820 installhtml1dir=''
821 html3dir=''
822 html3direxp=''
823 installhtml3dir=''
824 i_arpainet=''
825 i_crypt=''
826 db_hashtype=''
827 db_prefixtype=''
828 db_version_major=''
829 db_version_minor=''
830 db_version_patch=''
831 i_db=''
832 i_dbm=''
833 i_rpcsvcdbm=''
834 d_dirnamlen=''
835 direntrytype=''
836 i_dirent=''
837 i_dld=''
838 i_dlfcn=''
839 i_fcntl=''
840 i_float=''
841 i_fp=''
842 i_fp_class=''
843 i_gdbm=''
844 d_grpasswd=''
845 i_grp=''
846 i_ieeefp=''
847 i_inttypes=''
848 i_langinfo=''
849 i_libutil=''
850 i_limits=''
851 i_locale=''
852 i_machcthr=''
853 i_malloc=''
854 i_math=''
855 i_memory=''
856 i_mntent=''
857 i_ndbm=''
858 i_netdb=''
859 i_neterrno=''
860 i_netinettcp=''
861 i_niin=''
862 i_sysin=''
863 i_poll=''
864 i_prot=''
865 i_pthread=''
866 d_pwage=''
867 d_pwchange=''
868 d_pwclass=''
869 d_pwcomment=''
870 d_pwexpire=''
871 d_pwgecos=''
872 d_pwpasswd=''
873 d_pwquota=''
874 i_pwd=''
875 i_sfio=''
876 i_shadow=''
877 i_socks=''
878 i_stddef=''
879 i_stdlib=''
880 i_string=''
881 strings=''
882 i_sunmath=''
883 i_sysaccess=''
884 i_sysdir=''
885 i_sysfile=''
886 d_voidtty=''
887 i_bsdioctl=''
888 i_sysfilio=''
889 i_sysioctl=''
890 i_syssockio=''
891 i_syslog=''
892 i_sysmman=''
893 i_sysmode=''
894 i_sysmount=''
895 i_sysndir=''
896 i_sysparam=''
897 i_sysresrc=''
898 i_syssecrt=''
899 i_sysselct=''
900 i_sysstat=''
901 i_sysstatfs=''
902 i_sysstatvfs=''
903 i_systimes=''
904 i_systypes=''
905 i_sysuio=''
906 i_sysun=''
907 i_sysutsname=''
908 i_sysvfs=''
909 i_syswait=''
910 i_sgtty=''
911 i_termio=''
912 i_termios=''
913 d_tm_tm_gmtoff=''
914 d_tm_tm_zone=''
915 i_systime=''
916 i_systimek=''
917 i_time=''
918 timeincl=''
919 i_unistd=''
920 i_ustat=''
921 i_utime=''
922 i_values=''
923 i_stdarg=''
924 i_varargs=''
925 i_varhdr=''
926 i_vfork=''
927 d_inc_version_list=''
928 inc_version_list=''
929 inc_version_list_init=''
930 installprefix=''
931 installprefixexp=''
932 installstyle=''
933 installusrbinperl=''
934 intsize=''
935 longsize=''
936 shortsize=''
937 issymlink=''
938 libc=''
939 ldlibpthname=''
940 libperl=''
941 shrpenv=''
942 useshrplib=''
943 glibpth=''
944 libpth=''
945 loclibpth=''
946 plibpth=''
947 xlibpth=''
948 ignore_versioned_solibs=''
949 libs=''
950 libsdirs=''
951 libsfiles=''
952 libsfound=''
953 libspath=''
954 lns=''
955 d_PRIEUldbl=''
956 d_PRIFUldbl=''
957 d_PRIGUldbl=''
958 d_PRIeldbl=''
959 d_PRIfldbl=''
960 d_PRIgldbl=''
961 d_SCNfldbl=''
962 sPRIEUldbl=''
963 sPRIFUldbl=''
964 sPRIGUldbl=''
965 sPRIeldbl=''
966 sPRIfldbl=''
967 sPRIgldbl=''
968 sSCNfldbl=''
969 lseeksize=''
970 lseektype=''
971 mad=''
972 madlyh=''
973 madlyobj=''
974 madlysrc=''
975 make_set_make=''
976 d_mymalloc=''
977 freetype=''
978 mallocobj=''
979 mallocsrc=''
980 malloctype=''
981 usemallocwrap=''
982 usemymalloc=''
983 installman1dir=''
984 man1dir=''
985 man1direxp=''
986 man1ext=''
987 installman3dir=''
988 man3dir=''
989 man3direxp=''
990 man3ext=''
991 modetype=''
992 multiarch=''
993 mydomain=''
994 myhostname=''
995 phostname=''
996 c=''
997 n=''
998 d_eofnblk=''
999 eagain=''
1000 o_nonblock=''
1001 rd_nodata=''
1002 need_va_copy=''
1003 netdb_hlen_type=''
1004 netdb_host_type=''
1005 netdb_name_type=''
1006 netdb_net_type=''
1007 groupcat=''
1008 hostcat=''
1009 passcat=''
1010 orderlib=''
1011 ranlib=''
1012 d_perl_otherlibdirs=''
1013 otherlibdirs=''
1014 package=''
1015 spackage=''
1016 pager=''
1017 api_revision=''
1018 api_subversion=''
1019 api_version=''
1020 api_versionstring=''
1021 patchlevel=''
1022 perl_patchlevel=''
1023 revision=''
1024 subversion=''
1025 version=''
1026 version_patchlevel_string=''
1027 perl5=''
1028 perladmin=''
1029 perlpath=''
1030 d_nv_preserves_uv=''
1031 d_nv_zero_is_allbits_zero=''
1032 i16size=''
1033 i16type=''
1034 i32size=''
1035 i32type=''
1036 i64size=''
1037 i64type=''
1038 i8size=''
1039 i8type=''
1040 ivsize=''
1041 ivtype=''
1042 nv_preserves_uv_bits=''
1043 nvsize=''
1044 nvtype=''
1045 u16size=''
1046 u16type=''
1047 u32size=''
1048 u32type=''
1049 u64size=''
1050 u64type=''
1051 u8size=''
1052 u8type=''
1053 uvsize=''
1054 uvtype=''
1055 ivdformat=''
1056 nvEUformat=''
1057 nvFUformat=''
1058 nvGUformat=''
1059 nveformat=''
1060 nvfformat=''
1061 nvgformat=''
1062 uvXUformat=''
1063 uvoformat=''
1064 uvuformat=''
1065 uvxformat=''
1066 pidtype=''
1067 prefix=''
1068 prefixexp=''
1069 installprivlib=''
1070 privlib=''
1071 privlibexp=''
1072 prototype=''
1073 ptrsize=''
1074 d_PRIXU64=''
1075 d_PRId64=''
1076 d_PRIi64=''
1077 d_PRIo64=''
1078 d_PRIu64=''
1079 d_PRIx64=''
1080 sPRIXU64=''
1081 sPRId64=''
1082 sPRIi64=''
1083 sPRIo64=''
1084 sPRIu64=''
1085 sPRIx64=''
1086 d_quad=''
1087 quadkind=''
1088 quadtype=''
1089 uquadtype=''
1090 drand01=''
1091 randbits=''
1092 randfunc=''
1093 randseedtype=''
1094 seedfunc=''
1095 installscript=''
1096 scriptdir=''
1097 scriptdirexp=''
1098 selectminbits=''
1099 selecttype=''
1100 sh=''
1101 sig_count=''
1102 sig_name=''
1103 sig_name_init=''
1104 sig_num=''
1105 sig_num_init=''
1106 sig_size=''
1107 d_sitearch=''
1108 installsitearch=''
1109 sitearch=''
1110 sitearchexp=''
1111 installsitebin=''
1112 sitebin=''
1113 sitebinexp=''
1114 installsitehtml1dir=''
1115 sitehtml1dir=''
1116 sitehtml1direxp=''
1117 installsitehtml3dir=''
1118 sitehtml3dir=''
1119 sitehtml3direxp=''
1120 installsitelib=''
1121 sitelib=''
1122 sitelib_stem=''
1123 sitelibexp=''
1124 installsiteman1dir=''
1125 siteman1dir=''
1126 siteman1direxp=''
1127 installsiteman3dir=''
1128 siteman3dir=''
1129 siteman3direxp=''
1130 siteprefix=''
1131 siteprefixexp=''
1132 installsitescript=''
1133 sitescript=''
1134 sitescriptexp=''
1135 sizesize=''
1136 sizetype=''
1137 so=''
1138 socksizetype=''
1139 sharpbang=''
1140 shsharp=''
1141 spitshell=''
1142 src=''
1143 ssizetype=''
1144 startperl=''
1145 startsh=''
1146 stdchar=''
1147 d_stdio_stream_array=''
1148 stdio_stream_array=''
1149 sysman=''
1150 trnl=''
1151 uidformat=''
1152 uidsign=''
1153 uidsize=''
1154 uidtype=''
1155 archname64=''
1156 use64bitall=''
1157 use64bitint=''
1158 usefaststdio=''
1159 ccflags_uselargefiles=''
1160 ldflags_uselargefiles=''
1161 libswanted_uselargefiles=''
1162 uselargefiles=''
1163 uselongdouble=''
1164 usemorebits=''
1165 usemultiplicity=''
1166 nm_opt=''
1167 nm_so_opt=''
1168 runnm=''
1169 usenm=''
1170 useperlio=''
1171 usesocks=''
1172 d_oldpthreads=''
1173 use5005threads=''
1174 useithreads=''
1175 usereentrant=''
1176 usethreads=''
1177 incpath=''
1178 mips_type=''
1179 usrinc=''
1180 d_vendorarch=''
1181 installvendorarch=''
1182 vendorarch=''
1183 vendorarchexp=''
1184 d_vendorbin=''
1185 installvendorbin=''
1186 vendorbin=''
1187 vendorbinexp=''
1188 installvendorhtml1dir=''
1189 vendorhtml1dir=''
1190 vendorhtml1direxp=''
1191 installvendorhtml3dir=''
1192 vendorhtml3dir=''
1193 vendorhtml3direxp=''
1194 d_vendorlib=''
1195 installvendorlib=''
1196 vendorlib=''
1197 vendorlib_stem=''
1198 vendorlibexp=''
1199 installvendorman1dir=''
1200 vendorman1dir=''
1201 vendorman1direxp=''
1202 installvendorman3dir=''
1203 vendorman3dir=''
1204 vendorman3direxp=''
1205 usevendorprefix=''
1206 vendorprefix=''
1207 vendorprefixexp=''
1208 d_vendorscript=''
1209 installvendorscript=''
1210 vendorscript=''
1211 vendorscriptexp=''
1212 versiononly=''
1213 defvoidused=''
1214 voidflags=''
1215 yacc=''
1216 yaccflags=''
1217 CONFIG=''
1218
1219 define='define'
1220 undef='undef'
1221 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1222 rmlist=''
1223
1224 : We must find out about Eunice early
1225 eunicefix=':'
1226 if test -f /etc/unixtovms; then
1227         eunicefix=/etc/unixtovms
1228 fi
1229 if test -f /etc/unixtovms.exe; then
1230         eunicefix=/etc/unixtovms.exe
1231 fi
1232
1233 : Set executable suffix now -- needed before hints available
1234 if test -f "/libs/version.library"; then
1235 : Amiga OS
1236     _exe=""
1237 elif test -f "/system/gnu_library/bin/ar.pm"; then
1238 : Stratus VOS
1239     _exe=".pm"
1240 elif test -n "$DJGPP"; then
1241 : DOS DJGPP
1242     _exe=".exe"
1243 elif test -d c:/. -o -n "$is_os2" ; then
1244 : OS/2 or cygwin
1245     _exe=".exe"
1246 fi
1247
1248 i_whoami=''
1249 ccname=''
1250 ccversion=''
1251 perllibs=''
1252 : set useposix=false in your hint file to disable the POSIX extension.
1253 useposix=true
1254 : set useopcode=false in your hint file to disable the Opcode extension.
1255 useopcode=true
1256 : Trailing extension.  Override this in a hint file, if needed.
1257 : Extra object files, if any, needed on this platform.
1258 archobjs=''
1259 archname=''
1260 : Possible local include directories to search.
1261 : Set locincpth to "" in a hint file to defeat local include searches.
1262 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1263 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1264 :
1265 : no include file wanted by default
1266 inclwanted=''
1267
1268 : Enable -DEBUGGING and -DDEBUGGING from the command line
1269 EBUGGING=''
1270 DEBUGGING=old
1271
1272 groupstype=''
1273 libnames=''
1274 : change the next line if compiling for Xenix/286 on Xenix/386
1275 xlibpth='/usr/lib/386 /lib/386'
1276 : Possible local library directories to search.
1277 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1278 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1279
1280 : general looking path for locating libraries
1281 glibpth="/lib /usr/lib $xlibpth"
1282 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1283 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1284 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 archname64=''
1299 ccflags_uselargefiles=''
1300 ldflags_uselargefiles=''
1301 libswanted_uselargefiles=''
1302 : set usemultiplicity on the Configure command line to enable multiplicity.
1303 : set usesocks on the Configure command line to enable socks.
1304 : set usethreads on the Configure command line to enable threads.
1305 usereentrant='undef'
1306 : full support for void wanted by default
1307 defvoidused=15
1308
1309 : List of libraries we want.
1310 : If anyone needs extra -lxxx, put those in a hint file.
1311 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1312 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1313 : We probably want to search /usr/shlib before most other libraries.
1314 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1315 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1316 glibpth="/usr/shlib $glibpth"
1317 : Do not use vfork unless overridden by a hint file.
1318 usevfork=false
1319
1320 : Find the basic shell for Bourne shell scripts
1321 case "$sh" in
1322 '')
1323         case "$SYSTYPE" in
1324         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1325         *) xxx='/bin/sh';;
1326         esac
1327         if test -f "$xxx"; then
1328                 sh="$xxx"
1329         else
1330                 : Build up a list and do a single loop so we can 'break' out.
1331                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1332                 for xxx in sh bash ksh pdksh ash; do
1333                         for p in $pth; do
1334                                 try="$try ${p}/${xxx}"
1335                         done
1336                 done
1337                 for xxx in $try; do
1338                         if test -f "$xxx"; then
1339                                 sh="$xxx";
1340                                 break
1341                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1342                                 sh="$xxx";
1343                                 break
1344                         elif test -f "$xxx.exe"; then
1345                                 sh="$xxx";
1346                                 break
1347                         fi
1348                 done
1349         fi
1350         ;;
1351 esac
1352
1353 case "$sh" in
1354 '')     cat >&2 <<EOM
1355 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1356
1357 Usually it's in /bin/sh.  How did you even get this far?
1358 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1359 we'll try to straighten this all out.
1360 EOM
1361         exit 1
1362         ;;
1363 esac
1364
1365 : see if sh knows # comments
1366 if `$sh -c '#' >/dev/null 2>&1`; then
1367         shsharp=true
1368         spitshell=cat
1369         xcat=/bin/cat
1370         test -f $xcat$_exe || xcat=/usr/bin/cat
1371         if test ! -f $xcat$_exe; then
1372                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1373                         if test -f $p/cat$_exe; then
1374                                 xcat=$p/cat
1375                                 break
1376                         fi
1377                 done
1378                 if test ! -f $xcat$_exe; then
1379                         echo "Can't find cat anywhere!"
1380                         exit 1
1381                 fi
1382         fi
1383         echo "#!$xcat" >sharp
1384         $eunicefix sharp
1385         chmod +x sharp
1386         ./sharp > today
1387         if test -s today; then
1388                 sharpbang='#!'
1389         else
1390                 echo "#! $xcat" > sharp
1391                 $eunicefix sharp
1392                 chmod +x sharp
1393                 ./sharp > today
1394                 if test -s today; then
1395                         sharpbang='#! '
1396                 else
1397                         sharpbang=': use '
1398                 fi
1399         fi
1400 else
1401         echo " "
1402         echo "Your $sh doesn't grok # comments--I will strip them later on."
1403         shsharp=false
1404         cd ..
1405         echo "exec grep -v '^[  ]*#'" >spitshell
1406         chmod +x spitshell
1407         $eunicefix spitshell
1408         spitshell=`pwd`/spitshell
1409         cd UU
1410         echo "I presume that if # doesn't work, #! won't work either!"
1411         sharpbang=': use '
1412 fi
1413 rm -f sharp today
1414
1415 : figure out how to guarantee sh startup
1416 case "$startsh" in
1417 '') startsh=${sharpbang}${sh} ;;
1418 *)
1419 esac
1420 cat >sharp <<EOSS
1421 $startsh
1422 set abc
1423 test "$?abc" != 1
1424 EOSS
1425
1426 chmod +x sharp
1427 $eunicefix sharp
1428 if ./sharp; then
1429         : echo "Yup, it does."
1430 else
1431         echo "Hmm... '$startsh' does not guarantee sh startup..."
1432         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1433 fi
1434 rm -f sharp
1435
1436
1437 : Save command line options in file UU/cmdline.opt for later use in
1438 : generating config.sh.
1439 cat > cmdline.opt <<EOSH
1440 # Configure command line arguments.
1441 config_arg0='$0'
1442 config_args='$*'
1443 config_argc=$#
1444 EOSH
1445 argn=1
1446 args_exp=''
1447 args_sep=''
1448 for arg in "$@"; do
1449         cat >>cmdline.opt <<EOSH
1450 config_arg$argn='$arg'
1451 EOSH
1452         # Extreme backslashitis: replace each ' by '"'"'
1453         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1454 $arg
1455 EOC
1456         arg_exp=`cat cmdl.opt`
1457         args_exp="$args_exp$args_sep'$arg_exp'"
1458         argn=`expr $argn + 1`
1459         args_sep=' '
1460 done
1461 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1462 # used by ./hints/os2.sh
1463 rm -f cmdl.opt
1464
1465 : produce awk script to parse command line options
1466 cat >options.awk <<'EOF'
1467 BEGIN {
1468         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1469
1470         len = length(optstr);
1471         for (i = 1; i <= len; i++) {
1472                 c = substr(optstr, i, 1);
1473                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1474                 if (a == ":") {
1475                         arg[c] = 1;
1476                         i++;
1477                 }
1478                 opt[c] = 1;
1479         }
1480 }
1481 {
1482         expect = 0;
1483         str = $0;
1484         if (substr(str, 1, 1) != "-") {
1485                 printf("'%s'\n", str);
1486                 next;
1487         }
1488         len = length($0);
1489         for (i = 2; i <= len; i++) {
1490                 c = substr(str, i, 1);
1491                 if (!opt[c]) {
1492                         printf("-%s\n", substr(str, i));
1493                         next;
1494                 }
1495                 printf("-%s\n", c);
1496                 if (arg[c]) {
1497                         if (i < len)
1498                                 printf("'%s'\n", substr(str, i + 1));
1499                         else
1500                                 expect = 1;
1501                         next;
1502                 }
1503         }
1504 }
1505 END {
1506         if (expect)
1507                 print "?";
1508 }
1509 EOF
1510
1511 : process the command line options
1512 set X `for arg in "$@"; do echo "X$arg"; done |
1513         sed -e s/X// | awk -f options.awk`
1514 eval "set $*"
1515 shift
1516 rm -f options.awk
1517
1518 : set up default values
1519 fastread=''
1520 reuseval=false
1521 config_sh=''
1522 alldone=''
1523 error=''
1524 silent=''
1525 extractsh=''
1526 override=''
1527 knowitall=''
1528 rm -f optdef.sh posthint.sh
1529 cat >optdef.sh <<EOS
1530 $startsh
1531 EOS
1532
1533
1534 : option parsing
1535 while test $# -gt 0; do
1536         case "$1" in
1537         -d) shift; fastread=yes;;
1538         -e) shift; alldone=cont;;
1539         -f)
1540                 shift
1541                 cd ..
1542                 if test -r "$1"; then
1543                         config_sh="$1"
1544                 else
1545                         echo "$me: cannot read config file $1." >&2
1546                         error=true
1547                 fi
1548                 cd UU
1549                 shift;;
1550         -h) shift; error=true;;
1551         -r) shift; reuseval=true;;
1552         -s) shift; silent=true; realsilent=true;;
1553         -E) shift; alldone=exit;;
1554         -K) shift; knowitall=true;;
1555         -O) shift; override=true;;
1556         -S) shift; silent=true; extractsh=true;;
1557         -D)
1558                 shift
1559                 case "$1" in
1560                 *=)
1561                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1562                         echo "$me: ignoring -D $1" >&2
1563                         ;;
1564                 *=*) echo "$1" | \
1565                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1566                 *) echo "$1='define'" >> optdef.sh;;
1567                 esac
1568                 shift
1569                 ;;
1570         -U)
1571                 shift
1572                 case "$1" in
1573                 *=) echo "$1" >> optdef.sh;;
1574                 *=*)
1575                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1576                         echo "$me: ignoring -U $1" >&2
1577                         ;;
1578                 *) echo "$1='undef'" >> optdef.sh;;
1579                 esac
1580                 shift
1581                 ;;
1582         -A)
1583             shift
1584             xxx=''
1585             yyy="$1"
1586             zzz=''
1587             uuu=undef
1588             case "$yyy" in
1589             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1590                  case "$zzz" in
1591                  *:*) zzz='' ;;
1592                  *)   xxx=append
1593                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1594                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1595                  esac
1596                  ;;
1597             esac
1598             case "$xxx" in
1599             '')  case "$yyy" in
1600                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1601                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1602                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1603                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1604                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1605                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1606                  esac
1607                  ;;       
1608             esac
1609             case "$xxx" in
1610             append)
1611                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1612             clear)
1613                 echo "$yyy=''"                  >> posthint.sh ;;
1614             define)
1615                 case "$zzz" in
1616                 '') zzz=define ;;
1617                 esac
1618                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1619             eval)
1620                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1621             prepend)
1622                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1623             undef)
1624                 case "$zzz" in
1625                 '') zzz="$uuu" ;;
1626                 esac
1627                 echo "$yyy=$zzz"                >> posthint.sh ;;
1628             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1629             esac
1630             shift
1631             ;;
1632         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1633             exit 0;;
1634         --) break;;
1635         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1636         *) break;;
1637         esac
1638 done
1639
1640 case "$error" in
1641 true)
1642         cat >&2 <<EOM
1643 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1644                  [-U symbol] [-U symbol=] [-A command:symbol...]
1645   -d : use defaults for all answers.
1646   -e : go on without questioning past the production of config.sh.
1647   -f : specify an alternate default configuration file.
1648   -h : print this help message and exit (with an error status).
1649   -r : reuse C symbols value if possible (skips costly nm extraction).
1650   -s : silent mode, only echoes questions and essential information.
1651   -D : define symbol to have some value:
1652          -D symbol         symbol gets the value 'define'
1653          -D symbol=value   symbol gets the value 'value'
1654   -E : stop at the end of questions, after having produced config.sh.
1655   -K : do not use unless you know what you are doing.
1656   -O : let -D and -U override definitions from loaded configuration file.
1657   -S : perform variable substitutions on all .SH files (can mix with -f)
1658   -U : undefine symbol:
1659          -U symbol    symbol gets the value 'undef'
1660          -U symbol=   symbol gets completely empty
1661   -A : manipulate symbol after the platform specific hints have been applied:
1662          -A symbol=value                append " "value to symbol
1663          -A append:symbol=value         append value to symbol
1664          -A define:symbol=value         define symbol to have value
1665          -A clear:symbol                define symbol to be ''
1666          -A define:symbol               define symbol to be 'define'
1667          -A eval:symbol=value           define symbol to be eval of value
1668          -A prepend:symbol=value        prepend value to symbol
1669          -A undef:symbol                define symbol to be 'undef'
1670          -A undef:symbol=               define symbol to be ''
1671   -V : print version number and exit (with a zero status).
1672 EOM
1673         exit 1
1674         ;;
1675 esac
1676
1677 : Sanity checks
1678 case "$fastread$alldone" in
1679 yescont|yesexit) ;;
1680 *)
1681         case "$extractsh" in
1682         true) ;;
1683         *)
1684                 if test ! -t 0; then
1685                         echo "Say 'sh Configure', not 'sh <Configure'"
1686                         exit 1
1687                 fi
1688                 ;;
1689         esac
1690         ;;
1691 esac
1692
1693 exec 4>&1
1694 case "$silent" in
1695 true) exec 1>/dev/null;;
1696 esac
1697
1698 : run the defines and the undefines, if any, but leave the file out there...
1699 touch optdef.sh
1700 . ./optdef.sh
1701 : create the posthint manipulation script and leave the file out there...
1702 touch posthint.sh
1703
1704 : set package name
1705 package=perl5
1706 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1707 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1708 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1709 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1710 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1711 esac
1712
1713 : Some greps do not return status, grrr.
1714 echo "grimblepritz" >grimble
1715 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1716         contains=contains
1717 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1718         contains=grep
1719 else
1720         contains=contains
1721 fi
1722 rm -f grimble
1723 : the following should work in any shell
1724 case "$contains" in
1725 contains*)
1726         echo " "
1727         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1728         cat >contains <<'EOSS'
1729 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1730 EOSS
1731 chmod +x contains
1732 esac
1733
1734 : Find the path to the source tree
1735 case "$src" in
1736 '') case "$0" in
1737     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1738          case "$src" in
1739          /*)    ;;
1740          .)     ;;
1741          *)     src=`cd ../$src && pwd` ;;
1742          esac
1743          ;;
1744     *)   src='.';;
1745     esac;;
1746 esac
1747 case "$src" in
1748 '')     src=/
1749         rsrc=/
1750         ;;
1751 /*) rsrc="$src";;
1752 *) rsrc="../$src";;
1753 esac
1754 if test -f $rsrc/Configure && \
1755         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1756 then
1757    : found it, so we are ok.
1758 else
1759         rsrc=''
1760         for src in . .. ../.. ../../.. ../../../..; do
1761                 if test -f ../$src/Configure && \
1762                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1763                 then
1764                         rsrc=../$src
1765                         break
1766                 fi
1767         done
1768 fi
1769 case "$rsrc" in
1770 '')
1771         cat <<EOM >&4
1772
1773 Sorry, I can't seem to locate the source dir for $package.  Please start
1774 Configure with an explicit path -- i.e. /some/path/Configure.
1775
1776 EOM
1777         exit 1
1778         ;;
1779 ../.)   rsrc='..';;
1780 *)
1781         echo " "
1782         echo "Sources for $package found in \"$src\"." >&4
1783         ;;
1784 esac
1785
1786 : script used to extract .SH files with variable substitutions
1787 cat >extract <<'EOS'
1788 PERL_CONFIG_SH=true
1789 echo "Doing variable substitutions on .SH files..."
1790 if test -f MANIFEST; then
1791         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1792 else
1793         echo "(Looking for .SH files under the source directory.)"
1794         set x `(cd "$src"; find . -name "*.SH" -print)`
1795 fi
1796 shift
1797 case $# in
1798 0) set x `(cd "$src"; echo *.SH)`; shift;;
1799 esac
1800 if test ! -f "$src/$1"; then
1801         shift
1802 fi
1803 mkdir_p='
1804 name=$1;
1805 create="";
1806 while test $name; do
1807         if test ! -d "$name"; then
1808                 create="$name $create";
1809                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1810                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1811         else
1812                 name="";
1813         fi;
1814 done;
1815 for file in $create; do
1816         mkdir $file;
1817 done
1818 '
1819 for file in $*; do
1820         case "$src" in
1821         ".")
1822                 case "$file" in
1823                 */*)
1824                         dir=`expr X$file : 'X\(.*\)/'`
1825                         file=`expr X$file : 'X.*/\(.*\)'`
1826                         (cd "$dir" && . ./$file)
1827                         ;;
1828                 *)
1829                         . ./$file
1830                         ;;
1831                 esac
1832                 ;;
1833         *)
1834                 case "$file" in
1835                 */*)
1836                         dir=`expr X$file : 'X\(.*\)/'`
1837                         file=`expr X$file : 'X.*/\(.*\)'`
1838                         (set x $dir; shift; eval $mkdir_p)
1839                         sh <"$src/$dir/$file"
1840                         ;;
1841                 *)
1842                         sh <"$src/$file"
1843                         ;;
1844                 esac
1845                 ;;
1846         esac
1847 done
1848 if test -f "$src/config_h.SH"; then
1849         if test ! -f config.h; then
1850         : oops, they left it out of MANIFEST, probably, so do it anyway.
1851         . "$src/config_h.SH"
1852         fi
1853 fi
1854 EOS
1855
1856 : extract files and exit if asked to do so
1857 case "$extractsh" in
1858 true)
1859         case "$realsilent" in
1860         true) ;;
1861         *) exec 1>&4;;
1862         esac
1863         case "$config_sh" in
1864         '') config_sh='config.sh';;
1865         esac
1866         echo " "
1867         echo "Fetching answers from $config_sh..."
1868         cd ..
1869         . $config_sh
1870         test "$override" && . ./optdef.sh
1871         echo " "
1872         . UU/extract
1873         rm -rf UU
1874         echo "Extraction done."
1875         exit 0
1876         ;;
1877 esac
1878
1879 : Eunice requires " " instead of "", can you believe it
1880 echo " "
1881 : Here we go...
1882 echo "Beginning of configuration questions for $package."
1883
1884 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1885
1886 : first determine how to suppress newline on echo command
1887 echo " "
1888 echo "Checking echo to see how to suppress newlines..."
1889 (echo "hi there\c" ; echo " ") >.echotmp
1890 if $contains c .echotmp >/dev/null 2>&1 ; then
1891         echo "...using -n."
1892         n='-n'
1893         c=''
1894 else
1895         cat <<'EOM'
1896 ...using \c
1897 EOM
1898         n=''
1899         c='\c'
1900 fi
1901 echo $n "The star should be here-->$c"
1902 echo '*'
1903 rm -f .echotmp
1904
1905 : Now test for existence of everything in MANIFEST
1906 echo " "
1907 if test -f "$rsrc/MANIFEST"; then
1908         echo "First let's make sure your kit is complete.  Checking..." >&4
1909         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1910         rm -f missing
1911         tmppwd=`pwd`
1912         for filelist in x??; do
1913                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1914         done
1915         if test -s missing; then
1916                 cat missing >&4
1917                 cat >&4 <<'EOM'
1918
1919 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1920
1921 You have the option of continuing the configuration process, despite the
1922 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1923 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1924 and contact the author (perlbug@perl.org).
1925
1926 EOM
1927                 echo $n "Continue? [n] $c" >&4
1928                 read ans
1929                 case "$ans" in
1930                 y*)
1931                         echo "Continuing..." >&4
1932                         rm -f missing
1933                         ;;
1934                 *)
1935                         echo "ABORTING..." >&4
1936                         kill $$
1937                         ;;
1938                 esac
1939         else
1940                 echo "Looks good..."
1941         fi
1942 else
1943         echo "There is no MANIFEST file.  I hope your kit is complete !"
1944 fi
1945 rm -f missing x??
1946
1947 echo " "
1948 : Find the appropriate value for a newline for tr
1949 if test -n "$DJGPP"; then
1950        trnl='\012'
1951 fi
1952 if test X"$trnl" = X; then
1953         case "`echo foo|tr '\n' x 2>/dev/null`" in
1954         foox) trnl='\n' ;;
1955         esac
1956 fi
1957 if test X"$trnl" = X; then
1958         case "`echo foo|tr '\012' x 2>/dev/null`" in
1959         foox) trnl='\012' ;;
1960         esac
1961 fi
1962 if test X"$trnl" = X; then
1963        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1964        fooxy) trnl='\n\r' ;;
1965        esac
1966 fi
1967 if test X"$trnl" = X; then
1968         cat <<EOM >&2
1969
1970 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1971
1972 EOM
1973         exit 1
1974 fi
1975
1976 : compute the number of columns on the terminal for proper question formatting
1977 case "$COLUMNS" in
1978 '') COLUMNS='80';;
1979 esac
1980
1981 : set up the echo used in my read
1982 myecho="case \"\$xxxm\" in
1983 '') echo $n \"\$rp $c\" >&4;;
1984 *) case \"\$rp\" in
1985         '') echo $n \"[\$xxxm] $c\";;
1986         *)
1987                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1988                         echo \"\$rp\" >&4
1989                         echo $n \"[\$xxxm] $c\" >&4
1990                 else
1991                         echo $n \"\$rp [\$xxxm] $c\" >&4
1992                 fi
1993                 ;;
1994         esac;;
1995 esac"
1996
1997 : now set up to do reads with possible shell escape and default assignment
1998 cat <<EOSC >myread
1999 $startsh
2000 xxxm=\$dflt
2001 $myecho
2002 ans='!'
2003 case "\$fastread" in
2004 yes) case "\$dflt" in
2005         '') ;;
2006         *) ans='';
2007                 case "\$silent-\$rp" in
2008                 true-) ;;
2009                 *) echo " " >&4;;
2010                 esac;;
2011         esac;;
2012 *) case "\$silent" in
2013         true) case "\$rp" in
2014                 '') ans='';;
2015                 esac;;
2016         esac;;
2017 esac
2018 while expr "X\$ans" : "X!" >/dev/null; do
2019         read answ
2020         set x \$xxxm
2021         shift
2022         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2023         case  "\$answ" in
2024         "!")
2025                 sh 1>&4
2026                 echo " "
2027                 $myecho
2028                 ;;
2029         !*)
2030                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2031                 shift
2032                 sh 1>&4 -c "\$*"
2033                 echo " "
2034                 $myecho
2035                 ;;
2036         "\$ans")
2037                 case "\$ans" in
2038                 \\&*)
2039                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2040                         shift
2041                         case "\$1" in
2042                         -d)
2043                                 fastread=yes
2044                                 echo "(OK, I'll run with -d after this question.)" >&4
2045                                 ;;
2046                         -*)
2047                                 echo "*** Sorry, \$1 not supported yet." >&4
2048                                 ;;
2049                         esac
2050                         $myecho
2051                         ans=!
2052                         ;;
2053                 esac;;
2054         *)
2055                 case "\$aok" in
2056                 y)
2057                         echo "*** Substitution done -- please confirm."
2058                         xxxm="\$ans"
2059                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2060                         xxxm="\$ans"
2061                         ans=!
2062                         ;;
2063                 *)
2064                         echo "*** Error -- try again."
2065                         ans=!
2066                         ;;
2067                 esac
2068                 $myecho
2069                 ;;
2070         esac
2071         case "\$ans\$xxxm\$nostick" in
2072         '')
2073                 ans=!
2074                 $myecho
2075                 ;;
2076         esac
2077 done
2078 case "\$ans" in
2079 '') ans="\$xxxm";;
2080 esac
2081 EOSC
2082
2083 : create .config dir to save info across Configure sessions
2084 test -d ../.config || mkdir ../.config
2085 cat >../.config/README <<EOF
2086 This directory created by Configure to save information that should
2087 persist across sessions for $package.
2088
2089 You may safely delete it if you wish.
2090 EOF
2091
2092 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2093 case "$usedevel" in
2094 $define|true|[yY]*) ;;
2095 *) case "$xversion" in
2096    *[13579])
2097         cat >&4 <<EOH
2098 *** WHOA THERE!!! ***
2099
2100     This is an UNSTABLE DEVELOPMENT release.
2101     The version of this $package distribution is $xversion, that is, odd,
2102     (as opposed to even) and that signifies a development release.
2103     If you want a maintenance release, you want an even-numbered version.
2104
2105     Do ***NOT*** install this into production use.
2106     Data corruption and crashes are possible.
2107
2108     It is most seriously suggested that you do not continue any further
2109     unless you want to help in developing and debugging Perl.
2110
2111     If you *still* want to build perl, you can answer 'y' now,
2112     or pass -Dusedevel to Configure.
2113
2114 EOH
2115         rp='Do you really want to continue?'
2116         dflt='n'
2117         . ./myread
2118         case "$ans" in
2119         [yY]) echo >&4 "Okay, continuing."
2120               usedevel="$define" ;;
2121         *) echo >&4 "Okay, bye."
2122            exit 1
2123            ;;
2124         esac
2125         ;;
2126     esac
2127     ;;
2128 esac
2129 case "$usedevel" in
2130 $define|true|[yY]*)
2131         case "$versiononly" in
2132         '') versiononly="$define" ;;
2133         esac
2134         case "$installusrbinperl" in
2135         '') installusrbinperl="$undef" ;;
2136         esac
2137         ;;
2138 esac
2139
2140 : general instructions
2141 needman=true
2142 firsttime=true
2143 user=`(logname) 2>/dev/null`
2144 case "$user" in
2145 '') user=`whoami 2>&1`;;
2146 esac
2147 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2148         firsttime=false
2149         echo " "
2150         rp='Would you like to see the instructions?'
2151         dflt=n
2152         . ./myread
2153         case "$ans" in
2154         [yY]*) ;;
2155         *) needman=false;;
2156         esac
2157 fi
2158 if $needman; then
2159         cat <<EOH
2160
2161 This installation shell script will examine your system and ask you questions
2162 to determine how the perl5 package should be installed. If you get
2163 stuck on a question, you may use a ! shell escape to start a subshell or
2164 execute a command.  Many of the questions will have default answers in square
2165 brackets; typing carriage return will give you the default.
2166
2167 On some of the questions which ask for file or directory names you are allowed
2168 to use the ~name construct to specify the login directory belonging to "name",
2169 even if you don't have a shell which knows about that.  Questions where this is
2170 allowed will be marked "(~name ok)".
2171
2172 EOH
2173         rp=''
2174         dflt='Type carriage return to continue'
2175         . ./myread
2176         cat <<'EOH'
2177
2178 The prompter used in this script allows you to use shell variables and
2179 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2180 in the default answer, as if the default line was a set of arguments given to a
2181 script shell.  This means you may also use $* to repeat the whole default line,
2182 so you do not have to re-type everything to add something to the default.
2183
2184 Everytime there is a substitution, you will have to confirm.  If there is an
2185 error (e.g. an unmatched backtick), the default answer will remain unchanged
2186 and you will be prompted again.
2187
2188 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2189 the questions and use the computed defaults (or the previous answers if there
2190 was already a config.sh file). Type 'Configure -h' for a list of options.
2191 You may also start interactively and then answer '& -d' at any prompt to turn
2192 on the non-interactive behaviour for the remainder of the execution.
2193
2194 EOH
2195         . ./myread
2196         cat <<EOH
2197
2198 Much effort has been expended to ensure that this shell script will run on any
2199 Unix system.  If despite that it blows up on yours, your best bet is to edit
2200 Configure and run it again.  If you can't run Configure for some reason,
2201 you'll have to generate a config.sh file by hand.  Whatever problems you
2202 have, let me (perlbug@perl.org) know how I blew it.
2203
2204 This installation script affects things in two ways:
2205
2206 1) it may do direct variable substitutions on some of the files included
2207    in this kit.
2208 2) it builds a config.h file for inclusion in C programs.  You may edit
2209    any of these files as the need arises after running this script.
2210
2211 If you make a mistake on a question, there is no easy way to back up to it
2212 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2213 files.  Configure will offer to let you do this before it runs the SH files.
2214
2215 EOH
2216         dflt='Type carriage return to continue'
2217         . ./myread
2218         case "$firsttime" in
2219         true) echo $user >>../.config/instruct;;
2220         esac
2221 fi
2222
2223 : find out where common programs are
2224 echo " "
2225 echo "Locating common programs..." >&4
2226 cat <<EOSC >loc
2227 $startsh
2228 case \$# in
2229 0) exit 1;;
2230 esac
2231 thing=\$1
2232 shift
2233 dflt=\$1
2234 shift
2235 for dir in \$*; do
2236         case "\$thing" in
2237         .)
2238         if test -d \$dir/\$thing; then
2239                 echo \$dir
2240                 exit 0
2241         fi
2242         ;;
2243         *)
2244         for thisthing in \$dir/\$thing; do
2245                 : just loop through to pick last item
2246         done
2247         if test -f \$thisthing; then
2248                 echo \$thisthing
2249                 exit 0
2250         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2251                 echo \$thisthing
2252                 exit 0
2253         elif test -f \$dir/\$thing.exe; then
2254                 if test -n "$DJGPP"; then
2255                         echo \$dir/\$thing.exe
2256                 elif test "$eunicefix" != ":"; then
2257                         : on Eunice apparently
2258                         echo \$dir/\$thing
2259                         exit 0
2260                 fi
2261                 exit 0
2262         fi
2263         ;;
2264         esac
2265 done
2266 echo \$dflt
2267 exit 1
2268 EOSC
2269 chmod +x loc
2270 $eunicefix loc
2271 loclist="
2272 awk
2273 cat
2274 chmod
2275 comm
2276 cp
2277 echo
2278 expr
2279 grep
2280 ls
2281 mkdir
2282 rm
2283 sed
2284 sort
2285 touch
2286 tr
2287 uniq
2288 "
2289 trylist="
2290 Mcc
2291 ar
2292 bison
2293 byacc
2294 cpp
2295 csh
2296 date
2297 egrep
2298 gmake
2299 gzip
2300 less
2301 ln
2302 make
2303 more
2304 nm
2305 nroff
2306 pg
2307 test
2308 uname
2309 zip
2310 "
2311 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2312 pth="$pth /lib /usr/lib"
2313 for file in $loclist; do
2314         eval xxx=\$$file
2315         case "$xxx" in
2316         /*|?:[\\/]*)
2317                 if test -f "$xxx"; then
2318                         : ok
2319                 else
2320                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2321                         xxx=`./loc $file $file $pth`
2322                 fi
2323                 ;;
2324         '') xxx=`./loc $file $file $pth`;;
2325         *) xxx=`./loc $xxx $xxx $pth`;;
2326         esac
2327         eval $file=$xxx$_exe
2328         eval _$file=$xxx
2329         case "$xxx" in
2330         /*)
2331                 echo $file is in $xxx.
2332                 ;;
2333         ?:[\\/]*)
2334                 echo $file is in $xxx.
2335                 ;;
2336         *)
2337                 echo "I don't know where '$file' is, and my life depends on it." >&4
2338                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2339                 exit 1
2340                 ;;
2341         esac
2342 done
2343 echo " "
2344 echo "Don't worry if any of the following aren't found..."
2345 say=offhand
2346 for file in $trylist; do
2347         eval xxx=\$$file
2348         case "$xxx" in
2349         /*|?:[\\/]*)
2350                 if test -f "$xxx"; then
2351                         : ok
2352                 else
2353                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2354                         xxx=`./loc $file $file $pth`
2355                 fi
2356                 ;;
2357         '') xxx=`./loc $file $file $pth`;;
2358         *) xxx=`./loc $xxx $xxx $pth`;;
2359         esac
2360         eval $file=$xxx$_exe
2361         eval _$file=$xxx
2362         case "$xxx" in
2363         /*)
2364                 echo $file is in $xxx.
2365                 ;;
2366         ?:[\\/]*)
2367                 echo $file is in $xxx.
2368                 ;;
2369         *)
2370                 echo "I don't see $file out there, $say."
2371                 say=either
2372                 ;;
2373         esac
2374 done
2375 case "$egrep" in
2376 egrep)
2377         echo "Substituting grep for egrep."
2378         egrep=$grep
2379         _egrep=$grep
2380         ;;
2381 esac
2382 case "$ln" in
2383 ln)
2384         echo "Substituting cp for ln."
2385         ln=$cp
2386         _ln=$cp
2387         ;;
2388 esac
2389 case "$make" in
2390 make)   
2391         case "$gmake" in
2392         gmake)
2393         echo "I can't find make or gmake, and my life depends on it." >&4
2394         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2395         exit 1
2396         ;;
2397         esac
2398         ;;
2399 esac    
2400 case "$gmake" in
2401 gmake)  ;;
2402 *)      # We can't have osname yet.
2403         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2404                 # Assume that gmake, if found, is definitely GNU make
2405                 # and prefer it over the system make.
2406                 echo "Substituting gmake for make."
2407                 make=$gmake
2408                 _make=$gmake
2409         fi
2410         ;;
2411 esac
2412 case "$test" in
2413 test)
2414         echo "Hopefully test is built into your sh."
2415         ;;
2416 *)
2417         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2418                 echo "Using the test built into your sh."
2419                 test=test
2420                 _test=test
2421         fi
2422         ;;
2423 esac
2424 case "$echo" in
2425 echo)
2426         echo "Hopefully echo is built into your sh."
2427         ;;
2428 '') ;;
2429 *)
2430         echo " "
2431 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2432         $echo $n "hi there$c" >foo1
2433         echo $n "hi there$c" >foo2
2434         if cmp foo1 foo2 >/dev/null 2>&1; then
2435                 echo "They are compatible.  In fact, they may be identical."
2436         else
2437                 case "$n" in
2438                 '-n') n='' c='\c';;
2439                 *) n='-n' c='';;
2440                 esac
2441                 cat <<FOO
2442 They are not compatible!  You are probably running ksh on a non-USG system.
2443 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2444 have echo built in and we may have to run some Bourne shell scripts.  That
2445 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2446
2447 FOO
2448                 $echo $n "The star should be here-->$c"
2449                 $echo "*"
2450         fi
2451         $rm -f foo1 foo2
2452         ;;
2453 esac
2454
2455 cat <<EOS >trygcc
2456 $startsh
2457 EOS
2458 cat <<'EOSC' >>trygcc
2459 case "$cc" in
2460 '') ;;
2461 *)  $rm -f try try.*
2462     $cat >try.c <<EOM
2463 int main(int argc, char *argv[]) {
2464   return 0;
2465 }
2466 EOM
2467     if $cc -o try $ccflags $ldflags try.c; then
2468        :
2469     else
2470         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2471         despair=yes
2472         trygcc=yes
2473         case "$cc" in
2474         *gcc*) trygcc=no ;;
2475         esac
2476         case "`$cc -v -c try.c 2>&1`" in
2477         *gcc*) trygcc=no ;;
2478         esac
2479         if $test X"$trygcc" = Xyes; then
2480             if gcc -o try -c try.c; then
2481                 echo " "
2482                 echo "You seem to have a working gcc, though." >&4
2483                 rp="Would you like to use it?"
2484                 dflt=y
2485                 if $test -f myread; then
2486                     . ./myread
2487                 else
2488                     if $test -f UU/myread; then
2489                         . ./UU/myread
2490                     else
2491                         echo "Cannot find myread, sorry.  Aborting." >&2
2492                         exit 1
2493                     fi
2494                 fi  
2495                 case "$ans" in
2496                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2497                        if $test -f usethreads.cbu; then
2498                            $cat >&4 <<EOM 
2499
2500 *** However, any setting of the C compiler flags (e.g. for thread support)
2501 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2502 *** (together with e.g. -Dusethreads).
2503
2504 EOM
2505                        fi;;
2506                 esac
2507             fi
2508         fi
2509     fi
2510     $rm -f try try.*
2511     ;;
2512 esac
2513 EOSC
2514
2515 cat <<EOS >checkcc
2516 $startsh
2517 EOS
2518 cat <<'EOSC' >>checkcc
2519 case "$cc" in        
2520 '') ;;
2521 *)  $rm -f try try.*              
2522     $cat >try.c <<EOM
2523 int main(int argc, char *argv[]) {
2524   return 0;
2525 }
2526 EOM
2527     if $cc -o try $ccflags $ldflags try.c; then
2528        :
2529     else
2530         if $test X"$despair" = Xyes; then
2531            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2532         fi
2533         $cat >&4 <<EOM         
2534 You need to find a working C compiler.
2535 Either (purchase and) install the C compiler supplied by your OS vendor,
2536 or for a free C compiler try http://gcc.gnu.org/
2537 I cannot continue any further, aborting.
2538 EOM
2539         exit 1
2540     fi
2541     $rm -f try try.*
2542     ;;
2543 esac
2544 EOSC
2545
2546 : determine whether symbolic links are supported
2547 echo " "
2548 $touch blurfl
2549 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2550         echo "Symbolic links are supported." >&4
2551         lns="$ln -s"
2552 else
2553         echo "Symbolic links are NOT supported." >&4
2554         lns="$ln"
2555 fi
2556 $rm -f blurfl sym
2557
2558 : determine whether symbolic links are supported
2559 echo " "
2560 case "$lns" in
2561 *"ln"*" -s")
2562         echo "Checking how to test for symbolic links..." >&4
2563         $lns blurfl sym
2564         if $test "X$issymlink" = X; then
2565                 case "$newsh" in
2566                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2567                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2568                 esac
2569                 if test $? = 0; then
2570                         issymlink="test -h"
2571                 else
2572                         echo "Your builtin 'test -h' may be broken." >&4
2573                         case "$test" in
2574                         /*)     ;;
2575                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2576                                 for p in $pth
2577                                 do
2578                                         if test -f "$p/$test"; then
2579                                                 test="$p/$test"
2580                                                 break
2581                                         fi
2582                                 done
2583                                 ;;
2584                         esac
2585                         case "$test" in
2586                         /*)
2587                                 echo "Trying external '$test -h'." >&4
2588                                 issymlink="$test -h"
2589                                 if $test ! -h sym >/dev/null 2>&1; then
2590                                         echo "External '$test -h' is broken, too." >&4
2591                                         issymlink=''
2592                                 fi
2593                                 ;;
2594                         *)      issymlink='' ;;
2595                         esac
2596                 fi              
2597         fi
2598         if $test "X$issymlink" = X; then
2599                 if $test -L sym 2>/dev/null; then
2600                         issymlink="$test -L"
2601                         echo "The builtin '$test -L' worked." >&4
2602                 fi
2603         fi
2604         if $test "X$issymlink" != X; then
2605                 echo "You can test for symbolic links with '$issymlink'." >&4
2606         else
2607                 echo "I do not know how you can test for symbolic links." >&4
2608         fi
2609         $rm -f blurfl sym
2610         ;;
2611 *)      echo "No symbolic links, so not testing for their testing..." >&4
2612         ;;
2613 esac
2614 echo " "
2615
2616
2617 case "$mksymlinks" in
2618 $define|true|[yY]*)
2619         case "$src" in
2620         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2621                 exit 1
2622                 ;;
2623         *)      case "$lns:$issymlink" in
2624                 *"ln"*" -s:"*"test -"?)
2625                         echo "Creating the symbolic links..." >&4
2626                         echo "(First creating the subdirectories...)" >&4
2627                         cd ..
2628                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2629                                 read directory
2630                                 test -z "$directory" && break
2631                                 mkdir -p $directory
2632                         done
2633                         # Sanity check 1.
2634                         if test ! -d t/base; then
2635                                 echo "Failed to create the subdirectories.  Aborting." >&4
2636                                 exit 1
2637                         fi
2638                         echo "(Then creating the symlinks...)" >&4
2639                         awk '{print $1}' $src/MANIFEST | while true; do
2640                                 read filename
2641                                 test -z "$filename" && break
2642                                 if test -f $filename; then
2643                                         if $issymlink $filename; then
2644                                                 rm -f $filename
2645                                         fi
2646                                 fi
2647                                 if test -f $filename; then
2648                                         echo "$filename already exists, not symlinking."
2649                                 else
2650                                         ln -s $src/$filename $filename
2651                                 fi
2652                         done
2653                         # Sanity check 2.
2654                         if test ! -f t/base/lex.t; then
2655                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2656                                 exit 1
2657                         fi
2658                         cd UU
2659                         ;;
2660                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2661                         ;;
2662                 esac
2663                 ;;
2664         esac
2665         ;;
2666 esac
2667
2668
2669 case "$usecrosscompile" in
2670 $define|true|[yY]*)
2671         $echo "Cross-compiling..."
2672         croak=''
2673         case "$cc" in
2674         *-*-gcc) # A cross-compiling gcc, probably.
2675             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2676             ar=$targetarch-ar
2677             # leave out ld, choosing it is more complex
2678             nm=$targetarch-nm
2679             ranlib=$targetarch-ranlib
2680             $echo 'extern int foo;' > try.c
2681             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2682             shift
2683             if $test $# -gt 0; then
2684                 incpth="$incpth $*"
2685                 incpth="`$echo $incpth|$sed 's/^ //'`"
2686                 echo "Guessing incpth '$incpth'." >&4
2687                 for i in $*; do
2688                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2689                     if $test -d $j; then
2690                         libpth="$libpth $j"
2691                     fi
2692                 done   
2693                 libpth="`$echo $libpth|$sed 's/^ //'`"
2694                 echo "Guessing libpth '$libpth'." >&4
2695             fi
2696             $rm -f try.c
2697             ;;
2698         esac
2699         case "$targetarch" in
2700         '') echo "Targetarch not defined." >&4; croak=y ;;
2701         *)  echo "Using targetarch $targetarch." >&4 ;;
2702         esac
2703         case "$incpth" in
2704         '') echo "Incpth not defined." >&4; croak=y ;;
2705         *)  echo "Using incpth '$incpth'." >&4 ;;
2706         esac
2707         case "$libpth" in
2708         '') echo "Libpth not defined." >&4; croak=y ;;
2709         *)  echo "Using libpth '$libpth'." >&4 ;;
2710         esac
2711         case "$usrinc" in
2712         '') for i in $incpth; do
2713                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2714                     usrinc=$i
2715                     echo "Guessing usrinc $usrinc." >&4
2716                     break
2717                 fi
2718             done
2719             case "$usrinc" in
2720             '') echo "Usrinc not defined." >&4; croak=y ;;
2721             esac
2722             ;;
2723         *)  echo "Using usrinc $usrinc." >&4 ;;
2724         esac
2725         case "$targethost" in
2726         '') echo "Targethost not defined." >&4; croak=y ;;
2727         *)  echo "Using targethost $targethost." >&4
2728         esac
2729         locincpth=' '
2730         loclibpth=' '
2731         case "$croak" in
2732         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2733         esac
2734         case "$src" in
2735         /*) run=$src/Cross/run
2736             targetmkdir=$src/Cross/mkdir
2737             to=$src/Cross/to
2738             from=$src/Cross/from
2739             ;;
2740         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2741             run=$pwd/Cross/run
2742             targetmkdir=$pwd/Cross/mkdir
2743             to=$pwd/Cross/to
2744             from=$pwd/Cross/from
2745             ;;
2746         esac
2747         case "$targetrun" in
2748         '') targetrun=ssh ;;
2749         esac
2750         case "$targetto" in
2751         '') targetto=scp ;;
2752         esac
2753         case "$targetfrom" in
2754         '') targetfrom=scp ;;
2755         esac
2756         run=$run-$targetrun
2757         to=$to-$targetto
2758         from=$from-$targetfrom
2759         case "$targetdir" in
2760         '')  targetdir=/tmp
2761              echo "Guessing targetdir $targetdir." >&4
2762              ;;
2763         esac
2764         case "$targetuser" in
2765         '')  targetuser=root
2766              echo "Guessing targetuser $targetuser." >&4
2767              ;;
2768         esac
2769         case "$targetfrom" in
2770         scp)    q=-q ;;
2771         *)      q='' ;;
2772         esac
2773         case "$targetrun" in
2774         ssh|rsh)
2775             cat >$run <<EOF
2776 #!/bin/sh
2777 case "\$1" in
2778 -cwd)
2779   shift
2780   cwd=\$1
2781   shift
2782   ;;
2783 esac
2784 case "\$cwd" in
2785 '') cwd=$targetdir ;;
2786 esac
2787 exe=\$1
2788 shift
2789 if $test ! -f \$exe.xok; then
2790   $to \$exe
2791   $touch \$exe.xok
2792 fi
2793 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2794 EOF
2795             ;;
2796         *)  echo "Unknown targetrun '$targetrun'" >&4
2797             exit 1
2798             ;;
2799         esac
2800         case "$targetmkdir" in
2801         */Cross/mkdir)
2802             cat >$targetmkdir <<EOF
2803 #!/bin/sh
2804 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2805 EOF
2806             $chmod a+rx $targetmkdir
2807             ;;
2808         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2809             exit 1
2810             ;;
2811         esac
2812         case "$targetto" in
2813         scp|rcp)
2814             cat >$to <<EOF
2815 #!/bin/sh
2816 for f in \$@
2817 do
2818   case "\$f" in
2819   /*)
2820     $targetmkdir \`dirname \$f\`
2821     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2822     ;;
2823   *)
2824     $targetmkdir $targetdir/\`dirname \$f\`
2825     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2826     ;;
2827   esac
2828 done
2829 exit 0
2830 EOF
2831             ;;
2832         cp) cat >$to <<EOF
2833 #!/bin/sh
2834 for f in \$@
2835 do
2836   case "\$f" in
2837   /*)
2838     $mkdir -p $targetdir/\`dirname \$f\`
2839     $cp \$f $targetdir/\$f || exit 1
2840     ;;
2841   *)
2842     $targetmkdir $targetdir/\`dirname \$f\`
2843     $cp \$f $targetdir/\$f || exit 1
2844     ;;
2845   esac
2846 done
2847 exit 0
2848 EOF
2849             ;;
2850         *)  echo "Unknown targetto '$targetto'" >&4
2851             exit 1
2852             ;;
2853         esac
2854         case "$targetfrom" in
2855         scp|rcp)
2856           cat >$from <<EOF
2857 #!/bin/sh
2858 for f in \$@
2859 do
2860   $rm -f \$f
2861   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2862 done
2863 exit 0
2864 EOF
2865             ;;
2866         cp) cat >$from <<EOF
2867 #!/bin/sh
2868 for f in \$@
2869 do
2870   $rm -f \$f
2871   cp $targetdir/\$f . || exit 1
2872 done
2873 exit 0
2874 EOF
2875             ;;
2876         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2877             exit 1
2878             ;;
2879         esac
2880         if $test ! -f $run; then
2881             echo "Target 'run' script '$run' not found." >&4
2882         else
2883             $chmod a+rx $run
2884         fi
2885         if $test ! -f $to; then
2886             echo "Target 'to' script '$to' not found." >&4
2887         else
2888             $chmod a+rx $to
2889         fi
2890         if $test ! -f $from; then
2891             echo "Target 'from' script '$from' not found." >&4
2892         else
2893             $chmod a+rx $from
2894         fi
2895         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2896             exit 1
2897         fi
2898         cat >&4 <<EOF
2899 Using '$run' for remote execution,
2900 and '$from' and '$to'
2901 for remote file transfer.
2902 EOF
2903         ;;
2904 *)      run=''
2905         to=:
2906         from=:
2907         usecrosscompile='undef'
2908         targetarch=''
2909         ;;
2910 esac
2911
2912 : see whether [:lower:] and [:upper:] are supported character classes
2913 echo " "
2914 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2915 ABYZ)
2916         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2917         up='[:upper:]'
2918         low='[:lower:]'
2919         ;;
2920 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2921         # (0xd9 and 0xe2), therefore that is a nice testing point.
2922         if test "X$up" = X -o "X$low" = X; then
2923             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2924             rs) up='[A-Z]'
2925                 low='[a-z]'
2926                 ;;
2927             esac
2928         fi
2929         if test "X$up" = X -o "X$low" = X; then
2930             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2931             rs) up='A-Z'
2932                 low='a-z'
2933                 ;;
2934             esac
2935         fi
2936         if test "X$up" = X -o "X$low" = X; then
2937             case "`echo RS | od -x 2>/dev/null`" in
2938             *D9E2*|*d9e2*)
2939                 echo "Hey, this might be EBCDIC." >&4
2940                 if test "X$up" = X -o "X$low" = X; then
2941                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2942                     rs) up='[A-IJ-RS-Z]'
2943                         low='[a-ij-rs-z]'
2944                         ;;
2945                     esac
2946                 fi
2947                 if test "X$up" = X -o "X$low" = X; then
2948                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2949                     rs) up='A-IJ-RS-Z'
2950                         low='a-ij-rs-z'
2951                         ;;
2952                     esac
2953                 fi
2954                 ;;
2955             esac
2956         fi
2957 esac
2958 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2959 rs)
2960     echo "Using $up and $low to convert case." >&4
2961     ;;
2962 *)
2963     echo "I don't know how to translate letters from upper to lower case." >&4
2964     echo "Your tr is not acting any way I know of." >&4
2965     exit 1
2966     ;;
2967 esac
2968 : set up the translation script tr, must be called with ./tr of course
2969 cat >tr <<EOSC
2970 $startsh
2971 case "\$1\$2" in
2972 '[A-Z][a-z]') exec $tr '$up' '$low';;
2973 '[a-z][A-Z]') exec $tr '$low' '$up';;
2974 esac
2975 exec $tr "\$@"
2976 EOSC
2977 chmod +x tr
2978 $eunicefix tr
2979
2980 : Try to determine whether config.sh was made on this system
2981 case "$config_sh" in
2982 '')
2983 myuname=`$uname -a 2>/dev/null`
2984 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2985 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2986 # because the A-Z/a-z are not consecutive.
2987 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2988         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2989 newmyuname="$myuname"
2990 dflt=n
2991 case "$knowitall" in
2992 '')
2993         if test -f ../config.sh; then
2994                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2995                         eval "`grep myuname= ../config.sh`"
2996                 fi
2997                 if test "X$myuname" = "X$newmyuname"; then
2998                         dflt=y
2999                 fi
3000         fi
3001         ;;
3002 *) dflt=y;;
3003 esac
3004
3005 : Get old answers from old config file if Configure was run on the
3006 : same system, otherwise use the hints.
3007 hint=default
3008 cd ..
3009 if test -f config.sh; then
3010         echo " "
3011         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3012         . UU/myread
3013         case "$ans" in
3014         n*|N*) echo "OK, I'll ignore it."
3015                 mv config.sh config.sh.old
3016                 myuname="$newmyuname"
3017                 ;;
3018         *)  echo "Fetching default answers from your old config.sh file..." >&4
3019                 tmp_n="$n"
3020                 tmp_c="$c"
3021                 tmp_sh="$sh"
3022                 . ./config.sh
3023                 cp config.sh UU
3024                 n="$tmp_n"
3025                 c="$tmp_c"
3026                 : Older versions did not always set $sh.  Catch re-use of such
3027                 : an old config.sh.
3028                 case "$sh" in
3029                 '') sh="$tmp_sh" ;;
3030                 esac
3031                 hint=previous
3032                 ;;
3033         esac
3034 fi
3035 . ./UU/checkcc
3036 if test ! -f config.sh; then
3037         $cat <<EOM
3038
3039 First time through, eh?  I have some defaults handy for some systems
3040 that need some extra help getting the Configure answers right:
3041
3042 EOM
3043         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3044         dflt=''
3045         : Half the following guesses are probably wrong... If you have better
3046         : tests or hints, please send them to perlbug@perl.org
3047         : The metaconfig authors would also appreciate a copy...
3048         $test -f /irix && osname=irix
3049         $test -f /xenix && osname=sco_xenix
3050         $test -f /dynix && osname=dynix
3051         $test -f /dnix && osname=dnix
3052         $test -f /lynx.os && osname=lynxos
3053         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3054         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3055         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3056         $test -f /bin/mips && /bin/mips && osname=mips
3057         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3058                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3059         $test -d /usr/apollo/bin && osname=apollo
3060         $test -f /etc/saf/_sactab && osname=svr4
3061         $test -d /usr/include/minix && osname=minix
3062         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3063         if $test -d /MachTen -o -d /MachTen_Folder; then
3064                 osname=machten
3065                 if $test -x /sbin/version; then
3066                         osvers=`/sbin/version | $awk '{print $2}' |
3067                         $sed -e 's/[A-Za-z]$//'`
3068                 elif $test -x /usr/etc/version; then
3069                         osvers=`/usr/etc/version | $awk '{print $2}' |
3070                         $sed -e 's/[A-Za-z]$//'`
3071                 else
3072                         osvers="$2.$3"
3073                 fi
3074         fi
3075
3076         $test -f /sys/posix.dll &&
3077                 $test -f /usr/bin/what &&
3078                 set X `/usr/bin/what /sys/posix.dll` &&
3079                 $test "$3" = UWIN &&
3080                 osname=uwin &&
3081                 osvers="$5"
3082
3083         if $test -f $uname; then
3084                 set X $myuname
3085                 shift
3086
3087                 case "$5" in
3088                 fps*) osname=fps ;;
3089                 mips*)
3090                         case "$4" in
3091                         umips) osname=umips ;;
3092                         *) osname=mips ;;
3093                         esac;;
3094                 [23]100) osname=mips ;;
3095                 next*) osname=next ;;
3096                 i386*)
3097                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3098                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3099                                 osname='sco'
3100                                 osvers=$tmp
3101                         elif $test -f /etc/kconfig; then
3102                                 osname=isc
3103                                 if test "$lns" = "$ln -s"; then
3104                                         osvers=4
3105                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3106                                         osvers=3
3107                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3108                                         osvers=2
3109                                 fi
3110                         fi
3111                         tmp=''
3112                         ;;
3113                 pc*)
3114                         if test -n "$DJGPP"; then
3115                                 osname=dos
3116                                 osvers=djgpp
3117                         fi
3118                         ;;
3119                 esac
3120
3121                 case "$1" in
3122                 aix) osname=aix
3123                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3124                         case "$tmp" in
3125                         # oslevel can fail with:
3126                         # oslevel: Unable to acquire lock.
3127                         *not\ found) osvers="$4"."$3" ;;
3128                         '<3240'|'<>3240') osvers=3.2.0 ;;
3129                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3130                         '=3250'|'>3250') osvers=3.2.5 ;;
3131                         *) osvers=$tmp;;
3132                         esac
3133                         ;;
3134                 bsd386) osname=bsd386
3135                         osvers=`$uname -r`
3136                         ;;
3137                 cygwin*) osname=cygwin
3138                         osvers="$3"
3139                         ;;
3140                 *dc.osx) osname=dcosx
3141                         osvers="$3"
3142                         ;;
3143                 dnix) osname=dnix
3144                         osvers="$3"
3145                         ;;
3146                 domainos) osname=apollo
3147                         osvers="$3"
3148                         ;;
3149                 dgux)   osname=dgux
3150                         osvers="$3"
3151                         ;;
3152                 dragonfly) osname=dragonfly
3153                         osvers="$3"
3154                         ;;
3155                 dynixptx*) osname=dynixptx
3156                         osvers=`echo "$4"|sed 's/^v//'`
3157                         ;;
3158                 freebsd) osname=freebsd
3159                         osvers="$3" ;;
3160                 genix)  osname=genix ;;
3161                 gnu)    osname=gnu
3162                         osvers="$3" ;;
3163                 hp*)    osname=hpux
3164                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3165                         ;;
3166                 irix*)  osname=irix
3167                         case "$3" in
3168                         4*) osvers=4 ;;
3169                         5*) osvers=5 ;;
3170                         *)      osvers="$3" ;;
3171                         esac
3172                         ;;
3173                 linux)  osname=linux
3174                         case "$3" in
3175                         *)      osvers="$3" ;;
3176                         esac
3177                         ;;
3178                 MiNT)   osname=mint
3179                         ;;
3180                 netbsd*) osname=netbsd
3181                         osvers="$3"
3182                         ;;
3183                 news-os) osvers="$3"
3184                         case "$3" in
3185                         4*) osname=newsos4 ;;
3186                         *) osname=newsos ;;
3187                         esac
3188                         ;;
3189                 next*) osname=next ;;
3190                 nonstop-ux) osname=nonstopux ;;
3191                 openbsd) osname=openbsd
3192                         osvers="$3"
3193                         ;;
3194                 os2)    osname=os2
3195                         osvers="$4"
3196                         ;;
3197                 POSIX-BC | posix-bc ) osname=posix-bc
3198                         osvers="$3"
3199                         ;;
3200                 powerux | power_ux | powermax_os | powermaxos | \
3201                 powerunix | power_unix) osname=powerux
3202                         osvers="$3"
3203                         ;;
3204                 qnx) osname=qnx
3205                         osvers="$4"
3206                         ;;
3207                 solaris) osname=solaris
3208                         case "$3" in
3209                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3210                         *)      osvers="$3" ;;
3211                         esac
3212                         ;;
3213                 sunos) osname=sunos
3214                         case "$3" in
3215                         5*) osname=solaris
3216                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3217                         *)      osvers="$3" ;;
3218                         esac
3219                         ;;
3220                 titanos) osname=titanos
3221                         case "$3" in
3222                         1*) osvers=1 ;;
3223                         2*) osvers=2 ;;
3224                         3*) osvers=3 ;;
3225                         4*) osvers=4 ;;
3226                         *)      osvers="$3" ;;
3227                         esac
3228                         ;;
3229                 ultrix) osname=ultrix
3230                         osvers="$3"
3231                         ;;
3232                 osf1|mls+)      case "$5" in
3233                                 alpha)
3234                                         osname=dec_osf
3235                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3236                                         case "$osvers" in
3237                                         [1-9].[0-9]*) ;;
3238                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3239                                         esac
3240                                         ;;
3241                         hp*)    osname=hp_osf1  ;;
3242                         mips)   osname=mips_osf1 ;;
3243                         esac
3244                         ;;
3245                 # UnixWare 7.1.2 is known as Open UNIX 8
3246                 openunix|unixware) osname=svr5
3247                         osvers="$4"
3248                         ;;
3249                 uts)    osname=uts
3250                         osvers="$3"
3251                         ;;
3252                 vos) osvers="$3"
3253                         ;;
3254                 $2) case "$osname" in
3255                         *isc*) ;;
3256                         *freebsd*) ;;
3257                         svr*)
3258                                 : svr4.x or possibly later
3259                                 case "svr$3" in
3260                                 ${osname}*)
3261                                         osname=svr$3
3262                                         osvers=$4
3263                                         ;;
3264                                 esac
3265                                 case "$osname" in
3266                                 svr4.0)
3267                                         : Check for ESIX
3268                                         if test -f /stand/boot ; then
3269                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3270                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3271                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3272                                                         if test -n "$isesix"; then
3273                                                                 osname=esix4
3274                                                         fi
3275                                                 fi
3276                                         fi
3277                                         ;;
3278                                 esac
3279                                 ;;
3280                         *)      if test -f /etc/systemid; then
3281                                         osname=sco
3282                                         set `echo $3 | $sed 's/\./ /g'` $4
3283                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3284                                                 osvers=$1.$2.$3
3285                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3286                                                 osvers=$1.$2
3287                                         elif $test -f $src/hints/sco_$1.sh; then
3288                                                 osvers=$1
3289                                         fi
3290                                 else
3291                                         case "$osname" in
3292                                         '') : Still unknown.  Probably a generic Sys V.
3293                                                 osname="sysv"
3294                                                 osvers="$3"
3295                                                 ;;
3296                                         esac
3297                                 fi
3298                                 ;;
3299                         esac
3300                         ;;
3301                 *)      case "$osname" in
3302                         '') : Still unknown.  Probably a generic BSD.
3303                                 osname="$1"
3304                                 osvers="$3"
3305                                 ;;
3306                         esac
3307                         ;;
3308                 esac
3309         else
3310                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3311                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3312                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3313                                 osname=news_os
3314                         fi
3315                         $rm -f UU/kernel.what
3316                 elif test -d c:/. -o -n "$is_os2" ; then
3317                         set X $myuname
3318                         osname=os2
3319                         osvers="$5"
3320                 fi
3321         fi
3322
3323         case "$targetarch" in
3324         '') ;;
3325         *)  hostarch=$osname
3326             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3327             osvers=''
3328             ;;
3329         esac
3330
3331         : Now look for a hint file osname_osvers, unless one has been
3332         : specified already.
3333         case "$hintfile" in
3334         ''|' ')
3335                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3336                 : Also try without trailing minor version numbers.
3337                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3338                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3339                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3340                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3341                 case "$file" in
3342                 '') dflt=none ;;
3343                 *)  case "$osvers" in
3344                         '') dflt=$file
3345                                 ;;
3346                         *)  if $test -f $src/hints/$file.sh ; then
3347                                         dflt=$file
3348                                 elif $test -f $src/hints/$xfile.sh ; then
3349                                         dflt=$xfile
3350                                 elif $test -f $src/hints/$xxfile.sh ; then
3351                                         dflt=$xxfile
3352                                 elif $test -f $src/hints/$xxxfile.sh ; then
3353                                         dflt=$xxxfile
3354                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3355                                         dflt=$xxxxfile
3356                                 elif $test -f "$src/hints/${osname}.sh" ; then
3357                                         dflt="${osname}"
3358                                 else
3359                                         dflt=none
3360                                 fi
3361                                 ;;
3362                         esac
3363                         ;;
3364                 esac
3365                 if $test -f Policy.sh ; then
3366                         case "$dflt" in
3367                         *Policy*) ;;
3368                         none) dflt="Policy" ;;
3369                         *) dflt="Policy $dflt" ;;
3370                         esac
3371                 fi
3372                 ;;
3373         *)
3374                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3375                 ;;
3376         esac
3377
3378         if $test -f Policy.sh ; then
3379                 $cat <<EOM
3380
3381 There's also a Policy hint file available, which should make the
3382 site-specific (policy) questions easier to answer.
3383 EOM
3384
3385         fi
3386
3387         $cat <<EOM
3388
3389 You may give one or more space-separated answers, or "none" if appropriate.
3390 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3391 previous run of Configure, you may specify it as well as or instead of
3392 OS-specific hints.  If hints are provided for your OS, you should use them:
3393 although Perl can probably be built without hints on many platforms, using
3394 hints often improve performance and may enable features that Configure can't
3395 set up on its own. If there are no hints that match your OS, specify "none";
3396 DO NOT give a wrong version or a wrong OS.
3397
3398 EOM
3399
3400         rp="Which of these apply, if any?"
3401         . UU/myread
3402         tans=$ans
3403         for file in $tans; do
3404                 if $test X$file = XPolicy -a -f Policy.sh; then
3405                         . Policy.sh
3406                         $cat Policy.sh >> UU/config.sh
3407                 elif $test -f $src/hints/$file.sh; then
3408                         . $src/hints/$file.sh
3409                         $cat $src/hints/$file.sh >> UU/config.sh
3410                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3411                         : nothing
3412                 else
3413                         : Give one chance to correct a possible typo.
3414                         echo "$file.sh does not exist"
3415                         dflt=$file
3416                         rp="hint to use instead?"
3417                         . UU/myread
3418                         for file in $ans; do
3419                                 if $test -f "$src/hints/$file.sh"; then
3420                                         . $src/hints/$file.sh
3421                                         $cat $src/hints/$file.sh >> UU/config.sh
3422                                 elif $test X$ans = X -o X$ans = Xnone ; then
3423                                         : nothing
3424                                 else
3425                                         echo "$file.sh does not exist -- ignored."
3426                                 fi
3427                         done
3428                 fi
3429         done
3430
3431         hint=recommended
3432         : Remember our hint file for later.
3433         if $test -f "$src/hints/$file.sh" ; then
3434                 hintfile="$file"
3435         else
3436                 hintfile=''
3437         fi
3438 fi
3439 cd UU
3440 ;;
3441 *)
3442         echo " "
3443         echo "Fetching default answers from $config_sh..." >&4
3444         tmp_n="$n"
3445         tmp_c="$c"
3446         cd ..
3447         cp $config_sh config.sh 2>/dev/null
3448         chmod +w config.sh
3449         . ./config.sh
3450         cd UU
3451         cp ../config.sh .
3452         n="$tmp_n"
3453         c="$tmp_c"
3454         hint=previous
3455         ;;
3456 esac
3457 test "$override" && . ./optdef.sh
3458
3459 : Restore computed paths
3460 for file in $loclist $trylist; do
3461         eval $file="\$_$file"
3462 done
3463
3464 cat << EOM
3465
3466 Configure uses the operating system name and version to set some defaults.
3467 The default value is probably right if the name rings a bell. Otherwise,
3468 since spelling matters for me, either accept the default or answer "none"
3469 to leave it blank.
3470
3471 EOM
3472 case "$osname" in
3473         ''|' ')
3474                 case "$hintfile" in
3475                 ''|' '|none) dflt=none ;;
3476                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3477                 esac
3478                 ;;
3479         *) dflt="$osname" ;;
3480 esac
3481 rp="Operating system name?"
3482 . ./myread
3483 case "$ans" in
3484 none)  osname='' ;;
3485 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3486 esac
3487 echo " "
3488 case "$osvers" in
3489         ''|' ')
3490                 case "$hintfile" in
3491                 ''|' '|none) dflt=none ;;
3492                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3493                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3494                         case "$dflt" in
3495                         ''|' ') dflt=none ;;
3496                         esac
3497                         ;;
3498                 esac
3499                 ;;
3500         *) dflt="$osvers" ;;
3501 esac
3502 rp="Operating system version?"
3503 . ./myread
3504 case "$ans" in
3505 none)  osvers='' ;;
3506 *) osvers="$ans" ;;
3507 esac
3508
3509
3510 . ./posthint.sh
3511
3512 : who configured the system
3513 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3514 case "$cf_by" in
3515 "")
3516         cf_by=`(logname) 2>/dev/null`
3517         case "$cf_by" in
3518         "")
3519                 cf_by=`(whoami) 2>/dev/null`
3520                 case "$cf_by" in
3521                 "") cf_by=unknown ;;
3522                 esac ;;
3523         esac ;;
3524 esac
3525
3526 : decide how portable to be.  Allow command line overrides.
3527 case "$d_portable" in
3528 "$undef") ;;
3529 *)      d_portable="$define" ;;
3530 esac
3531
3532 : set up shell script to do ~ expansion
3533 cat >filexp <<EOSS
3534 $startsh
3535 : expand filename
3536 case "\$1" in
3537  ~/*|~)
3538         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3539         ;;
3540  ~*)
3541         if $test -f /bin/csh; then
3542                 /bin/csh -f -c "glob \$1"
3543                 failed=\$?
3544                 echo ""
3545                 exit \$failed
3546         else
3547                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3548                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3549                 if $test ! -d "\$dir"; then
3550                         me=\`basename \$0\`
3551                         echo "\$me: can't locate home directory for: \$name" >&2
3552                         exit 1
3553                 fi
3554                 case "\$1" in
3555                 */*)
3556                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3557                         ;;
3558                 *)
3559                         echo \$dir
3560                         ;;
3561                 esac
3562         fi
3563         ;;
3564 *)
3565         echo \$1
3566         ;;
3567 esac
3568 EOSS
3569 chmod +x filexp
3570 $eunicefix filexp
3571
3572 : now set up to get a file name
3573 cat <<EOS >getfile
3574 $startsh
3575 EOS
3576 cat <<'EOSC' >>getfile
3577 tilde=''
3578 fullpath=''
3579 already=''
3580 skip=''
3581 none_ok=''
3582 exp_file=''
3583 nopath_ok=''
3584 orig_rp="$rp"
3585 orig_dflt="$dflt"
3586 case "$gfpth" in
3587 '') gfpth='.' ;;
3588 esac
3589
3590 case "$fn" in
3591 *\(*)
3592         : getfile will accept an answer from the comma-separated list
3593         : enclosed in parentheses even if it does not meet other criteria.
3594         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3595         fn=`echo $fn | sed 's/(.*)//'`
3596         ;;
3597 esac
3598
3599 case "$fn" in
3600 *:*)
3601         loc_file=`expr $fn : '.*:\(.*\)'`
3602         fn=`expr $fn : '\(.*\):.*'`
3603         ;;
3604 esac
3605
3606 case "$fn" in
3607 *~*) tilde=true;;
3608 esac
3609 case "$fn" in
3610 */*) fullpath=true;;
3611 esac
3612 case "$fn" in
3613 *+*) skip=true;;
3614 esac
3615 case "$fn" in
3616 *n*) none_ok=true;;
3617 esac
3618 case "$fn" in
3619 *e*) exp_file=true;;
3620 esac
3621 case "$fn" in
3622 *p*) nopath_ok=true;;
3623 esac
3624
3625 case "$fn" in
3626 *f*) type='File';;
3627 *d*) type='Directory';;
3628 *l*) type='Locate';;
3629 esac
3630
3631 what="$type"
3632 case "$what" in
3633 Locate) what='File';;
3634 esac
3635
3636 case "$exp_file" in
3637 '')
3638         case "$d_portable" in
3639         "$define") ;;
3640         *) exp_file=true;;
3641         esac
3642         ;;
3643 esac
3644
3645 cd ..
3646 while test "$type"; do
3647         redo=''
3648         rp="$orig_rp"
3649         dflt="$orig_dflt"
3650         case "$tilde" in
3651         true) rp="$rp (~name ok)";;
3652         esac
3653         . UU/myread
3654         if test -f UU/getfile.ok && \
3655                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3656         then
3657                 value="$ans"
3658                 ansexp="$ans"
3659                 break
3660         fi
3661         case "$ans" in
3662         none)
3663                 value=''
3664                 ansexp=''
3665                 case "$none_ok" in
3666                 true) type='';;
3667                 esac
3668                 ;;
3669         *)
3670                 case "$tilde" in
3671                 '') value="$ans"
3672                         ansexp="$ans";;
3673                 *)
3674                         value=`UU/filexp $ans`
3675                         case $? in
3676                         0)
3677                                 if test "$ans" != "$value"; then
3678                                         echo "(That expands to $value on this system.)"
3679                                 fi
3680                                 ;;
3681                         *) value="$ans";;
3682                         esac
3683                         ansexp="$value"
3684                         case "$exp_file" in
3685                         '') value="$ans";;
3686                         esac
3687                         ;;
3688                 esac
3689                 case "$fullpath" in
3690                 true)
3691                         case "$ansexp" in
3692                         /*) value="$ansexp" ;;
3693                         [a-zA-Z]:/*) value="$ansexp" ;;
3694                         *)
3695                                 redo=true
3696                                 case "$already" in
3697                                 true)
3698                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3699                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3700                                         ;;
3701                                 *)
3702                                 echo "Please give a full path name, starting with slash." >&4
3703                                         case "$tilde" in
3704                                         true)
3705                                 echo "Note that using ~name is ok provided it expands well." >&4
3706                                                 already=true
3707                                                 ;;
3708                                         esac
3709                                 esac
3710                                 ;;
3711                         esac
3712                         ;;
3713                 esac
3714                 case "$redo" in
3715                 '')
3716                         case "$type" in
3717                         File)
3718                                 for fp in $gfpth; do
3719                                         if test "X$fp" = X.; then
3720                                             pf="$ansexp"
3721                                         else    
3722                                             pf="$fp/$ansexp"
3723                                         fi
3724                                         if test -f "$pf"; then
3725                                                 type=''
3726                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3727                                         then
3728                                                 echo "($value is not a plain file, but that's ok.)"
3729                                                 type=''
3730                                         fi
3731                                         if test X"$type" = X; then
3732                                             value="$pf"
3733                                             break
3734                                         fi
3735                                 done
3736                                 ;;
3737                         Directory)
3738                                 for fp in $gfpth; do
3739                                         if test "X$fp" = X.; then
3740                                             dir="$ans"
3741                                             direxp="$ansexp"
3742                                         else    
3743                                             dir="$fp/$ansexp"
3744                                             direxp="$fp/$ansexp"
3745                                         fi
3746                                         if test -d "$direxp"; then
3747                                                 type=''
3748                                                 value="$dir"
3749                                                 break
3750                                         fi
3751                                 done
3752                                 ;;
3753                         Locate)
3754                                 if test -d "$ansexp"; then
3755                                         echo "(Looking for $loc_file in directory $value.)"
3756                                         value="$value/$loc_file"
3757                                         ansexp="$ansexp/$loc_file"
3758                                 fi
3759                                 if test -f "$ansexp"; then
3760                                         type=''
3761                                 fi
3762                                 case "$nopath_ok" in
3763                                 true)   case "$value" in
3764                                         */*) ;;
3765                                         *)      echo "Assuming $value will be in people's path."
3766                                                 type=''
3767                                                 ;;
3768                                         esac
3769                                         ;;
3770                                 esac
3771                                 ;;
3772                         esac
3773
3774                         case "$skip" in
3775                         true) type='';
3776                         esac
3777
3778                         case "$type" in
3779                         '') ;;
3780                         *)
3781                                 if test "$fastread" = yes; then
3782                                         dflt=y
3783                                 else
3784                                         dflt=n
3785                                 fi
3786                                 rp="$what $value doesn't exist.  Use that name anyway?"
3787                                 . UU/myread
3788                                 dflt=''
3789                                 case "$ans" in
3790                                 y*) type='';;
3791                                 *) echo " ";;
3792                                 esac
3793                                 ;;
3794                         esac
3795                         ;;
3796                 esac
3797                 ;;
3798         esac
3799 done
3800 cd UU
3801 ans="$value"
3802 rp="$orig_rp"
3803 dflt="$orig_dflt"
3804 rm -f getfile.ok
3805 test "X$gfpthkeep" != Xy && gfpth=""
3806 EOSC
3807
3808 : determine root of directory hierarchy where package will be installed.
3809 case "$prefix" in
3810 '')
3811         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3812         ;;
3813 *?/)
3814         dflt=`echo "$prefix" | sed 's/.$//'`
3815         ;;
3816 *)
3817         dflt="$prefix"
3818         ;;
3819 esac
3820 $cat <<EOM
3821
3822 By default, $package will be installed in $dflt/bin, manual pages
3823 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3824 installation directories. Typically this is something like /usr/local.
3825 If you wish to have binaries under /usr/bin but other parts of the
3826 installation under /usr/local, that's ok: you will be prompted
3827 separately for each of the installation directories, the prefix being
3828 only used to set the defaults.
3829
3830 EOM
3831 fn=d~
3832 rp='Installation prefix to use?'
3833 . ./getfile
3834 oldprefix=''
3835 case "$prefix" in
3836 '') ;;
3837 *)
3838         case "$ans" in
3839         "$prefix") ;;
3840         *) oldprefix="$prefix";;
3841         esac
3842         ;;
3843 esac
3844 prefix="$ans"
3845 prefixexp="$ansexp"
3846
3847 case "$afsroot" in
3848 '')     afsroot=/afs ;;
3849 *)      afsroot=$afsroot ;;
3850 esac
3851
3852 : is AFS running?
3853 echo " "
3854 case "$afs" in
3855 $define|true)   afs=true ;;
3856 $undef|false)   afs=false ;;
3857 *)      if test -d $afsroot; then
3858                 afs=true
3859         else
3860                 afs=false
3861         fi
3862         ;;
3863 esac
3864 if $afs; then
3865         echo "AFS may be running... I'll be extra cautious then..." >&4
3866 else
3867         echo "AFS does not seem to be running..." >&4
3868 fi
3869
3870 : determine installation prefix for where package is to be installed.
3871 if $afs; then 
3872 $cat <<EOM
3873
3874 Since you are running AFS, I need to distinguish the directory in which
3875 files will reside from the directory in which they are installed (and from
3876 which they are presumably copied to the former directory by occult means).
3877
3878 EOM
3879         case "$installprefix" in
3880         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3881         *) dflt="$installprefix";;
3882         esac
3883 else
3884 $cat <<EOM
3885
3886 In some special cases, particularly when building $package for distribution,
3887 it is convenient to distinguish the directory in which files should be
3888 installed from the directory ($prefix) in which they will
3889 eventually reside.  For most users, these two directories are the same.
3890
3891 EOM
3892         case "$installprefix" in
3893         '') dflt=$prefix ;;
3894         *) dflt=$installprefix;;
3895         esac
3896 fi
3897 fn=d~
3898 rp='What installation prefix should I use for installing files?'
3899 . ./getfile
3900 installprefix="$ans"
3901 installprefixexp="$ansexp"
3902
3903 : Perform the prefixexp/installprefixexp correction if necessary
3904 cat <<EOS >installprefix
3905 $startsh
3906 EOS
3907 cat <<'EOSC' >>installprefix
3908 : Change installation prefix, if necessary.
3909 if $test X"$prefix" != X"$installprefix"; then
3910     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3911 else
3912     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3913 fi
3914 EOSC
3915 chmod +x installprefix
3916 $eunicefix installprefix
3917
3918 : Set variables such as privlib and privlibexp from the output of ./getfile
3919 : performing the prefixexp/installprefixexp correction if necessary.
3920 cat <<EOS >setprefixvar
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>setprefixvar
3924 eval "${prefixvar}=\"\$ans\""
3925 eval "${prefixvar}exp=\"\$ansexp\""
3926 . ./installprefix
3927 EOSC
3928 chmod +x setprefixvar
3929 $eunicefix setprefixvar
3930
3931 : set up the script used to warn in case of inconsistency
3932 cat <<EOS >whoa
3933 $startsh
3934 EOS
3935 cat <<'EOSC' >>whoa
3936 dflt=y
3937 echo " "
3938 echo "*** WHOA THERE!!! ***" >&4
3939 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3940 rp="    Keep the $hint value?"
3941 . ./myread
3942 case "$ans" in
3943 y) td=$was; tu=$was;;
3944 esac
3945 EOSC
3946
3947 : function used to set $1 to $val
3948 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3949 case "$val$was" in
3950 $define$undef) . ./whoa; eval "$var=\$td";;
3951 $undef$define) . ./whoa; eval "$var=\$tu";;
3952 *) eval "$var=$val";;
3953 esac'
3954
3955 case "$usesocks" in
3956 $define|true|[yY]*)     dflt='y';;
3957 *) dflt='n';;
3958 esac
3959 cat <<EOM
3960
3961 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3962 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3963 to use the PerlIO abstraction layer, this will be implicitly selected.
3964
3965 If this doesn't make any sense to you, just accept the default '$dflt'.
3966 EOM
3967 rp='Build Perl for SOCKS?'
3968 . ./myread
3969 case "$ans" in
3970 y|Y)    val="$define" ;;     
3971 *)      val="$undef" ;;
3972 esac
3973 set usesocks
3974 eval $setvar
3975
3976 case "$usesocks" in
3977 $define|true|[yY]*) useperlio="$define";;
3978 esac
3979
3980 case "$useperlio" in
3981 $define|true|[yY]*|'')  dflt='y';;
3982 *) dflt='n';;
3983 esac
3984 cat <<EOM
3985
3986 Previous version of $package used the standard IO mechanisms as
3987 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3988 alternate IO mechanisms via the PerlIO abstraction layer, but the
3989 stdio mechanism is still available if needed.  The abstraction layer
3990 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3991 Using PerlIO with sfio may cause problems with some extension modules.
3992
3993 If this doesn't make any sense to you, just accept the default '$dflt'.
3994 EOM
3995 rp='Use the PerlIO abstraction layer?'
3996 . ./myread
3997 case "$ans" in
3998 y|Y) 
3999         val="$define"
4000         ;;
4001 *)      
4002         echo "Ok, doing things the stdio way."
4003         val="$undef"
4004         ;;
4005 esac
4006 set useperlio
4007 eval $setvar 
4008
4009 case "$usesocks" in
4010 $define|true|[yY]*)
4011         case "$useperlio" in
4012         $define|true|[yY]*) ;;
4013         *)      cat >&4 <<EOM
4014
4015 You are using the SOCKS proxy protocol library which means that you
4016 should also use the PerlIO layer.  You may be headed for trouble.
4017
4018 EOM
4019                 ;;
4020         esac
4021         ;;
4022 esac
4023
4024         
4025 case "$usethreads" in
4026 $define|true|[yY]*)     dflt='y';;
4027 *)     # Catch case where user specified ithreads or 5005threads but
4028        # forgot -Dusethreads (A.D. 4/2002)
4029        case "$useithreads$use5005threads" in
4030        *$define*)      
4031                 case "$useperlio" in
4032                 "$define")      dflt='y' ;;
4033                 *)              dflt='n' ;;
4034                 esac
4035                 ;;
4036        *)       dflt='n';;
4037        esac
4038        ;;
4039 esac
4040 cat <<EOM
4041
4042 Perl can be built to take advantage of threads on some systems.
4043 To do so, Configure can be run with -Dusethreads.
4044
4045 Note that Perl built with threading support runs slightly slower
4046 and uses more memory than plain Perl. The current implementation
4047 is believed to be stable, but it is fairly new, and so should be
4048 treated with caution.
4049
4050 If this doesn't make any sense to you, just accept the default '$dflt'.
4051 EOM
4052 rp='Build a threading Perl?'
4053 . ./myread
4054 case "$ans" in
4055 y|Y)    val="$define" ;;
4056 *)      val="$undef" ;;
4057 esac
4058 set usethreads
4059 eval $setvar
4060
4061 case "$usethreads" in
4062 $define)
4063         $cat <<EOM
4064
4065 Since release 5.6, Perl has had two different threading implementations,
4066 the newer interpreter-based version (ithreads) with one interpreter per
4067 thread, and the older 5.005 version (5005threads).
4068 The 5005threads version is effectively unmaintained and will probably be
4069 removed in Perl 5.10, so there should be no need to build a Perl using it
4070 unless needed for backwards compatibility with some existing 5.005threads
4071 code.
4072
4073 EOM
4074         : Default to ithreads unless overridden on command line or with
4075         : old config.sh
4076         dflt='y'
4077         case "$use5005threads" in
4078                 $define|true|[yY]*) dflt='n';;
4079         esac
4080         case "$useithreads" in
4081                 $undef|false|[nN]*) dflt='n';;
4082         esac
4083         rp='Use the newer interpreter-based ithreads?'
4084         . ./myread
4085         case "$ans" in
4086         y|Y)    val="$define" ;;
4087         *)      val="$undef" ;;
4088         esac
4089         set useithreads
4090         eval $setvar
4091         : Now set use5005threads to the opposite value.
4092         case "$useithreads" in
4093         $define) val="$undef" ;;
4094         *) val="$define" ;;
4095         esac
4096         set use5005threads
4097         eval $setvar
4098         ;;
4099 *)
4100         useithreads="$undef"
4101         use5005threads="$undef"
4102         ;;
4103 esac
4104
4105 case "$useithreads$use5005threads" in
4106 "$define$define")
4107         $cat >&4 <<EOM
4108
4109 You cannot have both the ithreads and the 5.005 threads enabled
4110 at the same time.  Disabling the 5.005 threads since they are
4111 much less stable than the ithreads.
4112
4113 EOM
4114         use5005threads="$undef"
4115         ;;
4116 esac
4117
4118 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4119         cat >&4 <<EOF
4120 ***
4121 *** To build with ithreads you must also use the PerlIO layer.
4122 *** Cannot continue, aborting.
4123 ***
4124 EOF
4125         exit 1
4126 fi
4127
4128 case "$d_oldpthreads" in
4129 '')     : Configure tests would be welcome here.  For now, assume undef.
4130         val="$undef" ;;
4131 *)      val="$d_oldpthreads" ;;
4132 esac
4133 set d_oldpthreads
4134 eval $setvar
4135
4136
4137 : Look for a hint-file generated 'call-back-unit'.  If the
4138 : user has specified that a threading perl is to be built,
4139 : we may need to set or change some other defaults.
4140 if $test -f usethreads.cbu; then
4141     echo "Your platform has some specific hints regarding threaded builds, using them..."
4142     . ./usethreads.cbu
4143 else
4144     case "$usethreads" in
4145         "$define"|true|[yY]*)
4146                 $cat <<EOM
4147 (Your platform does not have any specific hints for threaded builds.
4148  Assuming POSIX threads, then.)
4149 EOM
4150         ;;
4151     esac
4152 fi
4153
4154 cat <<EOM
4155
4156 Perl can be built so that multiple Perl interpreters can coexist
4157 within the same Perl executable.
4158 EOM
4159
4160 case "$useithreads" in
4161 $define)
4162         cat <<EOM
4163 This multiple interpreter support is required for interpreter-based threads.
4164 EOM
4165         val="$define"
4166         ;;
4167 *)      case "$usemultiplicity" in
4168         $define|true|[yY]*)     dflt='y';;
4169         *) dflt='n';;
4170         esac
4171         echo " "
4172         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4173         rp='Build Perl for multiplicity?'
4174         . ./myread
4175         case "$ans" in
4176         y|Y)    val="$define" ;;
4177         *)      val="$undef" ;;
4178         esac
4179         ;;
4180 esac
4181 set usemultiplicity
4182 eval $setvar
4183
4184
4185 case "$usemorebits" in
4186 "$define"|true|[yY]*)
4187         use64bitint="$define"
4188         uselongdouble="$define"
4189         usemorebits="$define"
4190         ;;
4191 *)      usemorebits="$undef"
4192         ;;
4193 esac
4194
4195 : make some quick guesses about what we are up against
4196 echo " "
4197 $echo $n "Hmm...  $c"
4198 echo exit 1 >bsd
4199 echo exit 1 >usg
4200 echo exit 1 >v7
4201 echo exit 1 >osf1
4202 echo exit 1 >eunice
4203 echo exit 1 >xenix
4204 echo exit 1 >venix
4205 echo exit 1 >os2
4206 d_bsd="$undef"
4207 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4208 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4209 then
4210         echo "Looks kind of like an OSF/1 system, but we'll see..."
4211         echo exit 0 >osf1
4212 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4213         xxx=`./loc addbib blurfl $pth`
4214         if $test -f $xxx; then
4215         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4216                 echo exit 0 >bsd
4217                 echo exit 0 >usg
4218         else
4219                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4220                         echo "Looks kind of like an extended USG system, but we'll see..."
4221                 else
4222                         echo "Looks kind of like a USG system, but we'll see..."
4223                 fi
4224                 echo exit 0 >usg
4225         fi
4226 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4227         echo "Looks kind of like a BSD system, but we'll see..."
4228         d_bsd="$define"
4229         echo exit 0 >bsd
4230 else
4231         echo "Looks kind of like a Version 7 system, but we'll see..."
4232         echo exit 0 >v7
4233 fi
4234 case "$eunicefix" in
4235 *unixtovms*)
4236         $cat <<'EOI'
4237 There is, however, a strange, musty smell in the air that reminds me of
4238 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4239 EOI
4240         echo exit 0 >eunice
4241         d_eunice="$define"
4242 : it so happens the Eunice I know will not run shell scripts in Unix format
4243         ;;
4244 *)
4245         echo " "
4246         echo "Congratulations.  You aren't running Eunice."
4247         d_eunice="$undef"
4248         ;;
4249 esac
4250 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4251 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4252 : semicolon as a patch separator
4253 case "$p_" in
4254 :) ;;
4255 *)
4256         $cat <<'EOI'
4257 I have the feeling something is not exactly right, however...don't tell me...
4258 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4259 (Or you may be running DOS with DJGPP.)
4260 EOI
4261         echo exit 0 >os2
4262         ;;
4263 esac
4264 if test -f /xenix; then
4265         echo "Actually, this looks more like a XENIX system..."
4266         echo exit 0 >xenix
4267         d_xenix="$define"
4268 else
4269         echo " "
4270         echo "It's not Xenix..."
4271         d_xenix="$undef"
4272 fi
4273 chmod +x xenix
4274 $eunicefix xenix
4275 if test -f /venix; then
4276         echo "Actually, this looks more like a VENIX system..."
4277         echo exit 0 >venix
4278 else
4279         echo " "
4280         if ./xenix; then
4281                 : null
4282         else
4283                 echo "Nor is it Venix..."
4284         fi
4285 fi
4286 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4287 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4288 $rm -f foo
4289
4290 case "$cc" in
4291 '') dflt=cc;;
4292 *) dflt="$cc";;
4293 esac
4294 rp="Use which C compiler?"
4295 . ./myread
4296 cc="$ans"
4297
4298 : See if they have not cc but they do have gcc
4299 . ./trygcc
4300 : Look for a hint-file generated 'call-back-unit'.  Now that the
4301 : user has specified the compiler, we may need to set or change some
4302 : other defaults.
4303 if $test -f cc.cbu; then
4304     . ./cc.cbu
4305 fi
4306 . ./checkcc
4307
4308 echo " "
4309 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4310 $cat >try.c <<EOM
4311 #include <stdio.h>
4312 int main() {
4313 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4314 #ifdef __VERSION__
4315         printf("%s\n", __VERSION__);
4316 #else
4317         printf("%s\n", "1");
4318 #endif
4319 #endif
4320         return(0);
4321 }
4322 EOM
4323 if $cc -o try $ccflags $ldflags try.c; then
4324         gccversion=`$run ./try`
4325         case "$gccversion" in
4326         '') echo "You are not using GNU cc." ;;
4327         *)  echo "You are using GNU cc $gccversion."
4328             ccname=gcc
4329             ;;
4330         esac
4331 else
4332         echo " "
4333         echo "*** WHOA THERE!!! ***" >&4
4334         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4335         case "$knowitall" in
4336         '')
4337         echo "    You'd better start hunting for one and let me know about it." >&4
4338                 exit 1
4339                 ;;
4340         esac
4341 fi
4342 $rm -f try try.*
4343 case "$gccversion" in
4344 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4345 esac
4346 case "$gccversion" in
4347 '') gccosandvers='' ;;
4348 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4349    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4350    gccshortvers=''
4351    case "$gccosandvers" in
4352    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4353    $osname$osvers) ;; # looking good
4354    $osname*) cat <<EOM >&4
4355
4356 *** WHOA THERE!!! ***
4357
4358     Your gcc has not been compiled for the exact release of
4359     your operating system ($gccosandvers versus $osname$osvers).
4360
4361     In general it is a good idea to keep gcc synchronized with
4362     the operating system because otherwise serious problems
4363     may ensue when trying to compile software, like Perl.
4364
4365     I'm trying to be optimistic here, though, and will continue.
4366     If later during the configuration and build icky compilation
4367     problems appear (headerfile conflicts being the most common
4368     manifestation), I suggest reinstalling the gcc to match
4369     your operating system release.
4370
4371 EOM
4372       ;;
4373    *) gccosandvers='' ;; # failed to parse, better be silent
4374    esac
4375    ;;
4376 esac
4377 case "$ccname" in
4378 '') ccname="$cc" ;;
4379 esac
4380
4381 # gcc 3.* complain about adding -Idirectories that they already know about,
4382 # so we will take those off from locincpth.
4383 case "$gccversion" in
4384 3*)
4385     echo "main(){}">try.c
4386     for incdir in $locincpth; do
4387        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4388              grep '^c[cp]p*[01]: warning: changing search order '`
4389        if test "X$warn" != X; then
4390            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4391        fi
4392     done
4393     $rm -f try try.*
4394 esac
4395
4396 : What should the include directory be ?
4397 echo " "
4398 $echo $n "Hmm...  $c"
4399 dflt='/usr/include'
4400 incpath=''
4401 mips_type=''
4402 if $test -f /bin/mips && /bin/mips; then
4403         echo "Looks like a MIPS system..."
4404         $cat >usr.c <<'EOCP'
4405 #ifdef SYSTYPE_BSD43
4406 /bsd43
4407 #endif
4408 EOCP
4409         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4410                 dflt='/bsd43/usr/include'
4411                 incpath='/bsd43'
4412                 mips_type='BSD 4.3'
4413         else
4414                 mips_type='System V'
4415         fi
4416         $rm -f usr.c usr.out
4417         echo "and you're compiling with the $mips_type compiler and libraries."
4418         xxx_prompt=y
4419         echo "exit 0" >mips
4420 else
4421         echo "Doesn't look like a MIPS system."
4422         xxx_prompt=n
4423         echo "exit 1" >mips
4424 fi
4425 chmod +x mips
4426 $eunicefix mips
4427 case "$usrinc" in
4428 '') ;;
4429 *) dflt="$usrinc";;
4430 esac
4431 case "$xxx_prompt" in
4432 y)      fn=d/
4433         echo " "
4434         rp='Where are the include files you want to use?'
4435         . ./getfile
4436         usrinc="$ans"
4437         ;;
4438 *)      usrinc="$dflt"
4439         ;;
4440 esac
4441
4442 : see how we invoke the C preprocessor
4443 echo " "
4444 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4445 cat <<'EOT' >testcpp.c
4446 #define ABC abc
4447 #define XYZ xyz
4448 ABC.XYZ
4449 EOT
4450 cd ..
4451 if test ! -f cppstdin; then
4452         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4453                 # AIX cc -E doesn't show the absolute headerfile
4454                 # locations but we'll cheat by using the -M flag.
4455                 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
4456         else
4457                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4458         fi
4459 else
4460         echo "Keeping your $hint cppstdin wrapper."
4461 fi
4462 chmod 755 cppstdin
4463 wrapper=`pwd`/cppstdin
4464 ok='false'
4465 cd UU
4466
4467 if $test "X$cppstdin" != "X" && \
4468         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4469         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4470 then
4471         echo "You used to use $cppstdin $cppminus so we'll use that again."
4472         case "$cpprun" in
4473         '') echo "But let's see if we can live without a wrapper..." ;;
4474         *)
4475                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4476                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4477                 then
4478                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4479                         ok='true'
4480                 else
4481                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4482                 fi
4483                 ;;
4484         esac
4485 else
4486         case "$cppstdin" in
4487         '') ;;
4488         *)
4489                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4490                 ;;
4491         esac
4492 fi
4493
4494 if $ok; then
4495         : nothing
4496 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4497         $cc -E <testcpp.c >testcpp.out 2>&1; \
4498         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4499         echo "Yup, it does."
4500         x_cpp="$cc -E"
4501         x_minus='';
4502 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4503         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4504         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4505         echo "Yup, it does."
4506         x_cpp="$cc -E"
4507         x_minus='-';
4508 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4509         $cc -P <testcpp.c >testcpp.out 2>&1; \
4510         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4511         echo "Yipee, that works!"
4512         x_cpp="$cc -P"
4513         x_minus='';
4514 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4515         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4516         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4517         echo "At long last!"
4518         x_cpp="$cc -P"
4519         x_minus='-';
4520 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4521         $cpp <testcpp.c >testcpp.out 2>&1; \
4522         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4523         echo "It works!"
4524         x_cpp="$cpp"
4525         x_minus='';
4526 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4527         $cpp - <testcpp.c >testcpp.out 2>&1; \
4528         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4529         echo "Hooray, it works!  I was beginning to wonder."
4530         x_cpp="$cpp"
4531         x_minus='-';
4532 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4533         $wrapper <testcpp.c >testcpp.out 2>&1; \
4534         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4535         x_cpp="$wrapper"
4536         x_minus=''
4537         echo "Eureka!"
4538 else
4539         dflt=''
4540         rp="No dice.  I can't find a C preprocessor.  Name one:"
4541         . ./myread
4542         x_cpp="$ans"
4543         x_minus=''
4544         $x_cpp <testcpp.c >testcpp.out 2>&1
4545         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4546                 echo "OK, that will do." >&4
4547         else
4548 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4549                 exit 1
4550         fi
4551 fi
4552
4553 case "$ok" in
4554 false)
4555         cppstdin="$x_cpp"
4556         cppminus="$x_minus"
4557         cpprun="$x_cpp"
4558         cpplast="$x_minus"
4559         set X $x_cpp
4560         shift
4561         case "$1" in
4562         "$cpp")
4563                 echo "Perhaps can we force $cc -E using a wrapper..."
4564                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4565                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4566                 then
4567                         echo "Yup, we can."
4568                         cppstdin="$wrapper"
4569                         cppminus='';
4570                 else
4571                         echo "Nope, we'll have to live without it..."
4572                 fi
4573                 ;;
4574         esac
4575         case "$cpprun" in
4576         "$wrapper")
4577                 cpprun=''
4578                 cpplast=''
4579                 ;;
4580         esac
4581         ;;
4582 esac
4583
4584 case "$cppstdin" in
4585 "$wrapper"|'cppstdin') ;;
4586 *) $rm -f $wrapper;;
4587 esac
4588 $rm -f testcpp.c testcpp.out
4589
4590 : Set private lib path
4591 case "$plibpth" in
4592 '') if ./mips; then
4593                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4594         fi;;
4595 esac
4596 case "$libpth" in
4597 ' ') dlist='';;
4598 '') dlist="$loclibpth $plibpth $glibpth";;
4599 *) dlist="$libpth";;
4600 esac
4601
4602 : Now check and see which directories actually exist, avoiding duplicates
4603 libpth=''
4604 for xxx in $dlist
4605 do
4606     if $test -d $xxx; then
4607                 case " $libpth " in
4608                 *" $xxx "*) ;;
4609                 *) libpth="$libpth $xxx";;
4610                 esac
4611     fi
4612 done
4613 $cat <<'EOM'
4614
4615 Some systems have incompatible or broken versions of libraries.  Among
4616 the directories listed in the question below, please remove any you
4617 know not to be holding relevant libraries, and add any that are needed.
4618 Say "none" for none.
4619
4620 EOM
4621 case "$libpth" in
4622 '') dflt='none';;
4623 *)
4624         set X $libpth
4625         shift
4626         dflt=${1+"$@"}
4627         ;;
4628 esac
4629 rp="Directories to use for library searches?"
4630 . ./myread
4631 case "$ans" in
4632 none) libpth=' ';;
4633 *) libpth="$ans";;
4634 esac
4635
4636 : compute shared library extension
4637 case "$so" in
4638 '')
4639         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4640                 dflt='sl'
4641         else
4642                 dflt='so'
4643         fi
4644         ;;
4645 *) dflt="$so";;
4646 esac
4647 $cat <<EOM
4648
4649 On some systems, shared libraries may be available.  Answer 'none' if
4650 you want to suppress searching of shared libraries for the remainder
4651 of this configuration.
4652
4653 EOM
4654 rp='What is the file extension used for shared libraries?'
4655 . ./myread
4656 so="$ans"
4657
4658 : Define several unixisms.
4659 : Hints files or command line option can be used to override them.
4660 : The convoluted testing is in case hints files set either the old
4661 : or the new name.
4662 case "$_exe" in
4663 '')     case "$exe_ext" in
4664         '')     ;;
4665         *)      _exe="$exe_ext" ;;
4666         esac
4667         ;;
4668 esac
4669 case "$_a" in
4670 '')     case "$lib_ext" in
4671     '') _a='.a';;
4672         *)      _a="$lib_ext" ;;
4673         esac
4674         ;;
4675 esac
4676 case "$_o" in
4677 '') case "$obj_ext" in
4678         '')     _o='.o';;
4679         *)      _o="$obj_ext";;
4680         esac
4681         ;;
4682 esac
4683 case "$p_" in
4684 '') case "$path_sep" in
4685         '')     p_=':';;
4686         *)      p_="$path_sep";;
4687         esac
4688         ;;
4689 esac
4690 exe_ext=$_exe
4691 lib_ext=$_a
4692 obj_ext=$_o
4693 path_sep=$p_
4694
4695 : Which makefile gets called first.  This is used by make depend.
4696 case "$firstmakefile" in
4697 '') firstmakefile='makefile';;
4698 esac
4699
4700 case "$ccflags" in
4701 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4702 esac
4703
4704 case "$uselongdouble" in
4705 $define|true|[yY]*)     dflt='y';;
4706 *) dflt='n';;
4707 esac
4708 cat <<EOM
4709
4710 Perl can be built to take advantage of long doubles which
4711 (if available) may give more accuracy and range for floating point numbers.
4712
4713 If this doesn't make any sense to you, just accept the default '$dflt'.
4714 EOM
4715 rp='Try to use long doubles if available?'
4716 . ./myread
4717 case "$ans" in
4718 y|Y)    val="$define"   ;;
4719 *)      val="$undef"    ;;
4720 esac
4721 set uselongdouble
4722 eval $setvar
4723
4724 case "$uselongdouble" in
4725 true|[yY]*) uselongdouble="$define" ;;
4726 esac
4727
4728 : Look for a hint-file generated 'call-back-unit'.  If the
4729 : user has specified that long doubles should be used,
4730 : we may need to set or change some other defaults.
4731 if $test -f uselongdouble.cbu; then
4732     echo "Your platform has some specific hints regarding long doubles, using them..."
4733     . ./uselongdouble.cbu
4734 else
4735     case "$uselongdouble" in
4736         $define)
4737                 $cat <<EOM
4738 (Your platform does not have any specific hints for long doubles.)
4739 EOM
4740         ;;
4741     esac
4742 fi
4743
4744 : Looking for optional libraries
4745 echo " "
4746 echo "Checking for optional libraries..." >&4
4747 case "$libs" in
4748 ' '|'') dflt='';;
4749 *) dflt="$libs";;
4750 esac
4751 case "$libswanted" in
4752 '') libswanted='c_s';;
4753 esac
4754 case "$usesocks" in
4755 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4756 esac
4757 libsfound=''
4758 libsfiles=''
4759 libsdirs=''
4760 libspath=''
4761 for thisdir in $libpth $xlibpth; do
4762   test -d $thisdir && libspath="$libspath $thisdir"
4763 done
4764 for thislib in $libswanted; do
4765         for thisdir in $libspath; do
4766             xxx=''
4767             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4768                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4769                 $test -f "$xxx" && eval $libscheck
4770                 $test -f "$xxx" && libstyle=shared
4771             fi
4772             if test ! -f "$xxx"; then
4773                 xxx=$thisdir/lib$thislib.$so
4774                 $test -f "$xxx" && eval $libscheck
4775                 $test -f "$xxx" && libstyle=shared
4776             fi  
4777             if test ! -f "$xxx"; then
4778                 xxx=$thisdir/lib$thislib$_a
4779                 $test -f "$xxx" && eval $libscheck
4780                 $test -f "$xxx" && libstyle=static
4781             fi
4782             if test ! -f "$xxx"; then
4783                 xxx=$thisdir/$thislib$_a
4784                 $test -f "$xxx" && eval $libscheck
4785                 $test -f "$xxx" && libstyle=static
4786             fi
4787             if test ! -f "$xxx"; then
4788                 xxx=$thisdir/lib${thislib}_s$_a
4789                 $test -f "$xxx" && eval $libscheck
4790                 $test -f "$xxx" && libstyle=static
4791                 $test -f "$xxx" && thislib=${thislib}_s
4792             fi
4793             if test ! -f "$xxx"; then
4794                 xxx=$thisdir/Slib$thislib$_a
4795                 $test -f "$xxx" && eval $libscheck
4796                 $test -f "$xxx" && libstyle=static
4797             fi
4798             if $test -f "$xxx"; then
4799                 case "$libstyle" in
4800                 shared) echo "Found -l$thislib (shared)." ;;
4801                 static) echo "Found -l$thislib." ;;
4802                 *)      echo "Found -l$thislib ($libstyle)." ;;
4803                 esac
4804                 case " $dflt " in
4805                 *"-l$thislib "*);;
4806                 *) dflt="$dflt -l$thislib"
4807                    libsfound="$libsfound $xxx"
4808                    yyy=`basename $xxx`
4809                    libsfiles="$libsfiles $yyy"
4810                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4811                    case " $libsdirs " in
4812                    *" $yyy "*) ;;
4813                    *) libsdirs="$libsdirs $yyy" ;;
4814                    esac
4815                    ;;
4816                 esac
4817                 break
4818             fi  
4819         done
4820         if $test ! -f "$xxx"; then
4821             echo "No -l$thislib."
4822         fi
4823 done
4824 set X $dflt
4825 shift
4826 dflt="$*"
4827 case "$libs" in
4828 '') dflt="$dflt";;
4829 *) dflt="$libs";;
4830 esac
4831 case "$dflt" in
4832 ' '|'') dflt='none';;
4833 esac
4834
4835 $cat <<EOM
4836
4837 In order to compile $package on your machine, a number of libraries
4838 are usually needed.  Include any other special libraries here as well.
4839 Say "none" for none.  The default list is almost always right.
4840 EOM
4841
4842 echo " "
4843 rp="What libraries to use?"
4844 . ./myread
4845 case "$ans" in
4846 none) libs=' ';;
4847 *) libs="$ans";;
4848 esac
4849
4850 : determine optimization, if desired, or use for debug flag also
4851 case "$optimize" in
4852 ' '|$undef) dflt='none';;
4853 '') dflt='-O';;
4854 *) dflt="$optimize";;
4855 esac
4856 $cat <<EOH
4857
4858 By default, $package compiles with the -O flag to use the optimizer.
4859 Alternately, you might want to use the symbolic debugger, which uses
4860 the -g flag (on traditional Unix systems).  Either flag can be
4861 specified here.  To use neither flag, specify the word "none".
4862
4863 EOH
4864 rp="What optimizer/debugger flag should be used?"
4865 . ./myread
4866 optimize="$ans"
4867 case "$optimize" in
4868 'none') optimize=" ";;
4869 esac
4870
4871 : Check what DEBUGGING is required from the command line
4872 : -DEBUGGING      or -DDEBUGGING or
4873 : -DEBUGGING=both                       = -g + -DDEBUGGING
4874 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4875 : -DEBUGGING=none or -UDEBUGGING        =
4876 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4877 case "$EBUGGING" in
4878 '')     ;;
4879 *)      DEBUGGING=$EBUGGING ;;
4880 esac
4881
4882 case "$DEBUGGING" in
4883 -g|$define)
4884     case "$optimize" in
4885         *-g*) ;;
4886         *)    optimize="$optimize -g" ;;
4887     esac ;;
4888 none|$undef)
4889     case "$optimize" in
4890         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4891                 shift
4892                 optimize="$*"
4893                 ;;
4894     esac ;;
4895 esac
4896
4897 dflt=''
4898 case "$DEBUGGING" in
4899 both|$define) dflt='-DDEBUGGING'
4900 esac
4901
4902 : We will not override a previous value, but we might want to
4903 : augment a hint file
4904 case "$hint" in
4905 default|recommended)
4906         case "$gccversion" in
4907         1*) dflt="$dflt -fpcc-struct-return" ;;
4908         esac
4909         case "$optimize:$DEBUGGING" in
4910         *-g*:old) dflt="$dflt -DDEBUGGING";;
4911         esac
4912         case "$gccversion" in
4913         2*) if test -d /etc/conf/kconfig.d &&
4914                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4915                 then
4916                         # Interactive Systems (ISC) POSIX mode.
4917                         dflt="$dflt -posix"
4918                 fi
4919                 ;;
4920         esac
4921         case "$gccversion" in
4922         1*) ;;
4923         2.[0-8]*) ;;
4924         ?*)     echo " "
4925                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4926                 echo 'int main(void) { return 0; }' > gcctest.c
4927                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4928                         echo "Yes, it does." 2>&1
4929                         case "$ccflags" in
4930                         *strict-aliasing*)
4931                                 echo "Leaving current flags $ccflags alone." 2>&1
4932                                 ;;
4933                         *) dflt="$dflt -fno-strict-aliasing" ;;
4934                         esac
4935                 else
4936                         echo "Nope, it doesn't, but that's ok." 2>&1
4937                 fi
4938                 ;;
4939         esac
4940         # For gcc, adding -pipe speeds up compilations for some, but apparently
4941         # some assemblers can't read from stdin.  (It also slows down compilations
4942         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4943         case "$gccversion" in
4944         ?*)     echo " "
4945                 echo "Checking if your compiler accepts -pipe" 2>&1
4946                 echo 'int main(void) { return 0; }' > gcctest.c
4947                 if $cc -pipe -o gcctest gcctest.c; then
4948                         echo "Yes, it does." 2>&1
4949                         case "$ccflags" in
4950                         *-pipe*)
4951                                 echo "Leaving current flags $ccflags alone." 2>&1
4952                                 ;;
4953                         *) dflt="$dflt -pipe" ;;
4954                         esac
4955                 else
4956                         echo "Nope, it doesn't, but that's ok." 2>&1
4957                 fi
4958                 ;;
4959         esac
4960         ;;
4961 esac
4962
4963 case "$mips_type" in
4964 *BSD*|'') inclwanted="$locincpth $usrinc";;
4965 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4966 esac
4967 for thisincl in $inclwanted; do
4968         if $test -d $thisincl; then
4969                 if $test x$thisincl != x$usrinc; then
4970                         case "$dflt" in
4971                         *" -I$thisincl "*);;
4972                         *) dflt="$dflt -I$thisincl ";;
4973                         esac
4974                 fi
4975         fi
4976 done
4977
4978 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4979         xxx=true;
4980 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4981         xxx=true;
4982 else
4983         xxx=false;
4984 fi;
4985 if $xxx; then
4986         case "$dflt" in
4987         *$2*);;
4988         *) dflt="$dflt -D$2";;
4989         esac;
4990 fi'
4991
4992 set signal.h LANGUAGE_C; eval $inctest
4993
4994 case "$usesocks" in
4995 $define)
4996         ccflags="$ccflags -DSOCKS"
4997         ;;
4998 esac
4999
5000 case "$hint" in
5001 default|recommended) dflt="$ccflags $dflt" ;;
5002 *) dflt="$ccflags";;
5003 esac
5004
5005 case "$dflt" in
5006 ''|' ') dflt=none;;
5007 esac
5008
5009 $cat <<EOH
5010
5011 Your C compiler may want other flags.  For this question you should include
5012 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5013 but you should NOT include libraries or ld flags like -lwhatever.  If you
5014 want $package to honor its debug switch, you should include -DDEBUGGING here.
5015 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5016
5017 To use no flags, specify the word "none".
5018
5019 EOH
5020 set X $dflt
5021 shift
5022 dflt=${1+"$@"}
5023 rp="Any additional cc flags?"
5024 . ./myread
5025 case "$ans" in
5026 none) ccflags='';;
5027 *) ccflags="$ans";;
5028 esac
5029
5030 : the following weeds options from ccflags that are of no interest to cpp
5031 case "$cppflags" in
5032 '') cppflags="$ccflags" ;;
5033 *)  cppflags="$cppflags $ccflags" ;;
5034 esac
5035 case "$gccversion" in
5036 1*) cppflags="$cppflags -D__GNUC__"
5037 esac
5038 case "$mips_type" in
5039 '');;
5040 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5041 esac
5042 case "$cppflags" in
5043 '');;
5044 *)
5045         echo " "
5046         echo "Let me guess what the preprocessor flags are..." >&4
5047         set X $cppflags
5048         shift
5049         cppflags=''
5050         $cat >cpp.c <<'EOM'
5051 #define BLURFL foo
5052
5053 BLURFL xx LFRULB
5054 EOM
5055         previous=''
5056         for flag in $*
5057         do
5058                 case "$flag" in
5059                 -*) ftry="$flag";;
5060                 *) ftry="$previous $flag";;
5061                 esac
5062                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5063                         >cpp1.out 2>/dev/null && \
5064                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5065                         >cpp2.out 2>/dev/null && \
5066                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5067                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5068                 then
5069                         cppflags="$cppflags $ftry"
5070                         previous=''
5071                 else
5072                         previous="$flag"
5073                 fi
5074         done
5075         set X $cppflags
5076         shift
5077         cppflags=${1+"$@"}
5078         case "$cppflags" in
5079         *-*)  echo "They appear to be: $cppflags";;
5080         esac
5081         $rm -f cpp.c cpp?.out
5082         ;;
5083 esac
5084
5085 : flags used in final linking phase
5086 case "$ldflags" in
5087 '') if ./venix; then
5088                 dflt='-i -z'
5089         else
5090                 dflt=''
5091         fi
5092         case "$ccflags" in
5093         *-posix*) dflt="$dflt -posix" ;;
5094         esac
5095         ;;
5096 *) dflt="$ldflags";;
5097 esac
5098
5099 : Try to guess additional flags to pick up local libraries.
5100 for thislibdir in $libpth; do
5101         case " $loclibpth " in
5102         *" $thislibdir "*)
5103                 case "$dflt " in
5104                 *"-L$thislibdir "*) ;;
5105                 *)  dflt="$dflt -L$thislibdir" ;;
5106                 esac
5107                 ;;
5108         esac
5109 done
5110
5111 case "$dflt" in
5112 '') dflt='none' ;;
5113 esac
5114
5115 $cat <<EOH
5116
5117 Your C linker may need flags.  For this question you should
5118 include -L/whatever and any other flags used by the C linker, but you
5119 should NOT include libraries like -lwhatever.
5120
5121 Make sure you include the appropriate -L/path flags if your C linker
5122 does not normally search all of the directories you specified above,
5123 namely
5124         $libpth
5125 To use no flags, specify the word "none".
5126
5127 EOH
5128
5129 rp="Any additional ld flags (NOT including libraries)?"
5130 . ./myread
5131 case "$ans" in
5132 none) ldflags='';;
5133 *) ldflags="$ans";;
5134 esac
5135 rmlist="$rmlist pdp11"
5136
5137 : coherency check
5138 echo " "
5139 echo "Checking your choice of C compiler and flags for coherency..." >&4
5140 $cat > try.c <<'EOF'
5141 #include <stdio.h>
5142 int main() { printf("Ok\n"); return(0); }
5143 EOF
5144 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5145 shift
5146 $cat >try.msg <<'EOM'
5147 I've tried to compile and run the following simple program:
5148
5149 EOM
5150 $cat try.c >> try.msg
5151
5152 $cat >> try.msg <<EOM
5153
5154 I used the command:
5155
5156         $*
5157         $run ./try
5158
5159 and I got the following output:
5160
5161 EOM
5162 dflt=y
5163 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5164         if $sh -c "$run ./try" >>try.msg 2>&1; then
5165                 xxx=`$run ./try`
5166                 case "$xxx" in
5167                 "Ok") dflt=n ;;
5168                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5169                         case " $libs " in
5170                         *" -lsfio "*)
5171                                 cat >> try.msg <<'EOQS'
5172 If $libs contains -lsfio, and sfio is mis-configured, then it
5173 sometimes (apparently) runs and exits with a 0 status, but with no
5174 output!  It may have to do with sfio's use of _exit vs. exit.
5175
5176 EOQS
5177                                 rp="You have a big problem.  Shall I abort Configure"
5178                                 dflt=y
5179                                 ;;
5180                         esac
5181                         ;;
5182                 esac
5183         else
5184                 echo "The program compiled OK, but exited with status $?." >>try.msg
5185                 rp="You have a problem.  Shall I abort Configure"
5186                 dflt=y
5187         fi
5188 else
5189         echo "I can't compile the test program." >>try.msg
5190         rp="You have a BIG problem.  Shall I abort Configure"
5191         dflt=y
5192 fi
5193 case "$dflt" in
5194 y)
5195         $cat try.msg >&4
5196         case "$knowitall" in
5197         '')
5198                 echo "(The supplied flags or libraries might be incorrect.)"
5199                 ;;
5200         *) dflt=n;;
5201         esac
5202         echo " "
5203         . ./myread
5204         case "$ans" in
5205         n*|N*) ;;
5206         *)      echo "Ok.  Stopping Configure." >&4
5207                 exit 1
5208                 ;;
5209         esac
5210         ;;
5211 n) echo "OK, that should do.";;
5212 esac
5213 $rm -f try try.* core
5214
5215 : define a shorthand compile call
5216 compile='
5217 mc_file=$1;
5218 shift;
5219 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5220 : define a shorthand compile call for compilations that should be ok.
5221 compile_ok='
5222 mc_file=$1;
5223 shift;
5224 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5225
5226 : determine filename position in cpp output
5227 echo " "
5228 echo "Computing filename position in cpp output for #include directives..." >&4
5229 case "$osname" in
5230 vos) testaccess=-e ;;
5231 *)   testaccess=-r ;;
5232 esac
5233 echo '#include <stdio.h>' > foo.c
5234 $cat >fieldn <<EOF
5235 $startsh
5236 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5237 $grep '^[       ]*#.*stdio\.h' | \
5238 while read cline; do
5239         pos=1
5240         set \$cline
5241         while $test \$# -gt 0; do
5242                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5243                         echo "\$pos"
5244                         exit 0
5245                 fi
5246                 shift
5247                 pos=\`expr \$pos + 1\`
5248         done
5249 done
5250 EOF
5251 chmod +x fieldn
5252 fieldn=`./fieldn`
5253 $rm -f foo.c fieldn
5254 case $fieldn in
5255 '') pos='???';;
5256 1) pos=first;;
5257 2) pos=second;;
5258 3) pos=third;;
5259 *) pos="${fieldn}th";;
5260 esac
5261 echo "Your cpp writes the filename in the $pos field of the line."
5262
5263 case "$osname" in
5264 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5265 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5266 *)   cppfilter='' ;;
5267 esac
5268 : locate header file
5269 $cat >findhdr <<EOF
5270 $startsh
5271 wanted=\$1
5272 name=''
5273 for usrincdir in $usrinc
5274 do
5275         if test -f \$usrincdir/\$wanted; then
5276                 echo "\$usrincdir/\$wanted"
5277                 exit 0
5278         fi
5279 done
5280 awkprg='{ print \$$fieldn }'
5281 echo "#include <\$wanted>" > foo\$\$.c
5282 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5283 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5284 while read cline; do
5285         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5286         case "\$name" in
5287         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5288         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5289         *) exit 2;;
5290         esac;
5291 done;
5292 #
5293 # status = 0: grep returned 0 lines, case statement not executed
5294 # status = 1: headerfile found
5295 # status = 2: while loop executed, no headerfile found
5296 #
5297 status=\$?
5298 $rm -f foo\$\$.c;
5299 if test \$status -eq 1; then
5300         exit 0;
5301 fi
5302 exit 1
5303 EOF
5304 chmod +x findhdr
5305
5306 : define an alternate in-header-list? function
5307 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5308 cont=true; xxf="echo \"<\$1> found.\" >&4";
5309 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5310 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5311 esac;
5312 case $# in 4) instead=instead;; *) instead="at last";; esac;
5313 while $test "$cont"; do
5314         xxx=`./findhdr $1`
5315         var=$2; eval "was=\$$2";
5316         if $test "$xxx" && $test -r "$xxx";
5317         then eval $xxf;
5318         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5319                 cont="";
5320         else eval $xxnf;
5321         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5322         set $yyy; shift; shift; yyy=$@;
5323         case $# in 0) cont="";;
5324         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5325                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5326         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5327                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5328         esac;
5329 done;
5330 while $test "$yyy";
5331 do set $yyy; var=$2; eval "was=\$$2";
5332         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5333         set $yyy; shift; shift; yyy=$@;
5334 done'
5335
5336 : see if stdlib is available
5337 set stdlib.h i_stdlib
5338 eval $inhdr
5339
5340 : check for lengths of integral types
5341 echo " "
5342 case "$intsize" in
5343 '')
5344         echo "Checking to see how big your integers are..." >&4
5345         $cat >try.c <<EOCP
5346 #include <stdio.h>
5347 #$i_stdlib I_STDLIB
5348 #ifdef I_STDLIB
5349 #include <stdlib.h>
5350 #endif
5351 int main()
5352 {
5353         printf("intsize=%d;\n", (int)sizeof(int));
5354         printf("longsize=%d;\n", (int)sizeof(long));
5355         printf("shortsize=%d;\n", (int)sizeof(short));
5356         exit(0);
5357 }
5358 EOCP
5359         set try
5360         if eval $compile_ok && $run ./try > /dev/null; then
5361                 eval `$run ./try`
5362                 echo "Your integers are $intsize bytes long."
5363                 echo "Your long integers are $longsize bytes long."
5364                 echo "Your short integers are $shortsize bytes long."
5365         else
5366                 $cat >&4 <<EOM
5367 !
5368 Help! I can't compile and run the intsize test program: please enlighten me!
5369 (This is probably a misconfiguration in your system or libraries, and
5370 you really ought to fix it.  Still, I'll try anyway.)
5371 !
5372 EOM
5373                 dflt=4
5374                 rp="What is the size of an integer (in bytes)?"
5375                 . ./myread
5376                 intsize="$ans"
5377                 dflt=$intsize
5378                 rp="What is the size of a long integer (in bytes)?"
5379                 . ./myread
5380                 longsize="$ans"
5381                 dflt=2
5382                 rp="What is the size of a short integer (in bytes)?"
5383                 . ./myread
5384                 shortsize="$ans"
5385         fi
5386         ;;
5387 esac
5388 $rm -f try try.*
5389
5390 : check for long long
5391 echo " "
5392 echo "Checking to see if you have long long..." >&4
5393 echo 'int main() { long long x = 7; return 0; }' > try.c
5394 set try
5395 if eval $compile; then
5396         val="$define"
5397         echo "You have long long."
5398 else
5399         val="$undef"
5400         echo "You do not have long long."
5401 fi
5402 $rm try.*
5403 set d_longlong
5404 eval $setvar
5405
5406 : check for length of long long
5407 case "${d_longlong}${longlongsize}" in
5408 $define)
5409         echo " "
5410         echo "Checking to see how big your long longs are..." >&4
5411         $cat >try.c <<'EOCP'
5412 #include <stdio.h>
5413 int main()
5414 {
5415     printf("%d\n", (int)sizeof(long long));
5416     return(0);
5417 }
5418 EOCP
5419         set try
5420         if eval $compile_ok; then
5421                 longlongsize=`$run ./try`
5422                 echo "Your long longs are $longlongsize bytes long."
5423         else
5424                 dflt='8'
5425                 echo " "
5426                 echo "(I can't seem to compile the test program.  Guessing...)"
5427                 rp="What is the size of a long long (in bytes)?"
5428                 . ./myread
5429                 longlongsize="$ans"
5430         fi
5431         if $test "X$longsize" = "X$longlongsize"; then
5432                 echo "(That isn't any different from an ordinary long.)"
5433         fi      
5434         ;;
5435 esac
5436 $rm -f try.* try
5437
5438 : see if inttypes.h is available
5439 : we want a real compile instead of Inhdr because some systems
5440 : have an inttypes.h which includes non-existent headers
5441 echo " "
5442 $cat >try.c <<EOCP
5443 #include <inttypes.h>
5444 int main() {
5445         static int32_t foo32 = 0x12345678;
5446 }
5447 EOCP
5448 set try
5449 if eval $compile; then
5450         echo "<inttypes.h> found." >&4
5451         val="$define"
5452 else
5453         echo "<inttypes.h> NOT found." >&4
5454         val="$undef"
5455 fi
5456 $rm -f try.c try
5457 set i_inttypes
5458 eval $setvar
5459
5460 : check for int64_t
5461 echo " "
5462 echo "Checking to see if you have int64_t..." >&4
5463 $cat >try.c <<EOCP
5464 #include <sys/types.h>
5465 #$i_inttypes I_INTTYPES
5466 #ifdef I_INTTYPES
5467 #include <inttypes.h>
5468 #endif
5469 int main() { int64_t x = 7; }
5470 EOCP
5471 set try
5472 if eval $compile; then
5473         val="$define"
5474         echo "You have int64_t."
5475 else
5476         val="$undef"
5477         echo "You do not have int64_t."
5478 fi
5479 $rm -f try try.*
5480 set d_int64_t
5481 eval $setvar
5482
5483
5484 echo " "
5485 echo "Checking which 64-bit integer type we could use..." >&4
5486
5487 case "$intsize" in
5488 8) val=int
5489    set quadtype
5490    eval $setvar
5491    val='"unsigned int"'
5492    set uquadtype
5493    eval $setvar
5494    quadkind=1
5495    ;;
5496 *) case "$longsize" in
5497    8) val=long
5498       set quadtype
5499       eval $setvar
5500       val='"unsigned long"'
5501       set uquadtype
5502       eval $setvar
5503       quadkind=2
5504       ;;
5505    *) case "$d_longlong:$longlongsize" in
5506       define:8)
5507         val='"long long"'
5508         set quadtype
5509         eval $setvar
5510         val='"unsigned long long"'
5511         set uquadtype
5512         eval $setvar
5513         quadkind=3
5514         ;;
5515       *) case "$d_int64_t" in
5516          define)
5517            val=int64_t
5518            set quadtype
5519            eval $setvar
5520            val=uint64_t
5521            set uquadtype
5522            eval $setvar
5523            quadkind=4
5524            ;;
5525          esac
5526          ;;
5527       esac
5528       ;;
5529    esac
5530    ;;
5531 esac
5532
5533 case "$quadtype" in
5534 '')     echo "Alas, no 64-bit integer types in sight." >&4
5535         d_quad="$undef"
5536         ;;
5537 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5538         d_quad="$define"
5539         ;;
5540 esac
5541
5542
5543 case "$uselonglong" in
5544 "$define"|true|[yY]*)
5545         cat <<EOM >&4
5546
5547 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5548 EOM
5549         use64bitint="$define"
5550         ;;
5551 esac                          
5552 case "$use64bits" in
5553 "$define"|true|[yY]*)
5554         cat <<EOM >&4
5555
5556 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5557 EOM
5558         use64bitint="$define"
5559         ;;
5560 esac                          
5561 case "$use64bitints" in
5562 "$define"|true|[yY]*)
5563         cat <<EOM >&4
5564
5565 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5566 EOM
5567         use64bitint="$define"
5568         ;;
5569 esac                          
5570 case "$use64bitsint" in
5571 "$define"|true|[yY]*)
5572         cat <<EOM >&4
5573
5574 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5575 EOM
5576         use64bitint="$define"
5577         ;;
5578 esac                          
5579 case "$uselonglongs" in
5580 "$define"|true|[yY]*)
5581         cat <<EOM >&4
5582
5583 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5584 EOM
5585         use64bitint="$define"
5586         ;;
5587 esac                          
5588 case "$use64bitsall" in
5589 "$define"|true|[yY]*)
5590         cat <<EOM >&4
5591
5592 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5593 EOM
5594         use64bitall="$define"
5595         ;;
5596 esac                          
5597
5598 case "$ccflags" in
5599 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5600 esac
5601 case "$use64bitall" in
5602 "$define"|true|[yY]*) use64bitint="$define" ;;
5603 esac
5604
5605 case "$longsize" in
5606 8) cat <<EOM
5607
5608 You have natively 64-bit long integers.
5609 EOM
5610    val="$define"
5611    ;;
5612 *) case "$use64bitint" in
5613    "$define"|true|[yY]*) dflt='y';;
5614    *) dflt='n';;
5615    esac
5616    case "$d_quad" in
5617    "$define") ;;
5618    *) dflt='n' ;;
5619    esac
5620    cat <<EOM
5621
5622 Perl can be built to take advantage of 64-bit integer types
5623 on some systems.  To do so, Configure can be run with -Duse64bitint.
5624 Choosing this option will most probably introduce binary incompatibilities.
5625
5626 If this doesn't make any sense to you, just accept the default '$dflt'.
5627 (The default has been chosen based on your configuration.)
5628 EOM
5629    rp='Try to use 64-bit integers, if available?'
5630    . ./myread
5631    case "$ans" in
5632    [yY]*) val="$define" ;;
5633    *)     val="$undef"  ;;
5634    esac
5635    ;;
5636 esac
5637 set use64bitint
5638 eval $setvar
5639
5640 case "$use64bitall" in
5641 "$define"|true|[yY]*) dflt='y' ;;
5642 *) case "$longsize" in
5643    8) dflt='y' ;;
5644    *) dflt='n' ;;
5645    esac
5646    ;;
5647 esac    
5648 cat <<EOM
5649
5650 You may also choose to try maximal 64-bitness.  It means using as much
5651 64-bitness as possible on the platform.  This in turn means even more
5652 binary incompatibilities.  On the other hand, your platform may not
5653 have any more 64-bitness available than what you already have chosen.
5654
5655 If this doesn't make any sense to you, just accept the default '$dflt'.
5656 (The default has been chosen based on your configuration.)
5657 EOM
5658 rp='Try to use maximal 64-bit support, if available?'
5659 . ./myread
5660 case "$ans" in
5661 [yY]*) val="$define" ;;
5662 *)     val="$undef"  ;;
5663 esac
5664 set use64bitall
5665 eval $setvar
5666 case "$use64bitall" in
5667 "$define")
5668         case "$use64bitint" in
5669         "$undef")
5670                 cat <<EOM
5671
5672 Since you have chosen a maximally 64-bit build, I'm also turning on
5673 the use of 64-bit integers.
5674 EOM
5675                 use64bitint="$define" ;;
5676         esac
5677         ;;
5678 esac
5679
5680 : Look for a hint-file generated 'call-back-unit'.  If the
5681 : user has specified that a 64-bit perl is to be built,
5682 : we may need to set or change some other defaults.
5683 if $test -f use64bitint.cbu; then
5684         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5685         . ./use64bitint.cbu
5686 fi
5687 case "$use64bitint" in
5688 "$define"|true|[yY]*)
5689         case "$longsize" in
5690         4) case "$archname64" in
5691            '') archname64=64int ;;
5692            esac
5693            ;;
5694         esac
5695         ;;
5696 esac
5697
5698 : Look for a hint-file generated 'call-back-unit'.  If the
5699 : user has specified that a maximally 64-bit perl is to be built,
5700 : we may need to set or change some other defaults.
5701 if $test -f use64bitall.cbu; then
5702         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5703         . ./use64bitall.cbu
5704 fi
5705 case "$use64bitall" in
5706 "$define"|true|[yY]*)
5707         case "$longsize" in
5708         4) case "$archname64" in
5709            ''|64int) archname64=64all ;;
5710            esac
5711            ;;
5712         esac
5713         ;;
5714 esac
5715
5716 case "$d_quad:$use64bitint" in
5717 $undef:$define)
5718         cat >&4 <<EOF
5719
5720 *** You have chosen to use 64-bit integers,
5721 *** but none can be found.
5722 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5723 *** Cannot continue, aborting.
5724
5725 EOF
5726         exit 1
5727         ;;
5728 esac
5729
5730 : check for length of double
5731 echo " "
5732 case "$doublesize" in
5733 '')
5734         echo "Checking to see how big your double precision numbers are..." >&4
5735         $cat >try.c <<EOCP
5736 #include <stdio.h>
5737 #$i_stdlib I_STDLIB
5738 #ifdef I_STDLIB
5739 #include <stdlib.h>
5740 #endif
5741 int main()
5742 {
5743     printf("%d\n", (int)sizeof(double));
5744     exit(0);
5745 }
5746 EOCP
5747         set try
5748         if eval $compile_ok; then
5749                 doublesize=`$run ./try`
5750                 echo "Your double is $doublesize bytes long."
5751         else
5752                 dflt='8'
5753                 echo "(I can't seem to compile the test program.  Guessing...)"
5754                 rp="What is the size of a double precision number (in bytes)?"
5755                 . ./myread
5756                 doublesize="$ans"
5757         fi
5758         ;;
5759 esac
5760 $rm -f try.c try
5761
5762 : check for long doubles
5763 echo " "
5764 echo "Checking to see if you have long double..." >&4
5765 echo 'int main() { long double x = 7.0; }' > try.c
5766 set try
5767 if eval $compile; then
5768         val="$define"
5769         echo "You have long double."
5770 else
5771         val="$undef"
5772         echo "You do not have long double."
5773 fi
5774 $rm try.*
5775 set d_longdbl
5776 eval $setvar
5777
5778 : check for length of long double
5779 case "${d_longdbl}${longdblsize}" in
5780 $define)
5781         echo " "
5782         echo "Checking to see how big your long doubles are..." >&4
5783         $cat >try.c <<'EOCP'
5784 #include <stdio.h>
5785 int main()
5786 {
5787         printf("%d\n", sizeof(long double));
5788 }
5789 EOCP
5790         set try
5791         set try
5792         if eval $compile; then
5793                 longdblsize=`$run ./try`
5794                 echo "Your long doubles are $longdblsize bytes long."
5795         else
5796                 dflt='8'
5797                 echo " "
5798                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5799                 rp="What is the size of a long double (in bytes)?"
5800                 . ./myread
5801                 longdblsize="$ans"
5802         fi
5803         if $test "X$doublesize" = "X$longdblsize"; then
5804                 echo "That isn't any different from an ordinary double."
5805                 echo "I'll keep your setting anyway, but you may see some"
5806                 echo "harmless compilation warnings."
5807         fi      
5808         ;;
5809 esac
5810 $rm -f try.* try
5811
5812 : determine the architecture name
5813 echo " "
5814 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5815         tarch=`arch`"-$osname"
5816 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5817         if uname -m > tmparch 2>&1 ; then
5818                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5819                         -e 's/$/'"-$osname/" tmparch`
5820         else
5821                 tarch="$osname"
5822         fi
5823         $rm -f tmparch
5824 else
5825         tarch="$osname"
5826 fi
5827 case "$myarchname" in
5828 ''|"$tarch") ;;
5829 *)
5830         echo "(Your architecture name used to be $myarchname.)"
5831         archname=''
5832         ;;
5833 esac
5834 case "$targetarch" in
5835 '') ;;
5836 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5837 esac
5838 myarchname="$tarch"
5839 case "$archname" in
5840 '') dflt="$tarch";;
5841 *) dflt="$archname";;
5842 esac
5843 rp='What is your architecture name'
5844 . ./myread
5845 archname="$ans"
5846 case "$usethreads" in
5847 $define)
5848         echo "Threads selected." >&4
5849         case "$archname" in
5850         *-thread*) echo "...and architecture name already has -thread." >&4
5851                 ;;
5852         *)      archname="$archname-thread"
5853                 echo "...setting architecture name to $archname." >&4
5854                 ;;
5855         esac
5856         ;;
5857 esac
5858 case "$usemultiplicity" in
5859 $define)
5860         echo "Multiplicity selected." >&4
5861         case "$archname" in
5862         *-multi*) echo "...and architecture name already has -multi." >&4
5863                 ;;
5864         *)      archname="$archname-multi"
5865                 echo "...setting architecture name to $archname." >&4
5866                 ;;
5867         esac
5868         ;;
5869 esac
5870 case "$use64bitint$use64bitall" in
5871 *"$define"*)
5872         case "$archname64" in
5873         '')
5874                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5875                 ;;
5876         *)
5877                 case "$use64bitint" in
5878                 "$define") echo "64 bit integers selected." >&4 ;;
5879                 esac
5880                 case "$use64bitall" in
5881                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5882                 esac
5883                 case "$archname" in
5884                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5885                         ;;
5886                 *)      archname="$archname-$archname64"
5887                         echo "...setting architecture name to $archname." >&4
5888                         ;;
5889                 esac
5890                 ;;
5891         esac
5892 esac
5893 case "$uselongdouble" in
5894 $define)
5895         echo "Long doubles selected." >&4
5896         case "$longdblsize" in
5897         $doublesize)
5898                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5899                 ;;
5900         *)
5901                 case "$archname" in
5902                 *-ld*) echo "...and architecture name already has -ld." >&4
5903                         ;;
5904                 *)      archname="$archname-ld"
5905                         echo "...setting architecture name to $archname." >&4
5906                         ;;
5907                 esac
5908                 ;;
5909         esac
5910         ;;
5911 esac
5912 case "$useperlio" in
5913 $define)
5914         echo "Perlio selected." >&4
5915         ;;
5916 *)
5917         echo "Perlio not selected, using stdio." >&4
5918         case "$archname" in
5919         *-stdio*) echo "...and architecture name already has -stdio." >&4
5920                 ;;
5921         *)      archname="$archname-stdio"
5922                 echo "...setting architecture name to $archname." >&4
5923                 ;;
5924         esac
5925         ;;
5926 esac
5927 if $test -f archname.cbu; then
5928         echo "Your platform has some specific hints for architecture name, using them..."
5929         . ./archname.cbu
5930 fi
5931
5932 : set the prefixit variable, to compute a suitable default value
5933 prefixit='case "$3" in
5934 ""|none)
5935         case "$oldprefix" in
5936         "") eval "$1=\"\$$2\"";;
5937         *)
5938                 case "$3" in
5939                 "") eval "$1=";;
5940                 none)
5941                         eval "tp=\"\$$2\"";
5942                         case "$tp" in
5943                         ""|" ") eval "$1=\"\$$2\"";;
5944                         *) eval "$1=";;
5945                         esac;;
5946                 esac;;
5947         esac;;
5948 *)
5949         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5950         case "$tp" in
5951         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5952         /*-$oldprefix/*|\~*-$oldprefix/*)
5953                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5954         *) eval "$1=\"\$$2\"";;
5955         esac;;
5956 esac'
5957
5958 : get the patchlevel
5959 echo " "
5960 echo "Getting the current patchlevel..." >&4
5961 if $test -r $rsrc/patchlevel.h;then
5962         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5963         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5964         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5965         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5966         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5967         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5968         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5969 else
5970         revision=0
5971         patchlevel=0
5972         subversion=0
5973         api_revision=0
5974         api_version=0
5975         api_subversion=0
5976         perl_patchlevel=0
5977         $echo "(You do not have patchlevel.h.  Eek.)"
5978 fi
5979 if $test -r $rsrc/.patch ; then
5980         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5981                 perl_patchlevel=`cat $rsrc/.patch`
5982         fi
5983 fi
5984 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5985 version_patchlevel_string="version $patchlevel subversion $subversion"
5986 case "$perl_patchlevel" in
5987 0|'') ;;
5988 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5989 esac
5990
5991 $echo "(You have $package $version_patchlevel_string.)"
5992
5993 case "$osname" in
5994 dos|vms)
5995         : XXX Should be a Configure test for double-dots in filenames.
5996         version=`echo $revision $patchlevel $subversion | \
5997                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5998         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5999                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6000         ;;
6001 *)
6002         version=`echo $revision $patchlevel $subversion | \
6003                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6004         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6005                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6006         ;;
6007 esac
6008 : Special case the 5.005_xx maintenance series, which used 5.005
6009 : without any subversion label as a subdirectory in $sitelib
6010 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6011         api_versionstring='5.005'
6012 fi
6013
6014 : determine installation style
6015 : For now, try to deduce it from prefix unless it is already set.
6016 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6017 case "$installstyle" in
6018 '')     case "$prefix" in
6019                 *perl*) dflt='lib';;
6020                 *) dflt='lib/perl5' ;;
6021         esac
6022         ;;
6023 *)      dflt="$installstyle" ;;
6024 esac
6025 : Probably not worth prompting for this since we prompt for all
6026 : the directories individually, and the prompt would be too long and
6027 : confusing anyway.
6028 installstyle=$dflt
6029
6030 : determine where public executables go
6031 echo " "
6032 set dflt bin bin
6033 eval $prefixit
6034 fn=d~
6035 rp='Pathname where the public executables will reside?'
6036 . ./getfile
6037 if $test "X$ansexp" != "X$binexp"; then
6038         installbin=''
6039 fi
6040 prefixvar=bin
6041 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6042 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6043 :     this via initialinstalllocation
6044 . ./setprefixvar
6045
6046 case "$userelocatableinc" in
6047 $define|true|[yY]*)     dflt='y' ;;
6048 *)                      dflt='n' ;;
6049 esac
6050 cat <<EOM
6051
6052 Would you like to build Perl so that the installation is relocatable, so that
6053 library paths in @INC are determined relative to the path of the perl binary?
6054 This is not advised for system Perl installs, or if you need to run setid
6055 scripts or scripts under taint mode.
6056
6057 If this doesn't make any sense to you, just accept the default '$dflt'.
6058 EOM
6059 rp='Use relocatable @INC?'
6060 . ./myread
6061 case "$ans" in
6062 y|Y)    val="$define" ;;
6063 *)      val="$undef"  ;;
6064 esac
6065 set userelocatableinc
6066 eval $setvar
6067
6068 initialinstalllocation="$binexp"
6069 : Default prefix is now "up one level from where the binaries are"
6070 case "$userelocatableinc" in
6071 $define|true|[yY]*)
6072     bin=".../"
6073     binexp=".../"
6074     prefix=".../.."
6075     prefixexp=".../.."
6076     installprefixexp=".../.."
6077     ;;
6078 esac
6079
6080 : determine where private library files go
6081 : Usual default is /usr/local/lib/perl5/$version.
6082 : Also allow things like /opt/perl/lib/$version, since
6083 : /opt/perl/lib/perl5... would be redundant.
6084 : The default "style" setting is made in installstyle.U
6085 case "$installstyle" in
6086 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6087 *)       set dflt privlib lib/$version ;;
6088 esac
6089 eval $prefixit
6090 $cat <<EOM
6091
6092 There are some auxiliary files for $package that need to be put into a
6093 private library directory that is accessible by everyone.
6094
6095 EOM
6096 fn=$binexp
6097 fn=d~+
6098 rp='Pathname where the private library files will reside?'
6099 . ./getfile
6100 prefixvar=privlib
6101 . ./setprefixvar
6102
6103 : set the prefixup variable, to restore leading tilda escape
6104 prefixup='case "$prefixexp" in
6105 "$prefix") ;;
6106 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6107 esac'
6108
6109 : determine where public architecture dependent libraries go
6110 set archlib archlib
6111 eval $prefixit
6112 : privlib default is /usr/local/lib/$package/$version
6113 : archlib default is /usr/local/lib/$package/$version/$archname
6114 : privlib may have an optional trailing /share.
6115 tdflt=`echo $privlib | $sed 's,/share$,,'`
6116 tdflt=$tdflt/$archname
6117 case "$archlib" in
6118 '')     dflt=$tdflt
6119         ;;
6120 *)      dflt="$archlib"
6121     ;;
6122 esac
6123 $cat <<EOM
6124
6125 $spackage contains architecture-dependent library files.  If you are
6126 sharing libraries in a heterogeneous environment, you might store
6127 these files in a separate location.  Otherwise, you can just include
6128 them with the rest of the public library files.
6129
6130 EOM
6131 fn=$binexp
6132 fn=d+~
6133 rp='Where do you want to put the public architecture-dependent libraries?'
6134 . ./getfile
6135 prefixvar=archlib
6136 . ./setprefixvar
6137 if $test X"$archlib" = X"$privlib"; then
6138         d_archlib="$undef"
6139 else
6140         d_archlib="$define"
6141 fi
6142
6143 : see if setuid scripts can be secure
6144 $cat <<EOM
6145
6146 Some kernels have a bug that prevents setuid #! scripts from being
6147 secure.  Some sites have disabled setuid #! scripts because of this.
6148
6149 First let's decide if your kernel supports secure setuid #! scripts.
6150 (If setuid #! scripts would be secure but have been disabled anyway,
6151 don't say that they are secure if asked.)
6152
6153 EOM
6154
6155 val="$undef"
6156 if $test -d /dev/fd; then
6157         echo "#!$ls" >reflect
6158         chmod +x,u+s reflect
6159         ./reflect >flect 2>&1
6160         if $contains "/dev/fd" flect >/dev/null; then
6161                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6162                 val="$define"
6163         else
6164                 $cat <<EOM
6165 If you are not sure if they are secure, I can check but I'll need a
6166 username and password different from the one you are using right now.
6167 If you don't have such a username or don't want me to test, simply
6168 enter 'none'.
6169
6170 EOM
6171                 rp='Other username to test security of setuid scripts with?'
6172                 dflt='none'
6173                 . ./myread
6174                 case "$ans" in
6175                 n|none)
6176                         case "$d_suidsafe" in
6177                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6178                                 dflt=n;;
6179                         "$undef")
6180                                 echo "Well, the $hint value is *not* secure." >&4
6181                                 dflt=n;;
6182                         *)      echo "Well, the $hint value *is* secure." >&4
6183                                 dflt=y;;
6184                         esac
6185                         ;;
6186                 *)
6187                         $rm -f reflect flect
6188                         echo "#!$ls" >reflect
6189                         chmod +x,u+s reflect
6190                         echo >flect
6191                         chmod a+w flect
6192                         echo '"su" will (probably) prompt you for '"$ans's password."
6193                         su $ans -c './reflect >flect'
6194                         if $contains "/dev/fd" flect >/dev/null; then
6195                                 echo "Okay, it looks like setuid scripts are secure." >&4
6196                                 dflt=y
6197                         else
6198                                 echo "I don't think setuid scripts are secure." >&4
6199                                 dflt=n
6200                         fi
6201                         ;;
6202                 esac
6203                 rp='Does your kernel have *secure* setuid scripts?'
6204                 . ./myread
6205                 case "$ans" in
6206                 [yY]*)  val="$define";;
6207                 *)      val="$undef";;
6208                 esac
6209         fi
6210 else
6211         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6212         echo "(That's for file descriptors, not floppy disks.)"
6213         val="$undef"
6214 fi
6215 set d_suidsafe
6216 eval $setvar
6217
6218 $rm -f reflect flect
6219
6220 : now see if they want to do setuid emulation
6221 echo " "
6222 val="$undef"
6223 case "$d_suidsafe" in
6224 "$define")
6225         val="$undef"
6226         echo "No need to emulate SUID scripts since they are secure here." >&4
6227         ;;
6228 *)
6229         $cat <<EOM
6230 Some systems have disabled setuid scripts, especially systems where
6231 setuid scripts cannot be secure.  On systems where setuid scripts have
6232 been disabled, the setuid/setgid bits on scripts are currently
6233 useless.  It is possible for $package to detect those bits and emulate
6234 setuid/setgid in a secure fashion.  This emulation will only work if
6235 setuid scripts have been disabled in your kernel.
6236
6237 EOM
6238         case "$d_dosuid" in
6239         "$define") dflt=y ;;
6240         *) dflt=n ;;
6241         esac
6242         rp="Do you want to do setuid/setgid emulation?"
6243         . ./myread
6244         case "$ans" in
6245         [yY]*)  val="$define";;
6246         *)      val="$undef";;
6247         esac
6248         ;;
6249 esac
6250 set d_dosuid
6251 eval $setvar
6252
6253 : Find perl5.005 or later.
6254 echo "Looking for a previously installed perl5.005 or later... "
6255 case "$perl5" in
6256 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6257                 : Check if this perl is recent and can load a simple module
6258                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6259                         perl5=$tdir/perl
6260                         break;
6261                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6262                         perl5=$tdir/perl5
6263                         break;
6264                 fi
6265         done
6266         ;;
6267 *)      perl5="$perl5"
6268         ;;
6269 esac
6270 case "$perl5" in
6271 '')     echo "None found.  That's ok.";;
6272 *)      echo "Using $perl5." ;;
6273 esac
6274
6275 $cat <<EOM
6276
6277 After $package is installed, you may wish to install various
6278 add-on modules and utilities.  Typically, these add-ons will
6279 be installed under $prefix with the rest
6280 of this package.  However, you may wish to install such add-ons
6281 elsewhere under a different prefix.
6282
6283 If you do not wish to put everything under a single prefix, that's
6284 ok.  You will be prompted for the individual locations; this siteprefix
6285 is only used to suggest the defaults.
6286
6287 The default should be fine for most people.
6288
6289 EOM
6290 fn=d~+
6291 rp='Installation prefix to use for add-on modules and utilities?'
6292 : XXX Here might be another good place for an installstyle setting.
6293 case "$siteprefix" in
6294 '') dflt=$prefix ;;
6295 *)  dflt=$siteprefix ;;
6296 esac
6297 . ./getfile
6298 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6299 oldsiteprefix=''
6300 case "$siteprefix" in
6301 '') ;;
6302 *)      case "$ans" in
6303         "$prefix") ;;
6304         *) oldsiteprefix="$prefix";;
6305         esac
6306         ;;
6307 esac
6308 siteprefix="$ans"
6309 siteprefixexp="$ansexp"
6310
6311 : determine where site specific libraries go.
6312 : Usual default is /usr/local/lib/perl5/site_perl/$version
6313 : The default "style" setting is made in installstyle.U
6314 : XXX No longer works with Prefixit stuff.
6315 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6316 case "$sitelib" in
6317 '') case "$installstyle" in
6318         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6319         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6320         esac
6321         ;;
6322 *)      dflt="$sitelib"
6323         ;;
6324 esac
6325 $cat <<EOM
6326
6327 The installation process will create a directory for
6328 site-specific extensions and modules.  Most users find it convenient
6329 to place all site-specific files in this directory rather than in the
6330 main distribution directory.
6331
6332 EOM
6333 fn=d~+
6334 rp='Pathname for the site-specific library files?'
6335 . ./getfile
6336 prefixvar=sitelib
6337 . ./setprefixvar
6338 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6339
6340 : Determine list of previous versions to include in @INC
6341 $cat > getverlist <<EOPL
6342 #!$perl5 -w
6343 use File::Basename;
6344 \$api_versionstring = "$api_versionstring";
6345 \$version = "$version";
6346 \$stem = "$sitelib_stem";
6347 \$archname = "$archname";
6348 EOPL
6349         $cat >> getverlist <<'EOPL'
6350 # The list found is store twice for each entry: the original name, and
6351 # the binary broken down version as pack "sss", so sorting is easy and
6352 # unambiguous. This will work for all versions that have a maximum of
6353 # three digit groups, separate by '.'s or '_'s. Names are extended with
6354 # ".0.0" to ensure at least three elements for the pack.
6355 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6356
6357 # Can't have leading @ because metaconfig interprets it as a command!
6358 ;@inc_version_list=();
6359 # XXX Redo to do opendir/readdir?
6360 if (-d $stem) {
6361     chdir($stem);
6362     ;@candidates = map {
6363         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6364 }
6365 else {
6366     ;@candidates = ();
6367 }
6368
6369 ($pversion, $aversion, $vsn5005) = map {
6370     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6371 foreach $d (@candidates) {
6372     if ($d->[1] lt $pversion) {
6373         if ($d->[1] ge $aversion) {
6374             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6375         }
6376         elsif ($d->[1] ge $vsn5005) {
6377             unshift(@inc_version_list, grep { -d } $d->[0]);
6378         }
6379     }
6380     else {
6381         # Skip newer version.  I.e. don't look in
6382         # 5.7.0 if we're installing 5.6.1.
6383     }
6384 }
6385
6386 if (@inc_version_list) {
6387     print join(' ', @inc_version_list);
6388 }
6389 else {
6390     # Blank space to preserve value for next Configure run.
6391     print " ";
6392 }
6393 EOPL
6394 chmod +x getverlist
6395 case "$inc_version_list" in
6396 '')     if test -x "$perl5$exe_ext"; then
6397                 dflt=`$perl5 getverlist`
6398         else
6399                 dflt='none'
6400         fi
6401         ;;
6402 $undef) dflt='none' ;;
6403 *)  eval dflt=\"$inc_version_list\" ;;
6404 esac
6405 case "$dflt" in
6406 ''|' ') dflt=none ;;
6407 esac
6408 case "$dflt" in
6409 5.005) dflt=none ;;
6410 esac
6411 $cat <<EOM
6412
6413 In order to ease the process of upgrading, this version of perl
6414 can be configured to use modules built and installed with earlier
6415 versions of perl that were installed under $prefix.  Specify here
6416 the list of earlier versions that this version of perl should check.
6417 If Configure detected no earlier versions of perl installed under
6418 $prefix, then the list will be empty.  Answer 'none' to tell perl
6419 to not search earlier versions.
6420
6421 The default should almost always be sensible, so if you're not sure,
6422 just accept the default.
6423 EOM
6424
6425 rp='List of earlier versions to include in @INC?'
6426 . ./myread
6427 case "$ans" in
6428 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6429 *) inc_version_list="$ans" ;;
6430 esac
6431 case "$inc_version_list" in
6432 ''|' ')
6433         inc_version_list_init='0'
6434         d_inc_version_list="$undef"
6435         ;;
6436 *)      inc_version_list_init=`echo $inc_version_list |
6437                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6438         d_inc_version_list="$define"
6439         ;;
6440 esac
6441 $rm -f getverlist
6442
6443 : see if this is a malloc.h system
6444 : we want a real compile instead of Inhdr because some systems have a
6445 : malloc.h that just gives a compile error saying to use stdlib.h instead
6446 echo " "
6447 $cat >try.c <<EOCP
6448 #include <stdlib.h>
6449 #include <malloc.h>
6450 int main () { return 0; }
6451 EOCP
6452 set try
6453 if eval $compile; then
6454     echo "<malloc.h> found." >&4
6455     val="$define"
6456 else
6457     echo "<malloc.h> NOT found." >&4
6458     val="$undef"
6459 fi
6460 $rm -f try.c try
6461 set i_malloc
6462 eval $setvar
6463
6464 : check for void type
6465 echo " "
6466 echo "Checking to see how well your C compiler groks the void type..." >&4
6467 case "$voidflags" in
6468 '')
6469         $cat >try.c <<EOCP
6470 #$i_stdlib I_STDLIB
6471 #ifdef I_STDLIB
6472 #include <stdlib.h>
6473 #endif
6474 #if TRY & 1
6475 void sub() {
6476 #else
6477 sub() {
6478 #endif
6479         extern void moo();      /* function returning void */
6480         void (*goo)();          /* ptr to func returning void */
6481 #if TRY & 8
6482         void *hue;              /* generic ptr */
6483 #endif
6484 #if TRY & 2
6485         void (*foo[10])();
6486 #endif
6487
6488 #if TRY & 4
6489         if(goo == moo) {
6490                 exit(0);
6491         }
6492 #endif
6493         exit(0);
6494 }
6495 int main() { sub(); }
6496 EOCP
6497         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6498                 voidflags=$defvoidused
6499         echo "Good.  It appears to support void to the level $package wants.">&4
6500                 if $contains warning .out >/dev/null 2>&1; then
6501                         echo "However, you might get some warnings that look like this:"
6502                         $cat .out
6503                 fi
6504         else
6505 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6506                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6507                         echo "It supports 1..."
6508                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6509                                 echo "It also supports 2..."
6510                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6511                                         voidflags=7
6512                                         echo "And it supports 4 but not 8 definitely."
6513                                 else
6514                                         echo "It doesn't support 4..."
6515                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6516                                                 voidflags=11
6517                                                 echo "But it supports 8."
6518                                         else
6519                                                 voidflags=3
6520                                                 echo "Neither does it support 8."
6521                                         fi
6522                                 fi
6523                         else
6524                                 echo "It does not support 2..."
6525                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6526                                         voidflags=13
6527                                         echo "But it supports 4 and 8."
6528                                 else
6529                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6530                                                 voidflags=5
6531                                                 echo "And it supports 4 but has not heard about 8."
6532                                         else
6533                                                 echo "However it supports 8 but not 4."
6534                                         fi
6535                                 fi
6536                         fi
6537                 else
6538                         echo "There is no support at all for void."
6539                         voidflags=0
6540                 fi
6541         fi
6542 esac
6543 case "$voidflags" in
6544 "$defvoidused") ;;
6545 *)      $cat >&4 <<'EOM'
6546   Support flag bits are:
6547     1: basic void declarations.
6548     2: arrays of pointers to functions returning void.
6549     4: operations between pointers to and addresses of void functions.
6550     8: generic void pointers.
6551 EOM
6552         dflt="$voidflags";
6553         rp="Your void support flags add up to what?"
6554         . ./myread
6555         voidflags="$ans"
6556         ;;
6557 esac
6558 $rm -f try.* .out
6559
6560 : check for length of pointer
6561 echo " "
6562 case "$ptrsize" in
6563 '')
6564         echo "Checking to see how big your pointers are..." >&4
6565         if test "$voidflags" -gt 7; then
6566                 echo '#define VOID_PTR char *' > try.c
6567         else
6568                 echo '#define VOID_PTR void *' > try.c
6569         fi
6570         $cat >>try.c <<EOCP
6571 #include <stdio.h>
6572 #$i_stdlib I_STDLIB
6573 #ifdef I_STDLIB
6574 #include <stdlib.h>
6575 #endif
6576 int main()
6577 {
6578     printf("%d\n", (int)sizeof(VOID_PTR));
6579     exit(0);
6580 }
6581 EOCP
6582         set try
6583         if eval $compile_ok; then
6584                 ptrsize=`$run ./try`
6585                 echo "Your pointers are $ptrsize bytes long."
6586         else
6587                 dflt='4'
6588                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6589                 rp="What is the size of a pointer (in bytes)?"
6590                 . ./myread
6591                 ptrsize="$ans"
6592         fi
6593         ;;
6594 esac
6595 $rm -f try.c try
6596 case "$use64bitall" in
6597 "$define"|true|[yY]*)
6598         case "$ptrsize" in
6599         4)      cat <<EOM >&4
6600
6601 *** You have chosen a maximally 64-bit build,
6602 *** but your pointers are only 4 bytes wide.
6603 *** Please rerun Configure without -Duse64bitall.
6604 EOM
6605                 case "$d_quad" in
6606                 define)
6607                         cat <<EOM >&4
6608 *** Since you have quads, you could possibly try with -Duse64bitint.
6609 EOM
6610                         ;;
6611                 esac
6612                 cat <<EOM >&4
6613 *** Cannot continue, aborting.
6614
6615 EOM
6616
6617                 exit 1
6618                 ;;
6619         esac
6620         ;;
6621 esac
6622
6623
6624 : determine whether to use malloc wrapping
6625 echo " "
6626 case "$usemallocwrap" in
6627 [yY]*|true|$define)     dflt='y' ;;
6628 [nN]*|false|$undef)     dflt='n' ;;
6629 *)      case "$usedevel" in
6630         [yY]*|true|$define)     dflt='y' ;;
6631         *) dflt='n' ;;
6632         esac
6633         ;;
6634 esac
6635 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6636 . ./myread
6637 usemallocwrap="$ans"
6638 case "$ans" in
6639 y*|true)
6640         usemallocwrap="$define" ;;
6641 *)
6642         usemallocwrap="$undef" ;;
6643 esac
6644
6645 : determine which malloc to compile in
6646 echo " "
6647 case "$usemymalloc" in
6648 [yY]*|true|$define)     dflt='y' ;;
6649 [nN]*|false|$undef)     dflt='n' ;;
6650 *)      case "$ptrsize" in
6651         4) dflt='y' ;;
6652         *) dflt='n' ;;
6653         esac
6654         ;;
6655 esac
6656 rp="Do you wish to attempt to use the malloc that comes with $package?"
6657 . ./myread
6658 usemymalloc="$ans"
6659 case "$ans" in
6660 y*|true)
6661         usemymalloc='y'
6662         mallocsrc='malloc.c'
6663         mallocobj="malloc$_o"
6664         d_mymalloc="$define"
6665         case "$libs" in
6666         *-lmalloc*)
6667                 : Remove malloc from list of libraries to use
6668                 echo "Removing unneeded -lmalloc from library list" >&4
6669                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6670                 shift
6671                 libs="$*"
6672                 echo "libs = $libs" >&4
6673                 ;;
6674         esac
6675         ;;
6676 *)
6677         usemymalloc='n'
6678         mallocsrc=''
6679         mallocobj=''
6680         d_mymalloc="$undef"
6681         ;;
6682 esac
6683
6684 : compute the return types of malloc and free
6685 echo " "
6686 $cat >malloc.c <<END
6687 #$i_malloc I_MALLOC
6688 #$i_stdlib I_STDLIB
6689 #include <stdio.h>
6690 #include <sys/types.h>
6691 #ifdef I_MALLOC
6692 #include <malloc.h>
6693 #endif
6694 #ifdef I_STDLIB
6695 #include <stdlib.h>
6696 #endif
6697 #ifdef TRY_MALLOC
6698 void *malloc();
6699 #endif
6700 #ifdef TRY_FREE
6701 void free();
6702 #endif
6703 END
6704 case "$malloctype" in
6705 '')
6706         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6707                 malloctype='void *'
6708         else
6709                 malloctype='char *'
6710         fi
6711         ;;
6712 esac
6713 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6714
6715 case "$freetype" in
6716 '')
6717         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6718                 freetype='void'
6719         else
6720                 freetype='int'
6721         fi
6722         ;;
6723 esac
6724 echo "Your system uses $freetype free(), it would seem." >&4
6725 $rm -f malloc.[co]
6726 : determine where site specific architecture-dependent libraries go.
6727 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6728 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6729 : sitelib may have an optional trailing /share.
6730 case "$sitearch" in
6731 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6732         dflt="$dflt/$archname"
6733         ;;
6734 *)      dflt="$sitearch"
6735         ;;
6736 esac
6737 set sitearch sitearch none
6738 eval $prefixit
6739 $cat <<EOM
6740
6741 The installation process will also create a directory for
6742 architecture-dependent site-specific extensions and modules.
6743
6744 EOM
6745 fn=d~+
6746 rp='Pathname for the site-specific architecture-dependent library files?'
6747 . ./getfile
6748 prefixvar=sitearch
6749 . ./setprefixvar
6750 if $test X"$sitearch" = X"$sitelib"; then
6751         d_sitearch="$undef"
6752 else
6753         d_sitearch="$define"
6754 fi
6755
6756 $cat <<EOM
6757
6758 The installation process will also create a directory for
6759 vendor-supplied add-ons.  Vendors who supply perl with their system
6760 may find it convenient to place all vendor-supplied files in this
6761 directory rather than in the main distribution directory.  This will
6762 ease upgrades between binary-compatible maintenance versions of perl.
6763
6764 Of course you may also use these directories in whatever way you see
6765 fit.  For example, you might use them to access modules shared over a
6766 company-wide network.
6767
6768 The default answer should be fine for most people.
6769 This causes further questions about vendor add-ons to be skipped
6770 and no vendor-specific directories will be configured for perl.
6771
6772 EOM
6773 rp='Do you want to configure vendor-specific add-on directories?'
6774 case "$usevendorprefix" in
6775 define|true|[yY]*) dflt=y ;;
6776 *)      : User may have set vendorprefix directly on Configure command line.
6777         case "$vendorprefix" in
6778         ''|' ') dflt=n ;;
6779         *)      dflt=y ;;
6780         esac
6781         ;;
6782 esac
6783 . ./myread
6784 case "$ans" in
6785 [yY]*)  fn=d~+
6786         rp='Installation prefix to use for vendor-supplied add-ons?'
6787         case "$vendorprefix" in
6788         '') dflt='' ;;
6789         *)  dflt=$vendorprefix ;;
6790         esac
6791         . ./getfile
6792         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6793         oldvendorprefix=''
6794         case "$vendorprefix" in
6795         '') ;;
6796         *)      case "$ans" in
6797                 "$prefix") ;;
6798                 *) oldvendorprefix="$prefix";;
6799                 esac
6800                 ;;
6801         esac
6802         usevendorprefix="$define"
6803         vendorprefix="$ans"
6804         vendorprefixexp="$ansexp"
6805         ;;
6806 *)      usevendorprefix="$undef"
6807         vendorprefix=''
6808         vendorprefixexp=''
6809         ;;
6810 esac
6811
6812 case "$vendorprefix" in
6813 '')     d_vendorlib="$undef"
6814         vendorlib=''
6815         vendorlibexp=''
6816         ;;
6817 *)      d_vendorlib="$define"
6818         : determine where vendor-supplied modules go.
6819         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6820         case "$vendorlib" in
6821         '')
6822                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6823                 case "$installstyle" in
6824                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6825                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6826                 esac
6827                 ;;
6828         *)      dflt="$vendorlib"
6829                 ;;
6830         esac
6831         fn=d~+
6832         rp='Pathname for the vendor-supplied library files?'
6833         . ./getfile
6834         vendorlib="$ans"
6835         vendorlibexp="$ansexp"
6836         ;;
6837 esac
6838 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6839 prefixvar=vendorlib
6840 . ./installprefix
6841
6842 case "$vendorprefix" in
6843 '')     d_vendorarch="$undef"
6844         vendorarch=''
6845         vendorarchexp=''
6846         ;;
6847 *)      d_vendorarch="$define"
6848         : determine where vendor-supplied architecture-dependent libraries go.
6849         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6850         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6851         : vendorlib may have an optional trailing /share.
6852         case "$vendorarch" in
6853         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6854                 dflt="$dflt/$archname"
6855                 ;;
6856         *)      dflt="$vendorarch" ;;
6857         esac
6858         fn=d~+
6859         rp='Pathname for vendor-supplied architecture-dependent files?'
6860         . ./getfile
6861         vendorarch="$ans"
6862         vendorarchexp="$ansexp"
6863         ;;
6864 esac
6865 prefixvar=vendorarch
6866 . ./installprefix
6867
6868 : Final catch-all directories to search
6869 $cat <<EOM
6870
6871 Lastly, you can have perl look in other directories for extensions and
6872 modules in addition to those already specified.
6873 These directories will be searched after 
6874         $sitearch 
6875         $sitelib 
6876 EOM
6877 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6878 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6879 echo ' '
6880 case "$otherlibdirs" in
6881 ''|' ') dflt='none' ;;
6882 *)      dflt="$otherlibdirs" ;;
6883 esac
6884 $cat <<EOM
6885 Enter a colon-separated set of extra paths to include in perl's @INC
6886 search path, or enter 'none' for no extra paths.
6887
6888 EOM
6889
6890 rp='Colon-separated list of additional directories for perl to search?'
6891 . ./myread
6892 case "$ans" in
6893 ' '|''|none)    otherlibdirs=' ' ;;     
6894 *)      otherlibdirs="$ans" ;;
6895 esac
6896 case "$otherlibdirs" in
6897 ' ') val=$undef ;;
6898 *)      val=$define ;;
6899 esac
6900 set d_perl_otherlibdirs
6901 eval $setvar
6902
6903 : Cruising for prototypes
6904 echo " "
6905 echo "Checking out function prototypes..." >&4
6906 $cat >prototype.c <<EOCP
6907 #$i_stdlib I_STDLIB
6908 #ifdef I_STDLIB
6909 #include <stdlib.h>
6910 #endif
6911 int main(int argc, char *argv[]) {
6912         exit(0);}
6913 EOCP
6914 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6915         echo "Your C compiler appears to support function prototypes."
6916         val="$define"
6917 else
6918         echo "Your C compiler doesn't seem to understand function prototypes."
6919         val="$undef"
6920 fi
6921 set prototype
6922 eval $setvar
6923 $rm -f prototype*
6924
6925 case "$prototype" in
6926 "$define") ;;
6927 *)      ansi2knr='ansi2knr'
6928         echo " "
6929         cat <<EOM >&4
6930
6931 $me:  FATAL ERROR:
6932 This version of $package can only be compiled by a compiler that 
6933 understands function prototypes.  Unfortunately, your C compiler 
6934         $cc $ccflags
6935 doesn't seem to understand them.  Sorry about that.
6936
6937 If GNU cc is available for your system, perhaps you could try that instead.  
6938
6939 Eventually, we hope to support building Perl with pre-ANSI compilers.
6940 If you would like to help in that effort, please contact <perlbug@perl.org>.
6941
6942 Aborting Configure now.
6943 EOM
6944         exit 2
6945         ;;
6946 esac
6947
6948 echo " "
6949 case "$extras" in
6950 '') dflt='n';;
6951 *) dflt='y';;
6952 esac
6953 cat <<EOM
6954 Perl can be built with extra modules or bundles of modules which
6955 will be fetched from the CPAN and installed alongside Perl.
6956
6957 Notice that you will need access to the CPAN; either via the Internet,
6958 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6959 be asked later to configure the CPAN.pm module which will in turn do
6960 the installation of the rest of the extra modules or bundles.)
6961
6962 Notice also that if the modules require any external software such as
6963 libraries and headers (the libz library and the zlib.h header for the
6964 Compress::Zlib module, for example) you MUST have any such software
6965 already installed, this configuration process will NOT install such
6966 things for you.
6967
6968 If this doesn't make any sense to you, just accept the default '$dflt'.
6969 EOM
6970 rp='Install any extra modules (y or n)?'
6971 . ./myread
6972 case "$ans" in
6973 y|Y)
6974         cat <<EOM
6975
6976 Please list any extra modules or bundles to be installed from CPAN,
6977 with spaces between the names.  The names can be in any format the
6978 'install' command of CPAN.pm will understand.  (Answer 'none',
6979 without the quotes, to install no extra modules or bundles.)
6980 EOM
6981         rp='Extras?'
6982         dflt="$extras"
6983         . ./myread
6984         extras="$ans"
6985 esac
6986 case "$extras" in
6987 ''|'none')
6988         val=''
6989         $rm -f ../extras.lst
6990         ;;
6991 *)      echo "(Saving the list of extras for later...)"
6992         echo "$extras" > ../extras.lst
6993         val="'$extras'"
6994         ;;
6995 esac
6996 set extras
6997 eval $setvar
6998 echo " "
6999
7000 : determine where html pages for programs go
7001 set html1dir html1dir none
7002 eval $prefixit
7003 $cat <<EOM
7004
7005 If you wish to install html files for programs in $spackage, indicate
7006 the appropriate directory here.  To skip installing html files,
7007 answer "none".
7008 EOM
7009 case "$html1dir" in
7010 ''|none|$undef|' ') dflt=none ;;
7011 *) dflt=$html1dir ;;
7012 esac
7013 fn=dn+~
7014 rp="Directory for the main $spackage html pages?"
7015 . ./getfile
7016 prefixvar=html1dir
7017 . ./setprefixvar
7018 : Use ' ' for none so value is preserved next time through Configure
7019 $test X"$html1dir" = "X" && html1dir=' '
7020
7021 : determine where html pages for libraries and modules go
7022 set html3dir html3dir none
7023 eval $prefixit
7024 $cat <<EOM
7025
7026 If you wish to install html files for modules associated with $spackage,
7027 indicate the appropriate directory here.  To skip installing html files,
7028 answer "none".
7029 EOM
7030 : There is no obvious default.  If they have specified html1dir, then
7031 : try to key off that, possibly changing .../html1 into .../html3.
7032 case "$html3dir" in
7033 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7034 *) dflt=$html3dir ;;
7035 esac
7036 fn=dn+~
7037 rp="Directory for the $spackage module html pages?"
7038 . ./getfile
7039 prefixvar=html3dir
7040 . ./setprefixvar
7041 : Use ' ' for none so value is preserved next time through Configure
7042 $test X"$html3dir" = "X" && html3dir=' '
7043
7044 : determine whether to install perl also as /usr/bin/perl
7045
7046 echo " "
7047 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7048         $cat <<EOM
7049 Many scripts expect perl to be installed as /usr/bin/perl.
7050
7051 If you want to, I can install the perl you are about to compile
7052 as /usr/bin/perl (in addition to $bin/perl).
7053 EOM
7054         if test -f /usr/bin/perl; then
7055             $cat <<EOM
7056
7057 However, please note that because you already have a /usr/bin/perl,
7058 overwriting that with a new Perl would very probably cause problems.
7059 Therefore I'm assuming you don't want to do that (unless you insist).
7060
7061 EOM
7062             case "$installusrbinperl" in
7063             "$define"|[yY]*)    dflt='y';;
7064             *)                  dflt='n';;
7065             esac
7066         else
7067             $cat <<EOM
7068
7069 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7070
7071 EOM
7072             case "$installusrbinperl" in
7073             "$undef"|[nN]*)     dflt='n';;
7074             *)                  dflt='y';;
7075             esac
7076         fi
7077         rp="Do you want to install perl as /usr/bin/perl?"
7078         . ./myread
7079         case "$ans" in
7080         [yY]*)  val="$define";;
7081         *)      val="$undef" ;;
7082         esac
7083 else
7084         val="$undef"
7085 fi
7086 set installusrbinperl
7087 eval $setvar
7088
7089 echo " "
7090 echo "Checking for GNU C Library..." >&4
7091 cat >try.c <<'EOCP'
7092 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7093    alone are insufficient to distinguish different versions, such as
7094    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7095    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7096 */
7097 #include <stdio.h>
7098 int main(void)
7099 {
7100 #ifdef __GLIBC__
7101 #   ifdef __GLIBC_MINOR__
7102 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7103 #           include <gnu/libc-version.h>
7104             printf("%s\n",  gnu_get_libc_version());
7105 #       else
7106             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7107 #       endif
7108 #   else
7109         printf("%d\n",  __GLIBC__);
7110 #   endif
7111     return 0;
7112 #else
7113     return 1;
7114 #endif
7115 }
7116 EOCP
7117 set try
7118 if eval $compile_ok && $run ./try > glibc.ver; then
7119         val="$define"
7120         gnulibc_version=`$cat glibc.ver`
7121         echo "You are using the GNU C Library version $gnulibc_version"
7122 else
7123         val="$undef"
7124         gnulibc_version=''
7125         echo "You are not using the GNU C Library"
7126 fi
7127 $rm -f try try.* glibc.ver
7128 set d_gnulibc
7129 eval $setvar
7130
7131 : see if nm is to be used to determine whether a symbol is defined or not
7132 case "$usenm" in
7133 '')
7134         dflt=''
7135         case "$d_gnulibc" in
7136         "$define")
7137                 echo " "
7138                 echo "nm probably won't work on the GNU C Library." >&4
7139                 dflt=n
7140                 ;;
7141         esac
7142         case "$dflt" in
7143         '') 
7144                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7145                         echo " "
7146                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7147                         echo "'nm' won't be sufficient on this sytem." >&4
7148                         dflt=n
7149                 fi
7150                 ;;
7151         esac
7152         case "$dflt" in
7153         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7154                 if $test $dflt -gt 20; then
7155                         dflt=y
7156                 else
7157                         dflt=n
7158                 fi
7159                 ;;
7160         esac
7161         ;;
7162 *)
7163         case "$usenm" in
7164         true|$define) dflt=y;;
7165         *) dflt=n;;
7166         esac
7167         ;;
7168 esac
7169 $cat <<EOM
7170
7171 I can use $nm to extract the symbols from your C libraries. This
7172 is a time consuming task which may generate huge output on the disk (up
7173 to 3 megabytes) but that should make the symbols extraction faster. The
7174 alternative is to skip the 'nm' extraction part and to compile a small
7175 test program instead to determine whether each symbol is present. If
7176 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7177 this may be the best solution.
7178
7179 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7180
7181 EOM
7182 rp="Shall I use $nm to extract C symbols from the libraries?"
7183 . ./myread
7184 case "$ans" in
7185 [Nn]*) usenm=false;;
7186 *) usenm=true;;
7187 esac
7188
7189 runnm=$usenm
7190 case "$reuseval" in
7191 true) runnm=false;;
7192 esac
7193
7194 : nm options which may be necessary
7195 case "$nm_opt" in
7196 '') if $test -f /mach_boot; then
7197                 nm_opt=''       # Mach
7198         elif $test -d /usr/ccs/lib; then
7199                 nm_opt='-p'     # Solaris (and SunOS?)
7200         elif $test -f /dgux; then
7201                 nm_opt='-p'     # DG-UX
7202         elif $test -f /lib64/rld; then
7203                 nm_opt='-p'     # 64-bit Irix
7204         else
7205                 nm_opt=''
7206         fi;;
7207 esac
7208
7209 : nm options which may be necessary for shared libraries but illegal
7210 : for archive libraries.  Thank you, Linux.
7211 case "$nm_so_opt" in
7212 '')     case "$myuname" in
7213         *linux*|gnu*)
7214                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7215                         nm_so_opt='--dynamic'
7216                 fi
7217                 ;;
7218         esac
7219         ;;
7220 esac
7221
7222 case "$runnm" in
7223 true)
7224 : get list of predefined functions in a handy place
7225 echo " "
7226 case "$libc" in
7227 '') libc=unknown
7228         case "$libs" in
7229         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7230         esac
7231         ;;
7232 esac
7233 case "$libs" in
7234 '') ;;
7235 *)  for thislib in $libs; do
7236         case "$thislib" in
7237         -lc|-lc_s)
7238                 : Handle C library specially below.
7239                 ;;
7240         -l*)
7241                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7242                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7243                         :
7244                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7245                         :
7246                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7247                         :
7248                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7249                         :
7250                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7251                         :
7252                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7253                         :
7254                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7255                         :
7256                 else
7257                         try=''
7258                 fi
7259                 libnames="$libnames $try"
7260                 ;;
7261         *) libnames="$libnames $thislib" ;;
7262         esac
7263         done
7264         ;;
7265 esac
7266 xxx=normal
7267 case "$libc" in
7268 unknown)
7269         set /lib/libc.$so
7270         for xxx in $libpth; do
7271                 $test -r $1 || set $xxx/libc.$so
7272                 : The messy sed command sorts on library version numbers.
7273                 $test -r $1 || \
7274                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7275                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7276                                 h
7277                                 s/[0-9][0-9]*/0000&/g
7278                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7279                                 G
7280                                 s/\n/ /' | \
7281                          $sort | $sed -e 's/^.* //'`
7282                 eval set \$$#
7283         done
7284         $test -r $1 || set /usr/ccs/lib/libc.$so
7285         $test -r $1 || set /lib/libsys_s$_a
7286         ;;
7287 *)
7288         set blurfl
7289         ;;
7290 esac
7291 if $test -r "$1"; then
7292         echo "Your (shared) C library seems to be in $1."
7293         libc="$1"
7294 elif $test -r /lib/libc && $test -r /lib/clib; then
7295         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7296         xxx=apollo
7297         libc='/lib/clib /lib/libc'
7298         if $test -r /lib/syslib; then
7299                 echo "(Your math library is in /lib/syslib.)"
7300                 libc="$libc /lib/syslib"
7301         fi
7302 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7303         echo "Your C library seems to be in $libc, as you said before."
7304 elif $test -r $incpath/usr/lib/libc$_a; then
7305         libc=$incpath/usr/lib/libc$_a;
7306         echo "Your C library seems to be in $libc.  That's fine."
7307 elif $test -r /lib/libc$_a; then
7308         libc=/lib/libc$_a;
7309         echo "Your C library seems to be in $libc.  You're normal."
7310 else
7311         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7312                 :
7313         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7314                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7315         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7316                 :
7317         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7318                 :
7319         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7320                 :
7321         else
7322                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7323         fi
7324         if $test -r "$tans"; then
7325                 echo "Your C library seems to be in $tans, of all places."
7326                 libc=$tans
7327         else
7328                 libc='blurfl'
7329         fi
7330 fi
7331 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7332         dflt="$libc"
7333         cat <<EOM
7334
7335 If the guess above is wrong (which it might be if you're using a strange
7336 compiler, or your machine supports multiple models), you can override it here.
7337
7338 EOM
7339 else
7340         dflt=''
7341         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7342         cat >&4 <<EOM
7343 I can't seem to find your C library.  I've looked in the following places:
7344
7345 EOM
7346         $sed 's/^/      /' libpath
7347         cat <<EOM
7348
7349 None of these seems to contain your C library. I need to get its name...
7350
7351 EOM
7352 fi
7353 fn=f
7354 rp='Where is your C library?'
7355 . ./getfile
7356 libc="$ans"
7357
7358 echo " "
7359 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7360 set X `cat libnames`
7361 shift
7362 xxx=files
7363 case $# in 1) xxx=file; esac
7364 echo "Extracting names from the following $xxx for later perusal:" >&4
7365 echo " "
7366 $sed 's/^/      /' libnames >&4
7367 echo " "
7368 $echo $n "This may take a while...$c" >&4
7369
7370 for file in $*; do
7371         case $file in
7372         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7373         *) $nm $nm_opt $file 2>/dev/null;;
7374         esac
7375 done >libc.tmp
7376
7377 $echo $n ".$c"
7378 $grep fprintf libc.tmp > libc.ptf
7379 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7380 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7381 xxx='[ADTSIW]'
7382 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7383         eval $xscan;\
7384         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7385                 eval $xrun
7386 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7387         eval $xscan;\
7388         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7389                 eval $xrun
7390 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7391         eval $xscan;\
7392         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7393                 eval $xrun
7394 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7395         eval $xscan;\
7396         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7397                 eval $xrun
7398 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7399         eval $xscan;\
7400         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7401                 eval $xrun
7402 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7403         eval $xscan;\
7404         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7405                 eval $xrun
7406 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7407                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7408         eval $xscan;\
7409         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7410                 eval $xrun
7411 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7412         eval $xscan;\
7413         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7414                 eval $xrun
7415 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7416         eval $xscan;\
7417         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7418                 eval $xrun
7419 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7420         eval $xscan;\
7421         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7422                 eval $xrun
7423 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7424         eval $xscan;\
7425         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7426                 eval $xrun
7427 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7428         eval $xscan;\
7429         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7430                 eval $xrun
7431 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7432         eval $xscan;\
7433         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7434                 eval $xrun
7435 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7436         eval $xscan;\
7437         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7438                 eval $xrun
7439 else
7440         $nm -p $* 2>/dev/null >libc.tmp
7441         $grep fprintf libc.tmp > libc.ptf
7442         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7443                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7444         then
7445                 nm_opt='-p'
7446                 eval $xrun
7447         else
7448                 echo " "
7449                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7450                 com=''
7451                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7452                         for thisname in $libnames $libc; do
7453                                 $ar t $thisname >>libc.tmp
7454                         done
7455                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7456                         echo "Ok." >&4
7457                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7458                         # Repeat libc to extract forwarders to DLL entries too
7459                         for thisname in $libnames $libc; do
7460                                 $ar tv $thisname >>libc.tmp
7461                                 # Revision 50 of EMX has bug in $ar.
7462                                 # it will not extract forwarders to DLL entries
7463                                 # Use emximp which will extract exactly them.
7464                                 emximp -o tmp.imp $thisname \
7465                                     2>/dev/null && \
7466                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7467                                     < tmp.imp >>libc.tmp
7468                                 $rm tmp.imp
7469                         done
7470                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7471                         echo "Ok." >&4
7472                 else
7473                         echo "$ar didn't seem to work right." >&4
7474                         echo "Maybe this is a Cray...trying bld instead..." >&4
7475                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7476                         then
7477                                 for thisname in $libnames; do
7478                                         bld t $libnames | \
7479                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7480                                         $ar t $thisname >>libc.tmp
7481                                 done
7482                                 echo "Ok." >&4
7483                         else
7484                                 echo "That didn't work either.  Giving up." >&4
7485                                 exit 1
7486                         fi
7487                 fi
7488         fi
7489 fi
7490 nm_extract="$com"
7491 case "$PASE" in
7492 define)
7493     echo " "
7494     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7495     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7496     ;;
7497 *)  if $test -f /lib/syscalls.exp; then
7498         echo " "
7499         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7500         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7501     fi
7502     ;;
7503 esac
7504 ;;
7505 esac
7506 $rm -f libnames libpath
7507
7508 : see if dld is available
7509 set dld.h i_dld
7510 eval $inhdr
7511
7512 : is a C symbol defined?
7513 csym='tlook=$1;
7514 case "$3" in
7515 -v) tf=libc.tmp; tdc="";;
7516 -a) tf=libc.tmp; tdc="[]";;
7517 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7518 esac;
7519 tx=yes;
7520 case "$reuseval-$4" in
7521 true-) ;;
7522 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7523 esac;
7524 case "$tx" in
7525 yes)
7526         tval=false;
7527         if $test "$runnm" = true; then
7528                 if $contains $tlook $tf >/dev/null 2>&1; then
7529                         tval=true;
7530                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7531                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7532                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7533                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7534                         $rm -f try$_exe try.c core core.* try.core;
7535                 fi;
7536         else
7537                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7538                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7539                 $rm -f try$_exe try.c;
7540         fi;
7541         ;;
7542 *)
7543         case "$tval" in
7544         $define) tval=true;;
7545         *) tval=false;;
7546         esac;
7547         ;;
7548 esac;
7549 eval "$2=$tval"'
7550
7551 : define an is-in-libc? function
7552 inlibc='echo " "; td=$define; tu=$undef;
7553 sym=$1; var=$2; eval "was=\$$2";
7554 tx=yes;
7555 case "$reuseval$was" in
7556 true) ;;
7557 true*) tx=no;;
7558 esac;
7559 case "$tx" in
7560 yes)
7561         set $sym tres -f;
7562         eval $csym;
7563         case "$tres" in
7564         true)
7565                 echo "$sym() found." >&4;
7566                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7567         *)
7568                 echo "$sym() NOT found." >&4;
7569                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7570         esac;;
7571 *)
7572         case "$was" in
7573         $define) echo "$sym() found." >&4;;
7574         *) echo "$sym() NOT found." >&4;;
7575         esac;;
7576 esac'
7577
7578
7579 echo " "
7580 echo "Checking for C++..." >&4
7581 cat >try.c <<'EOCP'
7582 #include <stdio.h>
7583 int main(void)
7584 {
7585 #ifdef __cplusplus
7586     printf("define\n");
7587 #else
7588     printf("undef\n");
7589 #endif
7590     return 0;
7591 }
7592 EOCP
7593 set try
7594 if eval $compile_ok && $run ./try >cplusplus$$; then
7595         val=`$cat cplusplus$$`
7596         echo "You are using a C++ compiler."
7597 else
7598         val="$undef"
7599         echo "You are not using a C++ compiler."
7600 fi
7601 $rm -f try try.* cplusplus$$
7602 set d_cplusplus
7603 eval $setvar
7604
7605 : see if dlopen exists
7606 xxx_runnm="$runnm"
7607 xxx_ccflags="$ccflags"
7608 runnm=false
7609 : with g++ one needs -shared to get is-in-libc to work for dlopen
7610 case "$gccversion" in
7611 '')     ;;
7612 *)      case "$d_cplusplus" in
7613         "$define") ccflags="$ccflags -shared" ;;
7614         esac
7615         ;;
7616 esac
7617 set dlopen d_dlopen
7618 eval $inlibc
7619 runnm="$xxx_runnm"
7620 ccflags="$xxx_ccflags"
7621
7622 : see if this is a unistd.h system
7623 set unistd.h i_unistd
7624 eval $inhdr
7625
7626 : determine which dynamic loading, if any, to compile in
7627 echo " "
7628 dldir="ext/DynaLoader"
7629 case "$usedl" in
7630 $define|y|true)
7631         dflt='y'
7632         usedl="$define"
7633         ;;
7634 $undef|n|false)
7635         dflt='n'
7636         usedl="$undef"
7637         ;;
7638 *) 
7639         dflt='n'
7640         case "$d_dlopen" in
7641             $define) dflt='y' ;;
7642         esac
7643         case "$i_dld" in
7644             $define) dflt='y' ;;
7645         esac
7646         : Does a dl_xxx.xs file exist for this operating system
7647         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7648         ;;
7649 esac
7650 rp="Do you wish to use dynamic loading?"
7651 . ./myread
7652 usedl="$ans"
7653 case "$ans" in
7654 y*) usedl="$define"
7655         case "$dlsrc" in
7656         '')
7657                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7658                         dflt="$dldir/dl_${osname}.xs"
7659                 elif $test "$d_dlopen" = "$define" ; then
7660                         dflt="$dldir/dl_dlopen.xs"
7661                 elif $test "$i_dld" = "$define" ; then
7662                         dflt="$dldir/dl_dld.xs"
7663                 else
7664                         dflt=''
7665                 fi
7666                 ;;
7667         *)      dflt="$dldir/$dlsrc"
7668                 ;;
7669         esac
7670     echo "The following dynamic loading files are available:"
7671         : Can not go over to $dldir because getfile has path hard-coded in.
7672         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7673         rp="Source file to use for dynamic loading"
7674         fn="fne"
7675         gfpth="$src"
7676         . ./getfile
7677         usedl="$define"
7678         : emulate basename
7679         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7680
7681         $cat << EOM
7682
7683 Some systems may require passing special flags to $cc -c to
7684 compile modules that will be used to create a shared library.
7685 To use no flags, say "none".
7686
7687 EOM
7688     case "$cccdlflags" in
7689     '') case "$gccversion" in
7690                 '') case "$osname" in
7691                         hpux)   dflt='+z' ;;
7692                         next)   dflt='none' ;;
7693                         irix*)  dflt='-KPIC' ;;
7694                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7695                         sunos)  dflt='-pic' ;;
7696                         *)      dflt='none' ;;
7697                     esac
7698                         ;;
7699                 *)  case "$osname" in
7700                         darwin) dflt='none' ;;
7701                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7702                         *)      dflt='-fpic' ;;
7703                     esac ;;
7704             esac ;;
7705         ' ') dflt='none' ;;
7706     *)  dflt="$cccdlflags" ;;
7707     esac
7708     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7709     . ./myread
7710     case "$ans" in
7711     none) cccdlflags=' ' ;;
7712     *) cccdlflags="$ans" ;;
7713     esac
7714
7715     cat << EOM
7716
7717 Some systems use ld to create libraries that can be dynamically loaded,
7718 while other systems (such as those using ELF) use $cc.
7719
7720 EOM
7721         case "$ld" in
7722         '')     $cat >try.c <<EOM
7723 /* Test for whether ELF binaries are produced */
7724 #include <fcntl.h>
7725 #$i_stdlib I_STDLIB
7726 #ifdef I_STDLIB
7727 #include <stdlib.h>
7728 #endif
7729 #$i_unistd I_UNISTD
7730 #ifdef I_UNISTD
7731 #include <unistd.h>
7732 #endif
7733 int main() {
7734         char b[4];
7735         int i = open("a.out",O_RDONLY);
7736         if(i == -1) 
7737                 exit(1); /* fail */
7738         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7739                 exit(0); /* succeed (yes, it's ELF) */
7740         else
7741                 exit(1); /* fail */
7742 }
7743 EOM
7744                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7745                         cat <<EOM
7746 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7747 EOM
7748                         dflt="$cc"
7749                 else
7750                         echo "I'll use ld to build dynamic libraries."
7751                         dflt='ld'
7752                 fi
7753                 rm -f try.c a.out
7754                 ;;
7755         *)      dflt="$ld"
7756                 ;;
7757         esac
7758
7759     rp="What command should be used to create dynamic libraries?"
7760     . ./myread
7761         ld="$ans"
7762
7763     cat << EOM
7764
7765 Some systems may require passing special flags to $ld to create a
7766 library that can be dynamically loaded.  If your ld flags include
7767 -L/other/path options to locate libraries outside your loader's normal
7768 search path, you may need to specify those -L options here as well.  To
7769 use no flags, say "none".
7770
7771 EOM
7772     case "$lddlflags" in
7773     '') case "$osname" in
7774                         beos) dflt='-nostart' ;;
7775                         hpux) dflt='-b';
7776                               case "$gccversion" in
7777                               '') dflt="$dflt +vnocompatwarnings" ;;
7778                               esac
7779                               ;;        
7780                         linux|irix*|gnu*)       dflt='-shared' ;;
7781                         next)  dflt='none' ;;
7782                         solaris) dflt='-G' ;;
7783                         sunos) dflt='-assert nodefinitions' ;;
7784                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7785                 *)     dflt='none' ;;
7786                         esac
7787                         ;;
7788     *) dflt="$lddlflags" ;;
7789     esac
7790
7791         : Try to guess additional flags to pick up local libraries.
7792         : Be careful not to append to a plain 'none'
7793         case "$dflt" in
7794         none) dflt='' ;;
7795         esac
7796         for thisflag in $ldflags; do
7797                 case "$thisflag" in
7798                 -L*|-R*|-Wl,-R*)
7799                         case " $dflt " in
7800                         *" $thisflag "*) ;;
7801                         *) dflt="$dflt $thisflag" ;;
7802                         esac
7803                         ;;
7804                 esac
7805         done
7806
7807         case "$dflt" in
7808         ''|' ') dflt='none' ;;
7809         esac
7810
7811     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7812     . ./myread
7813     case "$ans" in
7814     none) lddlflags=' ' ;;
7815     *) lddlflags="$ans" ;;
7816     esac
7817
7818         cat <<EOM
7819
7820 Some systems may require passing special flags to $cc to indicate that
7821 the resulting executable will use dynamic linking.  To use no flags,
7822 say "none".
7823
7824 EOM
7825     case "$ccdlflags" in
7826     '') case "$osname" in
7827             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7828             next|sunos) dflt='none' ;;
7829             *)          dflt='none' ;;
7830             esac ;;
7831     ' ')  dflt='none' ;;
7832     *)  dflt="$ccdlflags" ;;
7833     esac
7834     rp="Any special flags to pass to $cc to use dynamic linking?"
7835     . ./myread
7836     case "$ans" in
7837     none) ccdlflags=' ' ;;
7838     *) ccdlflags="$ans" ;;
7839     esac
7840     ;;
7841 *)  usedl="$undef"
7842         ld='ld'
7843     dlsrc='dl_none.xs'
7844     lddlflags=''
7845     ccdlflags=''
7846     ;;
7847 esac
7848
7849 also=''
7850 case "$usedl" in
7851 $undef)
7852         # No dynamic loading being used, so don't bother even to prompt.
7853         useshrplib='false'
7854         ;;
7855 *)      case "$useshrplib" in
7856         '')     case "$osname" in
7857                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7858                         dflt=y
7859                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7860                         ;;
7861                 next*)
7862                         case "$osvers" in
7863                         4*)     dflt=y
7864                                 also='Building a shared libperl is needed for MAB support.'
7865                                 ;;
7866                         *)      dflt=n
7867                                 ;;
7868                         esac
7869                         ;;
7870                 *)      dflt=n
7871                         ;;
7872                 esac
7873                 ;;
7874         $define|true|[Yy]*)
7875                 dflt=y
7876                 ;;
7877         *)      dflt=n
7878                 ;;
7879         esac
7880         $cat << EOM
7881
7882 The perl executable is normally obtained by linking perlmain.c with
7883 libperl${_a}, any static extensions (usually just DynaLoader), and
7884 any other libraries needed on this system (such as -lm, etc.).  Since
7885 your system supports dynamic loading, it is probably possible to build
7886 a shared libperl.$so.  If you will have more than one executable linked
7887 to libperl.$so, this will significantly reduce the size of each
7888 executable, but it may have a noticeable effect on performance.  The
7889 default is probably sensible for your system.
7890 $also
7891
7892 EOM
7893         rp="Build a shared libperl.$so (y/n)"
7894         . ./myread
7895         case "$ans" in
7896         true|$define|[Yy]*)
7897                 useshrplib='true'  ;;
7898         *)      useshrplib='false' ;;
7899         esac
7900         ;;
7901 esac
7902
7903 case "$useshrplib" in
7904 true)
7905         case "$libperl" in
7906         '')
7907                 # Figure out a good name for libperl.so.  Since it gets stored in
7908                 # a version-specific architecture-dependent library, the version
7909                 # number isn't really that important, except for making cc/ld happy.
7910                 #
7911                 # A name such as libperl.so.3.1
7912                 majmin="libperl.$so.$patchlevel.$subversion"
7913                 # A name such as libperl.so.301
7914                 majonly=`echo $patchlevel $subversion |
7915                         $awk '{printf "%d%02d", $1, $2}'`
7916                 majonly=libperl.$so.$majonly
7917                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7918                 # rely on figuring it out from the naming of libc.
7919                 case "${osname}${osvers}" in
7920                 next4*)
7921                         dflt=libperl.5.$so
7922                         # XXX How handle the --version stuff for MAB?
7923                         ;;
7924                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7925                         dflt=libperl.$so
7926                         ;;
7927                 cygwin*) # ld links against an importlib
7928                         dflt=libperl$lib_ext
7929                         ;;
7930                 *)      # Try to guess based on whether libc has major.minor.
7931                         case "$libc" in
7932                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7933                         *libc.$so.[0-9]*) dflt=$majonly ;;
7934                         *)      dflt=libperl.$so ;;
7935                         esac
7936                         ;;
7937                 esac
7938                 ;;
7939         *)      dflt=$libperl
7940                 ;;
7941         esac
7942         cat << EOM
7943
7944 I need to select a good name for the shared libperl.  If your system uses
7945 library names with major and minor numbers, then you might want something
7946 like $majmin.  Alternatively, if your system uses a single version
7947 number for shared libraries, then you might want to use $majonly.
7948 Or, your system might be quite happy with a simple libperl.$so.
7949
7950 Since the shared libperl will get installed into a version-specific
7951 architecture-dependent directory, the version number of the shared perl
7952 library probably isn't important, so the default should be o.k.
7953
7954 EOM
7955         rp='What name do you want to give to the shared libperl?'
7956         . ./myread
7957         libperl=$ans
7958         echo "Ok, I'll use $libperl"
7959         ;;
7960 *)
7961         libperl="libperl${_a}"
7962         ;;
7963 esac
7964
7965 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7966 case "$shrpdir" in
7967 '') ;;
7968 *)      $cat >&4 <<EOM
7969 WARNING:  Use of the shrpdir variable for the installation location of
7970 the shared $libperl is not supported.  It was never documented and
7971 will not work in this version.  Let me (perlbug@perl.org)
7972 know of any problems this may cause.
7973
7974 EOM
7975         case "$shrpdir" in
7976         "$archlibexp/CORE")
7977                 $cat >&4 <<EOM
7978 But your current setting of $shrpdir is
7979 the default anyway, so it's harmless.
7980 EOM
7981                 ;;
7982         *)
7983                 $cat >&4 <<EOM
7984 Further, your current attempted setting of $shrpdir
7985 conflicts with the value of $archlibexp/CORE
7986 that installperl will use.
7987 EOM
7988                 ;;
7989         esac
7990         ;;
7991 esac
7992
7993 # How will the perl executable find the installed shared $libperl?
7994 # Add $xxx to ccdlflags.
7995 # If we can't figure out a command-line option, use $shrpenv to
7996 # set env LD_RUN_PATH.  The main perl makefile uses this.
7997 shrpdir=$archlibexp/CORE
7998 xxx=''
7999 tmp_shrpenv=''
8000 if "$useshrplib"; then
8001     case "$osname" in 
8002         aix)
8003                 # We'll set it in Makefile.SH...
8004                 ;;
8005         solaris)
8006                 xxx="-R $shrpdir"
8007                 ;;
8008         freebsd|netbsd|openbsd|interix|dragonfly)
8009                 xxx="-Wl,-R$shrpdir"
8010                 ;;
8011         bsdos|linux|irix*|dec_osf|gnu*)
8012                 xxx="-Wl,-rpath,$shrpdir"
8013                 ;;
8014         next)
8015                 # next doesn't like the default...
8016                 ;;
8017         beos)
8018                 # beos doesn't like the default, either.
8019                 ;;
8020         hpux*)
8021                 # hpux doesn't like the default, either.
8022                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8023                 ;;
8024         *)
8025                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8026                 ;;
8027         esac
8028         case "$xxx" in
8029         '') ;;
8030         *)      
8031                 # Only add $xxx if it isn't already in ccdlflags.
8032                 case " $ccdlflags " in
8033                 *" $xxx "*)     ;;
8034                 *)      ccdlflags="$ccdlflags $xxx"
8035                         cat <<EOM >&4
8036
8037 Adding $xxx to the flags
8038 passed to $ld so that the perl executable will find the 
8039 installed shared $libperl.
8040
8041 EOM
8042                         ;;
8043                 esac
8044                 ;;
8045         esac
8046 fi
8047 # Fix ccdlflags in AIX for building external extensions.
8048 # (For building Perl itself bare -bE:perl.exp is needed,
8049 #  Makefile.SH takes care of this.)
8050 case "$osname" in
8051 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8052 esac
8053 # Respect a hint or command-line value.
8054 case "$shrpenv" in
8055 '') shrpenv="$tmp_shrpenv" ;;
8056 esac
8057 case "$ldlibpthname" in
8058 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8059 none)   ldlibpthname='' ;;
8060 esac
8061
8062 : determine where manual pages are on this system
8063 echo " "
8064 case "$sysman" in
8065 '') 
8066         syspath='/usr/share/man/man1 /usr/man/man1'
8067         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8068         syspath="$syspath /usr/man/u_man/man1"
8069         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8070         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8071         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8072         sysman=`./loc . /usr/man/man1 $syspath`
8073         ;;
8074 esac
8075 if $test -d "$sysman"; then
8076         echo "System manual is in $sysman." >&4
8077 else
8078         echo "Could not find manual pages in source form." >&4
8079 fi
8080
8081 : determine where manual pages go
8082 set man1dir man1dir none
8083 eval $prefixit
8084 $cat <<EOM
8085
8086 $spackage has manual pages available in source form.
8087 EOM
8088 case "$nroff" in
8089 nroff)
8090         echo "However, you don't have nroff, so they're probably useless to you."
8091         case "$man1dir" in
8092         '') man1dir="none";;
8093         esac;;
8094 esac
8095 echo "If you don't want the manual sources installed, answer 'none'."
8096 case "$man1dir" in
8097 ' ') dflt=none
8098         ;;
8099 '')
8100         lookpath="$prefixexp/share/man/man1"
8101         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8102         lookpath="$lookpath $prefixexp/man/p_man/man1"
8103         lookpath="$lookpath $prefixexp/man/u_man/man1"
8104         lookpath="$lookpath $prefixexp/man/man.1"
8105         case "$sysman" in
8106         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8107         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8108         esac
8109         set dflt
8110         eval $prefixup
8111         ;;
8112 *)  dflt="$man1dir"
8113         ;;
8114 esac
8115 echo " "
8116 fn=dn+~
8117 rp="Where do the main $spackage manual pages (source) go?"
8118 . ./getfile
8119 if $test "X$man1direxp" != "X$ansexp"; then
8120         installman1dir=''
8121 fi
8122 prefixvar=man1dir
8123 . ./setprefixvar
8124
8125 case "$man1dir" in
8126 '')     man1dir=' '
8127         installman1dir='';;
8128 esac
8129
8130 : What suffix to use on installed man pages
8131
8132 case "$man1dir" in
8133 ' ')
8134         man1ext='0'
8135         ;;
8136 *)
8137         rp="What suffix should be used for the main $spackage man pages?"
8138         case "$man1ext" in
8139         '')     case "$man1dir" in
8140                 *1)  dflt=1 ;;
8141                 *1p) dflt=1p ;;
8142                 *1pm) dflt=1pm ;;
8143                 *l) dflt=l;;
8144                 *n) dflt=n;;
8145                 *o) dflt=o;;
8146                 *p) dflt=p;;
8147                 *C) dflt=C;;
8148                 *L) dflt=L;;
8149                 *L1) dflt=L1;;
8150                 *) dflt=1;;
8151                 esac
8152                 ;;
8153         *)      dflt="$man1ext";;
8154         esac
8155         . ./myread
8156         man1ext="$ans"
8157         ;;
8158 esac
8159
8160 : see if we can have long filenames
8161 echo " "
8162 first=123456789abcdef
8163 $rm -f $first
8164 if (echo hi >$first) 2>/dev/null; then
8165         if $test -f 123456789abcde; then
8166                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8167                 val="$undef"
8168         else
8169                 echo 'You can have filenames longer than 14 characters.'>&4
8170                 val="$define"
8171         fi
8172 else
8173         $cat <<'EOM'
8174 You can't have filenames longer than 14 chars.
8175 You can't even think about them!
8176 EOM
8177         val="$undef"
8178 fi 
8179 set d_flexfnam
8180 eval $setvar
8181 $rm -rf 123456789abcde*
8182
8183 : determine where library module manual pages go
8184 set man3dir man3dir none
8185 eval $prefixit
8186 $cat <<EOM
8187
8188 $spackage has manual pages for many of the library modules.
8189 EOM
8190
8191 case "$nroff" in
8192 nroff)
8193         $cat <<'EOM'
8194 However, you don't have nroff, so they're probably useless to you.
8195 EOM
8196         case "$man3dir" in
8197         '') man3dir="none";;
8198         esac;;
8199 esac
8200
8201 case "$d_flexfnam" in
8202 undef)
8203         $cat <<'EOM'
8204 However, your system can't handle the long file names like File::Basename.3.
8205 EOM
8206         case "$man3dir" in
8207         '') man3dir="none";;
8208         esac;;
8209 esac
8210
8211 echo "If you don't want the manual sources installed, answer 'none'."
8212 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8213 case "$man3dir" in
8214 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8215         if $test -d "$privlib/man/man3"; then
8216                 cat <<EOM >&4
8217
8218 WARNING:  Previous versions of perl installed man3 pages into
8219 $privlib/man/man3.  This version will suggest a
8220 new default of $dflt.
8221 EOM
8222                 tdflt=$dflt
8223                 dflt='n'
8224                 rp='Do you wish to preserve the old behavior?(y/n)'
8225                 . ./myread
8226                 case "$ans" in
8227                 y*) dflt="$privlib/man/man3" ;;
8228                 *)  dflt=$tdflt ;;
8229                 esac
8230     fi
8231         ;;
8232 *)      dflt="$man3dir" ;;
8233 esac
8234 case "$dflt" in
8235 ' ') dflt=none ;;
8236 esac
8237 echo " "
8238 fn=dn+~
8239 rp="Where do the $package library man pages (source) go?"
8240 . ./getfile
8241 prefixvar=man3dir
8242 . ./setprefixvar
8243
8244 case "$man3dir" in
8245 '')     man3dir=' '
8246         installman3dir='';;
8247 esac
8248
8249 : What suffix to use on installed man pages
8250 case "$man3dir" in
8251 ' ')
8252         man3ext='0'
8253         ;;
8254 *)
8255         rp="What suffix should be used for the $package library man pages?"
8256         case "$man3ext" in
8257         '')     case "$man3dir" in
8258                 *3)  dflt=3 ;;
8259                 *3p) dflt=3p ;;
8260                 *3pm) dflt=3pm ;;
8261                 *l) dflt=l;;
8262                 *n) dflt=n;;
8263                 *o) dflt=o;;
8264                 *p) dflt=p;;
8265                 *C) dflt=C;;
8266                 *L) dflt=L;;
8267                 *L3) dflt=L3;;
8268                 *) dflt=3;;
8269                 esac
8270                 ;;
8271         *)      dflt="$man3ext";;
8272         esac
8273         . ./myread
8274         man3ext="$ans"
8275         ;;
8276 esac
8277
8278 : see if we have to deal with yellow pages, now NIS.
8279 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8280         if $test -f /usr/etc/nibindd; then
8281                 echo " "
8282                 echo "I'm fairly confident you're on a NeXT."
8283                 echo " "
8284                 rp='Do you get the hosts file via NetInfo?'
8285                 dflt=y
8286                 case "$hostcat" in
8287                 nidump*) ;;
8288                 '') ;;
8289                 *) dflt=n;;
8290                 esac
8291                 . ./myread
8292                 case "$ans" in
8293                 y*) hostcat='nidump hosts .';;
8294                 *)      case "$hostcat" in
8295                         nidump*) hostcat='';;
8296                         esac
8297                         ;;
8298                 esac
8299         fi
8300         case "$hostcat" in
8301         nidump*) ;;
8302         *)
8303                 case "$hostcat" in
8304                 *ypcat*) dflt=y;;
8305                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8306                                 dflt=y
8307                         else
8308                                 dflt=n
8309                         fi;;
8310                 *) dflt=n;;
8311                 esac
8312                 echo " "
8313                 rp='Are you getting the hosts file via yellow pages?'
8314                 . ./myread
8315                 case "$ans" in
8316                 y*) hostcat='ypcat hosts';;
8317                 *) hostcat='cat /etc/hosts';;
8318                 esac
8319                 ;;
8320         esac
8321 fi
8322 case "$hostcat" in
8323 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8324 esac
8325 case "$groupcat" in
8326 '') test -f /etc/group && groupcat='cat /etc/group';;
8327 esac
8328 case "$passcat" in
8329 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8330 esac
8331
8332 : now get the host name
8333 echo " "
8334 echo "Figuring out host name..." >&4
8335 case "$myhostname" in
8336 '') cont=true
8337         echo 'Maybe "hostname" will work...'
8338         if tans=`sh -c hostname 2>&1` ; then
8339                 myhostname=$tans
8340                 phostname=hostname
8341                 cont=''
8342         fi
8343         ;;
8344 *) cont='';;
8345 esac
8346 if $test "$cont"; then
8347         if ./xenix; then
8348                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8349                 if tans=`cat /etc/systemid 2>&1` ; then
8350                         myhostname=$tans
8351                         phostname='cat /etc/systemid'
8352                         echo "Whadyaknow.  Xenix always was a bit strange..."
8353                         cont=''
8354                 fi
8355         elif $test -r /etc/systemid; then
8356                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8357         fi
8358 fi
8359 if $test "$cont"; then
8360         echo 'No, maybe "uuname -l" will work...'
8361         if tans=`sh -c 'uuname -l' 2>&1` ; then
8362                 myhostname=$tans
8363                 phostname='uuname -l'
8364         else
8365                 echo 'Strange.  Maybe "uname -n" will work...'
8366                 if tans=`sh -c 'uname -n' 2>&1` ; then
8367                         myhostname=$tans
8368                         phostname='uname -n'
8369                 else
8370                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8371                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8372                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8373                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8374                         else
8375                                 case "$myhostname" in
8376                                 '') echo "Does this machine have an identity crisis or something?"
8377                                         phostname='';;
8378                                 *)
8379                                         echo "Well, you said $myhostname before..."
8380                                         phostname='echo $myhostname';;
8381                                 esac
8382                         fi
8383                 fi
8384         fi
8385 fi
8386 case "$myhostname" in
8387 '') myhostname=noname ;;
8388 esac
8389 : you do not want to know about this
8390 set $myhostname
8391 myhostname=$1
8392
8393 : verify guess
8394 if $test "$myhostname" ; then
8395         dflt=y
8396         rp='Your host name appears to be "'$myhostname'".'" Right?"
8397         . ./myread
8398         case "$ans" in
8399         y*) ;;
8400         *) myhostname='';;
8401         esac
8402 fi
8403
8404 : bad guess or no guess
8405 while $test "X$myhostname" = X ; do
8406         dflt=''
8407         rp="Please type the (one word) name of your host:"
8408         . ./myread
8409         myhostname="$ans"
8410 done
8411
8412 : translate upper to lower if necessary
8413 case "$myhostname" in
8414 *[A-Z]*)
8415         echo "(Normalizing case in your host name)"
8416         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8417         ;;
8418 esac
8419
8420 case "$myhostname" in
8421 *.*)
8422         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8423         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8424         echo "(Trimming domain name from host name--host name is now $myhostname)"
8425         ;;
8426 *) case "$mydomain" in
8427         '')
8428                 {
8429                         test "X$hostcat" = "Xypcat hosts" &&
8430                         ypmatch "$myhostname" hosts 2>/dev/null |\
8431                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8432                         $test -s hosts
8433                 } || {
8434                         test "X$hostcat" != "X" &&
8435                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8436                                         /[       ]$myhostname[  . ]/p" > hosts
8437                 }
8438                 tmp_re="[       . ]"
8439                 if $test -f hosts; then
8440                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8441                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8442                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8443                                 hosts | $sort | $uniq | \
8444                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8445                         case `$echo X$dflt` in
8446                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8447                                 dflt=.
8448                                 ;;
8449                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8450                                 ;;
8451                         esac
8452                 else
8453                         echo "(I cannot locate a hosts database anywhere)"
8454                         dflt=.
8455                 fi
8456                 case "$dflt" in
8457                 .)
8458                         tans=`./loc resolv.conf X /etc /usr/etc`
8459                         if $test -f "$tans"; then
8460                                 echo "(Attempting domain name extraction from $tans)"
8461                                 dflt=.`$sed -n -e 's/   / /g' \
8462                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8463                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8464                                 case "$dflt" in
8465                                 .) dflt=.`$sed -n -e 's/        / /g' \
8466                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8467                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8468                                         ;;
8469                                 esac
8470                         fi
8471                         ;;
8472                 esac
8473                 case "$dflt" in
8474                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8475                         dflt=.`sh -c domainname 2>/dev/null`
8476                         case "$dflt" in
8477                         '') dflt='.';;
8478                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8479                         esac
8480                         ;;
8481                 esac
8482                 case "$dflt$osname" in
8483                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8484                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8485                         ;;
8486                 esac
8487                 case "$dflt" in
8488                 .) echo "(Lost all hope -- silly guess then)"
8489                         dflt='.nonet'
8490                         ;;
8491                 esac
8492                 $rm -f hosts
8493                 ;;
8494         *) dflt="$mydomain";;
8495         esac;;
8496 esac
8497 echo " "
8498 rp="What is your domain name?"
8499 . ./myread
8500 tans="$ans"
8501 case "$ans" in
8502 '') ;;
8503 .*) ;;
8504 *) tans=".$tans";;
8505 esac
8506 mydomain="$tans"
8507
8508 : translate upper to lower if necessary
8509 case "$mydomain" in
8510 *[A-Z]*)
8511         echo "(Normalizing case in your domain name)"
8512         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8513         ;;
8514 esac
8515
8516 : a little sanity check here
8517 case "$phostname" in
8518 '') ;;
8519 *)
8520         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8521         $myhostname$mydomain|$myhostname) ;;
8522         *)
8523                 case "$phostname" in
8524                 sed*)
8525                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8526                         ;;
8527                 *)
8528                         echo "(That doesn't agree with your $phostname command, by the way.)"
8529                         ;;
8530                 esac
8531         ;;
8532         esac
8533         ;;
8534 esac
8535
8536 $cat <<EOM
8537
8538 I need to get your e-mail address in Internet format if possible, i.e.
8539 something like user@host.domain. Please answer accurately since I have
8540 no easy means to double check it. The default value provided below
8541 is most probably close to reality but may not be valid from outside
8542 your organization...
8543
8544 EOM
8545 cont=x
8546 while test "$cont"; do
8547         case "$cf_email" in
8548         '') dflt="$cf_by@$myhostname$mydomain";;
8549         *) dflt="$cf_email";;
8550         esac
8551         rp='What is your e-mail address?'
8552         . ./myread
8553         cf_email="$ans"
8554         case "$cf_email" in
8555         *@*.*) cont='' ;;
8556         *)
8557                 rp='Address does not look like an Internet one.  Use it anyway?'
8558                 case "$fastread" in
8559                 yes) dflt=y ;;
8560                 *) dflt=n ;;
8561                 esac
8562                 . ./myread
8563                 case "$ans" in
8564                 y*) cont='' ;;
8565                 *) echo " " ;;
8566                 esac
8567                 ;;
8568         esac
8569 done
8570
8571 $cat <<EOM
8572
8573 If you or somebody else will be maintaining perl at your site, please
8574 fill in the correct e-mail address here so that they may be contacted
8575 if necessary. Currently, the "perlbug" program included with perl
8576 will send mail to this address in addition to perlbug@perl.org. You may
8577 enter "none" for no administrator.
8578
8579 EOM
8580 case "$perladmin" in
8581 '') dflt="$cf_email";;
8582 *) dflt="$perladmin";;
8583 esac
8584 rp='Perl administrator e-mail address'
8585 . ./myread
8586 perladmin="$ans"
8587
8588 : determine whether to only install version-specific parts.
8589 echo " "
8590 $cat <<EOM
8591 Do you want to install only the version-specific parts of the perl
8592 distribution?  Usually you do *not* want to do this.
8593 EOM
8594 case "$versiononly" in
8595 "$define"|[Yy]*|true) dflt='y' ;;
8596 *) dflt='n';
8597 esac
8598 rp="Do you want to install only the version-specific parts of perl?"
8599 . ./myread
8600 case "$ans" in
8601 [yY]*)  val="$define";;
8602 *)      val="$undef" ;;
8603 esac
8604 set versiononly
8605 eval $setvar
8606
8607 case "$versiononly" in
8608 "$define") inc_version_list=''
8609            inc_version_list_init=0
8610            ;;
8611 esac
8612
8613 : figure out how to guarantee perl startup
8614 : XXX Note that this currently takes advantage of the bug that binexp ignores
8615 :     the Configure -Dinstallprefix setting, which in turn means that under
8616 :     relocatable @INC, initialinstalllocation is what binexp started as.
8617 case "$startperl" in
8618 '')
8619         case "$sharpbang" in
8620         *!)
8621                 $cat <<EOH
8622
8623 I can use the #! construct to start perl on your system. This will
8624 make startup of perl scripts faster, but may cause problems if you
8625 want to share those scripts and perl is not in a standard place
8626 ($initialinstalllocation/perl) on all your platforms. The alternative
8627 is to force a shell by starting the script with a single ':' character.
8628
8629 EOH
8630                 case "$versiononly" in
8631                 "$define")      dflt="$initialinstalllocation/perl$version";;
8632                 *)              dflt="$initialinstalllocation/perl";;
8633                 esac
8634                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8635                 . ./myread
8636                 case "$ans" in
8637                 none)   startperl=": # use perl";;
8638                 *)      startperl="#!$ans"
8639                         if $test 30 -lt `echo "$ans" | wc -c`; then
8640                                 $cat >&4 <<EOM
8641
8642 WARNING:  Some systems limit the #! command to 32 characters.
8643 If you experience difficulty running Perl scripts with #!, try
8644 installing Perl in a directory with a shorter pathname.
8645
8646 EOM
8647                         fi ;;
8648                 esac
8649                 ;;
8650         *) startperl=": # use perl"
8651                 ;;
8652         esac
8653         ;;
8654 esac
8655 echo "I'll use $startperl to start perl scripts."
8656
8657 : figure best path for perl in scripts
8658 case "$perlpath" in
8659 '')
8660         case "$versiononly" in
8661         "$define")      perlpath="$initialinstalllocation/perl$version";;
8662         *)              perlpath="$initialinstalllocation/perl";;
8663         esac
8664         case "$startperl" in
8665         *!*) ;;
8666         *)
8667                 $cat <<EOH
8668
8669 I will use the "eval 'exec'" idiom to start Perl on your system.
8670 I can use the full path of your Perl binary for this purpose, but
8671 doing so may cause problems if you want to share those scripts and
8672 Perl is not always in a standard place ($initialinstalllocation/perl).
8673
8674 EOH
8675                 dflt="$initialinstalllocation/perl"
8676                 rp="What path shall I use in \"eval 'exec'\"?"
8677                 . ./myread
8678                 perlpath="$ans"
8679                 ;;
8680         esac
8681         ;;
8682 esac
8683 case "$startperl" in
8684 *!*)    ;;
8685 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8686 esac
8687
8688 : determine where public executable scripts go
8689 set scriptdir scriptdir
8690 eval $prefixit
8691 case "$scriptdir" in
8692 '')
8693         dflt="$bin"
8694         : guess some guesses
8695         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8696         $test -d /usr/share/bin     && dflt=/usr/share/bin
8697         $test -d /usr/local/script  && dflt=/usr/local/script
8698         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8699         $test -d $prefixexp/script  && dflt=$prefixexp/script
8700         set dflt
8701         eval $prefixup
8702         ;;
8703 *)  dflt="$scriptdir"
8704         ;;
8705 esac
8706 $cat <<EOM
8707
8708 Some installations have a separate directory just for executable scripts so
8709 that they can mount it across multiple architectures but keep the scripts in
8710 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8711 Or you might just lump your scripts in with all your other executables.
8712
8713 EOM
8714 fn=d~
8715 rp='Where do you keep publicly executable scripts?'
8716 . ./getfile
8717 if $test "X$ansexp" != "X$scriptdirexp"; then
8718         installscript=''
8719 fi
8720 installscriptdir=''
8721 prefixvar=scriptdir
8722 . ./setprefixvar
8723 : A little fix up for an irregularly named variable.
8724 installscript="$installscriptdir"
8725
8726 : determine where add-on public executables go
8727 case "$sitebin" in
8728 '')     dflt=$siteprefix/bin ;;
8729 *)      dflt=$sitebin ;;
8730 esac
8731 fn=d~
8732 rp='Pathname where the add-on public executables should be installed?'
8733 . ./getfile
8734 prefixvar=sitebin
8735 . ./setprefixvar
8736
8737 : determine where add-on html pages go
8738 : There is no standard location, so try to copy the previously-selected
8739 : directory structure for the core html pages.
8740 case "$sitehtml1dir" in
8741 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8742 *)     dflt=$sitehtml1dir ;;
8743 esac
8744 case "$dflt" in
8745 ''|' ') dflt=none ;;
8746 esac
8747 fn=dn+~
8748 rp='Pathname where the site-specific html pages should be installed?'
8749 . ./getfile
8750 prefixvar=sitehtml1dir
8751 . ./setprefixvar
8752
8753 : determine where add-on library html pages go
8754 : There is no standard location, so try to copy the previously-selected
8755 : directory structure for the core html pages.
8756 case "$sitehtml3dir" in
8757 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8758 *)     dflt=$sitehtml3dir ;;
8759 esac
8760 case "$dflt" in
8761 ''|' ') dflt=none ;;
8762 esac
8763 fn=dn+~
8764 rp='Pathname where the site-specific library html pages should be installed?'
8765 . ./getfile
8766 prefixvar=sitehtml3dir
8767 . ./setprefixvar
8768
8769 : determine where add-on manual pages go
8770 case "$siteman1dir" in
8771 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8772 *)      dflt=$siteman1dir ;;
8773 esac
8774 case "$dflt" in
8775 ''|' ') dflt=none ;;
8776 esac
8777 fn=dn+~
8778 rp='Pathname where the site-specific manual pages should be installed?'
8779 . ./getfile
8780 prefixvar=siteman1dir
8781 . ./setprefixvar
8782
8783 : determine where add-on library man pages go
8784 case "$siteman3dir" in
8785 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8786 *)      dflt=$siteman3dir ;;
8787 esac
8788 case "$dflt" in
8789 ''|' ') dflt=none ;;
8790 esac
8791 fn=dn+~
8792 rp='Pathname where the site-specific library manual pages should be installed?'
8793 . ./getfile
8794 prefixvar=siteman3dir
8795 . ./setprefixvar
8796
8797 : determine where add-on public executable scripts go
8798 case "$sitescript" in
8799 '')     dflt=$siteprefix/script
8800         $test -d $dflt || dflt=$sitebin ;;
8801 *)  dflt="$sitescript" ;;
8802 esac
8803 fn=d~+
8804 rp='Pathname where add-on public executable scripts should be installed?'
8805 . ./getfile
8806 prefixvar=sitescript
8807 . ./setprefixvar
8808
8809 case "$usefaststdio" in
8810 $define|true|[yY]*|'')
8811         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8812         case "$xversion" in
8813         [68])   dflt='y' ;;
8814         *)      dflt='n' ;;
8815         esac
8816         ;;
8817 *) dflt='n';;
8818 esac
8819 cat <<EOM
8820
8821 Perl can be built to use 'fast stdio', which means using the stdio
8822 library but also directly manipulating the stdio buffers to enable
8823 faster I/O.  Using stdio is better for backward compatibility (especially
8824 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8825 interface has been preferred instead of stdio.
8826
8827 If this doesn't make any sense to you, just accept the default '$dflt'.
8828 EOM
8829 rp='Use the "fast stdio" if available?'
8830 . ./myread
8831 case "$ans" in
8832 y|Y)    val="$define" ;;     
8833 *)      val="$undef" ;;
8834 esac
8835 set usefaststdio
8836 eval $setvar
8837
8838
8839 : define an is-a-typedef? function
8840 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8841 case "$inclist" in
8842 "") inclist="sys/types.h";;
8843 esac;
8844 eval "varval=\$$var";
8845 case "$varval" in
8846 "")
8847         $rm -f temp.c;
8848         for inc in $inclist; do
8849                 echo "#include <$inc>" >>temp.c;
8850         done;
8851         echo "#ifdef $type" >> temp.c;
8852         echo "printf(\"We have $type\");" >> temp.c;
8853         echo "#endif" >> temp.c;
8854         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8855         if $contains $type temp.E >/dev/null 2>&1; then
8856                 eval "$var=\$type";
8857         else
8858                 eval "$var=\$def";
8859         fi;
8860         $rm -f temp.?;;
8861 *) eval "$var=\$varval";;
8862 esac'
8863
8864 : define an is-a-typedef? function that prompts if the type is not available.
8865 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8866 case "$inclist" in
8867 "") inclist="sys/types.h";;
8868 esac;
8869 eval "varval=\$$var";
8870 case "$varval" in
8871 "")
8872         $rm -f temp.c;
8873         for inc in $inclist; do
8874                 echo "#include <$inc>" >>temp.c;
8875         done;
8876         echo "#ifdef $type" >> temp.c;
8877         echo "printf(\"We have $type\");" >> temp.c;
8878         echo "#endif" >> temp.c;
8879         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8880         echo " " ;
8881         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8882         if $contains $type temp.E >/dev/null 2>&1; then
8883                 echo "$type found." >&4;
8884                 eval "$var=\$type";
8885         else
8886                 echo "$type NOT found." >&4;
8887                 dflt="$def";
8888                 . ./myread ;
8889                 eval "$var=\$ans";
8890         fi;
8891         $rm -f temp.?;;
8892 *) eval "$var=\$varval";;
8893 esac'
8894
8895 : see what type lseek is declared as in the kernel
8896 rp="What is the type used for lseek's offset on this system?"
8897 set off_t lseektype long stdio.h sys/types.h
8898 eval $typedef_ask
8899
8900 echo " "
8901 echo "Checking to see how big your file offsets are..." >&4
8902 $cat >try.c <<EOCP
8903 #include <sys/types.h>
8904 #include <stdio.h>
8905 int main()
8906 {
8907     printf("%d\n", (int)sizeof($lseektype));
8908     return(0); 
8909 }
8910 EOCP
8911 set try
8912 if eval $compile_ok; then
8913         lseeksize=`$run ./try`
8914         echo "Your file offsets are $lseeksize bytes long."
8915 else
8916         dflt=$longsize
8917         echo " "
8918         echo "(I can't seem to compile the test program.  Guessing...)"
8919         rp="What is the size of your file offsets (in bytes)?"
8920         . ./myread
8921         lseeksize="$ans"
8922 fi
8923 $rm -f try.c try
8924
8925 : see what type file positions are declared as in the library
8926 rp="What is the type for file position used by fsetpos()?"
8927 set fpos_t fpostype long stdio.h sys/types.h
8928 eval $typedef_ask
8929
8930 echo " "
8931 case "$fpostype" in
8932 *_t) zzz="$fpostype"    ;;
8933 *)   zzz="fpos_t"       ;;
8934 esac
8935 echo "Checking the size of $zzz..." >&4 
8936 cat > try.c <<EOCP
8937 #include <sys/types.h>
8938 #include <stdio.h>
8939 #$i_stdlib I_STDLIB
8940 #ifdef I_STDLIB
8941 #include <stdlib.h>
8942 #endif
8943 int main() {
8944     printf("%d\n", (int)sizeof($fpostype));
8945     exit(0);
8946 }
8947 EOCP
8948 set try
8949 if eval $compile_ok; then
8950         yyy=`$run ./try`
8951         case "$yyy" in
8952         '')     fpossize=4
8953                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8954                 ;;
8955         *)      fpossize=$yyy
8956                 echo "Your $zzz is $fpossize bytes long."
8957                 ;;
8958         esac
8959 else
8960         dflt="$longsize"
8961         echo " " >&4
8962         echo "(I can't compile the test program.  Guessing...)" >&4
8963         rp="What is the size of your file positions (in bytes)?"
8964         . ./myread
8965         fpossize="$ans"
8966 fi
8967
8968 # Backward compatibility (uselfs is deprecated).
8969 case "$uselfs" in
8970 "$define"|true|[yY]*)
8971         cat <<EOM >&4
8972
8973 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8974 EOM
8975         uselargefiles="$define"
8976         ;;
8977 esac                          
8978
8979 case "$lseeksize:$fpossize" in
8980 8:8) cat <<EOM
8981
8982 You can have files larger than 2 gigabytes.
8983 EOM
8984    val="$define" ;;
8985 *)    case "$uselargefiles" in
8986    "$undef"|false|[nN]*) dflt='n' ;;
8987    *)   dflt='y' ;;
8988    esac
8989    cat <<EOM
8990
8991 Perl can be built to understand large files (files larger than 2 gigabytes)
8992 on some systems.  To do so, Configure can be run with -Duselargefiles.
8993
8994 If this doesn't make any sense to you, just accept the default '$dflt'.
8995 EOM
8996    rp='Try to understand large files, if available?'
8997    . ./myread
8998    case "$ans" in
8999    y|Y)         val="$define" ;;
9000    *)           val="$undef"  ;;
9001    esac
9002    ;;
9003 esac
9004 set uselargefiles
9005 eval $setvar
9006 : Look for a hint-file generated 'call-back-unit'.  If the
9007 : user has specified that a large files perl is to be built,
9008 : we may need to set or change some other defaults.
9009 if $test -f uselargefiles.cbu; then
9010         echo "Your platform has some specific hints regarding large file builds, using them..."
9011         . ./uselargefiles.cbu
9012 fi
9013 case "$uselargefiles" in
9014 "$define")
9015         if $test -f uselargefiles.cbu; then
9016                 echo " "
9017                 echo "Rechecking to see how big your file offsets are..." >&4
9018                 $cat >try.c <<EOCP
9019 #include <sys/types.h>
9020 #include <stdio.h>
9021 int main()
9022 {
9023     printf("%d\n", (int)sizeof($lseektype));
9024     return(0); 
9025 }
9026 EOCP
9027                 set try
9028                 if eval $compile_ok; then
9029                         lseeksize=`$run ./try`
9030                         $echo "Your file offsets are now $lseeksize bytes long."
9031                 else
9032                         dflt="$lseeksize"
9033                         echo " "
9034                         echo "(I can't seem to compile the test program.  Guessing...)"
9035                         rp="What is the size of your file offsets (in bytes)?"
9036                         . ./myread
9037                         lseeksize="$ans"
9038                 fi
9039                 case "$fpostype" in
9040                 *_t) zzz="$fpostype"    ;;
9041                 *)   zzz="fpos_t"       ;;
9042                 esac
9043                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9044                 $cat > try.c <<EOCP
9045 #include <sys/types.h>
9046 #include <stdio.h>
9047 #$i_stdlib I_STDLIB
9048 #ifdef I_STDLIB
9049 #include <stdlib.h>
9050 #endif
9051 int main() {
9052     printf("%d\n", (int)sizeof($fpostype));
9053     return(0);
9054 }
9055 EOCP
9056                 set try
9057                 if eval $compile_ok; then
9058                         yyy=`$run ./try`
9059                         dflt="$lseeksize"
9060                         case "$yyy" in
9061                         '')     echo " "
9062                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9063                                 ;;
9064                         *)      fpossize=$yyy
9065                                 echo " $fpossize bytes." >&4
9066                                 ;;
9067                         esac
9068                 else
9069                         dflt="$fpossize"
9070                         echo " "
9071                         echo "(I can't compile the test program.  Guessing...)" >&4
9072                         rp="What is the size of your file positions (in bytes)?"
9073                         . ./myread
9074                         fpossize="$ans"
9075                 fi
9076                 $rm -f try.c try
9077         fi
9078         ;;
9079 esac
9080
9081 case "$vendorprefix" in
9082 '')     d_vendorbin="$undef"
9083         vendorbin=''
9084         vendorbinexp=''
9085         ;;
9086 *)      d_vendorbin="$define"
9087         : determine where vendor-supplied executables go.
9088         case "$vendorbin" in
9089         '') dflt=$vendorprefix/bin ;;
9090         *)      dflt="$vendorbin" ;;
9091         esac
9092         fn=d~+
9093         rp='Pathname for the vendor-supplied executables directory?'
9094         . ./getfile
9095         vendorbin="$ans"
9096         vendorbinexp="$ansexp"
9097         ;;
9098 esac
9099 prefixvar=vendorbin
9100 . ./installprefix
9101
9102 case "$vendorprefix" in
9103 '')     vendorhtml1dir=''
9104         vendorhtml1direxp=''
9105         ;;
9106 *)      : determine where vendor-supplied html pages go.
9107         : There is no standard location, so try to copy the previously-selected
9108         : directory structure for the core html pages.
9109         : XXX Better default suggestions would be welcome.
9110         case "$vendorhtml1dir" in
9111         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9112         *)      dflt=$vendorhtml1dir ;;
9113         esac
9114         case "$dflt" in
9115         ''|' ') dflt=none ;;
9116         esac
9117         fn=dn+~
9118         rp='Pathname for the vendor-supplied html pages?'
9119         . ./getfile
9120         vendorhtml1dir="$ans"
9121         vendorhtml1direxp="$ansexp"
9122         ;;
9123 esac
9124 : Use ' ' for none so value is preserved next time through Configure
9125 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9126 prefixvar=vendorhtml1dir
9127 . ./installprefix
9128
9129 case "$vendorprefix" in
9130 '')     vendorhtml3dir=''
9131         vendorhtml3direxp=''
9132         ;;
9133 *)      : determine where vendor-supplied module html pages go.
9134         : There is no standard location, so try to copy the previously-selected
9135         : directory structure for the core html pages.
9136         : XXX Better default suggestions would be welcome.
9137         case "$vendorhtml3dir" in
9138         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9139         *)      dflt=$vendorhtml3dir ;;
9140         esac
9141         case "$dflt" in
9142         ''|' ') dflt=none ;;
9143         esac
9144         fn=dn+~
9145         rp='Pathname for the vendor-supplied html pages?'
9146         . ./getfile
9147         vendorhtml3dir="$ans"
9148         vendorhtml3direxp="$ansexp"
9149         ;;
9150 esac
9151 : Use ' ' for none so value is preserved next time through Configure
9152 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9153 prefixvar=vendorhtml3dir
9154 . ./installprefix
9155
9156 case "$vendorprefix" in
9157 '')     vendorman1dir=''
9158         vendorman1direxp=''
9159         ;;
9160 *)      : determine where vendor-supplied manual pages go.
9161         case "$vendorman1dir" in
9162         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9163         *)      dflt=$vendorman1dir ;;
9164         esac
9165         case "$dflt" in
9166         ''|' ') dflt=none ;;
9167         esac
9168         fn=nd~+
9169         rp='Pathname for the vendor-supplied manual section 1 pages?'
9170         . ./getfile
9171         vendorman1dir="$ans"
9172         vendorman1direxp="$ansexp"
9173         ;;
9174 esac
9175 : Use ' ' for none so value is preserved next time through Configure
9176 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9177 prefixvar=vendorman1dir
9178 . ./installprefix
9179
9180 case "$vendorprefix" in
9181 '')     vendorman3dir=''
9182         vendorman3direxp=''
9183         ;;
9184 *)      : determine where vendor-supplied module manual pages go.
9185         case "$vendorman3dir" in
9186         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9187         *)      dflt=$vendorman3dir ;;
9188         esac
9189         case "$dflt" in
9190         ''|' ') dflt=none ;;
9191         esac
9192         fn=nd~+
9193         rp='Pathname for the vendor-supplied manual section 3 pages?'
9194         . ./getfile
9195         vendorman3dir="$ans"
9196         vendorman3direxp="$ansexp"
9197         ;;
9198 esac
9199 : Use ' ' for none so value is preserved next time through Configure
9200 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9201 prefixvar=vendorman3dir
9202 . ./installprefix
9203
9204 case "$vendorprefix" in
9205 '')     d_vendorscript="$undef"
9206         vendorscript=''
9207         vendorscriptexp=''
9208         ;;
9209 *)      d_vendorscript="$define"
9210         : determine where vendor-supplied scripts go.
9211         case "$vendorscript" in
9212         '')     dflt=$vendorprefix/script
9213                 $test -d $dflt || dflt=$vendorbin ;;
9214         *)  dflt="$vendorscript" ;;
9215         esac
9216         $cat <<EOM
9217
9218 The installation process will create a directory for
9219 vendor-supplied scripts.
9220
9221 EOM
9222         fn=d~+
9223         rp='Pathname for the vendor-supplied scripts directory?'
9224         . ./getfile
9225         vendorscript="$ans"
9226         vendorscriptexp="$ansexp"
9227         ;;
9228 esac
9229 prefixvar=vendorscript
9230 . ./installprefix
9231
9232 : see if qgcvt exists
9233 set qgcvt d_qgcvt
9234 eval $inlibc
9235
9236 echo " "
9237
9238 if $test X"$d_longdbl" = X"$define"; then
9239
9240 echo "Checking how to print long doubles..." >&4
9241
9242 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9243         $cat >try.c <<'EOCP'
9244 #include <sys/types.h>
9245 #include <stdio.h>
9246 int main() {
9247   double d = 123.456;
9248   printf("%.3f\n", d);
9249 }
9250 EOCP
9251         set try
9252         if eval $compile; then
9253                 yyy=`$run ./try`
9254                 case "$yyy" in
9255                 123.456)
9256                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9257                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9258                         echo "We will use %f."
9259                         ;;
9260                 esac
9261         fi
9262 fi
9263
9264 if $test X"$sPRIfldbl" = X; then
9265         $cat >try.c <<'EOCP'
9266 #include <sys/types.h>
9267 #include <stdio.h>
9268 int main() {
9269   long double d = 123.456;
9270   printf("%.3Lf\n", d);
9271 }
9272 EOCP
9273         set try
9274         if eval $compile; then
9275                 yyy=`$run ./try`
9276                 case "$yyy" in
9277                 123.456)
9278                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9279                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9280                         echo "We will use %Lf."
9281                         ;;
9282                 esac
9283         fi
9284 fi
9285
9286 if $test X"$sPRIfldbl" = X; then
9287         $cat >try.c <<'EOCP'
9288 #include <sys/types.h>
9289 #include <stdio.h>
9290 int main() {
9291   long double d = 123.456;
9292   printf("%.3llf\n", d);
9293 }
9294 EOCP
9295         set try
9296         if eval $compile; then
9297                 yyy=`$run ./try`
9298                 case "$yyy" in
9299                 123.456)
9300                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9301                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9302                         echo "We will use %llf."
9303                         ;;
9304                 esac
9305         fi
9306 fi
9307
9308 if $test X"$sPRIfldbl" = X; then
9309         $cat >try.c <<'EOCP'
9310 #include <sys/types.h>
9311 #include <stdio.h>
9312 int main() {
9313   long double d = 123.456;
9314   printf("%.3lf\n", d);
9315 }
9316 EOCP
9317         set try
9318         if eval $compile; then
9319                 yyy=`$run ./try`
9320                 case "$yyy" in
9321                 123.456)
9322                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9323                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9324                         echo "We will use %lf."
9325                         ;;
9326                 esac
9327         fi
9328 fi
9329
9330 if $test X"$sPRIfldbl" = X; then
9331         echo "Cannot figure out how to print long doubles." >&4
9332 else
9333         sSCNfldbl=$sPRIfldbl    # expect consistency
9334 fi
9335
9336 $rm -f try try.*
9337
9338 fi # d_longdbl
9339
9340 case "$sPRIfldbl" in
9341 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9342         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9343         d_SCNfldbl="$undef";
9344         ;;
9345 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9346         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9347         d_SCNfldbl="$define";
9348         ;;
9349 esac
9350
9351 : Check how to convert floats to strings.
9352
9353 if test "X$d_Gconvert" = X; then
9354
9355 echo " "
9356 echo "Checking for an efficient way to convert floats to strings."
9357 echo " " > try.c
9358 case "$uselongdouble" in
9359 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9360 esac
9361 case "$d_longdbl" in
9362 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9363 esac
9364 case "$d_PRIgldbl" in
9365 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9366 esac
9367 $cat >>try.c <<EOP
9368 #ifdef TRY_gconvert
9369 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9370 char *myname = "gconvert";
9371 #endif
9372 #ifdef TRY_gcvt
9373 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9374 char *myname = "gcvt";
9375 #endif
9376 #ifdef TRY_qgcvt
9377 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9378 char *myname = "qgcvt";
9379 #define DOUBLETYPE long double
9380 #endif
9381 #ifdef TRY_sprintf
9382 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9383 #ifdef HAS_PRIgldbl
9384 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9385 #else
9386 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9387 #endif
9388 #else
9389 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9390 #endif
9391 char *myname = "sprintf";
9392 #endif
9393
9394 #ifndef DOUBLETYPE
9395 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9396 #define DOUBLETYPE long double
9397 #else
9398 #define DOUBLETYPE double
9399 #endif
9400 #endif
9401
9402 #include <stdio.h>
9403
9404 #define I_STDLIB $i_stdlib
9405 #ifdef I_STDLIB
9406 #include <stdlib.h>
9407 #endif
9408
9409 int
9410 checkit(expect, got)
9411 char *expect;
9412 char *got;
9413 {
9414     if (strcmp(expect, got)) {
9415                 printf("%s oddity:  Expected %s, got %s\n",
9416                         myname, expect, got);
9417                 exit(1);
9418         }
9419 }
9420
9421 int main()
9422
9423         char buf[64]; 
9424         buf[63] = '\0';
9425
9426         /* This must be 1st test on (which?) platform */
9427         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9428         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9429         checkit("0.1", buf);
9430
9431         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9432         checkit("0.01", buf);
9433
9434         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9435         checkit("0.001", buf);
9436
9437         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9438         checkit("0.0001", buf);
9439
9440         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9441         if (strlen(buf) > 5)
9442             checkit("9e-005", buf); /* for Microsoft ?? */
9443         else
9444             checkit("9e-05", buf);
9445
9446         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9447         checkit("1", buf);
9448
9449         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9450         checkit("1.1", buf);
9451
9452         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9453         checkit("1.01", buf);
9454
9455         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9456         checkit("1.001", buf);
9457
9458         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9459         checkit("1.0001", buf);
9460
9461         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9462         checkit("1.00001", buf);
9463
9464         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9465         checkit("1.000001", buf);
9466
9467         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9468         checkit("0", buf);
9469
9470         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9471         checkit("-1", buf);
9472
9473         /* Some Linux gcvt's give 1.e+5 here. */
9474         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9475         checkit("100000", buf);
9476         
9477         /* Some Linux gcvt's give -1.e+5 here. */
9478         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9479         checkit("-100000", buf);
9480
9481         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9482         checkit("123.456", buf);
9483
9484         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9485         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9486         /* 34 should be enough to scare even long double
9487          * places into using the e notation. */
9488         if (strlen(buf) > 5)
9489             checkit("1e+034", buf); /* for Microsoft */
9490         else
9491             checkit("1e+34", buf);
9492
9493         /* For Perl, if you add additional tests here, also add them to
9494          * t/base/num.t for benefit of platforms not using Configure or
9495          * overriding d_Gconvert */
9496
9497         exit(0);
9498 }
9499 EOP
9500 : first add preferred functions to our list
9501 xxx_list=""
9502 for xxx_convert in $gconvert_preference; do
9503     case $xxx_convert in
9504     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9505     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9506     esac 
9507 done
9508 : then add any others
9509 for xxx_convert in gconvert gcvt sprintf; do
9510     case "$xxx_list" in
9511     *$xxx_convert*) ;;
9512     *) xxx_list="$xxx_list $xxx_convert" ;;
9513     esac 
9514 done
9515
9516 case "$d_longdbl$uselongdouble" in
9517 "$define$define")
9518     : again, add prefered functions to our list first
9519     xxx_ld_list=""
9520     for xxx_convert in $gconvert_ld_preference; do
9521         case $xxx_convert in
9522         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9523         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9524         esac
9525     done
9526     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9527     for xxx_convert in qgcvt sprintf $xxx_list; do
9528         case "$xxx_ld_list" in
9529         $xxx_convert*|*" $xxx_convert"*) ;;
9530         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9531         esac
9532     done
9533     : if sprintf cannot do long doubles, move it to the end
9534     if test "$d_PRIgldbl" != "$define"; then
9535         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9536     fi
9537     : if no qgcvt, remove it
9538     if test "$d_qgcvt" != "$define"; then
9539         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9540     fi
9541     : use the ld_list
9542     xxx_list="$xxx_ld_list"
9543     ;;
9544 esac
9545
9546 for xxx_convert in $xxx_list; do
9547         echo "Trying $xxx_convert..."
9548         $rm -f try try$_o
9549         set try -DTRY_$xxx_convert
9550         if eval $compile; then
9551                 echo "$xxx_convert() found." >&4
9552                 if $run ./try; then
9553                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9554                         break;
9555                 else
9556                         echo "...But $xxx_convert didn't work as I expected."
9557                         xxx_convert=''
9558                 fi
9559         else
9560                 echo "$xxx_convert NOT found." >&4
9561         fi
9562 done
9563
9564 if test X$xxx_convert = X; then
9565     echo "*** WHOA THERE!!! ***" >&4
9566     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9567     xxx_convert=sprintf
9568 fi
9569
9570 case "$xxx_convert" in
9571 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9572 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9573 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9574 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9575    "$define$define$define")
9576       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9577    "$define$define$undef")
9578       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9579    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9580    esac
9581    ;;  
9582 esac
9583
9584 fi
9585
9586 : see if _fwalk exists
9587 set fwalk d__fwalk
9588 eval $inlibc
9589
9590 : Initialize h_fcntl
9591 h_fcntl=false
9592
9593 : Initialize h_sysfile
9594 h_sysfile=false
9595
9596 : access call always available on UNIX
9597 set access d_access
9598 eval $inlibc
9599
9600 : locate the flags for 'access()'
9601 case "$d_access" in
9602 "$define")
9603         echo " "
9604         $cat >access.c <<EOCP
9605 #include <sys/types.h>
9606 #ifdef I_FCNTL
9607 #include <fcntl.h>
9608 #endif
9609 #ifdef I_SYS_FILE
9610 #include <sys/file.h>
9611 #endif
9612 #ifdef I_UNISTD
9613 #include <unistd.h>
9614 #endif
9615 #$i_stdlib I_STDLIB
9616 #ifdef I_STDLIB
9617 #include <stdlib.h>
9618 #endif
9619 int main() {
9620         exit(R_OK);
9621 }
9622 EOCP
9623         : check sys/file.h first, no particular reason here
9624         if $test `./findhdr sys/file.h` && \
9625                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9626                 h_sysfile=true;
9627                 echo "<sys/file.h> defines the *_OK access constants." >&4
9628         elif $test `./findhdr fcntl.h` && \
9629                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9630                 h_fcntl=true;
9631                 echo "<fcntl.h> defines the *_OK access constants." >&4
9632         elif $test `./findhdr unistd.h` && \
9633                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9634                 echo "<unistd.h> defines the *_OK access constants." >&4
9635         else
9636                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9637         fi
9638         ;;
9639 esac
9640 $rm -f access*
9641
9642 : see if accessx exists
9643 set accessx d_accessx
9644 eval $inlibc
9645
9646 : see if aintl exists
9647 set aintl d_aintl
9648 eval $inlibc
9649
9650 : see if alarm exists
9651 set alarm d_alarm
9652 eval $inlibc
9653
9654 : see if POSIX threads are available
9655 set pthread.h i_pthread
9656 eval $inhdr
9657
9658 : define a fucntion to check prototypes
9659 $cat > protochk <<EOSH
9660 $startsh
9661 cc="$cc"
9662 optimize="$optimize"
9663 ccflags="$ccflags"
9664 prototype="$prototype"
9665 define="$define"
9666 rm=$rm
9667 usethreads=$usethreads
9668 i_pthread=$i_pthread
9669 pthread_h_first=$pthread_h_first
9670 EOSH
9671
9672 $cat >> protochk <<'EOSH'
9673
9674 $rm -f try.c
9675 foo="$1"
9676 shift
9677 while test $# -ge 2; do
9678         case "$1" in
9679                 $define) echo "#include <$2>" >> try.c ;;
9680                 literal) echo "$2" >> try.c ;;
9681         esac
9682     # Extra magic for the benefit of systems that need pthread.h
9683     # to be included early to correctly detect threadsafe functions.
9684     # Such functions must guarantee themselves, though, that the usethreads
9685     # and i_pthread have been defined, before calling protochk.
9686     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9687         echo "#include <pthread.h>" >> try.c
9688         pthread_h_done=yes
9689     fi
9690     shift 2
9691 done
9692 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9693 cat >> try.c <<'EOCP'
9694 #ifdef CAN_PROTOTYPE
9695 #define _(args) args
9696 #else
9697 #define _(args) ()
9698 #endif
9699 EOCP
9700 echo "$foo" >> try.c
9701 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9702 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9703 status=$?
9704 $rm -f try.[co]
9705 exit $status
9706 EOSH
9707 chmod +x protochk
9708 $eunicefix protochk
9709
9710 hasproto='varname=$1; func=$2; shift; shift;
9711 while $test $# -ge 2; do
9712         case "$1" in
9713         $define) echo "#include <$2>";;
9714         esac ;
9715     shift 2;
9716 done > try.c;
9717 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9718 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9719         echo "$func() prototype found.";
9720         val="$define";
9721 else
9722         echo "$func() prototype NOT found.";
9723         val="$undef";
9724 fi;
9725 set $varname;
9726 eval $setvar;
9727 $rm -f try.c tryout.c'
9728
9729 : see if sys/types.h has to be included
9730 set sys/types.h i_systypes
9731 eval $inhdr
9732
9733 : see if sys/select.h has to be included
9734 set sys/select.h i_sysselct
9735 eval $inhdr
9736
9737 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9738 while $test $# -ge 2; do
9739         case "$1" in
9740         $define) echo "#include <$2>";;
9741         esac ;
9742     shift 2;
9743 done > try.c;
9744 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9745 set try;
9746 if eval $compile; then
9747         val="$define";
9748 else
9749         val="$undef";
9750 fi;
9751 set $varname;
9752 eval $setvar;
9753 $rm -f try.c try.o'
9754
9755 : see if we should include time.h, sys/time.h, or both
9756 echo " "
9757 if test "X$timeincl" = X; then
9758         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9759         $echo $n "I'm now running the test program...$c"
9760         $cat >try.c <<EOCP
9761 #include <sys/types.h>
9762 #ifdef I_TIME
9763 #include <time.h>
9764 #endif
9765 #ifdef I_SYSTIME
9766 #ifdef SYSTIMEKERNEL
9767 #define KERNEL
9768 #endif
9769 #include <sys/time.h>
9770 #endif
9771 #ifdef I_SYSSELECT
9772 #include <sys/select.h>
9773 #endif
9774 #$i_stdlib I_STDLIB
9775 #ifdef I_STDLIB
9776 #include <stdlib.h>
9777 #endif
9778 int main()
9779 {
9780         struct tm foo;
9781 #ifdef S_TIMEVAL
9782         struct timeval bar;
9783 #endif
9784 #ifdef S_TIMEZONE
9785         struct timezone tzp;
9786 #endif
9787         if (foo.tm_sec == foo.tm_sec)
9788                 exit(0);
9789 #ifdef S_TIMEVAL
9790         if (bar.tv_sec == bar.tv_sec)
9791                 exit(0);
9792 #endif
9793         exit(1);
9794 }
9795 EOCP
9796         flags=''
9797         for s_timezone in '-DS_TIMEZONE' ''; do
9798         sysselect=''
9799         for s_timeval in '-DS_TIMEVAL' ''; do
9800         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9801         for i_time in '' '-DI_TIME'; do
9802         for i_systime in '-DI_SYSTIME' ''; do
9803                 case "$flags" in
9804                 '') $echo $n ".$c"
9805                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9806                         if eval $compile; then
9807                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9808                                 shift
9809                                 flags="$*"
9810                                 echo " "
9811                                 $echo $n "Succeeded with $flags$c"
9812                         fi
9813                         ;;
9814                 esac
9815         done
9816         done
9817         done
9818         done
9819         done
9820         timeincl=''
9821         echo " "
9822         case "$flags" in
9823         *SYSTIMEKERNEL*) i_systimek="$define"
9824                 timeincl=`./findhdr sys/time.h`
9825                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9826         *) i_systimek="$undef";;
9827         esac
9828         case "$flags" in
9829         *I_TIME*) i_time="$define"
9830                 timeincl=`./findhdr time.h`" $timeincl"
9831                 echo "We'll include <time.h>." >&4;;
9832         *) i_time="$undef";;
9833         esac
9834         case "$flags" in
9835         *I_SYSTIME*) i_systime="$define"
9836                 timeincl=`./findhdr sys/time.h`" $timeincl"
9837                 echo "We'll include <sys/time.h>." >&4;;
9838         *) i_systime="$undef";;
9839         esac
9840         $rm -f try.c try
9841 fi
9842 : see if struct tm knows about tm_zone
9843 case "$i_systime$i_time" in
9844 *$define*) 
9845         echo " "
9846         echo "Checking to see if your struct tm has tm_zone field..." >&4
9847         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9848         eval $hasfield
9849         ;;
9850 *)      val="$undef"
9851         set d_tm_tm_zone
9852         eval $setvar
9853         ;;
9854 esac
9855 case "$d_tm_tm_zone" in
9856 "$define")      echo "Yes, it does."   ;;
9857 *)              echo "No, it doesn't." ;;
9858 esac
9859 : see if struct tm knows about tm_gmtoff
9860 case "$i_systime$i_time" in
9861 *$define*) 
9862         echo " "
9863         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9864         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9865         eval $hasfield
9866         ;;
9867 *)      val="$undef"
9868         set d_tm_tm_gmtoff
9869         eval $setvar
9870         ;;
9871 esac
9872 case "$d_tm_tm_gmtoff" in
9873 "$define")      echo "Yes, it does."   ;;
9874 *)              echo "No, it doesn't." ;;
9875 esac
9876
9877 : see if asctime_r exists
9878 set asctime_r d_asctime_r
9879 eval $inlibc
9880 case "$d_asctime_r" in
9881 "$define")
9882         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9883         case "$d_asctime_r_proto:$usethreads" in
9884         ":define")      d_asctime_r_proto=define
9885                 set d_asctime_r_proto asctime_r $hdrs
9886                 eval $hasproto ;;
9887         *)      ;;
9888         esac
9889         case "$d_asctime_r_proto" in
9890         define)
9891         case "$asctime_r_proto" in
9892         ''|0) try='char* asctime_r(const struct tm*, char*);'
9893         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9894         esac
9895         case "$asctime_r_proto" in
9896         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9897         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9898         esac
9899         case "$asctime_r_proto" in
9900         ''|0) try='int asctime_r(const struct tm*, char*);'
9901         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9902         esac
9903         case "$asctime_r_proto" in
9904         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9905         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9906         esac
9907         case "$asctime_r_proto" in
9908         ''|0)   d_asctime_r=undef
9909                 asctime_r_proto=0
9910                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9911         * )     case "$asctime_r_proto" in
9912                 REENTRANT_PROTO*) ;;
9913                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9914                 esac
9915                 echo "Prototype: $try" ;;
9916         esac
9917         ;;
9918         *)      case "$usethreads" in
9919                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9920                 esac
9921                 d_asctime_r=undef
9922                 asctime_r_proto=0
9923                 ;;
9924         esac
9925         ;;
9926 *)      asctime_r_proto=0
9927         ;;
9928 esac
9929
9930 : see if atolf exists
9931 set atolf d_atolf
9932 eval $inlibc
9933
9934 : see if atoll exists
9935 set atoll d_atoll
9936 eval $inlibc
9937
9938 : Look for GCC-style attribute format
9939 case "$d_attribute_format" in
9940 '')
9941 echo " "
9942 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9943 $cat >attrib.c <<'EOCP'
9944 #include <stdio.h>
9945 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9946 EOCP
9947 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9948         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9949                 echo "Your C compiler doesn't support __attribute__((format))."
9950                 val="$undef"
9951         else
9952                 echo "Your C compiler supports __attribute__((format))."
9953                 val="$define"
9954         fi
9955 else
9956         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9957         val="$undef"
9958 fi
9959 ;;
9960 *) val="$d_attribute_format" ;;
9961 esac
9962 set d_attribute_format
9963 eval $setvar
9964 $rm -f attrib*
9965
9966 : Look for GCC-style attribute malloc
9967 case "$d_attribute_malloc" in
9968 '')
9969 echo " "
9970 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9971 $cat >attrib.c <<'EOCP'
9972 #include <stdio.h>
9973 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9974 EOCP
9975 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9976         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9977                 echo "Your C compiler doesn't support __attribute__((malloc))."
9978                 val="$undef"
9979         else
9980                 echo "Your C compiler supports __attribute__((malloc))."
9981                 val="$define"
9982         fi
9983 else
9984         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9985         val="$undef"
9986 fi
9987 ;;
9988 *) val="$d_attribute_malloc" ;;
9989 esac
9990 set d_attribute_malloc
9991 eval $setvar
9992 $rm -f attrib*
9993
9994 : Look for GCC-style attribute nonnull
9995 case "$d_attribute_nonnull" in
9996 '')
9997 echo " "
9998 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9999 $cat >attrib.c <<'EOCP'
10000 #include <stdio.h>
10001 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10002 EOCP
10003 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10004         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10005                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10006                 val="$undef"
10007         else
10008                 echo "Your C compiler supports __attribute__((nonnull))."
10009                 val="$define"
10010         fi
10011 else
10012         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10013         val="$undef"
10014 fi
10015 ;;
10016 *) val="$d_attribute_nonnull" ;;
10017 esac
10018 set d_attribute_nonnull
10019 eval $setvar
10020 $rm -f attrib*
10021
10022 : Look for GCC-style attribute noreturn
10023 case "$d_attribute_noreturn" in
10024 '')
10025 echo " "
10026 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10027 $cat >attrib.c <<'EOCP'
10028 #include <stdio.h>
10029 void fall_over_dead( void ) __attribute__((noreturn));
10030 EOCP
10031 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10032         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10033                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10034                 val="$undef"
10035         else
10036                 echo "Your C compiler supports __attribute__((noreturn))."
10037                 val="$define"
10038         fi
10039 else
10040         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10041         val="$undef"
10042 fi
10043 ;;
10044 *) val="$d_attribute_noreturn" ;;
10045 esac
10046 set d_attribute_noreturn
10047 eval $setvar
10048 $rm -f attrib*
10049
10050 : Look for GCC-style attribute pure
10051 case "$d_attribute_pure" in
10052 '')
10053 echo " "
10054 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10055 $cat >attrib.c <<'EOCP'
10056 #include <stdio.h>
10057 int square( int n ) __attribute__((pure));
10058 EOCP
10059 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10060         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10061                 echo "Your C compiler doesn't support __attribute__((pure))."
10062                 val="$undef"
10063         else
10064                 echo "Your C compiler supports __attribute__((pure))."
10065                 val="$define"
10066         fi
10067 else
10068         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10069         val="$undef"
10070 fi
10071 ;;
10072 *) val="$d_attribute_pure" ;;
10073 esac
10074 set d_attribute_pure
10075 eval $setvar
10076 $rm -f attrib*
10077
10078 : Look for GCC-style attribute unused
10079 case "$d_attribute_unused" in
10080 '')
10081 echo " "
10082 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10083 $cat >attrib.c <<'EOCP'
10084 #include <stdio.h>
10085 int do_something( int dummy __attribute__((unused)), int n );
10086 EOCP
10087 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10088         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10089                 echo "Your C compiler doesn't support __attribute__((unused))."
10090                 val="$undef"
10091         else
10092                 echo "Your C compiler supports __attribute__((unused))."
10093                 val="$define"
10094         fi
10095 else
10096         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10097         val="$undef"
10098 fi
10099 ;;
10100 *) val="$d_attribute_unused" ;;
10101 esac
10102 set d_attribute_unused
10103 eval $setvar
10104 $rm -f attrib*
10105
10106 : Look for GCC-style attribute warn_unused_result
10107 case "$d_attribute_warn_unused_result" in
10108 '')
10109 echo " "
10110 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10111 $cat >attrib.c <<'EOCP'
10112 #include <stdio.h>
10113 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10114 EOCP
10115 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10116         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10117                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10118                 val="$undef"
10119         else
10120                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10121                 val="$define"
10122         fi
10123 else
10124         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10125         val="$undef"
10126 fi
10127 ;;
10128 *) val="$d_attribute_warn_unused_result" ;;
10129 esac
10130 set d_attribute_warn_unused_result
10131 eval $setvar
10132 $rm -f attrib*
10133
10134 : see if bcmp exists
10135 set bcmp d_bcmp
10136 eval $inlibc
10137
10138 : see if bcopy exists
10139 set bcopy d_bcopy
10140 eval $inlibc
10141
10142 : see if getpgrp exists
10143 set getpgrp d_getpgrp
10144 eval $inlibc
10145
10146 case "$d_getpgrp" in
10147 "$define")
10148         echo " "
10149         echo "Checking to see which flavor of getpgrp is in use..."
10150         $cat >try.c <<EOP
10151 #$i_unistd I_UNISTD
10152 #include <sys/types.h>
10153 #ifdef I_UNISTD
10154 #  include <unistd.h>
10155 #endif
10156 #$i_stdlib I_STDLIB
10157 #ifdef I_STDLIB
10158 #include <stdlib.h>
10159 #endif
10160 int main()
10161 {
10162         if (getuid() == 0) {
10163                 printf("(I see you are running Configure as super-user...)\n");
10164                 setuid(1);
10165         }
10166 #ifdef TRY_BSD_PGRP
10167         if (getpgrp(1) == 0)
10168                 exit(0);
10169 #else
10170         if (getpgrp() > 0)
10171                 exit(0);
10172 #endif
10173         exit(1);
10174 }
10175 EOP
10176         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10177                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10178                 val="$define"
10179         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10180                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10181                 val="$undef"
10182         else
10183                 echo "I can't seem to compile and run the test program."
10184                 if ./usg; then
10185                         xxx="a USG one, i.e. you use getpgrp()."
10186                 else
10187                         # SVR4 systems can appear rather BSD-ish.
10188                         case "$i_unistd" in
10189                         $undef)
10190                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10191                                 val="$define"
10192                                 ;;
10193                         $define)
10194                                 xxx="probably a USG one, i.e. you use getpgrp()."
10195                                 val="$undef"
10196                                 ;;
10197                         esac
10198                 fi
10199                 echo "Assuming your getpgrp is $xxx" >&4
10200         fi
10201         ;;
10202 *) val="$undef";;
10203 esac
10204 set d_bsdgetpgrp
10205 eval $setvar
10206 $rm -f try try.*
10207
10208 : see if setpgrp exists
10209 set setpgrp d_setpgrp
10210 eval $inlibc
10211
10212 case "$d_setpgrp" in
10213 "$define")
10214         echo " "
10215         echo "Checking to see which flavor of setpgrp is in use..."
10216         $cat >try.c <<EOP
10217 #$i_unistd I_UNISTD
10218 #include <sys/types.h>
10219 #ifdef I_UNISTD
10220 #  include <unistd.h>
10221 #endif
10222 #$i_stdlib I_STDLIB
10223 #ifdef I_STDLIB
10224 #include <stdlib.h>
10225 #endif
10226 int main()
10227 {
10228         if (getuid() == 0) {
10229                 printf("(I see you are running Configure as super-user...)\n");
10230                 setuid(1);
10231         }
10232 #ifdef TRY_BSD_PGRP
10233         if (-1 == setpgrp(1, 1))
10234                 exit(0);
10235 #else
10236         if (setpgrp() != -1)
10237                 exit(0);
10238 #endif
10239         exit(1);
10240 }
10241 EOP
10242         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10243                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10244                 val="$define"
10245         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10246                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10247                 val="$undef"
10248         else
10249                 echo "(I can't seem to compile and run the test program.)"
10250                 if ./usg; then
10251                         xxx="a USG one, i.e. you use setpgrp()."
10252                 else
10253                         # SVR4 systems can appear rather BSD-ish.
10254                         case "$i_unistd" in
10255                         $undef)
10256                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10257                                 val="$define"
10258                                 ;;
10259                         $define)
10260                                 xxx="probably a USG one, i.e. you use setpgrp()."
10261                                 val="$undef"
10262                                 ;;
10263                         esac
10264                 fi
10265                 echo "Assuming your setpgrp is $xxx" >&4
10266         fi
10267         ;;
10268 *) val="$undef";;
10269 esac
10270 set d_bsdsetpgrp
10271 eval $setvar
10272 $rm -f try try.*
10273 : Look for GCC-style __builtin_choose_expr
10274 case "$d_builtin_choose_expr" in
10275 '')
10276     echo " "
10277     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10278     $cat >try.c <<'EOCP'
10279 #include <assert.h>
10280 #include <stdlib.h>
10281 #include <stdio.h>
10282
10283 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10284
10285 int main(void) {
10286     assert( SYRINX(1) == 2112 );
10287     assert( SYRINX(1) != 5150 );
10288     assert( SYRINX(0) == 5150 );
10289     assert( SYRINX(0) != 2112 );
10290     puts( "All good!" );
10291     exit(0);
10292 }
10293
10294 EOCP
10295     set try
10296     if eval $compile; then
10297         echo "Your C compiler supports __builtin_choose_expr."
10298         val="$define"
10299     else
10300         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10301         val="$undef"
10302     fi
10303 ;;
10304 *) val="$d_builtin_choose_expr" ;;
10305 esac
10306
10307 set d_builtin_choose_expr
10308 eval $setvar
10309 $rm -f try.* try core core.try.*
10310
10311 : Look for GCC-style __builtin_expect
10312 case "$d_builtin_expect" in
10313 '')
10314     echo " "
10315     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10316     $cat >builtin.c <<'EOCP'
10317 int main(void) {
10318     int n = 50;
10319     if ( __builtin_expect(n, 0) ) n = 1;
10320 }
10321 EOCP
10322     set try
10323     if eval $compile; then
10324         echo "Your C compiler supports __builtin_choose_expr."
10325         val="$define"
10326     else
10327         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10328         val="$undef"
10329     fi
10330     ;;
10331 *) val="$d_builtin_expect" ;;
10332 esac
10333
10334 set d_builtin_expect
10335 eval $setvar
10336 $rm -f try.* try core core.try.*
10337
10338 : see if bzero exists
10339 set bzero d_bzero
10340 eval $inlibc
10341
10342 : see if stdarg is available
10343 echo " "
10344 if $test `./findhdr stdarg.h`; then
10345         echo "<stdarg.h> found." >&4
10346         valstd="$define"
10347 else
10348         echo "<stdarg.h> NOT found." >&4
10349         valstd="$undef"
10350 fi
10351
10352 : see if varags is available
10353 echo " "
10354 if $test `./findhdr varargs.h`; then
10355         echo "<varargs.h> found." >&4
10356 else
10357         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10358 fi
10359
10360 : set up the varargs testing programs
10361 $cat > varargs.c <<EOP
10362 #ifdef I_STDARG
10363 #include <stdarg.h>
10364 #endif
10365 #ifdef I_VARARGS
10366 #include <varargs.h>
10367 #endif
10368
10369 #ifdef I_STDARG
10370 int f(char *p, ...)
10371 #else
10372 int f(va_alist)
10373 va_dcl
10374 #endif
10375 {
10376         va_list ap;
10377 #ifndef I_STDARG
10378         char *p;
10379 #endif
10380 #ifdef I_STDARG
10381         va_start(ap,p);
10382 #else
10383         va_start(ap);
10384         p = va_arg(ap, char *);
10385 #endif
10386         va_end(ap);
10387         return 0;
10388 }
10389 EOP
10390 $cat > varargs <<EOP
10391 $startsh
10392 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10393         echo "true"
10394 else
10395         echo "false"
10396 fi
10397 $rm -f varargs$_o
10398 EOP
10399 chmod +x varargs
10400
10401 : now check which varargs header should be included
10402 echo " "
10403 i_varhdr=''
10404 case "$valstd" in
10405 "$define")
10406         if `./varargs I_STDARG`; then
10407                 val='stdarg.h'
10408         elif `./varargs I_VARARGS`; then
10409                 val='varargs.h'
10410         fi
10411         ;;
10412 *)
10413         if `./varargs I_VARARGS`; then
10414                 val='varargs.h'
10415         fi
10416         ;;
10417 esac
10418 case "$val" in
10419 '')
10420 echo "I could not find the definition for va_dcl... You have problems..." >&4
10421         val="$undef"; set i_stdarg; eval $setvar
10422         val="$undef"; set i_varargs; eval $setvar
10423         ;;
10424 *) 
10425         set i_varhdr
10426         eval $setvar
10427         case "$i_varhdr" in
10428         stdarg.h)
10429                 val="$define"; set i_stdarg; eval $setvar
10430                 val="$undef"; set i_varargs; eval $setvar
10431                 ;;
10432         varargs.h)
10433                 val="$undef"; set i_stdarg; eval $setvar
10434                 val="$define"; set i_varargs; eval $setvar
10435                 ;;
10436         esac
10437         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10438 esac
10439 $rm -f varargs*
10440
10441 : see if the Compiler supports C99 variadic macros
10442 case "$i_stdarg$i_stdlib" in
10443     "$define$define")
10444     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10445     $cat >try.c <<EOCP
10446 #include <stdio.h>
10447 #include <stdarg.h>
10448
10449 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10450
10451 int main() {
10452   char buf[20];
10453   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10454   puts(buf);
10455   return 0;
10456 }
10457 EOCP
10458     set try
10459     if eval $compile && $run ./try 2>&1 >/dev/null; then
10460         case "`$run ./try`" in
10461             "123 456 789")
10462             echo "You have C99 variadic macros." >&4
10463             d_c99_variadic_macros="$define"
10464             ;;
10465             *)
10466             echo "You don't have functional C99 variadic macros." >&4
10467             d_c99_variadic_macros="$undef"
10468             ;;
10469         esac
10470     else
10471         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10472         d_c99_variadic_macros="$undef"
10473     fi
10474     $rm -f try.* try core core.try.*
10475     ;;
10476     *)
10477     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10478     d_c99_variadic_macros="$undef"
10479     ;;
10480 esac
10481
10482 : see if signal is declared as pointer to function returning int or void
10483 echo " "
10484 xxx=`./findhdr signal.h`
10485 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10486 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10487         echo "You have int (*signal())() instead of void." >&4
10488         val="$undef"
10489 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10490         echo "You have void (*signal())()." >&4
10491         val="$define"
10492 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10493         echo "You have int (*signal())() instead of void." >&4
10494         val="$undef"
10495 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10496         echo "You have void (*signal())()." >&4
10497         val="$define"
10498 else
10499         case "$d_voidsig" in
10500         '')
10501         echo "I can't determine whether signal handler returns void or int..." >&4
10502                 dflt=void
10503                 rp="What type does your signal handler return?"
10504                 . ./myread
10505                 case "$ans" in
10506                 v*) val="$define";;
10507                 *) val="$undef";;
10508                 esac;;
10509         "$define")
10510                 echo "As you already told me, signal handler returns void." >&4
10511                 val="$define"
10512                 ;;
10513         *)      echo "As you already told me, signal handler returns int." >&4
10514                 val="$undef"
10515                 ;;
10516         esac
10517 fi
10518 set d_voidsig
10519 eval $setvar
10520 case "$d_voidsig" in
10521 "$define") signal_t="void";;
10522 *) signal_t="int";;
10523 esac
10524 $rm -f $$.tmp
10525
10526 : check for ability to cast large floats to 32-bit ints.
10527 echo " "
10528 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10529 if $test "$intsize" -ge 4; then
10530         xxx=int
10531 else
10532         xxx=long
10533 fi
10534 $cat >try.c <<EOCP
10535 #include <stdio.h>
10536 #$i_stdlib I_STDLIB
10537 #ifdef I_STDLIB
10538 #include <stdlib.h>
10539 #endif
10540 #include <sys/types.h>
10541 #include <signal.h>
10542 $signal_t blech(int s) { exit(3); }
10543 int main()
10544 {
10545         $xxx i32;
10546         double f, g;
10547         int result = 0;
10548         char str[16];
10549         signal(SIGFPE, blech);
10550
10551         /* Don't let compiler optimize the test away.  Store the number 
10552            in a writable string for gcc to pass to sscanf under HP/UX.
10553         */
10554         sprintf(str, "2147483647");
10555         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10556         g = 10 * f;
10557         i32  = ($xxx) g;
10558
10559         /* x86 processors will probably give 0x8000 0000, which is a
10560            sign change.  We don't want that.  We want to mimic SPARC
10561            behavior here, which is to preserve the sign and give
10562            back 0x7fff ffff.
10563         */
10564         if (i32 != ($xxx) f)
10565                 result |= 1;
10566         exit(result);
10567 }
10568 EOCP
10569 set try
10570 if eval $compile_ok; then
10571         $run ./try
10572         yyy=$?
10573 else
10574         echo "(I can't seem to compile the test program--assuming it can't)"
10575         yyy=1
10576 fi
10577 case "$yyy" in
10578 0)      val="$define"
10579         echo "Yup, it can."
10580         ;;
10581 *)      val="$undef"
10582         echo "Nope, it can't."
10583         ;;
10584 esac
10585 set d_casti32
10586 eval $setvar
10587 $rm -f try try.*
10588
10589 : check for ability to cast negative floats to unsigned
10590 echo " "
10591 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10592 $cat >try.c <<EOCP
10593 #include <stdio.h>
10594 #$i_stdlib I_STDLIB
10595 #ifdef I_STDLIB
10596 #include <stdlib.h>
10597 #endif
10598 #include <sys/types.h>
10599 #include <signal.h>
10600 $signal_t blech(int s) { exit(7); }
10601 $signal_t blech_in_list(int s) { exit(4); }
10602 unsigned long dummy_long(unsigned long p) { return p; }
10603 unsigned int dummy_int(unsigned int p) { return p; }
10604 unsigned short dummy_short(unsigned short p) { return p; }
10605 int main()
10606 {
10607         double f;
10608         unsigned long along;
10609         unsigned int aint;
10610         unsigned short ashort;
10611         int result = 0;
10612         char str[16];
10613         
10614         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10615            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10616            optimized the whole file away
10617         */
10618         /* Store the number in a writable string for gcc to pass to 
10619            sscanf under HP/UX.
10620         */
10621         sprintf(str, "-123");
10622         sscanf(str, "%lf", &f);  /* f = -123.; */
10623
10624         signal(SIGFPE, blech);
10625         along = (unsigned long)f;
10626         aint = (unsigned int)f;
10627         ashort = (unsigned short)f;
10628         if (along != (unsigned long)-123)
10629                 result |= 1;
10630         if (aint != (unsigned int)-123)
10631                 result |= 1;
10632         if (ashort != (unsigned short)-123)
10633                 result |= 1;
10634         sprintf(str, "1073741824.");
10635         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10636         f = f + f;
10637         along = 0;
10638         along = (unsigned long)f;
10639         if (along != 0x80000000)
10640                 result |= 2;
10641         f -= 1.;
10642         along = 0;
10643         along = (unsigned long)f;
10644         if (along != 0x7fffffff)
10645                 result |= 1;
10646         f += 2.;
10647         along = 0;
10648         along = (unsigned long)f;
10649         if (along != 0x80000001)
10650                 result |= 2;
10651         if (result)
10652                 exit(result);
10653         signal(SIGFPE, blech_in_list);
10654         sprintf(str, "123.");
10655         sscanf(str, "%lf", &f);  /* f = 123.; */
10656         along = dummy_long((unsigned long)f);
10657         aint = dummy_int((unsigned int)f);
10658         ashort = dummy_short((unsigned short)f);
10659         if (along != (unsigned long)123)
10660                 result |= 4;
10661         if (aint != (unsigned int)123)
10662                 result |= 4;
10663         if (ashort != (unsigned short)123)
10664                 result |= 4;
10665         exit(result);
10666
10667 }
10668 EOCP
10669 set try
10670 if eval $compile_ok; then
10671         $run ./try
10672         castflags=$?
10673 else
10674         echo "(I can't seem to compile the test program--assuming it can't)"
10675         castflags=7
10676 fi
10677 case "$castflags" in
10678 0)      val="$define"
10679         echo "Yup, it can."
10680         ;;
10681 *)      val="$undef"
10682         echo "Nope, it can't."
10683         ;;
10684 esac
10685 set d_castneg
10686 eval $setvar
10687 $rm -f try.*
10688
10689 : see if vprintf exists
10690 echo " "
10691 if set vprintf val -f d_vprintf; eval $csym; $val; then
10692         echo 'vprintf() found.' >&4
10693         val="$define"
10694         $cat >try.c <<EOF
10695 #include <varargs.h>
10696 #$i_stdlib I_STDLIB
10697 #ifdef I_STDLIB
10698 #include <stdlib.h>
10699 #endif
10700
10701 int main() { xxx("foo"); }
10702
10703 xxx(va_alist)
10704 va_dcl
10705 {
10706         va_list args;
10707         char buf[10];
10708
10709         va_start(args);
10710         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10711 }
10712 EOF
10713         set try
10714         if eval $compile && $run ./try; then
10715                 echo "Your vsprintf() returns (int)." >&4
10716                 val2="$undef"
10717         else
10718                 echo "Your vsprintf() returns (char*)." >&4
10719                 val2="$define"
10720         fi
10721 else
10722         echo 'vprintf() NOT found.' >&4
10723                 val="$undef"
10724                 val2="$undef"
10725 fi
10726 $rm -f try try.*
10727 set d_vprintf
10728 eval $setvar
10729 val=$val2
10730 set d_charvspr
10731 eval $setvar
10732
10733 : see if chown exists
10734 set chown d_chown
10735 eval $inlibc
10736
10737 : see if chroot exists
10738 set chroot d_chroot
10739 eval $inlibc
10740
10741 : see if chsize exists
10742 set chsize d_chsize
10743 eval $inlibc
10744
10745 : see if class exists
10746 set class d_class
10747 eval $inlibc
10748
10749 : see if clearenv exists
10750 set clearenv d_clearenv
10751 eval $inlibc
10752
10753 hasstruct='varname=$1; struct=$2; shift; shift;
10754 while $test $# -ge 2; do
10755         case "$1" in
10756         $define) echo "#include <$2>";;
10757         esac ;
10758     shift 2;
10759 done > try.c;
10760 echo "int main () { struct $struct foo; }" >> try.c;
10761 set try;
10762 if eval $compile; then
10763         val="$define";
10764 else
10765         val="$undef";
10766 fi;
10767 set $varname;
10768 eval $setvar;
10769 $rm -f try.c try.o'
10770
10771 socketlib=''
10772 sockethdr=''
10773 : see whether socket exists
10774 echo " "
10775 $echo $n "Hmm... $c" >&4
10776 if set socket val -f d_socket; eval $csym; $val; then
10777         echo "Looks like you have Berkeley networking support." >&4
10778         d_socket="$define"
10779         if set setsockopt val -f; eval $csym; $val; then
10780                 d_oldsock="$undef"
10781         else
10782                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10783                 d_oldsock="$define"
10784         fi
10785 else
10786         if $contains socklib libc.list >/dev/null 2>&1; then
10787                 echo "Looks like you have Berkeley networking support." >&4
10788                 d_socket="$define"
10789                 : we will have to assume that it supports the 4.2 BSD interface
10790                 d_oldsock="$undef"
10791         else
10792                 echo "You don't have Berkeley networking in libc$_a..." >&4
10793                 if test "X$d_socket" = "X$define"; then
10794                    echo "...but you seem to believe that you have sockets." >&4
10795                 else
10796                         for net in net socket
10797                         do
10798                                 if test -f /usr/lib/lib$net$_a; then
10799                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10800                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10801                                         if $contains socket libc.list >/dev/null 2>&1; then
10802                                                 d_socket="$define"
10803                                                 socketlib="-l$net"
10804                                                 case "$net" in
10805                                                 net)
10806                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10807                                                         sockethdr="-I/usr/netinclude"
10808                                                         ;;
10809                                                 esac
10810                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10811                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10812                                                         d_oldsock="$undef"
10813                                                 else
10814                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10815                                                         d_oldsock="$define"
10816                                                 fi
10817                                                 break
10818                                         fi
10819                                 fi
10820                         done
10821                         if test "X$d_socket" != "X$define"; then
10822                            echo "or anywhere else I see." >&4
10823                            d_socket="$undef"
10824                            d_oldsock="$undef"
10825                         fi
10826                 fi
10827         fi
10828 fi
10829
10830 : see if socketpair exists
10831 set socketpair d_sockpair
10832 eval $inlibc
10833
10834
10835 echo " "
10836 echo "Checking the availability of certain socket constants..." >&4
10837 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10838         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10839         $cat >try.c <<EOF
10840 #include <sys/types.h>
10841 #include <sys/socket.h>
10842 int main() {
10843     int i = $ENUM;
10844 }
10845 EOF
10846         val="$undef"
10847         set try; if eval $compile; then
10848                 val="$define"
10849         fi
10850         set d_${enum}; eval $setvar
10851         $rm -f try.c try
10852 done
10853
10854 : see if this is a sys/uio.h system
10855 set sys/uio.h i_sysuio
10856 eval $inhdr
10857
10858
10859 echo " "
10860 echo "Checking to see if your system supports struct cmsghdr..." >&4
10861 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10862 eval $hasstruct
10863 case "$d_cmsghdr_s" in
10864 "$define")      echo "Yes, it does."   ;;
10865 *)              echo "No, it doesn't." ;;
10866 esac
10867
10868
10869 : check for const keyword
10870 echo " "
10871 echo 'Checking to see if your C compiler knows about "const"...' >&4
10872 $cat >const.c <<'EOCP'
10873 typedef struct spug { int drokk; } spug;
10874 int main()
10875 {
10876         const char *foo;
10877         const spug y = { 0 };
10878 }
10879 EOCP
10880 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10881         val="$define"
10882         echo "Yup, it does."
10883 else
10884         val="$undef"
10885         echo "Nope, it doesn't."
10886 fi
10887 set d_const
10888 eval $setvar
10889
10890 : see if copysignl exists
10891 set copysignl d_copysignl
10892 eval $inlibc
10893
10894 : see if crypt exists
10895 echo " "
10896 set crypt d_crypt
10897 eval $inlibc
10898 case "$d_crypt" in
10899 $define) cryptlib='' ;;
10900 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10901                 echo 'crypt() found.' >&4
10902                 val="$define"
10903                 cryptlib=''
10904         else
10905                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10906                 if $test -z "$cryptlib"; then
10907                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10908                 else
10909                         cryptlib=-lcrypt
10910                 fi
10911                 if $test -z "$cryptlib"; then
10912                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10913                 else
10914                         cryptlib=-lcrypt
10915                 fi
10916                 if $test -z "$cryptlib"; then
10917                         cryptlib=`./loc libcrypt$_a "" $libpth`
10918                 else
10919                         cryptlib=-lcrypt
10920                 fi
10921                 if $test -z "$cryptlib"; then
10922                         echo 'crypt() NOT found.' >&4
10923                         val="$undef"
10924                 else
10925                         val="$define"
10926                 fi
10927         fi
10928         set d_crypt
10929         eval $setvar
10930         ;;
10931 esac
10932
10933 : see if this is a crypt.h system
10934 set crypt.h i_crypt
10935 eval $inhdr
10936
10937 : see if crypt_r exists
10938 set crypt_r d_crypt_r
10939 eval $inlibc
10940 case "$d_crypt_r" in
10941 "$define")
10942         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10943         case "$d_crypt_r_proto:$usethreads" in
10944         ":define")      d_crypt_r_proto=define
10945                 set d_crypt_r_proto crypt_r $hdrs
10946                 eval $hasproto ;;
10947         *)      ;;
10948         esac
10949         case "$d_crypt_r_proto" in
10950         define)
10951         case "$crypt_r_proto" in
10952         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10953         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10954         esac
10955         case "$crypt_r_proto" in
10956         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10957         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10958         esac
10959         case "$crypt_r_proto" in
10960         ''|0)   d_crypt_r=undef
10961                 crypt_r_proto=0
10962                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10963         * )     case "$crypt_r_proto" in
10964                 REENTRANT_PROTO*) ;;
10965                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10966                 esac
10967                 echo "Prototype: $try" ;;
10968         esac
10969         ;;
10970         *)      case "$usethreads" in
10971                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10972                 esac
10973                 d_crypt_r=undef
10974                 crypt_r_proto=0
10975                 ;;
10976         esac
10977         ;;
10978 *)      crypt_r_proto=0
10979         ;;
10980 esac
10981
10982 : get csh whereabouts
10983 case "$csh" in
10984 'csh') val="$undef" ;;
10985 *) val="$define" ;;
10986 esac
10987 set d_csh
10988 eval $setvar
10989 : Respect a hint or command line value for full_csh.
10990 case "$full_csh" in
10991 '') full_csh=$csh ;;
10992 esac
10993
10994 : see if ctermid exists
10995 set ctermid d_ctermid
10996 eval $inlibc
10997
10998 : see if ctermid_r exists
10999 set ctermid_r d_ctermid_r
11000 eval $inlibc
11001 case "$d_ctermid_r" in
11002 "$define")
11003         hdrs="$i_systypes sys/types.h define stdio.h "
11004         case "$d_ctermid_r_proto:$usethreads" in
11005         ":define")      d_ctermid_r_proto=define
11006                 set d_ctermid_r_proto ctermid_r $hdrs
11007                 eval $hasproto ;;
11008         *)      ;;
11009         esac
11010         case "$d_ctermid_r_proto" in
11011         define)
11012         case "$ctermid_r_proto" in
11013         ''|0) try='char* ctermid_r(char*);'
11014         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11015         esac
11016         case "$ctermid_r_proto" in
11017         ''|0)   d_ctermid_r=undef
11018                 ctermid_r_proto=0
11019                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11020         * )     case "$ctermid_r_proto" in
11021                 REENTRANT_PROTO*) ;;
11022                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11023                 esac
11024                 echo "Prototype: $try" ;;
11025         esac
11026         ;;
11027         *)      case "$usethreads" in
11028                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11029                 esac
11030                 d_ctermid_r=undef
11031                 ctermid_r_proto=0
11032                 ;;
11033         esac
11034         ;;
11035 *)      ctermid_r_proto=0
11036         ;;
11037 esac
11038
11039 : see if ctime_r exists
11040 set ctime_r d_ctime_r
11041 eval $inlibc
11042 case "$d_ctime_r" in
11043 "$define")
11044         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11045         case "$d_ctime_r_proto:$usethreads" in
11046         ":define")      d_ctime_r_proto=define
11047                 set d_ctime_r_proto ctime_r $hdrs
11048                 eval $hasproto ;;
11049         *)      ;;
11050         esac
11051         case "$d_ctime_r_proto" in
11052         define)
11053         case "$ctime_r_proto" in
11054         ''|0) try='char* ctime_r(const time_t*, char*);'
11055         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11056         esac
11057         case "$ctime_r_proto" in
11058         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11059         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11060         esac
11061         case "$ctime_r_proto" in
11062         ''|0) try='int ctime_r(const time_t*, char*);'
11063         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11064         esac
11065         case "$ctime_r_proto" in
11066         ''|0) try='int ctime_r(const time_t*, char*, int);'
11067         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11068         esac
11069         case "$ctime_r_proto" in
11070         ''|0)   d_ctime_r=undef
11071                 ctime_r_proto=0
11072                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11073         * )     case "$ctime_r_proto" in
11074                 REENTRANT_PROTO*) ;;
11075                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11076                 esac
11077                 echo "Prototype: $try" ;;
11078         esac
11079         ;;
11080         *)      case "$usethreads" in
11081                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11082                 esac
11083                 d_ctime_r=undef
11084                 ctime_r_proto=0
11085                 ;;
11086         esac
11087         ;;
11088 *)      ctime_r_proto=0
11089         ;;
11090 esac
11091
11092 : see if cuserid exists
11093 set cuserid d_cuserid
11094 eval $inlibc
11095
11096 : see if this is a limits.h system
11097 set limits.h i_limits
11098 eval $inhdr
11099
11100 : see if this is a float.h system
11101 set float.h i_float
11102 eval $inhdr
11103
11104 : See if number of significant digits in a double precision number is known
11105 echo " "
11106 $cat >dbl_dig.c <<EOM
11107 #$i_limits I_LIMITS
11108 #$i_float I_FLOAT
11109 #ifdef I_LIMITS
11110 #include <limits.h>
11111 #endif
11112 #ifdef I_FLOAT
11113 #include <float.h>
11114 #endif
11115 #ifdef DBL_DIG
11116 printf("Contains DBL_DIG");
11117 #endif
11118 EOM
11119 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11120 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11121         echo "DBL_DIG found." >&4
11122         val="$define"
11123 else
11124         echo "DBL_DIG NOT found." >&4
11125         val="$undef"
11126 fi
11127 $rm -f dbl_dig.?
11128 set d_dbl_dig
11129 eval $setvar
11130
11131 : see if dbm.h is available
11132 : see if dbmclose exists
11133 set dbmclose d_dbmclose
11134 eval $inlibc
11135
11136 case "$d_dbmclose" in
11137 $define)
11138         set dbm.h i_dbm
11139         eval $inhdr
11140         case "$i_dbm" in
11141         $define)
11142                 val="$undef"
11143                 set i_rpcsvcdbm
11144                 eval $setvar
11145                 ;;
11146         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11147                 eval $inhdr
11148                 ;;
11149         esac
11150         ;;
11151 *)      echo "We won't be including <dbm.h>"
11152         val="$undef"
11153         set i_dbm
11154         eval $setvar
11155         val="$undef"
11156         set i_rpcsvcdbm
11157         eval $setvar
11158         ;;
11159 esac
11160
11161 : see if prototype for dbminit is available
11162 echo " "
11163 set d_dbminitproto dbminit $i_dbm dbm.h
11164 eval $hasproto
11165
11166 : see if difftime exists
11167 set difftime d_difftime
11168 eval $inlibc
11169
11170 : see if this is a dirent system
11171 echo " "
11172 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11173         val="$define"
11174         echo "<dirent.h> found." >&4
11175 else
11176         val="$undef"
11177         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11178                 echo "<sys/dir.h> found." >&4
11179                 echo " "
11180         else
11181                 xinc=`./findhdr sys/ndir.h`
11182         fi
11183         echo "<dirent.h> NOT found." >&4
11184 fi
11185 set i_dirent
11186 eval $setvar
11187
11188 : Look for type of directory structure.
11189 echo " "
11190 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11191
11192 case "$direntrytype" in
11193 ''|' ')
11194         case "$i_dirent" in
11195         $define) guess1='struct dirent' ;;
11196         *) guess1='struct direct'  ;;
11197         esac
11198         ;;
11199 *)      guess1="$direntrytype"
11200         ;;
11201 esac
11202
11203 case "$guess1" in
11204 'struct dirent') guess2='struct direct' ;;
11205 *) guess2='struct dirent' ;;
11206 esac
11207                 
11208 if $contains "$guess1" try.c >/dev/null 2>&1; then
11209         direntrytype="$guess1"
11210         echo "Your directory entries are $direntrytype." >&4
11211 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11212         direntrytype="$guess2"
11213         echo "Your directory entries seem to be $direntrytype." >&4
11214 else
11215         echo "I don't recognize your system's directory entries." >&4
11216         rp="What type is used for directory entries on this system?"
11217         dflt="$guess1"
11218         . ./myread
11219         direntrytype="$ans"
11220 fi
11221 $rm -f try.c
11222
11223
11224 : see if the directory entry stores field length
11225 echo " "
11226 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11227 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11228         echo "Good, your directory entry keeps length information in d_namlen." >&4
11229         val="$define"
11230 else
11231         echo "Your directory entry does not know about the d_namlen field." >&4
11232         val="$undef"
11233 fi
11234 set d_dirnamlen
11235 eval $setvar
11236 $rm -f try.c
11237
11238 : see if this is an sysdir system
11239 set sys/dir.h i_sysdir
11240 eval $inhdr
11241
11242 : see if this is an sysndir system
11243 set sys/ndir.h i_sysndir
11244 eval $inhdr
11245
11246 : Look for dirfd
11247 echo " "
11248 $cat >dirfd.c <<EOM
11249 #include <stdio.h>
11250 #$i_stdlib I_STDLIB
11251 #ifdef I_STDLIB
11252 #include <stdlib.h>
11253 #endif
11254 #$i_dirent I_DIRENT             /**/
11255 #$i_sysdir I_SYS_DIR            /**/
11256 #$i_sysndir I_SYS_NDIR          /**/
11257 #$i_systypes I_SYS_TYPES        /**/
11258 #if defined(I_SYS_TYPES)
11259 #include <sys/types.h>
11260 #endif
11261 #if defined(I_DIRENT)
11262 #include <dirent.h>
11263 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11264 #include <sys/dir.h>
11265 #endif
11266 #else
11267 #ifdef I_SYS_NDIR
11268 #include <sys/ndir.h>
11269 #else
11270 #ifdef I_SYS_DIR
11271 #ifdef hp9000s500
11272 #include <ndir.h>       /* may be wrong in the future */
11273 #else
11274 #include <sys/dir.h>
11275 #endif
11276 #endif
11277 #endif
11278 #endif 
11279 int main() {
11280         DIR *dirp = opendir(".");
11281         if (dirfd(dirp) >= 0)
11282                 exit(0);
11283         else
11284                 exit(1);
11285 }
11286 EOM
11287 val=$undef
11288 set dirfd
11289 if eval $compile; then
11290         val="$define"
11291 fi
11292 case "$val" in
11293 $define)        echo "dirfd() found." >&4       ;;
11294 *)              echo "dirfd() NOT found." >&4   ;;
11295 esac
11296 set d_dirfd
11297 eval $setvar
11298 $rm -f dirfd*
11299
11300 : see if dlerror exists
11301 xxx_runnm="$runnm"
11302 runnm=false
11303 set dlerror d_dlerror
11304 eval $inlibc
11305 runnm="$xxx_runnm"
11306
11307 : see if dlfcn is available
11308 set dlfcn.h i_dlfcn
11309 eval $inhdr
11310
11311 case "$usedl" in
11312 $define|y|true)
11313         $cat << EOM
11314
11315 On a few systems, the dynamically loaded modules that perl generates and uses
11316 will need a different extension than shared libs. The default will probably
11317 be appropriate.
11318
11319 EOM
11320         case "$dlext" in
11321         '')     dflt="$so" ;;
11322         *)      dflt="$dlext" ;;
11323         esac
11324         rp='What is the extension of dynamically loaded modules'
11325         . ./myread
11326         dlext="$ans"
11327         ;;
11328 *)
11329         dlext="none"
11330         ;;
11331 esac
11332
11333 : Check if dlsym need a leading underscore
11334 echo " "
11335 val="$undef"
11336
11337 case "$dlsrc" in
11338 dl_dlopen.xs)
11339         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11340         $cat >dyna.c <<'EOM'
11341 fred () { }
11342 EOM
11343
11344 $cat >fred.c<<EOM
11345
11346 #include <stdio.h>
11347 #$i_stdlib I_STDLIB
11348 #ifdef I_STDLIB
11349 #include <stdlib.h>
11350 #endif
11351 #$i_dlfcn I_DLFCN
11352 #ifdef I_DLFCN
11353 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11354 #else
11355 #include <sys/types.h>
11356 #include <nlist.h>
11357 #include <link.h>
11358 #endif
11359
11360 extern int fred() ;
11361
11362 int main()
11363 {
11364     void * handle ;
11365     void * symbol ;
11366 #ifndef RTLD_LAZY
11367     int mode = 1 ;
11368 #else
11369     int mode = RTLD_LAZY ;
11370 #endif
11371     handle = dlopen("./dyna.$dlext", mode) ;
11372     if (handle == NULL) {
11373         printf ("1\n") ;
11374         fflush (stdout) ;
11375         exit(0);
11376     }
11377     symbol = dlsym(handle, "fred") ;
11378     if (symbol == NULL) {
11379         /* try putting a leading underscore */
11380         symbol = dlsym(handle, "_fred") ;
11381         if (symbol == NULL) {
11382             printf ("2\n") ;
11383             fflush (stdout) ;
11384             exit(0);
11385         }
11386         printf ("3\n") ;
11387     }
11388     else
11389         printf ("4\n") ;
11390     fflush (stdout) ;
11391     exit(0);
11392 }
11393 EOM
11394         : Call the object file tmp-dyna.o in case dlext=o.
11395         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11396                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11397                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11398                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11399                 xxx=`$run ./fred`
11400                 case $xxx in
11401                 1)      echo "Test program failed using dlopen." >&4
11402                         echo "Perhaps you should not use dynamic loading." >&4;;
11403                 2)      echo "Test program failed using dlsym." >&4
11404                         echo "Perhaps you should not use dynamic loading." >&4;;
11405                 3)      echo "dlsym needs a leading underscore" >&4
11406                         val="$define" ;;
11407                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11408                 esac
11409         else
11410                 echo "I can't compile and run the test program." >&4
11411                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11412         fi
11413         ;;
11414 esac
11415                 
11416 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11417
11418 set d_dlsymun
11419 eval $setvar
11420
11421 : see if drand48_r exists
11422 set drand48_r d_drand48_r
11423 eval $inlibc
11424 case "$d_drand48_r" in
11425 "$define")
11426         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11427         case "$d_drand48_r_proto:$usethreads" in
11428         ":define")      d_drand48_r_proto=define
11429                 set d_drand48_r_proto drand48_r $hdrs
11430                 eval $hasproto ;;
11431         *)      ;;
11432         esac
11433         case "$d_drand48_r_proto" in
11434         define)
11435         case "$drand48_r_proto" in
11436         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11437         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11438         esac
11439         case "$drand48_r_proto" in
11440         ''|0)   d_drand48_r=undef
11441                 drand48_r_proto=0
11442                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11443         * )     case "$drand48_r_proto" in
11444                 REENTRANT_PROTO*) ;;
11445                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11446                 esac
11447                 echo "Prototype: $try" ;;
11448         esac
11449         ;;
11450         *)      case "$usethreads" in
11451                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11452                 esac
11453                 d_drand48_r=undef
11454                 drand48_r_proto=0
11455                 ;;
11456         esac
11457         ;;
11458 *)      drand48_r_proto=0
11459         ;;
11460 esac
11461
11462 : see if prototype for drand48 is available
11463 echo " "
11464 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11465 eval $hasproto
11466
11467 : see if dup2 exists
11468 set dup2 d_dup2
11469 eval $inlibc
11470
11471 : see if eaccess exists
11472 set eaccess d_eaccess
11473 eval $inlibc
11474
11475 : see if endgrent exists
11476 set endgrent d_endgrent
11477 eval $inlibc
11478
11479 : see if this is an grp system
11480 set grp.h i_grp
11481 eval $inhdr
11482
11483 case "$i_grp" in
11484 $define)
11485         xxx=`./findhdr grp.h`
11486         $cppstdin $cppflags $cppminus < $xxx >$$.h
11487
11488         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11489                 val="$define"
11490         else
11491                 val="$undef"
11492         fi
11493         set d_grpasswd
11494         eval $setvar
11495
11496         $rm -f $$.h
11497         ;;
11498 *)
11499         val="$undef";
11500         set d_grpasswd; eval $setvar
11501         ;;
11502 esac
11503
11504 : see if endgrent_r exists
11505 set endgrent_r d_endgrent_r
11506 eval $inlibc
11507 case "$d_endgrent_r" in
11508 "$define")
11509         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11510         case "$d_endgrent_r_proto:$usethreads" in
11511         ":define")      d_endgrent_r_proto=define
11512                 set d_endgrent_r_proto endgrent_r $hdrs
11513                 eval $hasproto ;;
11514         *)      ;;
11515         esac
11516         case "$d_endgrent_r_proto" in
11517         define)
11518         case "$endgrent_r_proto" in
11519         ''|0) try='int endgrent_r(FILE**);'
11520         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11521         esac
11522         case "$endgrent_r_proto" in
11523         ''|0) try='void endgrent_r(FILE**);'
11524         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11525         esac
11526         case "$endgrent_r_proto" in
11527         ''|0)   d_endgrent_r=undef
11528                 endgrent_r_proto=0
11529                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11530         * )     case "$endgrent_r_proto" in
11531                 REENTRANT_PROTO*) ;;
11532                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11533                 esac
11534                 echo "Prototype: $try" ;;
11535         esac
11536         ;;
11537         *)      case "$usethreads" in
11538                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11539                 esac
11540                 d_endgrent_r=undef
11541                 endgrent_r_proto=0
11542                 ;;
11543         esac
11544         ;;
11545 *)      endgrent_r_proto=0
11546         ;;
11547 esac
11548
11549 : see if endhostent exists
11550 set endhostent d_endhent
11551 eval $inlibc
11552
11553 : see if this is a netdb.h system
11554 set netdb.h i_netdb
11555 eval $inhdr
11556
11557 : see if endhostent_r exists
11558 set endhostent_r d_endhostent_r
11559 eval $inlibc
11560 case "$d_endhostent_r" in
11561 "$define")
11562         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11563         case "$d_endhostent_r_proto:$usethreads" in
11564         ":define")      d_endhostent_r_proto=define
11565                 set d_endhostent_r_proto endhostent_r $hdrs
11566                 eval $hasproto ;;
11567         *)      ;;
11568         esac
11569         case "$d_endhostent_r_proto" in
11570         define)
11571         case "$endhostent_r_proto" in
11572         ''|0) try='int endhostent_r(struct hostent_data*);'
11573         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11574         esac
11575         case "$endhostent_r_proto" in
11576         ''|0) try='void endhostent_r(struct hostent_data*);'
11577         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11578         esac
11579         case "$endhostent_r_proto" in
11580         ''|0)   d_endhostent_r=undef
11581                 endhostent_r_proto=0
11582                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11583         * )     case "$endhostent_r_proto" in
11584                 REENTRANT_PROTO*) ;;
11585                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11586                 esac
11587                 echo "Prototype: $try" ;;
11588         esac
11589         ;;
11590         *)      case "$usethreads" in
11591                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11592                 esac
11593                 d_endhostent_r=undef
11594                 endhostent_r_proto=0
11595                 ;;
11596         esac
11597         ;;
11598 *)      endhostent_r_proto=0
11599         ;;
11600 esac
11601
11602 : see if endnetent exists
11603 set endnetent d_endnent
11604 eval $inlibc
11605
11606 : see if endnetent_r exists
11607 set endnetent_r d_endnetent_r
11608 eval $inlibc
11609 case "$d_endnetent_r" in
11610 "$define")
11611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11612         case "$d_endnetent_r_proto:$usethreads" in
11613         ":define")      d_endnetent_r_proto=define
11614                 set d_endnetent_r_proto endnetent_r $hdrs
11615                 eval $hasproto ;;
11616         *)      ;;
11617         esac
11618         case "$d_endnetent_r_proto" in
11619         define)
11620         case "$endnetent_r_proto" in
11621         ''|0) try='int endnetent_r(struct netent_data*);'
11622         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11623         esac
11624         case "$endnetent_r_proto" in
11625         ''|0) try='void endnetent_r(struct netent_data*);'
11626         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11627         esac
11628         case "$endnetent_r_proto" in
11629         ''|0)   d_endnetent_r=undef
11630                 endnetent_r_proto=0
11631                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11632         * )     case "$endnetent_r_proto" in
11633                 REENTRANT_PROTO*) ;;
11634                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11635                 esac
11636                 echo "Prototype: $try" ;;
11637         esac
11638         ;;
11639         *)      case "$usethreads" in
11640                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11641                 esac
11642                 d_endnetent_r=undef
11643                 endnetent_r_proto=0
11644                 ;;
11645         esac
11646         ;;
11647 *)      endnetent_r_proto=0
11648         ;;
11649 esac
11650
11651 : see if endprotoent exists
11652 set endprotoent d_endpent
11653 eval $inlibc
11654
11655 : see if endprotoent_r exists
11656 set endprotoent_r d_endprotoent_r
11657 eval $inlibc
11658 case "$d_endprotoent_r" in
11659 "$define")
11660         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11661         case "$d_endprotoent_r_proto:$usethreads" in
11662         ":define")      d_endprotoent_r_proto=define
11663                 set d_endprotoent_r_proto endprotoent_r $hdrs
11664                 eval $hasproto ;;
11665         *)      ;;
11666         esac
11667         case "$d_endprotoent_r_proto" in
11668         define)
11669         case "$endprotoent_r_proto" in
11670         ''|0) try='int endprotoent_r(struct protoent_data*);'
11671         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11672         esac
11673         case "$endprotoent_r_proto" in
11674         ''|0) try='void endprotoent_r(struct protoent_data*);'
11675         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11676         esac
11677         case "$endprotoent_r_proto" in
11678         ''|0)   d_endprotoent_r=undef
11679                 endprotoent_r_proto=0
11680                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11681         * )     case "$endprotoent_r_proto" in
11682                 REENTRANT_PROTO*) ;;
11683                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11684                 esac
11685                 echo "Prototype: $try" ;;
11686         esac
11687         ;;
11688         *)      case "$usethreads" in
11689                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11690                 esac
11691                 d_endprotoent_r=undef
11692                 endprotoent_r_proto=0
11693                 ;;
11694         esac
11695         ;;
11696 *)      endprotoent_r_proto=0
11697         ;;
11698 esac
11699
11700 : see if endpwent exists
11701 set endpwent d_endpwent
11702 eval $inlibc
11703
11704 : see if this is a pwd.h system
11705 set pwd.h i_pwd
11706 eval $inhdr
11707
11708 case "$i_pwd" in
11709 $define)
11710         xxx=`./findhdr pwd.h`
11711         $cppstdin $cppflags $cppminus < $xxx >$$.h
11712
11713         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11714                 val="$define"
11715         else
11716                 val="$undef"
11717         fi
11718         set d_pwquota
11719         eval $setvar
11720
11721         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11722                 val="$define"
11723         else
11724                 val="$undef"
11725         fi
11726         set d_pwage
11727         eval $setvar
11728
11729         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11730                 val="$define"
11731         else
11732                 val="$undef"
11733         fi
11734         set d_pwchange
11735         eval $setvar
11736
11737         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11738                 val="$define"
11739         else
11740                 val="$undef"
11741         fi
11742         set d_pwclass
11743         eval $setvar
11744
11745         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11746                 val="$define"
11747         else
11748                 val="$undef"
11749         fi
11750         set d_pwexpire
11751         eval $setvar
11752
11753         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11754                 val="$define"
11755         else
11756                 val="$undef"
11757         fi
11758         set d_pwcomment
11759         eval $setvar
11760
11761         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11762                 val="$define"
11763         else
11764                 val="$undef"
11765         fi
11766         set d_pwgecos
11767         eval $setvar
11768
11769         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11770                 val="$define"
11771         else
11772                 val="$undef"
11773         fi
11774         set d_pwpasswd
11775         eval $setvar
11776
11777         $rm -f $$.h
11778         ;;
11779 *)
11780         val="$undef"; 
11781         set d_pwquota; eval $setvar
11782         set d_pwage; eval $setvar
11783         set d_pwchange; eval $setvar
11784         set d_pwclass; eval $setvar
11785         set d_pwexpire; eval $setvar
11786         set d_pwcomment; eval $setvar
11787         set d_pwgecos; eval $setvar
11788         set d_pwpasswd; eval $setvar
11789         ;;
11790 esac
11791
11792 : see if endpwent_r exists
11793 set endpwent_r d_endpwent_r
11794 eval $inlibc
11795 case "$d_endpwent_r" in
11796 "$define")
11797         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11798         case "$d_endpwent_r_proto:$usethreads" in
11799         ":define")      d_endpwent_r_proto=define
11800                 set d_endpwent_r_proto endpwent_r $hdrs
11801                 eval $hasproto ;;
11802         *)      ;;
11803         esac
11804         case "$d_endpwent_r_proto" in
11805         define)
11806         case "$endpwent_r_proto" in
11807         ''|0) try='int endpwent_r(FILE**);'
11808         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11809         esac
11810         case "$endpwent_r_proto" in
11811         ''|0) try='void endpwent_r(FILE**);'
11812         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11813         esac
11814         case "$endpwent_r_proto" in
11815         ''|0)   d_endpwent_r=undef
11816                 endpwent_r_proto=0
11817                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11818         * )     case "$endpwent_r_proto" in
11819                 REENTRANT_PROTO*) ;;
11820                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11821                 esac
11822                 echo "Prototype: $try" ;;
11823         esac
11824         ;;
11825         *)      case "$usethreads" in
11826                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11827                 esac
11828                 d_endpwent_r=undef
11829                 endpwent_r_proto=0
11830                 ;;
11831         esac
11832         ;;
11833 *)      endpwent_r_proto=0
11834         ;;
11835 esac
11836
11837 : see if endservent exists
11838 set endservent d_endsent
11839 eval $inlibc
11840
11841 : see if endservent_r exists
11842 set endservent_r d_endservent_r
11843 eval $inlibc
11844 case "$d_endservent_r" in
11845 "$define")
11846         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11847         case "$d_endservent_r_proto:$usethreads" in
11848         ":define")      d_endservent_r_proto=define
11849                 set d_endservent_r_proto endservent_r $hdrs
11850                 eval $hasproto ;;
11851         *)      ;;
11852         esac
11853         case "$d_endservent_r_proto" in
11854         define)
11855         case "$endservent_r_proto" in
11856         ''|0) try='int endservent_r(struct servent_data*);'
11857         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11858         esac
11859         case "$endservent_r_proto" in
11860         ''|0) try='void endservent_r(struct servent_data*);'
11861         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11862         esac
11863         case "$endservent_r_proto" in
11864         ''|0)   d_endservent_r=undef
11865                 endservent_r_proto=0
11866                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11867         * )     case "$endservent_r_proto" in
11868                 REENTRANT_PROTO*) ;;
11869                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11870                 esac
11871                 echo "Prototype: $try" ;;
11872         esac
11873         ;;
11874         *)      case "$usethreads" in
11875                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11876                 esac
11877                 d_endservent_r=undef
11878                 endservent_r_proto=0
11879                 ;;
11880         esac
11881         ;;
11882 *)      endservent_r_proto=0
11883         ;;
11884 esac
11885
11886 : Locate the flags for 'open()'
11887 echo " "
11888 $cat >try.c <<EOCP
11889 #include <sys/types.h>
11890 #ifdef I_FCNTL
11891 #include <fcntl.h>
11892 #endif
11893 #ifdef I_SYS_FILE
11894 #include <sys/file.h>
11895 #endif
11896 #$i_stdlib I_STDLIB
11897 #ifdef I_STDLIB
11898 #include <stdlib.h>
11899 #endif
11900 int main() {
11901         if(O_RDONLY);
11902 #ifdef O_TRUNC
11903         exit(0);
11904 #else
11905         exit(1);
11906 #endif
11907 }
11908 EOCP
11909 : check sys/file.h first to get FREAD on Sun
11910 if $test `./findhdr sys/file.h` && \
11911                 set try -DI_SYS_FILE && eval $compile; then
11912         h_sysfile=true;
11913         echo "<sys/file.h> defines the O_* constants..." >&4
11914         if $run ./try; then
11915                 echo "and you have the 3 argument form of open()." >&4
11916                 val="$define"
11917         else
11918                 echo "but not the 3 argument form of open().  Oh, well." >&4
11919                 val="$undef"
11920         fi
11921 elif $test `./findhdr fcntl.h` && \
11922                 set try -DI_FCNTL && eval $compile; then
11923         h_fcntl=true;
11924         echo "<fcntl.h> defines the O_* constants..." >&4
11925         if $run ./try; then
11926                 echo "and you have the 3 argument form of open()." >&4
11927                 val="$define"
11928         else
11929                 echo "but not the 3 argument form of open().  Oh, well." >&4
11930                 val="$undef"
11931         fi
11932 else
11933         val="$undef"
11934         echo "I can't find the O_* constant definitions!  You got problems." >&4
11935 fi
11936 set d_open3
11937 eval $setvar
11938 $rm -f try try.*
11939
11940 : see which of string.h or strings.h is needed
11941 echo " "
11942 strings=`./findhdr string.h`
11943 if $test "$strings" && $test -r "$strings"; then
11944         echo "Using <string.h> instead of <strings.h>." >&4
11945         val="$define"
11946 else
11947         val="$undef"
11948         strings=`./findhdr strings.h`
11949         if $test "$strings" && $test -r "$strings"; then
11950                 echo "Using <strings.h> instead of <string.h>." >&4
11951         else
11952                 echo "No string header found -- You'll surely have problems." >&4
11953         fi
11954 fi
11955 set i_string
11956 eval $setvar
11957 case "$i_string" in
11958 "$undef") strings=`./findhdr strings.h`;;
11959 *)        strings=`./findhdr string.h`;;
11960 esac
11961
11962 : see if this is a sys/file.h system
11963 val=''
11964 set sys/file.h val
11965 eval $inhdr
11966
11967 : do we need to include sys/file.h ?
11968 case "$val" in
11969 "$define")
11970         echo " "
11971         if $h_sysfile; then
11972                 val="$define"
11973                 echo "We'll be including <sys/file.h>." >&4
11974         else
11975                 val="$undef"
11976                 echo "We won't be including <sys/file.h>." >&4
11977         fi
11978         ;;
11979 *)
11980         h_sysfile=false
11981         ;;
11982 esac
11983 set i_sysfile
11984 eval $setvar
11985
11986 : see if fcntl.h is there
11987 val=''
11988 set fcntl.h val
11989 eval $inhdr
11990
11991 : see if we can include fcntl.h
11992 case "$val" in
11993 "$define")
11994         echo " "
11995         if $h_fcntl; then
11996                 val="$define"
11997                 echo "We'll be including <fcntl.h>." >&4
11998         else
11999                 val="$undef"
12000                 if $h_sysfile; then
12001         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12002                 else
12003                         echo "We won't be including <fcntl.h>." >&4
12004                 fi
12005         fi
12006         ;;
12007 *)
12008         h_fcntl=false
12009         val="$undef"
12010         ;;
12011 esac
12012 set i_fcntl
12013 eval $setvar
12014
12015 : check for non-blocking I/O stuff
12016 case "$h_sysfile" in
12017 true) echo "#include <sys/file.h>" > head.c;;
12018 *)
12019        case "$h_fcntl" in
12020        true) echo "#include <fcntl.h>" > head.c;;
12021        *) echo "#include <sys/fcntl.h>" > head.c;;
12022        esac
12023        ;;
12024 esac
12025 echo " "
12026 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12027 case "$o_nonblock" in
12028 '')
12029         $cat head.c > try.c
12030         $cat >>try.c <<EOCP
12031 #include <stdio.h>
12032 #$i_stdlib I_STDLIB
12033 #ifdef I_STDLIB
12034 #include <stdlib.h>
12035 #endif
12036 #$i_fcntl I_FCNTL
12037 #ifdef I_FCNTL
12038 #include <fcntl.h>
12039 #endif
12040 int main() {
12041 #ifdef O_NONBLOCK
12042         printf("O_NONBLOCK\n");
12043         exit(0);
12044 #endif
12045 #ifdef O_NDELAY
12046         printf("O_NDELAY\n");
12047         exit(0);
12048 #endif
12049 #ifdef FNDELAY
12050         printf("FNDELAY\n");
12051         exit(0);
12052 #endif
12053         exit(0);
12054 }
12055 EOCP
12056         set try
12057         if eval $compile_ok; then
12058                 o_nonblock=`$run ./try`
12059                 case "$o_nonblock" in
12060                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12061                 *) echo "Seems like we can use $o_nonblock.";;
12062                 esac
12063         else
12064                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12065         fi
12066         ;;
12067 *) echo "Using $hint value $o_nonblock.";;
12068 esac
12069 $rm -f try try.* .out core
12070
12071 echo " "
12072 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12073 case "$eagain" in
12074 '')
12075         $cat head.c > try.c
12076         $cat >>try.c <<EOCP
12077 #include <errno.h>
12078 #include <sys/types.h>
12079 #include <signal.h>
12080 #include <stdio.h> 
12081 #$i_stdlib I_STDLIB
12082 #ifdef I_STDLIB
12083 #include <stdlib.h>
12084 #endif
12085 #$i_fcntl I_FCNTL
12086 #ifdef I_FCNTL
12087 #include <fcntl.h>
12088 #endif
12089 #define MY_O_NONBLOCK $o_nonblock
12090 #ifndef errno  /* XXX need better Configure test */
12091 extern int errno;
12092 #endif
12093 #$i_unistd I_UNISTD
12094 #ifdef I_UNISTD
12095 #include <unistd.h>
12096 #endif
12097 #$i_string I_STRING
12098 #ifdef I_STRING
12099 #include <string.h>
12100 #else
12101 #include <strings.h>
12102 #endif
12103 $signal_t blech(int x) { exit(3); }
12104 EOCP
12105         $cat >> try.c <<'EOCP'
12106 int main()
12107 {
12108         int pd[2];
12109         int pu[2];
12110         char buf[1];
12111         char string[100];
12112
12113         pipe(pd);       /* Down: child -> parent */
12114         pipe(pu);       /* Up: parent -> child */
12115         if (0 != fork()) {
12116                 int ret;
12117                 close(pd[1]);   /* Parent reads from pd[0] */
12118                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12119 #ifdef F_SETFL
12120                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12121                         exit(1);
12122 #else
12123                 exit(4);
12124 #endif
12125                 signal(SIGALRM, blech);
12126                 alarm(5);
12127                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12128                         exit(2);
12129                 sprintf(string, "%d\n", ret);
12130                 write(2, string, strlen(string));
12131                 alarm(0);
12132 #ifdef EAGAIN
12133                 if (errno == EAGAIN) {
12134                         printf("EAGAIN\n");
12135                         goto ok;
12136                 }
12137 #endif
12138 #ifdef EWOULDBLOCK
12139                 if (errno == EWOULDBLOCK)
12140                         printf("EWOULDBLOCK\n");
12141 #endif
12142         ok:
12143                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12144                 sleep(2);                               /* Give it time to close our pipe */
12145                 alarm(5);
12146                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12147                 alarm(0);
12148                 sprintf(string, "%d\n", ret);
12149                 write(4, string, strlen(string));
12150                 exit(0);
12151         }
12152
12153         close(pd[0]);                   /* We write to pd[1] */
12154         close(pu[1]);                   /* We read from pu[0] */
12155         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12156         close(pd[1]);                   /* Pipe pd is now fully closed! */
12157         exit(0);                                /* Bye bye, thank you for playing! */
12158 }
12159 EOCP
12160         set try
12161         if eval $compile_ok; then
12162                 echo "$startsh" >mtry
12163                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12164                 chmod +x mtry
12165                 ./mtry >/dev/null 2>&1
12166                 case $? in
12167                 0) eagain=`$cat try.out`;;
12168                 1) echo "Could not perform non-blocking setting!";;
12169                 2) echo "I did a successful read() for something that was not there!";;
12170                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12171                 4) echo "Could not find F_SETFL!";;
12172                 *) echo "Something terribly wrong happened during testing.";;
12173                 esac
12174                 rd_nodata=`$cat try.ret`
12175                 echo "A read() system call with no data present returns $rd_nodata."
12176                 case "$rd_nodata" in
12177                 0|-1) ;;
12178                 *)
12179                         echo "(That's peculiar, fixing that to be -1.)"
12180                         rd_nodata=-1
12181                         ;;
12182                 esac
12183                 case "$eagain" in
12184                 '')
12185                         echo "Forcing errno EAGAIN on read() with no data available."
12186                         eagain=EAGAIN
12187                         ;;
12188                 *)
12189                         echo "Your read() sets errno to $eagain when no data is available."
12190                         ;;
12191                 esac
12192                 status=`$cat try.err`
12193                 case "$status" in
12194                 0) echo "And it correctly returns 0 to signal EOF.";;
12195                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12196                 *) echo "However, your read() returns '$status' on EOF??";;
12197                 esac
12198                 val="$define"
12199                 if test "$status" = "$rd_nodata"; then
12200                         echo "WARNING: you can't distinguish between EOF and no data!"
12201                         val="$undef"
12202                 fi
12203         else
12204                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12205                 eagain=EAGAIN
12206         fi
12207         set d_eofnblk
12208         eval $setvar
12209         ;;
12210 *)
12211         echo "Using $hint value $eagain."
12212         echo "Your read() returns $rd_nodata when no data is present."
12213         case "$d_eofnblk" in
12214         "$define") echo "And you can see EOF because read() returns 0.";;
12215         "$undef") echo "But you can't see EOF status from read() returned value.";;
12216         *)
12217                 echo "(Assuming you can't see EOF status from read anyway.)"
12218                 d_eofnblk=$undef
12219                 ;;
12220         esac
12221         ;;
12222 esac
12223 $rm -f try try.* .out core head.c mtry
12224
12225 : see if _ptr and _cnt from stdio act std
12226 echo " "
12227
12228 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12229         echo "(Looks like you have stdio.h from BSD.)"
12230         case "$stdio_ptr" in
12231         '') stdio_ptr='((fp)->_p)'
12232                 ptr_lval=$define
12233                 ;;
12234         *)      ptr_lval=$d_stdio_ptr_lval;;
12235         esac
12236         case "$stdio_cnt" in
12237         '') stdio_cnt='((fp)->_r)'
12238                 cnt_lval=$define
12239                 ;;
12240         *)      cnt_lval=$d_stdio_cnt_lval;;
12241         esac
12242         case "$stdio_base" in
12243         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12244         esac
12245         case "$stdio_bufsiz" in
12246         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12247         esac
12248 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12249         echo "(Looks like you have stdio.h from Linux.)"
12250         case "$stdio_ptr" in
12251         '') stdio_ptr='((fp)->_IO_read_ptr)'
12252                 ptr_lval=$define
12253                 ;;
12254         *)      ptr_lval=$d_stdio_ptr_lval;;
12255         esac
12256         case "$stdio_cnt" in
12257         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12258                 cnt_lval=$undef
12259                 ;;
12260         *)      cnt_lval=$d_stdio_cnt_lval;;
12261         esac
12262         case "$stdio_base" in
12263         '') stdio_base='((fp)->_IO_read_base)';;
12264         esac
12265         case "$stdio_bufsiz" in
12266         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12267         esac
12268 else
12269         case "$stdio_ptr" in
12270         '') stdio_ptr='((fp)->_ptr)'
12271                 ptr_lval=$define
12272                 ;;
12273         *)      ptr_lval=$d_stdio_ptr_lval;;
12274         esac
12275         case "$stdio_cnt" in
12276         '') stdio_cnt='((fp)->_cnt)'
12277                 cnt_lval=$define
12278                 ;;
12279         *)      cnt_lval=$d_stdio_cnt_lval;;
12280         esac
12281         case "$stdio_base" in
12282         '') stdio_base='((fp)->_base)';;
12283         esac
12284         case "$stdio_bufsiz" in
12285         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12286         esac
12287 fi
12288
12289 : test whether _ptr and _cnt really work
12290 echo "Checking how std your stdio is..." >&4
12291 $cat >try.c <<EOP
12292 #include <stdio.h>
12293 #$i_stdlib I_STDLIB
12294 #ifdef I_STDLIB
12295 #include <stdlib.h>
12296 #endif
12297 #define FILE_ptr(fp)    $stdio_ptr
12298 #define FILE_cnt(fp)    $stdio_cnt
12299 int main() {
12300         FILE *fp = fopen("try.c", "r");
12301         char c = getc(fp);
12302         if (
12303                 18 <= FILE_cnt(fp) &&
12304                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12305         )
12306                 exit(0);
12307         exit(1);
12308 }
12309 EOP
12310 val="$undef"
12311 set try
12312 if eval $compile && $to try.c; then
12313         if $run ./try; then
12314                 echo "Your stdio acts pretty std."
12315                 val="$define"
12316         else
12317                 echo "Your stdio isn't very std."
12318         fi
12319 else
12320         echo "Your stdio doesn't appear very std."
12321 fi
12322 $rm -f try.c try
12323
12324 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12325 # direct buffer manipulation no longer works.  The Configure tests
12326 # should be changed to correctly detect this, but until then,
12327 # the following check should at least let perl compile and run.
12328 # (This quick fix should be updated before 5.8.1.)
12329 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12330 # A. Dougherty, June 3, 2002.
12331 case "$d_gnulibc" in
12332 $define)
12333         case "$gnulibc_version" in
12334         2.[01]*)  ;;
12335         2.2) ;;
12336         2.2.[0-9]) ;;
12337         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12338                 val="$undef"
12339                 ;;
12340         esac
12341         ;;
12342 esac
12343 set d_stdstdio
12344 eval $setvar
12345
12346 : Can _ptr be used as an lvalue?
12347 case "$d_stdstdio$ptr_lval" in
12348 $define$define) val=$define ;;
12349 *) val=$undef ;;
12350 esac
12351 set d_stdio_ptr_lval
12352 eval $setvar
12353
12354 : Can _cnt be used as an lvalue?
12355 case "$d_stdstdio$cnt_lval" in
12356 $define$define) val=$define ;;
12357 *) val=$undef ;;
12358 esac
12359 set d_stdio_cnt_lval
12360 eval $setvar
12361
12362
12363 : test whether setting _ptr sets _cnt as a side effect
12364 d_stdio_ptr_lval_sets_cnt="$undef"
12365 d_stdio_ptr_lval_nochange_cnt="$undef"
12366 case "$d_stdio_ptr_lval$d_stdstdio" in
12367 $define$define)
12368         echo "Checking to see what happens if we set the stdio ptr..." >&4
12369 $cat >try.c <<EOP
12370 #include <stdio.h>
12371 /* Can we scream? */
12372 /* Eat dust sed :-) */
12373 /* In the buffer space, no one can hear you scream. */
12374 #$i_stdlib I_STDLIB
12375 #ifdef I_STDLIB
12376 #include <stdlib.h>
12377 #endif
12378 #define FILE_ptr(fp)    $stdio_ptr
12379 #define FILE_cnt(fp)    $stdio_cnt
12380 #include <sys/types.h>
12381 int main() {
12382         FILE *fp = fopen("try.c", "r");
12383         int c;
12384         char *ptr;
12385         size_t cnt;
12386         if (!fp) {
12387             puts("Fail even to read");
12388             exit(1);
12389         }
12390         c = getc(fp); /* Read away the first # */
12391         if (c == EOF) {
12392             puts("Fail even to read");
12393             exit(1);
12394         }
12395         if (!(
12396                 18 <= FILE_cnt(fp) &&
12397                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12398         )) {
12399                 puts("Fail even to read");
12400                 exit (1);
12401         }
12402         ptr = (char*) FILE_ptr(fp);
12403         cnt = (size_t)FILE_cnt(fp);
12404
12405         FILE_ptr(fp) += 42;
12406
12407         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12408                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12409                 exit (1);
12410         }
12411         if (FILE_cnt(fp) <= 20) {
12412                 printf ("Fail (<20 chars to test)");
12413                 exit (1);
12414         }
12415         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12416                 puts("Fail compare");
12417                 exit (1);
12418         }
12419         if (cnt == FILE_cnt(fp)) {
12420                 puts("Pass_unchanged");
12421                 exit (0);
12422         }       
12423         if (FILE_cnt(fp) == (cnt - 42)) {
12424                 puts("Pass_changed");
12425                 exit (0);
12426         }
12427         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12428         return 1;
12429
12430 }
12431 EOP
12432         set try
12433         if eval $compile && $to try.c; then
12434                 case `$run ./try` in
12435                 Pass_changed)
12436                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12437                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12438                 Pass_unchanged)
12439                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12440                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12441                 Fail*)
12442                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12443                 *)
12444                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12445         esac
12446         else
12447                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12448         fi
12449         $rm -f try.c try
12450         ;;
12451 esac
12452
12453 : see if _base is also standard
12454 val="$undef"
12455 case "$d_stdstdio" in
12456 $define)
12457         $cat >try.c <<EOP
12458 #include <stdio.h>
12459 #$i_stdlib I_STDLIB
12460 #ifdef I_STDLIB
12461 #include <stdlib.h>
12462 #endif
12463 #define FILE_base(fp)   $stdio_base
12464 #define FILE_bufsiz(fp) $stdio_bufsiz
12465 int main() {
12466         FILE *fp = fopen("try.c", "r");
12467         char c = getc(fp);
12468         if (
12469                 19 <= FILE_bufsiz(fp) &&
12470                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12471         )
12472                 exit(0);
12473         exit(1);
12474 }
12475 EOP
12476         set try
12477         if eval $compile && $to try.c; then
12478                 if $run ./try; then
12479                         echo "And its _base field acts std."
12480                         val="$define"
12481                 else
12482                         echo "But its _base field isn't std."
12483                 fi
12484         else
12485                 echo "However, it seems to be lacking the _base field."
12486         fi
12487         $rm -f try.c try
12488         ;;
12489 esac
12490 set d_stdiobase
12491 eval $setvar
12492
12493 : see if fast_stdio exists
12494 val="$undef"
12495 case "$d_stdstdio:$d_stdio_ptr_lval" in
12496 "$define:$define")
12497         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12498         *$define*)
12499                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12500                 val="$define"
12501                 ;;
12502         esac
12503         ;;
12504 esac
12505 set d_faststdio
12506 eval $setvar
12507
12508
12509
12510 : see if fchdir exists
12511 set fchdir d_fchdir
12512 eval $inlibc
12513
12514 : see if fchmod exists
12515 set fchmod d_fchmod
12516 eval $inlibc
12517
12518 : see if fchown exists
12519 set fchown d_fchown
12520 eval $inlibc
12521
12522 : see if this is an fcntl system
12523 set fcntl d_fcntl
12524 eval $inlibc
12525
12526 echo " "
12527 : See if fcntl-based locking works.
12528 $cat >try.c <<EOCP
12529 #$i_stdlib I_STDLIB
12530 #ifdef I_STDLIB
12531 #include <stdlib.h>
12532 #endif
12533 #include <unistd.h>
12534 #include <fcntl.h>
12535 #include <signal.h>
12536 $signal_t blech(int x) { exit(3); }
12537 int main() {
12538 #if defined(F_SETLK) && defined(F_SETLKW)
12539      struct flock flock;
12540      int retval, fd;
12541      fd = open("try.c", O_RDONLY);
12542      flock.l_type = F_RDLCK;
12543      flock.l_whence = SEEK_SET;
12544      flock.l_start = flock.l_len = 0;
12545      signal(SIGALRM, blech);
12546      alarm(10);
12547      retval = fcntl(fd, F_SETLK, &flock);
12548      close(fd);
12549      (retval < 0 ? exit(2) : exit(0));
12550 #else
12551      exit(2);
12552 #endif
12553 }
12554 EOCP
12555 echo "Checking if fcntl-based file locking works... "
12556 case "$d_fcntl" in
12557 "$define")
12558         set try
12559         if eval $compile_ok; then
12560                 if $run ./try; then
12561                         echo "Yes, it seems to work."
12562                         val="$define"
12563                 else
12564                         echo "Nope, it didn't work."
12565                         val="$undef"
12566                         case "$?" in
12567                         3) $cat >&4 <<EOM
12568 ***
12569 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12570 *** This is (almost) impossible.
12571 *** If your NFS lock daemons are not feeling well, something like
12572 *** this may happen, please investigate.  Cannot continue, aborting.
12573 ***
12574 EOM
12575                                 exit 1
12576                                 ;;
12577                         esac
12578                 fi
12579         else
12580                 echo "I'm unable to compile the test program, so I'll assume not."
12581                 val="$undef"
12582         fi
12583         ;;
12584 *) val="$undef";
12585         echo "Nope, since you don't even have fcntl()."
12586         ;;
12587 esac
12588 set d_fcntl_can_lock
12589 eval $setvar
12590 $rm -f try*
12591
12592
12593 : check for fd_set items
12594 $cat <<EOM
12595
12596 Checking to see how well your C compiler handles fd_set and friends ...
12597 EOM
12598 $cat >try.c <<EOCP
12599 #$i_stdlib I_STDLIB
12600 #ifdef I_STDLIB
12601 #include <stdlib.h>
12602 #endif
12603 #$i_systime I_SYS_TIME
12604 #$i_sysselct I_SYS_SELECT
12605 #$d_socket HAS_SOCKET
12606 #include <sys/types.h>
12607 #ifdef HAS_SOCKET
12608 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12609 #endif
12610 #ifdef I_SYS_TIME
12611 #include <sys/time.h>
12612 #endif
12613 #ifdef I_SYS_SELECT
12614 #include <sys/select.h>
12615 #endif
12616 int main() {
12617         fd_set fds;
12618
12619 #ifdef TRYBITS
12620         if(fds.fds_bits);
12621 #endif
12622
12623 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12624         exit(0);
12625 #else
12626         exit(1);
12627 #endif
12628 }
12629 EOCP
12630 set try -DTRYBITS
12631 if eval $compile; then
12632         d_fds_bits="$define"
12633         d_fd_set="$define"
12634         echo "Well, your system knows about the normal fd_set typedef..." >&4
12635         if $run ./try; then
12636                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12637                 d_fd_macros="$define"
12638         else
12639                 $cat >&4 <<'EOM'
12640 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12641 EOM
12642                 d_fd_macros="$undef"
12643         fi
12644 else
12645         $cat <<'EOM'
12646 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12647 EOM
12648         set try
12649         if eval $compile; then
12650                 d_fds_bits="$undef"
12651                 d_fd_set="$define"
12652                 echo "Well, your system has some sort of fd_set available..." >&4
12653                 if $run ./try; then
12654                         echo "and you have the normal fd_set macros." >&4
12655                         d_fd_macros="$define"
12656                 else
12657                         $cat <<'EOM'
12658 but not the normal fd_set macros!  Gross!  More work for me...
12659 EOM
12660                         d_fd_macros="$undef"
12661                 fi
12662         else
12663         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12664                 d_fd_set="$undef"
12665                 d_fds_bits="$undef"
12666                 d_fd_macros="$undef"
12667         fi
12668 fi
12669 $rm -f try try.*
12670
12671 : see if fgetpos exists
12672 set fgetpos d_fgetpos
12673 eval $inlibc
12674
12675 : see if finite exists
12676 set finite d_finite
12677 eval $inlibc
12678
12679 : see if finitel exists
12680 set finitel d_finitel
12681 eval $inlibc
12682
12683 : see if flock exists
12684 set flock d_flock
12685 eval $inlibc
12686
12687 : see if prototype for flock is available
12688 echo " "
12689 set d_flockproto flock $i_sysfile sys/file.h
12690 eval $hasproto
12691
12692 : see if fork exists
12693 set fork d_fork
12694 eval $inlibc
12695
12696 : see if fp_class exists
12697 set fp_class d_fp_class
12698 eval $inlibc
12699
12700 : see if pathconf exists
12701 set pathconf d_pathconf
12702 eval $inlibc
12703
12704 : see if fpathconf exists
12705 set fpathconf d_fpathconf
12706 eval $inlibc
12707
12708 : see if fpclass exists
12709 set fpclass d_fpclass
12710 eval $inlibc
12711
12712 : see if fpclassify exists
12713 set fpclassify d_fpclassify
12714 eval $inlibc
12715
12716 : see if fpclassl exists
12717 set fpclassl d_fpclassl
12718 eval $inlibc
12719
12720
12721 : check for fpos64_t
12722 echo " "
12723 echo "Checking to see if you have fpos64_t..." >&4
12724 $cat >try.c <<EOCP
12725 #include <stdio.h>
12726 int main() { fpos64_t x = 7; }
12727 EOCP
12728 set try
12729 if eval $compile; then
12730         val="$define"
12731         echo "You have fpos64_t."
12732 else
12733         val="$undef"
12734         echo "You do not have fpos64_t."
12735         case "$fpossize" in
12736         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12737         esac
12738 fi
12739 $rm -f try.* try
12740 set d_fpos64_t
12741 eval $setvar
12742
12743 : see if frexpl exists
12744 set frexpl d_frexpl
12745 eval $inlibc
12746
12747 : see if this is a sys/param system
12748 set sys/param.h i_sysparam
12749 eval $inhdr
12750
12751 : see if this is a sys/mount.h system
12752 set sys/mount.h i_sysmount
12753 eval $inhdr
12754
12755
12756 echo " "
12757 echo "Checking to see if your system supports struct fs_data..." >&4
12758 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12759 eval $hasstruct
12760 case "$d_fs_data_s" in
12761 "$define")      echo "Yes, it does."   ;;
12762 *)              echo "No, it doesn't." ;;
12763 esac
12764
12765 : see if fseeko exists
12766 set fseeko d_fseeko
12767 eval $inlibc
12768 case "$longsize" in
12769 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12770 esac
12771
12772 : see if fsetpos exists
12773 set fsetpos d_fsetpos
12774 eval $inlibc
12775
12776
12777 : see if fstatfs exists
12778 set fstatfs d_fstatfs
12779 eval $inlibc
12780
12781
12782 : see if statvfs exists
12783 set statvfs d_statvfs
12784 eval $inlibc
12785
12786 : see if fstatvfs exists
12787 set fstatvfs d_fstatvfs
12788 eval $inlibc
12789
12790
12791 : see if fsync exists
12792 set fsync d_fsync
12793 eval $inlibc
12794
12795 : see if ftello exists
12796 set ftello d_ftello
12797 eval $inlibc
12798 case "$longsize" in
12799 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12800 esac
12801
12802 d_futimes="$undef"
12803 : check for a working futimes
12804 echo " "
12805 echo "Checking for a working futimes()" >&4
12806 $cat >try.c <<EOCP
12807 #include <stdio.h>
12808 #include <sys/time.h>
12809 #include <errno.h>
12810 #include <fcntl.h>
12811
12812 int main ()
12813 {
12814     int fd, rv;
12815     fd = open ("try.c", O_RDWR);
12816     if (-1 == fd) exit (1);
12817     rv = futimes (fd, NULL);
12818     exit (rv == -1 ? errno : 0);
12819 }
12820 EOCP
12821 set try
12822 if eval $compile; then
12823     `$run ./try`
12824     rc=$?
12825     case "$rc" in
12826         0)  echo "Yes, it does" >&4
12827             d_futimes="$define"
12828             ;;
12829         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12830             ;;
12831     esac
12832 else
12833     echo "No, it does not (probably harmless)\n" >&4
12834 fi
12835 $rm -f try.* try core core.try.*
12836
12837 : see if getcwd exists
12838 set getcwd d_getcwd
12839 eval $inlibc
12840
12841 : see if getespwnam exists
12842 set getespwnam d_getespwnam
12843 eval $inlibc
12844
12845
12846 : see if getfsstat exists
12847 set getfsstat d_getfsstat
12848 eval $inlibc
12849
12850 : see if getgrent exists
12851 set getgrent d_getgrent
12852 eval $inlibc
12853
12854 : see if getgrent_r exists
12855 set getgrent_r d_getgrent_r
12856 eval $inlibc
12857 case "$d_getgrent_r" in
12858 "$define")
12859         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12860         case "$d_getgrent_r_proto:$usethreads" in
12861         ":define")      d_getgrent_r_proto=define
12862                 set d_getgrent_r_proto getgrent_r $hdrs
12863                 eval $hasproto ;;
12864         *)      ;;
12865         esac
12866         case "$d_getgrent_r_proto" in
12867         define)
12868         case "$getgrent_r_proto" in
12869         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12870         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12871         esac
12872         case "$getgrent_r_proto" in
12873         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12874         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12875         esac
12876         case "$getgrent_r_proto" in
12877         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12878         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12879         esac
12880         case "$getgrent_r_proto" in
12881         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12882         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12883         esac
12884         case "$getgrent_r_proto" in
12885         ''|0) try='int getgrent_r(struct group*, char*, int);'
12886         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12887         esac
12888         case "$getgrent_r_proto" in
12889         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12890         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12891         esac
12892         case "$getgrent_r_proto" in
12893         ''|0)   d_getgrent_r=undef
12894                 getgrent_r_proto=0
12895                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12896         * )     case "$getgrent_r_proto" in
12897                 REENTRANT_PROTO*) ;;
12898                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12899                 esac
12900                 echo "Prototype: $try" ;;
12901         esac
12902         ;;
12903         *)      case "$usethreads" in
12904                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12905                 esac
12906                 d_getgrent_r=undef
12907                 getgrent_r_proto=0
12908                 ;;
12909         esac
12910         ;;
12911 *)      getgrent_r_proto=0
12912         ;;
12913 esac
12914
12915 : see if getgrgid_r exists
12916 set getgrgid_r d_getgrgid_r
12917 eval $inlibc
12918 case "$d_getgrgid_r" in
12919 "$define")
12920         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12921         case "$d_getgrgid_r_proto:$usethreads" in
12922         ":define")      d_getgrgid_r_proto=define
12923                 set d_getgrgid_r_proto getgrgid_r $hdrs
12924                 eval $hasproto ;;
12925         *)      ;;
12926         esac
12927         case "$d_getgrgid_r_proto" in
12928         define)
12929         case "$getgrgid_r_proto" in
12930         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12931         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12932         esac
12933         case "$getgrgid_r_proto" in
12934         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12935         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12936         esac
12937         case "$getgrgid_r_proto" in
12938         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12939         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12940         esac
12941         case "$getgrgid_r_proto" in
12942         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12943         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12944         esac
12945         case "$getgrgid_r_proto" in
12946         ''|0)   d_getgrgid_r=undef
12947                 getgrgid_r_proto=0
12948                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12949         * )     case "$getgrgid_r_proto" in
12950                 REENTRANT_PROTO*) ;;
12951                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12952                 esac
12953                 echo "Prototype: $try" ;;
12954         esac
12955         ;;
12956         *)      case "$usethreads" in
12957                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12958                 esac
12959                 d_getgrgid_r=undef
12960                 getgrgid_r_proto=0
12961                 ;;
12962         esac
12963         ;;
12964 *)      getgrgid_r_proto=0
12965         ;;
12966 esac
12967
12968 : see if getgrnam_r exists
12969 set getgrnam_r d_getgrnam_r
12970 eval $inlibc
12971 case "$d_getgrnam_r" in
12972 "$define")
12973         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12974         case "$d_getgrnam_r_proto:$usethreads" in
12975         ":define")      d_getgrnam_r_proto=define
12976                 set d_getgrnam_r_proto getgrnam_r $hdrs
12977                 eval $hasproto ;;
12978         *)      ;;
12979         esac
12980         case "$d_getgrnam_r_proto" in
12981         define)
12982         case "$getgrnam_r_proto" in
12983         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12984         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12985         esac
12986         case "$getgrnam_r_proto" in
12987         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12988         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12989         esac
12990         case "$getgrnam_r_proto" in
12991         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12992         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12993         esac
12994         case "$getgrnam_r_proto" in
12995         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12996         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12997         esac
12998         case "$getgrnam_r_proto" in
12999         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13000         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13001         esac
13002         case "$getgrnam_r_proto" in
13003         ''|0)   d_getgrnam_r=undef
13004                 getgrnam_r_proto=0
13005                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13006         * )     case "$getgrnam_r_proto" in
13007                 REENTRANT_PROTO*) ;;
13008                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13009                 esac
13010                 echo "Prototype: $try" ;;
13011         esac
13012         ;;
13013         *)      case "$usethreads" in
13014                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13015                 esac
13016                 d_getgrnam_r=undef
13017                 getgrnam_r_proto=0
13018                 ;;
13019         esac
13020         ;;
13021 *)      getgrnam_r_proto=0
13022         ;;
13023 esac
13024
13025 : see if gethostbyaddr exists
13026 set gethostbyaddr d_gethbyaddr
13027 eval $inlibc
13028
13029 : see if gethostbyname exists
13030 set gethostbyname d_gethbyname
13031 eval $inlibc
13032
13033 : see if gethostent exists
13034 set gethostent d_gethent
13035 eval $inlibc
13036
13037 : see how we will look up host name
13038 echo " "
13039 call=''
13040 if set gethostname val -f d_gethname; eval $csym; $val; then
13041         echo 'gethostname() found.' >&4
13042         d_gethname="$define"
13043         call=gethostname
13044 fi
13045 if set uname val -f d_uname; eval $csym; $val; then
13046         if ./xenix; then
13047                 $cat <<'EOM'
13048 uname() was found, but you're running xenix, and older versions of xenix
13049 have a broken uname(). If you don't really know whether your xenix is old
13050 enough to have a broken system call, use the default answer.
13051
13052 EOM
13053                 dflt=y
13054                 case "$d_uname" in
13055                 "$define") dflt=n;;
13056                 esac
13057                 rp='Is your uname() broken?'
13058                 . ./myread
13059                 case "$ans" in
13060                 n*) d_uname="$define"; call=uname;;
13061                 esac
13062         else
13063                 echo 'uname() found.' >&4
13064                 d_uname="$define"
13065                 case "$call" in
13066                 '') call=uname ;;
13067                 esac
13068         fi
13069 fi
13070 case "$d_gethname" in
13071 '') d_gethname="$undef";;
13072 esac
13073 case "$d_uname" in
13074 '') d_uname="$undef";;
13075 esac
13076 case "$d_uname$d_gethname" in
13077 *define*)
13078         dflt=n
13079         cat <<EOM
13080  
13081 Every now and then someone has a $call() that lies about the hostname
13082 but can't be fixed for political or economic reasons.  If you wish, I can
13083 pretend $call() isn't there and maybe compute hostname at run-time
13084 thanks to the '$phostname' command.
13085
13086 EOM
13087         rp="Shall I ignore $call() from now on?"
13088         . ./myread
13089         case "$ans" in
13090         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13091         esac;;
13092 esac
13093 case "$phostname" in
13094 '') aphostname='';;
13095 *) case "$aphostname" in
13096         /*) ;;
13097         *) set X $phostname
13098                 shift
13099                 file=$1
13100                 shift
13101                 file=`./loc $file $file $pth`
13102                 aphostname=`echo $file $*`
13103                 ;;
13104         esac
13105         ;;
13106 esac
13107 case "$d_uname$d_gethname" in
13108 *define*) ;;
13109 *)
13110         case "$phostname" in
13111         '')
13112                 echo "There will be no way for $package to get your hostname." >&4;;
13113         *)
13114         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13115                 ;;
13116         esac;;
13117 esac
13118 case "$d_phostname" in
13119 '') d_phostname="$undef";;
13120 esac
13121
13122 : see if gethostbyaddr_r exists
13123 set gethostbyaddr_r d_gethostbyaddr_r
13124 eval $inlibc
13125 case "$d_gethostbyaddr_r" in
13126 "$define")
13127         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13128         case "$d_gethostbyaddr_r_proto:$usethreads" in
13129         ":define")      d_gethostbyaddr_r_proto=define
13130                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13131                 eval $hasproto ;;
13132         *)      ;;
13133         esac
13134         case "$d_gethostbyaddr_r_proto" in
13135         define)
13136         case "$gethostbyaddr_r_proto" in
13137         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13138         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13139         esac
13140         case "$gethostbyaddr_r_proto" in
13141         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13142         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13143         esac
13144         case "$gethostbyaddr_r_proto" in
13145         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13146         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13147         esac
13148         case "$gethostbyaddr_r_proto" in
13149         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13150         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13151         esac
13152         case "$gethostbyaddr_r_proto" in
13153         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13154         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13155         esac
13156         case "$gethostbyaddr_r_proto" in
13157         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13158         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13159         esac
13160         case "$gethostbyaddr_r_proto" in
13161         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13162         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13163         esac
13164         case "$gethostbyaddr_r_proto" in
13165         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13166         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13167         esac
13168         case "$gethostbyaddr_r_proto" in
13169         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13170         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13171         esac
13172         case "$gethostbyaddr_r_proto" in
13173         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13174         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13175         esac
13176         case "$gethostbyaddr_r_proto" in
13177         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13178         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13179         esac
13180         case "$gethostbyaddr_r_proto" in
13181         ''|0)   d_gethostbyaddr_r=undef
13182                 gethostbyaddr_r_proto=0
13183                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13184         * )     case "$gethostbyaddr_r_proto" in
13185                 REENTRANT_PROTO*) ;;
13186                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13187                 esac
13188                 echo "Prototype: $try" ;;
13189         esac
13190         ;;
13191         *)      case "$usethreads" in
13192                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13193                 esac
13194                 d_gethostbyaddr_r=undef
13195                 gethostbyaddr_r_proto=0
13196                 ;;
13197         esac
13198         ;;
13199 *)      gethostbyaddr_r_proto=0
13200         ;;
13201 esac
13202
13203 : see if gethostbyname_r exists
13204 set gethostbyname_r d_gethostbyname_r
13205 eval $inlibc
13206 case "$d_gethostbyname_r" in
13207 "$define")
13208         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13209         case "$d_gethostbyname_r_proto:$usethreads" in
13210         ":define")      d_gethostbyname_r_proto=define
13211                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13212                 eval $hasproto ;;
13213         *)      ;;
13214         esac
13215         case "$d_gethostbyname_r_proto" in
13216         define)
13217         case "$gethostbyname_r_proto" in
13218         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13219         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13220         esac
13221         case "$gethostbyname_r_proto" in
13222         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13223         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13224         esac
13225         case "$gethostbyname_r_proto" in
13226         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13227         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13228         esac
13229         case "$gethostbyname_r_proto" in
13230         ''|0)   d_gethostbyname_r=undef
13231                 gethostbyname_r_proto=0
13232                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13233         * )     case "$gethostbyname_r_proto" in
13234                 REENTRANT_PROTO*) ;;
13235                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13236                 esac
13237                 echo "Prototype: $try" ;;
13238         esac
13239         ;;
13240         *)      case "$usethreads" in
13241                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13242                 esac
13243                 d_gethostbyname_r=undef
13244                 gethostbyname_r_proto=0
13245                 ;;
13246         esac
13247         ;;
13248 *)      gethostbyname_r_proto=0
13249         ;;
13250 esac
13251
13252 : see if gethostent_r exists
13253 set gethostent_r d_gethostent_r
13254 eval $inlibc
13255 case "$d_gethostent_r" in
13256 "$define")
13257         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13258         case "$d_gethostent_r_proto:$usethreads" in
13259         ":define")      d_gethostent_r_proto=define
13260                 set d_gethostent_r_proto gethostent_r $hdrs
13261                 eval $hasproto ;;
13262         *)      ;;
13263         esac
13264         case "$d_gethostent_r_proto" in
13265         define)
13266         case "$gethostent_r_proto" in
13267         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13268         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13269         esac
13270         case "$gethostent_r_proto" in
13271         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13272         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13273         esac
13274         case "$gethostent_r_proto" in
13275         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13276         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13277         esac
13278         case "$gethostent_r_proto" in
13279         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13280         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13281         esac
13282         case "$gethostent_r_proto" in
13283         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13284         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13285         esac
13286         case "$gethostent_r_proto" in
13287         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13288         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13289         esac
13290         case "$gethostent_r_proto" in
13291         ''|0)   d_gethostent_r=undef
13292                 gethostent_r_proto=0
13293                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13294         * )     case "$gethostent_r_proto" in
13295                 REENTRANT_PROTO*) ;;
13296                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13297                 esac
13298                 echo "Prototype: $try" ;;
13299         esac
13300         ;;
13301         *)      case "$usethreads" in
13302                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13303                 esac
13304                 d_gethostent_r=undef
13305                 gethostent_r_proto=0
13306                 ;;
13307         esac
13308         ;;
13309 *)      gethostent_r_proto=0
13310         ;;
13311 esac
13312
13313 : see if prototypes for various gethostxxx netdb.h functions are available
13314 echo " "
13315 set d_gethostprotos gethostent $i_netdb netdb.h
13316 eval $hasproto
13317
13318 : see if getitimer exists
13319 set getitimer d_getitimer
13320 eval $inlibc
13321
13322 : see if getlogin exists
13323 set getlogin d_getlogin
13324 eval $inlibc
13325
13326 : see if getlogin_r exists
13327 set getlogin_r d_getlogin_r
13328 eval $inlibc
13329 case "$d_getlogin_r" in
13330 "$define")
13331         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13332         case "$d_getlogin_r_proto:$usethreads" in
13333         ":define")      d_getlogin_r_proto=define
13334                 set d_getlogin_r_proto getlogin_r $hdrs
13335                 eval $hasproto ;;
13336         *)      ;;
13337         esac
13338         case "$d_getlogin_r_proto" in
13339         define)
13340         case "$getlogin_r_proto" in
13341         ''|0) try='int getlogin_r(char*, size_t);'
13342         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13343         esac
13344         case "$getlogin_r_proto" in
13345         ''|0) try='int getlogin_r(char*, int);'
13346         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13347         esac
13348         case "$getlogin_r_proto" in
13349         ''|0) try='char* getlogin_r(char*, size_t);'
13350         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13351         esac
13352         case "$getlogin_r_proto" in
13353         ''|0) try='char* getlogin_r(char*, int);'
13354         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13355         esac
13356         case "$getlogin_r_proto" in
13357         ''|0)   d_getlogin_r=undef
13358                 getlogin_r_proto=0
13359                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13360         * )     case "$getlogin_r_proto" in
13361                 REENTRANT_PROTO*) ;;
13362                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13363                 esac
13364                 echo "Prototype: $try" ;;
13365         esac
13366         ;;
13367         *)      case "$usethreads" in
13368                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13369                 esac
13370                 d_getlogin_r=undef
13371                 getlogin_r_proto=0
13372                 ;;
13373         esac
13374         ;;
13375 *)      getlogin_r_proto=0
13376         ;;
13377 esac
13378
13379 : see if getmnt exists
13380 set getmnt d_getmnt
13381 eval $inlibc
13382
13383 : see if getmntent exists
13384 set getmntent d_getmntent
13385 eval $inlibc
13386
13387 : see if getnetbyaddr exists
13388 set getnetbyaddr d_getnbyaddr
13389 eval $inlibc
13390
13391 : see if getnetbyname exists
13392 set getnetbyname d_getnbyname
13393 eval $inlibc
13394
13395 : see if getnetent exists
13396 set getnetent d_getnent
13397 eval $inlibc
13398
13399 : see if getnetbyaddr_r exists
13400 set getnetbyaddr_r d_getnetbyaddr_r
13401 eval $inlibc
13402 case "$d_getnetbyaddr_r" in
13403 "$define")
13404         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13405         case "$d_getnetbyaddr_r_proto:$usethreads" in
13406         ":define")      d_getnetbyaddr_r_proto=define
13407                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13408                 eval $hasproto ;;
13409         *)      ;;
13410         esac
13411         case "$d_getnetbyaddr_r_proto" in
13412         define)
13413         case "$getnetbyaddr_r_proto" in
13414         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13415         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13416         esac
13417         case "$getnetbyaddr_r_proto" in
13418         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13419         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13420         esac
13421         case "$getnetbyaddr_r_proto" in
13422         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13423         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13424         esac
13425         case "$getnetbyaddr_r_proto" in
13426         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13427         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13428         esac
13429         case "$getnetbyaddr_r_proto" in
13430         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13431         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13432         esac
13433         case "$getnetbyaddr_r_proto" in
13434         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13435         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13436         esac
13437         case "$getnetbyaddr_r_proto" in
13438         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13439         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13440         esac
13441         case "$getnetbyaddr_r_proto" in
13442         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13443         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13444         esac
13445         case "$getnetbyaddr_r_proto" in
13446         ''|0)   d_getnetbyaddr_r=undef
13447                 getnetbyaddr_r_proto=0
13448                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13449         * )     case "$getnetbyaddr_r_proto" in
13450                 REENTRANT_PROTO*) ;;
13451                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13452                 esac
13453                 echo "Prototype: $try" ;;
13454         esac
13455         ;;
13456         *)      case "$usethreads" in
13457                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13458                 esac
13459                 d_getnetbyaddr_r=undef
13460                 getnetbyaddr_r_proto=0
13461                 ;;
13462         esac
13463         ;;
13464 *)      getnetbyaddr_r_proto=0
13465         ;;
13466 esac
13467
13468 : see if getnetbyname_r exists
13469 set getnetbyname_r d_getnetbyname_r
13470 eval $inlibc
13471 case "$d_getnetbyname_r" in
13472 "$define")
13473         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13474         case "$d_getnetbyname_r_proto:$usethreads" in
13475         ":define")      d_getnetbyname_r_proto=define
13476                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13477                 eval $hasproto ;;
13478         *)      ;;
13479         esac
13480         case "$d_getnetbyname_r_proto" in
13481         define)
13482         case "$getnetbyname_r_proto" in
13483         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13484         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13485         esac
13486         case "$getnetbyname_r_proto" in
13487         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13488         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13489         esac
13490         case "$getnetbyname_r_proto" in
13491         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13492         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13493         esac
13494         case "$getnetbyname_r_proto" in
13495         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13496         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13497         esac
13498         case "$getnetbyname_r_proto" in
13499         ''|0)   d_getnetbyname_r=undef
13500                 getnetbyname_r_proto=0
13501                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13502         * )     case "$getnetbyname_r_proto" in
13503                 REENTRANT_PROTO*) ;;
13504                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13505                 esac
13506                 echo "Prototype: $try" ;;
13507         esac
13508         ;;
13509         *)      case "$usethreads" in
13510                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13511                 esac
13512                 d_getnetbyname_r=undef
13513                 getnetbyname_r_proto=0
13514                 ;;
13515         esac
13516         ;;
13517 *)      getnetbyname_r_proto=0
13518         ;;
13519 esac
13520
13521 : see if getnetent_r exists
13522 set getnetent_r d_getnetent_r
13523 eval $inlibc
13524 case "$d_getnetent_r" in
13525 "$define")
13526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13527         case "$d_getnetent_r_proto:$usethreads" in
13528         ":define")      d_getnetent_r_proto=define
13529                 set d_getnetent_r_proto getnetent_r $hdrs
13530                 eval $hasproto ;;
13531         *)      ;;
13532         esac
13533         case "$d_getnetent_r_proto" in
13534         define)
13535         case "$getnetent_r_proto" in
13536         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13537         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13538         esac
13539         case "$getnetent_r_proto" in
13540         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13541         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13542         esac
13543         case "$getnetent_r_proto" in
13544         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13545         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13546         esac
13547         case "$getnetent_r_proto" in
13548         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13549         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13550         esac
13551         case "$getnetent_r_proto" in
13552         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13553         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13554         esac
13555         case "$getnetent_r_proto" in
13556         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13557         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13558         esac
13559         case "$getnetent_r_proto" in
13560         ''|0)   d_getnetent_r=undef
13561                 getnetent_r_proto=0
13562                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13563         * )     case "$getnetent_r_proto" in
13564                 REENTRANT_PROTO*) ;;
13565                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13566                 esac
13567                 echo "Prototype: $try" ;;
13568         esac
13569         ;;
13570         *)      case "$usethreads" in
13571                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13572                 esac
13573                 d_getnetent_r=undef
13574                 getnetent_r_proto=0
13575                 ;;
13576         esac
13577         ;;
13578 *)      getnetent_r_proto=0
13579         ;;
13580 esac
13581
13582 : see if prototypes for various getnetxxx netdb.h functions are available
13583 echo " "
13584 set d_getnetprotos getnetent $i_netdb netdb.h
13585 eval $hasproto
13586
13587 : see if getpagesize exists
13588 set getpagesize d_getpagsz
13589 eval $inlibc
13590
13591
13592 : see if getprotobyname exists
13593 set getprotobyname d_getpbyname
13594 eval $inlibc
13595
13596 : see if getprotobynumber exists
13597 set getprotobynumber d_getpbynumber
13598 eval $inlibc
13599
13600 : see if getprotoent exists
13601 set getprotoent d_getpent
13602 eval $inlibc
13603
13604 : see if getpgid exists
13605 set getpgid d_getpgid
13606 eval $inlibc
13607
13608 : see if getpgrp2 exists
13609 set getpgrp2 d_getpgrp2
13610 eval $inlibc
13611
13612 : see if getppid exists
13613 set getppid d_getppid
13614 eval $inlibc
13615
13616 : see if getpriority exists
13617 set getpriority d_getprior
13618 eval $inlibc
13619
13620 : see if getprotobyname_r exists
13621 set getprotobyname_r d_getprotobyname_r
13622 eval $inlibc
13623 case "$d_getprotobyname_r" in
13624 "$define")
13625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13626         case "$d_getprotobyname_r_proto:$usethreads" in
13627         ":define")      d_getprotobyname_r_proto=define
13628                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13629                 eval $hasproto ;;
13630         *)      ;;
13631         esac
13632         case "$d_getprotobyname_r_proto" in
13633         define)
13634         case "$getprotobyname_r_proto" in
13635         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13636         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13637         esac
13638         case "$getprotobyname_r_proto" in
13639         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13640         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13641         esac
13642         case "$getprotobyname_r_proto" in
13643         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13644         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13645         esac
13646         case "$getprotobyname_r_proto" in
13647         ''|0)   d_getprotobyname_r=undef
13648                 getprotobyname_r_proto=0
13649                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13650         * )     case "$getprotobyname_r_proto" in
13651                 REENTRANT_PROTO*) ;;
13652                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13653                 esac
13654                 echo "Prototype: $try" ;;
13655         esac
13656         ;;
13657         *)      case "$usethreads" in
13658                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13659                 esac
13660                 d_getprotobyname_r=undef
13661                 getprotobyname_r_proto=0
13662                 ;;
13663         esac
13664         ;;
13665 *)      getprotobyname_r_proto=0
13666         ;;
13667 esac
13668
13669 : see if getprotobynumber_r exists
13670 set getprotobynumber_r d_getprotobynumber_r
13671 eval $inlibc
13672 case "$d_getprotobynumber_r" in
13673 "$define")
13674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13675         case "$d_getprotobynumber_r_proto:$usethreads" in
13676         ":define")      d_getprotobynumber_r_proto=define
13677                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13678                 eval $hasproto ;;
13679         *)      ;;
13680         esac
13681         case "$d_getprotobynumber_r_proto" in
13682         define)
13683         case "$getprotobynumber_r_proto" in
13684         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13685         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13686         esac
13687         case "$getprotobynumber_r_proto" in
13688         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13689         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13690         esac
13691         case "$getprotobynumber_r_proto" in
13692         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13693         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13694         esac
13695         case "$getprotobynumber_r_proto" in
13696         ''|0)   d_getprotobynumber_r=undef
13697                 getprotobynumber_r_proto=0
13698                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13699         * )     case "$getprotobynumber_r_proto" in
13700                 REENTRANT_PROTO*) ;;
13701                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13702                 esac
13703                 echo "Prototype: $try" ;;
13704         esac
13705         ;;
13706         *)      case "$usethreads" in
13707                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13708                 esac
13709                 d_getprotobynumber_r=undef
13710                 getprotobynumber_r_proto=0
13711                 ;;
13712         esac
13713         ;;
13714 *)      getprotobynumber_r_proto=0
13715         ;;
13716 esac
13717
13718 : see if getprotoent_r exists
13719 set getprotoent_r d_getprotoent_r
13720 eval $inlibc
13721 case "$d_getprotoent_r" in
13722 "$define")
13723         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13724         case "$d_getprotoent_r_proto:$usethreads" in
13725         ":define")      d_getprotoent_r_proto=define
13726                 set d_getprotoent_r_proto getprotoent_r $hdrs
13727                 eval $hasproto ;;
13728         *)      ;;
13729         esac
13730         case "$d_getprotoent_r_proto" in
13731         define)
13732         case "$getprotoent_r_proto" in
13733         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13734         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13735         esac
13736         case "$getprotoent_r_proto" in
13737         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13738         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13739         esac
13740         case "$getprotoent_r_proto" in
13741         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13742         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13743         esac
13744         case "$getprotoent_r_proto" in
13745         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13746         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13747         esac
13748         case "$getprotoent_r_proto" in
13749         ''|0)   d_getprotoent_r=undef
13750                 getprotoent_r_proto=0
13751                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13752         * )     case "$getprotoent_r_proto" in
13753                 REENTRANT_PROTO*) ;;
13754                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13755                 esac
13756                 echo "Prototype: $try" ;;
13757         esac
13758         ;;
13759         *)      case "$usethreads" in
13760                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13761                 esac
13762                 d_getprotoent_r=undef
13763                 getprotoent_r_proto=0
13764                 ;;
13765         esac
13766         ;;
13767 *)      getprotoent_r_proto=0
13768         ;;
13769 esac
13770
13771 : see if prototypes for various getprotoxxx netdb.h functions are available
13772 echo " "
13773 set d_getprotoprotos getprotoent $i_netdb netdb.h
13774 eval $hasproto
13775
13776 : see if getprpwnam exists
13777 set getprpwnam d_getprpwnam
13778 eval $inlibc
13779
13780 : see if getpwent exists
13781 set getpwent d_getpwent
13782 eval $inlibc
13783
13784 : see if getpwent_r exists
13785 set getpwent_r d_getpwent_r
13786 eval $inlibc
13787 case "$d_getpwent_r" in
13788 "$define")
13789         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13790         case "$d_getpwent_r_proto:$usethreads" in
13791         ":define")      d_getpwent_r_proto=define
13792                 set d_getpwent_r_proto getpwent_r $hdrs
13793                 eval $hasproto ;;
13794         *)      ;;
13795         esac
13796         case "$d_getpwent_r_proto" in
13797         define)
13798         case "$getpwent_r_proto" in
13799         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13800         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13801         esac
13802         case "$getpwent_r_proto" in
13803         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13804         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13805         esac
13806         case "$getpwent_r_proto" in
13807         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13808         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13809         esac
13810         case "$getpwent_r_proto" in
13811         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13812         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13813         esac
13814         case "$getpwent_r_proto" in
13815         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13816         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13817         esac
13818         case "$getpwent_r_proto" in
13819         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13820         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13821         esac
13822         case "$getpwent_r_proto" in
13823         ''|0)   d_getpwent_r=undef
13824                 getpwent_r_proto=0
13825                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13826         * )     case "$getpwent_r_proto" in
13827                 REENTRANT_PROTO*) ;;
13828                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13829                 esac
13830                 echo "Prototype: $try" ;;
13831         esac
13832         ;;
13833         *)      case "$usethreads" in
13834                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13835                 esac
13836                 d_getpwent_r=undef
13837                 getpwent_r_proto=0
13838                 ;;
13839         esac
13840         ;;
13841 *)      getpwent_r_proto=0
13842         ;;
13843 esac
13844
13845 : see if getpwnam_r exists
13846 set getpwnam_r d_getpwnam_r
13847 eval $inlibc
13848 case "$d_getpwnam_r" in
13849 "$define")
13850         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13851         case "$d_getpwnam_r_proto:$usethreads" in
13852         ":define")      d_getpwnam_r_proto=define
13853                 set d_getpwnam_r_proto getpwnam_r $hdrs
13854                 eval $hasproto ;;
13855         *)      ;;
13856         esac
13857         case "$d_getpwnam_r_proto" in
13858         define)
13859         case "$getpwnam_r_proto" in
13860         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13861         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13862         esac
13863         case "$getpwnam_r_proto" in
13864         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13865         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13866         esac
13867         case "$getpwnam_r_proto" in
13868         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13869         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13870         esac
13871         case "$getpwnam_r_proto" in
13872         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13873         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13874         esac
13875         case "$getpwnam_r_proto" in
13876         ''|0)   d_getpwnam_r=undef
13877                 getpwnam_r_proto=0
13878                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13879         * )     case "$getpwnam_r_proto" in
13880                 REENTRANT_PROTO*) ;;
13881                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13882                 esac
13883                 echo "Prototype: $try" ;;
13884         esac
13885         ;;
13886         *)      case "$usethreads" in
13887                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13888                 esac
13889                 d_getpwnam_r=undef
13890                 getpwnam_r_proto=0
13891                 ;;
13892         esac
13893         ;;
13894 *)      getpwnam_r_proto=0
13895         ;;
13896 esac
13897
13898 : see if getpwuid_r exists
13899 set getpwuid_r d_getpwuid_r
13900 eval $inlibc
13901 case "$d_getpwuid_r" in
13902 "$define")
13903         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13904         case "$d_getpwuid_r_proto:$usethreads" in
13905         ":define")      d_getpwuid_r_proto=define
13906                 set d_getpwuid_r_proto getpwuid_r $hdrs
13907                 eval $hasproto ;;
13908         *)      ;;
13909         esac
13910         case "$d_getpwuid_r_proto" in
13911         define)
13912         case "$getpwuid_r_proto" in
13913         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13914         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13915         esac
13916         case "$getpwuid_r_proto" in
13917         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13918         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13919         esac
13920         case "$getpwuid_r_proto" in
13921         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13922         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13923         esac
13924         case "$getpwuid_r_proto" in
13925         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13926         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13927         esac
13928         case "$getpwuid_r_proto" in
13929         ''|0)   d_getpwuid_r=undef
13930                 getpwuid_r_proto=0
13931                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13932         * )     case "$getpwuid_r_proto" in
13933                 REENTRANT_PROTO*) ;;
13934                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13935                 esac
13936                 echo "Prototype: $try" ;;
13937         esac
13938         ;;
13939         *)      case "$usethreads" in
13940                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13941                 esac
13942                 d_getpwuid_r=undef
13943                 getpwuid_r_proto=0
13944                 ;;
13945         esac
13946         ;;
13947 *)      getpwuid_r_proto=0
13948         ;;
13949 esac
13950
13951
13952 : see if getservbyname exists
13953 set getservbyname d_getsbyname
13954 eval $inlibc
13955
13956 : see if getservbyport exists
13957 set getservbyport d_getsbyport
13958 eval $inlibc
13959
13960 : see if getservent exists
13961 set getservent d_getsent
13962 eval $inlibc
13963
13964 : see if getservbyname_r exists
13965 set getservbyname_r d_getservbyname_r
13966 eval $inlibc
13967 case "$d_getservbyname_r" in
13968 "$define")
13969         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13970         case "$d_getservbyname_r_proto:$usethreads" in
13971         ":define")      d_getservbyname_r_proto=define
13972                 set d_getservbyname_r_proto getservbyname_r $hdrs
13973                 eval $hasproto ;;
13974         *)      ;;
13975         esac
13976         case "$d_getservbyname_r_proto" in
13977         define)
13978         case "$getservbyname_r_proto" in
13979         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13980         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13981         esac
13982         case "$getservbyname_r_proto" in
13983         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13984         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13985         esac
13986         case "$getservbyname_r_proto" in
13987         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13988         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13989         esac
13990         case "$getservbyname_r_proto" in
13991         ''|0)   d_getservbyname_r=undef
13992                 getservbyname_r_proto=0
13993                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13994         * )     case "$getservbyname_r_proto" in
13995                 REENTRANT_PROTO*) ;;
13996                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13997                 esac
13998                 echo "Prototype: $try" ;;
13999         esac
14000         ;;
14001         *)      case "$usethreads" in
14002                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14003                 esac
14004                 d_getservbyname_r=undef
14005                 getservbyname_r_proto=0
14006                 ;;
14007         esac
14008         ;;
14009 *)      getservbyname_r_proto=0
14010         ;;
14011 esac
14012
14013 : see if getservbyport_r exists
14014 set getservbyport_r d_getservbyport_r
14015 eval $inlibc
14016 case "$d_getservbyport_r" in
14017 "$define")
14018         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14019         case "$d_getservbyport_r_proto:$usethreads" in
14020         ":define")      d_getservbyport_r_proto=define
14021                 set d_getservbyport_r_proto getservbyport_r $hdrs
14022                 eval $hasproto ;;
14023         *)      ;;
14024         esac
14025         case "$d_getservbyport_r_proto" in
14026         define)
14027         case "$getservbyport_r_proto" in
14028         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14029         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14030         esac
14031         case "$getservbyport_r_proto" in
14032         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14033         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14034         esac
14035         case "$getservbyport_r_proto" in
14036         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14037         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14038         esac
14039         case "$getservbyport_r_proto" in
14040         ''|0)   d_getservbyport_r=undef
14041                 getservbyport_r_proto=0
14042                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14043         * )     case "$getservbyport_r_proto" in
14044                 REENTRANT_PROTO*) ;;
14045                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14046                 esac
14047                 echo "Prototype: $try" ;;
14048         esac
14049         ;;
14050         *)      case "$usethreads" in
14051                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14052                 esac
14053                 d_getservbyport_r=undef
14054                 getservbyport_r_proto=0
14055                 ;;
14056         esac
14057         ;;
14058 *)      getservbyport_r_proto=0
14059         ;;
14060 esac
14061
14062 : see if getservent_r exists
14063 set getservent_r d_getservent_r
14064 eval $inlibc
14065 case "$d_getservent_r" in
14066 "$define")
14067         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14068         case "$d_getservent_r_proto:$usethreads" in
14069         ":define")      d_getservent_r_proto=define
14070                 set d_getservent_r_proto getservent_r $hdrs
14071                 eval $hasproto ;;
14072         *)      ;;
14073         esac
14074         case "$d_getservent_r_proto" in
14075         define)
14076         case "$getservent_r_proto" in
14077         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14078         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14079         esac
14080         case "$getservent_r_proto" in
14081         ''|0) try='int getservent_r(struct servent*, char*, int);'
14082         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14083         esac
14084         case "$getservent_r_proto" in
14085         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14086         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14087         esac
14088         case "$getservent_r_proto" in
14089         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14090         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14091         esac
14092         case "$getservent_r_proto" in
14093         ''|0)   d_getservent_r=undef
14094                 getservent_r_proto=0
14095                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14096         * )     case "$getservent_r_proto" in
14097                 REENTRANT_PROTO*) ;;
14098                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14099                 esac
14100                 echo "Prototype: $try" ;;
14101         esac
14102         ;;
14103         *)      case "$usethreads" in
14104                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14105                 esac
14106                 d_getservent_r=undef
14107                 getservent_r_proto=0
14108                 ;;
14109         esac
14110         ;;
14111 *)      getservent_r_proto=0
14112         ;;
14113 esac
14114
14115 : see if prototypes for various getservxxx netdb.h functions are available
14116 echo " "
14117 set d_getservprotos getservent $i_netdb netdb.h
14118 eval $hasproto
14119
14120 : see if getspnam exists
14121 set getspnam d_getspnam
14122 eval $inlibc
14123
14124 : see if this is a shadow.h system
14125 set shadow.h i_shadow
14126 eval $inhdr
14127
14128 : see if getspnam_r exists
14129 set getspnam_r d_getspnam_r
14130 eval $inlibc
14131 case "$d_getspnam_r" in
14132 "$define")
14133         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14134         case "$d_getspnam_r_proto:$usethreads" in
14135         ":define")      d_getspnam_r_proto=define
14136                 set d_getspnam_r_proto getspnam_r $hdrs
14137                 eval $hasproto ;;
14138         *)      ;;
14139         esac
14140         case "$d_getspnam_r_proto" in
14141         define)
14142         case "$getspnam_r_proto" in
14143         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14144         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14145         esac
14146         case "$getspnam_r_proto" in
14147         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14148         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14149         esac
14150         case "$getspnam_r_proto" in
14151         ''|0)   d_getspnam_r=undef
14152                 getspnam_r_proto=0
14153                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14154         * )     case "$getspnam_r_proto" in
14155                 REENTRANT_PROTO*) ;;
14156                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14157                 esac
14158                 echo "Prototype: $try" ;;
14159         esac
14160         ;;
14161         *)      case "$usethreads" in
14162                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14163                 esac
14164                 d_getspnam_r=undef
14165                 getspnam_r_proto=0
14166                 ;;
14167         esac
14168         ;;
14169 *)      getspnam_r_proto=0
14170         ;;
14171 esac
14172
14173 : see if gettimeofday or ftime exists
14174 set gettimeofday d_gettimeod
14175 eval $inlibc
14176 case "$d_gettimeod" in
14177 "$undef")
14178         set ftime d_ftime 
14179         eval $inlibc
14180         ;;
14181 *)
14182         val="$undef"; set d_ftime; eval $setvar
14183         ;;
14184 esac
14185 case "$d_gettimeod$d_ftime" in
14186 "$undef$undef")
14187         echo " "
14188         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14189         ;;
14190 esac
14191
14192 : see if gmtime_r exists
14193 set gmtime_r d_gmtime_r
14194 eval $inlibc
14195 case "$d_gmtime_r" in
14196 "$define")
14197         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14198         case "$d_gmtime_r_proto:$usethreads" in
14199         ":define")      d_gmtime_r_proto=define
14200                 set d_gmtime_r_proto gmtime_r $hdrs
14201                 eval $hasproto ;;
14202         *)      ;;
14203         esac
14204         case "$d_gmtime_r_proto" in
14205         define)
14206         case "$gmtime_r_proto" in
14207         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14208         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14209         esac
14210         case "$gmtime_r_proto" in
14211         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14212         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14213         esac
14214         case "$gmtime_r_proto" in
14215         ''|0)   d_gmtime_r=undef
14216                 gmtime_r_proto=0
14217                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14218         * )     case "$gmtime_r_proto" in
14219                 REENTRANT_PROTO*) ;;
14220                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14221                 esac
14222                 echo "Prototype: $try" ;;
14223         esac
14224         ;;
14225         *)      case "$usethreads" in
14226                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14227                 esac
14228                 d_gmtime_r=undef
14229                 gmtime_r_proto=0
14230                 ;;
14231         esac
14232         ;;
14233 *)      gmtime_r_proto=0
14234         ;;
14235 esac
14236
14237 : see if hasmntopt exists
14238 set hasmntopt d_hasmntopt
14239 eval $inlibc
14240
14241 : see if this is a netinet/in.h or sys/in.h system
14242 set netinet/in.h i_niin sys/in.h i_sysin
14243 eval $inhdr
14244
14245 : see if arpa/inet.h has to be included
14246 set arpa/inet.h i_arpainet
14247 eval $inhdr
14248
14249 : see if htonl --and friends-- exists
14250 val=''
14251 set htonl val
14252 eval $inlibc
14253
14254 : Maybe they are macros.
14255 case "$val" in
14256 $undef)
14257         $cat >htonl.c <<EOM
14258 #include <stdio.h>
14259 #include <sys/types.h>
14260 #$i_niin I_NETINET_IN
14261 #$i_sysin I_SYS_IN
14262 #$i_arpainet I_ARPA_INET
14263 #ifdef I_NETINET_IN
14264 #include <netinet/in.h>
14265 #endif
14266 #ifdef I_SYS_IN
14267 #include <sys/in.h>
14268 #endif
14269 #ifdef I_ARPA_INET
14270 #include <arpa/inet.h>
14271 #endif
14272 #ifdef htonl
14273 printf("Defined as a macro.");
14274 #endif
14275 EOM
14276         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14277         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14278                 val="$define"
14279                 echo "But it seems to be defined as a macro." >&4
14280         fi
14281         $rm -f htonl.?
14282         ;;
14283 esac
14284 set d_htonl
14285 eval $setvar
14286
14287 : see if ilogbl exists
14288 set ilogbl d_ilogbl
14289 eval $inlibc
14290
14291 : index or strchr
14292 echo " "
14293 if set index val -f; eval $csym; $val; then
14294         if set strchr val -f d_strchr; eval $csym; $val; then
14295                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14296                         val="$define"
14297                         vali="$undef"
14298                         echo "strchr() found." >&4
14299                 else
14300                         val="$undef"
14301                         vali="$define"
14302                         echo "index() found." >&4
14303                 fi
14304         else
14305                 val="$undef"
14306                 vali="$define"
14307                 echo "index() found." >&4
14308         fi
14309 else
14310         if set strchr val -f d_strchr; eval $csym; $val; then
14311                 val="$define"
14312                 vali="$undef"
14313                 echo "strchr() found." >&4
14314         else
14315                 echo "No index() or strchr() found!" >&4
14316                 val="$undef"
14317                 vali="$undef"
14318         fi
14319 fi
14320 set d_strchr; eval $setvar
14321 val="$vali"
14322 set d_index; eval $setvar
14323
14324 : check whether inet_aton exists
14325 set inet_aton d_inetaton
14326 eval $inlibc
14327
14328 : Look for isascii
14329 echo " "
14330 $cat >isascii.c <<EOCP
14331 #include <stdio.h>
14332 #include <ctype.h>
14333 #$i_stdlib I_STDLIB
14334 #ifdef I_STDLIB
14335 #include <stdlib.h>
14336 #endif
14337 int main() {
14338         int c = 'A';
14339         if (isascii(c))
14340                 exit(0);
14341         else
14342                 exit(1);
14343 }
14344 EOCP
14345 set isascii
14346 if eval $compile; then
14347         echo "isascii() found." >&4
14348         val="$define"
14349 else
14350         echo "isascii() NOT found." >&4
14351         val="$undef"
14352 fi
14353 set d_isascii
14354 eval $setvar
14355 $rm -f isascii*
14356
14357 : see if isfinite exists
14358 set isfinite d_isfinite
14359 eval $inlibc
14360
14361 : see if isinf exists
14362 set isinf d_isinf
14363 eval $inlibc
14364
14365 : see if isnan exists
14366 set isnan d_isnan
14367 eval $inlibc
14368
14369 : see if isnanl exists
14370 set isnanl d_isnanl
14371 eval $inlibc
14372
14373 : see if killpg exists
14374 set killpg d_killpg
14375 eval $inlibc
14376
14377 : see if lchown exists
14378 echo " "
14379 $cat > try.c <<'EOCP'
14380 /* System header to define __stub macros and hopefully few prototypes,
14381     which can conflict with char lchown(); below.  */
14382 #include <assert.h>
14383 /* Override any gcc2 internal prototype to avoid an error.  */
14384 /* We use char because int might match the return type of a gcc2
14385    builtin and then its argument prototype would still apply.  */
14386 char lchown();
14387 int main() {
14388     /*  The GNU C library defines this for functions which it implements
14389         to always fail with ENOSYS.  Some functions are actually named
14390         something starting with __ and the normal name is an alias.  */
14391 #if defined (__stub_lchown) || defined (__stub___lchown)
14392 choke me
14393 #else
14394 lchown();
14395 #endif
14396 ; return 0; }
14397 EOCP
14398 set try
14399 if eval $compile; then
14400     $echo "lchown() found." >&4
14401     val="$define"
14402 else
14403     $echo "lchown() NOT found." >&4
14404     val="$undef"
14405 fi
14406 set d_lchown
14407 eval $setvar
14408
14409 : See if number of significant digits in a double precision number is known
14410 echo " "
14411 $cat >ldbl_dig.c <<EOM
14412 #$i_limits I_LIMITS
14413 #$i_float I_FLOAT
14414 #ifdef I_LIMITS
14415 #include <limits.h>
14416 #endif
14417 #ifdef I_FLOAT
14418 #include <float.h>
14419 #endif
14420 #ifdef LDBL_DIG
14421 printf("Contains LDBL_DIG");
14422 #endif
14423 EOM
14424 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14425 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14426         echo "LDBL_DIG found." >&4
14427         val="$define"
14428 else
14429         echo "LDBL_DIG NOT found." >&4
14430         val="$undef"
14431 fi
14432 $rm -f ldbl_dig.?
14433 set d_ldbl_dig
14434 eval $setvar
14435
14436 : see if this is a math.h system
14437 set math.h i_math
14438 eval $inhdr
14439
14440 d_libm_lib_version="$undef"
14441 case $i_math in
14442     $define)
14443         : check to see if math.h defines _LIB_VERSION
14444         echo " "
14445         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14446         $cat >try.c <<EOCP
14447 #include <unistd.h>
14448 #include <math.h>
14449 int main (int argc, char *argv[])
14450 {
14451     printf ("%d\n", _LIB_VERSION);
14452     return (0);
14453     } /* main */
14454 EOCP
14455         set try
14456         if eval $compile; then
14457             foo=`$run ./try`
14458             echo "Yes, it does ($foo)" >&4
14459             d_libm_lib_version="$define"
14460         else
14461             echo "No, it does not (probably harmless)\n" >&4
14462             fi
14463         $rm -f try.* try core core.try.*
14464         ;;
14465
14466     esac
14467
14468 : see if link exists
14469 set link d_link
14470 eval $inlibc
14471
14472 : see if localtime_r exists
14473 set localtime_r d_localtime_r
14474 eval $inlibc
14475 case "$d_localtime_r" in
14476 "$define")
14477         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14478         case "$d_localtime_r_proto:$usethreads" in
14479         ":define")      d_localtime_r_proto=define
14480                 set d_localtime_r_proto localtime_r $hdrs
14481                 eval $hasproto ;;
14482         *)      ;;
14483         esac
14484         case "$d_localtime_r_proto" in
14485         define)
14486         case "$localtime_r_proto" in
14487         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14488         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14489         esac
14490         case "$localtime_r_proto" in
14491         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14492         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14493         esac
14494         case "$localtime_r_proto" in
14495         ''|0)   d_localtime_r=undef
14496                 localtime_r_proto=0
14497                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14498         * )     case "$localtime_r_proto" in
14499                 REENTRANT_PROTO*) ;;
14500                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14501                 esac
14502                 echo "Prototype: $try" ;;
14503         esac
14504         ;;
14505         *)      case "$usethreads" in
14506                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14507                 esac
14508                 d_localtime_r=undef
14509                 localtime_r_proto=0
14510                 ;;
14511         esac
14512         ;;
14513 *)      localtime_r_proto=0
14514         ;;
14515 esac
14516
14517 : see if localeconv exists
14518 set localeconv d_locconv
14519 eval $inlibc
14520
14521 : see if lockf exists
14522 set lockf d_lockf
14523 eval $inlibc
14524
14525 : see if prototype for lseek is available
14526 echo " "
14527 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14528 eval $hasproto
14529
14530 : see if lstat exists
14531 set lstat d_lstat
14532 eval $inlibc
14533
14534 : see if madvise exists
14535 set madvise d_madvise
14536 eval $inlibc
14537
14538 : see if malloc_size exists
14539 set malloc_size d_malloc_size
14540 eval $inlibc
14541
14542 : see if malloc_size_good exists
14543 set malloc_good_size d_malloc_good_size
14544 eval $inlibc
14545
14546 : see if mblen exists
14547 set mblen d_mblen
14548 eval $inlibc
14549
14550 : see if mbstowcs exists
14551 set mbstowcs d_mbstowcs
14552 eval $inlibc
14553
14554 : see if mbtowc exists
14555 set mbtowc d_mbtowc
14556 eval $inlibc
14557
14558 : see if memchr exists
14559 set memchr d_memchr
14560 eval $inlibc
14561
14562 : see if memcmp exists
14563 set memcmp d_memcmp
14564 eval $inlibc
14565
14566 : see if memcpy exists
14567 set memcpy d_memcpy
14568 eval $inlibc
14569
14570 : see if memmove exists
14571 set memmove d_memmove
14572 eval $inlibc
14573
14574 : see if memset exists
14575 set memset d_memset
14576 eval $inlibc
14577
14578 : see if mkdir exists
14579 set mkdir d_mkdir
14580 eval $inlibc
14581
14582 : see if mkdtemp exists
14583 set mkdtemp d_mkdtemp
14584 eval $inlibc
14585
14586 : see if mkfifo exists
14587 set mkfifo d_mkfifo
14588 eval $inlibc
14589
14590 : see if mkstemp exists
14591 set mkstemp d_mkstemp
14592 eval $inlibc
14593
14594 : see if mkstemps exists
14595 set mkstemps d_mkstemps
14596 eval $inlibc
14597
14598 : see if mktime exists
14599 set mktime d_mktime
14600 eval $inlibc
14601
14602 : see if this is a sys/mman.h system
14603 set sys/mman.h i_sysmman
14604 eval $inhdr
14605
14606 : see if mmap exists
14607 set mmap d_mmap
14608 eval $inlibc
14609 : see what shmat returns
14610 : default to something harmless
14611 mmaptype='void *'
14612 case "$i_sysmman$d_mmap" in
14613 "$define$define")
14614         $cat >mmap.c <<'END'
14615 #include <sys/mman.h>
14616 void *mmap();
14617 END
14618         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14619                 mmaptype='void *'
14620         else
14621                 mmaptype='caddr_t'
14622         fi
14623         echo "and it returns ($mmaptype)." >&4
14624         ;;
14625 esac
14626
14627
14628
14629 : see if sqrtl exists
14630 set sqrtl d_sqrtl
14631 eval $inlibc
14632
14633 : see if scalbnl exists
14634 set scalbnl d_scalbnl
14635 eval $inlibc
14636
14637 : see if modfl exists
14638 set modfl d_modfl
14639 eval $inlibc
14640
14641 : see if prototype for modfl is available
14642 echo " "
14643 set d_modflproto modfl $i_math math.h
14644 eval $hasproto
14645
14646 d_modfl_pow32_bug="$undef"
14647
14648 case "$d_longdbl$d_modfl" in
14649 $define$define)
14650         $cat <<EOM
14651 Checking to see whether your modfl() is okay for large values...
14652 EOM
14653 $cat >try.c <<EOCP
14654 #include <math.h> 
14655 #include <stdio.h>
14656 EOCP
14657 if $test "X$d_modflproto" != "X$define"; then
14658         $cat >>try.c <<EOCP
14659 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14660 long double modfl (long double, long double *);
14661 EOCP
14662 fi
14663 $cat >>try.c <<EOCP
14664 int main() {
14665     long double nv = 4294967303.15;
14666     long double v, w;
14667     v = modfl(nv, &w);         
14668 #ifdef __GLIBC__
14669     printf("glibc");
14670 #endif
14671     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14672     return 0;
14673 }
14674 EOCP
14675         case "$osname:$gccversion" in
14676         aix:)   saveccflags="$ccflags"
14677                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14678         esac
14679         set try
14680         if eval $compile; then
14681                 foo=`$run ./try`
14682                 case "$foo" in
14683                 *" 4294967303.150000 1.150000 4294967302.000000")
14684                         echo >&4 "Your modfl() is broken for large values."
14685                         d_modfl_pow32_bug="$define"
14686                         case "$foo" in
14687                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14688                         ;;
14689                         esac
14690                         ;;
14691                 *" 4294967303.150000 0.150000 4294967303.000000")
14692                         echo >&4 "Your modfl() seems okay for large values."
14693                         ;;
14694                 *)      echo >&4 "I don't understand your modfl() at all."
14695                         d_modfl="$undef"
14696                         ;;
14697                 esac
14698                 $rm -f try.* try core core.try.*
14699         else
14700                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14701                 d_modfl="$undef"
14702         fi
14703         case "$osname:$gccversion" in
14704         aix:)   ccflags="$saveccflags" ;; # restore
14705         esac
14706         ;;
14707 esac
14708
14709 if $test "$uselongdouble" = "$define"; then
14710     message=""
14711     if $test "$d_sqrtl" != "$define"; then
14712         message="$message sqrtl"
14713     fi
14714     if $test "$d_modfl" != "$define"; then
14715         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14716             echo "You have both aintl and copysignl, so I can emulate modfl."
14717         else
14718             message="$message modfl"
14719         fi
14720     fi
14721     if $test "$d_frexpl" != "$define"; then
14722         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14723             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14724         else
14725             message="$message frexpl"
14726         fi
14727     fi
14728
14729     if $test "$message" != ""; then
14730         $cat <<EOM >&4
14731
14732 *** You requested the use of long doubles but you do not seem to have
14733 *** the following mathematical functions needed for long double support:
14734 ***    $message
14735 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14736 *** Cannot continue, aborting.
14737
14738 EOM
14739
14740         exit 1
14741     fi
14742 fi
14743
14744 : see if mprotect exists
14745 set mprotect d_mprotect
14746 eval $inlibc
14747
14748 : see if msgctl exists
14749 set msgctl d_msgctl
14750 eval $inlibc
14751
14752 : see if msgget exists
14753 set msgget d_msgget
14754 eval $inlibc
14755
14756 : see if msgsnd exists
14757 set msgsnd d_msgsnd
14758 eval $inlibc
14759
14760 : see if msgrcv exists
14761 set msgrcv d_msgrcv
14762 eval $inlibc
14763
14764 : see how much of the 'msg*(2)' library is present.
14765 h_msg=true
14766 echo " "
14767 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14768 *"$undef"*) h_msg=false;;
14769 esac
14770 case "$osname" in
14771 freebsd)
14772     case "`ipcs 2>&1`" in
14773     "SVID messages"*"not configured"*)
14774         echo "Your $osname does not have the msg*(2) configured." >&4
14775         h_msg=false
14776         val="$undef"
14777         set msgctl d_msgctl
14778         eval $setvar
14779         set msgget d_msgget
14780         eval $setvar
14781         set msgsnd d_msgsnd
14782         eval $setvar
14783         set msgrcv d_msgrcv
14784         eval $setvar
14785         ;;
14786     esac
14787     ;;
14788 esac
14789 : we could also check for sys/ipc.h ...
14790 if $h_msg && $test `./findhdr sys/msg.h`; then
14791         echo "You have the full msg*(2) library." >&4
14792         val="$define"
14793 else
14794         echo "You don't have the full msg*(2) library." >&4
14795         val="$undef"
14796 fi
14797 set d_msg
14798 eval $setvar
14799
14800
14801 echo " "
14802 echo "Checking to see if your system supports struct msghdr..." >&4
14803 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14804 eval $hasstruct
14805 case "$d_msghdr_s" in
14806 "$define")      echo "Yes, it does."   ;;
14807 *)              echo "No, it doesn't." ;;
14808 esac
14809
14810
14811 : see if msync exists
14812 set msync d_msync
14813 eval $inlibc
14814
14815 : see if munmap exists
14816 set munmap d_munmap
14817 eval $inlibc
14818
14819 : see if nice exists
14820 set nice d_nice
14821 eval $inlibc
14822
14823 : see if this is a langinfo.h system
14824 set langinfo.h i_langinfo
14825 eval $inhdr
14826
14827 : see if nl_langinfo exists
14828 set nl_langinfo d_nl_langinfo
14829 eval $inlibc
14830
14831 : check for length of character
14832 echo " "
14833 case "$charsize" in
14834 '')
14835         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14836         $cat >try.c <<EOCP
14837 #include <stdio.h>
14838 #$i_stdlib I_STDLIB
14839 #ifdef I_STDLIB
14840 #include <stdlib.h>
14841 #endif
14842 int main()
14843 {
14844     printf("%d\n", (int)sizeof(char));
14845     exit(0);
14846 }
14847 EOCP
14848         set try
14849         if eval $compile_ok; then
14850                 dflt=`$run ./try`
14851         else
14852                 dflt='1'
14853                 echo "(I can't seem to compile the test program.  Guessing...)"
14854         fi
14855         ;;
14856 *)
14857         dflt="$charsize"
14858         ;;
14859 esac
14860 rp="What is the size of a character (in bytes)?"
14861 . ./myread
14862 charsize="$ans"
14863 $rm -f try.c try
14864
14865 : check for volatile keyword
14866 echo " "
14867 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14868 $cat >try.c <<'EOCP'
14869 int main()
14870 {
14871         typedef struct _goo_struct goo_struct;
14872         goo_struct * volatile goo = ((goo_struct *)0);
14873         struct _goo_struct {
14874                 long long_int;
14875                 int reg_int;
14876                 char char_var;
14877         };
14878         typedef unsigned short foo_t;
14879         char *volatile foo;
14880         volatile int bar;
14881         volatile foo_t blech;
14882         foo = foo;
14883 }
14884 EOCP
14885 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14886         val="$define"
14887         echo "Yup, it does."
14888 else
14889         val="$undef"
14890         echo "Nope, it doesn't."
14891 fi
14892 set d_volatile
14893 eval $setvar
14894 $rm -f try.*
14895
14896
14897 echo " "
14898 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14899
14900 case "$use64bitint:$d_quad:$quadtype" in
14901 define:define:?*)
14902         ivtype="$quadtype"
14903         uvtype="$uquadtype"
14904         ivsize=8
14905         uvsize=8
14906         ;;
14907 *)      ivtype="long"
14908         uvtype="unsigned long"
14909         ivsize=$longsize
14910         uvsize=$longsize
14911         ;;
14912 esac
14913
14914 case "$uselongdouble:$d_longdbl" in
14915 define:define)
14916         nvtype="long double"
14917         nvsize=$longdblsize
14918         ;;
14919 *)      nvtype=double
14920         nvsize=$doublesize
14921         ;;
14922 esac
14923
14924 $echo "(IV will be "$ivtype", $ivsize bytes)"
14925 $echo "(UV will be "$uvtype", $uvsize bytes)"
14926 $echo "(NV will be "$nvtype", $nvsize bytes)"
14927
14928 $cat >try.c <<EOCP
14929 #$i_inttypes I_INTTYPES
14930 #ifdef I_INTTYPES
14931 #include <inttypes.h>
14932 #endif
14933 #include <stdio.h>
14934 int main() {
14935 #ifdef INT8
14936    int8_t i =  INT8_MAX;
14937   uint8_t u = UINT8_MAX;
14938   printf("int8_t\n");
14939 #endif
14940 #ifdef INT16
14941    int16_t i =  INT16_MAX;
14942   uint16_t i = UINT16_MAX;
14943   printf("int16_t\n");
14944 #endif
14945 #ifdef INT32
14946    int32_t i =  INT32_MAX;
14947   uint32_t u = UINT32_MAX;
14948   printf("int32_t\n");
14949 #endif
14950 }
14951 EOCP
14952
14953 case "$i8type" in
14954 '')     case "$charsize" in
14955         1)      i8type=char
14956                 u8type="unsigned char"
14957                 i8size=$charsize
14958                 u8size=$charsize
14959                 ;;
14960         esac
14961         ;;
14962 esac
14963 case "$i8type" in
14964 '')     set try -DINT8
14965         if eval $compile; then
14966                 case "`$run ./try`" in
14967                 int8_t) i8type=int8_t
14968                         u8type=uint8_t
14969                         i8size=1
14970                         u8size=1
14971                         ;;
14972                 esac
14973         fi
14974         ;;
14975 esac
14976 case "$i8type" in
14977 '')     if $test $charsize -ge 1; then
14978                 i8type=char
14979                 u8type="unsigned char"
14980                 i8size=$charsize
14981                 u8size=$charsize
14982         fi
14983         ;;
14984 esac
14985
14986 case "$i16type" in
14987 '')     case "$shortsize" in
14988         2)      i16type=short
14989                 u16type="unsigned short"
14990                 i16size=$shortsize
14991                 u16size=$shortsize
14992                 ;;
14993         esac
14994         ;;
14995 esac
14996 case "$i16type" in
14997 '')     set try -DINT16
14998         if eval $compile; then
14999                 case "`$run ./try`" in
15000                 int16_t)
15001                         i16type=int16_t
15002                         u16type=uint16_t
15003                         i16size=2
15004                         u16size=2
15005                         ;;
15006                 esac
15007         fi
15008         ;;
15009 esac
15010 case "$i16type" in
15011 '')     if $test $shortsize -ge 2; then
15012                 i16type=short
15013                 u16type="unsigned short"
15014                 i16size=$shortsize
15015                 u16size=$shortsize
15016         fi
15017         ;;
15018 esac
15019
15020 case "$i32type" in
15021 '')     case "$longsize" in
15022         4)      i32type=long
15023                 u32type="unsigned long"
15024                 i32size=$longsize
15025                 u32size=$longsize
15026                 ;;
15027         *)      case "$intsize" in
15028                 4)      i32type=int
15029                         u32type="unsigned int"
15030                         i32size=$intsize
15031                         u32size=$intsize
15032                         ;;
15033                 esac
15034                 ;;
15035         esac
15036         ;;
15037 esac
15038 case "$i32type" in
15039 '')     set try -DINT32
15040         if eval $compile; then
15041                 case "`$run ./try`" in
15042                 int32_t)
15043                         i32type=int32_t
15044                         u32type=uint32_t
15045                         i32size=4
15046                         u32size=4
15047                         ;;
15048                 esac
15049         fi
15050         ;;
15051 esac
15052 case "$i32type" in
15053 '')     if $test $intsize -ge 4; then
15054                 i32type=int
15055                 u32type="unsigned int"
15056                 i32size=$intsize
15057                 u32size=$intsize
15058         fi
15059         ;;
15060 esac
15061
15062 case "$i64type" in
15063 '')     case "$d_quad:$quadtype" in
15064         define:?*)
15065                 i64type="$quadtype"
15066                 u64type="$uquadtype"
15067                 i64size=8
15068                 u64size=8
15069                 ;;
15070         esac
15071         ;;
15072 esac
15073
15074 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15075 : volatile so that the compiler has to store it out to memory.
15076 if test X"$d_volatile" = X"$define"; then
15077         volatile=volatile
15078 fi
15079 $cat <<EOP >try.c
15080 #include <stdio.h>
15081 #$i_stdlib I_STDLIB
15082 #ifdef I_STDLIB
15083 #include <stdlib.h>
15084 #endif
15085 #include <sys/types.h>
15086 #include <signal.h>
15087 #ifdef SIGFPE
15088 $volatile int bletched = 0;
15089 $signal_t blech(int s) { bletched = 1; }
15090 #endif
15091 int main() {
15092     $uvtype u = 0;
15093     $nvtype d;
15094     int     n = 8 * $uvsize;
15095     int     i;
15096 #ifdef SIGFPE
15097     signal(SIGFPE, blech);
15098 #endif
15099
15100     for (i = 0; i < n; i++) {
15101       u = u << 1 | ($uvtype)1;
15102       d = ($nvtype)u;
15103       if (($uvtype)d != u)
15104         break;
15105       if (d <= 0)
15106         break;
15107       d = ($nvtype)(u - 1);
15108       if (($uvtype)d != (u - 1))
15109         break;
15110 #ifdef SIGFPE
15111       if (bletched) {
15112         break;
15113 #endif
15114       } 
15115     }
15116     printf("%d\n", ((i == n) ? -n : i));
15117     exit(0);
15118 }
15119 EOP
15120 set try
15121
15122 d_nv_preserves_uv="$undef"
15123 if eval $compile; then
15124         nv_preserves_uv_bits="`$run ./try`"
15125 fi
15126 case "$nv_preserves_uv_bits" in
15127 \-[1-9]*)       
15128         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15129         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15130         d_nv_preserves_uv="$define"
15131         ;;
15132 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15133         d_nv_preserves_uv="$undef" ;;
15134 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15135         nv_preserves_uv_bits="$undef" ;;
15136 esac
15137
15138 $rm -f try.* try
15139
15140 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15141 : volatile so that the compiler has to store it out to memory.
15142 if test X"$d_volatile" = X"$define"; then
15143         volatile=volatile
15144 fi
15145 $cat <<EOP >try.c
15146 #include <stdio.h>
15147 #$i_stdlib I_STDLIB
15148 #ifdef I_STDLIB
15149 #include <stdlib.h>
15150 #endif
15151 #$i_string I_STRING
15152 #ifdef I_STRING
15153 #  include <string.h>
15154 #else
15155 #  include <strings.h>
15156 #endif
15157 #include <sys/types.h>
15158 #include <signal.h>
15159 #ifdef SIGFPE
15160 $volatile int bletched = 0;
15161 $signal_t blech(int s) { bletched = 1; }
15162 #endif
15163
15164 int checkit($nvtype d, char *where) {
15165     unsigned char *p = (char *)&d;
15166     unsigned char *end = p + sizeof(d);
15167     int fail = 0;
15168
15169     while (p < end)
15170         fail += *p++;
15171
15172     if (!fail)
15173         return 0;
15174
15175     p = (char *)&d;
15176     printf("No - %s: 0x", where);
15177     while (p < end)
15178         printf ("%02X", *p++);
15179     printf("\n");
15180     return 1;
15181 }
15182
15183 int main(int argc, char **argv) {
15184     $nvtype d = 0.0;
15185     int fail = 0;
15186     fail += checkit(d, "0.0");
15187
15188     /* The compiler shouldn't be assuming that bletched is 0  */
15189     d = bletched;
15190
15191     fail += checkit(d, "bleched");
15192
15193 #ifdef SIGFPE
15194     signal(SIGFPE, blech);
15195 #endif
15196
15197     /* Paranoia - the compiler should have no way of knowing that ANSI says
15198        that argv[argc] will always be NULL.  Actually, if it did assume this it
15199        would be buggy, as this is C and main() can be called from elsewhere in
15200        the program.  */
15201     d = argv[argc] ? 1 : 0;
15202
15203     if (d) {
15204         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15205     }
15206
15207     fail += checkit(d, "ternary");
15208
15209     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15210
15211     if (d != 0.0) {
15212         printf("No - memset doesn't give 0.0\n");
15213         /* This might just blow up:  */
15214         printf("(gives %g)\n", d);
15215         return 1;
15216     }
15217     
15218 #ifdef SIGFPE
15219     if (bletched) {
15220         printf("No - something bleched\n");
15221         return 1;
15222     }
15223 #endif
15224     if (fail) {
15225       printf("No - %d fail(s)\n", fail);
15226       return 1;
15227     }
15228     printf("Yes\n");
15229     return 0;
15230 }
15231 EOP
15232 set try
15233
15234 d_nv_zero_is_allbits_zero="$undef"
15235 if eval $compile; then
15236     xxx="`$run ./try`"
15237     case "$?" in
15238         0)
15239             case "$xxx" in
15240                 Yes)  cat >&4 <<EOM
15241 0.0 is represented as all bits zero in memory
15242 EOM
15243                     d_nv_zero_is_allbits_zero="$define"
15244                     ;;
15245                 *)  cat >&4 <<EOM
15246 0.0 is not represented as all bits zero in memory
15247 EOM
15248                     d_nv_zero_is_allbits_zero="$undef"
15249                     ;;
15250             esac
15251             ;;
15252         *)  cat >&4 <<EOM
15253 0.0 is not represented as all bits zero in memory
15254 EOM
15255             d_nv_zero_is_allbits_zero="$undef"
15256             ;;
15257     esac
15258 fi
15259
15260 $rm -f try.* try
15261
15262
15263 : check for off64_t
15264 echo " "
15265 echo "Checking to see if you have off64_t..." >&4
15266 $cat >try.c <<EOCP
15267 #include <sys/types.h>
15268 #include <unistd.h>
15269 int main() { off64_t x = 7; }
15270 EOCP
15271 set try
15272 if eval $compile; then
15273         val="$define"
15274         echo "You have off64_t."
15275 else
15276         val="$undef"
15277         echo "You do not have off64_t."
15278         case "$lseeksize" in
15279         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15280         esac
15281 fi
15282 $rm -f try.* try
15283 set d_off64_t
15284 eval $setvar
15285
15286 : how to create joinable pthreads
15287 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15288         echo " "
15289         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15290         $cat >try.c <<'EOCP'
15291 #include <pthread.h>
15292 int main() {
15293     int detachstate = JOINABLE;
15294 }
15295 EOCP
15296         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15297         if eval $compile; then
15298                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15299                 val="$undef" # Yes, undef.
15300                 set d_old_pthread_create_joinable
15301                 eval $setvar
15302                 val=""
15303                 set old_pthread_create_joinable
15304                 eval $setvar
15305         else
15306                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15307                 if eval $compile; then
15308                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15309                         val="$define"
15310                         set d_old_pthread_create_joinable
15311                         eval $setvar
15312                         val=PTHREAD_CREATE_UNDETACHED
15313                         set old_pthread_create_joinable
15314                         eval $setvar
15315                 else            
15316                         set try -DJOINABLE=__UNDETACHED
15317                         if eval $compile; then
15318                                 echo "You seem to use __UNDETACHED." >&4
15319                                 val="$define"
15320                                 set d_old_pthread_create_joinable
15321                                 eval $setvar
15322                                 val=__UNDETACHED
15323                                 set old_pthread_create_joinable
15324                                 eval $setvar
15325                         else
15326                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15327                                 val="$define"
15328                                 set d_old_pthread_create_joinable
15329                                 eval $setvar
15330                                 val=0
15331                                 set old_pthread_create_joinable
15332                                 eval $setvar
15333                         fi
15334                 fi
15335         fi
15336         $rm -f try try.*
15337 else
15338     d_old_pthread_create_joinable="$undef"
15339     old_pthread_create_joinable=""
15340 fi
15341
15342 : see if pause exists
15343 set pause d_pause
15344 eval $inlibc
15345
15346 : see if pipe exists
15347 set pipe d_pipe
15348 eval $inlibc
15349
15350 : see if poll exists
15351 set poll d_poll
15352 eval $inlibc
15353
15354 : see if readlink exists
15355 set readlink d_readlink
15356 eval $inlibc
15357
15358 echo " "
15359 procselfexe=''
15360 val="$undef"
15361 case "$d_readlink" in
15362 "$define")
15363         if $issymlink /proc/self/exe ; then
15364                 $ls -l /proc/self/exe > reflect
15365                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15366                         echo "You have Linux-like /proc/self/exe."
15367                         procselfexe='"/proc/self/exe"'
15368                         val="$define"
15369                 fi
15370         fi
15371         if $issymlink /proc/curproc/file ; then
15372                 $ls -l /proc/curproc/file > reflect
15373                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15374                         echo "You have BSD-like /proc/curproc/file."
15375                         procselfexe='"/proc/curproc/file"'
15376                         val="$define"
15377                 fi
15378         fi
15379         ;;
15380 esac
15381 $rm -f reflect
15382 set d_procselfexe
15383 eval $setvar
15384
15385 : see whether the pthread_atfork exists
15386 $cat >try.c <<EOP
15387 #include <pthread.h>
15388 #include <stdio.h>
15389 int main() {
15390 #ifdef  PTHREAD_ATFORK
15391         pthread_atfork(NULL,NULL,NULL);
15392 #endif
15393 }
15394 EOP
15395
15396 : see if pthread_atfork exists
15397 set try -DPTHREAD_ATFORK
15398 if eval $compile; then
15399     val="$define"
15400 else
15401     val="$undef"
15402 fi
15403 case "$usethreads" in
15404 $define)
15405         case "$val" in
15406         $define) echo 'pthread_atfork found.' >&4        ;;
15407         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15408         esac
15409 esac
15410 set d_pthread_atfork
15411 eval $setvar
15412
15413 : see if pthread_attr_setscope exists
15414 set pthread_attr_setscope d_pthread_attr_setscope
15415 eval $inlibc
15416
15417
15418 : see whether the various POSIXish _yields exist
15419 $cat >try.c <<EOP
15420 #include <pthread.h>
15421 #include <stdio.h>
15422 int main() {
15423 #ifdef SCHED_YIELD
15424         sched_yield();
15425 #else
15426 #ifdef PTHREAD_YIELD
15427         pthread_yield();
15428 #else
15429 #ifdef PTHREAD_YIELD_NULL
15430         pthread_yield(NULL);
15431 #endif
15432 #endif
15433 #endif
15434 }
15435 EOP
15436 : see if sched_yield exists
15437 set try -DSCHED_YIELD
15438 if eval $compile; then
15439     val="$define"
15440     sched_yield='sched_yield()'
15441 else
15442     val="$undef"
15443 fi
15444 case "$usethreads" in
15445 $define)
15446         case "$val" in
15447         $define) echo 'sched_yield() found.' >&4        ;;
15448         *)       echo 'sched_yield() NOT found.' >&4    ;;
15449         esac
15450 esac
15451 set d_sched_yield
15452 eval $setvar
15453
15454 : see if pthread_yield exists
15455 set try -DPTHREAD_YIELD
15456 if eval $compile; then
15457     val="$define"
15458     case "$sched_yield" in
15459     '') sched_yield='pthread_yield()' ;;
15460     esac
15461 else
15462     set try -DPTHREAD_YIELD_NULL
15463     if eval $compile; then
15464         val="$define"
15465         case "$sched_yield" in
15466         '') sched_yield='pthread_yield(NULL)' ;;
15467         esac
15468     else
15469         val="$undef"
15470     fi
15471 fi
15472 case "$usethreads" in
15473 $define)
15474         case "$val" in
15475         $define) echo 'pthread_yield() found.' >&4      ;;
15476         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15477         esac
15478         ;;
15479 esac
15480 set d_pthread_yield
15481 eval $setvar
15482
15483 case "$sched_yield" in
15484 '') sched_yield=undef ;;
15485 esac
15486
15487 $rm -f try try.*
15488
15489 : see if random_r exists
15490 set random_r d_random_r
15491 eval $inlibc
15492 case "$d_random_r" in
15493 "$define")
15494         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15495         case "$d_random_r_proto:$usethreads" in
15496         ":define")      d_random_r_proto=define
15497                 set d_random_r_proto random_r $hdrs
15498                 eval $hasproto ;;
15499         *)      ;;
15500         esac
15501         case "$d_random_r_proto" in
15502         define)
15503         case "$random_r_proto" in
15504         ''|0) try='int random_r(int*, struct random_data*);'
15505         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15506         esac
15507         case "$random_r_proto" in
15508         ''|0) try='int random_r(long*, struct random_data*);'
15509         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15510         esac
15511         case "$random_r_proto" in
15512         ''|0) try='int random_r(struct random_data*, int32_t*);'
15513         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15514         esac
15515         case "$random_r_proto" in
15516         ''|0)   d_random_r=undef
15517                 random_r_proto=0
15518                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15519         * )     case "$random_r_proto" in
15520                 REENTRANT_PROTO*) ;;
15521                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15522                 esac
15523                 echo "Prototype: $try" ;;
15524         esac
15525         ;;
15526         *)      case "$usethreads" in
15527                 define) echo "random_r has no prototype, not using it." >&4 ;;
15528                 esac
15529                 d_random_r=undef
15530                 random_r_proto=0
15531                 ;;
15532         esac
15533         ;;
15534 *)      random_r_proto=0
15535         ;;
15536 esac
15537
15538 : see if readdir and friends exist
15539 set readdir d_readdir
15540 eval $inlibc
15541 set seekdir d_seekdir
15542 eval $inlibc
15543 set telldir d_telldir
15544 eval $inlibc
15545 set rewinddir d_rewinddir
15546 eval $inlibc
15547
15548 : see if readdir64_r exists
15549 set readdir64_r d_readdir64_r
15550 eval $inlibc
15551 case "$d_readdir64_r" in
15552 "$define")
15553         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15554         case "$d_readdir64_r_proto:$usethreads" in
15555         ":define")      d_readdir64_r_proto=define
15556                 set d_readdir64_r_proto readdir64_r $hdrs
15557                 eval $hasproto ;;
15558         *)      ;;
15559         esac
15560         case "$d_readdir64_r_proto" in
15561         define)
15562         case "$readdir64_r_proto" in
15563         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15564         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15565         esac
15566         case "$readdir64_r_proto" in
15567         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15568         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15569         esac
15570         case "$readdir64_r_proto" in
15571         ''|0)   d_readdir64_r=undef
15572                 readdir64_r_proto=0
15573                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15574         * )     case "$readdir64_r_proto" in
15575                 REENTRANT_PROTO*) ;;
15576                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15577                 esac
15578                 echo "Prototype: $try" ;;
15579         esac
15580         ;;
15581         *)      case "$usethreads" in
15582                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15583                 esac
15584                 d_readdir64_r=undef
15585                 readdir64_r_proto=0
15586                 ;;
15587         esac
15588         ;;
15589 *)      readdir64_r_proto=0
15590         ;;
15591 esac
15592
15593 : see if readdir_r exists
15594 set readdir_r d_readdir_r
15595 eval $inlibc
15596 case "$d_readdir_r" in
15597 "$define")
15598         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15599         case "$d_readdir_r_proto:$usethreads" in
15600         ":define")      d_readdir_r_proto=define
15601                 set d_readdir_r_proto readdir_r $hdrs
15602                 eval $hasproto ;;
15603         *)      ;;
15604         esac
15605         case "$d_readdir_r_proto" in
15606         define)
15607         case "$readdir_r_proto" in
15608         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15609         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15610         esac
15611         case "$readdir_r_proto" in
15612         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15613         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15614         esac
15615         case "$readdir_r_proto" in
15616         ''|0)   d_readdir_r=undef
15617                 readdir_r_proto=0
15618                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15619         * )     case "$readdir_r_proto" in
15620                 REENTRANT_PROTO*) ;;
15621                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15622                 esac
15623                 echo "Prototype: $try" ;;
15624         esac
15625         ;;
15626         *)      case "$usethreads" in
15627                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15628                 esac
15629                 d_readdir_r=undef
15630                 readdir_r_proto=0
15631                 ;;
15632         esac
15633         ;;
15634 *)      readdir_r_proto=0
15635         ;;
15636 esac
15637
15638 : see if readv exists
15639 set readv d_readv
15640 eval $inlibc
15641
15642 : see if recvmsg exists
15643 set recvmsg d_recvmsg
15644 eval $inlibc
15645
15646 : see if rename exists
15647 set rename d_rename
15648 eval $inlibc
15649
15650 : see if rmdir exists
15651 set rmdir d_rmdir
15652 eval $inlibc
15653
15654 : see if memory.h is available.
15655 val=''
15656 set memory.h val
15657 eval $inhdr
15658
15659 : See if it conflicts with string.h
15660 case "$val" in
15661 $define)
15662         case "$strings" in
15663         '') ;;
15664         *)
15665                 $cppstdin $cppflags $cppminus < $strings > mem.h
15666                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15667                         echo " "
15668                         echo "We won't be including <memory.h>."
15669                         val="$undef"
15670                 fi
15671                 $rm -f mem.h
15672                 ;;
15673         esac
15674 esac
15675 set i_memory
15676 eval $setvar
15677
15678 : can bcopy handle overlapping blocks?
15679 echo " "
15680 val="$undef"
15681 case "$d_memmove" in
15682 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15683 *)      case "$d_bcopy" in
15684         "$define")
15685                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15686                 $cat >try.c <<EOCP
15687 #$i_memory I_MEMORY
15688 #$i_stdlib I_STDLIB
15689 #$i_string I_STRING
15690 #$i_unistd I_UNISTD
15691 EOCP
15692         $cat >>try.c <<'EOCP'
15693 #include <stdio.h>
15694 #ifdef I_MEMORY
15695 #  include <memory.h>
15696 #endif
15697 #ifdef I_STDLIB
15698 #  include <stdlib.h>
15699 #endif
15700 #ifdef I_STRING
15701 #  include <string.h>
15702 #else
15703 #  include <strings.h>
15704 #endif
15705 #ifdef I_UNISTD
15706 #  include <unistd.h>  /* Needed for NetBSD */
15707 #endif
15708 int main()
15709 {
15710 char buf[128], abc[128];
15711 char *b;
15712 int len;
15713 int off;
15714 int align;
15715
15716 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15717    try to store the string in read-only memory. */
15718 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15719
15720 for (align = 7; align >= 0; align--) {
15721         for (len = 36; len; len--) {
15722                 b = buf+align;
15723                 bcopy(abc, b, len);
15724                 for (off = 1; off <= len; off++) {
15725                         bcopy(b, b+off, len);
15726                         bcopy(b+off, b, len);
15727                         if (bcmp(b, abc, len))
15728                                 exit(1);
15729                 }
15730         }
15731 }
15732 exit(0);
15733 }
15734 EOCP
15735                 set try
15736                 if eval $compile_ok; then
15737                         if ./try 2>/dev/null; then
15738                                 echo "Yes, it can."
15739                                 val="$define"
15740                         else
15741                                 echo "It can't, sorry."
15742                         fi
15743                 else
15744                         echo "(I can't compile the test program, so we'll assume not...)"
15745                 fi
15746                 ;;
15747         esac
15748         $rm -f try.* try core
15749         ;;
15750 esac
15751 set d_safebcpy
15752 eval $setvar
15753
15754 : can memcpy handle overlapping blocks?
15755 echo " "
15756 val="$undef"
15757 case "$d_memmove" in
15758 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15759 *)      case "$d_memcpy" in
15760         "$define")
15761                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15762                 $cat >try.c <<EOCP
15763 #$i_memory I_MEMORY
15764 #$i_stdlib I_STDLIB
15765 #$i_string I_STRING
15766 #$i_unistd I_UNISTD
15767 EOCP
15768         $cat >>try.c <<'EOCP'
15769 #include <stdio.h>
15770 #ifdef I_MEMORY
15771 #  include <memory.h>
15772 #endif
15773 #ifdef I_STDLIB
15774 #  include <stdlib.h>
15775 #endif
15776 #ifdef I_STRING
15777 #  include <string.h>
15778 #else
15779 #  include <strings.h>
15780 #endif
15781 #ifdef I_UNISTD
15782 #  include <unistd.h>  /* Needed for NetBSD */
15783 #endif
15784 int main()
15785 {
15786 char buf[128], abc[128];
15787 char *b;
15788 int len;
15789 int off;
15790 int align;
15791
15792 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15793    try to store the string in read-only memory. */
15794 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15795
15796 for (align = 7; align >= 0; align--) {
15797         for (len = 36; len; len--) {
15798                 b = buf+align;
15799                 memcpy(b, abc, len);
15800                 for (off = 1; off <= len; off++) {
15801                         memcpy(b+off, b, len);
15802                         memcpy(b, b+off, len);
15803                         if (memcmp(b, abc, len))
15804                                 exit(1);
15805                 }
15806         }
15807 }
15808 exit(0);
15809 }
15810 EOCP
15811                 set try
15812                 if eval $compile_ok; then
15813                         if ./try 2>/dev/null; then
15814                                 echo "Yes, it can."
15815                                 val="$define"
15816                         else
15817                                 echo "It can't, sorry."
15818                         fi
15819                 else
15820                         echo "(I can't compile the test program, so we'll assume not...)"
15821                 fi
15822                 ;;
15823         esac
15824         $rm -f try.* try core
15825         ;;
15826 esac
15827 set d_safemcpy
15828 eval $setvar
15829
15830 : can memcmp be trusted to compare relative magnitude?
15831 val="$undef"
15832 case "$d_memcmp" in
15833 "$define")
15834         echo " "
15835         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15836         $cat >try.c <<EOCP
15837 #$i_memory I_MEMORY
15838 #$i_stdlib I_STDLIB
15839 #$i_string I_STRING
15840 #$i_unistd I_UNISTD
15841 EOCP
15842         $cat >>try.c <<'EOCP'
15843 #include <stdio.h>
15844 #ifdef I_MEMORY
15845 #  include <memory.h>
15846 #endif
15847 #ifdef I_STDLIB
15848 #  include <stdlib.h>
15849 #endif
15850 #ifdef I_STRING
15851 #  include <string.h>
15852 #else
15853 #  include <strings.h>
15854 #endif
15855 #ifdef I_UNISTD
15856 #  include <unistd.h>  /* Needed for NetBSD */
15857 #endif
15858 int main()
15859 {
15860 char a = -1;
15861 char b = 0;
15862 if ((a < b) && memcmp(&a, &b, 1) < 0)
15863         exit(1);
15864 exit(0);
15865 }
15866 EOCP
15867         set try
15868         if eval $compile_ok; then
15869                 if $run ./try 2>/dev/null; then
15870                         echo "Yes, it can."
15871                         val="$define"
15872                 else
15873                         echo "No, it can't (it uses signed chars)."
15874                 fi
15875         else
15876                 echo "(I can't compile the test program, so we'll assume not...)"
15877         fi
15878         ;;
15879 esac
15880 $rm -f try.* try core
15881 set d_sanemcmp
15882 eval $setvar
15883
15884 : see if prototype for sbrk is available
15885 echo " "
15886 set d_sbrkproto sbrk $i_unistd unistd.h
15887 eval $hasproto
15888
15889 : see if select exists
15890 set select d_select
15891 eval $inlibc
15892
15893 : see if semctl exists
15894 set semctl d_semctl
15895 eval $inlibc
15896
15897 : see if semget exists
15898 set semget d_semget
15899 eval $inlibc
15900
15901 : see if semop exists
15902 set semop d_semop
15903 eval $inlibc
15904
15905 : see how much of the 'sem*(2)' library is present.
15906 h_sem=true
15907 echo " "
15908 case "$d_semctl$d_semget$d_semop" in
15909 *"$undef"*) h_sem=false;;
15910 esac
15911 case "$osname" in
15912 freebsd)
15913     case "`ipcs 2>&1`" in
15914     "SVID messages"*"not configured"*)
15915         echo "Your $osname does not have the sem*(2) configured." >&4
15916         h_sem=false
15917         val="$undef"
15918         set semctl d_semctl
15919         eval $setvar
15920         set semget d_semget
15921         eval $setvar
15922         set semop d_semop
15923         eval $setvar
15924         ;;
15925     esac
15926     ;;
15927 esac
15928 : we could also check for sys/ipc.h ...
15929 if $h_sem && $test `./findhdr sys/sem.h`; then
15930         echo "You have the full sem*(2) library." >&4
15931         val="$define"
15932 else
15933         echo "You don't have the full sem*(2) library." >&4
15934         val="$undef"
15935 fi
15936 set d_sem
15937 eval $setvar
15938
15939 : see whether sys/sem.h defines union semun
15940 echo " "
15941 $cat > try.c <<'END'
15942 #include <sys/types.h>
15943 #include <sys/ipc.h>
15944 #include <sys/sem.h>
15945 int main () { union semun semun; semun.buf = 0; }
15946 END
15947 set try
15948 if eval $compile; then
15949     echo "You have union semun in <sys/sem.h>." >&4
15950     val="$define"
15951 else
15952     echo "You do not have union semun in <sys/sem.h>." >&4
15953     val="$undef"
15954 fi
15955 $rm -f try try.c
15956 set d_union_semun
15957 eval $setvar
15958
15959 : see how to do semctl IPC_STAT
15960 case "$d_sem" in
15961 $define)
15962     echo " "
15963     $cat > try.h <<END
15964 #ifndef S_IRUSR
15965 #   ifdef S_IREAD
15966 #       define S_IRUSR S_IREAD
15967 #       define S_IWUSR S_IWRITE
15968 #       define S_IXUSR S_IEXEC
15969 #   else
15970 #       define S_IRUSR 0400
15971 #       define S_IWUSR 0200
15972 #       define S_IXUSR 0100
15973 #   endif
15974 #   define S_IRGRP (S_IRUSR>>3)
15975 #   define S_IWGRP (S_IWUSR>>3)
15976 #   define S_IXGRP (S_IXUSR>>3)
15977 #   define S_IROTH (S_IRUSR>>6)
15978 #   define S_IWOTH (S_IWUSR>>6)
15979 #   define S_IXOTH (S_IXUSR>>6)
15980 #endif
15981 #ifndef S_IRWXU
15982 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15983 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15984 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15985 #endif
15986 END
15987     : see whether semctl IPC_STAT can use union semun
15988     case "$d_semctl_semun" in
15989     '')
15990       val="$undef"
15991       $cat > try.c <<END
15992 #include <sys/types.h>
15993 #include <sys/ipc.h>
15994 #include <sys/sem.h>
15995 #include <sys/stat.h>
15996 #include <stdio.h>
15997 #include <errno.h>
15998 #include "try.h"
15999 #ifndef errno
16000 extern int errno;
16001 #endif
16002 #$d_union_semun HAS_UNION_SEMUN
16003 int main() {
16004     union semun
16005 #ifndef HAS_UNION_SEMUN
16006     {
16007         int val;
16008         struct semid_ds *buf;
16009         unsigned short *array;
16010     }
16011 #endif
16012     arg;
16013     int sem, st;
16014
16015 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16016     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16017     if (sem > -1) {
16018         struct semid_ds argbuf;
16019         arg.buf = &argbuf;
16020 #       ifdef IPC_STAT
16021         st = semctl(sem, 0, IPC_STAT, arg);
16022         if (st == 0)
16023             printf("semun\n");
16024         else
16025 #       endif /* IPC_STAT */
16026             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16027 #       ifdef IPC_RMID
16028         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16029 #       endif /* IPC_RMID */
16030             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16031     } else
16032 #endif /* IPC_PRIVATE && ... */
16033         printf("semget failed: errno = %d\n", errno);
16034   return 0;
16035 }
16036 END
16037       set try
16038       if eval $compile; then
16039           xxx=`$run ./try`
16040           case "$xxx" in
16041           semun) val="$define" ;;
16042           esac
16043       fi
16044       $rm -f try try.c
16045       set d_semctl_semun
16046       eval $setvar
16047       ;;
16048     esac
16049     case "$d_semctl_semun" in
16050     $define)
16051         echo "You can use union semun for semctl IPC_STAT." >&4
16052         also='also'
16053         ;;
16054     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16055         also=''
16056         ;;
16057     esac
16058
16059     : see whether semctl IPC_STAT can use struct semid_ds pointer
16060     case "$d_semctl_semid_ds" in
16061     '')
16062       val="$undef"
16063       $cat > try.c <<'END'
16064 #include <sys/types.h>
16065 #include <sys/ipc.h>
16066 #include <sys/sem.h>
16067 #include <sys/stat.h>
16068 #include "try.h"
16069 #include <stdio.h>
16070 #include <errno.h>
16071 #ifndef errno
16072 extern int errno;
16073 #endif
16074 int main() {
16075     struct semid_ds arg;
16076     int sem, st;
16077
16078 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16079     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16080     if (sem > -1) {
16081 #       ifdef IPC_STAT
16082         st = semctl(sem, 0, IPC_STAT, &arg);
16083         if (st == 0)
16084             printf("semid_ds\n");
16085         else
16086 #       endif /* IPC_STAT */
16087             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16088 #       ifdef IPC_RMID
16089         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16090 #       endif /* IPC_RMID */
16091             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16092     } else
16093 #endif /* IPC_PRIVATE && ... */
16094         printf("semget failed: errno = %d\n", errno);
16095
16096     return 0;
16097 }
16098 END
16099       set try
16100       if eval $compile; then
16101           xxx=`$run ./try`
16102           case "$xxx" in
16103           semid_ds) val="$define" ;;
16104           esac
16105       fi
16106       $rm -f try try.c
16107       set d_semctl_semid_ds
16108       eval $setvar
16109       ;;
16110     esac
16111     case "$d_semctl_semid_ds" in
16112     $define)
16113         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16114         ;;
16115     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16116         ;;
16117     esac
16118     $rm -f try.h
16119     ;;
16120 *)  val="$undef"
16121
16122     # We do not have the full sem*(2) library, so assume we can not
16123     # use either.
16124
16125     set d_semctl_semun
16126     eval $setvar
16127
16128     set d_semctl_semid_ds
16129     eval $setvar
16130     ;;
16131 esac
16132
16133 : see if sendmsg exists
16134 set sendmsg d_sendmsg
16135 eval $inlibc
16136
16137 : see if setegid exists
16138 set setegid d_setegid
16139 eval $inlibc
16140
16141 : see if seteuid exists
16142 set seteuid d_seteuid
16143 eval $inlibc
16144
16145 : see if setgrent exists
16146 set setgrent d_setgrent
16147 eval $inlibc
16148
16149 : see if setgrent_r exists
16150 set setgrent_r d_setgrent_r
16151 eval $inlibc
16152 case "$d_setgrent_r" in
16153 "$define")
16154         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16155         case "$d_setgrent_r_proto:$usethreads" in
16156         ":define")      d_setgrent_r_proto=define
16157                 set d_setgrent_r_proto setgrent_r $hdrs
16158                 eval $hasproto ;;
16159         *)      ;;
16160         esac
16161         case "$d_setgrent_r_proto" in
16162         define)
16163         case "$setgrent_r_proto" in
16164         ''|0) try='int setgrent_r(FILE**);'
16165         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16166         esac
16167         case "$setgrent_r_proto" in
16168         ''|0) try='void setgrent_r(FILE**);'
16169         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16170         esac
16171         case "$setgrent_r_proto" in
16172         ''|0)   d_setgrent_r=undef
16173                 setgrent_r_proto=0
16174                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16175         * )     case "$setgrent_r_proto" in
16176                 REENTRANT_PROTO*) ;;
16177                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16178                 esac
16179                 echo "Prototype: $try" ;;
16180         esac
16181         ;;
16182         *)      case "$usethreads" in
16183                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16184                 esac
16185                 d_setgrent_r=undef
16186                 setgrent_r_proto=0
16187                 ;;
16188         esac
16189         ;;
16190 *)      setgrent_r_proto=0
16191         ;;
16192 esac
16193
16194 : see if sethostent exists
16195 set sethostent d_sethent
16196 eval $inlibc
16197
16198 : see if sethostent_r exists
16199 set sethostent_r d_sethostent_r
16200 eval $inlibc
16201 case "$d_sethostent_r" in
16202 "$define")
16203         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16204         case "$d_sethostent_r_proto:$usethreads" in
16205         ":define")      d_sethostent_r_proto=define
16206                 set d_sethostent_r_proto sethostent_r $hdrs
16207                 eval $hasproto ;;
16208         *)      ;;
16209         esac
16210         case "$d_sethostent_r_proto" in
16211         define)
16212         case "$sethostent_r_proto" in
16213         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16214         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16215         esac
16216         case "$sethostent_r_proto" in
16217         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16218         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16219         esac
16220         case "$sethostent_r_proto" in
16221         ''|0)   d_sethostent_r=undef
16222                 sethostent_r_proto=0
16223                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16224         * )     case "$sethostent_r_proto" in
16225                 REENTRANT_PROTO*) ;;
16226                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16227                 esac
16228                 echo "Prototype: $try" ;;
16229         esac
16230         ;;
16231         *)      case "$usethreads" in
16232                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16233                 esac
16234                 d_sethostent_r=undef
16235                 sethostent_r_proto=0
16236                 ;;
16237         esac
16238         ;;
16239 *)      sethostent_r_proto=0
16240         ;;
16241 esac
16242
16243 : see if setitimer exists
16244 set setitimer d_setitimer
16245 eval $inlibc
16246
16247 : see if setlinebuf exists
16248 set setlinebuf d_setlinebuf
16249 eval $inlibc
16250
16251 : see if setlocale exists
16252 set setlocale d_setlocale
16253 eval $inlibc
16254
16255 : see if locale.h is available
16256 set locale.h i_locale
16257 eval $inhdr
16258
16259 : see if setlocale_r exists
16260 set setlocale_r d_setlocale_r
16261 eval $inlibc
16262 case "$d_setlocale_r" in
16263 "$define")
16264         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16265         case "$d_setlocale_r_proto:$usethreads" in
16266         ":define")      d_setlocale_r_proto=define
16267                 set d_setlocale_r_proto setlocale_r $hdrs
16268                 eval $hasproto ;;
16269         *)      ;;
16270         esac
16271         case "$d_setlocale_r_proto" in
16272         define)
16273         case "$setlocale_r_proto" in
16274         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16275         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16276         esac
16277         case "$setlocale_r_proto" in
16278         ''|0)   d_setlocale_r=undef
16279                 setlocale_r_proto=0
16280                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16281         * )     case "$setlocale_r_proto" in
16282                 REENTRANT_PROTO*) ;;
16283                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16284                 esac
16285                 echo "Prototype: $try" ;;
16286         esac
16287         ;;
16288         *)      case "$usethreads" in
16289                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16290                 esac
16291                 d_setlocale_r=undef
16292                 setlocale_r_proto=0
16293                 ;;
16294         esac
16295         ;;
16296 *)      setlocale_r_proto=0
16297         ;;
16298 esac
16299
16300 : see if setnetent exists
16301 set setnetent d_setnent
16302 eval $inlibc
16303
16304 : see if setnetent_r exists
16305 set setnetent_r d_setnetent_r
16306 eval $inlibc
16307 case "$d_setnetent_r" in
16308 "$define")
16309         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16310         case "$d_setnetent_r_proto:$usethreads" in
16311         ":define")      d_setnetent_r_proto=define
16312                 set d_setnetent_r_proto setnetent_r $hdrs
16313                 eval $hasproto ;;
16314         *)      ;;
16315         esac
16316         case "$d_setnetent_r_proto" in
16317         define)
16318         case "$setnetent_r_proto" in
16319         ''|0) try='int setnetent_r(int, struct netent_data*);'
16320         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16321         esac
16322         case "$setnetent_r_proto" in
16323         ''|0) try='void setnetent_r(int, struct netent_data*);'
16324         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16325         esac
16326         case "$setnetent_r_proto" in
16327         ''|0)   d_setnetent_r=undef
16328                 setnetent_r_proto=0
16329                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16330         * )     case "$setnetent_r_proto" in
16331                 REENTRANT_PROTO*) ;;
16332                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16333                 esac
16334                 echo "Prototype: $try" ;;
16335         esac
16336         ;;
16337         *)      case "$usethreads" in
16338                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16339                 esac
16340                 d_setnetent_r=undef
16341                 setnetent_r_proto=0
16342                 ;;
16343         esac
16344         ;;
16345 *)      setnetent_r_proto=0
16346         ;;
16347 esac
16348
16349 : see if setprotoent exists
16350 set setprotoent d_setpent
16351 eval $inlibc
16352
16353 : see if setpgid exists
16354 set setpgid d_setpgid
16355 eval $inlibc
16356
16357 : see if setpgrp2 exists
16358 set setpgrp2 d_setpgrp2
16359 eval $inlibc
16360
16361 : see if setpriority exists
16362 set setpriority d_setprior
16363 eval $inlibc
16364
16365 : see if setproctitle exists
16366 set setproctitle d_setproctitle
16367 eval $inlibc
16368
16369 : see if setprotoent_r exists
16370 set setprotoent_r d_setprotoent_r
16371 eval $inlibc
16372 case "$d_setprotoent_r" in
16373 "$define")
16374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16375         case "$d_setprotoent_r_proto:$usethreads" in
16376         ":define")      d_setprotoent_r_proto=define
16377                 set d_setprotoent_r_proto setprotoent_r $hdrs
16378                 eval $hasproto ;;
16379         *)      ;;
16380         esac
16381         case "$d_setprotoent_r_proto" in
16382         define)
16383         case "$setprotoent_r_proto" in
16384         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16385         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16386         esac
16387         case "$setprotoent_r_proto" in
16388         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16389         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16390         esac
16391         case "$setprotoent_r_proto" in
16392         ''|0)   d_setprotoent_r=undef
16393                 setprotoent_r_proto=0
16394                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16395         * )     case "$setprotoent_r_proto" in
16396                 REENTRANT_PROTO*) ;;
16397                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16398                 esac
16399                 echo "Prototype: $try" ;;
16400         esac
16401         ;;
16402         *)      case "$usethreads" in
16403                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16404                 esac
16405                 d_setprotoent_r=undef
16406                 setprotoent_r_proto=0
16407                 ;;
16408         esac
16409         ;;
16410 *)      setprotoent_r_proto=0
16411         ;;
16412 esac
16413
16414 : see if setpwent exists
16415 set setpwent d_setpwent
16416 eval $inlibc
16417
16418 : see if setpwent_r exists
16419 set setpwent_r d_setpwent_r
16420 eval $inlibc
16421 case "$d_setpwent_r" in
16422 "$define")
16423         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16424         case "$d_setpwent_r_proto:$usethreads" in
16425         ":define")      d_setpwent_r_proto=define
16426                 set d_setpwent_r_proto setpwent_r $hdrs
16427                 eval $hasproto ;;
16428         *)      ;;
16429         esac
16430         case "$d_setpwent_r_proto" in
16431         define)
16432         case "$setpwent_r_proto" in
16433         ''|0) try='int setpwent_r(FILE**);'
16434         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16435         esac
16436         case "$setpwent_r_proto" in
16437         ''|0) try='void setpwent_r(FILE**);'
16438         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16439         esac
16440         case "$setpwent_r_proto" in
16441         ''|0)   d_setpwent_r=undef
16442                 setpwent_r_proto=0
16443                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16444         * )     case "$setpwent_r_proto" in
16445                 REENTRANT_PROTO*) ;;
16446                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16447                 esac
16448                 echo "Prototype: $try" ;;
16449         esac
16450         ;;
16451         *)      case "$usethreads" in
16452                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16453                 esac
16454                 d_setpwent_r=undef
16455                 setpwent_r_proto=0
16456                 ;;
16457         esac
16458         ;;
16459 *)      setpwent_r_proto=0
16460         ;;
16461 esac
16462
16463 : see if setregid exists
16464 set setregid d_setregid
16465 eval $inlibc
16466 set setresgid d_setresgid
16467 eval $inlibc
16468
16469 : see if setreuid exists
16470 set setreuid d_setreuid
16471 eval $inlibc
16472 set setresuid d_setresuid
16473 eval $inlibc
16474
16475 : see if setrgid exists
16476 set setrgid d_setrgid
16477 eval $inlibc
16478
16479 : see if setruid exists
16480 set setruid d_setruid
16481 eval $inlibc
16482
16483 : see if setservent exists
16484 set setservent d_setsent
16485 eval $inlibc
16486
16487 : see if setservent_r exists
16488 set setservent_r d_setservent_r
16489 eval $inlibc
16490 case "$d_setservent_r" in
16491 "$define")
16492         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16493         case "$d_setservent_r_proto:$usethreads" in
16494         ":define")      d_setservent_r_proto=define
16495                 set d_setservent_r_proto setservent_r $hdrs
16496                 eval $hasproto ;;
16497         *)      ;;
16498         esac
16499         case "$d_setservent_r_proto" in
16500         define)
16501         case "$setservent_r_proto" in
16502         ''|0) try='int setservent_r(int, struct servent_data*);'
16503         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16504         esac
16505         case "$setservent_r_proto" in
16506         ''|0) try='void setservent_r(int, struct servent_data*);'
16507         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16508         esac
16509         case "$setservent_r_proto" in
16510         ''|0)   d_setservent_r=undef
16511                 setservent_r_proto=0
16512                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16513         * )     case "$setservent_r_proto" in
16514                 REENTRANT_PROTO*) ;;
16515                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16516                 esac
16517                 echo "Prototype: $try" ;;
16518         esac
16519         ;;
16520         *)      case "$usethreads" in
16521                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16522                 esac
16523                 d_setservent_r=undef
16524                 setservent_r_proto=0
16525                 ;;
16526         esac
16527         ;;
16528 *)      setservent_r_proto=0
16529         ;;
16530 esac
16531
16532 : see if setsid exists
16533 set setsid d_setsid
16534 eval $inlibc
16535
16536 : see if setvbuf exists
16537 set setvbuf d_setvbuf
16538 eval $inlibc
16539
16540 : see if sfio.h is available
16541 set sfio.h i_sfio
16542 eval $inhdr
16543
16544
16545 : see if sfio library is available
16546 case "$i_sfio" in
16547 $define)
16548         val=''
16549         set sfreserve val
16550         eval $inlibc
16551         ;;
16552 *)
16553         val="$undef"
16554         ;;
16555 esac
16556 : Ok, but do we want to use it.
16557 case "$val" in
16558 $define)
16559         case "$usesfio" in
16560         true|$define|[yY]*) dflt='y';;
16561         *) dflt='n';;
16562         esac
16563         echo "$package can use the sfio library, but it is experimental."
16564         case "$useperlio" in
16565         "$undef")
16566             echo "For sfio also the PerlIO abstraction layer is needed."
16567             echo "Earlier you said you wouldn't want that."
16568             ;;
16569         esac
16570         rp="You seem to have sfio available, do you want to try using it?"
16571         . ./myread
16572         case "$ans" in
16573         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16574                 useperlio="$define"
16575                 val="$define"
16576                 ;;
16577         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16578                 val="$undef"
16579                 ;;
16580         esac
16581         ;;
16582 *)      case "$usesfio" in
16583         true|$define|[yY]*)
16584                 echo "Sorry, cannot find sfio on this machine." >&4
16585                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16586                 val="$undef"
16587                 ;;
16588         esac
16589         ;;
16590 esac
16591 set d_sfio
16592 eval $setvar
16593 case "$d_sfio" in
16594 $define) usesfio='true';;
16595 *) usesfio='false';;
16596 esac
16597 case "$d_sfio" in
16598 $define) ;;
16599 *)      : Remove sfio from list of libraries to use
16600         case "$libs" in
16601         *-lsfio*)
16602                 echo "Removing unneeded -lsfio from library list" >&4
16603                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16604                 shift
16605                 libs="$*"
16606                 echo "libs = $libs" >&4
16607                 ;;
16608         esac
16609 ;;
16610 esac
16611
16612
16613 : see if shmctl exists
16614 set shmctl d_shmctl
16615 eval $inlibc
16616
16617 : see if shmget exists
16618 set shmget d_shmget
16619 eval $inlibc
16620
16621 : see if shmat exists
16622 set shmat d_shmat
16623 eval $inlibc
16624 : see what shmat returns
16625 case "$d_shmat" in
16626 "$define")
16627         $cat >shmat.c <<'END'
16628 #include <sys/shm.h>
16629 void *shmat();
16630 END
16631         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16632                 shmattype='void *'
16633         else
16634                 shmattype='char *'
16635         fi
16636         echo "and it returns ($shmattype)." >&4
16637         : see if a prototype for shmat is available
16638         xxx=`./findhdr sys/shm.h`
16639         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16640         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16641                 val="$define"
16642         else
16643                 val="$undef"
16644         fi
16645         $rm -f shmat.[co]
16646         ;;
16647 *)
16648         val="$undef"
16649         ;;
16650 esac
16651 set d_shmatprototype
16652 eval $setvar
16653
16654 : see if shmdt exists
16655 set shmdt d_shmdt
16656 eval $inlibc
16657
16658 : see how much of the 'shm*(2)' library is present.
16659 h_shm=true
16660 echo " "
16661 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16662 *"$undef"*) h_shm=false;;
16663 esac
16664 case "$osname" in
16665 freebsd)
16666     case "`ipcs 2>&1`" in
16667     "SVID shared memory"*"not configured"*)
16668         echo "Your $osname does not have the shm*(2) configured." >&4
16669         h_shm=false
16670         val="$undef"
16671         set shmctl d_shmctl
16672         evat $setvar
16673         set shmget d_shmget
16674         evat $setvar
16675         set shmat d_shmat
16676         evat $setvar
16677         set shmdt d_shmdt
16678         evat $setvar
16679         ;;
16680     esac
16681     ;;
16682 esac
16683 : we could also check for sys/ipc.h ...
16684 if $h_shm && $test `./findhdr sys/shm.h`; then
16685         echo "You have the full shm*(2) library." >&4
16686         val="$define"
16687 else
16688         echo "You don't have the full shm*(2) library." >&4
16689         val="$undef"
16690 fi
16691 set d_shm
16692 eval $setvar
16693
16694 echo " "
16695 : see if we have sigaction
16696 if set sigaction val -f d_sigaction; eval $csym; $val; then
16697         echo 'sigaction() found.' >&4
16698         $cat > try.c <<EOP
16699 #include <stdio.h>
16700 #include <sys/types.h>
16701 #include <signal.h>
16702 #$i_stdlib I_STDLIB
16703 #ifdef I_STDLIB
16704 #include <stdlib.h>
16705 #endif
16706 int main()
16707 {
16708     struct sigaction act, oact;
16709     act.sa_flags = 0;
16710     oact.sa_handler = 0;
16711     /* so that act and oact are used */
16712     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16713 }
16714 EOP
16715         set try
16716         if eval $compile_ok; then
16717                 val="$define"
16718         else
16719                 echo "But you don't seem to have a useable struct sigaction." >&4
16720                 val="$undef"
16721         fi
16722 else
16723         echo 'sigaction NOT found.' >&4
16724         val="$undef"
16725 fi
16726 set d_sigaction; eval $setvar
16727 $rm -f try try$_o try.c
16728
16729 : see if sigprocmask exists
16730 set sigprocmask d_sigprocmask
16731 eval $inlibc
16732
16733 : see if sigsetjmp exists
16734 echo " "
16735 case "$d_sigsetjmp" in
16736 '')
16737         $cat >try.c <<EOP
16738 #include <setjmp.h>
16739 #$i_stdlib I_STDLIB
16740 #ifdef I_STDLIB
16741 #include <stdlib.h>
16742 #endif
16743 sigjmp_buf env;
16744 int set = 1;
16745 int main()
16746 {
16747         if (sigsetjmp(env,1))
16748                 exit(set);
16749         set = 0;
16750         siglongjmp(env, 1);
16751         exit(1);
16752 }
16753 EOP
16754         set try
16755         if eval $compile; then
16756                 if $run ./try >/dev/null 2>&1; then
16757                         echo "POSIX sigsetjmp found." >&4
16758                         val="$define"
16759                 else
16760                         $cat >&4 <<EOM
16761 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16762 I'll ignore them.
16763 EOM
16764                         val="$undef"
16765                 fi
16766         else
16767                 echo "sigsetjmp not found." >&4
16768                 val="$undef"
16769         fi
16770         ;;
16771 *) val="$d_sigsetjmp"
16772         case "$d_sigsetjmp" in
16773         $define) echo "POSIX sigsetjmp found." >&4;;
16774         $undef) echo "sigsetjmp not found." >&4;;
16775         esac
16776         ;;
16777 esac
16778 set d_sigsetjmp
16779 eval $setvar
16780 $rm -f try.c try
16781
16782 : see if snprintf exists
16783 set snprintf d_snprintf
16784 eval $inlibc
16785
16786 : see if vsnprintf exists
16787 set vsnprintf d_vsnprintf
16788 eval $inlibc
16789
16790 case "$d_snprintf-$d_vsnprintf" in
16791 "$define-$define")
16792     $cat <<EOM
16793 Checking whether your snprintf() and vsnprintf() work okay...
16794 EOM
16795     $cat >try.c <<'EOCP'
16796 /* v?snprintf testing logic courtesy of Russ Allbery.
16797  * According to C99:
16798  * - if the buffer is too short it still must be \0-terminated
16799  * - if the buffer is too short the potentially required length
16800  *   must be returned and not -1
16801  * - if the buffer is NULL the potentially required length
16802  *   must be returned and not -1 or core dump
16803  */
16804 #include <stdio.h>
16805 #include <stdarg.h>
16806
16807 char buf[2];
16808
16809 int test (char *format, ...)
16810 {
16811     va_list args;
16812     int count;
16813
16814     va_start (args, format);
16815     count = vsnprintf (buf, sizeof buf, format, args);
16816     va_end (args);
16817     return count;
16818 }
16819
16820 int main ()
16821 {
16822     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16823              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16824 }
16825 EOCP
16826     set try
16827     if eval $compile; then
16828         `$run ./try`
16829         case "$?" in
16830         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16831         *) cat <<EOM >&4
16832 Your snprintf() and snprintf() don't seem to be working okay.
16833 EOM
16834            d_snprintf="$undef"
16835            d_vsnprintf="$undef"
16836            ;;
16837         esac
16838     else
16839         echo "(I can't seem to compile the test program--assuming they don't)"
16840         d_snprintf="$undef"
16841         d_vsnprintf="$undef"
16842     fi
16843     $rm -f try.* try core core.try.*
16844     ;;
16845 esac
16846
16847 : see if sockatmark exists
16848 set sockatmark d_sockatmark
16849 eval $inlibc
16850
16851 : see if prototype for sockatmark is available
16852 echo " "
16853 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16854 eval $hasproto
16855
16856 : see if socks5_init exists
16857 set socks5_init d_socks5_init
16858 eval $inlibc
16859
16860 : see if sprintf returns the length of the string in the buffer as per ANSI
16861 $echo "Checking whether sprintf returns the length of the string..." >&4
16862 $cat <<EOP >try.c
16863 #include <stdio.h>
16864 #$i_stdlib I_STDLIB
16865 #ifdef I_STDLIB
16866 #include <stdlib.h>
16867 #endif
16868 #$i_string I_STRING
16869 #ifdef I_STRING
16870 #  include <string.h>
16871 #else
16872 #  include <strings.h>
16873 #endif
16874 #$i_math I_MATH
16875 #ifdef I_MATH
16876 #include <math.h>
16877 #endif
16878
16879 char buffer[256];
16880
16881 int check (size_t expect, int test) {
16882   size_t got = strlen(buffer);
16883   if (expect == got)
16884     return 0;
16885
16886   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16887        test, buffer);
16888   exit (test);
16889 }
16890
16891 int main(int argc, char **argv) {
16892   int test = 0;
16893
16894   check(sprintf(buffer, ""), ++test);
16895   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16896   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16897
16898   return 0;
16899 }
16900 EOP
16901 set try
16902
16903 d_sprintf_returns_strlen="$undef"
16904 if eval $compile; then
16905     xxx="`$run ./try`"
16906     case "$?" in
16907         0) cat >&4 <<EOM
16908 sprintf returns the length of the string (as ANSI says it should)
16909 EOM
16910         d_sprintf_returns_strlen="$define"
16911         ;;
16912         *) cat >&4 <<EOM
16913 sprintf does not return the length of the string (how old is this system?)
16914 EOM
16915         d_sprintf_returns_strlen="$undef"
16916         ;;
16917     esac
16918 fi
16919
16920 $rm -f try.* try
16921
16922 : see if srand48_r exists
16923 set srand48_r d_srand48_r
16924 eval $inlibc
16925 case "$d_srand48_r" in
16926 "$define")
16927         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16928         case "$d_srand48_r_proto:$usethreads" in
16929         ":define")      d_srand48_r_proto=define
16930                 set d_srand48_r_proto srand48_r $hdrs
16931                 eval $hasproto ;;
16932         *)      ;;
16933         esac
16934         case "$d_srand48_r_proto" in
16935         define)
16936         case "$srand48_r_proto" in
16937         ''|0) try='int srand48_r(long, struct drand48_data*);'
16938         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16939         esac
16940         case "$srand48_r_proto" in
16941         ''|0)   d_srand48_r=undef
16942                 srand48_r_proto=0
16943                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16944         * )     case "$srand48_r_proto" in
16945                 REENTRANT_PROTO*) ;;
16946                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16947                 esac
16948                 echo "Prototype: $try" ;;
16949         esac
16950         ;;
16951         *)      case "$usethreads" in
16952                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16953                 esac
16954                 d_srand48_r=undef
16955                 srand48_r_proto=0
16956                 ;;
16957         esac
16958         ;;
16959 *)      srand48_r_proto=0
16960         ;;
16961 esac
16962
16963 : see if srandom_r exists
16964 set srandom_r d_srandom_r
16965 eval $inlibc
16966 case "$d_srandom_r" in
16967 "$define")
16968         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16969         case "$d_srandom_r_proto:$usethreads" in
16970         ":define")      d_srandom_r_proto=define
16971                 set d_srandom_r_proto srandom_r $hdrs
16972                 eval $hasproto ;;
16973         *)      ;;
16974         esac
16975         case "$d_srandom_r_proto" in
16976         define)
16977         case "$srandom_r_proto" in
16978         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16979         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16980         esac
16981         case "$srandom_r_proto" in
16982         ''|0)   d_srandom_r=undef
16983                 srandom_r_proto=0
16984                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16985         * )     case "$srandom_r_proto" in
16986                 REENTRANT_PROTO*) ;;
16987                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16988                 esac
16989                 echo "Prototype: $try" ;;
16990         esac
16991         ;;
16992         *)      case "$usethreads" in
16993                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16994                 esac
16995                 d_srandom_r=undef
16996                 srandom_r_proto=0
16997                 ;;
16998         esac
16999         ;;
17000 *)      srandom_r_proto=0
17001         ;;
17002 esac
17003
17004 : see if prototype for setresgid is available
17005 echo " "
17006 set d_sresgproto setresgid $i_unistd unistd.h
17007 eval $hasproto
17008
17009 : see if prototype for setresuid is available
17010 echo " "
17011 set d_sresuproto setresuid $i_unistd unistd.h
17012 eval $hasproto
17013
17014 : see if sys/stat.h is available
17015 set sys/stat.h i_sysstat
17016 eval $inhdr
17017
17018
17019 : see if stat knows about block sizes
17020 echo " "
17021 echo "Checking to see if your struct stat has st_blocks field..." >&4
17022 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17023 eval $hasfield
17024
17025
17026 : see if this is a sys/vfs.h system
17027 set sys/vfs.h i_sysvfs
17028 eval $inhdr
17029
17030
17031 : see if this is a sys/statfs.h system
17032 set sys/statfs.h i_sysstatfs
17033 eval $inhdr
17034
17035
17036 echo " "
17037 echo "Checking to see if your system supports struct statfs..." >&4
17038 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
17039 eval $hasstruct
17040 case "$d_statfs_s" in
17041 "$define")      echo "Yes, it does."   ;;
17042 *)              echo "No, it doesn't." ;;
17043 esac
17044
17045
17046
17047 : see if struct statfs knows about f_flags
17048 case "$d_statfs_s" in
17049 define) 
17050         echo " "
17051         echo "Checking to see if your struct statfs has f_flags field..." >&4
17052         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
17053         eval $hasfield
17054         ;;
17055 *)      val="$undef"
17056         set d_statfs_f_flags
17057         eval $setvar
17058         ;;
17059 esac
17060 case "$d_statfs_f_flags" in
17061 "$define")      echo "Yes, it does."   ;;
17062 *)              echo "No, it doesn't." ;;
17063 esac
17064
17065 $cat >&4 <<EOM
17066 Checking how to access stdio streams by file descriptor number...
17067 EOM
17068 case "$stdio_stream_array" in
17069 '')     $cat >try.c <<EOCP
17070 #include <stdio.h>
17071 int main() {
17072   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17073     printf("yes\n");
17074 }
17075 EOCP
17076         for s in _iob __iob __sF
17077         do
17078                 set try -DSTDIO_STREAM_ARRAY=$s
17079                 if eval $compile; then
17080                         case "`$run ./try`" in
17081                         yes)    stdio_stream_array=$s; break ;;
17082                         esac
17083                 fi
17084         done
17085         $rm -f try.* try$exe_ext
17086 esac
17087 case "$stdio_stream_array" in
17088 '')     $cat >&4 <<EOM
17089 I can't figure out how to access stdio streams by file descriptor number.
17090 EOM
17091         d_stdio_stream_array="$undef"
17092         ;;
17093 *)      $cat >&4 <<EOM
17094 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17095 EOM
17096         d_stdio_stream_array="$define"
17097         ;;
17098 esac
17099
17100 : see if strcoll exists
17101 set strcoll d_strcoll
17102 eval $inlibc
17103
17104 : check for structure copying
17105 echo " "
17106 echo "Checking to see if your C compiler can copy structs..." >&4
17107 $cat >try.c <<'EOCP'
17108 int main()
17109 {
17110         struct blurfl {
17111                 int dyick;
17112         } foo, bar;
17113
17114         foo = bar;
17115 }
17116 EOCP
17117 if $cc -c try.c >/dev/null 2>&1 ; then
17118         val="$define"
17119         echo "Yup, it can."
17120 else
17121         val="$undef"
17122         echo "Nope, it can't."
17123 fi
17124 set d_strctcpy
17125 eval $setvar
17126 $rm -f try.*
17127
17128 : see if strerror and/or sys_errlist[] exist
17129 echo " "
17130 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17131     if set strerror val -f d_strerror; eval $csym; $val; then
17132                 echo 'strerror() found.' >&4
17133                 d_strerror="$define"
17134                 d_strerrm='strerror(e)'
17135                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17136                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17137                         d_syserrlst="$define"
17138                 else
17139                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17140                         d_syserrlst="$undef"
17141                 fi
17142     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17143                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17144                 echo 'strerror() found in string header.' >&4
17145                 d_strerror="$define"
17146                 d_strerrm='strerror(e)'
17147                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17148                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17149                                 d_syserrlst="$define"
17150                 else
17151                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17152                         d_syserrlst="$undef"
17153                 fi
17154     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17155                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17156                 d_strerror="$undef"
17157                 d_syserrlst="$define"
17158                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17159     else
17160                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17161                 d_strerror="$undef"
17162                 d_syserrlst="$undef"
17163                 d_strerrm='"unknown"'
17164     fi
17165 fi
17166
17167 : see if strerror_r exists
17168 set strerror_r d_strerror_r
17169 eval $inlibc
17170 case "$d_strerror_r" in
17171 "$define")
17172         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17173         case "$d_strerror_r_proto:$usethreads" in
17174         ":define")      d_strerror_r_proto=define
17175                 set d_strerror_r_proto strerror_r $hdrs
17176                 eval $hasproto ;;
17177         *)      ;;
17178         esac
17179         case "$d_strerror_r_proto" in
17180         define)
17181         case "$strerror_r_proto" in
17182         ''|0) try='int strerror_r(int, char*, size_t);'
17183         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17184         esac
17185         case "$strerror_r_proto" in
17186         ''|0) try='int strerror_r(int, char*, int);'
17187         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17188         esac
17189         case "$strerror_r_proto" in
17190         ''|0) try='char* strerror_r(int, char*, size_t);'
17191         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17192         esac
17193         case "$strerror_r_proto" in
17194         ''|0)   d_strerror_r=undef
17195                 strerror_r_proto=0
17196                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17197         * )     case "$strerror_r_proto" in
17198                 REENTRANT_PROTO*) ;;
17199                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17200                 esac
17201                 echo "Prototype: $try" ;;
17202         esac
17203         ;;
17204         *)      case "$usethreads" in
17205                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17206                 esac
17207                 d_strerror_r=undef
17208                 strerror_r_proto=0
17209                 ;;
17210         esac
17211         ;;
17212 *)      strerror_r_proto=0
17213         ;;
17214 esac
17215
17216 : see if strftime exists
17217 set strftime d_strftime
17218 eval $inlibc
17219
17220 : see if strlcat exists
17221 set strlcat d_strlcat
17222 eval $inlibc
17223
17224 : see if strlcpy exists
17225 set strlcpy d_strlcpy
17226 eval $inlibc
17227
17228 : see if strtod exists
17229 set strtod d_strtod
17230 eval $inlibc
17231
17232 : see if strtol exists
17233 set strtol d_strtol
17234 eval $inlibc
17235
17236 : see if strtold exists
17237 set strtold d_strtold
17238 eval $inlibc
17239
17240 : see if strtoll exists
17241 set strtoll d_strtoll
17242 eval $inlibc
17243
17244 case "$d_longlong-$d_strtoll" in
17245 "$define-$define")
17246         $cat <<EOM
17247 Checking whether your strtoll() works okay...
17248 EOM
17249         $cat >try.c <<'EOCP'
17250 #include <errno.h>
17251 #ifdef __hpux
17252 #define strtoll __strtoll
17253 #endif
17254 #ifdef __EMX__
17255 #define strtoll _strtoll
17256 #endif
17257 #include <stdio.h>
17258 extern long long int strtoll(char *s, char **, int); 
17259 static int bad = 0;
17260 int check(char *s, long long ell, int een) {
17261         long long gll;
17262         errno = 0;
17263         gll = strtoll(s, 0, 10);
17264         if (!((gll == ell) && (errno == een)))
17265                 bad++;
17266 }
17267 int main() {
17268         check(" 1",                                      1LL, 0);
17269         check(" 0",                                      0LL, 0);
17270         check("-1",                                     -1LL, 0);
17271         check("-9223372036854775808", -9223372036854775808LL, 0);
17272         check("-9223372036854775808", -9223372036854775808LL, 0);
17273         check(" 9223372036854775807",  9223372036854775807LL, 0);
17274         check("-9223372036854775808", -9223372036854775808LL, 0);
17275         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17276         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17277         if (!bad)
17278                 printf("ok\n");
17279 }
17280 EOCP
17281         set try
17282         if eval $compile; then
17283                 yyy=`$run ./try`
17284                 case "$yyy" in
17285                 ok) echo "Your strtoll() seems to be working okay." ;;
17286                 *) cat <<EOM >&4
17287 Your strtoll() doesn't seem to be working okay.
17288 EOM
17289                    d_strtoll="$undef"
17290                    ;;
17291                 esac
17292         else
17293                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17294                 d_strtoll="$undef"
17295         fi
17296         ;;
17297 esac
17298
17299 : see if strtoq exists
17300 set strtoq d_strtoq
17301 eval $inlibc
17302
17303 : see if strtoul exists
17304 set strtoul d_strtoul
17305 eval $inlibc
17306
17307 case "$d_strtoul" in
17308 "$define")
17309         $cat <<EOM
17310 Checking whether your strtoul() works okay...
17311 EOM
17312         $cat >try.c <<'EOCP'
17313 #include <errno.h>
17314 #include <stdio.h>
17315 extern unsigned long int strtoul(char *s, char **, int); 
17316 static int bad = 0;
17317 void check(char *s, unsigned long eul, int een) {
17318         unsigned long gul;
17319         errno = 0;
17320         gul = strtoul(s, 0, 10);
17321         if (!((gul == eul) && (errno == een)))
17322                 bad++;
17323 }
17324 int main() {
17325         check(" 1", 1L, 0);
17326         check(" 0", 0L, 0);
17327 EOCP
17328         case "$longsize" in
17329         8)
17330             $cat >>try.c <<'EOCP'
17331         check("18446744073709551615", 18446744073709551615UL, 0);
17332         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17333 #if 0 /* strtoul() for /^-/ strings is undefined. */
17334         check("-1", 18446744073709551615UL, 0);
17335         check("-18446744073709551614", 2, 0);
17336         check("-18446744073709551615", 1, 0);
17337         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17338         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17339 #endif
17340 EOCP
17341                 ;;
17342         4)
17343                     $cat >>try.c <<'EOCP'
17344         check("4294967295", 4294967295UL, 0);
17345         check("4294967296", 4294967295UL, ERANGE);
17346 #if 0 /* strtoul() for /^-/ strings is undefined. */
17347         check("-1", 4294967295UL, 0);
17348         check("-4294967294", 2, 0);
17349         check("-4294967295", 1, 0);
17350         check("-4294967296", 4294967295UL, ERANGE);
17351         check("-4294967297", 4294967295UL, ERANGE);
17352 #endif
17353 EOCP
17354                 ;;
17355         *)
17356 : Should we write these tests to be more portable by sprintf-ing
17357 : ~0 and then manipulating that char string as input for strtol?
17358                 ;;
17359         esac
17360         $cat >>try.c <<'EOCP'
17361         if (!bad)
17362                 printf("ok\n");
17363         return 0;
17364 }
17365 EOCP
17366         set try
17367         if eval $compile; then
17368                 case "`$run ./try`" in
17369                 ok) echo "Your strtoul() seems to be working okay." ;;
17370                 *) cat <<EOM >&4
17371 Your strtoul() doesn't seem to be working okay.
17372 EOM
17373                    d_strtoul="$undef"
17374                    ;;
17375                 esac
17376         fi
17377         ;;
17378 esac
17379
17380 : see if strtoull exists
17381 set strtoull d_strtoull
17382 eval $inlibc
17383
17384 case "$d_longlong-$d_strtoull" in
17385 "$define-$define")
17386         $cat <<EOM
17387 Checking whether your strtoull() works okay...
17388 EOM
17389         $cat >try.c <<'EOCP'
17390 #include <errno.h>
17391 #ifdef __hpux
17392 #define strtoull __strtoull
17393 #endif
17394 #include <stdio.h>
17395 extern unsigned long long int strtoull(char *s, char **, int); 
17396 static int bad = 0;
17397 int check(char *s, long long eull, int een) {
17398         long long gull;
17399         errno = 0;
17400         gull = strtoull(s, 0, 10);
17401         if (!((gull == eull) && (errno == een)))
17402                 bad++;
17403 }
17404 int main() {
17405         check(" 1",                                        1LL, 0);
17406         check(" 0",                                        0LL, 0);
17407         check("18446744073709551615",  18446744073709551615ULL, 0);
17408         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17409 #if 0 /* strtoull() for /^-/ strings is undefined. */
17410         check("-1",                    18446744073709551615ULL, 0);
17411         check("-18446744073709551614",                     2LL, 0);
17412         check("-18446744073709551615",                     1LL, 0);
17413         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17414         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17415 #endif
17416         if (!bad)
17417                 printf("ok\n");
17418 }
17419 EOCP
17420         set try
17421         if eval $compile; then
17422                 case "`$run ./try`" in
17423                 ok) echo "Your strtoull() seems to be working okay." ;;
17424                 *) cat <<EOM >&4
17425 Your strtoull() doesn't seem to be working okay.
17426 EOM
17427                    d_strtoull="$undef"
17428                    ;;
17429                 esac
17430         fi
17431         ;;
17432 esac
17433
17434 : see if strtouq exists
17435 set strtouq d_strtouq
17436 eval $inlibc
17437
17438 case "$d_strtouq" in
17439 "$define")
17440         $cat <<EOM
17441 Checking whether your strtouq() works okay...
17442 EOM
17443         $cat >try.c <<'EOCP'
17444 #include <errno.h>
17445 #include <stdio.h>
17446 extern unsigned long long int strtouq(char *s, char **, int); 
17447 static int bad = 0;
17448 void check(char *s, unsigned long long eull, int een) {
17449         unsigned long long gull;
17450         errno = 0;
17451         gull = strtouq(s, 0, 10);
17452         if (!((gull == eull) && (errno == een)))
17453                 bad++;
17454 }
17455 int main() {
17456         check(" 1",                                        1LL, 0);
17457         check(" 0",                                        0LL, 0);
17458         check("18446744073709551615",  18446744073709551615ULL, 0);
17459         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17460 #if 0 /* strtouq() for /^-/ strings is undefined. */
17461         check("-1",                    18446744073709551615ULL, 0);
17462         check("-18446744073709551614",                     2LL, 0);
17463         check("-18446744073709551615",                     1LL, 0);
17464         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17465         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17466 #endif
17467         if (!bad)
17468                 printf("ok\n");
17469         return 0;
17470 }
17471 EOCP
17472         set try
17473         if eval $compile; then
17474                 case "`$run ./try`" in
17475                 ok) echo "Your strtouq() seems to be working okay." ;;
17476                 *) cat <<EOM >&4
17477 Your strtouq() doesn't seem to be working okay.
17478 EOM
17479                    d_strtouq="$undef"
17480                    ;;
17481                 esac
17482         fi
17483         ;;
17484 esac
17485
17486 : see if strxfrm exists
17487 set strxfrm d_strxfrm
17488 eval $inlibc
17489
17490 : see if symlink exists
17491 set symlink d_symlink
17492 eval $inlibc
17493
17494 : see if syscall exists
17495 set syscall d_syscall
17496 eval $inlibc
17497
17498 : see if prototype for syscall is available
17499 echo " "
17500 set d_syscallproto syscall $i_unistd unistd.h
17501 eval $hasproto
17502
17503 : see if sysconf exists
17504 set sysconf d_sysconf
17505 eval $inlibc
17506
17507 : see if system exists
17508 set system d_system
17509 eval $inlibc
17510
17511 : see if tcgetpgrp exists
17512 set tcgetpgrp d_tcgetpgrp
17513 eval $inlibc
17514
17515 : see if tcsetpgrp exists
17516 set tcsetpgrp d_tcsetpgrp
17517 eval $inlibc
17518
17519 : see if prototype for telldir is available
17520 echo " "
17521 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17522 eval $hasproto
17523
17524 : see if time exists
17525 echo " "
17526 if test "X$d_time" = X -o X"$timetype" = X; then
17527     if set time val -f d_time; eval $csym; $val; then
17528                 echo 'time() found.' >&4
17529                 val="$define"
17530                 rp="What is the type returned by time() on this system?"
17531                 set time_t timetype long stdio.h sys/types.h
17532                 eval $typedef_ask
17533     else
17534                 echo 'time() not found, hope that will do.' >&4
17535                 val="$undef"
17536                 timetype='int';
17537     fi
17538     set d_time
17539     eval $setvar
17540 fi
17541
17542 : see if this is a sys/times.h system
17543 set sys/times.h i_systimes
17544 eval $inhdr
17545
17546 : see if times exists
17547 echo " "
17548 if set times val -f d_times; eval $csym; $val; then
17549         echo 'times() found.' >&4
17550         d_times="$define"
17551         inc=''
17552         case "$i_systimes" in
17553         "$define") inc='sys/times.h';;
17554         esac
17555         rp="What is the type returned by times() on this system?"
17556         set clock_t clocktype long stdio.h sys/types.h $inc
17557         eval $typedef_ask
17558 else
17559         echo 'times() NOT found, hope that will do.' >&4
17560         d_times="$undef"
17561         clocktype='int'
17562 fi
17563
17564 : see if tmpnam_r exists
17565 set tmpnam_r d_tmpnam_r
17566 eval $inlibc
17567 case "$d_tmpnam_r" in
17568 "$define")
17569         hdrs="$i_systypes sys/types.h define stdio.h "
17570         case "$d_tmpnam_r_proto:$usethreads" in
17571         ":define")      d_tmpnam_r_proto=define
17572                 set d_tmpnam_r_proto tmpnam_r $hdrs
17573                 eval $hasproto ;;
17574         *)      ;;
17575         esac
17576         case "$d_tmpnam_r_proto" in
17577         define)
17578         case "$tmpnam_r_proto" in
17579         ''|0) try='char* tmpnam_r(char*);'
17580         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17581         esac
17582         case "$tmpnam_r_proto" in
17583         ''|0)   d_tmpnam_r=undef
17584                 tmpnam_r_proto=0
17585                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17586         * )     case "$tmpnam_r_proto" in
17587                 REENTRANT_PROTO*) ;;
17588                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17589                 esac
17590                 echo "Prototype: $try" ;;
17591         esac
17592         ;;
17593         *)      case "$usethreads" in
17594                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17595                 esac
17596                 d_tmpnam_r=undef
17597                 tmpnam_r_proto=0
17598                 ;;
17599         esac
17600         ;;
17601 *)      tmpnam_r_proto=0
17602         ;;
17603 esac
17604
17605 : see if truncate exists
17606 set truncate d_truncate
17607 eval $inlibc
17608
17609 : see if ttyname_r exists
17610 set ttyname_r d_ttyname_r
17611 eval $inlibc
17612 case "$d_ttyname_r" in
17613 "$define")
17614         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17615         case "$d_ttyname_r_proto:$usethreads" in
17616         ":define")      d_ttyname_r_proto=define
17617                 set d_ttyname_r_proto ttyname_r $hdrs
17618                 eval $hasproto ;;
17619         *)      ;;
17620         esac
17621         case "$d_ttyname_r_proto" in
17622         define)
17623         case "$ttyname_r_proto" in
17624         ''|0) try='int ttyname_r(int, char*, size_t);'
17625         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17626         esac
17627         case "$ttyname_r_proto" in
17628         ''|0) try='int ttyname_r(int, char*, int);'
17629         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17630         esac
17631         case "$ttyname_r_proto" in
17632         ''|0) try='char* ttyname_r(int, char*, int);'
17633         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17634         esac
17635         case "$ttyname_r_proto" in
17636         ''|0)   d_ttyname_r=undef
17637                 ttyname_r_proto=0
17638                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17639         * )     case "$ttyname_r_proto" in
17640                 REENTRANT_PROTO*) ;;
17641                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17642                 esac
17643                 echo "Prototype: $try" ;;
17644         esac
17645         ;;
17646         *)      case "$usethreads" in
17647                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17648                 esac
17649                 d_ttyname_r=undef
17650                 ttyname_r_proto=0
17651                 ;;
17652         esac
17653         ;;
17654 *)      ttyname_r_proto=0
17655         ;;
17656 esac
17657
17658 : see if tzname[] exists
17659 echo " "
17660 if set tzname val -a d_tzname; eval $csym; $val; then
17661         val="$define"
17662         echo 'tzname[] found.' >&4
17663 else
17664         val="$undef"
17665         echo 'tzname[] NOT found.' >&4
17666 fi
17667 set d_tzname
17668 eval $setvar
17669
17670 case "$osname" in
17671 next|rhapsody|darwin) multiarch="$define" ;;
17672 esac
17673 case "$multiarch" in
17674 ''|[nN]*) multiarch="$undef" ;;
17675 esac
17676
17677 : check for ordering of bytes in a UV
17678 echo " "
17679 case "$usecrosscompile$multiarch" in
17680 *$define*)
17681         $cat <<EOM
17682 You seem to be either cross-compiling or doing a multiarchitecture build,
17683 skipping the byteorder check.
17684
17685 EOM
17686         byteorder='ffff'
17687         ;;
17688 *)
17689         case "$byteorder" in
17690         '')
17691                 $cat <<'EOM'
17692 In the following, larger digits indicate more significance.  A big-endian
17693 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17694 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17695 machines may have weird orders like 3412.  A Cray will report 87654321,
17696 an Alpha will report 12345678. If the test program works the default is
17697 probably right.
17698 I'm now running the test program...
17699 EOM
17700                 $cat >try.c <<EOCP
17701 #include <stdio.h>
17702 #$i_stdlib I_STDLIB
17703 #ifdef I_STDLIB
17704 #include <stdlib.h>
17705 #endif
17706 #include <sys/types.h>
17707 typedef $uvtype UV;
17708 int main()
17709 {
17710         int i;
17711         union {
17712                 UV l;
17713                 char c[$uvsize];
17714         } u;
17715
17716         if ($uvsize > 4)
17717                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17718         else
17719                 u.l = (UV)0x04030201;
17720         for (i = 0; i < $uvsize; i++)
17721                 printf("%c", u.c[i]+'0');
17722         printf("\n");
17723         exit(0);
17724 }
17725 EOCP
17726                 xxx_prompt=y
17727                 set try
17728                 if eval $compile && ./try > /dev/null; then
17729                         dflt=`$run ./try`
17730                         case "$dflt" in
17731                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17732                                 echo "(The test program ran ok.)"
17733                                 echo "byteorder=$dflt"
17734                                 xxx_prompt=n
17735                         ;;
17736                         ????|????????) echo "(The test program ran ok.)" ;;
17737                         *) echo "(The test program didn't run right for some reason.)" ;;
17738                         esac
17739                 else
17740                         dflt='4321'
17741                         cat <<'EOM'
17742 (I can't seem to compile the test program.  Guessing big-endian...)
17743 EOM
17744                 fi
17745                 case "$xxx_prompt" in
17746                 y)
17747                         rp="What is the order of bytes in $uvtype?"
17748                         . ./myread
17749                         byteorder="$ans"
17750                         ;;
17751                 *)      byteorder=$dflt
17752                         ;;
17753                 esac
17754                 ;;
17755         esac
17756         $rm -f try.c try
17757         ;;
17758 esac
17759
17760
17761 $cat <<EOM
17762
17763 Checking to see whether you can access character data unalignedly...
17764 EOM
17765 case "$d_u32align" in
17766 '')   $cat >try.c <<EOCP
17767 #include <stdio.h>
17768 #$i_stdlib I_STDLIB
17769 #ifdef I_STDLIB
17770 #include <stdlib.h>
17771 #endif
17772 #define U32 $u32type
17773 #define BYTEORDER 0x$byteorder
17774 #define U8 $u8type
17775 #include <signal.h>
17776 #ifdef SIGBUS
17777 $signal_t bletch(int s) { exit(4); }
17778 #endif
17779 int main() {
17780 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17781     U8 buf[8];
17782     U32 *up;
17783     int i;
17784
17785     if (sizeof(U32) != 4) {
17786         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17787         exit(1);
17788     }
17789
17790     fflush(stdout);
17791
17792 #ifdef SIGBUS
17793     signal(SIGBUS, bletch);
17794 #endif
17795
17796     buf[0] = 0;
17797     buf[1] = 0;
17798     buf[2] = 0;
17799     buf[3] = 1;
17800     buf[4] = 0;
17801     buf[5] = 0;
17802     buf[6] = 0;
17803     buf[7] = 1;
17804
17805     for (i = 0; i < 4; i++) {
17806         up = (U32*)(buf + i);
17807         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17808                (*up == 1 << (8*(3-i)))  /* little-endian */
17809               )
17810            )
17811         {
17812             printf("read failed (%x)\n", *up);
17813             exit(2);
17814         }
17815     }
17816
17817     /* write test */
17818     for (i = 0; i < 4; i++) {
17819         up = (U32*)(buf + i);
17820         *up = 0xBeef;
17821         if (*up != 0xBeef) {
17822             printf("write failed (%x)\n", *up);
17823             exit(3);
17824         }
17825     }
17826
17827     exit(0);
17828 #else
17829     printf("1\n");
17830     exit(1);
17831 #endif
17832     return 0;
17833 }
17834 EOCP
17835 set try
17836 if eval $compile_ok; then
17837         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17838         $run ./try 2>&1 >/dev/null
17839         case "$?" in
17840         0)      cat >&4 <<EOM
17841 You can access character data pretty unalignedly.
17842 EOM
17843                 d_u32align="$undef"
17844                 ;;
17845         *)      cat >&4 <<EOM
17846 It seems that you must access character data in an aligned manner.
17847 EOM
17848                 d_u32align="$define"
17849                 ;;
17850         esac
17851 else
17852         rp='Can you access character data at unaligned addresses?'
17853         dflt='n'
17854         . ./myread
17855         case "$ans" in
17856         [yY]*)  d_u32align="$undef"  ;;
17857         *)      d_u32align="$define" ;;
17858         esac
17859 fi
17860 $rm -f core core.try.* try.core
17861 ;;
17862 esac
17863
17864 : see if ualarm exists
17865 set ualarm d_ualarm
17866 eval $inlibc
17867
17868 : see if umask exists
17869 set umask d_umask
17870 eval $inlibc
17871
17872 : see if unordered exists
17873 set unordered d_unordered
17874 eval $inlibc
17875
17876 : see if unsetenv exists
17877 set unsetenv d_unsetenv
17878 eval $inlibc
17879
17880 : see if usleep exists
17881 set usleep d_usleep
17882 eval $inlibc
17883
17884 : see if prototype for usleep is available
17885 echo " "
17886 set d_usleepproto usleep $i_unistd unistd.h
17887 eval $hasproto
17888
17889 : see if ustat exists
17890 set ustat d_ustat
17891 eval $inlibc
17892
17893 : backward compatibility for d_hvfork
17894 if test X$d_hvfork != X; then
17895         d_vfork="$d_hvfork"
17896         d_hvfork=''
17897 fi
17898 : see if there is a vfork
17899 val=''
17900 set vfork val
17901 eval $inlibc
17902
17903 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17904 : perl on Solaris 2.x, and probably elsewhere.
17905 case "$val" in
17906 $define)
17907         echo " "
17908         case "$usevfork" in
17909         false) dflt='n';;
17910         *) dflt='y';;
17911         esac
17912         cat <<'EOM'
17913  
17914 Perl can only use a vfork() that doesn't suffer from strict
17915 restrictions on calling functions or modifying global data in
17916 the child.  For example, glibc-2.1 contains such a vfork()
17917 that is unsuitable.  If your system provides a proper fork()
17918 call, chances are that you do NOT want perl to use vfork().
17919
17920 EOM
17921         rp="Do you still want to use vfork()?"
17922         . ./myread
17923         case "$ans" in
17924         y|Y) ;;
17925         *)
17926                 echo "Ok, we won't use vfork()."
17927                 val="$undef"
17928                 ;;
17929         esac
17930         ;;
17931 esac
17932 set d_vfork
17933 eval $setvar
17934 case "$d_vfork" in
17935 $define) usevfork='true';;
17936 *) usevfork='false';;
17937 esac
17938
17939 : see if closedir exists
17940 set closedir d_closedir
17941 eval $inlibc
17942
17943 case "$d_closedir" in
17944 "$define")
17945         echo " "
17946         echo "Checking whether closedir() returns a status..." >&4
17947         cat > try.c <<EOM
17948 #$i_dirent I_DIRENT             /**/
17949 #$i_sysdir I_SYS_DIR            /**/
17950 #$i_sysndir I_SYS_NDIR          /**/
17951 #$i_systypes I_SYS_TYPES        /**/
17952
17953 #if defined(I_SYS_TYPES)
17954 #include <sys/types.h>
17955 #endif
17956 #if defined(I_DIRENT)
17957 #include <dirent.h>
17958 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17959 #include <sys/dir.h>
17960 #endif
17961 #else
17962 #ifdef I_SYS_NDIR
17963 #include <sys/ndir.h>
17964 #else
17965 #ifdef I_SYS_DIR
17966 #ifdef hp9000s500
17967 #include <ndir.h>       /* may be wrong in the future */
17968 #else
17969 #include <sys/dir.h>
17970 #endif
17971 #endif
17972 #endif
17973 #endif 
17974 int main() { return closedir(opendir(".")); }
17975 EOM
17976         set try
17977         if eval $compile_ok; then
17978                 if $run ./try > /dev/null 2>&1 ; then
17979                         echo "Yes, it does."
17980                         val="$undef"
17981                 else
17982                         echo "No, it doesn't."
17983                         val="$define"
17984                 fi
17985         else
17986                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17987                 val="$define"
17988         fi
17989         ;;
17990 *)
17991         val="$undef";
17992         ;;
17993 esac
17994 set d_void_closedir
17995 eval $setvar
17996 $rm -f try try.*
17997 : see if there is a wait4
17998 set wait4 d_wait4
17999 eval $inlibc
18000
18001 : see if waitpid exists
18002 set waitpid d_waitpid
18003 eval $inlibc
18004
18005 : see if wcstombs exists
18006 set wcstombs d_wcstombs
18007 eval $inlibc
18008
18009 : see if wctomb exists
18010 set wctomb d_wctomb
18011 eval $inlibc
18012
18013 : see if writev exists
18014 set writev d_writev
18015 eval $inlibc
18016
18017 : preserve RCS keywords in files with variable substitution, grrr
18018 Date='$Date'
18019 Id='$Id'
18020 Log='$Log'
18021 RCSfile='$RCSfile'
18022 Revision='$Revision'
18023
18024 : check for alignment requirements
18025 echo " "
18026 case "$usecrosscompile$multiarch" in
18027 *$define*)
18028         $cat <<EOM
18029 You seem to be either cross-compiling or doing a multiarchitecture build,
18030 skipping the memory alignment check.
18031
18032 EOM
18033         case "$alignbytes" in
18034         '') alignbytes=8 ;;
18035         esac
18036         ;;
18037 *)
18038         case "$alignbytes" in
18039         '') echo "Checking alignment constraints..." >&4
18040                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18041                         $cat >try.c <<'EOCP'
18042 typedef long double NV;
18043 EOCP
18044                 else
18045                         $cat >try.c <<'EOCP'
18046 typedef double NV;
18047 EOCP
18048                 fi
18049                 $cat >>try.c <<'EOCP'
18050 #include <stdio.h>
18051 struct foobar {
18052         char foo;
18053         NV bar;
18054 } try_algn;
18055 int main()
18056 {
18057     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18058     return(0);
18059 }
18060 EOCP
18061                 set try
18062                 if eval $compile_ok; then
18063                         dflt=`$run ./try`
18064                 else
18065                         dflt='8'
18066                         echo "(I can't seem to compile the test program...)"
18067                 fi
18068                 ;;
18069         *) dflt="$alignbytes"
18070                 ;;
18071         esac
18072         rp="Doubles must be aligned on a how-many-byte boundary?"
18073         . ./myread
18074         alignbytes="$ans"
18075         $rm -f try.c try
18076         ;;
18077 esac
18078
18079
18080 : set the base revision
18081 baserev=5.0
18082
18083 : how do we concatenate cpp tokens here?
18084 echo " "
18085 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18086 $cat >cpp_stuff.c <<'EOCP'
18087 #define RCAT(a,b)a/**/b
18088 #define ACAT(a,b)a ## b
18089 RCAT(Rei,ser)
18090 ACAT(Cir,cus)
18091 EOCP
18092 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18093 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18094         echo "Oh!  Smells like ANSI's been here." >&4
18095         echo "We can catify or stringify, separately or together!"
18096         cpp_stuff=42
18097 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18098         echo "Ah, yes!  The good old days!" >&4
18099         echo "However, in the good old days we don't know how to stringify and"
18100         echo "catify at the same time."
18101         cpp_stuff=1
18102 else
18103         $cat >&4 <<EOM
18104 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18105 You're going to have to edit the values of CAT[2-5] in config.h...
18106 EOM
18107         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18108 fi
18109 $rm -f cpp_stuff.*
18110
18111 : see if this is a db.h system
18112 set db.h i_db
18113 eval $inhdr
18114
18115 case "$i_db" in
18116 $define)
18117         : Check db version.
18118         echo " "
18119         echo "Checking Berkeley DB version ..." >&4
18120         $cat >try.c <<EOCP
18121 #$d_const HASCONST
18122 #ifndef HASCONST
18123 #define const
18124 #endif
18125 #include <sys/types.h>
18126 #include <stdio.h>
18127 #$i_stdlib I_STDLIB
18128 #ifdef I_STDLIB
18129 #include <stdlib.h>
18130 #endif
18131 #include <db.h>
18132 int main(int argc, char *argv[])
18133 {
18134 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18135     int Major, Minor, Patch ;
18136     unsigned long Version ;
18137     (void)db_version(&Major, &Minor, &Patch) ;
18138     if (argc == 2) {
18139         printf("%d %d %d %d %d %d\n",
18140                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18141                Major, Minor, Patch);
18142         exit(0);
18143     }
18144     printf("You have Berkeley DB Version 2 or greater.\n");
18145
18146     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18147                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18148     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18149                 Major, Minor, Patch) ;
18150
18151     /* check that db.h & libdb are compatible */
18152     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18153         printf("db.h and libdb are incompatible.\n") ;
18154         exit(3);        
18155     }
18156
18157     printf("db.h and libdb are compatible.\n") ;
18158
18159     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18160                 + DB_VERSION_PATCH ;
18161
18162     /* needs to be >= 2.3.4 */
18163     if (Version < 2003004) {
18164     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18165         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18166         exit(2);        
18167     }
18168
18169     exit(0);
18170 #else
18171 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18172     if (argc == 2) {
18173         printf("1 0 0\n");
18174         exit(0);
18175     }
18176     printf("You have Berkeley DB Version 1.\n");
18177     exit(0);    /* DB version < 2: the coast is clear. */
18178 #else
18179     exit(1);    /* <db.h> not Berkeley DB? */
18180 #endif
18181 #endif
18182 }
18183 EOCP
18184         set try
18185         if eval $compile_ok && $run ./try; then
18186                 echo 'Looks OK.' >&4
18187                 set `$run ./try 1`
18188                 db_version_major=$1
18189                 db_version_minor=$2
18190                 db_version_patch=$3
18191         else
18192                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18193                 i_db=$undef
18194                 case " $libs " in
18195                 *"-ldb "*)
18196                         : Remove db from list of libraries to use
18197                         echo "Removing unusable -ldb from library list" >&4
18198                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18199                         shift
18200                         libs="$*"
18201                         echo "libs = $libs" >&4
18202                         ;;
18203                 esac
18204         fi
18205         $rm -f try.*
18206         ;;
18207 esac
18208
18209 case "$i_db" in
18210 define)
18211         : Check the return type needed for hash 
18212         echo " "
18213         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18214         $cat >try.c <<EOCP
18215 #$d_const HASCONST
18216 #ifndef HASCONST
18217 #define const
18218 #endif
18219 #include <sys/types.h>
18220 #include <db.h>
18221
18222 #ifndef DB_VERSION_MAJOR
18223 u_int32_t hash_cb (ptr, size)
18224 const void *ptr;
18225 size_t size;
18226 {
18227 }
18228 HASHINFO info;
18229 int main()
18230 {
18231         info.hash = hash_cb;
18232 }
18233 #endif
18234 EOCP
18235         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18236                 if $contains warning try.out >>/dev/null 2>&1 ; then
18237                         db_hashtype='int'
18238                 else
18239                         db_hashtype='u_int32_t'
18240                 fi
18241         else
18242                 : XXX Maybe we should just give up here.
18243                 db_hashtype=u_int32_t
18244                 $cat try.out >&4
18245                 echo "Help:  I can't seem to compile the db test program." >&4
18246                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18247         fi
18248         $rm -f try.*
18249         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18250         ;;
18251 *)      db_hashtype=u_int32_t
18252         ;;
18253 esac
18254 case "$i_db" in
18255 define)
18256         : Check the return type needed for prefix 
18257         echo " "
18258         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18259         cat >try.c <<EOCP
18260 #$d_const HASCONST
18261 #ifndef HASCONST
18262 #define const
18263 #endif
18264 #include <sys/types.h>
18265 #include <db.h>
18266
18267 #ifndef DB_VERSION_MAJOR
18268 size_t prefix_cb (key1, key2)
18269 const DBT *key1;
18270 const DBT *key2;
18271 {
18272 }
18273 BTREEINFO info;
18274 int main()
18275 {
18276         info.prefix = prefix_cb;
18277 }
18278 #endif
18279 EOCP
18280         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18281                 if $contains warning try.out >>/dev/null 2>&1 ; then
18282                         db_prefixtype='int'
18283                 else
18284                         db_prefixtype='size_t'
18285                 fi
18286         else
18287                 db_prefixtype='size_t'
18288                 : XXX Maybe we should just give up here.
18289                 $cat try.out >&4
18290                 echo "Help:  I can't seem to compile the db test program." >&4
18291                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18292         fi
18293         $rm -f try.*
18294         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18295         ;;
18296 *)      db_prefixtype='size_t'
18297         ;;
18298 esac
18299
18300
18301 : How can we generate normalized random numbers ?
18302 echo " "
18303 echo "Looking for a random number function..." >&4
18304 case "$randfunc" in
18305 '')
18306         if set drand48 val -f; eval $csym; $val; then
18307                 dflt="drand48"
18308                 echo "Good, found drand48()." >&4
18309         elif set random val -f; eval $csym; $val; then
18310                 dflt="random"
18311                 echo "OK, found random()." >&4
18312         else
18313                 dflt="rand"
18314                 echo "Yick, looks like I have to use rand()." >&4
18315         fi
18316         echo " "
18317         ;;
18318 *)
18319         dflt="$randfunc"
18320         ;;
18321 esac
18322 cont=true
18323
18324 case "$ccflags" in
18325 *-Dmy_rand=*|*-Dmy_srand=*)
18326         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18327         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18328         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18329         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18330         ;;
18331 esac
18332
18333 while $test "$cont"; do
18334         rp="Use which function to generate random numbers?"
18335         . ./myread
18336         if $test "$ans" = "$dflt"; then
18337                 : null
18338         else
18339                 randbits=''
18340         fi
18341         randfunc="$ans"
18342         if set $ans val -f; eval $csym; $val; then
18343                 cont=''
18344         else
18345                 dflt=y
18346                 rp="I cannot find function $ans. Use that name anyway?"
18347                 . ./myread
18348                 dflt=rand
18349                 case "$ans" in
18350                         [yY]*) cont='';;
18351                 esac
18352         fi
18353         case "$cont" in
18354         '')
18355                 case "$randfunc" in
18356                 drand48)
18357                         drand01="drand48()"
18358                         seedfunc="srand48"
18359                         randbits=48
18360                         randseedtype=long
18361                         ;;
18362                 rand|random)
18363                         case "$randbits" in
18364                         '')
18365 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18366                                 $cat >try.c <<EOCP
18367 #$i_unistd I_UNISTD
18368 #$i_stdlib I_STDLIB
18369 #include <stdio.h>
18370 #ifdef I_UNISTD
18371 #  include <unistd.h>
18372 #endif
18373 #ifdef I_STDLIB
18374 #  include <stdlib.h>
18375 #endif
18376 int main()
18377 {
18378         register int i;
18379         register unsigned long tmp;
18380         register unsigned long max = 0L;
18381
18382         for (i = 1000; i; i--) {
18383                 tmp = (unsigned long) $randfunc();
18384                 if (tmp > max) max = tmp;
18385         }
18386         for (i = 0; max; i++)
18387                 max /= 2;
18388         printf("%d\n",i);
18389 }
18390 EOCP
18391                                 set try
18392                                 if eval $compile_ok; then
18393                                         dflt=`try`
18394                                 else
18395                                         dflt='?'
18396                                         echo "(I can't seem to compile the test program...)"
18397                                 fi
18398                                 ;;
18399                         *)
18400                                 dflt="$randbits"
18401                                 ;;
18402                         esac
18403                         rp="How many bits does your $randfunc() function produce?"
18404                         . ./myread
18405                         randbits="$ans"
18406                         $rm -f try.c try
18407                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18408                         seedfunc="s$randfunc"
18409                         randseedtype=unsigned
18410                         ;;
18411                 *)
18412                         dflt="31"
18413                         rp="How many bits does your $randfunc() function produce?"
18414                         . ./myread
18415                         randbits="$ans"
18416                         seedfunc="s$randfunc"
18417                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18418                         if set $seedfunc val -f; eval $csym; $val; then
18419                                 echo "(Using $seedfunc() to seed random generator)"
18420                         else
18421                                 echo "(Warning: no $seedfunc() to seed random generator)"
18422                                 seedfunc=rand
18423                         fi
18424                         randseedtype=unsigned
18425                         ;;
18426                 esac
18427                 ;;
18428         esac
18429 done
18430
18431 echo " "
18432 echo "Determining whether or not we are on an EBCDIC system..." >&4
18433 $cat >try.c <<'EOM'
18434 int main()
18435 {
18436   if ('M'==0xd4) return 0;
18437   return 1;
18438 }
18439 EOM
18440
18441 val=$undef
18442 set try
18443 if eval $compile_ok; then
18444         if $run ./try; then
18445                 echo "You seem to speak EBCDIC." >&4
18446                 val="$define"
18447         else
18448                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18449         fi
18450 else
18451         echo "I'm unable to compile the test program." >&4
18452         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18453 fi
18454 $rm -f try try.*
18455 set ebcdic
18456 eval $setvar
18457
18458 echo " "
18459 $cat >&4 <<EOM
18460 Checking how to flush all pending stdio output...
18461 EOM
18462 # I only know how to find the first 32 possibly open files on SunOS.
18463 # See also hints/sunos_4_1.sh and util.c  --AD
18464 case "$osname" in
18465 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18466 esac
18467 $cat >>try.c <<EOCP
18468 #include <stdio.h>
18469 #$i_stdlib I_STDLIB
18470 #ifdef I_STDLIB
18471 #include <stdlib.h>
18472 #endif
18473 #$i_unistd I_UNISTD
18474 #ifdef I_UNISTD
18475 # include <unistd.h>
18476 #endif
18477 #$d_sysconf HAS_SYSCONF
18478 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18479 #ifdef HAS_STDIO_STREAM_ARRAY
18480 # define STDIO_STREAM_ARRAY $stdio_stream_array
18481 #endif
18482 int main() {
18483   FILE* p;
18484   unlink("try.out");
18485   p = fopen("try.out", "w");
18486 #ifdef TRY_FPUTC
18487   fputc('x', p);
18488 #else
18489 # ifdef TRY_FPRINTF
18490   fprintf(p, "x");
18491 # endif
18492 #endif
18493 #ifdef TRY_FFLUSH_NULL
18494   fflush(NULL);
18495 #endif
18496 #ifdef TRY_FFLUSH_ALL
18497   {
18498     long open_max = -1;
18499 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18500     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18501 # else
18502 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18503     open_max = sysconf(_SC_OPEN_MAX);
18504 #  else
18505 #   ifdef FOPEN_MAX
18506     open_max = FOPEN_MAX;
18507 #   else
18508 #    ifdef OPEN_MAX
18509     open_max = OPEN_MAX;
18510 #    else
18511 #     ifdef _NFILE
18512     open_max = _NFILE;
18513 #     endif
18514 #    endif
18515 #   endif
18516 #  endif
18517 # endif 
18518 # ifdef HAS_STDIO_STREAM_ARRAY
18519     if (open_max > 0) {
18520       long i;
18521       for (i = 0; i < open_max; i++)
18522             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18523                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18524                 STDIO_STREAM_ARRAY[i]._flag)
18525                 fflush(&STDIO_STREAM_ARRAY[i]);
18526     }   
18527   }
18528 # endif
18529 #endif
18530   _exit(42);
18531 }
18532 EOCP
18533 : first we have to find out how _not_ to flush
18534 $to try.c
18535 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18536     output=''
18537     set try -DTRY_FPUTC
18538     if eval $compile; then
18539             $run ./try 2>/dev/null
18540             code="$?"
18541             $from try.out
18542             if $test ! -s try.out -a "X$code" = X42; then
18543                 output=-DTRY_FPUTC
18544             fi
18545     fi
18546     case "$output" in
18547     '')
18548             set try -DTRY_FPRINTF
18549             if eval $compile; then
18550                     $run ./try 2>/dev/null
18551                     code="$?"
18552                     $from try.out
18553                     if $test ! -s try.out -a "X$code" = X42; then
18554                         output=-DTRY_FPRINTF
18555                     fi
18556             fi
18557         ;;
18558     esac
18559 fi
18560 : check for fflush NULL behaviour
18561 case "$fflushNULL" in
18562 '')     set try -DTRY_FFLUSH_NULL $output
18563         if eval $compile; then
18564                 $run ./try 2>/dev/null
18565                 code="$?"
18566                 $from try.out
18567                 if $test -s try.out -a "X$code" = X42; then
18568                         fflushNULL="`$cat try.out`"
18569                 else
18570                         if $test "X$code" != X42; then
18571                                 $cat >&4 <<EOM
18572 (If this test failed, don't worry, we'll try another method shortly.)
18573 EOM
18574                         fi
18575                 fi
18576         fi
18577         $rm -f core try.core core.try.*
18578         case "$fflushNULL" in
18579         x)      $cat >&4 <<EOM
18580 Your fflush(NULL) works okay for output streams.
18581 Let's see if it clobbers input pipes...
18582 EOM
18583 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18584 # bug that improperly flushes the input end of pipes.  So we avoid the
18585 # autoflush on fork/system/exec support for now. :-(
18586 $cat >tryp.c <<EOCP
18587 #include <stdio.h>
18588 int
18589 main(int argc, char **argv)
18590 {
18591     char buf[1024];
18592     int i;
18593     char *bp = buf;
18594     while (1) {
18595         while ((i = getc(stdin)) != -1
18596                && (*bp++ = i) != '\n'
18597                && bp < &buf[1024])
18598         /* DO NOTHING */ ;
18599         *bp = '\0';
18600         fprintf(stdout, "%s", buf);
18601         fflush(NULL);
18602         if (i == -1)
18603             return 0;
18604         bp = buf;
18605     }
18606 }
18607 EOCP
18608                 fflushNULL="$define"
18609                 set tryp
18610                 if eval $compile; then
18611                     $rm -f tryp.out
18612                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18613                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18614                        $cat >&4 <<EOM
18615 fflush(NULL) seems to behave okay with input streams.
18616 EOM
18617                         fflushNULL="$define"
18618                     else
18619                         $cat >&4 <<EOM
18620 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18621 EOM
18622                         fflushNULL="$undef"
18623                     fi
18624                 fi
18625                 $rm -f core tryp.c tryp.core core.tryp.*
18626                 ;;
18627         '')     $cat >&4 <<EOM
18628 Your fflush(NULL) isn't working (contrary to ANSI C).
18629 EOM
18630                 fflushNULL="$undef"
18631                 ;;
18632         *)      $cat >&4 <<EOM
18633 Cannot figure out whether your fflush(NULL) works or not.
18634 I'm assuming it doesn't (contrary to ANSI C).
18635 EOM
18636                 fflushNULL="$undef"
18637                 ;;
18638         esac
18639         ;;
18640 $define|true|[yY]*)
18641         fflushNULL="$define"
18642         ;;
18643 *)
18644         fflushNULL="$undef"
18645         ;;
18646 esac
18647 : check explicit looping only if NULL did not work, and if the pipe
18648 : bug does not show up on an explicit flush too
18649 case "$fflushNULL" in
18650 "$undef")
18651         $cat >tryp.c <<EOCP
18652 #include <stdio.h>
18653 int
18654 main(int argc, char **argv)
18655 {
18656     char buf[1024];
18657     int i;
18658     char *bp = buf;
18659     while (1) {
18660         while ((i = getc(stdin)) != -1
18661                && (*bp++ = i) != '\n'
18662                && bp < &buf[1024])
18663         /* DO NOTHING */ ;
18664         *bp = '\0';
18665         fprintf(stdout, "%s", buf);
18666         fflush(stdin);
18667         if (i == -1)
18668             return 0;
18669         bp = buf;
18670     }
18671 }
18672 EOCP
18673         set tryp
18674         if eval $compile; then
18675             $rm -f tryp.out
18676             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18677             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18678                $cat >&4 <<EOM
18679 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18680 EOM
18681                 : now check for fflushall behaviour
18682                 case "$fflushall" in
18683                 '')     set try -DTRY_FFLUSH_ALL $output
18684                         if eval $compile; then
18685                                 $cat >&4 <<EOM
18686 (Now testing the other method--but note that this also may fail.)
18687 EOM
18688                                 $run ./try 2>/dev/null
18689                                 code=$?
18690                                 $from try.out
18691                                 if $test -s try.out -a "X$code" = X42; then
18692                                         fflushall="`$cat try.out`"
18693                                 fi
18694                         fi
18695                         $rm -f core try.core core.try.*
18696                         case "$fflushall" in
18697                         x)      $cat >&4 <<EOM
18698 Whew. Flushing explicitly all the stdio streams works.
18699 EOM
18700                                 fflushall="$define"
18701                                 ;;
18702                         '')     $cat >&4 <<EOM
18703 Sigh. Flushing explicitly all the stdio streams doesn't work.
18704 EOM
18705                                 fflushall="$undef"
18706                                 ;;
18707                         *)      $cat >&4 <<EOM
18708 Cannot figure out whether flushing stdio streams explicitly works or not.
18709 I'm assuming it doesn't.
18710 EOM
18711                                 fflushall="$undef"
18712                                 ;;
18713                         esac
18714                         ;;
18715                 "$define"|true|[yY]*)
18716                         fflushall="$define"
18717                         ;;
18718                 *)
18719                         fflushall="$undef"
18720                         ;;
18721                 esac
18722             else
18723                 $cat >&4 <<EOM
18724 All is futile.  Even fflush(stdin) clobbers input pipes!
18725 EOM
18726                 fflushall="$undef"
18727             fi
18728         else
18729             fflushall="$undef"
18730         fi
18731         $rm -f core tryp.c tryp.core core.tryp.*
18732         ;;
18733 *)      fflushall="$undef"
18734         ;;
18735 esac
18736
18737 case "$fflushNULL$fflushall" in
18738 undefundef)
18739         $cat <<EOM
18740 OK, I give up.  I cannot figure out how to flush pending stdio output.
18741 We won't be flushing handles at all before fork/exec/popen.
18742 EOM
18743         ;;
18744 esac
18745 $rm -f try.* try$exe_ext
18746
18747 : Store the full pathname to the ar program for use in the C program
18748 : Respect a hint or command line value for full_ar.
18749 case "$full_ar" in
18750 '') full_ar=$ar ;;
18751 esac
18752
18753 : Store the full pathname to the sed program for use in the C program
18754 full_sed=$sed
18755
18756 : see what type gids are declared as in the kernel
18757 echo " "
18758 echo "Looking for the type for group ids returned by getgid()."
18759 set gid_t gidtype xxx stdio.h sys/types.h
18760 eval $typedef
18761 case "$gidtype" in
18762 xxx)
18763         xxx=`./findhdr sys/user.h`
18764         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18765         case $1 in
18766         unsigned) dflt="$1 $2" ;;
18767         *) dflt="$1" ;;
18768         esac
18769         ;;
18770 *) dflt="$gidtype";;
18771 esac
18772 case "$gidtype" in
18773 gid_t) echo "gid_t found." ;;
18774 *)      rp="What is the type for group ids returned by getgid()?"
18775         . ./myread
18776         gidtype="$ans"
18777         ;;
18778 esac
18779
18780 echo " "
18781 case "$gidtype" in
18782 *_t) zzz="$gidtype"     ;;
18783 *)   zzz="gid"          ;;
18784 esac
18785 echo "Checking the size of $zzz..." >&4 
18786 cat > try.c <<EOCP
18787 #include <sys/types.h>
18788 #include <stdio.h>
18789 #$i_stdlib I_STDLIB
18790 #ifdef I_STDLIB
18791 #include <stdlib.h>
18792 #endif
18793 int main() {
18794     printf("%d\n", (int)sizeof($gidtype));
18795     exit(0);
18796 }
18797 EOCP
18798 set try
18799 if eval $compile_ok; then
18800         yyy=`$run ./try`
18801         case "$yyy" in
18802         '')     gidsize=4
18803                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18804                 ;;
18805         *)      gidsize=$yyy
18806                 echo "Your $zzz is $gidsize bytes long."
18807                 ;;
18808         esac
18809 else
18810         gidsize=4
18811         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18812 fi
18813
18814
18815 echo " "
18816 case "$gidtype" in
18817 *_t) zzz="$gidtype"     ;;
18818 *)   zzz="gid"          ;;
18819 esac
18820 echo "Checking the sign of $zzz..." >&4 
18821 cat > try.c <<EOCP
18822 #include <sys/types.h>
18823 #include <stdio.h>
18824 int main() {
18825         $gidtype foo = -1;
18826         if (foo < 0)
18827                 printf("-1\n");
18828         else
18829                 printf("1\n");
18830 }
18831 EOCP
18832 set try
18833 if eval $compile; then
18834         yyy=`$run ./try`
18835         case "$yyy" in
18836         '')     gidsign=1
18837                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18838                 ;;
18839         *)      gidsign=$yyy
18840                 case "$gidsign" in
18841                  1) echo "Your $zzz is unsigned." ;;
18842                 -1) echo "Your $zzz is signed."   ;;
18843                 esac
18844                 ;;
18845         esac
18846 else
18847         gidsign=1
18848         echo "(I can't compile the test program--guessing unsigned.)" >&4
18849 fi
18850
18851
18852 echo " "
18853
18854 if $test X"$quadtype" != X; then
18855
18856 echo "Checking how to print 64-bit integers..." >&4
18857
18858 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18859         $cat >try.c <<'EOCP'
18860 #include <sys/types.h>
18861 #include <stdio.h>
18862 int main() {
18863   int q = 12345678901;
18864   printf("%ld\n", q);
18865 }
18866 EOCP
18867         set try
18868         if eval $compile; then
18869                 yyy=`$run ./try`
18870                 case "$yyy" in
18871                 12345678901)
18872                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18873                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18874                         echo "We will use %d."
18875                         ;;
18876                 esac
18877         fi
18878 fi
18879
18880 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18881         $cat >try.c <<'EOCP'
18882 #include <sys/types.h>
18883 #include <stdio.h>
18884 int main() {
18885   long q = 12345678901;
18886   printf("%ld\n", q);
18887 }
18888 EOCP
18889         set try
18890         if eval $compile; then
18891                 yyy=`$run ./try`
18892                 case "$yyy" in
18893                 12345678901)
18894                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18895                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18896                         echo "We will use %ld."
18897                         ;;
18898                 esac
18899         fi
18900 fi
18901
18902 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18903         $cat >try.c <<'EOCP'
18904 #include <sys/types.h>
18905 #include <inttypes.h>
18906 #include <stdio.h>
18907 int main() {
18908   int64_t q = 12345678901;
18909   printf("%" PRId64 "\n", q);
18910 }
18911 EOCP
18912         set try
18913         if eval $compile; then
18914                 yyy=`$run ./try`
18915                 case "$yyy" in
18916                 12345678901)
18917                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18918                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18919                         echo "We will use the C9X style."
18920                         ;;
18921                 esac
18922         fi
18923 fi
18924
18925 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18926         $cat >try.c <<EOCP
18927 #include <sys/types.h>
18928 #include <stdio.h>
18929 int main() {
18930   $quadtype q = 12345678901;
18931   printf("%Ld\n", q);
18932 }
18933 EOCP
18934         set try
18935         if eval $compile; then
18936                 yyy=`$run ./try`
18937                 case "$yyy" in
18938                 12345678901)
18939                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18940                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18941                         echo "We will use %Ld."
18942                         ;;
18943                 esac
18944         fi
18945 fi
18946
18947 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18948         $cat >try.c <<'EOCP'
18949 #include <sys/types.h>
18950 #include <stdio.h>
18951 int main() {
18952   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18953   printf("%lld\n", q);
18954 }
18955 EOCP
18956         set try
18957         if eval $compile; then
18958                 yyy=`$run ./try`
18959                 case "$yyy" in
18960                 12345678901)
18961                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18962                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18963                         echo "We will use the %lld style."
18964                         ;;
18965                 esac
18966         fi
18967 fi
18968
18969 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18970         $cat >try.c <<EOCP
18971 #include <sys/types.h>
18972 #include <stdio.h>
18973 int main() {
18974   $quadtype q = 12345678901;
18975   printf("%qd\n", q);
18976 }
18977 EOCP
18978         set try
18979         if eval $compile; then
18980                 yyy=`$run ./try`
18981                 case "$yyy" in
18982                 12345678901)
18983                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18984                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18985                         echo "We will use %qd."
18986                         ;;
18987                 esac
18988         fi
18989 fi
18990
18991 if $test X"$sPRId64" = X; then
18992         echo "Cannot figure out how to print 64-bit integers." >&4
18993 fi
18994
18995 $rm -f try try.*
18996
18997 fi
18998
18999 case "$sPRId64" in
19000 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19001         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19002         ;;
19003 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19004         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19005         ;;
19006 esac
19007
19008
19009 echo " "
19010 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19011
19012 if $test X"$ivsize" = X8; then
19013         ivdformat="$sPRId64"
19014         uvuformat="$sPRIu64"
19015         uvoformat="$sPRIo64"
19016         uvxformat="$sPRIx64"
19017         uvXUformat="$sPRIXU64"
19018 else
19019         if $test X"$ivsize" = X"$longsize"; then
19020                 ivdformat='"ld"'
19021                 uvuformat='"lu"'
19022                 uvoformat='"lo"'
19023                 uvxformat='"lx"'
19024                 uvXUformat='"lX"'
19025         else
19026                 if $test X"$ivsize" = X"$intsize"; then
19027                         ivdformat='"d"'
19028                         uvuformat='"u"'
19029                         uvoformat='"o"'
19030                         uvxformat='"x"'
19031                         uvXUformat='"X"'
19032                 else
19033                         : far out
19034                         if $test X"$ivsize" = X"$shortsize"; then
19035                                 ivdformat='"hd"'
19036                                 uvuformat='"hu"'
19037                                 uvoformat='"ho"'
19038                                 uvxformat='"hx"'
19039                                 uvXUformat='"hX"'
19040                         fi
19041                 fi
19042         fi
19043 fi
19044
19045 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19046         nveformat="$sPRIeldbl"
19047         nvfformat="$sPRIfldbl"
19048         nvgformat="$sPRIgldbl"
19049         nvEUformat="$sPRIEUldbl"
19050         nvFUformat="$sPRIFUldbl"
19051         nvGUformat="$sPRIGUldbl"
19052 else
19053         nveformat='"e"'
19054         nvfformat='"f"'
19055         nvgformat='"g"'
19056         nvEUformat='"E"'
19057         nvFUformat='"F"'
19058         nvGUformat='"G"'
19059 fi
19060
19061 case "$ivdformat" in
19062 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19063     exit 1
19064     ;;
19065 esac
19066
19067
19068 echo " "
19069 $echo "Checking the format string to be used for gids..." >&4
19070
19071 case "$gidsign" in
19072 -1)     if $test X"$gidsize" = X"$ivsize"; then
19073                 gidformat="$ivdformat"
19074         else
19075                 if $test X"$gidsize" = X"$longsize"; then
19076                         gidformat='"ld"'
19077                 else
19078                         if $test X"$gidsize" = X"$intsize"; then
19079                                 gidformat='"d"'
19080                         else
19081                                 if $test X"$gidsize" = X"$shortsize"; then
19082                                         gidformat='"hd"'
19083                                 fi
19084                         fi
19085                 fi
19086         fi
19087         ;;
19088 *)      if $test X"$gidsize" = X"$uvsize"; then
19089                 gidformat="$uvuformat"
19090         else
19091                 if $test X"$gidsize" = X"$longsize"; then
19092                         gidformat='"lu"'
19093                 else
19094                         if $test X"$gidsize" = X"$intsize"; then
19095                                 gidformat='"u"'
19096                         else
19097                                 if $test X"$gidsize" = X"$shortsize"; then
19098                                         gidformat='"hu"'
19099                                 fi
19100                         fi
19101                 fi
19102         fi
19103         ;;
19104 esac
19105
19106 : see if getgroups exists
19107 set getgroups d_getgrps
19108 eval $inlibc
19109
19110 : see if setgroups exists
19111 set setgroups d_setgrps
19112 eval $inlibc
19113
19114
19115 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19116 echo " "
19117 case "$d_getgrps$d_setgrps" in
19118 *define*)
19119         case "$groupstype" in
19120         '') dflt="$gidtype" ;;
19121         *)  dflt="$groupstype" ;;
19122         esac
19123         $cat <<EOM
19124 What type of pointer is the second argument to getgroups() and setgroups()?
19125 Usually this is the same as group ids, $gidtype, but not always.
19126
19127 EOM
19128         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19129         . ./myread
19130         groupstype="$ans"
19131         ;;
19132 *)  groupstype="$gidtype";;
19133 esac
19134
19135
19136 if $test $patchlevel -lt 9; then
19137 : MAD is not available in 5.8.x or earlier.
19138     ans=n;
19139 else
19140     case "$mad" in
19141     $define|true|[yY]*) dflt='y' ;;
19142     *)                  dflt='n' ;;
19143     esac
19144     cat <<EOM
19145
19146 Would you like to build with Misc Attribute Decoration? This is development
19147 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19148 overhead on the interpreter.
19149
19150 If this doesn't make any sense to you, just accept the default '$dflt'.
19151 EOM
19152     rp='Build Perl with MAD?'
19153     . ./myread
19154 fi
19155 case "$ans" in
19156 y|Y)    val="$define"
19157         madlyh='madly.h madly.act madly.tab'
19158         madlysrc='madly.c'
19159         madlyobj="madly$_o" ;;
19160 *)      val="$undef"
19161         madlyh=''
19162         madlysrc=''
19163         madlyobj='' ;;
19164 esac
19165 set mad
19166 eval $setvar
19167
19168 echo " "
19169 echo "Checking if your $make program sets \$(MAKE)..." >&4
19170 case "$make_set_make" in
19171 '')
19172         $sed 's/^X //' > testmake.mak << 'EOF'
19173 Xall:
19174 X       @echo 'maketemp="$(MAKE)"'
19175 EOF
19176         case "`$make -f testmake.mak 2>/dev/null`" in
19177         *maketemp=*) make_set_make='#' ;;
19178         *)      make_set_make="MAKE=$make" ;;
19179         esac
19180         $rm -f testmake.mak
19181         ;;
19182 esac
19183 case "$make_set_make" in
19184 '#') echo "Yup, it does.";;
19185 *) echo "Nope, it doesn't.";;
19186 esac
19187
19188 : see what type is used for mode_t
19189 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19190 set mode_t modetype int stdio.h sys/types.h
19191 eval $typedef_ask
19192
19193 : see if we need va_copy
19194 echo " "
19195 case "$i_stdarg" in
19196 "$define")
19197         $cat >try.c <<EOCP
19198 #include <stdarg.h>
19199 #include <stdio.h>
19200 #$i_stdlib I_STDLIB
19201 #ifdef I_STDLIB
19202 #include <stdlib.h>
19203 #endif
19204 #include <signal.h>
19205
19206 int
19207 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19208 {
19209   return vfprintf(f, fmt, *valp);
19210 }
19211  
19212 int    
19213 myvfprintf(FILE *f, const  char *fmt, va_list val)
19214 {
19215   return ivfprintf(f, fmt, &val);
19216 }
19217       
19218 int
19219 myprintf(char *fmt, ...) 
19220 {
19221   va_list val;
19222   va_start(val, fmt);
19223   return myvfprintf(stdout, fmt, val); 
19224 }         
19225
19226 int
19227 main(int ac, char **av)
19228 {
19229   signal(SIGSEGV, exit);
19230
19231   myprintf("%s%cs all right, then\n", "that", '\'');                            
19232   exit(0);      
19233 }
19234 EOCP
19235         set try
19236         if eval $compile && $run ./try 2>&1 >/dev/null; then
19237                 case "`$run ./try`" in
19238                 "that's all right, then")
19239                         okay=yes
19240                         ;;
19241                 esac
19242         fi
19243         case "$okay" in
19244         yes)    echo "It seems that you don't need va_copy()." >&4
19245                 need_va_copy="$undef"
19246                 ;;
19247         *)      echo "It seems that va_copy() or similar will be needed." >&4
19248                 need_va_copy="$define"
19249                 ;;
19250         esac
19251         $rm -f try.* core core.* *.core *.core.*
19252         ;;
19253 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19254         ;;
19255 esac
19256
19257 : see what type is used for size_t
19258 rp="What is the type used for the length parameter for string functions?"
19259 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19260 eval $typedef_ask
19261
19262 : check for type of arguments to gethostbyaddr. 
19263 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19264         case "$d_gethbyaddr" in
19265         $define)
19266                 $cat <<EOM
19267
19268 Checking to see what type of arguments are accepted by gethostbyaddr().
19269 EOM
19270                 hdrs="$define sys/types.h
19271                         $d_socket sys/socket.h 
19272                         $i_niin netinet/in.h 
19273                         $i_netdb netdb.h
19274                         $i_unistd unistd.h"
19275                 : The first arg can 'char *' or 'void *'
19276                 : The second arg is some of integral type
19277                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19278                         for yyy in size_t long int; do
19279                                 case "$netdb_host_type" in
19280                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19281                                         if ./protochk "$try" $hdrs; then
19282                                                 echo "Your system accepts $xxx for the first arg."
19283                                                 echo "...and $yyy for the second arg."
19284                                                 netdb_host_type="$xxx"
19285                                                 netdb_hlen_type="$yyy"
19286                                         fi
19287                                         ;;
19288                                 esac
19289                         done
19290                 done
19291                 : In case none of those worked, prompt the user.
19292                 case "$netdb_host_type" in
19293                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19294                         dflt='char *'
19295                         . ./myread
19296                         netdb_host_type=$ans
19297                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19298                         dflt="$sizetype"
19299                         . ./myread
19300                         netdb_hlen_type=$ans
19301                         ;;
19302                 esac
19303                 ;;
19304         *)      : no gethostbyaddr, so pick harmless defaults
19305                 netdb_host_type='char *'
19306                 netdb_hlen_type="$sizetype"
19307                 ;;
19308         esac
19309         # Remove the "const" if needed. -- but then we'll have a 
19310         # prototype clash!
19311         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19312 fi
19313
19314 : check for type of argument to gethostbyname. 
19315 if test "X$netdb_name_type" = X ; then
19316         case "$d_gethbyname" in
19317         $define)
19318                 $cat <<EOM
19319
19320 Checking to see what type of argument is accepted by gethostbyname().
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 "const char *" "char *"; do
19328                         case "$netdb_name_type" in
19329                         '')     try="extern struct hostent *gethostbyname($xxx);"
19330                                 if ./protochk "$try" $hdrs; then
19331                                         echo "Your system accepts $xxx."
19332                                         netdb_name_type="$xxx"
19333                                 fi
19334                                 ;;
19335                         esac
19336                 done
19337                 : In case none of those worked, prompt the user.
19338                 case "$netdb_name_type" in
19339                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19340                         dflt='char *'
19341                         . ./myread
19342                         netdb_name_type=$ans
19343                         ;;
19344                 esac
19345                 ;;
19346         *)      : no gethostbyname, so pick harmless default
19347                 netdb_name_type='char *'
19348                 ;;
19349         esac
19350 fi
19351
19352 : check for type of 1st argument to getnetbyaddr. 
19353 if test "X$netdb_net_type" = X ; then
19354         case "$d_getnbyaddr" in
19355         $define)
19356                 $cat <<EOM
19357
19358 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19359 EOM
19360                 hdrs="$define sys/types.h
19361                         $d_socket sys/socket.h 
19362                         $i_niin netinet/in.h 
19363                         $i_netdb netdb.h
19364                         $i_unistd unistd.h"
19365                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19366                         case "$netdb_net_type" in
19367                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19368                                 if ./protochk "$try" $hdrs; then
19369                                         echo "Your system accepts $xxx."
19370                                         netdb_net_type="$xxx"
19371                                 fi
19372                                 ;;
19373                         esac
19374                 done
19375                 : In case none of those worked, prompt the user.
19376                 case "$netdb_net_type" in
19377                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19378                         dflt='long'
19379                         . ./myread
19380                         netdb_net_type=$ans
19381                         ;;
19382                 esac
19383                 ;;
19384         *)      : no getnetbyaddr, so pick harmless default
19385                 netdb_net_type='long'
19386                 ;;
19387         esac
19388 fi
19389 : locate the preferred pager for this system
19390 fn=f/
19391 case "$pager" in
19392 '')
19393         dflt=''
19394         case "$pg" in
19395         /*) dflt=$pg;;
19396         [a-zA-Z]:/*) dflt=$pg;;
19397         esac
19398         case "$more" in
19399         /*) dflt=$more;;
19400         [a-zA-Z]:/*) dflt=$more;;
19401         esac
19402         case "$less" in
19403         /*) dflt=$less;;
19404         [a-zA-Z]:/*) dflt=$less;;
19405         esac
19406         case "$dflt" in
19407         '') dflt=/usr/ucb/more;;
19408         esac
19409         ;;
19410 *)      dflt="$pager"
19411         : Instruct ./getfile to trust the hinted or previous pager value,
19412         : even if it does not begin with a slash.  For example, on os2,
19413         : pager might be cmd /c more.  See comments in UU/getfile.
19414         fn="f/($pager)"
19415         ;;
19416 esac
19417 echo " "
19418 rp='What pager is used on your system?'
19419 . ./getfile
19420 pager="$ans"
19421
19422 : see what type pids are declared as in the kernel
19423 rp="What is the type of process ids on this system?"
19424 set pid_t pidtype int stdio.h sys/types.h
19425 eval $typedef_ask
19426
19427 : see if ar generates random libraries by itself
19428 echo " "
19429 echo "Checking how to generate random libraries on your machine..." >&4
19430 echo 'int bar1() { return bar2(); }' > bar1.c
19431 echo 'int bar2() { return 2; }' > bar2.c
19432 $cat > foo.c <<EOP
19433 #$i_stdlib I_STDLIB
19434 #ifdef I_STDLIB
19435 #include <stdlib.h>
19436 #endif
19437 int main() { printf("%d\n", bar1()); exit(0); }
19438 EOP
19439 $cc $ccflags -c bar1.c >/dev/null 2>&1
19440 $cc $ccflags -c bar2.c >/dev/null 2>&1
19441 $cc $ccflags -c foo.c >/dev/null 2>&1
19442 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19443 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19444         $run ./foobar >/dev/null 2>&1; then
19445         echo "$ar appears to generate random libraries itself."
19446         orderlib=false
19447         if [ "X$ranlib" = "X" ]; then
19448             ranlib=":"
19449         fi
19450 elif $ar s bar$_a >/dev/null 2>&1 &&
19451         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19452         $run ./foobar >/dev/null 2>&1; then
19453                 echo "a table of contents needs to be added with '$ar s'."
19454                 orderlib=false
19455                 ranlib="$ar s"
19456 elif $ar ts bar$_a >/dev/null 2>&1 &&
19457         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19458         $run ./foobar >/dev/null 2>&1; then
19459                 echo "a table of contents needs to be added with '$ar ts'."
19460                 orderlib=false
19461                 ranlib="$ar ts"
19462 else
19463         case "$ranlib" in
19464         :) ranlib='';;
19465         '')
19466                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19467                 $test -f $ranlib || ranlib=''
19468                 ;;
19469         esac
19470         if $test -n "$ranlib"; then
19471                 echo "your system has '$ranlib'; we'll use that."
19472                 orderlib=false
19473         else
19474                 echo "your system doesn't seem to support random libraries"
19475                 echo "so we'll use lorder and tsort to order the libraries."
19476                 orderlib=true
19477                 ranlib=":"
19478         fi
19479 fi
19480 $rm -f foo* bar*
19481
19482 : check for type of arguments to select. 
19483 case "$selecttype" in
19484 '') case "$d_select" in
19485         $define)
19486                 echo " "
19487                 $cat <<EOM
19488 Checking to see what type of arguments are accepted by select().
19489 EOM
19490                 hdrs="$define sys/types.h
19491                         $i_systime sys/time.h 
19492                         $i_sysselct sys/select.h
19493                         $d_socket sys/socket.h"
19494                 : The first arg can be int, unsigned, or size_t
19495                 : The last arg may or may not be 'const'
19496                 val=''
19497                 : void pointer has been seen but using that
19498                 : breaks the selectminbits test
19499                 for xxx in 'fd_set *' 'int *'; do
19500                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19501                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19502                                         case "$val" in
19503                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19504                                                 if ./protochk "$try" $hdrs; then
19505                                                         echo "Your system accepts $xxx."
19506                                                         val="$xxx"
19507                                                 fi
19508                                                 ;;
19509                                         esac
19510                                 done
19511                         done
19512                 done
19513                 case "$val" in
19514                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19515                         case "$d_fd_set" in
19516                                 $define) dflt="fd_set *" ;;
19517                                 *)              dflt="int *" ;;
19518                         esac
19519                         . ./myread
19520                         val=$ans
19521                         ;;
19522                 esac
19523                 selecttype="$val"
19524                 ;;
19525         *)      : no select, so pick a harmless default
19526                 selecttype='int *'
19527                 ;;
19528         esac
19529         ;;
19530 esac
19531
19532 : check for the select 'width'
19533 case "$selectminbits" in
19534 '') safebits=`expr $ptrsize \* 8`
19535     case "$d_select" in
19536         $define)
19537                 $cat <<EOM
19538
19539 Checking to see on how many bits at a time your select() operates...
19540 EOM
19541                 $cat >try.c <<EOCP
19542 #include <sys/types.h>
19543 #$i_time I_TIME
19544 #$i_systime I_SYS_TIME
19545 #$i_systimek I_SYS_TIME_KERNEL
19546 #ifdef I_TIME
19547 #   include <time.h>
19548 #endif
19549 #ifdef I_SYS_TIME
19550 #   ifdef I_SYS_TIME_KERNEL
19551 #       define KERNEL
19552 #   endif
19553 #   include <sys/time.h>
19554 #   ifdef I_SYS_TIME_KERNEL
19555 #       undef KERNEL
19556 #   endif
19557 #endif
19558 #$i_sysselct I_SYS_SELECT
19559 #ifdef I_SYS_SELECT
19560 #include <sys/select.h>
19561 #endif
19562 #$d_socket HAS_SOCKET
19563 #ifdef HAS_SOCKET
19564 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19565 #endif
19566 #include <stdio.h>
19567 #$i_stdlib I_STDLIB
19568 #ifdef I_STDLIB
19569 #include <stdlib.h>
19570 #endif
19571 $selecttype b;
19572 #define S sizeof(*(b))
19573 #define MINBITS 64
19574 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19575 #define NBITS  (NBYTES * 8)
19576 int main() {
19577     char *s = (char *)malloc(NBYTES);
19578     struct timeval t;
19579     int i;
19580     FILE* fp;
19581     int fd;
19582
19583     if (!s)
19584         exit(1);
19585     fclose(stdin);
19586     fp = fopen("try.c", "r");
19587     if (fp == 0)
19588       exit(2);
19589     fd = fileno(fp);
19590     if (fd < 0)
19591       exit(3);
19592     b = ($selecttype)s;
19593     for (i = 0; i < NBITS; i++)
19594         FD_SET(i, b);
19595     t.tv_sec  = 0;
19596     t.tv_usec = 0;
19597     select(fd + 1, b, 0, 0, &t);
19598     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19599     free(s);
19600     printf("%d\n", i + 1);
19601     return 0;
19602 }
19603 EOCP
19604                 set try
19605                 if eval $compile_ok; then
19606                         selectminbits=`$run ./try`
19607                         case "$selectminbits" in
19608                         '')     cat >&4 <<EOM
19609 Cannot figure out on how many bits at a time your select() operates.
19610 I'll play safe and guess it is $safebits bits.
19611 EOM
19612                                 selectminbits=$safebits
19613                                 bits="$safebits bits"
19614                                 ;;
19615                         1)      bits="1 bit" ;;
19616                         *)      bits="$selectminbits bits" ;;
19617                         esac
19618                         echo "Your select() operates on $bits at a time." >&4
19619                 else
19620                         rp='What is the minimum number of bits your select() operates on?'
19621                         case "$byteorder" in
19622                         12345678)       dflt=64 ;;
19623                         1234)           dflt=32 ;;
19624                         *)              dflt=1  ;;
19625                         esac
19626                         . ./myread
19627                         val=$ans
19628                         selectminbits="$val"
19629                 fi
19630                 $rm -f try.* try
19631                 ;;
19632         *)      : no select, so pick a harmless default
19633                 selectminbits=$safebits
19634                 ;;
19635         esac
19636         ;;
19637 esac
19638
19639 : Trace out the files included by signal.h, then look for SIGxxx names.
19640 : Remove SIGARRAYSIZE used by HPUX.
19641 : Remove SIGSTKSIZE used by Linux.
19642 : Remove SIGSTKSZ used by Posix.
19643 : Remove SIGTYP void lines used by OS2.
19644 : Some cpps, like os390, dont give the file name anywhere
19645 if [ "X$fieldn" = X ]; then
19646         : Just make some guesses.  We check them later.
19647         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19648 else
19649         xxx=`echo '#include <signal.h>' |
19650         $cppstdin $cppminus $cppflags 2>/dev/null |
19651         $grep '^[       ]*#.*include' | 
19652         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19653 fi
19654 : Check this list of files to be sure we have parsed the cpp output ok.
19655 : This will also avoid potentially non-existent files, such 
19656 : as ../foo/bar.h
19657 xxxfiles=''
19658 for xx in $xxx /dev/null ; do
19659         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19660 done
19661 : If we have found no files, at least try signal.h
19662 case "$xxxfiles" in
19663 '')     xxxfiles=`./findhdr signal.h` ;;
19664 esac
19665 xxx=`awk '
19666 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19667         print substr($2, 4, 20)
19668 }
19669 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19670         print substr($3, 4, 20)
19671 }' $xxxfiles`
19672 : Append some common names just in case the awk scan failed.
19673 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19674 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19675 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19676 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19677 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19678
19679 : generate a few handy files for later
19680 $cat > signal.c <<EOCP
19681 #include <sys/types.h>
19682 #include <signal.h>
19683 #$i_stdlib I_STDLIB
19684 #ifdef I_STDLIB
19685 #include <stdlib.h>
19686 #endif
19687 #include <stdio.h>
19688 int main() {
19689
19690 /* Strange style to avoid deeply-nested #if/#else/#endif */
19691 #ifndef NSIG
19692 #  ifdef _NSIG
19693 #    define NSIG (_NSIG)
19694 #  endif
19695 #endif
19696
19697 #ifndef NSIG
19698 #  ifdef SIGMAX
19699 #    define NSIG (SIGMAX+1)
19700 #  endif
19701 #endif
19702
19703 #ifndef NSIG
19704 #  ifdef SIG_MAX
19705 #    define NSIG (SIG_MAX+1)
19706 #  endif
19707 #endif
19708
19709 #ifndef NSIG
19710 #  ifdef _SIG_MAX
19711 #    define NSIG (_SIG_MAX+1)
19712 #  endif
19713 #endif
19714
19715 #ifndef NSIG
19716 #  ifdef MAXSIG
19717 #    define NSIG (MAXSIG+1)
19718 #  endif
19719 #endif
19720
19721 #ifndef NSIG
19722 #  ifdef MAX_SIG
19723 #    define NSIG (MAX_SIG+1)
19724 #  endif
19725 #endif
19726
19727 #ifndef NSIG
19728 #  ifdef SIGARRAYSIZE
19729 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19730 #  endif
19731 #endif
19732
19733 #ifndef NSIG
19734 #  ifdef _sys_nsig
19735 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19736 #  endif
19737 #endif
19738
19739 /* Default to some arbitrary number that's big enough to get most
19740    of the common signals.
19741 */
19742 #ifndef NSIG
19743 #    define NSIG 50
19744 #endif
19745
19746 printf("NSIG %d\n", NSIG);
19747
19748 #ifndef JUST_NSIG
19749
19750 EOCP
19751
19752 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19753 {
19754         printf "#ifdef SIG"; printf $1; printf "\n"
19755         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19756         printf $1; printf ");\n"
19757         printf "#endif\n"
19758 }
19759 END {
19760         printf "#endif /* JUST_NSIG */\n";
19761         printf "exit(0);\n}\n";
19762 }
19763 ' >>signal.c
19764 $cat >signal.awk <<'EOP'
19765 BEGIN { ndups = 0 }
19766 $1 ~ /^NSIG$/ { nsig = $2 }
19767 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19768     if ($2 > maxsig) { maxsig = $2 }
19769     if (sig_name[$2]) {
19770         dup_name[ndups] = $1
19771         dup_num[ndups] = $2
19772         ndups++ 
19773     }
19774     else {
19775         sig_name[$2] = $1
19776         sig_num[$2] = $2
19777     }
19778 }
19779 END { 
19780     if (nsig == 0) {
19781         nsig = maxsig + 1
19782     }
19783     printf("NSIG %d\n", nsig);
19784     for (n = 1; n < nsig; n++) {
19785         if (sig_name[n]) {
19786             printf("%s %d\n", sig_name[n], sig_num[n])
19787         }
19788         else {
19789             printf("NUM%d %d\n", n, n) 
19790         }
19791     }
19792     for (n = 0; n < ndups; n++) {
19793         printf("%s %d\n", dup_name[n], dup_num[n])
19794     }
19795 }
19796 EOP
19797 $cat >signal_cmd <<EOS
19798 $startsh
19799 if $test -s signal.lst; then
19800     echo "Using your existing signal.lst file"
19801         exit 0
19802 fi
19803 xxx="$xxx"
19804 EOS
19805 $cat >>signal_cmd <<'EOS'
19806
19807 set signal
19808 if eval $compile_ok; then
19809         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19810 else
19811         echo "(I can't seem be able to compile the whole test program)" >&4
19812         echo "(I'll try it in little pieces.)" >&4
19813         set signal -DJUST_NSIG
19814         if eval $compile_ok; then
19815                 $run ./signal$_exe > signal.nsg
19816                 $cat signal.nsg
19817         else
19818                 echo "I can't seem to figure out how many signals you have." >&4
19819                 echo "Guessing 50." >&4
19820                 echo 'NSIG 50' > signal.nsg
19821         fi
19822         : Now look at all the signal names, one at a time.
19823         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19824                 $cat > signal.c <<EOCP
19825 #include <sys/types.h>
19826 #include <signal.h>
19827 #include <stdio.h>
19828 int main() {
19829 printf("$xx %d\n", SIG${xx});
19830 return 0;
19831 }
19832 EOCP
19833                 set signal
19834                 if eval $compile; then
19835                         echo "SIG${xx} found."
19836                         $run ./signal$_exe  >> signal.ls1
19837                 else
19838                         echo "SIG${xx} NOT found."
19839                 fi
19840         done
19841         if $test -s signal.ls1; then
19842                 $cat signal.nsg signal.ls1 |
19843                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19844         fi
19845
19846 fi
19847 if $test -s signal.lst; then
19848         :
19849 else
19850         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19851         echo 'kill -l' >signal
19852         set X `csh -f <signal`
19853         $rm -f signal
19854         shift
19855         case $# in
19856         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19857         esac
19858         echo $@ | $tr ' ' $trnl | \
19859             $awk '{ printf "%s %d\n", $1, ++s; }
19860                   END { printf "NSIG %d\n", ++s }' >signal.lst
19861 fi
19862 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19863 EOS
19864 chmod a+x signal_cmd
19865 $eunicefix signal_cmd
19866
19867 : generate list of signal names
19868 echo " "
19869 case "$sig_name_init" in
19870 '') doinit=yes ;;
19871 *)  case "$sig_num_init" in
19872     ''|*,*) doinit=yes ;;
19873     esac ;;
19874 esac
19875 case "$doinit" in
19876 yes)
19877         echo "Generating a list of signal names and numbers..." >&4
19878         . ./signal_cmd
19879         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19880         sig_name=`$awk 'BEGIN { printf "ZERO " }
19881                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19882         sig_num=`$awk  'BEGIN { printf "0 " }
19883                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19884         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19885                              !/^NSIG/   { printf "\"%s\", ", $1 }
19886                              END        { printf "0\n" }' signal.lst`
19887         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19888                              !/^NSIG/   { printf "%d, ", $2}
19889                              END        { printf "0\n"}' signal.lst`
19890         ;;
19891 esac
19892 echo "The following $sig_count signals are available:"
19893 echo " "
19894 echo $sig_name | $awk \
19895 'BEGIN { linelen = 0 }
19896 {
19897         for (i = 1; i <= NF; i++) {
19898                 name = "SIG" $i " "
19899                 linelen = linelen + length(name)
19900                 if (linelen > 70) {
19901                         printf "\n"
19902                         linelen = length(name)
19903                 }
19904                 printf "%s", name
19905         }
19906         printf "\n"
19907 }'
19908 sig_size=`echo $sig_name | awk '{print NF}'`
19909 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19910
19911 echo " "
19912 case "$sizetype" in
19913 *_t) zzz="$sizetype"    ;;
19914 *)   zzz="filesize"     ;;
19915 esac
19916 echo "Checking the size of $zzz..." >&4 
19917 cat > try.c <<EOCP
19918 #include <sys/types.h>
19919 #include <stdio.h>
19920 #$i_stdlib I_STDLIB
19921 #ifdef I_STDLIB
19922 #include <stdlib.h>
19923 #endif
19924 int main() {
19925     printf("%d\n", (int)sizeof($sizetype));
19926     exit(0);
19927 }
19928 EOCP
19929 set try
19930 if eval $compile_ok; then
19931         yyy=`$run ./try`
19932         case "$yyy" in
19933         '')     sizesize=4
19934                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19935                 ;;
19936         *)      sizesize=$yyy
19937                 echo "Your $zzz size is $sizesize bytes."
19938                 ;;
19939         esac
19940 else
19941         sizesize=4
19942         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19943 fi
19944
19945
19946 : check for socklen_t
19947 echo " "
19948 echo "Checking to see if you have socklen_t..." >&4
19949 $cat >try.c <<EOCP
19950 #include <sys/types.h>
19951 #$d_socket HAS_SOCKET
19952 #ifdef HAS_SOCKET
19953 #include <sys/socket.h>
19954 #endif
19955 int main() { socklen_t x = 16; }
19956 EOCP
19957 set try
19958 if eval $compile; then
19959         val="$define"
19960         echo "You have socklen_t."
19961 else
19962         val="$undef"
19963         echo "You do not have socklen_t."
19964         case "$sizetype" in
19965         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19966         esac
19967 fi
19968 $rm -f try try.*
19969 set d_socklen_t
19970 eval $setvar
19971
19972 : see if this is a socks.h system
19973 set socks.h i_socks
19974 eval $inhdr
19975
19976 : check for type of the size argument to socket calls
19977 case "$d_socket" in
19978 "$define")
19979         $cat <<EOM
19980
19981 Checking to see what type is the last argument of accept().
19982 EOM
19983         yyy=''
19984         case "$d_socklen_t" in
19985         "$define") yyy="$yyy socklen_t"
19986         esac
19987         yyy="$yyy $sizetype int long unsigned"
19988         for xxx in $yyy; do
19989                 case "$socksizetype" in
19990                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19991                         case "$usesocks" in
19992                         "$define")
19993                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19994                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19995                                         socksizetype="$xxx"
19996                                 fi
19997                                 ;;
19998                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19999                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20000                                         socksizetype="$xxx"
20001                                 fi
20002                                 ;;
20003                         esac
20004                         ;;
20005                 esac
20006         done
20007 : In case none of those worked, prompt the user.
20008         case "$socksizetype" in
20009         '')     rp='What is the type for socket address structure sizes?'
20010                 dflt='int'
20011                 . ./myread
20012                 socksizetype=$ans
20013                 ;;
20014         esac
20015         ;;
20016 *)      : no sockets, so pick relatively harmless default
20017         socksizetype='int'
20018         ;;
20019 esac
20020
20021 : see what type is used for signed size_t
20022 set ssize_t ssizetype int stdio.h sys/types.h
20023 eval $typedef
20024 dflt="$ssizetype"
20025 $cat > try.c <<EOM
20026 #include <stdio.h>
20027 #$i_stdlib I_STDLIB
20028 #ifdef I_STDLIB
20029 #include <stdlib.h>
20030 #endif
20031 #include <sys/types.h>
20032 #define Size_t $sizetype
20033 #define SSize_t $dflt
20034 int main()
20035 {
20036         if (sizeof(Size_t) == sizeof(SSize_t))
20037                 printf("$dflt\n");
20038         else if (sizeof(Size_t) == sizeof(int))
20039                 printf("int\n");
20040         else 
20041                 printf("long\n");
20042         exit(0);
20043 }
20044 EOM
20045 echo " "
20046 set try
20047 if eval $compile_ok && $run ./try > /dev/null; then
20048         ssizetype=`$run ./try`
20049         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20050 else
20051         $cat >&4 <<EOM
20052 Help! I can't compile and run the ssize_t test program: please enlighten me!
20053 (This is probably a misconfiguration in your system or libraries, and
20054 you really ought to fix it.  Still, I'll try anyway.)
20055
20056 I need a type that is the same size as $sizetype, but is guaranteed to
20057 be signed.  Common values are ssize_t, int and long.
20058
20059 EOM
20060         rp="What signed type is the same size as $sizetype?"
20061         . ./myread
20062         ssizetype="$ans"
20063 fi
20064 $rm -f try try.*
20065
20066 : see what type of char stdio uses.
20067 echo " "
20068 echo '#include <stdio.h>' > stdio.c
20069 $cppstdin $cppminus < stdio.c > stdioh
20070 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20071         echo "Your stdio uses unsigned chars." >&4
20072         stdchar="unsigned char"
20073 else
20074         echo "Your stdio uses signed chars." >&4
20075         stdchar="char"
20076 fi
20077 $rm -f stdio.* stdioh
20078
20079 : see what type uids are declared as in the kernel
20080 echo " "
20081 echo "Looking for the type for user ids returned by getuid()."
20082 set uid_t uidtype xxx stdio.h sys/types.h
20083 eval $typedef
20084 case "$uidtype" in
20085 xxx)
20086         xxx=`./findhdr sys/user.h`
20087         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20088         case $1 in
20089         unsigned) dflt="$1 $2" ;;
20090         *) dflt="$1" ;;
20091         esac
20092         ;;
20093 *) dflt="$uidtype";;
20094 esac
20095 case "$uidtype" in
20096 uid_t)  echo "uid_t found." ;;
20097 *)      rp="What is the type for user ids returned by getuid()?"
20098         . ./myread
20099         uidtype="$ans"
20100         ;;
20101 esac
20102
20103 echo " "
20104 case "$uidtype" in
20105 *_t) zzz="$uidtype"     ;;
20106 *)   zzz="uid"          ;;
20107 esac
20108 echo "Checking the size of $zzz..." >&4 
20109 cat > try.c <<EOCP
20110 #include <sys/types.h>
20111 #include <stdio.h>
20112 #$i_stdlib I_STDLIB
20113 #ifdef I_STDLIB
20114 #include <stdlib.h>
20115 #endif
20116 int main() {
20117     printf("%d\n", (int)sizeof($uidtype));
20118     exit(0);
20119 }
20120 EOCP
20121 set try
20122 if eval $compile_ok; then
20123         yyy=`$run ./try`
20124         case "$yyy" in
20125         '')     uidsize=4
20126                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20127                 ;;
20128         *)      uidsize=$yyy
20129                 echo "Your $zzz is $uidsize bytes long."
20130                 ;;
20131         esac
20132 else
20133         uidsize=4
20134         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20135 fi
20136
20137 echo " "
20138 case "$uidtype" in
20139 *_t) zzz="$uidtype"     ;;
20140 *)   zzz="uid"          ;;
20141 esac
20142 echo "Checking the sign of $zzz..." >&4
20143 cat > try.c <<EOCP
20144 #include <sys/types.h>
20145 #include <stdio.h>
20146 int main() {
20147         $uidtype foo = -1;
20148         if (foo < 0)
20149                 printf("-1\n");
20150         else
20151                 printf("1\n");
20152 }
20153 EOCP
20154 set try
20155 if eval $compile; then
20156         yyy=`$run ./try`
20157         case "$yyy" in
20158         '')     uidsign=1
20159                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20160                 ;;
20161         *)      uidsign=$yyy
20162                 case "$uidsign" in
20163                  1) echo "Your $zzz is unsigned." ;;
20164                 -1) echo "Your $zzz is signed."   ;;
20165                 esac
20166                 ;;
20167         esac
20168 else
20169         uidsign=1
20170         echo "(I can't compile the test program--guessing unsigned.)" >&4
20171 fi
20172
20173
20174
20175 echo " "
20176 $echo "Checking the format string to be used for uids..." >&4
20177
20178 case "$uidsign" in
20179 -1)     if $test X"$uidsize" = X"$ivsize"; then
20180                 uidformat="$ivdformat"
20181         else
20182                 if $test X"$uidsize" = X"$longsize"; then
20183                         uidformat='"ld"'
20184                 else
20185                         if $test X"$uidsize" = X"$intsize"; then
20186                                 uidformat='"d"'
20187                         else
20188                                 if $test X"$uidsize" = X"$shortsize"; then
20189                                         uidformat='"hd"'
20190                                 fi
20191                         fi
20192                 fi
20193         fi
20194         ;;
20195 *)      if $test X"$uidsize" = X"$uvsize"; then
20196                 uidformat="$uvuformat"
20197         else
20198                 if $test X"$uidsize" = X"$longsize"; then
20199                         uidformat='"lu"'
20200                 else
20201                         if $test X"$uidsize" = X"$intsize"; then
20202                                 uidformat='"u"'
20203                         else
20204                                 if $test X"$uidsize" = X"$shortsize"; then
20205                                         uidformat='"hu"'
20206                                 fi
20207                         fi
20208                 fi
20209         fi
20210         ;;
20211 esac
20212
20213
20214 case "$usesitecustomize" in
20215     $define|true|[Yy]*)
20216         usesitecustomize="$define"
20217         ;;
20218     *)
20219         usesitecustomize="$undef"
20220         ;;
20221     esac
20222
20223 : determine compiler compiler
20224 case "$yacc" in
20225 '')
20226         dflt=yacc;;
20227 *)
20228         dflt="$yacc";;
20229 esac
20230 echo " "
20231 comp='yacc'
20232 if $test -f "$byacc$_exe"; then
20233         dflt="$byacc"
20234         comp="byacc or $comp"
20235 fi
20236 if $test -f "$bison$_exe"; then
20237         comp="$comp or bison -y"
20238 fi
20239 rp="Which compiler compiler ($comp) shall I use?"
20240 . ./myread
20241 yacc="$ans"
20242 case "$yacc" in
20243 *bis*)
20244         case "$yacc" in
20245         *-y*) ;;
20246         *)
20247                 yacc="$yacc -y"
20248                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20249                 ;;
20250         esac
20251         ;;
20252 esac
20253
20254 : see if this is a fp.h system
20255 set fp.h i_fp
20256 eval $inhdr
20257
20258 : see if this is a fp_class.h system
20259 set fp_class.h i_fp_class
20260 eval $inhdr
20261
20262 : see if gdbm.h is available
20263 set gdbm.h t_gdbm
20264 eval $inhdr
20265 case "$t_gdbm" in
20266 $define)
20267         : see if gdbm_open exists
20268         set gdbm_open d_gdbm_open
20269         eval $inlibc
20270         case "$d_gdbm_open" in
20271         $undef)
20272                 t_gdbm="$undef"
20273                 echo "We won't be including <gdbm.h>"
20274                 ;;
20275         esac
20276         ;;
20277 esac
20278 val="$t_gdbm"
20279 set i_gdbm
20280 eval $setvar
20281
20282 : see if this is a ieeefp.h system
20283 case "$i_ieeefp" in
20284 '' ) set ieeefp.h i_ieeefp
20285      eval $inhdr
20286      ;;
20287 esac
20288
20289 : see if this is a libutil.h system
20290 set libutil.h i_libutil
20291 eval $inhdr
20292
20293 : see if mach cthreads are available
20294 if test "X$usethreads" = "X$define"; then
20295         set mach/cthreads.h i_machcthr
20296         eval $inhdr
20297 else
20298         i_machcthr="$undef"
20299 fi
20300
20301
20302
20303 : see if this is a mntent.h system
20304 set mntent.h i_mntent
20305 eval $inhdr
20306
20307 : see if ndbm.h is available
20308 set ndbm.h t_ndbm
20309 eval $inhdr
20310
20311 case "$t_ndbm" in
20312 $undef)
20313     # Some Linux distributions such as RedHat 7.1 put the
20314     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20315     if $test -f /usr/include/gdbm/ndbm.h; then
20316         echo '<gdbm/ndbm.h> found.'
20317         ccflags="$ccflags -I/usr/include/gdbm"
20318         cppflags="$cppflags -I/usr/include/gdbm"
20319         t_ndbm=$define
20320     fi
20321     ;;
20322 esac
20323
20324 case "$t_ndbm" in
20325 $define)
20326         : see if dbm_open exists
20327         set dbm_open d_dbm_open
20328         eval $inlibc
20329         case "$d_dbm_open" in
20330         $undef)
20331                 t_ndbm="$undef"
20332                 echo "We won't be including <ndbm.h>"
20333                 ;;
20334         esac
20335         ;;
20336 esac
20337 val="$t_ndbm"
20338 set i_ndbm
20339 eval $setvar
20340
20341 : see if net/errno.h is available
20342 val=''
20343 set net/errno.h val
20344 eval $inhdr
20345
20346 : Unfortunately, it causes problems on some systems.  Arrgh.
20347 case "$val" in
20348 $define)
20349         cat > try.c <<'EOM'
20350 #include <stdio.h>
20351 #include <errno.h>
20352 #include <net/errno.h>
20353 int func()
20354 {
20355         return ENOTSOCK;
20356 }
20357 EOM
20358         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20359                 echo "We'll be including <net/errno.h>." >&4
20360         else
20361                 echo "We won't be including <net/errno.h>." >&4
20362                 val="$undef"
20363         fi
20364         $rm -f try.* try
20365         ;;
20366 esac
20367 set i_neterrno
20368 eval $setvar
20369
20370 : see if netinet/tcp.h is available
20371 set netinet/tcp.h i_netinettcp
20372 eval $inhdr
20373
20374 : see if this is a poll.h system
20375 set poll.h i_poll
20376 eval $inhdr
20377
20378 : see if this is a prot.h system
20379 set prot.h i_prot
20380 eval $inhdr
20381
20382 echo " "
20383 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20384 $cat <<'EOSH' > Cppsym.know
20385 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20386 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20387 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20388 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20389 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20390 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20391 bull c cadmus clipper CMU COFF COMPILER_VERSION
20392 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20393 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20394 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20395 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20396 GLIBC GLIBC_MINOR
20397 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20398 H3050R H3050RX hbullx20 hcx host_mips
20399 hp200 hp300 hp700 HP700 hp800 hp9000
20400 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20401 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20402 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20403 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20404 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20405 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20406 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20407 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20408 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20409 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20410 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20411 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20412 MATH_HAS_NO_SIDE_EFFECTS
20413 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20414 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20415 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20416 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20417 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20418 NetBSD news1500 news1700 news1800 news1900 news3700
20419 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20420 ns32016 ns32332 ns32k nsc32000
20421 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20422 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20423 pc532 pdp11 PGC PIC plexus PORTAR posix
20424 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20425 POSIX_C_SOURCE POSIX_SOURCE POWER
20426 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20427 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20428 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20429 sony sony_news sonyrisc sparc sparclite spectrum
20430 stardent stdc STDC_EXT stratos sun sun3 sun386
20431 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20432 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20433 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20434 sysV68 sysV88 Tek4132 Tek4300 titan
20435 TM3200 TM5400 TM5600
20436 tower tower32 tower32_200 tower32_600 tower32_700
20437 tower32_800 tower32_850 tss
20438 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20439 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20440 unix UNIX95 UNIX99 unixpc unos
20441 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20442 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20443 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20444 USGr4 USGr4_2
20445 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20446 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20447 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20448 z8000
20449 EOSH
20450 # Maybe put other stuff here too.
20451 cat <<EOSH >>Cppsym.know
20452 $osname
20453 EOSH
20454 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20455 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20456 $cat Cppsym.know > Cppsym.c
20457 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20458 $rm -f Cppsym.a Cppsym.b Cppsym.c
20459 cat <<EOSH > Cppsym
20460 $startsh
20461 if $test \$# -gt 0; then
20462     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20463     if $test -s Cppsym.got; then
20464         $rm -f Cppsym.got
20465         exit 0
20466     fi
20467     $rm -f Cppsym.got
20468     exit 1
20469 else
20470     $tr " " "$trnl" | ./Cppsym.try
20471     exit 0
20472 fi
20473 EOSH
20474 chmod +x Cppsym
20475 $eunicefix Cppsym
20476 cat <<EOSH > Cppsym.try
20477 $startsh
20478 cat <<'EOCP' > try.c
20479 #include <stdio.h>
20480 #if cpp_stuff == 1
20481 #define STRINGIFY(a)    "a"
20482 #endif
20483 #if cpp_stuff == 42
20484 #define StGiFy(a)  #a
20485 #define STRINGIFY(a)    StGiFy(a)
20486 #endif
20487 #if $cpp_stuff != 1 && $cpp_stuff != 42
20488 #   include "Bletch: How does this C preprocessor stringify macros?"
20489 #endif
20490 int main() {
20491 EOCP
20492 $awk \\
20493 EOSH
20494 cat <<'EOSH' >> Cppsym.try
20495 'length($1) > 0 {
20496     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20497     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20498     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20499     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20500 }'       >> try.c
20501 echo 'return 0;}' >> try.c
20502 EOSH
20503 cat <<EOSH >> Cppsym.try
20504 ccflags="$ccflags"
20505 case "$osname-$gccversion" in
20506 irix-) ccflags="\$ccflags -woff 1178" ;;
20507 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20508 esac
20509 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20510 EOSH
20511 chmod +x Cppsym.try
20512 $eunicefix Cppsym.try
20513 ./Cppsym < Cppsym.know > Cppsym.true
20514 : Add in any linux cpp "predefined macros":
20515 case "$osname::$gccversion" in
20516   *linux*::*.*)
20517     tHdrH=_tmpHdr
20518     rm -f $tHdrH'.h' $tHdrH
20519     touch $tHdrH'.h'
20520     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20521        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20522        if [ -s $tHdrH'_cppsym.real' ]; then
20523           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20524        fi
20525     fi
20526     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20527   ;;
20528 esac
20529 : now check the C compiler for additional symbols
20530 postprocess_cc_v=''
20531 case "$osname" in
20532 aix) postprocess_cc_v="|$tr , ' '" ;;
20533 esac
20534 $cat >ccsym <<EOS
20535 $startsh
20536 $cat >tmp.c <<EOF
20537 extern int foo;
20538 EOF
20539 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20540 do
20541         case "\$i" in
20542         -D*) echo "\$i" | $sed 's/^-D//';;
20543         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20544         esac
20545 done
20546 $rm -f try.c
20547 EOS
20548 postprocess_cc_v=''
20549 chmod +x ccsym
20550 $eunicefix ccsym
20551 ./ccsym > ccsym1.raw
20552 if $test -s ccsym1.raw; then
20553        $sort ccsym1.raw | $uniq >ccsym.raw
20554 else
20555        mv ccsym1.raw ccsym.raw
20556 fi
20557
20558 $awk '/\=/ { print $0; next }
20559         { print $0"=1" }' ccsym.raw >ccsym.list
20560 $comm -13 Cppsym.true ccsym.list >ccsym.own
20561 $comm -12 Cppsym.true ccsym.list >ccsym.com
20562 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20563 also=''
20564 if $test -z ccsym.raw; then
20565         echo "Your C compiler doesn't seem to define any symbols!" >&4
20566         echo " "
20567         echo "However, your C preprocessor defines the following symbols:"
20568         $cat Cppsym.true
20569         ccsymbols=''
20570         cppsymbols=`$cat Cppsym.true`
20571         cppsymbols=`echo $cppsymbols`
20572         cppccsymbols="$cppsymbols"
20573 else
20574         if $test -s ccsym.com; then
20575                 echo "Your C compiler and pre-processor define these symbols:"
20576                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20577                 also='also '
20578                 symbols='ones'
20579                 cppccsymbols=`$cat ccsym.com`
20580                 cppccsymbols=`echo $cppccsymbols`
20581                 $test "$silent" || sleep 1
20582         fi
20583         if $test -s ccsym.cpp; then
20584                 $test "$also" && echo " "
20585                 echo "Your C pre-processor ${also}defines the following symbols:"
20586                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20587                 also='further '
20588                 cppsymbols=`$cat ccsym.cpp`
20589                 cppsymbols=`echo $cppsymbols`
20590                 $test "$silent" || sleep 1
20591         fi
20592         if $test -s ccsym.own; then
20593                 $test "$also" && echo " "
20594                 echo "Your C compiler ${also}defines the following cpp symbols:"
20595                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20596                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20597                 ccsymbols=`$cat ccsym.own`
20598                 ccsymbols=`echo $ccsymbols`
20599                 $test "$silent" || sleep 1
20600         fi
20601 fi
20602
20603 : see if this is a termio system
20604 val="$undef"
20605 val2="$undef"
20606 val3="$undef"
20607 if $test `./findhdr termios.h`; then
20608         set tcsetattr i_termios
20609         eval $inlibc
20610         val3="$i_termios"
20611 fi
20612 echo " "
20613 case "$val3" in
20614 "$define") echo "You have POSIX termios.h... good!" >&4;;
20615 *) if ./Cppsym pyr; then
20616                 case "`/bin/universe`" in
20617                 ucb) if $test `./findhdr sgtty.h`; then
20618                                 val2="$define"
20619                                 echo "<sgtty.h> found." >&4
20620                         else
20621                                 echo "System is pyramid with BSD universe."
20622                                 echo "<sgtty.h> not found--you could have problems." >&4
20623                         fi;;
20624                 *) if $test `./findhdr termio.h`; then
20625                                 val="$define"
20626                                 echo "<termio.h> found." >&4
20627                         else
20628                                 echo "System is pyramid with USG universe."
20629                                 echo "<termio.h> not found--you could have problems." >&4
20630                         fi;;
20631                 esac
20632         elif ./usg; then
20633                 if $test `./findhdr termio.h`; then
20634                         echo "<termio.h> found." >&4
20635                         val="$define"
20636                 elif $test `./findhdr sgtty.h`; then
20637                         echo "<sgtty.h> found." >&4
20638                         val2="$define"
20639                 else
20640 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20641                 fi
20642         else
20643                 if $test `./findhdr sgtty.h`; then
20644                         echo "<sgtty.h> found." >&4
20645                         val2="$define"
20646                 elif $test `./findhdr termio.h`; then
20647                         echo "<termio.h> found." >&4
20648                         val="$define"
20649                 else
20650 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20651                 fi
20652         fi;;
20653 esac
20654 set i_termio; eval $setvar
20655 val=$val2; set i_sgtty; eval $setvar
20656 val=$val3; set i_termios; eval $setvar
20657
20658 : see if stddef is available
20659 set stddef.h i_stddef
20660 eval $inhdr
20661
20662 : see if this is a sunmath.h system
20663 set sunmath.h i_sunmath
20664 eval $inhdr
20665
20666 : see if sys/access.h is available
20667 set sys/access.h i_sysaccess
20668 eval $inhdr
20669
20670 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20671 set sys/filio.h i_sysfilio
20672 eval $inhdr
20673 echo " "
20674 if $test `./findhdr sys/ioctl.h`; then
20675         val="$define"
20676         echo '<sys/ioctl.h> found.' >&4
20677 else
20678         val="$undef"
20679         if $test $i_sysfilio = "$define"; then
20680             echo '<sys/ioctl.h> NOT found.' >&4
20681         else
20682                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20683                 $test $i_termio = "$define" && xxx="termio.h"
20684                 $test $i_termios = "$define" && xxx="termios.h"
20685 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20686         fi
20687 fi
20688 set i_sysioctl
20689 eval $setvar
20690
20691 : see if socket ioctl defs are in sys/sockio.h
20692 echo " "
20693 xxx=`./findhdr sys/sockio.h`
20694 if $test "$xxx"; then
20695         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20696                 val="$define"
20697                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20698         else
20699                 val="$undef"
20700                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20701         fi
20702 else
20703         val="$undef"
20704         $cat <<EOM
20705 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20706 EOM
20707 fi
20708 set i_syssockio
20709 eval $setvar
20710
20711
20712 : see if this is a syslog.h system
20713 set syslog.h i_syslog
20714 eval $inhdr
20715
20716
20717 : see if this is a sys/mode.h system
20718 set sys/mode.h i_sysmode
20719 eval $inhdr
20720
20721 : see if sys/resource.h has to be included
20722 set sys/resource.h i_sysresrc
20723 eval $inhdr
20724
20725 : see if sys/security.h is available
20726 set sys/security.h i_syssecrt
20727 eval $inhdr
20728
20729 : see if this is a sys/statvfs.h system
20730 set sys/statvfs.h i_sysstatvfs
20731 eval $inhdr
20732
20733 : see if this is a sys/un.h system
20734 set sys/un.h i_sysun
20735 eval $inhdr
20736
20737
20738 : see if this is a sys/utsname.h system
20739 set sys/utsname.h i_sysutsname
20740 eval $inhdr
20741
20742 : see if this is a syswait system
20743 set sys/wait.h i_syswait
20744 eval $inhdr
20745
20746 : see if this is a ustat.h system
20747 set ustat.h i_ustat
20748 eval $inhdr
20749
20750 : see if this is an utime system
20751 set utime.h i_utime
20752 eval $inhdr
20753
20754 : see if this is a values.h system
20755 set values.h i_values
20756 eval $inhdr
20757
20758 : see if this is a vfork system
20759 case "$d_vfork" in
20760 "$define")
20761         set vfork.h i_vfork
20762         eval $inhdr
20763         ;;
20764 *)
20765         i_vfork="$undef"
20766         ;;
20767 esac
20768
20769 echo " "
20770 echo "Looking for extensions..." >&4
20771 : If we are using the old config.sh, known_extensions may contain
20772 : old or inaccurate or duplicate values.
20773 known_extensions=''
20774 nonxs_extensions=''
20775 : We do not use find because it might not be available.
20776 : We do not just use MANIFEST because the user may have dropped
20777 : some additional extensions into the source tree and expect them
20778 : to be built.
20779
20780 : Function to recursively find available extensions, ignoring DynaLoader
20781 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20782 find_extensions='
20783     for xxx in *; do
20784        case "$xxx" in
20785            DynaLoader|dynaload) ;;
20786            *)
20787            if $test -f $xxx/$xxx.xs; then
20788                known_extensions="$known_extensions $1$xxx";
20789            elif $test -f $xxx/Makefile.PL; then
20790                nonxs_extensions="$nonxs_extensions $1$xxx";
20791            else
20792                if $test -d $xxx -a $# -lt 10; then
20793                    set $1$xxx/ $*;
20794                    cd "$xxx";
20795                    eval $find_extensions;
20796                    cd ..;
20797                    shift;
20798                fi;
20799            fi
20800            ;;
20801        esac;
20802     done'
20803 tdir=`pwd`
20804 cd "$rsrc/ext"
20805 set X
20806 shift
20807 eval $find_extensions
20808 # Special case:  Add in threads/shared since it is not picked up by the
20809 # recursive find above (and adding in general recursive finding breaks
20810 # SDBM_File/sdbm).  A.D.  10/25/2001.
20811 known_extensions="$known_extensions threads/shared"
20812 set X $nonxs_extensions
20813 shift
20814 nonxs_extensions="$*"
20815 set X $known_extensions
20816 shift
20817 known_extensions="$*"
20818 cd "$tdir"
20819
20820 : Now see which are supported on this system.
20821 avail_ext=''
20822 for xxx in $known_extensions ; do
20823         case "$xxx" in
20824         DB_File|db_file)
20825                 case "$i_db" in
20826                 $define) avail_ext="$avail_ext $xxx" ;;
20827                 esac
20828                 ;;
20829         GDBM_File|gdbm_fil)
20830                 case "$i_gdbm" in 
20831                 $define) avail_ext="$avail_ext $xxx" ;;
20832                 esac
20833                 ;;
20834         I18N/Langinfo|i18n_lan)
20835                 case "$i_langinfo$d_nl_langinfo" in 
20836                 $define$define) avail_ext="$avail_ext $xxx" ;;
20837                 esac
20838                 ;;
20839         NDBM_File|ndbm_fil)
20840                 case "$i_ndbm" in
20841                 $define)
20842                     case "$osname-$use64bitint" in
20843                     hpux-define)
20844                         case "$libs" in
20845                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20846                         esac
20847                         ;;
20848                     *) avail_ext="$avail_ext $xxx" ;;
20849                     esac
20850                     ;;
20851                 esac
20852                 ;;
20853         ODBM_File|odbm_fil) 
20854                 case "${i_dbm}${i_rpcsvcdbm}" in
20855                 *"${define}"*)
20856                     case "$osname-$use64bitint" in
20857                     hpux-define)
20858                         case "$libs" in
20859                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20860                         esac
20861                         ;;
20862                     *) avail_ext="$avail_ext $xxx" ;;
20863                     esac
20864                     ;;
20865                 esac
20866                 ;;
20867         POSIX|posix)
20868                 case "$useposix" in
20869                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20870                 esac
20871                 ;;
20872         Opcode|opcode)
20873                 case "$useopcode" in
20874                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20875                 esac
20876                 ;;
20877         Socket|socket)
20878                 case "$d_socket" in 
20879                 true|$define|y)
20880                     case "$osname" in
20881                     beos) ;; # not unless BONE
20882                     *) avail_ext="$avail_ext $xxx" ;;
20883                     esac
20884                     ;;
20885                 esac
20886                 ;;
20887         Sys/Syslog|sys/syslog)
20888                 : XXX syslog requires socket
20889                 case "$d_socket" in 
20890                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20891                 esac
20892                 ;;
20893         Thread|thread)
20894                 case "$usethreads" in
20895                 true|$define|y)
20896                         case "$useithreads" in
20897                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20898                         esac
20899                 esac
20900                 ;;
20901         XS/APItest|xs/apitest)
20902                 # This is just for testing.  Skip it unless we have dynamic loading.
20903
20904                 case "$usedl" in
20905                 $define) avail_ext="$avail_ext $xxx" ;;
20906                 esac
20907                 ;;
20908         XS/Typemap|xs/typemap)
20909                 # This is just for testing.  Skip it unless we have dynamic loading.
20910                 case "$usedl" in
20911                 $define) avail_ext="$avail_ext $xxx" ;;
20912                 esac
20913                 ;;
20914         threads|threads/shared)
20915                 # threads and threads::shared are special cases.
20916                 # To stop people from asking "Perl 5.8.0 was supposed
20917                 # to have this new fancy threads implementation but my
20918                 # perl doesn't have it" and from people trying to
20919                 # (re)install the threads module using CPAN.pm and
20920                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20921                 # the threads.pm and threads/shared.pm will always be
20922                 # there, croaking informatively ("you need to rebuild
20923                 # all of Perl with threads, sorry") when threads haven't
20924                 # been compiled in.
20925                 # --jhi
20926                 avail_ext="$avail_ext $xxx"
20927                 ;;
20928         IPC/SysV|ipc/sysv)
20929                 : XXX Do we need a useipcsysv variable here
20930                 case "${d_msg}${d_sem}${d_shm}" in 
20931                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20932                 esac
20933                 ;;
20934         *)      avail_ext="$avail_ext $xxx"
20935                 ;;
20936         esac
20937 done
20938
20939 set X $avail_ext
20940 shift
20941 avail_ext="$*"
20942
20943 case "$onlyextensions" in
20944 '') ;;
20945 *)  keepextensions=''
20946     echo "You have requested that only certains extensions be included..." >&4
20947     for i in $onlyextensions; do
20948         case " $avail_ext " in
20949         *" $i "*)
20950             echo "Keeping extension $i."
20951             keepextensions="$keepextensions $i"
20952             ;;
20953         *) echo "Ignoring extension $i." ;;
20954         esac
20955     done
20956     avail_ext="$keepextensions"
20957     ;;
20958 esac
20959
20960 case "$noextensions" in
20961 '') ;;
20962 *)  keepextensions=''
20963     echo "You have requested that certain extensions be ignored..." >&4
20964     for i in $avail_ext; do
20965         case " $noextensions " in
20966         *" $i "*) echo "Ignoring extension $i." ;;
20967         *) echo "Keeping extension $i.";
20968            keepextensions="$keepextensions $i"
20969            ;;
20970         esac
20971     done
20972     avail_ext="$keepextensions"
20973     ;;
20974 esac
20975
20976 : Now see which nonxs extensions are supported on this system.
20977 : For now assume all are.
20978 nonxs_ext=''
20979 for xxx in $nonxs_extensions ; do
20980         case "$xxx" in
20981         *)      nonxs_ext="$nonxs_ext $xxx"
20982                 ;;
20983         esac
20984 done
20985
20986 set X $nonxs_ext
20987 shift
20988 nonxs_ext="$*"
20989
20990 case $usedl in
20991 $define)
20992         $cat <<EOM
20993 A number of extensions are supplied with $package.  You may choose to
20994 compile these extensions for dynamic loading (the default), compile
20995 them into the $package executable (static loading), or not include
20996 them at all.  Answer "none" to include no extensions.
20997 Note that DynaLoader is always built and need not be mentioned here.
20998
20999 EOM
21000         case "$dynamic_ext" in
21001         '')
21002                 : Exclude those listed in static_ext
21003                 dflt=''
21004                 for xxx in $avail_ext; do
21005                         case " $static_ext " in
21006                         *" $xxx "*) ;;
21007                         *) dflt="$dflt $xxx" ;;
21008                         esac
21009                 done
21010                 set X $dflt
21011                 shift
21012                 dflt="$*"
21013                 ;;
21014         *)      dflt="$dynamic_ext"
21015                 # Perhaps we are reusing an old out-of-date config.sh.
21016                 case "$hint" in
21017                 previous)
21018                         if test X"$dynamic_ext" != X"$avail_ext"; then
21019                                 $cat <<EOM
21020 NOTICE:  Your previous config.sh list may be incorrect. 
21021 The extensions now available to you are 
21022         ${avail_ext}
21023 but the default list from your previous config.sh is
21024         ${dynamic_ext} 
21025
21026 EOM
21027                         fi
21028                         ;;
21029                 esac
21030                 ;;
21031         esac
21032         case "$dflt" in
21033         '')     dflt=none;;
21034         esac
21035         rp="What extensions do you wish to load dynamically?"
21036         . ./myread
21037         case "$ans" in
21038         none) dynamic_ext=' ' ;;
21039         *) dynamic_ext="$ans" ;;
21040         esac
21041
21042         case "$static_ext" in
21043         '')
21044                 : Exclude those already listed in dynamic linking
21045                 dflt=''
21046                 for xxx in $avail_ext; do
21047                         case " $dynamic_ext " in
21048                         *" $xxx "*) ;;
21049                         *) dflt="$dflt $xxx" ;;
21050                         esac
21051                 done
21052                 set X $dflt
21053                 shift
21054                 dflt="$*"
21055                 ;;
21056         *)  dflt="$static_ext" 
21057                 ;;
21058         esac
21059
21060         case "$dflt" in
21061         '')     dflt=none;;
21062         esac
21063         rp="What extensions do you wish to load statically?"
21064         . ./myread
21065         case "$ans" in
21066         none) static_ext=' ' ;;
21067         *) static_ext="$ans" ;;
21068         esac
21069         ;;
21070 *)
21071         $cat <<EOM
21072 A number of extensions are supplied with $package.  Answer "none" 
21073 to include no extensions. 
21074 Note that DynaLoader is always built and need not be mentioned here.
21075
21076 EOM
21077         case "$static_ext" in
21078         '') dflt="$avail_ext" ;;
21079         *)      dflt="$static_ext"
21080                 # Perhaps we are reusing an old out-of-date config.sh.
21081                 case "$hint" in
21082                 previous)
21083                         if test X"$static_ext" != X"$avail_ext"; then
21084                                 $cat <<EOM
21085 NOTICE:  Your previous config.sh list may be incorrect. 
21086 The extensions now available to you are 
21087         ${avail_ext}
21088 but the default list from your previous config.sh is
21089         ${static_ext} 
21090
21091 EOM
21092                         fi
21093                         ;;
21094                 esac
21095                 ;;
21096         esac
21097         : Exclude those that are not xs extensions
21098         case "$dflt" in
21099         '')     dflt=none;;
21100         esac
21101         rp="What extensions do you wish to include?"
21102         . ./myread
21103         case "$ans" in
21104         none) static_ext=' ' ;;
21105         *) static_ext="$ans" ;;
21106         esac
21107         ;;
21108 esac
21109 #        
21110 # Encode is a special case.  If we are building Encode as a static
21111 # extension, we need to explicitly list its subextensions as well.
21112 # For other nested extensions, this is handled automatically by
21113 # the appropriate Makefile.PL.
21114 case " $static_ext " in
21115         *" Encode "*) # Add the subextensions of Encode
21116         cd "$rsrc/ext"
21117         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21118                 static_ext="$static_ext Encode/$xxx"
21119         done
21120         cd "$tdir"
21121         ;;
21122 esac
21123
21124 set X $dynamic_ext $static_ext $nonxs_ext
21125 shift
21126 extensions="$*"
21127
21128 # Sanity check:  We require an extension suitable for use with
21129 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21130 # should show up as failures in the test suite, but it's helpful to
21131 # catch them now.) The 'extensions' list is normally sorted
21132 # alphabetically, so we need to accept either
21133 #    DB_File ... Fcntl ... IO  ....
21134 # or something like
21135 #    Fcntl ... NDBM_File ... IO  ....
21136 case " $extensions"  in
21137 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21138 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21139 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21140 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21141    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21142    ;;
21143 esac
21144
21145 : Remove libraries needed only for extensions
21146 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21147 : The exception is SunOS 4.x, which needs them.
21148 case "${osname}X${osvers}" in
21149 sunos*X4*)
21150     perllibs="$libs"
21151     ;;
21152 *) case "$usedl" in
21153     $define|true|[yY]*)
21154             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21155             shift
21156             perllibs="$*"
21157             ;;
21158     *)  perllibs="$libs"
21159             ;;
21160     esac
21161     ;;
21162 esac
21163
21164 : Remove build directory name from cppstdin so it can be used from
21165 : either the present location or the final installed location.
21166 echo " "
21167 : Get out of the UU directory to get correct path name.
21168 cd ..
21169 case "$cppstdin" in
21170 `pwd`/cppstdin)
21171         echo "Stripping down cppstdin path name"
21172         cppstdin=cppstdin
21173         ;;
21174 esac
21175 cd UU
21176
21177 : end of configuration questions
21178 echo " "
21179 echo "End of configuration questions."
21180 echo " "
21181
21182 : back to where it started
21183 if test -d ../UU; then
21184         cd ..
21185 fi
21186
21187 : configuration may be patched via a 'config.arch' file
21188 if $test -f config.arch; then
21189         echo "I see a config.arch file, loading it."
21190         . ./config.arch
21191 fi
21192
21193 : configuration may be patched via a 'config.over' file
21194 if $test -f config.over; then
21195         echo " "
21196         dflt=y
21197         rp='I see a config.over file.  Do you wish to load it?'
21198         . UU/myread
21199         case "$ans" in
21200         n*) echo "OK, I'll ignore it.";;
21201         *)      . ./config.over
21202                 echo "Configuration override changes have been loaded."
21203                 ;;
21204         esac
21205 fi
21206
21207 : in case they want portability, strip down executable paths
21208 case "$d_portable" in
21209 "$define")
21210         echo " "
21211         echo "Stripping down executable paths..." >&4
21212         for file in $loclist $trylist; do
21213                 eval temp=\$$file
21214                 eval $file=`basename $temp`
21215         done
21216         ;;
21217 esac
21218
21219 : create config.sh file
21220 echo " "
21221 echo "Creating config.sh..." >&4
21222 $spitshell <<EOT >config.sh
21223 $startsh
21224 #
21225 # This file was produced by running the Configure script. It holds all the
21226 # definitions figured out by Configure. Should you modify one of these values,
21227 # do not forget to propagate your changes by running "Configure -der". You may
21228 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21229 #
21230
21231 # Package name      : $package
21232 # Source directory  : $src
21233 # Configuration time: $cf_time
21234 # Configured by     : $cf_by
21235 # Target system     : $myuname
21236
21237 Author='$Author'
21238 Date='$Date'
21239 Header='$Header'
21240 Id='$Id'
21241 Locker='$Locker'
21242 Log='$Log'
21243 Mcc='$Mcc'
21244 RCSfile='$RCSfile'
21245 Revision='$Revision'
21246 Source='$Source'
21247 State='$State'
21248 _a='$_a'
21249 _exe='$_exe'
21250 _o='$_o'
21251 afs='$afs'
21252 afsroot='$afsroot'
21253 alignbytes='$alignbytes'
21254 ansi2knr='$ansi2knr'
21255 aphostname='$aphostname'
21256 api_revision='$api_revision'
21257 api_subversion='$api_subversion'
21258 api_version='$api_version'
21259 api_versionstring='$api_versionstring'
21260 ar='$ar'
21261 archlib='$archlib'
21262 archlibexp='$archlibexp'
21263 archname64='$archname64'
21264 archname='$archname'
21265 archobjs='$archobjs'
21266 asctime_r_proto='$asctime_r_proto'
21267 awk='$awk'
21268 baserev='$baserev'
21269 bash='$bash'
21270 bin='$bin'
21271 binexp='$binexp'
21272 bison='$bison'
21273 byacc='$byacc'
21274 byteorder='$byteorder'
21275 c='$c'
21276 castflags='$castflags'
21277 cat='$cat'
21278 cc='$cc'
21279 cccdlflags='$cccdlflags'
21280 ccdlflags='$ccdlflags'
21281 ccflags='$ccflags'
21282 ccflags_uselargefiles='$ccflags_uselargefiles'
21283 ccname='$ccname'
21284 ccsymbols='$ccsymbols'
21285 ccversion='$ccversion'
21286 cf_by='$cf_by'
21287 cf_email='$cf_email'
21288 cf_time='$cf_time'
21289 charsize='$charsize'
21290 chgrp='$chgrp'
21291 chmod='$chmod'
21292 chown='$chown'
21293 clocktype='$clocktype'
21294 comm='$comm'
21295 compress='$compress'
21296 contains='$contains'
21297 cp='$cp'
21298 cpio='$cpio'
21299 cpp='$cpp'
21300 cpp_stuff='$cpp_stuff'
21301 cppccsymbols='$cppccsymbols'
21302 cppflags='$cppflags'
21303 cpplast='$cpplast'
21304 cppminus='$cppminus'
21305 cpprun='$cpprun'
21306 cppstdin='$cppstdin'
21307 cppsymbols='$cppsymbols'
21308 crypt_r_proto='$crypt_r_proto'
21309 cryptlib='$cryptlib'
21310 csh='$csh'
21311 ctermid_r_proto='$ctermid_r_proto'
21312 ctime_r_proto='$ctime_r_proto'
21313 d_Gconvert='$d_Gconvert'
21314 d_PRIEUldbl='$d_PRIEUldbl'
21315 d_PRIFUldbl='$d_PRIFUldbl'
21316 d_PRIGUldbl='$d_PRIGUldbl'
21317 d_PRIXU64='$d_PRIXU64'
21318 d_PRId64='$d_PRId64'
21319 d_PRIeldbl='$d_PRIeldbl'
21320 d_PRIfldbl='$d_PRIfldbl'
21321 d_PRIgldbl='$d_PRIgldbl'
21322 d_PRIi64='$d_PRIi64'
21323 d_PRIo64='$d_PRIo64'
21324 d_PRIu64='$d_PRIu64'
21325 d_PRIx64='$d_PRIx64'
21326 d_SCNfldbl='$d_SCNfldbl'
21327 d__fwalk='$d__fwalk'
21328 d_access='$d_access'
21329 d_accessx='$d_accessx'
21330 d_aintl='$d_aintl'
21331 d_alarm='$d_alarm'
21332 d_archlib='$d_archlib'
21333 d_asctime_r='$d_asctime_r'
21334 d_atolf='$d_atolf'
21335 d_atoll='$d_atoll'
21336 d_attribute_format='$d_attribute_format'
21337 d_attribute_malloc='$d_attribute_malloc'
21338 d_attribute_nonnull='$d_attribute_nonnull'
21339 d_attribute_noreturn='$d_attribute_noreturn'
21340 d_attribute_pure='$d_attribute_pure'
21341 d_attribute_unused='$d_attribute_unused'
21342 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21343 d_bcmp='$d_bcmp'
21344 d_bcopy='$d_bcopy'
21345 d_bsd='$d_bsd'
21346 d_bsdgetpgrp='$d_bsdgetpgrp'
21347 d_bsdsetpgrp='$d_bsdsetpgrp'
21348 d_builtin_choose_expr='$d_builtin_choose_expr'
21349 d_builtin_expect='$d_builtin_expect'
21350 d_bzero='$d_bzero'
21351 d_c99_variadic_macros='$d_c99_variadic_macros'
21352 d_casti32='$d_casti32'
21353 d_castneg='$d_castneg'
21354 d_charvspr='$d_charvspr'
21355 d_chown='$d_chown'
21356 d_chroot='$d_chroot'
21357 d_chsize='$d_chsize'
21358 d_class='$d_class'
21359 d_clearenv='$d_clearenv'
21360 d_closedir='$d_closedir'
21361 d_cmsghdr_s='$d_cmsghdr_s'
21362 d_const='$d_const'
21363 d_copysignl='$d_copysignl'
21364 d_cplusplus='$d_cplusplus'
21365 d_crypt='$d_crypt'
21366 d_crypt_r='$d_crypt_r'
21367 d_csh='$d_csh'
21368 d_ctermid='$d_ctermid'
21369 d_ctermid_r='$d_ctermid_r'
21370 d_ctime_r='$d_ctime_r'
21371 d_cuserid='$d_cuserid'
21372 d_dbl_dig='$d_dbl_dig'
21373 d_dbminitproto='$d_dbminitproto'
21374 d_difftime='$d_difftime'
21375 d_dirfd='$d_dirfd'
21376 d_dirnamlen='$d_dirnamlen'
21377 d_dlerror='$d_dlerror'
21378 d_dlopen='$d_dlopen'
21379 d_dlsymun='$d_dlsymun'
21380 d_dosuid='$d_dosuid'
21381 d_drand48_r='$d_drand48_r'
21382 d_drand48proto='$d_drand48proto'
21383 d_dup2='$d_dup2'
21384 d_eaccess='$d_eaccess'
21385 d_endgrent='$d_endgrent'
21386 d_endgrent_r='$d_endgrent_r'
21387 d_endhent='$d_endhent'
21388 d_endhostent_r='$d_endhostent_r'
21389 d_endnent='$d_endnent'
21390 d_endnetent_r='$d_endnetent_r'
21391 d_endpent='$d_endpent'
21392 d_endprotoent_r='$d_endprotoent_r'
21393 d_endpwent='$d_endpwent'
21394 d_endpwent_r='$d_endpwent_r'
21395 d_endsent='$d_endsent'
21396 d_endservent_r='$d_endservent_r'
21397 d_eofnblk='$d_eofnblk'
21398 d_eunice='$d_eunice'
21399 d_faststdio='$d_faststdio'
21400 d_fchdir='$d_fchdir'
21401 d_fchmod='$d_fchmod'
21402 d_fchown='$d_fchown'
21403 d_fcntl='$d_fcntl'
21404 d_fcntl_can_lock='$d_fcntl_can_lock'
21405 d_fd_macros='$d_fd_macros'
21406 d_fd_set='$d_fd_set'
21407 d_fds_bits='$d_fds_bits'
21408 d_fgetpos='$d_fgetpos'
21409 d_finite='$d_finite'
21410 d_finitel='$d_finitel'
21411 d_flexfnam='$d_flexfnam'
21412 d_flock='$d_flock'
21413 d_flockproto='$d_flockproto'
21414 d_fork='$d_fork'
21415 d_fp_class='$d_fp_class'
21416 d_fpathconf='$d_fpathconf'
21417 d_fpclass='$d_fpclass'
21418 d_fpclassify='$d_fpclassify'
21419 d_fpclassl='$d_fpclassl'
21420 d_fpos64_t='$d_fpos64_t'
21421 d_frexpl='$d_frexpl'
21422 d_fs_data_s='$d_fs_data_s'
21423 d_fseeko='$d_fseeko'
21424 d_fsetpos='$d_fsetpos'
21425 d_fstatfs='$d_fstatfs'
21426 d_fstatvfs='$d_fstatvfs'
21427 d_fsync='$d_fsync'
21428 d_ftello='$d_ftello'
21429 d_ftime='$d_ftime'
21430 d_futimes='$d_futimes'
21431 d_getcwd='$d_getcwd'
21432 d_getespwnam='$d_getespwnam'
21433 d_getfsstat='$d_getfsstat'
21434 d_getgrent='$d_getgrent'
21435 d_getgrent_r='$d_getgrent_r'
21436 d_getgrgid_r='$d_getgrgid_r'
21437 d_getgrnam_r='$d_getgrnam_r'
21438 d_getgrps='$d_getgrps'
21439 d_gethbyaddr='$d_gethbyaddr'
21440 d_gethbyname='$d_gethbyname'
21441 d_gethent='$d_gethent'
21442 d_gethname='$d_gethname'
21443 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21444 d_gethostbyname_r='$d_gethostbyname_r'
21445 d_gethostent_r='$d_gethostent_r'
21446 d_gethostprotos='$d_gethostprotos'
21447 d_getitimer='$d_getitimer'
21448 d_getlogin='$d_getlogin'
21449 d_getlogin_r='$d_getlogin_r'
21450 d_getmnt='$d_getmnt'
21451 d_getmntent='$d_getmntent'
21452 d_getnbyaddr='$d_getnbyaddr'
21453 d_getnbyname='$d_getnbyname'
21454 d_getnent='$d_getnent'
21455 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21456 d_getnetbyname_r='$d_getnetbyname_r'
21457 d_getnetent_r='$d_getnetent_r'
21458 d_getnetprotos='$d_getnetprotos'
21459 d_getpagsz='$d_getpagsz'
21460 d_getpbyname='$d_getpbyname'
21461 d_getpbynumber='$d_getpbynumber'
21462 d_getpent='$d_getpent'
21463 d_getpgid='$d_getpgid'
21464 d_getpgrp2='$d_getpgrp2'
21465 d_getpgrp='$d_getpgrp'
21466 d_getppid='$d_getppid'
21467 d_getprior='$d_getprior'
21468 d_getprotobyname_r='$d_getprotobyname_r'
21469 d_getprotobynumber_r='$d_getprotobynumber_r'
21470 d_getprotoent_r='$d_getprotoent_r'
21471 d_getprotoprotos='$d_getprotoprotos'
21472 d_getprpwnam='$d_getprpwnam'
21473 d_getpwent='$d_getpwent'
21474 d_getpwent_r='$d_getpwent_r'
21475 d_getpwnam_r='$d_getpwnam_r'
21476 d_getpwuid_r='$d_getpwuid_r'
21477 d_getsbyname='$d_getsbyname'
21478 d_getsbyport='$d_getsbyport'
21479 d_getsent='$d_getsent'
21480 d_getservbyname_r='$d_getservbyname_r'
21481 d_getservbyport_r='$d_getservbyport_r'
21482 d_getservent_r='$d_getservent_r'
21483 d_getservprotos='$d_getservprotos'
21484 d_getspnam='$d_getspnam'
21485 d_getspnam_r='$d_getspnam_r'
21486 d_gettimeod='$d_gettimeod'
21487 d_gmtime_r='$d_gmtime_r'
21488 d_gnulibc='$d_gnulibc'
21489 d_grpasswd='$d_grpasswd'
21490 d_hasmntopt='$d_hasmntopt'
21491 d_htonl='$d_htonl'
21492 d_ilogbl='$d_ilogbl'
21493 d_inc_version_list='$d_inc_version_list'
21494 d_index='$d_index'
21495 d_inetaton='$d_inetaton'
21496 d_int64_t='$d_int64_t'
21497 d_isascii='$d_isascii'
21498 d_isfinite='$d_isfinite'
21499 d_isinf='$d_isinf'
21500 d_isnan='$d_isnan'
21501 d_isnanl='$d_isnanl'
21502 d_killpg='$d_killpg'
21503 d_lchown='$d_lchown'
21504 d_ldbl_dig='$d_ldbl_dig'
21505 d_libm_lib_version='$d_libm_lib_version'
21506 d_link='$d_link'
21507 d_localtime_r='$d_localtime_r'
21508 d_locconv='$d_locconv'
21509 d_lockf='$d_lockf'
21510 d_longdbl='$d_longdbl'
21511 d_longlong='$d_longlong'
21512 d_lseekproto='$d_lseekproto'
21513 d_lstat='$d_lstat'
21514 d_madvise='$d_madvise'
21515 d_malloc_good_size='$d_malloc_good_size'
21516 d_malloc_size='$d_malloc_size'
21517 d_mblen='$d_mblen'
21518 d_mbstowcs='$d_mbstowcs'
21519 d_mbtowc='$d_mbtowc'
21520 d_memchr='$d_memchr'
21521 d_memcmp='$d_memcmp'
21522 d_memcpy='$d_memcpy'
21523 d_memmove='$d_memmove'
21524 d_memset='$d_memset'
21525 d_mkdir='$d_mkdir'
21526 d_mkdtemp='$d_mkdtemp'
21527 d_mkfifo='$d_mkfifo'
21528 d_mkstemp='$d_mkstemp'
21529 d_mkstemps='$d_mkstemps'
21530 d_mktime='$d_mktime'
21531 d_mmap='$d_mmap'
21532 d_modfl='$d_modfl'
21533 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21534 d_modflproto='$d_modflproto'
21535 d_mprotect='$d_mprotect'
21536 d_msg='$d_msg'
21537 d_msg_ctrunc='$d_msg_ctrunc'
21538 d_msg_dontroute='$d_msg_dontroute'
21539 d_msg_oob='$d_msg_oob'
21540 d_msg_peek='$d_msg_peek'
21541 d_msg_proxy='$d_msg_proxy'
21542 d_msgctl='$d_msgctl'
21543 d_msgget='$d_msgget'
21544 d_msghdr_s='$d_msghdr_s'
21545 d_msgrcv='$d_msgrcv'
21546 d_msgsnd='$d_msgsnd'
21547 d_msync='$d_msync'
21548 d_munmap='$d_munmap'
21549 d_mymalloc='$d_mymalloc'
21550 d_nice='$d_nice'
21551 d_nl_langinfo='$d_nl_langinfo'
21552 d_nv_preserves_uv='$d_nv_preserves_uv'
21553 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21554 d_off64_t='$d_off64_t'
21555 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21556 d_oldpthreads='$d_oldpthreads'
21557 d_oldsock='$d_oldsock'
21558 d_open3='$d_open3'
21559 d_pathconf='$d_pathconf'
21560 d_pause='$d_pause'
21561 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21562 d_phostname='$d_phostname'
21563 d_pipe='$d_pipe'
21564 d_poll='$d_poll'
21565 d_portable='$d_portable'
21566 d_procselfexe='$d_procselfexe'
21567 d_pthread_atfork='$d_pthread_atfork'
21568 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21569 d_pthread_yield='$d_pthread_yield'
21570 d_pwage='$d_pwage'
21571 d_pwchange='$d_pwchange'
21572 d_pwclass='$d_pwclass'
21573 d_pwcomment='$d_pwcomment'
21574 d_pwexpire='$d_pwexpire'
21575 d_pwgecos='$d_pwgecos'
21576 d_pwpasswd='$d_pwpasswd'
21577 d_pwquota='$d_pwquota'
21578 d_qgcvt='$d_qgcvt'
21579 d_quad='$d_quad'
21580 d_random_r='$d_random_r'
21581 d_readdir64_r='$d_readdir64_r'
21582 d_readdir='$d_readdir'
21583 d_readdir_r='$d_readdir_r'
21584 d_readlink='$d_readlink'
21585 d_readv='$d_readv'
21586 d_recvmsg='$d_recvmsg'
21587 d_rename='$d_rename'
21588 d_rewinddir='$d_rewinddir'
21589 d_rmdir='$d_rmdir'
21590 d_safebcpy='$d_safebcpy'
21591 d_safemcpy='$d_safemcpy'
21592 d_sanemcmp='$d_sanemcmp'
21593 d_sbrkproto='$d_sbrkproto'
21594 d_scalbnl='$d_scalbnl'
21595 d_sched_yield='$d_sched_yield'
21596 d_scm_rights='$d_scm_rights'
21597 d_seekdir='$d_seekdir'
21598 d_select='$d_select'
21599 d_sem='$d_sem'
21600 d_semctl='$d_semctl'
21601 d_semctl_semid_ds='$d_semctl_semid_ds'
21602 d_semctl_semun='$d_semctl_semun'
21603 d_semget='$d_semget'
21604 d_semop='$d_semop'
21605 d_sendmsg='$d_sendmsg'
21606 d_setegid='$d_setegid'
21607 d_seteuid='$d_seteuid'
21608 d_setgrent='$d_setgrent'
21609 d_setgrent_r='$d_setgrent_r'
21610 d_setgrps='$d_setgrps'
21611 d_sethent='$d_sethent'
21612 d_sethostent_r='$d_sethostent_r'
21613 d_setitimer='$d_setitimer'
21614 d_setlinebuf='$d_setlinebuf'
21615 d_setlocale='$d_setlocale'
21616 d_setlocale_r='$d_setlocale_r'
21617 d_setnent='$d_setnent'
21618 d_setnetent_r='$d_setnetent_r'
21619 d_setpent='$d_setpent'
21620 d_setpgid='$d_setpgid'
21621 d_setpgrp2='$d_setpgrp2'
21622 d_setpgrp='$d_setpgrp'
21623 d_setprior='$d_setprior'
21624 d_setproctitle='$d_setproctitle'
21625 d_setprotoent_r='$d_setprotoent_r'
21626 d_setpwent='$d_setpwent'
21627 d_setpwent_r='$d_setpwent_r'
21628 d_setregid='$d_setregid'
21629 d_setresgid='$d_setresgid'
21630 d_setresuid='$d_setresuid'
21631 d_setreuid='$d_setreuid'
21632 d_setrgid='$d_setrgid'
21633 d_setruid='$d_setruid'
21634 d_setsent='$d_setsent'
21635 d_setservent_r='$d_setservent_r'
21636 d_setsid='$d_setsid'
21637 d_setvbuf='$d_setvbuf'
21638 d_sfio='$d_sfio'
21639 d_shm='$d_shm'
21640 d_shmat='$d_shmat'
21641 d_shmatprototype='$d_shmatprototype'
21642 d_shmctl='$d_shmctl'
21643 d_shmdt='$d_shmdt'
21644 d_shmget='$d_shmget'
21645 d_sigaction='$d_sigaction'
21646 d_sigprocmask='$d_sigprocmask'
21647 d_sigsetjmp='$d_sigsetjmp'
21648 d_sitearch='$d_sitearch'
21649 d_snprintf='$d_snprintf'
21650 d_sockatmark='$d_sockatmark'
21651 d_sockatmarkproto='$d_sockatmarkproto'
21652 d_socket='$d_socket'
21653 d_socklen_t='$d_socklen_t'
21654 d_sockpair='$d_sockpair'
21655 d_socks5_init='$d_socks5_init'
21656 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21657 d_sqrtl='$d_sqrtl'
21658 d_srand48_r='$d_srand48_r'
21659 d_srandom_r='$d_srandom_r'
21660 d_sresgproto='$d_sresgproto'
21661 d_sresuproto='$d_sresuproto'
21662 d_statblks='$d_statblks'
21663 d_statfs_f_flags='$d_statfs_f_flags'
21664 d_statfs_s='$d_statfs_s'
21665 d_statvfs='$d_statvfs'
21666 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21667 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21668 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21669 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21670 d_stdio_stream_array='$d_stdio_stream_array'
21671 d_stdiobase='$d_stdiobase'
21672 d_stdstdio='$d_stdstdio'
21673 d_strchr='$d_strchr'
21674 d_strcoll='$d_strcoll'
21675 d_strctcpy='$d_strctcpy'
21676 d_strerrm='$d_strerrm'
21677 d_strerror='$d_strerror'
21678 d_strerror_r='$d_strerror_r'
21679 d_strftime='$d_strftime'
21680 d_strlcat='$d_strlcat'
21681 d_strlcpy='$d_strlcpy'
21682 d_strtod='$d_strtod'
21683 d_strtol='$d_strtol'
21684 d_strtold='$d_strtold'
21685 d_strtoll='$d_strtoll'
21686 d_strtoq='$d_strtoq'
21687 d_strtoul='$d_strtoul'
21688 d_strtoull='$d_strtoull'
21689 d_strtouq='$d_strtouq'
21690 d_strxfrm='$d_strxfrm'
21691 d_suidsafe='$d_suidsafe'
21692 d_symlink='$d_symlink'
21693 d_syscall='$d_syscall'
21694 d_syscallproto='$d_syscallproto'
21695 d_sysconf='$d_sysconf'
21696 d_sysernlst='$d_sysernlst'
21697 d_syserrlst='$d_syserrlst'
21698 d_system='$d_system'
21699 d_tcgetpgrp='$d_tcgetpgrp'
21700 d_tcsetpgrp='$d_tcsetpgrp'
21701 d_telldir='$d_telldir'
21702 d_telldirproto='$d_telldirproto'
21703 d_time='$d_time'
21704 d_times='$d_times'
21705 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21706 d_tm_tm_zone='$d_tm_tm_zone'
21707 d_tmpnam_r='$d_tmpnam_r'
21708 d_truncate='$d_truncate'
21709 d_ttyname_r='$d_ttyname_r'
21710 d_tzname='$d_tzname'
21711 d_u32align='$d_u32align'
21712 d_ualarm='$d_ualarm'
21713 d_umask='$d_umask'
21714 d_uname='$d_uname'
21715 d_union_semun='$d_union_semun'
21716 d_unordered='$d_unordered'
21717 d_unsetenv='$d_unsetenv'
21718 d_usleep='$d_usleep'
21719 d_usleepproto='$d_usleepproto'
21720 d_ustat='$d_ustat'
21721 d_vendorarch='$d_vendorarch'
21722 d_vendorbin='$d_vendorbin'
21723 d_vendorlib='$d_vendorlib'
21724 d_vendorscript='$d_vendorscript'
21725 d_vfork='$d_vfork'
21726 d_void_closedir='$d_void_closedir'
21727 d_voidsig='$d_voidsig'
21728 d_voidtty='$d_voidtty'
21729 d_volatile='$d_volatile'
21730 d_vprintf='$d_vprintf'
21731 d_vsnprintf='$d_vsnprintf'
21732 d_wait4='$d_wait4'
21733 d_waitpid='$d_waitpid'
21734 d_wcstombs='$d_wcstombs'
21735 d_wctomb='$d_wctomb'
21736 d_writev='$d_writev'
21737 d_xenix='$d_xenix'
21738 date='$date'
21739 db_hashtype='$db_hashtype'
21740 db_prefixtype='$db_prefixtype'
21741 db_version_major='$db_version_major'
21742 db_version_minor='$db_version_minor'
21743 db_version_patch='$db_version_patch'
21744 defvoidused='$defvoidused'
21745 direntrytype='$direntrytype'
21746 dlext='$dlext'
21747 dlsrc='$dlsrc'
21748 doublesize='$doublesize'
21749 drand01='$drand01'
21750 drand48_r_proto='$drand48_r_proto'
21751 dynamic_ext='$dynamic_ext'
21752 eagain='$eagain'
21753 ebcdic='$ebcdic'
21754 echo='$echo'
21755 egrep='$egrep'
21756 emacs='$emacs'
21757 endgrent_r_proto='$endgrent_r_proto'
21758 endhostent_r_proto='$endhostent_r_proto'
21759 endnetent_r_proto='$endnetent_r_proto'
21760 endprotoent_r_proto='$endprotoent_r_proto'
21761 endpwent_r_proto='$endpwent_r_proto'
21762 endservent_r_proto='$endservent_r_proto'
21763 eunicefix='$eunicefix'
21764 exe_ext='$exe_ext'
21765 expr='$expr'
21766 extensions='$extensions'
21767 extras='$extras'
21768 fflushNULL='$fflushNULL'
21769 fflushall='$fflushall'
21770 find='$find'
21771 firstmakefile='$firstmakefile'
21772 flex='$flex'
21773 fpossize='$fpossize'
21774 fpostype='$fpostype'
21775 freetype='$freetype'
21776 from='$from'
21777 full_ar='$full_ar'
21778 full_csh='$full_csh'
21779 full_sed='$full_sed'
21780 gccansipedantic='$gccansipedantic'
21781 gccosandvers='$gccosandvers'
21782 gccversion='$gccversion'
21783 getgrent_r_proto='$getgrent_r_proto'
21784 getgrgid_r_proto='$getgrgid_r_proto'
21785 getgrnam_r_proto='$getgrnam_r_proto'
21786 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21787 gethostbyname_r_proto='$gethostbyname_r_proto'
21788 gethostent_r_proto='$gethostent_r_proto'
21789 getlogin_r_proto='$getlogin_r_proto'
21790 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21791 getnetbyname_r_proto='$getnetbyname_r_proto'
21792 getnetent_r_proto='$getnetent_r_proto'
21793 getprotobyname_r_proto='$getprotobyname_r_proto'
21794 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21795 getprotoent_r_proto='$getprotoent_r_proto'
21796 getpwent_r_proto='$getpwent_r_proto'
21797 getpwnam_r_proto='$getpwnam_r_proto'
21798 getpwuid_r_proto='$getpwuid_r_proto'
21799 getservbyname_r_proto='$getservbyname_r_proto'
21800 getservbyport_r_proto='$getservbyport_r_proto'
21801 getservent_r_proto='$getservent_r_proto'
21802 getspnam_r_proto='$getspnam_r_proto'
21803 gidformat='$gidformat'
21804 gidsign='$gidsign'
21805 gidsize='$gidsize'
21806 gidtype='$gidtype'
21807 glibpth='$glibpth'
21808 gmake='$gmake'
21809 gmtime_r_proto='$gmtime_r_proto'
21810 gnulibc_version='$gnulibc_version'
21811 grep='$grep'
21812 groupcat='$groupcat'
21813 groupstype='$groupstype'
21814 gzip='$gzip'
21815 h_fcntl='$h_fcntl'
21816 h_sysfile='$h_sysfile'
21817 hint='$hint'
21818 hostcat='$hostcat'
21819 html1dir='$html1dir'
21820 html1direxp='$html1direxp'
21821 html3dir='$html3dir'
21822 html3direxp='$html3direxp'
21823 i16size='$i16size'
21824 i16type='$i16type'
21825 i32size='$i32size'
21826 i32type='$i32type'
21827 i64size='$i64size'
21828 i64type='$i64type'
21829 i8size='$i8size'
21830 i8type='$i8type'
21831 i_arpainet='$i_arpainet'
21832 i_bsdioctl='$i_bsdioctl'
21833 i_crypt='$i_crypt'
21834 i_db='$i_db'
21835 i_dbm='$i_dbm'
21836 i_dirent='$i_dirent'
21837 i_dld='$i_dld'
21838 i_dlfcn='$i_dlfcn'
21839 i_fcntl='$i_fcntl'
21840 i_float='$i_float'
21841 i_fp='$i_fp'
21842 i_fp_class='$i_fp_class'
21843 i_gdbm='$i_gdbm'
21844 i_grp='$i_grp'
21845 i_ieeefp='$i_ieeefp'
21846 i_inttypes='$i_inttypes'
21847 i_langinfo='$i_langinfo'
21848 i_libutil='$i_libutil'
21849 i_limits='$i_limits'
21850 i_locale='$i_locale'
21851 i_machcthr='$i_machcthr'
21852 i_malloc='$i_malloc'
21853 i_math='$i_math'
21854 i_memory='$i_memory'
21855 i_mntent='$i_mntent'
21856 i_ndbm='$i_ndbm'
21857 i_netdb='$i_netdb'
21858 i_neterrno='$i_neterrno'
21859 i_netinettcp='$i_netinettcp'
21860 i_niin='$i_niin'
21861 i_poll='$i_poll'
21862 i_prot='$i_prot'
21863 i_pthread='$i_pthread'
21864 i_pwd='$i_pwd'
21865 i_rpcsvcdbm='$i_rpcsvcdbm'
21866 i_sfio='$i_sfio'
21867 i_sgtty='$i_sgtty'
21868 i_shadow='$i_shadow'
21869 i_socks='$i_socks'
21870 i_stdarg='$i_stdarg'
21871 i_stddef='$i_stddef'
21872 i_stdlib='$i_stdlib'
21873 i_string='$i_string'
21874 i_sunmath='$i_sunmath'
21875 i_sysaccess='$i_sysaccess'
21876 i_sysdir='$i_sysdir'
21877 i_sysfile='$i_sysfile'
21878 i_sysfilio='$i_sysfilio'
21879 i_sysin='$i_sysin'
21880 i_sysioctl='$i_sysioctl'
21881 i_syslog='$i_syslog'
21882 i_sysmman='$i_sysmman'
21883 i_sysmode='$i_sysmode'
21884 i_sysmount='$i_sysmount'
21885 i_sysndir='$i_sysndir'
21886 i_sysparam='$i_sysparam'
21887 i_sysresrc='$i_sysresrc'
21888 i_syssecrt='$i_syssecrt'
21889 i_sysselct='$i_sysselct'
21890 i_syssockio='$i_syssockio'
21891 i_sysstat='$i_sysstat'
21892 i_sysstatfs='$i_sysstatfs'
21893 i_sysstatvfs='$i_sysstatvfs'
21894 i_systime='$i_systime'
21895 i_systimek='$i_systimek'
21896 i_systimes='$i_systimes'
21897 i_systypes='$i_systypes'
21898 i_sysuio='$i_sysuio'
21899 i_sysun='$i_sysun'
21900 i_sysutsname='$i_sysutsname'
21901 i_sysvfs='$i_sysvfs'
21902 i_syswait='$i_syswait'
21903 i_termio='$i_termio'
21904 i_termios='$i_termios'
21905 i_time='$i_time'
21906 i_unistd='$i_unistd'
21907 i_ustat='$i_ustat'
21908 i_utime='$i_utime'
21909 i_values='$i_values'
21910 i_varargs='$i_varargs'
21911 i_varhdr='$i_varhdr'
21912 i_vfork='$i_vfork'
21913 ignore_versioned_solibs='$ignore_versioned_solibs'
21914 inc_version_list='$inc_version_list'
21915 inc_version_list_init='$inc_version_list_init'
21916 incpath='$incpath'
21917 inews='$inews'
21918 initialinstalllocation='$initialinstalllocation'
21919 installarchlib='$installarchlib'
21920 installbin='$installbin'
21921 installhtml1dir='$installhtml1dir'
21922 installhtml3dir='$installhtml3dir'
21923 installman1dir='$installman1dir'
21924 installman3dir='$installman3dir'
21925 installprefix='$installprefix'
21926 installprefixexp='$installprefixexp'
21927 installprivlib='$installprivlib'
21928 installscript='$installscript'
21929 installsitearch='$installsitearch'
21930 installsitebin='$installsitebin'
21931 installsitehtml1dir='$installsitehtml1dir'
21932 installsitehtml3dir='$installsitehtml3dir'
21933 installsitelib='$installsitelib'
21934 installsiteman1dir='$installsiteman1dir'
21935 installsiteman3dir='$installsiteman3dir'
21936 installsitescript='$installsitescript'
21937 installstyle='$installstyle'
21938 installusrbinperl='$installusrbinperl'
21939 installvendorarch='$installvendorarch'
21940 installvendorbin='$installvendorbin'
21941 installvendorhtml1dir='$installvendorhtml1dir'
21942 installvendorhtml3dir='$installvendorhtml3dir'
21943 installvendorlib='$installvendorlib'
21944 installvendorman1dir='$installvendorman1dir'
21945 installvendorman3dir='$installvendorman3dir'
21946 installvendorscript='$installvendorscript'
21947 intsize='$intsize'
21948 issymlink='$issymlink'
21949 ivdformat='$ivdformat'
21950 ivsize='$ivsize'
21951 ivtype='$ivtype'
21952 known_extensions='$known_extensions'
21953 ksh='$ksh'
21954 ld='$ld'
21955 lddlflags='$lddlflags'
21956 ldflags='$ldflags'
21957 ldflags_uselargefiles='$ldflags_uselargefiles'
21958 ldlibpthname='$ldlibpthname'
21959 less='$less'
21960 lib_ext='$lib_ext'
21961 libc='$libc'
21962 libperl='$libperl'
21963 libpth='$libpth'
21964 libs='$libs'
21965 libsdirs='$libsdirs'
21966 libsfiles='$libsfiles'
21967 libsfound='$libsfound'
21968 libspath='$libspath'
21969 libswanted='$libswanted'
21970 libswanted_uselargefiles='$libswanted_uselargefiles'
21971 line='$line'
21972 lint='$lint'
21973 lkflags='$lkflags'
21974 ln='$ln'
21975 lns='$lns'
21976 localtime_r_proto='$localtime_r_proto'
21977 locincpth='$locincpth'
21978 loclibpth='$loclibpth'
21979 longdblsize='$longdblsize'
21980 longlongsize='$longlongsize'
21981 longsize='$longsize'
21982 lp='$lp'
21983 lpr='$lpr'
21984 ls='$ls'
21985 lseeksize='$lseeksize'
21986 lseektype='$lseektype'
21987 mad='$mad'
21988 madlyh='$madlyh'
21989 madlyobj='$madlyobj'
21990 madlysrc='$madlysrc'
21991 mail='$mail'
21992 mailx='$mailx'
21993 make='$make'
21994 make_set_make='$make_set_make'
21995 mallocobj='$mallocobj'
21996 mallocsrc='$mallocsrc'
21997 malloctype='$malloctype'
21998 man1dir='$man1dir'
21999 man1direxp='$man1direxp'
22000 man1ext='$man1ext'
22001 man3dir='$man3dir'
22002 man3direxp='$man3direxp'
22003 man3ext='$man3ext'
22004 mips_type='$mips_type'
22005 mistrustnm='$mistrustnm'
22006 mkdir='$mkdir'
22007 mmaptype='$mmaptype'
22008 modetype='$modetype'
22009 more='$more'
22010 multiarch='$multiarch'
22011 mv='$mv'
22012 myarchname='$myarchname'
22013 mydomain='$mydomain'
22014 myhostname='$myhostname'
22015 myuname='$myuname'
22016 n='$n'
22017 need_va_copy='$need_va_copy'
22018 netdb_hlen_type='$netdb_hlen_type'
22019 netdb_host_type='$netdb_host_type'
22020 netdb_name_type='$netdb_name_type'
22021 netdb_net_type='$netdb_net_type'
22022 nm='$nm'
22023 nm_opt='$nm_opt'
22024 nm_so_opt='$nm_so_opt'
22025 nonxs_ext='$nonxs_ext'
22026 nroff='$nroff'
22027 nvEUformat='$nvEUformat'
22028 nvFUformat='$nvFUformat'
22029 nvGUformat='$nvGUformat'
22030 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22031 nveformat='$nveformat'
22032 nvfformat='$nvfformat'
22033 nvgformat='$nvgformat'
22034 nvsize='$nvsize'
22035 nvtype='$nvtype'
22036 o_nonblock='$o_nonblock'
22037 obj_ext='$obj_ext'
22038 old_pthread_create_joinable='$old_pthread_create_joinable'
22039 optimize='$optimize'
22040 orderlib='$orderlib'
22041 osname='$osname'
22042 osvers='$osvers'
22043 otherlibdirs='$otherlibdirs'
22044 package='$package'
22045 pager='$pager'
22046 passcat='$passcat'
22047 patchlevel='$patchlevel'
22048 path_sep='$path_sep'
22049 perl5='$perl5'
22050 perl='$perl'
22051 perl_patchlevel='$perl_patchlevel'
22052 perladmin='$perladmin'
22053 perllibs='$perllibs'
22054 perlpath='$perlpath'
22055 pg='$pg'
22056 phostname='$phostname'
22057 pidtype='$pidtype'
22058 plibpth='$plibpth'
22059 pmake='$pmake'
22060 pr='$pr'
22061 prefix='$prefix'
22062 prefixexp='$prefixexp'
22063 privlib='$privlib'
22064 privlibexp='$privlibexp'
22065 procselfexe='$procselfexe'
22066 prototype='$prototype'
22067 ptrsize='$ptrsize'
22068 quadkind='$quadkind'
22069 quadtype='$quadtype'
22070 randbits='$randbits'
22071 randfunc='$randfunc'
22072 random_r_proto='$random_r_proto'
22073 randseedtype='$randseedtype'
22074 ranlib='$ranlib'
22075 rd_nodata='$rd_nodata'
22076 readdir64_r_proto='$readdir64_r_proto'
22077 readdir_r_proto='$readdir_r_proto'
22078 revision='$revision'
22079 rm='$rm'
22080 rmail='$rmail'
22081 run='$run'
22082 runnm='$runnm'
22083 sPRIEUldbl='$sPRIEUldbl'
22084 sPRIFUldbl='$sPRIFUldbl'
22085 sPRIGUldbl='$sPRIGUldbl'
22086 sPRIXU64='$sPRIXU64'
22087 sPRId64='$sPRId64'
22088 sPRIeldbl='$sPRIeldbl'
22089 sPRIfldbl='$sPRIfldbl'
22090 sPRIgldbl='$sPRIgldbl'
22091 sPRIi64='$sPRIi64'
22092 sPRIo64='$sPRIo64'
22093 sPRIu64='$sPRIu64'
22094 sPRIx64='$sPRIx64'
22095 sSCNfldbl='$sSCNfldbl'
22096 sched_yield='$sched_yield'
22097 scriptdir='$scriptdir'
22098 scriptdirexp='$scriptdirexp'
22099 sed='$sed'
22100 seedfunc='$seedfunc'
22101 selectminbits='$selectminbits'
22102 selecttype='$selecttype'
22103 sendmail='$sendmail'
22104 setgrent_r_proto='$setgrent_r_proto'
22105 sethostent_r_proto='$sethostent_r_proto'
22106 setlocale_r_proto='$setlocale_r_proto'
22107 setnetent_r_proto='$setnetent_r_proto'
22108 setprotoent_r_proto='$setprotoent_r_proto'
22109 setpwent_r_proto='$setpwent_r_proto'
22110 setservent_r_proto='$setservent_r_proto'
22111 sh='$sh'
22112 shar='$shar'
22113 sharpbang='$sharpbang'
22114 shmattype='$shmattype'
22115 shortsize='$shortsize'
22116 shrpenv='$shrpenv'
22117 shsharp='$shsharp'
22118 sig_count='$sig_count'
22119 sig_name='$sig_name'
22120 sig_name_init='$sig_name_init'
22121 sig_num='$sig_num'
22122 sig_num_init='$sig_num_init'
22123 sig_size='$sig_size'
22124 signal_t='$signal_t'
22125 sitearch='$sitearch'
22126 sitearchexp='$sitearchexp'
22127 sitebin='$sitebin'
22128 sitebinexp='$sitebinexp'
22129 sitehtml1dir='$sitehtml1dir'
22130 sitehtml1direxp='$sitehtml1direxp'
22131 sitehtml3dir='$sitehtml3dir'
22132 sitehtml3direxp='$sitehtml3direxp'
22133 sitelib='$sitelib'
22134 sitelib_stem='$sitelib_stem'
22135 sitelibexp='$sitelibexp'
22136 siteman1dir='$siteman1dir'
22137 siteman1direxp='$siteman1direxp'
22138 siteman3dir='$siteman3dir'
22139 siteman3direxp='$siteman3direxp'
22140 siteprefix='$siteprefix'
22141 siteprefixexp='$siteprefixexp'
22142 sitescript='$sitescript'
22143 sitescriptexp='$sitescriptexp'
22144 sizesize='$sizesize'
22145 sizetype='$sizetype'
22146 sleep='$sleep'
22147 smail='$smail'
22148 so='$so'
22149 sockethdr='$sockethdr'
22150 socketlib='$socketlib'
22151 socksizetype='$socksizetype'
22152 sort='$sort'
22153 spackage='$spackage'
22154 spitshell='$spitshell'
22155 srand48_r_proto='$srand48_r_proto'
22156 srandom_r_proto='$srandom_r_proto'
22157 src='$src'
22158 ssizetype='$ssizetype'
22159 startperl='$startperl'
22160 startsh='$startsh'
22161 static_ext='$static_ext'
22162 stdchar='$stdchar'
22163 stdio_base='$stdio_base'
22164 stdio_bufsiz='$stdio_bufsiz'
22165 stdio_cnt='$stdio_cnt'
22166 stdio_filbuf='$stdio_filbuf'
22167 stdio_ptr='$stdio_ptr'
22168 stdio_stream_array='$stdio_stream_array'
22169 strerror_r_proto='$strerror_r_proto'
22170 strings='$strings'
22171 submit='$submit'
22172 subversion='$subversion'
22173 sysman='$sysman'
22174 tail='$tail'
22175 tar='$tar'
22176 targetarch='$targetarch'
22177 tbl='$tbl'
22178 tee='$tee'
22179 test='$test'
22180 timeincl='$timeincl'
22181 timetype='$timetype'
22182 tmpnam_r_proto='$tmpnam_r_proto'
22183 to='$to'
22184 touch='$touch'
22185 tr='$tr'
22186 trnl='$trnl'
22187 troff='$troff'
22188 ttyname_r_proto='$ttyname_r_proto'
22189 u16size='$u16size'
22190 u16type='$u16type'
22191 u32size='$u32size'
22192 u32type='$u32type'
22193 u64size='$u64size'
22194 u64type='$u64type'
22195 u8size='$u8size'
22196 u8type='$u8type'
22197 uidformat='$uidformat'
22198 uidsign='$uidsign'
22199 uidsize='$uidsize'
22200 uidtype='$uidtype'
22201 uname='$uname'
22202 uniq='$uniq'
22203 uquadtype='$uquadtype'
22204 use5005threads='$use5005threads'
22205 use64bitall='$use64bitall'
22206 use64bitint='$use64bitint'
22207 usecrosscompile='$usecrosscompile'
22208 usedl='$usedl'
22209 usefaststdio='$usefaststdio'
22210 useithreads='$useithreads'
22211 uselargefiles='$uselargefiles'
22212 uselongdouble='$uselongdouble'
22213 usemallocwrap='$usemallocwrap'
22214 usemorebits='$usemorebits'
22215 usemultiplicity='$usemultiplicity'
22216 usemymalloc='$usemymalloc'
22217 usenm='$usenm'
22218 useopcode='$useopcode'
22219 useperlio='$useperlio'
22220 useposix='$useposix'
22221 usereentrant='$usereentrant'
22222 userelocatableinc='$userelocatableinc'
22223 usesfio='$usesfio'
22224 useshrplib='$useshrplib'
22225 usesitecustomize='$usesitecustomize'
22226 usesocks='$usesocks'
22227 usethreads='$usethreads'
22228 usevendorprefix='$usevendorprefix'
22229 usevfork='$usevfork'
22230 usrinc='$usrinc'
22231 uuname='$uuname'
22232 uvXUformat='$uvXUformat'
22233 uvoformat='$uvoformat'
22234 uvsize='$uvsize'
22235 uvtype='$uvtype'
22236 uvuformat='$uvuformat'
22237 uvxformat='$uvxformat'
22238 vendorarch='$vendorarch'
22239 vendorarchexp='$vendorarchexp'
22240 vendorbin='$vendorbin'
22241 vendorbinexp='$vendorbinexp'
22242 vendorhtml1dir='$vendorhtml1dir'
22243 vendorhtml1direxp='$vendorhtml1direxp'
22244 vendorhtml3dir='$vendorhtml3dir'
22245 vendorhtml3direxp='$vendorhtml3direxp'
22246 vendorlib='$vendorlib'
22247 vendorlib_stem='$vendorlib_stem'
22248 vendorlibexp='$vendorlibexp'
22249 vendorman1dir='$vendorman1dir'
22250 vendorman1direxp='$vendorman1direxp'
22251 vendorman3dir='$vendorman3dir'
22252 vendorman3direxp='$vendorman3direxp'
22253 vendorprefix='$vendorprefix'
22254 vendorprefixexp='$vendorprefixexp'
22255 vendorscript='$vendorscript'
22256 vendorscriptexp='$vendorscriptexp'
22257 version='$version'
22258 version_patchlevel_string='$version_patchlevel_string'
22259 versiononly='$versiononly'
22260 vi='$vi'
22261 voidflags='$voidflags'
22262 xlibpth='$xlibpth'
22263 yacc='$yacc'
22264 yaccflags='$yaccflags'
22265 zcat='$zcat'
22266 zip='$zip'
22267 EOT
22268
22269 : Add in command line options if available
22270 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22271
22272 : add special variables
22273 $test -f $src/patchlevel.h && \
22274 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22275 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22276 echo "PERL_CONFIG_SH=true" >>config.sh
22277
22278 : propagate old symbols
22279 if $test -f UU/config.sh; then
22280         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22281         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22282         $sort | $uniq -u >UU/oldsyms
22283         set X `cat UU/oldsyms`
22284         shift
22285         case $# in
22286         0) ;;
22287         *)
22288                 cat <<EOM
22289 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22290 EOM
22291                 echo "# Variables propagated from previous config.sh file." >>config.sh
22292                 for sym in `cat UU/oldsyms`; do
22293                         echo "    Propagating $hint variable "'$'"$sym..."
22294                         eval 'tmp="$'"${sym}"'"'
22295                         echo "$tmp" | \
22296                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22297                 done
22298                 ;;
22299         esac
22300 fi
22301
22302 : Finish up by extracting the .SH files
22303 case "$alldone" in
22304 exit)
22305         $rm -rf UU
22306         echo "Extraction done."
22307         exit 0
22308         ;;
22309 cont)
22310         ;;
22311 '')
22312         dflt=''
22313         nostick=true
22314         $cat <<EOM
22315
22316 If you'd like to make any changes to the config.sh file before I begin
22317 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22318
22319 EOM
22320         rp="Press return or use a shell escape to edit config.sh:"
22321         . UU/myread
22322         nostick=''
22323         case "$ans" in
22324         '') ;;
22325         *) : in case they cannot read
22326                 sh 1>&4 -c "$ans";;
22327         esac
22328         ;;
22329 esac
22330
22331 : if this fails, just run all the .SH files by hand
22332 . ./config.sh
22333
22334 echo " "
22335 exec 1>&4
22336 pwd=`pwd`
22337 . ./UU/extract
22338 cd "$pwd"
22339
22340 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22341         dflt=y
22342         case "$silent" in
22343         true) ;;
22344         *)
22345                 $cat <<EOM
22346
22347 Now you need to generate make dependencies by running "$make depend".
22348 You might prefer to run it in background: "$make depend > makedepend.out &"
22349 It can take a while, so you might not want to run it right now.
22350
22351 EOM
22352                 ;;
22353         esac
22354         rp="Run $make depend now?"
22355         . UU/myread
22356         case "$ans" in
22357         y*)
22358                 $make depend && echo "Now you must run '$make'."
22359                 ;;
22360         *)
22361                 echo "You must run '$make depend' then '$make'."
22362                 ;;
22363         esac
22364 elif test -f [Mm]akefile; then
22365         echo " "
22366         echo "Now you must run a $make."
22367 else
22368         echo "Configure done."
22369 fi
22370
22371 if $test -f Policy.sh; then
22372     $cat <<EOM
22373
22374 If you compile $package on a different machine or from a different object
22375 directory, copy the Policy.sh file from this object directory to the
22376 new one before you run Configure -- this will help you with most of
22377 the policy defaults.
22378
22379 EOM
22380 fi
22381 if $test -f config.msg; then
22382     echo "Hmm.  I also noted the following information while running:"
22383     echo " "
22384     $cat config.msg >&4
22385     $rm -f config.msg
22386 fi
22387 $rm -f kit*isdone ark*isdone
22388 $rm -rf UU
22389
22390 : End of Configure
22391