1. Less Whoa there, based on a suggestion by Andy Dougherty
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Nov 15 22:26:01 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184
185 : if needed set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *)              CDPATH='' ;;
192         esac
193         ;;
194 esac
195 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 afs=''
320 afsroot=''
321 alignbytes=''
322 ansi2knr=''
323 archlib=''
324 archlibexp=''
325 d_archlib=''
326 installarchlib=''
327 archname=''
328 myarchname=''
329 d_atolf=''
330 d_atoll=''
331 baserev=''
332 bin=''
333 binexp=''
334 initialinstalllocation=''
335 installbin=''
336 userelocatableinc=''
337 byteorder=''
338 cc=''
339 ccflags=''
340 cppflags=''
341 ldflags=''
342 lkflags=''
343 locincpth=''
344 optimize=''
345 cf_email=''
346 cf_by=''
347 cf_time=''
348 charsize=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_sigprocmask=''
704 d_sigsetjmp=''
705 usesitecustomize=''
706 d_snprintf=''
707 d_vsnprintf=''
708 d_sockatmark=''
709 d_sockatmarkproto=''
710 d_msg_ctrunc=''
711 d_msg_dontroute=''
712 d_msg_oob=''
713 d_msg_peek=''
714 d_msg_proxy=''
715 d_oldsock=''
716 d_scm_rights=''
717 d_socket=''
718 d_sockpair=''
719 sockethdr=''
720 socketlib=''
721 d_socklen_t=''
722 d_socks5_init=''
723 d_sprintf_returns_strlen=''
724 d_sqrtl=''
725 d_srand48_r=''
726 srand48_r_proto=''
727 d_srandom_r=''
728 srandom_r_proto=''
729 d_sresgproto=''
730 d_sresuproto=''
731 d_statblks=''
732 d_statfs_f_flags=''
733 d_statfs_s=''
734 d_fstatvfs=''
735 d_statvfs=''
736 d_stdio_cnt_lval=''
737 d_stdio_ptr_lval=''
738 d_stdio_ptr_lval_nochange_cnt=''
739 d_stdio_ptr_lval_sets_cnt=''
740 d_stdiobase=''
741 d_stdstdio=''
742 stdio_base=''
743 stdio_bufsiz=''
744 stdio_cnt=''
745 stdio_filbuf=''
746 stdio_ptr=''
747 d_index=''
748 d_strchr=''
749 d_strcoll=''
750 d_strctcpy=''
751 d_strerrm=''
752 d_strerror=''
753 d_sysernlst=''
754 d_syserrlst=''
755 d_strerror_r=''
756 strerror_r_proto=''
757 d_strftime=''
758 d_strlcat=''
759 d_strlcpy=''
760 d_strtod=''
761 d_strtol=''
762 d_strtold=''
763 d_strtoll=''
764 d_strtoq=''
765 d_strtoul=''
766 d_strtoull=''
767 d_strtouq=''
768 d_strxfrm=''
769 d_symlink=''
770 d_syscall=''
771 d_syscallproto=''
772 d_sysconf=''
773 d_system=''
774 d_tcgetpgrp=''
775 d_tcsetpgrp=''
776 d_telldirproto=''
777 d_time=''
778 timetype=''
779 clocktype=''
780 d_times=''
781 d_tmpnam_r=''
782 tmpnam_r_proto=''
783 d_truncate=''
784 d_ttyname_r=''
785 ttyname_r_proto=''
786 d_tzname=''
787 d_u32align=''
788 d_ualarm=''
789 d_umask=''
790 d_semctl_semid_ds=''
791 d_semctl_semun=''
792 d_union_semun=''
793 d_unordered=''
794 d_unsetenv=''
795 d_usleep=''
796 d_usleepproto=''
797 d_ustat=''
798 d_vfork=''
799 usevfork=''
800 d_voidsig=''
801 signal_t=''
802 d_volatile=''
803 d_charvspr=''
804 d_vprintf=''
805 d_wait4=''
806 d_waitpid=''
807 d_wcstombs=''
808 d_wctomb=''
809 d_writev=''
810 dlext=''
811 cccdlflags=''
812 ccdlflags=''
813 dlsrc=''
814 ld=''
815 lddlflags=''
816 usedl=''
817 doublesize=''
818 ebcdic=''
819 fflushNULL=''
820 fflushall=''
821 fpossize=''
822 fpostype=''
823 gccansipedantic=''
824 gccosandvers=''
825 gccversion=''
826 gidformat=''
827 gidsign=''
828 gidsize=''
829 gidtype=''
830 groupstype=''
831 h_fcntl=''
832 h_sysfile=''
833 html1dir=''
834 html1direxp=''
835 installhtml1dir=''
836 html3dir=''
837 html3direxp=''
838 installhtml3dir=''
839 i_arpainet=''
840 i_crypt=''
841 db_hashtype=''
842 db_prefixtype=''
843 db_version_major=''
844 db_version_minor=''
845 db_version_patch=''
846 i_db=''
847 i_dbm=''
848 i_rpcsvcdbm=''
849 d_dirnamlen=''
850 direntrytype=''
851 i_dirent=''
852 i_dld=''
853 i_dlfcn=''
854 i_fcntl=''
855 i_float=''
856 i_fp=''
857 i_fp_class=''
858 i_gdbm=''
859 d_grpasswd=''
860 i_grp=''
861 i_ieeefp=''
862 i_inttypes=''
863 i_langinfo=''
864 i_libutil=''
865 i_limits=''
866 i_locale=''
867 i_machcthr=''
868 i_malloc=''
869 i_math=''
870 i_memory=''
871 i_mntent=''
872 i_ndbm=''
873 i_netdb=''
874 i_neterrno=''
875 i_netinettcp=''
876 i_niin=''
877 i_sysin=''
878 i_poll=''
879 i_prot=''
880 i_pthread=''
881 d_pwage=''
882 d_pwchange=''
883 d_pwclass=''
884 d_pwcomment=''
885 d_pwexpire=''
886 d_pwgecos=''
887 d_pwpasswd=''
888 d_pwquota=''
889 i_pwd=''
890 i_sfio=''
891 i_shadow=''
892 i_socks=''
893 i_stddef=''
894 i_stdlib=''
895 i_string=''
896 strings=''
897 i_sunmath=''
898 i_sysaccess=''
899 i_sysdir=''
900 i_sysfile=''
901 d_voidtty=''
902 i_bsdioctl=''
903 i_sysfilio=''
904 i_sysioctl=''
905 i_syssockio=''
906 i_syslog=''
907 i_sysmman=''
908 i_sysmode=''
909 i_sysmount=''
910 i_sysndir=''
911 i_sysparam=''
912 i_sysresrc=''
913 i_syssecrt=''
914 i_sysselct=''
915 i_sysstat=''
916 i_sysstatfs=''
917 i_sysstatvfs=''
918 i_systimes=''
919 i_systypes=''
920 i_sysuio=''
921 i_sysun=''
922 i_sysutsname=''
923 i_sysvfs=''
924 i_syswait=''
925 i_sgtty=''
926 i_termio=''
927 i_termios=''
928 d_tm_tm_gmtoff=''
929 d_tm_tm_zone=''
930 i_systime=''
931 i_systimek=''
932 i_time=''
933 timeincl=''
934 i_unistd=''
935 i_ustat=''
936 i_utime=''
937 i_values=''
938 i_stdarg=''
939 i_varargs=''
940 i_varhdr=''
941 i_vfork=''
942 d_inc_version_list=''
943 inc_version_list=''
944 inc_version_list_init=''
945 installprefix=''
946 installprefixexp=''
947 installstyle=''
948 installusrbinperl=''
949 intsize=''
950 longsize=''
951 shortsize=''
952 issymlink=''
953 libc=''
954 ldlibpthname=''
955 libperl=''
956 shrpenv=''
957 useshrplib=''
958 glibpth=''
959 libpth=''
960 loclibpth=''
961 plibpth=''
962 xlibpth=''
963 ignore_versioned_solibs=''
964 libs=''
965 libsdirs=''
966 libsfiles=''
967 libsfound=''
968 libspath=''
969 lns=''
970 d_PRIEUldbl=''
971 d_PRIFUldbl=''
972 d_PRIGUldbl=''
973 d_PRIeldbl=''
974 d_PRIfldbl=''
975 d_PRIgldbl=''
976 d_SCNfldbl=''
977 sPRIEUldbl=''
978 sPRIFUldbl=''
979 sPRIGUldbl=''
980 sPRIeldbl=''
981 sPRIfldbl=''
982 sPRIgldbl=''
983 sSCNfldbl=''
984 lseeksize=''
985 lseektype=''
986 mad=''
987 madlyh=''
988 madlyobj=''
989 madlysrc=''
990 make_set_make=''
991 d_mymalloc=''
992 freetype=''
993 mallocobj=''
994 mallocsrc=''
995 malloctype=''
996 usemallocwrap=''
997 usemymalloc=''
998 installman1dir=''
999 man1dir=''
1000 man1direxp=''
1001 man1ext=''
1002 installman3dir=''
1003 man3dir=''
1004 man3direxp=''
1005 man3ext=''
1006 modetype=''
1007 multiarch=''
1008 mydomain=''
1009 myhostname=''
1010 phostname=''
1011 c=''
1012 n=''
1013 d_eofnblk=''
1014 eagain=''
1015 o_nonblock=''
1016 rd_nodata=''
1017 need_va_copy=''
1018 netdb_hlen_type=''
1019 netdb_host_type=''
1020 netdb_name_type=''
1021 netdb_net_type=''
1022 groupcat=''
1023 hostcat=''
1024 passcat=''
1025 orderlib=''
1026 ranlib=''
1027 d_perl_otherlibdirs=''
1028 otherlibdirs=''
1029 package=''
1030 spackage=''
1031 pager=''
1032 api_revision=''
1033 api_subversion=''
1034 api_version=''
1035 api_versionstring=''
1036 patchlevel=''
1037 perl_patchlevel=''
1038 revision=''
1039 subversion=''
1040 version=''
1041 version_patchlevel_string=''
1042 perl5=''
1043 perladmin=''
1044 perlpath=''
1045 d_nv_preserves_uv=''
1046 d_nv_zero_is_allbits_zero=''
1047 i16size=''
1048 i16type=''
1049 i32size=''
1050 i32type=''
1051 i64size=''
1052 i64type=''
1053 i8size=''
1054 i8type=''
1055 ivsize=''
1056 ivtype=''
1057 nv_preserves_uv_bits=''
1058 nvsize=''
1059 nvtype=''
1060 u16size=''
1061 u16type=''
1062 u32size=''
1063 u32type=''
1064 u64size=''
1065 u64type=''
1066 u8size=''
1067 u8type=''
1068 uvsize=''
1069 uvtype=''
1070 ivdformat=''
1071 nvEUformat=''
1072 nvFUformat=''
1073 nvGUformat=''
1074 nveformat=''
1075 nvfformat=''
1076 nvgformat=''
1077 uvXUformat=''
1078 uvoformat=''
1079 uvuformat=''
1080 uvxformat=''
1081 pidtype=''
1082 prefix=''
1083 prefixexp=''
1084 installprivlib=''
1085 privlib=''
1086 privlibexp=''
1087 prototype=''
1088 ptrsize=''
1089 d_PRIXU64=''
1090 d_PRId64=''
1091 d_PRIi64=''
1092 d_PRIo64=''
1093 d_PRIu64=''
1094 d_PRIx64=''
1095 sPRIXU64=''
1096 sPRId64=''
1097 sPRIi64=''
1098 sPRIo64=''
1099 sPRIu64=''
1100 sPRIx64=''
1101 d_quad=''
1102 quadkind=''
1103 quadtype=''
1104 uquadtype=''
1105 drand01=''
1106 randbits=''
1107 randfunc=''
1108 randseedtype=''
1109 seedfunc=''
1110 installscript=''
1111 scriptdir=''
1112 scriptdirexp=''
1113 selectminbits=''
1114 selecttype=''
1115 sh=''
1116 sig_count=''
1117 sig_name=''
1118 sig_name_init=''
1119 sig_num=''
1120 sig_num_init=''
1121 sig_size=''
1122 d_sitearch=''
1123 installsitearch=''
1124 sitearch=''
1125 sitearchexp=''
1126 installsitebin=''
1127 sitebin=''
1128 sitebinexp=''
1129 installsitehtml1dir=''
1130 sitehtml1dir=''
1131 sitehtml1direxp=''
1132 installsitehtml3dir=''
1133 sitehtml3dir=''
1134 sitehtml3direxp=''
1135 installsitelib=''
1136 sitelib=''
1137 sitelib_stem=''
1138 sitelibexp=''
1139 installsiteman1dir=''
1140 siteman1dir=''
1141 siteman1direxp=''
1142 installsiteman3dir=''
1143 siteman3dir=''
1144 siteman3direxp=''
1145 siteprefix=''
1146 siteprefixexp=''
1147 installsitescript=''
1148 sitescript=''
1149 sitescriptexp=''
1150 sizesize=''
1151 sizetype=''
1152 so=''
1153 socksizetype=''
1154 sharpbang=''
1155 shsharp=''
1156 spitshell=''
1157 src=''
1158 ssizetype=''
1159 startperl=''
1160 startsh=''
1161 stdchar=''
1162 d_stdio_stream_array=''
1163 stdio_stream_array=''
1164 sysman=''
1165 trnl=''
1166 uidformat=''
1167 uidsign=''
1168 uidsize=''
1169 uidtype=''
1170 archname64=''
1171 use64bitall=''
1172 use64bitint=''
1173 usefaststdio=''
1174 ccflags_uselargefiles=''
1175 ldflags_uselargefiles=''
1176 libswanted_uselargefiles=''
1177 uselargefiles=''
1178 uselongdouble=''
1179 usemorebits=''
1180 usemultiplicity=''
1181 nm_opt=''
1182 nm_so_opt=''
1183 runnm=''
1184 usenm=''
1185 useperlio=''
1186 usesocks=''
1187 d_oldpthreads=''
1188 use5005threads=''
1189 useithreads=''
1190 usereentrant=''
1191 usethreads=''
1192 incpath=''
1193 mips_type=''
1194 usrinc=''
1195 d_vendorarch=''
1196 installvendorarch=''
1197 vendorarch=''
1198 vendorarchexp=''
1199 d_vendorbin=''
1200 installvendorbin=''
1201 vendorbin=''
1202 vendorbinexp=''
1203 installvendorhtml1dir=''
1204 vendorhtml1dir=''
1205 vendorhtml1direxp=''
1206 installvendorhtml3dir=''
1207 vendorhtml3dir=''
1208 vendorhtml3direxp=''
1209 d_vendorlib=''
1210 installvendorlib=''
1211 vendorlib=''
1212 vendorlib_stem=''
1213 vendorlibexp=''
1214 installvendorman1dir=''
1215 vendorman1dir=''
1216 vendorman1direxp=''
1217 installvendorman3dir=''
1218 vendorman3dir=''
1219 vendorman3direxp=''
1220 usevendorprefix=''
1221 vendorprefix=''
1222 vendorprefixexp=''
1223 d_vendorscript=''
1224 installvendorscript=''
1225 vendorscript=''
1226 vendorscriptexp=''
1227 versiononly=''
1228 defvoidused=''
1229 voidflags=''
1230 yacc=''
1231 yaccflags=''
1232 CONFIG=''
1233
1234 define='define'
1235 undef='undef'
1236 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1237 rmlist=''
1238
1239 : We must find out about Eunice early
1240 eunicefix=':'
1241 if test -f /etc/unixtovms; then
1242         eunicefix=/etc/unixtovms
1243 fi
1244 if test -f /etc/unixtovms.exe; then
1245         eunicefix=/etc/unixtovms.exe
1246 fi
1247
1248 : Set executable suffix now -- needed before hints available
1249 if test -f "/libs/version.library"; then
1250 : Amiga OS
1251     _exe=""
1252 elif test -f "/system/gnu_library/bin/ar.pm"; then
1253 : Stratus VOS
1254     _exe=".pm"
1255 elif test -n "$DJGPP"; then
1256 : DOS DJGPP
1257     _exe=".exe"
1258 elif test -d c:/. -o -n "$is_os2" ; then
1259 : OS/2 or cygwin
1260     _exe=".exe"
1261 fi
1262
1263 i_whoami=''
1264 ccname=''
1265 ccversion=''
1266 perllibs=''
1267 : set useposix=false in your hint file to disable the POSIX extension.
1268 useposix=true
1269 : set useopcode=false in your hint file to disable the Opcode extension.
1270 useopcode=true
1271 : Trailing extension.  Override this in a hint file, if needed.
1272 : Extra object files, if any, needed on this platform.
1273 archobjs=''
1274 archname=''
1275 : Possible local include directories to search.
1276 : Set locincpth to "" in a hint file to defeat local include searches.
1277 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1278 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1279 :
1280 : no include file wanted by default
1281 inclwanted=''
1282
1283 : Enable -DEBUGGING and -DDEBUGGING from the command line
1284 EBUGGING=''
1285 DEBUGGING=old
1286
1287 groupstype=''
1288 libnames=''
1289 : change the next line if compiling for Xenix/286 on Xenix/386
1290 xlibpth='/usr/lib/386 /lib/386'
1291 : Possible local library directories to search.
1292 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1293 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1294
1295 : general looking path for locating libraries
1296 glibpth="/lib /usr/lib $xlibpth"
1297 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1298 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1299 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1300
1301 : Private path used by Configure to find libraries.  Its value
1302 : is prepended to libpth. This variable takes care of special
1303 : machines, like the mips.  Usually, it should be empty.
1304 plibpth=''
1305
1306 : default library list
1307 libswanted=''
1308 : some systems want to use only the non-versioned libso:s
1309 ignore_versioned_solibs=''
1310 siteman1dir=''
1311 siteman3dir=''
1312 sitescript=''
1313 archname64=''
1314 ccflags_uselargefiles=''
1315 ldflags_uselargefiles=''
1316 libswanted_uselargefiles=''
1317 : set usemultiplicity on the Configure command line to enable multiplicity.
1318 : set usesocks on the Configure command line to enable socks.
1319 : set usethreads on the Configure command line to enable threads.
1320 usereentrant='undef'
1321 : full support for void wanted by default
1322 defvoidused=15
1323
1324 : List of libraries we want.
1325 : If anyone needs extra -lxxx, put those in a hint file.
1326 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1327 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1328 : We probably want to search /usr/shlib before most other libraries.
1329 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1330 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1331 glibpth="/usr/shlib $glibpth"
1332 : Do not use vfork unless overridden by a hint file.
1333 usevfork=false
1334
1335 : Find the basic shell for Bourne shell scripts
1336 case "$sh" in
1337 '')
1338         case "$SYSTYPE" in
1339         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1340         *) xxx='/bin/sh';;
1341         esac
1342         if test -f "$xxx"; then
1343                 sh="$xxx"
1344         else
1345                 : Build up a list and do a single loop so we can 'break' out.
1346                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1347                 for xxx in sh bash ksh pdksh ash; do
1348                         for p in $pth; do
1349                                 try="$try ${p}/${xxx}"
1350                         done
1351                 done
1352                 for xxx in $try; do
1353                         if test -f "$xxx"; then
1354                                 sh="$xxx";
1355                                 break
1356                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1357                                 sh="$xxx";
1358                                 break
1359                         elif test -f "$xxx.exe"; then
1360                                 sh="$xxx";
1361                                 break
1362                         fi
1363                 done
1364         fi
1365         ;;
1366 esac
1367
1368 case "$sh" in
1369 '')     cat >&2 <<EOM
1370 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1371
1372 Usually it's in /bin/sh.  How did you even get this far?
1373 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1374 we'll try to straighten this all out.
1375 EOM
1376         exit 1
1377         ;;
1378 esac
1379
1380 : see if sh knows # comments
1381 if `$sh -c '#' >/dev/null 2>&1`; then
1382         shsharp=true
1383         spitshell=cat
1384         xcat=/bin/cat
1385         test -f $xcat$_exe || xcat=/usr/bin/cat
1386         if test ! -f $xcat$_exe; then
1387                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1388                         if test -f $p/cat$_exe; then
1389                                 xcat=$p/cat
1390                                 break
1391                         fi
1392                 done
1393                 if test ! -f $xcat$_exe; then
1394                         echo "Can't find cat anywhere!"
1395                         exit 1
1396                 fi
1397         fi
1398         echo "#!$xcat" >sharp
1399         $eunicefix sharp
1400         chmod +x sharp
1401         ./sharp > today
1402         if test -s today; then
1403                 sharpbang='#!'
1404         else
1405                 echo "#! $xcat" > sharp
1406                 $eunicefix sharp
1407                 chmod +x sharp
1408                 ./sharp > today
1409                 if test -s today; then
1410                         sharpbang='#! '
1411                 else
1412                         sharpbang=': use '
1413                 fi
1414         fi
1415 else
1416         echo " "
1417         echo "Your $sh doesn't grok # comments--I will strip them later on."
1418         shsharp=false
1419         cd ..
1420         echo "exec grep -v '^[  ]*#'" >spitshell
1421         chmod +x spitshell
1422         $eunicefix spitshell
1423         spitshell=`pwd`/spitshell
1424         cd UU
1425         echo "I presume that if # doesn't work, #! won't work either!"
1426         sharpbang=': use '
1427 fi
1428 rm -f sharp today
1429
1430 : figure out how to guarantee sh startup
1431 case "$startsh" in
1432 '') startsh=${sharpbang}${sh} ;;
1433 *)
1434 esac
1435 cat >sharp <<EOSS
1436 $startsh
1437 set abc
1438 test "$?abc" != 1
1439 EOSS
1440
1441 chmod +x sharp
1442 $eunicefix sharp
1443 if ./sharp; then
1444         : echo "Yup, it does."
1445 else
1446         echo "Hmm... '$startsh' does not guarantee sh startup..."
1447         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1448 fi
1449 rm -f sharp
1450
1451
1452 : Save command line options in file UU/cmdline.opt for later use in
1453 : generating config.sh.
1454 cat > cmdline.opt <<EOSH
1455 # Configure command line arguments.
1456 config_arg0='$0'
1457 config_args='$*'
1458 config_argc=$#
1459 EOSH
1460 argn=1
1461 args_exp=''
1462 args_sep=''
1463 for arg in "$@"; do
1464         cat >>cmdline.opt <<EOSH
1465 config_arg$argn='$arg'
1466 EOSH
1467         # Extreme backslashitis: replace each ' by '"'"'
1468         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1469 $arg
1470 EOC
1471         arg_exp=`cat cmdl.opt`
1472         args_exp="$args_exp$args_sep'$arg_exp'"
1473         argn=`expr $argn + 1`
1474         args_sep=' '
1475 done
1476 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1477 # used by ./hints/os2.sh
1478 rm -f cmdl.opt
1479
1480 : produce awk script to parse command line options
1481 cat >options.awk <<'EOF'
1482 BEGIN {
1483         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1484
1485         len = length(optstr);
1486         for (i = 1; i <= len; i++) {
1487                 c = substr(optstr, i, 1);
1488                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1489                 if (a == ":") {
1490                         arg[c] = 1;
1491                         i++;
1492                 }
1493                 opt[c] = 1;
1494         }
1495 }
1496 {
1497         expect = 0;
1498         str = $0;
1499         if (substr(str, 1, 1) != "-") {
1500                 printf("'%s'\n", str);
1501                 next;
1502         }
1503         len = length($0);
1504         for (i = 2; i <= len; i++) {
1505                 c = substr(str, i, 1);
1506                 if (!opt[c]) {
1507                         printf("-%s\n", substr(str, i));
1508                         next;
1509                 }
1510                 printf("-%s\n", c);
1511                 if (arg[c]) {
1512                         if (i < len)
1513                                 printf("'%s'\n", substr(str, i + 1));
1514                         else
1515                                 expect = 1;
1516                         next;
1517                 }
1518         }
1519 }
1520 END {
1521         if (expect)
1522                 print "?";
1523 }
1524 EOF
1525
1526 : process the command line options
1527 set X `for arg in "$@"; do echo "X$arg"; done |
1528         sed -e s/X// | awk -f options.awk`
1529 eval "set $*"
1530 shift
1531 rm -f options.awk
1532
1533 : set up default values
1534 fastread=''
1535 reuseval=false
1536 config_sh=''
1537 alldone=''
1538 error=''
1539 silent=''
1540 extractsh=''
1541 override=''
1542 knowitall=''
1543 rm -f optdef.sh posthint.sh
1544 cat >optdef.sh <<EOS
1545 $startsh
1546 EOS
1547
1548
1549 : option parsing
1550 while test $# -gt 0; do
1551         case "$1" in
1552         -d) shift; fastread=yes;;
1553         -e) shift; alldone=cont;;
1554         -f)
1555                 shift
1556                 cd ..
1557                 if test -r "$1"; then
1558                         config_sh="$1"
1559                 else
1560                         echo "$me: cannot read config file $1." >&2
1561                         error=true
1562                 fi
1563                 cd UU
1564                 shift;;
1565         -h) shift; error=true;;
1566         -r) shift; reuseval=true;;
1567         -s) shift; silent=true; realsilent=true;;
1568         -E) shift; alldone=exit;;
1569         -K) shift; knowitall=true;;
1570         -O) shift; override=true;;
1571         -S) shift; silent=true; extractsh=true;;
1572         -D)
1573                 shift
1574                 case "$1" in
1575                 *=)
1576                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1577                         echo "$me: ignoring -D $1" >&2
1578                         ;;
1579                 *=*) echo "$1" | \
1580                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1581                 *) echo "$1='define'" >> optdef.sh;;
1582                 esac
1583                 shift
1584                 ;;
1585         -U)
1586                 shift
1587                 case "$1" in
1588                 *=) echo "$1" >> optdef.sh;;
1589                 *=*)
1590                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1591                         echo "$me: ignoring -U $1" >&2
1592                         ;;
1593                 *) echo "$1='undef'" >> optdef.sh;;
1594                 esac
1595                 shift
1596                 ;;
1597         -A)
1598             shift
1599             xxx=''
1600             yyy="$1"
1601             zzz=''
1602             uuu=undef
1603             case "$yyy" in
1604             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1605                  case "$zzz" in
1606                  *:*) zzz='' ;;
1607                  *)   xxx=append
1608                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1609                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1610                  esac
1611                  ;;
1612             esac
1613             case "$xxx" in
1614             '')  case "$yyy" in
1615                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1616                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1617                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1618                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1619                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1620                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1621                  esac
1622                  ;;       
1623             esac
1624             case "$xxx" in
1625             append)
1626                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1627             clear)
1628                 echo "$yyy=''"                  >> posthint.sh ;;
1629             define)
1630                 case "$zzz" in
1631                 '') zzz=define ;;
1632                 esac
1633                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1634             eval)
1635                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1636             prepend)
1637                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1638             undef)
1639                 case "$zzz" in
1640                 '') zzz="$uuu" ;;
1641                 esac
1642                 echo "$yyy=$zzz"                >> posthint.sh ;;
1643             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1644             esac
1645             shift
1646             ;;
1647         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1648             exit 0;;
1649         --) break;;
1650         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1651         *) break;;
1652         esac
1653 done
1654
1655 case "$error" in
1656 true)
1657         cat >&2 <<EOM
1658 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1659                  [-U symbol] [-U symbol=] [-A command:symbol...]
1660   -d : use defaults for all answers.
1661   -e : go on without questioning past the production of config.sh.
1662   -f : specify an alternate default configuration file.
1663   -h : print this help message and exit (with an error status).
1664   -r : reuse C symbols value if possible (skips costly nm extraction).
1665   -s : silent mode, only echoes questions and essential information.
1666   -D : define symbol to have some value:
1667          -D symbol         symbol gets the value 'define'
1668          -D symbol=value   symbol gets the value 'value'
1669   -E : stop at the end of questions, after having produced config.sh.
1670   -K : do not use unless you know what you are doing.
1671   -O : let -D and -U override definitions from loaded configuration file.
1672   -S : perform variable substitutions on all .SH files (can mix with -f)
1673   -U : undefine symbol:
1674          -U symbol    symbol gets the value 'undef'
1675          -U symbol=   symbol gets completely empty
1676   -A : manipulate symbol after the platform specific hints have been applied:
1677          -A symbol=value                append " "value to symbol
1678          -A append:symbol=value         append value to symbol
1679          -A define:symbol=value         define symbol to have value
1680          -A clear:symbol                define symbol to be ''
1681          -A define:symbol               define symbol to be 'define'
1682          -A eval:symbol=value           define symbol to be eval of value
1683          -A prepend:symbol=value        prepend value to symbol
1684          -A undef:symbol                define symbol to be 'undef'
1685          -A undef:symbol=               define symbol to be ''
1686   -V : print version number and exit (with a zero status).
1687 EOM
1688         exit 1
1689         ;;
1690 esac
1691
1692 : Sanity checks
1693 case "$fastread$alldone" in
1694 yescont|yesexit) ;;
1695 *)
1696         case "$extractsh" in
1697         true) ;;
1698         *)
1699                 if test ! -t 0; then
1700                         echo "Say 'sh Configure', not 'sh <Configure'"
1701                         exit 1
1702                 fi
1703                 ;;
1704         esac
1705         ;;
1706 esac
1707
1708 exec 4>&1
1709 case "$silent" in
1710 true) exec 1>/dev/null;;
1711 esac
1712
1713 : run the defines and the undefines, if any, but leave the file out there...
1714 touch optdef.sh
1715 . ./optdef.sh
1716 : create the posthint manipulation script and leave the file out there...
1717 touch posthint.sh
1718
1719 : set package name
1720 package=perl5
1721 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1722 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1723 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1724 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1725 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1726 esac
1727
1728 : Some greps do not return status, grrr.
1729 echo "grimblepritz" >grimble
1730 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1731         contains=contains
1732 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1733         contains=grep
1734 else
1735         contains=contains
1736 fi
1737 rm -f grimble
1738 : the following should work in any shell
1739 case "$contains" in
1740 contains*)
1741         echo " "
1742         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1743         cat >contains <<'EOSS'
1744 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1745 EOSS
1746 chmod +x contains
1747 esac
1748
1749 : Find the path to the source tree
1750 case "$src" in
1751 '') case "$0" in
1752     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1753          case "$src" in
1754          /*)    ;;
1755          .)     ;;
1756          *)     src=`cd ../$src && pwd` ;;
1757          esac
1758          ;;
1759     *)   src='.';;
1760     esac;;
1761 esac
1762 case "$src" in
1763 '')     src=/
1764         rsrc=/
1765         ;;
1766 /*) rsrc="$src";;
1767 *) rsrc="../$src";;
1768 esac
1769 if test -f $rsrc/Configure && \
1770         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1771 then
1772    : found it, so we are ok.
1773 else
1774         rsrc=''
1775         for src in . .. ../.. ../../.. ../../../..; do
1776                 if test -f ../$src/Configure && \
1777                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1778                 then
1779                         rsrc=../$src
1780                         break
1781                 fi
1782         done
1783 fi
1784 case "$rsrc" in
1785 '')
1786         cat <<EOM >&4
1787
1788 Sorry, I can't seem to locate the source dir for $package.  Please start
1789 Configure with an explicit path -- i.e. /some/path/Configure.
1790
1791 EOM
1792         exit 1
1793         ;;
1794 ../.)   rsrc='..';;
1795 *)
1796         echo " "
1797         echo "Sources for $package found in \"$src\"." >&4
1798         ;;
1799 esac
1800
1801 : script used to extract .SH files with variable substitutions
1802 cat >extract <<'EOS'
1803 PERL_CONFIG_SH=true
1804 echo "Doing variable substitutions on .SH files..."
1805 if test -f MANIFEST; then
1806         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1807 else
1808         echo "(Looking for .SH files under the source directory.)"
1809         set x `(cd "$src"; find . -name "*.SH" -print)`
1810 fi
1811 shift
1812 case $# in
1813 0) set x `(cd "$src"; echo *.SH)`; shift;;
1814 esac
1815 if test ! -f "$src/$1"; then
1816         shift
1817 fi
1818 mkdir_p='
1819 name=$1;
1820 create="";
1821 while test $name; do
1822         if test ! -d "$name"; then
1823                 create="$name $create";
1824                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1825                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1826         else
1827                 name="";
1828         fi;
1829 done;
1830 for file in $create; do
1831         mkdir $file;
1832 done
1833 '
1834 for file in $*; do
1835         case "$src" in
1836         ".")
1837                 case "$file" in
1838                 */*)
1839                         dir=`expr X$file : 'X\(.*\)/'`
1840                         file=`expr X$file : 'X.*/\(.*\)'`
1841                         (cd "$dir" && . ./$file)
1842                         ;;
1843                 *)
1844                         . ./$file
1845                         ;;
1846                 esac
1847                 ;;
1848         *)
1849                 case "$file" in
1850                 */*)
1851                         dir=`expr X$file : 'X\(.*\)/'`
1852                         file=`expr X$file : 'X.*/\(.*\)'`
1853                         (set x $dir; shift; eval $mkdir_p)
1854                         sh <"$src/$dir/$file"
1855                         ;;
1856                 *)
1857                         sh <"$src/$file"
1858                         ;;
1859                 esac
1860                 ;;
1861         esac
1862 done
1863 if test -f "$src/config_h.SH"; then
1864         if test ! -f config.h; then
1865         : oops, they left it out of MANIFEST, probably, so do it anyway.
1866         . "$src/config_h.SH"
1867         fi
1868 fi
1869 EOS
1870
1871 : extract files and exit if asked to do so
1872 case "$extractsh" in
1873 true)
1874         case "$realsilent" in
1875         true) ;;
1876         *) exec 1>&4;;
1877         esac
1878         case "$config_sh" in
1879         '') config_sh='config.sh';;
1880         esac
1881         echo " "
1882         echo "Fetching answers from $config_sh..."
1883         cd ..
1884         . $config_sh
1885         test "$override" && . ./optdef.sh
1886         echo " "
1887         . UU/extract
1888         rm -rf UU
1889         echo "Extraction done."
1890         exit 0
1891         ;;
1892 esac
1893
1894 : Eunice requires " " instead of "", can you believe it
1895 echo " "
1896 : Here we go...
1897 echo "Beginning of configuration questions for $package."
1898
1899 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1900
1901 : first determine how to suppress newline on echo command
1902 echo " "
1903 echo "Checking echo to see how to suppress newlines..."
1904 (echo "hi there\c" ; echo " ") >.echotmp
1905 if $contains c .echotmp >/dev/null 2>&1 ; then
1906         echo "...using -n."
1907         n='-n'
1908         c=''
1909 else
1910         cat <<'EOM'
1911 ...using \c
1912 EOM
1913         n=''
1914         c='\c'
1915 fi
1916 echo $n "The star should be here-->$c"
1917 echo '*'
1918 rm -f .echotmp
1919
1920 : Now test for existence of everything in MANIFEST
1921 echo " "
1922 if test -f "$rsrc/MANIFEST"; then
1923         echo "First let's make sure your kit is complete.  Checking..." >&4
1924         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1925         rm -f missing
1926         tmppwd=`pwd`
1927         for filelist in x??; do
1928                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1929         done
1930         if test -s missing; then
1931                 cat missing >&4
1932                 cat >&4 <<'EOM'
1933
1934 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1935
1936 You have the option of continuing the configuration process, despite the
1937 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1938 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1939 and contact the author (perlbug@perl.org).
1940
1941 EOM
1942                 echo $n "Continue? [n] $c" >&4
1943                 read ans
1944                 case "$ans" in
1945                 y*)
1946                         echo "Continuing..." >&4
1947                         rm -f missing
1948                         ;;
1949                 *)
1950                         echo "ABORTING..." >&4
1951                         kill $$
1952                         ;;
1953                 esac
1954         else
1955                 echo "Looks good..."
1956         fi
1957 else
1958         echo "There is no MANIFEST file.  I hope your kit is complete !"
1959 fi
1960 rm -f missing x??
1961
1962 echo " "
1963 : Find the appropriate value for a newline for tr
1964 if test -n "$DJGPP"; then
1965        trnl='\012'
1966 fi
1967 if test X"$trnl" = X; then
1968         case "`echo foo|tr '\n' x 2>/dev/null`" in
1969         foox) trnl='\n' ;;
1970         esac
1971 fi
1972 if test X"$trnl" = X; then
1973         case "`echo foo|tr '\012' x 2>/dev/null`" in
1974         foox) trnl='\012' ;;
1975         esac
1976 fi
1977 if test X"$trnl" = X; then
1978        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1979        fooxy) trnl='\n\r' ;;
1980        esac
1981 fi
1982 if test X"$trnl" = X; then
1983         cat <<EOM >&2
1984
1985 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1986
1987 EOM
1988         exit 1
1989 fi
1990
1991 : compute the number of columns on the terminal for proper question formatting
1992 case "$COLUMNS" in
1993 '') COLUMNS='80';;
1994 esac
1995
1996 : set up the echo used in my read
1997 myecho="case \"\$xxxm\" in
1998 '') echo $n \"\$rp $c\" >&4;;
1999 *) case \"\$rp\" in
2000         '') echo $n \"[\$xxxm] $c\";;
2001         *)
2002                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2003                         echo \"\$rp\" >&4
2004                         echo $n \"[\$xxxm] $c\" >&4
2005                 else
2006                         echo $n \"\$rp [\$xxxm] $c\" >&4
2007                 fi
2008                 ;;
2009         esac;;
2010 esac"
2011
2012 : now set up to do reads with possible shell escape and default assignment
2013 cat <<EOSC >myread
2014 $startsh
2015 xxxm=\$dflt
2016 $myecho
2017 ans='!'
2018 case "\$fastread" in
2019 yes) case "\$dflt" in
2020         '') ;;
2021         *) ans='';
2022                 case "\$silent-\$rp" in
2023                 true-) ;;
2024                 *) echo " " >&4;;
2025                 esac;;
2026         esac;;
2027 *) case "\$silent" in
2028         true) case "\$rp" in
2029                 '') ans='';;
2030                 esac;;
2031         esac;;
2032 esac
2033 while expr "X\$ans" : "X!" >/dev/null; do
2034         read answ
2035         set x \$xxxm
2036         shift
2037         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2038         case  "\$answ" in
2039         "!")
2040                 sh 1>&4
2041                 echo " "
2042                 $myecho
2043                 ;;
2044         !*)
2045                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2046                 shift
2047                 sh 1>&4 -c "\$*"
2048                 echo " "
2049                 $myecho
2050                 ;;
2051         "\$ans")
2052                 case "\$ans" in
2053                 \\&*)
2054                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2055                         shift
2056                         case "\$1" in
2057                         -d)
2058                                 fastread=yes
2059                                 echo "(OK, I'll run with -d after this question.)" >&4
2060                                 ;;
2061                         -*)
2062                                 echo "*** Sorry, \$1 not supported yet." >&4
2063                                 ;;
2064                         esac
2065                         $myecho
2066                         ans=!
2067                         ;;
2068                 esac;;
2069         *)
2070                 case "\$aok" in
2071                 y)
2072                         echo "*** Substitution done -- please confirm."
2073                         xxxm="\$ans"
2074                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2075                         xxxm="\$ans"
2076                         ans=!
2077                         ;;
2078                 *)
2079                         echo "*** Error -- try again."
2080                         ans=!
2081                         ;;
2082                 esac
2083                 $myecho
2084                 ;;
2085         esac
2086         case "\$ans\$xxxm\$nostick" in
2087         '')
2088                 ans=!
2089                 $myecho
2090                 ;;
2091         esac
2092 done
2093 case "\$ans" in
2094 '') ans="\$xxxm";;
2095 esac
2096 EOSC
2097
2098 : create .config dir to save info across Configure sessions
2099 test -d ../.config || mkdir ../.config
2100 cat >../.config/README <<EOF
2101 This directory created by Configure to save information that should
2102 persist across sessions for $package.
2103
2104 You may safely delete it if you wish.
2105 EOF
2106
2107 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2108 case "$usedevel" in
2109 $define|true|[yY]*) ;;
2110 *) case "$xversion" in
2111    *[13579])
2112         cat >&4 <<EOH
2113 *** WHOA THERE!!! ***
2114
2115     This is an UNSTABLE DEVELOPMENT release.
2116     The version of this $package distribution is $xversion, that is, odd,
2117     (as opposed to even) and that signifies a development release.
2118     If you want a maintenance release, you want an even-numbered version.
2119
2120     Do ***NOT*** install this into production use.
2121     Data corruption and crashes are possible.
2122
2123     It is most seriously suggested that you do not continue any further
2124     unless you want to help in developing and debugging Perl.
2125
2126     If you *still* want to build perl, you can answer 'y' now,
2127     or pass -Dusedevel to Configure.
2128
2129 EOH
2130         rp='Do you really want to continue?'
2131         dflt='n'
2132         . ./myread
2133         case "$ans" in
2134         [yY]) echo >&4 "Okay, continuing."
2135               usedevel="$define" ;;
2136         *) echo >&4 "Okay, bye."
2137            exit 1
2138            ;;
2139         esac
2140         ;;
2141     esac
2142     ;;
2143 esac
2144 case "$usedevel" in
2145 $define|true|[yY]*)
2146         case "$versiononly" in
2147         '') versiononly="$define" ;;
2148         esac
2149         case "$installusrbinperl" in
2150         '') installusrbinperl="$undef" ;;
2151         esac
2152         ;;
2153 esac
2154
2155 : general instructions
2156 needman=true
2157 firsttime=true
2158 user=`(logname) 2>/dev/null`
2159 case "$user" in
2160 '') user=`whoami 2>&1`;;
2161 esac
2162 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2163         firsttime=false
2164         echo " "
2165         rp='Would you like to see the instructions?'
2166         dflt=n
2167         . ./myread
2168         case "$ans" in
2169         [yY]*) ;;
2170         *) needman=false;;
2171         esac
2172 fi
2173 if $needman; then
2174         cat <<EOH
2175
2176 This installation shell script will examine your system and ask you questions
2177 to determine how the perl5 package should be installed. If you get
2178 stuck on a question, you may use a ! shell escape to start a subshell or
2179 execute a command.  Many of the questions will have default answers in square
2180 brackets; typing carriage return will give you the default.
2181
2182 On some of the questions which ask for file or directory names you are allowed
2183 to use the ~name construct to specify the login directory belonging to "name",
2184 even if you don't have a shell which knows about that.  Questions where this is
2185 allowed will be marked "(~name ok)".
2186
2187 EOH
2188         rp=''
2189         dflt='Type carriage return to continue'
2190         . ./myread
2191         cat <<'EOH'
2192
2193 The prompter used in this script allows you to use shell variables and
2194 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2195 in the default answer, as if the default line was a set of arguments given to a
2196 script shell.  This means you may also use $* to repeat the whole default line,
2197 so you do not have to re-type everything to add something to the default.
2198
2199 Everytime there is a substitution, you will have to confirm.  If there is an
2200 error (e.g. an unmatched backtick), the default answer will remain unchanged
2201 and you will be prompted again.
2202
2203 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2204 the questions and use the computed defaults (or the previous answers if there
2205 was already a config.sh file). Type 'Configure -h' for a list of options.
2206 You may also start interactively and then answer '& -d' at any prompt to turn
2207 on the non-interactive behaviour for the remainder of the execution.
2208
2209 EOH
2210         . ./myread
2211         cat <<EOH
2212
2213 Much effort has been expended to ensure that this shell script will run on any
2214 Unix system.  If despite that it blows up on yours, your best bet is to edit
2215 Configure and run it again.  If you can't run Configure for some reason,
2216 you'll have to generate a config.sh file by hand.  Whatever problems you
2217 have, let me (perlbug@perl.org) know how I blew it.
2218
2219 This installation script affects things in two ways:
2220
2221 1) it may do direct variable substitutions on some of the files included
2222    in this kit.
2223 2) it builds a config.h file for inclusion in C programs.  You may edit
2224    any of these files as the need arises after running this script.
2225
2226 If you make a mistake on a question, there is no easy way to back up to it
2227 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2228 files.  Configure will offer to let you do this before it runs the SH files.
2229
2230 EOH
2231         dflt='Type carriage return to continue'
2232         . ./myread
2233         case "$firsttime" in
2234         true) echo $user >>../.config/instruct;;
2235         esac
2236 fi
2237
2238 : find out where common programs are
2239 echo " "
2240 echo "Locating common programs..." >&4
2241 cat <<EOSC >loc
2242 $startsh
2243 case \$# in
2244 0) exit 1;;
2245 esac
2246 thing=\$1
2247 shift
2248 dflt=\$1
2249 shift
2250 for dir in \$*; do
2251         case "\$thing" in
2252         .)
2253         if test -d \$dir/\$thing; then
2254                 echo \$dir
2255                 exit 0
2256         fi
2257         ;;
2258         *)
2259         for thisthing in \$dir/\$thing; do
2260                 : just loop through to pick last item
2261         done
2262         if test -f \$thisthing; then
2263                 echo \$thisthing
2264                 exit 0
2265         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2266                 echo \$thisthing
2267                 exit 0
2268         elif test -f \$dir/\$thing.exe; then
2269                 if test -n "$DJGPP"; then
2270                         echo \$dir/\$thing.exe
2271                 elif test "$eunicefix" != ":"; then
2272                         : on Eunice apparently
2273                         echo \$dir/\$thing
2274                         exit 0
2275                 fi
2276                 exit 0
2277         fi
2278         ;;
2279         esac
2280 done
2281 echo \$dflt
2282 exit 1
2283 EOSC
2284 chmod +x loc
2285 $eunicefix loc
2286 loclist="
2287 awk
2288 cat
2289 chmod
2290 comm
2291 cp
2292 echo
2293 expr
2294 grep
2295 ls
2296 mkdir
2297 rm
2298 sed
2299 sort
2300 touch
2301 tr
2302 uniq
2303 "
2304 trylist="
2305 Mcc
2306 ar
2307 bison
2308 byacc
2309 cpp
2310 csh
2311 date
2312 egrep
2313 gmake
2314 gzip
2315 less
2316 ln
2317 make
2318 more
2319 nm
2320 nroff
2321 pg
2322 test
2323 uname
2324 zip
2325 "
2326 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2327 pth="$pth /lib /usr/lib"
2328 for file in $loclist; do
2329         eval xxx=\$$file
2330         case "$xxx" in
2331         /*|?:[\\/]*)
2332                 if test -f "$xxx"; then
2333                         : ok
2334                 else
2335                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2336                         xxx=`./loc $file $file $pth`
2337                 fi
2338                 ;;
2339         '') xxx=`./loc $file $file $pth`;;
2340         *) xxx=`./loc $xxx $xxx $pth`;;
2341         esac
2342         eval $file=$xxx$_exe
2343         eval _$file=$xxx
2344         case "$xxx" in
2345         /*)
2346                 echo $file is in $xxx.
2347                 ;;
2348         ?:[\\/]*)
2349                 echo $file is in $xxx.
2350                 ;;
2351         *)
2352                 echo "I don't know where '$file' is, and my life depends on it." >&4
2353                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2354                 exit 1
2355                 ;;
2356         esac
2357 done
2358 echo " "
2359 echo "Don't worry if any of the following aren't found..."
2360 say=offhand
2361 for file in $trylist; do
2362         eval xxx=\$$file
2363         case "$xxx" in
2364         /*|?:[\\/]*)
2365                 if test -f "$xxx"; then
2366                         : ok
2367                 else
2368                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2369                         xxx=`./loc $file $file $pth`
2370                 fi
2371                 ;;
2372         '') xxx=`./loc $file $file $pth`;;
2373         *) xxx=`./loc $xxx $xxx $pth`;;
2374         esac
2375         eval $file=$xxx$_exe
2376         eval _$file=$xxx
2377         case "$xxx" in
2378         /*)
2379                 echo $file is in $xxx.
2380                 ;;
2381         ?:[\\/]*)
2382                 echo $file is in $xxx.
2383                 ;;
2384         *)
2385                 echo "I don't see $file out there, $say."
2386                 say=either
2387                 ;;
2388         esac
2389 done
2390 case "$egrep" in
2391 egrep)
2392         echo "Substituting grep for egrep."
2393         egrep=$grep
2394         _egrep=$grep
2395         ;;
2396 esac
2397 case "$ln" in
2398 ln)
2399         echo "Substituting cp for ln."
2400         ln=$cp
2401         _ln=$cp
2402         ;;
2403 esac
2404 case "$make" in
2405 make)   
2406         case "$gmake" in
2407         gmake)
2408         echo "I can't find make or gmake, and my life depends on it." >&4
2409         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2410         exit 1
2411         ;;
2412         esac
2413         ;;
2414 esac    
2415 case "$gmake" in
2416 gmake)  ;;
2417 *)      # We can't have osname yet.
2418         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2419                 # Assume that gmake, if found, is definitely GNU make
2420                 # and prefer it over the system make.
2421                 echo "Substituting gmake for make."
2422                 make=$gmake
2423                 _make=$gmake
2424         fi
2425         ;;
2426 esac
2427 case "$test" in
2428 test)
2429         echo "Hopefully test is built into your sh."
2430         ;;
2431 *)
2432         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2433                 echo "Using the test built into your sh."
2434                 test=test
2435                 _test=test
2436         fi
2437         ;;
2438 esac
2439 case "$echo" in
2440 echo)
2441         echo "Hopefully echo is built into your sh."
2442         ;;
2443 '') ;;
2444 *)
2445         echo " "
2446 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2447         $echo $n "hi there$c" >foo1
2448         echo $n "hi there$c" >foo2
2449         if cmp foo1 foo2 >/dev/null 2>&1; then
2450                 echo "They are compatible.  In fact, they may be identical."
2451         else
2452                 case "$n" in
2453                 '-n') n='' c='\c';;
2454                 *) n='-n' c='';;
2455                 esac
2456                 cat <<FOO
2457 They are not compatible!  You are probably running ksh on a non-USG system.
2458 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2459 have echo built in and we may have to run some Bourne shell scripts.  That
2460 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2461
2462 FOO
2463                 $echo $n "The star should be here-->$c"
2464                 $echo "*"
2465         fi
2466         $rm -f foo1 foo2
2467         ;;
2468 esac
2469
2470 cat <<EOS >trygcc
2471 $startsh
2472 EOS
2473 cat <<'EOSC' >>trygcc
2474 case "$cc" in
2475 '') ;;
2476 *)  $rm -f try try.*
2477     $cat >try.c <<EOM
2478 int main(int argc, char *argv[]) {
2479   return 0;
2480 }
2481 EOM
2482     if $cc -o try $ccflags $ldflags try.c; then
2483        :
2484     else
2485         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2486         despair=yes
2487         trygcc=yes
2488         case "$cc" in
2489         *gcc*) trygcc=no ;;
2490         esac
2491         case "`$cc -v -c try.c 2>&1`" in
2492         *gcc*) trygcc=no ;;
2493         esac
2494         if $test X"$trygcc" = Xyes; then
2495             if gcc -o try -c try.c; then
2496                 echo " "
2497                 echo "You seem to have a working gcc, though." >&4
2498                 rp="Would you like to use it?"
2499                 dflt=y
2500                 if $test -f myread; then
2501                     . ./myread
2502                 else
2503                     if $test -f UU/myread; then
2504                         . ./UU/myread
2505                     else
2506                         echo "Cannot find myread, sorry.  Aborting." >&2
2507                         exit 1
2508                     fi
2509                 fi  
2510                 case "$ans" in
2511                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2512                        if $test -f usethreads.cbu; then
2513                            $cat >&4 <<EOM 
2514
2515 *** However, any setting of the C compiler flags (e.g. for thread support)
2516 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2517 *** (together with e.g. -Dusethreads).
2518
2519 EOM
2520                        fi;;
2521                 esac
2522             fi
2523         fi
2524     fi
2525     $rm -f try try.*
2526     ;;
2527 esac
2528 EOSC
2529
2530 cat <<EOS >checkcc
2531 $startsh
2532 EOS
2533 cat <<'EOSC' >>checkcc
2534 case "$cc" in        
2535 '') ;;
2536 *)  $rm -f try try.*              
2537     $cat >try.c <<EOM
2538 int main(int argc, char *argv[]) {
2539   return 0;
2540 }
2541 EOM
2542     if $cc -o try $ccflags $ldflags try.c; then
2543        :
2544     else
2545         if $test X"$despair" = Xyes; then
2546            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2547         fi
2548         $cat >&4 <<EOM         
2549 You need to find a working C compiler.
2550 Either (purchase and) install the C compiler supplied by your OS vendor,
2551 or for a free C compiler try http://gcc.gnu.org/
2552 I cannot continue any further, aborting.
2553 EOM
2554         exit 1
2555     fi
2556     $rm -f try try.*
2557     ;;
2558 esac
2559 EOSC
2560
2561 : determine whether symbolic links are supported
2562 echo " "
2563 $touch blurfl
2564 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2565         echo "Symbolic links are supported." >&4
2566         lns="$ln -s"
2567 else
2568         echo "Symbolic links are NOT supported." >&4
2569         lns="$ln"
2570 fi
2571 $rm -f blurfl sym
2572
2573 : determine whether symbolic links are supported
2574 echo " "
2575 case "$lns" in
2576 *"ln"*" -s")
2577         echo "Checking how to test for symbolic links..." >&4
2578         $lns blurfl sym
2579         if $test "X$issymlink" = X; then
2580                 case "$newsh" in
2581                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2582                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2583                 esac
2584                 if test $? = 0; then
2585                         issymlink="test -h"
2586                 else
2587                         echo "Your builtin 'test -h' may be broken." >&4
2588                         case "$test" in
2589                         /*)     ;;
2590                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2591                                 for p in $pth
2592                                 do
2593                                         if test -f "$p/$test"; then
2594                                                 test="$p/$test"
2595                                                 break
2596                                         fi
2597                                 done
2598                                 ;;
2599                         esac
2600                         case "$test" in
2601                         /*)
2602                                 echo "Trying external '$test -h'." >&4
2603                                 issymlink="$test -h"
2604                                 if $test ! -h sym >/dev/null 2>&1; then
2605                                         echo "External '$test -h' is broken, too." >&4
2606                                         issymlink=''
2607                                 fi
2608                                 ;;
2609                         *)      issymlink='' ;;
2610                         esac
2611                 fi              
2612         fi
2613         if $test "X$issymlink" = X; then
2614                 if $test -L sym 2>/dev/null; then
2615                         issymlink="$test -L"
2616                         echo "The builtin '$test -L' worked." >&4
2617                 fi
2618         fi
2619         if $test "X$issymlink" != X; then
2620                 echo "You can test for symbolic links with '$issymlink'." >&4
2621         else
2622                 echo "I do not know how you can test for symbolic links." >&4
2623         fi
2624         $rm -f blurfl sym
2625         ;;
2626 *)      echo "No symbolic links, so not testing for their testing..." >&4
2627         ;;
2628 esac
2629 echo " "
2630
2631
2632 case "$mksymlinks" in
2633 $define|true|[yY]*)
2634         case "$src" in
2635         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2636                 exit 1
2637                 ;;
2638         *)      case "$lns:$issymlink" in
2639                 *"ln"*" -s:"*"test -"?)
2640                         echo "Creating the symbolic links..." >&4
2641                         echo "(First creating the subdirectories...)" >&4
2642                         cd ..
2643                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2644                                 read directory
2645                                 test -z "$directory" && break
2646                                 mkdir -p $directory
2647                         done
2648                         # Sanity check 1.
2649                         if test ! -d t/base; then
2650                                 echo "Failed to create the subdirectories.  Aborting." >&4
2651                                 exit 1
2652                         fi
2653                         echo "(Then creating the symlinks...)" >&4
2654                         awk '{print $1}' $src/MANIFEST | while true; do
2655                                 read filename
2656                                 test -z "$filename" && break
2657                                 if test -f $filename; then
2658                                         if $issymlink $filename; then
2659                                                 rm -f $filename
2660                                         fi
2661                                 fi
2662                                 if test -f $filename; then
2663                                         echo "$filename already exists, not symlinking."
2664                                 else
2665                                         ln -s $src/$filename $filename
2666                                 fi
2667                         done
2668                         # Sanity check 2.
2669                         if test ! -f t/base/lex.t; then
2670                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2671                                 exit 1
2672                         fi
2673                         cd UU
2674                         ;;
2675                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2676                         ;;
2677                 esac
2678                 ;;
2679         esac
2680         ;;
2681 esac
2682
2683
2684 case "$usecrosscompile" in
2685 $define|true|[yY]*)
2686         $echo "Cross-compiling..."
2687         croak=''
2688         case "$cc" in
2689         *-*-gcc) # A cross-compiling gcc, probably.
2690             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2691             ar=$targetarch-ar
2692             # leave out ld, choosing it is more complex
2693             nm=$targetarch-nm
2694             ranlib=$targetarch-ranlib
2695             $echo 'extern int foo;' > try.c
2696             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2697             shift
2698             if $test $# -gt 0; then
2699                 incpth="$incpth $*"
2700                 incpth="`$echo $incpth|$sed 's/^ //'`"
2701                 echo "Guessing incpth '$incpth'." >&4
2702                 for i in $*; do
2703                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2704                     if $test -d $j; then
2705                         libpth="$libpth $j"
2706                     fi
2707                 done   
2708                 libpth="`$echo $libpth|$sed 's/^ //'`"
2709                 echo "Guessing libpth '$libpth'." >&4
2710             fi
2711             $rm -f try.c
2712             ;;
2713         esac
2714         case "$targetarch" in
2715         '') echo "Targetarch not defined." >&4; croak=y ;;
2716         *)  echo "Using targetarch $targetarch." >&4 ;;
2717         esac
2718         case "$incpth" in
2719         '') echo "Incpth not defined." >&4; croak=y ;;
2720         *)  echo "Using incpth '$incpth'." >&4 ;;
2721         esac
2722         case "$libpth" in
2723         '') echo "Libpth not defined." >&4; croak=y ;;
2724         *)  echo "Using libpth '$libpth'." >&4 ;;
2725         esac
2726         case "$usrinc" in
2727         '') for i in $incpth; do
2728                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2729                     usrinc=$i
2730                     echo "Guessing usrinc $usrinc." >&4
2731                     break
2732                 fi
2733             done
2734             case "$usrinc" in
2735             '') echo "Usrinc not defined." >&4; croak=y ;;
2736             esac
2737             ;;
2738         *)  echo "Using usrinc $usrinc." >&4 ;;
2739         esac
2740         case "$targethost" in
2741         '') echo "Targethost not defined." >&4; croak=y ;;
2742         *)  echo "Using targethost $targethost." >&4
2743         esac
2744         locincpth=' '
2745         loclibpth=' '
2746         case "$croak" in
2747         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2748         esac
2749         case "$src" in
2750         /*) run=$src/Cross/run
2751             targetmkdir=$src/Cross/mkdir
2752             to=$src/Cross/to
2753             from=$src/Cross/from
2754             ;;
2755         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2756             run=$pwd/Cross/run
2757             targetmkdir=$pwd/Cross/mkdir
2758             to=$pwd/Cross/to
2759             from=$pwd/Cross/from
2760             ;;
2761         esac
2762         case "$targetrun" in
2763         '') targetrun=ssh ;;
2764         esac
2765         case "$targetto" in
2766         '') targetto=scp ;;
2767         esac
2768         case "$targetfrom" in
2769         '') targetfrom=scp ;;
2770         esac
2771         run=$run-$targetrun
2772         to=$to-$targetto
2773         from=$from-$targetfrom
2774         case "$targetdir" in
2775         '')  targetdir=/tmp
2776              echo "Guessing targetdir $targetdir." >&4
2777              ;;
2778         esac
2779         case "$targetuser" in
2780         '')  targetuser=root
2781              echo "Guessing targetuser $targetuser." >&4
2782              ;;
2783         esac
2784         case "$targetfrom" in
2785         scp)    q=-q ;;
2786         *)      q='' ;;
2787         esac
2788         case "$targetrun" in
2789         ssh|rsh)
2790             cat >$run <<EOF
2791 #!/bin/sh
2792 case "\$1" in
2793 -cwd)
2794   shift
2795   cwd=\$1
2796   shift
2797   ;;
2798 esac
2799 case "\$cwd" in
2800 '') cwd=$targetdir ;;
2801 esac
2802 exe=\$1
2803 shift
2804 if $test ! -f \$exe.xok; then
2805   $to \$exe
2806   $touch \$exe.xok
2807 fi
2808 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2809 EOF
2810             ;;
2811         *)  echo "Unknown targetrun '$targetrun'" >&4
2812             exit 1
2813             ;;
2814         esac
2815         case "$targetmkdir" in
2816         */Cross/mkdir)
2817             cat >$targetmkdir <<EOF
2818 #!/bin/sh
2819 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2820 EOF
2821             $chmod a+rx $targetmkdir
2822             ;;
2823         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2824             exit 1
2825             ;;
2826         esac
2827         case "$targetto" in
2828         scp|rcp)
2829             cat >$to <<EOF
2830 #!/bin/sh
2831 for f in \$@
2832 do
2833   case "\$f" in
2834   /*)
2835     $targetmkdir \`dirname \$f\`
2836     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2837     ;;
2838   *)
2839     $targetmkdir $targetdir/\`dirname \$f\`
2840     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2841     ;;
2842   esac
2843 done
2844 exit 0
2845 EOF
2846             ;;
2847         cp) cat >$to <<EOF
2848 #!/bin/sh
2849 for f in \$@
2850 do
2851   case "\$f" in
2852   /*)
2853     $mkdir -p $targetdir/\`dirname \$f\`
2854     $cp \$f $targetdir/\$f || exit 1
2855     ;;
2856   *)
2857     $targetmkdir $targetdir/\`dirname \$f\`
2858     $cp \$f $targetdir/\$f || exit 1
2859     ;;
2860   esac
2861 done
2862 exit 0
2863 EOF
2864             ;;
2865         *)  echo "Unknown targetto '$targetto'" >&4
2866             exit 1
2867             ;;
2868         esac
2869         case "$targetfrom" in
2870         scp|rcp)
2871           cat >$from <<EOF
2872 #!/bin/sh
2873 for f in \$@
2874 do
2875   $rm -f \$f
2876   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2877 done
2878 exit 0
2879 EOF
2880             ;;
2881         cp) cat >$from <<EOF
2882 #!/bin/sh
2883 for f in \$@
2884 do
2885   $rm -f \$f
2886   cp $targetdir/\$f . || exit 1
2887 done
2888 exit 0
2889 EOF
2890             ;;
2891         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2892             exit 1
2893             ;;
2894         esac
2895         if $test ! -f $run; then
2896             echo "Target 'run' script '$run' not found." >&4
2897         else
2898             $chmod a+rx $run
2899         fi
2900         if $test ! -f $to; then
2901             echo "Target 'to' script '$to' not found." >&4
2902         else
2903             $chmod a+rx $to
2904         fi
2905         if $test ! -f $from; then
2906             echo "Target 'from' script '$from' not found." >&4
2907         else
2908             $chmod a+rx $from
2909         fi
2910         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2911             exit 1
2912         fi
2913         cat >&4 <<EOF
2914 Using '$run' for remote execution,
2915 and '$from' and '$to'
2916 for remote file transfer.
2917 EOF
2918         ;;
2919 *)      run=''
2920         to=:
2921         from=:
2922         usecrosscompile='undef'
2923         targetarch=''
2924         ;;
2925 esac
2926
2927 : see whether [:lower:] and [:upper:] are supported character classes
2928 echo " "
2929 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2930 ABYZ)
2931         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2932         up='[:upper:]'
2933         low='[:lower:]'
2934         ;;
2935 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2936         # (0xd9 and 0xe2), therefore that is a nice testing point.
2937         if test "X$up" = X -o "X$low" = X; then
2938             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2939             rs) up='[A-Z]'
2940                 low='[a-z]'
2941                 ;;
2942             esac
2943         fi
2944         if test "X$up" = X -o "X$low" = X; then
2945             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2946             rs) up='A-Z'
2947                 low='a-z'
2948                 ;;
2949             esac
2950         fi
2951         if test "X$up" = X -o "X$low" = X; then
2952             case "`echo RS | od -x 2>/dev/null`" in
2953             *D9E2*|*d9e2*)
2954                 echo "Hey, this might be EBCDIC." >&4
2955                 if test "X$up" = X -o "X$low" = X; then
2956                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2957                     rs) up='[A-IJ-RS-Z]'
2958                         low='[a-ij-rs-z]'
2959                         ;;
2960                     esac
2961                 fi
2962                 if test "X$up" = X -o "X$low" = X; then
2963                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2964                     rs) up='A-IJ-RS-Z'
2965                         low='a-ij-rs-z'
2966                         ;;
2967                     esac
2968                 fi
2969                 ;;
2970             esac
2971         fi
2972 esac
2973 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2974 rs)
2975     echo "Using $up and $low to convert case." >&4
2976     ;;
2977 *)
2978     echo "I don't know how to translate letters from upper to lower case." >&4
2979     echo "Your tr is not acting any way I know of." >&4
2980     exit 1
2981     ;;
2982 esac
2983 : set up the translation script tr, must be called with ./tr of course
2984 cat >tr <<EOSC
2985 $startsh
2986 case "\$1\$2" in
2987 '[A-Z][a-z]') exec $tr '$up' '$low';;
2988 '[a-z][A-Z]') exec $tr '$low' '$up';;
2989 esac
2990 exec $tr "\$@"
2991 EOSC
2992 chmod +x tr
2993 $eunicefix tr
2994
2995 : Try to determine whether config.sh was made on this system
2996 case "$config_sh" in
2997 '')
2998 myuname=`$uname -a 2>/dev/null`
2999 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3000 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3001 # because the A-Z/a-z are not consecutive.
3002 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3003         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3004 newmyuname="$myuname"
3005 dflt=n
3006 case "$knowitall" in
3007 '')
3008         if test -f ../config.sh; then
3009                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3010                         eval "`grep myuname= ../config.sh`"
3011                 fi
3012                 if test "X$myuname" = "X$newmyuname"; then
3013                         dflt=y
3014                 fi
3015         fi
3016         ;;
3017 *) dflt=y;;
3018 esac
3019
3020 : Get old answers from old config file if Configure was run on the
3021 : same system, otherwise use the hints.
3022 hint=default
3023 cd ..
3024 if test -f config.sh; then
3025         echo " "
3026         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3027         . UU/myread
3028         case "$ans" in
3029         n*|N*) echo "OK, I'll ignore it."
3030                 mv config.sh config.sh.old
3031                 myuname="$newmyuname"
3032                 ;;
3033         *)  echo "Fetching default answers from your old config.sh file..." >&4
3034                 tmp_n="$n"
3035                 tmp_c="$c"
3036                 tmp_sh="$sh"
3037                 . ./config.sh
3038                 cp config.sh UU
3039                 n="$tmp_n"
3040                 c="$tmp_c"
3041                 : Older versions did not always set $sh.  Catch re-use of such
3042                 : an old config.sh.
3043                 case "$sh" in
3044                 '') sh="$tmp_sh" ;;
3045                 esac
3046                 hint=previous
3047                 ;;
3048         esac
3049 fi
3050 . ./UU/checkcc
3051 if test ! -f config.sh; then
3052         $cat <<EOM
3053
3054 First time through, eh?  I have some defaults handy for some systems
3055 that need some extra help getting the Configure answers right:
3056
3057 EOM
3058         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3059         dflt=''
3060         : Half the following guesses are probably wrong... If you have better
3061         : tests or hints, please send them to perlbug@perl.org
3062         : The metaconfig authors would also appreciate a copy...
3063         $test -f /irix && osname=irix
3064         $test -f /xenix && osname=sco_xenix
3065         $test -f /dynix && osname=dynix
3066         $test -f /dnix && osname=dnix
3067         $test -f /lynx.os && osname=lynxos
3068         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3069         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3070         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3071         $test -f /bin/mips && /bin/mips && osname=mips
3072         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3073                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3074         $test -d /usr/apollo/bin && osname=apollo
3075         $test -f /etc/saf/_sactab && osname=svr4
3076         $test -d /usr/include/minix && osname=minix
3077         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3078         if $test -d /MachTen -o -d /MachTen_Folder; then
3079                 osname=machten
3080                 if $test -x /sbin/version; then
3081                         osvers=`/sbin/version | $awk '{print $2}' |
3082                         $sed -e 's/[A-Za-z]$//'`
3083                 elif $test -x /usr/etc/version; then
3084                         osvers=`/usr/etc/version | $awk '{print $2}' |
3085                         $sed -e 's/[A-Za-z]$//'`
3086                 else
3087                         osvers="$2.$3"
3088                 fi
3089         fi
3090
3091         $test -f /sys/posix.dll &&
3092                 $test -f /usr/bin/what &&
3093                 set X `/usr/bin/what /sys/posix.dll` &&
3094                 $test "$3" = UWIN &&
3095                 osname=uwin &&
3096                 osvers="$5"
3097
3098         if $test -f $uname; then
3099                 set X $myuname
3100                 shift
3101
3102                 case "$5" in
3103                 fps*) osname=fps ;;
3104                 mips*)
3105                         case "$4" in
3106                         umips) osname=umips ;;
3107                         *) osname=mips ;;
3108                         esac;;
3109                 [23]100) osname=mips ;;
3110                 next*) osname=next ;;
3111                 i386*)
3112                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3113                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3114                                 osname='sco'
3115                                 osvers=$tmp
3116                         elif $test -f /etc/kconfig; then
3117                                 osname=isc
3118                                 if test "$lns" = "$ln -s"; then
3119                                         osvers=4
3120                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3121                                         osvers=3
3122                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3123                                         osvers=2
3124                                 fi
3125                         fi
3126                         tmp=''
3127                         ;;
3128                 pc*)
3129                         if test -n "$DJGPP"; then
3130                                 osname=dos
3131                                 osvers=djgpp
3132                         fi
3133                         ;;
3134                 esac
3135
3136                 case "$1" in
3137                 aix) osname=aix
3138                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3139                         case "$tmp" in
3140                         # oslevel can fail with:
3141                         # oslevel: Unable to acquire lock.
3142                         *not\ found) osvers="$4"."$3" ;;
3143                         '<3240'|'<>3240') osvers=3.2.0 ;;
3144                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3145                         '=3250'|'>3250') osvers=3.2.5 ;;
3146                         *) osvers=$tmp;;
3147                         esac
3148                         ;;
3149                 bsd386) osname=bsd386
3150                         osvers=`$uname -r`
3151                         ;;
3152                 cygwin*) osname=cygwin
3153                         osvers="$3"
3154                         ;;
3155                 *dc.osx) osname=dcosx
3156                         osvers="$3"
3157                         ;;
3158                 dnix) osname=dnix
3159                         osvers="$3"
3160                         ;;
3161                 domainos) osname=apollo
3162                         osvers="$3"
3163                         ;;
3164                 dgux)   osname=dgux
3165                         osvers="$3"
3166                         ;;
3167                 dragonfly) osname=dragonfly
3168                         osvers="$3"
3169                         ;;
3170                 dynixptx*) osname=dynixptx
3171                         osvers=`echo "$4"|sed 's/^v//'`
3172                         ;;
3173                 freebsd) osname=freebsd
3174                         osvers="$3" ;;
3175                 genix)  osname=genix ;;
3176                 gnu)    osname=gnu
3177                         osvers="$3" ;;
3178                 hp*)    osname=hpux
3179                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3180                         ;;
3181                 irix*)  osname=irix
3182                         case "$3" in
3183                         4*) osvers=4 ;;
3184                         5*) osvers=5 ;;
3185                         *)      osvers="$3" ;;
3186                         esac
3187                         ;;
3188                 linux)  osname=linux
3189                         case "$3" in
3190                         *)      osvers="$3" ;;
3191                         esac
3192                         ;;
3193                 MiNT)   osname=mint
3194                         ;;
3195                 netbsd*) osname=netbsd
3196                         osvers="$3"
3197                         ;;
3198                 news-os) osvers="$3"
3199                         case "$3" in
3200                         4*) osname=newsos4 ;;
3201                         *) osname=newsos ;;
3202                         esac
3203                         ;;
3204                 next*) osname=next ;;
3205                 nonstop-ux) osname=nonstopux ;;
3206                 openbsd) osname=openbsd
3207                         osvers="$3"
3208                         ;;
3209                 os2)    osname=os2
3210                         osvers="$4"
3211                         ;;
3212                 POSIX-BC | posix-bc ) osname=posix-bc
3213                         osvers="$3"
3214                         ;;
3215                 powerux | power_ux | powermax_os | powermaxos | \
3216                 powerunix | power_unix) osname=powerux
3217                         osvers="$3"
3218                         ;;
3219                 qnx) osname=qnx
3220                         osvers="$4"
3221                         ;;
3222                 solaris) osname=solaris
3223                         case "$3" in
3224                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3225                         *)      osvers="$3" ;;
3226                         esac
3227                         ;;
3228                 sunos) osname=sunos
3229                         case "$3" in
3230                         5*) osname=solaris
3231                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3232                         *)      osvers="$3" ;;
3233                         esac
3234                         ;;
3235                 titanos) osname=titanos
3236                         case "$3" in
3237                         1*) osvers=1 ;;
3238                         2*) osvers=2 ;;
3239                         3*) osvers=3 ;;
3240                         4*) osvers=4 ;;
3241                         *)      osvers="$3" ;;
3242                         esac
3243                         ;;
3244                 ultrix) osname=ultrix
3245                         osvers="$3"
3246                         ;;
3247                 osf1|mls+)      case "$5" in
3248                                 alpha)
3249                                         osname=dec_osf
3250                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3251                                         case "$osvers" in
3252                                         [1-9].[0-9]*) ;;
3253                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3254                                         esac
3255                                         ;;
3256                         hp*)    osname=hp_osf1  ;;
3257                         mips)   osname=mips_osf1 ;;
3258                         esac
3259                         ;;
3260                 # UnixWare 7.1.2 is known as Open UNIX 8
3261                 openunix|unixware) osname=svr5
3262                         osvers="$4"
3263                         ;;
3264                 uts)    osname=uts
3265                         osvers="$3"
3266                         ;;
3267                 vos) osvers="$3"
3268                         ;;
3269                 $2) case "$osname" in
3270                         *isc*) ;;
3271                         *freebsd*) ;;
3272                         svr*)
3273                                 : svr4.x or possibly later
3274                                 case "svr$3" in
3275                                 ${osname}*)
3276                                         osname=svr$3
3277                                         osvers=$4
3278                                         ;;
3279                                 esac
3280                                 case "$osname" in
3281                                 svr4.0)
3282                                         : Check for ESIX
3283                                         if test -f /stand/boot ; then
3284                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3285                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3286                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3287                                                         if test -n "$isesix"; then
3288                                                                 osname=esix4
3289                                                         fi
3290                                                 fi
3291                                         fi
3292                                         ;;
3293                                 esac
3294                                 ;;
3295                         *)      if test -f /etc/systemid; then
3296                                         osname=sco
3297                                         set `echo $3 | $sed 's/\./ /g'` $4
3298                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3299                                                 osvers=$1.$2.$3
3300                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3301                                                 osvers=$1.$2
3302                                         elif $test -f $src/hints/sco_$1.sh; then
3303                                                 osvers=$1
3304                                         fi
3305                                 else
3306                                         case "$osname" in
3307                                         '') : Still unknown.  Probably a generic Sys V.
3308                                                 osname="sysv"
3309                                                 osvers="$3"
3310                                                 ;;
3311                                         esac
3312                                 fi
3313                                 ;;
3314                         esac
3315                         ;;
3316                 *)      case "$osname" in
3317                         '') : Still unknown.  Probably a generic BSD.
3318                                 osname="$1"
3319                                 osvers="$3"
3320                                 ;;
3321                         esac
3322                         ;;
3323                 esac
3324         else
3325                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3326                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3327                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3328                                 osname=news_os
3329                         fi
3330                         $rm -f UU/kernel.what
3331                 elif test -d c:/. -o -n "$is_os2" ; then
3332                         set X $myuname
3333                         osname=os2
3334                         osvers="$5"
3335                 fi
3336         fi
3337
3338         case "$targetarch" in
3339         '') ;;
3340         *)  hostarch=$osname
3341             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3342             osvers=''
3343             ;;
3344         esac
3345
3346         : Now look for a hint file osname_osvers, unless one has been
3347         : specified already.
3348         case "$hintfile" in
3349         ''|' ')
3350                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3351                 : Also try without trailing minor version numbers.
3352                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3353                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3354                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3355                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3356                 case "$file" in
3357                 '') dflt=none ;;
3358                 *)  case "$osvers" in
3359                         '') dflt=$file
3360                                 ;;
3361                         *)  if $test -f $src/hints/$file.sh ; then
3362                                         dflt=$file
3363                                 elif $test -f $src/hints/$xfile.sh ; then
3364                                         dflt=$xfile
3365                                 elif $test -f $src/hints/$xxfile.sh ; then
3366                                         dflt=$xxfile
3367                                 elif $test -f $src/hints/$xxxfile.sh ; then
3368                                         dflt=$xxxfile
3369                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3370                                         dflt=$xxxxfile
3371                                 elif $test -f "$src/hints/${osname}.sh" ; then
3372                                         dflt="${osname}"
3373                                 else
3374                                         dflt=none
3375                                 fi
3376                                 ;;
3377                         esac
3378                         ;;
3379                 esac
3380                 if $test -f Policy.sh ; then
3381                         case "$dflt" in
3382                         *Policy*) ;;
3383                         none) dflt="Policy" ;;
3384                         *) dflt="Policy $dflt" ;;
3385                         esac
3386                 fi
3387                 ;;
3388         *)
3389                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3390                 ;;
3391         esac
3392
3393         if $test -f Policy.sh ; then
3394                 $cat <<EOM
3395
3396 There's also a Policy hint file available, which should make the
3397 site-specific (policy) questions easier to answer.
3398 EOM
3399
3400         fi
3401
3402         $cat <<EOM
3403
3404 You may give one or more space-separated answers, or "none" if appropriate.
3405 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3406 previous run of Configure, you may specify it as well as or instead of
3407 OS-specific hints.  If hints are provided for your OS, you should use them:
3408 although Perl can probably be built without hints on many platforms, using
3409 hints often improve performance and may enable features that Configure can't
3410 set up on its own. If there are no hints that match your OS, specify "none";
3411 DO NOT give a wrong version or a wrong OS.
3412
3413 EOM
3414
3415         rp="Which of these apply, if any?"
3416         . UU/myread
3417         tans=$ans
3418         for file in $tans; do
3419                 if $test X$file = XPolicy -a -f Policy.sh; then
3420                         . Policy.sh
3421                         $cat Policy.sh >> UU/config.sh
3422                 elif $test -f $src/hints/$file.sh; then
3423                         . $src/hints/$file.sh
3424                         $cat $src/hints/$file.sh >> UU/config.sh
3425                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3426                         : nothing
3427                 else
3428                         : Give one chance to correct a possible typo.
3429                         echo "$file.sh does not exist"
3430                         dflt=$file
3431                         rp="hint to use instead?"
3432                         . UU/myread
3433                         for file in $ans; do
3434                                 if $test -f "$src/hints/$file.sh"; then
3435                                         . $src/hints/$file.sh
3436                                         $cat $src/hints/$file.sh >> UU/config.sh
3437                                 elif $test X$ans = X -o X$ans = Xnone ; then
3438                                         : nothing
3439                                 else
3440                                         echo "$file.sh does not exist -- ignored."
3441                                 fi
3442                         done
3443                 fi
3444         done
3445
3446         hint=recommended
3447         : Remember our hint file for later.
3448         if $test -f "$src/hints/$file.sh" ; then
3449                 hintfile="$file"
3450         else
3451                 hintfile=''
3452         fi
3453 fi
3454 cd UU
3455 ;;
3456 *)
3457         echo " "
3458         echo "Fetching default answers from $config_sh..." >&4
3459         tmp_n="$n"
3460         tmp_c="$c"
3461         cd ..
3462         cp $config_sh config.sh 2>/dev/null
3463         chmod +w config.sh
3464         . ./config.sh
3465         cd UU
3466         cp ../config.sh .
3467         n="$tmp_n"
3468         c="$tmp_c"
3469         hint=previous
3470         ;;
3471 esac
3472 test "$override" && . ./optdef.sh
3473
3474 : Restore computed paths
3475 for file in $loclist $trylist; do
3476         eval $file="\$_$file"
3477 done
3478
3479 cat << EOM
3480
3481 Configure uses the operating system name and version to set some defaults.
3482 The default value is probably right if the name rings a bell. Otherwise,
3483 since spelling matters for me, either accept the default or answer "none"
3484 to leave it blank.
3485
3486 EOM
3487 case "$osname" in
3488         ''|' ')
3489                 case "$hintfile" in
3490                 ''|' '|none) dflt=none ;;
3491                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3492                 esac
3493                 ;;
3494         *) dflt="$osname" ;;
3495 esac
3496 rp="Operating system name?"
3497 . ./myread
3498 case "$ans" in
3499 none)  osname='' ;;
3500 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3501 esac
3502 echo " "
3503 case "$osvers" in
3504         ''|' ')
3505                 case "$hintfile" in
3506                 ''|' '|none) dflt=none ;;
3507                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3508                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3509                         case "$dflt" in
3510                         ''|' ') dflt=none ;;
3511                         esac
3512                         ;;
3513                 esac
3514                 ;;
3515         *) dflt="$osvers" ;;
3516 esac
3517 rp="Operating system version?"
3518 . ./myread
3519 case "$ans" in
3520 none)  osvers='' ;;
3521 *) osvers="$ans" ;;
3522 esac
3523
3524
3525 . ./posthint.sh
3526
3527 : who configured the system
3528 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3529 case "$cf_by" in
3530 "")
3531         cf_by=`(logname) 2>/dev/null`
3532         case "$cf_by" in
3533         "")
3534                 cf_by=`(whoami) 2>/dev/null`
3535                 case "$cf_by" in
3536                 "") cf_by=unknown ;;
3537                 esac ;;
3538         esac ;;
3539 esac
3540
3541 : decide how portable to be.  Allow command line overrides.
3542 case "$d_portable" in
3543 "$undef") ;;
3544 *)      d_portable="$define" ;;
3545 esac
3546
3547 : set up shell script to do ~ expansion
3548 cat >filexp <<EOSS
3549 $startsh
3550 : expand filename
3551 case "\$1" in
3552  ~/*|~)
3553         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3554         ;;
3555  ~*)
3556         if $test -f /bin/csh; then
3557                 /bin/csh -f -c "glob \$1"
3558                 failed=\$?
3559                 echo ""
3560                 exit \$failed
3561         else
3562                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3563                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3564                 if $test ! -d "\$dir"; then
3565                         me=\`basename \$0\`
3566                         echo "\$me: can't locate home directory for: \$name" >&2
3567                         exit 1
3568                 fi
3569                 case "\$1" in
3570                 */*)
3571                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3572                         ;;
3573                 *)
3574                         echo \$dir
3575                         ;;
3576                 esac
3577         fi
3578         ;;
3579 *)
3580         echo \$1
3581         ;;
3582 esac
3583 EOSS
3584 chmod +x filexp
3585 $eunicefix filexp
3586
3587 : now set up to get a file name
3588 cat <<EOS >getfile
3589 $startsh
3590 EOS
3591 cat <<'EOSC' >>getfile
3592 tilde=''
3593 fullpath=''
3594 already=''
3595 skip=''
3596 none_ok=''
3597 exp_file=''
3598 nopath_ok=''
3599 orig_rp="$rp"
3600 orig_dflt="$dflt"
3601 case "$gfpth" in
3602 '') gfpth='.' ;;
3603 esac
3604
3605 case "$fn" in
3606 *\(*)
3607         : getfile will accept an answer from the comma-separated list
3608         : enclosed in parentheses even if it does not meet other criteria.
3609         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3610         fn=`echo $fn | sed 's/(.*)//'`
3611         ;;
3612 esac
3613
3614 case "$fn" in
3615 *:*)
3616         loc_file=`expr $fn : '.*:\(.*\)'`
3617         fn=`expr $fn : '\(.*\):.*'`
3618         ;;
3619 esac
3620
3621 case "$fn" in
3622 *~*) tilde=true;;
3623 esac
3624 case "$fn" in
3625 */*) fullpath=true;;
3626 esac
3627 case "$fn" in
3628 *+*) skip=true;;
3629 esac
3630 case "$fn" in
3631 *n*) none_ok=true;;
3632 esac
3633 case "$fn" in
3634 *e*) exp_file=true;;
3635 esac
3636 case "$fn" in
3637 *p*) nopath_ok=true;;
3638 esac
3639
3640 case "$fn" in
3641 *f*) type='File';;
3642 *d*) type='Directory';;
3643 *l*) type='Locate';;
3644 esac
3645
3646 what="$type"
3647 case "$what" in
3648 Locate) what='File';;
3649 esac
3650
3651 case "$exp_file" in
3652 '')
3653         case "$d_portable" in
3654         "$define") ;;
3655         *) exp_file=true;;
3656         esac
3657         ;;
3658 esac
3659
3660 cd ..
3661 while test "$type"; do
3662         redo=''
3663         rp="$orig_rp"
3664         dflt="$orig_dflt"
3665         case "$tilde" in
3666         true) rp="$rp (~name ok)";;
3667         esac
3668         . UU/myread
3669         if test -f UU/getfile.ok && \
3670                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3671         then
3672                 value="$ans"
3673                 ansexp="$ans"
3674                 break
3675         fi
3676         case "$ans" in
3677         none)
3678                 value=''
3679                 ansexp=''
3680                 case "$none_ok" in
3681                 true) type='';;
3682                 esac
3683                 ;;
3684         *)
3685                 case "$tilde" in
3686                 '') value="$ans"
3687                         ansexp="$ans";;
3688                 *)
3689                         value=`UU/filexp $ans`
3690                         case $? in
3691                         0)
3692                                 if test "$ans" != "$value"; then
3693                                         echo "(That expands to $value on this system.)"
3694                                 fi
3695                                 ;;
3696                         *) value="$ans";;
3697                         esac
3698                         ansexp="$value"
3699                         case "$exp_file" in
3700                         '') value="$ans";;
3701                         esac
3702                         ;;
3703                 esac
3704                 case "$fullpath" in
3705                 true)
3706                         case "$ansexp" in
3707                         /*) value="$ansexp" ;;
3708                         [a-zA-Z]:/*) value="$ansexp" ;;
3709                         *)
3710                                 redo=true
3711                                 case "$already" in
3712                                 true)
3713                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3714                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3715                                         ;;
3716                                 *)
3717                                 echo "Please give a full path name, starting with slash." >&4
3718                                         case "$tilde" in
3719                                         true)
3720                                 echo "Note that using ~name is ok provided it expands well." >&4
3721                                                 already=true
3722                                                 ;;
3723                                         esac
3724                                 esac
3725                                 ;;
3726                         esac
3727                         ;;
3728                 esac
3729                 case "$redo" in
3730                 '')
3731                         case "$type" in
3732                         File)
3733                                 for fp in $gfpth; do
3734                                         if test "X$fp" = X.; then
3735                                             pf="$ansexp"
3736                                         else    
3737                                             pf="$fp/$ansexp"
3738                                         fi
3739                                         if test -f "$pf"; then
3740                                                 type=''
3741                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3742                                         then
3743                                                 echo "($value is not a plain file, but that's ok.)"
3744                                                 type=''
3745                                         fi
3746                                         if test X"$type" = X; then
3747                                             value="$pf"
3748                                             break
3749                                         fi
3750                                 done
3751                                 ;;
3752                         Directory)
3753                                 for fp in $gfpth; do
3754                                         if test "X$fp" = X.; then
3755                                             dir="$ans"
3756                                             direxp="$ansexp"
3757                                         else    
3758                                             dir="$fp/$ansexp"
3759                                             direxp="$fp/$ansexp"
3760                                         fi
3761                                         if test -d "$direxp"; then
3762                                                 type=''
3763                                                 value="$dir"
3764                                                 break
3765                                         fi
3766                                 done
3767                                 ;;
3768                         Locate)
3769                                 if test -d "$ansexp"; then
3770                                         echo "(Looking for $loc_file in directory $value.)"
3771                                         value="$value/$loc_file"
3772                                         ansexp="$ansexp/$loc_file"
3773                                 fi
3774                                 if test -f "$ansexp"; then
3775                                         type=''
3776                                 fi
3777                                 case "$nopath_ok" in
3778                                 true)   case "$value" in
3779                                         */*) ;;
3780                                         *)      echo "Assuming $value will be in people's path."
3781                                                 type=''
3782                                                 ;;
3783                                         esac
3784                                         ;;
3785                                 esac
3786                                 ;;
3787                         esac
3788
3789                         case "$skip" in
3790                         true) type='';
3791                         esac
3792
3793                         case "$type" in
3794                         '') ;;
3795                         *)
3796                                 if test "$fastread" = yes; then
3797                                         dflt=y
3798                                 else
3799                                         dflt=n
3800                                 fi
3801                                 rp="$what $value doesn't exist.  Use that name anyway?"
3802                                 . UU/myread
3803                                 dflt=''
3804                                 case "$ans" in
3805                                 y*) type='';;
3806                                 *) echo " ";;
3807                                 esac
3808                                 ;;
3809                         esac
3810                         ;;
3811                 esac
3812                 ;;
3813         esac
3814 done
3815 cd UU
3816 ans="$value"
3817 rp="$orig_rp"
3818 dflt="$orig_dflt"
3819 rm -f getfile.ok
3820 test "X$gfpthkeep" != Xy && gfpth=""
3821 EOSC
3822
3823 : determine root of directory hierarchy where package will be installed.
3824 case "$prefix" in
3825 '')
3826         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3827         ;;
3828 *?/)
3829         dflt=`echo "$prefix" | sed 's/.$//'`
3830         ;;
3831 *)
3832         dflt="$prefix"
3833         ;;
3834 esac
3835 $cat <<EOM
3836
3837 By default, $package will be installed in $dflt/bin, manual pages
3838 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3839 installation directories. Typically this is something like /usr/local.
3840 If you wish to have binaries under /usr/bin but other parts of the
3841 installation under /usr/local, that's ok: you will be prompted
3842 separately for each of the installation directories, the prefix being
3843 only used to set the defaults.
3844
3845 EOM
3846 fn=d~
3847 rp='Installation prefix to use?'
3848 . ./getfile
3849 oldprefix=''
3850 case "$prefix" in
3851 '') ;;
3852 *)
3853         case "$ans" in
3854         "$prefix") ;;
3855         *) oldprefix="$prefix";;
3856         esac
3857         ;;
3858 esac
3859 prefix="$ans"
3860 prefixexp="$ansexp"
3861
3862 case "$afsroot" in
3863 '')     afsroot=/afs ;;
3864 *)      afsroot=$afsroot ;;
3865 esac
3866
3867 : is AFS running?
3868 echo " "
3869 case "$afs" in
3870 $define|true)   afs=true ;;
3871 $undef|false)   afs=false ;;
3872 *)      if test -d $afsroot; then
3873                 afs=true
3874         else
3875                 afs=false
3876         fi
3877         ;;
3878 esac
3879 if $afs; then
3880         echo "AFS may be running... I'll be extra cautious then..." >&4
3881 else
3882         echo "AFS does not seem to be running..." >&4
3883 fi
3884
3885 : determine installation prefix for where package is to be installed.
3886 if $afs; then 
3887 $cat <<EOM
3888
3889 Since you are running AFS, I need to distinguish the directory in which
3890 files will reside from the directory in which they are installed (and from
3891 which they are presumably copied to the former directory by occult means).
3892
3893 EOM
3894         case "$installprefix" in
3895         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3896         *) dflt="$installprefix";;
3897         esac
3898 else
3899 $cat <<EOM
3900
3901 In some special cases, particularly when building $package for distribution,
3902 it is convenient to distinguish the directory in which files should be
3903 installed from the directory ($prefix) in which they will
3904 eventually reside.  For most users, these two directories are the same.
3905
3906 EOM
3907         case "$installprefix" in
3908         '') dflt=$prefix ;;
3909         *) dflt=$installprefix;;
3910         esac
3911 fi
3912 fn=d~
3913 rp='What installation prefix should I use for installing files?'
3914 . ./getfile
3915 installprefix="$ans"
3916 installprefixexp="$ansexp"
3917
3918 : Perform the prefixexp/installprefixexp correction if necessary
3919 cat <<EOS >installprefix
3920 $startsh
3921 EOS
3922 cat <<'EOSC' >>installprefix
3923 : Change installation prefix, if necessary.
3924 if $test X"$prefix" != X"$installprefix"; then
3925     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3926 else
3927     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3928 fi
3929 EOSC
3930 chmod +x installprefix
3931 $eunicefix installprefix
3932
3933 : Set variables such as privlib and privlibexp from the output of ./getfile
3934 : performing the prefixexp/installprefixexp correction if necessary.
3935 cat <<EOS >setprefixvar
3936 $startsh
3937 EOS
3938 cat <<'EOSC' >>setprefixvar
3939 eval "${prefixvar}=\"\$ans\""
3940 eval "${prefixvar}exp=\"\$ansexp\""
3941 . ./installprefix
3942 EOSC
3943 chmod +x setprefixvar
3944 $eunicefix setprefixvar
3945
3946 : set up the script used to warn in case of inconsistency
3947 cat <<EOS >whoa
3948 $startsh
3949 EOS
3950 cat <<'EOSC' >>whoa
3951 dflt=y
3952 case "$hint" in
3953     recommended)
3954         case "$hintfile" in
3955         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3956                 ;;
3957         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3958                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3959                 ;;
3960         esac
3961         ;;
3962     *)  echo " "
3963         echo "*** WHOA THERE!!! ***" >&4
3964         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3965         ;;
3966 esac
3967 rp="    Keep the $hint value?"
3968 . ./myread
3969 case "$ans" in
3970 y) td=$was; tu=$was;;
3971 esac
3972 EOSC
3973
3974 : function used to set $1 to $val
3975 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3976 case "$val$was" in
3977 $define$undef) . ./whoa; eval "$var=\$td";;
3978 $undef$define) . ./whoa; eval "$var=\$tu";;
3979 *) eval "$var=$val";;
3980 esac'
3981
3982 case "$usesocks" in
3983 $define|true|[yY]*)     dflt='y';;
3984 *) dflt='n';;
3985 esac
3986 cat <<EOM
3987
3988 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3989 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3990 to use the PerlIO abstraction layer, this will be implicitly selected.
3991
3992 If this doesn't make any sense to you, just accept the default '$dflt'.
3993 EOM
3994 rp='Build Perl for SOCKS?'
3995 . ./myread
3996 case "$ans" in
3997 y|Y)    val="$define" ;;     
3998 *)      val="$undef" ;;
3999 esac
4000 set usesocks
4001 eval $setvar
4002
4003 case "$usesocks" in
4004 $define|true|[yY]*) useperlio="$define";;
4005 esac
4006
4007 case "$useperlio" in
4008 $define|true|[yY]*|'')  dflt='y';;
4009 *) dflt='n';;
4010 esac
4011 cat <<EOM
4012
4013 Previous version of $package used the standard IO mechanisms as
4014 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4015 alternate IO mechanisms via the PerlIO abstraction layer, but the
4016 stdio mechanism is still available if needed.  The abstraction layer
4017 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4018 Using PerlIO with sfio may cause problems with some extension modules.
4019
4020 If this doesn't make any sense to you, just accept the default '$dflt'.
4021 EOM
4022 rp='Use the PerlIO abstraction layer?'
4023 . ./myread
4024 case "$ans" in
4025 y|Y) 
4026         val="$define"
4027         ;;
4028 *)      
4029         echo "Ok, doing things the stdio way."
4030         val="$undef"
4031         ;;
4032 esac
4033 set useperlio
4034 eval $setvar 
4035
4036 case "$usesocks" in
4037 $define|true|[yY]*)
4038         case "$useperlio" in
4039         $define|true|[yY]*) ;;
4040         *)      cat >&4 <<EOM
4041
4042 You are using the SOCKS proxy protocol library which means that you
4043 should also use the PerlIO layer.  You may be headed for trouble.
4044
4045 EOM
4046                 ;;
4047         esac
4048         ;;
4049 esac
4050
4051         
4052 case "$usethreads" in
4053 $define|true|[yY]*)     dflt='y';;
4054 *)     # Catch case where user specified ithreads or 5005threads but
4055        # forgot -Dusethreads (A.D. 4/2002)
4056        case "$useithreads$use5005threads" in
4057        *$define*)      
4058                 case "$useperlio" in
4059                 "$define")      dflt='y' ;;
4060                 *)              dflt='n' ;;
4061                 esac
4062                 ;;
4063        *)       dflt='n';;
4064        esac
4065        ;;
4066 esac
4067 cat <<EOM
4068
4069 Perl can be built to take advantage of threads on some systems.
4070 To do so, Configure can be run with -Dusethreads.
4071
4072 Note that Perl built with threading support runs slightly slower
4073 and uses more memory than plain Perl. The current implementation
4074 is believed to be stable, but it is fairly new, and so should be
4075 treated with caution.
4076
4077 If this doesn't make any sense to you, just accept the default '$dflt'.
4078 EOM
4079 rp='Build a threading Perl?'
4080 . ./myread
4081 case "$ans" in
4082 y|Y)    val="$define" ;;
4083 *)      val="$undef" ;;
4084 esac
4085 set usethreads
4086 eval $setvar
4087
4088 case "$usethreads" in
4089 $define)
4090         $cat <<EOM
4091
4092 Since release 5.6, Perl has had two different threading implementations,
4093 the newer interpreter-based version (ithreads) with one interpreter per
4094 thread, and the older 5.005 version (5005threads).
4095 The 5005threads version is effectively unmaintained and will probably be
4096 removed in Perl 5.10, so there should be no need to build a Perl using it
4097 unless needed for backwards compatibility with some existing 5.005threads
4098 code.
4099
4100 EOM
4101         : Default to ithreads unless overridden on command line or with
4102         : old config.sh
4103         dflt='y'
4104         case "$use5005threads" in
4105                 $define|true|[yY]*) dflt='n';;
4106         esac
4107         case "$useithreads" in
4108                 $undef|false|[nN]*) dflt='n';;
4109         esac
4110         rp='Use the newer interpreter-based ithreads?'
4111         . ./myread
4112         case "$ans" in
4113         y|Y)    val="$define" ;;
4114         *)      val="$undef" ;;
4115         esac
4116         set useithreads
4117         eval $setvar
4118         : Now set use5005threads to the opposite value.
4119         case "$useithreads" in
4120         $define) val="$undef" ;;
4121         *) val="$define" ;;
4122         esac
4123         set use5005threads
4124         eval $setvar
4125         ;;
4126 *)
4127         useithreads="$undef"
4128         use5005threads="$undef"
4129         ;;
4130 esac
4131
4132 case "$useithreads$use5005threads" in
4133 "$define$define")
4134         $cat >&4 <<EOM
4135
4136 You cannot have both the ithreads and the 5.005 threads enabled
4137 at the same time.  Disabling the 5.005 threads since they are
4138 much less stable than the ithreads.
4139
4140 EOM
4141         use5005threads="$undef"
4142         ;;
4143 esac
4144
4145 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4146         cat >&4 <<EOF
4147 ***
4148 *** To build with ithreads you must also use the PerlIO layer.
4149 *** Cannot continue, aborting.
4150 ***
4151 EOF
4152         exit 1
4153 fi
4154
4155 case "$d_oldpthreads" in
4156 '')     : Configure tests would be welcome here.  For now, assume undef.
4157         val="$undef" ;;
4158 *)      val="$d_oldpthreads" ;;
4159 esac
4160 set d_oldpthreads
4161 eval $setvar
4162
4163
4164 : Look for a hint-file generated 'call-back-unit'.  If the
4165 : user has specified that a threading perl is to be built,
4166 : we may need to set or change some other defaults.
4167 if $test -f usethreads.cbu; then
4168     echo "Your platform has some specific hints regarding threaded builds, using them..."
4169     . ./usethreads.cbu
4170 else
4171     case "$usethreads" in
4172         "$define"|true|[yY]*)
4173                 $cat <<EOM
4174 (Your platform does not have any specific hints for threaded builds.
4175  Assuming POSIX threads, then.)
4176 EOM
4177         ;;
4178     esac
4179 fi
4180
4181 cat <<EOM
4182
4183 Perl can be built so that multiple Perl interpreters can coexist
4184 within the same Perl executable.
4185 EOM
4186
4187 case "$useithreads" in
4188 $define)
4189         cat <<EOM
4190 This multiple interpreter support is required for interpreter-based threads.
4191 EOM
4192         val="$define"
4193         ;;
4194 *)      case "$usemultiplicity" in
4195         $define|true|[yY]*)     dflt='y';;
4196         *) dflt='n';;
4197         esac
4198         echo " "
4199         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4200         rp='Build Perl for multiplicity?'
4201         . ./myread
4202         case "$ans" in
4203         y|Y)    val="$define" ;;
4204         *)      val="$undef" ;;
4205         esac
4206         ;;
4207 esac
4208 set usemultiplicity
4209 eval $setvar
4210
4211
4212 case "$usemorebits" in
4213 "$define"|true|[yY]*)
4214         use64bitint="$define"
4215         uselongdouble="$define"
4216         usemorebits="$define"
4217         ;;
4218 *)      usemorebits="$undef"
4219         ;;
4220 esac
4221
4222 : make some quick guesses about what we are up against
4223 echo " "
4224 $echo $n "Hmm...  $c"
4225 echo exit 1 >bsd
4226 echo exit 1 >usg
4227 echo exit 1 >v7
4228 echo exit 1 >osf1
4229 echo exit 1 >eunice
4230 echo exit 1 >xenix
4231 echo exit 1 >venix
4232 echo exit 1 >os2
4233 d_bsd="$undef"
4234 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4235 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4236 then
4237         echo "Looks kind of like an OSF/1 system, but we'll see..."
4238         echo exit 0 >osf1
4239 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4240         xxx=`./loc addbib blurfl $pth`
4241         if $test -f $xxx; then
4242         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4243                 echo exit 0 >bsd
4244                 echo exit 0 >usg
4245         else
4246                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4247                         echo "Looks kind of like an extended USG system, but we'll see..."
4248                 else
4249                         echo "Looks kind of like a USG system, but we'll see..."
4250                 fi
4251                 echo exit 0 >usg
4252         fi
4253 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4254         echo "Looks kind of like a BSD system, but we'll see..."
4255         d_bsd="$define"
4256         echo exit 0 >bsd
4257 else
4258         echo "Looks kind of like a Version 7 system, but we'll see..."
4259         echo exit 0 >v7
4260 fi
4261 case "$eunicefix" in
4262 *unixtovms*)
4263         $cat <<'EOI'
4264 There is, however, a strange, musty smell in the air that reminds me of
4265 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4266 EOI
4267         echo exit 0 >eunice
4268         d_eunice="$define"
4269 : it so happens the Eunice I know will not run shell scripts in Unix format
4270         ;;
4271 *)
4272         echo " "
4273         echo "Congratulations.  You aren't running Eunice."
4274         d_eunice="$undef"
4275         ;;
4276 esac
4277 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4278 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4279 : semicolon as a patch separator
4280 case "$p_" in
4281 :) ;;
4282 *)
4283         $cat <<'EOI'
4284 I have the feeling something is not exactly right, however...don't tell me...
4285 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4286 (Or you may be running DOS with DJGPP.)
4287 EOI
4288         echo exit 0 >os2
4289         ;;
4290 esac
4291 if test -f /xenix; then
4292         echo "Actually, this looks more like a XENIX system..."
4293         echo exit 0 >xenix
4294         d_xenix="$define"
4295 else
4296         echo " "
4297         echo "It's not Xenix..."
4298         d_xenix="$undef"
4299 fi
4300 chmod +x xenix
4301 $eunicefix xenix
4302 if test -f /venix; then
4303         echo "Actually, this looks more like a VENIX system..."
4304         echo exit 0 >venix
4305 else
4306         echo " "
4307         if ./xenix; then
4308                 : null
4309         else
4310                 echo "Nor is it Venix..."
4311         fi
4312 fi
4313 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4314 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4315 $rm -f foo
4316
4317 case "$cc" in
4318 '') dflt=cc;;
4319 *) dflt="$cc";;
4320 esac
4321 rp="Use which C compiler?"
4322 . ./myread
4323 cc="$ans"
4324
4325 : See if they have not cc but they do have gcc
4326 . ./trygcc
4327 : Look for a hint-file generated 'call-back-unit'.  Now that the
4328 : user has specified the compiler, we may need to set or change some
4329 : other defaults.
4330 if $test -f cc.cbu; then
4331     . ./cc.cbu
4332 fi
4333 . ./checkcc
4334
4335 echo " "
4336 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4337 $cat >try.c <<EOM
4338 #include <stdio.h>
4339 int main() {
4340 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4341 #ifdef __VERSION__
4342         printf("%s\n", __VERSION__);
4343 #else
4344         printf("%s\n", "1");
4345 #endif
4346 #endif
4347         return(0);
4348 }
4349 EOM
4350 if $cc -o try $ccflags $ldflags try.c; then
4351         gccversion=`$run ./try`
4352         case "$gccversion" in
4353         '') echo "You are not using GNU cc." ;;
4354         *)  echo "You are using GNU cc $gccversion."
4355             ccname=gcc
4356             ;;
4357         esac
4358 else
4359         echo " "
4360         echo "*** WHOA THERE!!! ***" >&4
4361         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4362         case "$knowitall" in
4363         '')
4364         echo "    You'd better start hunting for one and let me know about it." >&4
4365                 exit 1
4366                 ;;
4367         esac
4368 fi
4369 $rm -f try try.*
4370 case "$gccversion" in
4371 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4372 esac
4373 case "$gccversion" in
4374 '') gccosandvers='' ;;
4375 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4376    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4377    gccshortvers=''
4378    case "$gccosandvers" in
4379    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4380    $osname$osvers) ;; # looking good
4381    $osname*) cat <<EOM >&4
4382
4383 *** WHOA THERE!!! ***
4384
4385     Your gcc has not been compiled for the exact release of
4386     your operating system ($gccosandvers versus $osname$osvers).
4387
4388     In general it is a good idea to keep gcc synchronized with
4389     the operating system because otherwise serious problems
4390     may ensue when trying to compile software, like Perl.
4391
4392     I'm trying to be optimistic here, though, and will continue.
4393     If later during the configuration and build icky compilation
4394     problems appear (headerfile conflicts being the most common
4395     manifestation), I suggest reinstalling the gcc to match
4396     your operating system release.
4397
4398 EOM
4399       ;;
4400    *) gccosandvers='' ;; # failed to parse, better be silent
4401    esac
4402    ;;
4403 esac
4404 case "$ccname" in
4405 '') ccname="$cc" ;;
4406 esac
4407
4408 # gcc 3.* complain about adding -Idirectories that they already know about,
4409 # so we will take those off from locincpth.
4410 case "$gccversion" in
4411 3*)
4412     echo "main(){}">try.c
4413     for incdir in $locincpth; do
4414        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4415              grep '^c[cp]p*[01]: warning: changing search order '`
4416        if test "X$warn" != X; then
4417            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4418        fi
4419     done
4420     $rm -f try try.*
4421 esac
4422
4423 : What should the include directory be ?
4424 echo " "
4425 $echo $n "Hmm...  $c"
4426 dflt='/usr/include'
4427 incpath=''
4428 mips_type=''
4429 if $test -f /bin/mips && /bin/mips; then
4430         echo "Looks like a MIPS system..."
4431         $cat >usr.c <<'EOCP'
4432 #ifdef SYSTYPE_BSD43
4433 /bsd43
4434 #endif
4435 EOCP
4436         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4437                 dflt='/bsd43/usr/include'
4438                 incpath='/bsd43'
4439                 mips_type='BSD 4.3'
4440         else
4441                 mips_type='System V'
4442         fi
4443         $rm -f usr.c usr.out
4444         echo "and you're compiling with the $mips_type compiler and libraries."
4445         xxx_prompt=y
4446         echo "exit 0" >mips
4447 else
4448         echo "Doesn't look like a MIPS system."
4449         xxx_prompt=n
4450         echo "exit 1" >mips
4451 fi
4452 chmod +x mips
4453 $eunicefix mips
4454 case "$usrinc" in
4455 '') ;;
4456 *) dflt="$usrinc";;
4457 esac
4458 case "$xxx_prompt" in
4459 y)      fn=d/
4460         echo " "
4461         rp='Where are the include files you want to use?'
4462         . ./getfile
4463         usrinc="$ans"
4464         ;;
4465 *)      usrinc="$dflt"
4466         ;;
4467 esac
4468
4469 : see how we invoke the C preprocessor
4470 echo " "
4471 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4472 cat <<'EOT' >testcpp.c
4473 #define ABC abc
4474 #define XYZ xyz
4475 ABC.XYZ
4476 EOT
4477 cd ..
4478 if test ! -f cppstdin; then
4479         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4480                 # AIX cc -E doesn't show the absolute headerfile
4481                 # locations but we'll cheat by using the -M flag.
4482                 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
4483         else
4484                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4485         fi
4486 else
4487         echo "Keeping your $hint cppstdin wrapper."
4488 fi
4489 chmod 755 cppstdin
4490 wrapper=`pwd`/cppstdin
4491 ok='false'
4492 cd UU
4493
4494 if $test "X$cppstdin" != "X" && \
4495         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4496         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4497 then
4498         echo "You used to use $cppstdin $cppminus so we'll use that again."
4499         case "$cpprun" in
4500         '') echo "But let's see if we can live without a wrapper..." ;;
4501         *)
4502                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4503                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4504                 then
4505                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4506                         ok='true'
4507                 else
4508                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4509                 fi
4510                 ;;
4511         esac
4512 else
4513         case "$cppstdin" in
4514         '') ;;
4515         *)
4516                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4517                 ;;
4518         esac
4519 fi
4520
4521 if $ok; then
4522         : nothing
4523 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4524         $cc -E <testcpp.c >testcpp.out 2>&1; \
4525         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4526         echo "Yup, it does."
4527         x_cpp="$cc -E"
4528         x_minus='';
4529 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4530         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4531         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4532         echo "Yup, it does."
4533         x_cpp="$cc -E"
4534         x_minus='-';
4535 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4536         $cc -P <testcpp.c >testcpp.out 2>&1; \
4537         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4538         echo "Yipee, that works!"
4539         x_cpp="$cc -P"
4540         x_minus='';
4541 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4542         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4543         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4544         echo "At long last!"
4545         x_cpp="$cc -P"
4546         x_minus='-';
4547 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4548         $cpp <testcpp.c >testcpp.out 2>&1; \
4549         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4550         echo "It works!"
4551         x_cpp="$cpp"
4552         x_minus='';
4553 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4554         $cpp - <testcpp.c >testcpp.out 2>&1; \
4555         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4556         echo "Hooray, it works!  I was beginning to wonder."
4557         x_cpp="$cpp"
4558         x_minus='-';
4559 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4560         $wrapper <testcpp.c >testcpp.out 2>&1; \
4561         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4562         x_cpp="$wrapper"
4563         x_minus=''
4564         echo "Eureka!"
4565 else
4566         dflt=''
4567         rp="No dice.  I can't find a C preprocessor.  Name one:"
4568         . ./myread
4569         x_cpp="$ans"
4570         x_minus=''
4571         $x_cpp <testcpp.c >testcpp.out 2>&1
4572         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4573                 echo "OK, that will do." >&4
4574         else
4575 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4576                 exit 1
4577         fi
4578 fi
4579
4580 case "$ok" in
4581 false)
4582         cppstdin="$x_cpp"
4583         cppminus="$x_minus"
4584         cpprun="$x_cpp"
4585         cpplast="$x_minus"
4586         set X $x_cpp
4587         shift
4588         case "$1" in
4589         "$cpp")
4590                 echo "Perhaps can we force $cc -E using a wrapper..."
4591                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4592                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4593                 then
4594                         echo "Yup, we can."
4595                         cppstdin="$wrapper"
4596                         cppminus='';
4597                 else
4598                         echo "Nope, we'll have to live without it..."
4599                 fi
4600                 ;;
4601         esac
4602         case "$cpprun" in
4603         "$wrapper")
4604                 cpprun=''
4605                 cpplast=''
4606                 ;;
4607         esac
4608         ;;
4609 esac
4610
4611 case "$cppstdin" in
4612 "$wrapper"|'cppstdin') ;;
4613 *) $rm -f $wrapper;;
4614 esac
4615 $rm -f testcpp.c testcpp.out
4616
4617 : Set private lib path
4618 case "$plibpth" in
4619 '') if ./mips; then
4620                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4621         fi;;
4622 esac
4623 case "$libpth" in
4624 ' ') dlist='';;
4625 '') dlist="$loclibpth $plibpth $glibpth";;
4626 *) dlist="$libpth";;
4627 esac
4628
4629 : Now check and see which directories actually exist, avoiding duplicates
4630 libpth=''
4631 for xxx in $dlist
4632 do
4633     if $test -d $xxx; then
4634                 case " $libpth " in
4635                 *" $xxx "*) ;;
4636                 *) libpth="$libpth $xxx";;
4637                 esac
4638     fi
4639 done
4640 $cat <<'EOM'
4641
4642 Some systems have incompatible or broken versions of libraries.  Among
4643 the directories listed in the question below, please remove any you
4644 know not to be holding relevant libraries, and add any that are needed.
4645 Say "none" for none.
4646
4647 EOM
4648 case "$libpth" in
4649 '') dflt='none';;
4650 *)
4651         set X $libpth
4652         shift
4653         dflt=${1+"$@"}
4654         ;;
4655 esac
4656 rp="Directories to use for library searches?"
4657 . ./myread
4658 case "$ans" in
4659 none) libpth=' ';;
4660 *) libpth="$ans";;
4661 esac
4662
4663 : compute shared library extension
4664 case "$so" in
4665 '')
4666         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4667                 dflt='sl'
4668         else
4669                 dflt='so'
4670         fi
4671         ;;
4672 *) dflt="$so";;
4673 esac
4674 $cat <<EOM
4675
4676 On some systems, shared libraries may be available.  Answer 'none' if
4677 you want to suppress searching of shared libraries for the remainder
4678 of this configuration.
4679
4680 EOM
4681 rp='What is the file extension used for shared libraries?'
4682 . ./myread
4683 so="$ans"
4684
4685 : Define several unixisms.
4686 : Hints files or command line option can be used to override them.
4687 : The convoluted testing is in case hints files set either the old
4688 : or the new name.
4689 case "$_exe" in
4690 '')     case "$exe_ext" in
4691         '')     ;;
4692         *)      _exe="$exe_ext" ;;
4693         esac
4694         ;;
4695 esac
4696 case "$_a" in
4697 '')     case "$lib_ext" in
4698     '') _a='.a';;
4699         *)      _a="$lib_ext" ;;
4700         esac
4701         ;;
4702 esac
4703 case "$_o" in
4704 '') case "$obj_ext" in
4705         '')     _o='.o';;
4706         *)      _o="$obj_ext";;
4707         esac
4708         ;;
4709 esac
4710 case "$p_" in
4711 '') case "$path_sep" in
4712         '')     p_=':';;
4713         *)      p_="$path_sep";;
4714         esac
4715         ;;
4716 esac
4717 exe_ext=$_exe
4718 lib_ext=$_a
4719 obj_ext=$_o
4720 path_sep=$p_
4721
4722 : Which makefile gets called first.  This is used by make depend.
4723 case "$firstmakefile" in
4724 '') firstmakefile='makefile';;
4725 esac
4726
4727 case "$ccflags" in
4728 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4729 esac
4730
4731 case "$uselongdouble" in
4732 $define|true|[yY]*)     dflt='y';;
4733 *) dflt='n';;
4734 esac
4735 cat <<EOM
4736
4737 Perl can be built to take advantage of long doubles which
4738 (if available) may give more accuracy and range for floating point numbers.
4739
4740 If this doesn't make any sense to you, just accept the default '$dflt'.
4741 EOM
4742 rp='Try to use long doubles if available?'
4743 . ./myread
4744 case "$ans" in
4745 y|Y)    val="$define"   ;;
4746 *)      val="$undef"    ;;
4747 esac
4748 set uselongdouble
4749 eval $setvar
4750
4751 case "$uselongdouble" in
4752 true|[yY]*) uselongdouble="$define" ;;
4753 esac
4754
4755 : Look for a hint-file generated 'call-back-unit'.  If the
4756 : user has specified that long doubles should be used,
4757 : we may need to set or change some other defaults.
4758 if $test -f uselongdouble.cbu; then
4759     echo "Your platform has some specific hints regarding long doubles, using them..."
4760     . ./uselongdouble.cbu
4761 else
4762     case "$uselongdouble" in
4763         $define)
4764                 $cat <<EOM
4765 (Your platform does not have any specific hints for long doubles.)
4766 EOM
4767         ;;
4768     esac
4769 fi
4770
4771 : Looking for optional libraries
4772 echo " "
4773 echo "Checking for optional libraries..." >&4
4774 case "$libs" in
4775 ' '|'') dflt='';;
4776 *) dflt="$libs";;
4777 esac
4778 case "$libswanted" in
4779 '') libswanted='c_s';;
4780 esac
4781 case "$usesocks" in
4782 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4783 esac
4784 libsfound=''
4785 libsfiles=''
4786 libsdirs=''
4787 libspath=''
4788 for thisdir in $libpth $xlibpth; do
4789   test -d $thisdir && libspath="$libspath $thisdir"
4790 done
4791 for thislib in $libswanted; do
4792         for thisdir in $libspath; do
4793             xxx=''
4794             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4795                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4796                 $test -f "$xxx" && eval $libscheck
4797                 $test -f "$xxx" && libstyle=shared
4798             fi
4799             if test ! -f "$xxx"; then
4800                 xxx=$thisdir/lib$thislib.$so
4801                 $test -f "$xxx" && eval $libscheck
4802                 $test -f "$xxx" && libstyle=shared
4803             fi  
4804             if test ! -f "$xxx"; then
4805                 xxx=$thisdir/lib$thislib$_a
4806                 $test -f "$xxx" && eval $libscheck
4807                 $test -f "$xxx" && libstyle=static
4808             fi
4809             if test ! -f "$xxx"; then
4810                 xxx=$thisdir/$thislib$_a
4811                 $test -f "$xxx" && eval $libscheck
4812                 $test -f "$xxx" && libstyle=static
4813             fi
4814             if test ! -f "$xxx"; then
4815                 xxx=$thisdir/lib${thislib}_s$_a
4816                 $test -f "$xxx" && eval $libscheck
4817                 $test -f "$xxx" && libstyle=static
4818                 $test -f "$xxx" && thislib=${thislib}_s
4819             fi
4820             if test ! -f "$xxx"; then
4821                 xxx=$thisdir/Slib$thislib$_a
4822                 $test -f "$xxx" && eval $libscheck
4823                 $test -f "$xxx" && libstyle=static
4824             fi
4825             if $test -f "$xxx"; then
4826                 case "$libstyle" in
4827                 shared) echo "Found -l$thislib (shared)." ;;
4828                 static) echo "Found -l$thislib." ;;
4829                 *)      echo "Found -l$thislib ($libstyle)." ;;
4830                 esac
4831                 case " $dflt " in
4832                 *"-l$thislib "*);;
4833                 *) dflt="$dflt -l$thislib"
4834                    libsfound="$libsfound $xxx"
4835                    yyy=`basename $xxx`
4836                    libsfiles="$libsfiles $yyy"
4837                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4838                    case " $libsdirs " in
4839                    *" $yyy "*) ;;
4840                    *) libsdirs="$libsdirs $yyy" ;;
4841                    esac
4842                    ;;
4843                 esac
4844                 break
4845             fi  
4846         done
4847         if $test ! -f "$xxx"; then
4848             echo "No -l$thislib."
4849         fi
4850 done
4851 set X $dflt
4852 shift
4853 dflt="$*"
4854 case "$libs" in
4855 '') dflt="$dflt";;
4856 *) dflt="$libs";;
4857 esac
4858 case "$dflt" in
4859 ' '|'') dflt='none';;
4860 esac
4861
4862 $cat <<EOM
4863
4864 In order to compile $package on your machine, a number of libraries
4865 are usually needed.  Include any other special libraries here as well.
4866 Say "none" for none.  The default list is almost always right.
4867 EOM
4868
4869 echo " "
4870 rp="What libraries to use?"
4871 . ./myread
4872 case "$ans" in
4873 none) libs=' ';;
4874 *) libs="$ans";;
4875 esac
4876
4877 : determine optimization, if desired, or use for debug flag also
4878 case "$optimize" in
4879 ' '|$undef) dflt='none';;
4880 '') dflt='-O';;
4881 *) dflt="$optimize";;
4882 esac
4883 $cat <<EOH
4884
4885 By default, $package compiles with the -O flag to use the optimizer.
4886 Alternately, you might want to use the symbolic debugger, which uses
4887 the -g flag (on traditional Unix systems).  Either flag can be
4888 specified here.  To use neither flag, specify the word "none".
4889
4890 EOH
4891 rp="What optimizer/debugger flag should be used?"
4892 . ./myread
4893 optimize="$ans"
4894 case "$optimize" in
4895 'none') optimize=" ";;
4896 esac
4897
4898 : Check what DEBUGGING is required from the command line
4899 : -DEBUGGING      or -DDEBUGGING or
4900 : -DEBUGGING=both                       = -g + -DDEBUGGING
4901 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4902 : -DEBUGGING=none or -UDEBUGGING        =
4903 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4904 case "$EBUGGING" in
4905 '')     ;;
4906 *)      DEBUGGING=$EBUGGING ;;
4907 esac
4908
4909 case "$DEBUGGING" in
4910 -g|$define)
4911     case "$optimize" in
4912         *-g*) ;;
4913         *)    optimize="$optimize -g" ;;
4914     esac ;;
4915 none|$undef)
4916     case "$optimize" in
4917         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4918                 shift
4919                 optimize="$*"
4920                 ;;
4921     esac ;;
4922 esac
4923
4924 dflt=''
4925 case "$DEBUGGING" in
4926 both|$define) dflt='-DDEBUGGING'
4927 esac
4928
4929 : We will not override a previous value, but we might want to
4930 : augment a hint file
4931 case "$hint" in
4932 default|recommended)
4933         case "$gccversion" in
4934         1*) dflt="$dflt -fpcc-struct-return" ;;
4935         esac
4936         case "$optimize:$DEBUGGING" in
4937         *-g*:old) dflt="$dflt -DDEBUGGING";;
4938         esac
4939         case "$gccversion" in
4940         2*) if test -d /etc/conf/kconfig.d &&
4941                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4942                 then
4943                         # Interactive Systems (ISC) POSIX mode.
4944                         dflt="$dflt -posix"
4945                 fi
4946                 ;;
4947         esac
4948         case "$gccversion" in
4949         1*) ;;
4950         2.[0-8]*) ;;
4951         ?*)     echo " "
4952                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4953                 echo 'int main(void) { return 0; }' > gcctest.c
4954                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4955                         echo "Yes, it does." 2>&1
4956                         case "$ccflags" in
4957                         *strict-aliasing*)
4958                                 echo "Leaving current flags $ccflags alone." 2>&1
4959                                 ;;
4960                         *) dflt="$dflt -fno-strict-aliasing" ;;
4961                         esac
4962                 else
4963                         echo "Nope, it doesn't, but that's ok." 2>&1
4964                 fi
4965                 ;;
4966         esac
4967         # For gcc, adding -pipe speeds up compilations for some, but apparently
4968         # some assemblers can't read from stdin.  (It also slows down compilations
4969         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4970         case "$gccversion" in
4971         ?*)     echo " "
4972                 echo "Checking if your compiler accepts -pipe" 2>&1
4973                 echo 'int main(void) { return 0; }' > gcctest.c
4974                 if $cc -pipe -o gcctest gcctest.c; then
4975                         echo "Yes, it does." 2>&1
4976                         case "$ccflags" in
4977                         *-pipe*)
4978                                 echo "Leaving current flags $ccflags alone." 2>&1
4979                                 ;;
4980                         *) dflt="$dflt -pipe" ;;
4981                         esac
4982                 else
4983                         echo "Nope, it doesn't, but that's ok." 2>&1
4984                 fi
4985                 ;;
4986         esac
4987         ;;
4988 esac
4989
4990 case "$mips_type" in
4991 *BSD*|'') inclwanted="$locincpth $usrinc";;
4992 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4993 esac
4994 for thisincl in $inclwanted; do
4995         if $test -d $thisincl; then
4996                 if $test x$thisincl != x$usrinc; then
4997                         case "$dflt" in
4998                         *" -I$thisincl "*);;
4999                         *) dflt="$dflt -I$thisincl ";;
5000                         esac
5001                 fi
5002         fi
5003 done
5004
5005 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5006         xxx=true;
5007 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5008         xxx=true;
5009 else
5010         xxx=false;
5011 fi;
5012 if $xxx; then
5013         case "$dflt" in
5014         *$2*);;
5015         *) dflt="$dflt -D$2";;
5016         esac;
5017 fi'
5018
5019 set signal.h LANGUAGE_C; eval $inctest
5020
5021 case "$usesocks" in
5022 $define)
5023         ccflags="$ccflags -DSOCKS"
5024         ;;
5025 esac
5026
5027 case "$hint" in
5028 default|recommended) dflt="$ccflags $dflt" ;;
5029 *) dflt="$ccflags";;
5030 esac
5031
5032 case "$dflt" in
5033 ''|' ') dflt=none;;
5034 esac
5035
5036 $cat <<EOH
5037
5038 Your C compiler may want other flags.  For this question you should include
5039 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5040 but you should NOT include libraries or ld flags like -lwhatever.  If you
5041 want $package to honor its debug switch, you should include -DDEBUGGING here.
5042 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5043
5044 To use no flags, specify the word "none".
5045
5046 EOH
5047 set X $dflt
5048 shift
5049 dflt=${1+"$@"}
5050 rp="Any additional cc flags?"
5051 . ./myread
5052 case "$ans" in
5053 none) ccflags='';;
5054 *) ccflags="$ans";;
5055 esac
5056
5057 : the following weeds options from ccflags that are of no interest to cpp
5058 case "$cppflags" in
5059 '') cppflags="$ccflags" ;;
5060 *)  cppflags="$cppflags $ccflags" ;;
5061 esac
5062 case "$gccversion" in
5063 1*) cppflags="$cppflags -D__GNUC__"
5064 esac
5065 case "$mips_type" in
5066 '');;
5067 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5068 esac
5069 case "$cppflags" in
5070 '');;
5071 *)
5072         echo " "
5073         echo "Let me guess what the preprocessor flags are..." >&4
5074         set X $cppflags
5075         shift
5076         cppflags=''
5077         $cat >cpp.c <<'EOM'
5078 #define BLURFL foo
5079
5080 BLURFL xx LFRULB
5081 EOM
5082         previous=''
5083         for flag in $*
5084         do
5085                 case "$flag" in
5086                 -*) ftry="$flag";;
5087                 *) ftry="$previous $flag";;
5088                 esac
5089                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5090                         >cpp1.out 2>/dev/null && \
5091                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5092                         >cpp2.out 2>/dev/null && \
5093                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5094                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5095                 then
5096                         cppflags="$cppflags $ftry"
5097                         previous=''
5098                 else
5099                         previous="$flag"
5100                 fi
5101         done
5102         set X $cppflags
5103         shift
5104         cppflags=${1+"$@"}
5105         case "$cppflags" in
5106         *-*)  echo "They appear to be: $cppflags";;
5107         esac
5108         $rm -f cpp.c cpp?.out
5109         ;;
5110 esac
5111
5112 : flags used in final linking phase
5113 case "$ldflags" in
5114 '') if ./venix; then
5115                 dflt='-i -z'
5116         else
5117                 dflt=''
5118         fi
5119         case "$ccflags" in
5120         *-posix*) dflt="$dflt -posix" ;;
5121         esac
5122         ;;
5123 *) dflt="$ldflags";;
5124 esac
5125
5126 : Try to guess additional flags to pick up local libraries.
5127 for thislibdir in $libpth; do
5128         case " $loclibpth " in
5129         *" $thislibdir "*)
5130                 case "$dflt " in
5131                 *"-L$thislibdir "*) ;;
5132                 *)  dflt="$dflt -L$thislibdir" ;;
5133                 esac
5134                 ;;
5135         esac
5136 done
5137
5138 case "$dflt" in
5139 '') dflt='none' ;;
5140 esac
5141
5142 $cat <<EOH
5143
5144 Your C linker may need flags.  For this question you should
5145 include -L/whatever and any other flags used by the C linker, but you
5146 should NOT include libraries like -lwhatever.
5147
5148 Make sure you include the appropriate -L/path flags if your C linker
5149 does not normally search all of the directories you specified above,
5150 namely
5151         $libpth
5152 To use no flags, specify the word "none".
5153
5154 EOH
5155
5156 rp="Any additional ld flags (NOT including libraries)?"
5157 . ./myread
5158 case "$ans" in
5159 none) ldflags='';;
5160 *) ldflags="$ans";;
5161 esac
5162 rmlist="$rmlist pdp11"
5163
5164 : coherency check
5165 echo " "
5166 echo "Checking your choice of C compiler and flags for coherency..." >&4
5167 $cat > try.c <<'EOF'
5168 #include <stdio.h>
5169 int main() { printf("Ok\n"); return(0); }
5170 EOF
5171 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5172 shift
5173 $cat >try.msg <<'EOM'
5174 I've tried to compile and run the following simple program:
5175
5176 EOM
5177 $cat try.c >> try.msg
5178
5179 $cat >> try.msg <<EOM
5180
5181 I used the command:
5182
5183         $*
5184         $run ./try
5185
5186 and I got the following output:
5187
5188 EOM
5189 dflt=y
5190 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5191         if $sh -c "$run ./try" >>try.msg 2>&1; then
5192                 xxx=`$run ./try`
5193                 case "$xxx" in
5194                 "Ok") dflt=n ;;
5195                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5196                         case " $libs " in
5197                         *" -lsfio "*)
5198                                 cat >> try.msg <<'EOQS'
5199 If $libs contains -lsfio, and sfio is mis-configured, then it
5200 sometimes (apparently) runs and exits with a 0 status, but with no
5201 output!  It may have to do with sfio's use of _exit vs. exit.
5202
5203 EOQS
5204                                 rp="You have a big problem.  Shall I abort Configure"
5205                                 dflt=y
5206                                 ;;
5207                         esac
5208                         ;;
5209                 esac
5210         else
5211                 echo "The program compiled OK, but exited with status $?." >>try.msg
5212                 rp="You have a problem.  Shall I abort Configure"
5213                 dflt=y
5214         fi
5215 else
5216         echo "I can't compile the test program." >>try.msg
5217         rp="You have a BIG problem.  Shall I abort Configure"
5218         dflt=y
5219 fi
5220 case "$dflt" in
5221 y)
5222         $cat try.msg >&4
5223         case "$knowitall" in
5224         '')
5225                 echo "(The supplied flags or libraries might be incorrect.)"
5226                 ;;
5227         *) dflt=n;;
5228         esac
5229         echo " "
5230         . ./myread
5231         case "$ans" in
5232         n*|N*) ;;
5233         *)      echo "Ok.  Stopping Configure." >&4
5234                 exit 1
5235                 ;;
5236         esac
5237         ;;
5238 n) echo "OK, that should do.";;
5239 esac
5240 $rm -f try try.* core
5241
5242 : define a shorthand compile call
5243 compile='
5244 mc_file=$1;
5245 shift;
5246 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5247 : define a shorthand compile call for compilations that should be ok.
5248 compile_ok='
5249 mc_file=$1;
5250 shift;
5251 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5252
5253 : determine filename position in cpp output
5254 echo " "
5255 echo "Computing filename position in cpp output for #include directives..." >&4
5256 case "$osname" in
5257 vos) testaccess=-e ;;
5258 *)   testaccess=-r ;;
5259 esac
5260 echo '#include <stdio.h>' > foo.c
5261 $cat >fieldn <<EOF
5262 $startsh
5263 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5264 $grep '^[       ]*#.*stdio\.h' | \
5265 while read cline; do
5266         pos=1
5267         set \$cline
5268         while $test \$# -gt 0; do
5269                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5270                         echo "\$pos"
5271                         exit 0
5272                 fi
5273                 shift
5274                 pos=\`expr \$pos + 1\`
5275         done
5276 done
5277 EOF
5278 chmod +x fieldn
5279 fieldn=`./fieldn`
5280 $rm -f foo.c fieldn
5281 case $fieldn in
5282 '') pos='???';;
5283 1) pos=first;;
5284 2) pos=second;;
5285 3) pos=third;;
5286 *) pos="${fieldn}th";;
5287 esac
5288 echo "Your cpp writes the filename in the $pos field of the line."
5289
5290 case "$osname" in
5291 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5292 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5293 *)   cppfilter='' ;;
5294 esac
5295 : locate header file
5296 $cat >findhdr <<EOF
5297 $startsh
5298 wanted=\$1
5299 name=''
5300 for usrincdir in $usrinc
5301 do
5302         if test -f \$usrincdir/\$wanted; then
5303                 echo "\$usrincdir/\$wanted"
5304                 exit 0
5305         fi
5306 done
5307 awkprg='{ print \$$fieldn }'
5308 echo "#include <\$wanted>" > foo\$\$.c
5309 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5310 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5311 while read cline; do
5312         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5313         case "\$name" in
5314         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5315         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5316         *) exit 2;;
5317         esac;
5318 done;
5319 #
5320 # status = 0: grep returned 0 lines, case statement not executed
5321 # status = 1: headerfile found
5322 # status = 2: while loop executed, no headerfile found
5323 #
5324 status=\$?
5325 $rm -f foo\$\$.c;
5326 if test \$status -eq 1; then
5327         exit 0;
5328 fi
5329 exit 1
5330 EOF
5331 chmod +x findhdr
5332
5333 : define an alternate in-header-list? function
5334 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5335 cont=true; xxf="echo \"<\$1> found.\" >&4";
5336 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5337 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5338 esac;
5339 case $# in 4) instead=instead;; *) instead="at last";; esac;
5340 while $test "$cont"; do
5341         xxx=`./findhdr $1`
5342         var=$2; eval "was=\$$2";
5343         if $test "$xxx" && $test -r "$xxx";
5344         then eval $xxf;
5345         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5346                 cont="";
5347         else eval $xxnf;
5348         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5349         set $yyy; shift; shift; yyy=$@;
5350         case $# in 0) cont="";;
5351         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5352                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5353         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5354                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5355         esac;
5356 done;
5357 while $test "$yyy";
5358 do set $yyy; var=$2; eval "was=\$$2";
5359         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5360         set $yyy; shift; shift; yyy=$@;
5361 done'
5362
5363 : see if stdlib is available
5364 set stdlib.h i_stdlib
5365 eval $inhdr
5366
5367 : check for lengths of integral types
5368 echo " "
5369 case "$intsize" in
5370 '')
5371         echo "Checking to see how big your integers are..." >&4
5372         $cat >try.c <<EOCP
5373 #include <stdio.h>
5374 #$i_stdlib I_STDLIB
5375 #ifdef I_STDLIB
5376 #include <stdlib.h>
5377 #endif
5378 int main()
5379 {
5380         printf("intsize=%d;\n", (int)sizeof(int));
5381         printf("longsize=%d;\n", (int)sizeof(long));
5382         printf("shortsize=%d;\n", (int)sizeof(short));
5383         exit(0);
5384 }
5385 EOCP
5386         set try
5387         if eval $compile_ok && $run ./try > /dev/null; then
5388                 eval `$run ./try`
5389                 echo "Your integers are $intsize bytes long."
5390                 echo "Your long integers are $longsize bytes long."
5391                 echo "Your short integers are $shortsize bytes long."
5392         else
5393                 $cat >&4 <<EOM
5394 !
5395 Help! I can't compile and run the intsize test program: please enlighten me!
5396 (This is probably a misconfiguration in your system or libraries, and
5397 you really ought to fix it.  Still, I'll try anyway.)
5398 !
5399 EOM
5400                 dflt=4
5401                 rp="What is the size of an integer (in bytes)?"
5402                 . ./myread
5403                 intsize="$ans"
5404                 dflt=$intsize
5405                 rp="What is the size of a long integer (in bytes)?"
5406                 . ./myread
5407                 longsize="$ans"
5408                 dflt=2
5409                 rp="What is the size of a short integer (in bytes)?"
5410                 . ./myread
5411                 shortsize="$ans"
5412         fi
5413         ;;
5414 esac
5415 $rm -f try try.*
5416
5417 : check for long long
5418 echo " "
5419 echo "Checking to see if you have long long..." >&4
5420 echo 'int main() { long long x = 7; return 0; }' > try.c
5421 set try
5422 if eval $compile; then
5423         val="$define"
5424         echo "You have long long."
5425 else
5426         val="$undef"
5427         echo "You do not have long long."
5428 fi
5429 $rm try.*
5430 set d_longlong
5431 eval $setvar
5432
5433 : check for length of long long
5434 case "${d_longlong}${longlongsize}" in
5435 $define)
5436         echo " "
5437         echo "Checking to see how big your long longs are..." >&4
5438         $cat >try.c <<'EOCP'
5439 #include <stdio.h>
5440 int main()
5441 {
5442     printf("%d\n", (int)sizeof(long long));
5443     return(0);
5444 }
5445 EOCP
5446         set try
5447         if eval $compile_ok; then
5448                 longlongsize=`$run ./try`
5449                 echo "Your long longs are $longlongsize bytes long."
5450         else
5451                 dflt='8'
5452                 echo " "
5453                 echo "(I can't seem to compile the test program.  Guessing...)"
5454                 rp="What is the size of a long long (in bytes)?"
5455                 . ./myread
5456                 longlongsize="$ans"
5457         fi
5458         if $test "X$longsize" = "X$longlongsize"; then
5459                 echo "(That isn't any different from an ordinary long.)"
5460         fi      
5461         ;;
5462 esac
5463 $rm -f try.* try
5464
5465 : see if inttypes.h is available
5466 : we want a real compile instead of Inhdr because some systems
5467 : have an inttypes.h which includes non-existent headers
5468 echo " "
5469 $cat >try.c <<EOCP
5470 #include <inttypes.h>
5471 int main() {
5472         static int32_t foo32 = 0x12345678;
5473 }
5474 EOCP
5475 set try
5476 if eval $compile; then
5477         echo "<inttypes.h> found." >&4
5478         val="$define"
5479 else
5480         echo "<inttypes.h> NOT found." >&4
5481         val="$undef"
5482 fi
5483 $rm -f try.c try
5484 set i_inttypes
5485 eval $setvar
5486
5487 : check for int64_t
5488 echo " "
5489 echo "Checking to see if you have int64_t..." >&4
5490 $cat >try.c <<EOCP
5491 #include <sys/types.h>
5492 #$i_inttypes I_INTTYPES
5493 #ifdef I_INTTYPES
5494 #include <inttypes.h>
5495 #endif
5496 int main() { int64_t x = 7; }
5497 EOCP
5498 set try
5499 if eval $compile; then
5500         val="$define"
5501         echo "You have int64_t."
5502 else
5503         val="$undef"
5504         echo "You do not have int64_t."
5505 fi
5506 $rm -f try try.*
5507 set d_int64_t
5508 eval $setvar
5509
5510
5511 echo " "
5512 echo "Checking which 64-bit integer type we could use..." >&4
5513
5514 case "$intsize" in
5515 8) val=int
5516    set quadtype
5517    eval $setvar
5518    val='"unsigned int"'
5519    set uquadtype
5520    eval $setvar
5521    quadkind=1
5522    ;;
5523 *) case "$longsize" in
5524    8) val=long
5525       set quadtype
5526       eval $setvar
5527       val='"unsigned long"'
5528       set uquadtype
5529       eval $setvar
5530       quadkind=2
5531       ;;
5532    *) case "$d_longlong:$longlongsize" in
5533       define:8)
5534         val='"long long"'
5535         set quadtype
5536         eval $setvar
5537         val='"unsigned long long"'
5538         set uquadtype
5539         eval $setvar
5540         quadkind=3
5541         ;;
5542       *) case "$d_int64_t" in
5543          define)
5544            val=int64_t
5545            set quadtype
5546            eval $setvar
5547            val=uint64_t
5548            set uquadtype
5549            eval $setvar
5550            quadkind=4
5551            ;;
5552          esac
5553          ;;
5554       esac
5555       ;;
5556    esac
5557    ;;
5558 esac
5559
5560 case "$quadtype" in
5561 '')     echo "Alas, no 64-bit integer types in sight." >&4
5562         d_quad="$undef"
5563         ;;
5564 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5565         d_quad="$define"
5566         ;;
5567 esac
5568
5569
5570 case "$uselonglong" in
5571 "$define"|true|[yY]*)
5572         cat <<EOM >&4
5573
5574 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5575 EOM
5576         use64bitint="$define"
5577         ;;
5578 esac                          
5579 case "$use64bits" in
5580 "$define"|true|[yY]*)
5581         cat <<EOM >&4
5582
5583 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5584 EOM
5585         use64bitint="$define"
5586         ;;
5587 esac                          
5588 case "$use64bitints" in
5589 "$define"|true|[yY]*)
5590         cat <<EOM >&4
5591
5592 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5593 EOM
5594         use64bitint="$define"
5595         ;;
5596 esac                          
5597 case "$use64bitsint" in
5598 "$define"|true|[yY]*)
5599         cat <<EOM >&4
5600
5601 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5602 EOM
5603         use64bitint="$define"
5604         ;;
5605 esac                          
5606 case "$uselonglongs" in
5607 "$define"|true|[yY]*)
5608         cat <<EOM >&4
5609
5610 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5611 EOM
5612         use64bitint="$define"
5613         ;;
5614 esac                          
5615 case "$use64bitsall" in
5616 "$define"|true|[yY]*)
5617         cat <<EOM >&4
5618
5619 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5620 EOM
5621         use64bitall="$define"
5622         ;;
5623 esac                          
5624
5625 case "$ccflags" in
5626 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5627 esac
5628 case "$use64bitall" in
5629 "$define"|true|[yY]*) use64bitint="$define" ;;
5630 esac
5631
5632 case "$longsize" in
5633 8) cat <<EOM
5634
5635 You have natively 64-bit long integers.
5636 EOM
5637    val="$define"
5638    ;;
5639 *) case "$use64bitint" in
5640    "$define"|true|[yY]*) dflt='y';;
5641    *) dflt='n';;
5642    esac
5643    case "$d_quad" in
5644    "$define") ;;
5645    *) dflt='n' ;;
5646    esac
5647    cat <<EOM
5648
5649 Perl can be built to take advantage of 64-bit integer types
5650 on some systems.  To do so, Configure can be run with -Duse64bitint.
5651 Choosing this option will most probably introduce binary incompatibilities.
5652
5653 If this doesn't make any sense to you, just accept the default '$dflt'.
5654 (The default has been chosen based on your configuration.)
5655 EOM
5656    rp='Try to use 64-bit integers, if available?'
5657    . ./myread
5658    case "$ans" in
5659    [yY]*) val="$define" ;;
5660    *)     val="$undef"  ;;
5661    esac
5662    ;;
5663 esac
5664 set use64bitint
5665 eval $setvar
5666
5667 case "$use64bitall" in
5668 "$define"|true|[yY]*) dflt='y' ;;
5669 *) case "$longsize" in
5670    8) dflt='y' ;;
5671    *) dflt='n' ;;
5672    esac
5673    ;;
5674 esac    
5675 cat <<EOM
5676
5677 You may also choose to try maximal 64-bitness.  It means using as much
5678 64-bitness as possible on the platform.  This in turn means even more
5679 binary incompatibilities.  On the other hand, your platform may not
5680 have any more 64-bitness available than what you already have chosen.
5681
5682 If this doesn't make any sense to you, just accept the default '$dflt'.
5683 (The default has been chosen based on your configuration.)
5684 EOM
5685 rp='Try to use maximal 64-bit support, if available?'
5686 . ./myread
5687 case "$ans" in
5688 [yY]*) val="$define" ;;
5689 *)     val="$undef"  ;;
5690 esac
5691 set use64bitall
5692 eval $setvar
5693 case "$use64bitall" in
5694 "$define")
5695         case "$use64bitint" in
5696         "$undef")
5697                 cat <<EOM
5698
5699 Since you have chosen a maximally 64-bit build, I'm also turning on
5700 the use of 64-bit integers.
5701 EOM
5702                 use64bitint="$define" ;;
5703         esac
5704         ;;
5705 esac
5706
5707 : Look for a hint-file generated 'call-back-unit'.  If the
5708 : user has specified that a 64-bit perl is to be built,
5709 : we may need to set or change some other defaults.
5710 if $test -f use64bitint.cbu; then
5711         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5712         . ./use64bitint.cbu
5713 fi
5714 case "$use64bitint" in
5715 "$define"|true|[yY]*)
5716         case "$longsize" in
5717         4) case "$archname64" in
5718            '') archname64=64int ;;
5719            esac
5720            ;;
5721         esac
5722         ;;
5723 esac
5724
5725 : Look for a hint-file generated 'call-back-unit'.  If the
5726 : user has specified that a maximally 64-bit perl is to be built,
5727 : we may need to set or change some other defaults.
5728 if $test -f use64bitall.cbu; then
5729         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5730         . ./use64bitall.cbu
5731 fi
5732 case "$use64bitall" in
5733 "$define"|true|[yY]*)
5734         case "$longsize" in
5735         4) case "$archname64" in
5736            ''|64int) archname64=64all ;;
5737            esac
5738            ;;
5739         esac
5740         ;;
5741 esac
5742
5743 case "$d_quad:$use64bitint" in
5744 $undef:$define)
5745         cat >&4 <<EOF
5746
5747 *** You have chosen to use 64-bit integers,
5748 *** but none can be found.
5749 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5750 *** Cannot continue, aborting.
5751
5752 EOF
5753         exit 1
5754         ;;
5755 esac
5756
5757 : check for length of double
5758 echo " "
5759 case "$doublesize" in
5760 '')
5761         echo "Checking to see how big your double precision numbers are..." >&4
5762         $cat >try.c <<EOCP
5763 #include <stdio.h>
5764 #$i_stdlib I_STDLIB
5765 #ifdef I_STDLIB
5766 #include <stdlib.h>
5767 #endif
5768 int main()
5769 {
5770     printf("%d\n", (int)sizeof(double));
5771     exit(0);
5772 }
5773 EOCP
5774         set try
5775         if eval $compile_ok; then
5776                 doublesize=`$run ./try`
5777                 echo "Your double is $doublesize bytes long."
5778         else
5779                 dflt='8'
5780                 echo "(I can't seem to compile the test program.  Guessing...)"
5781                 rp="What is the size of a double precision number (in bytes)?"
5782                 . ./myread
5783                 doublesize="$ans"
5784         fi
5785         ;;
5786 esac
5787 $rm -f try.c try
5788
5789 : check for long doubles
5790 echo " "
5791 echo "Checking to see if you have long double..." >&4
5792 echo 'int main() { long double x = 7.0; }' > try.c
5793 set try
5794 if eval $compile; then
5795         val="$define"
5796         echo "You have long double."
5797 else
5798         val="$undef"
5799         echo "You do not have long double."
5800 fi
5801 $rm try.*
5802 set d_longdbl
5803 eval $setvar
5804
5805 : check for length of long double
5806 case "${d_longdbl}${longdblsize}" in
5807 $define)
5808         echo " "
5809         echo "Checking to see how big your long doubles are..." >&4
5810         $cat >try.c <<'EOCP'
5811 #include <stdio.h>
5812 int main()
5813 {
5814         printf("%d\n", sizeof(long double));
5815 }
5816 EOCP
5817         set try
5818         set try
5819         if eval $compile; then
5820                 longdblsize=`$run ./try`
5821                 echo "Your long doubles are $longdblsize bytes long."
5822         else
5823                 dflt='8'
5824                 echo " "
5825                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5826                 rp="What is the size of a long double (in bytes)?"
5827                 . ./myread
5828                 longdblsize="$ans"
5829         fi
5830         if $test "X$doublesize" = "X$longdblsize"; then
5831                 echo "That isn't any different from an ordinary double."
5832                 echo "I'll keep your setting anyway, but you may see some"
5833                 echo "harmless compilation warnings."
5834         fi      
5835         ;;
5836 esac
5837 $rm -f try.* try
5838
5839 : determine the architecture name
5840 echo " "
5841 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5842         tarch=`arch`"-$osname"
5843 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5844         if uname -m > tmparch 2>&1 ; then
5845                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5846                         -e 's/$/'"-$osname/" tmparch`
5847         else
5848                 tarch="$osname"
5849         fi
5850         $rm -f tmparch
5851 else
5852         tarch="$osname"
5853 fi
5854 case "$myarchname" in
5855 ''|"$tarch") ;;
5856 *)
5857         echo "(Your architecture name used to be $myarchname.)"
5858         archname=''
5859         ;;
5860 esac
5861 case "$targetarch" in
5862 '') ;;
5863 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5864 esac
5865 myarchname="$tarch"
5866 case "$archname" in
5867 '') dflt="$tarch";;
5868 *) dflt="$archname";;
5869 esac
5870 rp='What is your architecture name'
5871 . ./myread
5872 archname="$ans"
5873 case "$usethreads" in
5874 $define)
5875         echo "Threads selected." >&4
5876         case "$archname" in
5877         *-thread*) echo "...and architecture name already has -thread." >&4
5878                 ;;
5879         *)      archname="$archname-thread"
5880                 echo "...setting architecture name to $archname." >&4
5881                 ;;
5882         esac
5883         ;;
5884 esac
5885 case "$usemultiplicity" in
5886 $define)
5887         echo "Multiplicity selected." >&4
5888         case "$archname" in
5889         *-multi*) echo "...and architecture name already has -multi." >&4
5890                 ;;
5891         *)      archname="$archname-multi"
5892                 echo "...setting architecture name to $archname." >&4
5893                 ;;
5894         esac
5895         ;;
5896 esac
5897 case "$use64bitint$use64bitall" in
5898 *"$define"*)
5899         case "$archname64" in
5900         '')
5901                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5902                 ;;
5903         *)
5904                 case "$use64bitint" in
5905                 "$define") echo "64 bit integers selected." >&4 ;;
5906                 esac
5907                 case "$use64bitall" in
5908                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5909                 esac
5910                 case "$archname" in
5911                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5912                         ;;
5913                 *)      archname="$archname-$archname64"
5914                         echo "...setting architecture name to $archname." >&4
5915                         ;;
5916                 esac
5917                 ;;
5918         esac
5919 esac
5920 case "$uselongdouble" in
5921 $define)
5922         echo "Long doubles selected." >&4
5923         case "$longdblsize" in
5924         $doublesize)
5925                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5926                 ;;
5927         *)
5928                 case "$archname" in
5929                 *-ld*) echo "...and architecture name already has -ld." >&4
5930                         ;;
5931                 *)      archname="$archname-ld"
5932                         echo "...setting architecture name to $archname." >&4
5933                         ;;
5934                 esac
5935                 ;;
5936         esac
5937         ;;
5938 esac
5939 case "$useperlio" in
5940 $define)
5941         echo "Perlio selected." >&4
5942         ;;
5943 *)
5944         echo "Perlio not selected, using stdio." >&4
5945         case "$archname" in
5946         *-stdio*) echo "...and architecture name already has -stdio." >&4
5947                 ;;
5948         *)      archname="$archname-stdio"
5949                 echo "...setting architecture name to $archname." >&4
5950                 ;;
5951         esac
5952         ;;
5953 esac
5954 if $test -f archname.cbu; then
5955         echo "Your platform has some specific hints for architecture name, using them..."
5956         . ./archname.cbu
5957 fi
5958
5959 : set the prefixit variable, to compute a suitable default value
5960 prefixit='case "$3" in
5961 ""|none)
5962         case "$oldprefix" in
5963         "") eval "$1=\"\$$2\"";;
5964         *)
5965                 case "$3" in
5966                 "") eval "$1=";;
5967                 none)
5968                         eval "tp=\"\$$2\"";
5969                         case "$tp" in
5970                         ""|" ") eval "$1=\"\$$2\"";;
5971                         *) eval "$1=";;
5972                         esac;;
5973                 esac;;
5974         esac;;
5975 *)
5976         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5977         case "$tp" in
5978         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5979         /*-$oldprefix/*|\~*-$oldprefix/*)
5980                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5981         *) eval "$1=\"\$$2\"";;
5982         esac;;
5983 esac'
5984
5985 : get the patchlevel
5986 echo " "
5987 echo "Getting the current patchlevel..." >&4
5988 if $test -r $rsrc/patchlevel.h;then
5989         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5990         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5991         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5992         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5993         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5994         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5995         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5996 else
5997         revision=0
5998         patchlevel=0
5999         subversion=0
6000         api_revision=0
6001         api_version=0
6002         api_subversion=0
6003         perl_patchlevel=0
6004         $echo "(You do not have patchlevel.h.  Eek.)"
6005 fi
6006 if $test -r $rsrc/.patch ; then
6007         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6008                 perl_patchlevel=`cat $rsrc/.patch`
6009         fi
6010 fi
6011 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6012 version_patchlevel_string="version $patchlevel subversion $subversion"
6013 case "$perl_patchlevel" in
6014 0|'') ;;
6015 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6016 esac
6017
6018 $echo "(You have $package $version_patchlevel_string.)"
6019
6020 case "$osname" in
6021 dos|vms)
6022         : XXX Should be a Configure test for double-dots in filenames.
6023         version=`echo $revision $patchlevel $subversion | \
6024                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6025         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6026                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6027         ;;
6028 *)
6029         version=`echo $revision $patchlevel $subversion | \
6030                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6031         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6032                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6033         ;;
6034 esac
6035 : Special case the 5.005_xx maintenance series, which used 5.005
6036 : without any subversion label as a subdirectory in $sitelib
6037 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6038         api_versionstring='5.005'
6039 fi
6040
6041 : determine installation style
6042 : For now, try to deduce it from prefix unless it is already set.
6043 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6044 case "$installstyle" in
6045 '')     case "$prefix" in
6046                 *perl*) dflt='lib';;
6047                 *) dflt='lib/perl5' ;;
6048         esac
6049         ;;
6050 *)      dflt="$installstyle" ;;
6051 esac
6052 : Probably not worth prompting for this since we prompt for all
6053 : the directories individually, and the prompt would be too long and
6054 : confusing anyway.
6055 installstyle=$dflt
6056
6057 : determine where public executables go
6058 echo " "
6059 set dflt bin bin
6060 eval $prefixit
6061 fn=d~
6062 rp='Pathname where the public executables will reside?'
6063 . ./getfile
6064 if $test "X$ansexp" != "X$binexp"; then
6065         installbin=''
6066 fi
6067 prefixvar=bin
6068 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6069 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6070 :     this via initialinstalllocation
6071 . ./setprefixvar
6072
6073 case "$userelocatableinc" in
6074 $define|true|[yY]*)     dflt='y' ;;
6075 *)                      dflt='n' ;;
6076 esac
6077 cat <<EOM
6078
6079 Would you like to build Perl so that the installation is relocatable, so that
6080 library paths in @INC are determined relative to the path of the perl binary?
6081 This is not advised for system Perl installs, or if you need to run setid
6082 scripts or scripts under taint mode.
6083
6084 If this doesn't make any sense to you, just accept the default '$dflt'.
6085 EOM
6086 rp='Use relocatable @INC?'
6087 . ./myread
6088 case "$ans" in
6089 y|Y)    val="$define" ;;
6090 *)      val="$undef"  ;;
6091 esac
6092 set userelocatableinc
6093 eval $setvar
6094
6095 initialinstalllocation="$binexp"
6096 : Default prefix is now "up one level from where the binaries are"
6097 case "$userelocatableinc" in
6098 $define|true|[yY]*)
6099     bin=".../"
6100     binexp=".../"
6101     prefix=".../.."
6102     prefixexp=".../.."
6103     installprefixexp=".../.."
6104     ;;
6105 esac
6106
6107 : determine where private library files go
6108 : Usual default is /usr/local/lib/perl5/$version.
6109 : Also allow things like /opt/perl/lib/$version, since
6110 : /opt/perl/lib/perl5... would be redundant.
6111 : The default "style" setting is made in installstyle.U
6112 case "$installstyle" in
6113 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6114 *)       set dflt privlib lib/$version ;;
6115 esac
6116 eval $prefixit
6117 $cat <<EOM
6118
6119 There are some auxiliary files for $package that need to be put into a
6120 private library directory that is accessible by everyone.
6121
6122 EOM
6123 fn=$binexp
6124 fn=d~+
6125 rp='Pathname where the private library files will reside?'
6126 . ./getfile
6127 prefixvar=privlib
6128 . ./setprefixvar
6129
6130 : set the prefixup variable, to restore leading tilda escape
6131 prefixup='case "$prefixexp" in
6132 "$prefix") ;;
6133 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6134 esac'
6135
6136 : determine where public architecture dependent libraries go
6137 set archlib archlib
6138 eval $prefixit
6139 : privlib default is /usr/local/lib/$package/$version
6140 : archlib default is /usr/local/lib/$package/$version/$archname
6141 : privlib may have an optional trailing /share.
6142 tdflt=`echo $privlib | $sed 's,/share$,,'`
6143 tdflt=$tdflt/$archname
6144 case "$archlib" in
6145 '')     dflt=$tdflt
6146         ;;
6147 *)      dflt="$archlib"
6148     ;;
6149 esac
6150 $cat <<EOM
6151
6152 $spackage contains architecture-dependent library files.  If you are
6153 sharing libraries in a heterogeneous environment, you might store
6154 these files in a separate location.  Otherwise, you can just include
6155 them with the rest of the public library files.
6156
6157 EOM
6158 fn=$binexp
6159 fn=d+~
6160 rp='Where do you want to put the public architecture-dependent libraries?'
6161 . ./getfile
6162 prefixvar=archlib
6163 . ./setprefixvar
6164 if $test X"$archlib" = X"$privlib"; then
6165         d_archlib="$undef"
6166 else
6167         d_archlib="$define"
6168 fi
6169
6170 : see if setuid scripts can be secure
6171 $cat <<EOM
6172
6173 Some kernels have a bug that prevents setuid #! scripts from being
6174 secure.  Some sites have disabled setuid #! scripts because of this.
6175
6176 First let's decide if your kernel supports secure setuid #! scripts.
6177 (If setuid #! scripts would be secure but have been disabled anyway,
6178 don't say that they are secure if asked.)
6179
6180 EOM
6181
6182 val="$undef"
6183 if $test -d /dev/fd; then
6184         echo "#!$ls" >reflect
6185         chmod +x,u+s reflect
6186         ./reflect >flect 2>&1
6187         if $contains "/dev/fd" flect >/dev/null; then
6188                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6189                 val="$define"
6190         else
6191                 $cat <<EOM
6192 If you are not sure if they are secure, I can check but I'll need a
6193 username and password different from the one you are using right now.
6194 If you don't have such a username or don't want me to test, simply
6195 enter 'none'.
6196
6197 EOM
6198                 rp='Other username to test security of setuid scripts with?'
6199                 dflt='none'
6200                 . ./myread
6201                 case "$ans" in
6202                 n|none)
6203                         case "$d_suidsafe" in
6204                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6205                                 dflt=n;;
6206                         "$undef")
6207                                 echo "Well, the $hint value is *not* secure." >&4
6208                                 dflt=n;;
6209                         *)      echo "Well, the $hint value *is* secure." >&4
6210                                 dflt=y;;
6211                         esac
6212                         ;;
6213                 *)
6214                         $rm -f reflect flect
6215                         echo "#!$ls" >reflect
6216                         chmod +x,u+s reflect
6217                         echo >flect
6218                         chmod a+w flect
6219                         echo '"su" will (probably) prompt you for '"$ans's password."
6220                         su $ans -c './reflect >flect'
6221                         if $contains "/dev/fd" flect >/dev/null; then
6222                                 echo "Okay, it looks like setuid scripts are secure." >&4
6223                                 dflt=y
6224                         else
6225                                 echo "I don't think setuid scripts are secure." >&4
6226                                 dflt=n
6227                         fi
6228                         ;;
6229                 esac
6230                 rp='Does your kernel have *secure* setuid scripts?'
6231                 . ./myread
6232                 case "$ans" in
6233                 [yY]*)  val="$define";;
6234                 *)      val="$undef";;
6235                 esac
6236         fi
6237 else
6238         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6239         echo "(That's for file descriptors, not floppy disks.)"
6240         val="$undef"
6241 fi
6242 set d_suidsafe
6243 eval $setvar
6244
6245 $rm -f reflect flect
6246
6247 : now see if they want to do setuid emulation
6248 echo " "
6249 val="$undef"
6250 case "$d_suidsafe" in
6251 "$define")
6252         val="$undef"
6253         echo "No need to emulate SUID scripts since they are secure here." >&4
6254         ;;
6255 *)
6256         $cat <<EOM
6257 Some systems have disabled setuid scripts, especially systems where
6258 setuid scripts cannot be secure.  On systems where setuid scripts have
6259 been disabled, the setuid/setgid bits on scripts are currently
6260 useless.  It is possible for $package to detect those bits and emulate
6261 setuid/setgid in a secure fashion.  This emulation will only work if
6262 setuid scripts have been disabled in your kernel.
6263
6264 EOM
6265         case "$d_dosuid" in
6266         "$define") dflt=y ;;
6267         *) dflt=n ;;
6268         esac
6269         rp="Do you want to do setuid/setgid emulation?"
6270         . ./myread
6271         case "$ans" in
6272         [yY]*)  val="$define";;
6273         *)      val="$undef";;
6274         esac
6275         ;;
6276 esac
6277 set d_dosuid
6278 eval $setvar
6279
6280 : Find perl5.005 or later.
6281 echo "Looking for a previously installed perl5.005 or later... "
6282 case "$perl5" in
6283 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6284                 : Check if this perl is recent and can load a simple module
6285                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6286                         perl5=$tdir/perl
6287                         break;
6288                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6289                         perl5=$tdir/perl5
6290                         break;
6291                 fi
6292         done
6293         ;;
6294 *)      perl5="$perl5"
6295         ;;
6296 esac
6297 case "$perl5" in
6298 '')     echo "None found.  That's ok.";;
6299 *)      echo "Using $perl5." ;;
6300 esac
6301
6302 $cat <<EOM
6303
6304 After $package is installed, you may wish to install various
6305 add-on modules and utilities.  Typically, these add-ons will
6306 be installed under $prefix with the rest
6307 of this package.  However, you may wish to install such add-ons
6308 elsewhere under a different prefix.
6309
6310 If you do not wish to put everything under a single prefix, that's
6311 ok.  You will be prompted for the individual locations; this siteprefix
6312 is only used to suggest the defaults.
6313
6314 The default should be fine for most people.
6315
6316 EOM
6317 fn=d~+
6318 rp='Installation prefix to use for add-on modules and utilities?'
6319 : XXX Here might be another good place for an installstyle setting.
6320 case "$siteprefix" in
6321 '') dflt=$prefix ;;
6322 *)  dflt=$siteprefix ;;
6323 esac
6324 . ./getfile
6325 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6326 oldsiteprefix=''
6327 case "$siteprefix" in
6328 '') ;;
6329 *)      case "$ans" in
6330         "$prefix") ;;
6331         *) oldsiteprefix="$prefix";;
6332         esac
6333         ;;
6334 esac
6335 siteprefix="$ans"
6336 siteprefixexp="$ansexp"
6337
6338 : determine where site specific libraries go.
6339 : Usual default is /usr/local/lib/perl5/site_perl/$version
6340 : The default "style" setting is made in installstyle.U
6341 : XXX No longer works with Prefixit stuff.
6342 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6343 case "$sitelib" in
6344 '') case "$installstyle" in
6345         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6346         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6347         esac
6348         ;;
6349 *)      dflt="$sitelib"
6350         ;;
6351 esac
6352 $cat <<EOM
6353
6354 The installation process will create a directory for
6355 site-specific extensions and modules.  Most users find it convenient
6356 to place all site-specific files in this directory rather than in the
6357 main distribution directory.
6358
6359 EOM
6360 fn=d~+
6361 rp='Pathname for the site-specific library files?'
6362 . ./getfile
6363 prefixvar=sitelib
6364 . ./setprefixvar
6365 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6366
6367 : Determine list of previous versions to include in @INC
6368 $cat > getverlist <<EOPL
6369 #!$perl5 -w
6370 use File::Basename;
6371 \$api_versionstring = "$api_versionstring";
6372 \$version = "$version";
6373 \$stem = "$sitelib_stem";
6374 \$archname = "$archname";
6375 EOPL
6376         $cat >> getverlist <<'EOPL'
6377 # The list found is store twice for each entry: the original name, and
6378 # the binary broken down version as pack "sss", so sorting is easy and
6379 # unambiguous. This will work for all versions that have a maximum of
6380 # three digit groups, separate by '.'s or '_'s. Names are extended with
6381 # ".0.0" to ensure at least three elements for the pack.
6382 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6383
6384 # Can't have leading @ because metaconfig interprets it as a command!
6385 ;@inc_version_list=();
6386 # XXX Redo to do opendir/readdir?
6387 if (-d $stem) {
6388     chdir($stem);
6389     ;@candidates = map {
6390         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6391 }
6392 else {
6393     ;@candidates = ();
6394 }
6395
6396 ($pversion, $aversion, $vsn5005) = map {
6397     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6398 foreach $d (@candidates) {
6399     if ($d->[1] lt $pversion) {
6400         if ($d->[1] ge $aversion) {
6401             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6402         }
6403         elsif ($d->[1] ge $vsn5005) {
6404             unshift(@inc_version_list, grep { -d } $d->[0]);
6405         }
6406     }
6407     else {
6408         # Skip newer version.  I.e. don't look in
6409         # 5.7.0 if we're installing 5.6.1.
6410     }
6411 }
6412
6413 if (@inc_version_list) {
6414     print join(' ', @inc_version_list);
6415 }
6416 else {
6417     # Blank space to preserve value for next Configure run.
6418     print " ";
6419 }
6420 EOPL
6421 chmod +x getverlist
6422 case "$inc_version_list" in
6423 '')     if test -x "$perl5$exe_ext"; then
6424                 dflt=`$perl5 getverlist`
6425         else
6426                 dflt='none'
6427         fi
6428         ;;
6429 $undef) dflt='none' ;;
6430 *)  eval dflt=\"$inc_version_list\" ;;
6431 esac
6432 case "$dflt" in
6433 ''|' ') dflt=none ;;
6434 esac
6435 case "$dflt" in
6436 5.005) dflt=none ;;
6437 esac
6438 $cat <<EOM
6439
6440 In order to ease the process of upgrading, this version of perl
6441 can be configured to use modules built and installed with earlier
6442 versions of perl that were installed under $prefix.  Specify here
6443 the list of earlier versions that this version of perl should check.
6444 If Configure detected no earlier versions of perl installed under
6445 $prefix, then the list will be empty.  Answer 'none' to tell perl
6446 to not search earlier versions.
6447
6448 The default should almost always be sensible, so if you're not sure,
6449 just accept the default.
6450 EOM
6451
6452 rp='List of earlier versions to include in @INC?'
6453 . ./myread
6454 case "$ans" in
6455 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6456 *) inc_version_list="$ans" ;;
6457 esac
6458 case "$inc_version_list" in
6459 ''|' ')
6460         inc_version_list_init='0'
6461         d_inc_version_list="$undef"
6462         ;;
6463 *)      inc_version_list_init=`echo $inc_version_list |
6464                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6465         d_inc_version_list="$define"
6466         ;;
6467 esac
6468 $rm -f getverlist
6469
6470 : see if this is a malloc.h system
6471 : we want a real compile instead of Inhdr because some systems have a
6472 : malloc.h that just gives a compile error saying to use stdlib.h instead
6473 echo " "
6474 $cat >try.c <<EOCP
6475 #include <stdlib.h>
6476 #include <malloc.h>
6477 int main () { return 0; }
6478 EOCP
6479 set try
6480 if eval $compile; then
6481     echo "<malloc.h> found." >&4
6482     val="$define"
6483 else
6484     echo "<malloc.h> NOT found." >&4
6485     val="$undef"
6486 fi
6487 $rm -f try.c try
6488 set i_malloc
6489 eval $setvar
6490
6491 : check for void type
6492 echo " "
6493 echo "Checking to see how well your C compiler groks the void type..." >&4
6494 case "$voidflags" in
6495 '')
6496         $cat >try.c <<EOCP
6497 #$i_stdlib I_STDLIB
6498 #ifdef I_STDLIB
6499 #include <stdlib.h>
6500 #endif
6501 #if TRY & 1
6502 void sub() {
6503 #else
6504 sub() {
6505 #endif
6506         extern void moo();      /* function returning void */
6507         void (*goo)();          /* ptr to func returning void */
6508 #if TRY & 8
6509         void *hue;              /* generic ptr */
6510 #endif
6511 #if TRY & 2
6512         void (*foo[10])();
6513 #endif
6514
6515 #if TRY & 4
6516         if(goo == moo) {
6517                 exit(0);
6518         }
6519 #endif
6520         exit(0);
6521 }
6522 int main() { sub(); }
6523 EOCP
6524         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6525                 voidflags=$defvoidused
6526         echo "Good.  It appears to support void to the level $package wants.">&4
6527                 if $contains warning .out >/dev/null 2>&1; then
6528                         echo "However, you might get some warnings that look like this:"
6529                         $cat .out
6530                 fi
6531         else
6532 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6533                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6534                         echo "It supports 1..."
6535                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6536                                 echo "It also supports 2..."
6537                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6538                                         voidflags=7
6539                                         echo "And it supports 4 but not 8 definitely."
6540                                 else
6541                                         echo "It doesn't support 4..."
6542                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6543                                                 voidflags=11
6544                                                 echo "But it supports 8."
6545                                         else
6546                                                 voidflags=3
6547                                                 echo "Neither does it support 8."
6548                                         fi
6549                                 fi
6550                         else
6551                                 echo "It does not support 2..."
6552                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6553                                         voidflags=13
6554                                         echo "But it supports 4 and 8."
6555                                 else
6556                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6557                                                 voidflags=5
6558                                                 echo "And it supports 4 but has not heard about 8."
6559                                         else
6560                                                 echo "However it supports 8 but not 4."
6561                                         fi
6562                                 fi
6563                         fi
6564                 else
6565                         echo "There is no support at all for void."
6566                         voidflags=0
6567                 fi
6568         fi
6569 esac
6570 case "$voidflags" in
6571 "$defvoidused") ;;
6572 *)      $cat >&4 <<'EOM'
6573   Support flag bits are:
6574     1: basic void declarations.
6575     2: arrays of pointers to functions returning void.
6576     4: operations between pointers to and addresses of void functions.
6577     8: generic void pointers.
6578 EOM
6579         dflt="$voidflags";
6580         rp="Your void support flags add up to what?"
6581         . ./myread
6582         voidflags="$ans"
6583         ;;
6584 esac
6585 $rm -f try.* .out
6586
6587 : check for length of pointer
6588 echo " "
6589 case "$ptrsize" in
6590 '')
6591         echo "Checking to see how big your pointers are..." >&4
6592         if test "$voidflags" -gt 7; then
6593                 echo '#define VOID_PTR char *' > try.c
6594         else
6595                 echo '#define VOID_PTR void *' > try.c
6596         fi
6597         $cat >>try.c <<EOCP
6598 #include <stdio.h>
6599 #$i_stdlib I_STDLIB
6600 #ifdef I_STDLIB
6601 #include <stdlib.h>
6602 #endif
6603 int main()
6604 {
6605     printf("%d\n", (int)sizeof(VOID_PTR));
6606     exit(0);
6607 }
6608 EOCP
6609         set try
6610         if eval $compile_ok; then
6611                 ptrsize=`$run ./try`
6612                 echo "Your pointers are $ptrsize bytes long."
6613         else
6614                 dflt='4'
6615                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6616                 rp="What is the size of a pointer (in bytes)?"
6617                 . ./myread
6618                 ptrsize="$ans"
6619         fi
6620         ;;
6621 esac
6622 $rm -f try.c try
6623 case "$use64bitall" in
6624 "$define"|true|[yY]*)
6625         case "$ptrsize" in
6626         4)      cat <<EOM >&4
6627
6628 *** You have chosen a maximally 64-bit build,
6629 *** but your pointers are only 4 bytes wide.
6630 *** Please rerun Configure without -Duse64bitall.
6631 EOM
6632                 case "$d_quad" in
6633                 define)
6634                         cat <<EOM >&4
6635 *** Since you have quads, you could possibly try with -Duse64bitint.
6636 EOM
6637                         ;;
6638                 esac
6639                 cat <<EOM >&4
6640 *** Cannot continue, aborting.
6641
6642 EOM
6643
6644                 exit 1
6645                 ;;
6646         esac
6647         ;;
6648 esac
6649
6650
6651 : determine whether to use malloc wrapping
6652 echo " "
6653 case "$usemallocwrap" in
6654 [yY]*|true|$define)     dflt='y' ;;
6655 [nN]*|false|$undef)     dflt='n' ;;
6656 *)      case "$usedevel" in
6657         [yY]*|true|$define)     dflt='y' ;;
6658         *) dflt='n' ;;
6659         esac
6660         ;;
6661 esac
6662 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6663 . ./myread
6664 usemallocwrap="$ans"
6665 case "$ans" in
6666 y*|true)
6667         usemallocwrap="$define" ;;
6668 *)
6669         usemallocwrap="$undef" ;;
6670 esac
6671
6672 : determine which malloc to compile in
6673 echo " "
6674 case "$usemymalloc" in
6675 [yY]*|true|$define)     dflt='y' ;;
6676 [nN]*|false|$undef)     dflt='n' ;;
6677 *)      case "$ptrsize" in
6678         4) dflt='y' ;;
6679         *) dflt='n' ;;
6680         esac
6681         ;;
6682 esac
6683 rp="Do you wish to attempt to use the malloc that comes with $package?"
6684 . ./myread
6685 usemymalloc="$ans"
6686 case "$ans" in
6687 y*|true)
6688         usemymalloc='y'
6689         mallocsrc='malloc.c'
6690         mallocobj="malloc$_o"
6691         d_mymalloc="$define"
6692         case "$libs" in
6693         *-lmalloc*)
6694                 : Remove malloc from list of libraries to use
6695                 echo "Removing unneeded -lmalloc from library list" >&4
6696                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6697                 shift
6698                 libs="$*"
6699                 echo "libs = $libs" >&4
6700                 ;;
6701         esac
6702         ;;
6703 *)
6704         usemymalloc='n'
6705         mallocsrc=''
6706         mallocobj=''
6707         d_mymalloc="$undef"
6708         ;;
6709 esac
6710
6711 : compute the return types of malloc and free
6712 echo " "
6713 $cat >malloc.c <<END
6714 #$i_malloc I_MALLOC
6715 #$i_stdlib I_STDLIB
6716 #include <stdio.h>
6717 #include <sys/types.h>
6718 #ifdef I_MALLOC
6719 #include <malloc.h>
6720 #endif
6721 #ifdef I_STDLIB
6722 #include <stdlib.h>
6723 #endif
6724 #ifdef TRY_MALLOC
6725 void *malloc();
6726 #endif
6727 #ifdef TRY_FREE
6728 void free();
6729 #endif
6730 END
6731 case "$malloctype" in
6732 '')
6733         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6734                 malloctype='void *'
6735         else
6736                 malloctype='char *'
6737         fi
6738         ;;
6739 esac
6740 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6741
6742 case "$freetype" in
6743 '')
6744         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6745                 freetype='void'
6746         else
6747                 freetype='int'
6748         fi
6749         ;;
6750 esac
6751 echo "Your system uses $freetype free(), it would seem." >&4
6752 $rm -f malloc.[co]
6753 : determine where site specific architecture-dependent libraries go.
6754 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6755 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6756 : sitelib may have an optional trailing /share.
6757 case "$sitearch" in
6758 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6759         dflt="$dflt/$archname"
6760         ;;
6761 *)      dflt="$sitearch"
6762         ;;
6763 esac
6764 set sitearch sitearch none
6765 eval $prefixit
6766 $cat <<EOM
6767
6768 The installation process will also create a directory for
6769 architecture-dependent site-specific extensions and modules.
6770
6771 EOM
6772 fn=d~+
6773 rp='Pathname for the site-specific architecture-dependent library files?'
6774 . ./getfile
6775 prefixvar=sitearch
6776 . ./setprefixvar
6777 if $test X"$sitearch" = X"$sitelib"; then
6778         d_sitearch="$undef"
6779 else
6780         d_sitearch="$define"
6781 fi
6782
6783 $cat <<EOM
6784
6785 The installation process will also create a directory for
6786 vendor-supplied add-ons.  Vendors who supply perl with their system
6787 may find it convenient to place all vendor-supplied files in this
6788 directory rather than in the main distribution directory.  This will
6789 ease upgrades between binary-compatible maintenance versions of perl.
6790
6791 Of course you may also use these directories in whatever way you see
6792 fit.  For example, you might use them to access modules shared over a
6793 company-wide network.
6794
6795 The default answer should be fine for most people.
6796 This causes further questions about vendor add-ons to be skipped
6797 and no vendor-specific directories will be configured for perl.
6798
6799 EOM
6800 rp='Do you want to configure vendor-specific add-on directories?'
6801 case "$usevendorprefix" in
6802 define|true|[yY]*) dflt=y ;;
6803 *)      : User may have set vendorprefix directly on Configure command line.
6804         case "$vendorprefix" in
6805         ''|' ') dflt=n ;;
6806         *)      dflt=y ;;
6807         esac
6808         ;;
6809 esac
6810 . ./myread
6811 case "$ans" in
6812 [yY]*)  fn=d~+
6813         rp='Installation prefix to use for vendor-supplied add-ons?'
6814         case "$vendorprefix" in
6815         '') dflt='' ;;
6816         *)  dflt=$vendorprefix ;;
6817         esac
6818         . ./getfile
6819         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6820         oldvendorprefix=''
6821         case "$vendorprefix" in
6822         '') ;;
6823         *)      case "$ans" in
6824                 "$prefix") ;;
6825                 *) oldvendorprefix="$prefix";;
6826                 esac
6827                 ;;
6828         esac
6829         usevendorprefix="$define"
6830         vendorprefix="$ans"
6831         vendorprefixexp="$ansexp"
6832         ;;
6833 *)      usevendorprefix="$undef"
6834         vendorprefix=''
6835         vendorprefixexp=''
6836         ;;
6837 esac
6838
6839 case "$vendorprefix" in
6840 '')     d_vendorlib="$undef"
6841         vendorlib=''
6842         vendorlibexp=''
6843         ;;
6844 *)      d_vendorlib="$define"
6845         : determine where vendor-supplied modules go.
6846         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6847         case "$vendorlib" in
6848         '')
6849                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6850                 case "$installstyle" in
6851                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6852                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6853                 esac
6854                 ;;
6855         *)      dflt="$vendorlib"
6856                 ;;
6857         esac
6858         fn=d~+
6859         rp='Pathname for the vendor-supplied library files?'
6860         . ./getfile
6861         vendorlib="$ans"
6862         vendorlibexp="$ansexp"
6863         ;;
6864 esac
6865 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6866 prefixvar=vendorlib
6867 . ./installprefix
6868
6869 case "$vendorprefix" in
6870 '')     d_vendorarch="$undef"
6871         vendorarch=''
6872         vendorarchexp=''
6873         ;;
6874 *)      d_vendorarch="$define"
6875         : determine where vendor-supplied architecture-dependent libraries go.
6876         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6877         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6878         : vendorlib may have an optional trailing /share.
6879         case "$vendorarch" in
6880         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6881                 dflt="$dflt/$archname"
6882                 ;;
6883         *)      dflt="$vendorarch" ;;
6884         esac
6885         fn=d~+
6886         rp='Pathname for vendor-supplied architecture-dependent files?'
6887         . ./getfile
6888         vendorarch="$ans"
6889         vendorarchexp="$ansexp"
6890         ;;
6891 esac
6892 prefixvar=vendorarch
6893 . ./installprefix
6894
6895 : Final catch-all directories to search
6896 $cat <<EOM
6897
6898 Lastly, you can have perl look in other directories for extensions and
6899 modules in addition to those already specified.
6900 These directories will be searched after 
6901         $sitearch 
6902         $sitelib 
6903 EOM
6904 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6905 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6906 echo ' '
6907 case "$otherlibdirs" in
6908 ''|' ') dflt='none' ;;
6909 *)      dflt="$otherlibdirs" ;;
6910 esac
6911 $cat <<EOM
6912 Enter a colon-separated set of extra paths to include in perl's @INC
6913 search path, or enter 'none' for no extra paths.
6914
6915 EOM
6916
6917 rp='Colon-separated list of additional directories for perl to search?'
6918 . ./myread
6919 case "$ans" in
6920 ' '|''|none)    otherlibdirs=' ' ;;     
6921 *)      otherlibdirs="$ans" ;;
6922 esac
6923 case "$otherlibdirs" in
6924 ' ') val=$undef ;;
6925 *)      val=$define ;;
6926 esac
6927 set d_perl_otherlibdirs
6928 eval $setvar
6929
6930 : Cruising for prototypes
6931 echo " "
6932 echo "Checking out function prototypes..." >&4
6933 $cat >prototype.c <<EOCP
6934 #$i_stdlib I_STDLIB
6935 #ifdef I_STDLIB
6936 #include <stdlib.h>
6937 #endif
6938 int main(int argc, char *argv[]) {
6939         exit(0);}
6940 EOCP
6941 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6942         echo "Your C compiler appears to support function prototypes."
6943         val="$define"
6944 else
6945         echo "Your C compiler doesn't seem to understand function prototypes."
6946         val="$undef"
6947 fi
6948 set prototype
6949 eval $setvar
6950 $rm -f prototype*
6951
6952 case "$prototype" in
6953 "$define") ;;
6954 *)      ansi2knr='ansi2knr'
6955         echo " "
6956         cat <<EOM >&4
6957
6958 $me:  FATAL ERROR:
6959 This version of $package can only be compiled by a compiler that 
6960 understands function prototypes.  Unfortunately, your C compiler 
6961         $cc $ccflags
6962 doesn't seem to understand them.  Sorry about that.
6963
6964 If GNU cc is available for your system, perhaps you could try that instead.  
6965
6966 Eventually, we hope to support building Perl with pre-ANSI compilers.
6967 If you would like to help in that effort, please contact <perlbug@perl.org>.
6968
6969 Aborting Configure now.
6970 EOM
6971         exit 2
6972         ;;
6973 esac
6974
6975 echo " "
6976 case "$extras" in
6977 '') dflt='n';;
6978 *) dflt='y';;
6979 esac
6980 cat <<EOM
6981 Perl can be built with extra modules or bundles of modules which
6982 will be fetched from the CPAN and installed alongside Perl.
6983
6984 Notice that you will need access to the CPAN; either via the Internet,
6985 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6986 be asked later to configure the CPAN.pm module which will in turn do
6987 the installation of the rest of the extra modules or bundles.)
6988
6989 Notice also that if the modules require any external software such as
6990 libraries and headers (the libz library and the zlib.h header for the
6991 Compress::Zlib module, for example) you MUST have any such software
6992 already installed, this configuration process will NOT install such
6993 things for you.
6994
6995 If this doesn't make any sense to you, just accept the default '$dflt'.
6996 EOM
6997 rp='Install any extra modules (y or n)?'
6998 . ./myread
6999 case "$ans" in
7000 y|Y)
7001         cat <<EOM
7002
7003 Please list any extra modules or bundles to be installed from CPAN,
7004 with spaces between the names.  The names can be in any format the
7005 'install' command of CPAN.pm will understand.  (Answer 'none',
7006 without the quotes, to install no extra modules or bundles.)
7007 EOM
7008         rp='Extras?'
7009         dflt="$extras"
7010         . ./myread
7011         extras="$ans"
7012 esac
7013 case "$extras" in
7014 ''|'none')
7015         val=''
7016         $rm -f ../extras.lst
7017         ;;
7018 *)      echo "(Saving the list of extras for later...)"
7019         echo "$extras" > ../extras.lst
7020         val="'$extras'"
7021         ;;
7022 esac
7023 set extras
7024 eval $setvar
7025 echo " "
7026
7027 : determine where html pages for programs go
7028 set html1dir html1dir none
7029 eval $prefixit
7030 $cat <<EOM
7031
7032 If you wish to install html files for programs in $spackage, indicate
7033 the appropriate directory here.  To skip installing html files,
7034 answer "none".
7035 EOM
7036 case "$html1dir" in
7037 ''|none|$undef|' ') dflt=none ;;
7038 *) dflt=$html1dir ;;
7039 esac
7040 fn=dn+~
7041 rp="Directory for the main $spackage html pages?"
7042 . ./getfile
7043 prefixvar=html1dir
7044 . ./setprefixvar
7045 : Use ' ' for none so value is preserved next time through Configure
7046 $test X"$html1dir" = "X" && html1dir=' '
7047
7048 : determine where html pages for libraries and modules go
7049 set html3dir html3dir none
7050 eval $prefixit
7051 $cat <<EOM
7052
7053 If you wish to install html files for modules associated with $spackage,
7054 indicate the appropriate directory here.  To skip installing html files,
7055 answer "none".
7056 EOM
7057 : There is no obvious default.  If they have specified html1dir, then
7058 : try to key off that, possibly changing .../html1 into .../html3.
7059 case "$html3dir" in
7060 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7061 *) dflt=$html3dir ;;
7062 esac
7063 fn=dn+~
7064 rp="Directory for the $spackage module html pages?"
7065 . ./getfile
7066 prefixvar=html3dir
7067 . ./setprefixvar
7068 : Use ' ' for none so value is preserved next time through Configure
7069 $test X"$html3dir" = "X" && html3dir=' '
7070
7071 : determine whether to install perl also as /usr/bin/perl
7072
7073 echo " "
7074 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7075         $cat <<EOM
7076 Many scripts expect perl to be installed as /usr/bin/perl.
7077
7078 If you want to, I can install the perl you are about to compile
7079 as /usr/bin/perl (in addition to $bin/perl).
7080 EOM
7081         if test -f /usr/bin/perl; then
7082             $cat <<EOM
7083
7084 However, please note that because you already have a /usr/bin/perl,
7085 overwriting that with a new Perl would very probably cause problems.
7086 Therefore I'm assuming you don't want to do that (unless you insist).
7087
7088 EOM
7089             case "$installusrbinperl" in
7090             "$define"|[yY]*)    dflt='y';;
7091             *)                  dflt='n';;
7092             esac
7093         else
7094             $cat <<EOM
7095
7096 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7097
7098 EOM
7099             case "$installusrbinperl" in
7100             "$undef"|[nN]*)     dflt='n';;
7101             *)                  dflt='y';;
7102             esac
7103         fi
7104         rp="Do you want to install perl as /usr/bin/perl?"
7105         . ./myread
7106         case "$ans" in
7107         [yY]*)  val="$define";;
7108         *)      val="$undef" ;;
7109         esac
7110 else
7111         val="$undef"
7112 fi
7113 set installusrbinperl
7114 eval $setvar
7115
7116 echo " "
7117 echo "Checking for GNU C Library..." >&4
7118 cat >try.c <<'EOCP'
7119 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7120    alone are insufficient to distinguish different versions, such as
7121    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7122    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7123 */
7124 #include <stdio.h>
7125 int main(void)
7126 {
7127 #ifdef __GLIBC__
7128 #   ifdef __GLIBC_MINOR__
7129 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7130 #           include <gnu/libc-version.h>
7131             printf("%s\n",  gnu_get_libc_version());
7132 #       else
7133             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7134 #       endif
7135 #   else
7136         printf("%d\n",  __GLIBC__);
7137 #   endif
7138     return 0;
7139 #else
7140     return 1;
7141 #endif
7142 }
7143 EOCP
7144 set try
7145 if eval $compile_ok && $run ./try > glibc.ver; then
7146         val="$define"
7147         gnulibc_version=`$cat glibc.ver`
7148         echo "You are using the GNU C Library version $gnulibc_version"
7149 else
7150         val="$undef"
7151         gnulibc_version=''
7152         echo "You are not using the GNU C Library"
7153 fi
7154 $rm -f try try.* glibc.ver
7155 set d_gnulibc
7156 eval $setvar
7157
7158 : see if nm is to be used to determine whether a symbol is defined or not
7159 case "$usenm" in
7160 '')
7161         dflt=''
7162         case "$d_gnulibc" in
7163         "$define")
7164                 echo " "
7165                 echo "nm probably won't work on the GNU C Library." >&4
7166                 dflt=n
7167                 ;;
7168         esac
7169         case "$dflt" in
7170         '') 
7171                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7172                         echo " "
7173                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7174                         echo "'nm' won't be sufficient on this sytem." >&4
7175                         dflt=n
7176                 fi
7177                 ;;
7178         esac
7179         case "$dflt" in
7180         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7181                 if $test $dflt -gt 20; then
7182                         dflt=y
7183                 else
7184                         dflt=n
7185                 fi
7186                 ;;
7187         esac
7188         ;;
7189 *)
7190         case "$usenm" in
7191         true|$define) dflt=y;;
7192         *) dflt=n;;
7193         esac
7194         ;;
7195 esac
7196 $cat <<EOM
7197
7198 I can use $nm to extract the symbols from your C libraries. This
7199 is a time consuming task which may generate huge output on the disk (up
7200 to 3 megabytes) but that should make the symbols extraction faster. The
7201 alternative is to skip the 'nm' extraction part and to compile a small
7202 test program instead to determine whether each symbol is present. If
7203 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7204 this may be the best solution.
7205
7206 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7207
7208 EOM
7209 rp="Shall I use $nm to extract C symbols from the libraries?"
7210 . ./myread
7211 case "$ans" in
7212 [Nn]*) usenm=false;;
7213 *) usenm=true;;
7214 esac
7215
7216 runnm=$usenm
7217 case "$reuseval" in
7218 true) runnm=false;;
7219 esac
7220
7221 : nm options which may be necessary
7222 case "$nm_opt" in
7223 '') if $test -f /mach_boot; then
7224                 nm_opt=''       # Mach
7225         elif $test -d /usr/ccs/lib; then
7226                 nm_opt='-p'     # Solaris (and SunOS?)
7227         elif $test -f /dgux; then
7228                 nm_opt='-p'     # DG-UX
7229         elif $test -f /lib64/rld; then
7230                 nm_opt='-p'     # 64-bit Irix
7231         else
7232                 nm_opt=''
7233         fi;;
7234 esac
7235
7236 : nm options which may be necessary for shared libraries but illegal
7237 : for archive libraries.  Thank you, Linux.
7238 case "$nm_so_opt" in
7239 '')     case "$myuname" in
7240         *linux*|gnu*)
7241                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7242                         nm_so_opt='--dynamic'
7243                 fi
7244                 ;;
7245         esac
7246         ;;
7247 esac
7248
7249 case "$runnm" in
7250 true)
7251 : get list of predefined functions in a handy place
7252 echo " "
7253 case "$libc" in
7254 '') libc=unknown
7255         case "$libs" in
7256         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7257         esac
7258         ;;
7259 esac
7260 case "$libs" in
7261 '') ;;
7262 *)  for thislib in $libs; do
7263         case "$thislib" in
7264         -lc|-lc_s)
7265                 : Handle C library specially below.
7266                 ;;
7267         -l*)
7268                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7269                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7270                         :
7271                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7272                         :
7273                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7274                         :
7275                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7276                         :
7277                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7278                         :
7279                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7280                         :
7281                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7282                         :
7283                 else
7284                         try=''
7285                 fi
7286                 libnames="$libnames $try"
7287                 ;;
7288         *) libnames="$libnames $thislib" ;;
7289         esac
7290         done
7291         ;;
7292 esac
7293 xxx=normal
7294 case "$libc" in
7295 unknown)
7296         set /lib/libc.$so
7297         for xxx in $libpth; do
7298                 $test -r $1 || set $xxx/libc.$so
7299                 : The messy sed command sorts on library version numbers.
7300                 $test -r $1 || \
7301                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7302                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7303                                 h
7304                                 s/[0-9][0-9]*/0000&/g
7305                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7306                                 G
7307                                 s/\n/ /' | \
7308                          $sort | $sed -e 's/^.* //'`
7309                 eval set \$$#
7310         done
7311         $test -r $1 || set /usr/ccs/lib/libc.$so
7312         $test -r $1 || set /lib/libsys_s$_a
7313         ;;
7314 *)
7315         set blurfl
7316         ;;
7317 esac
7318 if $test -r "$1"; then
7319         echo "Your (shared) C library seems to be in $1."
7320         libc="$1"
7321 elif $test -r /lib/libc && $test -r /lib/clib; then
7322         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7323         xxx=apollo
7324         libc='/lib/clib /lib/libc'
7325         if $test -r /lib/syslib; then
7326                 echo "(Your math library is in /lib/syslib.)"
7327                 libc="$libc /lib/syslib"
7328         fi
7329 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7330         echo "Your C library seems to be in $libc, as you said before."
7331 elif $test -r $incpath/usr/lib/libc$_a; then
7332         libc=$incpath/usr/lib/libc$_a;
7333         echo "Your C library seems to be in $libc.  That's fine."
7334 elif $test -r /lib/libc$_a; then
7335         libc=/lib/libc$_a;
7336         echo "Your C library seems to be in $libc.  You're normal."
7337 else
7338         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7339                 :
7340         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7341                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7342         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7343                 :
7344         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7345                 :
7346         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7347                 :
7348         else
7349                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7350         fi
7351         if $test -r "$tans"; then
7352                 echo "Your C library seems to be in $tans, of all places."
7353                 libc=$tans
7354         else
7355                 libc='blurfl'
7356         fi
7357 fi
7358 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7359         dflt="$libc"
7360         cat <<EOM
7361
7362 If the guess above is wrong (which it might be if you're using a strange
7363 compiler, or your machine supports multiple models), you can override it here.
7364
7365 EOM
7366 else
7367         dflt=''
7368         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7369         cat >&4 <<EOM
7370 I can't seem to find your C library.  I've looked in the following places:
7371
7372 EOM
7373         $sed 's/^/      /' libpath
7374         cat <<EOM
7375
7376 None of these seems to contain your C library. I need to get its name...
7377
7378 EOM
7379 fi
7380 fn=f
7381 rp='Where is your C library?'
7382 . ./getfile
7383 libc="$ans"
7384
7385 echo " "
7386 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7387 set X `cat libnames`
7388 shift
7389 xxx=files
7390 case $# in 1) xxx=file; esac
7391 echo "Extracting names from the following $xxx for later perusal:" >&4
7392 echo " "
7393 $sed 's/^/      /' libnames >&4
7394 echo " "
7395 $echo $n "This may take a while...$c" >&4
7396
7397 for file in $*; do
7398         case $file in
7399         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7400         *) $nm $nm_opt $file 2>/dev/null;;
7401         esac
7402 done >libc.tmp
7403
7404 $echo $n ".$c"
7405 $grep fprintf libc.tmp > libc.ptf
7406 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7407 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7408 xxx='[ADTSIW]'
7409 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7410         eval $xscan;\
7411         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7412                 eval $xrun
7413 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7414         eval $xscan;\
7415         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7416                 eval $xrun
7417 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7418         eval $xscan;\
7419         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7420                 eval $xrun
7421 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7422         eval $xscan;\
7423         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7424                 eval $xrun
7425 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7426         eval $xscan;\
7427         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7428                 eval $xrun
7429 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7430         eval $xscan;\
7431         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7432                 eval $xrun
7433 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7434                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7435         eval $xscan;\
7436         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7437                 eval $xrun
7438 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7439         eval $xscan;\
7440         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7441                 eval $xrun
7442 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7443         eval $xscan;\
7444         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7445                 eval $xrun
7446 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7447         eval $xscan;\
7448         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7449                 eval $xrun
7450 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7451         eval $xscan;\
7452         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7453                 eval $xrun
7454 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7455         eval $xscan;\
7456         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7457                 eval $xrun
7458 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7459         eval $xscan;\
7460         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7461                 eval $xrun
7462 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7463         eval $xscan;\
7464         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7465                 eval $xrun
7466 else
7467         $nm -p $* 2>/dev/null >libc.tmp
7468         $grep fprintf libc.tmp > libc.ptf
7469         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7470                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7471         then
7472                 nm_opt='-p'
7473                 eval $xrun
7474         else
7475                 echo " "
7476                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7477                 com=''
7478                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7479                         for thisname in $libnames $libc; do
7480                                 $ar t $thisname >>libc.tmp
7481                         done
7482                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7483                         echo "Ok." >&4
7484                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7485                         # Repeat libc to extract forwarders to DLL entries too
7486                         for thisname in $libnames $libc; do
7487                                 $ar tv $thisname >>libc.tmp
7488                                 # Revision 50 of EMX has bug in $ar.
7489                                 # it will not extract forwarders to DLL entries
7490                                 # Use emximp which will extract exactly them.
7491                                 emximp -o tmp.imp $thisname \
7492                                     2>/dev/null && \
7493                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7494                                     < tmp.imp >>libc.tmp
7495                                 $rm tmp.imp
7496                         done
7497                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7498                         echo "Ok." >&4
7499                 else
7500                         echo "$ar didn't seem to work right." >&4
7501                         echo "Maybe this is a Cray...trying bld instead..." >&4
7502                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7503                         then
7504                                 for thisname in $libnames; do
7505                                         bld t $libnames | \
7506                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7507                                         $ar t $thisname >>libc.tmp
7508                                 done
7509                                 echo "Ok." >&4
7510                         else
7511                                 echo "That didn't work either.  Giving up." >&4
7512                                 exit 1
7513                         fi
7514                 fi
7515         fi
7516 fi
7517 nm_extract="$com"
7518 case "$PASE" in
7519 define)
7520     echo " "
7521     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7522     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7523     ;;
7524 *)  if $test -f /lib/syscalls.exp; then
7525         echo " "
7526         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7527         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7528     fi
7529     ;;
7530 esac
7531 ;;
7532 esac
7533 $rm -f libnames libpath
7534
7535 : see if dld is available
7536 set dld.h i_dld
7537 eval $inhdr
7538
7539 : is a C symbol defined?
7540 csym='tlook=$1;
7541 case "$3" in
7542 -v) tf=libc.tmp; tdc="";;
7543 -a) tf=libc.tmp; tdc="[]";;
7544 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7545 esac;
7546 tx=yes;
7547 case "$reuseval-$4" in
7548 true-) ;;
7549 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7550 esac;
7551 case "$tx" in
7552 yes)
7553         tval=false;
7554         if $test "$runnm" = true; then
7555                 if $contains $tlook $tf >/dev/null 2>&1; then
7556                         tval=true;
7557                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7558                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7559                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7560                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7561                         $rm -f try$_exe try.c core core.* try.core;
7562                 fi;
7563         else
7564                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7565                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7566                 $rm -f try$_exe try.c;
7567         fi;
7568         ;;
7569 *)
7570         case "$tval" in
7571         $define) tval=true;;
7572         *) tval=false;;
7573         esac;
7574         ;;
7575 esac;
7576 eval "$2=$tval"'
7577
7578 : define an is-in-libc? function
7579 inlibc='echo " "; td=$define; tu=$undef;
7580 sym=$1; var=$2; eval "was=\$$2";
7581 tx=yes;
7582 case "$reuseval$was" in
7583 true) ;;
7584 true*) tx=no;;
7585 esac;
7586 case "$tx" in
7587 yes)
7588         set $sym tres -f;
7589         eval $csym;
7590         case "$tres" in
7591         true)
7592                 echo "$sym() found." >&4;
7593                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7594         *)
7595                 echo "$sym() NOT found." >&4;
7596                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7597         esac;;
7598 *)
7599         case "$was" in
7600         $define) echo "$sym() found." >&4;;
7601         *) echo "$sym() NOT found." >&4;;
7602         esac;;
7603 esac'
7604
7605
7606 echo " "
7607 echo "Checking for C++..." >&4
7608 cat >try.c <<'EOCP'
7609 #include <stdio.h>
7610 int main(void)
7611 {
7612 #ifdef __cplusplus
7613     printf("define\n");
7614 #else
7615     printf("undef\n");
7616 #endif
7617     return 0;
7618 }
7619 EOCP
7620 set try
7621 if eval $compile_ok && $run ./try >cplusplus$$; then
7622         val=`$cat cplusplus$$`
7623         echo "You are using a C++ compiler."
7624 else
7625         val="$undef"
7626         echo "You are not using a C++ compiler."
7627 fi
7628 $rm -f try try.* cplusplus$$
7629 set d_cplusplus
7630 eval $setvar
7631
7632 : see if dlopen exists
7633 xxx_runnm="$runnm"
7634 xxx_ccflags="$ccflags"
7635 runnm=false
7636 : with g++ one needs -shared to get is-in-libc to work for dlopen
7637 case "$gccversion" in
7638 '')     ;;
7639 *)      case "$d_cplusplus" in
7640         "$define") ccflags="$ccflags -shared" ;;
7641         esac
7642         ;;
7643 esac
7644 set dlopen d_dlopen
7645 eval $inlibc
7646 runnm="$xxx_runnm"
7647 ccflags="$xxx_ccflags"
7648
7649 : see if this is a unistd.h system
7650 set unistd.h i_unistd
7651 eval $inhdr
7652
7653 : determine which dynamic loading, if any, to compile in
7654 echo " "
7655 dldir="ext/DynaLoader"
7656 case "$usedl" in
7657 $define|y|true)
7658         dflt='y'
7659         usedl="$define"
7660         ;;
7661 $undef|n|false)
7662         dflt='n'
7663         usedl="$undef"
7664         ;;
7665 *) 
7666         dflt='n'
7667         case "$d_dlopen" in
7668             $define) dflt='y' ;;
7669         esac
7670         case "$i_dld" in
7671             $define) dflt='y' ;;
7672         esac
7673         : Does a dl_xxx.xs file exist for this operating system
7674         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7675         ;;
7676 esac
7677 rp="Do you wish to use dynamic loading?"
7678 . ./myread
7679 usedl="$ans"
7680 case "$ans" in
7681 y*) usedl="$define"
7682         case "$dlsrc" in
7683         '')
7684                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7685                         dflt="$dldir/dl_${osname}.xs"
7686                 elif $test "$d_dlopen" = "$define" ; then
7687                         dflt="$dldir/dl_dlopen.xs"
7688                 elif $test "$i_dld" = "$define" ; then
7689                         dflt="$dldir/dl_dld.xs"
7690                 else
7691                         dflt=''
7692                 fi
7693                 ;;
7694         *)      dflt="$dldir/$dlsrc"
7695                 ;;
7696         esac
7697     echo "The following dynamic loading files are available:"
7698         : Can not go over to $dldir because getfile has path hard-coded in.
7699         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7700         rp="Source file to use for dynamic loading"
7701         fn="fne"
7702         gfpth="$src"
7703         . ./getfile
7704         usedl="$define"
7705         : emulate basename
7706         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7707
7708         $cat << EOM
7709
7710 Some systems may require passing special flags to $cc -c to
7711 compile modules that will be used to create a shared library.
7712 To use no flags, say "none".
7713
7714 EOM
7715     case "$cccdlflags" in
7716     '') case "$gccversion" in
7717                 '') case "$osname" in
7718                         hpux)   dflt='+z' ;;
7719                         next)   dflt='none' ;;
7720                         irix*)  dflt='-KPIC' ;;
7721                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7722                         sunos)  dflt='-pic' ;;
7723                         *)      dflt='none' ;;
7724                     esac
7725                         ;;
7726                 *)  case "$osname" in
7727                         darwin) dflt='none' ;;
7728                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7729                         *)      dflt='-fpic' ;;
7730                     esac ;;
7731             esac ;;
7732         ' ') dflt='none' ;;
7733     *)  dflt="$cccdlflags" ;;
7734     esac
7735     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7736     . ./myread
7737     case "$ans" in
7738     none) cccdlflags=' ' ;;
7739     *) cccdlflags="$ans" ;;
7740     esac
7741
7742     cat << EOM
7743
7744 Some systems use ld to create libraries that can be dynamically loaded,
7745 while other systems (such as those using ELF) use $cc.
7746
7747 EOM
7748         case "$ld" in
7749         '')     $cat >try.c <<EOM
7750 /* Test for whether ELF binaries are produced */
7751 #include <fcntl.h>
7752 #$i_stdlib I_STDLIB
7753 #ifdef I_STDLIB
7754 #include <stdlib.h>
7755 #endif
7756 #$i_unistd I_UNISTD
7757 #ifdef I_UNISTD
7758 #include <unistd.h>
7759 #endif
7760 int main() {
7761         char b[4];
7762         int i = open("a.out",O_RDONLY);
7763         if(i == -1) 
7764                 exit(1); /* fail */
7765         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7766                 exit(0); /* succeed (yes, it's ELF) */
7767         else
7768                 exit(1); /* fail */
7769 }
7770 EOM
7771                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7772                         cat <<EOM
7773 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7774 EOM
7775                         dflt="$cc"
7776                 else
7777                         echo "I'll use ld to build dynamic libraries."
7778                         dflt='ld'
7779                 fi
7780                 rm -f try.c a.out
7781                 ;;
7782         *)      dflt="$ld"
7783                 ;;
7784         esac
7785
7786     rp="What command should be used to create dynamic libraries?"
7787     . ./myread
7788         ld="$ans"
7789
7790     cat << EOM
7791
7792 Some systems may require passing special flags to $ld to create a
7793 library that can be dynamically loaded.  If your ld flags include
7794 -L/other/path options to locate libraries outside your loader's normal
7795 search path, you may need to specify those -L options here as well.  To
7796 use no flags, say "none".
7797
7798 EOM
7799     case "$lddlflags" in
7800     '') case "$osname" in
7801                         beos) dflt='-nostart' ;;
7802                         hpux) dflt='-b';
7803                               case "$gccversion" in
7804                               '') dflt="$dflt +vnocompatwarnings" ;;
7805                               esac
7806                               ;;        
7807                         linux|irix*|gnu*)       dflt='-shared' ;;
7808                         next)  dflt='none' ;;
7809                         solaris) dflt='-G' ;;
7810                         sunos) dflt='-assert nodefinitions' ;;
7811                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7812                 *)     dflt='none' ;;
7813                         esac
7814                         ;;
7815     *) dflt="$lddlflags" ;;
7816     esac
7817
7818         : Try to guess additional flags to pick up local libraries.
7819         : Be careful not to append to a plain 'none'
7820         case "$dflt" in
7821         none) dflt='' ;;
7822         esac
7823         for thisflag in $ldflags; do
7824                 case "$thisflag" in
7825                 -L*|-R*|-Wl,-R*)
7826                         case " $dflt " in
7827                         *" $thisflag "*) ;;
7828                         *) dflt="$dflt $thisflag" ;;
7829                         esac
7830                         ;;
7831                 esac
7832         done
7833
7834         case "$dflt" in
7835         ''|' ') dflt='none' ;;
7836         esac
7837
7838     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7839     . ./myread
7840     case "$ans" in
7841     none) lddlflags=' ' ;;
7842     *) lddlflags="$ans" ;;
7843     esac
7844
7845         cat <<EOM
7846
7847 Some systems may require passing special flags to $cc to indicate that
7848 the resulting executable will use dynamic linking.  To use no flags,
7849 say "none".
7850
7851 EOM
7852     case "$ccdlflags" in
7853     '') case "$osname" in
7854             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7855             next|sunos) dflt='none' ;;
7856             *)          dflt='none' ;;
7857             esac ;;
7858     ' ')  dflt='none' ;;
7859     *)  dflt="$ccdlflags" ;;
7860     esac
7861     rp="Any special flags to pass to $cc to use dynamic linking?"
7862     . ./myread
7863     case "$ans" in
7864     none) ccdlflags=' ' ;;
7865     *) ccdlflags="$ans" ;;
7866     esac
7867     ;;
7868 *)  usedl="$undef"
7869         ld='ld'
7870     dlsrc='dl_none.xs'
7871     lddlflags=''
7872     ccdlflags=''
7873     ;;
7874 esac
7875
7876 also=''
7877 case "$usedl" in
7878 $undef)
7879         # No dynamic loading being used, so don't bother even to prompt.
7880         useshrplib='false'
7881         ;;
7882 *)      case "$useshrplib" in
7883         '')     case "$osname" in
7884                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7885                         dflt=y
7886                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7887                         ;;
7888                 next*)
7889                         case "$osvers" in
7890                         4*)     dflt=y
7891                                 also='Building a shared libperl is needed for MAB support.'
7892                                 ;;
7893                         *)      dflt=n
7894                                 ;;
7895                         esac
7896                         ;;
7897                 *)      dflt=n
7898                         ;;
7899                 esac
7900                 ;;
7901         $define|true|[Yy]*)
7902                 dflt=y
7903                 ;;
7904         *)      dflt=n
7905                 ;;
7906         esac
7907         $cat << EOM
7908
7909 The perl executable is normally obtained by linking perlmain.c with
7910 libperl${_a}, any static extensions (usually just DynaLoader), and
7911 any other libraries needed on this system (such as -lm, etc.).  Since
7912 your system supports dynamic loading, it is probably possible to build
7913 a shared libperl.$so.  If you will have more than one executable linked
7914 to libperl.$so, this will significantly reduce the size of each
7915 executable, but it may have a noticeable effect on performance.  The
7916 default is probably sensible for your system.
7917 $also
7918
7919 EOM
7920         rp="Build a shared libperl.$so (y/n)"
7921         . ./myread
7922         case "$ans" in
7923         true|$define|[Yy]*)
7924                 useshrplib='true'  ;;
7925         *)      useshrplib='false' ;;
7926         esac
7927         ;;
7928 esac
7929
7930 case "$useshrplib" in
7931 true)
7932         case "$libperl" in
7933         '')
7934                 # Figure out a good name for libperl.so.  Since it gets stored in
7935                 # a version-specific architecture-dependent library, the version
7936                 # number isn't really that important, except for making cc/ld happy.
7937                 #
7938                 # A name such as libperl.so.3.1
7939                 majmin="libperl.$so.$patchlevel.$subversion"
7940                 # A name such as libperl.so.301
7941                 majonly=`echo $patchlevel $subversion |
7942                         $awk '{printf "%d%02d", $1, $2}'`
7943                 majonly=libperl.$so.$majonly
7944                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7945                 # rely on figuring it out from the naming of libc.
7946                 case "${osname}${osvers}" in
7947                 next4*)
7948                         dflt=libperl.5.$so
7949                         # XXX How handle the --version stuff for MAB?
7950                         ;;
7951                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7952                         dflt=libperl.$so
7953                         ;;
7954                 cygwin*) # ld links against an importlib
7955                         dflt=libperl$lib_ext
7956                         ;;
7957                 *)      # Try to guess based on whether libc has major.minor.
7958                         case "$libc" in
7959                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7960                         *libc.$so.[0-9]*) dflt=$majonly ;;
7961                         *)      dflt=libperl.$so ;;
7962                         esac
7963                         ;;
7964                 esac
7965                 ;;
7966         *)      dflt=$libperl
7967                 ;;
7968         esac
7969         cat << EOM
7970
7971 I need to select a good name for the shared libperl.  If your system uses
7972 library names with major and minor numbers, then you might want something
7973 like $majmin.  Alternatively, if your system uses a single version
7974 number for shared libraries, then you might want to use $majonly.
7975 Or, your system might be quite happy with a simple libperl.$so.
7976
7977 Since the shared libperl will get installed into a version-specific
7978 architecture-dependent directory, the version number of the shared perl
7979 library probably isn't important, so the default should be o.k.
7980
7981 EOM
7982         rp='What name do you want to give to the shared libperl?'
7983         . ./myread
7984         libperl=$ans
7985         echo "Ok, I'll use $libperl"
7986         ;;
7987 *)
7988         libperl="libperl${_a}"
7989         ;;
7990 esac
7991
7992 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7993 case "$shrpdir" in
7994 '') ;;
7995 *)      $cat >&4 <<EOM
7996 WARNING:  Use of the shrpdir variable for the installation location of
7997 the shared $libperl is not supported.  It was never documented and
7998 will not work in this version.  Let me (perlbug@perl.org)
7999 know of any problems this may cause.
8000
8001 EOM
8002         case "$shrpdir" in
8003         "$archlibexp/CORE")
8004                 $cat >&4 <<EOM
8005 But your current setting of $shrpdir is
8006 the default anyway, so it's harmless.
8007 EOM
8008                 ;;
8009         *)
8010                 $cat >&4 <<EOM
8011 Further, your current attempted setting of $shrpdir
8012 conflicts with the value of $archlibexp/CORE
8013 that installperl will use.
8014 EOM
8015                 ;;
8016         esac
8017         ;;
8018 esac
8019
8020 # How will the perl executable find the installed shared $libperl?
8021 # Add $xxx to ccdlflags.
8022 # If we can't figure out a command-line option, use $shrpenv to
8023 # set env LD_RUN_PATH.  The main perl makefile uses this.
8024 shrpdir=$archlibexp/CORE
8025 xxx=''
8026 tmp_shrpenv=''
8027 if "$useshrplib"; then
8028     case "$osname" in 
8029         aix)
8030                 # We'll set it in Makefile.SH...
8031                 ;;
8032         solaris)
8033                 xxx="-R $shrpdir"
8034                 ;;
8035         freebsd|netbsd|openbsd|interix|dragonfly)
8036                 xxx="-Wl,-R$shrpdir"
8037                 ;;
8038         bsdos|linux|irix*|dec_osf|gnu*)
8039                 xxx="-Wl,-rpath,$shrpdir"
8040                 ;;
8041         next)
8042                 # next doesn't like the default...
8043                 ;;
8044         beos)
8045                 # beos doesn't like the default, either.
8046                 ;;
8047         hpux*)
8048                 # hpux doesn't like the default, either.
8049                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8050                 ;;
8051         *)
8052                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8053                 ;;
8054         esac
8055         case "$xxx" in
8056         '') ;;
8057         *)      
8058                 # Only add $xxx if it isn't already in ccdlflags.
8059                 case " $ccdlflags " in
8060                 *" $xxx "*)     ;;
8061                 *)      ccdlflags="$ccdlflags $xxx"
8062                         cat <<EOM >&4
8063
8064 Adding $xxx to the flags
8065 passed to $ld so that the perl executable will find the 
8066 installed shared $libperl.
8067
8068 EOM
8069                         ;;
8070                 esac
8071                 ;;
8072         esac
8073 fi
8074 # Fix ccdlflags in AIX for building external extensions.
8075 # (For building Perl itself bare -bE:perl.exp is needed,
8076 #  Makefile.SH takes care of this.)
8077 case "$osname" in
8078 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8079 esac
8080 # Respect a hint or command-line value.
8081 case "$shrpenv" in
8082 '') shrpenv="$tmp_shrpenv" ;;
8083 esac
8084 case "$ldlibpthname" in
8085 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8086 none)   ldlibpthname='' ;;
8087 esac
8088
8089 : determine where manual pages are on this system
8090 echo " "
8091 case "$sysman" in
8092 '') 
8093         syspath='/usr/share/man/man1 /usr/man/man1'
8094         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8095         syspath="$syspath /usr/man/u_man/man1"
8096         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8097         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8098         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8099         sysman=`./loc . /usr/man/man1 $syspath`
8100         ;;
8101 esac
8102 if $test -d "$sysman"; then
8103         echo "System manual is in $sysman." >&4
8104 else
8105         echo "Could not find manual pages in source form." >&4
8106 fi
8107
8108 : determine where manual pages go
8109 set man1dir man1dir none
8110 eval $prefixit
8111 $cat <<EOM
8112
8113 $spackage has manual pages available in source form.
8114 EOM
8115 case "$nroff" in
8116 nroff)
8117         echo "However, you don't have nroff, so they're probably useless to you."
8118         case "$man1dir" in
8119         '') man1dir="none";;
8120         esac;;
8121 esac
8122 echo "If you don't want the manual sources installed, answer 'none'."
8123 case "$man1dir" in
8124 ' ') dflt=none
8125         ;;
8126 '')
8127         lookpath="$prefixexp/share/man/man1"
8128         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8129         lookpath="$lookpath $prefixexp/man/p_man/man1"
8130         lookpath="$lookpath $prefixexp/man/u_man/man1"
8131         lookpath="$lookpath $prefixexp/man/man.1"
8132         case "$sysman" in
8133         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8134         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8135         esac
8136         set dflt
8137         eval $prefixup
8138         ;;
8139 *)  dflt="$man1dir"
8140         ;;
8141 esac
8142 echo " "
8143 fn=dn+~
8144 rp="Where do the main $spackage manual pages (source) go?"
8145 . ./getfile
8146 if $test "X$man1direxp" != "X$ansexp"; then
8147         installman1dir=''
8148 fi
8149 prefixvar=man1dir
8150 . ./setprefixvar
8151
8152 case "$man1dir" in
8153 '')     man1dir=' '
8154         installman1dir='';;
8155 esac
8156
8157 : What suffix to use on installed man pages
8158
8159 case "$man1dir" in
8160 ' ')
8161         man1ext='0'
8162         ;;
8163 *)
8164         rp="What suffix should be used for the main $spackage man pages?"
8165         case "$man1ext" in
8166         '')     case "$man1dir" in
8167                 *1)  dflt=1 ;;
8168                 *1p) dflt=1p ;;
8169                 *1pm) dflt=1pm ;;
8170                 *l) dflt=l;;
8171                 *n) dflt=n;;
8172                 *o) dflt=o;;
8173                 *p) dflt=p;;
8174                 *C) dflt=C;;
8175                 *L) dflt=L;;
8176                 *L1) dflt=L1;;
8177                 *) dflt=1;;
8178                 esac
8179                 ;;
8180         *)      dflt="$man1ext";;
8181         esac
8182         . ./myread
8183         man1ext="$ans"
8184         ;;
8185 esac
8186
8187 : see if we can have long filenames
8188 echo " "
8189 first=123456789abcdef
8190 $rm -f $first
8191 if (echo hi >$first) 2>/dev/null; then
8192         if $test -f 123456789abcde; then
8193                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8194                 val="$undef"
8195         else
8196                 echo 'You can have filenames longer than 14 characters.'>&4
8197                 val="$define"
8198         fi
8199 else
8200         $cat <<'EOM'
8201 You can't have filenames longer than 14 chars.
8202 You can't even think about them!
8203 EOM
8204         val="$undef"
8205 fi 
8206 set d_flexfnam
8207 eval $setvar
8208 $rm -rf 123456789abcde*
8209
8210 : determine where library module manual pages go
8211 set man3dir man3dir none
8212 eval $prefixit
8213 $cat <<EOM
8214
8215 $spackage has manual pages for many of the library modules.
8216 EOM
8217
8218 case "$nroff" in
8219 nroff)
8220         $cat <<'EOM'
8221 However, you don't have nroff, so they're probably useless to you.
8222 EOM
8223         case "$man3dir" in
8224         '') man3dir="none";;
8225         esac;;
8226 esac
8227
8228 case "$d_flexfnam" in
8229 undef)
8230         $cat <<'EOM'
8231 However, your system can't handle the long file names like File::Basename.3.
8232 EOM
8233         case "$man3dir" in
8234         '') man3dir="none";;
8235         esac;;
8236 esac
8237
8238 echo "If you don't want the manual sources installed, answer 'none'."
8239 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8240 case "$man3dir" in
8241 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8242         if $test -d "$privlib/man/man3"; then
8243                 cat <<EOM >&4
8244
8245 WARNING:  Previous versions of perl installed man3 pages into
8246 $privlib/man/man3.  This version will suggest a
8247 new default of $dflt.
8248 EOM
8249                 tdflt=$dflt
8250                 dflt='n'
8251                 rp='Do you wish to preserve the old behavior?(y/n)'
8252                 . ./myread
8253                 case "$ans" in
8254                 y*) dflt="$privlib/man/man3" ;;
8255                 *)  dflt=$tdflt ;;
8256                 esac
8257     fi
8258         ;;
8259 *)      dflt="$man3dir" ;;
8260 esac
8261 case "$dflt" in
8262 ' ') dflt=none ;;
8263 esac
8264 echo " "
8265 fn=dn+~
8266 rp="Where do the $package library man pages (source) go?"
8267 . ./getfile
8268 prefixvar=man3dir
8269 . ./setprefixvar
8270
8271 case "$man3dir" in
8272 '')     man3dir=' '
8273         installman3dir='';;
8274 esac
8275
8276 : What suffix to use on installed man pages
8277 case "$man3dir" in
8278 ' ')
8279         man3ext='0'
8280         ;;
8281 *)
8282         rp="What suffix should be used for the $package library man pages?"
8283         case "$man3ext" in
8284         '')     case "$man3dir" in
8285                 *3)  dflt=3 ;;
8286                 *3p) dflt=3p ;;
8287                 *3pm) dflt=3pm ;;
8288                 *l) dflt=l;;
8289                 *n) dflt=n;;
8290                 *o) dflt=o;;
8291                 *p) dflt=p;;
8292                 *C) dflt=C;;
8293                 *L) dflt=L;;
8294                 *L3) dflt=L3;;
8295                 *) dflt=3;;
8296                 esac
8297                 ;;
8298         *)      dflt="$man3ext";;
8299         esac
8300         . ./myread
8301         man3ext="$ans"
8302         ;;
8303 esac
8304
8305 : see if we have to deal with yellow pages, now NIS.
8306 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8307         if $test -f /usr/etc/nibindd; then
8308                 echo " "
8309                 echo "I'm fairly confident you're on a NeXT."
8310                 echo " "
8311                 rp='Do you get the hosts file via NetInfo?'
8312                 dflt=y
8313                 case "$hostcat" in
8314                 nidump*) ;;
8315                 '') ;;
8316                 *) dflt=n;;
8317                 esac
8318                 . ./myread
8319                 case "$ans" in
8320                 y*) hostcat='nidump hosts .';;
8321                 *)      case "$hostcat" in
8322                         nidump*) hostcat='';;
8323                         esac
8324                         ;;
8325                 esac
8326         fi
8327         case "$hostcat" in
8328         nidump*) ;;
8329         *)
8330                 case "$hostcat" in
8331                 *ypcat*) dflt=y;;
8332                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8333                                 dflt=y
8334                         else
8335                                 dflt=n
8336                         fi;;
8337                 *) dflt=n;;
8338                 esac
8339                 echo " "
8340                 rp='Are you getting the hosts file via yellow pages?'
8341                 . ./myread
8342                 case "$ans" in
8343                 y*) hostcat='ypcat hosts';;
8344                 *) hostcat='cat /etc/hosts';;
8345                 esac
8346                 ;;
8347         esac
8348 fi
8349 case "$hostcat" in
8350 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8351 esac
8352 case "$groupcat" in
8353 '') test -f /etc/group && groupcat='cat /etc/group';;
8354 esac
8355 case "$passcat" in
8356 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8357 esac
8358
8359 : now get the host name
8360 echo " "
8361 echo "Figuring out host name..." >&4
8362 case "$myhostname" in
8363 '') cont=true
8364         echo 'Maybe "hostname" will work...'
8365         if tans=`sh -c hostname 2>&1` ; then
8366                 myhostname=$tans
8367                 phostname=hostname
8368                 cont=''
8369         fi
8370         ;;
8371 *) cont='';;
8372 esac
8373 if $test "$cont"; then
8374         if ./xenix; then
8375                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8376                 if tans=`cat /etc/systemid 2>&1` ; then
8377                         myhostname=$tans
8378                         phostname='cat /etc/systemid'
8379                         echo "Whadyaknow.  Xenix always was a bit strange..."
8380                         cont=''
8381                 fi
8382         elif $test -r /etc/systemid; then
8383                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8384         fi
8385 fi
8386 if $test "$cont"; then
8387         echo 'No, maybe "uuname -l" will work...'
8388         if tans=`sh -c 'uuname -l' 2>&1` ; then
8389                 myhostname=$tans
8390                 phostname='uuname -l'
8391         else
8392                 echo 'Strange.  Maybe "uname -n" will work...'
8393                 if tans=`sh -c 'uname -n' 2>&1` ; then
8394                         myhostname=$tans
8395                         phostname='uname -n'
8396                 else
8397                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8398                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8399                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8400                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8401                         else
8402                                 case "$myhostname" in
8403                                 '') echo "Does this machine have an identity crisis or something?"
8404                                         phostname='';;
8405                                 *)
8406                                         echo "Well, you said $myhostname before..."
8407                                         phostname='echo $myhostname';;
8408                                 esac
8409                         fi
8410                 fi
8411         fi
8412 fi
8413 case "$myhostname" in
8414 '') myhostname=noname ;;
8415 esac
8416 : you do not want to know about this
8417 set $myhostname
8418 myhostname=$1
8419
8420 : verify guess
8421 if $test "$myhostname" ; then
8422         dflt=y
8423         rp='Your host name appears to be "'$myhostname'".'" Right?"
8424         . ./myread
8425         case "$ans" in
8426         y*) ;;
8427         *) myhostname='';;
8428         esac
8429 fi
8430
8431 : bad guess or no guess
8432 while $test "X$myhostname" = X ; do
8433         dflt=''
8434         rp="Please type the (one word) name of your host:"
8435         . ./myread
8436         myhostname="$ans"
8437 done
8438
8439 : translate upper to lower if necessary
8440 case "$myhostname" in
8441 *[A-Z]*)
8442         echo "(Normalizing case in your host name)"
8443         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8444         ;;
8445 esac
8446
8447 case "$myhostname" in
8448 *.*)
8449         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8450         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8451         echo "(Trimming domain name from host name--host name is now $myhostname)"
8452         ;;
8453 *) case "$mydomain" in
8454         '')
8455                 {
8456                         test "X$hostcat" = "Xypcat hosts" &&
8457                         ypmatch "$myhostname" hosts 2>/dev/null |\
8458                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8459                         $test -s hosts
8460                 } || {
8461                         test "X$hostcat" != "X" &&
8462                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8463                                         /[       ]$myhostname[  . ]/p" > hosts
8464                 }
8465                 tmp_re="[       . ]"
8466                 if $test -f hosts; then
8467                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8468                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8469                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8470                                 hosts | $sort | $uniq | \
8471                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8472                         case `$echo X$dflt` in
8473                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8474                                 dflt=.
8475                                 ;;
8476                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8477                                 ;;
8478                         esac
8479                 else
8480                         echo "(I cannot locate a hosts database anywhere)"
8481                         dflt=.
8482                 fi
8483                 case "$dflt" in
8484                 .)
8485                         tans=`./loc resolv.conf X /etc /usr/etc`
8486                         if $test -f "$tans"; then
8487                                 echo "(Attempting domain name extraction from $tans)"
8488                                 dflt=.`$sed -n -e 's/   / /g' \
8489                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8490                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8491                                 case "$dflt" in
8492                                 .) dflt=.`$sed -n -e 's/        / /g' \
8493                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8494                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8495                                         ;;
8496                                 esac
8497                         fi
8498                         ;;
8499                 esac
8500                 case "$dflt" in
8501                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8502                         dflt=.`sh -c domainname 2>/dev/null`
8503                         case "$dflt" in
8504                         '') dflt='.';;
8505                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8506                         esac
8507                         ;;
8508                 esac
8509                 case "$dflt$osname" in
8510                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8511                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8512                         ;;
8513                 esac
8514                 case "$dflt" in
8515                 .) echo "(Lost all hope -- silly guess then)"
8516                         dflt='.nonet'
8517                         ;;
8518                 esac
8519                 $rm -f hosts
8520                 ;;
8521         *) dflt="$mydomain";;
8522         esac;;
8523 esac
8524 echo " "
8525 rp="What is your domain name?"
8526 . ./myread
8527 tans="$ans"
8528 case "$ans" in
8529 '') ;;
8530 .*) ;;
8531 *) tans=".$tans";;
8532 esac
8533 mydomain="$tans"
8534
8535 : translate upper to lower if necessary
8536 case "$mydomain" in
8537 *[A-Z]*)
8538         echo "(Normalizing case in your domain name)"
8539         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8540         ;;
8541 esac
8542
8543 : a little sanity check here
8544 case "$phostname" in
8545 '') ;;
8546 *)
8547         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8548         $myhostname$mydomain|$myhostname) ;;
8549         *)
8550                 case "$phostname" in
8551                 sed*)
8552                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8553                         ;;
8554                 *)
8555                         echo "(That doesn't agree with your $phostname command, by the way.)"
8556                         ;;
8557                 esac
8558         ;;
8559         esac
8560         ;;
8561 esac
8562
8563 $cat <<EOM
8564
8565 I need to get your e-mail address in Internet format if possible, i.e.
8566 something like user@host.domain. Please answer accurately since I have
8567 no easy means to double check it. The default value provided below
8568 is most probably close to reality but may not be valid from outside
8569 your organization...
8570
8571 EOM
8572 cont=x
8573 while test "$cont"; do
8574         case "$cf_email" in
8575         '') dflt="$cf_by@$myhostname$mydomain";;
8576         *) dflt="$cf_email";;
8577         esac
8578         rp='What is your e-mail address?'
8579         . ./myread
8580         cf_email="$ans"
8581         case "$cf_email" in
8582         *@*.*) cont='' ;;
8583         *)
8584                 rp='Address does not look like an Internet one.  Use it anyway?'
8585                 case "$fastread" in
8586                 yes) dflt=y ;;
8587                 *) dflt=n ;;
8588                 esac
8589                 . ./myread
8590                 case "$ans" in
8591                 y*) cont='' ;;
8592                 *) echo " " ;;
8593                 esac
8594                 ;;
8595         esac
8596 done
8597
8598 $cat <<EOM
8599
8600 If you or somebody else will be maintaining perl at your site, please
8601 fill in the correct e-mail address here so that they may be contacted
8602 if necessary. Currently, the "perlbug" program included with perl
8603 will send mail to this address in addition to perlbug@perl.org. You may
8604 enter "none" for no administrator.
8605
8606 EOM
8607 case "$perladmin" in
8608 '') dflt="$cf_email";;
8609 *) dflt="$perladmin";;
8610 esac
8611 rp='Perl administrator e-mail address'
8612 . ./myread
8613 perladmin="$ans"
8614
8615 : determine whether to only install version-specific parts.
8616 echo " "
8617 $cat <<EOM
8618 Do you want to install only the version-specific parts of the perl
8619 distribution?  Usually you do *not* want to do this.
8620 EOM
8621 case "$versiononly" in
8622 "$define"|[Yy]*|true) dflt='y' ;;
8623 *) dflt='n';
8624 esac
8625 rp="Do you want to install only the version-specific parts of perl?"
8626 . ./myread
8627 case "$ans" in
8628 [yY]*)  val="$define";;
8629 *)      val="$undef" ;;
8630 esac
8631 set versiononly
8632 eval $setvar
8633
8634 case "$versiononly" in
8635 "$define") inc_version_list=''
8636            inc_version_list_init=0
8637            ;;
8638 esac
8639
8640 : figure out how to guarantee perl startup
8641 : XXX Note that this currently takes advantage of the bug that binexp ignores
8642 :     the Configure -Dinstallprefix setting, which in turn means that under
8643 :     relocatable @INC, initialinstalllocation is what binexp started as.
8644 case "$startperl" in
8645 '')
8646         case "$sharpbang" in
8647         *!)
8648                 $cat <<EOH
8649
8650 I can use the #! construct to start perl on your system. This will
8651 make startup of perl scripts faster, but may cause problems if you
8652 want to share those scripts and perl is not in a standard place
8653 ($initialinstalllocation/perl) on all your platforms. The alternative
8654 is to force a shell by starting the script with a single ':' character.
8655
8656 EOH
8657                 case "$versiononly" in
8658                 "$define")      dflt="$initialinstalllocation/perl$version";;
8659                 *)              dflt="$initialinstalllocation/perl";;
8660                 esac
8661                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8662                 . ./myread
8663                 case "$ans" in
8664                 none)   startperl=": # use perl";;
8665                 *)      startperl="#!$ans"
8666                         if $test 30 -lt `echo "$ans" | wc -c`; then
8667                                 $cat >&4 <<EOM
8668
8669 WARNING:  Some systems limit the #! command to 32 characters.
8670 If you experience difficulty running Perl scripts with #!, try
8671 installing Perl in a directory with a shorter pathname.
8672
8673 EOM
8674                         fi ;;
8675                 esac
8676                 ;;
8677         *) startperl=": # use perl"
8678                 ;;
8679         esac
8680         ;;
8681 esac
8682 echo "I'll use $startperl to start perl scripts."
8683
8684 : figure best path for perl in scripts
8685 case "$perlpath" in
8686 '')
8687         case "$versiononly" in
8688         "$define")      perlpath="$initialinstalllocation/perl$version";;
8689         *)              perlpath="$initialinstalllocation/perl";;
8690         esac
8691         case "$startperl" in
8692         *!*) ;;
8693         *)
8694                 $cat <<EOH
8695
8696 I will use the "eval 'exec'" idiom to start Perl on your system.
8697 I can use the full path of your Perl binary for this purpose, but
8698 doing so may cause problems if you want to share those scripts and
8699 Perl is not always in a standard place ($initialinstalllocation/perl).
8700
8701 EOH
8702                 dflt="$initialinstalllocation/perl"
8703                 rp="What path shall I use in \"eval 'exec'\"?"
8704                 . ./myread
8705                 perlpath="$ans"
8706                 ;;
8707         esac
8708         ;;
8709 esac
8710 case "$startperl" in
8711 *!*)    ;;
8712 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8713 esac
8714
8715 : determine where public executable scripts go
8716 set scriptdir scriptdir
8717 eval $prefixit
8718 case "$scriptdir" in
8719 '')
8720         dflt="$bin"
8721         : guess some guesses
8722         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8723         $test -d /usr/share/bin     && dflt=/usr/share/bin
8724         $test -d /usr/local/script  && dflt=/usr/local/script
8725         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8726         $test -d $prefixexp/script  && dflt=$prefixexp/script
8727         set dflt
8728         eval $prefixup
8729         ;;
8730 *)  dflt="$scriptdir"
8731         ;;
8732 esac
8733 $cat <<EOM
8734
8735 Some installations have a separate directory just for executable scripts so
8736 that they can mount it across multiple architectures but keep the scripts in
8737 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8738 Or you might just lump your scripts in with all your other executables.
8739
8740 EOM
8741 fn=d~
8742 rp='Where do you keep publicly executable scripts?'
8743 . ./getfile
8744 if $test "X$ansexp" != "X$scriptdirexp"; then
8745         installscript=''
8746 fi
8747 installscriptdir=''
8748 prefixvar=scriptdir
8749 . ./setprefixvar
8750 : A little fix up for an irregularly named variable.
8751 installscript="$installscriptdir"
8752
8753 : determine where add-on public executables go
8754 case "$sitebin" in
8755 '')     dflt=$siteprefix/bin ;;
8756 *)      dflt=$sitebin ;;
8757 esac
8758 fn=d~
8759 rp='Pathname where the add-on public executables should be installed?'
8760 . ./getfile
8761 prefixvar=sitebin
8762 . ./setprefixvar
8763
8764 : determine where add-on html pages go
8765 : There is no standard location, so try to copy the previously-selected
8766 : directory structure for the core html pages.
8767 case "$sitehtml1dir" in
8768 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8769 *)     dflt=$sitehtml1dir ;;
8770 esac
8771 case "$dflt" in
8772 ''|' ') dflt=none ;;
8773 esac
8774 fn=dn+~
8775 rp='Pathname where the site-specific html pages should be installed?'
8776 . ./getfile
8777 prefixvar=sitehtml1dir
8778 . ./setprefixvar
8779
8780 : determine where add-on library html pages go
8781 : There is no standard location, so try to copy the previously-selected
8782 : directory structure for the core html pages.
8783 case "$sitehtml3dir" in
8784 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8785 *)     dflt=$sitehtml3dir ;;
8786 esac
8787 case "$dflt" in
8788 ''|' ') dflt=none ;;
8789 esac
8790 fn=dn+~
8791 rp='Pathname where the site-specific library html pages should be installed?'
8792 . ./getfile
8793 prefixvar=sitehtml3dir
8794 . ./setprefixvar
8795
8796 : determine where add-on manual pages go
8797 case "$siteman1dir" in
8798 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8799 *)      dflt=$siteman1dir ;;
8800 esac
8801 case "$dflt" in
8802 ''|' ') dflt=none ;;
8803 esac
8804 fn=dn+~
8805 rp='Pathname where the site-specific manual pages should be installed?'
8806 . ./getfile
8807 prefixvar=siteman1dir
8808 . ./setprefixvar
8809
8810 : determine where add-on library man pages go
8811 case "$siteman3dir" in
8812 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8813 *)      dflt=$siteman3dir ;;
8814 esac
8815 case "$dflt" in
8816 ''|' ') dflt=none ;;
8817 esac
8818 fn=dn+~
8819 rp='Pathname where the site-specific library manual pages should be installed?'
8820 . ./getfile
8821 prefixvar=siteman3dir
8822 . ./setprefixvar
8823
8824 : determine where add-on public executable scripts go
8825 case "$sitescript" in
8826 '')     dflt=$siteprefix/script
8827         $test -d $dflt || dflt=$sitebin ;;
8828 *)  dflt="$sitescript" ;;
8829 esac
8830 fn=d~+
8831 rp='Pathname where add-on public executable scripts should be installed?'
8832 . ./getfile
8833 prefixvar=sitescript
8834 . ./setprefixvar
8835
8836 case "$usefaststdio" in
8837 $define|true|[yY]*|'')
8838         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8839         case "$xversion" in
8840         [68])   dflt='y' ;;
8841         *)      dflt='n' ;;
8842         esac
8843         ;;
8844 *) dflt='n';;
8845 esac
8846 cat <<EOM
8847
8848 Perl can be built to use 'fast stdio', which means using the stdio
8849 library but also directly manipulating the stdio buffers to enable
8850 faster I/O.  Using stdio is better for backward compatibility (especially
8851 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8852 interface has been preferred instead of stdio.
8853
8854 If this doesn't make any sense to you, just accept the default '$dflt'.
8855 EOM
8856 rp='Use the "fast stdio" if available?'
8857 . ./myread
8858 case "$ans" in
8859 y|Y)    val="$define" ;;     
8860 *)      val="$undef" ;;
8861 esac
8862 set usefaststdio
8863 eval $setvar
8864
8865
8866 : define an is-a-typedef? function
8867 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8868 case "$inclist" in
8869 "") inclist="sys/types.h";;
8870 esac;
8871 eval "varval=\$$var";
8872 case "$varval" in
8873 "")
8874         $rm -f temp.c;
8875         for inc in $inclist; do
8876                 echo "#include <$inc>" >>temp.c;
8877         done;
8878         echo "#ifdef $type" >> temp.c;
8879         echo "printf(\"We have $type\");" >> temp.c;
8880         echo "#endif" >> temp.c;
8881         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8882         if $contains $type temp.E >/dev/null 2>&1; then
8883                 eval "$var=\$type";
8884         else
8885                 eval "$var=\$def";
8886         fi;
8887         $rm -f temp.?;;
8888 *) eval "$var=\$varval";;
8889 esac'
8890
8891 : define an is-a-typedef? function that prompts if the type is not available.
8892 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8893 case "$inclist" in
8894 "") inclist="sys/types.h";;
8895 esac;
8896 eval "varval=\$$var";
8897 case "$varval" in
8898 "")
8899         $rm -f temp.c;
8900         for inc in $inclist; do
8901                 echo "#include <$inc>" >>temp.c;
8902         done;
8903         echo "#ifdef $type" >> temp.c;
8904         echo "printf(\"We have $type\");" >> temp.c;
8905         echo "#endif" >> temp.c;
8906         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8907         echo " " ;
8908         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8909         if $contains $type temp.E >/dev/null 2>&1; then
8910                 echo "$type found." >&4;
8911                 eval "$var=\$type";
8912         else
8913                 echo "$type NOT found." >&4;
8914                 dflt="$def";
8915                 . ./myread ;
8916                 eval "$var=\$ans";
8917         fi;
8918         $rm -f temp.?;;
8919 *) eval "$var=\$varval";;
8920 esac'
8921
8922 : see what type lseek is declared as in the kernel
8923 rp="What is the type used for lseek's offset on this system?"
8924 set off_t lseektype long stdio.h sys/types.h
8925 eval $typedef_ask
8926
8927 echo " "
8928 echo "Checking to see how big your file offsets are..." >&4
8929 $cat >try.c <<EOCP
8930 #include <sys/types.h>
8931 #include <stdio.h>
8932 int main()
8933 {
8934     printf("%d\n", (int)sizeof($lseektype));
8935     return(0); 
8936 }
8937 EOCP
8938 set try
8939 if eval $compile_ok; then
8940         lseeksize=`$run ./try`
8941         echo "Your file offsets are $lseeksize bytes long."
8942 else
8943         dflt=$longsize
8944         echo " "
8945         echo "(I can't seem to compile the test program.  Guessing...)"
8946         rp="What is the size of your file offsets (in bytes)?"
8947         . ./myread
8948         lseeksize="$ans"
8949 fi
8950 $rm -f try.c try
8951
8952 : see what type file positions are declared as in the library
8953 rp="What is the type for file position used by fsetpos()?"
8954 set fpos_t fpostype long stdio.h sys/types.h
8955 eval $typedef_ask
8956
8957 echo " "
8958 case "$fpostype" in
8959 *_t) zzz="$fpostype"    ;;
8960 *)   zzz="fpos_t"       ;;
8961 esac
8962 echo "Checking the size of $zzz..." >&4 
8963 cat > try.c <<EOCP
8964 #include <sys/types.h>
8965 #include <stdio.h>
8966 #$i_stdlib I_STDLIB
8967 #ifdef I_STDLIB
8968 #include <stdlib.h>
8969 #endif
8970 int main() {
8971     printf("%d\n", (int)sizeof($fpostype));
8972     exit(0);
8973 }
8974 EOCP
8975 set try
8976 if eval $compile_ok; then
8977         yyy=`$run ./try`
8978         case "$yyy" in
8979         '')     fpossize=4
8980                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8981                 ;;
8982         *)      fpossize=$yyy
8983                 echo "Your $zzz is $fpossize bytes long."
8984                 ;;
8985         esac
8986 else
8987         dflt="$longsize"
8988         echo " " >&4
8989         echo "(I can't compile the test program.  Guessing...)" >&4
8990         rp="What is the size of your file positions (in bytes)?"
8991         . ./myread
8992         fpossize="$ans"
8993 fi
8994
8995 # Backward compatibility (uselfs is deprecated).
8996 case "$uselfs" in
8997 "$define"|true|[yY]*)
8998         cat <<EOM >&4
8999
9000 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9001 EOM
9002         uselargefiles="$define"
9003         ;;
9004 esac                          
9005
9006 case "$lseeksize:$fpossize" in
9007 8:8) cat <<EOM
9008
9009 You can have files larger than 2 gigabytes.
9010 EOM
9011    val="$define" ;;
9012 *)    case "$uselargefiles" in
9013    "$undef"|false|[nN]*) dflt='n' ;;
9014    *)   dflt='y' ;;
9015    esac
9016    cat <<EOM
9017
9018 Perl can be built to understand large files (files larger than 2 gigabytes)
9019 on some systems.  To do so, Configure can be run with -Duselargefiles.
9020
9021 If this doesn't make any sense to you, just accept the default '$dflt'.
9022 EOM
9023    rp='Try to understand large files, if available?'
9024    . ./myread
9025    case "$ans" in
9026    y|Y)         val="$define" ;;
9027    *)           val="$undef"  ;;
9028    esac
9029    ;;
9030 esac
9031 set uselargefiles
9032 eval $setvar
9033 : Look for a hint-file generated 'call-back-unit'.  If the
9034 : user has specified that a large files perl is to be built,
9035 : we may need to set or change some other defaults.
9036 if $test -f uselargefiles.cbu; then
9037         echo "Your platform has some specific hints regarding large file builds, using them..."
9038         . ./uselargefiles.cbu
9039 fi
9040 case "$uselargefiles" in
9041 "$define")
9042         if $test -f uselargefiles.cbu; then
9043                 echo " "
9044                 echo "Rechecking to see how big your file offsets are..." >&4
9045                 $cat >try.c <<EOCP
9046 #include <sys/types.h>
9047 #include <stdio.h>
9048 int main()
9049 {
9050     printf("%d\n", (int)sizeof($lseektype));
9051     return(0); 
9052 }
9053 EOCP
9054                 set try
9055                 if eval $compile_ok; then
9056                         lseeksize=`$run ./try`
9057                         $echo "Your file offsets are now $lseeksize bytes long."
9058                 else
9059                         dflt="$lseeksize"
9060                         echo " "
9061                         echo "(I can't seem to compile the test program.  Guessing...)"
9062                         rp="What is the size of your file offsets (in bytes)?"
9063                         . ./myread
9064                         lseeksize="$ans"
9065                 fi
9066                 case "$fpostype" in
9067                 *_t) zzz="$fpostype"    ;;
9068                 *)   zzz="fpos_t"       ;;
9069                 esac
9070                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9071                 $cat > try.c <<EOCP
9072 #include <sys/types.h>
9073 #include <stdio.h>
9074 #$i_stdlib I_STDLIB
9075 #ifdef I_STDLIB
9076 #include <stdlib.h>
9077 #endif
9078 int main() {
9079     printf("%d\n", (int)sizeof($fpostype));
9080     return(0);
9081 }
9082 EOCP
9083                 set try
9084                 if eval $compile_ok; then
9085                         yyy=`$run ./try`
9086                         dflt="$lseeksize"
9087                         case "$yyy" in
9088                         '')     echo " "
9089                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9090                                 ;;
9091                         *)      fpossize=$yyy
9092                                 echo " $fpossize bytes." >&4
9093                                 ;;
9094                         esac
9095                 else
9096                         dflt="$fpossize"
9097                         echo " "
9098                         echo "(I can't compile the test program.  Guessing...)" >&4
9099                         rp="What is the size of your file positions (in bytes)?"
9100                         . ./myread
9101                         fpossize="$ans"
9102                 fi
9103                 $rm -f try.c try
9104         fi
9105         ;;
9106 esac
9107
9108 case "$vendorprefix" in
9109 '')     d_vendorbin="$undef"
9110         vendorbin=''
9111         vendorbinexp=''
9112         ;;
9113 *)      d_vendorbin="$define"
9114         : determine where vendor-supplied executables go.
9115         case "$vendorbin" in
9116         '') dflt=$vendorprefix/bin ;;
9117         *)      dflt="$vendorbin" ;;
9118         esac
9119         fn=d~+
9120         rp='Pathname for the vendor-supplied executables directory?'
9121         . ./getfile
9122         vendorbin="$ans"
9123         vendorbinexp="$ansexp"
9124         ;;
9125 esac
9126 prefixvar=vendorbin
9127 . ./installprefix
9128
9129 case "$vendorprefix" in
9130 '')     vendorhtml1dir=''
9131         vendorhtml1direxp=''
9132         ;;
9133 *)      : determine where vendor-supplied 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 "$vendorhtml1dir" in
9138         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9139         *)      dflt=$vendorhtml1dir ;;
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         vendorhtml1dir="$ans"
9148         vendorhtml1direxp="$ansexp"
9149         ;;
9150 esac
9151 : Use ' ' for none so value is preserved next time through Configure
9152 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9153 prefixvar=vendorhtml1dir
9154 . ./installprefix
9155
9156 case "$vendorprefix" in
9157 '')     vendorhtml3dir=''
9158         vendorhtml3direxp=''
9159         ;;
9160 *)      : determine where vendor-supplied module html pages go.
9161         : There is no standard location, so try to copy the previously-selected
9162         : directory structure for the core html pages.
9163         : XXX Better default suggestions would be welcome.
9164         case "$vendorhtml3dir" in
9165         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9166         *)      dflt=$vendorhtml3dir ;;
9167         esac
9168         case "$dflt" in
9169         ''|' ') dflt=none ;;
9170         esac
9171         fn=dn+~
9172         rp='Pathname for the vendor-supplied html pages?'
9173         . ./getfile
9174         vendorhtml3dir="$ans"
9175         vendorhtml3direxp="$ansexp"
9176         ;;
9177 esac
9178 : Use ' ' for none so value is preserved next time through Configure
9179 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9180 prefixvar=vendorhtml3dir
9181 . ./installprefix
9182
9183 case "$vendorprefix" in
9184 '')     vendorman1dir=''
9185         vendorman1direxp=''
9186         ;;
9187 *)      : determine where vendor-supplied manual pages go.
9188         case "$vendorman1dir" in
9189         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9190         *)      dflt=$vendorman1dir ;;
9191         esac
9192         case "$dflt" in
9193         ''|' ') dflt=none ;;
9194         esac
9195         fn=nd~+
9196         rp='Pathname for the vendor-supplied manual section 1 pages?'
9197         . ./getfile
9198         vendorman1dir="$ans"
9199         vendorman1direxp="$ansexp"
9200         ;;
9201 esac
9202 : Use ' ' for none so value is preserved next time through Configure
9203 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9204 prefixvar=vendorman1dir
9205 . ./installprefix
9206
9207 case "$vendorprefix" in
9208 '')     vendorman3dir=''
9209         vendorman3direxp=''
9210         ;;
9211 *)      : determine where vendor-supplied module manual pages go.
9212         case "$vendorman3dir" in
9213         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9214         *)      dflt=$vendorman3dir ;;
9215         esac
9216         case "$dflt" in
9217         ''|' ') dflt=none ;;
9218         esac
9219         fn=nd~+
9220         rp='Pathname for the vendor-supplied manual section 3 pages?'
9221         . ./getfile
9222         vendorman3dir="$ans"
9223         vendorman3direxp="$ansexp"
9224         ;;
9225 esac
9226 : Use ' ' for none so value is preserved next time through Configure
9227 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9228 prefixvar=vendorman3dir
9229 . ./installprefix
9230
9231 case "$vendorprefix" in
9232 '')     d_vendorscript="$undef"
9233         vendorscript=''
9234         vendorscriptexp=''
9235         ;;
9236 *)      d_vendorscript="$define"
9237         : determine where vendor-supplied scripts go.
9238         case "$vendorscript" in
9239         '')     dflt=$vendorprefix/script
9240                 $test -d $dflt || dflt=$vendorbin ;;
9241         *)  dflt="$vendorscript" ;;
9242         esac
9243         $cat <<EOM
9244
9245 The installation process will create a directory for
9246 vendor-supplied scripts.
9247
9248 EOM
9249         fn=d~+
9250         rp='Pathname for the vendor-supplied scripts directory?'
9251         . ./getfile
9252         vendorscript="$ans"
9253         vendorscriptexp="$ansexp"
9254         ;;
9255 esac
9256 prefixvar=vendorscript
9257 . ./installprefix
9258
9259 : see if qgcvt exists
9260 set qgcvt d_qgcvt
9261 eval $inlibc
9262
9263 echo " "
9264
9265 if $test X"$d_longdbl" = X"$define"; then
9266
9267 echo "Checking how to print long doubles..." >&4
9268
9269 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9270         $cat >try.c <<'EOCP'
9271 #include <sys/types.h>
9272 #include <stdio.h>
9273 int main() {
9274   double d = 123.456;
9275   printf("%.3f\n", d);
9276 }
9277 EOCP
9278         set try
9279         if eval $compile; then
9280                 yyy=`$run ./try`
9281                 case "$yyy" in
9282                 123.456)
9283                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9284                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9285                         echo "We will use %f."
9286                         ;;
9287                 esac
9288         fi
9289 fi
9290
9291 if $test X"$sPRIfldbl" = X; then
9292         $cat >try.c <<'EOCP'
9293 #include <sys/types.h>
9294 #include <stdio.h>
9295 int main() {
9296   long double d = 123.456;
9297   printf("%.3Lf\n", d);
9298 }
9299 EOCP
9300         set try
9301         if eval $compile; then
9302                 yyy=`$run ./try`
9303                 case "$yyy" in
9304                 123.456)
9305                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9306                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9307                         echo "We will use %Lf."
9308                         ;;
9309                 esac
9310         fi
9311 fi
9312
9313 if $test X"$sPRIfldbl" = X; then
9314         $cat >try.c <<'EOCP'
9315 #include <sys/types.h>
9316 #include <stdio.h>
9317 int main() {
9318   long double d = 123.456;
9319   printf("%.3llf\n", d);
9320 }
9321 EOCP
9322         set try
9323         if eval $compile; then
9324                 yyy=`$run ./try`
9325                 case "$yyy" in
9326                 123.456)
9327                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9328                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9329                         echo "We will use %llf."
9330                         ;;
9331                 esac
9332         fi
9333 fi
9334
9335 if $test X"$sPRIfldbl" = X; then
9336         $cat >try.c <<'EOCP'
9337 #include <sys/types.h>
9338 #include <stdio.h>
9339 int main() {
9340   long double d = 123.456;
9341   printf("%.3lf\n", d);
9342 }
9343 EOCP
9344         set try
9345         if eval $compile; then
9346                 yyy=`$run ./try`
9347                 case "$yyy" in
9348                 123.456)
9349                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9350                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9351                         echo "We will use %lf."
9352                         ;;
9353                 esac
9354         fi
9355 fi
9356
9357 if $test X"$sPRIfldbl" = X; then
9358         echo "Cannot figure out how to print long doubles." >&4
9359 else
9360         sSCNfldbl=$sPRIfldbl    # expect consistency
9361 fi
9362
9363 $rm -f try try.*
9364
9365 fi # d_longdbl
9366
9367 case "$sPRIfldbl" in
9368 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9369         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9370         d_SCNfldbl="$undef";
9371         ;;
9372 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9373         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9374         d_SCNfldbl="$define";
9375         ;;
9376 esac
9377
9378 : Check how to convert floats to strings.
9379
9380 if test "X$d_Gconvert" = X; then
9381
9382 echo " "
9383 echo "Checking for an efficient way to convert floats to strings."
9384 echo " " > try.c
9385 case "$uselongdouble" in
9386 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9387 esac
9388 case "$d_longdbl" in
9389 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9390 esac
9391 case "$d_PRIgldbl" in
9392 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9393 esac
9394 $cat >>try.c <<EOP
9395 #ifdef TRY_gconvert
9396 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9397 char *myname = "gconvert";
9398 #endif
9399 #ifdef TRY_gcvt
9400 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9401 char *myname = "gcvt";
9402 #endif
9403 #ifdef TRY_qgcvt
9404 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9405 char *myname = "qgcvt";
9406 #define DOUBLETYPE long double
9407 #endif
9408 #ifdef TRY_sprintf
9409 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9410 #ifdef HAS_PRIgldbl
9411 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9412 #else
9413 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9414 #endif
9415 #else
9416 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9417 #endif
9418 char *myname = "sprintf";
9419 #endif
9420
9421 #ifndef DOUBLETYPE
9422 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9423 #define DOUBLETYPE long double
9424 #else
9425 #define DOUBLETYPE double
9426 #endif
9427 #endif
9428
9429 #include <stdio.h>
9430
9431 #define I_STDLIB $i_stdlib
9432 #ifdef I_STDLIB
9433 #include <stdlib.h>
9434 #endif
9435
9436 int
9437 checkit(expect, got)
9438 char *expect;
9439 char *got;
9440 {
9441     if (strcmp(expect, got)) {
9442                 printf("%s oddity:  Expected %s, got %s\n",
9443                         myname, expect, got);
9444                 exit(1);
9445         }
9446 }
9447
9448 int main()
9449
9450         char buf[64]; 
9451         buf[63] = '\0';
9452
9453         /* This must be 1st test on (which?) platform */
9454         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9455         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9456         checkit("0.1", buf);
9457
9458         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9459         checkit("0.01", buf);
9460
9461         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9462         checkit("0.001", buf);
9463
9464         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9465         checkit("0.0001", buf);
9466
9467         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9468         if (strlen(buf) > 5)
9469             checkit("9e-005", buf); /* for Microsoft ?? */
9470         else
9471             checkit("9e-05", buf);
9472
9473         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9474         checkit("1", buf);
9475
9476         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9477         checkit("1.1", buf);
9478
9479         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9480         checkit("1.01", buf);
9481
9482         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9483         checkit("1.001", buf);
9484
9485         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9486         checkit("1.0001", buf);
9487
9488         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9489         checkit("1.00001", buf);
9490
9491         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9492         checkit("1.000001", buf);
9493
9494         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9495         checkit("0", buf);
9496
9497         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9498         checkit("-1", buf);
9499
9500         /* Some Linux gcvt's give 1.e+5 here. */
9501         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9502         checkit("100000", buf);
9503         
9504         /* Some Linux gcvt's give -1.e+5 here. */
9505         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9506         checkit("-100000", buf);
9507
9508         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9509         checkit("123.456", buf);
9510
9511         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9512         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9513         /* 34 should be enough to scare even long double
9514          * places into using the e notation. */
9515         if (strlen(buf) > 5)
9516             checkit("1e+034", buf); /* for Microsoft */
9517         else
9518             checkit("1e+34", buf);
9519
9520         /* For Perl, if you add additional tests here, also add them to
9521          * t/base/num.t for benefit of platforms not using Configure or
9522          * overriding d_Gconvert */
9523
9524         exit(0);
9525 }
9526 EOP
9527 : first add preferred functions to our list
9528 xxx_list=""
9529 for xxx_convert in $gconvert_preference; do
9530     case $xxx_convert in
9531     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9532     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9533     esac 
9534 done
9535 : then add any others
9536 for xxx_convert in gconvert gcvt sprintf; do
9537     case "$xxx_list" in
9538     *$xxx_convert*) ;;
9539     *) xxx_list="$xxx_list $xxx_convert" ;;
9540     esac 
9541 done
9542
9543 case "$d_longdbl$uselongdouble" in
9544 "$define$define")
9545     : again, add prefered functions to our list first
9546     xxx_ld_list=""
9547     for xxx_convert in $gconvert_ld_preference; do
9548         case $xxx_convert in
9549         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9550         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9551         esac
9552     done
9553     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9554     for xxx_convert in qgcvt sprintf $xxx_list; do
9555         case "$xxx_ld_list" in
9556         $xxx_convert*|*" $xxx_convert"*) ;;
9557         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9558         esac
9559     done
9560     : if sprintf cannot do long doubles, move it to the end
9561     if test "$d_PRIgldbl" != "$define"; then
9562         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9563     fi
9564     : if no qgcvt, remove it
9565     if test "$d_qgcvt" != "$define"; then
9566         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9567     fi
9568     : use the ld_list
9569     xxx_list="$xxx_ld_list"
9570     ;;
9571 esac
9572
9573 for xxx_convert in $xxx_list; do
9574         echo "Trying $xxx_convert..."
9575         $rm -f try try$_o
9576         set try -DTRY_$xxx_convert
9577         if eval $compile; then
9578                 echo "$xxx_convert() found." >&4
9579                 if $run ./try; then
9580                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9581                         break;
9582                 else
9583                         echo "...But $xxx_convert didn't work as I expected."
9584                         xxx_convert=''
9585                 fi
9586         else
9587                 echo "$xxx_convert NOT found." >&4
9588         fi
9589 done
9590
9591 if test X$xxx_convert = X; then
9592     echo "*** WHOA THERE!!! ***" >&4
9593     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9594     xxx_convert=sprintf
9595 fi
9596
9597 case "$xxx_convert" in
9598 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9599 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9600 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9601 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9602    "$define$define$define")
9603       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9604    "$define$define$undef")
9605       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9606    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9607    esac
9608    ;;  
9609 esac
9610
9611 fi
9612
9613 : see if _fwalk exists
9614 set fwalk d__fwalk
9615 eval $inlibc
9616
9617 : Initialize h_fcntl
9618 h_fcntl=false
9619
9620 : Initialize h_sysfile
9621 h_sysfile=false
9622
9623 : access call always available on UNIX
9624 set access d_access
9625 eval $inlibc
9626
9627 : locate the flags for 'access()'
9628 case "$d_access" in
9629 "$define")
9630         echo " "
9631         $cat >access.c <<EOCP
9632 #include <sys/types.h>
9633 #ifdef I_FCNTL
9634 #include <fcntl.h>
9635 #endif
9636 #ifdef I_SYS_FILE
9637 #include <sys/file.h>
9638 #endif
9639 #ifdef I_UNISTD
9640 #include <unistd.h>
9641 #endif
9642 #$i_stdlib I_STDLIB
9643 #ifdef I_STDLIB
9644 #include <stdlib.h>
9645 #endif
9646 int main() {
9647         exit(R_OK);
9648 }
9649 EOCP
9650         : check sys/file.h first, no particular reason here
9651         if $test `./findhdr sys/file.h` && \
9652                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9653                 h_sysfile=true;
9654                 echo "<sys/file.h> defines the *_OK access constants." >&4
9655         elif $test `./findhdr fcntl.h` && \
9656                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9657                 h_fcntl=true;
9658                 echo "<fcntl.h> defines the *_OK access constants." >&4
9659         elif $test `./findhdr unistd.h` && \
9660                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9661                 echo "<unistd.h> defines the *_OK access constants." >&4
9662         else
9663                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9664         fi
9665         ;;
9666 esac
9667 $rm -f access*
9668
9669 : see if accessx exists
9670 set accessx d_accessx
9671 eval $inlibc
9672
9673 : see if aintl exists
9674 set aintl d_aintl
9675 eval $inlibc
9676
9677 : see if alarm exists
9678 set alarm d_alarm
9679 eval $inlibc
9680
9681 : see if POSIX threads are available
9682 set pthread.h i_pthread
9683 eval $inhdr
9684
9685 : define a fucntion to check prototypes
9686 $cat > protochk <<EOSH
9687 $startsh
9688 cc="$cc"
9689 optimize="$optimize"
9690 ccflags="$ccflags"
9691 prototype="$prototype"
9692 define="$define"
9693 rm=$rm
9694 usethreads=$usethreads
9695 i_pthread=$i_pthread
9696 pthread_h_first=$pthread_h_first
9697 EOSH
9698
9699 $cat >> protochk <<'EOSH'
9700
9701 $rm -f try.c
9702 foo="$1"
9703 shift
9704 while test $# -ge 2; do
9705         case "$1" in
9706                 $define) echo "#include <$2>" >> try.c ;;
9707                 literal) echo "$2" >> try.c ;;
9708         esac
9709     # Extra magic for the benefit of systems that need pthread.h
9710     # to be included early to correctly detect threadsafe functions.
9711     # Such functions must guarantee themselves, though, that the usethreads
9712     # and i_pthread have been defined, before calling protochk.
9713     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9714         echo "#include <pthread.h>" >> try.c
9715         pthread_h_done=yes
9716     fi
9717     shift 2
9718 done
9719 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9720 cat >> try.c <<'EOCP'
9721 #ifdef CAN_PROTOTYPE
9722 #define _(args) args
9723 #else
9724 #define _(args) ()
9725 #endif
9726 EOCP
9727 echo "$foo" >> try.c
9728 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9729 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9730 status=$?
9731 $rm -f try.[co]
9732 exit $status
9733 EOSH
9734 chmod +x protochk
9735 $eunicefix protochk
9736
9737 hasproto='varname=$1; func=$2; 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 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9745 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9746         echo "$func() prototype found.";
9747         val="$define";
9748 else
9749         echo "$func() prototype NOT found.";
9750         val="$undef";
9751 fi;
9752 set $varname;
9753 eval $setvar;
9754 $rm -f try.c tryout.c'
9755
9756 : see if sys/types.h has to be included
9757 set sys/types.h i_systypes
9758 eval $inhdr
9759
9760 : see if sys/select.h has to be included
9761 set sys/select.h i_sysselct
9762 eval $inhdr
9763
9764 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9765 while $test $# -ge 2; do
9766         case "$1" in
9767         $define) echo "#include <$2>";;
9768         esac ;
9769     shift 2;
9770 done > try.c;
9771 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9772 set try;
9773 if eval $compile; then
9774         val="$define";
9775 else
9776         val="$undef";
9777 fi;
9778 set $varname;
9779 eval $setvar;
9780 $rm -f try.c try.o'
9781
9782 : see if we should include time.h, sys/time.h, or both
9783 echo " "
9784 if test "X$timeincl" = X; then
9785         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9786         $echo $n "I'm now running the test program...$c"
9787         $cat >try.c <<EOCP
9788 #include <sys/types.h>
9789 #ifdef I_TIME
9790 #include <time.h>
9791 #endif
9792 #ifdef I_SYSTIME
9793 #ifdef SYSTIMEKERNEL
9794 #define KERNEL
9795 #endif
9796 #include <sys/time.h>
9797 #endif
9798 #ifdef I_SYSSELECT
9799 #include <sys/select.h>
9800 #endif
9801 #$i_stdlib I_STDLIB
9802 #ifdef I_STDLIB
9803 #include <stdlib.h>
9804 #endif
9805 int main()
9806 {
9807         struct tm foo;
9808 #ifdef S_TIMEVAL
9809         struct timeval bar;
9810 #endif
9811 #ifdef S_TIMEZONE
9812         struct timezone tzp;
9813 #endif
9814         if (foo.tm_sec == foo.tm_sec)
9815                 exit(0);
9816 #ifdef S_TIMEVAL
9817         if (bar.tv_sec == bar.tv_sec)
9818                 exit(0);
9819 #endif
9820         exit(1);
9821 }
9822 EOCP
9823         flags=''
9824         for s_timezone in '-DS_TIMEZONE' ''; do
9825         sysselect=''
9826         for s_timeval in '-DS_TIMEVAL' ''; do
9827         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9828         for i_time in '' '-DI_TIME'; do
9829         for i_systime in '-DI_SYSTIME' ''; do
9830                 case "$flags" in
9831                 '') $echo $n ".$c"
9832                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9833                         if eval $compile; then
9834                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9835                                 shift
9836                                 flags="$*"
9837                                 echo " "
9838                                 $echo $n "Succeeded with $flags$c"
9839                         fi
9840                         ;;
9841                 esac
9842         done
9843         done
9844         done
9845         done
9846         done
9847         timeincl=''
9848         echo " "
9849         case "$flags" in
9850         *SYSTIMEKERNEL*) i_systimek="$define"
9851                 timeincl=`./findhdr sys/time.h`
9852                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9853         *) i_systimek="$undef";;
9854         esac
9855         case "$flags" in
9856         *I_TIME*) i_time="$define"
9857                 timeincl=`./findhdr time.h`" $timeincl"
9858                 echo "We'll include <time.h>." >&4;;
9859         *) i_time="$undef";;
9860         esac
9861         case "$flags" in
9862         *I_SYSTIME*) i_systime="$define"
9863                 timeincl=`./findhdr sys/time.h`" $timeincl"
9864                 echo "We'll include <sys/time.h>." >&4;;
9865         *) i_systime="$undef";;
9866         esac
9867         $rm -f try.c try
9868 fi
9869 : see if struct tm knows about tm_zone
9870 case "$i_systime$i_time" in
9871 *$define*) 
9872         echo " "
9873         echo "Checking to see if your struct tm has tm_zone field..." >&4
9874         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9875         eval $hasfield
9876         ;;
9877 *)      val="$undef"
9878         set d_tm_tm_zone
9879         eval $setvar
9880         ;;
9881 esac
9882 case "$d_tm_tm_zone" in
9883 "$define")      echo "Yes, it does."   ;;
9884 *)              echo "No, it doesn't." ;;
9885 esac
9886 : see if struct tm knows about tm_gmtoff
9887 case "$i_systime$i_time" in
9888 *$define*) 
9889         echo " "
9890         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9891         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9892         eval $hasfield
9893         ;;
9894 *)      val="$undef"
9895         set d_tm_tm_gmtoff
9896         eval $setvar
9897         ;;
9898 esac
9899 case "$d_tm_tm_gmtoff" in
9900 "$define")      echo "Yes, it does."   ;;
9901 *)              echo "No, it doesn't." ;;
9902 esac
9903
9904 : see if asctime_r exists
9905 set asctime_r d_asctime_r
9906 eval $inlibc
9907 case "$d_asctime_r" in
9908 "$define")
9909         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9910         case "$d_asctime_r_proto:$usethreads" in
9911         ":define")      d_asctime_r_proto=define
9912                 set d_asctime_r_proto asctime_r $hdrs
9913                 eval $hasproto ;;
9914         *)      ;;
9915         esac
9916         case "$d_asctime_r_proto" in
9917         define)
9918         case "$asctime_r_proto" in
9919         ''|0) try='char* asctime_r(const struct tm*, char*);'
9920         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9921         esac
9922         case "$asctime_r_proto" in
9923         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9924         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9925         esac
9926         case "$asctime_r_proto" in
9927         ''|0) try='int asctime_r(const struct tm*, char*);'
9928         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9929         esac
9930         case "$asctime_r_proto" in
9931         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9932         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9933         esac
9934         case "$asctime_r_proto" in
9935         ''|0)   d_asctime_r=undef
9936                 asctime_r_proto=0
9937                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9938         * )     case "$asctime_r_proto" in
9939                 REENTRANT_PROTO*) ;;
9940                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9941                 esac
9942                 echo "Prototype: $try" ;;
9943         esac
9944         ;;
9945         *)      case "$usethreads" in
9946                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9947                 esac
9948                 d_asctime_r=undef
9949                 asctime_r_proto=0
9950                 ;;
9951         esac
9952         ;;
9953 *)      asctime_r_proto=0
9954         ;;
9955 esac
9956
9957 : see if atolf exists
9958 set atolf d_atolf
9959 eval $inlibc
9960
9961 : see if atoll exists
9962 set atoll d_atoll
9963 eval $inlibc
9964
9965 : Look for GCC-style attribute format
9966 case "$d_attribute_format" in
9967 '')
9968 echo " "
9969 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9970 $cat >attrib.c <<'EOCP'
9971 #include <stdio.h>
9972 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9973 EOCP
9974 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9975         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9976                 echo "Your C compiler doesn't support __attribute__((format))."
9977                 val="$undef"
9978         else
9979                 echo "Your C compiler supports __attribute__((format))."
9980                 val="$define"
9981         fi
9982 else
9983         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9984         val="$undef"
9985 fi
9986 ;;
9987 *) val="$d_attribute_format" ;;
9988 esac
9989 set d_attribute_format
9990 eval $setvar
9991 $rm -f attrib*
9992
9993 : Look for GCC-style attribute format with null format allowed
9994 case "$d_printf_format_null" in
9995 '') case "$d_attribute_format" in
9996     $define)
9997         echo " "
9998         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
9999 $cat >attrib.c <<EOCP
10000 #include <stdio.h>
10001 #$i_stdlib I_STDLIB
10002 #ifdef I_STDLIB
10003 #include <stdlib.h>
10004 #endif
10005 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10006 int null_printf (char* pat,...) { return (int)pat; }
10007 int main () { exit(null_printf(NULL)); }
10008 EOCP
10009         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10010             : run the executable in case it produces a run-time warning
10011             if $run ./attrib >>attrib.out 2>&1; then
10012                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10013                     echo "Your C compiler doesn't allow __printf__ format to be null."
10014                     val="$undef"
10015                 else
10016                     echo "Your C compiler allows __printf__ format to be null."
10017                     val="$define"
10018                 fi
10019             else
10020             echo "Your C compiler executable failed with __printf__ format null."
10021             val="$undef"
10022         fi
10023     else
10024         echo "Your C compiler fails with __printf__ format null."
10025         val="$undef"
10026     fi
10027     ;;
10028     *)  val="$undef" ;;
10029     esac
10030 ;;
10031 *)  val="$d_printf_format_null" ;;
10032 esac
10033 set d_printf_format_null
10034 eval $setvar
10035 $rm -f attrib*
10036
10037 : Look for GCC-style attribute malloc
10038 case "$d_attribute_malloc" in
10039 '')
10040 echo " "
10041 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10042 $cat >attrib.c <<'EOCP'
10043 #include <stdio.h>
10044 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10045 EOCP
10046 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10047         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10048                 echo "Your C compiler doesn't support __attribute__((malloc))."
10049                 val="$undef"
10050         else
10051                 echo "Your C compiler supports __attribute__((malloc))."
10052                 val="$define"
10053         fi
10054 else
10055         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10056         val="$undef"
10057 fi
10058 ;;
10059 *) val="$d_attribute_malloc" ;;
10060 esac
10061 set d_attribute_malloc
10062 eval $setvar
10063 $rm -f attrib*
10064
10065 : Look for GCC-style attribute nonnull
10066 case "$d_attribute_nonnull" in
10067 '')
10068 echo " "
10069 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10070 $cat >attrib.c <<'EOCP'
10071 #include <stdio.h>
10072 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10073 EOCP
10074 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10075         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10076                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10077                 val="$undef"
10078         else
10079                 echo "Your C compiler supports __attribute__((nonnull))."
10080                 val="$define"
10081         fi
10082 else
10083         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10084         val="$undef"
10085 fi
10086 ;;
10087 *) val="$d_attribute_nonnull" ;;
10088 esac
10089 set d_attribute_nonnull
10090 eval $setvar
10091 $rm -f attrib*
10092
10093 : Look for GCC-style attribute noreturn
10094 case "$d_attribute_noreturn" in
10095 '')
10096 echo " "
10097 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10098 $cat >attrib.c <<'EOCP'
10099 #include <stdio.h>
10100 void fall_over_dead( void ) __attribute__((noreturn));
10101 EOCP
10102 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10103         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10104                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10105                 val="$undef"
10106         else
10107                 echo "Your C compiler supports __attribute__((noreturn))."
10108                 val="$define"
10109         fi
10110 else
10111         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10112         val="$undef"
10113 fi
10114 ;;
10115 *) val="$d_attribute_noreturn" ;;
10116 esac
10117 set d_attribute_noreturn
10118 eval $setvar
10119 $rm -f attrib*
10120
10121 : Look for GCC-style attribute pure
10122 case "$d_attribute_pure" in
10123 '')
10124 echo " "
10125 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10126 $cat >attrib.c <<'EOCP'
10127 #include <stdio.h>
10128 int square( int n ) __attribute__((pure));
10129 EOCP
10130 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10131         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10132                 echo "Your C compiler doesn't support __attribute__((pure))."
10133                 val="$undef"
10134         else
10135                 echo "Your C compiler supports __attribute__((pure))."
10136                 val="$define"
10137         fi
10138 else
10139         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10140         val="$undef"
10141 fi
10142 ;;
10143 *) val="$d_attribute_pure" ;;
10144 esac
10145 set d_attribute_pure
10146 eval $setvar
10147 $rm -f attrib*
10148
10149 : Look for GCC-style attribute unused
10150 case "$d_attribute_unused" in
10151 '')
10152 echo " "
10153 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10154 $cat >attrib.c <<'EOCP'
10155 #include <stdio.h>
10156 int do_something( int dummy __attribute__((unused)), int n );
10157 EOCP
10158 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10159         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10160                 echo "Your C compiler doesn't support __attribute__((unused))."
10161                 val="$undef"
10162         else
10163                 echo "Your C compiler supports __attribute__((unused))."
10164                 val="$define"
10165         fi
10166 else
10167         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10168         val="$undef"
10169 fi
10170 ;;
10171 *) val="$d_attribute_unused" ;;
10172 esac
10173 set d_attribute_unused
10174 eval $setvar
10175 $rm -f attrib*
10176
10177 : Look for GCC-style attribute warn_unused_result
10178 case "$d_attribute_warn_unused_result" in
10179 '')
10180 echo " "
10181 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10182 $cat >attrib.c <<'EOCP'
10183 #include <stdio.h>
10184 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10185 EOCP
10186 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10187         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10188                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10189                 val="$undef"
10190         else
10191                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10192                 val="$define"
10193         fi
10194 else
10195         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10196         val="$undef"
10197 fi
10198 ;;
10199 *) val="$d_attribute_warn_unused_result" ;;
10200 esac
10201 set d_attribute_warn_unused_result
10202 eval $setvar
10203 $rm -f attrib*
10204
10205 : see if bcmp exists
10206 set bcmp d_bcmp
10207 eval $inlibc
10208
10209 : see if bcopy exists
10210 set bcopy d_bcopy
10211 eval $inlibc
10212
10213 : see if getpgrp exists
10214 set getpgrp d_getpgrp
10215 eval $inlibc
10216
10217 case "$d_getpgrp" in
10218 "$define")
10219         echo " "
10220         echo "Checking to see which flavor of getpgrp is in use..."
10221         $cat >try.c <<EOP
10222 #$i_unistd I_UNISTD
10223 #include <sys/types.h>
10224 #ifdef I_UNISTD
10225 #  include <unistd.h>
10226 #endif
10227 #$i_stdlib I_STDLIB
10228 #ifdef I_STDLIB
10229 #include <stdlib.h>
10230 #endif
10231 int main()
10232 {
10233         if (getuid() == 0) {
10234                 printf("(I see you are running Configure as super-user...)\n");
10235                 setuid(1);
10236         }
10237 #ifdef TRY_BSD_PGRP
10238         if (getpgrp(1) == 0)
10239                 exit(0);
10240 #else
10241         if (getpgrp() > 0)
10242                 exit(0);
10243 #endif
10244         exit(1);
10245 }
10246 EOP
10247         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10248                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10249                 val="$define"
10250         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10251                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10252                 val="$undef"
10253         else
10254                 echo "I can't seem to compile and run the test program."
10255                 if ./usg; then
10256                         xxx="a USG one, i.e. you use getpgrp()."
10257                 else
10258                         # SVR4 systems can appear rather BSD-ish.
10259                         case "$i_unistd" in
10260                         $undef)
10261                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10262                                 val="$define"
10263                                 ;;
10264                         $define)
10265                                 xxx="probably a USG one, i.e. you use getpgrp()."
10266                                 val="$undef"
10267                                 ;;
10268                         esac
10269                 fi
10270                 echo "Assuming your getpgrp is $xxx" >&4
10271         fi
10272         ;;
10273 *) val="$undef";;
10274 esac
10275 set d_bsdgetpgrp
10276 eval $setvar
10277 $rm -f try try.*
10278
10279 : see if setpgrp exists
10280 set setpgrp d_setpgrp
10281 eval $inlibc
10282
10283 case "$d_setpgrp" in
10284 "$define")
10285         echo " "
10286         echo "Checking to see which flavor of setpgrp is in use..."
10287         $cat >try.c <<EOP
10288 #$i_unistd I_UNISTD
10289 #include <sys/types.h>
10290 #ifdef I_UNISTD
10291 #  include <unistd.h>
10292 #endif
10293 #$i_stdlib I_STDLIB
10294 #ifdef I_STDLIB
10295 #include <stdlib.h>
10296 #endif
10297 int main()
10298 {
10299         if (getuid() == 0) {
10300                 printf("(I see you are running Configure as super-user...)\n");
10301                 setuid(1);
10302         }
10303 #ifdef TRY_BSD_PGRP
10304         if (-1 == setpgrp(1, 1))
10305                 exit(0);
10306 #else
10307         if (setpgrp() != -1)
10308                 exit(0);
10309 #endif
10310         exit(1);
10311 }
10312 EOP
10313         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10314                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10315                 val="$define"
10316         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10317                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10318                 val="$undef"
10319         else
10320                 echo "(I can't seem to compile and run the test program.)"
10321                 if ./usg; then
10322                         xxx="a USG one, i.e. you use setpgrp()."
10323                 else
10324                         # SVR4 systems can appear rather BSD-ish.
10325                         case "$i_unistd" in
10326                         $undef)
10327                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10328                                 val="$define"
10329                                 ;;
10330                         $define)
10331                                 xxx="probably a USG one, i.e. you use setpgrp()."
10332                                 val="$undef"
10333                                 ;;
10334                         esac
10335                 fi
10336                 echo "Assuming your setpgrp is $xxx" >&4
10337         fi
10338         ;;
10339 *) val="$undef";;
10340 esac
10341 set d_bsdsetpgrp
10342 eval $setvar
10343 $rm -f try try.*
10344 : Look for GCC-style __builtin_choose_expr
10345 case "$d_builtin_choose_expr" in
10346 '')
10347     echo " "
10348     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10349     $cat >try.c <<'EOCP'
10350 #include <assert.h>
10351 #include <stdlib.h>
10352 #include <stdio.h>
10353
10354 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10355
10356 int main(void) {
10357     assert( SYRINX(1) == 2112 );
10358     assert( SYRINX(1) != 5150 );
10359     assert( SYRINX(0) == 5150 );
10360     assert( SYRINX(0) != 2112 );
10361     puts( "All good!" );
10362     exit(0);
10363 }
10364
10365 EOCP
10366     set try
10367     if eval $compile; then
10368         echo "Your C compiler supports __builtin_choose_expr."
10369         val="$define"
10370     else
10371         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10372         val="$undef"
10373     fi
10374 ;;
10375 *) val="$d_builtin_choose_expr" ;;
10376 esac
10377
10378 set d_builtin_choose_expr
10379 eval $setvar
10380 $rm -f try.* try core core.try.*
10381
10382 : Look for GCC-style __builtin_expect
10383 case "$d_builtin_expect" in
10384 '')
10385     echo " "
10386     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10387     $cat >builtin.c <<'EOCP'
10388 int main(void) {
10389     int n = 50;
10390     if ( __builtin_expect(n, 0) ) n = 1;
10391 }
10392 EOCP
10393     set try
10394     if eval $compile; then
10395         echo "Your C compiler supports __builtin_choose_expr."
10396         val="$define"
10397     else
10398         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10399         val="$undef"
10400     fi
10401     ;;
10402 *) val="$d_builtin_expect" ;;
10403 esac
10404
10405 set d_builtin_expect
10406 eval $setvar
10407 $rm -f try.* try core core.try.*
10408
10409 : see if bzero exists
10410 set bzero d_bzero
10411 eval $inlibc
10412
10413 : see if stdarg is available
10414 echo " "
10415 if $test `./findhdr stdarg.h`; then
10416         echo "<stdarg.h> found." >&4
10417         valstd="$define"
10418 else
10419         echo "<stdarg.h> NOT found." >&4
10420         valstd="$undef"
10421 fi
10422
10423 : see if varags is available
10424 echo " "
10425 if $test `./findhdr varargs.h`; then
10426         echo "<varargs.h> found." >&4
10427 else
10428         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10429 fi
10430
10431 : set up the varargs testing programs
10432 $cat > varargs.c <<EOP
10433 #ifdef I_STDARG
10434 #include <stdarg.h>
10435 #endif
10436 #ifdef I_VARARGS
10437 #include <varargs.h>
10438 #endif
10439
10440 #ifdef I_STDARG
10441 int f(char *p, ...)
10442 #else
10443 int f(va_alist)
10444 va_dcl
10445 #endif
10446 {
10447         va_list ap;
10448 #ifndef I_STDARG
10449         char *p;
10450 #endif
10451 #ifdef I_STDARG
10452         va_start(ap,p);
10453 #else
10454         va_start(ap);
10455         p = va_arg(ap, char *);
10456 #endif
10457         va_end(ap);
10458         return 0;
10459 }
10460 EOP
10461 $cat > varargs <<EOP
10462 $startsh
10463 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10464         echo "true"
10465 else
10466         echo "false"
10467 fi
10468 $rm -f varargs$_o
10469 EOP
10470 chmod +x varargs
10471
10472 : now check which varargs header should be included
10473 echo " "
10474 i_varhdr=''
10475 case "$valstd" in
10476 "$define")
10477         if `./varargs I_STDARG`; then
10478                 val='stdarg.h'
10479         elif `./varargs I_VARARGS`; then
10480                 val='varargs.h'
10481         fi
10482         ;;
10483 *)
10484         if `./varargs I_VARARGS`; then
10485                 val='varargs.h'
10486         fi
10487         ;;
10488 esac
10489 case "$val" in
10490 '')
10491 echo "I could not find the definition for va_dcl... You have problems..." >&4
10492         val="$undef"; set i_stdarg; eval $setvar
10493         val="$undef"; set i_varargs; eval $setvar
10494         ;;
10495 *) 
10496         set i_varhdr
10497         eval $setvar
10498         case "$i_varhdr" in
10499         stdarg.h)
10500                 val="$define"; set i_stdarg; eval $setvar
10501                 val="$undef"; set i_varargs; eval $setvar
10502                 ;;
10503         varargs.h)
10504                 val="$undef"; set i_stdarg; eval $setvar
10505                 val="$define"; set i_varargs; eval $setvar
10506                 ;;
10507         esac
10508         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10509 esac
10510 $rm -f varargs*
10511
10512 : see if the Compiler supports C99 variadic macros
10513 case "$i_stdarg$i_stdlib" in
10514     "$define$define")
10515     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10516     $cat >try.c <<EOCP
10517 #include <stdio.h>
10518 #include <stdarg.h>
10519
10520 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10521
10522 int main() {
10523   char buf[20];
10524   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10525   puts(buf);
10526   return 0;
10527 }
10528 EOCP
10529     set try
10530     if eval $compile && $run ./try 2>&1 >/dev/null; then
10531         case "`$run ./try`" in
10532             "123 456 789")
10533             echo "You have C99 variadic macros." >&4
10534             d_c99_variadic_macros="$define"
10535             ;;
10536             *)
10537             echo "You don't have functional C99 variadic macros." >&4
10538             d_c99_variadic_macros="$undef"
10539             ;;
10540         esac
10541     else
10542         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10543         d_c99_variadic_macros="$undef"
10544     fi
10545     $rm -f try.* try core core.try.*
10546     ;;
10547     *)
10548     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10549     d_c99_variadic_macros="$undef"
10550     ;;
10551 esac
10552
10553 : see if signal is declared as pointer to function returning int or void
10554 echo " "
10555 xxx=`./findhdr signal.h`
10556 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10557 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10558         echo "You have int (*signal())() instead of void." >&4
10559         val="$undef"
10560 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10561         echo "You have void (*signal())()." >&4
10562         val="$define"
10563 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10564         echo "You have int (*signal())() instead of void." >&4
10565         val="$undef"
10566 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10567         echo "You have void (*signal())()." >&4
10568         val="$define"
10569 else
10570         case "$d_voidsig" in
10571         '')
10572         echo "I can't determine whether signal handler returns void or int..." >&4
10573                 dflt=void
10574                 rp="What type does your signal handler return?"
10575                 . ./myread
10576                 case "$ans" in
10577                 v*) val="$define";;
10578                 *) val="$undef";;
10579                 esac;;
10580         "$define")
10581                 echo "As you already told me, signal handler returns void." >&4
10582                 val="$define"
10583                 ;;
10584         *)      echo "As you already told me, signal handler returns int." >&4
10585                 val="$undef"
10586                 ;;
10587         esac
10588 fi
10589 set d_voidsig
10590 eval $setvar
10591 case "$d_voidsig" in
10592 "$define") signal_t="void";;
10593 *) signal_t="int";;
10594 esac
10595 $rm -f $$.tmp
10596
10597 : check for ability to cast large floats to 32-bit ints.
10598 echo " "
10599 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10600 if $test "$intsize" -ge 4; then
10601         xxx=int
10602 else
10603         xxx=long
10604 fi
10605 $cat >try.c <<EOCP
10606 #include <stdio.h>
10607 #$i_stdlib I_STDLIB
10608 #ifdef I_STDLIB
10609 #include <stdlib.h>
10610 #endif
10611 #include <sys/types.h>
10612 #include <signal.h>
10613 $signal_t blech(int s) { exit(3); }
10614 int main()
10615 {
10616         $xxx i32;
10617         double f, g;
10618         int result = 0;
10619         char str[16];
10620         signal(SIGFPE, blech);
10621
10622         /* Don't let compiler optimize the test away.  Store the number 
10623            in a writable string for gcc to pass to sscanf under HP/UX.
10624         */
10625         sprintf(str, "2147483647");
10626         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10627         g = 10 * f;
10628         i32  = ($xxx) g;
10629
10630         /* x86 processors will probably give 0x8000 0000, which is a
10631            sign change.  We don't want that.  We want to mimic SPARC
10632            behavior here, which is to preserve the sign and give
10633            back 0x7fff ffff.
10634         */
10635         if (i32 != ($xxx) f)
10636                 result |= 1;
10637         exit(result);
10638 }
10639 EOCP
10640 set try
10641 if eval $compile_ok; then
10642         $run ./try
10643         yyy=$?
10644 else
10645         echo "(I can't seem to compile the test program--assuming it can't)"
10646         yyy=1
10647 fi
10648 case "$yyy" in
10649 0)      val="$define"
10650         echo "Yup, it can."
10651         ;;
10652 *)      val="$undef"
10653         echo "Nope, it can't."
10654         ;;
10655 esac
10656 set d_casti32
10657 eval $setvar
10658 $rm -f try try.*
10659
10660 : check for ability to cast negative floats to unsigned
10661 echo " "
10662 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10663 $cat >try.c <<EOCP
10664 #include <stdio.h>
10665 #$i_stdlib I_STDLIB
10666 #ifdef I_STDLIB
10667 #include <stdlib.h>
10668 #endif
10669 #include <sys/types.h>
10670 #include <signal.h>
10671 $signal_t blech(int s) { exit(7); }
10672 $signal_t blech_in_list(int s) { exit(4); }
10673 unsigned long dummy_long(unsigned long p) { return p; }
10674 unsigned int dummy_int(unsigned int p) { return p; }
10675 unsigned short dummy_short(unsigned short p) { return p; }
10676 int main()
10677 {
10678         double f;
10679         unsigned long along;
10680         unsigned int aint;
10681         unsigned short ashort;
10682         int result = 0;
10683         char str[16];
10684         
10685         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10686            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10687            optimized the whole file away
10688         */
10689         /* Store the number in a writable string for gcc to pass to 
10690            sscanf under HP/UX.
10691         */
10692         sprintf(str, "-123");
10693         sscanf(str, "%lf", &f);  /* f = -123.; */
10694
10695         signal(SIGFPE, blech);
10696         along = (unsigned long)f;
10697         aint = (unsigned int)f;
10698         ashort = (unsigned short)f;
10699         if (along != (unsigned long)-123)
10700                 result |= 1;
10701         if (aint != (unsigned int)-123)
10702                 result |= 1;
10703         if (ashort != (unsigned short)-123)
10704                 result |= 1;
10705         sprintf(str, "1073741824.");
10706         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10707         f = f + f;
10708         along = 0;
10709         along = (unsigned long)f;
10710         if (along != 0x80000000)
10711                 result |= 2;
10712         f -= 1.;
10713         along = 0;
10714         along = (unsigned long)f;
10715         if (along != 0x7fffffff)
10716                 result |= 1;
10717         f += 2.;
10718         along = 0;
10719         along = (unsigned long)f;
10720         if (along != 0x80000001)
10721                 result |= 2;
10722         if (result)
10723                 exit(result);
10724         signal(SIGFPE, blech_in_list);
10725         sprintf(str, "123.");
10726         sscanf(str, "%lf", &f);  /* f = 123.; */
10727         along = dummy_long((unsigned long)f);
10728         aint = dummy_int((unsigned int)f);
10729         ashort = dummy_short((unsigned short)f);
10730         if (along != (unsigned long)123)
10731                 result |= 4;
10732         if (aint != (unsigned int)123)
10733                 result |= 4;
10734         if (ashort != (unsigned short)123)
10735                 result |= 4;
10736         exit(result);
10737
10738 }
10739 EOCP
10740 set try
10741 if eval $compile_ok; then
10742         $run ./try
10743         castflags=$?
10744 else
10745         echo "(I can't seem to compile the test program--assuming it can't)"
10746         castflags=7
10747 fi
10748 case "$castflags" in
10749 0)      val="$define"
10750         echo "Yup, it can."
10751         ;;
10752 *)      val="$undef"
10753         echo "Nope, it can't."
10754         ;;
10755 esac
10756 set d_castneg
10757 eval $setvar
10758 $rm -f try.*
10759
10760 : see if vprintf exists
10761 echo " "
10762 if set vprintf val -f d_vprintf; eval $csym; $val; then
10763         echo 'vprintf() found.' >&4
10764         val="$define"
10765         $cat >try.c <<EOF
10766 #include <varargs.h>
10767 #$i_stdlib I_STDLIB
10768 #ifdef I_STDLIB
10769 #include <stdlib.h>
10770 #endif
10771
10772 int main() { xxx("foo"); }
10773
10774 xxx(va_alist)
10775 va_dcl
10776 {
10777         va_list args;
10778         char buf[10];
10779
10780         va_start(args);
10781         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10782 }
10783 EOF
10784         set try
10785         if eval $compile && $run ./try; then
10786                 echo "Your vsprintf() returns (int)." >&4
10787                 val2="$undef"
10788         else
10789                 echo "Your vsprintf() returns (char*)." >&4
10790                 val2="$define"
10791         fi
10792 else
10793         echo 'vprintf() NOT found.' >&4
10794                 val="$undef"
10795                 val2="$undef"
10796 fi
10797 $rm -f try try.*
10798 set d_vprintf
10799 eval $setvar
10800 val=$val2
10801 set d_charvspr
10802 eval $setvar
10803
10804 : see if chown exists
10805 set chown d_chown
10806 eval $inlibc
10807
10808 : see if chroot exists
10809 set chroot d_chroot
10810 eval $inlibc
10811
10812 : see if chsize exists
10813 set chsize d_chsize
10814 eval $inlibc
10815
10816 : see if class exists
10817 set class d_class
10818 eval $inlibc
10819
10820 : see if clearenv exists
10821 set clearenv d_clearenv
10822 eval $inlibc
10823
10824 hasstruct='varname=$1; struct=$2; shift; shift;
10825 while $test $# -ge 2; do
10826         case "$1" in
10827         $define) echo "#include <$2>";;
10828         esac ;
10829     shift 2;
10830 done > try.c;
10831 echo "int main () { struct $struct foo; }" >> try.c;
10832 set try;
10833 if eval $compile; then
10834         val="$define";
10835 else
10836         val="$undef";
10837 fi;
10838 set $varname;
10839 eval $setvar;
10840 $rm -f try.c try.o'
10841
10842 socketlib=''
10843 sockethdr=''
10844 : see whether socket exists
10845 echo " "
10846 $echo $n "Hmm... $c" >&4
10847 if set socket val -f d_socket; eval $csym; $val; then
10848         echo "Looks like you have Berkeley networking support." >&4
10849         d_socket="$define"
10850         if set setsockopt val -f; eval $csym; $val; then
10851                 d_oldsock="$undef"
10852         else
10853                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10854                 d_oldsock="$define"
10855         fi
10856 else
10857         if $contains socklib libc.list >/dev/null 2>&1; then
10858                 echo "Looks like you have Berkeley networking support." >&4
10859                 d_socket="$define"
10860                 : we will have to assume that it supports the 4.2 BSD interface
10861                 d_oldsock="$undef"
10862         else
10863                 echo "You don't have Berkeley networking in libc$_a..." >&4
10864                 if test "X$d_socket" = "X$define"; then
10865                    echo "...but you seem to believe that you have sockets." >&4
10866                 else
10867                         for net in net socket
10868                         do
10869                                 if test -f /usr/lib/lib$net$_a; then
10870                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10871                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10872                                         if $contains socket libc.list >/dev/null 2>&1; then
10873                                                 d_socket="$define"
10874                                                 socketlib="-l$net"
10875                                                 case "$net" in
10876                                                 net)
10877                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10878                                                         sockethdr="-I/usr/netinclude"
10879                                                         ;;
10880                                                 esac
10881                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10882                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10883                                                         d_oldsock="$undef"
10884                                                 else
10885                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10886                                                         d_oldsock="$define"
10887                                                 fi
10888                                                 break
10889                                         fi
10890                                 fi
10891                         done
10892                         if test "X$d_socket" != "X$define"; then
10893                            echo "or anywhere else I see." >&4
10894                            d_socket="$undef"
10895                            d_oldsock="$undef"
10896                         fi
10897                 fi
10898         fi
10899 fi
10900
10901 : see if socketpair exists
10902 set socketpair d_sockpair
10903 eval $inlibc
10904
10905
10906 echo " "
10907 echo "Checking the availability of certain socket constants..." >&4
10908 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10909         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10910         $cat >try.c <<EOF
10911 #include <sys/types.h>
10912 #include <sys/socket.h>
10913 int main() {
10914     int i = $ENUM;
10915 }
10916 EOF
10917         val="$undef"
10918         set try; if eval $compile; then
10919                 val="$define"
10920         fi
10921         set d_${enum}; eval $setvar
10922         $rm -f try.c try
10923 done
10924
10925 : see if this is a sys/uio.h system
10926 set sys/uio.h i_sysuio
10927 eval $inhdr
10928
10929
10930 echo " "
10931 echo "Checking to see if your system supports struct cmsghdr..." >&4
10932 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10933 eval $hasstruct
10934 case "$d_cmsghdr_s" in
10935 "$define")      echo "Yes, it does."   ;;
10936 *)              echo "No, it doesn't." ;;
10937 esac
10938
10939
10940 : check for const keyword
10941 echo " "
10942 echo 'Checking to see if your C compiler knows about "const"...' >&4
10943 $cat >const.c <<'EOCP'
10944 typedef struct spug { int drokk; } spug;
10945 int main()
10946 {
10947         const char *foo;
10948         const spug y = { 0 };
10949 }
10950 EOCP
10951 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10952         val="$define"
10953         echo "Yup, it does."
10954 else
10955         val="$undef"
10956         echo "Nope, it doesn't."
10957 fi
10958 set d_const
10959 eval $setvar
10960
10961 : see if copysignl exists
10962 set copysignl d_copysignl
10963 eval $inlibc
10964
10965 : see if crypt exists
10966 echo " "
10967 set crypt d_crypt
10968 eval $inlibc
10969 case "$d_crypt" in
10970 $define) cryptlib='' ;;
10971 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10972                 echo 'crypt() found.' >&4
10973                 val="$define"
10974                 cryptlib=''
10975         else
10976                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10977                 if $test -z "$cryptlib"; then
10978                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10979                 else
10980                         cryptlib=-lcrypt
10981                 fi
10982                 if $test -z "$cryptlib"; then
10983                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10984                 else
10985                         cryptlib=-lcrypt
10986                 fi
10987                 if $test -z "$cryptlib"; then
10988                         cryptlib=`./loc libcrypt$_a "" $libpth`
10989                 else
10990                         cryptlib=-lcrypt
10991                 fi
10992                 if $test -z "$cryptlib"; then
10993                         echo 'crypt() NOT found.' >&4
10994                         val="$undef"
10995                 else
10996                         val="$define"
10997                 fi
10998         fi
10999         set d_crypt
11000         eval $setvar
11001         ;;
11002 esac
11003
11004 : see if this is a crypt.h system
11005 set crypt.h i_crypt
11006 eval $inhdr
11007
11008 : see if crypt_r exists
11009 set crypt_r d_crypt_r
11010 eval $inlibc
11011 case "$d_crypt_r" in
11012 "$define")
11013         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11014         case "$d_crypt_r_proto:$usethreads" in
11015         ":define")      d_crypt_r_proto=define
11016                 set d_crypt_r_proto crypt_r $hdrs
11017                 eval $hasproto ;;
11018         *)      ;;
11019         esac
11020         case "$d_crypt_r_proto" in
11021         define)
11022         case "$crypt_r_proto" in
11023         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11024         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11025         esac
11026         case "$crypt_r_proto" in
11027         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11028         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11029         esac
11030         case "$crypt_r_proto" in
11031         ''|0)   d_crypt_r=undef
11032                 crypt_r_proto=0
11033                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11034         * )     case "$crypt_r_proto" in
11035                 REENTRANT_PROTO*) ;;
11036                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11037                 esac
11038                 echo "Prototype: $try" ;;
11039         esac
11040         ;;
11041         *)      case "$usethreads" in
11042                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11043                 esac
11044                 d_crypt_r=undef
11045                 crypt_r_proto=0
11046                 ;;
11047         esac
11048         ;;
11049 *)      crypt_r_proto=0
11050         ;;
11051 esac
11052
11053 : get csh whereabouts
11054 case "$csh" in
11055 'csh') val="$undef" ;;
11056 *) val="$define" ;;
11057 esac
11058 set d_csh
11059 eval $setvar
11060 : Respect a hint or command line value for full_csh.
11061 case "$full_csh" in
11062 '') full_csh=$csh ;;
11063 esac
11064
11065 : see if ctermid exists
11066 set ctermid d_ctermid
11067 eval $inlibc
11068
11069 : see if ctermid_r exists
11070 set ctermid_r d_ctermid_r
11071 eval $inlibc
11072 case "$d_ctermid_r" in
11073 "$define")
11074         hdrs="$i_systypes sys/types.h define stdio.h "
11075         case "$d_ctermid_r_proto:$usethreads" in
11076         ":define")      d_ctermid_r_proto=define
11077                 set d_ctermid_r_proto ctermid_r $hdrs
11078                 eval $hasproto ;;
11079         *)      ;;
11080         esac
11081         case "$d_ctermid_r_proto" in
11082         define)
11083         case "$ctermid_r_proto" in
11084         ''|0) try='char* ctermid_r(char*);'
11085         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11086         esac
11087         case "$ctermid_r_proto" in
11088         ''|0)   d_ctermid_r=undef
11089                 ctermid_r_proto=0
11090                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11091         * )     case "$ctermid_r_proto" in
11092                 REENTRANT_PROTO*) ;;
11093                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11094                 esac
11095                 echo "Prototype: $try" ;;
11096         esac
11097         ;;
11098         *)      case "$usethreads" in
11099                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11100                 esac
11101                 d_ctermid_r=undef
11102                 ctermid_r_proto=0
11103                 ;;
11104         esac
11105         ;;
11106 *)      ctermid_r_proto=0
11107         ;;
11108 esac
11109
11110 : see if ctime_r exists
11111 set ctime_r d_ctime_r
11112 eval $inlibc
11113 case "$d_ctime_r" in
11114 "$define")
11115         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11116         case "$d_ctime_r_proto:$usethreads" in
11117         ":define")      d_ctime_r_proto=define
11118                 set d_ctime_r_proto ctime_r $hdrs
11119                 eval $hasproto ;;
11120         *)      ;;
11121         esac
11122         case "$d_ctime_r_proto" in
11123         define)
11124         case "$ctime_r_proto" in
11125         ''|0) try='char* ctime_r(const time_t*, char*);'
11126         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11127         esac
11128         case "$ctime_r_proto" in
11129         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11130         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11131         esac
11132         case "$ctime_r_proto" in
11133         ''|0) try='int ctime_r(const time_t*, char*);'
11134         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11135         esac
11136         case "$ctime_r_proto" in
11137         ''|0) try='int ctime_r(const time_t*, char*, int);'
11138         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11139         esac
11140         case "$ctime_r_proto" in
11141         ''|0)   d_ctime_r=undef
11142                 ctime_r_proto=0
11143                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11144         * )     case "$ctime_r_proto" in
11145                 REENTRANT_PROTO*) ;;
11146                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11147                 esac
11148                 echo "Prototype: $try" ;;
11149         esac
11150         ;;
11151         *)      case "$usethreads" in
11152                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11153                 esac
11154                 d_ctime_r=undef
11155                 ctime_r_proto=0
11156                 ;;
11157         esac
11158         ;;
11159 *)      ctime_r_proto=0
11160         ;;
11161 esac
11162
11163 : see if cuserid exists
11164 set cuserid d_cuserid
11165 eval $inlibc
11166
11167 : see if this is a limits.h system
11168 set limits.h i_limits
11169 eval $inhdr
11170
11171 : see if this is a float.h system
11172 set float.h i_float
11173 eval $inhdr
11174
11175 : See if number of significant digits in a double precision number is known
11176 echo " "
11177 $cat >dbl_dig.c <<EOM
11178 #$i_limits I_LIMITS
11179 #$i_float I_FLOAT
11180 #ifdef I_LIMITS
11181 #include <limits.h>
11182 #endif
11183 #ifdef I_FLOAT
11184 #include <float.h>
11185 #endif
11186 #ifdef DBL_DIG
11187 printf("Contains DBL_DIG");
11188 #endif
11189 EOM
11190 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11191 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11192         echo "DBL_DIG found." >&4
11193         val="$define"
11194 else
11195         echo "DBL_DIG NOT found." >&4
11196         val="$undef"
11197 fi
11198 $rm -f dbl_dig.?
11199 set d_dbl_dig
11200 eval $setvar
11201
11202 : see if dbm.h is available
11203 : see if dbmclose exists
11204 set dbmclose d_dbmclose
11205 eval $inlibc
11206
11207 case "$d_dbmclose" in
11208 $define)
11209         set dbm.h i_dbm
11210         eval $inhdr
11211         case "$i_dbm" in
11212         $define)
11213                 val="$undef"
11214                 set i_rpcsvcdbm
11215                 eval $setvar
11216                 ;;
11217         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11218                 eval $inhdr
11219                 ;;
11220         esac
11221         ;;
11222 *)      echo "We won't be including <dbm.h>"
11223         val="$undef"
11224         set i_dbm
11225         eval $setvar
11226         val="$undef"
11227         set i_rpcsvcdbm
11228         eval $setvar
11229         ;;
11230 esac
11231
11232 : see if prototype for dbminit is available
11233 echo " "
11234 set d_dbminitproto dbminit $i_dbm dbm.h
11235 eval $hasproto
11236
11237 : see if difftime exists
11238 set difftime d_difftime
11239 eval $inlibc
11240
11241 : see if this is a dirent system
11242 echo " "
11243 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11244         val="$define"
11245         echo "<dirent.h> found." >&4
11246 else
11247         val="$undef"
11248         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11249                 echo "<sys/dir.h> found." >&4
11250                 echo " "
11251         else
11252                 xinc=`./findhdr sys/ndir.h`
11253         fi
11254         echo "<dirent.h> NOT found." >&4
11255 fi
11256 set i_dirent
11257 eval $setvar
11258
11259 : Look for type of directory structure.
11260 echo " "
11261 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11262
11263 case "$direntrytype" in
11264 ''|' ')
11265         case "$i_dirent" in
11266         $define) guess1='struct dirent' ;;
11267         *) guess1='struct direct'  ;;
11268         esac
11269         ;;
11270 *)      guess1="$direntrytype"
11271         ;;
11272 esac
11273
11274 case "$guess1" in
11275 'struct dirent') guess2='struct direct' ;;
11276 *) guess2='struct dirent' ;;
11277 esac
11278                 
11279 if $contains "$guess1" try.c >/dev/null 2>&1; then
11280         direntrytype="$guess1"
11281         echo "Your directory entries are $direntrytype." >&4
11282 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11283         direntrytype="$guess2"
11284         echo "Your directory entries seem to be $direntrytype." >&4
11285 else
11286         echo "I don't recognize your system's directory entries." >&4
11287         rp="What type is used for directory entries on this system?"
11288         dflt="$guess1"
11289         . ./myread
11290         direntrytype="$ans"
11291 fi
11292 $rm -f try.c
11293
11294
11295 : see if the directory entry stores field length
11296 echo " "
11297 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11298 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11299         echo "Good, your directory entry keeps length information in d_namlen." >&4
11300         val="$define"
11301 else
11302         echo "Your directory entry does not know about the d_namlen field." >&4
11303         val="$undef"
11304 fi
11305 set d_dirnamlen
11306 eval $setvar
11307 $rm -f try.c
11308
11309 : Look for DIR.dd_fd
11310 case "$i_dirent" in
11311 "$define")
11312     echo "Checking to see if DIR has a dd_fd member variable" >&4
11313     $cat >try.c <<EOCP
11314 #$i_stdlib I_STDLIB
11315 #ifdef I_STDLIB
11316 #include <stdlib.h>
11317 #endif
11318 #include <dirent.h>
11319
11320 int main() {
11321     DIR dir;
11322     dir.dd_fd = 1;
11323     return 0;
11324 }
11325 EOCP
11326     val=$undef
11327     set try
11328     if eval $compile; then
11329         echo "Yes, it does."
11330         val="$define"
11331     else
11332         echo "No, it does not."
11333         val="$undef"
11334     fi
11335     ;;
11336 *)
11337     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11338     val="$undef"
11339     ;;
11340 esac
11341 set d_dir_dd_fd
11342 eval $setvar
11343 $rm -f try try.*
11344
11345 : see if this is an sysdir system
11346 set sys/dir.h i_sysdir
11347 eval $inhdr
11348
11349 : see if this is an sysndir system
11350 set sys/ndir.h i_sysndir
11351 eval $inhdr
11352
11353 : Look for dirfd
11354 echo " "
11355 $cat >dirfd.c <<EOM
11356 #include <stdio.h>
11357 #$i_stdlib I_STDLIB
11358 #ifdef I_STDLIB
11359 #include <stdlib.h>
11360 #endif
11361 #$i_dirent I_DIRENT             /**/
11362 #$i_sysdir I_SYS_DIR            /**/
11363 #$i_sysndir I_SYS_NDIR          /**/
11364 #$i_systypes I_SYS_TYPES        /**/
11365 #if defined(I_SYS_TYPES)
11366 #include <sys/types.h>
11367 #endif
11368 #if defined(I_DIRENT)
11369 #include <dirent.h>
11370 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11371 #include <sys/dir.h>
11372 #endif
11373 #else
11374 #ifdef I_SYS_NDIR
11375 #include <sys/ndir.h>
11376 #else
11377 #ifdef I_SYS_DIR
11378 #ifdef hp9000s500
11379 #include <ndir.h>       /* may be wrong in the future */
11380 #else
11381 #include <sys/dir.h>
11382 #endif
11383 #endif
11384 #endif
11385 #endif 
11386 int main() {
11387         DIR *dirp = opendir(".");
11388         if (dirfd(dirp) >= 0)
11389                 exit(0);
11390         else
11391                 exit(1);
11392 }
11393 EOM
11394 val=$undef
11395 set dirfd
11396 if eval $compile; then
11397         val="$define"
11398 fi
11399 case "$val" in
11400 $define)        echo "dirfd() found." >&4       ;;
11401 *)              echo "dirfd() NOT found." >&4   ;;
11402 esac
11403 set d_dirfd
11404 eval $setvar
11405 $rm -f dirfd*
11406
11407 : see if dlerror exists
11408 xxx_runnm="$runnm"
11409 runnm=false
11410 set dlerror d_dlerror
11411 eval $inlibc
11412 runnm="$xxx_runnm"
11413
11414 : see if dlfcn is available
11415 set dlfcn.h i_dlfcn
11416 eval $inhdr
11417
11418 case "$usedl" in
11419 $define|y|true)
11420         $cat << EOM
11421
11422 On a few systems, the dynamically loaded modules that perl generates and uses
11423 will need a different extension than shared libs. The default will probably
11424 be appropriate.
11425
11426 EOM
11427         case "$dlext" in
11428         '')     dflt="$so" ;;
11429         *)      dflt="$dlext" ;;
11430         esac
11431         rp='What is the extension of dynamically loaded modules'
11432         . ./myread
11433         dlext="$ans"
11434         ;;
11435 *)
11436         dlext="none"
11437         ;;
11438 esac
11439
11440 : Check if dlsym need a leading underscore
11441 echo " "
11442 val="$undef"
11443
11444 case "$dlsrc" in
11445 dl_dlopen.xs)
11446         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11447         $cat >dyna.c <<'EOM'
11448 fred () { }
11449 EOM
11450
11451 $cat >fred.c<<EOM
11452
11453 #include <stdio.h>
11454 #$i_stdlib I_STDLIB
11455 #ifdef I_STDLIB
11456 #include <stdlib.h>
11457 #endif
11458 #$i_dlfcn I_DLFCN
11459 #ifdef I_DLFCN
11460 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11461 #else
11462 #include <sys/types.h>
11463 #include <nlist.h>
11464 #include <link.h>
11465 #endif
11466
11467 extern int fred() ;
11468
11469 int main()
11470 {
11471     void * handle ;
11472     void * symbol ;
11473 #ifndef RTLD_LAZY
11474     int mode = 1 ;
11475 #else
11476     int mode = RTLD_LAZY ;
11477 #endif
11478     handle = dlopen("./dyna.$dlext", mode) ;
11479     if (handle == NULL) {
11480         printf ("1\n") ;
11481         fflush (stdout) ;
11482         exit(0);
11483     }
11484     symbol = dlsym(handle, "fred") ;
11485     if (symbol == NULL) {
11486         /* try putting a leading underscore */
11487         symbol = dlsym(handle, "_fred") ;
11488         if (symbol == NULL) {
11489             printf ("2\n") ;
11490             fflush (stdout) ;
11491             exit(0);
11492         }
11493         printf ("3\n") ;
11494     }
11495     else
11496         printf ("4\n") ;
11497     fflush (stdout) ;
11498     exit(0);
11499 }
11500 EOM
11501         : Call the object file tmp-dyna.o in case dlext=o.
11502         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11503                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11504                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11505                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11506                 xxx=`$run ./fred`
11507                 case $xxx in
11508                 1)      echo "Test program failed using dlopen." >&4
11509                         echo "Perhaps you should not use dynamic loading." >&4;;
11510                 2)      echo "Test program failed using dlsym." >&4
11511                         echo "Perhaps you should not use dynamic loading." >&4;;
11512                 3)      echo "dlsym needs a leading underscore" >&4
11513                         val="$define" ;;
11514                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11515                 esac
11516         else
11517                 echo "I can't compile and run the test program." >&4
11518                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11519         fi
11520         ;;
11521 esac
11522                 
11523 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11524
11525 set d_dlsymun
11526 eval $setvar
11527
11528 : see if drand48_r exists
11529 set drand48_r d_drand48_r
11530 eval $inlibc
11531 case "$d_drand48_r" in
11532 "$define")
11533         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11534         case "$d_drand48_r_proto:$usethreads" in
11535         ":define")      d_drand48_r_proto=define
11536                 set d_drand48_r_proto drand48_r $hdrs
11537                 eval $hasproto ;;
11538         *)      ;;
11539         esac
11540         case "$d_drand48_r_proto" in
11541         define)
11542         case "$drand48_r_proto" in
11543         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11544         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11545         esac
11546         case "$drand48_r_proto" in
11547         ''|0)   d_drand48_r=undef
11548                 drand48_r_proto=0
11549                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11550         * )     case "$drand48_r_proto" in
11551                 REENTRANT_PROTO*) ;;
11552                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11553                 esac
11554                 echo "Prototype: $try" ;;
11555         esac
11556         ;;
11557         *)      case "$usethreads" in
11558                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11559                 esac
11560                 d_drand48_r=undef
11561                 drand48_r_proto=0
11562                 ;;
11563         esac
11564         ;;
11565 *)      drand48_r_proto=0
11566         ;;
11567 esac
11568
11569 : see if prototype for drand48 is available
11570 echo " "
11571 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11572 eval $hasproto
11573
11574 : see if dup2 exists
11575 set dup2 d_dup2
11576 eval $inlibc
11577
11578 : see if eaccess exists
11579 set eaccess d_eaccess
11580 eval $inlibc
11581
11582 : see if endgrent exists
11583 set endgrent d_endgrent
11584 eval $inlibc
11585
11586 : see if this is an grp system
11587 set grp.h i_grp
11588 eval $inhdr
11589
11590 case "$i_grp" in
11591 $define)
11592         xxx=`./findhdr grp.h`
11593         $cppstdin $cppflags $cppminus < $xxx >$$.h
11594
11595         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11596                 val="$define"
11597         else
11598                 val="$undef"
11599         fi
11600         set d_grpasswd
11601         eval $setvar
11602
11603         $rm -f $$.h
11604         ;;
11605 *)
11606         val="$undef";
11607         set d_grpasswd; eval $setvar
11608         ;;
11609 esac
11610
11611 : see if endgrent_r exists
11612 set endgrent_r d_endgrent_r
11613 eval $inlibc
11614 case "$d_endgrent_r" in
11615 "$define")
11616         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11617         case "$d_endgrent_r_proto:$usethreads" in
11618         ":define")      d_endgrent_r_proto=define
11619                 set d_endgrent_r_proto endgrent_r $hdrs
11620                 eval $hasproto ;;
11621         *)      ;;
11622         esac
11623         case "$d_endgrent_r_proto" in
11624         define)
11625         case "$endgrent_r_proto" in
11626         ''|0) try='int endgrent_r(FILE**);'
11627         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11628         esac
11629         case "$endgrent_r_proto" in
11630         ''|0) try='void endgrent_r(FILE**);'
11631         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11632         esac
11633         case "$endgrent_r_proto" in
11634         ''|0)   d_endgrent_r=undef
11635                 endgrent_r_proto=0
11636                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11637         * )     case "$endgrent_r_proto" in
11638                 REENTRANT_PROTO*) ;;
11639                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11640                 esac
11641                 echo "Prototype: $try" ;;
11642         esac
11643         ;;
11644         *)      case "$usethreads" in
11645                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11646                 esac
11647                 d_endgrent_r=undef
11648                 endgrent_r_proto=0
11649                 ;;
11650         esac
11651         ;;
11652 *)      endgrent_r_proto=0
11653         ;;
11654 esac
11655
11656 : see if endhostent exists
11657 set endhostent d_endhent
11658 eval $inlibc
11659
11660 : see if this is a netdb.h system
11661 set netdb.h i_netdb
11662 eval $inhdr
11663
11664 : see if endhostent_r exists
11665 set endhostent_r d_endhostent_r
11666 eval $inlibc
11667 case "$d_endhostent_r" in
11668 "$define")
11669         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11670         case "$d_endhostent_r_proto:$usethreads" in
11671         ":define")      d_endhostent_r_proto=define
11672                 set d_endhostent_r_proto endhostent_r $hdrs
11673                 eval $hasproto ;;
11674         *)      ;;
11675         esac
11676         case "$d_endhostent_r_proto" in
11677         define)
11678         case "$endhostent_r_proto" in
11679         ''|0) try='int endhostent_r(struct hostent_data*);'
11680         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11681         esac
11682         case "$endhostent_r_proto" in
11683         ''|0) try='void endhostent_r(struct hostent_data*);'
11684         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11685         esac
11686         case "$endhostent_r_proto" in
11687         ''|0)   d_endhostent_r=undef
11688                 endhostent_r_proto=0
11689                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11690         * )     case "$endhostent_r_proto" in
11691                 REENTRANT_PROTO*) ;;
11692                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11693                 esac
11694                 echo "Prototype: $try" ;;
11695         esac
11696         ;;
11697         *)      case "$usethreads" in
11698                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11699                 esac
11700                 d_endhostent_r=undef
11701                 endhostent_r_proto=0
11702                 ;;
11703         esac
11704         ;;
11705 *)      endhostent_r_proto=0
11706         ;;
11707 esac
11708
11709 : see if endnetent exists
11710 set endnetent d_endnent
11711 eval $inlibc
11712
11713 : see if endnetent_r exists
11714 set endnetent_r d_endnetent_r
11715 eval $inlibc
11716 case "$d_endnetent_r" in
11717 "$define")
11718         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11719         case "$d_endnetent_r_proto:$usethreads" in
11720         ":define")      d_endnetent_r_proto=define
11721                 set d_endnetent_r_proto endnetent_r $hdrs
11722                 eval $hasproto ;;
11723         *)      ;;
11724         esac
11725         case "$d_endnetent_r_proto" in
11726         define)
11727         case "$endnetent_r_proto" in
11728         ''|0) try='int endnetent_r(struct netent_data*);'
11729         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11730         esac
11731         case "$endnetent_r_proto" in
11732         ''|0) try='void endnetent_r(struct netent_data*);'
11733         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11734         esac
11735         case "$endnetent_r_proto" in
11736         ''|0)   d_endnetent_r=undef
11737                 endnetent_r_proto=0
11738                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11739         * )     case "$endnetent_r_proto" in
11740                 REENTRANT_PROTO*) ;;
11741                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11742                 esac
11743                 echo "Prototype: $try" ;;
11744         esac
11745         ;;
11746         *)      case "$usethreads" in
11747                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11748                 esac
11749                 d_endnetent_r=undef
11750                 endnetent_r_proto=0
11751                 ;;
11752         esac
11753         ;;
11754 *)      endnetent_r_proto=0
11755         ;;
11756 esac
11757
11758 : see if endprotoent exists
11759 set endprotoent d_endpent
11760 eval $inlibc
11761
11762 : see if endprotoent_r exists
11763 set endprotoent_r d_endprotoent_r
11764 eval $inlibc
11765 case "$d_endprotoent_r" in
11766 "$define")
11767         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11768         case "$d_endprotoent_r_proto:$usethreads" in
11769         ":define")      d_endprotoent_r_proto=define
11770                 set d_endprotoent_r_proto endprotoent_r $hdrs
11771                 eval $hasproto ;;
11772         *)      ;;
11773         esac
11774         case "$d_endprotoent_r_proto" in
11775         define)
11776         case "$endprotoent_r_proto" in
11777         ''|0) try='int endprotoent_r(struct protoent_data*);'
11778         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11779         esac
11780         case "$endprotoent_r_proto" in
11781         ''|0) try='void endprotoent_r(struct protoent_data*);'
11782         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11783         esac
11784         case "$endprotoent_r_proto" in
11785         ''|0)   d_endprotoent_r=undef
11786                 endprotoent_r_proto=0
11787                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11788         * )     case "$endprotoent_r_proto" in
11789                 REENTRANT_PROTO*) ;;
11790                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11791                 esac
11792                 echo "Prototype: $try" ;;
11793         esac
11794         ;;
11795         *)      case "$usethreads" in
11796                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11797                 esac
11798                 d_endprotoent_r=undef
11799                 endprotoent_r_proto=0
11800                 ;;
11801         esac
11802         ;;
11803 *)      endprotoent_r_proto=0
11804         ;;
11805 esac
11806
11807 : see if endpwent exists
11808 set endpwent d_endpwent
11809 eval $inlibc
11810
11811 : see if this is a pwd.h system
11812 set pwd.h i_pwd
11813 eval $inhdr
11814
11815 case "$i_pwd" in
11816 $define)
11817         xxx=`./findhdr pwd.h`
11818         $cppstdin $cppflags $cppminus < $xxx >$$.h
11819
11820         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11821                 val="$define"
11822         else
11823                 val="$undef"
11824         fi
11825         set d_pwquota
11826         eval $setvar
11827
11828         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11829                 val="$define"
11830         else
11831                 val="$undef"
11832         fi
11833         set d_pwage
11834         eval $setvar
11835
11836         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11837                 val="$define"
11838         else
11839                 val="$undef"
11840         fi
11841         set d_pwchange
11842         eval $setvar
11843
11844         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11845                 val="$define"
11846         else
11847                 val="$undef"
11848         fi
11849         set d_pwclass
11850         eval $setvar
11851
11852         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11853                 val="$define"
11854         else
11855                 val="$undef"
11856         fi
11857         set d_pwexpire
11858         eval $setvar
11859
11860         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11861                 val="$define"
11862         else
11863                 val="$undef"
11864         fi
11865         set d_pwcomment
11866         eval $setvar
11867
11868         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11869                 val="$define"
11870         else
11871                 val="$undef"
11872         fi
11873         set d_pwgecos
11874         eval $setvar
11875
11876         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11877                 val="$define"
11878         else
11879                 val="$undef"
11880         fi
11881         set d_pwpasswd
11882         eval $setvar
11883
11884         $rm -f $$.h
11885         ;;
11886 *)
11887         val="$undef"; 
11888         set d_pwquota; eval $setvar
11889         set d_pwage; eval $setvar
11890         set d_pwchange; eval $setvar
11891         set d_pwclass; eval $setvar
11892         set d_pwexpire; eval $setvar
11893         set d_pwcomment; eval $setvar
11894         set d_pwgecos; eval $setvar
11895         set d_pwpasswd; eval $setvar
11896         ;;
11897 esac
11898
11899 : see if endpwent_r exists
11900 set endpwent_r d_endpwent_r
11901 eval $inlibc
11902 case "$d_endpwent_r" in
11903 "$define")
11904         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11905         case "$d_endpwent_r_proto:$usethreads" in
11906         ":define")      d_endpwent_r_proto=define
11907                 set d_endpwent_r_proto endpwent_r $hdrs
11908                 eval $hasproto ;;
11909         *)      ;;
11910         esac
11911         case "$d_endpwent_r_proto" in
11912         define)
11913         case "$endpwent_r_proto" in
11914         ''|0) try='int endpwent_r(FILE**);'
11915         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11916         esac
11917         case "$endpwent_r_proto" in
11918         ''|0) try='void endpwent_r(FILE**);'
11919         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11920         esac
11921         case "$endpwent_r_proto" in
11922         ''|0)   d_endpwent_r=undef
11923                 endpwent_r_proto=0
11924                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11925         * )     case "$endpwent_r_proto" in
11926                 REENTRANT_PROTO*) ;;
11927                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11928                 esac
11929                 echo "Prototype: $try" ;;
11930         esac
11931         ;;
11932         *)      case "$usethreads" in
11933                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11934                 esac
11935                 d_endpwent_r=undef
11936                 endpwent_r_proto=0
11937                 ;;
11938         esac
11939         ;;
11940 *)      endpwent_r_proto=0
11941         ;;
11942 esac
11943
11944 : see if endservent exists
11945 set endservent d_endsent
11946 eval $inlibc
11947
11948 : see if endservent_r exists
11949 set endservent_r d_endservent_r
11950 eval $inlibc
11951 case "$d_endservent_r" in
11952 "$define")
11953         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11954         case "$d_endservent_r_proto:$usethreads" in
11955         ":define")      d_endservent_r_proto=define
11956                 set d_endservent_r_proto endservent_r $hdrs
11957                 eval $hasproto ;;
11958         *)      ;;
11959         esac
11960         case "$d_endservent_r_proto" in
11961         define)
11962         case "$endservent_r_proto" in
11963         ''|0) try='int endservent_r(struct servent_data*);'
11964         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11965         esac
11966         case "$endservent_r_proto" in
11967         ''|0) try='void endservent_r(struct servent_data*);'
11968         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11969         esac
11970         case "$endservent_r_proto" in
11971         ''|0)   d_endservent_r=undef
11972                 endservent_r_proto=0
11973                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11974         * )     case "$endservent_r_proto" in
11975                 REENTRANT_PROTO*) ;;
11976                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11977                 esac
11978                 echo "Prototype: $try" ;;
11979         esac
11980         ;;
11981         *)      case "$usethreads" in
11982                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11983                 esac
11984                 d_endservent_r=undef
11985                 endservent_r_proto=0
11986                 ;;
11987         esac
11988         ;;
11989 *)      endservent_r_proto=0
11990         ;;
11991 esac
11992
11993 : Locate the flags for 'open()'
11994 echo " "
11995 $cat >try.c <<EOCP
11996 #include <sys/types.h>
11997 #ifdef I_FCNTL
11998 #include <fcntl.h>
11999 #endif
12000 #ifdef I_SYS_FILE
12001 #include <sys/file.h>
12002 #endif
12003 #$i_stdlib I_STDLIB
12004 #ifdef I_STDLIB
12005 #include <stdlib.h>
12006 #endif
12007 int main() {
12008         if(O_RDONLY);
12009 #ifdef O_TRUNC
12010         exit(0);
12011 #else
12012         exit(1);
12013 #endif
12014 }
12015 EOCP
12016 : check sys/file.h first to get FREAD on Sun
12017 if $test `./findhdr sys/file.h` && \
12018                 set try -DI_SYS_FILE && eval $compile; then
12019         h_sysfile=true;
12020         echo "<sys/file.h> defines the O_* constants..." >&4
12021         if $run ./try; then
12022                 echo "and you have the 3 argument form of open()." >&4
12023                 val="$define"
12024         else
12025                 echo "but not the 3 argument form of open().  Oh, well." >&4
12026                 val="$undef"
12027         fi
12028 elif $test `./findhdr fcntl.h` && \
12029                 set try -DI_FCNTL && eval $compile; then
12030         h_fcntl=true;
12031         echo "<fcntl.h> defines the O_* constants..." >&4
12032         if $run ./try; then
12033                 echo "and you have the 3 argument form of open()." >&4
12034                 val="$define"
12035         else
12036                 echo "but not the 3 argument form of open().  Oh, well." >&4
12037                 val="$undef"
12038         fi
12039 else
12040         val="$undef"
12041         echo "I can't find the O_* constant definitions!  You got problems." >&4
12042 fi
12043 set d_open3
12044 eval $setvar
12045 $rm -f try try.*
12046
12047 : see which of string.h or strings.h is needed
12048 echo " "
12049 strings=`./findhdr string.h`
12050 if $test "$strings" && $test -r "$strings"; then
12051         echo "Using <string.h> instead of <strings.h>." >&4
12052         val="$define"
12053 else
12054         val="$undef"
12055         strings=`./findhdr strings.h`
12056         if $test "$strings" && $test -r "$strings"; then
12057                 echo "Using <strings.h> instead of <string.h>." >&4
12058         else
12059                 echo "No string header found -- You'll surely have problems." >&4
12060         fi
12061 fi
12062 set i_string
12063 eval $setvar
12064 case "$i_string" in
12065 "$undef") strings=`./findhdr strings.h`;;
12066 *)        strings=`./findhdr string.h`;;
12067 esac
12068
12069 : see if this is a sys/file.h system
12070 val=''
12071 set sys/file.h val
12072 eval $inhdr
12073
12074 : do we need to include sys/file.h ?
12075 case "$val" in
12076 "$define")
12077         echo " "
12078         if $h_sysfile; then
12079                 val="$define"
12080                 echo "We'll be including <sys/file.h>." >&4
12081         else
12082                 val="$undef"
12083                 echo "We won't be including <sys/file.h>." >&4
12084         fi
12085         ;;
12086 *)
12087         h_sysfile=false
12088         ;;
12089 esac
12090 set i_sysfile
12091 eval $setvar
12092
12093 : see if fcntl.h is there
12094 val=''
12095 set fcntl.h val
12096 eval $inhdr
12097
12098 : see if we can include fcntl.h
12099 case "$val" in
12100 "$define")
12101         echo " "
12102         if $h_fcntl; then
12103                 val="$define"
12104                 echo "We'll be including <fcntl.h>." >&4
12105         else
12106                 val="$undef"
12107                 if $h_sysfile; then
12108         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12109                 else
12110                         echo "We won't be including <fcntl.h>." >&4
12111                 fi
12112         fi
12113         ;;
12114 *)
12115         h_fcntl=false
12116         val="$undef"
12117         ;;
12118 esac
12119 set i_fcntl
12120 eval $setvar
12121
12122 : check for non-blocking I/O stuff
12123 case "$h_sysfile" in
12124 true) echo "#include <sys/file.h>" > head.c;;
12125 *)
12126        case "$h_fcntl" in
12127        true) echo "#include <fcntl.h>" > head.c;;
12128        *) echo "#include <sys/fcntl.h>" > head.c;;
12129        esac
12130        ;;
12131 esac
12132 echo " "
12133 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12134 case "$o_nonblock" in
12135 '')
12136         $cat head.c > try.c
12137         $cat >>try.c <<EOCP
12138 #include <stdio.h>
12139 #$i_stdlib I_STDLIB
12140 #ifdef I_STDLIB
12141 #include <stdlib.h>
12142 #endif
12143 #$i_fcntl I_FCNTL
12144 #ifdef I_FCNTL
12145 #include <fcntl.h>
12146 #endif
12147 int main() {
12148 #ifdef O_NONBLOCK
12149         printf("O_NONBLOCK\n");
12150         exit(0);
12151 #endif
12152 #ifdef O_NDELAY
12153         printf("O_NDELAY\n");
12154         exit(0);
12155 #endif
12156 #ifdef FNDELAY
12157         printf("FNDELAY\n");
12158         exit(0);
12159 #endif
12160         exit(0);
12161 }
12162 EOCP
12163         set try
12164         if eval $compile_ok; then
12165                 o_nonblock=`$run ./try`
12166                 case "$o_nonblock" in
12167                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12168                 *) echo "Seems like we can use $o_nonblock.";;
12169                 esac
12170         else
12171                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12172         fi
12173         ;;
12174 *) echo "Using $hint value $o_nonblock.";;
12175 esac
12176 $rm -f try try.* .out core
12177
12178 echo " "
12179 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12180 case "$eagain" in
12181 '')
12182         $cat head.c > try.c
12183         $cat >>try.c <<EOCP
12184 #include <errno.h>
12185 #include <sys/types.h>
12186 #include <signal.h>
12187 #include <stdio.h> 
12188 #$i_stdlib I_STDLIB
12189 #ifdef I_STDLIB
12190 #include <stdlib.h>
12191 #endif
12192 #$i_fcntl I_FCNTL
12193 #ifdef I_FCNTL
12194 #include <fcntl.h>
12195 #endif
12196 #define MY_O_NONBLOCK $o_nonblock
12197 #ifndef errno  /* XXX need better Configure test */
12198 extern int errno;
12199 #endif
12200 #$i_unistd I_UNISTD
12201 #ifdef I_UNISTD
12202 #include <unistd.h>
12203 #endif
12204 #$i_string I_STRING
12205 #ifdef I_STRING
12206 #include <string.h>
12207 #else
12208 #include <strings.h>
12209 #endif
12210 $signal_t blech(int x) { exit(3); }
12211 EOCP
12212         $cat >> try.c <<'EOCP'
12213 int main()
12214 {
12215         int pd[2];
12216         int pu[2];
12217         char buf[1];
12218         char string[100];
12219
12220         pipe(pd);       /* Down: child -> parent */
12221         pipe(pu);       /* Up: parent -> child */
12222         if (0 != fork()) {
12223                 int ret;
12224                 close(pd[1]);   /* Parent reads from pd[0] */
12225                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12226 #ifdef F_SETFL
12227                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12228                         exit(1);
12229 #else
12230                 exit(4);
12231 #endif
12232                 signal(SIGALRM, blech);
12233                 alarm(5);
12234                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12235                         exit(2);
12236                 sprintf(string, "%d\n", ret);
12237                 write(2, string, strlen(string));
12238                 alarm(0);
12239 #ifdef EAGAIN
12240                 if (errno == EAGAIN) {
12241                         printf("EAGAIN\n");
12242                         goto ok;
12243                 }
12244 #endif
12245 #ifdef EWOULDBLOCK
12246                 if (errno == EWOULDBLOCK)
12247                         printf("EWOULDBLOCK\n");
12248 #endif
12249         ok:
12250                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12251                 sleep(2);                               /* Give it time to close our pipe */
12252                 alarm(5);
12253                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12254                 alarm(0);
12255                 sprintf(string, "%d\n", ret);
12256                 write(4, string, strlen(string));
12257                 exit(0);
12258         }
12259
12260         close(pd[0]);                   /* We write to pd[1] */
12261         close(pu[1]);                   /* We read from pu[0] */
12262         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12263         close(pd[1]);                   /* Pipe pd is now fully closed! */
12264         exit(0);                                /* Bye bye, thank you for playing! */
12265 }
12266 EOCP
12267         set try
12268         if eval $compile_ok; then
12269                 echo "$startsh" >mtry
12270                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12271                 chmod +x mtry
12272                 ./mtry >/dev/null 2>&1
12273                 case $? in
12274                 0) eagain=`$cat try.out`;;
12275                 1) echo "Could not perform non-blocking setting!";;
12276                 2) echo "I did a successful read() for something that was not there!";;
12277                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12278                 4) echo "Could not find F_SETFL!";;
12279                 *) echo "Something terribly wrong happened during testing.";;
12280                 esac
12281                 rd_nodata=`$cat try.ret`
12282                 echo "A read() system call with no data present returns $rd_nodata."
12283                 case "$rd_nodata" in
12284                 0|-1) ;;
12285                 *)
12286                         echo "(That's peculiar, fixing that to be -1.)"
12287                         rd_nodata=-1
12288                         ;;
12289                 esac
12290                 case "$eagain" in
12291                 '')
12292                         echo "Forcing errno EAGAIN on read() with no data available."
12293                         eagain=EAGAIN
12294                         ;;
12295                 *)
12296                         echo "Your read() sets errno to $eagain when no data is available."
12297                         ;;
12298                 esac
12299                 status=`$cat try.err`
12300                 case "$status" in
12301                 0) echo "And it correctly returns 0 to signal EOF.";;
12302                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12303                 *) echo "However, your read() returns '$status' on EOF??";;
12304                 esac
12305                 val="$define"
12306                 if test "$status" = "$rd_nodata"; then
12307                         echo "WARNING: you can't distinguish between EOF and no data!"
12308                         val="$undef"
12309                 fi
12310         else
12311                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12312                 eagain=EAGAIN
12313         fi
12314         set d_eofnblk
12315         eval $setvar
12316         ;;
12317 *)
12318         echo "Using $hint value $eagain."
12319         echo "Your read() returns $rd_nodata when no data is present."
12320         case "$d_eofnblk" in
12321         "$define") echo "And you can see EOF because read() returns 0.";;
12322         "$undef") echo "But you can't see EOF status from read() returned value.";;
12323         *)
12324                 echo "(Assuming you can't see EOF status from read anyway.)"
12325                 d_eofnblk=$undef
12326                 ;;
12327         esac
12328         ;;
12329 esac
12330 $rm -f try try.* .out core head.c mtry
12331
12332 : see if _ptr and _cnt from stdio act std
12333 echo " "
12334
12335 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12336         echo "(Looks like you have stdio.h from BSD.)"
12337         case "$stdio_ptr" in
12338         '') stdio_ptr='((fp)->_p)'
12339                 ptr_lval=$define
12340                 ;;
12341         *)      ptr_lval=$d_stdio_ptr_lval;;
12342         esac
12343         case "$stdio_cnt" in
12344         '') stdio_cnt='((fp)->_r)'
12345                 cnt_lval=$define
12346                 ;;
12347         *)      cnt_lval=$d_stdio_cnt_lval;;
12348         esac
12349         case "$stdio_base" in
12350         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12351         esac
12352         case "$stdio_bufsiz" in
12353         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12354         esac
12355 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12356         echo "(Looks like you have stdio.h from Linux.)"
12357         case "$stdio_ptr" in
12358         '') stdio_ptr='((fp)->_IO_read_ptr)'
12359                 ptr_lval=$define
12360                 ;;
12361         *)      ptr_lval=$d_stdio_ptr_lval;;
12362         esac
12363         case "$stdio_cnt" in
12364         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12365                 cnt_lval=$undef
12366                 ;;
12367         *)      cnt_lval=$d_stdio_cnt_lval;;
12368         esac
12369         case "$stdio_base" in
12370         '') stdio_base='((fp)->_IO_read_base)';;
12371         esac
12372         case "$stdio_bufsiz" in
12373         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12374         esac
12375 else
12376         case "$stdio_ptr" in
12377         '') stdio_ptr='((fp)->_ptr)'
12378                 ptr_lval=$define
12379                 ;;
12380         *)      ptr_lval=$d_stdio_ptr_lval;;
12381         esac
12382         case "$stdio_cnt" in
12383         '') stdio_cnt='((fp)->_cnt)'
12384                 cnt_lval=$define
12385                 ;;
12386         *)      cnt_lval=$d_stdio_cnt_lval;;
12387         esac
12388         case "$stdio_base" in
12389         '') stdio_base='((fp)->_base)';;
12390         esac
12391         case "$stdio_bufsiz" in
12392         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12393         esac
12394 fi
12395
12396 : test whether _ptr and _cnt really work
12397 echo "Checking how std your stdio is..." >&4
12398 $cat >try.c <<EOP
12399 #include <stdio.h>
12400 #$i_stdlib I_STDLIB
12401 #ifdef I_STDLIB
12402 #include <stdlib.h>
12403 #endif
12404 #define FILE_ptr(fp)    $stdio_ptr
12405 #define FILE_cnt(fp)    $stdio_cnt
12406 int main() {
12407         FILE *fp = fopen("try.c", "r");
12408         char c = getc(fp);
12409         if (
12410                 18 <= FILE_cnt(fp) &&
12411                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12412         )
12413                 exit(0);
12414         exit(1);
12415 }
12416 EOP
12417 val="$undef"
12418 set try
12419 if eval $compile && $to try.c; then
12420         if $run ./try; then
12421                 echo "Your stdio acts pretty std."
12422                 val="$define"
12423         else
12424                 echo "Your stdio isn't very std."
12425         fi
12426 else
12427         echo "Your stdio doesn't appear very std."
12428 fi
12429 $rm -f try.c try
12430
12431 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12432 # direct buffer manipulation no longer works.  The Configure tests
12433 # should be changed to correctly detect this, but until then,
12434 # the following check should at least let perl compile and run.
12435 # (This quick fix should be updated before 5.8.1.)
12436 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12437 # A. Dougherty, June 3, 2002.
12438 case "$d_gnulibc" in
12439 $define)
12440         case "$gnulibc_version" in
12441         2.[01]*)  ;;
12442         2.2) ;;
12443         2.2.[0-9]) ;;
12444         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12445                 val="$undef"
12446                 ;;
12447         esac
12448         ;;
12449 esac
12450 set d_stdstdio
12451 eval $setvar
12452
12453 : Can _ptr be used as an lvalue?
12454 case "$d_stdstdio$ptr_lval" in
12455 $define$define) val=$define ;;
12456 *) val=$undef ;;
12457 esac
12458 set d_stdio_ptr_lval
12459 eval $setvar
12460
12461 : Can _cnt be used as an lvalue?
12462 case "$d_stdstdio$cnt_lval" in
12463 $define$define) val=$define ;;
12464 *) val=$undef ;;
12465 esac
12466 set d_stdio_cnt_lval
12467 eval $setvar
12468
12469
12470 : test whether setting _ptr sets _cnt as a side effect
12471 d_stdio_ptr_lval_sets_cnt="$undef"
12472 d_stdio_ptr_lval_nochange_cnt="$undef"
12473 case "$d_stdio_ptr_lval$d_stdstdio" in
12474 $define$define)
12475         echo "Checking to see what happens if we set the stdio ptr..." >&4
12476 $cat >try.c <<EOP
12477 #include <stdio.h>
12478 /* Can we scream? */
12479 /* Eat dust sed :-) */
12480 /* In the buffer space, no one can hear you scream. */
12481 #$i_stdlib I_STDLIB
12482 #ifdef I_STDLIB
12483 #include <stdlib.h>
12484 #endif
12485 #define FILE_ptr(fp)    $stdio_ptr
12486 #define FILE_cnt(fp)    $stdio_cnt
12487 #include <sys/types.h>
12488 int main() {
12489         FILE *fp = fopen("try.c", "r");
12490         int c;
12491         char *ptr;
12492         size_t cnt;
12493         if (!fp) {
12494             puts("Fail even to read");
12495             exit(1);
12496         }
12497         c = getc(fp); /* Read away the first # */
12498         if (c == EOF) {
12499             puts("Fail even to read");
12500             exit(1);
12501         }
12502         if (!(
12503                 18 <= FILE_cnt(fp) &&
12504                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12505         )) {
12506                 puts("Fail even to read");
12507                 exit (1);
12508         }
12509         ptr = (char*) FILE_ptr(fp);
12510         cnt = (size_t)FILE_cnt(fp);
12511
12512         FILE_ptr(fp) += 42;
12513
12514         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12515                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12516                 exit (1);
12517         }
12518         if (FILE_cnt(fp) <= 20) {
12519                 printf ("Fail (<20 chars to test)");
12520                 exit (1);
12521         }
12522         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12523                 puts("Fail compare");
12524                 exit (1);
12525         }
12526         if (cnt == FILE_cnt(fp)) {
12527                 puts("Pass_unchanged");
12528                 exit (0);
12529         }       
12530         if (FILE_cnt(fp) == (cnt - 42)) {
12531                 puts("Pass_changed");
12532                 exit (0);
12533         }
12534         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12535         return 1;
12536
12537 }
12538 EOP
12539         set try
12540         if eval $compile && $to try.c; then
12541                 case `$run ./try` in
12542                 Pass_changed)
12543                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12544                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12545                 Pass_unchanged)
12546                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12547                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12548                 Fail*)
12549                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12550                 *)
12551                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12552         esac
12553         else
12554                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12555         fi
12556         $rm -f try.c try
12557         ;;
12558 esac
12559
12560 : see if _base is also standard
12561 val="$undef"
12562 case "$d_stdstdio" in
12563 $define)
12564         $cat >try.c <<EOP
12565 #include <stdio.h>
12566 #$i_stdlib I_STDLIB
12567 #ifdef I_STDLIB
12568 #include <stdlib.h>
12569 #endif
12570 #define FILE_base(fp)   $stdio_base
12571 #define FILE_bufsiz(fp) $stdio_bufsiz
12572 int main() {
12573         FILE *fp = fopen("try.c", "r");
12574         char c = getc(fp);
12575         if (
12576                 19 <= FILE_bufsiz(fp) &&
12577                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12578         )
12579                 exit(0);
12580         exit(1);
12581 }
12582 EOP
12583         set try
12584         if eval $compile && $to try.c; then
12585                 if $run ./try; then
12586                         echo "And its _base field acts std."
12587                         val="$define"
12588                 else
12589                         echo "But its _base field isn't std."
12590                 fi
12591         else
12592                 echo "However, it seems to be lacking the _base field."
12593         fi
12594         $rm -f try.c try
12595         ;;
12596 esac
12597 set d_stdiobase
12598 eval $setvar
12599
12600 : see if fast_stdio exists
12601 val="$undef"
12602 case "$d_stdstdio:$d_stdio_ptr_lval" in
12603 "$define:$define")
12604         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12605         *$define*)
12606                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12607                 val="$define"
12608                 ;;
12609         esac
12610         ;;
12611 esac
12612 set d_faststdio
12613 eval $setvar
12614
12615
12616
12617 : see if fchdir exists
12618 set fchdir d_fchdir
12619 eval $inlibc
12620
12621 : see if fchmod exists
12622 set fchmod d_fchmod
12623 eval $inlibc
12624
12625 : see if fchown exists
12626 set fchown d_fchown
12627 eval $inlibc
12628
12629 : see if this is an fcntl system
12630 set fcntl d_fcntl
12631 eval $inlibc
12632
12633 echo " "
12634 : See if fcntl-based locking works.
12635 $cat >try.c <<EOCP
12636 #$i_stdlib I_STDLIB
12637 #ifdef I_STDLIB
12638 #include <stdlib.h>
12639 #endif
12640 #include <unistd.h>
12641 #include <fcntl.h>
12642 #include <signal.h>
12643 $signal_t blech(int x) { exit(3); }
12644 int main() {
12645 #if defined(F_SETLK) && defined(F_SETLKW)
12646      struct flock flock;
12647      int retval, fd;
12648      fd = open("try.c", O_RDONLY);
12649      flock.l_type = F_RDLCK;
12650      flock.l_whence = SEEK_SET;
12651      flock.l_start = flock.l_len = 0;
12652      signal(SIGALRM, blech);
12653      alarm(10);
12654      retval = fcntl(fd, F_SETLK, &flock);
12655      close(fd);
12656      (retval < 0 ? exit(2) : exit(0));
12657 #else
12658      exit(2);
12659 #endif
12660 }
12661 EOCP
12662 echo "Checking if fcntl-based file locking works... "
12663 case "$d_fcntl" in
12664 "$define")
12665         set try
12666         if eval $compile_ok; then
12667                 if $run ./try; then
12668                         echo "Yes, it seems to work."
12669                         val="$define"
12670                 else
12671                         echo "Nope, it didn't work."
12672                         val="$undef"
12673                         case "$?" in
12674                         3) $cat >&4 <<EOM
12675 ***
12676 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12677 *** This is (almost) impossible.
12678 *** If your NFS lock daemons are not feeling well, something like
12679 *** this may happen, please investigate.  Cannot continue, aborting.
12680 ***
12681 EOM
12682                                 exit 1
12683                                 ;;
12684                         esac
12685                 fi
12686         else
12687                 echo "I'm unable to compile the test program, so I'll assume not."
12688                 val="$undef"
12689         fi
12690         ;;
12691 *) val="$undef";
12692         echo "Nope, since you don't even have fcntl()."
12693         ;;
12694 esac
12695 set d_fcntl_can_lock
12696 eval $setvar
12697 $rm -f try*
12698
12699
12700 : check for fd_set items
12701 $cat <<EOM
12702
12703 Checking to see how well your C compiler handles fd_set and friends ...
12704 EOM
12705 $cat >try.c <<EOCP
12706 #$i_stdlib I_STDLIB
12707 #ifdef I_STDLIB
12708 #include <stdlib.h>
12709 #endif
12710 #$i_systime I_SYS_TIME
12711 #$i_sysselct I_SYS_SELECT
12712 #$d_socket HAS_SOCKET
12713 #include <sys/types.h>
12714 #ifdef HAS_SOCKET
12715 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12716 #endif
12717 #ifdef I_SYS_TIME
12718 #include <sys/time.h>
12719 #endif
12720 #ifdef I_SYS_SELECT
12721 #include <sys/select.h>
12722 #endif
12723 int main() {
12724         fd_set fds;
12725
12726 #ifdef TRYBITS
12727         if(fds.fds_bits);
12728 #endif
12729
12730 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12731         exit(0);
12732 #else
12733         exit(1);
12734 #endif
12735 }
12736 EOCP
12737 set try -DTRYBITS
12738 if eval $compile; then
12739         d_fds_bits="$define"
12740         d_fd_set="$define"
12741         echo "Well, your system knows about the normal fd_set typedef..." >&4
12742         if $run ./try; then
12743                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12744                 d_fd_macros="$define"
12745         else
12746                 $cat >&4 <<'EOM'
12747 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12748 EOM
12749                 d_fd_macros="$undef"
12750         fi
12751 else
12752         $cat <<'EOM'
12753 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12754 EOM
12755         set try
12756         if eval $compile; then
12757                 d_fds_bits="$undef"
12758                 d_fd_set="$define"
12759                 echo "Well, your system has some sort of fd_set available..." >&4
12760                 if $run ./try; then
12761                         echo "and you have the normal fd_set macros." >&4
12762                         d_fd_macros="$define"
12763                 else
12764                         $cat <<'EOM'
12765 but not the normal fd_set macros!  Gross!  More work for me...
12766 EOM
12767                         d_fd_macros="$undef"
12768                 fi
12769         else
12770         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12771                 d_fd_set="$undef"
12772                 d_fds_bits="$undef"
12773                 d_fd_macros="$undef"
12774         fi
12775 fi
12776 $rm -f try try.*
12777
12778 : see if fgetpos exists
12779 set fgetpos d_fgetpos
12780 eval $inlibc
12781
12782 : see if finite exists
12783 set finite d_finite
12784 eval $inlibc
12785
12786 : see if finitel exists
12787 set finitel d_finitel
12788 eval $inlibc
12789
12790 : see if flock exists
12791 set flock d_flock
12792 eval $inlibc
12793
12794 : see if prototype for flock is available
12795 echo " "
12796 set d_flockproto flock $i_sysfile sys/file.h
12797 eval $hasproto
12798
12799 : see if fork exists
12800 set fork d_fork
12801 eval $inlibc
12802
12803 : see if fp_class exists
12804 set fp_class d_fp_class
12805 eval $inlibc
12806
12807 : see if pathconf exists
12808 set pathconf d_pathconf
12809 eval $inlibc
12810
12811 : see if fpathconf exists
12812 set fpathconf d_fpathconf
12813 eval $inlibc
12814
12815 : see if fpclass exists
12816 set fpclass d_fpclass
12817 eval $inlibc
12818
12819 : see if fpclassify exists
12820 set fpclassify d_fpclassify
12821 eval $inlibc
12822
12823 : see if fpclassl exists
12824 set fpclassl d_fpclassl
12825 eval $inlibc
12826
12827
12828 : check for fpos64_t
12829 echo " "
12830 echo "Checking to see if you have fpos64_t..." >&4
12831 $cat >try.c <<EOCP
12832 #include <stdio.h>
12833 int main() { fpos64_t x = 7; }
12834 EOCP
12835 set try
12836 if eval $compile; then
12837         val="$define"
12838         echo "You have fpos64_t."
12839 else
12840         val="$undef"
12841         echo "You do not have fpos64_t."
12842         case "$fpossize" in
12843         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12844         esac
12845 fi
12846 $rm -f try.* try
12847 set d_fpos64_t
12848 eval $setvar
12849
12850 : see if frexpl exists
12851 set frexpl d_frexpl
12852 eval $inlibc
12853
12854 : see if this is a sys/param system
12855 set sys/param.h i_sysparam
12856 eval $inhdr
12857
12858 : see if this is a sys/mount.h system
12859 set sys/mount.h i_sysmount
12860 eval $inhdr
12861
12862
12863 echo " "
12864 echo "Checking to see if your system supports struct fs_data..." >&4
12865 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12866 eval $hasstruct
12867 case "$d_fs_data_s" in
12868 "$define")      echo "Yes, it does."   ;;
12869 *)              echo "No, it doesn't." ;;
12870 esac
12871
12872 : see if fseeko exists
12873 set fseeko d_fseeko
12874 eval $inlibc
12875 case "$longsize" in
12876 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12877 esac
12878
12879 : see if fsetpos exists
12880 set fsetpos d_fsetpos
12881 eval $inlibc
12882
12883
12884 : see if fstatfs exists
12885 set fstatfs d_fstatfs
12886 eval $inlibc
12887
12888
12889 : see if statvfs exists
12890 set statvfs d_statvfs
12891 eval $inlibc
12892
12893 : see if fstatvfs exists
12894 set fstatvfs d_fstatvfs
12895 eval $inlibc
12896
12897
12898 : see if fsync exists
12899 set fsync d_fsync
12900 eval $inlibc
12901
12902 : see if ftello exists
12903 set ftello d_ftello
12904 eval $inlibc
12905 case "$longsize" in
12906 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12907 esac
12908
12909 d_futimes="$undef"
12910 : check for a working futimes
12911 echo " "
12912 echo "Checking for a working futimes()" >&4
12913 $cat >try.c <<EOCP
12914 #include <stdio.h>
12915 #include <sys/time.h>
12916 #include <errno.h>
12917 #include <fcntl.h>
12918
12919 int main ()
12920 {
12921     int fd, rv;
12922     fd = open ("try.c", O_RDWR);
12923     if (-1 == fd) exit (1);
12924     rv = futimes (fd, NULL);
12925     exit (rv == -1 ? errno : 0);
12926 }
12927 EOCP
12928 set try
12929 if eval $compile; then
12930     `$run ./try`
12931     rc=$?
12932     case "$rc" in
12933         0)  echo "Yes, it does" >&4
12934             d_futimes="$define"
12935             ;;
12936         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12937             ;;
12938     esac
12939 else
12940     echo "No, it does not (probably harmless)\n" >&4
12941 fi
12942 $rm -f try.* try core core.try.*
12943
12944 : see if getcwd exists
12945 set getcwd d_getcwd
12946 eval $inlibc
12947
12948 : see if getespwnam exists
12949 set getespwnam d_getespwnam
12950 eval $inlibc
12951
12952
12953 : see if getfsstat exists
12954 set getfsstat d_getfsstat
12955 eval $inlibc
12956
12957 : see if getgrent exists
12958 set getgrent d_getgrent
12959 eval $inlibc
12960
12961 : see if getgrent_r exists
12962 set getgrent_r d_getgrent_r
12963 eval $inlibc
12964 case "$d_getgrent_r" in
12965 "$define")
12966         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12967         case "$d_getgrent_r_proto:$usethreads" in
12968         ":define")      d_getgrent_r_proto=define
12969                 set d_getgrent_r_proto getgrent_r $hdrs
12970                 eval $hasproto ;;
12971         *)      ;;
12972         esac
12973         case "$d_getgrent_r_proto" in
12974         define)
12975         case "$getgrent_r_proto" in
12976         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12977         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12978         esac
12979         case "$getgrent_r_proto" in
12980         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12981         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12982         esac
12983         case "$getgrent_r_proto" in
12984         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12985         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12986         esac
12987         case "$getgrent_r_proto" in
12988         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12989         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12990         esac
12991         case "$getgrent_r_proto" in
12992         ''|0) try='int getgrent_r(struct group*, char*, int);'
12993         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12994         esac
12995         case "$getgrent_r_proto" in
12996         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12997         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12998         esac
12999         case "$getgrent_r_proto" in
13000         ''|0)   d_getgrent_r=undef
13001                 getgrent_r_proto=0
13002                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13003         * )     case "$getgrent_r_proto" in
13004                 REENTRANT_PROTO*) ;;
13005                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13006                 esac
13007                 echo "Prototype: $try" ;;
13008         esac
13009         ;;
13010         *)      case "$usethreads" in
13011                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13012                 esac
13013                 d_getgrent_r=undef
13014                 getgrent_r_proto=0
13015                 ;;
13016         esac
13017         ;;
13018 *)      getgrent_r_proto=0
13019         ;;
13020 esac
13021
13022 : see if getgrgid_r exists
13023 set getgrgid_r d_getgrgid_r
13024 eval $inlibc
13025 case "$d_getgrgid_r" in
13026 "$define")
13027         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13028         case "$d_getgrgid_r_proto:$usethreads" in
13029         ":define")      d_getgrgid_r_proto=define
13030                 set d_getgrgid_r_proto getgrgid_r $hdrs
13031                 eval $hasproto ;;
13032         *)      ;;
13033         esac
13034         case "$d_getgrgid_r_proto" in
13035         define)
13036         case "$getgrgid_r_proto" in
13037         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13038         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13039         esac
13040         case "$getgrgid_r_proto" in
13041         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13042         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13043         esac
13044         case "$getgrgid_r_proto" in
13045         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13046         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13047         esac
13048         case "$getgrgid_r_proto" in
13049         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13050         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13051         esac
13052         case "$getgrgid_r_proto" in
13053         ''|0)   d_getgrgid_r=undef
13054                 getgrgid_r_proto=0
13055                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13056         * )     case "$getgrgid_r_proto" in
13057                 REENTRANT_PROTO*) ;;
13058                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13059                 esac
13060                 echo "Prototype: $try" ;;
13061         esac
13062         ;;
13063         *)      case "$usethreads" in
13064                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13065                 esac
13066                 d_getgrgid_r=undef
13067                 getgrgid_r_proto=0
13068                 ;;
13069         esac
13070         ;;
13071 *)      getgrgid_r_proto=0
13072         ;;
13073 esac
13074
13075 : see if getgrnam_r exists
13076 set getgrnam_r d_getgrnam_r
13077 eval $inlibc
13078 case "$d_getgrnam_r" in
13079 "$define")
13080         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13081         case "$d_getgrnam_r_proto:$usethreads" in
13082         ":define")      d_getgrnam_r_proto=define
13083                 set d_getgrnam_r_proto getgrnam_r $hdrs
13084                 eval $hasproto ;;
13085         *)      ;;
13086         esac
13087         case "$d_getgrnam_r_proto" in
13088         define)
13089         case "$getgrnam_r_proto" in
13090         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13091         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13092         esac
13093         case "$getgrnam_r_proto" in
13094         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13095         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13096         esac
13097         case "$getgrnam_r_proto" in
13098         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13099         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13100         esac
13101         case "$getgrnam_r_proto" in
13102         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13103         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13104         esac
13105         case "$getgrnam_r_proto" in
13106         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13107         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13108         esac
13109         case "$getgrnam_r_proto" in
13110         ''|0)   d_getgrnam_r=undef
13111                 getgrnam_r_proto=0
13112                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13113         * )     case "$getgrnam_r_proto" in
13114                 REENTRANT_PROTO*) ;;
13115                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13116                 esac
13117                 echo "Prototype: $try" ;;
13118         esac
13119         ;;
13120         *)      case "$usethreads" in
13121                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13122                 esac
13123                 d_getgrnam_r=undef
13124                 getgrnam_r_proto=0
13125                 ;;
13126         esac
13127         ;;
13128 *)      getgrnam_r_proto=0
13129         ;;
13130 esac
13131
13132 : see if gethostbyaddr exists
13133 set gethostbyaddr d_gethbyaddr
13134 eval $inlibc
13135
13136 : see if gethostbyname exists
13137 set gethostbyname d_gethbyname
13138 eval $inlibc
13139
13140 : see if gethostent exists
13141 set gethostent d_gethent
13142 eval $inlibc
13143
13144 : see how we will look up host name
13145 echo " "
13146 call=''
13147 if set gethostname val -f d_gethname; eval $csym; $val; then
13148         echo 'gethostname() found.' >&4
13149         d_gethname="$define"
13150         call=gethostname
13151 fi
13152 if set uname val -f d_uname; eval $csym; $val; then
13153         if ./xenix; then
13154                 $cat <<'EOM'
13155 uname() was found, but you're running xenix, and older versions of xenix
13156 have a broken uname(). If you don't really know whether your xenix is old
13157 enough to have a broken system call, use the default answer.
13158
13159 EOM
13160                 dflt=y
13161                 case "$d_uname" in
13162                 "$define") dflt=n;;
13163                 esac
13164                 rp='Is your uname() broken?'
13165                 . ./myread
13166                 case "$ans" in
13167                 n*) d_uname="$define"; call=uname;;
13168                 esac
13169         else
13170                 echo 'uname() found.' >&4
13171                 d_uname="$define"
13172                 case "$call" in
13173                 '') call=uname ;;
13174                 esac
13175         fi
13176 fi
13177 case "$d_gethname" in
13178 '') d_gethname="$undef";;
13179 esac
13180 case "$d_uname" in
13181 '') d_uname="$undef";;
13182 esac
13183 case "$d_uname$d_gethname" in
13184 *define*)
13185         dflt=n
13186         cat <<EOM
13187  
13188 Every now and then someone has a $call() that lies about the hostname
13189 but can't be fixed for political or economic reasons.  If you wish, I can
13190 pretend $call() isn't there and maybe compute hostname at run-time
13191 thanks to the '$phostname' command.
13192
13193 EOM
13194         rp="Shall I ignore $call() from now on?"
13195         . ./myread
13196         case "$ans" in
13197         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13198         esac;;
13199 esac
13200 case "$phostname" in
13201 '') aphostname='';;
13202 *) case "$aphostname" in
13203         /*) ;;
13204         *) set X $phostname
13205                 shift
13206                 file=$1
13207                 shift
13208                 file=`./loc $file $file $pth`
13209                 aphostname=`echo $file $*`
13210                 ;;
13211         esac
13212         ;;
13213 esac
13214 case "$d_uname$d_gethname" in
13215 *define*) ;;
13216 *)
13217         case "$phostname" in
13218         '')
13219                 echo "There will be no way for $package to get your hostname." >&4;;
13220         *)
13221         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13222                 ;;
13223         esac;;
13224 esac
13225 case "$d_phostname" in
13226 '') d_phostname="$undef";;
13227 esac
13228
13229 : see if gethostbyaddr_r exists
13230 set gethostbyaddr_r d_gethostbyaddr_r
13231 eval $inlibc
13232 case "$d_gethostbyaddr_r" in
13233 "$define")
13234         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13235         case "$d_gethostbyaddr_r_proto:$usethreads" in
13236         ":define")      d_gethostbyaddr_r_proto=define
13237                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13238                 eval $hasproto ;;
13239         *)      ;;
13240         esac
13241         case "$d_gethostbyaddr_r_proto" in
13242         define)
13243         case "$gethostbyaddr_r_proto" in
13244         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13245         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13246         esac
13247         case "$gethostbyaddr_r_proto" in
13248         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13249         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13250         esac
13251         case "$gethostbyaddr_r_proto" in
13252         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13253         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13254         esac
13255         case "$gethostbyaddr_r_proto" in
13256         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13257         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13258         esac
13259         case "$gethostbyaddr_r_proto" in
13260         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13261         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13262         esac
13263         case "$gethostbyaddr_r_proto" in
13264         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13265         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13266         esac
13267         case "$gethostbyaddr_r_proto" in
13268         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13269         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13270         esac
13271         case "$gethostbyaddr_r_proto" in
13272         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13273         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13274         esac
13275         case "$gethostbyaddr_r_proto" in
13276         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13277         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13278         esac
13279         case "$gethostbyaddr_r_proto" in
13280         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13281         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13282         esac
13283         case "$gethostbyaddr_r_proto" in
13284         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13285         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13286         esac
13287         case "$gethostbyaddr_r_proto" in
13288         ''|0)   d_gethostbyaddr_r=undef
13289                 gethostbyaddr_r_proto=0
13290                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13291         * )     case "$gethostbyaddr_r_proto" in
13292                 REENTRANT_PROTO*) ;;
13293                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13294                 esac
13295                 echo "Prototype: $try" ;;
13296         esac
13297         ;;
13298         *)      case "$usethreads" in
13299                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13300                 esac
13301                 d_gethostbyaddr_r=undef
13302                 gethostbyaddr_r_proto=0
13303                 ;;
13304         esac
13305         ;;
13306 *)      gethostbyaddr_r_proto=0
13307         ;;
13308 esac
13309
13310 : see if gethostbyname_r exists
13311 set gethostbyname_r d_gethostbyname_r
13312 eval $inlibc
13313 case "$d_gethostbyname_r" in
13314 "$define")
13315         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13316         case "$d_gethostbyname_r_proto:$usethreads" in
13317         ":define")      d_gethostbyname_r_proto=define
13318                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13319                 eval $hasproto ;;
13320         *)      ;;
13321         esac
13322         case "$d_gethostbyname_r_proto" in
13323         define)
13324         case "$gethostbyname_r_proto" in
13325         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13326         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13327         esac
13328         case "$gethostbyname_r_proto" in
13329         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13330         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13331         esac
13332         case "$gethostbyname_r_proto" in
13333         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13334         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13335         esac
13336         case "$gethostbyname_r_proto" in
13337         ''|0)   d_gethostbyname_r=undef
13338                 gethostbyname_r_proto=0
13339                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13340         * )     case "$gethostbyname_r_proto" in
13341                 REENTRANT_PROTO*) ;;
13342                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13343                 esac
13344                 echo "Prototype: $try" ;;
13345         esac
13346         ;;
13347         *)      case "$usethreads" in
13348                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13349                 esac
13350                 d_gethostbyname_r=undef
13351                 gethostbyname_r_proto=0
13352                 ;;
13353         esac
13354         ;;
13355 *)      gethostbyname_r_proto=0
13356         ;;
13357 esac
13358
13359 : see if gethostent_r exists
13360 set gethostent_r d_gethostent_r
13361 eval $inlibc
13362 case "$d_gethostent_r" in
13363 "$define")
13364         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13365         case "$d_gethostent_r_proto:$usethreads" in
13366         ":define")      d_gethostent_r_proto=define
13367                 set d_gethostent_r_proto gethostent_r $hdrs
13368                 eval $hasproto ;;
13369         *)      ;;
13370         esac
13371         case "$d_gethostent_r_proto" in
13372         define)
13373         case "$gethostent_r_proto" in
13374         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13375         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13376         esac
13377         case "$gethostent_r_proto" in
13378         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13379         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13380         esac
13381         case "$gethostent_r_proto" in
13382         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13383         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13384         esac
13385         case "$gethostent_r_proto" in
13386         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13387         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13388         esac
13389         case "$gethostent_r_proto" in
13390         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13391         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13392         esac
13393         case "$gethostent_r_proto" in
13394         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13395         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13396         esac
13397         case "$gethostent_r_proto" in
13398         ''|0)   d_gethostent_r=undef
13399                 gethostent_r_proto=0
13400                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13401         * )     case "$gethostent_r_proto" in
13402                 REENTRANT_PROTO*) ;;
13403                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13404                 esac
13405                 echo "Prototype: $try" ;;
13406         esac
13407         ;;
13408         *)      case "$usethreads" in
13409                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13410                 esac
13411                 d_gethostent_r=undef
13412                 gethostent_r_proto=0
13413                 ;;
13414         esac
13415         ;;
13416 *)      gethostent_r_proto=0
13417         ;;
13418 esac
13419
13420 : see if prototypes for various gethostxxx netdb.h functions are available
13421 echo " "
13422 set d_gethostprotos gethostent $i_netdb netdb.h
13423 eval $hasproto
13424
13425 : see if getitimer exists
13426 set getitimer d_getitimer
13427 eval $inlibc
13428
13429 : see if getlogin exists
13430 set getlogin d_getlogin
13431 eval $inlibc
13432
13433 : see if getlogin_r exists
13434 set getlogin_r d_getlogin_r
13435 eval $inlibc
13436 case "$d_getlogin_r" in
13437 "$define")
13438         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13439         case "$d_getlogin_r_proto:$usethreads" in
13440         ":define")      d_getlogin_r_proto=define
13441                 set d_getlogin_r_proto getlogin_r $hdrs
13442                 eval $hasproto ;;
13443         *)      ;;
13444         esac
13445         case "$d_getlogin_r_proto" in
13446         define)
13447         case "$getlogin_r_proto" in
13448         ''|0) try='int getlogin_r(char*, size_t);'
13449         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13450         esac
13451         case "$getlogin_r_proto" in
13452         ''|0) try='int getlogin_r(char*, int);'
13453         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13454         esac
13455         case "$getlogin_r_proto" in
13456         ''|0) try='char* getlogin_r(char*, size_t);'
13457         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13458         esac
13459         case "$getlogin_r_proto" in
13460         ''|0) try='char* getlogin_r(char*, int);'
13461         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13462         esac
13463         case "$getlogin_r_proto" in
13464         ''|0)   d_getlogin_r=undef
13465                 getlogin_r_proto=0
13466                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13467         * )     case "$getlogin_r_proto" in
13468                 REENTRANT_PROTO*) ;;
13469                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13470                 esac
13471                 echo "Prototype: $try" ;;
13472         esac
13473         ;;
13474         *)      case "$usethreads" in
13475                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13476                 esac
13477                 d_getlogin_r=undef
13478                 getlogin_r_proto=0
13479                 ;;
13480         esac
13481         ;;
13482 *)      getlogin_r_proto=0
13483         ;;
13484 esac
13485
13486 : see if getmnt exists
13487 set getmnt d_getmnt
13488 eval $inlibc
13489
13490 : see if getmntent exists
13491 set getmntent d_getmntent
13492 eval $inlibc
13493
13494 : see if getnetbyaddr exists
13495 set getnetbyaddr d_getnbyaddr
13496 eval $inlibc
13497
13498 : see if getnetbyname exists
13499 set getnetbyname d_getnbyname
13500 eval $inlibc
13501
13502 : see if getnetent exists
13503 set getnetent d_getnent
13504 eval $inlibc
13505
13506 : see if getnetbyaddr_r exists
13507 set getnetbyaddr_r d_getnetbyaddr_r
13508 eval $inlibc
13509 case "$d_getnetbyaddr_r" in
13510 "$define")
13511         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13512         case "$d_getnetbyaddr_r_proto:$usethreads" in
13513         ":define")      d_getnetbyaddr_r_proto=define
13514                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13515                 eval $hasproto ;;
13516         *)      ;;
13517         esac
13518         case "$d_getnetbyaddr_r_proto" in
13519         define)
13520         case "$getnetbyaddr_r_proto" in
13521         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13522         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13523         esac
13524         case "$getnetbyaddr_r_proto" in
13525         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13526         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13527         esac
13528         case "$getnetbyaddr_r_proto" in
13529         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13530         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13531         esac
13532         case "$getnetbyaddr_r_proto" in
13533         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13534         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13535         esac
13536         case "$getnetbyaddr_r_proto" in
13537         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13538         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13539         esac
13540         case "$getnetbyaddr_r_proto" in
13541         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13542         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13543         esac
13544         case "$getnetbyaddr_r_proto" in
13545         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13546         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13547         esac
13548         case "$getnetbyaddr_r_proto" in
13549         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13550         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13551         esac
13552         case "$getnetbyaddr_r_proto" in
13553         ''|0)   d_getnetbyaddr_r=undef
13554                 getnetbyaddr_r_proto=0
13555                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13556         * )     case "$getnetbyaddr_r_proto" in
13557                 REENTRANT_PROTO*) ;;
13558                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13559                 esac
13560                 echo "Prototype: $try" ;;
13561         esac
13562         ;;
13563         *)      case "$usethreads" in
13564                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13565                 esac
13566                 d_getnetbyaddr_r=undef
13567                 getnetbyaddr_r_proto=0
13568                 ;;
13569         esac
13570         ;;
13571 *)      getnetbyaddr_r_proto=0
13572         ;;
13573 esac
13574
13575 : see if getnetbyname_r exists
13576 set getnetbyname_r d_getnetbyname_r
13577 eval $inlibc
13578 case "$d_getnetbyname_r" in
13579 "$define")
13580         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13581         case "$d_getnetbyname_r_proto:$usethreads" in
13582         ":define")      d_getnetbyname_r_proto=define
13583                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13584                 eval $hasproto ;;
13585         *)      ;;
13586         esac
13587         case "$d_getnetbyname_r_proto" in
13588         define)
13589         case "$getnetbyname_r_proto" in
13590         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13591         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13592         esac
13593         case "$getnetbyname_r_proto" in
13594         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13595         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13596         esac
13597         case "$getnetbyname_r_proto" in
13598         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13599         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13600         esac
13601         case "$getnetbyname_r_proto" in
13602         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13603         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13604         esac
13605         case "$getnetbyname_r_proto" in
13606         ''|0)   d_getnetbyname_r=undef
13607                 getnetbyname_r_proto=0
13608                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13609         * )     case "$getnetbyname_r_proto" in
13610                 REENTRANT_PROTO*) ;;
13611                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13612                 esac
13613                 echo "Prototype: $try" ;;
13614         esac
13615         ;;
13616         *)      case "$usethreads" in
13617                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13618                 esac
13619                 d_getnetbyname_r=undef
13620                 getnetbyname_r_proto=0
13621                 ;;
13622         esac
13623         ;;
13624 *)      getnetbyname_r_proto=0
13625         ;;
13626 esac
13627
13628 : see if getnetent_r exists
13629 set getnetent_r d_getnetent_r
13630 eval $inlibc
13631 case "$d_getnetent_r" in
13632 "$define")
13633         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13634         case "$d_getnetent_r_proto:$usethreads" in
13635         ":define")      d_getnetent_r_proto=define
13636                 set d_getnetent_r_proto getnetent_r $hdrs
13637                 eval $hasproto ;;
13638         *)      ;;
13639         esac
13640         case "$d_getnetent_r_proto" in
13641         define)
13642         case "$getnetent_r_proto" in
13643         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13644         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13645         esac
13646         case "$getnetent_r_proto" in
13647         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13648         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13649         esac
13650         case "$getnetent_r_proto" in
13651         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13652         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13653         esac
13654         case "$getnetent_r_proto" in
13655         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13656         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13657         esac
13658         case "$getnetent_r_proto" in
13659         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13660         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13661         esac
13662         case "$getnetent_r_proto" in
13663         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13664         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13665         esac
13666         case "$getnetent_r_proto" in
13667         ''|0)   d_getnetent_r=undef
13668                 getnetent_r_proto=0
13669                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13670         * )     case "$getnetent_r_proto" in
13671                 REENTRANT_PROTO*) ;;
13672                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13673                 esac
13674                 echo "Prototype: $try" ;;
13675         esac
13676         ;;
13677         *)      case "$usethreads" in
13678                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13679                 esac
13680                 d_getnetent_r=undef
13681                 getnetent_r_proto=0
13682                 ;;
13683         esac
13684         ;;
13685 *)      getnetent_r_proto=0
13686         ;;
13687 esac
13688
13689 : see if prototypes for various getnetxxx netdb.h functions are available
13690 echo " "
13691 set d_getnetprotos getnetent $i_netdb netdb.h
13692 eval $hasproto
13693
13694 : see if getpagesize exists
13695 set getpagesize d_getpagsz
13696 eval $inlibc
13697
13698
13699 : see if getprotobyname exists
13700 set getprotobyname d_getpbyname
13701 eval $inlibc
13702
13703 : see if getprotobynumber exists
13704 set getprotobynumber d_getpbynumber
13705 eval $inlibc
13706
13707 : see if getprotoent exists
13708 set getprotoent d_getpent
13709 eval $inlibc
13710
13711 : see if getpgid exists
13712 set getpgid d_getpgid
13713 eval $inlibc
13714
13715 : see if getpgrp2 exists
13716 set getpgrp2 d_getpgrp2
13717 eval $inlibc
13718
13719 : see if getppid exists
13720 set getppid d_getppid
13721 eval $inlibc
13722
13723 : see if getpriority exists
13724 set getpriority d_getprior
13725 eval $inlibc
13726
13727 : see if getprotobyname_r exists
13728 set getprotobyname_r d_getprotobyname_r
13729 eval $inlibc
13730 case "$d_getprotobyname_r" in
13731 "$define")
13732         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13733         case "$d_getprotobyname_r_proto:$usethreads" in
13734         ":define")      d_getprotobyname_r_proto=define
13735                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13736                 eval $hasproto ;;
13737         *)      ;;
13738         esac
13739         case "$d_getprotobyname_r_proto" in
13740         define)
13741         case "$getprotobyname_r_proto" in
13742         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13743         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13744         esac
13745         case "$getprotobyname_r_proto" in
13746         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13747         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13748         esac
13749         case "$getprotobyname_r_proto" in
13750         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13751         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13752         esac
13753         case "$getprotobyname_r_proto" in
13754         ''|0)   d_getprotobyname_r=undef
13755                 getprotobyname_r_proto=0
13756                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13757         * )     case "$getprotobyname_r_proto" in
13758                 REENTRANT_PROTO*) ;;
13759                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13760                 esac
13761                 echo "Prototype: $try" ;;
13762         esac
13763         ;;
13764         *)      case "$usethreads" in
13765                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13766                 esac
13767                 d_getprotobyname_r=undef
13768                 getprotobyname_r_proto=0
13769                 ;;
13770         esac
13771         ;;
13772 *)      getprotobyname_r_proto=0
13773         ;;
13774 esac
13775
13776 : see if getprotobynumber_r exists
13777 set getprotobynumber_r d_getprotobynumber_r
13778 eval $inlibc
13779 case "$d_getprotobynumber_r" in
13780 "$define")
13781         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13782         case "$d_getprotobynumber_r_proto:$usethreads" in
13783         ":define")      d_getprotobynumber_r_proto=define
13784                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13785                 eval $hasproto ;;
13786         *)      ;;
13787         esac
13788         case "$d_getprotobynumber_r_proto" in
13789         define)
13790         case "$getprotobynumber_r_proto" in
13791         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13792         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13793         esac
13794         case "$getprotobynumber_r_proto" in
13795         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13796         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13797         esac
13798         case "$getprotobynumber_r_proto" in
13799         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13800         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13801         esac
13802         case "$getprotobynumber_r_proto" in
13803         ''|0)   d_getprotobynumber_r=undef
13804                 getprotobynumber_r_proto=0
13805                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13806         * )     case "$getprotobynumber_r_proto" in
13807                 REENTRANT_PROTO*) ;;
13808                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13809                 esac
13810                 echo "Prototype: $try" ;;
13811         esac
13812         ;;
13813         *)      case "$usethreads" in
13814                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13815                 esac
13816                 d_getprotobynumber_r=undef
13817                 getprotobynumber_r_proto=0
13818                 ;;
13819         esac
13820         ;;
13821 *)      getprotobynumber_r_proto=0
13822         ;;
13823 esac
13824
13825 : see if getprotoent_r exists
13826 set getprotoent_r d_getprotoent_r
13827 eval $inlibc
13828 case "$d_getprotoent_r" in
13829 "$define")
13830         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13831         case "$d_getprotoent_r_proto:$usethreads" in
13832         ":define")      d_getprotoent_r_proto=define
13833                 set d_getprotoent_r_proto getprotoent_r $hdrs
13834                 eval $hasproto ;;
13835         *)      ;;
13836         esac
13837         case "$d_getprotoent_r_proto" in
13838         define)
13839         case "$getprotoent_r_proto" in
13840         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13841         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13842         esac
13843         case "$getprotoent_r_proto" in
13844         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13845         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13846         esac
13847         case "$getprotoent_r_proto" in
13848         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13849         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13850         esac
13851         case "$getprotoent_r_proto" in
13852         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13853         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13854         esac
13855         case "$getprotoent_r_proto" in
13856         ''|0)   d_getprotoent_r=undef
13857                 getprotoent_r_proto=0
13858                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13859         * )     case "$getprotoent_r_proto" in
13860                 REENTRANT_PROTO*) ;;
13861                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13862                 esac
13863                 echo "Prototype: $try" ;;
13864         esac
13865         ;;
13866         *)      case "$usethreads" in
13867                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13868                 esac
13869                 d_getprotoent_r=undef
13870                 getprotoent_r_proto=0
13871                 ;;
13872         esac
13873         ;;
13874 *)      getprotoent_r_proto=0
13875         ;;
13876 esac
13877
13878 : see if prototypes for various getprotoxxx netdb.h functions are available
13879 echo " "
13880 set d_getprotoprotos getprotoent $i_netdb netdb.h
13881 eval $hasproto
13882
13883 : see if getprpwnam exists
13884 set getprpwnam d_getprpwnam
13885 eval $inlibc
13886
13887 : see if getpwent exists
13888 set getpwent d_getpwent
13889 eval $inlibc
13890
13891 : see if getpwent_r exists
13892 set getpwent_r d_getpwent_r
13893 eval $inlibc
13894 case "$d_getpwent_r" in
13895 "$define")
13896         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13897         case "$d_getpwent_r_proto:$usethreads" in
13898         ":define")      d_getpwent_r_proto=define
13899                 set d_getpwent_r_proto getpwent_r $hdrs
13900                 eval $hasproto ;;
13901         *)      ;;
13902         esac
13903         case "$d_getpwent_r_proto" in
13904         define)
13905         case "$getpwent_r_proto" in
13906         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13907         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13908         esac
13909         case "$getpwent_r_proto" in
13910         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13911         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13912         esac
13913         case "$getpwent_r_proto" in
13914         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13915         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13916         esac
13917         case "$getpwent_r_proto" in
13918         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13919         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13920         esac
13921         case "$getpwent_r_proto" in
13922         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13923         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13924         esac
13925         case "$getpwent_r_proto" in
13926         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13927         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13928         esac
13929         case "$getpwent_r_proto" in
13930         ''|0)   d_getpwent_r=undef
13931                 getpwent_r_proto=0
13932                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13933         * )     case "$getpwent_r_proto" in
13934                 REENTRANT_PROTO*) ;;
13935                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13936                 esac
13937                 echo "Prototype: $try" ;;
13938         esac
13939         ;;
13940         *)      case "$usethreads" in
13941                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13942                 esac
13943                 d_getpwent_r=undef
13944                 getpwent_r_proto=0
13945                 ;;
13946         esac
13947         ;;
13948 *)      getpwent_r_proto=0
13949         ;;
13950 esac
13951
13952 : see if getpwnam_r exists
13953 set getpwnam_r d_getpwnam_r
13954 eval $inlibc
13955 case "$d_getpwnam_r" in
13956 "$define")
13957         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13958         case "$d_getpwnam_r_proto:$usethreads" in
13959         ":define")      d_getpwnam_r_proto=define
13960                 set d_getpwnam_r_proto getpwnam_r $hdrs
13961                 eval $hasproto ;;
13962         *)      ;;
13963         esac
13964         case "$d_getpwnam_r_proto" in
13965         define)
13966         case "$getpwnam_r_proto" in
13967         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13968         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13969         esac
13970         case "$getpwnam_r_proto" in
13971         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13972         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13973         esac
13974         case "$getpwnam_r_proto" in
13975         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13976         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13977         esac
13978         case "$getpwnam_r_proto" in
13979         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13980         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13981         esac
13982         case "$getpwnam_r_proto" in
13983         ''|0)   d_getpwnam_r=undef
13984                 getpwnam_r_proto=0
13985                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13986         * )     case "$getpwnam_r_proto" in
13987                 REENTRANT_PROTO*) ;;
13988                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13989                 esac
13990                 echo "Prototype: $try" ;;
13991         esac
13992         ;;
13993         *)      case "$usethreads" in
13994                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13995                 esac
13996                 d_getpwnam_r=undef
13997                 getpwnam_r_proto=0
13998                 ;;
13999         esac
14000         ;;
14001 *)      getpwnam_r_proto=0
14002         ;;
14003 esac
14004
14005 : see if getpwuid_r exists
14006 set getpwuid_r d_getpwuid_r
14007 eval $inlibc
14008 case "$d_getpwuid_r" in
14009 "$define")
14010         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14011         case "$d_getpwuid_r_proto:$usethreads" in
14012         ":define")      d_getpwuid_r_proto=define
14013                 set d_getpwuid_r_proto getpwuid_r $hdrs
14014                 eval $hasproto ;;
14015         *)      ;;
14016         esac
14017         case "$d_getpwuid_r_proto" in
14018         define)
14019         case "$getpwuid_r_proto" in
14020         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14021         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14022         esac
14023         case "$getpwuid_r_proto" in
14024         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14025         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14026         esac
14027         case "$getpwuid_r_proto" in
14028         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14029         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14030         esac
14031         case "$getpwuid_r_proto" in
14032         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14033         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14034         esac
14035         case "$getpwuid_r_proto" in
14036         ''|0)   d_getpwuid_r=undef
14037                 getpwuid_r_proto=0
14038                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14039         * )     case "$getpwuid_r_proto" in
14040                 REENTRANT_PROTO*) ;;
14041                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14042                 esac
14043                 echo "Prototype: $try" ;;
14044         esac
14045         ;;
14046         *)      case "$usethreads" in
14047                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14048                 esac
14049                 d_getpwuid_r=undef
14050                 getpwuid_r_proto=0
14051                 ;;
14052         esac
14053         ;;
14054 *)      getpwuid_r_proto=0
14055         ;;
14056 esac
14057
14058
14059 : see if getservbyname exists
14060 set getservbyname d_getsbyname
14061 eval $inlibc
14062
14063 : see if getservbyport exists
14064 set getservbyport d_getsbyport
14065 eval $inlibc
14066
14067 : see if getservent exists
14068 set getservent d_getsent
14069 eval $inlibc
14070
14071 : see if getservbyname_r exists
14072 set getservbyname_r d_getservbyname_r
14073 eval $inlibc
14074 case "$d_getservbyname_r" in
14075 "$define")
14076         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14077         case "$d_getservbyname_r_proto:$usethreads" in
14078         ":define")      d_getservbyname_r_proto=define
14079                 set d_getservbyname_r_proto getservbyname_r $hdrs
14080                 eval $hasproto ;;
14081         *)      ;;
14082         esac
14083         case "$d_getservbyname_r_proto" in
14084         define)
14085         case "$getservbyname_r_proto" in
14086         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14087         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14088         esac
14089         case "$getservbyname_r_proto" in
14090         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14091         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14092         esac
14093         case "$getservbyname_r_proto" in
14094         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14095         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14096         esac
14097         case "$getservbyname_r_proto" in
14098         ''|0)   d_getservbyname_r=undef
14099                 getservbyname_r_proto=0
14100                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14101         * )     case "$getservbyname_r_proto" in
14102                 REENTRANT_PROTO*) ;;
14103                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14104                 esac
14105                 echo "Prototype: $try" ;;
14106         esac
14107         ;;
14108         *)      case "$usethreads" in
14109                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14110                 esac
14111                 d_getservbyname_r=undef
14112                 getservbyname_r_proto=0
14113                 ;;
14114         esac
14115         ;;
14116 *)      getservbyname_r_proto=0
14117         ;;
14118 esac
14119
14120 : see if getservbyport_r exists
14121 set getservbyport_r d_getservbyport_r
14122 eval $inlibc
14123 case "$d_getservbyport_r" in
14124 "$define")
14125         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14126         case "$d_getservbyport_r_proto:$usethreads" in
14127         ":define")      d_getservbyport_r_proto=define
14128                 set d_getservbyport_r_proto getservbyport_r $hdrs
14129                 eval $hasproto ;;
14130         *)      ;;
14131         esac
14132         case "$d_getservbyport_r_proto" in
14133         define)
14134         case "$getservbyport_r_proto" in
14135         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14136         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14137         esac
14138         case "$getservbyport_r_proto" in
14139         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14140         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14141         esac
14142         case "$getservbyport_r_proto" in
14143         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14144         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14145         esac
14146         case "$getservbyport_r_proto" in
14147         ''|0)   d_getservbyport_r=undef
14148                 getservbyport_r_proto=0
14149                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14150         * )     case "$getservbyport_r_proto" in
14151                 REENTRANT_PROTO*) ;;
14152                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14153                 esac
14154                 echo "Prototype: $try" ;;
14155         esac
14156         ;;
14157         *)      case "$usethreads" in
14158                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14159                 esac
14160                 d_getservbyport_r=undef
14161                 getservbyport_r_proto=0
14162                 ;;
14163         esac
14164         ;;
14165 *)      getservbyport_r_proto=0
14166         ;;
14167 esac
14168
14169 : see if getservent_r exists
14170 set getservent_r d_getservent_r
14171 eval $inlibc
14172 case "$d_getservent_r" in
14173 "$define")
14174         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14175         case "$d_getservent_r_proto:$usethreads" in
14176         ":define")      d_getservent_r_proto=define
14177                 set d_getservent_r_proto getservent_r $hdrs
14178                 eval $hasproto ;;
14179         *)      ;;
14180         esac
14181         case "$d_getservent_r_proto" in
14182         define)
14183         case "$getservent_r_proto" in
14184         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14185         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14186         esac
14187         case "$getservent_r_proto" in
14188         ''|0) try='int getservent_r(struct servent*, char*, int);'
14189         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14190         esac
14191         case "$getservent_r_proto" in
14192         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14193         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14194         esac
14195         case "$getservent_r_proto" in
14196         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14197         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14198         esac
14199         case "$getservent_r_proto" in
14200         ''|0)   d_getservent_r=undef
14201                 getservent_r_proto=0
14202                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14203         * )     case "$getservent_r_proto" in
14204                 REENTRANT_PROTO*) ;;
14205                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14206                 esac
14207                 echo "Prototype: $try" ;;
14208         esac
14209         ;;
14210         *)      case "$usethreads" in
14211                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14212                 esac
14213                 d_getservent_r=undef
14214                 getservent_r_proto=0
14215                 ;;
14216         esac
14217         ;;
14218 *)      getservent_r_proto=0
14219         ;;
14220 esac
14221
14222 : see if prototypes for various getservxxx netdb.h functions are available
14223 echo " "
14224 set d_getservprotos getservent $i_netdb netdb.h
14225 eval $hasproto
14226
14227 : see if getspnam exists
14228 set getspnam d_getspnam
14229 eval $inlibc
14230
14231 : see if this is a shadow.h system
14232 set shadow.h i_shadow
14233 eval $inhdr
14234
14235 : see if getspnam_r exists
14236 set getspnam_r d_getspnam_r
14237 eval $inlibc
14238 case "$d_getspnam_r" in
14239 "$define")
14240         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14241         case "$d_getspnam_r_proto:$usethreads" in
14242         ":define")      d_getspnam_r_proto=define
14243                 set d_getspnam_r_proto getspnam_r $hdrs
14244                 eval $hasproto ;;
14245         *)      ;;
14246         esac
14247         case "$d_getspnam_r_proto" in
14248         define)
14249         case "$getspnam_r_proto" in
14250         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14251         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14252         esac
14253         case "$getspnam_r_proto" in
14254         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14255         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14256         esac
14257         case "$getspnam_r_proto" in
14258         ''|0)   d_getspnam_r=undef
14259                 getspnam_r_proto=0
14260                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14261         * )     case "$getspnam_r_proto" in
14262                 REENTRANT_PROTO*) ;;
14263                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14264                 esac
14265                 echo "Prototype: $try" ;;
14266         esac
14267         ;;
14268         *)      case "$usethreads" in
14269                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14270                 esac
14271                 d_getspnam_r=undef
14272                 getspnam_r_proto=0
14273                 ;;
14274         esac
14275         ;;
14276 *)      getspnam_r_proto=0
14277         ;;
14278 esac
14279
14280 : see if gettimeofday or ftime exists
14281 set gettimeofday d_gettimeod
14282 eval $inlibc
14283 case "$d_gettimeod" in
14284 "$undef")
14285         set ftime d_ftime 
14286         eval $inlibc
14287         ;;
14288 *)
14289         val="$undef"; set d_ftime; eval $setvar
14290         ;;
14291 esac
14292 case "$d_gettimeod$d_ftime" in
14293 "$undef$undef")
14294         echo " "
14295         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14296         ;;
14297 esac
14298
14299 : see if gmtime_r exists
14300 set gmtime_r d_gmtime_r
14301 eval $inlibc
14302 case "$d_gmtime_r" in
14303 "$define")
14304         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14305         case "$d_gmtime_r_proto:$usethreads" in
14306         ":define")      d_gmtime_r_proto=define
14307                 set d_gmtime_r_proto gmtime_r $hdrs
14308                 eval $hasproto ;;
14309         *)      ;;
14310         esac
14311         case "$d_gmtime_r_proto" in
14312         define)
14313         case "$gmtime_r_proto" in
14314         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14315         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14316         esac
14317         case "$gmtime_r_proto" in
14318         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14319         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14320         esac
14321         case "$gmtime_r_proto" in
14322         ''|0)   d_gmtime_r=undef
14323                 gmtime_r_proto=0
14324                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14325         * )     case "$gmtime_r_proto" in
14326                 REENTRANT_PROTO*) ;;
14327                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14328                 esac
14329                 echo "Prototype: $try" ;;
14330         esac
14331         ;;
14332         *)      case "$usethreads" in
14333                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14334                 esac
14335                 d_gmtime_r=undef
14336                 gmtime_r_proto=0
14337                 ;;
14338         esac
14339         ;;
14340 *)      gmtime_r_proto=0
14341         ;;
14342 esac
14343
14344 : see if hasmntopt exists
14345 set hasmntopt d_hasmntopt
14346 eval $inlibc
14347
14348 : see if this is a netinet/in.h or sys/in.h system
14349 set netinet/in.h i_niin sys/in.h i_sysin
14350 eval $inhdr
14351
14352 : see if arpa/inet.h has to be included
14353 set arpa/inet.h i_arpainet
14354 eval $inhdr
14355
14356 : see if htonl --and friends-- exists
14357 val=''
14358 set htonl val
14359 eval $inlibc
14360
14361 : Maybe they are macros.
14362 case "$val" in
14363 $undef)
14364         $cat >htonl.c <<EOM
14365 #include <stdio.h>
14366 #include <sys/types.h>
14367 #$i_niin I_NETINET_IN
14368 #$i_sysin I_SYS_IN
14369 #$i_arpainet I_ARPA_INET
14370 #ifdef I_NETINET_IN
14371 #include <netinet/in.h>
14372 #endif
14373 #ifdef I_SYS_IN
14374 #include <sys/in.h>
14375 #endif
14376 #ifdef I_ARPA_INET
14377 #include <arpa/inet.h>
14378 #endif
14379 #ifdef htonl
14380 printf("Defined as a macro.");
14381 #endif
14382 EOM
14383         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14384         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14385                 val="$define"
14386                 echo "But it seems to be defined as a macro." >&4
14387         fi
14388         $rm -f htonl.?
14389         ;;
14390 esac
14391 set d_htonl
14392 eval $setvar
14393
14394 : see if ilogbl exists
14395 set ilogbl d_ilogbl
14396 eval $inlibc
14397
14398 : index or strchr
14399 echo " "
14400 if set index val -f; eval $csym; $val; then
14401         if set strchr val -f d_strchr; eval $csym; $val; then
14402                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14403                         val="$define"
14404                         vali="$undef"
14405                         echo "strchr() found." >&4
14406                 else
14407                         val="$undef"
14408                         vali="$define"
14409                         echo "index() found." >&4
14410                 fi
14411         else
14412                 val="$undef"
14413                 vali="$define"
14414                 echo "index() found." >&4
14415         fi
14416 else
14417         if set strchr val -f d_strchr; eval $csym; $val; then
14418                 val="$define"
14419                 vali="$undef"
14420                 echo "strchr() found." >&4
14421         else
14422                 echo "No index() or strchr() found!" >&4
14423                 val="$undef"
14424                 vali="$undef"
14425         fi
14426 fi
14427 set d_strchr; eval $setvar
14428 val="$vali"
14429 set d_index; eval $setvar
14430
14431 : check whether inet_aton exists
14432 set inet_aton d_inetaton
14433 eval $inlibc
14434
14435 : Look for isascii
14436 echo " "
14437 $cat >isascii.c <<EOCP
14438 #include <stdio.h>
14439 #include <ctype.h>
14440 #$i_stdlib I_STDLIB
14441 #ifdef I_STDLIB
14442 #include <stdlib.h>
14443 #endif
14444 int main() {
14445         int c = 'A';
14446         if (isascii(c))
14447                 exit(0);
14448         else
14449                 exit(1);
14450 }
14451 EOCP
14452 set isascii
14453 if eval $compile; then
14454         echo "isascii() found." >&4
14455         val="$define"
14456 else
14457         echo "isascii() NOT found." >&4
14458         val="$undef"
14459 fi
14460 set d_isascii
14461 eval $setvar
14462 $rm -f isascii*
14463
14464 : see if isfinite exists
14465 set isfinite d_isfinite
14466 eval $inlibc
14467
14468 : see if isinf exists
14469 set isinf d_isinf
14470 eval $inlibc
14471
14472 : see if isnan exists
14473 set isnan d_isnan
14474 eval $inlibc
14475
14476 : see if isnanl exists
14477 set isnanl d_isnanl
14478 eval $inlibc
14479
14480 : see if killpg exists
14481 set killpg d_killpg
14482 eval $inlibc
14483
14484 : see if lchown exists
14485 echo " "
14486 $cat > try.c <<'EOCP'
14487 /* System header to define __stub macros and hopefully few prototypes,
14488     which can conflict with char lchown(); below.  */
14489 #include <assert.h>
14490 /* Override any gcc2 internal prototype to avoid an error.  */
14491 /* We use char because int might match the return type of a gcc2
14492    builtin and then its argument prototype would still apply.  */
14493 char lchown();
14494 int main() {
14495     /*  The GNU C library defines this for functions which it implements
14496         to always fail with ENOSYS.  Some functions are actually named
14497         something starting with __ and the normal name is an alias.  */
14498 #if defined (__stub_lchown) || defined (__stub___lchown)
14499 choke me
14500 #else
14501 lchown();
14502 #endif
14503 ; return 0; }
14504 EOCP
14505 set try
14506 if eval $compile; then
14507     $echo "lchown() found." >&4
14508     val="$define"
14509 else
14510     $echo "lchown() NOT found." >&4
14511     val="$undef"
14512 fi
14513 set d_lchown
14514 eval $setvar
14515
14516 : See if number of significant digits in a double precision number is known
14517 echo " "
14518 $cat >ldbl_dig.c <<EOM
14519 #$i_limits I_LIMITS
14520 #$i_float I_FLOAT
14521 #ifdef I_LIMITS
14522 #include <limits.h>
14523 #endif
14524 #ifdef I_FLOAT
14525 #include <float.h>
14526 #endif
14527 #ifdef LDBL_DIG
14528 printf("Contains LDBL_DIG");
14529 #endif
14530 EOM
14531 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14532 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14533         echo "LDBL_DIG found." >&4
14534         val="$define"
14535 else
14536         echo "LDBL_DIG NOT found." >&4
14537         val="$undef"
14538 fi
14539 $rm -f ldbl_dig.?
14540 set d_ldbl_dig
14541 eval $setvar
14542
14543 : see if this is a math.h system
14544 set math.h i_math
14545 eval $inhdr
14546
14547 d_libm_lib_version="$undef"
14548 case $i_math in
14549     $define)
14550         : check to see if math.h defines _LIB_VERSION
14551         echo " "
14552         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14553         $cat >try.c <<EOCP
14554 #include <unistd.h>
14555 #include <math.h>
14556 int main (int argc, char *argv[])
14557 {
14558     printf ("%d\n", _LIB_VERSION);
14559     return (0);
14560     } /* main */
14561 EOCP
14562         set try
14563         if eval $compile; then
14564             foo=`$run ./try`
14565             echo "Yes, it does ($foo)" >&4
14566             d_libm_lib_version="$define"
14567         else
14568             echo "No, it does not (probably harmless)\n" >&4
14569             fi
14570         $rm -f try.* try core core.try.*
14571         ;;
14572
14573     esac
14574
14575 : see if link exists
14576 set link d_link
14577 eval $inlibc
14578
14579 : see if localtime_r exists
14580 set localtime_r d_localtime_r
14581 eval $inlibc
14582 case "$d_localtime_r" in
14583 "$define")
14584         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14585         case "$d_localtime_r_proto:$usethreads" in
14586         ":define")      d_localtime_r_proto=define
14587                 set d_localtime_r_proto localtime_r $hdrs
14588                 eval $hasproto ;;
14589         *)      ;;
14590         esac
14591         case "$d_localtime_r_proto" in
14592         define)
14593         case "$localtime_r_proto" in
14594         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14595         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14596         esac
14597         case "$localtime_r_proto" in
14598         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14599         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14600         esac
14601         case "$localtime_r_proto" in
14602         ''|0)   d_localtime_r=undef
14603                 localtime_r_proto=0
14604                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14605         * )     case "$localtime_r_proto" in
14606                 REENTRANT_PROTO*) ;;
14607                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14608                 esac
14609                 echo "Prototype: $try" ;;
14610         esac
14611         ;;
14612         *)      case "$usethreads" in
14613                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14614                 esac
14615                 d_localtime_r=undef
14616                 localtime_r_proto=0
14617                 ;;
14618         esac
14619         ;;
14620 *)      localtime_r_proto=0
14621         ;;
14622 esac
14623
14624 : see if localtime_r calls tzset
14625 case "$localtime_r_proto" in
14626 REENTRANT_PROTO*)
14627         $cat >try.c <<EOCP
14628 /*  Does our libc's localtime_r call tzset ?
14629  *  return 0 if so, 1 otherwise.
14630  */
14631 #include <sys/types.h>
14632 #include <unistd.h>
14633 #include <time.h>
14634 #include <string.h>
14635 #include <malloc.h>
14636 int main()
14637 {
14638     time_t t = time(0L);
14639     char w_tz[]="TZ" "=GMT+5",
14640          e_tz[]="TZ" "=GMT-5",
14641         *tz_e = (char*)malloc(16),
14642         *tz_w = (char*)malloc(16);
14643     struct tm tm_e, tm_w;
14644     memset(&tm_e,'\0',sizeof(struct tm));
14645     memset(&tm_w,'\0',sizeof(struct tm));
14646     strcpy(tz_e,e_tz);
14647     strcpy(tz_w,w_tz);
14648
14649     putenv(tz_e);
14650     localtime_r(&t, &tm_e);
14651
14652     putenv(tz_w);
14653     localtime_r(&t, &tm_w);
14654
14655     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14656         return 1;
14657     return 0;
14658 }
14659 EOCP
14660         set try
14661         if eval $compile; then
14662             if ./try; then
14663                 d_localtime_r_needs_tzset=undef;
14664             else
14665                 d_localtime_r_needs_tzset=define;
14666             fi;
14667         else
14668             d_localtime_r_needs_tzset=undef;
14669         fi;
14670      ;;
14671   *)
14672      d_localtime_r_needs_tzset=undef;
14673      ;;
14674 esac
14675 $rm -f try try.* core
14676
14677 : see if localeconv exists
14678 set localeconv d_locconv
14679 eval $inlibc
14680
14681 : see if lockf exists
14682 set lockf d_lockf
14683 eval $inlibc
14684
14685 : see if prototype for lseek is available
14686 echo " "
14687 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14688 eval $hasproto
14689
14690 : see if lstat exists
14691 set lstat d_lstat
14692 eval $inlibc
14693
14694 : see if madvise exists
14695 set madvise d_madvise
14696 eval $inlibc
14697
14698 : see if malloc_size exists
14699 set malloc_size d_malloc_size
14700 eval $inlibc
14701
14702 : see if malloc_size_good exists
14703 set malloc_good_size d_malloc_good_size
14704 eval $inlibc
14705
14706 : see if mblen exists
14707 set mblen d_mblen
14708 eval $inlibc
14709
14710 : see if mbstowcs exists
14711 set mbstowcs d_mbstowcs
14712 eval $inlibc
14713
14714 : see if mbtowc exists
14715 set mbtowc d_mbtowc
14716 eval $inlibc
14717
14718 : see if memchr exists
14719 set memchr d_memchr
14720 eval $inlibc
14721
14722 : see if memcmp exists
14723 set memcmp d_memcmp
14724 eval $inlibc
14725
14726 : see if memcpy exists
14727 set memcpy d_memcpy
14728 eval $inlibc
14729
14730 : see if memmove exists
14731 set memmove d_memmove
14732 eval $inlibc
14733
14734 : see if memset exists
14735 set memset d_memset
14736 eval $inlibc
14737
14738 : see if mkdir exists
14739 set mkdir d_mkdir
14740 eval $inlibc
14741
14742 : see if mkdtemp exists
14743 set mkdtemp d_mkdtemp
14744 eval $inlibc
14745
14746 : see if mkfifo exists
14747 set mkfifo d_mkfifo
14748 eval $inlibc
14749
14750 : see if mkstemp exists
14751 set mkstemp d_mkstemp
14752 eval $inlibc
14753
14754 : see if mkstemps exists
14755 set mkstemps d_mkstemps
14756 eval $inlibc
14757
14758 : see if mktime exists
14759 set mktime d_mktime
14760 eval $inlibc
14761
14762 : see if this is a sys/mman.h system
14763 set sys/mman.h i_sysmman
14764 eval $inhdr
14765
14766 : see if mmap exists
14767 set mmap d_mmap
14768 eval $inlibc
14769 : see what shmat returns
14770 : default to something harmless
14771 mmaptype='void *'
14772 case "$i_sysmman$d_mmap" in
14773 "$define$define")
14774         $cat >mmap.c <<'END'
14775 #include <sys/mman.h>
14776 void *mmap();
14777 END
14778         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14779                 mmaptype='void *'
14780         else
14781                 mmaptype='caddr_t'
14782         fi
14783         echo "and it returns ($mmaptype)." >&4
14784         ;;
14785 esac
14786
14787
14788
14789 : see if sqrtl exists
14790 set sqrtl d_sqrtl
14791 eval $inlibc
14792
14793 : see if scalbnl exists
14794 set scalbnl d_scalbnl
14795 eval $inlibc
14796
14797 : see if modfl exists
14798 set modfl d_modfl
14799 eval $inlibc
14800
14801 : see if prototype for modfl is available
14802 echo " "
14803 set d_modflproto modfl $i_math math.h
14804 eval $hasproto
14805
14806 d_modfl_pow32_bug="$undef"
14807
14808 case "$d_longdbl$d_modfl" in
14809 $define$define)
14810         $cat <<EOM
14811 Checking to see whether your modfl() is okay for large values...
14812 EOM
14813 $cat >try.c <<EOCP
14814 #include <math.h> 
14815 #include <stdio.h>
14816 EOCP
14817 if $test "X$d_modflproto" != "X$define"; then
14818         $cat >>try.c <<EOCP
14819 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14820 long double modfl (long double, long double *);
14821 EOCP
14822 fi
14823 $cat >>try.c <<EOCP
14824 int main() {
14825     long double nv = 4294967303.15;
14826     long double v, w;
14827     v = modfl(nv, &w);         
14828 #ifdef __GLIBC__
14829     printf("glibc");
14830 #endif
14831     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14832     return 0;
14833 }
14834 EOCP
14835         case "$osname:$gccversion" in
14836         aix:)   saveccflags="$ccflags"
14837                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14838         esac
14839         set try
14840         if eval $compile; then
14841                 foo=`$run ./try`
14842                 case "$foo" in
14843                 *" 4294967303.150000 1.150000 4294967302.000000")
14844                         echo >&4 "Your modfl() is broken for large values."
14845                         d_modfl_pow32_bug="$define"
14846                         case "$foo" in
14847                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14848                         ;;
14849                         esac
14850                         ;;
14851                 *" 4294967303.150000 0.150000 4294967303.000000")
14852                         echo >&4 "Your modfl() seems okay for large values."
14853                         ;;
14854                 *)      echo >&4 "I don't understand your modfl() at all."
14855                         d_modfl="$undef"
14856                         ;;
14857                 esac
14858                 $rm -f try.* try core core.try.*
14859         else
14860                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14861                 d_modfl="$undef"
14862         fi
14863         case "$osname:$gccversion" in
14864         aix:)   ccflags="$saveccflags" ;; # restore
14865         esac
14866         ;;
14867 esac
14868
14869 if $test "$uselongdouble" = "$define"; then
14870     message=""
14871     if $test "$d_sqrtl" != "$define"; then
14872         message="$message sqrtl"
14873     fi
14874     if $test "$d_modfl" != "$define"; then
14875         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14876             echo "You have both aintl and copysignl, so I can emulate modfl."
14877         else
14878             message="$message modfl"
14879         fi
14880     fi
14881     if $test "$d_frexpl" != "$define"; then
14882         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14883             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14884         else
14885             message="$message frexpl"
14886         fi
14887     fi
14888
14889     if $test "$message" != ""; then
14890         $cat <<EOM >&4
14891
14892 *** You requested the use of long doubles but you do not seem to have
14893 *** the following mathematical functions needed for long double support:
14894 ***    $message
14895 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14896 *** Cannot continue, aborting.
14897
14898 EOM
14899
14900         exit 1
14901     fi
14902 fi
14903
14904 : see if mprotect exists
14905 set mprotect d_mprotect
14906 eval $inlibc
14907
14908 : see if msgctl exists
14909 set msgctl d_msgctl
14910 eval $inlibc
14911
14912 : see if msgget exists
14913 set msgget d_msgget
14914 eval $inlibc
14915
14916 : see if msgsnd exists
14917 set msgsnd d_msgsnd
14918 eval $inlibc
14919
14920 : see if msgrcv exists
14921 set msgrcv d_msgrcv
14922 eval $inlibc
14923
14924 : see how much of the 'msg*(2)' library is present.
14925 h_msg=true
14926 echo " "
14927 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14928 *"$undef"*) h_msg=false;;
14929 esac
14930 case "$osname" in
14931 freebsd)
14932     case "`ipcs 2>&1`" in
14933     "SVID messages"*"not configured"*)
14934         echo "Your $osname does not have the msg*(2) configured." >&4
14935         h_msg=false
14936         val="$undef"
14937         set msgctl d_msgctl
14938         eval $setvar
14939         set msgget d_msgget
14940         eval $setvar
14941         set msgsnd d_msgsnd
14942         eval $setvar
14943         set msgrcv d_msgrcv
14944         eval $setvar
14945         ;;
14946     esac
14947     ;;
14948 esac
14949 : we could also check for sys/ipc.h ...
14950 if $h_msg && $test `./findhdr sys/msg.h`; then
14951         echo "You have the full msg*(2) library." >&4
14952         val="$define"
14953 else
14954         echo "You don't have the full msg*(2) library." >&4
14955         val="$undef"
14956 fi
14957 set d_msg
14958 eval $setvar
14959
14960
14961 echo " "
14962 echo "Checking to see if your system supports struct msghdr..." >&4
14963 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14964 eval $hasstruct
14965 case "$d_msghdr_s" in
14966 "$define")      echo "Yes, it does."   ;;
14967 *)              echo "No, it doesn't." ;;
14968 esac
14969
14970
14971 : see if msync exists
14972 set msync d_msync
14973 eval $inlibc
14974
14975 : see if munmap exists
14976 set munmap d_munmap
14977 eval $inlibc
14978
14979 : see if nice exists
14980 set nice d_nice
14981 eval $inlibc
14982
14983 : see if this is a langinfo.h system
14984 set langinfo.h i_langinfo
14985 eval $inhdr
14986
14987 : see if nl_langinfo exists
14988 set nl_langinfo d_nl_langinfo
14989 eval $inlibc
14990
14991 : check for length of character
14992 echo " "
14993 case "$charsize" in
14994 '')
14995         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14996         $cat >try.c <<EOCP
14997 #include <stdio.h>
14998 #$i_stdlib I_STDLIB
14999 #ifdef I_STDLIB
15000 #include <stdlib.h>
15001 #endif
15002 int main()
15003 {
15004     printf("%d\n", (int)sizeof(char));
15005     exit(0);
15006 }
15007 EOCP
15008         set try
15009         if eval $compile_ok; then
15010                 dflt=`$run ./try`
15011         else
15012                 dflt='1'
15013                 echo "(I can't seem to compile the test program.  Guessing...)"
15014         fi
15015         ;;
15016 *)
15017         dflt="$charsize"
15018         ;;
15019 esac
15020 rp="What is the size of a character (in bytes)?"
15021 . ./myread
15022 charsize="$ans"
15023 $rm -f try.c try
15024
15025 : check for volatile keyword
15026 echo " "
15027 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15028 $cat >try.c <<'EOCP'
15029 int main()
15030 {
15031         typedef struct _goo_struct goo_struct;
15032         goo_struct * volatile goo = ((goo_struct *)0);
15033         struct _goo_struct {
15034                 long long_int;
15035                 int reg_int;
15036                 char char_var;
15037         };
15038         typedef unsigned short foo_t;
15039         char *volatile foo;
15040         volatile int bar;
15041         volatile foo_t blech;
15042         foo = foo;
15043 }
15044 EOCP
15045 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15046         val="$define"
15047         echo "Yup, it does."
15048 else
15049         val="$undef"
15050         echo "Nope, it doesn't."
15051 fi
15052 set d_volatile
15053 eval $setvar
15054 $rm -f try.*
15055
15056
15057 echo " "
15058 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15059
15060 case "$use64bitint:$d_quad:$quadtype" in
15061 define:define:?*)
15062         ivtype="$quadtype"
15063         uvtype="$uquadtype"
15064         ivsize=8
15065         uvsize=8
15066         ;;
15067 *)      ivtype="long"
15068         uvtype="unsigned long"
15069         ivsize=$longsize
15070         uvsize=$longsize
15071         ;;
15072 esac
15073
15074 case "$uselongdouble:$d_longdbl" in
15075 define:define)
15076         nvtype="long double"
15077         nvsize=$longdblsize
15078         ;;
15079 *)      nvtype=double
15080         nvsize=$doublesize
15081         ;;
15082 esac
15083
15084 $echo "(IV will be "$ivtype", $ivsize bytes)"
15085 $echo "(UV will be "$uvtype", $uvsize bytes)"
15086 $echo "(NV will be "$nvtype", $nvsize bytes)"
15087
15088 $cat >try.c <<EOCP
15089 #$i_inttypes I_INTTYPES
15090 #ifdef I_INTTYPES
15091 #include <inttypes.h>
15092 #endif
15093 #include <stdio.h>
15094 int main() {
15095 #ifdef INT8
15096    int8_t i =  INT8_MAX;
15097   uint8_t u = UINT8_MAX;
15098   printf("int8_t\n");
15099 #endif
15100 #ifdef INT16
15101    int16_t i =  INT16_MAX;
15102   uint16_t i = UINT16_MAX;
15103   printf("int16_t\n");
15104 #endif
15105 #ifdef INT32
15106    int32_t i =  INT32_MAX;
15107   uint32_t u = UINT32_MAX;
15108   printf("int32_t\n");
15109 #endif
15110 }
15111 EOCP
15112
15113 case "$i8type" in
15114 '')     case "$charsize" in
15115         1)      i8type=char
15116                 u8type="unsigned char"
15117                 i8size=$charsize
15118                 u8size=$charsize
15119                 ;;
15120         esac
15121         ;;
15122 esac
15123 case "$i8type" in
15124 '')     set try -DINT8
15125         if eval $compile; then
15126                 case "`$run ./try`" in
15127                 int8_t) i8type=int8_t
15128                         u8type=uint8_t
15129                         i8size=1
15130                         u8size=1
15131                         ;;
15132                 esac
15133         fi
15134         ;;
15135 esac
15136 case "$i8type" in
15137 '')     if $test $charsize -ge 1; then
15138                 i8type=char
15139                 u8type="unsigned char"
15140                 i8size=$charsize
15141                 u8size=$charsize
15142         fi
15143         ;;
15144 esac
15145
15146 case "$i16type" in
15147 '')     case "$shortsize" in
15148         2)      i16type=short
15149                 u16type="unsigned short"
15150                 i16size=$shortsize
15151                 u16size=$shortsize
15152                 ;;
15153         esac
15154         ;;
15155 esac
15156 case "$i16type" in
15157 '')     set try -DINT16
15158         if eval $compile; then
15159                 case "`$run ./try`" in
15160                 int16_t)
15161                         i16type=int16_t
15162                         u16type=uint16_t
15163                         i16size=2
15164                         u16size=2
15165                         ;;
15166                 esac
15167         fi
15168         ;;
15169 esac
15170 case "$i16type" in
15171 '')     if $test $shortsize -ge 2; then
15172                 i16type=short
15173                 u16type="unsigned short"
15174                 i16size=$shortsize
15175                 u16size=$shortsize
15176         fi
15177         ;;
15178 esac
15179
15180 case "$i32type" in
15181 '')     case "$longsize" in
15182         4)      i32type=long
15183                 u32type="unsigned long"
15184                 i32size=$longsize
15185                 u32size=$longsize
15186                 ;;
15187         *)      case "$intsize" in
15188                 4)      i32type=int
15189                         u32type="unsigned int"
15190                         i32size=$intsize
15191                         u32size=$intsize
15192                         ;;
15193                 esac
15194                 ;;
15195         esac
15196         ;;
15197 esac
15198 case "$i32type" in
15199 '')     set try -DINT32
15200         if eval $compile; then
15201                 case "`$run ./try`" in
15202                 int32_t)
15203                         i32type=int32_t
15204                         u32type=uint32_t
15205                         i32size=4
15206                         u32size=4
15207                         ;;
15208                 esac
15209         fi
15210         ;;
15211 esac
15212 case "$i32type" in
15213 '')     if $test $intsize -ge 4; then
15214                 i32type=int
15215                 u32type="unsigned int"
15216                 i32size=$intsize
15217                 u32size=$intsize
15218         fi
15219         ;;
15220 esac
15221
15222 case "$i64type" in
15223 '')     case "$d_quad:$quadtype" in
15224         define:?*)
15225                 i64type="$quadtype"
15226                 u64type="$uquadtype"
15227                 i64size=8
15228                 u64size=8
15229                 ;;
15230         esac
15231         ;;
15232 esac
15233
15234 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15235 : volatile so that the compiler has to store it out to memory.
15236 if test X"$d_volatile" = X"$define"; then
15237         volatile=volatile
15238 fi
15239 $cat <<EOP >try.c
15240 #include <stdio.h>
15241 #$i_stdlib I_STDLIB
15242 #ifdef I_STDLIB
15243 #include <stdlib.h>
15244 #endif
15245 #include <sys/types.h>
15246 #include <signal.h>
15247 #ifdef SIGFPE
15248 $volatile int bletched = 0;
15249 $signal_t blech(int s) { bletched = 1; }
15250 #endif
15251 int main() {
15252     $uvtype u = 0;
15253     $nvtype d;
15254     int     n = 8 * $uvsize;
15255     int     i;
15256 #ifdef SIGFPE
15257     signal(SIGFPE, blech);
15258 #endif
15259
15260     for (i = 0; i < n; i++) {
15261       u = u << 1 | ($uvtype)1;
15262       d = ($nvtype)u;
15263       if (($uvtype)d != u)
15264         break;
15265       if (d <= 0)
15266         break;
15267       d = ($nvtype)(u - 1);
15268       if (($uvtype)d != (u - 1))
15269         break;
15270 #ifdef SIGFPE
15271       if (bletched) {
15272         break;
15273 #endif
15274       } 
15275     }
15276     printf("%d\n", ((i == n) ? -n : i));
15277     exit(0);
15278 }
15279 EOP
15280 set try
15281
15282 d_nv_preserves_uv="$undef"
15283 if eval $compile; then
15284         nv_preserves_uv_bits="`$run ./try`"
15285 fi
15286 case "$nv_preserves_uv_bits" in
15287 \-[1-9]*)       
15288         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15289         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15290         d_nv_preserves_uv="$define"
15291         ;;
15292 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15293         d_nv_preserves_uv="$undef" ;;
15294 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15295         nv_preserves_uv_bits="$undef" ;;
15296 esac
15297
15298 $rm -f try.* try
15299
15300 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15301 : volatile so that the compiler has to store it out to memory.
15302 if test X"$d_volatile" = X"$define"; then
15303         volatile=volatile
15304 fi
15305 $cat <<EOP >try.c
15306 #include <stdio.h>
15307 #$i_stdlib I_STDLIB
15308 #ifdef I_STDLIB
15309 #include <stdlib.h>
15310 #endif
15311 #$i_string I_STRING
15312 #ifdef I_STRING
15313 #  include <string.h>
15314 #else
15315 #  include <strings.h>
15316 #endif
15317 #include <sys/types.h>
15318 #include <signal.h>
15319 #ifdef SIGFPE
15320 $volatile int bletched = 0;
15321 $signal_t blech(int s) { bletched = 1; }
15322 #endif
15323
15324 int checkit($nvtype d, char *where) {
15325     unsigned char *p = (char *)&d;
15326     unsigned char *end = p + sizeof(d);
15327     int fail = 0;
15328
15329     while (p < end)
15330         fail += *p++;
15331
15332     if (!fail)
15333         return 0;
15334
15335     p = (char *)&d;
15336     printf("No - %s: 0x", where);
15337     while (p < end)
15338         printf ("%02X", *p++);
15339     printf("\n");
15340     return 1;
15341 }
15342
15343 int main(int argc, char **argv) {
15344     $nvtype d = 0.0;
15345     int fail = 0;
15346     fail += checkit(d, "0.0");
15347
15348     /* The compiler shouldn't be assuming that bletched is 0  */
15349     d = bletched;
15350
15351     fail += checkit(d, "bleched");
15352
15353 #ifdef SIGFPE
15354     signal(SIGFPE, blech);
15355 #endif
15356
15357     /* Paranoia - the compiler should have no way of knowing that ANSI says
15358        that argv[argc] will always be NULL.  Actually, if it did assume this it
15359        would be buggy, as this is C and main() can be called from elsewhere in
15360        the program.  */
15361     d = argv[argc] ? 1 : 0;
15362
15363     if (d) {
15364         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15365     }
15366
15367     fail += checkit(d, "ternary");
15368
15369     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15370
15371     if (d != 0.0) {
15372         printf("No - memset doesn't give 0.0\n");
15373         /* This might just blow up:  */
15374         printf("(gives %g)\n", d);
15375         return 1;
15376     }
15377     
15378 #ifdef SIGFPE
15379     if (bletched) {
15380         printf("No - something bleched\n");
15381         return 1;
15382     }
15383 #endif
15384     if (fail) {
15385       printf("No - %d fail(s)\n", fail);
15386       return 1;
15387     }
15388     printf("Yes\n");
15389     return 0;
15390 }
15391 EOP
15392 set try
15393
15394 d_nv_zero_is_allbits_zero="$undef"
15395 if eval $compile; then
15396     xxx="`$run ./try`"
15397     case "$?" in
15398         0)
15399             case "$xxx" in
15400                 Yes)  cat >&4 <<EOM
15401 0.0 is represented as all bits zero in memory
15402 EOM
15403                     d_nv_zero_is_allbits_zero="$define"
15404                     ;;
15405                 *)  cat >&4 <<EOM
15406 0.0 is not represented as all bits zero in memory
15407 EOM
15408                     d_nv_zero_is_allbits_zero="$undef"
15409                     ;;
15410             esac
15411             ;;
15412         *)  cat >&4 <<EOM
15413 0.0 is not represented as all bits zero in memory
15414 EOM
15415             d_nv_zero_is_allbits_zero="$undef"
15416             ;;
15417     esac
15418 fi
15419
15420 $rm -f try.* try
15421
15422
15423 : check for off64_t
15424 echo " "
15425 echo "Checking to see if you have off64_t..." >&4
15426 $cat >try.c <<EOCP
15427 #include <sys/types.h>
15428 #include <unistd.h>
15429 int main() { off64_t x = 7; }
15430 EOCP
15431 set try
15432 if eval $compile; then
15433         val="$define"
15434         echo "You have off64_t."
15435 else
15436         val="$undef"
15437         echo "You do not have off64_t."
15438         case "$lseeksize" in
15439         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15440         esac
15441 fi
15442 $rm -f try.* try
15443 set d_off64_t
15444 eval $setvar
15445
15446 : how to create joinable pthreads
15447 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15448         echo " "
15449         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15450         $cat >try.c <<'EOCP'
15451 #include <pthread.h>
15452 int main() {
15453     int detachstate = JOINABLE;
15454 }
15455 EOCP
15456         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15457         if eval $compile; then
15458                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15459                 val="$undef" # Yes, undef.
15460                 set d_old_pthread_create_joinable
15461                 eval $setvar
15462                 val=""
15463                 set old_pthread_create_joinable
15464                 eval $setvar
15465         else
15466                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15467                 if eval $compile; then
15468                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15469                         val="$define"
15470                         set d_old_pthread_create_joinable
15471                         eval $setvar
15472                         val=PTHREAD_CREATE_UNDETACHED
15473                         set old_pthread_create_joinable
15474                         eval $setvar
15475                 else            
15476                         set try -DJOINABLE=__UNDETACHED
15477                         if eval $compile; then
15478                                 echo "You seem to use __UNDETACHED." >&4
15479                                 val="$define"
15480                                 set d_old_pthread_create_joinable
15481                                 eval $setvar
15482                                 val=__UNDETACHED
15483                                 set old_pthread_create_joinable
15484                                 eval $setvar
15485                         else
15486                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15487                                 val="$define"
15488                                 set d_old_pthread_create_joinable
15489                                 eval $setvar
15490                                 val=0
15491                                 set old_pthread_create_joinable
15492                                 eval $setvar
15493                         fi
15494                 fi
15495         fi
15496         $rm -f try try.*
15497 else
15498     d_old_pthread_create_joinable="$undef"
15499     old_pthread_create_joinable=""
15500 fi
15501
15502 : see if pause exists
15503 set pause d_pause
15504 eval $inlibc
15505
15506 : see if pipe exists
15507 set pipe d_pipe
15508 eval $inlibc
15509
15510 : see if poll exists
15511 set poll d_poll
15512 eval $inlibc
15513
15514 : see if readlink exists
15515 set readlink d_readlink
15516 eval $inlibc
15517
15518 echo " "
15519 procselfexe=''
15520 val="$undef"
15521 case "$d_readlink" in
15522 "$define")
15523         if $issymlink /proc/self/exe ; then
15524                 $ls -l /proc/self/exe > reflect
15525                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15526                         echo "You have Linux-like /proc/self/exe."
15527                         procselfexe='"/proc/self/exe"'
15528                         val="$define"
15529                 fi
15530         fi
15531         if $issymlink /proc/curproc/file ; then
15532                 $ls -l /proc/curproc/file > reflect
15533                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15534                         echo "You have BSD-like /proc/curproc/file."
15535                         procselfexe='"/proc/curproc/file"'
15536                         val="$define"
15537                 fi
15538         fi
15539         ;;
15540 esac
15541 $rm -f reflect
15542 set d_procselfexe
15543 eval $setvar
15544
15545 : see whether the pthread_atfork exists
15546 $cat >try.c <<EOP
15547 #include <pthread.h>
15548 #include <stdio.h>
15549 int main() {
15550 #ifdef  PTHREAD_ATFORK
15551         pthread_atfork(NULL,NULL,NULL);
15552 #endif
15553 }
15554 EOP
15555
15556 : see if pthread_atfork exists
15557 set try -DPTHREAD_ATFORK
15558 if eval $compile; then
15559     val="$define"
15560 else
15561     val="$undef"
15562 fi
15563 case "$usethreads" in
15564 $define)
15565         case "$val" in
15566         $define) echo 'pthread_atfork found.' >&4        ;;
15567         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15568         esac
15569 esac
15570 set d_pthread_atfork
15571 eval $setvar
15572
15573 : see if pthread_attr_setscope exists
15574 set pthread_attr_setscope d_pthread_attr_setscope
15575 eval $inlibc
15576
15577
15578 : see whether the various POSIXish _yields exist
15579 $cat >try.c <<EOP
15580 #include <pthread.h>
15581 #include <stdio.h>
15582 int main() {
15583 #ifdef SCHED_YIELD
15584         sched_yield();
15585 #else
15586 #ifdef PTHREAD_YIELD
15587         pthread_yield();
15588 #else
15589 #ifdef PTHREAD_YIELD_NULL
15590         pthread_yield(NULL);
15591 #endif
15592 #endif
15593 #endif
15594 }
15595 EOP
15596 : see if sched_yield exists
15597 set try -DSCHED_YIELD
15598 if eval $compile; then
15599     val="$define"
15600     sched_yield='sched_yield()'
15601 else
15602     val="$undef"
15603 fi
15604 case "$usethreads" in
15605 $define)
15606         case "$val" in
15607         $define) echo 'sched_yield() found.' >&4        ;;
15608         *)       echo 'sched_yield() NOT found.' >&4    ;;
15609         esac
15610 esac
15611 set d_sched_yield
15612 eval $setvar
15613
15614 : see if pthread_yield exists
15615 set try -DPTHREAD_YIELD
15616 if eval $compile; then
15617     val="$define"
15618     case "$sched_yield" in
15619     '') sched_yield='pthread_yield()' ;;
15620     esac
15621 else
15622     set try -DPTHREAD_YIELD_NULL
15623     if eval $compile; then
15624         val="$define"
15625         case "$sched_yield" in
15626         '') sched_yield='pthread_yield(NULL)' ;;
15627         esac
15628     else
15629         val="$undef"
15630     fi
15631 fi
15632 case "$usethreads" in
15633 $define)
15634         case "$val" in
15635         $define) echo 'pthread_yield() found.' >&4      ;;
15636         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15637         esac
15638         ;;
15639 esac
15640 set d_pthread_yield
15641 eval $setvar
15642
15643 case "$sched_yield" in
15644 '') sched_yield=undef ;;
15645 esac
15646
15647 $rm -f try try.*
15648
15649 : see if random_r exists
15650 set random_r d_random_r
15651 eval $inlibc
15652 case "$d_random_r" in
15653 "$define")
15654         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15655         case "$d_random_r_proto:$usethreads" in
15656         ":define")      d_random_r_proto=define
15657                 set d_random_r_proto random_r $hdrs
15658                 eval $hasproto ;;
15659         *)      ;;
15660         esac
15661         case "$d_random_r_proto" in
15662         define)
15663         case "$random_r_proto" in
15664         ''|0) try='int random_r(int*, struct random_data*);'
15665         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15666         esac
15667         case "$random_r_proto" in
15668         ''|0) try='int random_r(long*, struct random_data*);'
15669         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15670         esac
15671         case "$random_r_proto" in
15672         ''|0) try='int random_r(struct random_data*, int32_t*);'
15673         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15674         esac
15675         case "$random_r_proto" in
15676         ''|0)   d_random_r=undef
15677                 random_r_proto=0
15678                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15679         * )     case "$random_r_proto" in
15680                 REENTRANT_PROTO*) ;;
15681                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15682                 esac
15683                 echo "Prototype: $try" ;;
15684         esac
15685         ;;
15686         *)      case "$usethreads" in
15687                 define) echo "random_r has no prototype, not using it." >&4 ;;
15688                 esac
15689                 d_random_r=undef
15690                 random_r_proto=0
15691                 ;;
15692         esac
15693         ;;
15694 *)      random_r_proto=0
15695         ;;
15696 esac
15697
15698 : see if readdir and friends exist
15699 set readdir d_readdir
15700 eval $inlibc
15701 set seekdir d_seekdir
15702 eval $inlibc
15703 set telldir d_telldir
15704 eval $inlibc
15705 set rewinddir d_rewinddir
15706 eval $inlibc
15707
15708 : see if readdir64_r exists
15709 set readdir64_r d_readdir64_r
15710 eval $inlibc
15711 case "$d_readdir64_r" in
15712 "$define")
15713         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15714         case "$d_readdir64_r_proto:$usethreads" in
15715         ":define")      d_readdir64_r_proto=define
15716                 set d_readdir64_r_proto readdir64_r $hdrs
15717                 eval $hasproto ;;
15718         *)      ;;
15719         esac
15720         case "$d_readdir64_r_proto" in
15721         define)
15722         case "$readdir64_r_proto" in
15723         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15724         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15725         esac
15726         case "$readdir64_r_proto" in
15727         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15728         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15729         esac
15730         case "$readdir64_r_proto" in
15731         ''|0)   d_readdir64_r=undef
15732                 readdir64_r_proto=0
15733                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15734         * )     case "$readdir64_r_proto" in
15735                 REENTRANT_PROTO*) ;;
15736                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15737                 esac
15738                 echo "Prototype: $try" ;;
15739         esac
15740         ;;
15741         *)      case "$usethreads" in
15742                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15743                 esac
15744                 d_readdir64_r=undef
15745                 readdir64_r_proto=0
15746                 ;;
15747         esac
15748         ;;
15749 *)      readdir64_r_proto=0
15750         ;;
15751 esac
15752
15753 : see if readdir_r exists
15754 set readdir_r d_readdir_r
15755 eval $inlibc
15756 case "$d_readdir_r" in
15757 "$define")
15758         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15759         case "$d_readdir_r_proto:$usethreads" in
15760         ":define")      d_readdir_r_proto=define
15761                 set d_readdir_r_proto readdir_r $hdrs
15762                 eval $hasproto ;;
15763         *)      ;;
15764         esac
15765         case "$d_readdir_r_proto" in
15766         define)
15767         case "$readdir_r_proto" in
15768         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15769         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15770         esac
15771         case "$readdir_r_proto" in
15772         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15773         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15774         esac
15775         case "$readdir_r_proto" in
15776         ''|0)   d_readdir_r=undef
15777                 readdir_r_proto=0
15778                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15779         * )     case "$readdir_r_proto" in
15780                 REENTRANT_PROTO*) ;;
15781                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15782                 esac
15783                 echo "Prototype: $try" ;;
15784         esac
15785         ;;
15786         *)      case "$usethreads" in
15787                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15788                 esac
15789                 d_readdir_r=undef
15790                 readdir_r_proto=0
15791                 ;;
15792         esac
15793         ;;
15794 *)      readdir_r_proto=0
15795         ;;
15796 esac
15797
15798 : see if readv exists
15799 set readv d_readv
15800 eval $inlibc
15801
15802 : see if recvmsg exists
15803 set recvmsg d_recvmsg
15804 eval $inlibc
15805
15806 : see if rename exists
15807 set rename d_rename
15808 eval $inlibc
15809
15810 : see if rmdir exists
15811 set rmdir d_rmdir
15812 eval $inlibc
15813
15814 : see if memory.h is available.
15815 val=''
15816 set memory.h val
15817 eval $inhdr
15818
15819 : See if it conflicts with string.h
15820 case "$val" in
15821 $define)
15822         case "$strings" in
15823         '') ;;
15824         *)
15825                 $cppstdin $cppflags $cppminus < $strings > mem.h
15826                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15827                         echo " "
15828                         echo "We won't be including <memory.h>."
15829                         val="$undef"
15830                 fi
15831                 $rm -f mem.h
15832                 ;;
15833         esac
15834 esac
15835 set i_memory
15836 eval $setvar
15837
15838 : can bcopy handle overlapping blocks?
15839 echo " "
15840 val="$undef"
15841 case "$d_memmove" in
15842 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15843 *)      case "$d_bcopy" in
15844         "$define")
15845                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15846                 $cat >try.c <<EOCP
15847 #$i_memory I_MEMORY
15848 #$i_stdlib I_STDLIB
15849 #$i_string I_STRING
15850 #$i_unistd I_UNISTD
15851 EOCP
15852         $cat >>try.c <<'EOCP'
15853 #include <stdio.h>
15854 #ifdef I_MEMORY
15855 #  include <memory.h>
15856 #endif
15857 #ifdef I_STDLIB
15858 #  include <stdlib.h>
15859 #endif
15860 #ifdef I_STRING
15861 #  include <string.h>
15862 #else
15863 #  include <strings.h>
15864 #endif
15865 #ifdef I_UNISTD
15866 #  include <unistd.h>  /* Needed for NetBSD */
15867 #endif
15868 int main()
15869 {
15870 char buf[128], abc[128];
15871 char *b;
15872 int len;
15873 int off;
15874 int align;
15875
15876 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15877    try to store the string in read-only memory. */
15878 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15879
15880 for (align = 7; align >= 0; align--) {
15881         for (len = 36; len; len--) {
15882                 b = buf+align;
15883                 bcopy(abc, b, len);
15884                 for (off = 1; off <= len; off++) {
15885                         bcopy(b, b+off, len);
15886                         bcopy(b+off, b, len);
15887                         if (bcmp(b, abc, len))
15888                                 exit(1);
15889                 }
15890         }
15891 }
15892 exit(0);
15893 }
15894 EOCP
15895                 set try
15896                 if eval $compile_ok; then
15897                         if ./try 2>/dev/null; then
15898                                 echo "Yes, it can."
15899                                 val="$define"
15900                         else
15901                                 echo "It can't, sorry."
15902                         fi
15903                 else
15904                         echo "(I can't compile the test program, so we'll assume not...)"
15905                 fi
15906                 ;;
15907         esac
15908         $rm -f try.* try core
15909         ;;
15910 esac
15911 set d_safebcpy
15912 eval $setvar
15913
15914 : can memcpy handle overlapping blocks?
15915 echo " "
15916 val="$undef"
15917 case "$d_memmove" in
15918 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15919 *)      case "$d_memcpy" in
15920         "$define")
15921                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15922                 $cat >try.c <<EOCP
15923 #$i_memory I_MEMORY
15924 #$i_stdlib I_STDLIB
15925 #$i_string I_STRING
15926 #$i_unistd I_UNISTD
15927 EOCP
15928         $cat >>try.c <<'EOCP'
15929 #include <stdio.h>
15930 #ifdef I_MEMORY
15931 #  include <memory.h>
15932 #endif
15933 #ifdef I_STDLIB
15934 #  include <stdlib.h>
15935 #endif
15936 #ifdef I_STRING
15937 #  include <string.h>
15938 #else
15939 #  include <strings.h>
15940 #endif
15941 #ifdef I_UNISTD
15942 #  include <unistd.h>  /* Needed for NetBSD */
15943 #endif
15944 int main()
15945 {
15946 char buf[128], abc[128];
15947 char *b;
15948 int len;
15949 int off;
15950 int align;
15951
15952 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15953    try to store the string in read-only memory. */
15954 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15955
15956 for (align = 7; align >= 0; align--) {
15957         for (len = 36; len; len--) {
15958                 b = buf+align;
15959                 memcpy(b, abc, len);
15960                 for (off = 1; off <= len; off++) {
15961                         memcpy(b+off, b, len);
15962                         memcpy(b, b+off, len);
15963                         if (memcmp(b, abc, len))
15964                                 exit(1);
15965                 }
15966         }
15967 }
15968 exit(0);
15969 }
15970 EOCP
15971                 set try
15972                 if eval $compile_ok; then
15973                         if ./try 2>/dev/null; then
15974                                 echo "Yes, it can."
15975                                 val="$define"
15976                         else
15977                                 echo "It can't, sorry."
15978                         fi
15979                 else
15980                         echo "(I can't compile the test program, so we'll assume not...)"
15981                 fi
15982                 ;;
15983         esac
15984         $rm -f try.* try core
15985         ;;
15986 esac
15987 set d_safemcpy
15988 eval $setvar
15989
15990 : can memcmp be trusted to compare relative magnitude?
15991 val="$undef"
15992 case "$d_memcmp" in
15993 "$define")
15994         echo " "
15995         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15996         $cat >try.c <<EOCP
15997 #$i_memory I_MEMORY
15998 #$i_stdlib I_STDLIB
15999 #$i_string I_STRING
16000 #$i_unistd I_UNISTD
16001 EOCP
16002         $cat >>try.c <<'EOCP'
16003 #include <stdio.h>
16004 #ifdef I_MEMORY
16005 #  include <memory.h>
16006 #endif
16007 #ifdef I_STDLIB
16008 #  include <stdlib.h>
16009 #endif
16010 #ifdef I_STRING
16011 #  include <string.h>
16012 #else
16013 #  include <strings.h>
16014 #endif
16015 #ifdef I_UNISTD
16016 #  include <unistd.h>  /* Needed for NetBSD */
16017 #endif
16018 int main()
16019 {
16020 char a = -1;
16021 char b = 0;
16022 if ((a < b) && memcmp(&a, &b, 1) < 0)
16023         exit(1);
16024 exit(0);
16025 }
16026 EOCP
16027         set try
16028         if eval $compile_ok; then
16029                 if $run ./try 2>/dev/null; then
16030                         echo "Yes, it can."
16031                         val="$define"
16032                 else
16033                         echo "No, it can't (it uses signed chars)."
16034                 fi
16035         else
16036                 echo "(I can't compile the test program, so we'll assume not...)"
16037         fi
16038         ;;
16039 esac
16040 $rm -f try.* try core
16041 set d_sanemcmp
16042 eval $setvar
16043
16044 : see if prototype for sbrk is available
16045 echo " "
16046 set d_sbrkproto sbrk $i_unistd unistd.h
16047 eval $hasproto
16048
16049 : see if select exists
16050 set select d_select
16051 eval $inlibc
16052
16053 : see if semctl exists
16054 set semctl d_semctl
16055 eval $inlibc
16056
16057 : see if semget exists
16058 set semget d_semget
16059 eval $inlibc
16060
16061 : see if semop exists
16062 set semop d_semop
16063 eval $inlibc
16064
16065 : see how much of the 'sem*(2)' library is present.
16066 h_sem=true
16067 echo " "
16068 case "$d_semctl$d_semget$d_semop" in
16069 *"$undef"*) h_sem=false;;
16070 esac
16071 case "$osname" in
16072 freebsd)
16073     case "`ipcs 2>&1`" in
16074     "SVID messages"*"not configured"*)
16075         echo "Your $osname does not have the sem*(2) configured." >&4
16076         h_sem=false
16077         val="$undef"
16078         set semctl d_semctl
16079         eval $setvar
16080         set semget d_semget
16081         eval $setvar
16082         set semop d_semop
16083         eval $setvar
16084         ;;
16085     esac
16086     ;;
16087 esac
16088 : we could also check for sys/ipc.h ...
16089 if $h_sem && $test `./findhdr sys/sem.h`; then
16090         echo "You have the full sem*(2) library." >&4
16091         val="$define"
16092 else
16093         echo "You don't have the full sem*(2) library." >&4
16094         val="$undef"
16095 fi
16096 set d_sem
16097 eval $setvar
16098
16099 : see whether sys/sem.h defines union semun
16100 echo " "
16101 $cat > try.c <<'END'
16102 #include <sys/types.h>
16103 #include <sys/ipc.h>
16104 #include <sys/sem.h>
16105 int main () { union semun semun; semun.buf = 0; }
16106 END
16107 set try
16108 if eval $compile; then
16109     echo "You have union semun in <sys/sem.h>." >&4
16110     val="$define"
16111 else
16112     echo "You do not have union semun in <sys/sem.h>." >&4
16113     val="$undef"
16114 fi
16115 $rm -f try try.c
16116 set d_union_semun
16117 eval $setvar
16118
16119 : see how to do semctl IPC_STAT
16120 case "$d_sem" in
16121 $define)
16122     echo " "
16123     $cat > try.h <<END
16124 #ifndef S_IRUSR
16125 #   ifdef S_IREAD
16126 #       define S_IRUSR S_IREAD
16127 #       define S_IWUSR S_IWRITE
16128 #       define S_IXUSR S_IEXEC
16129 #   else
16130 #       define S_IRUSR 0400
16131 #       define S_IWUSR 0200
16132 #       define S_IXUSR 0100
16133 #   endif
16134 #   define S_IRGRP (S_IRUSR>>3)
16135 #   define S_IWGRP (S_IWUSR>>3)
16136 #   define S_IXGRP (S_IXUSR>>3)
16137 #   define S_IROTH (S_IRUSR>>6)
16138 #   define S_IWOTH (S_IWUSR>>6)
16139 #   define S_IXOTH (S_IXUSR>>6)
16140 #endif
16141 #ifndef S_IRWXU
16142 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16143 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16144 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16145 #endif
16146 END
16147     : see whether semctl IPC_STAT can use union semun
16148     case "$d_semctl_semun" in
16149     '')
16150       val="$undef"
16151       $cat > try.c <<END
16152 #include <sys/types.h>
16153 #include <sys/ipc.h>
16154 #include <sys/sem.h>
16155 #include <sys/stat.h>
16156 #include <stdio.h>
16157 #include <errno.h>
16158 #include "try.h"
16159 #ifndef errno
16160 extern int errno;
16161 #endif
16162 #$d_union_semun HAS_UNION_SEMUN
16163 int main() {
16164     union semun
16165 #ifndef HAS_UNION_SEMUN
16166     {
16167         int val;
16168         struct semid_ds *buf;
16169         unsigned short *array;
16170     }
16171 #endif
16172     arg;
16173     int sem, st;
16174
16175 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16176     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16177     if (sem > -1) {
16178         struct semid_ds argbuf;
16179         arg.buf = &argbuf;
16180 #       ifdef IPC_STAT
16181         st = semctl(sem, 0, IPC_STAT, arg);
16182         if (st == 0)
16183             printf("semun\n");
16184         else
16185 #       endif /* IPC_STAT */
16186             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16187 #       ifdef IPC_RMID
16188         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16189 #       endif /* IPC_RMID */
16190             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16191     } else
16192 #endif /* IPC_PRIVATE && ... */
16193         printf("semget failed: errno = %d\n", errno);
16194   return 0;
16195 }
16196 END
16197       set try
16198       if eval $compile; then
16199           xxx=`$run ./try`
16200           case "$xxx" in
16201           semun) val="$define" ;;
16202           esac
16203       fi
16204       $rm -f try try.c
16205       set d_semctl_semun
16206       eval $setvar
16207       ;;
16208     esac
16209     case "$d_semctl_semun" in
16210     $define)
16211         echo "You can use union semun for semctl IPC_STAT." >&4
16212         also='also'
16213         ;;
16214     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16215         also=''
16216         ;;
16217     esac
16218
16219     : see whether semctl IPC_STAT can use struct semid_ds pointer
16220     case "$d_semctl_semid_ds" in
16221     '')
16222       val="$undef"
16223       $cat > try.c <<'END'
16224 #include <sys/types.h>
16225 #include <sys/ipc.h>
16226 #include <sys/sem.h>
16227 #include <sys/stat.h>
16228 #include "try.h"
16229 #include <stdio.h>
16230 #include <errno.h>
16231 #ifndef errno
16232 extern int errno;
16233 #endif
16234 int main() {
16235     struct semid_ds arg;
16236     int sem, st;
16237
16238 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16239     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16240     if (sem > -1) {
16241 #       ifdef IPC_STAT
16242         st = semctl(sem, 0, IPC_STAT, &arg);
16243         if (st == 0)
16244             printf("semid_ds\n");
16245         else
16246 #       endif /* IPC_STAT */
16247             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16248 #       ifdef IPC_RMID
16249         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16250 #       endif /* IPC_RMID */
16251             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16252     } else
16253 #endif /* IPC_PRIVATE && ... */
16254         printf("semget failed: errno = %d\n", errno);
16255
16256     return 0;
16257 }
16258 END
16259       set try
16260       if eval $compile; then
16261           xxx=`$run ./try`
16262           case "$xxx" in
16263           semid_ds) val="$define" ;;
16264           esac
16265       fi
16266       $rm -f try try.c
16267       set d_semctl_semid_ds
16268       eval $setvar
16269       ;;
16270     esac
16271     case "$d_semctl_semid_ds" in
16272     $define)
16273         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16274         ;;
16275     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16276         ;;
16277     esac
16278     $rm -f try.h
16279     ;;
16280 *)  val="$undef"
16281
16282     # We do not have the full sem*(2) library, so assume we can not
16283     # use either.
16284
16285     set d_semctl_semun
16286     eval $setvar
16287
16288     set d_semctl_semid_ds
16289     eval $setvar
16290     ;;
16291 esac
16292
16293 : see if sendmsg exists
16294 set sendmsg d_sendmsg
16295 eval $inlibc
16296
16297 : see if setegid exists
16298 set setegid d_setegid
16299 eval $inlibc
16300
16301 : see if seteuid exists
16302 set seteuid d_seteuid
16303 eval $inlibc
16304
16305 : see if setgrent exists
16306 set setgrent d_setgrent
16307 eval $inlibc
16308
16309 : see if setgrent_r exists
16310 set setgrent_r d_setgrent_r
16311 eval $inlibc
16312 case "$d_setgrent_r" in
16313 "$define")
16314         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16315         case "$d_setgrent_r_proto:$usethreads" in
16316         ":define")      d_setgrent_r_proto=define
16317                 set d_setgrent_r_proto setgrent_r $hdrs
16318                 eval $hasproto ;;
16319         *)      ;;
16320         esac
16321         case "$d_setgrent_r_proto" in
16322         define)
16323         case "$setgrent_r_proto" in
16324         ''|0) try='int setgrent_r(FILE**);'
16325         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16326         esac
16327         case "$setgrent_r_proto" in
16328         ''|0) try='void setgrent_r(FILE**);'
16329         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16330         esac
16331         case "$setgrent_r_proto" in
16332         ''|0)   d_setgrent_r=undef
16333                 setgrent_r_proto=0
16334                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16335         * )     case "$setgrent_r_proto" in
16336                 REENTRANT_PROTO*) ;;
16337                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16338                 esac
16339                 echo "Prototype: $try" ;;
16340         esac
16341         ;;
16342         *)      case "$usethreads" in
16343                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16344                 esac
16345                 d_setgrent_r=undef
16346                 setgrent_r_proto=0
16347                 ;;
16348         esac
16349         ;;
16350 *)      setgrent_r_proto=0
16351         ;;
16352 esac
16353
16354 : see if sethostent exists
16355 set sethostent d_sethent
16356 eval $inlibc
16357
16358 : see if sethostent_r exists
16359 set sethostent_r d_sethostent_r
16360 eval $inlibc
16361 case "$d_sethostent_r" in
16362 "$define")
16363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16364         case "$d_sethostent_r_proto:$usethreads" in
16365         ":define")      d_sethostent_r_proto=define
16366                 set d_sethostent_r_proto sethostent_r $hdrs
16367                 eval $hasproto ;;
16368         *)      ;;
16369         esac
16370         case "$d_sethostent_r_proto" in
16371         define)
16372         case "$sethostent_r_proto" in
16373         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16374         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16375         esac
16376         case "$sethostent_r_proto" in
16377         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16378         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16379         esac
16380         case "$sethostent_r_proto" in
16381         ''|0)   d_sethostent_r=undef
16382                 sethostent_r_proto=0
16383                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16384         * )     case "$sethostent_r_proto" in
16385                 REENTRANT_PROTO*) ;;
16386                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16387                 esac
16388                 echo "Prototype: $try" ;;
16389         esac
16390         ;;
16391         *)      case "$usethreads" in
16392                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16393                 esac
16394                 d_sethostent_r=undef
16395                 sethostent_r_proto=0
16396                 ;;
16397         esac
16398         ;;
16399 *)      sethostent_r_proto=0
16400         ;;
16401 esac
16402
16403 : see if setitimer exists
16404 set setitimer d_setitimer
16405 eval $inlibc
16406
16407 : see if setlinebuf exists
16408 set setlinebuf d_setlinebuf
16409 eval $inlibc
16410
16411 : see if setlocale exists
16412 set setlocale d_setlocale
16413 eval $inlibc
16414
16415 : see if locale.h is available
16416 set locale.h i_locale
16417 eval $inhdr
16418
16419 : see if setlocale_r exists
16420 set setlocale_r d_setlocale_r
16421 eval $inlibc
16422 case "$d_setlocale_r" in
16423 "$define")
16424         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16425         case "$d_setlocale_r_proto:$usethreads" in
16426         ":define")      d_setlocale_r_proto=define
16427                 set d_setlocale_r_proto setlocale_r $hdrs
16428                 eval $hasproto ;;
16429         *)      ;;
16430         esac
16431         case "$d_setlocale_r_proto" in
16432         define)
16433         case "$setlocale_r_proto" in
16434         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16435         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16436         esac
16437         case "$setlocale_r_proto" in
16438         ''|0)   d_setlocale_r=undef
16439                 setlocale_r_proto=0
16440                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16441         * )     case "$setlocale_r_proto" in
16442                 REENTRANT_PROTO*) ;;
16443                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16444                 esac
16445                 echo "Prototype: $try" ;;
16446         esac
16447         ;;
16448         *)      case "$usethreads" in
16449                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16450                 esac
16451                 d_setlocale_r=undef
16452                 setlocale_r_proto=0
16453                 ;;
16454         esac
16455         ;;
16456 *)      setlocale_r_proto=0
16457         ;;
16458 esac
16459
16460 : see if setnetent exists
16461 set setnetent d_setnent
16462 eval $inlibc
16463
16464 : see if setnetent_r exists
16465 set setnetent_r d_setnetent_r
16466 eval $inlibc
16467 case "$d_setnetent_r" in
16468 "$define")
16469         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16470         case "$d_setnetent_r_proto:$usethreads" in
16471         ":define")      d_setnetent_r_proto=define
16472                 set d_setnetent_r_proto setnetent_r $hdrs
16473                 eval $hasproto ;;
16474         *)      ;;
16475         esac
16476         case "$d_setnetent_r_proto" in
16477         define)
16478         case "$setnetent_r_proto" in
16479         ''|0) try='int setnetent_r(int, struct netent_data*);'
16480         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16481         esac
16482         case "$setnetent_r_proto" in
16483         ''|0) try='void setnetent_r(int, struct netent_data*);'
16484         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16485         esac
16486         case "$setnetent_r_proto" in
16487         ''|0)   d_setnetent_r=undef
16488                 setnetent_r_proto=0
16489                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16490         * )     case "$setnetent_r_proto" in
16491                 REENTRANT_PROTO*) ;;
16492                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16493                 esac
16494                 echo "Prototype: $try" ;;
16495         esac
16496         ;;
16497         *)      case "$usethreads" in
16498                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16499                 esac
16500                 d_setnetent_r=undef
16501                 setnetent_r_proto=0
16502                 ;;
16503         esac
16504         ;;
16505 *)      setnetent_r_proto=0
16506         ;;
16507 esac
16508
16509 : see if setprotoent exists
16510 set setprotoent d_setpent
16511 eval $inlibc
16512
16513 : see if setpgid exists
16514 set setpgid d_setpgid
16515 eval $inlibc
16516
16517 : see if setpgrp2 exists
16518 set setpgrp2 d_setpgrp2
16519 eval $inlibc
16520
16521 : see if setpriority exists
16522 set setpriority d_setprior
16523 eval $inlibc
16524
16525 : see if setproctitle exists
16526 set setproctitle d_setproctitle
16527 eval $inlibc
16528
16529 : see if setprotoent_r exists
16530 set setprotoent_r d_setprotoent_r
16531 eval $inlibc
16532 case "$d_setprotoent_r" in
16533 "$define")
16534         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16535         case "$d_setprotoent_r_proto:$usethreads" in
16536         ":define")      d_setprotoent_r_proto=define
16537                 set d_setprotoent_r_proto setprotoent_r $hdrs
16538                 eval $hasproto ;;
16539         *)      ;;
16540         esac
16541         case "$d_setprotoent_r_proto" in
16542         define)
16543         case "$setprotoent_r_proto" in
16544         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16545         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16546         esac
16547         case "$setprotoent_r_proto" in
16548         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16549         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16550         esac
16551         case "$setprotoent_r_proto" in
16552         ''|0)   d_setprotoent_r=undef
16553                 setprotoent_r_proto=0
16554                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16555         * )     case "$setprotoent_r_proto" in
16556                 REENTRANT_PROTO*) ;;
16557                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16558                 esac
16559                 echo "Prototype: $try" ;;
16560         esac
16561         ;;
16562         *)      case "$usethreads" in
16563                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16564                 esac
16565                 d_setprotoent_r=undef
16566                 setprotoent_r_proto=0
16567                 ;;
16568         esac
16569         ;;
16570 *)      setprotoent_r_proto=0
16571         ;;
16572 esac
16573
16574 : see if setpwent exists
16575 set setpwent d_setpwent
16576 eval $inlibc
16577
16578 : see if setpwent_r exists
16579 set setpwent_r d_setpwent_r
16580 eval $inlibc
16581 case "$d_setpwent_r" in
16582 "$define")
16583         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16584         case "$d_setpwent_r_proto:$usethreads" in
16585         ":define")      d_setpwent_r_proto=define
16586                 set d_setpwent_r_proto setpwent_r $hdrs
16587                 eval $hasproto ;;
16588         *)      ;;
16589         esac
16590         case "$d_setpwent_r_proto" in
16591         define)
16592         case "$setpwent_r_proto" in
16593         ''|0) try='int setpwent_r(FILE**);'
16594         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16595         esac
16596         case "$setpwent_r_proto" in
16597         ''|0) try='void setpwent_r(FILE**);'
16598         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16599         esac
16600         case "$setpwent_r_proto" in
16601         ''|0)   d_setpwent_r=undef
16602                 setpwent_r_proto=0
16603                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16604         * )     case "$setpwent_r_proto" in
16605                 REENTRANT_PROTO*) ;;
16606                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16607                 esac
16608                 echo "Prototype: $try" ;;
16609         esac
16610         ;;
16611         *)      case "$usethreads" in
16612                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16613                 esac
16614                 d_setpwent_r=undef
16615                 setpwent_r_proto=0
16616                 ;;
16617         esac
16618         ;;
16619 *)      setpwent_r_proto=0
16620         ;;
16621 esac
16622
16623 : see if setregid exists
16624 set setregid d_setregid
16625 eval $inlibc
16626 set setresgid d_setresgid
16627 eval $inlibc
16628
16629 : see if setreuid exists
16630 set setreuid d_setreuid
16631 eval $inlibc
16632 set setresuid d_setresuid
16633 eval $inlibc
16634
16635 : see if setrgid exists
16636 set setrgid d_setrgid
16637 eval $inlibc
16638
16639 : see if setruid exists
16640 set setruid d_setruid
16641 eval $inlibc
16642
16643 : see if setservent exists
16644 set setservent d_setsent
16645 eval $inlibc
16646
16647 : see if setservent_r exists
16648 set setservent_r d_setservent_r
16649 eval $inlibc
16650 case "$d_setservent_r" in
16651 "$define")
16652         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16653         case "$d_setservent_r_proto:$usethreads" in
16654         ":define")      d_setservent_r_proto=define
16655                 set d_setservent_r_proto setservent_r $hdrs
16656                 eval $hasproto ;;
16657         *)      ;;
16658         esac
16659         case "$d_setservent_r_proto" in
16660         define)
16661         case "$setservent_r_proto" in
16662         ''|0) try='int setservent_r(int, struct servent_data*);'
16663         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16664         esac
16665         case "$setservent_r_proto" in
16666         ''|0) try='void setservent_r(int, struct servent_data*);'
16667         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16668         esac
16669         case "$setservent_r_proto" in
16670         ''|0)   d_setservent_r=undef
16671                 setservent_r_proto=0
16672                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16673         * )     case "$setservent_r_proto" in
16674                 REENTRANT_PROTO*) ;;
16675                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16676                 esac
16677                 echo "Prototype: $try" ;;
16678         esac
16679         ;;
16680         *)      case "$usethreads" in
16681                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16682                 esac
16683                 d_setservent_r=undef
16684                 setservent_r_proto=0
16685                 ;;
16686         esac
16687         ;;
16688 *)      setservent_r_proto=0
16689         ;;
16690 esac
16691
16692 : see if setsid exists
16693 set setsid d_setsid
16694 eval $inlibc
16695
16696 : see if setvbuf exists
16697 set setvbuf d_setvbuf
16698 eval $inlibc
16699
16700 : see if sfio.h is available
16701 set sfio.h i_sfio
16702 eval $inhdr
16703
16704
16705 : see if sfio library is available
16706 case "$i_sfio" in
16707 $define)
16708         val=''
16709         set sfreserve val
16710         eval $inlibc
16711         ;;
16712 *)
16713         val="$undef"
16714         ;;
16715 esac
16716 : Ok, but do we want to use it.
16717 case "$val" in
16718 $define)
16719         case "$usesfio" in
16720         true|$define|[yY]*) dflt='y';;
16721         *) dflt='n';;
16722         esac
16723         echo "$package can use the sfio library, but it is experimental."
16724         case "$useperlio" in
16725         "$undef")
16726             echo "For sfio also the PerlIO abstraction layer is needed."
16727             echo "Earlier you said you wouldn't want that."
16728             ;;
16729         esac
16730         rp="You seem to have sfio available, do you want to try using it?"
16731         . ./myread
16732         case "$ans" in
16733         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16734                 useperlio="$define"
16735                 val="$define"
16736                 ;;
16737         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16738                 val="$undef"
16739                 ;;
16740         esac
16741         ;;
16742 *)      case "$usesfio" in
16743         true|$define|[yY]*)
16744                 echo "Sorry, cannot find sfio on this machine." >&4
16745                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16746                 val="$undef"
16747                 ;;
16748         esac
16749         ;;
16750 esac
16751 set d_sfio
16752 eval $setvar
16753 case "$d_sfio" in
16754 $define) usesfio='true';;
16755 *) usesfio='false';;
16756 esac
16757 case "$d_sfio" in
16758 $define) ;;
16759 *)      : Remove sfio from list of libraries to use
16760         case "$libs" in
16761         *-lsfio*)
16762                 echo "Removing unneeded -lsfio from library list" >&4
16763                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16764                 shift
16765                 libs="$*"
16766                 echo "libs = $libs" >&4
16767                 ;;
16768         esac
16769 ;;
16770 esac
16771
16772
16773 : see if shmctl exists
16774 set shmctl d_shmctl
16775 eval $inlibc
16776
16777 : see if shmget exists
16778 set shmget d_shmget
16779 eval $inlibc
16780
16781 : see if shmat exists
16782 set shmat d_shmat
16783 eval $inlibc
16784 : see what shmat returns
16785 case "$d_shmat" in
16786 "$define")
16787         $cat >shmat.c <<'END'
16788 #include <sys/shm.h>
16789 void *shmat();
16790 END
16791         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16792                 shmattype='void *'
16793         else
16794                 shmattype='char *'
16795         fi
16796         echo "and it returns ($shmattype)." >&4
16797         : see if a prototype for shmat is available
16798         xxx=`./findhdr sys/shm.h`
16799         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16800         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16801                 val="$define"
16802         else
16803                 val="$undef"
16804         fi
16805         $rm -f shmat.[co]
16806         ;;
16807 *)
16808         val="$undef"
16809         ;;
16810 esac
16811 set d_shmatprototype
16812 eval $setvar
16813
16814 : see if shmdt exists
16815 set shmdt d_shmdt
16816 eval $inlibc
16817
16818 : see how much of the 'shm*(2)' library is present.
16819 h_shm=true
16820 echo " "
16821 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16822 *"$undef"*) h_shm=false;;
16823 esac
16824 case "$osname" in
16825 freebsd)
16826     case "`ipcs 2>&1`" in
16827     "SVID shared memory"*"not configured"*)
16828         echo "Your $osname does not have the shm*(2) configured." >&4
16829         h_shm=false
16830         val="$undef"
16831         set shmctl d_shmctl
16832         evat $setvar
16833         set shmget d_shmget
16834         evat $setvar
16835         set shmat d_shmat
16836         evat $setvar
16837         set shmdt d_shmdt
16838         evat $setvar
16839         ;;
16840     esac
16841     ;;
16842 esac
16843 : we could also check for sys/ipc.h ...
16844 if $h_shm && $test `./findhdr sys/shm.h`; then
16845         echo "You have the full shm*(2) library." >&4
16846         val="$define"
16847 else
16848         echo "You don't have the full shm*(2) library." >&4
16849         val="$undef"
16850 fi
16851 set d_shm
16852 eval $setvar
16853
16854 echo " "
16855 : see if we have sigaction
16856 if set sigaction val -f d_sigaction; eval $csym; $val; then
16857         echo 'sigaction() found.' >&4
16858         $cat > try.c <<EOP
16859 #include <stdio.h>
16860 #include <sys/types.h>
16861 #include <signal.h>
16862 #$i_stdlib I_STDLIB
16863 #ifdef I_STDLIB
16864 #include <stdlib.h>
16865 #endif
16866 int main()
16867 {
16868     struct sigaction act, oact;
16869     act.sa_flags = 0;
16870     oact.sa_handler = 0;
16871     /* so that act and oact are used */
16872     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16873 }
16874 EOP
16875         set try
16876         if eval $compile_ok; then
16877                 val="$define"
16878         else
16879                 echo "But you don't seem to have a useable struct sigaction." >&4
16880                 val="$undef"
16881         fi
16882 else
16883         echo 'sigaction NOT found.' >&4
16884         val="$undef"
16885 fi
16886 set d_sigaction; eval $setvar
16887 $rm -f try try$_o try.c
16888
16889 : see if sigprocmask exists
16890 set sigprocmask d_sigprocmask
16891 eval $inlibc
16892
16893 : see if sigsetjmp exists
16894 echo " "
16895 case "$d_sigsetjmp" in
16896 '')
16897         $cat >try.c <<EOP
16898 #include <setjmp.h>
16899 #$i_stdlib I_STDLIB
16900 #ifdef I_STDLIB
16901 #include <stdlib.h>
16902 #endif
16903 sigjmp_buf env;
16904 int set = 1;
16905 int main()
16906 {
16907         if (sigsetjmp(env,1))
16908                 exit(set);
16909         set = 0;
16910         siglongjmp(env, 1);
16911         exit(1);
16912 }
16913 EOP
16914         set try
16915         if eval $compile; then
16916                 if $run ./try >/dev/null 2>&1; then
16917                         echo "POSIX sigsetjmp found." >&4
16918                         val="$define"
16919                 else
16920                         $cat >&4 <<EOM
16921 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16922 I'll ignore them.
16923 EOM
16924                         val="$undef"
16925                 fi
16926         else
16927                 echo "sigsetjmp not found." >&4
16928                 val="$undef"
16929         fi
16930         ;;
16931 *) val="$d_sigsetjmp"
16932         case "$d_sigsetjmp" in
16933         $define) echo "POSIX sigsetjmp found." >&4;;
16934         $undef) echo "sigsetjmp not found." >&4;;
16935         esac
16936         ;;
16937 esac
16938 set d_sigsetjmp
16939 eval $setvar
16940 $rm -f try.c try
16941
16942 : see if snprintf exists
16943 set snprintf d_snprintf
16944 eval $inlibc
16945
16946 : see if vsnprintf exists
16947 set vsnprintf d_vsnprintf
16948 eval $inlibc
16949
16950 case "$d_snprintf-$d_vsnprintf" in
16951 "$define-$define")
16952     $cat <<EOM
16953 Checking whether your snprintf() and vsnprintf() work okay...
16954 EOM
16955     $cat >try.c <<'EOCP'
16956 /* v?snprintf testing logic courtesy of Russ Allbery.
16957  * According to C99:
16958  * - if the buffer is too short it still must be \0-terminated
16959  * - if the buffer is too short the potentially required length
16960  *   must be returned and not -1
16961  * - if the buffer is NULL the potentially required length
16962  *   must be returned and not -1 or core dump
16963  */
16964 #include <stdio.h>
16965 #include <stdarg.h>
16966
16967 char buf[2];
16968
16969 int test (char *format, ...)
16970 {
16971     va_list args;
16972     int count;
16973
16974     va_start (args, format);
16975     count = vsnprintf (buf, sizeof buf, format, args);
16976     va_end (args);
16977     return count;
16978 }
16979
16980 int main ()
16981 {
16982     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16983              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16984 }
16985 EOCP
16986     set try
16987     if eval $compile; then
16988         `$run ./try`
16989         case "$?" in
16990         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16991         *) cat <<EOM >&4
16992 Your snprintf() and snprintf() don't seem to be working okay.
16993 EOM
16994            d_snprintf="$undef"
16995            d_vsnprintf="$undef"
16996            ;;
16997         esac
16998     else
16999         echo "(I can't seem to compile the test program--assuming they don't)"
17000         d_snprintf="$undef"
17001         d_vsnprintf="$undef"
17002     fi
17003     $rm -f try.* try core core.try.*
17004     ;;
17005 esac
17006
17007 : see if sockatmark exists
17008 set sockatmark d_sockatmark
17009 eval $inlibc
17010
17011 : see if prototype for sockatmark is available
17012 echo " "
17013 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17014 eval $hasproto
17015
17016 : see if socks5_init exists
17017 set socks5_init d_socks5_init
17018 eval $inlibc
17019
17020 : see if sprintf returns the length of the string in the buffer as per ANSI
17021 $echo "Checking whether sprintf returns the length of the string..." >&4
17022 $cat <<EOP >try.c
17023 #include <stdio.h>
17024 #$i_stdlib I_STDLIB
17025 #ifdef I_STDLIB
17026 #include <stdlib.h>
17027 #endif
17028 #$i_string I_STRING
17029 #ifdef I_STRING
17030 #  include <string.h>
17031 #else
17032 #  include <strings.h>
17033 #endif
17034 #$i_math I_MATH
17035 #ifdef I_MATH
17036 #include <math.h>
17037 #endif
17038
17039 char buffer[256];
17040
17041 int check (size_t expect, int test) {
17042   size_t got = strlen(buffer);
17043   if (expect == got)
17044     return 0;
17045
17046   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17047        test, buffer);
17048   exit (test);
17049 }
17050
17051 int main(int argc, char **argv) {
17052   int test = 0;
17053
17054   check(sprintf(buffer, ""), ++test);
17055   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17056   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17057
17058   return 0;
17059 }
17060 EOP
17061 set try
17062
17063 d_sprintf_returns_strlen="$undef"
17064 if eval $compile; then
17065     xxx="`$run ./try`"
17066     case "$?" in
17067         0) cat >&4 <<EOM
17068 sprintf returns the length of the string (as ANSI says it should)
17069 EOM
17070         d_sprintf_returns_strlen="$define"
17071         ;;
17072         *) cat >&4 <<EOM
17073 sprintf does not return the length of the string (how old is this system?)
17074 EOM
17075         d_sprintf_returns_strlen="$undef"
17076         ;;
17077     esac
17078 fi
17079
17080 $rm -f try.* try
17081
17082 : see if srand48_r exists
17083 set srand48_r d_srand48_r
17084 eval $inlibc
17085 case "$d_srand48_r" in
17086 "$define")
17087         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17088         case "$d_srand48_r_proto:$usethreads" in
17089         ":define")      d_srand48_r_proto=define
17090                 set d_srand48_r_proto srand48_r $hdrs
17091                 eval $hasproto ;;
17092         *)      ;;
17093         esac
17094         case "$d_srand48_r_proto" in
17095         define)
17096         case "$srand48_r_proto" in
17097         ''|0) try='int srand48_r(long, struct drand48_data*);'
17098         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17099         esac
17100         case "$srand48_r_proto" in
17101         ''|0)   d_srand48_r=undef
17102                 srand48_r_proto=0
17103                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17104         * )     case "$srand48_r_proto" in
17105                 REENTRANT_PROTO*) ;;
17106                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17107                 esac
17108                 echo "Prototype: $try" ;;
17109         esac
17110         ;;
17111         *)      case "$usethreads" in
17112                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17113                 esac
17114                 d_srand48_r=undef
17115                 srand48_r_proto=0
17116                 ;;
17117         esac
17118         ;;
17119 *)      srand48_r_proto=0
17120         ;;
17121 esac
17122
17123 : see if srandom_r exists
17124 set srandom_r d_srandom_r
17125 eval $inlibc
17126 case "$d_srandom_r" in
17127 "$define")
17128         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17129         case "$d_srandom_r_proto:$usethreads" in
17130         ":define")      d_srandom_r_proto=define
17131                 set d_srandom_r_proto srandom_r $hdrs
17132                 eval $hasproto ;;
17133         *)      ;;
17134         esac
17135         case "$d_srandom_r_proto" in
17136         define)
17137         case "$srandom_r_proto" in
17138         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17139         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17140         esac
17141         case "$srandom_r_proto" in
17142         ''|0)   d_srandom_r=undef
17143                 srandom_r_proto=0
17144                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17145         * )     case "$srandom_r_proto" in
17146                 REENTRANT_PROTO*) ;;
17147                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17148                 esac
17149                 echo "Prototype: $try" ;;
17150         esac
17151         ;;
17152         *)      case "$usethreads" in
17153                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17154                 esac
17155                 d_srandom_r=undef
17156                 srandom_r_proto=0
17157                 ;;
17158         esac
17159         ;;
17160 *)      srandom_r_proto=0
17161         ;;
17162 esac
17163
17164 : see if prototype for setresgid is available
17165 echo " "
17166 set d_sresgproto setresgid $i_unistd unistd.h
17167 eval $hasproto
17168
17169 : see if prototype for setresuid is available
17170 echo " "
17171 set d_sresuproto setresuid $i_unistd unistd.h
17172 eval $hasproto
17173
17174 : see if sys/stat.h is available
17175 set sys/stat.h i_sysstat
17176 eval $inhdr
17177
17178
17179 : see if stat knows about block sizes
17180 echo " "
17181 echo "Checking to see if your struct stat has st_blocks field..." >&4
17182 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17183 eval $hasfield
17184
17185
17186 : see if this is a sys/vfs.h system
17187 set sys/vfs.h i_sysvfs
17188 eval $inhdr
17189
17190
17191 : see if this is a sys/statfs.h system
17192 set sys/statfs.h i_sysstatfs
17193 eval $inhdr
17194
17195
17196 echo " "
17197 echo "Checking to see if your system supports struct statfs..." >&4
17198 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
17199 eval $hasstruct
17200 case "$d_statfs_s" in
17201 "$define")      echo "Yes, it does."   ;;
17202 *)              echo "No, it doesn't." ;;
17203 esac
17204
17205
17206
17207 : see if struct statfs knows about f_flags
17208 case "$d_statfs_s" in
17209 define) 
17210         echo " "
17211         echo "Checking to see if your struct statfs has f_flags field..." >&4
17212         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
17213         eval $hasfield
17214         ;;
17215 *)      val="$undef"
17216         set d_statfs_f_flags
17217         eval $setvar
17218         ;;
17219 esac
17220 case "$d_statfs_f_flags" in
17221 "$define")      echo "Yes, it does."   ;;
17222 *)              echo "No, it doesn't." ;;
17223 esac
17224
17225 $cat >&4 <<EOM
17226 Checking how to access stdio streams by file descriptor number...
17227 EOM
17228 case "$stdio_stream_array" in
17229 '')     $cat >try.c <<EOCP
17230 #include <stdio.h>
17231 int main() {
17232   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17233     printf("yes\n");
17234 }
17235 EOCP
17236         for s in _iob __iob __sF
17237         do
17238                 set try -DSTDIO_STREAM_ARRAY=$s
17239                 if eval $compile; then
17240                         case "`$run ./try`" in
17241                         yes)    stdio_stream_array=$s; break ;;
17242                         esac
17243                 fi
17244         done
17245         $rm -f try.* try$exe_ext
17246 esac
17247 case "$stdio_stream_array" in
17248 '')     $cat >&4 <<EOM
17249 I can't figure out how to access stdio streams by file descriptor number.
17250 EOM
17251         d_stdio_stream_array="$undef"
17252         ;;
17253 *)      $cat >&4 <<EOM
17254 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17255 EOM
17256         d_stdio_stream_array="$define"
17257         ;;
17258 esac
17259
17260 : see if strcoll exists
17261 set strcoll d_strcoll
17262 eval $inlibc
17263
17264 : check for structure copying
17265 echo " "
17266 echo "Checking to see if your C compiler can copy structs..." >&4
17267 $cat >try.c <<'EOCP'
17268 int main()
17269 {
17270         struct blurfl {
17271                 int dyick;
17272         } foo, bar;
17273
17274         foo = bar;
17275 }
17276 EOCP
17277 if $cc -c try.c >/dev/null 2>&1 ; then
17278         val="$define"
17279         echo "Yup, it can."
17280 else
17281         val="$undef"
17282         echo "Nope, it can't."
17283 fi
17284 set d_strctcpy
17285 eval $setvar
17286 $rm -f try.*
17287
17288 : see if strerror and/or sys_errlist[] exist
17289 echo " "
17290 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17291     if set strerror val -f d_strerror; eval $csym; $val; then
17292                 echo 'strerror() found.' >&4
17293                 d_strerror="$define"
17294                 d_strerrm='strerror(e)'
17295                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17296                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17297                         d_syserrlst="$define"
17298                 else
17299                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17300                         d_syserrlst="$undef"
17301                 fi
17302     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17303                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17304                 echo 'strerror() found in string header.' >&4
17305                 d_strerror="$define"
17306                 d_strerrm='strerror(e)'
17307                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17308                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17309                                 d_syserrlst="$define"
17310                 else
17311                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17312                         d_syserrlst="$undef"
17313                 fi
17314     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17315                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17316                 d_strerror="$undef"
17317                 d_syserrlst="$define"
17318                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17319     else
17320                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17321                 d_strerror="$undef"
17322                 d_syserrlst="$undef"
17323                 d_strerrm='"unknown"'
17324     fi
17325 fi
17326
17327 : see if strerror_r exists
17328 set strerror_r d_strerror_r
17329 eval $inlibc
17330 case "$d_strerror_r" in
17331 "$define")
17332         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17333         case "$d_strerror_r_proto:$usethreads" in
17334         ":define")      d_strerror_r_proto=define
17335                 set d_strerror_r_proto strerror_r $hdrs
17336                 eval $hasproto ;;
17337         *)      ;;
17338         esac
17339         case "$d_strerror_r_proto" in
17340         define)
17341         case "$strerror_r_proto" in
17342         ''|0) try='int strerror_r(int, char*, size_t);'
17343         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17344         esac
17345         case "$strerror_r_proto" in
17346         ''|0) try='int strerror_r(int, char*, int);'
17347         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17348         esac
17349         case "$strerror_r_proto" in
17350         ''|0) try='char* strerror_r(int, char*, size_t);'
17351         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17352         esac
17353         case "$strerror_r_proto" in
17354         ''|0)   d_strerror_r=undef
17355                 strerror_r_proto=0
17356                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17357         * )     case "$strerror_r_proto" in
17358                 REENTRANT_PROTO*) ;;
17359                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17360                 esac
17361                 echo "Prototype: $try" ;;
17362         esac
17363         ;;
17364         *)      case "$usethreads" in
17365                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17366                 esac
17367                 d_strerror_r=undef
17368                 strerror_r_proto=0
17369                 ;;
17370         esac
17371         ;;
17372 *)      strerror_r_proto=0
17373         ;;
17374 esac
17375
17376 : see if strftime exists
17377 set strftime d_strftime
17378 eval $inlibc
17379
17380 : see if strlcat exists
17381 set strlcat d_strlcat
17382 eval $inlibc
17383
17384 : see if strlcpy exists
17385 set strlcpy d_strlcpy
17386 eval $inlibc
17387
17388 : see if strtod exists
17389 set strtod d_strtod
17390 eval $inlibc
17391
17392 : see if strtol exists
17393 set strtol d_strtol
17394 eval $inlibc
17395
17396 : see if strtold exists
17397 set strtold d_strtold
17398 eval $inlibc
17399
17400 : see if strtoll exists
17401 set strtoll d_strtoll
17402 eval $inlibc
17403
17404 case "$d_longlong-$d_strtoll" in
17405 "$define-$define")
17406         $cat <<EOM
17407 Checking whether your strtoll() works okay...
17408 EOM
17409         $cat >try.c <<'EOCP'
17410 #include <errno.h>
17411 #ifdef __hpux
17412 #define strtoll __strtoll
17413 #endif
17414 #ifdef __EMX__
17415 #define strtoll _strtoll
17416 #endif
17417 #include <stdio.h>
17418 extern long long int strtoll(char *s, char **, int); 
17419 static int bad = 0;
17420 int check(char *s, long long ell, int een) {
17421         long long gll;
17422         errno = 0;
17423         gll = strtoll(s, 0, 10);
17424         if (!((gll == ell) && (errno == een)))
17425                 bad++;
17426 }
17427 int main() {
17428         check(" 1",                                      1LL, 0);
17429         check(" 0",                                      0LL, 0);
17430         check("-1",                                     -1LL, 0);
17431         check("-9223372036854775808", -9223372036854775808LL, 0);
17432         check("-9223372036854775808", -9223372036854775808LL, 0);
17433         check(" 9223372036854775807",  9223372036854775807LL, 0);
17434         check("-9223372036854775808", -9223372036854775808LL, 0);
17435         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17436         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17437         if (!bad)
17438                 printf("ok\n");
17439 }
17440 EOCP
17441         set try
17442         if eval $compile; then
17443                 yyy=`$run ./try`
17444                 case "$yyy" in
17445                 ok) echo "Your strtoll() seems to be working okay." ;;
17446                 *) cat <<EOM >&4
17447 Your strtoll() doesn't seem to be working okay.
17448 EOM
17449                    d_strtoll="$undef"
17450                    ;;
17451                 esac
17452         else
17453                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17454                 d_strtoll="$undef"
17455         fi
17456         ;;
17457 esac
17458
17459 : see if strtoq exists
17460 set strtoq d_strtoq
17461 eval $inlibc
17462
17463 : see if strtoul exists
17464 set strtoul d_strtoul
17465 eval $inlibc
17466
17467 case "$d_strtoul" in
17468 "$define")
17469         $cat <<EOM
17470 Checking whether your strtoul() works okay...
17471 EOM
17472         $cat >try.c <<'EOCP'
17473 #include <errno.h>
17474 #include <stdio.h>
17475 extern unsigned long int strtoul(char *s, char **, int); 
17476 static int bad = 0;
17477 void check(char *s, unsigned long eul, int een) {
17478         unsigned long gul;
17479         errno = 0;
17480         gul = strtoul(s, 0, 10);
17481         if (!((gul == eul) && (errno == een)))
17482                 bad++;
17483 }
17484 int main() {
17485         check(" 1", 1L, 0);
17486         check(" 0", 0L, 0);
17487 EOCP
17488         case "$longsize" in
17489         8)
17490             $cat >>try.c <<'EOCP'
17491         check("18446744073709551615", 18446744073709551615UL, 0);
17492         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17493 #if 0 /* strtoul() for /^-/ strings is undefined. */
17494         check("-1", 18446744073709551615UL, 0);
17495         check("-18446744073709551614", 2, 0);
17496         check("-18446744073709551615", 1, 0);
17497         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17498         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17499 #endif
17500 EOCP
17501                 ;;
17502         4)
17503                     $cat >>try.c <<'EOCP'
17504         check("4294967295", 4294967295UL, 0);
17505         check("4294967296", 4294967295UL, ERANGE);
17506 #if 0 /* strtoul() for /^-/ strings is undefined. */
17507         check("-1", 4294967295UL, 0);
17508         check("-4294967294", 2, 0);
17509         check("-4294967295", 1, 0);
17510         check("-4294967296", 4294967295UL, ERANGE);
17511         check("-4294967297", 4294967295UL, ERANGE);
17512 #endif
17513 EOCP
17514                 ;;
17515         *)
17516 : Should we write these tests to be more portable by sprintf-ing
17517 : ~0 and then manipulating that char string as input for strtol?
17518                 ;;
17519         esac
17520         $cat >>try.c <<'EOCP'
17521         if (!bad)
17522                 printf("ok\n");
17523         return 0;
17524 }
17525 EOCP
17526         set try
17527         if eval $compile; then
17528                 case "`$run ./try`" in
17529                 ok) echo "Your strtoul() seems to be working okay." ;;
17530                 *) cat <<EOM >&4
17531 Your strtoul() doesn't seem to be working okay.
17532 EOM
17533                    d_strtoul="$undef"
17534                    ;;
17535                 esac
17536         fi
17537         ;;
17538 esac
17539
17540 : see if strtoull exists
17541 set strtoull d_strtoull
17542 eval $inlibc
17543
17544 case "$d_longlong-$d_strtoull" in
17545 "$define-$define")
17546         $cat <<EOM
17547 Checking whether your strtoull() works okay...
17548 EOM
17549         $cat >try.c <<'EOCP'
17550 #include <errno.h>
17551 #ifdef __hpux
17552 #define strtoull __strtoull
17553 #endif
17554 #include <stdio.h>
17555 extern unsigned long long int strtoull(char *s, char **, int); 
17556 static int bad = 0;
17557 int check(char *s, long long eull, int een) {
17558         long long gull;
17559         errno = 0;
17560         gull = strtoull(s, 0, 10);
17561         if (!((gull == eull) && (errno == een)))
17562                 bad++;
17563 }
17564 int main() {
17565         check(" 1",                                        1LL, 0);
17566         check(" 0",                                        0LL, 0);
17567         check("18446744073709551615",  18446744073709551615ULL, 0);
17568         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17569 #if 0 /* strtoull() for /^-/ strings is undefined. */
17570         check("-1",                    18446744073709551615ULL, 0);
17571         check("-18446744073709551614",                     2LL, 0);
17572         check("-18446744073709551615",                     1LL, 0);
17573         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17574         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17575 #endif
17576         if (!bad)
17577                 printf("ok\n");
17578 }
17579 EOCP
17580         set try
17581         if eval $compile; then
17582                 case "`$run ./try`" in
17583                 ok) echo "Your strtoull() seems to be working okay." ;;
17584                 *) cat <<EOM >&4
17585 Your strtoull() doesn't seem to be working okay.
17586 EOM
17587                    d_strtoull="$undef"
17588                    ;;
17589                 esac
17590         fi
17591         ;;
17592 esac
17593
17594 : see if strtouq exists
17595 set strtouq d_strtouq
17596 eval $inlibc
17597
17598 case "$d_strtouq" in
17599 "$define")
17600         $cat <<EOM
17601 Checking whether your strtouq() works okay...
17602 EOM
17603         $cat >try.c <<'EOCP'
17604 #include <errno.h>
17605 #include <stdio.h>
17606 extern unsigned long long int strtouq(char *s, char **, int); 
17607 static int bad = 0;
17608 void check(char *s, unsigned long long eull, int een) {
17609         unsigned long long gull;
17610         errno = 0;
17611         gull = strtouq(s, 0, 10);
17612         if (!((gull == eull) && (errno == een)))
17613                 bad++;
17614 }
17615 int main() {
17616         check(" 1",                                        1LL, 0);
17617         check(" 0",                                        0LL, 0);
17618         check("18446744073709551615",  18446744073709551615ULL, 0);
17619         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17620 #if 0 /* strtouq() for /^-/ strings is undefined. */
17621         check("-1",                    18446744073709551615ULL, 0);
17622         check("-18446744073709551614",                     2LL, 0);
17623         check("-18446744073709551615",                     1LL, 0);
17624         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17625         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17626 #endif
17627         if (!bad)
17628                 printf("ok\n");
17629         return 0;
17630 }
17631 EOCP
17632         set try
17633         if eval $compile; then
17634                 case "`$run ./try`" in
17635                 ok) echo "Your strtouq() seems to be working okay." ;;
17636                 *) cat <<EOM >&4
17637 Your strtouq() doesn't seem to be working okay.
17638 EOM
17639                    d_strtouq="$undef"
17640                    ;;
17641                 esac
17642         fi
17643         ;;
17644 esac
17645
17646 : see if strxfrm exists
17647 set strxfrm d_strxfrm
17648 eval $inlibc
17649
17650 : see if symlink exists
17651 set symlink d_symlink
17652 eval $inlibc
17653
17654 : see if syscall exists
17655 set syscall d_syscall
17656 eval $inlibc
17657
17658 : see if prototype for syscall is available
17659 echo " "
17660 set d_syscallproto syscall $i_unistd unistd.h
17661 eval $hasproto
17662
17663 : see if sysconf exists
17664 set sysconf d_sysconf
17665 eval $inlibc
17666
17667 : see if system exists
17668 set system d_system
17669 eval $inlibc
17670
17671 : see if tcgetpgrp exists
17672 set tcgetpgrp d_tcgetpgrp
17673 eval $inlibc
17674
17675 : see if tcsetpgrp exists
17676 set tcsetpgrp d_tcsetpgrp
17677 eval $inlibc
17678
17679 : see if prototype for telldir is available
17680 echo " "
17681 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17682 eval $hasproto
17683
17684 : see if time exists
17685 echo " "
17686 if test "X$d_time" = X -o X"$timetype" = X; then
17687     if set time val -f d_time; eval $csym; $val; then
17688                 echo 'time() found.' >&4
17689                 val="$define"
17690                 rp="What is the type returned by time() on this system?"
17691                 set time_t timetype long stdio.h sys/types.h
17692                 eval $typedef_ask
17693     else
17694                 echo 'time() not found, hope that will do.' >&4
17695                 val="$undef"
17696                 timetype='int';
17697     fi
17698     set d_time
17699     eval $setvar
17700 fi
17701
17702 : see if this is a sys/times.h system
17703 set sys/times.h i_systimes
17704 eval $inhdr
17705
17706 : see if times exists
17707 echo " "
17708 if set times val -f d_times; eval $csym; $val; then
17709         echo 'times() found.' >&4
17710         d_times="$define"
17711         inc=''
17712         case "$i_systimes" in
17713         "$define") inc='sys/times.h';;
17714         esac
17715         rp="What is the type returned by times() on this system?"
17716         set clock_t clocktype long stdio.h sys/types.h $inc
17717         eval $typedef_ask
17718 else
17719         echo 'times() NOT found, hope that will do.' >&4
17720         d_times="$undef"
17721         clocktype='int'
17722 fi
17723
17724 : see if tmpnam_r exists
17725 set tmpnam_r d_tmpnam_r
17726 eval $inlibc
17727 case "$d_tmpnam_r" in
17728 "$define")
17729         hdrs="$i_systypes sys/types.h define stdio.h "
17730         case "$d_tmpnam_r_proto:$usethreads" in
17731         ":define")      d_tmpnam_r_proto=define
17732                 set d_tmpnam_r_proto tmpnam_r $hdrs
17733                 eval $hasproto ;;
17734         *)      ;;
17735         esac
17736         case "$d_tmpnam_r_proto" in
17737         define)
17738         case "$tmpnam_r_proto" in
17739         ''|0) try='char* tmpnam_r(char*);'
17740         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17741         esac
17742         case "$tmpnam_r_proto" in
17743         ''|0)   d_tmpnam_r=undef
17744                 tmpnam_r_proto=0
17745                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17746         * )     case "$tmpnam_r_proto" in
17747                 REENTRANT_PROTO*) ;;
17748                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17749                 esac
17750                 echo "Prototype: $try" ;;
17751         esac
17752         ;;
17753         *)      case "$usethreads" in
17754                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17755                 esac
17756                 d_tmpnam_r=undef
17757                 tmpnam_r_proto=0
17758                 ;;
17759         esac
17760         ;;
17761 *)      tmpnam_r_proto=0
17762         ;;
17763 esac
17764
17765 : see if truncate exists
17766 set truncate d_truncate
17767 eval $inlibc
17768
17769 : see if ttyname_r exists
17770 set ttyname_r d_ttyname_r
17771 eval $inlibc
17772 case "$d_ttyname_r" in
17773 "$define")
17774         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17775         case "$d_ttyname_r_proto:$usethreads" in
17776         ":define")      d_ttyname_r_proto=define
17777                 set d_ttyname_r_proto ttyname_r $hdrs
17778                 eval $hasproto ;;
17779         *)      ;;
17780         esac
17781         case "$d_ttyname_r_proto" in
17782         define)
17783         case "$ttyname_r_proto" in
17784         ''|0) try='int ttyname_r(int, char*, size_t);'
17785         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17786         esac
17787         case "$ttyname_r_proto" in
17788         ''|0) try='int ttyname_r(int, char*, int);'
17789         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17790         esac
17791         case "$ttyname_r_proto" in
17792         ''|0) try='char* ttyname_r(int, char*, int);'
17793         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17794         esac
17795         case "$ttyname_r_proto" in
17796         ''|0)   d_ttyname_r=undef
17797                 ttyname_r_proto=0
17798                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17799         * )     case "$ttyname_r_proto" in
17800                 REENTRANT_PROTO*) ;;
17801                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17802                 esac
17803                 echo "Prototype: $try" ;;
17804         esac
17805         ;;
17806         *)      case "$usethreads" in
17807                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17808                 esac
17809                 d_ttyname_r=undef
17810                 ttyname_r_proto=0
17811                 ;;
17812         esac
17813         ;;
17814 *)      ttyname_r_proto=0
17815         ;;
17816 esac
17817
17818 : see if tzname[] exists
17819 echo " "
17820 if set tzname val -a d_tzname; eval $csym; $val; then
17821         val="$define"
17822         echo 'tzname[] found.' >&4
17823 else
17824         val="$undef"
17825         echo 'tzname[] NOT found.' >&4
17826 fi
17827 set d_tzname
17828 eval $setvar
17829
17830 case "$osname" in
17831 next|rhapsody|darwin) multiarch="$define" ;;
17832 esac
17833 case "$multiarch" in
17834 ''|[nN]*) multiarch="$undef" ;;
17835 esac
17836
17837 : check for ordering of bytes in a UV
17838 echo " "
17839 case "$usecrosscompile$multiarch" in
17840 *$define*)
17841         $cat <<EOM
17842 You seem to be either cross-compiling or doing a multiarchitecture build,
17843 skipping the byteorder check.
17844
17845 EOM
17846         byteorder='ffff'
17847         ;;
17848 *)
17849         case "$byteorder" in
17850         '')
17851                 $cat <<'EOM'
17852 In the following, larger digits indicate more significance.  A big-endian
17853 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17854 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17855 machines may have weird orders like 3412.  A Cray will report 87654321,
17856 an Alpha will report 12345678. If the test program works the default is
17857 probably right.
17858 I'm now running the test program...
17859 EOM
17860                 $cat >try.c <<EOCP
17861 #include <stdio.h>
17862 #$i_stdlib I_STDLIB
17863 #ifdef I_STDLIB
17864 #include <stdlib.h>
17865 #endif
17866 #include <sys/types.h>
17867 typedef $uvtype UV;
17868 int main()
17869 {
17870         int i;
17871         union {
17872                 UV l;
17873                 char c[$uvsize];
17874         } u;
17875
17876         if ($uvsize > 4)
17877                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17878         else
17879                 u.l = (UV)0x04030201;
17880         for (i = 0; i < $uvsize; i++)
17881                 printf("%c", u.c[i]+'0');
17882         printf("\n");
17883         exit(0);
17884 }
17885 EOCP
17886                 xxx_prompt=y
17887                 set try
17888                 if eval $compile && ./try > /dev/null; then
17889                         dflt=`$run ./try`
17890                         case "$dflt" in
17891                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17892                                 echo "(The test program ran ok.)"
17893                                 echo "byteorder=$dflt"
17894                                 xxx_prompt=n
17895                         ;;
17896                         ????|????????) echo "(The test program ran ok.)" ;;
17897                         *) echo "(The test program didn't run right for some reason.)" ;;
17898                         esac
17899                 else
17900                         dflt='4321'
17901                         cat <<'EOM'
17902 (I can't seem to compile the test program.  Guessing big-endian...)
17903 EOM
17904                 fi
17905                 case "$xxx_prompt" in
17906                 y)
17907                         rp="What is the order of bytes in $uvtype?"
17908                         . ./myread
17909                         byteorder="$ans"
17910                         ;;
17911                 *)      byteorder=$dflt
17912                         ;;
17913                 esac
17914                 ;;
17915         esac
17916         $rm -f try.c try
17917         ;;
17918 esac
17919
17920
17921 $cat <<EOM
17922
17923 Checking to see whether you can access character data unalignedly...
17924 EOM
17925 case "$d_u32align" in
17926 '')   $cat >try.c <<EOCP
17927 #include <stdio.h>
17928 #$i_stdlib I_STDLIB
17929 #ifdef I_STDLIB
17930 #include <stdlib.h>
17931 #endif
17932 #define U32 $u32type
17933 #define BYTEORDER 0x$byteorder
17934 #define U8 $u8type
17935 #include <signal.h>
17936 #ifdef SIGBUS
17937 $signal_t bletch(int s) { exit(4); }
17938 #endif
17939 int main() {
17940 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17941     U8 buf[8];
17942     U32 *up;
17943     int i;
17944
17945     if (sizeof(U32) != 4) {
17946         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17947         exit(1);
17948     }
17949
17950     fflush(stdout);
17951
17952 #ifdef SIGBUS
17953     signal(SIGBUS, bletch);
17954 #endif
17955
17956     buf[0] = 0;
17957     buf[1] = 0;
17958     buf[2] = 0;
17959     buf[3] = 1;
17960     buf[4] = 0;
17961     buf[5] = 0;
17962     buf[6] = 0;
17963     buf[7] = 1;
17964
17965     for (i = 0; i < 4; i++) {
17966         up = (U32*)(buf + i);
17967         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17968                (*up == 1 << (8*(3-i)))  /* little-endian */
17969               )
17970            )
17971         {
17972             printf("read failed (%x)\n", *up);
17973             exit(2);
17974         }
17975     }
17976
17977     /* write test */
17978     for (i = 0; i < 4; i++) {
17979         up = (U32*)(buf + i);
17980         *up = 0xBeef;
17981         if (*up != 0xBeef) {
17982             printf("write failed (%x)\n", *up);
17983             exit(3);
17984         }
17985     }
17986
17987     exit(0);
17988 #else
17989     printf("1\n");
17990     exit(1);
17991 #endif
17992     return 0;
17993 }
17994 EOCP
17995 set try
17996 if eval $compile_ok; then
17997         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17998         $run ./try 2>&1 >/dev/null
17999         case "$?" in
18000         0)      cat >&4 <<EOM
18001 You can access character data pretty unalignedly.
18002 EOM
18003                 d_u32align="$undef"
18004                 ;;
18005         *)      cat >&4 <<EOM
18006 It seems that you must access character data in an aligned manner.
18007 EOM
18008                 d_u32align="$define"
18009                 ;;
18010         esac
18011 else
18012         rp='Can you access character data at unaligned addresses?'
18013         dflt='n'
18014         . ./myread
18015         case "$ans" in
18016         [yY]*)  d_u32align="$undef"  ;;
18017         *)      d_u32align="$define" ;;
18018         esac
18019 fi
18020 $rm -f core core.try.* try.core
18021 ;;
18022 esac
18023
18024 : see if ualarm exists
18025 set ualarm d_ualarm
18026 eval $inlibc
18027
18028 : see if umask exists
18029 set umask d_umask
18030 eval $inlibc
18031
18032 : see if unordered exists
18033 set unordered d_unordered
18034 eval $inlibc
18035
18036 : see if unsetenv exists
18037 set unsetenv d_unsetenv
18038 eval $inlibc
18039
18040 : see if usleep exists
18041 set usleep d_usleep
18042 eval $inlibc
18043
18044 : see if prototype for usleep is available
18045 echo " "
18046 set d_usleepproto usleep $i_unistd unistd.h
18047 eval $hasproto
18048
18049 : see if ustat exists
18050 set ustat d_ustat
18051 eval $inlibc
18052
18053 : backward compatibility for d_hvfork
18054 if test X$d_hvfork != X; then
18055         d_vfork="$d_hvfork"
18056         d_hvfork=''
18057 fi
18058 : see if there is a vfork
18059 val=''
18060 set vfork val
18061 eval $inlibc
18062
18063 : Ok, but do we want to use it. vfork is reportedly unreliable in 
18064 : perl on Solaris 2.x, and probably elsewhere.
18065 case "$val" in
18066 $define)
18067         echo " "
18068         case "$usevfork" in
18069         false) dflt='n';;
18070         *) dflt='y';;
18071         esac
18072         cat <<'EOM'
18073  
18074 Perl can only use a vfork() that doesn't suffer from strict
18075 restrictions on calling functions or modifying global data in
18076 the child.  For example, glibc-2.1 contains such a vfork()
18077 that is unsuitable.  If your system provides a proper fork()
18078 call, chances are that you do NOT want perl to use vfork().
18079
18080 EOM
18081         rp="Do you still want to use vfork()?"
18082         . ./myread
18083         case "$ans" in
18084         y|Y) ;;
18085         *)
18086                 echo "Ok, we won't use vfork()."
18087                 val="$undef"
18088                 ;;
18089         esac
18090         ;;
18091 esac
18092 set d_vfork
18093 eval $setvar
18094 case "$d_vfork" in
18095 $define) usevfork='true';;
18096 *) usevfork='false';;
18097 esac
18098
18099 : see if closedir exists
18100 set closedir d_closedir
18101 eval $inlibc
18102
18103 case "$d_closedir" in
18104 "$define")
18105         echo " "
18106         echo "Checking whether closedir() returns a status..." >&4
18107         cat > try.c <<EOM
18108 #$i_dirent I_DIRENT             /**/
18109 #$i_sysdir I_SYS_DIR            /**/
18110 #$i_sysndir I_SYS_NDIR          /**/
18111 #$i_systypes I_SYS_TYPES        /**/
18112
18113 #if defined(I_SYS_TYPES)
18114 #include <sys/types.h>
18115 #endif
18116 #if defined(I_DIRENT)
18117 #include <dirent.h>
18118 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18119 #include <sys/dir.h>
18120 #endif
18121 #else
18122 #ifdef I_SYS_NDIR
18123 #include <sys/ndir.h>
18124 #else
18125 #ifdef I_SYS_DIR
18126 #ifdef hp9000s500
18127 #include <ndir.h>       /* may be wrong in the future */
18128 #else
18129 #include <sys/dir.h>
18130 #endif
18131 #endif
18132 #endif
18133 #endif 
18134 int main() { return closedir(opendir(".")); }
18135 EOM
18136         set try
18137         if eval $compile_ok; then
18138                 if $run ./try > /dev/null 2>&1 ; then
18139                         echo "Yes, it does."
18140                         val="$undef"
18141                 else
18142                         echo "No, it doesn't."
18143                         val="$define"
18144                 fi
18145         else
18146                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18147                 val="$define"
18148         fi
18149         ;;
18150 *)
18151         val="$undef";
18152         ;;
18153 esac
18154 set d_void_closedir
18155 eval $setvar
18156 $rm -f try try.*
18157 : see if there is a wait4
18158 set wait4 d_wait4
18159 eval $inlibc
18160
18161 : see if waitpid exists
18162 set waitpid d_waitpid
18163 eval $inlibc
18164
18165 : see if wcstombs exists
18166 set wcstombs d_wcstombs
18167 eval $inlibc
18168
18169 : see if wctomb exists
18170 set wctomb d_wctomb
18171 eval $inlibc
18172
18173 : see if writev exists
18174 set writev d_writev
18175 eval $inlibc
18176
18177 : preserve RCS keywords in files with variable substitution, grrr
18178 Date='$Date'
18179 Id='$Id'
18180 Log='$Log'
18181 RCSfile='$RCSfile'
18182 Revision='$Revision'
18183
18184 : check for alignment requirements
18185 echo " "
18186 case "$usecrosscompile$multiarch" in
18187 *$define*)
18188         $cat <<EOM
18189 You seem to be either cross-compiling or doing a multiarchitecture build,
18190 skipping the memory alignment check.
18191
18192 EOM
18193         case "$alignbytes" in
18194         '') alignbytes=8 ;;
18195         esac
18196         ;;
18197 *)
18198         case "$alignbytes" in
18199         '') echo "Checking alignment constraints..." >&4
18200                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18201                         $cat >try.c <<'EOCP'
18202 typedef long double NV;
18203 EOCP
18204                 else
18205                         $cat >try.c <<'EOCP'
18206 typedef double NV;
18207 EOCP
18208                 fi
18209                 $cat >>try.c <<'EOCP'
18210 #include <stdio.h>
18211 struct foobar {
18212         char foo;
18213         NV bar;
18214 } try_algn;
18215 int main()
18216 {
18217     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18218     return(0);
18219 }
18220 EOCP
18221                 set try
18222                 if eval $compile_ok; then
18223                         dflt=`$run ./try`
18224                 else
18225                         dflt='8'
18226                         echo "(I can't seem to compile the test program...)"
18227                 fi
18228                 ;;
18229         *) dflt="$alignbytes"
18230                 ;;
18231         esac
18232         rp="Doubles must be aligned on a how-many-byte boundary?"
18233         . ./myread
18234         alignbytes="$ans"
18235         $rm -f try.c try
18236         ;;
18237 esac
18238
18239
18240 : set the base revision
18241 baserev=5.0
18242
18243 : how do we concatenate cpp tokens here?
18244 echo " "
18245 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18246 $cat >cpp_stuff.c <<'EOCP'
18247 #define RCAT(a,b)a/**/b
18248 #define ACAT(a,b)a ## b
18249 RCAT(Rei,ser)
18250 ACAT(Cir,cus)
18251 EOCP
18252 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18253 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18254         echo "Oh!  Smells like ANSI's been here." >&4
18255         echo "We can catify or stringify, separately or together!"
18256         cpp_stuff=42
18257 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18258         echo "Ah, yes!  The good old days!" >&4
18259         echo "However, in the good old days we don't know how to stringify and"
18260         echo "catify at the same time."
18261         cpp_stuff=1
18262 else
18263         $cat >&4 <<EOM
18264 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18265 You're going to have to edit the values of CAT[2-5] in config.h...
18266 EOM
18267         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18268 fi
18269 $rm -f cpp_stuff.*
18270
18271 : see if this is a db.h system
18272 set db.h i_db
18273 eval $inhdr
18274
18275 case "$i_db" in
18276 $define)
18277         : Check db version.
18278         echo " "
18279         echo "Checking Berkeley DB version ..." >&4
18280         $cat >try.c <<EOCP
18281 #$d_const HASCONST
18282 #ifndef HASCONST
18283 #define const
18284 #endif
18285 #include <sys/types.h>
18286 #include <stdio.h>
18287 #$i_stdlib I_STDLIB
18288 #ifdef I_STDLIB
18289 #include <stdlib.h>
18290 #endif
18291 #include <db.h>
18292 int main(int argc, char *argv[])
18293 {
18294 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18295     int Major, Minor, Patch ;
18296     unsigned long Version ;
18297     (void)db_version(&Major, &Minor, &Patch) ;
18298     if (argc == 2) {
18299         printf("%d %d %d %d %d %d\n",
18300                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18301                Major, Minor, Patch);
18302         exit(0);
18303     }
18304     printf("You have Berkeley DB Version 2 or greater.\n");
18305
18306     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18307                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18308     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18309                 Major, Minor, Patch) ;
18310
18311     /* check that db.h & libdb are compatible */
18312     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18313         printf("db.h and libdb are incompatible.\n") ;
18314         exit(3);        
18315     }
18316
18317     printf("db.h and libdb are compatible.\n") ;
18318
18319     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18320                 + DB_VERSION_PATCH ;
18321
18322     /* needs to be >= 2.3.4 */
18323     if (Version < 2003004) {
18324     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18325         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18326         exit(2);        
18327     }
18328
18329     exit(0);
18330 #else
18331 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18332     if (argc == 2) {
18333         printf("1 0 0\n");
18334         exit(0);
18335     }
18336     printf("You have Berkeley DB Version 1.\n");
18337     exit(0);    /* DB version < 2: the coast is clear. */
18338 #else
18339     exit(1);    /* <db.h> not Berkeley DB? */
18340 #endif
18341 #endif
18342 }
18343 EOCP
18344         set try
18345         if eval $compile_ok && $run ./try; then
18346                 echo 'Looks OK.' >&4
18347                 set `$run ./try 1`
18348                 db_version_major=$1
18349                 db_version_minor=$2
18350                 db_version_patch=$3
18351         else
18352                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18353                 i_db=$undef
18354                 case " $libs " in
18355                 *"-ldb "*)
18356                         : Remove db from list of libraries to use
18357                         echo "Removing unusable -ldb from library list" >&4
18358                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18359                         shift
18360                         libs="$*"
18361                         echo "libs = $libs" >&4
18362                         ;;
18363                 esac
18364         fi
18365         $rm -f try.*
18366         ;;
18367 esac
18368
18369 case "$i_db" in
18370 define)
18371         : Check the return type needed for hash 
18372         echo " "
18373         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18374         $cat >try.c <<EOCP
18375 #$d_const HASCONST
18376 #ifndef HASCONST
18377 #define const
18378 #endif
18379 #include <sys/types.h>
18380 #include <db.h>
18381
18382 #ifndef DB_VERSION_MAJOR
18383 u_int32_t hash_cb (ptr, size)
18384 const void *ptr;
18385 size_t size;
18386 {
18387 }
18388 HASHINFO info;
18389 int main()
18390 {
18391         info.hash = hash_cb;
18392 }
18393 #endif
18394 EOCP
18395         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18396                 if $contains warning try.out >>/dev/null 2>&1 ; then
18397                         db_hashtype='int'
18398                 else
18399                         db_hashtype='u_int32_t'
18400                 fi
18401         else
18402                 : XXX Maybe we should just give up here.
18403                 db_hashtype=u_int32_t
18404                 $cat try.out >&4
18405                 echo "Help:  I can't seem to compile the db test program." >&4
18406                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18407         fi
18408         $rm -f try.*
18409         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18410         ;;
18411 *)      db_hashtype=u_int32_t
18412         ;;
18413 esac
18414 case "$i_db" in
18415 define)
18416         : Check the return type needed for prefix 
18417         echo " "
18418         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18419         cat >try.c <<EOCP
18420 #$d_const HASCONST
18421 #ifndef HASCONST
18422 #define const
18423 #endif
18424 #include <sys/types.h>
18425 #include <db.h>
18426
18427 #ifndef DB_VERSION_MAJOR
18428 size_t prefix_cb (key1, key2)
18429 const DBT *key1;
18430 const DBT *key2;
18431 {
18432 }
18433 BTREEINFO info;
18434 int main()
18435 {
18436         info.prefix = prefix_cb;
18437 }
18438 #endif
18439 EOCP
18440         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18441                 if $contains warning try.out >>/dev/null 2>&1 ; then
18442                         db_prefixtype='int'
18443                 else
18444                         db_prefixtype='size_t'
18445                 fi
18446         else
18447                 db_prefixtype='size_t'
18448                 : XXX Maybe we should just give up here.
18449                 $cat try.out >&4
18450                 echo "Help:  I can't seem to compile the db test program." >&4
18451                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18452         fi
18453         $rm -f try.*
18454         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18455         ;;
18456 *)      db_prefixtype='size_t'
18457         ;;
18458 esac
18459
18460
18461 : How can we generate normalized random numbers ?
18462 echo " "
18463 echo "Looking for a random number function..." >&4
18464 case "$randfunc" in
18465 '')
18466         if set drand48 val -f; eval $csym; $val; then
18467                 dflt="drand48"
18468                 echo "Good, found drand48()." >&4
18469         elif set random val -f; eval $csym; $val; then
18470                 dflt="random"
18471                 echo "OK, found random()." >&4
18472         else
18473                 dflt="rand"
18474                 echo "Yick, looks like I have to use rand()." >&4
18475         fi
18476         echo " "
18477         ;;
18478 *)
18479         dflt="$randfunc"
18480         ;;
18481 esac
18482 cont=true
18483
18484 case "$ccflags" in
18485 *-Dmy_rand=*|*-Dmy_srand=*)
18486         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18487         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18488         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18489         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18490         ;;
18491 esac
18492
18493 while $test "$cont"; do
18494         rp="Use which function to generate random numbers?"
18495         . ./myread
18496         if $test "$ans" = "$dflt"; then
18497                 : null
18498         else
18499                 randbits=''
18500         fi
18501         randfunc="$ans"
18502         if set $ans val -f; eval $csym; $val; then
18503                 cont=''
18504         else
18505                 dflt=y
18506                 rp="I cannot find function $ans. Use that name anyway?"
18507                 . ./myread
18508                 dflt=rand
18509                 case "$ans" in
18510                         [yY]*) cont='';;
18511                 esac
18512         fi
18513         case "$cont" in
18514         '')
18515                 case "$randfunc" in
18516                 drand48)
18517                         drand01="drand48()"
18518                         seedfunc="srand48"
18519                         randbits=48
18520                         randseedtype=long
18521                         ;;
18522                 rand|random)
18523                         case "$randbits" in
18524                         '')
18525 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18526                                 $cat >try.c <<EOCP
18527 #$i_unistd I_UNISTD
18528 #$i_stdlib I_STDLIB
18529 #include <stdio.h>
18530 #ifdef I_UNISTD
18531 #  include <unistd.h>
18532 #endif
18533 #ifdef I_STDLIB
18534 #  include <stdlib.h>
18535 #endif
18536 int main()
18537 {
18538         register int i;
18539         register unsigned long tmp;
18540         register unsigned long max = 0L;
18541
18542         for (i = 1000; i; i--) {
18543                 tmp = (unsigned long) $randfunc();
18544                 if (tmp > max) max = tmp;
18545         }
18546         for (i = 0; max; i++)
18547                 max /= 2;
18548         printf("%d\n",i);
18549 }
18550 EOCP
18551                                 set try
18552                                 if eval $compile_ok; then
18553                                         dflt=`try`
18554                                 else
18555                                         dflt='?'
18556                                         echo "(I can't seem to compile the test program...)"
18557                                 fi
18558                                 ;;
18559                         *)
18560                                 dflt="$randbits"
18561                                 ;;
18562                         esac
18563                         rp="How many bits does your $randfunc() function produce?"
18564                         . ./myread
18565                         randbits="$ans"
18566                         $rm -f try.c try
18567                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18568                         seedfunc="s$randfunc"
18569                         randseedtype=unsigned
18570                         ;;
18571                 *)
18572                         dflt="31"
18573                         rp="How many bits does your $randfunc() function produce?"
18574                         . ./myread
18575                         randbits="$ans"
18576                         seedfunc="s$randfunc"
18577                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18578                         if set $seedfunc val -f; eval $csym; $val; then
18579                                 echo "(Using $seedfunc() to seed random generator)"
18580                         else
18581                                 echo "(Warning: no $seedfunc() to seed random generator)"
18582                                 seedfunc=rand
18583                         fi
18584                         randseedtype=unsigned
18585                         ;;
18586                 esac
18587                 ;;
18588         esac
18589 done
18590
18591 echo " "
18592 echo "Determining whether or not we are on an EBCDIC system..." >&4
18593 $cat >try.c <<'EOM'
18594 int main()
18595 {
18596   if ('M'==0xd4) return 0;
18597   return 1;
18598 }
18599 EOM
18600
18601 val=$undef
18602 set try
18603 if eval $compile_ok; then
18604         if $run ./try; then
18605                 echo "You seem to speak EBCDIC." >&4
18606                 val="$define"
18607         else
18608                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18609         fi
18610 else
18611         echo "I'm unable to compile the test program." >&4
18612         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18613 fi
18614 $rm -f try try.*
18615 set ebcdic
18616 eval $setvar
18617
18618 echo " "
18619 $cat >&4 <<EOM
18620 Checking how to flush all pending stdio output...
18621 EOM
18622 # I only know how to find the first 32 possibly open files on SunOS.
18623 # See also hints/sunos_4_1.sh and util.c  --AD
18624 case "$osname" in
18625 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18626 esac
18627 $cat >>try.c <<EOCP
18628 #include <stdio.h>
18629 #$i_stdlib I_STDLIB
18630 #ifdef I_STDLIB
18631 #include <stdlib.h>
18632 #endif
18633 #$i_unistd I_UNISTD
18634 #ifdef I_UNISTD
18635 # include <unistd.h>
18636 #endif
18637 #$d_sysconf HAS_SYSCONF
18638 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18639 #ifdef HAS_STDIO_STREAM_ARRAY
18640 # define STDIO_STREAM_ARRAY $stdio_stream_array
18641 #endif
18642 int main() {
18643   FILE* p;
18644   unlink("try.out");
18645   p = fopen("try.out", "w");
18646 #ifdef TRY_FPUTC
18647   fputc('x', p);
18648 #else
18649 # ifdef TRY_FPRINTF
18650   fprintf(p, "x");
18651 # endif
18652 #endif
18653 #ifdef TRY_FFLUSH_NULL
18654   fflush(NULL);
18655 #endif
18656 #ifdef TRY_FFLUSH_ALL
18657   {
18658     long open_max = -1;
18659 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18660     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18661 # else
18662 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18663     open_max = sysconf(_SC_OPEN_MAX);
18664 #  else
18665 #   ifdef FOPEN_MAX
18666     open_max = FOPEN_MAX;
18667 #   else
18668 #    ifdef OPEN_MAX
18669     open_max = OPEN_MAX;
18670 #    else
18671 #     ifdef _NFILE
18672     open_max = _NFILE;
18673 #     endif
18674 #    endif
18675 #   endif
18676 #  endif
18677 # endif 
18678 # ifdef HAS_STDIO_STREAM_ARRAY
18679     if (open_max > 0) {
18680       long i;
18681       for (i = 0; i < open_max; i++)
18682             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18683                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18684                 STDIO_STREAM_ARRAY[i]._flag)
18685                 fflush(&STDIO_STREAM_ARRAY[i]);
18686     }   
18687   }
18688 # endif
18689 #endif
18690   _exit(42);
18691 }
18692 EOCP
18693 : first we have to find out how _not_ to flush
18694 $to try.c
18695 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18696     output=''
18697     set try -DTRY_FPUTC
18698     if eval $compile; then
18699             $run ./try 2>/dev/null
18700             code="$?"
18701             $from try.out
18702             if $test ! -s try.out -a "X$code" = X42; then
18703                 output=-DTRY_FPUTC
18704             fi
18705     fi
18706     case "$output" in
18707     '')
18708             set try -DTRY_FPRINTF
18709             if eval $compile; then
18710                     $run ./try 2>/dev/null
18711                     code="$?"
18712                     $from try.out
18713                     if $test ! -s try.out -a "X$code" = X42; then
18714                         output=-DTRY_FPRINTF
18715                     fi
18716             fi
18717         ;;
18718     esac
18719 fi
18720 : check for fflush NULL behaviour
18721 case "$fflushNULL" in
18722 '')     set try -DTRY_FFLUSH_NULL $output
18723         if eval $compile; then
18724                 $run ./try 2>/dev/null
18725                 code="$?"
18726                 $from try.out
18727                 if $test -s try.out -a "X$code" = X42; then
18728                         fflushNULL="`$cat try.out`"
18729                 else
18730                         if $test "X$code" != X42; then
18731                                 $cat >&4 <<EOM
18732 (If this test failed, don't worry, we'll try another method shortly.)
18733 EOM
18734                         fi
18735                 fi
18736         fi
18737         $rm -f core try.core core.try.*
18738         case "$fflushNULL" in
18739         x)      $cat >&4 <<EOM
18740 Your fflush(NULL) works okay for output streams.
18741 Let's see if it clobbers input pipes...
18742 EOM
18743 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18744 # bug that improperly flushes the input end of pipes.  So we avoid the
18745 # autoflush on fork/system/exec support for now. :-(
18746 $cat >tryp.c <<EOCP
18747 #include <stdio.h>
18748 int
18749 main(int argc, char **argv)
18750 {
18751     char buf[1024];
18752     int i;
18753     char *bp = buf;
18754     while (1) {
18755         while ((i = getc(stdin)) != -1
18756                && (*bp++ = i) != '\n'
18757                && bp < &buf[1024])
18758         /* DO NOTHING */ ;
18759         *bp = '\0';
18760         fprintf(stdout, "%s", buf);
18761         fflush(NULL);
18762         if (i == -1)
18763             return 0;
18764         bp = buf;
18765     }
18766 }
18767 EOCP
18768                 fflushNULL="$define"
18769                 set tryp
18770                 if eval $compile; then
18771                     $rm -f tryp.out
18772                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18773                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18774                        $cat >&4 <<EOM
18775 fflush(NULL) seems to behave okay with input streams.
18776 EOM
18777                         fflushNULL="$define"
18778                     else
18779                         $cat >&4 <<EOM
18780 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18781 EOM
18782                         fflushNULL="$undef"
18783                     fi
18784                 fi
18785                 $rm -f core tryp.c tryp.core core.tryp.*
18786                 ;;
18787         '')     $cat >&4 <<EOM
18788 Your fflush(NULL) isn't working (contrary to ANSI C).
18789 EOM
18790                 fflushNULL="$undef"
18791                 ;;
18792         *)      $cat >&4 <<EOM
18793 Cannot figure out whether your fflush(NULL) works or not.
18794 I'm assuming it doesn't (contrary to ANSI C).
18795 EOM
18796                 fflushNULL="$undef"
18797                 ;;
18798         esac
18799         ;;
18800 $define|true|[yY]*)
18801         fflushNULL="$define"
18802         ;;
18803 *)
18804         fflushNULL="$undef"
18805         ;;
18806 esac
18807 : check explicit looping only if NULL did not work, and if the pipe
18808 : bug does not show up on an explicit flush too
18809 case "$fflushNULL" in
18810 "$undef")
18811         $cat >tryp.c <<EOCP
18812 #include <stdio.h>
18813 int
18814 main(int argc, char **argv)
18815 {
18816     char buf[1024];
18817     int i;
18818     char *bp = buf;
18819     while (1) {
18820         while ((i = getc(stdin)) != -1
18821                && (*bp++ = i) != '\n'
18822                && bp < &buf[1024])
18823         /* DO NOTHING */ ;
18824         *bp = '\0';
18825         fprintf(stdout, "%s", buf);
18826         fflush(stdin);
18827         if (i == -1)
18828             return 0;
18829         bp = buf;
18830     }
18831 }
18832 EOCP
18833         set tryp
18834         if eval $compile; then
18835             $rm -f tryp.out
18836             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18837             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18838                $cat >&4 <<EOM
18839 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18840 EOM
18841                 : now check for fflushall behaviour
18842                 case "$fflushall" in
18843                 '')     set try -DTRY_FFLUSH_ALL $output
18844                         if eval $compile; then
18845                                 $cat >&4 <<EOM
18846 (Now testing the other method--but note that this also may fail.)
18847 EOM
18848                                 $run ./try 2>/dev/null
18849                                 code=$?
18850                                 $from try.out
18851                                 if $test -s try.out -a "X$code" = X42; then
18852                                         fflushall="`$cat try.out`"
18853                                 fi
18854                         fi
18855                         $rm -f core try.core core.try.*
18856                         case "$fflushall" in
18857                         x)      $cat >&4 <<EOM
18858 Whew. Flushing explicitly all the stdio streams works.
18859 EOM
18860                                 fflushall="$define"
18861                                 ;;
18862                         '')     $cat >&4 <<EOM
18863 Sigh. Flushing explicitly all the stdio streams doesn't work.
18864 EOM
18865                                 fflushall="$undef"
18866                                 ;;
18867                         *)      $cat >&4 <<EOM
18868 Cannot figure out whether flushing stdio streams explicitly works or not.
18869 I'm assuming it doesn't.
18870 EOM
18871                                 fflushall="$undef"
18872                                 ;;
18873                         esac
18874                         ;;
18875                 "$define"|true|[yY]*)
18876                         fflushall="$define"
18877                         ;;
18878                 *)
18879                         fflushall="$undef"
18880                         ;;
18881                 esac
18882             else
18883                 $cat >&4 <<EOM
18884 All is futile.  Even fflush(stdin) clobbers input pipes!
18885 EOM
18886                 fflushall="$undef"
18887             fi
18888         else
18889             fflushall="$undef"
18890         fi
18891         $rm -f core tryp.c tryp.core core.tryp.*
18892         ;;
18893 *)      fflushall="$undef"
18894         ;;
18895 esac
18896
18897 case "$fflushNULL$fflushall" in
18898 undefundef)
18899         $cat <<EOM
18900 OK, I give up.  I cannot figure out how to flush pending stdio output.
18901 We won't be flushing handles at all before fork/exec/popen.
18902 EOM
18903         ;;
18904 esac
18905 $rm -f try.* try$exe_ext
18906
18907 : Store the full pathname to the ar program for use in the C program
18908 : Respect a hint or command line value for full_ar.
18909 case "$full_ar" in
18910 '') full_ar=$ar ;;
18911 esac
18912
18913 : Store the full pathname to the sed program for use in the C program
18914 full_sed=$sed
18915
18916 : see what type gids are declared as in the kernel
18917 echo " "
18918 echo "Looking for the type for group ids returned by getgid()."
18919 set gid_t gidtype xxx stdio.h sys/types.h
18920 eval $typedef
18921 case "$gidtype" in
18922 xxx)
18923         xxx=`./findhdr sys/user.h`
18924         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18925         case $1 in
18926         unsigned) dflt="$1 $2" ;;
18927         *) dflt="$1" ;;
18928         esac
18929         ;;
18930 *) dflt="$gidtype";;
18931 esac
18932 case "$gidtype" in
18933 gid_t) echo "gid_t found." ;;
18934 *)      rp="What is the type for group ids returned by getgid()?"
18935         . ./myread
18936         gidtype="$ans"
18937         ;;
18938 esac
18939
18940 echo " "
18941 case "$gidtype" in
18942 *_t) zzz="$gidtype"     ;;
18943 *)   zzz="gid"          ;;
18944 esac
18945 echo "Checking the size of $zzz..." >&4 
18946 cat > try.c <<EOCP
18947 #include <sys/types.h>
18948 #include <stdio.h>
18949 #$i_stdlib I_STDLIB
18950 #ifdef I_STDLIB
18951 #include <stdlib.h>
18952 #endif
18953 int main() {
18954     printf("%d\n", (int)sizeof($gidtype));
18955     exit(0);
18956 }
18957 EOCP
18958 set try
18959 if eval $compile_ok; then
18960         yyy=`$run ./try`
18961         case "$yyy" in
18962         '')     gidsize=4
18963                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18964                 ;;
18965         *)      gidsize=$yyy
18966                 echo "Your $zzz is $gidsize bytes long."
18967                 ;;
18968         esac
18969 else
18970         gidsize=4
18971         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18972 fi
18973
18974
18975 echo " "
18976 case "$gidtype" in
18977 *_t) zzz="$gidtype"     ;;
18978 *)   zzz="gid"          ;;
18979 esac
18980 echo "Checking the sign of $zzz..." >&4 
18981 cat > try.c <<EOCP
18982 #include <sys/types.h>
18983 #include <stdio.h>
18984 int main() {
18985         $gidtype foo = -1;
18986         if (foo < 0)
18987                 printf("-1\n");
18988         else
18989                 printf("1\n");
18990 }
18991 EOCP
18992 set try
18993 if eval $compile; then
18994         yyy=`$run ./try`
18995         case "$yyy" in
18996         '')     gidsign=1
18997                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18998                 ;;
18999         *)      gidsign=$yyy
19000                 case "$gidsign" in
19001                  1) echo "Your $zzz is unsigned." ;;
19002                 -1) echo "Your $zzz is signed."   ;;
19003                 esac
19004                 ;;
19005         esac
19006 else
19007         gidsign=1
19008         echo "(I can't compile the test program--guessing unsigned.)" >&4
19009 fi
19010
19011
19012 echo " "
19013
19014 if $test X"$quadtype" != X; then
19015
19016 echo "Checking how to print 64-bit integers..." >&4
19017
19018 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19019         $cat >try.c <<'EOCP'
19020 #include <sys/types.h>
19021 #include <stdio.h>
19022 int main() {
19023   int q = 12345678901;
19024   printf("%ld\n", q);
19025 }
19026 EOCP
19027         set try
19028         if eval $compile; then
19029                 yyy=`$run ./try`
19030                 case "$yyy" in
19031                 12345678901)
19032                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19033                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19034                         echo "We will use %d."
19035                         ;;
19036                 esac
19037         fi
19038 fi
19039
19040 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19041         $cat >try.c <<'EOCP'
19042 #include <sys/types.h>
19043 #include <stdio.h>
19044 int main() {
19045   long q = 12345678901;
19046   printf("%ld\n", q);
19047 }
19048 EOCP
19049         set try
19050         if eval $compile; then
19051                 yyy=`$run ./try`
19052                 case "$yyy" in
19053                 12345678901)
19054                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19055                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19056                         echo "We will use %ld."
19057                         ;;
19058                 esac
19059         fi
19060 fi
19061
19062 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19063         $cat >try.c <<'EOCP'
19064 #include <sys/types.h>
19065 #include <inttypes.h>
19066 #include <stdio.h>
19067 int main() {
19068   int64_t q = 12345678901;
19069   printf("%" PRId64 "\n", q);
19070 }
19071 EOCP
19072         set try
19073         if eval $compile; then
19074                 yyy=`$run ./try`
19075                 case "$yyy" in
19076                 12345678901)
19077                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19078                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19079                         echo "We will use the C9X style."
19080                         ;;
19081                 esac
19082         fi
19083 fi
19084
19085 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19086         $cat >try.c <<EOCP
19087 #include <sys/types.h>
19088 #include <stdio.h>
19089 int main() {
19090   $quadtype q = 12345678901;
19091   printf("%Ld\n", q);
19092 }
19093 EOCP
19094         set try
19095         if eval $compile; then
19096                 yyy=`$run ./try`
19097                 case "$yyy" in
19098                 12345678901)
19099                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19100                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19101                         echo "We will use %Ld."
19102                         ;;
19103                 esac
19104         fi
19105 fi
19106
19107 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19108         $cat >try.c <<'EOCP'
19109 #include <sys/types.h>
19110 #include <stdio.h>
19111 int main() {
19112   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19113   printf("%lld\n", q);
19114 }
19115 EOCP
19116         set try
19117         if eval $compile; then
19118                 yyy=`$run ./try`
19119                 case "$yyy" in
19120                 12345678901)
19121                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19122                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19123                         echo "We will use the %lld style."
19124                         ;;
19125                 esac
19126         fi
19127 fi
19128
19129 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19130         $cat >try.c <<EOCP
19131 #include <sys/types.h>
19132 #include <stdio.h>
19133 int main() {
19134   $quadtype q = 12345678901;
19135   printf("%qd\n", q);
19136 }
19137 EOCP
19138         set try
19139         if eval $compile; then
19140                 yyy=`$run ./try`
19141                 case "$yyy" in
19142                 12345678901)
19143                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19144                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19145                         echo "We will use %qd."
19146                         ;;
19147                 esac
19148         fi
19149 fi
19150
19151 if $test X"$sPRId64" = X; then
19152         echo "Cannot figure out how to print 64-bit integers." >&4
19153 fi
19154
19155 $rm -f try try.*
19156
19157 fi
19158
19159 case "$sPRId64" in
19160 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19161         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19162         ;;
19163 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19164         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19165         ;;
19166 esac
19167
19168
19169 echo " "
19170 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19171
19172 if $test X"$ivsize" = X8; then
19173         ivdformat="$sPRId64"
19174         uvuformat="$sPRIu64"
19175         uvoformat="$sPRIo64"
19176         uvxformat="$sPRIx64"
19177         uvXUformat="$sPRIXU64"
19178 else
19179         if $test X"$ivsize" = X"$longsize"; then
19180                 ivdformat='"ld"'
19181                 uvuformat='"lu"'
19182                 uvoformat='"lo"'
19183                 uvxformat='"lx"'
19184                 uvXUformat='"lX"'
19185         else
19186                 if $test X"$ivsize" = X"$intsize"; then
19187                         ivdformat='"d"'
19188                         uvuformat='"u"'
19189                         uvoformat='"o"'
19190                         uvxformat='"x"'
19191                         uvXUformat='"X"'
19192                 else
19193                         : far out
19194                         if $test X"$ivsize" = X"$shortsize"; then
19195                                 ivdformat='"hd"'
19196                                 uvuformat='"hu"'
19197                                 uvoformat='"ho"'
19198                                 uvxformat='"hx"'
19199                                 uvXUformat='"hX"'
19200                         fi
19201                 fi
19202         fi
19203 fi
19204
19205 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19206         nveformat="$sPRIeldbl"
19207         nvfformat="$sPRIfldbl"
19208         nvgformat="$sPRIgldbl"
19209         nvEUformat="$sPRIEUldbl"
19210         nvFUformat="$sPRIFUldbl"
19211         nvGUformat="$sPRIGUldbl"
19212 else
19213         nveformat='"e"'
19214         nvfformat='"f"'
19215         nvgformat='"g"'
19216         nvEUformat='"E"'
19217         nvFUformat='"F"'
19218         nvGUformat='"G"'
19219 fi
19220
19221 case "$ivdformat" in
19222 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19223     exit 1
19224     ;;
19225 esac
19226
19227
19228 echo " "
19229 $echo "Checking the format string to be used for gids..." >&4
19230
19231 case "$gidsign" in
19232 -1)     if $test X"$gidsize" = X"$ivsize"; then
19233                 gidformat="$ivdformat"
19234         else
19235                 if $test X"$gidsize" = X"$longsize"; then
19236                         gidformat='"ld"'
19237                 else
19238                         if $test X"$gidsize" = X"$intsize"; then
19239                                 gidformat='"d"'
19240                         else
19241                                 if $test X"$gidsize" = X"$shortsize"; then
19242                                         gidformat='"hd"'
19243                                 fi
19244                         fi
19245                 fi
19246         fi
19247         ;;
19248 *)      if $test X"$gidsize" = X"$uvsize"; then
19249                 gidformat="$uvuformat"
19250         else
19251                 if $test X"$gidsize" = X"$longsize"; then
19252                         gidformat='"lu"'
19253                 else
19254                         if $test X"$gidsize" = X"$intsize"; then
19255                                 gidformat='"u"'
19256                         else
19257                                 if $test X"$gidsize" = X"$shortsize"; then
19258                                         gidformat='"hu"'
19259                                 fi
19260                         fi
19261                 fi
19262         fi
19263         ;;
19264 esac
19265
19266 : see if getgroups exists
19267 set getgroups d_getgrps
19268 eval $inlibc
19269
19270 : see if setgroups exists
19271 set setgroups d_setgrps
19272 eval $inlibc
19273
19274
19275 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19276 echo " "
19277 case "$d_getgrps$d_setgrps" in
19278 *define*)
19279         case "$groupstype" in
19280         '') dflt="$gidtype" ;;
19281         *)  dflt="$groupstype" ;;
19282         esac
19283         $cat <<EOM
19284 What type of pointer is the second argument to getgroups() and setgroups()?
19285 Usually this is the same as group ids, $gidtype, but not always.
19286
19287 EOM
19288         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19289         . ./myread
19290         groupstype="$ans"
19291         ;;
19292 *)  groupstype="$gidtype";;
19293 esac
19294
19295
19296 if $test $patchlevel -lt 9; then
19297 : MAD is not available in 5.8.x or earlier.
19298     ans=n;
19299 else
19300     case "$mad" in
19301     $define|true|[yY]*) dflt='y' ;;
19302     *)                  dflt='n' ;;
19303     esac
19304     cat <<EOM
19305
19306 Would you like to build with Misc Attribute Decoration? This is development
19307 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19308 overhead on the interpreter.
19309
19310 If this doesn't make any sense to you, just accept the default '$dflt'.
19311 EOM
19312     rp='Build Perl with MAD?'
19313     . ./myread
19314 fi
19315 case "$ans" in
19316 y|Y)    val="$define"
19317         madlyh='madly.h madly.act madly.tab'
19318         madlysrc='madly.c'
19319         madlyobj="madly$_o" ;;
19320 *)      val="$undef"
19321         madlyh=''
19322         madlysrc=''
19323         madlyobj='' ;;
19324 esac
19325 set mad
19326 eval $setvar
19327
19328 echo " "
19329 echo "Checking if your $make program sets \$(MAKE)..." >&4
19330 case "$make_set_make" in
19331 '')
19332         $sed 's/^X //' > testmake.mak << 'EOF'
19333 Xall:
19334 X       @echo 'maketemp="$(MAKE)"'
19335 EOF
19336         case "`$make -f testmake.mak 2>/dev/null`" in
19337         *maketemp=*) make_set_make='#' ;;
19338         *)      make_set_make="MAKE=$make" ;;
19339         esac
19340         $rm -f testmake.mak
19341         ;;
19342 esac
19343 case "$make_set_make" in
19344 '#') echo "Yup, it does.";;
19345 *) echo "Nope, it doesn't.";;
19346 esac
19347
19348 : see what type is used for mode_t
19349 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19350 set mode_t modetype int stdio.h sys/types.h
19351 eval $typedef_ask
19352
19353 : see if we need va_copy
19354 echo " "
19355 case "$i_stdarg" in
19356 "$define")
19357         $cat >try.c <<EOCP
19358 #include <stdarg.h>
19359 #include <stdio.h>
19360 #$i_stdlib I_STDLIB
19361 #ifdef I_STDLIB
19362 #include <stdlib.h>
19363 #endif
19364 #include <signal.h>
19365
19366 int
19367 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19368 {
19369   return vfprintf(f, fmt, *valp);
19370 }
19371  
19372 int    
19373 myvfprintf(FILE *f, const  char *fmt, va_list val)
19374 {
19375   return ivfprintf(f, fmt, &val);
19376 }
19377       
19378 int
19379 myprintf(char *fmt, ...) 
19380 {
19381   va_list val;
19382   va_start(val, fmt);
19383   return myvfprintf(stdout, fmt, val); 
19384 }         
19385
19386 int
19387 main(int ac, char **av)
19388 {
19389   signal(SIGSEGV, exit);
19390
19391   myprintf("%s%cs all right, then\n", "that", '\'');                            
19392   exit(0);      
19393 }
19394 EOCP
19395         set try
19396         if eval $compile && $run ./try 2>&1 >/dev/null; then
19397                 case "`$run ./try`" in
19398                 "that's all right, then")
19399                         okay=yes
19400                         ;;
19401                 esac
19402         fi
19403         case "$okay" in
19404         yes)    echo "It seems that you don't need va_copy()." >&4
19405                 need_va_copy="$undef"
19406                 ;;
19407         *)      echo "It seems that va_copy() or similar will be needed." >&4
19408                 need_va_copy="$define"
19409                 ;;
19410         esac
19411         $rm -f try.* core core.* *.core *.core.*
19412         ;;
19413 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19414         ;;
19415 esac
19416
19417 : see what type is used for size_t
19418 rp="What is the type used for the length parameter for string functions?"
19419 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19420 eval $typedef_ask
19421
19422 : check for type of arguments to gethostbyaddr. 
19423 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19424         case "$d_gethbyaddr" in
19425         $define)
19426                 $cat <<EOM
19427
19428 Checking to see what type of arguments are accepted by gethostbyaddr().
19429 EOM
19430                 hdrs="$define sys/types.h
19431                         $d_socket sys/socket.h 
19432                         $i_niin netinet/in.h 
19433                         $i_netdb netdb.h
19434                         $i_unistd unistd.h"
19435                 : The first arg can 'char *' or 'void *'
19436                 : The second arg is some of integral type
19437                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19438                         for yyy in size_t long int; do
19439                                 case "$netdb_host_type" in
19440                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19441                                         if ./protochk "$try" $hdrs; then
19442                                                 echo "Your system accepts $xxx for the first arg."
19443                                                 echo "...and $yyy for the second arg."
19444                                                 netdb_host_type="$xxx"
19445                                                 netdb_hlen_type="$yyy"
19446                                         fi
19447                                         ;;
19448                                 esac
19449                         done
19450                 done
19451                 : In case none of those worked, prompt the user.
19452                 case "$netdb_host_type" in
19453                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19454                         dflt='char *'
19455                         . ./myread
19456                         netdb_host_type=$ans
19457                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19458                         dflt="$sizetype"
19459                         . ./myread
19460                         netdb_hlen_type=$ans
19461                         ;;
19462                 esac
19463                 ;;
19464         *)      : no gethostbyaddr, so pick harmless defaults
19465                 netdb_host_type='char *'
19466                 netdb_hlen_type="$sizetype"
19467                 ;;
19468         esac
19469         # Remove the "const" if needed. -- but then we'll have a 
19470         # prototype clash!
19471         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19472 fi
19473
19474 : check for type of argument to gethostbyname. 
19475 if test "X$netdb_name_type" = X ; then
19476         case "$d_gethbyname" in
19477         $define)
19478                 $cat <<EOM
19479
19480 Checking to see what type of argument is accepted by gethostbyname().
19481 EOM
19482                 hdrs="$define sys/types.h
19483                         $d_socket sys/socket.h 
19484                         $i_niin netinet/in.h 
19485                         $i_netdb netdb.h
19486                         $i_unistd unistd.h"
19487                 for xxx in "const char *" "char *"; do
19488                         case "$netdb_name_type" in
19489                         '')     try="extern struct hostent *gethostbyname($xxx);"
19490                                 if ./protochk "$try" $hdrs; then
19491                                         echo "Your system accepts $xxx."
19492                                         netdb_name_type="$xxx"
19493                                 fi
19494                                 ;;
19495                         esac
19496                 done
19497                 : In case none of those worked, prompt the user.
19498                 case "$netdb_name_type" in
19499                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19500                         dflt='char *'
19501                         . ./myread
19502                         netdb_name_type=$ans
19503                         ;;
19504                 esac
19505                 ;;
19506         *)      : no gethostbyname, so pick harmless default
19507                 netdb_name_type='char *'
19508                 ;;
19509         esac
19510 fi
19511
19512 : check for type of 1st argument to getnetbyaddr. 
19513 if test "X$netdb_net_type" = X ; then
19514         case "$d_getnbyaddr" in
19515         $define)
19516                 $cat <<EOM
19517
19518 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19519 EOM
19520                 hdrs="$define sys/types.h
19521                         $d_socket sys/socket.h 
19522                         $i_niin netinet/in.h 
19523                         $i_netdb netdb.h
19524                         $i_unistd unistd.h"
19525                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19526                         case "$netdb_net_type" in
19527                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19528                                 if ./protochk "$try" $hdrs; then
19529                                         echo "Your system accepts $xxx."
19530                                         netdb_net_type="$xxx"
19531                                 fi
19532                                 ;;
19533                         esac
19534                 done
19535                 : In case none of those worked, prompt the user.
19536                 case "$netdb_net_type" in
19537                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19538                         dflt='long'
19539                         . ./myread
19540                         netdb_net_type=$ans
19541                         ;;
19542                 esac
19543                 ;;
19544         *)      : no getnetbyaddr, so pick harmless default
19545                 netdb_net_type='long'
19546                 ;;
19547         esac
19548 fi
19549 : locate the preferred pager for this system
19550 fn=f/
19551 case "$pager" in
19552 '')
19553         dflt=''
19554         case "$pg" in
19555         /*) dflt=$pg;;
19556         [a-zA-Z]:/*) dflt=$pg;;
19557         esac
19558         case "$more" in
19559         /*) dflt=$more;;
19560         [a-zA-Z]:/*) dflt=$more;;
19561         esac
19562         case "$less" in
19563         /*) dflt=$less;;
19564         [a-zA-Z]:/*) dflt=$less;;
19565         esac
19566         case "$dflt" in
19567         '') dflt=/usr/ucb/more;;
19568         esac
19569         ;;
19570 *)      dflt="$pager"
19571         : Instruct ./getfile to trust the hinted or previous pager value,
19572         : even if it does not begin with a slash.  For example, on os2,
19573         : pager might be cmd /c more.  See comments in UU/getfile.
19574         fn="f/($pager)"
19575         ;;
19576 esac
19577 echo " "
19578 rp='What pager is used on your system?'
19579 . ./getfile
19580 pager="$ans"
19581
19582 : see what type pids are declared as in the kernel
19583 rp="What is the type of process ids on this system?"
19584 set pid_t pidtype int stdio.h sys/types.h
19585 eval $typedef_ask
19586
19587 : see if ar generates random libraries by itself
19588 echo " "
19589 echo "Checking how to generate random libraries on your machine..." >&4
19590 echo 'int bar1() { return bar2(); }' > bar1.c
19591 echo 'int bar2() { return 2; }' > bar2.c
19592 $cat > foo.c <<EOP
19593 #$i_stdlib I_STDLIB
19594 #ifdef I_STDLIB
19595 #include <stdlib.h>
19596 #endif
19597 int main() { printf("%d\n", bar1()); exit(0); }
19598 EOP
19599 $cc $ccflags -c bar1.c >/dev/null 2>&1
19600 $cc $ccflags -c bar2.c >/dev/null 2>&1
19601 $cc $ccflags -c foo.c >/dev/null 2>&1
19602 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19603 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19604         $run ./foobar >/dev/null 2>&1; then
19605         echo "$ar appears to generate random libraries itself."
19606         orderlib=false
19607         if [ "X$ranlib" = "X" ]; then
19608             ranlib=":"
19609         fi
19610 elif $ar s bar$_a >/dev/null 2>&1 &&
19611         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19612         $run ./foobar >/dev/null 2>&1; then
19613                 echo "a table of contents needs to be added with '$ar s'."
19614                 orderlib=false
19615                 ranlib="$ar s"
19616 elif $ar ts bar$_a >/dev/null 2>&1 &&
19617         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19618         $run ./foobar >/dev/null 2>&1; then
19619                 echo "a table of contents needs to be added with '$ar ts'."
19620                 orderlib=false
19621                 ranlib="$ar ts"
19622 else
19623         case "$ranlib" in
19624         :) ranlib='';;
19625         '')
19626                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19627                 $test -f $ranlib || ranlib=''
19628                 ;;
19629         esac
19630         if $test -n "$ranlib"; then
19631                 echo "your system has '$ranlib'; we'll use that."
19632                 orderlib=false
19633         else
19634                 echo "your system doesn't seem to support random libraries"
19635                 echo "so we'll use lorder and tsort to order the libraries."
19636                 orderlib=true
19637                 ranlib=":"
19638         fi
19639 fi
19640 $rm -f foo* bar*
19641
19642 : check for type of arguments to select. 
19643 case "$selecttype" in
19644 '') case "$d_select" in
19645         $define)
19646                 echo " "
19647                 $cat <<EOM
19648 Checking to see what type of arguments are accepted by select().
19649 EOM
19650                 hdrs="$define sys/types.h
19651                         $i_systime sys/time.h 
19652                         $i_sysselct sys/select.h
19653                         $d_socket sys/socket.h"
19654                 : The first arg can be int, unsigned, or size_t
19655                 : The last arg may or may not be 'const'
19656                 val=''
19657                 : void pointer has been seen but using that
19658                 : breaks the selectminbits test
19659                 for xxx in 'fd_set *' 'int *'; do
19660                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19661                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19662                                         case "$val" in
19663                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19664                                                 if ./protochk "$try" $hdrs; then
19665                                                         echo "Your system accepts $xxx."
19666                                                         val="$xxx"
19667                                                 fi
19668                                                 ;;
19669                                         esac
19670                                 done
19671                         done
19672                 done
19673                 case "$val" in
19674                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19675                         case "$d_fd_set" in
19676                                 $define) dflt="fd_set *" ;;
19677                                 *)              dflt="int *" ;;
19678                         esac
19679                         . ./myread
19680                         val=$ans
19681                         ;;
19682                 esac
19683                 selecttype="$val"
19684                 ;;
19685         *)      : no select, so pick a harmless default
19686                 selecttype='int *'
19687                 ;;
19688         esac
19689         ;;
19690 esac
19691
19692 : check for the select 'width'
19693 case "$selectminbits" in
19694 '') safebits=`expr $ptrsize \* 8`
19695     case "$d_select" in
19696         $define)
19697                 $cat <<EOM
19698
19699 Checking to see on how many bits at a time your select() operates...
19700 EOM
19701                 $cat >try.c <<EOCP
19702 #include <sys/types.h>
19703 #$i_time I_TIME
19704 #$i_systime I_SYS_TIME
19705 #$i_systimek I_SYS_TIME_KERNEL
19706 #ifdef I_TIME
19707 #   include <time.h>
19708 #endif
19709 #ifdef I_SYS_TIME
19710 #   ifdef I_SYS_TIME_KERNEL
19711 #       define KERNEL
19712 #   endif
19713 #   include <sys/time.h>
19714 #   ifdef I_SYS_TIME_KERNEL
19715 #       undef KERNEL
19716 #   endif
19717 #endif
19718 #$i_sysselct I_SYS_SELECT
19719 #ifdef I_SYS_SELECT
19720 #include <sys/select.h>
19721 #endif
19722 #$d_socket HAS_SOCKET
19723 #ifdef HAS_SOCKET
19724 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19725 #endif
19726 #include <stdio.h>
19727 #$i_stdlib I_STDLIB
19728 #ifdef I_STDLIB
19729 #include <stdlib.h>
19730 #endif
19731 $selecttype b;
19732 #define S sizeof(*(b))
19733 #define MINBITS 64
19734 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19735 #define NBITS  (NBYTES * 8)
19736 int main() {
19737     char *s = (char *)malloc(NBYTES);
19738     struct timeval t;
19739     int i;
19740     FILE* fp;
19741     int fd;
19742
19743     if (!s)
19744         exit(1);
19745     fclose(stdin);
19746     fp = fopen("try.c", "r");
19747     if (fp == 0)
19748       exit(2);
19749     fd = fileno(fp);
19750     if (fd < 0)
19751       exit(3);
19752     b = ($selecttype)s;
19753     for (i = 0; i < NBITS; i++)
19754         FD_SET(i, b);
19755     t.tv_sec  = 0;
19756     t.tv_usec = 0;
19757     select(fd + 1, b, 0, 0, &t);
19758     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19759     free(s);
19760     printf("%d\n", i + 1);
19761     return 0;
19762 }
19763 EOCP
19764                 set try
19765                 if eval $compile_ok; then
19766                         selectminbits=`$run ./try`
19767                         case "$selectminbits" in
19768                         '')     cat >&4 <<EOM
19769 Cannot figure out on how many bits at a time your select() operates.
19770 I'll play safe and guess it is $safebits bits.
19771 EOM
19772                                 selectminbits=$safebits
19773                                 bits="$safebits bits"
19774                                 ;;
19775                         1)      bits="1 bit" ;;
19776                         *)      bits="$selectminbits bits" ;;
19777                         esac
19778                         echo "Your select() operates on $bits at a time." >&4
19779                 else
19780                         rp='What is the minimum number of bits your select() operates on?'
19781                         case "$byteorder" in
19782                         12345678)       dflt=64 ;;
19783                         1234)           dflt=32 ;;
19784                         *)              dflt=1  ;;
19785                         esac
19786                         . ./myread
19787                         val=$ans
19788                         selectminbits="$val"
19789                 fi
19790                 $rm -f try.* try
19791                 ;;
19792         *)      : no select, so pick a harmless default
19793                 selectminbits=$safebits
19794                 ;;
19795         esac
19796         ;;
19797 esac
19798
19799 : Trace out the files included by signal.h, then look for SIGxxx names.
19800 : Remove SIGARRAYSIZE used by HPUX.
19801 : Remove SIGSTKSIZE used by Linux.
19802 : Remove SIGSTKSZ used by Posix.
19803 : Remove SIGTYP void lines used by OS2.
19804 : Some cpps, like os390, dont give the file name anywhere
19805 if [ "X$fieldn" = X ]; then
19806         : Just make some guesses.  We check them later.
19807         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19808 else
19809         xxx=`echo '#include <signal.h>' |
19810         $cppstdin $cppminus $cppflags 2>/dev/null |
19811         $grep '^[       ]*#.*include' | 
19812         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19813 fi
19814 : Check this list of files to be sure we have parsed the cpp output ok.
19815 : This will also avoid potentially non-existent files, such 
19816 : as ../foo/bar.h
19817 xxxfiles=''
19818 for xx in $xxx /dev/null ; do
19819         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19820 done
19821 : If we have found no files, at least try signal.h
19822 case "$xxxfiles" in
19823 '')     xxxfiles=`./findhdr signal.h` ;;
19824 esac
19825 xxx=`awk '
19826 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19827         print substr($2, 4, 20)
19828 }
19829 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19830         print substr($3, 4, 20)
19831 }' $xxxfiles`
19832 : Append some common names just in case the awk scan failed.
19833 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19834 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19835 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19836 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19837 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19838
19839 : generate a few handy files for later
19840 $cat > signal.c <<EOCP
19841 #include <sys/types.h>
19842 #include <signal.h>
19843 #$i_stdlib I_STDLIB
19844 #ifdef I_STDLIB
19845 #include <stdlib.h>
19846 #endif
19847 #include <stdio.h>
19848 int main() {
19849
19850 /* Strange style to avoid deeply-nested #if/#else/#endif */
19851 #ifndef NSIG
19852 #  ifdef _NSIG
19853 #    define NSIG (_NSIG)
19854 #  endif
19855 #endif
19856
19857 #ifndef NSIG
19858 #  ifdef SIGMAX
19859 #    define NSIG (SIGMAX+1)
19860 #  endif
19861 #endif
19862
19863 #ifndef NSIG
19864 #  ifdef SIG_MAX
19865 #    define NSIG (SIG_MAX+1)
19866 #  endif
19867 #endif
19868
19869 #ifndef NSIG
19870 #  ifdef _SIG_MAX
19871 #    define NSIG (_SIG_MAX+1)
19872 #  endif
19873 #endif
19874
19875 #ifndef NSIG
19876 #  ifdef MAXSIG
19877 #    define NSIG (MAXSIG+1)
19878 #  endif
19879 #endif
19880
19881 #ifndef NSIG
19882 #  ifdef MAX_SIG
19883 #    define NSIG (MAX_SIG+1)
19884 #  endif
19885 #endif
19886
19887 #ifndef NSIG
19888 #  ifdef SIGARRAYSIZE
19889 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19890 #  endif
19891 #endif
19892
19893 #ifndef NSIG
19894 #  ifdef _sys_nsig
19895 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19896 #  endif
19897 #endif
19898
19899 /* Default to some arbitrary number that's big enough to get most
19900    of the common signals.
19901 */
19902 #ifndef NSIG
19903 #    define NSIG 50
19904 #endif
19905
19906 printf("NSIG %d\n", NSIG);
19907
19908 #ifndef JUST_NSIG
19909
19910 EOCP
19911
19912 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19913 {
19914         printf "#ifdef SIG"; printf $1; printf "\n"
19915         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19916         printf $1; printf ");\n"
19917         printf "#endif\n"
19918 }
19919 END {
19920         printf "#endif /* JUST_NSIG */\n";
19921         printf "exit(0);\n}\n";
19922 }
19923 ' >>signal.c
19924 $cat >signal.awk <<'EOP'
19925 BEGIN { ndups = 0 }
19926 $1 ~ /^NSIG$/ { nsig = $2 }
19927 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19928     if ($2 > maxsig) { maxsig = $2 }
19929     if (sig_name[$2]) {
19930         dup_name[ndups] = $1
19931         dup_num[ndups] = $2
19932         ndups++ 
19933     }
19934     else {
19935         sig_name[$2] = $1
19936         sig_num[$2] = $2
19937     }
19938 }
19939 END { 
19940     if (nsig == 0) {
19941         nsig = maxsig + 1
19942     }
19943     printf("NSIG %d\n", nsig);
19944     for (n = 1; n < nsig; n++) {
19945         if (sig_name[n]) {
19946             printf("%s %d\n", sig_name[n], sig_num[n])
19947         }
19948         else {
19949             printf("NUM%d %d\n", n, n) 
19950         }
19951     }
19952     for (n = 0; n < ndups; n++) {
19953         printf("%s %d\n", dup_name[n], dup_num[n])
19954     }
19955 }
19956 EOP
19957 $cat >signal_cmd <<EOS
19958 $startsh
19959 if $test -s signal.lst; then
19960     echo "Using your existing signal.lst file"
19961         exit 0
19962 fi
19963 xxx="$xxx"
19964 EOS
19965 $cat >>signal_cmd <<'EOS'
19966
19967 set signal
19968 if eval $compile_ok; then
19969         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19970 else
19971         echo "(I can't seem be able to compile the whole test program)" >&4
19972         echo "(I'll try it in little pieces.)" >&4
19973         set signal -DJUST_NSIG
19974         if eval $compile_ok; then
19975                 $run ./signal$_exe > signal.nsg
19976                 $cat signal.nsg
19977         else
19978                 echo "I can't seem to figure out how many signals you have." >&4
19979                 echo "Guessing 50." >&4
19980                 echo 'NSIG 50' > signal.nsg
19981         fi
19982         : Now look at all the signal names, one at a time.
19983         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19984                 $cat > signal.c <<EOCP
19985 #include <sys/types.h>
19986 #include <signal.h>
19987 #include <stdio.h>
19988 int main() {
19989 printf("$xx %d\n", SIG${xx});
19990 return 0;
19991 }
19992 EOCP
19993                 set signal
19994                 if eval $compile; then
19995                         echo "SIG${xx} found."
19996                         $run ./signal$_exe  >> signal.ls1
19997                 else
19998                         echo "SIG${xx} NOT found."
19999                 fi
20000         done
20001         if $test -s signal.ls1; then
20002                 $cat signal.nsg signal.ls1 |
20003                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20004         fi
20005
20006 fi
20007 if $test -s signal.lst; then
20008         :
20009 else
20010         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20011         echo 'kill -l' >signal
20012         set X `csh -f <signal`
20013         $rm -f signal
20014         shift
20015         case $# in
20016         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20017         esac
20018         echo $@ | $tr ' ' $trnl | \
20019             $awk '{ printf "%s %d\n", $1, ++s; }
20020                   END { printf "NSIG %d\n", ++s }' >signal.lst
20021 fi
20022 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20023 EOS
20024 chmod a+x signal_cmd
20025 $eunicefix signal_cmd
20026
20027 : generate list of signal names
20028 echo " "
20029 case "$sig_name_init" in
20030 '') doinit=yes ;;
20031 *)  case "$sig_num_init" in
20032     ''|*,*) doinit=yes ;;
20033     esac ;;
20034 esac
20035 case "$doinit" in
20036 yes)
20037         echo "Generating a list of signal names and numbers..." >&4
20038         . ./signal_cmd
20039         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20040         sig_name=`$awk 'BEGIN { printf "ZERO " }
20041                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20042         sig_num=`$awk  'BEGIN { printf "0 " }
20043                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20044         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20045                              !/^NSIG/   { printf "\"%s\", ", $1 }
20046                              END        { printf "0\n" }' signal.lst`
20047         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20048                              !/^NSIG/   { printf "%d, ", $2}
20049                              END        { printf "0\n"}' signal.lst`
20050         ;;
20051 esac
20052 echo "The following $sig_count signals are available:"
20053 echo " "
20054 echo $sig_name | $awk \
20055 'BEGIN { linelen = 0 }
20056 {
20057         for (i = 1; i <= NF; i++) {
20058                 name = "SIG" $i " "
20059                 linelen = linelen + length(name)
20060                 if (linelen > 70) {
20061                         printf "\n"
20062                         linelen = length(name)
20063                 }
20064                 printf "%s", name
20065         }
20066         printf "\n"
20067 }'
20068 sig_size=`echo $sig_name | awk '{print NF}'`
20069 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20070
20071 echo " "
20072 case "$sizetype" in
20073 *_t) zzz="$sizetype"    ;;
20074 *)   zzz="filesize"     ;;
20075 esac
20076 echo "Checking the size of $zzz..." >&4 
20077 cat > try.c <<EOCP
20078 #include <sys/types.h>
20079 #include <stdio.h>
20080 #$i_stdlib I_STDLIB
20081 #ifdef I_STDLIB
20082 #include <stdlib.h>
20083 #endif
20084 int main() {
20085     printf("%d\n", (int)sizeof($sizetype));
20086     exit(0);
20087 }
20088 EOCP
20089 set try
20090 if eval $compile_ok; then
20091         yyy=`$run ./try`
20092         case "$yyy" in
20093         '')     sizesize=4
20094                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20095                 ;;
20096         *)      sizesize=$yyy
20097                 echo "Your $zzz size is $sizesize bytes."
20098                 ;;
20099         esac
20100 else
20101         sizesize=4
20102         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20103 fi
20104
20105
20106 : check for socklen_t
20107 echo " "
20108 echo "Checking to see if you have socklen_t..." >&4
20109 $cat >try.c <<EOCP
20110 #include <sys/types.h>
20111 #$d_socket HAS_SOCKET
20112 #ifdef HAS_SOCKET
20113 #include <sys/socket.h>
20114 #endif
20115 int main() { socklen_t x = 16; }
20116 EOCP
20117 set try
20118 if eval $compile; then
20119         val="$define"
20120         echo "You have socklen_t."
20121 else
20122         val="$undef"
20123         echo "You do not have socklen_t."
20124         case "$sizetype" in
20125         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20126         esac
20127 fi
20128 $rm -f try try.*
20129 set d_socklen_t
20130 eval $setvar
20131
20132 : see if this is a socks.h system
20133 set socks.h i_socks
20134 eval $inhdr
20135
20136 : check for type of the size argument to socket calls
20137 case "$d_socket" in
20138 "$define")
20139         $cat <<EOM
20140
20141 Checking to see what type is the last argument of accept().
20142 EOM
20143         yyy=''
20144         case "$d_socklen_t" in
20145         "$define") yyy="$yyy socklen_t"
20146         esac
20147         yyy="$yyy $sizetype int long unsigned"
20148         for xxx in $yyy; do
20149                 case "$socksizetype" in
20150                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20151                         case "$usesocks" in
20152                         "$define")
20153                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20154                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20155                                         socksizetype="$xxx"
20156                                 fi
20157                                 ;;
20158                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20159                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20160                                         socksizetype="$xxx"
20161                                 fi
20162                                 ;;
20163                         esac
20164                         ;;
20165                 esac
20166         done
20167 : In case none of those worked, prompt the user.
20168         case "$socksizetype" in
20169         '')     rp='What is the type for socket address structure sizes?'
20170                 dflt='int'
20171                 . ./myread
20172                 socksizetype=$ans
20173                 ;;
20174         esac
20175         ;;
20176 *)      : no sockets, so pick relatively harmless default
20177         socksizetype='int'
20178         ;;
20179 esac
20180
20181 : see what type is used for signed size_t
20182 set ssize_t ssizetype int stdio.h sys/types.h
20183 eval $typedef
20184 dflt="$ssizetype"
20185 $cat > try.c <<EOM
20186 #include <stdio.h>
20187 #$i_stdlib I_STDLIB
20188 #ifdef I_STDLIB
20189 #include <stdlib.h>
20190 #endif
20191 #include <sys/types.h>
20192 #define Size_t $sizetype
20193 #define SSize_t $dflt
20194 int main()
20195 {
20196         if (sizeof(Size_t) == sizeof(SSize_t))
20197                 printf("$dflt\n");
20198         else if (sizeof(Size_t) == sizeof(int))
20199                 printf("int\n");
20200         else 
20201                 printf("long\n");
20202         exit(0);
20203 }
20204 EOM
20205 echo " "
20206 set try
20207 if eval $compile_ok && $run ./try > /dev/null; then
20208         ssizetype=`$run ./try`
20209         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20210 else
20211         $cat >&4 <<EOM
20212 Help! I can't compile and run the ssize_t test program: please enlighten me!
20213 (This is probably a misconfiguration in your system or libraries, and
20214 you really ought to fix it.  Still, I'll try anyway.)
20215
20216 I need a type that is the same size as $sizetype, but is guaranteed to
20217 be signed.  Common values are ssize_t, int and long.
20218
20219 EOM
20220         rp="What signed type is the same size as $sizetype?"
20221         . ./myread
20222         ssizetype="$ans"
20223 fi
20224 $rm -f try try.*
20225
20226 : see what type of char stdio uses.
20227 echo " "
20228 echo '#include <stdio.h>' > stdio.c
20229 $cppstdin $cppminus < stdio.c > stdioh
20230 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20231         echo "Your stdio uses unsigned chars." >&4
20232         stdchar="unsigned char"
20233 else
20234         echo "Your stdio uses signed chars." >&4
20235         stdchar="char"
20236 fi
20237 $rm -f stdio.* stdioh
20238
20239 : see what type uids are declared as in the kernel
20240 echo " "
20241 echo "Looking for the type for user ids returned by getuid()."
20242 set uid_t uidtype xxx stdio.h sys/types.h
20243 eval $typedef
20244 case "$uidtype" in
20245 xxx)
20246         xxx=`./findhdr sys/user.h`
20247         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20248         case $1 in
20249         unsigned) dflt="$1 $2" ;;
20250         *) dflt="$1" ;;
20251         esac
20252         ;;
20253 *) dflt="$uidtype";;
20254 esac
20255 case "$uidtype" in
20256 uid_t)  echo "uid_t found." ;;
20257 *)      rp="What is the type for user ids returned by getuid()?"
20258         . ./myread
20259         uidtype="$ans"
20260         ;;
20261 esac
20262
20263 echo " "
20264 case "$uidtype" in
20265 *_t) zzz="$uidtype"     ;;
20266 *)   zzz="uid"          ;;
20267 esac
20268 echo "Checking the size of $zzz..." >&4 
20269 cat > try.c <<EOCP
20270 #include <sys/types.h>
20271 #include <stdio.h>
20272 #$i_stdlib I_STDLIB
20273 #ifdef I_STDLIB
20274 #include <stdlib.h>
20275 #endif
20276 int main() {
20277     printf("%d\n", (int)sizeof($uidtype));
20278     exit(0);
20279 }
20280 EOCP
20281 set try
20282 if eval $compile_ok; then
20283         yyy=`$run ./try`
20284         case "$yyy" in
20285         '')     uidsize=4
20286                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20287                 ;;
20288         *)      uidsize=$yyy
20289                 echo "Your $zzz is $uidsize bytes long."
20290                 ;;
20291         esac
20292 else
20293         uidsize=4
20294         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20295 fi
20296
20297 echo " "
20298 case "$uidtype" in
20299 *_t) zzz="$uidtype"     ;;
20300 *)   zzz="uid"          ;;
20301 esac
20302 echo "Checking the sign of $zzz..." >&4
20303 cat > try.c <<EOCP
20304 #include <sys/types.h>
20305 #include <stdio.h>
20306 int main() {
20307         $uidtype foo = -1;
20308         if (foo < 0)
20309                 printf("-1\n");
20310         else
20311                 printf("1\n");
20312 }
20313 EOCP
20314 set try
20315 if eval $compile; then
20316         yyy=`$run ./try`
20317         case "$yyy" in
20318         '')     uidsign=1
20319                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20320                 ;;
20321         *)      uidsign=$yyy
20322                 case "$uidsign" in
20323                  1) echo "Your $zzz is unsigned." ;;
20324                 -1) echo "Your $zzz is signed."   ;;
20325                 esac
20326                 ;;
20327         esac
20328 else
20329         uidsign=1
20330         echo "(I can't compile the test program--guessing unsigned.)" >&4
20331 fi
20332
20333
20334
20335 echo " "
20336 $echo "Checking the format string to be used for uids..." >&4
20337
20338 case "$uidsign" in
20339 -1)     if $test X"$uidsize" = X"$ivsize"; then
20340                 uidformat="$ivdformat"
20341         else
20342                 if $test X"$uidsize" = X"$longsize"; then
20343                         uidformat='"ld"'
20344                 else
20345                         if $test X"$uidsize" = X"$intsize"; then
20346                                 uidformat='"d"'
20347                         else
20348                                 if $test X"$uidsize" = X"$shortsize"; then
20349                                         uidformat='"hd"'
20350                                 fi
20351                         fi
20352                 fi
20353         fi
20354         ;;
20355 *)      if $test X"$uidsize" = X"$uvsize"; then
20356                 uidformat="$uvuformat"
20357         else
20358                 if $test X"$uidsize" = X"$longsize"; then
20359                         uidformat='"lu"'
20360                 else
20361                         if $test X"$uidsize" = X"$intsize"; then
20362                                 uidformat='"u"'
20363                         else
20364                                 if $test X"$uidsize" = X"$shortsize"; then
20365                                         uidformat='"hu"'
20366                                 fi
20367                         fi
20368                 fi
20369         fi
20370         ;;
20371 esac
20372
20373
20374 case "$usesitecustomize" in
20375     $define|true|[Yy]*)
20376         usesitecustomize="$define"
20377         ;;
20378     *)
20379         usesitecustomize="$undef"
20380         ;;
20381     esac
20382
20383 : determine compiler compiler
20384 case "$yacc" in
20385 '')
20386         dflt=yacc;;
20387 *)
20388         dflt="$yacc";;
20389 esac
20390 echo " "
20391 comp='yacc'
20392 if $test -f "$byacc$_exe"; then
20393         dflt="$byacc"
20394         comp="byacc or $comp"
20395 fi
20396 if $test -f "$bison$_exe"; then
20397         comp="$comp or bison -y"
20398 fi
20399 rp="Which compiler compiler ($comp) shall I use?"
20400 . ./myread
20401 yacc="$ans"
20402 case "$yacc" in
20403 *bis*)
20404         case "$yacc" in
20405         *-y*) ;;
20406         *)
20407                 yacc="$yacc -y"
20408                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20409                 ;;
20410         esac
20411         ;;
20412 esac
20413
20414 : see if this is a fp.h system
20415 set fp.h i_fp
20416 eval $inhdr
20417
20418 : see if this is a fp_class.h system
20419 set fp_class.h i_fp_class
20420 eval $inhdr
20421
20422 : see if gdbm.h is available
20423 set gdbm.h t_gdbm
20424 eval $inhdr
20425 case "$t_gdbm" in
20426 $define)
20427         : see if gdbm_open exists
20428         set gdbm_open d_gdbm_open
20429         eval $inlibc
20430         case "$d_gdbm_open" in
20431         $undef)
20432                 t_gdbm="$undef"
20433                 echo "We won't be including <gdbm.h>"
20434                 ;;
20435         esac
20436         ;;
20437 esac
20438 val="$t_gdbm"
20439 set i_gdbm
20440 eval $setvar
20441
20442 : see if this is a ieeefp.h system
20443 case "$i_ieeefp" in
20444 '' ) set ieeefp.h i_ieeefp
20445      eval $inhdr
20446      ;;
20447 esac
20448
20449 : see if this is a libutil.h system
20450 set libutil.h i_libutil
20451 eval $inhdr
20452
20453 : see if mach cthreads are available
20454 if test "X$usethreads" = "X$define"; then
20455         set mach/cthreads.h i_machcthr
20456         eval $inhdr
20457 else
20458         i_machcthr="$undef"
20459 fi
20460
20461
20462
20463 : see if this is a mntent.h system
20464 set mntent.h i_mntent
20465 eval $inhdr
20466
20467 : see if ndbm.h is available
20468 set ndbm.h t_ndbm
20469 eval $inhdr
20470
20471 case "$t_ndbm" in
20472 $undef)
20473     # Some Linux distributions such as RedHat 7.1 put the
20474     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20475     if $test -f /usr/include/gdbm/ndbm.h; then
20476         echo '<gdbm/ndbm.h> found.'
20477         ccflags="$ccflags -I/usr/include/gdbm"
20478         cppflags="$cppflags -I/usr/include/gdbm"
20479         t_ndbm=$define
20480     fi
20481     ;;
20482 esac
20483
20484 case "$t_ndbm" in
20485 $define)
20486         : see if dbm_open exists
20487         set dbm_open d_dbm_open
20488         eval $inlibc
20489         case "$d_dbm_open" in
20490         $undef)
20491                 t_ndbm="$undef"
20492                 echo "We won't be including <ndbm.h>"
20493                 ;;
20494         esac
20495         ;;
20496 esac
20497 val="$t_ndbm"
20498 set i_ndbm
20499 eval $setvar
20500
20501 : see if net/errno.h is available
20502 val=''
20503 set net/errno.h val
20504 eval $inhdr
20505
20506 : Unfortunately, it causes problems on some systems.  Arrgh.
20507 case "$val" in
20508 $define)
20509         cat > try.c <<'EOM'
20510 #include <stdio.h>
20511 #include <errno.h>
20512 #include <net/errno.h>
20513 int func()
20514 {
20515         return ENOTSOCK;
20516 }
20517 EOM
20518         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20519                 echo "We'll be including <net/errno.h>." >&4
20520         else
20521                 echo "We won't be including <net/errno.h>." >&4
20522                 val="$undef"
20523         fi
20524         $rm -f try.* try
20525         ;;
20526 esac
20527 set i_neterrno
20528 eval $setvar
20529
20530 : see if netinet/tcp.h is available
20531 set netinet/tcp.h i_netinettcp
20532 eval $inhdr
20533
20534 : see if this is a poll.h system
20535 set poll.h i_poll
20536 eval $inhdr
20537
20538 : see if this is a prot.h system
20539 set prot.h i_prot
20540 eval $inhdr
20541
20542 echo " "
20543 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20544 $cat <<'EOSH' > Cppsym.know
20545 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20546 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20547 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20548 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20549 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20550 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20551 bull c cadmus clipper CMU COFF COMPILER_VERSION
20552 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20553 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20554 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20555 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20556 GLIBC GLIBC_MINOR
20557 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20558 H3050R H3050RX hbullx20 hcx host_mips
20559 hp200 hp300 hp700 HP700 hp800 hp9000
20560 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20561 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20562 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20563 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20564 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20565 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20566 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20567 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20568 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20569 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20570 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20571 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20572 MATH_HAS_NO_SIDE_EFFECTS
20573 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20574 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20575 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20576 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20577 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20578 NetBSD news1500 news1700 news1800 news1900 news3700
20579 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20580 ns32016 ns32332 ns32k nsc32000
20581 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20582 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20583 pc532 pdp11 PGC PIC plexus PORTAR posix
20584 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20585 POSIX_C_SOURCE POSIX_SOURCE POWER
20586 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20587 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20588 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20589 sony sony_news sonyrisc sparc sparclite spectrum
20590 stardent stdc STDC_EXT stratos sun sun3 sun386
20591 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20592 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20593 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20594 sysV68 sysV88 Tek4132 Tek4300 titan
20595 TM3200 TM5400 TM5600
20596 tower tower32 tower32_200 tower32_600 tower32_700
20597 tower32_800 tower32_850 tss
20598 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20599 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20600 unix UNIX95 UNIX99 unixpc unos
20601 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20602 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20603 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20604 USGr4 USGr4_2
20605 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20606 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20607 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20608 z8000
20609 EOSH
20610 # Maybe put other stuff here too.
20611 cat <<EOSH >>Cppsym.know
20612 $osname
20613 EOSH
20614 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20615 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20616 $cat Cppsym.know > Cppsym.c
20617 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20618 $rm -f Cppsym.a Cppsym.b Cppsym.c
20619 cat <<EOSH > Cppsym
20620 $startsh
20621 if $test \$# -gt 0; then
20622     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20623     if $test -s Cppsym.got; then
20624         $rm -f Cppsym.got
20625         exit 0
20626     fi
20627     $rm -f Cppsym.got
20628     exit 1
20629 else
20630     $tr " " "$trnl" | ./Cppsym.try
20631     exit 0
20632 fi
20633 EOSH
20634 chmod +x Cppsym
20635 $eunicefix Cppsym
20636 cat <<EOSH > Cppsym.try
20637 $startsh
20638 cat <<'EOCP' > try.c
20639 #include <stdio.h>
20640 #if cpp_stuff == 1
20641 #define STRINGIFY(a)    "a"
20642 #endif
20643 #if cpp_stuff == 42
20644 #define StGiFy(a)  #a
20645 #define STRINGIFY(a)    StGiFy(a)
20646 #endif
20647 #if $cpp_stuff != 1 && $cpp_stuff != 42
20648 #   include "Bletch: How does this C preprocessor stringify macros?"
20649 #endif
20650 int main() {
20651 EOCP
20652 $awk \\
20653 EOSH
20654 cat <<'EOSH' >> Cppsym.try
20655 'length($1) > 0 {
20656     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20657     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20658     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20659     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20660 }'       >> try.c
20661 echo 'return 0;}' >> try.c
20662 EOSH
20663 cat <<EOSH >> Cppsym.try
20664 ccflags="$ccflags"
20665 case "$osname-$gccversion" in
20666 irix-) ccflags="\$ccflags -woff 1178" ;;
20667 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20668 esac
20669 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20670 EOSH
20671 chmod +x Cppsym.try
20672 $eunicefix Cppsym.try
20673 ./Cppsym < Cppsym.know > Cppsym.true
20674 : Add in any linux cpp "predefined macros":
20675 case "$osname::$gccversion" in
20676   *linux*::*.*)
20677     tHdrH=_tmpHdr
20678     rm -f $tHdrH'.h' $tHdrH
20679     touch $tHdrH'.h'
20680     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20681        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20682        if [ -s $tHdrH'_cppsym.real' ]; then
20683           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20684        fi
20685     fi
20686     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20687   ;;
20688 esac
20689 : now check the C compiler for additional symbols
20690 postprocess_cc_v=''
20691 case "$osname" in
20692 aix) postprocess_cc_v="|$tr , ' '" ;;
20693 esac
20694 $cat >ccsym <<EOS
20695 $startsh
20696 $cat >tmp.c <<EOF
20697 extern int foo;
20698 EOF
20699 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20700 do
20701         case "\$i" in
20702         -D*) echo "\$i" | $sed 's/^-D//';;
20703         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20704         esac
20705 done
20706 $rm -f try.c
20707 EOS
20708 postprocess_cc_v=''
20709 chmod +x ccsym
20710 $eunicefix ccsym
20711 ./ccsym > ccsym1.raw
20712 if $test -s ccsym1.raw; then
20713        $sort ccsym1.raw | $uniq >ccsym.raw
20714 else
20715        mv ccsym1.raw ccsym.raw
20716 fi
20717
20718 $awk '/\=/ { print $0; next }
20719         { print $0"=1" }' ccsym.raw >ccsym.list
20720 $comm -13 Cppsym.true ccsym.list >ccsym.own
20721 $comm -12 Cppsym.true ccsym.list >ccsym.com
20722 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20723 also=''
20724 if $test -z ccsym.raw; then
20725         echo "Your C compiler doesn't seem to define any symbols!" >&4
20726         echo " "
20727         echo "However, your C preprocessor defines the following symbols:"
20728         $cat Cppsym.true
20729         ccsymbols=''
20730         cppsymbols=`$cat Cppsym.true`
20731         cppsymbols=`echo $cppsymbols`
20732         cppccsymbols="$cppsymbols"
20733 else
20734         if $test -s ccsym.com; then
20735                 echo "Your C compiler and pre-processor define these symbols:"
20736                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20737                 also='also '
20738                 symbols='ones'
20739                 cppccsymbols=`$cat ccsym.com`
20740                 cppccsymbols=`echo $cppccsymbols`
20741                 $test "$silent" || sleep 1
20742         fi
20743         if $test -s ccsym.cpp; then
20744                 $test "$also" && echo " "
20745                 echo "Your C pre-processor ${also}defines the following symbols:"
20746                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20747                 also='further '
20748                 cppsymbols=`$cat ccsym.cpp`
20749                 cppsymbols=`echo $cppsymbols`
20750                 $test "$silent" || sleep 1
20751         fi
20752         if $test -s ccsym.own; then
20753                 $test "$also" && echo " "
20754                 echo "Your C compiler ${also}defines the following cpp symbols:"
20755                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20756                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20757                 ccsymbols=`$cat ccsym.own`
20758                 ccsymbols=`echo $ccsymbols`
20759                 $test "$silent" || sleep 1
20760         fi
20761 fi
20762
20763 : see if this is a termio system
20764 val="$undef"
20765 val2="$undef"
20766 val3="$undef"
20767 if $test `./findhdr termios.h`; then
20768         set tcsetattr i_termios
20769         eval $inlibc
20770         val3="$i_termios"
20771 fi
20772 echo " "
20773 case "$val3" in
20774 "$define") echo "You have POSIX termios.h... good!" >&4;;
20775 *) if ./Cppsym pyr; then
20776                 case "`/bin/universe`" in
20777                 ucb) if $test `./findhdr sgtty.h`; then
20778                                 val2="$define"
20779                                 echo "<sgtty.h> found." >&4
20780                         else
20781                                 echo "System is pyramid with BSD universe."
20782                                 echo "<sgtty.h> not found--you could have problems." >&4
20783                         fi;;
20784                 *) if $test `./findhdr termio.h`; then
20785                                 val="$define"
20786                                 echo "<termio.h> found." >&4
20787                         else
20788                                 echo "System is pyramid with USG universe."
20789                                 echo "<termio.h> not found--you could have problems." >&4
20790                         fi;;
20791                 esac
20792         elif ./usg; then
20793                 if $test `./findhdr termio.h`; then
20794                         echo "<termio.h> found." >&4
20795                         val="$define"
20796                 elif $test `./findhdr sgtty.h`; then
20797                         echo "<sgtty.h> found." >&4
20798                         val2="$define"
20799                 else
20800 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20801                 fi
20802         else
20803                 if $test `./findhdr sgtty.h`; then
20804                         echo "<sgtty.h> found." >&4
20805                         val2="$define"
20806                 elif $test `./findhdr termio.h`; then
20807                         echo "<termio.h> found." >&4
20808                         val="$define"
20809                 else
20810 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20811                 fi
20812         fi;;
20813 esac
20814 set i_termio; eval $setvar
20815 val=$val2; set i_sgtty; eval $setvar
20816 val=$val3; set i_termios; eval $setvar
20817
20818 : see if stddef is available
20819 set stddef.h i_stddef
20820 eval $inhdr
20821
20822 : see if this is a sunmath.h system
20823 set sunmath.h i_sunmath
20824 eval $inhdr
20825
20826 : see if sys/access.h is available
20827 set sys/access.h i_sysaccess
20828 eval $inhdr
20829
20830 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20831 set sys/filio.h i_sysfilio
20832 eval $inhdr
20833 echo " "
20834 if $test `./findhdr sys/ioctl.h`; then
20835         val="$define"
20836         echo '<sys/ioctl.h> found.' >&4
20837 else
20838         val="$undef"
20839         if $test $i_sysfilio = "$define"; then
20840             echo '<sys/ioctl.h> NOT found.' >&4
20841         else
20842                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20843                 $test $i_termio = "$define" && xxx="termio.h"
20844                 $test $i_termios = "$define" && xxx="termios.h"
20845 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20846         fi
20847 fi
20848 set i_sysioctl
20849 eval $setvar
20850
20851 : see if socket ioctl defs are in sys/sockio.h
20852 echo " "
20853 xxx=`./findhdr sys/sockio.h`
20854 if $test "$xxx"; then
20855         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20856                 val="$define"
20857                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20858         else
20859                 val="$undef"
20860                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20861         fi
20862 else
20863         val="$undef"
20864         $cat <<EOM
20865 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20866 EOM
20867 fi
20868 set i_syssockio
20869 eval $setvar
20870
20871
20872 : see if this is a syslog.h system
20873 set syslog.h i_syslog
20874 eval $inhdr
20875
20876
20877 : see if this is a sys/mode.h system
20878 set sys/mode.h i_sysmode
20879 eval $inhdr
20880
20881 : see if sys/resource.h has to be included
20882 set sys/resource.h i_sysresrc
20883 eval $inhdr
20884
20885 : see if sys/security.h is available
20886 set sys/security.h i_syssecrt
20887 eval $inhdr
20888
20889 : see if this is a sys/statvfs.h system
20890 set sys/statvfs.h i_sysstatvfs
20891 eval $inhdr
20892
20893 : see if this is a sys/un.h system
20894 set sys/un.h i_sysun
20895 eval $inhdr
20896
20897
20898 : see if this is a sys/utsname.h system
20899 set sys/utsname.h i_sysutsname
20900 eval $inhdr
20901
20902 : see if this is a syswait system
20903 set sys/wait.h i_syswait
20904 eval $inhdr
20905
20906 : see if this is a ustat.h system
20907 set ustat.h i_ustat
20908 eval $inhdr
20909
20910 : see if this is an utime system
20911 set utime.h i_utime
20912 eval $inhdr
20913
20914 : see if this is a values.h system
20915 set values.h i_values
20916 eval $inhdr
20917
20918 : see if this is a vfork system
20919 case "$d_vfork" in
20920 "$define")
20921         set vfork.h i_vfork
20922         eval $inhdr
20923         ;;
20924 *)
20925         i_vfork="$undef"
20926         ;;
20927 esac
20928
20929 echo " "
20930 echo "Looking for extensions..." >&4
20931 : If we are using the old config.sh, known_extensions may contain
20932 : old or inaccurate or duplicate values.
20933 known_extensions=''
20934 nonxs_extensions=''
20935 : We do not use find because it might not be available.
20936 : We do not just use MANIFEST because the user may have dropped
20937 : some additional extensions into the source tree and expect them
20938 : to be built.
20939
20940 : Function to recursively find available extensions, ignoring DynaLoader
20941 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20942 find_extensions='
20943     for xxx in *; do
20944        case "$xxx" in
20945            DynaLoader|dynaload) ;;
20946            *)
20947            if $test -f $xxx/$xxx.xs; then
20948                known_extensions="$known_extensions $1$xxx";
20949            elif $test -f $xxx/Makefile.PL; then
20950                nonxs_extensions="$nonxs_extensions $1$xxx";
20951            else
20952                if $test -d $xxx -a $# -lt 10; then
20953                    set $1$xxx/ $*;
20954                    cd "$xxx";
20955                    eval $find_extensions;
20956                    cd ..;
20957                    shift;
20958                fi;
20959            fi
20960            ;;
20961        esac;
20962     done'
20963 tdir=`pwd`
20964 cd "$rsrc/ext"
20965 set X
20966 shift
20967 eval $find_extensions
20968 # Special case:  Add in threads/shared since it is not picked up by the
20969 # recursive find above (and adding in general recursive finding breaks
20970 # SDBM_File/sdbm).  A.D.  10/25/2001.
20971 known_extensions="$known_extensions threads/shared"
20972 set X $nonxs_extensions
20973 shift
20974 nonxs_extensions="$*"
20975 set X $known_extensions
20976 shift
20977 known_extensions="$*"
20978 cd "$tdir"
20979
20980 : Now see which are supported on this system.
20981 avail_ext=''
20982 for xxx in $known_extensions ; do
20983         case "$xxx" in
20984         DB_File|db_file)
20985                 case "$i_db" in
20986                 $define) avail_ext="$avail_ext $xxx" ;;
20987                 esac
20988                 ;;
20989         GDBM_File|gdbm_fil)
20990                 case "$i_gdbm" in 
20991                 $define) avail_ext="$avail_ext $xxx" ;;
20992                 esac
20993                 ;;
20994         I18N/Langinfo|i18n_lan)
20995                 case "$i_langinfo$d_nl_langinfo" in 
20996                 $define$define) avail_ext="$avail_ext $xxx" ;;
20997                 esac
20998                 ;;
20999         NDBM_File|ndbm_fil)
21000                 case "$i_ndbm" in
21001                 $define)
21002                     case "$osname-$use64bitint" in
21003                     hpux-define)
21004                         case "$libs" in
21005                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21006                         esac
21007                         ;;
21008                     *) avail_ext="$avail_ext $xxx" ;;
21009                     esac
21010                     ;;
21011                 esac
21012                 ;;
21013         ODBM_File|odbm_fil) 
21014                 case "${i_dbm}${i_rpcsvcdbm}" in
21015                 *"${define}"*)
21016                     case "$osname-$use64bitint" in
21017                     hpux-define)
21018                         case "$libs" in
21019                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21020                         esac
21021                         ;;
21022                     *) avail_ext="$avail_ext $xxx" ;;
21023                     esac
21024                     ;;
21025                 esac
21026                 ;;
21027         POSIX|posix)
21028                 case "$useposix" in
21029                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21030                 esac
21031                 ;;
21032         Opcode|opcode)
21033                 case "$useopcode" in
21034                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21035                 esac
21036                 ;;
21037         Socket|socket)
21038                 case "$d_socket" in 
21039                 true|$define|y)
21040                     case "$osname" in
21041                     beos) ;; # not unless BONE
21042                     *) avail_ext="$avail_ext $xxx" ;;
21043                     esac
21044                     ;;
21045                 esac
21046                 ;;
21047         Sys/Syslog|sys/syslog)
21048                 : XXX syslog requires socket
21049                 case "$d_socket" in 
21050                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21051                 esac
21052                 ;;
21053         Thread|thread)
21054                 case "$usethreads" in
21055                 true|$define|y)
21056                         case "$useithreads" in
21057                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21058                         esac
21059                 esac
21060                 ;;
21061         XS/APItest|xs/apitest)
21062                 # This is just for testing.  Skip it unless we have dynamic loading.
21063
21064                 case "$usedl" in
21065                 $define) avail_ext="$avail_ext $xxx" ;;
21066                 esac
21067                 ;;
21068         XS/Typemap|xs/typemap)
21069                 # This is just for testing.  Skip it unless we have dynamic loading.
21070                 case "$usedl" in
21071                 $define) avail_ext="$avail_ext $xxx" ;;
21072                 esac
21073                 ;;
21074         threads|threads/shared)
21075                 # threads and threads::shared are special cases.
21076                 # To stop people from asking "Perl 5.8.0 was supposed
21077                 # to have this new fancy threads implementation but my
21078                 # perl doesn't have it" and from people trying to
21079                 # (re)install the threads module using CPAN.pm and
21080                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21081                 # the threads.pm and threads/shared.pm will always be
21082                 # there, croaking informatively ("you need to rebuild
21083                 # all of Perl with threads, sorry") when threads haven't
21084                 # been compiled in.
21085                 # --jhi
21086                 avail_ext="$avail_ext $xxx"
21087                 ;;
21088         IPC/SysV|ipc/sysv)
21089                 : XXX Do we need a useipcsysv variable here
21090                 case "${d_msg}${d_sem}${d_shm}" in 
21091                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21092                 esac
21093                 ;;
21094         *)      avail_ext="$avail_ext $xxx"
21095                 ;;
21096         esac
21097 done
21098
21099 set X $avail_ext
21100 shift
21101 avail_ext="$*"
21102
21103 case "$onlyextensions" in
21104 '') ;;
21105 *)  keepextensions=''
21106     echo "You have requested that only certains extensions be included..." >&4
21107     for i in $onlyextensions; do
21108         case " $avail_ext " in
21109         *" $i "*)
21110             echo "Keeping extension $i."
21111             keepextensions="$keepextensions $i"
21112             ;;
21113         *) echo "Ignoring extension $i." ;;
21114         esac
21115     done
21116     avail_ext="$keepextensions"
21117     ;;
21118 esac
21119
21120 case "$noextensions" in
21121 '') ;;
21122 *)  keepextensions=''
21123     echo "You have requested that certain extensions be ignored..." >&4
21124     for i in $avail_ext; do
21125         case " $noextensions " in
21126         *" $i "*) echo "Ignoring extension $i." ;;
21127         *) echo "Keeping extension $i.";
21128            keepextensions="$keepextensions $i"
21129            ;;
21130         esac
21131     done
21132     avail_ext="$keepextensions"
21133     ;;
21134 esac
21135
21136 : Now see which nonxs extensions are supported on this system.
21137 : For now assume all are.
21138 nonxs_ext=''
21139 for xxx in $nonxs_extensions ; do
21140         case "$xxx" in
21141         *)      nonxs_ext="$nonxs_ext $xxx"
21142                 ;;
21143         esac
21144 done
21145
21146 set X $nonxs_ext
21147 shift
21148 nonxs_ext="$*"
21149
21150 case $usedl in
21151 $define)
21152         $cat <<EOM
21153 A number of extensions are supplied with $package.  You may choose to
21154 compile these extensions for dynamic loading (the default), compile
21155 them into the $package executable (static loading), or not include
21156 them at all.  Answer "none" to include no extensions.
21157 Note that DynaLoader is always built and need not be mentioned here.
21158
21159 EOM
21160         case "$dynamic_ext" in
21161         '')
21162                 : Exclude those listed in static_ext
21163                 dflt=''
21164                 for xxx in $avail_ext; do
21165                         case " $static_ext " in
21166                         *" $xxx "*) ;;
21167                         *) dflt="$dflt $xxx" ;;
21168                         esac
21169                 done
21170                 set X $dflt
21171                 shift
21172                 dflt="$*"
21173                 ;;
21174         *)      dflt="$dynamic_ext"
21175                 # Perhaps we are reusing an old out-of-date config.sh.
21176                 case "$hint" in
21177                 previous)
21178                         if test X"$dynamic_ext" != X"$avail_ext"; then
21179                                 $cat <<EOM
21180 NOTICE:  Your previous config.sh list may be incorrect. 
21181 The extensions now available to you are 
21182         ${avail_ext}
21183 but the default list from your previous config.sh is
21184         ${dynamic_ext} 
21185
21186 EOM
21187                         fi
21188                         ;;
21189                 esac
21190                 ;;
21191         esac
21192         case "$dflt" in
21193         '')     dflt=none;;
21194         esac
21195         rp="What extensions do you wish to load dynamically?"
21196         . ./myread
21197         case "$ans" in
21198         none) dynamic_ext=' ' ;;
21199         *) dynamic_ext="$ans" ;;
21200         esac
21201
21202         case "$static_ext" in
21203         '')
21204                 : Exclude those already listed in dynamic linking
21205                 dflt=''
21206                 for xxx in $avail_ext; do
21207                         case " $dynamic_ext " in
21208                         *" $xxx "*) ;;
21209                         *) dflt="$dflt $xxx" ;;
21210                         esac
21211                 done
21212                 set X $dflt
21213                 shift
21214                 dflt="$*"
21215                 ;;
21216         *)  dflt="$static_ext" 
21217                 ;;
21218         esac
21219
21220         case "$dflt" in
21221         '')     dflt=none;;
21222         esac
21223         rp="What extensions do you wish to load statically?"
21224         . ./myread
21225         case "$ans" in
21226         none) static_ext=' ' ;;
21227         *) static_ext="$ans" ;;
21228         esac
21229         ;;
21230 *)
21231         $cat <<EOM
21232 A number of extensions are supplied with $package.  Answer "none" 
21233 to include no extensions. 
21234 Note that DynaLoader is always built and need not be mentioned here.
21235
21236 EOM
21237         case "$static_ext" in
21238         '') dflt="$avail_ext" ;;
21239         *)      dflt="$static_ext"
21240                 # Perhaps we are reusing an old out-of-date config.sh.
21241                 case "$hint" in
21242                 previous)
21243                         if test X"$static_ext" != X"$avail_ext"; then
21244                                 $cat <<EOM
21245 NOTICE:  Your previous config.sh list may be incorrect. 
21246 The extensions now available to you are 
21247         ${avail_ext}
21248 but the default list from your previous config.sh is
21249         ${static_ext} 
21250
21251 EOM
21252                         fi
21253                         ;;
21254                 esac
21255                 ;;
21256         esac
21257         : Exclude those that are not xs extensions
21258         case "$dflt" in
21259         '')     dflt=none;;
21260         esac
21261         rp="What extensions do you wish to include?"
21262         . ./myread
21263         case "$ans" in
21264         none) static_ext=' ' ;;
21265         *) static_ext="$ans" ;;
21266         esac
21267         ;;
21268 esac
21269 #        
21270 # Encode is a special case.  If we are building Encode as a static
21271 # extension, we need to explicitly list its subextensions as well.
21272 # For other nested extensions, this is handled automatically by
21273 # the appropriate Makefile.PL.
21274 case " $static_ext " in
21275         *" Encode "*) # Add the subextensions of Encode
21276         cd "$rsrc/ext"
21277         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21278                 static_ext="$static_ext Encode/$xxx"
21279         done
21280         cd "$tdir"
21281         ;;
21282 esac
21283
21284 set X $dynamic_ext $static_ext $nonxs_ext
21285 shift
21286 extensions="$*"
21287
21288 # Sanity check:  We require an extension suitable for use with
21289 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21290 # should show up as failures in the test suite, but it's helpful to
21291 # catch them now.) The 'extensions' list is normally sorted
21292 # alphabetically, so we need to accept either
21293 #    DB_File ... Fcntl ... IO  ....
21294 # or something like
21295 #    Fcntl ... NDBM_File ... IO  ....
21296 case " $extensions"  in
21297 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21298 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21299 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21300 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21301    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21302    ;;
21303 esac
21304
21305 : Remove libraries needed only for extensions
21306 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21307 : The exception is SunOS 4.x, which needs them.
21308 case "${osname}X${osvers}" in
21309 sunos*X4*)
21310     perllibs="$libs"
21311     ;;
21312 *) case "$usedl" in
21313     $define|true|[yY]*)
21314             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21315             shift
21316             perllibs="$*"
21317             ;;
21318     *)  perllibs="$libs"
21319             ;;
21320     esac
21321     ;;
21322 esac
21323
21324 : Remove build directory name from cppstdin so it can be used from
21325 : either the present location or the final installed location.
21326 echo " "
21327 : Get out of the UU directory to get correct path name.
21328 cd ..
21329 case "$cppstdin" in
21330 `pwd`/cppstdin)
21331         echo "Stripping down cppstdin path name"
21332         cppstdin=cppstdin
21333         ;;
21334 esac
21335 cd UU
21336
21337 : end of configuration questions
21338 echo " "
21339 echo "End of configuration questions."
21340 echo " "
21341
21342 : back to where it started
21343 if test -d ../UU; then
21344         cd ..
21345 fi
21346
21347 : configuration may be patched via a 'config.arch' file
21348 if $test -f config.arch; then
21349         echo "I see a config.arch file, loading it."
21350         . ./config.arch
21351 fi
21352
21353 : configuration may be patched via a 'config.over' file
21354 if $test -f config.over; then
21355         echo " "
21356         dflt=y
21357         rp='I see a config.over file.  Do you wish to load it?'
21358         . UU/myread
21359         case "$ans" in
21360         n*) echo "OK, I'll ignore it.";;
21361         *)      . ./config.over
21362                 echo "Configuration override changes have been loaded."
21363                 ;;
21364         esac
21365 fi
21366
21367 : in case they want portability, strip down executable paths
21368 case "$d_portable" in
21369 "$define")
21370         echo " "
21371         echo "Stripping down executable paths..." >&4
21372         for file in $loclist $trylist; do
21373                 eval temp=\$$file
21374                 eval $file=`basename $temp`
21375         done
21376         ;;
21377 esac
21378
21379 : create config.sh file
21380 echo " "
21381 echo "Creating config.sh..." >&4
21382 $spitshell <<EOT >config.sh
21383 $startsh
21384 #
21385 # This file was produced by running the Configure script. It holds all the
21386 # definitions figured out by Configure. Should you modify one of these values,
21387 # do not forget to propagate your changes by running "Configure -der". You may
21388 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21389 #
21390
21391 # Package name      : $package
21392 # Source directory  : $src
21393 # Configuration time: $cf_time
21394 # Configured by     : $cf_by
21395 # Target system     : $myuname
21396
21397 Author='$Author'
21398 Date='$Date'
21399 Header='$Header'
21400 Id='$Id'
21401 Locker='$Locker'
21402 Log='$Log'
21403 Mcc='$Mcc'
21404 RCSfile='$RCSfile'
21405 Revision='$Revision'
21406 Source='$Source'
21407 State='$State'
21408 _a='$_a'
21409 _exe='$_exe'
21410 _o='$_o'
21411 afs='$afs'
21412 afsroot='$afsroot'
21413 alignbytes='$alignbytes'
21414 ansi2knr='$ansi2knr'
21415 aphostname='$aphostname'
21416 api_revision='$api_revision'
21417 api_subversion='$api_subversion'
21418 api_version='$api_version'
21419 api_versionstring='$api_versionstring'
21420 ar='$ar'
21421 archlib='$archlib'
21422 archlibexp='$archlibexp'
21423 archname64='$archname64'
21424 archname='$archname'
21425 archobjs='$archobjs'
21426 asctime_r_proto='$asctime_r_proto'
21427 awk='$awk'
21428 baserev='$baserev'
21429 bash='$bash'
21430 bin='$bin'
21431 binexp='$binexp'
21432 bison='$bison'
21433 byacc='$byacc'
21434 byteorder='$byteorder'
21435 c='$c'
21436 castflags='$castflags'
21437 cat='$cat'
21438 cc='$cc'
21439 cccdlflags='$cccdlflags'
21440 ccdlflags='$ccdlflags'
21441 ccflags='$ccflags'
21442 ccflags_uselargefiles='$ccflags_uselargefiles'
21443 ccname='$ccname'
21444 ccsymbols='$ccsymbols'
21445 ccversion='$ccversion'
21446 cf_by='$cf_by'
21447 cf_email='$cf_email'
21448 cf_time='$cf_time'
21449 charsize='$charsize'
21450 chgrp='$chgrp'
21451 chmod='$chmod'
21452 chown='$chown'
21453 clocktype='$clocktype'
21454 comm='$comm'
21455 compress='$compress'
21456 contains='$contains'
21457 cp='$cp'
21458 cpio='$cpio'
21459 cpp='$cpp'
21460 cpp_stuff='$cpp_stuff'
21461 cppccsymbols='$cppccsymbols'
21462 cppflags='$cppflags'
21463 cpplast='$cpplast'
21464 cppminus='$cppminus'
21465 cpprun='$cpprun'
21466 cppstdin='$cppstdin'
21467 cppsymbols='$cppsymbols'
21468 crypt_r_proto='$crypt_r_proto'
21469 cryptlib='$cryptlib'
21470 csh='$csh'
21471 ctermid_r_proto='$ctermid_r_proto'
21472 ctime_r_proto='$ctime_r_proto'
21473 d_Gconvert='$d_Gconvert'
21474 d_PRIEUldbl='$d_PRIEUldbl'
21475 d_PRIFUldbl='$d_PRIFUldbl'
21476 d_PRIGUldbl='$d_PRIGUldbl'
21477 d_PRIXU64='$d_PRIXU64'
21478 d_PRId64='$d_PRId64'
21479 d_PRIeldbl='$d_PRIeldbl'
21480 d_PRIfldbl='$d_PRIfldbl'
21481 d_PRIgldbl='$d_PRIgldbl'
21482 d_PRIi64='$d_PRIi64'
21483 d_PRIo64='$d_PRIo64'
21484 d_PRIu64='$d_PRIu64'
21485 d_PRIx64='$d_PRIx64'
21486 d_SCNfldbl='$d_SCNfldbl'
21487 d__fwalk='$d__fwalk'
21488 d_access='$d_access'
21489 d_accessx='$d_accessx'
21490 d_aintl='$d_aintl'
21491 d_alarm='$d_alarm'
21492 d_archlib='$d_archlib'
21493 d_asctime_r='$d_asctime_r'
21494 d_atolf='$d_atolf'
21495 d_atoll='$d_atoll'
21496 d_attribute_format='$d_attribute_format'
21497 d_attribute_malloc='$d_attribute_malloc'
21498 d_attribute_nonnull='$d_attribute_nonnull'
21499 d_attribute_noreturn='$d_attribute_noreturn'
21500 d_attribute_pure='$d_attribute_pure'
21501 d_attribute_unused='$d_attribute_unused'
21502 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21503 d_bcmp='$d_bcmp'
21504 d_bcopy='$d_bcopy'
21505 d_bsd='$d_bsd'
21506 d_bsdgetpgrp='$d_bsdgetpgrp'
21507 d_bsdsetpgrp='$d_bsdsetpgrp'
21508 d_builtin_choose_expr='$d_builtin_choose_expr'
21509 d_builtin_expect='$d_builtin_expect'
21510 d_bzero='$d_bzero'
21511 d_c99_variadic_macros='$d_c99_variadic_macros'
21512 d_casti32='$d_casti32'
21513 d_castneg='$d_castneg'
21514 d_charvspr='$d_charvspr'
21515 d_chown='$d_chown'
21516 d_chroot='$d_chroot'
21517 d_chsize='$d_chsize'
21518 d_class='$d_class'
21519 d_clearenv='$d_clearenv'
21520 d_closedir='$d_closedir'
21521 d_cmsghdr_s='$d_cmsghdr_s'
21522 d_const='$d_const'
21523 d_copysignl='$d_copysignl'
21524 d_cplusplus='$d_cplusplus'
21525 d_crypt='$d_crypt'
21526 d_crypt_r='$d_crypt_r'
21527 d_csh='$d_csh'
21528 d_ctermid='$d_ctermid'
21529 d_ctermid_r='$d_ctermid_r'
21530 d_ctime_r='$d_ctime_r'
21531 d_cuserid='$d_cuserid'
21532 d_dbl_dig='$d_dbl_dig'
21533 d_dbminitproto='$d_dbminitproto'
21534 d_difftime='$d_difftime'
21535 d_dir_dd_fd='$d_dir_dd_fd'
21536 d_dirfd='$d_dirfd'
21537 d_dirnamlen='$d_dirnamlen'
21538 d_dlerror='$d_dlerror'
21539 d_dlopen='$d_dlopen'
21540 d_dlsymun='$d_dlsymun'
21541 d_dosuid='$d_dosuid'
21542 d_drand48_r='$d_drand48_r'
21543 d_drand48proto='$d_drand48proto'
21544 d_dup2='$d_dup2'
21545 d_eaccess='$d_eaccess'
21546 d_endgrent='$d_endgrent'
21547 d_endgrent_r='$d_endgrent_r'
21548 d_endhent='$d_endhent'
21549 d_endhostent_r='$d_endhostent_r'
21550 d_endnent='$d_endnent'
21551 d_endnetent_r='$d_endnetent_r'
21552 d_endpent='$d_endpent'
21553 d_endprotoent_r='$d_endprotoent_r'
21554 d_endpwent='$d_endpwent'
21555 d_endpwent_r='$d_endpwent_r'
21556 d_endsent='$d_endsent'
21557 d_endservent_r='$d_endservent_r'
21558 d_eofnblk='$d_eofnblk'
21559 d_eunice='$d_eunice'
21560 d_faststdio='$d_faststdio'
21561 d_fchdir='$d_fchdir'
21562 d_fchmod='$d_fchmod'
21563 d_fchown='$d_fchown'
21564 d_fcntl='$d_fcntl'
21565 d_fcntl_can_lock='$d_fcntl_can_lock'
21566 d_fd_macros='$d_fd_macros'
21567 d_fd_set='$d_fd_set'
21568 d_fds_bits='$d_fds_bits'
21569 d_fgetpos='$d_fgetpos'
21570 d_finite='$d_finite'
21571 d_finitel='$d_finitel'
21572 d_flexfnam='$d_flexfnam'
21573 d_flock='$d_flock'
21574 d_flockproto='$d_flockproto'
21575 d_fork='$d_fork'
21576 d_fp_class='$d_fp_class'
21577 d_fpathconf='$d_fpathconf'
21578 d_fpclass='$d_fpclass'
21579 d_fpclassify='$d_fpclassify'
21580 d_fpclassl='$d_fpclassl'
21581 d_fpos64_t='$d_fpos64_t'
21582 d_frexpl='$d_frexpl'
21583 d_fs_data_s='$d_fs_data_s'
21584 d_fseeko='$d_fseeko'
21585 d_fsetpos='$d_fsetpos'
21586 d_fstatfs='$d_fstatfs'
21587 d_fstatvfs='$d_fstatvfs'
21588 d_fsync='$d_fsync'
21589 d_ftello='$d_ftello'
21590 d_ftime='$d_ftime'
21591 d_futimes='$d_futimes'
21592 d_getcwd='$d_getcwd'
21593 d_getespwnam='$d_getespwnam'
21594 d_getfsstat='$d_getfsstat'
21595 d_getgrent='$d_getgrent'
21596 d_getgrent_r='$d_getgrent_r'
21597 d_getgrgid_r='$d_getgrgid_r'
21598 d_getgrnam_r='$d_getgrnam_r'
21599 d_getgrps='$d_getgrps'
21600 d_gethbyaddr='$d_gethbyaddr'
21601 d_gethbyname='$d_gethbyname'
21602 d_gethent='$d_gethent'
21603 d_gethname='$d_gethname'
21604 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21605 d_gethostbyname_r='$d_gethostbyname_r'
21606 d_gethostent_r='$d_gethostent_r'
21607 d_gethostprotos='$d_gethostprotos'
21608 d_getitimer='$d_getitimer'
21609 d_getlogin='$d_getlogin'
21610 d_getlogin_r='$d_getlogin_r'
21611 d_getmnt='$d_getmnt'
21612 d_getmntent='$d_getmntent'
21613 d_getnbyaddr='$d_getnbyaddr'
21614 d_getnbyname='$d_getnbyname'
21615 d_getnent='$d_getnent'
21616 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21617 d_getnetbyname_r='$d_getnetbyname_r'
21618 d_getnetent_r='$d_getnetent_r'
21619 d_getnetprotos='$d_getnetprotos'
21620 d_getpagsz='$d_getpagsz'
21621 d_getpbyname='$d_getpbyname'
21622 d_getpbynumber='$d_getpbynumber'
21623 d_getpent='$d_getpent'
21624 d_getpgid='$d_getpgid'
21625 d_getpgrp2='$d_getpgrp2'
21626 d_getpgrp='$d_getpgrp'
21627 d_getppid='$d_getppid'
21628 d_getprior='$d_getprior'
21629 d_getprotobyname_r='$d_getprotobyname_r'
21630 d_getprotobynumber_r='$d_getprotobynumber_r'
21631 d_getprotoent_r='$d_getprotoent_r'
21632 d_getprotoprotos='$d_getprotoprotos'
21633 d_getprpwnam='$d_getprpwnam'
21634 d_getpwent='$d_getpwent'
21635 d_getpwent_r='$d_getpwent_r'
21636 d_getpwnam_r='$d_getpwnam_r'
21637 d_getpwuid_r='$d_getpwuid_r'
21638 d_getsbyname='$d_getsbyname'
21639 d_getsbyport='$d_getsbyport'
21640 d_getsent='$d_getsent'
21641 d_getservbyname_r='$d_getservbyname_r'
21642 d_getservbyport_r='$d_getservbyport_r'
21643 d_getservent_r='$d_getservent_r'
21644 d_getservprotos='$d_getservprotos'
21645 d_getspnam='$d_getspnam'
21646 d_getspnam_r='$d_getspnam_r'
21647 d_gettimeod='$d_gettimeod'
21648 d_gmtime_r='$d_gmtime_r'
21649 d_gnulibc='$d_gnulibc'
21650 d_grpasswd='$d_grpasswd'
21651 d_hasmntopt='$d_hasmntopt'
21652 d_htonl='$d_htonl'
21653 d_ilogbl='$d_ilogbl'
21654 d_inc_version_list='$d_inc_version_list'
21655 d_index='$d_index'
21656 d_inetaton='$d_inetaton'
21657 d_int64_t='$d_int64_t'
21658 d_isascii='$d_isascii'
21659 d_isfinite='$d_isfinite'
21660 d_isinf='$d_isinf'
21661 d_isnan='$d_isnan'
21662 d_isnanl='$d_isnanl'
21663 d_killpg='$d_killpg'
21664 d_lchown='$d_lchown'
21665 d_ldbl_dig='$d_ldbl_dig'
21666 d_libm_lib_version='$d_libm_lib_version'
21667 d_link='$d_link'
21668 d_localtime_r='$d_localtime_r'
21669 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21670 d_locconv='$d_locconv'
21671 d_lockf='$d_lockf'
21672 d_longdbl='$d_longdbl'
21673 d_longlong='$d_longlong'
21674 d_lseekproto='$d_lseekproto'
21675 d_lstat='$d_lstat'
21676 d_madvise='$d_madvise'
21677 d_malloc_good_size='$d_malloc_good_size'
21678 d_malloc_size='$d_malloc_size'
21679 d_mblen='$d_mblen'
21680 d_mbstowcs='$d_mbstowcs'
21681 d_mbtowc='$d_mbtowc'
21682 d_memchr='$d_memchr'
21683 d_memcmp='$d_memcmp'
21684 d_memcpy='$d_memcpy'
21685 d_memmove='$d_memmove'
21686 d_memset='$d_memset'
21687 d_mkdir='$d_mkdir'
21688 d_mkdtemp='$d_mkdtemp'
21689 d_mkfifo='$d_mkfifo'
21690 d_mkstemp='$d_mkstemp'
21691 d_mkstemps='$d_mkstemps'
21692 d_mktime='$d_mktime'
21693 d_mmap='$d_mmap'
21694 d_modfl='$d_modfl'
21695 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21696 d_modflproto='$d_modflproto'
21697 d_mprotect='$d_mprotect'
21698 d_msg='$d_msg'
21699 d_msg_ctrunc='$d_msg_ctrunc'
21700 d_msg_dontroute='$d_msg_dontroute'
21701 d_msg_oob='$d_msg_oob'
21702 d_msg_peek='$d_msg_peek'
21703 d_msg_proxy='$d_msg_proxy'
21704 d_msgctl='$d_msgctl'
21705 d_msgget='$d_msgget'
21706 d_msghdr_s='$d_msghdr_s'
21707 d_msgrcv='$d_msgrcv'
21708 d_msgsnd='$d_msgsnd'
21709 d_msync='$d_msync'
21710 d_munmap='$d_munmap'
21711 d_mymalloc='$d_mymalloc'
21712 d_nice='$d_nice'
21713 d_nl_langinfo='$d_nl_langinfo'
21714 d_nv_preserves_uv='$d_nv_preserves_uv'
21715 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21716 d_off64_t='$d_off64_t'
21717 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21718 d_oldpthreads='$d_oldpthreads'
21719 d_oldsock='$d_oldsock'
21720 d_open3='$d_open3'
21721 d_pathconf='$d_pathconf'
21722 d_pause='$d_pause'
21723 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21724 d_phostname='$d_phostname'
21725 d_pipe='$d_pipe'
21726 d_poll='$d_poll'
21727 d_portable='$d_portable'
21728 d_printf_format_null='$d_printf_format_null'
21729 d_procselfexe='$d_procselfexe'
21730 d_pthread_atfork='$d_pthread_atfork'
21731 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21732 d_pthread_yield='$d_pthread_yield'
21733 d_pwage='$d_pwage'
21734 d_pwchange='$d_pwchange'
21735 d_pwclass='$d_pwclass'
21736 d_pwcomment='$d_pwcomment'
21737 d_pwexpire='$d_pwexpire'
21738 d_pwgecos='$d_pwgecos'
21739 d_pwpasswd='$d_pwpasswd'
21740 d_pwquota='$d_pwquota'
21741 d_qgcvt='$d_qgcvt'
21742 d_quad='$d_quad'
21743 d_random_r='$d_random_r'
21744 d_readdir64_r='$d_readdir64_r'
21745 d_readdir='$d_readdir'
21746 d_readdir_r='$d_readdir_r'
21747 d_readlink='$d_readlink'
21748 d_readv='$d_readv'
21749 d_recvmsg='$d_recvmsg'
21750 d_rename='$d_rename'
21751 d_rewinddir='$d_rewinddir'
21752 d_rmdir='$d_rmdir'
21753 d_safebcpy='$d_safebcpy'
21754 d_safemcpy='$d_safemcpy'
21755 d_sanemcmp='$d_sanemcmp'
21756 d_sbrkproto='$d_sbrkproto'
21757 d_scalbnl='$d_scalbnl'
21758 d_sched_yield='$d_sched_yield'
21759 d_scm_rights='$d_scm_rights'
21760 d_seekdir='$d_seekdir'
21761 d_select='$d_select'
21762 d_sem='$d_sem'
21763 d_semctl='$d_semctl'
21764 d_semctl_semid_ds='$d_semctl_semid_ds'
21765 d_semctl_semun='$d_semctl_semun'
21766 d_semget='$d_semget'
21767 d_semop='$d_semop'
21768 d_sendmsg='$d_sendmsg'
21769 d_setegid='$d_setegid'
21770 d_seteuid='$d_seteuid'
21771 d_setgrent='$d_setgrent'
21772 d_setgrent_r='$d_setgrent_r'
21773 d_setgrps='$d_setgrps'
21774 d_sethent='$d_sethent'
21775 d_sethostent_r='$d_sethostent_r'
21776 d_setitimer='$d_setitimer'
21777 d_setlinebuf='$d_setlinebuf'
21778 d_setlocale='$d_setlocale'
21779 d_setlocale_r='$d_setlocale_r'
21780 d_setnent='$d_setnent'
21781 d_setnetent_r='$d_setnetent_r'
21782 d_setpent='$d_setpent'
21783 d_setpgid='$d_setpgid'
21784 d_setpgrp2='$d_setpgrp2'
21785 d_setpgrp='$d_setpgrp'
21786 d_setprior='$d_setprior'
21787 d_setproctitle='$d_setproctitle'
21788 d_setprotoent_r='$d_setprotoent_r'
21789 d_setpwent='$d_setpwent'
21790 d_setpwent_r='$d_setpwent_r'
21791 d_setregid='$d_setregid'
21792 d_setresgid='$d_setresgid'
21793 d_setresuid='$d_setresuid'
21794 d_setreuid='$d_setreuid'
21795 d_setrgid='$d_setrgid'
21796 d_setruid='$d_setruid'
21797 d_setsent='$d_setsent'
21798 d_setservent_r='$d_setservent_r'
21799 d_setsid='$d_setsid'
21800 d_setvbuf='$d_setvbuf'
21801 d_sfio='$d_sfio'
21802 d_shm='$d_shm'
21803 d_shmat='$d_shmat'
21804 d_shmatprototype='$d_shmatprototype'
21805 d_shmctl='$d_shmctl'
21806 d_shmdt='$d_shmdt'
21807 d_shmget='$d_shmget'
21808 d_sigaction='$d_sigaction'
21809 d_sigprocmask='$d_sigprocmask'
21810 d_sigsetjmp='$d_sigsetjmp'
21811 d_sitearch='$d_sitearch'
21812 d_snprintf='$d_snprintf'
21813 d_sockatmark='$d_sockatmark'
21814 d_sockatmarkproto='$d_sockatmarkproto'
21815 d_socket='$d_socket'
21816 d_socklen_t='$d_socklen_t'
21817 d_sockpair='$d_sockpair'
21818 d_socks5_init='$d_socks5_init'
21819 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21820 d_sqrtl='$d_sqrtl'
21821 d_srand48_r='$d_srand48_r'
21822 d_srandom_r='$d_srandom_r'
21823 d_sresgproto='$d_sresgproto'
21824 d_sresuproto='$d_sresuproto'
21825 d_statblks='$d_statblks'
21826 d_statfs_f_flags='$d_statfs_f_flags'
21827 d_statfs_s='$d_statfs_s'
21828 d_statvfs='$d_statvfs'
21829 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21830 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21831 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21832 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21833 d_stdio_stream_array='$d_stdio_stream_array'
21834 d_stdiobase='$d_stdiobase'
21835 d_stdstdio='$d_stdstdio'
21836 d_strchr='$d_strchr'
21837 d_strcoll='$d_strcoll'
21838 d_strctcpy='$d_strctcpy'
21839 d_strerrm='$d_strerrm'
21840 d_strerror='$d_strerror'
21841 d_strerror_r='$d_strerror_r'
21842 d_strftime='$d_strftime'
21843 d_strlcat='$d_strlcat'
21844 d_strlcpy='$d_strlcpy'
21845 d_strtod='$d_strtod'
21846 d_strtol='$d_strtol'
21847 d_strtold='$d_strtold'
21848 d_strtoll='$d_strtoll'
21849 d_strtoq='$d_strtoq'
21850 d_strtoul='$d_strtoul'
21851 d_strtoull='$d_strtoull'
21852 d_strtouq='$d_strtouq'
21853 d_strxfrm='$d_strxfrm'
21854 d_suidsafe='$d_suidsafe'
21855 d_symlink='$d_symlink'
21856 d_syscall='$d_syscall'
21857 d_syscallproto='$d_syscallproto'
21858 d_sysconf='$d_sysconf'
21859 d_sysernlst='$d_sysernlst'
21860 d_syserrlst='$d_syserrlst'
21861 d_system='$d_system'
21862 d_tcgetpgrp='$d_tcgetpgrp'
21863 d_tcsetpgrp='$d_tcsetpgrp'
21864 d_telldir='$d_telldir'
21865 d_telldirproto='$d_telldirproto'
21866 d_time='$d_time'
21867 d_times='$d_times'
21868 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21869 d_tm_tm_zone='$d_tm_tm_zone'
21870 d_tmpnam_r='$d_tmpnam_r'
21871 d_truncate='$d_truncate'
21872 d_ttyname_r='$d_ttyname_r'
21873 d_tzname='$d_tzname'
21874 d_u32align='$d_u32align'
21875 d_ualarm='$d_ualarm'
21876 d_umask='$d_umask'
21877 d_uname='$d_uname'
21878 d_union_semun='$d_union_semun'
21879 d_unordered='$d_unordered'
21880 d_unsetenv='$d_unsetenv'
21881 d_usleep='$d_usleep'
21882 d_usleepproto='$d_usleepproto'
21883 d_ustat='$d_ustat'
21884 d_vendorarch='$d_vendorarch'
21885 d_vendorbin='$d_vendorbin'
21886 d_vendorlib='$d_vendorlib'
21887 d_vendorscript='$d_vendorscript'
21888 d_vfork='$d_vfork'
21889 d_void_closedir='$d_void_closedir'
21890 d_voidsig='$d_voidsig'
21891 d_voidtty='$d_voidtty'
21892 d_volatile='$d_volatile'
21893 d_vprintf='$d_vprintf'
21894 d_vsnprintf='$d_vsnprintf'
21895 d_wait4='$d_wait4'
21896 d_waitpid='$d_waitpid'
21897 d_wcstombs='$d_wcstombs'
21898 d_wctomb='$d_wctomb'
21899 d_writev='$d_writev'
21900 d_xenix='$d_xenix'
21901 date='$date'
21902 db_hashtype='$db_hashtype'
21903 db_prefixtype='$db_prefixtype'
21904 db_version_major='$db_version_major'
21905 db_version_minor='$db_version_minor'
21906 db_version_patch='$db_version_patch'
21907 defvoidused='$defvoidused'
21908 direntrytype='$direntrytype'
21909 dlext='$dlext'
21910 dlsrc='$dlsrc'
21911 doublesize='$doublesize'
21912 drand01='$drand01'
21913 drand48_r_proto='$drand48_r_proto'
21914 dynamic_ext='$dynamic_ext'
21915 eagain='$eagain'
21916 ebcdic='$ebcdic'
21917 echo='$echo'
21918 egrep='$egrep'
21919 emacs='$emacs'
21920 endgrent_r_proto='$endgrent_r_proto'
21921 endhostent_r_proto='$endhostent_r_proto'
21922 endnetent_r_proto='$endnetent_r_proto'
21923 endprotoent_r_proto='$endprotoent_r_proto'
21924 endpwent_r_proto='$endpwent_r_proto'
21925 endservent_r_proto='$endservent_r_proto'
21926 eunicefix='$eunicefix'
21927 exe_ext='$exe_ext'
21928 expr='$expr'
21929 extensions='$extensions'
21930 extras='$extras'
21931 fflushNULL='$fflushNULL'
21932 fflushall='$fflushall'
21933 find='$find'
21934 firstmakefile='$firstmakefile'
21935 flex='$flex'
21936 fpossize='$fpossize'
21937 fpostype='$fpostype'
21938 freetype='$freetype'
21939 from='$from'
21940 full_ar='$full_ar'
21941 full_csh='$full_csh'
21942 full_sed='$full_sed'
21943 gccansipedantic='$gccansipedantic'
21944 gccosandvers='$gccosandvers'
21945 gccversion='$gccversion'
21946 getgrent_r_proto='$getgrent_r_proto'
21947 getgrgid_r_proto='$getgrgid_r_proto'
21948 getgrnam_r_proto='$getgrnam_r_proto'
21949 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21950 gethostbyname_r_proto='$gethostbyname_r_proto'
21951 gethostent_r_proto='$gethostent_r_proto'
21952 getlogin_r_proto='$getlogin_r_proto'
21953 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21954 getnetbyname_r_proto='$getnetbyname_r_proto'
21955 getnetent_r_proto='$getnetent_r_proto'
21956 getprotobyname_r_proto='$getprotobyname_r_proto'
21957 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21958 getprotoent_r_proto='$getprotoent_r_proto'
21959 getpwent_r_proto='$getpwent_r_proto'
21960 getpwnam_r_proto='$getpwnam_r_proto'
21961 getpwuid_r_proto='$getpwuid_r_proto'
21962 getservbyname_r_proto='$getservbyname_r_proto'
21963 getservbyport_r_proto='$getservbyport_r_proto'
21964 getservent_r_proto='$getservent_r_proto'
21965 getspnam_r_proto='$getspnam_r_proto'
21966 gidformat='$gidformat'
21967 gidsign='$gidsign'
21968 gidsize='$gidsize'
21969 gidtype='$gidtype'
21970 glibpth='$glibpth'
21971 gmake='$gmake'
21972 gmtime_r_proto='$gmtime_r_proto'
21973 gnulibc_version='$gnulibc_version'
21974 grep='$grep'
21975 groupcat='$groupcat'
21976 groupstype='$groupstype'
21977 gzip='$gzip'
21978 h_fcntl='$h_fcntl'
21979 h_sysfile='$h_sysfile'
21980 hint='$hint'
21981 hostcat='$hostcat'
21982 html1dir='$html1dir'
21983 html1direxp='$html1direxp'
21984 html3dir='$html3dir'
21985 html3direxp='$html3direxp'
21986 i16size='$i16size'
21987 i16type='$i16type'
21988 i32size='$i32size'
21989 i32type='$i32type'
21990 i64size='$i64size'
21991 i64type='$i64type'
21992 i8size='$i8size'
21993 i8type='$i8type'
21994 i_arpainet='$i_arpainet'
21995 i_bsdioctl='$i_bsdioctl'
21996 i_crypt='$i_crypt'
21997 i_db='$i_db'
21998 i_dbm='$i_dbm'
21999 i_dirent='$i_dirent'
22000 i_dld='$i_dld'
22001 i_dlfcn='$i_dlfcn'
22002 i_fcntl='$i_fcntl'
22003 i_float='$i_float'
22004 i_fp='$i_fp'
22005 i_fp_class='$i_fp_class'
22006 i_gdbm='$i_gdbm'
22007 i_grp='$i_grp'
22008 i_ieeefp='$i_ieeefp'
22009 i_inttypes='$i_inttypes'
22010 i_langinfo='$i_langinfo'
22011 i_libutil='$i_libutil'
22012 i_limits='$i_limits'
22013 i_locale='$i_locale'
22014 i_machcthr='$i_machcthr'
22015 i_malloc='$i_malloc'
22016 i_math='$i_math'
22017 i_memory='$i_memory'
22018 i_mntent='$i_mntent'
22019 i_ndbm='$i_ndbm'
22020 i_netdb='$i_netdb'
22021 i_neterrno='$i_neterrno'
22022 i_netinettcp='$i_netinettcp'
22023 i_niin='$i_niin'
22024 i_poll='$i_poll'
22025 i_prot='$i_prot'
22026 i_pthread='$i_pthread'
22027 i_pwd='$i_pwd'
22028 i_rpcsvcdbm='$i_rpcsvcdbm'
22029 i_sfio='$i_sfio'
22030 i_sgtty='$i_sgtty'
22031 i_shadow='$i_shadow'
22032 i_socks='$i_socks'
22033 i_stdarg='$i_stdarg'
22034 i_stddef='$i_stddef'
22035 i_stdlib='$i_stdlib'
22036 i_string='$i_string'
22037 i_sunmath='$i_sunmath'
22038 i_sysaccess='$i_sysaccess'
22039 i_sysdir='$i_sysdir'
22040 i_sysfile='$i_sysfile'
22041 i_sysfilio='$i_sysfilio'
22042 i_sysin='$i_sysin'
22043 i_sysioctl='$i_sysioctl'
22044 i_syslog='$i_syslog'
22045 i_sysmman='$i_sysmman'
22046 i_sysmode='$i_sysmode'
22047 i_sysmount='$i_sysmount'
22048 i_sysndir='$i_sysndir'
22049 i_sysparam='$i_sysparam'
22050 i_sysresrc='$i_sysresrc'
22051 i_syssecrt='$i_syssecrt'
22052 i_sysselct='$i_sysselct'
22053 i_syssockio='$i_syssockio'
22054 i_sysstat='$i_sysstat'
22055 i_sysstatfs='$i_sysstatfs'
22056 i_sysstatvfs='$i_sysstatvfs'
22057 i_systime='$i_systime'
22058 i_systimek='$i_systimek'
22059 i_systimes='$i_systimes'
22060 i_systypes='$i_systypes'
22061 i_sysuio='$i_sysuio'
22062 i_sysun='$i_sysun'
22063 i_sysutsname='$i_sysutsname'
22064 i_sysvfs='$i_sysvfs'
22065 i_syswait='$i_syswait'
22066 i_termio='$i_termio'
22067 i_termios='$i_termios'
22068 i_time='$i_time'
22069 i_unistd='$i_unistd'
22070 i_ustat='$i_ustat'
22071 i_utime='$i_utime'
22072 i_values='$i_values'
22073 i_varargs='$i_varargs'
22074 i_varhdr='$i_varhdr'
22075 i_vfork='$i_vfork'
22076 ignore_versioned_solibs='$ignore_versioned_solibs'
22077 inc_version_list='$inc_version_list'
22078 inc_version_list_init='$inc_version_list_init'
22079 incpath='$incpath'
22080 inews='$inews'
22081 initialinstalllocation='$initialinstalllocation'
22082 installarchlib='$installarchlib'
22083 installbin='$installbin'
22084 installhtml1dir='$installhtml1dir'
22085 installhtml3dir='$installhtml3dir'
22086 installman1dir='$installman1dir'
22087 installman3dir='$installman3dir'
22088 installprefix='$installprefix'
22089 installprefixexp='$installprefixexp'
22090 installprivlib='$installprivlib'
22091 installscript='$installscript'
22092 installsitearch='$installsitearch'
22093 installsitebin='$installsitebin'
22094 installsitehtml1dir='$installsitehtml1dir'
22095 installsitehtml3dir='$installsitehtml3dir'
22096 installsitelib='$installsitelib'
22097 installsiteman1dir='$installsiteman1dir'
22098 installsiteman3dir='$installsiteman3dir'
22099 installsitescript='$installsitescript'
22100 installstyle='$installstyle'
22101 installusrbinperl='$installusrbinperl'
22102 installvendorarch='$installvendorarch'
22103 installvendorbin='$installvendorbin'
22104 installvendorhtml1dir='$installvendorhtml1dir'
22105 installvendorhtml3dir='$installvendorhtml3dir'
22106 installvendorlib='$installvendorlib'
22107 installvendorman1dir='$installvendorman1dir'
22108 installvendorman3dir='$installvendorman3dir'
22109 installvendorscript='$installvendorscript'
22110 intsize='$intsize'
22111 issymlink='$issymlink'
22112 ivdformat='$ivdformat'
22113 ivsize='$ivsize'
22114 ivtype='$ivtype'
22115 known_extensions='$known_extensions'
22116 ksh='$ksh'
22117 ld='$ld'
22118 lddlflags='$lddlflags'
22119 ldflags='$ldflags'
22120 ldflags_uselargefiles='$ldflags_uselargefiles'
22121 ldlibpthname='$ldlibpthname'
22122 less='$less'
22123 lib_ext='$lib_ext'
22124 libc='$libc'
22125 libperl='$libperl'
22126 libpth='$libpth'
22127 libs='$libs'
22128 libsdirs='$libsdirs'
22129 libsfiles='$libsfiles'
22130 libsfound='$libsfound'
22131 libspath='$libspath'
22132 libswanted='$libswanted'
22133 libswanted_uselargefiles='$libswanted_uselargefiles'
22134 line='$line'
22135 lint='$lint'
22136 lkflags='$lkflags'
22137 ln='$ln'
22138 lns='$lns'
22139 localtime_r_proto='$localtime_r_proto'
22140 locincpth='$locincpth'
22141 loclibpth='$loclibpth'
22142 longdblsize='$longdblsize'
22143 longlongsize='$longlongsize'
22144 longsize='$longsize'
22145 lp='$lp'
22146 lpr='$lpr'
22147 ls='$ls'
22148 lseeksize='$lseeksize'
22149 lseektype='$lseektype'
22150 mad='$mad'
22151 madlyh='$madlyh'
22152 madlyobj='$madlyobj'
22153 madlysrc='$madlysrc'
22154 mail='$mail'
22155 mailx='$mailx'
22156 make='$make'
22157 make_set_make='$make_set_make'
22158 mallocobj='$mallocobj'
22159 mallocsrc='$mallocsrc'
22160 malloctype='$malloctype'
22161 man1dir='$man1dir'
22162 man1direxp='$man1direxp'
22163 man1ext='$man1ext'
22164 man3dir='$man3dir'
22165 man3direxp='$man3direxp'
22166 man3ext='$man3ext'
22167 mips_type='$mips_type'
22168 mistrustnm='$mistrustnm'
22169 mkdir='$mkdir'
22170 mmaptype='$mmaptype'
22171 modetype='$modetype'
22172 more='$more'
22173 multiarch='$multiarch'
22174 mv='$mv'
22175 myarchname='$myarchname'
22176 mydomain='$mydomain'
22177 myhostname='$myhostname'
22178 myuname='$myuname'
22179 n='$n'
22180 need_va_copy='$need_va_copy'
22181 netdb_hlen_type='$netdb_hlen_type'
22182 netdb_host_type='$netdb_host_type'
22183 netdb_name_type='$netdb_name_type'
22184 netdb_net_type='$netdb_net_type'
22185 nm='$nm'
22186 nm_opt='$nm_opt'
22187 nm_so_opt='$nm_so_opt'
22188 nonxs_ext='$nonxs_ext'
22189 nroff='$nroff'
22190 nvEUformat='$nvEUformat'
22191 nvFUformat='$nvFUformat'
22192 nvGUformat='$nvGUformat'
22193 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22194 nveformat='$nveformat'
22195 nvfformat='$nvfformat'
22196 nvgformat='$nvgformat'
22197 nvsize='$nvsize'
22198 nvtype='$nvtype'
22199 o_nonblock='$o_nonblock'
22200 obj_ext='$obj_ext'
22201 old_pthread_create_joinable='$old_pthread_create_joinable'
22202 optimize='$optimize'
22203 orderlib='$orderlib'
22204 osname='$osname'
22205 osvers='$osvers'
22206 otherlibdirs='$otherlibdirs'
22207 package='$package'
22208 pager='$pager'
22209 passcat='$passcat'
22210 patchlevel='$patchlevel'
22211 path_sep='$path_sep'
22212 perl5='$perl5'
22213 perl='$perl'
22214 perl_patchlevel='$perl_patchlevel'
22215 perladmin='$perladmin'
22216 perllibs='$perllibs'
22217 perlpath='$perlpath'
22218 pg='$pg'
22219 phostname='$phostname'
22220 pidtype='$pidtype'
22221 plibpth='$plibpth'
22222 pmake='$pmake'
22223 pr='$pr'
22224 prefix='$prefix'
22225 prefixexp='$prefixexp'
22226 privlib='$privlib'
22227 privlibexp='$privlibexp'
22228 procselfexe='$procselfexe'
22229 prototype='$prototype'
22230 ptrsize='$ptrsize'
22231 quadkind='$quadkind'
22232 quadtype='$quadtype'
22233 randbits='$randbits'
22234 randfunc='$randfunc'
22235 random_r_proto='$random_r_proto'
22236 randseedtype='$randseedtype'
22237 ranlib='$ranlib'
22238 rd_nodata='$rd_nodata'
22239 readdir64_r_proto='$readdir64_r_proto'
22240 readdir_r_proto='$readdir_r_proto'
22241 revision='$revision'
22242 rm='$rm'
22243 rmail='$rmail'
22244 run='$run'
22245 runnm='$runnm'
22246 sPRIEUldbl='$sPRIEUldbl'
22247 sPRIFUldbl='$sPRIFUldbl'
22248 sPRIGUldbl='$sPRIGUldbl'
22249 sPRIXU64='$sPRIXU64'
22250 sPRId64='$sPRId64'
22251 sPRIeldbl='$sPRIeldbl'
22252 sPRIfldbl='$sPRIfldbl'
22253 sPRIgldbl='$sPRIgldbl'
22254 sPRIi64='$sPRIi64'
22255 sPRIo64='$sPRIo64'
22256 sPRIu64='$sPRIu64'
22257 sPRIx64='$sPRIx64'
22258 sSCNfldbl='$sSCNfldbl'
22259 sched_yield='$sched_yield'
22260 scriptdir='$scriptdir'
22261 scriptdirexp='$scriptdirexp'
22262 sed='$sed'
22263 seedfunc='$seedfunc'
22264 selectminbits='$selectminbits'
22265 selecttype='$selecttype'
22266 sendmail='$sendmail'
22267 setgrent_r_proto='$setgrent_r_proto'
22268 sethostent_r_proto='$sethostent_r_proto'
22269 setlocale_r_proto='$setlocale_r_proto'
22270 setnetent_r_proto='$setnetent_r_proto'
22271 setprotoent_r_proto='$setprotoent_r_proto'
22272 setpwent_r_proto='$setpwent_r_proto'
22273 setservent_r_proto='$setservent_r_proto'
22274 sh='$sh'
22275 shar='$shar'
22276 sharpbang='$sharpbang'
22277 shmattype='$shmattype'
22278 shortsize='$shortsize'
22279 shrpenv='$shrpenv'
22280 shsharp='$shsharp'
22281 sig_count='$sig_count'
22282 sig_name='$sig_name'
22283 sig_name_init='$sig_name_init'
22284 sig_num='$sig_num'
22285 sig_num_init='$sig_num_init'
22286 sig_size='$sig_size'
22287 signal_t='$signal_t'
22288 sitearch='$sitearch'
22289 sitearchexp='$sitearchexp'
22290 sitebin='$sitebin'
22291 sitebinexp='$sitebinexp'
22292 sitehtml1dir='$sitehtml1dir'
22293 sitehtml1direxp='$sitehtml1direxp'
22294 sitehtml3dir='$sitehtml3dir'
22295 sitehtml3direxp='$sitehtml3direxp'
22296 sitelib='$sitelib'
22297 sitelib_stem='$sitelib_stem'
22298 sitelibexp='$sitelibexp'
22299 siteman1dir='$siteman1dir'
22300 siteman1direxp='$siteman1direxp'
22301 siteman3dir='$siteman3dir'
22302 siteman3direxp='$siteman3direxp'
22303 siteprefix='$siteprefix'
22304 siteprefixexp='$siteprefixexp'
22305 sitescript='$sitescript'
22306 sitescriptexp='$sitescriptexp'
22307 sizesize='$sizesize'
22308 sizetype='$sizetype'
22309 sleep='$sleep'
22310 smail='$smail'
22311 so='$so'
22312 sockethdr='$sockethdr'
22313 socketlib='$socketlib'
22314 socksizetype='$socksizetype'
22315 sort='$sort'
22316 spackage='$spackage'
22317 spitshell='$spitshell'
22318 srand48_r_proto='$srand48_r_proto'
22319 srandom_r_proto='$srandom_r_proto'
22320 src='$src'
22321 ssizetype='$ssizetype'
22322 startperl='$startperl'
22323 startsh='$startsh'
22324 static_ext='$static_ext'
22325 stdchar='$stdchar'
22326 stdio_base='$stdio_base'
22327 stdio_bufsiz='$stdio_bufsiz'
22328 stdio_cnt='$stdio_cnt'
22329 stdio_filbuf='$stdio_filbuf'
22330 stdio_ptr='$stdio_ptr'
22331 stdio_stream_array='$stdio_stream_array'
22332 strerror_r_proto='$strerror_r_proto'
22333 strings='$strings'
22334 submit='$submit'
22335 subversion='$subversion'
22336 sysman='$sysman'
22337 tail='$tail'
22338 tar='$tar'
22339 targetarch='$targetarch'
22340 tbl='$tbl'
22341 tee='$tee'
22342 test='$test'
22343 timeincl='$timeincl'
22344 timetype='$timetype'
22345 tmpnam_r_proto='$tmpnam_r_proto'
22346 to='$to'
22347 touch='$touch'
22348 tr='$tr'
22349 trnl='$trnl'
22350 troff='$troff'
22351 ttyname_r_proto='$ttyname_r_proto'
22352 u16size='$u16size'
22353 u16type='$u16type'
22354 u32size='$u32size'
22355 u32type='$u32type'
22356 u64size='$u64size'
22357 u64type='$u64type'
22358 u8size='$u8size'
22359 u8type='$u8type'
22360 uidformat='$uidformat'
22361 uidsign='$uidsign'
22362 uidsize='$uidsize'
22363 uidtype='$uidtype'
22364 uname='$uname'
22365 uniq='$uniq'
22366 uquadtype='$uquadtype'
22367 use5005threads='$use5005threads'
22368 use64bitall='$use64bitall'
22369 use64bitint='$use64bitint'
22370 usecrosscompile='$usecrosscompile'
22371 usedl='$usedl'
22372 usefaststdio='$usefaststdio'
22373 useithreads='$useithreads'
22374 uselargefiles='$uselargefiles'
22375 uselongdouble='$uselongdouble'
22376 usemallocwrap='$usemallocwrap'
22377 usemorebits='$usemorebits'
22378 usemultiplicity='$usemultiplicity'
22379 usemymalloc='$usemymalloc'
22380 usenm='$usenm'
22381 useopcode='$useopcode'
22382 useperlio='$useperlio'
22383 useposix='$useposix'
22384 usereentrant='$usereentrant'
22385 userelocatableinc='$userelocatableinc'
22386 usesfio='$usesfio'
22387 useshrplib='$useshrplib'
22388 usesitecustomize='$usesitecustomize'
22389 usesocks='$usesocks'
22390 usethreads='$usethreads'
22391 usevendorprefix='$usevendorprefix'
22392 usevfork='$usevfork'
22393 usrinc='$usrinc'
22394 uuname='$uuname'
22395 uvXUformat='$uvXUformat'
22396 uvoformat='$uvoformat'
22397 uvsize='$uvsize'
22398 uvtype='$uvtype'
22399 uvuformat='$uvuformat'
22400 uvxformat='$uvxformat'
22401 vendorarch='$vendorarch'
22402 vendorarchexp='$vendorarchexp'
22403 vendorbin='$vendorbin'
22404 vendorbinexp='$vendorbinexp'
22405 vendorhtml1dir='$vendorhtml1dir'
22406 vendorhtml1direxp='$vendorhtml1direxp'
22407 vendorhtml3dir='$vendorhtml3dir'
22408 vendorhtml3direxp='$vendorhtml3direxp'
22409 vendorlib='$vendorlib'
22410 vendorlib_stem='$vendorlib_stem'
22411 vendorlibexp='$vendorlibexp'
22412 vendorman1dir='$vendorman1dir'
22413 vendorman1direxp='$vendorman1direxp'
22414 vendorman3dir='$vendorman3dir'
22415 vendorman3direxp='$vendorman3direxp'
22416 vendorprefix='$vendorprefix'
22417 vendorprefixexp='$vendorprefixexp'
22418 vendorscript='$vendorscript'
22419 vendorscriptexp='$vendorscriptexp'
22420 version='$version'
22421 version_patchlevel_string='$version_patchlevel_string'
22422 versiononly='$versiononly'
22423 vi='$vi'
22424 voidflags='$voidflags'
22425 xlibpth='$xlibpth'
22426 yacc='$yacc'
22427 yaccflags='$yaccflags'
22428 zcat='$zcat'
22429 zip='$zip'
22430 EOT
22431
22432 : Add in command line options if available
22433 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22434
22435 : add special variables
22436 $test -f $src/patchlevel.h && \
22437 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22438 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22439 echo "PERL_CONFIG_SH=true" >>config.sh
22440
22441 : propagate old symbols
22442 if $test -f UU/config.sh; then
22443         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22444         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22445         $sort | $uniq -u >UU/oldsyms
22446         set X `cat UU/oldsyms`
22447         shift
22448         case $# in
22449         0) ;;
22450         *)
22451                 cat <<EOM
22452 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22453 EOM
22454                 echo "# Variables propagated from previous config.sh file." >>config.sh
22455                 for sym in `cat UU/oldsyms`; do
22456                         echo "    Propagating $hint variable "'$'"$sym..."
22457                         eval 'tmp="$'"${sym}"'"'
22458                         echo "$tmp" | \
22459                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22460                 done
22461                 ;;
22462         esac
22463 fi
22464
22465 : Finish up by extracting the .SH files
22466 case "$alldone" in
22467 exit)
22468         $rm -rf UU
22469         echo "Extraction done."
22470         exit 0
22471         ;;
22472 cont)
22473         ;;
22474 '')
22475         dflt=''
22476         nostick=true
22477         $cat <<EOM
22478
22479 If you'd like to make any changes to the config.sh file before I begin
22480 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22481
22482 EOM
22483         rp="Press return or use a shell escape to edit config.sh:"
22484         . UU/myread
22485         nostick=''
22486         case "$ans" in
22487         '') ;;
22488         *) : in case they cannot read
22489                 sh 1>&4 -c "$ans";;
22490         esac
22491         ;;
22492 esac
22493
22494 : if this fails, just run all the .SH files by hand
22495 . ./config.sh
22496
22497 echo " "
22498 exec 1>&4
22499 pwd=`pwd`
22500 . ./UU/extract
22501 cd "$pwd"
22502
22503 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22504         dflt=y
22505         case "$silent" in
22506         true) ;;
22507         *)
22508                 $cat <<EOM
22509
22510 Now you need to generate make dependencies by running "$make depend".
22511 You might prefer to run it in background: "$make depend > makedepend.out &"
22512 It can take a while, so you might not want to run it right now.
22513
22514 EOM
22515                 ;;
22516         esac
22517         rp="Run $make depend now?"
22518         . UU/myread
22519         case "$ans" in
22520         y*)
22521                 $make depend && echo "Now you must run '$make'."
22522                 ;;
22523         *)
22524                 echo "You must run '$make depend' then '$make'."
22525                 ;;
22526         esac
22527 elif test -f [Mm]akefile; then
22528         echo " "
22529         echo "Now you must run a $make."
22530 else
22531         echo "Configure done."
22532 fi
22533
22534 if $test -f Policy.sh; then
22535     $cat <<EOM
22536
22537 If you compile $package on a different machine or from a different object
22538 directory, copy the Policy.sh file from this object directory to the
22539 new one before you run Configure -- this will help you with most of
22540 the policy defaults.
22541
22542 EOM
22543 fi
22544 if $test -f config.msg; then
22545     echo "Hmm.  I also noted the following information while running:"
22546     echo " "
22547     $cat config.msg >&4
22548     $rm -f config.msg
22549 fi
22550 $rm -f kit*isdone ark*isdone
22551 $rm -rf UU
22552
22553 : End of Configure
22554